[Python-checkins] cpython: Use GetModuleHandleW to avoid *A functions where possible.
martin.v.loewis
python-checkins at python.org
Sat Jan 14 17:54:18 CET 2012
http://hg.python.org/cpython/rev/c932320cba33
changeset: 74402:c932320cba33
parent: 74400:7332e97587da
user: Martin v. Löwis <martin at v.loewis.de>
date: Sat Jan 14 17:54:09 2012 +0100
summary:
Use GetModuleHandleW to avoid *A functions where possible.
files:
Modules/posixmodule.c | 6 +++---
PC/frozen_dllmain.c | 2 +-
PC/winreg.c | 8 ++++----
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1155,7 +1155,7 @@
/* 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 @@
/* 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 @@
/* 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);
diff --git a/PC/frozen_dllmain.c b/PC/frozen_dllmain.c
--- a/PC/frozen_dllmain.c
+++ b/PC/frozen_dllmain.c
@@ -118,7 +118,7 @@
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.
diff --git a/PC/winreg.c b/PC/winreg.c
--- a/PC/winreg.c
+++ b/PC/winreg.c
@@ -1066,7 +1066,7 @@
/* 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 @@
/* 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 @@
/* 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 @@
/* 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");
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list