36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# define LABEL_SECURITY_INFORMATION (0x00000010L)
#endif
#ifndef FSCTL_GET_REPARSE_POINT
# define FSCTL_GET_REPARSE_POINT (((0x00000009) << 16) | ((0x00000000) << 14) | ((42) << 2) | (0))
#endif
#if defined(__MSVCRT__)
static HANDLE dllhandle = NULL;
static DWORD WINAPI (*getFinalPathNameByHandleW) (HANDLE, LPWSTR, DWORD, DWORD) = NULL;
static BOOLEAN APIENTRY (*createSymbolicLinkW) (LPCWSTR, LPCWSTR, DWORD) = NULL;
#endif
/* a couple defines to make the borrowed struct below compile */
#ifndef _ANONYMOUS_UNION
# define _ANONYMOUS_UNION
#endif
#define DUMMYUNIONNAME
|
<
|
|
<
|
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# define LABEL_SECURITY_INFORMATION (0x00000010L)
#endif
#ifndef FSCTL_GET_REPARSE_POINT
# define FSCTL_GET_REPARSE_POINT (((0x00000009) << 16) | ((0x00000000) << 14) | ((42) << 2) | (0))
#endif
static HANDLE dllhandle = NULL;
static DWORD (WINAPI *getFinalPathNameByHandleW) (HANDLE, LPWSTR, DWORD, DWORD) = NULL;
static BOOLEAN (APIENTRY *createSymbolicLinkW) (LPCWSTR, LPCWSTR, DWORD) = NULL;
/* a couple defines to make the borrowed struct below compile */
#ifndef _ANONYMOUS_UNION
# define _ANONYMOUS_UNION
#endif
#define DUMMYUNIONNAME
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
} FOSSIL_REPARSE_DATA_BUFFER;
#define LINK_BUFFER_SIZE 1024
static int isVistaOrLater(){
if( !dllhandle ){
HANDLE h = LoadLibraryW(L"KERNEL32");
createSymbolicLinkW = (BOOLEAN APIENTRY (*) (LPCWSTR, LPCWSTR, DWORD)) GetProcAddress(h, "CreateSymbolicLinkW");
getFinalPathNameByHandleW = (DWORD WINAPI (*) (HANDLE, LPWSTR, DWORD, DWORD)) GetProcAddress(h, "GetFinalPathNameByHandleW");
dllhandle = h;
}
return createSymbolicLinkW != NULL;
}
/*
** Fill stat buf with information received from GetFileAttributesExW().
|
|
|
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
} FOSSIL_REPARSE_DATA_BUFFER;
#define LINK_BUFFER_SIZE 1024
static int isVistaOrLater(){
if( !dllhandle ){
HANDLE h = LoadLibraryW(L"KERNEL32");
createSymbolicLinkW = (BOOLEAN (APIENTRY *) (LPCWSTR, LPCWSTR, DWORD)) GetProcAddress(h, "CreateSymbolicLinkW");
getFinalPathNameByHandleW = (DWORD (WINAPI *) (HANDLE, LPWSTR, DWORD, DWORD)) GetProcAddress(h, "GetFinalPathNameByHandleW");
dllhandle = h;
}
return createSymbolicLinkW != NULL;
}
/*
** Fill stat buf with information received from GetFileAttributesExW().
|