218{
231 ULONG dwCreateOptions;
233
234 if(!lpSymlinkFileName || !lpTargetFileName || (
dwFlags | SYMBOLIC_LINK_FLAG_DIRECTORY) != SYMBOLIC_LINK_FLAG_DIRECTORY)
235 {
238 }
239
240 if(
dwFlags & SYMBOLIC_LINK_FLAG_DIRECTORY)
242 else
244
246 {
250 bRelativePath =
TRUE;
252 break;
253
255 {
257 SIZE_T cchTargetFullFileName;
258
260
261 if(cchTargetFullFileName == 0)
262 {
265 }
266
267 lpTargetFullFileName =
RtlAllocateHeap(RtlGetProcessHeap(), 0, cchTargetFullFileName *
sizeof(
WCHAR));
268
269 if(lpTargetFullFileName ==
NULL)
270 {
273 }
274
275 if(
GetFullPathNameW(lpTargetFileName, cchTargetFullFileName, lpTargetFullFileName, &FilePart) == 0)
276 {
279 }
280 }
281
282 lpTargetFileName = lpTargetFullFileName;
283
284
285
290 default:
292 {
293 bAllocatedTarget =
TRUE;
296 }
297 }
298
299 cbPrintName =
wcslen(lpTargetFileName) *
sizeof(
WCHAR);
302
303 if(pReparseData ==
NULL)
304 {
307 }
308
310
314
319
324
326
327 if(bRelativePath)
329
331 {
334 }
335
337
339 (
340 &hSymlink,
346 0,
350 0
351 );
352
354 {
357 }
358
360 (
361 hSymlink,
367 pReparseData,
368 cbReparseData,
370 0
371 );
372
374 {
378
381 }
382
384
386 if(hSymlink)
388
390 if (bAllocatedTarget)
391 {
393 0,
395 }
396
397 if(lpTargetFullFileName)
398 RtlFreeHeap(RtlGetProcessHeap(), 0, lpTargetFullFileName);
399
400 if(pReparseData)
402
404 {
407 }
408
410}
#define FILE_DIRECTORY_FILE
#define FILE_NON_DIRECTORY_FILE
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
#define FILE_ATTRIBUTE_NORMAL
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
static const WCHAR Cleanup[]
@ 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)
#define REPARSE_DATA_BUFFER_HEADER_SIZE
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)
#define FSCTL_SET_REPARSE_POINT
struct _REPARSE_DATA_BUFFER::@312::@314 SymbolicLinkReparseBuffer
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
DWORD WINAPI GetLastError(void)
#define ERROR_PATH_NOT_FOUND
#define IO_REPARSE_TAG_SYMLINK