[ros-diffs] [dchapyshev] 39531: - Add SEH protection for FindResourceExW Notepad++ works now

dchapyshev at svn.reactos.org dchapyshev at svn.reactos.org
Tue Feb 10 15:08:06 CET 2009


Author: dchapyshev
Date: Tue Feb 10 08:08:05 2009
New Revision: 39531

URL: http://svn.reactos.org/svn/reactos?rev=39531&view=rev
Log:
- Add SEH protection for FindResourceExW
Notepad++ works now

Modified:
    trunk/reactos/dll/win32/kernel32/misc/res.c

Modified: trunk/reactos/dll/win32/kernel32/misc/res.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/res.c?rev=39531&r1=39530&r2=39531&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/res.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/res.c [iso-8859-1] Tue Feb 10 08:08:05 2009
@@ -1197,21 +1197,30 @@
 	if ( hModule == NULL )
 		hModule = (HINSTANCE)GetModuleHandleW(NULL);
 
-	if ( !IS_INTRESOURCE(lpName) && lpName[0] == L'#' ) {
-		lpName = MAKEINTRESOURCEW(wcstoul(lpName + 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;
+
+		Status = LdrFindResource_U (hModule,
+						&ResourceInfo,
+						RESOURCE_DATA_LEVEL,
+						&ResourceDataEntry);
 	}
-	if ( !IS_INTRESOURCE(lpType) && lpType[0] == L'#' ) {
-		lpType = MAKEINTRESOURCEW(wcstoul(lpType + 1, NULL, 10));
+	_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+	{
+		Status = _SEH2_GetExceptionCode();
 	}
-
-	ResourceInfo.Type = (ULONG)lpType;
-	ResourceInfo.Name = (ULONG)lpName;
-	ResourceInfo.Language = (ULONG)wLanguage;
-
-	Status = LdrFindResource_U (hModule,
-				    &ResourceInfo,
-				    RESOURCE_DATA_LEVEL,
-				    &ResourceDataEntry);
+	_SEH2_END;
+
 	if (!NT_SUCCESS(Status))
 	{
 		SetLastErrorByStatus (Status);



More information about the Ros-diffs mailing list