From 4c326807193acc8612a2fbf515cad3215c77caa6 Mon Sep 17 00:00:00 2001 From: vxunderground <57078196+vxunderground@users.noreply.github.com> Date: Thu, 14 Jul 2022 23:00:55 -0500 Subject: [PATCH] Create RfGetSystemWindowsDirectory.cpp --- Windows API/RfGetSystemWindowsDirectory.cpp | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Windows API/RfGetSystemWindowsDirectory.cpp diff --git a/Windows API/RfGetSystemWindowsDirectory.cpp b/Windows API/RfGetSystemWindowsDirectory.cpp new file mode 100644 index 0000000..4e72dbe --- /dev/null +++ b/Windows API/RfGetSystemWindowsDirectory.cpp @@ -0,0 +1,25 @@ +BOOL RfGetSystemWindowsDirectoryA(DWORD nBufferLength, PCHAR lpBuffer) +{ + PKUSER_SHARED_DATA SharedData = GetKUserSharedData(); + + if (nBufferLength < StringLengthW(SharedData->NtSystemRoot)) + return FALSE; + + if (WCharStringToCharString(lpBuffer, SharedData->NtSystemRoot, nBufferLength) != 0) + return TRUE; + else + return FALSE; +} + +BOOL RfGetSystemWindowsDirectoryW(DWORD nBufferLength, PWCHAR lpBuffer) +{ + PKUSER_SHARED_DATA SharedData = GetKUserSharedData(); + + if (nBufferLength < StringLengthW(SharedData->NtSystemRoot)) + return FALSE; + + if (StringCopyW(lpBuffer, SharedData->NtSystemRoot) == NULL) + return FALSE; + + return TRUE; +}