dlls/kernel: Resource updating functions (EndUpdateResources, ...)
Anich Gregor
blight at blight.eu.org
Sat May 7 14:16:44 CDT 2005
Hello!
I have implemented EndUpdateResources (and fixed BeginUpdateResources,
UpdateResource and some other functions) for the kernel32 dll. The changes
work with Inno Setup (http://www.jrsoftware.org/isinfo.php), when using the
SetupIconFile directive to customize the icon of the setup.exe which Inno
Setup creates, and mozip (http://moztw.org/tools/) - a tool to update mozilla
installers (which adds, updates and deletes resources from a given .exe file
with the API)
There was another problem with mozip - it tried to LoadLibrary() a .exe file
to read it's resources, but that doesn't work because LoadLibrary tries to
map it as executable file, and fails because the default load address is
occupied by mozip itself and the exe it is trying to load doesnt have
relocations, so I have changed the load_library function to load the file as
datafile in case it's extension is ".exe" (Maybe it would be better to read
the header from the file and check the type in the PE headers?)
The implementation of EndUpdateResources (they way how it edits the PE file)
is of course not perfect - it's a rather simple approach:
BeginUpdateResources loads all resources into memory if the caller didnt
specify to discard existing resources.
Each call to UpdateResource updates the resource tree which was created by
BeginUpdateResources.
EndUpdateResources tries to find the .rsrc section in the file, and tries to
enlarge it if it isnt big enough for the new resource tree - this works only
if the .rsrc section is the last one in the file (not sure if it would be a
problem if it wasn't the last one and the ones following .rsrc were moved)
and if no data directory other than the resource directory points into
the .rsrc section.
ChangeLog:
* Fix LoadLibrary() for .exe files
* Fix/Implement UpdateResource and Begin/EndUpdateResources
- blight
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kernel-resource-2005-05-07.patch
Type: text/x-diff
Size: 37240 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20050507/c6193189/kernel-resource-2005-05-07.bin
More information about the wine-patches
mailing list