MCPcopy Index your code
hub / github.com/bytecode77/r77-rootkit / GetRandomString

Function GetRandomString

r77api/r77win.c:24–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 return result;
23}
24BOOL GetRandomString(PWCHAR str, DWORD length)
25{
26 WCHAR characters[] = L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
27
28 if (GetRandomBytes(str, length * 2))
29 {
30 for (DWORD i = 0; i < length; i++)
31 {
32 str[i] = characters[str[i] % (sizeof(characters) / sizeof(WCHAR) - 1)];
33 }
34
35 str[length] = L'\0';
36 return TRUE;
37 }
38 else
39 {
40 return FALSE;
41 }
42}
43LPCSTR ConvertStringToAString(LPCWSTR str)
44{
45 PCHAR result = NULL;

Callers 2

CreateTempFileFunction · 0.85
ObfuscateVariableFunction · 0.85

Calls 1

GetRandomBytesFunction · 0.85

Tested by

no test coverage detected