Commits

Martin von Löwis committed c932320

Use GetModuleHandleW to avoid *A functions where possible.

Comments (0)

Files changed (3)

Modules/posixmodule.c

     /* only recheck */
     if (!has_GetFinalPathNameByHandle)
     {
-        hKernel32 = GetModuleHandle("KERNEL32");
+        hKernel32 = GetModuleHandleW(L"KERNEL32");
         *(FARPROC*)&Py_GetFinalPathNameByHandleA = GetProcAddress(hKernel32,
                                                 "GetFinalPathNameByHandleA");
         *(FARPROC*)&Py_GetFinalPathNameByHandleW = GetProcAddress(hKernel32,
     /* only recheck */
     if (has_CreateSymbolicLinkW)
         return has_CreateSymbolicLinkW;
-    hKernel32 = GetModuleHandle("KERNEL32");
+    hKernel32 = GetModuleHandleW(L"KERNEL32");
     *(FARPROC*)&Py_CreateSymbolicLinkW = GetProcAddress(hKernel32,
                                                         "CreateSymbolicLinkW");
     if (Py_CreateSymbolicLinkW)
 
         /* Obtain handle to the DLL containing CryptoAPI
            This should not fail         */
-        hAdvAPI32 = GetModuleHandle("advapi32.dll");
+        hAdvAPI32 = GetModuleHandleW(L"advapi32.dll");
         if(hAdvAPI32 == NULL)
             return win32_error("GetModuleHandle", NULL);
 
     BOOL (WINAPI * pfndllmain)(HINSTANCE, DWORD, LPVOID);
 
     char funcName[255];
-    HMODULE hmod = GetModuleHandle(NULL);
+    HMODULE hmod = GetModuleHandleW(NULL);
     strcpy(funcName, "_DllMain");
     strcat(funcName, modName);
     strcat(funcName, "@12"); // stdcall convention.
 
     /* Only available on 64bit platforms, so we must load it
        dynamically. */
-    hMod = GetModuleHandle("advapi32.dll");
+    hMod = GetModuleHandleW(L"advapi32.dll");
     if (hMod)
         pfn = (RDKEFunc)GetProcAddress(hMod,
                                                                    "RegDeleteKeyExW");
 
     /* Only available on 64bit platforms, so we must load it
        dynamically.*/
-    hMod = GetModuleHandle("advapi32.dll");
+    hMod = GetModuleHandleW(L"advapi32.dll");
     if (hMod)
         pfn = (RDRKFunc)GetProcAddress(hMod,
                                        "RegDisableReflectionKey");
 
     /* Only available on 64bit platforms, so we must load it
        dynamically.*/
-    hMod = GetModuleHandle("advapi32.dll");
+    hMod = GetModuleHandleW(L"advapi32.dll");
     if (hMod)
         pfn = (RERKFunc)GetProcAddress(hMod,
                                        "RegEnableReflectionKey");
 
     /* Only available on 64bit platforms, so we must load it
        dynamically.*/
-    hMod = GetModuleHandle("advapi32.dll");
+    hMod = GetModuleHandleW(L"advapi32.dll");
     if (hMod)
         pfn = (RQRKFunc)GetProcAddress(hMod,
                                        "RegQueryReflectionKey");