]> granicus.if.org Git - python/commitdiff
Use GetModuleHandleW to avoid *A functions where possible.
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 14 Jan 2012 16:54:09 +0000 (17:54 +0100)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 14 Jan 2012 16:54:09 +0000 (17:54 +0100)
Modules/posixmodule.c
PC/frozen_dllmain.c
PC/winreg.c

index a71d2e6426fac003740a325ebd8aa8bee640fabb..61a0439539f3635c9592ebfa402e8d61af009fa2 100644 (file)
@@ -1155,7 +1155,7 @@ check_GetFinalPathNameByHandle()
     /* only recheck */
     if (!has_GetFinalPathNameByHandle)
     {
-        hKernel32 = GetModuleHandle("KERNEL32");
+        hKernel32 = GetModuleHandleW(L"KERNEL32");
         *(FARPROC*)&Py_GetFinalPathNameByHandleA = GetProcAddress(hKernel32,
                                                 "GetFinalPathNameByHandleA");
         *(FARPROC*)&Py_GetFinalPathNameByHandleW = GetProcAddress(hKernel32,
@@ -6526,7 +6526,7 @@ check_CreateSymbolicLinkW()
     /* only recheck */
     if (has_CreateSymbolicLinkW)
         return has_CreateSymbolicLinkW;
-    hKernel32 = GetModuleHandle("KERNEL32");
+    hKernel32 = GetModuleHandleW(L"KERNEL32");
     *(FARPROC*)&Py_CreateSymbolicLinkW = GetProcAddress(hKernel32,
                                                         "CreateSymbolicLinkW");
     if (Py_CreateSymbolicLinkW)
@@ -9365,7 +9365,7 @@ win32_urandom(PyObject *self, PyObject *args)
 
         /* 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);
 
index e1e4edaf97bcc30e6337633f2311c0528635ee8b..0156c5008bc93a905665ea2651a2fd8dc224edf9 100644 (file)
@@ -118,7 +118,7 @@ BOOL CallModuleDllMain(char *modName, DWORD dwReason)
     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.
index 56bda5c258999267c581c86cdbc1fd3c65a21331..451ced29ee36b7beb3c6aa1dd5294ef6e433e0c2 100644 (file)
@@ -1066,7 +1066,7 @@ PyDeleteKeyEx(PyObject *self, PyObject *args, PyObject *kwargs)
 
     /* 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");
@@ -1590,7 +1590,7 @@ PyDisableReflectionKey(PyObject *self, PyObject *args)
 
     /* 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");
@@ -1626,7 +1626,7 @@ PyEnableReflectionKey(PyObject *self, PyObject *args)
 
     /* 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");
@@ -1663,7 +1663,7 @@ PyQueryReflectionKey(PyObject *self, PyObject *args)
 
     /* 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");