135 SpecifierLength = (
p - ArcPath) *
sizeof(
CHAR);
165 TokenSpecifier->MaximumLength,
166 ArcPath, SpecifierLength);
170 TokenSpecifier->Length = (
USHORT)SpecifierLength;
200 SpecifierLength = (
p - ArcPath) *
sizeof(
WCHAR);
232 TokenSpecifier->MaximumLength,
233 ArcPath, SpecifierLength);
237 TokenSpecifier->Length = (
USHORT)SpecifierLength;
289 while (TokenTable[
Index])
293 if ((
Length == CandidateToken->Length /
sizeof(
WCHAR)) &&
321 if (NormalizedArcPath->MaximumLength <
sizeof(
UNICODE_NULL))
325 NormalizedArcPath->Length = 0;
329 EndOfArcName = ArcPath +
wcslen(ArcPath);
331 while ((
p =
wcsstr(ArcPath,
L"()")) && (
p < EndOfArcName))
335 NormalizedArcPath->MaximumLength,
336 ArcPath, (
p - ArcPath) *
sizeof(
WCHAR));
339 NormalizedArcPath->MaximumLength,
340 ArcPath, (
p - ArcPath) *
sizeof(
WCHAR));
346 NormalizedArcPath->MaximumLength,
351 NormalizedArcPath->Buffer +=
wcslen(NormalizedArcPath->Buffer);
357 NormalizedArcPath->MaximumLength,
393 WCHAR TokenBuffer[50];
396 ULONG AdapterKey = 0;
397 ULONG ControllerKey = 0;
398 ULONG PeripheralKey = 0;
411 RtlInitEmptyUnicodeString(&
Token, TokenBuffer,
sizeof(TokenBuffer));
419 DPRINT1(
"No adapter specified!\n");
491 DPRINT1(
"%S(%lu) adapter with %S(%lu non-zero), ignored!\n",
511 DPRINT1(
"%S(%lu)%S(%lu) adapter-controller doesn't have a peripheral!\n",
530 DPRINT1(
"%S(%lu) controller cannot have a %S(%lu) peripheral! (note that we haven't check whether the adapter was SCSI or not)\n",
539 DPRINT1(
"%S(%lu)%S(%lu) SCSI adapter-controller has an invalid peripheral %S(%lu) !\n",
547 if (
AdapterType == SignatureAdapter && PeripheralKey != 0)
549 DPRINT1(
"%S(%lu) adapter with %S(%lu non-zero), ignored!\n",
577 *pAdapterKey = AdapterKey;
578 *pControllerKey = ControllerKey;
579 *pPeripheralKey = PeripheralKey;
582 *pControllerType = ControllerType;
583 *pPeripheralType = PeripheralType;
584 *pUseSignature = UseSignature;
623 DPRINT1(
"NtOpenDirectoryObject(%wZ) failed, Status 0x%08lx\n", &ArcNameDir,
Status);
643 DPRINT1(
"NtOpenSymbolicLinkObject(%wZ) failed, Status 0x%08lx\n", ArcName,
Status);
661 DPRINT1(
"NtQuerySymbolicLinkObject(%wZ) failed, Status 0x%08lx\n", ArcName,
Status);
733 L"\\Device\\Ramdisk%lu", AdapterKey);
739 L"\\Device\\Scsi\\CdRom%lu", ControllerKey);
746 L"\\Device\\CdRom%lu", PeripheralKey);
752 L"\\Device\\Floppy%lu", PeripheralKey);
768 ControllerKey, PeripheralKey);
782 L"\\Device\\Harddisk%lu\\Partition%lu",
787 if (PeripheralType == VDiskPeripheral)
791 L"\\Device\\VirtualHarddisk%lu\\Partition%lu",
806 NameLength =
wcslen(NtName->Buffer);
812 NtName->Length = (
USHORT)NameLength *
sizeof(
WCHAR);
863 DPRINT1(
"ResolveArcNameNtSymLink(ArcName = '%wZ') for ArcPath = '%S' failed, Status 0x%08lx\n", &ArcName, ArcPath,
Status);
872 DPRINT1(
"PartList == NULL, cannot perform a manual resolution\n");
879 BeginOfPath = ArcPath;
884 DPRINT1(
"ResolveArcNameManually(ArcPath = '%S') failed, Status 0x%08lx\n", ArcPath,
Status);
894 if (BeginOfPath && *BeginOfPath)
static HANDLE DirectoryHandle
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
char * strchr(const char *String, int ch)
#define OBJ_NAME_PATH_SEPARATOR
static ULONG ArcMatchToken_UStr(IN PCUNICODE_STRING CandidateToken, IN const PCWSTR *TokenTable)
const PCWSTR PeripheralTypes_U[]
ULONG ArcMatchTokenA(IN PCSTR CandidateToken, IN const PCSTR *TokenTable)
enum _ADAPTER_TYPE ADAPTER_TYPE
static PCWSTR ArcGetNextTokenU(IN PCWSTR ArcPath, OUT PUNICODE_STRING TokenSpecifier, OUT PULONG Key)
static NTSTATUS ResolveArcNameManually(OUT PUNICODE_STRING NtName, IN OUT PCWSTR *ArcNamePath, IN PPARTLIST PartList)
static NTSTATUS ResolveArcNameNtSymLink(OUT PUNICODE_STRING NtName, IN PUNICODE_STRING ArcName)
const PCSTR AdapterTypes_A[]
const PCWSTR AdapterTypes_U[]
enum _CONTROLLER_TYPE CONTROLLER_TYPE
BOOLEAN ArcPathNormalize(OUT PUNICODE_STRING NormalizedArcPath, IN PCWSTR ArcPath)
ULONG ArcMatchTokenU(IN PCWSTR CandidateToken, IN const PCWSTR *TokenTable)
const PCWSTR ControllerTypes_U[]
PCSTR ArcGetNextTokenA(IN PCSTR ArcPath, OUT PANSI_STRING TokenSpecifier, OUT PULONG Key)
enum _CONTROLLER_TYPE * PCONTROLLER_TYPE
BOOLEAN ArcPathToNtPath(OUT PUNICODE_STRING NtPath, IN PCWSTR ArcPath, IN PPARTLIST PartList OPTIONAL)
const PCSTR PeripheralTypes_A[]
const PCSTR ControllerTypes_A[]
enum _ADAPTER_TYPE * PADAPTER_TYPE
enum _PERIPHERAL_TYPE PERIPHERAL_TYPE
static NTSTATUS ParseArcName(IN OUT PCWSTR *ArcNamePath, OUT PULONG pAdapterKey, OUT PULONG pControllerKey, OUT PULONG pPeripheralKey, OUT PULONG pPartitionNumber, OUT PADAPTER_TYPE pAdapterType, OUT PCONTROLLER_TYPE pControllerType, OUT PPERIPHERAL_TYPE pPeripheralType, OUT PBOOLEAN pUseSignature)
enum _PERIPHERAL_TYPE * PPERIPHERAL_TYPE
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define STATUS_NOT_SUPPORTED
#define NT_SUCCESS(StatCode)
NTSTATUS ConcatPaths(IN OUT PWSTR PathBuffer, IN SIZE_T cchPathSize, IN ULONG NumberOfPathComponents, IN ...)
GLdouble GLdouble GLdouble GLdouble q
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define OBJ_CASE_INSENSITIVE
#define InitializeObjectAttributes(p, n, a, r, s)
#define SYMBOLIC_LINK_QUERY
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
#define DIRECTORY_ALL_ACCESS
#define UNICODE_STRING_MAX_CHARS
#define UNICODE_STRING_MAX_BYTES
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define STATUS_OBJECT_PATH_SYNTAX_BAD
#define STATUS_OBJECT_PATH_INVALID
#define STATUS_NAME_TOO_LONG
NTSTRSAFEAPI RtlStringCbCatW(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
NTSTRSAFEAPI RtlStringCbCopyNA(_Out_writes_bytes_(cbDest) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCSTR pszSrc, _In_ size_t cbToCopy)
NTSTRSAFEAPI RtlStringCbCatNW(_Inout_updates_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToAppend) STRSAFE_LPCWSTR pszSrc, _In_ size_t cbToAppend)
NTSTRSAFEAPI RtlStringCbCopyNW(_Out_writes_bytes_(cbDest) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_reads_bytes_(cbToCopy) STRSAFE_LPCWSTR pszSrc, _In_ size_t cbToCopy)
NTSTATUS NTAPI NtOpenDirectoryObject(OUT PHANDLE DirectoryHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
NTSTATUS NTAPI NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, OUT PUNICODE_STRING LinkTarget, OUT PULONG ResultLength OPTIONAL)
NTSTATUS NTAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
PDISKENTRY GetDiskBySCSI(_In_ PPARTLIST List, _In_ USHORT Port, _In_ USHORT Bus, _In_ USHORT Id)
PDISKENTRY GetDiskBySignature(_In_ PPARTLIST List, _In_ ULONG Signature)
PPARTENTRY GetPartition(_In_ PDISKENTRY DiskEntry, _In_ ULONG PartitionNumber)
#define STATUS_BUFFER_TOO_SMALL
PULONG MinorVersion OPTIONAL
struct _DISKENTRY * DiskEntry
#define STATUS_OBJECT_PATH_NOT_FOUND
#define STATUS_OBJECT_NAME_INVALID
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ ULONG _In_ ULONG PartitionNumber