Comment about the status of two '#if 0'.
[SETUPLIB] Fix some uninitialized variables (caught by clang-cl).
Also, initialize NtName->Length in return paths in ResolveArcNameManually().
while (TokenTable[Index])
{
#if 0
while (TokenTable[Index])
{
#if 0
- Length = wcslen(TokenTable[Index])*sizeof(WCHAR);
- if (RtlCompareMemory(CandidateToken->Buffer, TokenTable[Index], Length) == Length)
+ Length = wcslen(TokenTable[Index]);
+ if ((Length == CandidateToken->Length / sizeof(WCHAR)) &&
+ (_wcsnicmp(CandidateToken->Buffer, TokenTable[Index], Length) == 0))
+ {
#else
RtlInitUnicodeString(&Token, TokenTable[Index]);
#else
RtlInitUnicodeString(&Token, TokenTable[Index]);
- // if (RtlCompareUnicodeString(CandidateToken, &Token, TRUE) == 0)
if (RtlEqualUnicodeString(CandidateToken, &Token, TRUE))
break;
#endif
if (RtlEqualUnicodeString(CandidateToken, &Token, TRUE))
break;
#endif
WCHAR TokenBuffer[50];
UNICODE_STRING Token;
PCWSTR p, q;
WCHAR TokenBuffer[50];
UNICODE_STRING Token;
PCWSTR p, q;
- ULONG AdapterKey;
- ULONG ControllerKey;
- ULONG PeripheralKey;
- ULONG PartitionNumber;
- ADAPTER_TYPE AdapterType;
- CONTROLLER_TYPE ControllerType;
- PERIPHERAL_TYPE PeripheralType;
+ ULONG AdapterKey = 0;
+ ULONG ControllerKey = 0;
+ ULONG PeripheralKey = 0;
+ ULONG PartitionNumber = 0;
+ ADAPTER_TYPE AdapterType = AdapterTypeMax;
+ CONTROLLER_TYPE ControllerType = ControllerTypeMax;
+ PERIPHERAL_TYPE PeripheralType = PeripheralTypeMax;
BOOLEAN UseSignature = FALSE;
/*
BOOLEAN UseSignature = FALSE;
/*
else
{
/* Check for regular adapters */
else
{
/* Check for regular adapters */
- AdapterType = (ADAPTER_TYPE)/*ArcMatchTokenU*/ArcMatchToken_UStr(/*Token.Buffer*/&Token, AdapterTypes_U);
+ // ArcMatchTokenU(Token.Buffer, AdapterTypes_U);
+ AdapterType = (ADAPTER_TYPE)ArcMatchToken_UStr(&Token, AdapterTypes_U);
if (AdapterType >= AdapterTypeMax)
{
DPRINT1("Invalid adapter type %wZ\n", &Token);
if (AdapterType >= AdapterTypeMax)
{
DPRINT1("Invalid adapter type %wZ\n", &Token);
DPRINT1("%S(%lu) adapter doesn't have a controller!\n", AdapterTypes_U[AdapterType], AdapterKey);
return STATUS_OBJECT_PATH_SYNTAX_BAD;
}
DPRINT1("%S(%lu) adapter doesn't have a controller!\n", AdapterTypes_U[AdapterType], AdapterKey);
return STATUS_OBJECT_PATH_SYNTAX_BAD;
}
- ControllerType = (CONTROLLER_TYPE)/*ArcMatchTokenU*/ArcMatchToken_UStr(/*Token.Buffer*/&Token, ControllerTypes_U);
+ // ArcMatchTokenU(Token.Buffer, ControllerTypes_U);
+ ControllerType = (CONTROLLER_TYPE)ArcMatchToken_UStr(&Token, ControllerTypes_U);
if (ControllerType >= ControllerTypeMax)
{
DPRINT1("Invalid controller type %wZ\n", &Token);
if (ControllerType >= ControllerTypeMax)
{
DPRINT1("Invalid controller type %wZ\n", &Token);
ControllerTypes_U[ControllerType], ControllerKey);
return STATUS_OBJECT_PATH_SYNTAX_BAD;
}
ControllerTypes_U[ControllerType], ControllerKey);
return STATUS_OBJECT_PATH_SYNTAX_BAD;
}
- PeripheralType = (PERIPHERAL_TYPE)/*ArcMatchTokenU*/ArcMatchToken_UStr(/*Token.Buffer*/&Token, PeripheralTypes_U);
+ // ArcMatchTokenU(Token.Buffer, PeripheralTypes_U);
+ PeripheralType = (PERIPHERAL_TYPE)ArcMatchToken_UStr(&Token, PeripheralTypes_U);
if (PeripheralType >= PeripheralTypeMax)
{
DPRINT1("Invalid peripheral type %wZ\n", &Token);
if (PeripheralType >= PeripheralTypeMax)
{
DPRINT1("Invalid peripheral type %wZ\n", &Token);
if (NtName->MaximumLength < sizeof(UNICODE_NULL))
return STATUS_BUFFER_TOO_SMALL;
if (NtName->MaximumLength < sizeof(UNICODE_NULL))
return STATUS_BUFFER_TOO_SMALL;
-#if 0
- *NtName->Buffer = UNICODE_NULL;
- NtName->Length = 0;
-#endif
-
/* Open the \ArcName object directory */
RtlInitUnicodeString(&ArcNameDir, L"\\ArcName");
InitializeObjectAttributes(&ObjectAttributes,
/* Open the \ArcName object directory */
RtlInitUnicodeString(&ArcNameDir, L"\\ArcName");
InitializeObjectAttributes(&ObjectAttributes,
if (NtName->MaximumLength < sizeof(UNICODE_NULL))
return STATUS_BUFFER_TOO_SMALL;
if (NtName->MaximumLength < sizeof(UNICODE_NULL))
return STATUS_BUFFER_TOO_SMALL;
-#if 0
- *NtName->Buffer = UNICODE_NULL;
- NtName->Length = 0;
-#endif
-
/* Parse the ARC path */
Status = ParseArcName(ArcNamePath,
&AdapterKey,
/* Parse the ARC path */
Status = ParseArcName(ArcNamePath,
&AdapterKey,
// TODO: Check the partition number in case of fdisks and cdroms??
// TODO: Check the partition number in case of fdisks and cdroms??
- /* Check for adapters that don't take any extra controller or peripheral nodes */
+ /* Check for adapters that don't take any extra controller or peripheral node */
if (AdapterType == NetAdapter || AdapterType == RamdiskAdapter)
{
if (AdapterType == NetAdapter)
if (AdapterType == NetAdapter || AdapterType == RamdiskAdapter)
{
if (AdapterType == NetAdapter)
L"\\Device\\Harddisk%lu\\Partition%lu",
DiskEntry->DiskNumber, PartitionNumber);
}
L"\\Device\\Harddisk%lu\\Partition%lu",
DiskEntry->DiskNumber, PartitionNumber);
}
+#if 0 // FIXME: Not implemented yet!
else
if (PeripheralType == VDiskPeripheral)
{
else
if (PeripheralType == VDiskPeripheral)
{
#endif
if (!NT_SUCCESS(Status))
#endif
if (!NT_SUCCESS(Status))
+ {
+ /* Returned NtName is invalid, so zero it out */
+ *NtName->Buffer = UNICODE_NULL;
+ NtName->Length = 0;
+
+ }
+
+ /* Update NtName length */
+ NtName->Length = wcslen(NtName->Buffer) * sizeof(WCHAR);
}
}
NtPath->Length = wcslen(NtPath->Buffer) * sizeof(WCHAR);
}
}
NtPath->Length = wcslen(NtPath->Buffer) * sizeof(WCHAR);
+#if 0 // FIXME: Not implemented yet!
PWSTR
NtPathToArcPath(
IN PWSTR NtPath)
PWSTR
NtPathToArcPath(
IN PWSTR NtPath)