diff --git a/reactos/dll/win32/kernel32/misc/utils.c b/reactos/dll/win32/kernel32/misc/utils.c index 2c830ce448e..b9adb287a8f 100644 --- a/reactos/dll/win32/kernel32/misc/utils.c +++ b/reactos/dll/win32/kernel32/misc/utils.c @@ -412,10 +412,14 @@ BasepMapFile(IN LPCWSTR lpApplicationName, RelativeName.Handle = NULL; /* Find the application name */ - RtlDosPathNameToNtPathName_U(lpApplicationName, - ApplicationName, - NULL, - &RelativeName); + if (!RtlDosPathNameToNtPathName_U(lpApplicationName, + ApplicationName, + NULL, + &RelativeName)) + { + return STATUS_OBJECT_PATH_NOT_FOUND; + } + DPRINT("ApplicationName %wZ\n", ApplicationName); DPRINT("RelativeName %wZ\n", &RelativeName.DosPath); @@ -442,7 +446,7 @@ BasepMapFile(IN LPCWSTR lpApplicationName, if (!NT_SUCCESS(Status)) { DPRINT1("Failed to open file\n"); - SetLastErrorByStatus (Status); + SetLastErrorByStatus(Status); return Status; } diff --git a/reactos/dll/win32/kernel32/process/procsup.c b/reactos/dll/win32/kernel32/process/procsup.c index 805ac9408b3..843dc1f9ba4 100644 --- a/reactos/dll/win32/kernel32/process/procsup.c +++ b/reactos/dll/win32/kernel32/process/procsup.c @@ -1072,6 +1072,11 @@ GetAppName: &StartupInfo, lpProcessInformation); + case STATUS_OBJECT_NAME_NOT_FOUND: + case STATUS_OBJECT_PATH_NOT_FOUND: + SetLastErrorByStatus(Status); + goto Cleanup; + default: /* Invalid Image Type */ SetLastError(ERROR_BAD_EXE_FORMAT);