LdrpGetResourceFileName
int __fastcall LdrpGetResourceFileName(
__int64 a1,
char a2,
const WCHAR *a3,
const WCHAR *a4,
struct _UNICODE_STRING *Destination){
__int64 v9;
unsigned int v10;
unsigned __int64 v11;
__int64 v12;
unsigned __int64 v13;
WCHAR *v14;
int result;
__int64 v16;
__int16 *v17;
_WORD v18[2];
__int16 Source[264];
if( !a1 || !Destination || !a4 )
return -1073741811;
v9 = *(unsigned __int16 *)(a1 + 88);
v10 = *(unsigned __int16 *)(a1 + 72);
v11 = v10 - v9;
if( v11 >= 0x208 || (unsigned __int16)v10 <= (unsigned __int16)v9 )
return -1073020927;
v12 = (unsigned int)v11;
memmove((UINT8 *)Source, *(UINT8 **)(a1 + 80), (unsigned int)v11);
v13 = v12 & 0xFFFFFFFFFFFFFFFEui64;
if( v13 >= 0x208 )
_report_rangecheckfailure();
*(__int16 *)((char *)Source + v13) = 0;
if( !a2 )
{
v14 = (WCHAR *)Source;
goto LABEL_9;
}
v16 = -1i64;
do
++v16;
while( Source[v16] );
v17 = &v18[(unsigned int)v16];
if( v17 <= Source )
return -1073741686;
do
{
if( *v17 == 92 )
break;
--v17;
}
while( v17 > Source );
if( v17 <= Source )
return -1073741686;
v17[1] = 0;
result = RtlAppendUnicodeToString(Destination, (PWCHAR)Source);
if( result >= 0 )
{
v14 = L"SystemResources\\";
LABEL_9:
result = RtlAppendUnicodeToString(Destination, v14);
if( result >= 0 )
{
if( !a2 )
{
RtlAppendUnicodeToString(Destination, (PWCHAR)a4);
RtlAppendUnicodeToString(Destination, (PWCHAR)L"\\");
}
result = RtlAppendUnicodeToString(Destination, *(PWCHAR *)(a1 + 96));
if( result >= 0 )
{
if( a3 )
return RtlAppendUnicodeToString(Destination, (PWCHAR)a3);
}
}
}
return result;
}Referenced by:
LdrLoadAlternateResourceModuleEx