1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 03:52:49 -05:00

The Windows HANDLE type, despite being a `void *', does not actually

behave like a pointer. In particular, the right thing to set a
HANDLE to to indicate that it's invalid is INVALID_HANDLE_VALUE, not
NULL. Crack down on sloppy use of NULL HANDLEs across all Windows
code.

(There is one oddity, which is that {Create,Open}FileMapping are
documented to return a NULL HANDLE instead of INVALID_HANDLE_VALUE
on failure. Shrug. If MS want to be inconsistent, I suppose I have
to live with it.)

[originally from svn r6833]
This commit is contained in:
Simon Tatham
2006-08-29 18:32:44 +00:00
parent 088bc613ed
commit f0a9c33f25
4 changed files with 11 additions and 11 deletions

View File

@ -1964,11 +1964,11 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
filemap = CreateFileMapping((HANDLE) 0xFFFFFFFF,
filemap = CreateFileMapping(INVALID_HANDLE_VALUE,
&sa,
PAGE_READWRITE,
0, sizeof(Config), NULL);
if (filemap) {
if (filemap && filemap != INVALID_HANDLE_VALUE) {
p = (Config *) MapViewOfFile(filemap,
FILE_MAP_WRITE,
0, 0, sizeof(Config));