rundll32: Recognize entry points passed as ordinal numbers.

This commit is contained in:
Andrew Nguyen 2010-05-04 07:46:20 -05:00 committed by Alexandre Julliard
parent de83c53085
commit a42c072830
1 changed files with 32 additions and 18 deletions

View File

@ -119,30 +119,44 @@ static FARPROC16 get_entry_point16( HINSTANCE16 inst, LPCWSTR entry )
static void *get_entry_point32( HMODULE module, LPCWSTR entry, BOOL *unicode ) static void *get_entry_point32( HMODULE module, LPCWSTR entry, BOOL *unicode )
{ {
void *ret; void *ret;
DWORD len = WideCharToMultiByte( CP_ACP, 0, entry, -1, NULL, 0, NULL, NULL );
char *entryA = HeapAlloc( GetProcessHeap(), 0, len + 1 );
if (!entryA) /* determine if the entry point is an ordinal */
return NULL; if (entry[0] == '#')
WideCharToMultiByte( CP_ACP, 0, entry, -1, entryA, len, NULL, NULL );
/* first try the W version */
*unicode = TRUE;
strcat( entryA, "W" );
if (!(ret = GetProcAddress( module, entryA )))
{ {
/* now the A version */ int ordinal = atoiW( entry + 1 );
*unicode = FALSE; if (ordinal <= 0)
entryA[strlen(entryA)-1] = 'A'; return NULL;
*unicode = TRUE;
ret = GetProcAddress( module, (LPCSTR)ordinal );
}
else
{
DWORD len = WideCharToMultiByte( CP_ACP, 0, entry, -1, NULL, 0, NULL, NULL );
char *entryA = HeapAlloc( GetProcessHeap(), 0, len + 1 );
if (!entryA)
return NULL;
WideCharToMultiByte( CP_ACP, 0, entry, -1, entryA, len, NULL, NULL );
/* first try the W version */
*unicode = TRUE;
strcat( entryA, "W" );
if (!(ret = GetProcAddress( module, entryA ))) if (!(ret = GetProcAddress( module, entryA )))
{ {
/* now the version without suffix */ /* now the A version */
entryA[strlen(entryA)-1] = 0; *unicode = FALSE;
ret = GetProcAddress( module, entryA ); entryA[strlen(entryA)-1] = 'A';
if (!(ret = GetProcAddress( module, entryA )))
{
/* now the version without suffix */
entryA[strlen(entryA)-1] = 0;
ret = GetProcAddress( module, entryA );
}
} }
HeapFree( GetProcessHeap(), 0, entryA );
} }
HeapFree( GetProcessHeap(), 0, entryA );
return ret; return ret;
} }