#include "117828F1-DA7D-4BC1-8B58-9A954FED5121.h"
// SecureString.c - Extracted from 117828F1-DA7D-4BC1-8B58-9A954FED5121.c
// Functions: 27
// Function: AsciiSPrint @ 0x16f8 (0xf08 bytes)
// Index: 24/906
UINTN AsciiSPrint(CHAR8 *StartOfBuffer, UINTN BufferSize, const CHAR8 *FormatString, ...)
{
const CHAR16 *v3; // r14
__int64 v4; // r12
CHAR8 *StartOfBuffer_1; // r13
const CHAR16 *StartOfBuffer_2; // rsi
__int64 n2_1; // rdi
CHAR8 *StartOfBuffera_1; // rbx
unsigned __int64 v11; // r9
__int64 n2_2; // r8
__int64 n0xFFFF; // r10
int v14; // eax
unsigned __int64 n10; // rcx
int *v16; // r15
unsigned __int64 n512_5; // r9
char v18; // r11
unsigned __int64 n512_3; // rsi
unsigned __int64 n512_2; // rbp
const char *_r_n_1; // rbx
int *va_1; // rdx
unsigned __int64 n13_1; // rcx
__int64 v24; // rax
unsigned __int64 v25; // rcx
unsigned __int64 v26; // rcx
unsigned __int64 v27; // rcx
unsigned __int64 v28; // rcx
unsigned __int64 n4; // rcx
unsigned __int16 *v30; // r9
__int64 n4_1; // rcx
signed __int64 v32; // rbx
char n32; // al
char n32_1; // di
__int64 n16; // r8
unsigned __int64 v36; // rdi
int v37; // ebp
int v38; // e... [28186 chars total]
// Function: AsciiSPrint_w @ 0x2600 (0x22 bytes)
// Index: 25/906
UINTN sub_2600(
CHAR8 *_r_n,
UINTN n38,
const CHAR8 *FormatString,
const char *%08x_%04x_%04x_%02x%02x_%02x%02x%02x%02x%02x%02x,
...)
{
return AsciiSPrint(_r_n, n38, FormatString); /*0x261d*/
}
// Function: StrLen @ 0x2ef0 (0xbf bytes)
// Index: 44/906
UINTN __cdecl StrLen(const CHAR16 *String)
{
const CHAR16 *v1; // rbx
UINTN i; // rdi
v1 = String; /*0x2f08*/
if ( !String ) /*0x2f10*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0xA6u, "String != ((void *) 0)"); /*0x2f25*/
if ( ((unsigned __int8)v1 & 1) != 0 ) /*0x2f36*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0xA7u, "((UINTN) String & 0x00000001) == 0"); /*0x2f4b*/
for ( i = 0; *v1; ++i ) /*0x2f53*/
{
if ( i >= 0xF4240 ) /*0x2f70*/
DebugAssert( /*0x2f85*/
"c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c",
0xAFu,
"Length < _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength");
++v1; /*0x2f90*/
}
return i; /*0x2fa9*/
}
// Function: StrCpyOrCat @ 0x2fb0 (0xfe bytes)
// Index: 45/906
__int64 __fastcall StrCpyOrCat(const CHAR16 *i, const CHAR16 *a2, unsigned __int64 n0xF4240)
{
unsigned __int64 n0xF4240_1; // rdi
const CHAR16 *i_1; // rbx
n0xF4240_1 = n0xF4240; /*0x2fc6*/
i_1 = i; /*0x2fcc*/
if ( !n0xF4240 ) /*0x2fd2*/
return 0; /*0x2fd4*/
if ( 2 * StrLen(i) == -2 ) /*0x2ff1*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x130u, "StrSize (FirstString) != 0"); /*0x3006*/
if ( 2 * StrLen(a2) == -2 ) /*0x3024*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x131u, "StrSize (SecondString) != 0"); /*0x3039*/
if ( n0xF4240_1 > 0xF4240 ) /*0x3054*/
DebugAssert( /*0x3069*/
"c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c",
0x134u,
"Length <= _gPcd_FixedAtBuild_PcdMaximumUnicodeStringLength");
while ( *i_1 && *i_1 == *a2 && n0xF4240_1 > 1 ) /*0x3079*/
{
++i_1; /*0x307b*/
++a2; /*0x307f*/
--n0xF4240_1; /*0x3083*/
}
return *i_1 - *a2; /*0x30a8*/
}
// Function: StrToUpper @ 0x3184 (0xe1 bytes)
// Index: 47/906
unsigned __int64 __fastcall StrToUpper(const CHAR16 *a1)
{
unsigned __int64 v1; // rdi
const CHAR16 *v2; // rbx
int v3; // eax
v1 = 0; /*0x3193*/
v2 = a1; /*0x319c*/
if ( 2 * StrLen(a1) == -2 ) /*0x31ae*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x28Au, "StrSize (String) != 0"); /*0x31c3*/
while ( *v2 == 32 || *v2 == 9 ) /*0x31d2*/
++v2; /*0x31d4*/
while ( *v2 == 48 ) /*0x31e8*/
++v2; /*0x31e1*/
while ( (unsigned __int16)(*v2 - 48) <= 9u ) /*0x31f4*/
{
if ( v1 > (-1LL - (*v2 - 48)) / 0xAuLL ) /*0x3222*/
DebugAssert( /*0x3237*/
"c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c",
0x2A1u,
"Result <= ((((UINTN) ~0) - (*String - L'0')) / 10)");
v3 = *v2++ - 48; /*0x323f*/
v1 = v3 + 10 * v1; /*0x324c*/
}
return v1; /*0x325f*/
}
// Function: AsciiStrLen @ 0x3268 (0x8b bytes)
// Index: 48/906
UINTN __cdecl AsciiStrLen(const CHAR8 *String)
{
const CHAR8 *v1; // rbx
UINTN i; // rdi
v1 = String; /*0x3279*/
if ( !String ) /*0x3281*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x4BAu, "String != ((void *) 0)"); /*0x3296*/
for ( i = 0; *v1; ++i ) /*0x329d*/
{
if ( i >= 0xF4240 ) /*0x32ba*/
DebugAssert( /*0x32cf*/
"c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c",
0x4C2u,
"Length < _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength");
++v1; /*0x32da*/
}
return i; /*0x32ed*/
}
// Function: StrToDecimal @ 0x32f4 (0xe5 bytes)
// Index: 49/906
__int64 __fastcall StrToDecimal(const CHAR8 *HiiHandle, const CHAR8 *a2, unsigned __int64 n3)
{
unsigned __int64 n3_1; // rsi
const CHAR8 *HiiHandle_1; // rbx
n3_1 = n3; /*0x3303*/
HiiHandle_1 = HiiHandle; /*0x3309*/
if ( !n3 ) /*0x330f*/
return 0; /*0x3311*/
if ( AsciiStrLen(HiiHandle) == -1 ) /*0x332a*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x5A8u, "AsciiStrSize (FirstString)"); /*0x333f*/
if ( AsciiStrLen(a2) == -1 ) /*0x3359*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x5A9u, "AsciiStrSize (SecondString)"); /*0x336e*/
if ( n3_1 > 0xF4240 ) /*0x3389*/
DebugAssert( /*0x339e*/
"c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c",
0x5ACu,
"Length <= _gPcd_FixedAtBuild_PcdMaximumAsciiStringLength");
while ( *HiiHandle_1 && *HiiHandle_1 == *a2 && n3_1 > 1 ) /*0x33ad*/
{
++HiiHandle_1; /*0x33af*/
++a2; /*0x33b2*/
--n3_1; /*0x33b5*/
}
return *HiiHandle_1 - *a2; /*0x33d3*/
}
// Function: StrHexToDecimal @ 0x33dc (0x149 bytes)
// Index: 50/906
const CHAR16 *__fastcall StrHexToDecimal(const CHAR8 *Intel, CHAR16 *a2)
{
CHAR16 *v2; // rdi
const CHAR16 *v4; // rbx
v2 = a2; /*0x33fe*/
if ( !a2 ) /*0x3414*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x7D0u, "Destination != ((void *) 0)"); /*0x3425*/
if ( AsciiStrLen(Intel) == -1 ) /*0x3443*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x7D5u, "AsciiStrSize (Source) != 0"); /*0x3454*/
if ( (char *)v2 - Intel <= AsciiStrLen(Intel) ) /*0x3473*/
DebugAssert( /*0x3484*/
"c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c",
0x7DAu,
"(UINTN) ((CHAR8 *) Destination - Source) > AsciiStrLen (Source)");
if ( Intel - (const CHAR8 *)v2 <= 2 * AsciiStrLen(Intel) ) /*0x34a6*/
DebugAssert( /*0x34b7*/
"c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c",
0x7DBu,
"(UINTN) (Source - (CHAR8 *) Destination) > (AsciiStrLen (Source) * sizeof (CHAR16))");
v4 = v2; /*0x34bc*/
while ( *Intel ) /*0x34d3*/
*v2++ = *Intel++; /*0x34c4*/
*v2 = 0; /*0x34dc*/
if ( 2 * StrLen(v4) == -2 ) /*0x34f1*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\String.c", 0x7EAu, "StrSize (ReturnValue) != 0"); /*0x3502*/
return v4; /*0x351e*/
}
// Function: StrCharToUpper @ 0x3528 (0x36 bytes)
// Index: 51/906
__int16 __fastcall StrCharToUpper(__int64 a1)
{
if ( !a1 ) /*0x353d*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\Unaligned.c", 0x26u, "Buffer != ((void *) 0)"); /*0x3550*/
return *(_WORD *)a1; /*0x3558*/
}
// Function: StrLenAscii @ 0x3560 (0x37 bytes)
// Index: 52/906
__int64 __fastcall StrLenAscii(unsigned int *a1)
{
if ( !a1 ) /*0x3575*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\Unaligned.c", 0x8Du, "Buffer != ((void *) 0)"); /*0x358a*/
return *a1; /*0x3591*/
}
// Function: StrToHex @ 0x3598 (0x38 bytes)
// Index: 53/906
__int64 __fastcall StrToHex(__int64 a1)
{
if ( !a1 ) /*0x35ad*/
DebugAssert("c:\\udk\\myworkspace\\MdePkg\\Library\\BaseLib\\Unaligned.c", 0xC0u, "Buffer != ((void *) 0)"); /*0x35c2*/
return *(_QWORD *)a1; /*0x35ca*/
}
// Function: RstFormatSerialNumber @ 0x5418 (0xe9 bytes)
// Index: 125/906
__int64 __fastcall RstFormatSerialNumber(__int64 a1, __int64 a2, CHAR8 **a3, double a4)
{
CHAR8 *StartOfBuffer; // rdi
unsigned __int64 v7; // rbx
CHAR16 *v8; // rbx
CHAR16 i[12]; // [rsp+30h] [rbp-78h] BYREF
_BYTE i_1[32]; // [rsp+48h] [rbp-60h] BYREF
CHAR16 i_2[28]; // [rsp+68h] [rbp-40h] BYREF
StartOfBuffer = (CHAR8 *)(a1 + 368); /*0x542f*/
if ( !*(_WORD *)(a1 + 368) ) /*0x543c*/
{
v7 = *(unsigned int *)(a1 + 226) | ((unsigned __int64)*(unsigned __int16 *)(a1 + 224) << 32); /*0x5461*/
MemZero(i_1, 0, 32); /*0x5464*/
RstFormatDiskSize((__int64)i_1, v7, *(_DWORD *)(a1 + 216), 1, 0); /*0x5480*/
v8 = RstStringTrimCopy(i, 21, (const CHAR16 *)(a1 + 236), 0x14u); /*0x54b4*/
RstStringTrimCopy(i_2, 41, (const CHAR16 *)(a1 + 256), 0x28u); /*0x54b7*/
HiiCfgArraySet(StartOfBuffer, 0x100u, "%a SN:%a, %a", a4, *(double *)&v8, COERCE_DOUBLE(i_1)); /*0x54dd*/
}
*a3 = StartOfBuffer; /*0x54ea*/
return 0; /*0x54fc*/
}
// Function: RstStringAllocCopy @ 0x55e8 (0x2f bytes)
// Index: 129/906
_QWORD *__fastcall RstStringAllocCopy(_QWORD *a1, char a2)
{
CfgArrayGetBlock(a1); /*0x55f7*/
if ( (a2 & 1) != 0 ) /*0x55ff*/
MemFree(); /*0x5604*/
return a1; /*0x5611*/
}
// Function: StrnCmp @ 0x809c (0x27 bytes)
// Index: 207/906
INTN __cdecl StrnCmp(const CHAR16 *FirstString, const CHAR16 *SecondString, UINTN Length)
{
INTN result; // rax
if ( Length ) /*0x80a2*/
{
while ( *(_BYTE *)FirstString == *(_BYTE *)SecondString ) /*0x80ac*/
{
FirstString = (const CHAR16 *)((char *)FirstString + 1); /*0x80ae*/
SecondString = (const CHAR16 *)((char *)SecondString + 1); /*0x80b1*/
if ( !--Length ) /*0x80b7*/
goto LABEL_4; /*0x80b7*/
}
LOWORD(result) = 1; /*0x80be*/
}
else
{
LABEL_4:
LOWORD(result) = 0; /*0x80b9*/
}
return result; /*0x80bd*/
}
// Function: StrnCpy @ 0x80c4 (0x1f bytes)
// Index: 208/906
CHAR16 *__cdecl StrnCpy(CHAR16 *Destination, const CHAR16 *Source, UINTN Length)
{
CHAR16 *Destination_1; // r9
signed __int64 v4; // rdx
Destination_1 = Destination; /*0x80c4*/
if ( Length ) /*0x80ca*/
{
v4 = (char *)Source - (char *)Destination; /*0x80cc*/
do /*0x80dd*/
{
*(_BYTE *)Destination_1 = *((_BYTE *)Destination_1 + v4); /*0x80d3*/
Destination_1 = (CHAR16 *)((char *)Destination_1 + 1); /*0x80d6*/
--Length; /*0x80d9*/
}
while ( Length ); /*0x80dd*/
}
return Destination; /*0x80e2*/
}
// Function: StrLenA @ 0x8164 (0x1d bytes)
// Index: 215/906
__int16 __fastcall StrLenA(_BYTE *a1)
{
__int16 result; // ax
for ( result = 0; *a1; ++result ) /*0x816b*/
++a1; /*0x8174*/
return result; /*0x817f*/
}
// Function: StrnCpy16 @ 0x8184 (0x3a bytes)
// Index: 216/906
__int16 __fastcall StrnCpy16(_BYTE *a1, _BYTE *a2, __int16 a3)
{
while ( *a1 ) /*0x81a3*/
{
if ( !a3 ) /*0x818d*/
return 0; /*0x818d*/
if ( *a1 != *a2 ) /*0x8191*/
break; /*0x8191*/
++a1; /*0x8199*/
++a2; /*0x819c*/
--a3; /*0x819f*/
}
if ( !a3 ) /*0x81ae*/
return 0; /*0x81b4*/
return (unsigned __int8)*a1 - (unsigned __int8)*a2; /*0x81b4*/
}
// Function: RstStringTrimCopy @ 0x8348 (0xef bytes)
// Index: 222/906
CHAR16 *__fastcall RstStringTrimCopy(CHAR16 *i, __int64 n21, const CHAR16 *Source, UINTN n20)
{
unsigned int v8; // edi
CHAR16 *i_1; // rsi
CHAR16 *j; // r11
const CHAR16 *k; // rbx
if ( !i || !n20 || !n21 || !Source ) /*0x838a*/
return 0; /*0x841c*/
v8 = 0; /*0x8393*/
i_1 = (CHAR16 *)MemAllocPages(n21); /*0x83a2*/
MemZero(i_1, 0, n21); /*0x83a5*/
StrnCpy(i_1, Source, n20); /*0x83b3*/
for ( j = (CHAR16 *)((char *)i_1 + n21 - 1); j > i_1 && (*(_BYTE *)j == 32 || !*(_BYTE *)j); j = (CHAR16 *)((char *)j - 1) ) /*0x83b8*/
++v8; /*0x83cf*/
*((_BYTE *)j + 1) = 0; /*0x83d6*/
for ( k = i_1; *(_BYTE *)k == 32; ++v8 ) /*0x83e0*/
k = (const CHAR16 *)((char *)k + 1); /*0x83e2*/
MemZero(i, 0, n21); /*0x83f3*/
StrnCpy(i, k, n21 - v8); /*0x8407*/
MemZeroThenFree(i_1, n21); /*0x8412*/
return i; /*0x842d*/
}
// Function: RstParseDecimalString @ 0x8438 (0x154 bytes)
// Index: 223/906
__int64 __fastcall RstParseDecimalString(
__int64 a1,
unsigned __int64 n9,
unsigned __int8 i,
unsigned __int64 *a4,
unsigned __int64 *a5)
{
__int64 v5; // r14
char v10; // di
unsigned __int8 n9_2; // si
CHAR16 *v12; // rbx
unsigned __int8 n9_1; // al
__int64 n9_4; // rdx
CHAR16 n46; // cx
unsigned __int8 n9_3; // al
__int64 n9_5; // rcx
unsigned __int8 j; // dl
CHAR16 n0x30; // cx
unsigned __int64 n0xA; // rax
v5 = 2 * n9; /*0x8454*/
v10 = 1; /*0x8467*/
n9_2 = 0; /*0x846a*/
v12 = (CHAR16 *)MemAllocPages(2 * n9); /*0x8475*/
n9_1 = 0; /*0x8478*/
if ( n9 ) /*0x847e*/
{
n9_4 = 0; /*0x8480*/
while ( 1 ) /*0x8483*/
{
n46 = *(_WORD *)(a1 + 2 * n9_4); /*0x8483*/
if ( n46 == 46 ) /*0x848c*/
break; /*0x848c*/
if ( n46 < 0x30u || n46 > 0x39u ) /*0x849e*/
{
n9_2 = -1; /*0x84b1*/
goto LABEL_10; /*0x84b4*/
}
++n9_1; /*0x84a0*/
v12[n9_4] = n46; /*0x84a3*/
n9_4 = n9_1; /*0x84a7*/
if ( n9_1 >= n9 ) /*0x84ad*/
goto LABEL_10; /*0x84ad*/
}
n9_2 = n9_1; /*0x84b6*/
}
LABEL_10:
v12[n9_1] = 0; /*0x84b9*/
*a4 = StrToUpper(v12); /*0x84c9*/
if ( n9_2 != 0xFF ) /*0x84d1*/
{
n9_3 = 0; /*0x84da*/
if ( n9 ) /*0x84e0*/
{
n9_5 = 0; /*0x84e2*/
do /*0x84f3*/
{
++n9_3; /*0x84e5*/
v12[n9_5] = 0; /*0x84e8*/
n9_5 = n9_3; /*0x84ed*/
}
while ( n9_3 < n9 ); /*0x84f3*/
}
for ( j = 0; j < i; ++j ) /*0x84fb*/
{
if ( j + n9_2 + 1 < n9 ) /*0x850f*/
{
n0x30 = *(_WORD *)(a1 + 2 * (j + (unsigned __int64)n9_2) + 2); /*0x851c*/
if ( n0x30 < 0x30u || n0x30 > 0x39u ) /*0x852c*/
{
v10 = 0; /*0x853d*/
break; /*0x853d*/
}
v12[j] = n0x30; /*0x852e*/
}
}
n0xA = StrToUpper(v12); /*0x8540*/
*a5 = n0xA; /*0x854d*/
if ( !v10 && n0xA < 0xA ) /*0x8559*/
*a5 = 10 * n0xA; /*0x8562*/
}
return MemZeroThenFree(v12, v5); /*0x857a*/
}
// Function: RstFormatDiskSize @ 0x858c (0x12f bytes)
// Index: 224/906
__int64 __fastcall RstFormatDiskSize(__int64 a1, unsigned __int64 a2, unsigned int a3, char a4, char a5)
{
__int64 n5; // rcx
unsigned __int64 v7; // r8
unsigned __int64 v8; // rbx
if ( a2 && a3 ) /*0x85a4*/
{
n5 = 0; /*0x85b1*/
v7 = (1000 * (a2 / (0x100000 / a3))) >> 10; /*0x85ce*/
if ( a4 == 1 ) /*0x85d6*/
n5 = 5; /*0x85d6*/
v8 = (n5 + v7) / 0xA; /*0x85ed*/
if ( a1 ) /*0x85f4*/
{
if ( a5 ) /*0x860a*/
RstHelper_8da8( /*0x8641*/
a1,
0xAu,
"%4ld.%ld%ldGB",
(unsigned int)v8 / 0x64,
(unsigned int)v8 / 0xA % 0xA,
(unsigned int)v8 % 0xA);
else
RstHelper_8da8( /*0x868d*/
a1,
0xAu,
"%ld.%ld%ldGB",
(unsigned int)v8 / 0x64,
(unsigned int)v8 / 0xA % 0xA,
(unsigned int)v8 % 0xA);
}
return (unsigned int)v8; /*0x8692*/
}
else
{
RstHelper_8da8(a1, 0xAu, "%4ld.%ldMB", 0, 0); /*0x86ae*/
return 0; /*0x86b3*/
}
}
// Function: RstParseUnicodeString @ 0x86bc (0x70 bytes)
// Index: 225/906
unsigned __int64 __fastcall RstParseUnicodeString(_BYTE *a1, _BYTE **i, _QWORD *a3)
{
_BYTE *v3; // rax
_BYTE **j; // rbx
v3 = *i; /*0x86d0*/
for ( j = i; ; v3 = *j ) /*0x86d6*/
{
if ( !v3 ) /*0x8700*/
return 0x8000000000000003uLL; /*0x8702*/
if ( !StrnCpy16(v3, a1, 0xFFFF) ) /*0x86ec*/
break; /*0x86ec*/
j += 2; /*0x86f6*/
}
*a3 = j[1]; /*0x8725*/
return 0; /*0x871b*/
}
// Function: RstUint64ToHexString @ 0x8864 (0xbd bytes)
// Index: 233/906
unsigned __int16 __fastcall RstUint64ToHexString(_BYTE *a1, unsigned __int64 a2, char a3, unsigned __int16 a4)
{
_BYTE *i; // rdi
unsigned __int16 v6; // bp
char v7; // al
char n48; // r10
__int64 v9; // rbx
_BYTE i_1[56]; // [rsp+20h] [rbp-38h] BYREF
i = i_1; /*0x888a*/
v6 = 0; /*0x888e*/
do /*0x88b2*/
{
v7 = a2; /*0x8892*/
a2 >>= 4; /*0x889c*/
++v6; /*0x88a3*/
*i++ = a0123456789abcd_0[v7 & 0xF]; // "0123456789ABCDEF" /*0x88aa*/
}
while ( a2 ); /*0x88b2*/
if ( (a3 & 0x20) != 0 ) /*0x88b8*/
n48 = 48; /*0x88ba*/
else
n48 = ~(32 * a3) & 0x20; /*0x88c6*/
if ( v6 < a4 ) /*0x88ce*/
{
v9 = (unsigned __int16)(a4 - v6); /*0x88da*/
MemZero(i, n48, v9); /*0x88e1*/
i += v9; /*0x88e6*/
v6 += v9; /*0x88e9*/
}
while ( i != i_1 ) /*0x8900*/
*a1++ = *--i; /*0x88f3*/
*a1 = 0; /*0x8907*/
return v6; /*0x8917*/
}
// Function: RstInt64ToDecimalString @ 0x8924 (0x17c bytes)
// Index: 234/906
unsigned __int16 __fastcall RstInt64ToDecimalString(_BYTE *i, __int64 a2, char a3, unsigned __int16 a4)
{
__int64 v5; // r10
_BYTE *i_1; // rbp
__int64 *v7; // rsi
char v8; // r13
unsigned __int16 v9; // di
__int16 v10; // r11
char n48; // r9
__int64 v12; // rdx
__int16 v13; // ax
unsigned __int16 v14; // di
unsigned __int16 v15; // ax
_BYTE *i_2; // rcx
__int64 v17; // rbx
__int64 v18; // rax
__int64 v20; // [rsp+20h] [rbp-48h] BYREF
v5 = a2; /*0x8947*/
i_1 = i; /*0x894d*/
v7 = &v20; /*0x8950*/
v8 = 0; /*0x8958*/
v9 = 0; /*0x895b*/
if ( a2 < 0 && a3 >= 0 ) /*0x8964*/
{
v8 = 1; /*0x8966*/
v5 = -a2; /*0x8969*/
}
v10 = 0; /*0x8970*/
n48 = 48; /*0x8974*/
do /*0x89ea*/
{
v12 = v5 / 10; /*0x8993*/
v13 = v5 % 10; /*0x89a7*/
if ( v13 < 0 ) /*0x89ab*/
v13 = -v13; /*0x89ad*/
++v9; /*0x89b3*/
v5 /= 10; /*0x89b7*/
*(_BYTE *)v7 = v13 + 48; /*0x89ba*/
v7 = (__int64 *)((char *)v7 + 1); /*0x89bc*/
if ( (a3 & 8) == 8 && v9 == 3 * (v9 / 3) ) /*0x89db*/
{
*(_BYTE *)v7 = 44; /*0x89dd*/
v7 = (__int64 *)((char *)v7 + 1); /*0x89e0*/
++v10; /*0x89e3*/
}
}
while ( v12 ); /*0x89ea*/
if ( v8 ) /*0x89ef*/
{
*(_BYTE *)v7 = 45; /*0x89f1*/
v7 = (__int64 *)((char *)v7 + 1); /*0x89f4*/
++v9; /*0x89f7*/
}
v14 = v10 + v9; /*0x89fb*/
if ( (a3 & 0x20) == 0 ) /*0x8a03*/
n48 = 32; /*0x8a05*/
v15 = a4 - v14; /*0x8a0c*/
if ( (a3 & 1) != 0 )
{
i_2 = &i[v14]; /*0x8a17*/
if ( (v15 & (unsigned __int16)-(v14 < a4)) != 0 )
MemZero(i_2, n48, v14 < a4 ? v15 : 0);
}
else if ( (v15 & (unsigned __int16)-(v14 < a4)) != 0 )
{
v17 = v14 < a4 ? v15 : 0;
MemZero(i, n48, v17); /*0x8a4e*/
i_1 += v17; /*0x8a53*/
}
if ( v14 ) /*0x8a5a*/
{
v18 = v14; /*0x8a5c*/
do /*0x8a6d*/
{
v7 = (__int64 *)((char *)v7 - 1); /*0x8a5f*/
*i_1++ = *(_BYTE *)v7; /*0x8a64*/
--v18; /*0x8a6a*/
}
while ( v18 ); /*0x8a6d*/
}
if ( a4 > v14 ) /*0x8a80*/
v14 = a4; /*0x8a80*/
i_1[v14] = 0; /*0x8a8b*/
return v14; /*0x8a93*/
}
// Function: StrLenSafe @ 0x9078 (0x79 bytes)
// Index: 239/906
unsigned __int64 __fastcall StrLenSafe(_WORD *a1, __int64 n1000000)
{
unsigned __int64 result; // rax
if ( RstDebugEnabled() && ((unsigned __int8)a1 & 1) != 0 ) /*0x909c*/
DebugAssert("SecureString.cpp", 0x20u, "((UINTN) String & 0x00000001) == 0"); /*0x90af*/
if ( !a1 || !n1000000 ) /*0x90bc*/
return 0; /*0x90df*/
result = 0; /*0x90be*/
if ( *a1 ) /*0x90c1*/
{
while ( result < n1000000 - 1 ) /*0x90cd*/
{
if ( !a1[++result] ) /*0x90d2*/
return result; /*0x90d6*/
}
return n1000000; /*0x90da*/
}
return result; /*0x90eb*/
}
// Function: StrLenSafe_w @ 0x932c (0xa bytes)
// Index: 242/906
unsigned __int64 __fastcall sub_932C(_WORD *a1)
{
return StrLenSafe(a1, 1000000);
}
// Function: StrnCpy_w @ 0x14994 (0xb bytes)
// Index: 568/906
CHAR16 *__fastcall sub_14994(CHAR16 *Destination, const CHAR16 *Source)
{
return StrnCpy(Destination, Source, 0x208u);
}
// Function: StrnCpy16_w @ 0x195a4 (0x25 bytes)
// Index: 715/906
bool __fastcall sub_195A4(__int64 a1)
{
return StrnCpy16("Intel Raid ISM Journaling Sig ", (_BYTE *)(a1 + 4), 32) == 0; /*0x195c4*/
}