ExpParseSignatureName
NTSTATUS __stdcall ExpParseSignatureName(
WCHAR *deviceName,
UINT64 deviceNameCount,
_GUID *diskSignature,
UINT64 *partitionNumber,
UINT64 *partitionStart,
UINT64 *partitionSize,
UINT8 *GPTpartition,
UINT8 *longSignature){
WCHAR v8;
unsigned int v9;
bool v11;
char v13;
UINT8 v14;
__int64 v15;
WCHAR v16;
UINT8 v17;
NTSTATUS result;
VOID **PoolWithTag;
UINT16 *v20;
NTSTATUS v21;
NTSTATUS v22;
__int64 v23;
VOID **v24;
int v25;
WCHAR *v26;
unsigned int v27;
__int64 v28;
__int64 v29;
int v30;
WCHAR *v31;
unsigned int v32;
__int64 v33;
int v34;
int v35;
WCHAR *v36;
unsigned int v37;
__int64 v38;
_UNICODE_STRING GuidString[4];
v8 = *deviceName;
v9 = deviceNameCount;
v11 = *deviceName == 123;
v13 = 0;
v14 = 0;
LODWORD(v15) = 0;
GuidString[0] = 0i64;
if( v9 )
{
do
{
v16 = deviceName[(unsigned int)v15];
if( v16 == 41 )
break;
if( v8 == 123 )
{
if( v16 == 125 )
{
v13 = 1;
break;
}
}
else if( v16 == 45 )
{
break;
}
LODWORD(v15) = v15 + 1;
}
while( (unsigned int)v15 < v9 );
}
if( v8 == 123 && !v13 )
return -1073741811;
v17 = v11;
if( (unsigned int)v15 > 8 )
v17 = 1;
if( v17 != 1 || v13 != 1 )
{
PoolWithTag = ExAllocatePoolWithTag(0x200ui64, 2i64 * (unsigned int)(v15 + 1), 1920364101i64);
v20 = (UINT16 *)PoolWithTag;
if( !PoolWithTag )
return -1073741670;
wcsncpy_s((WCHAR *)PoolWithTag, (unsigned int)(v15 + 1), deviceName, (unsigned int)v15);
v20[(unsigned int)v15] = 0;
if( v17 )
v21 = ExpTranslateHexStringToGUID(v20, diskSignature);
else
v21 = ExpTranslateHexStringToULONG(v20, (UINT64 *)&diskSignature->Data1);
v22 = v21;
ExFreePoolWithTag(v20, 0);
if( v22 < 0 )
return v22;
v14 = 0;
LABEL_24:
if( (unsigned int)v15 < v9 )
{
if( deviceName[(unsigned int)v15] != 45 )
{
LABEL_46:
if( (unsigned int)v15 < v9 && deviceName[(unsigned int)v15] == 41 && (v17 || v14) )
{
*GPTpartition = v17;
*longSignature = v14;
return 0;
}
return -1073741811;
}
v23 = (unsigned int)(v15 + 1);
v14 = 1;
if( (unsigned int)v23 < v9 )
{
v24 = ExAllocatePoolWithTag(0x200ui64, 0x22ui64, 1920364101i64);
if( v24 )
{
v25 = v23;
v26 = &deviceName[v23];
do
{
if( deviceName[v23] == 45 )
break;
v23 = (unsigned int)(v23 + 1);
}
while( (unsigned int)v23 < v9 );
v27 = v23 - v25;
if( (unsigned int)(v23 - v25 - 1) > 7 )
goto LABEL_51;
v28 = v27;
wcsncpy_s((WCHAR *)v24, 0x11ui64, v26, v27);
*((_WORD *)v24 + v28) = 0;
v22 = ExpTranslateHexStringToULONG((PWCHAR)v24, partitionNumber);
if( v22 < 0 )
{
LABEL_52:
ExFreePoolWithTag(v24, 0);
return v22;
}
v29 = (unsigned int)(v23 + 1);
if( (unsigned int)v29 >= v9 )
goto LABEL_51;
v30 = v29;
v31 = &deviceName[v29];
do
{
if( deviceName[v29] == 45 )
break;
v29 = (unsigned int)(v29 + 1);
}
while( (unsigned int)v29 < v9 );
v32 = v29 - v30;
if( (unsigned int)(v29 - v30 - 1) > 0xF )
goto LABEL_51;
v33 = v32;
wcsncpy_s((WCHAR *)v24, 0x11ui64, v31, v32);
*((_WORD *)v24 + v33) = 0;
v34 = ExpTranslateHexStringToULONGLONG((UINT16 *)v24, (__int64 *)partitionStart);
if( v34 < 0 )
{
v22 = v34;
goto LABEL_52;
}
v15 = (unsigned int)(v29 + 1);
if( (unsigned int)v15 >= v9 )
goto LABEL_51;
v35 = v15;
v36 = &deviceName[v15];
do
{
if( deviceName[v15] == 41 )
break;
v15 = (unsigned int)(v15 + 1);
}
while( (unsigned int)v15 < v9 );
v37 = v15 - v35;
if( (unsigned int)(v15 - v35 - 1) > 0xF )
{
LABEL_51:
v22 = -1073741811;
goto LABEL_52;
}
v38 = v37;
wcsncpy_s((WCHAR *)v24, 0x11ui64, v36, v37);
*((_WORD *)v24 + v38) = 0;
v22 = ExpTranslateHexStringToULONGLONG((UINT16 *)v24, (__int64 *)partitionSize);
ExFreePoolWithTag(v24, 0);
if( v22 < 0 )
return v22;
goto LABEL_46;
}
return -1073741670;
}
}
return -1073741811;
}
LODWORD(v15) = v15 + 1;
GuidString[0].Buffer = deviceName;
GuidString[0].Length = 2 * v15;
GuidString[0].MaximumLength = 2 * v15;
result = RtlGUIDFromString(GuidString, diskSignature);
if( result >= 0 )
goto LABEL_24;
return result;
}Referenced by:
ExpConvertSignatureName