Add fallback when querying current directory
@@ -3266,7 +3266,11 @@ PPH_STRING PhGetApplicationFileNameWin32(
if (!NT_SUCCESS(PhGetProcessImageFileNameWin32(NtCurrentProcess(), &fileName)))
{
- if (NT_SUCCESS(PhGetProcessMappedFileName(NtCurrentProcess(), PhInstanceHandle, &fileName)))
+ if (NT_SUCCESS(PhGetProcessImageFileNameByProcessId(NtCurrentProcessId(), &fileName)))
+ {
+ PhMoveReference(&fileName, PhGetFileName(fileName));
+ }
+ else if (NT_SUCCESS(PhGetProcessMappedFileName(NtCurrentProcess(), PhInstanceHandle, &fileName)))
{
PhMoveReference(&fileName, PhGetFileName(fileName));
}
@@ -3671,18 +3675,15 @@ NTSTATUS PhCreateProcess(
PUNICODE_STRING windowTitle;
PUNICODE_STRING desktopInfo;
-#if (PHNT_VERSION >= PHNT_WIN7)
- if (!NT_SUCCESS(status = RtlDosPathNameToNtPathName_U_WithStatus(
+ status = RtlDosPathNameToNtPathName_U_WithStatus(
FileName,
&fileName,
NULL,
NULL
- )))
+ );
+
+ if (!NT_SUCCESS(status))
return status;
-#else
- if (!RtlDosPathNameToNtPathName_U(FileName, &fileName, NULL, NULL))
- return STATUS_UNSUCCESSFUL;
-#endif
if (CommandLine)
{
