Hi everybody,
I noticed that, when a builtin dll (.so) is loaded, the SizeOfImage field in the OptionalHeader is not updated and stays equal to page_size (see winebuild, spec32).
I need to get the correct value in SizeOfImage.
I thought about updating that field in map_dll@library/loader.c, but don't know how to get the size of the image.
Could anyone help me ? I'm not familiar with the PE loader.
You can't find out the size of the image from the libdl API calls except going into heavy ELF parsing.
winebuild does not really know either.
My suggestion would be to use a heuristic like the one below. However it is not perfect, the sizes are too large sometimes.
Ciao, Marcus
I thought about modifying winebuild to add
char _end[]; nt_headers->OptionalHeader.SizeOfImage = pe_header - _end;
in the library initialisation function. This is small, fast and probably more accurate.
Does anyone have any comment about that ?
Laurent Pinchart