forked from amdf/reparselib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreparselib.h
74 lines (65 loc) · 2.51 KB
/
reparselib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/** @file reparselib.h
* @brief A header file of a library for working
* with NTFS Reparse Points
* @author amdf
* @version 0.1
* @date May 2011
*/
#ifdef REPARSELIB_EXPORTS
#define REPARSELIB_API extern "C" __declspec(dllexport)
#else
#define REPARSELIB_API extern "C" __declspec(dllimport)
#endif
#define MAX_REPARSE_BUFFER 16*1024
#ifndef REPARSE_DATA_BUFFER
#define SYMLINK_FLAG_RELATIVE 1
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;
} DUMMYUNIONNAME;
} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
#endif
#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER,GenericReparseBuffer)
REPARSELIB_API BOOL ReparsePointExists(IN LPCWSTR sFileName);
REPARSELIB_API BOOL GetReparseBuffer(IN LPCWSTR sFileName, OUT PREPARSE_GUID_DATA_BUFFER pBuf);
REPARSELIB_API BOOL GetReparseGUID(IN LPCWSTR sFileName, OUT GUID* pGuid);
REPARSELIB_API BOOL GetReparseTag(IN LPCWSTR sFileName, OUT DWORD* pTag);
REPARSELIB_API BOOL DeleteReparsePoint(IN LPCWSTR sFileName);
REPARSELIB_API BOOL CreateCustomReparsePoint
(
IN LPCWSTR sFileName,
IN PVOID pBuffer,
IN UINT uBufSize,
IN GUID uGuid,
IN ULONG uReparseTag
);
REPARSELIB_API BOOL IsSymbolicLink(IN LPCWSTR sFileName);
REPARSELIB_API BOOL IsSymbolicLinkRelative(IN LPCWSTR sFileName);
REPARSELIB_API BOOL IsJunctionPoint(IN LPCWSTR sFileName);
REPARSELIB_API BOOL IsMountPoint(IN LPCWSTR sFileName);
REPARSELIB_API BOOL GetPrintName(IN LPCWSTR sFileName, OUT LPWSTR sPrintName, IN USHORT uPrintNameLength);
REPARSELIB_API BOOL GetSubstituteName(IN LPCWSTR sFileName, OUT LPWSTR sSubstituteName, IN USHORT uSubstituteNameLength);
REPARSELIB_API BOOL CreateSymlink(
IN LPCWSTR sLinkName, IN LPCWSTR sPrintName, IN LPCWSTR sSubstituteName, IN BOOL bRelative);
REPARSELIB_API BOOL CreateJunction(
IN LPCWSTR sLinkName, IN LPCWSTR sPrintName, IN LPCWSTR sSubstituteName);