ExpConvertSignatureName
NTSTATUS __stdcall ExpConvertSignatureName(
UINT64 OutputType,
_FILE_PATH *OutputPath,
UINT64 *OutputPathLength,
WCHAR *pDeviceName,
WCHAR *pPathName,
UINT64 DeviceNameCount){
int v6;
NTSTATUS result;
UINT8 v10;
int v11;
int v12;
VOID **PoolWithTag;
wchar_t *v14;
int v15;
NTSTATUS v16;
NTSTATUS v17;
UINT64 *partitionStart;
UINT8 GPTpartition;
char longSignature[3];
UINT64 partitionNumber;
char pDiskNumber[12];
UINT64 pPartitionSize;
UINT64 pPartitionStart[2];
_UNICODE_STRING ResultName;
_GUID diskSignature;
v6 = OutputType;
LODWORD(partitionNumber) = 0;
memset(pDiskNumber, 0, sizeof(pDiskNumber));
pPartitionStart[1] = 0i64;
pPartitionSize = 0i64;
pPartitionStart[0] = 0i64;
diskSignature = 0i64;
GPTpartition = 0;
longSignature[0] = 0;
ResultName = 0i64;
result = ExpParseSignatureName(
pDeviceName,
(unsigned int)DeviceNameCount,
&diskSignature,
&partitionNumber,
(UINT64 *)&pDiskNumber[4],
&pPartitionSize,
&GPTpartition,
(UINT8 *)longSignature);
if( result >= 0 )
{
if( longSignature[0] == 1 && v6 == 4 )
return ExpCreateOutputEFI(
OutputPath,
OutputPathLength,
(_DISK_SIGNATURE_NEW *)&diskSignature,
&partitionNumber,
(UINT64 *)&pDiskNumber[4],
&pPartitionSize,
pPathName,
GPTpartition);
v10 = GPTpartition;
v11 = 0;
if( !GPTpartition )
v11 = partitionNumber;
HIDWORD(partitionNumber) = v11;
result = ExpFindDiskSignature(
(_DISK_SIGNATURE_NEW *)&diskSignature,
(UINT64 *)((char *)&partitionNumber + 4),
(UINT64 *)pDiskNumber,
&pPartitionStart[1],
pPartitionStart,
GPTpartition);
if( result >= 0 )
{
v12 = HIDWORD(partitionNumber);
if( longSignature[0] == 1
&& ((_DWORD)partitionNumber != HIDWORD(partitionNumber)
|| *(_QWORD *)&pDiskNumber[4] != pPartitionStart[1]
|| pPartitionSize != pPartitionStart[0]) )
{
return -1073741811;
}
if( v6 == 4 )
return ExpCreateOutputEFI(
OutputPath,
OutputPathLength,
(_DISK_SIGNATURE_NEW *)&diskSignature,
(UINT64 *)((char *)&partitionNumber + 4),
&pPartitionStart[1],
pPartitionStart,
pPathName,
v10);
PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 0x5Eui64, 1920364101i64);
v14 = (wchar_t *)PoolWithTag;
if( !PoolWithTag )
return -1073741670;
LODWORD(partitionStart) = v12;
swprintf_s(
(WCHAR *)PoolWithTag,
0x2Fui64,
(WCHAR *)L"\\Device\\Harddisk%lu\\Partition%lu",
*(unsigned int *)pDiskNumber,
partitionStart);
v15 = ExpTranslateSymbolicLink(v14, &ResultName);
ExFreePoolWithTag(v14, 0);
if( v15 < 0 )
return v15;
if( v6 == 3 )
{
v16 = ExpCreateOutputNT(OutputPath, OutputPathLength, &ResultName, pPathName);
}
else
{
if( v6 != 1 )
{
v17 = -1073741811;
goto LABEL_26;
}
v16 = ExpCreateOutputARC(OutputPath, OutputPathLength, &ResultName, pPathName);
}
v17 = v16;
LABEL_26:
ExFreePoolWithTag(ResultName.Buffer, 0);
return v17;
}
}
return result;
}Referenced by:
ExpTranslateArcPath