MCPcopy Create free account
hub / github.com/bytecode77/r77-rootkit / CreateTempFile

Function CreateTempFile

r77api/r77win.c:492–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490 return result;
491}
492BOOL CreateTempFile(LPBYTE file, DWORD fileSize, LPCWSTR extension, LPWSTR resultPath)
493{
494 BOOL result = FALSE;
495 WCHAR tempPath[MAX_PATH + 1];
496
497 if (GetTempPathW(MAX_PATH, tempPath))
498 {
499 WCHAR fileName[MAX_PATH + 1];
500 if (GetRandomString(fileName, 8))
501 {
502 StrCatW(fileName, L".");
503 StrCatW(fileName, extension);
504
505 if (PathCombineW(resultPath, tempPath, fileName) && WriteFileContent(resultPath, file, fileSize))
506 {
507 result = TRUE;
508 }
509 }
510 }
511
512 return result;
513}
514BOOL ExecuteFile(LPCWSTR path, BOOL deleteFile)
515{
516 BOOL result = FALSE;

Callers 1

mainFunction · 0.85

Calls 2

GetRandomStringFunction · 0.85
WriteFileContentFunction · 0.85

Tested by

no test coverage detected