xref: /third_party/python/Modules/winreparse.h (revision 7db96d56)
1#ifndef Py_WINREPARSE_H
2#define Py_WINREPARSE_H
3
4#ifdef MS_WINDOWS
5#include <windows.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11/* The following structure was copied from
12   http://msdn.microsoft.com/en-us/library/ff552012.aspx as the required
13   include km\ntifs.h isn't present in the Windows SDK (at least as included
14   with Visual Studio Express). Use unique names to avoid conflicting with
15   the structure as defined by Min GW. */
16typedef struct {
17    ULONG ReparseTag;
18    USHORT ReparseDataLength;
19    USHORT Reserved;
20    union {
21        struct {
22            USHORT SubstituteNameOffset;
23            USHORT SubstituteNameLength;
24            USHORT PrintNameOffset;
25            USHORT PrintNameLength;
26            ULONG Flags;
27            WCHAR PathBuffer[1];
28        } SymbolicLinkReparseBuffer;
29
30        struct {
31            USHORT SubstituteNameOffset;
32            USHORT  SubstituteNameLength;
33            USHORT  PrintNameOffset;
34            USHORT  PrintNameLength;
35            WCHAR  PathBuffer[1];
36        } MountPointReparseBuffer;
37
38        struct {
39            UCHAR  DataBuffer[1];
40        } GenericReparseBuffer;
41    };
42} _Py_REPARSE_DATA_BUFFER, *_Py_PREPARSE_DATA_BUFFER;
43
44#define _Py_REPARSE_DATA_BUFFER_HEADER_SIZE \
45    FIELD_OFFSET(_Py_REPARSE_DATA_BUFFER, GenericReparseBuffer)
46#define _Py_MAXIMUM_REPARSE_DATA_BUFFER_SIZE  ( 16 * 1024 )
47
48// Defined in WinBase.h in 'recent' versions of Windows 10 SDK
49#ifndef SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE
50#define SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE 0x2
51#endif
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif /* MS_WINDOWS */
58
59#endif /* !Py_WINREPARSE_H */
60