Jump to content

KernelEx -- On building, debugging and related matters...


Drugwash

Recommended Posts

That looks great, Ley0k!

Would someone care to compile his repository, for some of us newbies?

It seems somewhat of a headache to compile. For starters, if you don't have or use the tools thats needed, then one must learn them all. This can be time consuming. I guess we will have to wait for someone to compile it.

I can compile it successfully and test it (otherwise I wouldn't even improve KernelEx lol).

As COMPILE.TXT says, you will need Microsoft Visual C++ 6.0 SP6 to compile.

I have been trying to compile the NSIS Installer (Kernelex.nsi) for a while now, but it keeps throwing up errors that it can't find files in the destination dir. These are the sections in the .NSI that caused the error:

  ;Files to install

;UpdateDLL_Func params:
;$R4 - target; $R5 - tempdir; $R6 - register?; $R7 - source
GetTempFileName $0 "$INSTDIR"
File /oname=$0 "output-i386\${FLAVOUR}\KernelEx.dll"
StrCpy $R4 "$INSTDIR\KernelEx.dll"
StrCpy $R6 "0"
StrCpy $R7 $0
Call UpgradeDLL_Func

GetTempFileName $0 "$INSTDIR"
File /oname=$0 "output-i386\${FLAVOUR}\kexbases.dll"
StrCpy $R4 "$INSTDIR\kexbases.dll"
StrCpy $R6 "0"
StrCpy $R7 $0
Call UpgradeDLL_Func

GetTempFileName $0 "$INSTDIR"
File /oname=$0 "output-i386\${FLAVOUR}\kexbasen.dll"
StrCpy $R4 "$INSTDIR\kexbasen.dll"
StrCpy $R6 "0"
StrCpy $R7 $0
Call UpgradeDLL_Func

GetTempFileName $0 "$INSTDIR"
File /oname=$0 "output-i386\${FLAVOUR}\sheet.dll"
StrCpy $R4 "$INSTDIR\sheet.dll"
StrCpy $R6 "1"
StrCpy $R7 $0
Call UpgradeDLL_Func

GetTempFileName $0 "$INSTDIR"
File /oname=$0 "output-i386\${FLAVOUR}\kexCOM.dll"
StrCpy $R4 "$INSTDIR\kexCOM.dll"
StrCpy $R6 "1"
StrCpy $R7 $0
Call UpgradeDLL_Func

SetOverwrite on

File apilibs\core.ini
File apilibs\settings.reg
File license.txt
File "Release Notes.txt"

GetTempFileName $0 "$INSTDIR"
File /oname=$0 "output-i386\${FLAVOUR}\VKrnlEx.vxd"
Delete "$INSTDIR\VKrnlEx.vxd"
Rename /REBOOTOK $0 "$INSTDIR\VKrnlEx.vxd"

GetTempFileName $0 "$INSTDIR"
File /oname=$0 output-i386\Release\msimg32.dll
Delete "$INSTDIR\msimg32.dll"
Rename /REBOOTOK $0 "$INSTDIR\msimg32.dll"
WriteRegStr HKLM "Software\KernelEx\KnownDLLs" \
"MSIMG32" "MSIMG32.DLL"

GetTempFileName $0 "$INSTDIR"
File /oname=$0 output-i386\Release\pdh.dll
Delete "$INSTDIR\pdh.dll"
Rename /REBOOTOK $0 "$INSTDIR\pdh.dll"
WriteRegStr HKLM "Software\KernelEx\KnownDLLs" \
"PDH" "PDH.DLL"

GetTempFileName $0 "$INSTDIR"
File /oname=$0 output-i386\Release\psapi.dll
Delete "$INSTDIR\psapi.dll"
Rename /REBOOTOK $0 "$INSTDIR\psapi.dll"
WriteRegStr HKLM "Software\KernelEx\KnownDLLs" \
"PSAPI" "PSAPI.DLL"

GetTempFileName $0 "$INSTDIR"
File /oname=$0 output-i386\Release\uxtheme.dll
Delete "$INSTDIR\uxtheme.dll"
Rename /REBOOTOK $0 "$INSTDIR\uxtheme.dll"
WriteRegStr HKLM "Software\KernelEx\KnownDLLs" \
"UXTHEME" "UXTHEME.DLL"

GetTempFileName $0 "$INSTDIR"
File /oname=$0 output-i386\Release\wtsapi32.dll
Delete "$INSTDIR\wtsapi32.dll"
Rename /REBOOTOK $0 "$INSTDIR\wtsapi32.dll"
WriteRegStr HKLM "Software\KernelEx\KnownDLLs" \
"WTSAPI32" "WTSAPI32.DLL"

GetTempFileName $0 "$INSTDIR"
File /oname=$0 output-i386\Release\userenv.dll
Delete "$INSTDIR\userenv.dll"
Rename /REBOOTOK $0 "$INSTDIR\userenv.dll"
WriteRegStr HKLM "Software\KernelEx\KnownDLLs" \
"USERENV" "USERENV.DLL"

(If I remove one of the lines that caused the error message, it will just move to the next file and bring up the same error message as well. Just removing those lines in the file would make no sense, because the files described in there are critical to the main functionality of KernelEx (I think))

This is the error message I get with or without removing the lines.

File: "output-i386\Debug\KernelEx.dll" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "C:\WINDOWS\Desktop\KernelEx-master\KernelEx.nsi" on line 244 -- aborting creation process

From what I can tell, It seems to create the installation directory (output-i386 or as NSIS would call it '$INSTDIR'), but it can't find any data in that directory, and that's a problem.

I also tried to compile some of the C++ .dsw files with VC++ 6.0, but it keeps telling me it can't execute (or find) rc.exe, cl.exe, etc.

Edited by coolman
Link to comment
Share on other sites


All the errors you get are due to incorrect/incomplete installation of the development environment. The file COMPILE.TXT in the root of the KernelEx source folder specifies the prerequisites:

- Visual C++ 6.0 SP6

- updated xtree header

- Platform SDK february 2003

- Windows 98/2000 DDK

In VC6 main menu > Tools > Options > Directories go through all items in the 'Show directories for' list and make sure the order of the items is as follows (that's important!):

Executable files

C:\Program Files\Microsoft Visual Studio\VC98\BIN

C:\Program Files\Microsoft Visual Studio\COMMON\MSDEV98\BIN

C:\Program Files\Microsoft Visual Studio\COMMON\TOOLS

C:\Program Files\Microsoft Visual Studio\COMMON\TOOLS\WIN95

C:\Program Files\Microsoft SDK\BIN

<other>

Include files

C:\Program Files\Microsoft SDK\INCLUDE

C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE

C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE

C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE

C:\Program Files\98DDK\INC\WIN98

<other>

Library files

C:\Program Files\Microsoft SDK\LIB

C:\Program Files\Microsoft Visual Studio\VC98\LIB

C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB

C:\Program Files\98DDK\LIB\I386\FREE

<other>

Source files

C:\Program Files\Microsoft Visual Studio\VC98\CRT\SRC

C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC

<other>

Also, if you're running VC6 under Win98/ME (and maybe not only these), there are a few additions required in AUTOEXEC.BAT so the system would know where to get the tools from:


SET PATH=%PATH%;C:\PROGRA~1\MICROS~6\Bin;C:\PROGRA~1\MICROS~6\Bin\Win9x;C:\PROGRA~1\MICROS~4\Common\MSDev98\Bin;C:\PROGRA~1\MICROS~4\Common\Tools
SET Basemake="C:\Program Files\Microsoft SDK\Include\BKOffice.Mak"
SET Bkoffice="C:\Program Files\Microsoft SDK\."
SET INCLUDE="C:\Program Files\Microsoft SDK\Include\."
SET INETSDK="C:\Program Files\Microsoft SDK\."
SET LIB="C:\Program Files\Microsoft SDK\Lib\."
SET MSSdk="C:\Program Files\Microsoft SDK\."
SET Mstools="C:\Program Files\Microsoft SDK\."

Please note that some of the items in the PATH variable may have different short names on each system, depending on the path they've been installed to; they usually are added by VC6 at installation time but I recall there's an option to skip this step so please check. There may be an option to add these system variables from within VC6 but I can't say where exactly - maybe someone else could chime in on this matter.

Also please note that not all of the items in the Directory list groups are required in order to correctly compile KernelEx but they may be required for other projects, so it's a good idea to set them up properly right now. If someone more knowledgeable notices anything wrong or missing with my advices, please do correct me.

Finally, please do read above in this topic in regard to a few minor issues in the KernelEx project files.

Oh and just to be clear: the NSIS packager cannot pack something that has not been compiled, so you definitely have to make VC6 work, compile the whole KernelEx project in batch mode and only after that launch the NSIS packager. The current .nsi script builds the Debug version of KernelEx so all pertaining components should be compiled and available. Using the modified project files I provided in the reply above, should allow a flawless batch compilation of the whole project. Just make sure there's enough free space on that partition.

Good luck! ;)

Edited by Drugwash
Link to comment
Share on other sites

Has anyone tried the modified projects from here? Do they work for you as they do for me?

Hallo Drugwash,

I've installed the KernelEX Build Environment on ME and Vista, but I think my environment is still faulty. All "Batch Builds" gives errors and hence to compile with NSIS 2.44. I have yet to read, learn and test a lot. I hope the next days I get some positive results. I'll report! I don't have the 98DDK. The downlads on MDGX are dead - "You're sunk in windows ...error 404"?? - . I have 2K / ME DDK's. Xeno says: "Microsoft Windows 98 Driver Development Kit or Microsoft Windows 2000 Driver Development Kit". On Vista I get on install and start Visual Studio 6.0 messages stating "known compatibility issues". But obviously it seems to run.?.

Link to comment
Share on other sites

I also tried to compile some of the C++ .dsw files with VC++ 6.0, but it keeps telling me it can't execute (or find) rc.exe, cl.exe, etc.

Same message I got, If I wasn't working on other projects, I would have invested more time in it. Lets hope someone can compile it correctly since it seems like everyone is having some issue or another.
Link to comment
Share on other sites

@ schwups: VC6 is old, it may not be 100% compatible with newer Windows; should work under ME though. Problem is, ME doesn't have a real DOS and doesn't take into account autoexec.bat, so even if VC6 and PSDK added the required lines, they will not take effect.

I wish I had more experience with ME, to know how to overcome this issue. Thing is, VC6 and PSDK need those environment variables to know where to find its tools. If those variables aren't set (which is the job of the autoexec.bat lines), VC6 will fail. Maybe the variables can be set through the registry, but we'll have to wait for someone more knowledgeable to point to the right direction. After that, the rest of the settings I listed in the post above should be checked and properly set.

One alternative solution would be to install a virtual machine under Vista, install 98SE and set up VC6, PSDK and the rest of the development environment, then try to compile. Personally I'm not a big fan of virtual environments, always did things on real hardware even if it took much longer (that's what experience builds up from), but in extreme situations such environment may prove useful. Well, it's worth a shot anyway.

@ PROBLEMCHYLD: I've always managed to build the project, but only after a few small changes to the projects. Unfortunately, after installing it, the machine hangs upon reboot. I've provided a few debug logs above, hopefully they'd be of some use. Haven't checked out the repository today, see if there's any newer commit; will do that soonish.

Please see my reply above to schwups, your problem might be the same, with missing environment variables in autoexec.bat.

Link to comment
Share on other sites

KernelEx does build properly under both Windows 98 SE and Windows 7 Pro x64.

Just follow the instructions here:

http://kernelex.sourceforge.net/wiki/Building_KernelEx

No virtual machine is needed.

Autoexec.bat changes aren't needed. Just set up the paths correctly inside VC6!

VC6 is 100% compatible with Windows 7 x64.

The guide applies to vanilla v4.5.2 only, cannot warrant that it will work with 3rd party mods.

Link to comment
Share on other sites

Those settings should work with both Xeno86's version and Ley0k's. I can build both of them without problems.

The environment variables in autoexec.bat may not be required by KernelEx, but they're automatically created at PSDK install time and may be needed by other projects, so it may not be a bad idea to have them properly set, especially for those that may wanna use this environment to build other open-source projects.

Today I've disabled the debugger on the test machine, compiled the Release version from Ley0k and installed it. Upon reboot, mprexe crashed and subsequently KernelEx reported a failed installation. Manually launching the verify tool reports the same thing. However, the Compatibility tab appears in apps' properties. Kernelex.dll is loaded in mprexe's namespace, kexcom.dll is loaded in explorer's, but neither kexbasen nor kexbases are loaded by any executable. Machine does not hang anymore. I've also disabled the SSDP service (installed by uSP) prior to installing KernelEx - don't know if that had any impact, but reenabling it sure didn't change anything. MPREXE crashes at every boot, otherwise machine appears to be running normally.

What else can I do to help?

Here's the standard crash report:

MPREXE caused an invalid page fault in
module KERNEL32.DLL at 0167:bff9e0b7.
Registers:
EAX=0072f5e0 CS=0167 EIP=bff9e0b7 EFLGS=00000246
EBX=81c08380 SS=016f ESP=0072f430 EBP=0072f5e0
ECX=0000016f DS=016f ESI=00001da7 FS=1da7
EDX=0072f5d0 ES=016f EDI=0000016f GS=0000
Bytes at CS:EIP:
cc a1 e0 dc fc bf 8b 00 66 64 f7 05 1c 00 00 00
Stack dump:
bfa40000 81c083c4 81c09d9c 81c09d64
81c09d78 c196b220 00000000 0072f5ec
ffecbad7 0072f480 0072f464 0000000e
00000007 00000000 00000000 0072f488

Link to comment
Share on other sites

On the subject of Windows Me environment variables, my understanding is that WinME uses both autoexec.bat and the HKLM\System\CurrentControlSet\Control\SessionManager\Environment registry key for setting environment variables. In case autoexec.bat entries aren't getting set, it will suffice to run msconfig which will automatically copy the autoexec.bat entries into the registry and they will sure be set at the next reboot.

Link to comment
Share on other sites

@ Leyok: Thanks for the explanation. Is there a way to communicate with the debugger, from the other machine, to resume operation and/or get more useful information? I use Hyperterminal to watch the boot progress, although I don't like it keeping the message history. Anyway, let me know if there's anything else I can do.

@ loblo: Good info! :) Apparently, XP uses the same location for its pseudo-DOS mode.

Anyway, the locations pertaining to VC6 and PSDK, found in the PATH variable string from my post above, should be set in VC6's Executable files section, as mentioned in the same post. This goes for any host OS.

In Windows ME, the other variables can be set in the Registry, at the location mentioned by loblo above, if necessary.

I'm thinking, the entries in autoexec.bat may be required only when using the tools outside the VC6 environment, that is manually building the projects in commandline mode.

Link to comment
Share on other sites

@ loblo: Good info! :) Apparently, XP uses the same location for its pseudo-DOS mode.

Unless I am completely mistaken, as I don't use that OS, I think XP uses a slightly different location which is HKLM\System\CurrentControlSet\Control\Session Manager\Environment.

Link to comment
Share on other sites

Indeed, I missed the space there. :blushing: I don't have ME here but I looked through my 98SE and it has both subkeys, which is confusing enough. Probably some newer apps that run in 2000/XP compatibility through KernelEx, create/modify some of the keys and maybe newer system files that come with uSP create them, in the first place.

So in 98/ME it's SessionManager and in 2000/XP/later it's Session Manager. What a tiny space can do...

Edited by Drugwash
Link to comment
Share on other sites

@ Leyok

I see you removed these functions DllInstall, DllRegisterServer and DllUnregisterServer. Not all users will use the WinME shell32.dll due to many reasons.

removed DllInstall/Dll**Server functions since Win98 can run WinME's …

…shell32.dll

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...