ExpCreateOutputEFI
NTSTATUS __stdcall ExpCreateOutputEFI(
VOID *OutputPath,
UINT64 *OutputPathLength,
_DISK_SIGNATURE_NEW *pDiskSignature,
UINT64 *pPartitionNumber,
UINT64 *pPartitionStart,
UINT64 *pPartitionSize,
WCHAR *pPathName,
UINT8 GPTpartition){
NTSTATUS v8;
unsigned __int64 v9;
UINT64 *v10;
int v13;
__int64 v15;
size_t v16;
NTSTATUS result;
UINT64 *v18;
unsigned __int64 BytesPerSector;
char v20;
char *v21;
UINT64 pDiskNumber;
UINT64 *v23;
_DISK_GEOMETRY DiskGeometry;
v8 = 0;
v9 = 0i64;
v10 = pPartitionNumber;
v23 = pPartitionNumber;
LODWORD(pDiskNumber) = 0;
v13 = 54;
if( pPathName )
{
v15 = -1i64;
do
++v15;
while( pPathName[v15] );
v9 = (unsigned int)(2 * v15 + 2);
v10 = pPartitionNumber;
v13 = v9 + 58;
}
v16 = v13 + 4;
if( *(_DWORD *)OutputPathLength < v16 )
{
v8 = -1073741789;
LABEL_15:
*(_DWORD *)OutputPathLength = v16;
return v8;
}
HIDWORD(pDiskNumber) = *(_DWORD *)v10;
memset(&DiskGeometry, 0, sizeof(DiskGeometry));
result = ExpFindDiskSignature(
pDiskSignature,
(UINT64 *)((char *)&pDiskNumber + 4),
&pDiskNumber,
0i64,
0i64,
GPTpartition);
if( result >= 0 )
{
result = ExpGetDriveGeometry((unsigned int)pDiskNumber, &DiskGeometry);
if( result >= 0 )
{
memset(OutputPath, 0i64, v16);
v18 = v23;
BytesPerSector = DiskGeometry.BytesPerSector;
v20 = 1;
*(_DWORD *)OutputPath = 1;
*((_DWORD *)OutputPath + 1) = v16;
*((_DWORD *)OutputPath + 2) = 4;
v21 = (char *)OutputPath + 12;
*(_DWORD *)v21 = 2752772;
*((_DWORD *)v21 + 1) = *(_DWORD *)v18;
*((_QWORD *)v21 + 1) = *pPartitionStart / BytesPerSector;
*((_QWORD *)v21 + 2) = *pPartitionSize / BytesPerSector;
if( GPTpartition == 1 )
{
v20 = 2;
*(_OWORD *)(v21 + 24) = *(_OWORD *)&pDiskSignature->Signature;
}
else
{
*((_DISK_SIGNATURE_NEW *)v21 + 6) = (_DISK_SIGNATURE_NEW)pDiskSignature->Signature;
}
v21[40] = v20;
v21[41] = v20;
if( pPathName )
{
v21 += *((unsigned __int16 *)v21 + 1);
*(_WORD *)v21 = 1028;
*((_WORD *)v21 + 1) = v9 + 4;
memmove(v21 + 4, pPathName, v9 - 2);
*(_WORD *)&v21[2 * (v9 >> 1) + 2] = 0;
}
*(_DWORD *)&v21[*((unsigned __int16 *)v21 + 1)] = 327551;
goto LABEL_15;
}
}
return result;
}Referenced by:
ExpConvertSignatureName
ExpTranslateNtPath