KsepStringConcatenate
NTSTATUS __stdcall KsepStringConcatenate(
UNICODE_STRING *ResultString,
PWCHAR LeftString,
PWCHAR RightString,
UINT64 WithBackSlash){
int v4;
__int64 v8;
__int64 v9;
UINT64 v10;
UINT64 v11;
__int64 v12;
UINT64 v13;
wchar_t *v14;
unsigned __int16 v15;
__int64 v17;
__int64 v18;
__int64 v19;
v4 = WithBackSlash;
if( !ResultString )
{
v17 = ((unsigned __int8)_InterlockedExchangeAdd(&KsepHistoryErrorsIndex, 1u) + 1) & 0x3F;
KsepHistoryErrors[2 * v17 + 1] = -1073740768;
KsepHistoryErrors[2 * v17] = 197324;
if( (KsepDebugFlag & 4) != 0 )
RtlAssert("ResultString != NULL", "minkernel\\ntos\\kshim\\ksemisc.c", 0x2CCu, 0i64);
}
if( !LeftString )
{
v18 = ((unsigned __int8)_InterlockedExchangeAdd(&KsepHistoryErrorsIndex, 1u) + 1) & 0x3F;
KsepHistoryErrors[2 * v18 + 1] = -1073740768;
KsepHistoryErrors[2 * v18] = 197325;
if( (KsepDebugFlag & 4) != 0 )
RtlAssert("LeftString != NULL", "minkernel\\ntos\\kshim\\ksemisc.c", 0x2CDu, 0i64);
}
if( !RightString )
{
v19 = ((unsigned __int8)_InterlockedExchangeAdd(&KsepHistoryErrorsIndex, 1u) + 1) & 0x3F;
KsepHistoryErrors[2 * v19 + 1] = -1073740768;
KsepHistoryErrors[2 * v19] = 197326;
if( (KsepDebugFlag & 4) != 0 )
RtlAssert("RightString != NULL", "minkernel\\ntos\\kshim\\ksemisc.c", 0x2CEu, 0i64);
}
v8 = -1i64;
*ResultString = 0i64;
v9 = -1i64;
do
++v9;
while( LeftString[v9] );
v10 = 2 * v9;
do
++v8;
while( RightString[v8] );
v11 = 2 * v8;
v12 = -(__int64)(v4 != 0) & 2;
v13 = v10 + v12 + v11;
if( v13 + 1 > 0xFFFE )
return -2147483643;
KsepPoolAllocatePaged(v13 + 2);
if( !v14 )
return -1073741801;
ResultString->Buffer = v14;
memmove((UINT8 *)v14, (UINT8 *)LeftString, v10);
if( v4 )
ResultString->Buffer[v10 >> 1] = 92;
memmove((UINT8 *)&ResultString->Buffer[(v12 + v10) >> 1], (UINT8 *)RightString, v11);
v15 = v11 + v10 + v12;
ResultString->Buffer[v13 >> 1] = 0;
ResultString->Length = v15;
ResultString->MaximumLength = v15 + 2;
return 0;
}Referenced by:
KsepLoadShimProvider
KsepRegistryOpenKey