SdbpCreateSearchDBContext
__int64 __fastcall SdbpCreateSearchDBContext(_QWORD *a1, const wchar_t **a2){
unsigned int v4;
WCHAR *v5;
VOID *v6;
INT64 v7;
const wchar_t *v8;
__int64 v9;
unsigned int v10;
WCHAR *v11;
VOID *v12;
INT64 v13;
WCHAR *v14;
WCHAR *v16;
char *v17;
INT64 v18;
WCHAR *v19;
WCHAR v20;
WCHAR *v21;
VOID *v22;
INT64 v23;
_WORD *v24;
UINT64 v25;
UINT64 v26;
wchar_t pszSrc[264];
wchar_t Extension[264];
v4 = 0;
memset((INT64)Extension, 0i64);
v5 = 0i64;
memset((INT64)pszSrc, 0i64);
if( !a2 )
{
v16 = (WCHAR *)AslAlloc(v6, 4ui64, v7);
v17 = (char *)((char *)L"." - (char *)v16);
v11 = v16;
v18 = 2i64;
v19 = v16;
do
{
if( v18 == -2147483644 )
break;
v20 = *(WCHAR *)((char *)v19 + (_QWORD)v17);
if( !v20 )
break;
*v19++ = v20;
--v18;
}
while( v18 );
v21 = v19 - 1;
if( v18 )
v21 = v19;
*v21 = 0;
v5 = (WCHAR *)AslAlloc(v19, 2ui64, v18);
*v5 = 0;
v24 = AslAlloc(v22, 2ui64, v23);
*v24 = 0;
a1[3] = v24;
goto LABEL_9;
}
v8 = *a2;
v9 = -1i64;
do
++v9;
while( v8[v9] );
v10 = v9 + 1;
v11 = (WCHAR *)AslAlloc(v6, 2i64 * (unsigned int)(v9 + 1), v7);
if( !v11 )
{
AslLogCallPrintf(1ui64, "SdbpCreateSearchDBContext", 0xD4ui64, "Unable to allocate memory for directory path");
return v4;
}
if( (int)AslPathSplit(v8, v11, v10, pszSrc, v25, Extension, v26) < 0 )
{
AslLogCallPrintf(1ui64, "SdbpCreateSearchDBContext", 0xDFui64, "Unable to parse executable path for \"%ws\"", v8);
}
else
{
v14 = (WCHAR *)AslAlloc(v12, 0x208ui64, v13);
v5 = v14;
if( v14 )
{
if( RtlStringCchCopyW(v14, 0x104ui64, pszSrc) >= 0 && RtlStringCchCatW(v5, 0x104ui64, Extension) >= 0 )
{
LABEL_9:
a1[7] = 0i64;
a1[6] = 0i64;
a1[9] = 0i64;
a1[8] = 0i64;
a1[11] = 0i64;
v4 = 1;
a1[1] = a2;
a1[4] = v11;
a1[5] = v5;
return v4;
}
}
else
{
AslLogCallPrintf(1ui64, "SdbpCreateSearchDBContext", 0xE5ui64, "Unable to allocate memory for full name");
}
}
ExFreePoolWithTag(v11, 0x74705041u);
if( v5 )
ExFreePoolWithTag(v5, 0x74705041u);
return v4;
}Referenced by:
SdbGetDatabaseMatch
SdbpCheckKObject