From: <th...@us...> - 2013-06-30 18:02:41
|
Revision: 734 http://sourceforge.net/p/py2exe/svn/734 Author: theller Date: 2013-06-30 18:02:34 +0000 (Sun, 30 Jun 2013) Log Message: ----------- Fix crash in GetProcAddress for functions exported only by ordinal. Modified Paths: -------------- trunk/py2exe/source/MemoryModule.c Modified: trunk/py2exe/source/MemoryModule.c =================================================================== --- trunk/py2exe/source/MemoryModule.c 2013-06-30 18:01:52 UTC (rev 733) +++ trunk/py2exe/source/MemoryModule.c 2013-06-30 18:02:34 UTC (rev 734) @@ -519,26 +519,32 @@ qsort(entry, exports->NumberOfNames, sizeof(struct NAME_TABLE), _compare); } - // search function name in list of exported names with binary search - if (((PMEMORYMODULE)module)->name_table) { - struct NAME_TABLE *found; - found = bsearch(&name, - ((PMEMORYMODULE)module)->name_table, - exports->NumberOfNames, - sizeof(struct NAME_TABLE), _find); - if (found) - idx = found->idx; - } + if (!IS_INTRESOURCE(name)) { + // search function name in list of exported names with binary search + if (((PMEMORYMODULE)module)->name_table) { + struct NAME_TABLE *found; + found = bsearch(&name, + ((PMEMORYMODULE)module)->name_table, + exports->NumberOfNames, + sizeof(struct NAME_TABLE), _find); + if (found) + idx = found->idx; + } + } else + idx = (int)name; #else - // search function name in list of exported names - nameRef = (DWORD *) (codeBase + exports->AddressOfNames); - ordinal = (WORD *) (codeBase + exports->AddressOfNameOrdinals); - for (i=0; i<exports->NumberOfNames; i++, nameRef++, ordinal++) { - if (_stricmp(name, (const char *) (codeBase + (*nameRef))) == 0) { - idx = *ordinal; - break; - } - } + if (!IS_INTRESOURCE(name)) { + // search function name in list of exported names + nameRef = (DWORD *) (codeBase + exports->AddressOfNames); + ordinal = (WORD *) (codeBase + exports->AddressOfNameOrdinals); + for (i=0; i<exports->NumberOfNames; i++, nameRef++, ordinal++) { + if (_stricmp(name, (const char *) (codeBase + (*nameRef))) == 0) { + idx = *ordinal; + break; + } + } + } else + idx = (int)name; #endif if (idx == -1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |