35#if (NTDDI_VERSION >= NTDDI_WS03)
36#define IOCTL_MOUNTDEV_LINK_CREATED_UNSECURE_DEPRECATED CTL_CODE(MOUNTDEVCONTROLTYPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
37#define IOCTL_MOUNTDEV_LINK_DELETED_UNSECURE_DEPRECATED CTL_CODE(MOUNTDEVCONTROLTYPE, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
109 GlobalString->Length = IntGlobal.
Length;
111 GlobalString->Buffer = IntGlobal.
Buffer;
211#if (NTDDI_VERSION >= NTDDI_WS03)
280#if (NTDDI_VERSION >= NTDDI_WS03)
330 if (ValueNameString.
Length)
368 if (!ValueNameString.
Length)
375 if (!ValueNameString.
Buffer)
384 while (ReturnString->
Length)
390 *ReturnString = ValueNameString;
454 IN BOOLEAN UseOnlyIfThereAreNoOtherLinks,
475 DeviceInformation->UniqueId,
483 if (SuggestedLinkName && !
IsDriveLetter(SuggestedLinkName) &&
484 UseOnlyIfThereAreNoOtherLinks && *SymLinkCount == 0)
504 SuggestedLinkName->Buffer,
506 DeviceInformation->UniqueId->UniqueId,
507 DeviceInformation->UniqueId->UniqueIdLength);
518 DeviceInformation->UniqueId,
567 DeviceInformation->UniqueId,
584 if (
IsListEmpty(&(DeviceExtension->SavedLinksListHead)))
590 for (NextEntry = DeviceExtension->SavedLinksListHead.
Flink;
591 NextEntry != &(DeviceExtension->SavedLinksListHead);
592 NextEntry = NextEntry->
Flink)
596 SavedLinksListEntry);
603 UniqueId->UniqueIdLength) ==
604 UniqueId->UniqueIdLength)
608 return SavedLinkInformation;
687 SuggestedLinkName->Length = IoCtlSuggested->
NameLength;
690 if (!SuggestedLinkName->Buffer)
697 SuggestedLinkName->Buffer[SuggestedLinkName->Length /
sizeof(
WCHAR)] =
UNICODE_NULL;
725 for (NextEntry = SavedLinkInformation->SymbolicLinksListHead.
Flink;
726 NextEntry != &(SavedLinkInformation->SymbolicLinksListHead);
727 NextEntry = NextEntry->
Flink)
763 if (
IsListEmpty(&(DeviceExtension->DeviceListHead)))
769 for (DeviceEntry = DeviceExtension->DeviceListHead.
Flink;
770 DeviceEntry != &(DeviceExtension->DeviceListHead);
771 DeviceEntry = DeviceEntry->
Flink)
777 SymbolEntry = SymbolEntry->
Flink)
872 Status = ZwQuerySymbolicLinkObject(LinkHandle,
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
static const WCHAR SymbolicLink[]
static const WCHAR Cleanup[]
NTSTATUS QuerySymbolicLinkNamesFromStorage(IN PDEVICE_EXTENSION DeviceExtension, IN PDEVICE_INFORMATION DeviceInformation, IN PUNICODE_STRING SuggestedLinkName, IN BOOLEAN UseOnlyIfThereAreNoOtherLinks, OUT PUNICODE_STRING *SymLinks, OUT PULONG SymLinkCount, IN BOOLEAN HasGuid, IN LPGUID Guid)
NTSTATUS NTAPI SymbolicLinkNamesFromUniqueIdQuery(IN PWSTR ValueName, IN ULONG ValueType, IN PVOID ValueData, IN ULONG ValueLength, IN PVOID Context, IN PVOID EntryContext)
VOID SendLinkCreated(IN PUNICODE_STRING SymbolicName)
NTSTATUS GlobalCreateSymbolicLink(IN PUNICODE_STRING DosName, IN PUNICODE_STRING DeviceName)
UNICODE_STRING SafeVolumes
NTSTATUS GlobalDeleteSymbolicLink(IN PUNICODE_STRING DosName)
NTSTATUS MountMgrQuerySymbolicLink(IN PUNICODE_STRING SymbolicName, IN OUT PUNICODE_STRING LinkTarget)
#define IOCTL_MOUNTDEV_LINK_DELETED_UNSECURE_DEPRECATED
UNICODE_STRING DeviceFloppy
UNICODE_STRING DosDevicesMount
UNICODE_STRING ReparseIndex
#define IOCTL_MOUNTDEV_LINK_CREATED_UNSECURE_DEPRECATED
BOOLEAN IsDriveLetter(PUNICODE_STRING SymbolicName)
NTSTATUS NTAPI SymbolicLinkNamesFromUniqueIdCount(IN PWSTR ValueName, IN ULONG ValueType, IN PVOID ValueData, IN ULONG ValueLength, IN PVOID Context, IN PVOID EntryContext)
UNICODE_STRING DeviceMount
NTSTATUS CreateNewVolumeName(OUT PUNICODE_STRING VolumeName, IN PGUID VolumeGuid OPTIONAL)
UNICODE_STRING DeviceCdRom
NTSTATUS QuerySuggestedLinkName(IN PUNICODE_STRING SymbolicName, OUT PUNICODE_STRING SuggestedLinkName, OUT PBOOLEAN UseOnlyIfThereAreNoOtherLinks)
VOID SendLinkDeleted(IN PUNICODE_STRING DeviceName, IN PUNICODE_STRING SymbolicName)
PSAVED_LINK_INFORMATION RemoveSavedLinks(IN PDEVICE_EXTENSION DeviceExtension, IN PMOUNTDEV_UNIQUE_ID UniqueId)
VOID DeleteSymbolicLinkNameFromMemory(IN PDEVICE_EXTENSION DeviceExtension, IN PUNICODE_STRING SymbolicLink, IN BOOLEAN MarkOffline)
UNICODE_STRING DosDevices
NTSTATUS CreateStringWithGlobal(IN PUNICODE_STRING DosName, OUT PUNICODE_STRING GlobalString)
BOOLEAN RedirectSavedLink(IN PSAVED_LINK_INFORMATION SavedLinkInformation, IN PUNICODE_STRING DosName, IN PUNICODE_STRING NewLink)
#define RemoveEntryList(Entry)
#define IsListEmpty(ListHead)
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
#define RtlCompareMemory(s1, s2, l)
_Must_inspect_result_ _Inout_opt_ PUNICODE_STRING VolumeName
_In_ GUID _In_ PVOID ValueData
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID, PUNICODE_STRING)
NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID)
#define AllocatePool(Size)
NTKERNELAPI NTSTATUS ExUuidCreate(OUT UUID *Uuid)
#define ExFreePoolWithTag(_P, _T)
#define IOCTL_MOUNTDEV_LINK_CREATED
#define IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME
#define MOUNTMGR_DEVICE_NAME
#define IOCTL_MOUNTDEV_LINK_DELETED
struct _MOUNTDEV_SUGGESTED_LINK_NAME MOUNTDEV_SUGGESTED_LINK_NAME
#define InitializeObjectAttributes(p, n, a, r, s)
_In_ PNDIS_STRING _In_ PNDIS_STRING SymbolicName
NTSYSAPI NTSTATUS NTAPI ZwOpenSymbolicLinkObject(_Out_ PHANDLE SymbolicLinkHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes)
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
_In_ PCWSTR _Inout_ _At_ QueryTable EntryContext
_In_ PCWSTR _Inout_ _At_ QueryTable _Pre_unknown_ PRTL_QUERY_REGISTRY_TABLE QueryTable
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
#define FILE_READ_ATTRIBUTES
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define RTL_REGISTRY_ABSOLUTE
NTSYSAPI BOOLEAN NTAPI RtlPrefixUnicodeString(IN PUNICODE_STRING String1, IN PUNICODE_STRING String2, IN BOOLEAN CaseInSensitive)
#define UNREFERENCED_PARAMETER(P)
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
PDEVICE_OBJECT NTAPI IoGetAttachedDeviceReference(PDEVICE_OBJECT DeviceObject)
NTSTATUS NTAPI IoCreateSymbolicLink(IN PUNICODE_STRING SymbolicLinkName, IN PUNICODE_STRING DeviceName)
NTSTATUS NTAPI IoDeleteSymbolicLink(IN PUNICODE_STRING SymbolicLinkName)
#define STATUS_BUFFER_OVERFLOW
PULONG MinorVersion OPTIONAL
struct _LIST_ENTRY * Flink
BOOLEAN UseOnlyIfThereAreNoOtherLinks
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine
#define RTL_CONSTANT_STRING(s)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
_Must_inspect_result_ _In_ WDFOBJECT _In_ CONST GUID * Guid
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
#define ObDereferenceObject
_Out_ PUNICODE_STRING DosName
_Inout_ PUNICODE_STRING LinkTarget