From 6ad6909fad43256f6794ee62e4bf1898b83c6d82 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Tue, 10 Feb 2009 14:08:05 +0000 Subject: [PATCH] - Add SEH protection for FindResourceExW Notepad++ works now svn path=/trunk/; revision=39531 --- reactos/dll/win32/kernel32/misc/res.c | 35 +++++++++++++++++---------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/reactos/dll/win32/kernel32/misc/res.c b/reactos/dll/win32/kernel32/misc/res.c index 06a2cb2b9e3..db00fac780e 100644 --- a/reactos/dll/win32/kernel32/misc/res.c +++ b/reactos/dll/win32/kernel32/misc/res.c @@ -1197,21 +1197,30 @@ FindResourceExW ( if ( hModule == NULL ) hModule = (HINSTANCE)GetModuleHandleW(NULL); - if ( !IS_INTRESOURCE(lpName) && lpName[0] == L'#' ) { - lpName = MAKEINTRESOURCEW(wcstoul(lpName + 1, NULL, 10)); - } - if ( !IS_INTRESOURCE(lpType) && lpType[0] == L'#' ) { - lpType = MAKEINTRESOURCEW(wcstoul(lpType + 1, NULL, 10)); - } + _SEH2_TRY + { + if ( !IS_INTRESOURCE(lpName) && lpName[0] == L'#' ) { + lpName = MAKEINTRESOURCEW(wcstoul(lpName + 1, NULL, 10)); + } + if ( !IS_INTRESOURCE(lpType) && lpType[0] == L'#' ) { + lpType = MAKEINTRESOURCEW(wcstoul(lpType + 1, NULL, 10)); + } - ResourceInfo.Type = (ULONG)lpType; - ResourceInfo.Name = (ULONG)lpName; - ResourceInfo.Language = (ULONG)wLanguage; + ResourceInfo.Type = (ULONG)lpType; + ResourceInfo.Name = (ULONG)lpName; + ResourceInfo.Language = (ULONG)wLanguage; + + Status = LdrFindResource_U (hModule, + &ResourceInfo, + RESOURCE_DATA_LEVEL, + &ResourceDataEntry); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; - Status = LdrFindResource_U (hModule, - &ResourceInfo, - RESOURCE_DATA_LEVEL, - &ResourceDataEntry); if (!NT_SUCCESS(Status)) { SetLastErrorByStatus (Status);