From 720e6639a99e44cbcfa447f241c0a9d0a74601ac Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 26 Sep 2025 01:16:52 -0600 Subject: [PATCH] Return ERROR_RESOURCE_DATA_NOT_FOUND if open_resource_stream fails --- common.h | 1 + dll/kernel32.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common.h b/common.h index 8d56669..5f4a8e9 100644 --- a/common.h +++ b/common.h @@ -60,6 +60,7 @@ typedef unsigned char BYTE; #define ERROR_INVALID_PARAMETER 87 #define ERROR_BUFFER_OVERFLOW 111 #define ERROR_INSUFFICIENT_BUFFER 122 +#define ERROR_RESOURCE_DATA_NOT_FOUND 1812 #define ERROR_MOD_NOT_FOUND 126 #define ERROR_NEGATIVE_SEEK 131 #define ERROR_BAD_EXE_FORMAT 193 diff --git a/dll/kernel32.cpp b/dll/kernel32.cpp index 40a5ad3..ceaf447 100644 --- a/dll/kernel32.cpp +++ b/dll/kernel32.cpp @@ -1711,7 +1711,11 @@ namespace kernel32 { const std::string name = resource_identifier_to_string(lpName); const std::string type = resource_identifier_to_string(lpType); - return open_resource_stream(type, name); + FILE *res = open_resource_stream(type, name); + if (!res) { + wibo::lastError = ERROR_RESOURCE_DATA_NOT_FOUND; + } + return res; } // https://github.com/reactos/reactos/blob/master/dll/win32/kernelbase/wine/loader.c#L1090