Module: wine Branch: master Commit: a42c072830dfd552559d2a9002c55965c42809fa URL: http://source.winehq.org/git/wine.git/?a=commit;h=a42c072830dfd552559d2a9002...
Author: Andrew Nguyen anguyen@codeweavers.com Date: Tue May 4 07:46:20 2010 -0500
rundll32: Recognize entry points passed as ordinal numbers.
---
programs/rundll32/rundll32.c | 48 +++++++++++++++++++++++++++-------------- 1 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/programs/rundll32/rundll32.c b/programs/rundll32/rundll32.c index e8ac8a5..c619693 100644 --- a/programs/rundll32/rundll32.c +++ b/programs/rundll32/rundll32.c @@ -119,30 +119,44 @@ static FARPROC16 get_entry_point16( HINSTANCE16 inst, LPCWSTR entry ) static void *get_entry_point32( HMODULE module, LPCWSTR entry, BOOL *unicode ) { 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; - strcat( entryA, "W" ); - if (!(ret = GetProcAddress( module, entryA ))) + *unicode = TRUE; + ret = GetProcAddress( module, (LPCSTR)ordinal ); + } + else { - /* now the A version */ - *unicode = FALSE; - entryA[strlen(entryA)-1] = 'A'; + 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 ))) { - /* now the version without suffix */ - entryA[strlen(entryA)-1] = 0; - ret = GetProcAddress( module, entryA ); + /* now the A version */ + *unicode = FALSE; + 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; }