# HG changeset patch # Parent 95df96aa2f5a03eab9d98324c4c4e2993b1ebb0f Issue #17599: Private Py_REPARSE_DATA_BUFFER etc names to avoid conflict The conflict occurs with Min GW, which already defines REPARSE_DATA_BUFFER. Also, Min GW uses a lowercase filename. diff -r 95df96aa2f5a Modules/_winapi.c --- a/Modules/_winapi.c Tue Jul 26 12:23:16 2016 -0400 +++ b/Modules/_winapi.c Wed Jul 27 04:17:35 2016 +0000 @@ -486,7 +486,7 @@ const USHORT prefix_len = 4; USHORT print_len = 0; USHORT rdb_size = 0; - PREPARSE_DATA_BUFFER rdb = NULL; + Py_PREPARSE_DATA_BUFFER rdb = NULL; /* Junction point creation */ HANDLE junction = NULL; @@ -542,18 +542,18 @@ - the size of the print name in bytes - the size of the substitute name in bytes - the size of two NUL terminators in bytes */ - rdb_size = REPARSE_DATA_BUFFER_HEADER_SIZE + + rdb_size = Py_REPARSE_DATA_BUFFER_HEADER_SIZE + sizeof(rdb->MountPointReparseBuffer) - sizeof(rdb->MountPointReparseBuffer.PathBuffer) + /* Two +1's for NUL terminators. */ (prefix_len + print_len + 1 + print_len + 1) * sizeof(WCHAR); - rdb = (PREPARSE_DATA_BUFFER)PyMem_RawMalloc(rdb_size); + rdb = (Py_PREPARSE_DATA_BUFFER)PyMem_RawMalloc(rdb_size); if (rdb == NULL) goto cleanup; memset(rdb, 0, rdb_size); rdb->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT; - rdb->ReparseDataLength = rdb_size - REPARSE_DATA_BUFFER_HEADER_SIZE; + rdb->ReparseDataLength = rdb_size - Py_REPARSE_DATA_BUFFER_HEADER_SIZE; rdb->MountPointReparseBuffer.SubstituteNameOffset = 0; rdb->MountPointReparseBuffer.SubstituteNameLength = (prefix_len + print_len) * sizeof(WCHAR); diff -r 95df96aa2f5a Modules/posixmodule.c --- a/Modules/posixmodule.c Tue Jul 26 12:23:16 2016 -0400 +++ b/Modules/posixmodule.c Wed Jul 27 04:17:35 2016 +0000 @@ -1106,8 +1106,8 @@ static int win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag) { - char target_buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; - REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER *)target_buffer; + char target_buffer[Py_MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; + Py_REPARSE_DATA_BUFFER *rdb = (Py_REPARSE_DATA_BUFFER *)target_buffer; DWORD n_bytes_returned; if (0 == DeviceIoControl( @@ -7149,8 +7149,8 @@ int dir_fd; HANDLE reparse_point_handle; - char target_buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; - REPARSE_DATA_BUFFER *rdb = (REPARSE_DATA_BUFFER *)target_buffer; + char target_buffer[Py_MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; + Py_REPARSE_DATA_BUFFER *rdb = (Py_REPARSE_DATA_BUFFER *)target_buffer; const wchar_t *print_name; static char *keywords[] = {"path", "dir_fd", NULL}; diff -r 95df96aa2f5a Modules/winreparse.h --- a/Modules/winreparse.h Tue Jul 26 12:23:16 2016 -0400 +++ b/Modules/winreparse.h Wed Jul 27 04:17:35 2016 +0000 @@ -2,7 +2,7 @@ #define Py_WINREPARSE_H #ifdef MS_WINDOWS -#include +#include #ifdef __cplusplus extern "C" { @@ -11,8 +11,9 @@ /* The following structure was copied from http://msdn.microsoft.com/en-us/library/ff552012.aspx as the required include doesn't seem to be present in the Windows SDK (at least as included - with Visual Studio Express). */ -typedef struct _REPARSE_DATA_BUFFER { + with Visual Studio Express). Use separate names to avoid conflicting with + the structure as defined by Min GW. */ +typedef struct { ULONG ReparseTag; USHORT ReparseDataLength; USHORT Reserved; @@ -38,11 +39,11 @@ UCHAR DataBuffer[1]; } GenericReparseBuffer; }; -} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; +} Py_REPARSE_DATA_BUFFER, *Py_PREPARSE_DATA_BUFFER; -#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER,\ - GenericReparseBuffer) -#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) +#define Py_REPARSE_DATA_BUFFER_HEADER_SIZE \ + FIELD_OFFSET(Py_REPARSE_DATA_BUFFER, GenericReparseBuffer) +#define Py_MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) #ifdef __cplusplus }