AslEnvExpandStrings
INT64 __fastcall AslEnvExpandStrings(
void *Environment,
const wchar_t *Source,
UINT64 SourceLength,
wchar_t *Destination,
UINT64 DestinationLength,
UINT64 *ReturnedLength){
UINT64 v6;
UINT64 v7;
WCHAR *v10;
unsigned int v11;
__int64 v12;
const wchar_t *v13;
UINT64 v15;
UINT64 v16;
NTSTATUS v17;
UINT64 ValueLength;
UINT64 ReturnLength;
v6 = DestinationLength;
v7 = SourceLength;
ReturnLength = 0i64;
v10 = (WCHAR *)Environment;
v11 = 0;
v12 = 0i64;
if( !SourceLength )
{
LABEL_9:
if( v6 )
*Destination = 0;
else
v11 = -1073741789;
goto LABEL_11;
}
do
{
if( *Source == 37 )
{
v15 = v7 - 1;
v16 = 0i64;
v13 = Source + 1;
if( v7 != 1 )
{
do
{
if( *v13 == 37 )
break;
++v13;
++v16;
}
while( v16 < v15 );
if( v16 && v16 < v15 )
{
v17 = AslEnvVarQuery(v10, (PWCHAR)Source + 1, v16, Destination, v6, &ReturnLength);
if( v17 == -1073741789 )
{
v12 += ReturnLength - 1;
v7 += -2i64 - v16;
}
else
{
if( v17 < 0 )
{
if( v17 != -1073741568 )
{
LODWORD(ValueLength) = v17;
AslLogCallPrintf(1ui64, "AslEnvExpandStrings", 0x27Fui64, "AslEnvVarQuery failed [%x]", ValueLength);
}
--v7;
++v12;
v13 = Source;
goto LABEL_23;
}
v12 += ReturnLength;
v7 += -2i64 - v16;
if( v6 > ReturnLength )
{
v6 -= ReturnLength;
Destination += ReturnLength;
LABEL_23:
v10 = (WCHAR *)Environment;
goto LABEL_7;
}
}
v11 = -1073741789;
goto LABEL_23;
}
}
}
if( v11 != -1073741789 )
{
if( v6 <= 1 )
{
v11 = -1073741789;
}
else
{
--v6;
*Destination++ = *Source;
}
}
++v12;
v13 = Source;
--v7;
LABEL_7:
Source = v13 + 1;
}
while( v7 );
if( v11 != -1073741789 )
goto LABEL_9;
LABEL_11:
if( ReturnedLength )
*ReturnedLength = v12 + 1;
return v11;
}Referenced by:
AslEnvExpandStrings2