Commit a42c0728 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

rundll32: Recognize entry points passed as ordinal numbers.

parent de83c530
...@@ -119,30 +119,44 @@ static FARPROC16 get_entry_point16( HINSTANCE16 inst, LPCWSTR entry ) ...@@ -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)
return NULL;
WideCharToMultiByte( CP_ACP, 0, entry, -1, entryA, len, NULL, NULL ); /* determine if the entry point is an ordinal */
if (entry[0] == '#')
{
int ordinal = atoiW( entry + 1 );
if (ordinal <= 0)
return NULL;
/* first try the W version */ *unicode = TRUE;
*unicode = TRUE; ret = GetProcAddress( module, (LPCSTR)ordinal );
strcat( entryA, "W" ); }
if (!(ret = GetProcAddress( module, entryA ))) else
{ {
/* now the A version */ DWORD len = WideCharToMultiByte( CP_ACP, 0, entry, -1, NULL, 0, NULL, NULL );
*unicode = FALSE; char *entryA = HeapAlloc( GetProcessHeap(), 0, len + 1 );
entryA[strlen(entryA)-1] = 'A';
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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment