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

Function GetPathFromHandle

r77api/r77win.c:395–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

393 return FALSE;
394}
395BOOL GetPathFromHandle(HANDLE file, PWCHAR fileName, DWORD fileNameLength)
396{
397 BOOL result = FALSE;
398
399 WCHAR path[MAX_PATH + 1];
400 if (GetFinalPathNameByHandleW(file, path, MAX_PATH, FILE_NAME_NORMALIZED) > 0 && !StrCmpNIW(path, L"\\\\?\\", 4))
401 {
402 PWCHAR resultFileName = &path[4];
403 if ((DWORD)lstrlenW(resultFileName) <= fileNameLength)
404 {
405 StrCpyW(fileName, resultFileName);
406 result = TRUE;
407 }
408 }
409
410 return result;
411}
412BOOL ReadFileContent(LPCWSTR path, LPBYTE *data, LPDWORD size)
413{
414 BOOL result = FALSE;

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected