From 2f5a9a2734fa8840d657f3667de9dee475ae22d3 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Mon, 26 Sep 2005 20:08:11 +0000 Subject: [PATCH] Add NDEBUG back and call LdrLoadDll correctly on Windows. svn path=/trunk/; revision=18106 --- reactos/lib/kernel32/misc/dllmain.c | 4 ++-- reactos/lib/kernel32/misc/ldr.c | 24 +++++++++++++++++++++++- reactos/lib/kernel32/misc/nls.c | 9 --------- reactos/lib/kernel32/misc/stubs.c | 8 ++++++++ 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/reactos/lib/kernel32/misc/dllmain.c b/reactos/lib/kernel32/misc/dllmain.c index 7684ebe10b0..f4d1544a562 100644 --- a/reactos/lib/kernel32/misc/dllmain.c +++ b/reactos/lib/kernel32/misc/dllmain.c @@ -13,7 +13,7 @@ #include -//#define NDEBUG +#define NDEBUG #include "../include/debug.h" /* GLOBALS *******************************************************************/ @@ -378,7 +378,7 @@ DllMain(HANDLE hDll, /* Insert more dll attach stuff here! */ DllInitialized = TRUE; - DPRINT1("Initialization complete\n"); + DPRINT("Initialization complete\n"); break; case DLL_PROCESS_DETACH: diff --git a/reactos/lib/kernel32/misc/ldr.c b/reactos/lib/kernel32/misc/ldr.c index a8ceb8da78e..671321d321f 100644 --- a/reactos/lib/kernel32/misc/ldr.c +++ b/reactos/lib/kernel32/misc/ldr.c @@ -19,6 +19,8 @@ typedef struct tagLOADPARMS32 { DWORD dwReserved; } LOADPARMS32; +extern BOOLEAN InWindows; + /* FUNCTIONS ****************************************************************/ /** @@ -167,12 +169,20 @@ LoadLibraryExW ( HINSTANCE hInst; NTSTATUS Status; PWSTR SearchPath; + ULONG DllCharacteristics; (void)hFile; if ( lpLibFileName == NULL ) return NULL; + /* Check for any flags LdrLoadDll might be interested in */ + if (dwFlags & DONT_RESOLVE_DLL_REFERENCES) + { + /* Tell LDR to treat it as an EXE */ + DllCharacteristics = IMAGE_FILE_EXECUTABLE_IMAGE; + } + dwFlags &= DONT_RESOLVE_DLL_REFERENCES | LOAD_LIBRARY_AS_DATAFILE | @@ -182,7 +192,19 @@ LoadLibraryExW ( dwFlags & LOAD_WITH_ALTERED_SEARCH_PATH ? lpLibFileName : NULL); RtlInitUnicodeString(&DllName, (LPWSTR)lpLibFileName); - Status = LdrLoadDll(SearchPath, dwFlags, &DllName, (PVOID*)&hInst); + if (InWindows) + { + /* Call the API Properly */ + Status = LdrLoadDll(SearchPath, + (ULONG)&DllCharacteristics, // Silence compiler + &DllName, + (PVOID*)&hInst); + } + else + { + /* Call the ROS API. NOTE: Don't fix this, I have a patch to merge later. */ + Status = LdrLoadDll(SearchPath, dwFlags, &DllName, (PVOID*)&hInst); + } RtlFreeHeap(RtlGetProcessHeap(), 0, SearchPath); if ( !NT_SUCCESS(Status)) { diff --git a/reactos/lib/kernel32/misc/nls.c b/reactos/lib/kernel32/misc/nls.c index 70929c780a0..bb1363ff24f 100755 --- a/reactos/lib/kernel32/misc/nls.c +++ b/reactos/lib/kernel32/misc/nls.c @@ -987,13 +987,4 @@ IsDBCSLeadByte(BYTE TestByte) return IntIsLeadByte(&AnsiCodePage.CodePageTable, TestByte); } -ULONG -WINAPI -NlsGetCacheUpdateCount(VOID) -{ - /* FIXME: */ - UNIMPLEMENTED; - return 0; -} - /* EOF */ diff --git a/reactos/lib/kernel32/misc/stubs.c b/reactos/lib/kernel32/misc/stubs.c index baa76c737cd..29fba24115d 100644 --- a/reactos/lib/kernel32/misc/stubs.c +++ b/reactos/lib/kernel32/misc/stubs.c @@ -1633,3 +1633,11 @@ SetClientTimeZoneInformation( STUB; return 0; } + +ULONG +WINAPI +NlsGetCacheUpdateCount(VOID) +{ + STUB; + return 0; +}