12#if _WIN32_WINNT != _WIN32_WINNT_VISTA
13#error "This file must be compiled with _WIN32_WINNT == _WIN32_WINNT_VISTA"
17#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
97 DWORD pdwSizeW = *pdwSize;
103 *pdwSize *
sizeof(
WCHAR));
134 OUT APPLICATION_RECOVERY_CALLBACK* pRecoveryCallback,
189 DWORD dwPingInterval,
231 ULONG dwCreateOptions;
234 if(!lpSymlinkFileName || !lpTargetFileName || (
dwFlags | SYMBOLIC_LINK_FLAG_DIRECTORY) != SYMBOLIC_LINK_FLAG_DIRECTORY)
240 if(
dwFlags & SYMBOLIC_LINK_FLAG_DIRECTORY)
250 bRelativePath =
TRUE;
257 SIZE_T cchTargetFullFileName;
261 if(cchTargetFullFileName == 0)
267 lpTargetFullFileName =
RtlAllocateHeap(RtlGetProcessHeap(), 0, cchTargetFullFileName *
sizeof(
WCHAR));
269 if(lpTargetFullFileName ==
NULL)
275 if(
GetFullPathNameW(lpTargetFileName, cchTargetFullFileName, lpTargetFullFileName, &FilePart) == 0)
282 lpTargetFileName = lpTargetFullFileName;
293 bAllocatedTarget =
TRUE;
299 cbPrintName =
wcslen(lpTargetFileName) *
sizeof(
WCHAR);
303 if(pReparseData ==
NULL)
390 if (bAllocatedTarget)
397 if(lpTargetFullFileName)
398 RtlFreeHeap(RtlGetProcessHeap(), 0, lpTargetFullFileName);
425 if(!lpSymlinkFileName || !lpTargetFileName)
458 if (
dwFlags & ~(VOLUME_NAME_DOS | VOLUME_NAME_GUID | VOLUME_NAME_NT |
459 VOLUME_NAME_NONE | FILE_NAME_NORMALIZED | FILE_NAME_OPENED))
485 if (cchFilePath != 0 &&
486 cchFilePath >
sizeof(FilePathW) /
sizeof(FilePathW[0]))
503 FilePathU.
Buffer = FilePathW;
527 if (FilePathU.
Buffer != FilePathW)
610 DWORD *pcbFileMUIInfo)
612 DPRINT1(
"%x %p %p %p\n",
dwFlags, pcwszFilePath, pFileMUIInfo, pcbFileMUIInfo);
627 PWSTR pwszFileMUIPath,
631 DPRINT1(
"%x %p %p %p %p %p\n",
dwFlags, pcwszFilePath, pwszLanguage, pwszFileMUIPath, pcchFileMUIPath, pululEnumerator);
642GetProcessPreferredUILanguages(
646 PULONG pcchLanguagesBuffer)
648 DPRINT1(
"%x %p %p %p\n",
dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
663 PULONG pcchLanguagesBuffer)
665 DPRINT1(
"%x %p %p %p\n",
dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
679 PULONG pcchLanguagesBuffer)
681 DPRINT1(
"%x %p %p %p\n",
dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
707 PDWORD pcchFallbackLanguages,
710 DPRINT1(
"%x %p %p %p %p\n",
dwFlags, pwmszLanguage, pwszFallbackLanguages, pcchFallbackLanguages, pdwAttributes);
725 PULONG pcchLanguagesBuffer)
727 DPRINT1(
"%x %p %p %p\n",
dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
738SetProcessPreferredUILanguages(
743 DPRINT1(
"%x %p %p\n",
dwFlags, pwszLanguagesBuffer, pulNumLanguages);
760 DPRINT1(
"%x %p %p\n",
dwFlags, pwszLanguagesBuffer, pulNumLanguages);
ACPI_SIZE strlen(const char *String)
#define FILE_DIRECTORY_FILE
#define FILE_NON_DIRECTORY_FILE
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
#define ERROR_CALL_NOT_IMPLEMENTED
#define ERROR_INVALID_PARAMETER
#define INVALID_HANDLE_VALUE
#define FILE_ATTRIBUTE_NORMAL
#define WideCharToMultiByte
PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc)
DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU)
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
static const WCHAR Cleanup[]
UNICODE_STRING * PUNICODE_STRING
struct _UNICODE_STRING UNICODE_STRING
@ FileDispositionInformation
#define FILE_OPEN_REPARSE_POINT
#define FILE_SYNCHRONOUS_IO_NONALERT
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
HRESULT WINAPI RegisterApplicationRecoveryCallback(IN APPLICATION_RECOVERY_CALLBACK pRecoveryCallback, IN PVOID pvParameter OPTIONAL, DWORD dwPingInterval, DWORD dwFlags)
BOOL WINAPI QueryFullProcessImageNameA(HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD pdwSize)
HANDLE WINAPI OpenFileById(IN HANDLE hFile, IN LPFILE_ID_DESCRIPTOR lpFileID, IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes OPTIONAL, IN DWORD dwFlags)
BOOLEAN WINAPI CreateSymbolicLinkW(IN LPCWSTR lpSymlinkFileName, IN LPCWSTR lpTargetFileName, IN DWORD dwFlags)
BOOL WINAPI SetFileBandwidthReservation(IN HANDLE hFile, IN DWORD nPeriodMilliseconds, IN DWORD nBytesPerPeriod, IN BOOL bDiscardable, OUT LPDWORD lpTransferSize, OUT LPDWORD lpNumOutstandingRequests)
HRESULT WINAPI RegisterApplicationRestart(IN PCWSTR pwzCommandline OPTIONAL, IN DWORD dwFlags)
HRESULT WINAPI GetApplicationRestart(IN HANDLE hProcess, OUT PWSTR pwzCommandline OPTIONAL, IN OUT PDWORD pcchSize, OUT PDWORD pdwFlags OPTIONAL)
BOOL WINAPI GetUserPreferredUILanguages(DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
BOOL WINAPI GetThreadPreferredUILanguages(DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
BOOL WINAPI GetSystemPreferredUILanguages(DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
BOOL WINAPI GetFileMUIPath(DWORD dwFlags, PCWSTR pcwszFilePath, PWSTR pwszLanguage, PULONG pcchLanguage, PWSTR pwszFileMUIPath, PULONG pcchFileMUIPath, PULONGLONG pululEnumerator)
BOOL WINAPI SetThreadPreferredUILanguages(DWORD dwFlags, PCZZWSTR pwszLanguagesBuffer, PULONG pulNumLanguages)
BOOL WINAPI GetUILanguageInfo(DWORD dwFlags, PCZZWSTR pwmszLanguage, PZZWSTR pwszFallbackLanguages, PDWORD pcchFallbackLanguages, PDWORD pdwAttributes)
DWORD WINAPI GetFinalPathNameByHandleW(IN HANDLE hFile, OUT LPWSTR lpszFilePath, IN DWORD cchFilePath, IN DWORD dwFlags)
HRESULT WINAPI GetApplicationRecoveryCallback(IN HANDLE hProcess, OUT APPLICATION_RECOVERY_CALLBACK *pRecoveryCallback, OUT PVOID *ppvParameter, PDWORD dwPingInterval, PDWORD dwFlags)
BOOL WINAPI GetFileMUIInfo(DWORD dwFlags, PCWSTR pcwszFilePath, PFILEMUIINFO pFileMUIInfo, DWORD *pcbFileMUIInfo)
LANGID WINAPI GetThreadUILanguage(VOID)
VOID WINAPI ApplicationRecoveryFinished(IN BOOL bSuccess)
BOOLEAN NTAPI CreateSymbolicLinkA(IN LPCSTR lpSymlinkFileName, IN LPCSTR lpTargetFileName, IN DWORD dwFlags)
BOOL WINAPI GetFileBandwidthReservation(IN HANDLE hFile, OUT LPDWORD lpPeriodMilliseconds, OUT LPDWORD lpBytesPerPeriod, OUT LPBOOL pDiscardable, OUT LPDWORD lpTransferSize, OUT LPDWORD lpNumOutstandingRequests)
BOOL WINAPI QueryFullProcessImageNameW(HANDLE hProcess, DWORD dwFlags, LPWSTR lpExeName, PDWORD pdwSize)
#define REPARSE_DATA_BUFFER_HEADER_SIZE
DWORD WINAPI GetFinalPathNameByHandleA(IN HANDLE hFile, OUT LPSTR lpszFilePath, IN DWORD cchFilePath, IN DWORD dwFlags)
HRESULT WINAPI ApplicationRecoveryInProgress(OUT PBOOL pbCancelled)
_In_ BOOL _In_ HANDLE hProcess
#define memcpy(s1, s2, n)
static LPFILE_ID_DESCRIPTOR
static DWORD LPSTR lpExeName
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_U(_In_ PCWSTR Path)
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
@ RtlPathTypeRootLocalDevice
@ RtlPathTypeDriveRelative
@ RtlPathTypeDriveAbsolute
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI NtSetInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define FILE_WRITE_ATTRIBUTES
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
NTSYSAPI NTSTATUS NTAPI NtFsControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
_NullNull_terminated_ WCHAR * PZZWSTR
_NullNull_terminated_ CONST WCHAR * PCZZWSTR
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
#define FSCTL_SET_REPARSE_POINT
DWORD BaseSetLastNTError(IN NTSTATUS Status)
#define STATUS_BUFFER_TOO_SMALL
PULONG MinorVersion OPTIONAL
struct _REPARSE_DATA_BUFFER::@312::@314 SymbolicLinkReparseBuffer
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define STATUS_INFO_LENGTH_MISMATCH
DWORD WINAPI GetLastError(void)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define ERROR_PATH_NOT_FOUND
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
#define IO_REPARSE_TAG_SYMLINK