[MPlayer-dev-eng] [PATCH] fix for crt8 init dll
Gianluigi Tiesi
mplayer at netfarm.it
Tue Feb 2 00:16:30 CET 2010
Hi,
msvcrt static linked dll and newer are making a check for "mixed crt" (posix)
executables, this implies a GetModuleHandle on the main exe
and a check for a section named .mixcrt
The attached patch fixes it by providing a minimal struct
needed to the crt init function, and fakes the section
.mixcrt so the crt avoid using Encode/Decode Pointers
additional values can be filled if needed in the future
the crt code:
// The DOS header starts from address where EXE is loaded
pDOSHeader = (PIMAGE_DOS_HEADER)GetModuleHandle(NULL);
// Get the NT header
pNTHeader = (PIMAGE_NT_HEADERS)((PBYTE)pDOSHeader + pDOSHeader->e_lfanew);
// Search for a section named ".mixcrt". If it exists, this is a
// POSIX binary for which encode/decode needs to be skipped
for (iSection = 0, pSection = IMAGE_FIRST_SECTION(pNTHeader);
iSection < pNTHeader->FileHeader.NumberOfSections;
++iSection, ++pSection)
{
if (!strcmp(".mixcrt", pSection->Name))
{
bEncode = FALSE;
break;
}
}
(sources in my vc 2005 pro)
by skipping encode/decode ptr stuff also makes less complex the emulation (a bit :D)
Regards
--
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: crt8init.diff
Type: text/x-diff
Size: 1182 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100202/1d69a35a/attachment.diff>
More information about the MPlayer-dev-eng
mailing list