]> granicus.if.org Git - python/commitdiff
Fixes issue4653 - Correctly specify the buffer size to FormatMessageW and
authorGregory P. Smith <greg@krypto.org>
Sat, 23 Mar 2013 23:05:36 +0000 (16:05 -0700)
committerGregory P. Smith <greg@krypto.org>
Sat, 23 Mar 2013 23:05:36 +0000 (16:05 -0700)
correctly check for errors on two CreateFileMapping calls.

PC/bdist_wininst/extract.c
PC/bdist_wininst/install.c
Python/dynload_win.c

index c900f235fd91af8727cc44a1326a928589fe32f0..aec8eda2be850efeaa3c98a51304b422902bf3de 100644 (file)
@@ -127,7 +127,7 @@ char *map_new_file(DWORD flags, char *filename,
 
     CloseHandle(hFile);
 
-    if (hFileMapping == INVALID_HANDLE_VALUE) {
+    if (hFileMapping == NULL) {
         if (notify)
             notify(SYSTEM_ERROR,
                    "CreateFileMapping (%s)", filename);
index 771922cfd6461a09bc9158b0266d1aa754d2d9bd..c11d45de2223ae0a73856e9bb1a291cc7f98db31 100644 (file)
@@ -1019,7 +1019,7 @@ static char *MapExistingFile(char *pathname, DWORD *psize)
                                       NULL, PAGE_READONLY, 0, 0, NULL);
     CloseHandle(hFile);
 
-    if (hFileMapping == INVALID_HANDLE_VALUE)
+    if (hFileMapping == NULL)
         return NULL;
 
     data = MapViewOfFile(hFileMapping,
index 25b6680b3b787322a43070eae6bf90b9406d0d42..edb6038e3bfb55cb26f4eb2b033715e24368d5b3 100644 (file)
@@ -235,7 +235,7 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
                            SUBLANG_DEFAULT),
                            /* Default language */
                 theInfo, /* the buffer */
-                sizeof(theInfo), /* the buffer size */
+                sizeof(theInfo) / sizeof(wchar_t), /* size in wchars */
                 NULL); /* no additional format args. */
 
             /* Problem: could not get the error message.