summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorTim Golden <mail@timgolden.me.uk>2014-04-27 17:35:36 (GMT)
committerTim Golden <mail@timgolden.me.uk>2014-04-27 17:35:36 (GMT)
commitfbf963c06492f55a6831c06a3895312c165d6478 (patch)
tree74a1e68b19371727d9844c025587323e12a40964 /Modules/posixmodule.c
parent15efd2b6439d118ad1635d881753a42fed997eb0 (diff)
downloadcpython-fbf963c06492f55a6831c06a3895312c165d6478.zip
cpython-fbf963c06492f55a6831c06a3895312c165d6478.tar.gz
cpython-fbf963c06492f55a6831c06a3895312c165d6478.tar.bz2
Backed out changeset: 17df50df62c7
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 916be81..8cd5485 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -27,8 +27,6 @@
#include "Python.h"
#ifndef MS_WINDOWS
#include "posixmodule.h"
-#else
-#include "winreparse.h"
#endif
#ifdef __cplusplus
@@ -303,9 +301,6 @@ extern int lstat(const char *, struct stat *);
#ifndef IO_REPARSE_TAG_SYMLINK
#define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
#endif
-#ifndef IO_REPARSE_TAG_MOUNT_POINT
-#define IO_REPARSE_TAG_MOUNT_POINT (0xA0000003L)
-#endif
#include "osdefs.h"
#include <malloc.h>
#include <windows.h>
@@ -1114,6 +1109,41 @@ _PyVerify_fd_dup2(int fd1, int fd2)
#endif
#ifdef MS_WINDOWS
+/* The following structure was copied from
+ http://msdn.microsoft.com/en-us/library/ms791514.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 {
+ ULONG ReparseTag;
+ USHORT ReparseDataLength;
+ USHORT Reserved;
+ union {
+ struct {
+ USHORT SubstituteNameOffset;
+ USHORT SubstituteNameLength;
+ USHORT PrintNameOffset;
+ USHORT PrintNameLength;
+ ULONG Flags;
+ WCHAR PathBuffer[1];
+ } SymbolicLinkReparseBuffer;
+
+ struct {
+ USHORT SubstituteNameOffset;
+ USHORT SubstituteNameLength;
+ USHORT PrintNameOffset;
+ USHORT PrintNameLength;
+ WCHAR PathBuffer[1];
+ } MountPointReparseBuffer;
+
+ struct {
+ UCHAR DataBuffer[1];
+ } GenericReparseBuffer;
+ };
+} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
+
+#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER,\
+ GenericReparseBuffer)
+#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 )
static int
win32_get_reparse_tag(HANDLE reparse_point_handle, ULONG *reparse_tag)
@@ -4462,10 +4492,7 @@ BOOL WINAPI Py_DeleteFileW(LPCWSTR lpFileName)
find_data_handle = FindFirstFileW(lpFileName, &find_data);
if(find_data_handle != INVALID_HANDLE_VALUE) {
- /* IO_REPARSE_TAG_SYMLINK if it is a symlink and
- IO_REPARSE_TAG_MOUNT_POINT if it is a junction point. */
- is_link = find_data.dwReserved0 == IO_REPARSE_TAG_SYMLINK ||
- find_data.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT;
+ is_link = find_data.dwReserved0 == IO_REPARSE_TAG_SYMLINK;
FindClose(find_data_handle);
}
}