Add NDEBUG back and call LdrLoadDll correctly on Windows.
authorAlex Ionescu <aionescu@gmail.com>
Mon, 26 Sep 2005 20:08:11 +0000 (20:08 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Mon, 26 Sep 2005 20:08:11 +0000 (20:08 +0000)
svn path=/trunk/; revision=18106

reactos/lib/kernel32/misc/dllmain.c
reactos/lib/kernel32/misc/ldr.c
reactos/lib/kernel32/misc/nls.c
reactos/lib/kernel32/misc/stubs.c

index 7684ebe..f4d1544 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <k32.h>
 
-//#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:
index a8ceb8d..671321d 100644 (file)
@@ -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))
        {
index 70929c7..bb1363f 100755 (executable)
@@ -987,13 +987,4 @@ IsDBCSLeadByte(BYTE TestByte)
    return IntIsLeadByte(&AnsiCodePage.CodePageTable, TestByte);
 }
 
-ULONG
-WINAPI
-NlsGetCacheUpdateCount(VOID)
-{
-    /* FIXME: */
-    UNIMPLEMENTED;
-    return 0;
-}
-
 /* EOF */
index baa76c7..29fba24 100644 (file)
@@ -1633,3 +1633,11 @@ SetClientTimeZoneInformation(
     STUB;
     return 0;
 }
+
+ULONG
+WINAPI
+NlsGetCacheUpdateCount(VOID)
+{
+    STUB;
+    return 0;
+}