Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d6f1d16

Browse files
committed
Fixes issue4653 - Correctly specify the buffer size to FormatMessageW and
correctly check for errors on two CreateFileMapping calls.
2 parents 23c31d5 + b803c6c commit d6f1d16

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

PC/bdist_wininst/extract.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ char *map_new_file(DWORD flags, char *filename,
127127

128128
CloseHandle(hFile);
129129

130-
if (hFileMapping == INVALID_HANDLE_VALUE) {
130+
if (hFileMapping == NULL) {
131131
if (notify)
132132
notify(SYSTEM_ERROR,
133133
"CreateFileMapping (%s)", filename);

PC/bdist_wininst/install.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static char *MapExistingFile(char *pathname, DWORD *psize)
10191019
NULL, PAGE_READONLY, 0, 0, NULL);
10201020
CloseHandle(hFile);
10211021

1022-
if (hFileMapping == INVALID_HANDLE_VALUE)
1022+
if (hFileMapping == NULL)
10231023
return NULL;
10241024

10251025
data = MapViewOfFile(hFileMapping,

Python/dynload_win.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname,
235235
SUBLANG_DEFAULT),
236236
/* Default language */
237237
theInfo, /* the buffer */
238-
sizeof(theInfo), /* the buffer size */
238+
sizeof(theInfo) / sizeof(wchar_t), /* size in wchars */
239239
NULL); /* no additional format args. */
240240

241241
/* Problem: could not get the error message.

0 commit comments

Comments
 (0)