Index: Modules/posixmodule.c =================================================================== --- Modules/posixmodule.c (revision 68473) +++ Modules/posixmodule.c (working copy) @@ -270,6 +270,11 @@ #endif #include "osdefs.h" #include +/* Some SDKs don't define this value for use with GetFileAttributes(), +so we simply add it if not. */ +#if !defined(INVALID_FILE_ATTRIBUTES) +# define INVALID_FILE_ATTRIBUTES 0xffffffffu +#endif #include /* for ShellExecute() */ #define popen _popen #define pclose _pclose @@ -905,7 +910,7 @@ /* Use GetFileAttributes to validate that the file name does not contain wildcards (which FindFirstFile would accept). */ - if (GetFileAttributesA(pszFile) == 0xFFFFFFFF) + if (GetFileAttributesA(pszFile) == INVALID_FILE_ATTRIBUTES) return FALSE; return attributes_from_dir(pszFile, pfad); } @@ -935,7 +940,7 @@ /* Use GetFileAttributes to validate that the file name does not contain wildcards (which FindFirstFile would accept). */ - if (GetFileAttributesW(pszFile) == 0xFFFFFFFF) + if (GetFileAttributesW(pszFile) == INVALID_FILE_ATTRIBUTES) return FALSE; return attributes_from_dir_w(pszFile, pfad); } @@ -1525,13 +1530,13 @@ } if (!PyArg_ParseTuple(args, "eti:access", Py_FileSystemDefaultEncoding, &path, &mode)) - return 0; + return NULL; Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesA(path); Py_END_ALLOW_THREADS PyMem_Free(path); finish: - if (attr == 0xFFFFFFFF) + if (attr == INVALID_FILE_ATTRIBUTES) /* File does not exist, or cannot read attributes */ return PyBool_FromLong(0); /* Access is possible if either write access wasn't requested, or @@ -1668,7 +1673,7 @@ if (PyArg_ParseTuple(args, "Ui|:chmod", &po, &i)) { Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); - if (attr != 0xFFFFFFFF) { + if (attr != INVALID_FILE_ATTRIBUTES) { if (i & _S_IWRITE) attr &= ~FILE_ATTRIBUTE_READONLY; else @@ -1693,7 +1698,7 @@ return NULL; Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesA(path); - if (attr != 0xFFFFFFFF) { + if (attr != INVALID_FILE_ATTRIBUTES) { if (i & _S_IWRITE) attr &= ~FILE_ATTRIBUTE_READONLY; else Index: PC/bdist_wininst/extract.c =================================================================== --- PC/bdist_wininst/extract.c (revision 68473) +++ PC/bdist_wininst/extract.c (working copy) @@ -8,6 +8,11 @@ */ #include +/* Some SDKs don't define this value for use with GetFileAttributes(), +so we simply add it if not. */ +#if !defined(INVALID_FILE_ATTRIBUTES) +# define INVALID_FILE_ATTRIBUTES 0xffffffffu +#endif #include "zlib.h" @@ -32,7 +37,7 @@ DWORD attr; *new_part = '\0'; attr = GetFileAttributes(pathname); - if (attr == -1) { + if (attr == INVALID_FILE_ATTRIBUTES) { /* nothing found */ if (!CreateDirectory(pathname, NULL) && notify) notify(SYSTEM_ERROR,