RtlStringCbCopyExW
NTSTATUS __stdcall RtlStringCbCopyExW(
WCHAR *pszDest,
UINT64 cbDest,
WCHAR *pszSrc,
WCHAR **ppszDestEnd,
UINT64 *pcbRemaining,
UINT64 dwFlags){
__int16 v6;
UINT64 v8;
int v11;
WCHAR *v12;
WCHAR *v13;
size_t v15;
__int64 v16[2];
UINT64 pcchNewDestLength;
v6 = dwFlags;
v8 = cbDest >> 1;
v11 = 0;
if( (dwFlags & 0x100) != 0 )
{
if( !pszDest && v8 || v8 > 0x7FFFFFFF )
v11 = -1073741811;
}
else if( v8 - 1 > 0x7FFFFFFE )
{
v11 = -1073741811;
}
if( v11 < 0 )
{
if( v8 )
*pszDest = 0;
return v11;
}
pcchNewDestLength = (UINT64)pszDest;
v12 = pszDest;
v16[0] = cbDest >> 1;
if( (dwFlags & 0x100) != 0 )
{
v13 = (WCHAR *)&::ppszDestEnd;
if( pszSrc )
v13 = pszSrc;
pszSrc = v13;
}
v11 = 0;
if( (dwFlags & 0xFFFFE000) != 0 )
{
v11 = -1073741811;
if( v8 )
*pszDest = 0;
}
else
{
if( !v8 )
{
if( !*pszSrc )
goto LABEL_14;
v11 = pszDest != 0i64 ? -2147483643 : -1073741811;
LABEL_13:
if( v11 >= 0 )
{
LABEL_14:
if( ppszDestEnd )
*ppszDestEnd = v12;
if( pcbRemaining )
*pcbRemaining = (cbDest & 1) + 2 * v8;
return v11;
}
goto LABEL_26;
}
pcchNewDestLength = 0i64;
v11 = RtlStringCopyWorkerW((_NTSTRSAFE_PWSTR)pszDest, v8, (size_t *)&pcchNewDestLength, pszSrc, v15);
v8 -= pcchNewDestLength;
v16[0] = v8;
v12 = &pszDest[pcchNewDestLength];
pcchNewDestLength = (UINT64)v12;
if( v11 >= 0 )
{
if( (v6 & 0x200) != 0 )
{
pszSrc = (WCHAR *)((cbDest & 1) + 2 * v8);
if( (unsigned __int64)pszSrc > 2 )
memset(v12 + 1, (unsigned __int8)v6, (_DWORD)pszSrc - 2);
}
goto LABEL_13;
}
}
LABEL_26:
if( (v6 & 0x1C00) != 0 && cbDest )
{
StringExHandleOtherFlagsW(pszDest, cbDest, (WCHAR **)pszSrc, &pcchNewDestLength, (UINT64)v16);
v12 = (WCHAR *)pcchNewDestLength;
v8 = v16[0];
}
if( (int)(v11 + 0x80000000) < 0 || v11 == -2147483643 )
goto LABEL_14;
return v11;
}Referenced by:
CmGetDeviceMappedPropertyFromComposite
ConvertDevpropertyToString
ExpressionConvertToString
PiCMGetRelatedDeviceInstance
PiDqConvertQueryFlagsToString
PnpMultiSzAppend
RtlFormatMessageEx