ancev
February 17th, 2006, 21:14
hi,
i have a big problem adding functions to the export table of a dll...
the dll is the kernel32.dll of w95 and w98, and i am adding support for VirtualAllocEx(), VirtualFreeEx() and CreateRemoteThread() to these OSes, via modifications on kernel32.dll
my problem is not in the api-simulacrum code, but in the dll file manipulation.
in w98, all work fine, becoz w98 kernel32.dll have stubs for these apis, that always return ERROR_NOTSUPPORTED. so, i just change the export table of these apis to point to my code, and all worked as a charm.
but in w95, the only api name that already exists is CreateRemoteThread(). i need add to the export table VirtualAllocEx() and VirtualFreeEx() entries.
so, i did that.
i recreate the export table and all its data in a new section, find the alphabetical sorted place to insert my new apis (i found the hard way that i cant just insert them in the end of original export list), preserve ordinal, and like.
the modified w95 kernel32.dll look right. even the checksum (that w95 dont check) its right.
all the pe utils show the export table as it should be. tdump, lordpe, etc, and even ida.
the new functions point to the right place, and the old ones continue pointing to their original places.
but, for some unknow reason, w95 crash while loading with my modified kernel32. if i comment out the "export-adding" part, w95 load, and CreateRemoteThread() its the only new api available (so, kernel32 isnt untouchable under w95... the problem is in the export thingie).
anybody know anything about this stuffs? may w95 have hardcoded, in some dark corner, the number of apis of kernel32? its w95 expecting the apis be in some particular way? its my house build over a indian cemetary?!?
thanks for any help,
vecna
ps: i tried to add some bogus exports to w98 kernel32.dll, and it also crashed. so, the problem should be in my export-add-routine
i have a big problem adding functions to the export table of a dll...

the dll is the kernel32.dll of w95 and w98, and i am adding support for VirtualAllocEx(), VirtualFreeEx() and CreateRemoteThread() to these OSes, via modifications on kernel32.dll
my problem is not in the api-simulacrum code, but in the dll file manipulation.
in w98, all work fine, becoz w98 kernel32.dll have stubs for these apis, that always return ERROR_NOTSUPPORTED. so, i just change the export table of these apis to point to my code, and all worked as a charm.
but in w95, the only api name that already exists is CreateRemoteThread(). i need add to the export table VirtualAllocEx() and VirtualFreeEx() entries.
so, i did that.
i recreate the export table and all its data in a new section, find the alphabetical sorted place to insert my new apis (i found the hard way that i cant just insert them in the end of original export list), preserve ordinal, and like.
the modified w95 kernel32.dll look right. even the checksum (that w95 dont check) its right.
all the pe utils show the export table as it should be. tdump, lordpe, etc, and even ida.
the new functions point to the right place, and the old ones continue pointing to their original places.
but, for some unknow reason, w95 crash while loading with my modified kernel32. if i comment out the "export-adding" part, w95 load, and CreateRemoteThread() its the only new api available (so, kernel32 isnt untouchable under w95... the problem is in the export thingie).
anybody know anything about this stuffs? may w95 have hardcoded, in some dark corner, the number of apis of kernel32? its w95 expecting the apis be in some particular way? its my house build over a indian cemetary?!?
thanks for any help,
vecna
ps: i tried to add some bogus exports to w98 kernel32.dll, and it also crashed. so, the problem should be in my export-add-routine