SepParseElamCertResources
INT64 __stdcall SepParseElamCertResources(PVOID ResourceBase, UINT64 ResourceSize){
int v2;
unsigned int v3;
const wchar_t *v4;
const wchar_t *v5;
INT64 result;
const wchar_t *v7;
WCHAR *v8;
unsigned int v9;
bool v10;
char v11;
wchar_t v12;
char v13;
unsigned int v14;
wchar_t v15;
unsigned __int16 *v16;
size_t v17;
unsigned int v18;
WCHAR *v19;
WCHAR *v20;
unsigned int v21;
__int64 v22;
unsigned __int64 v23;
WCHAR v24;
unsigned __int64 v25;
__int64 v26;
__int16 v27;
__int64 v28;
__int64 v29;
__int64 v30;
WCHAR *v31;
__int64 v32;
int v33;
int v34;
const wchar_t *v35;
unsigned int v36;
size_t pcchLength;
size_t v38;
const wchar_t *v39;
__int16 v40[24];
char v41[448];
pcchLength = 0i64;
v2 = 0;
v38 = 0i64;
if( ResourceSize - 2 > 0xFFFD )
return 3221225485i64;
v3 = *(unsigned __int16 *)ResourceBase;
v4 = (const wchar_t *)((char *)ResourceBase + ResourceSize);
v39 = (const wchar_t *)((char *)ResourceBase + ResourceSize);
v5 = (const wchar_t *)((char *)ResourceBase + 2);
v36 = v3;
v34 = 0;
if( !v3 )
return(unsigned int)v2;
while( 1 )
{
if( v5 + 1 > v4 )
return 3221225485i64;
LODWORD(result) = RtlStringCchLengthW(v5, (unsigned __int64)((char *)v4 - (char *)v5) >> 1, &pcchLength);
if( (int)result < 0 )
return result;
v7 = &v5[pcchLength + 1];
v8 = (WCHAR *)(v7 + 1);
v35 = v7;
if( v7 + 1 >= v4 )
return 3221225485i64;
v9 = 0;
v10 = 1;
if( *v5 )
{
do
{
if( v9 >= 0x40 )
return 3221225485i64;
if( v10 )
{
if( v9 >= 0x40ui64 )
_report_rangecheckfailure();
v41[v9] = 0;
v11 = 0;
}
else
{
v41[v9] *= 16;
v11 = v41[v9];
}
v12 = *v5;
if( *v5 == 32 )
{
if( !v10 )
return 3221225485i64;
}
else
{
if( v12 <= 0x2Fu )
return 3221225485i64;
if( v12 > 0x39u )
{
if( v12 <= 0x40u )
return 3221225485i64;
if( v12 > 0x46u )
{
if( v12 <= 0x60u || v12 > 0x66u )
return 3221225485i64;
v13 = v12 - 87;
}
else
{
v13 = v12 - 55;
}
}
else
{
v13 = v12 - 48;
}
v41[v9] = v11 + v13;
}
v14 = v9 + 1;
if( v10 )
v14 = v9;
v9 = v14;
if( *v5 != 32 )
v10 = !v10;
++v5;
}
while( *v5 );
if( !v10 )
return 3221225485i64;
}
v15 = *v7;
if( *v7 != 0x8004 && (v15 <= 0x800Bu || v15 > 0x800Eu) )
return 3221225485i64;
LODWORD(result) = RtlStringCchLengthW(v7 + 1, (unsigned __int64)((char *)v4 - (char *)v8) >> 1, &v38);
if( (int)result < 0 )
return result;
v17 = v38;
v18 = 0;
v19 = &v8[v38];
v5 = v19 + 1;
if( v38 )
{
v20 = wcschr(v8, 0x3Bu);
if( !v20 )
{
v20 = v19;
goto LABEL_54;
}
while( 1 )
{
v21 = 0;
v22 = 0i64;
v23 = (unsigned __int64)((char *)v20 - (char *)v8 + 1) >> 1;
if( v8 > v20 )
v23 = 0i64;
if( v23 )
{
do
{
v24 = *v8;
++v22;
++v8;
v25 = ((unsigned __int64)v18 << 6) + v21++;
*(_WORD *)&v41[2 * v25 + 64] = v24;
}
while( v22 != v23 );
v4 = v39;
}
v26 = v21;
v27 = 2 * v21;
*(_WORD *)&v41[128 * (unsigned __int64)v18 + 64 + 2 * v26] = 0;
v28 = 2i64 * v18;
v40[4 * v28] = v27;
v40[4 * v28 + 1] = v27 + 2;
*(_QWORD *)&v40[4 * v28 + 4] = &v41[128 * (unsigned __int64)v18 + 64];
if( !*v20 )
break;
v31 = v20 + 1;
if( !*v31 )
break;
v8 = v31;
v20 = wcschr(v31, 0x3Bu);
if( !v20 )
{
v32 = -1i64;
do
++v32;
while( v8[v32] );
v20 = &v8[v32];
}
if( ++v18 >= 3 )
goto LABEL_34;
LABEL_54:
if( !v20 )
goto LABEL_34;
}
++v18;
LABEL_34:
v16 = (unsigned __int16 *)v35;
}
v29 = v17 != 0 ? v18 : 0;
v30 = -(__int64)v17;
if( !qword_140C1D910 )
break;
v33 = v29;
LOBYTE(v29) = 7;
v2 = qword_140C1D910(v29, v41, v9, *v16, (unsigned __int64)v40 & -(__int64)(v30 != 0), v33, 0i64);
if( v2 >= 0 && ++v34 < v36 )
continue;
return(unsigned int)v2;
}
return(unsigned int)-1073741637;
}Referenced by:
SeRegisterElamCertResources