Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

KernelEx 4.5.2 updates

- - - - -

  • Please log in to reply
5 replies to this topic

#1
jumper

jumper

    2014 All-American Masters HJ'er

  • Member
  • PipPipPipPip
  • 507 posts
  • Joined 21-January 11
  • OS:98SE
  • Country: Country Flag

KernelEx 4.5.2 updates
Kernelex.dll 4.5.12.1
Kexbasen.dll 4.5.12.1
Kexbases.dll 4.5.12.1
Attached File  K4521.7z   93.19KB   15 downloads


How to install:
  • backup existing Windows\KernelEx DLL files
  • extract DLL files
  • "Exit to DOS" out of Windows
  • copy DLL files to Windows\KernelEx folder
  • exit from DOS back into Windows
If you have a program that will not run with the original KernelEx 4.5.2, do not post in this topic requesting help or support. Start a new topic in the Window 9x / ME forum or request help in the Kext:DIY topic.

 
These updates are built from source for the highly-tested KernelEx 4.5.2. This first release is mainly for sanity testing my build setup. Files are slightly larger than the 4.5.2 files.

Changes to the source will be presented in following posts. Changes will initially come from the 4.5.3 beta ("Master" branch), Kexstubs, and related projects.

I did slip a few "wish-list" gifts into this first package just for Christmas:
  • Kexbases.dll 4.5.12.1 has a Kernel32:VirtualProtect wrapper to fix the GCC problem and a Shell32:727 ordinal stub.
  • Kexbasen.dll 4.5.12.1 has Oleaut32:442/RegisterTypeLibForUser and 443/UnRegisterTypeLibForUser ordinal/name stubs.
  • Kernelex.dll 4.5.12.1 is a straight rebuild of 4.5.12.0 with just the version resource updated.
My toolchain isn't 100% complete, so I have no plans for releasing a full, updated KernelEx package. Is anyone interested in doing this? :angel

Topics for discussion
Versioning: Last official KernelEx product is 4.5.2, files 4.5.12, I'm currently using: product 4.5.2+ / 4.5.2.1; file 4.5.12.x.

Updates installer: suggestions for simple batchfile + wininit.ini solution.

API families TBD (additions welcome)
  • My Kstub822.ini has lots of these definitions. Which need partial or full code rather than stubs?
  • Ace
  • Acl/Dacl/Sacl (Security)
  • ActCtx
  • AnsiString/OemString/UnicodeString
  • Cred
  • Fls
  • Lsa
  • MD5
  • SList
  • Trace
Any technical discussion concerning updates/changes to KernelEx API support or architecture are welcome. Please report all known issues and limitations in KernelEx 4.5.2 so we can addressed them.

Known issues:
  • API names must be stored in sorted order in memory
  • plug-in limit is 4: std + kexbases + kexbasen + two more
  • ApiConfigurations limit is 11 (0..10); higher numbers show but don't "stick"
  • DLL must exist and be loaded for a new API to be added
  • new API can't be added to DLL loaded via KernelEx\KnownDLLs
  • no distinction between implecit(loader) and explicit(GetProcAddress) dynamic linking
  • Psapi code problems
Merry Christmas! :w00t:
  • Tommy likes this
Design feedback requested:
IHAtool - IpHlpApi tester; call various functions and report results
--status-> framework is solid; 22 api's fully supported; preview release coming soon
ComDlg32 wrapper - ComDlgEx meets IpHlpApi wrapper
--status-> PrintDlgExW working in latest SumatraPDF 8^)
Future projects: ImportPatcher40 - dialog interface; Kexter - IP40+Ktree+Kexstubs


How to remove advertisement from MSFN

#2
jumper

jumper

    2014 All-American Masters HJ'er

  • Member
  • PipPipPipPip
  • 507 posts
  • Joined 21-January 11
  • OS:98SE
  • Country: Country Flag
In the apilibs source folder, we find subfolders for Kexbases and Kexbasen.

To kexbases\Kernel32, I added VirtualProtect.c. This code has been tested via Kexstubs on my primary machine for six months:
// Don't let GCC apps 'accidentally' disable write access: If desired access protection
// is PAGE_READONLY and location is in PE image, request PAGE_READWRITE instead.

/* MAKE_EXPORT VirtualProtect_fix=VirtualProtect */
BOOL WINAPI VirtualProtect_fix(
  LPVOID  lpRegion,       // address of region of committed page
  DWORD   dwSize,         // size of the region
  DWORD   flNewProtect,   // desired access protection
  PDWORD  lpflOldProtect  // address of variable to get old protection
)
{
  if (flNewProtect == PAGE_READONLY) {
    MEMORY_BASIC_INFORMATION mbi;
    if (VirtualQuery (lpRegion, &mbi, sizeof(mbi))) //find base
      if (VirtualQuery (mbi.AllocationBase, &mbi, sizeof(mbi))) //query base
        if (mbi.Protect & 0x66) //readable?
          if (*(WORD*)(mbi.AllocationBase) == 'ZM') //PE image?
            flNewProtect = PAGE_READWRITE;
  }
  return VirtualProtect (lpRegion, dwSize, flNewProtect, lpflOldProtect);
}

To kexbases\shell32, I added SHGetImageList.c which exports SHGetImageList both by name and ordinal:
#define ERROR_CALL_NOT_IMPLEMENTED       120L

/* MAKE_EXPORT SHGetImageList_stub=SHGetImageList */
/* MAKE_EXPORT SHGetImageList_stub=ordinal727 */
HRESULT WINAPI SHGetImageList_stub (int iImageList, REFIID riid, void **ppv)
{
	return ERROR_CALL_NOT_IMPLEMENTED;
}

To Kexbasen, I added an Oleaut32 module with two function stubs exported both by name and by ordinal. I added them to the non-shared Kexbasen so they can be upgraded to delay-loaded forwards to (Un)RegisterTypeLib in the future.

kexbasen\oleaut32\_oleaut32_apilist.c created
kexbasen\oleaut32\_oleaut32_apilist.h created
kexbasen\oleaut32\oleaut32.c
#define ERROR_CALL_NOT_IMPLEMENTED       120L

/* MAKE_EXPORT RegisterTypeLibForUser_stub=RegisterTypeLibForUser */
/* MAKE_EXPORT RegisterTypeLibForUser_stub=ordinal442 */

HRESULT WINAPI RegisterTypeLibForUser_stub (
	ITypeLib *ptlib,
	OLECHAR  *szFullPath,
	OLECHAR  *szHelpDir )
{
	return ERROR_CALL_NOT_IMPLEMENTED;
}

/* MAKE_EXPORT UnRegisterTypeLibForUser_stub=UnRegisterTypeLibForUser */
/* MAKE_EXPORT UnRegisterTypeLibForUser_stub=ordinal443 */

HRESULT WINAPI UnRegisterTypeLibForUser_stub (
	REFGUID libID,
	WORD    wMajorVerNum,
	WORD    wMinorVerNum,
	LCID    lcid,
	SYSKIND syskind )
{
	return ERROR_CALL_NOT_IMPLEMENTED;
}
In apilibs\kexbasen, main.c and dirlist were updated to reflect the new oleaut32 modules.


Full source diff package: Attached File  K4521src.7z   7.62KB   4 downloads

Edited by jumper, Yesterday, 05:27 PM.

Design feedback requested:
IHAtool - IpHlpApi tester; call various functions and report results
--status-> framework is solid; 22 api's fully supported; preview release coming soon
ComDlg32 wrapper - ComDlgEx meets IpHlpApi wrapper
--status-> PrintDlgExW working in latest SumatraPDF 8^)
Future projects: ImportPatcher40 - dialog interface; Kexter - IP40+Ktree+Kexstubs

#3
MiKl

MiKl

    Member

  • Member
  • PipPip
  • 121 posts
  • Joined 01-December 11
  • OS:98SE
  • Country: Country Flag

Menues are now fully displaying in SumatraPDF 3.0. Thanks Jumper !!!

All other KernelEx depending programs seem to be working fine as well !!

 

Great news.



#4
loblo

loblo

    Oldbie

  • Member
  • PipPipPipPipPip
  • 766 posts
  • Joined 12-January 10
  • OS:ME
  • Country: Country Flag

Not working here on WinME : 

MPREXE caused an invalid page fault in
module KERNELEX.DLL at 0177:bfa08e80.
Registers:
EAX=00000043 CS=0177 EIP=bfa08e80 EFLGS=00010212
EBX=833421f8 SS=017f ESP=0072f568 EBP=0072f574
ECX=00000000 DS=017f ESI=bfa00000 FS=40cf
EDX=86a2df43 ES=017f EDI=00000000 GS=0000
Bytes at CS:EIP:
88 11 8b 45 f8 83 c0 01 89 45 f8 8b 4d fc 83 c1 
Stack dump:
00000043 00000000 86a2df00 0072f58c bfa06dcb 00000000 86a2df00 0072f5cc 00000000 0072f91c bfa06fd2 0072f5c4 bfa0c350 86a2df00 86a2df98 86a2dd6c 

After that initial error message, kernelex.dll and all dlls specified in core.ini are loaded but not working.

 


#5
Drugwash

Drugwash

    MSFN Expert

  • Member
  • PipPipPipPipPipPip
  • 1,279 posts
  • Joined 21-June 06
  • OS:98SE
  • Country: Country Flag

Nice that you took on this job, jumper! :)

 

I'm not sure I get things right so I'm gonna ask: is KernelEx supposed to implement stubs on a large scale or should it rather replicate original missing API behavior through our own code? Personally I'd like to see working code wherever possible rather than "not implemented" error codes being returned.

 

Now, last time I checked I could build the whole KernelEx package, installer included. The original 4.5.2 has always built, installed and run correctly, while leyok's attempts always failed. Couldn't figure out why. So if you want, I could try to build an updated package for you, as soon as I remember how to use all these things, because my memory is failing me badly. Please feel free to contact me in private, via PM or e-mail (drugwash aol com).



#6
MiKl

MiKl

    Member

  • Member
  • PipPip
  • 121 posts
  • Joined 01-December 11
  • OS:98SE
  • Country: Country Flag

@ loblo. I had a mprexe error too a few days ago but it was caused by a bad new entry I did put into kext's msvcrt.dll !!

Try booting without kstub822 in core.ini to see if the error goes away then you know where to look for the culprit.

Do you use the msvcr70 replacement dll for msvcrt.dll ??






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users