Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f5072787
Commit
f5072787
authored
Aug 09, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unprotect the resource data in the unhandled exception handler to fix
broken apps.
parent
a5dea216
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
except.c
win32/except.c
+29
-0
No files found.
win32/except.c
View file @
f5072787
...
...
@@ -360,6 +360,33 @@ static int start_debugger_atomic(PEXCEPTION_POINTERS epointers)
/*******************************************************************
* check_resource_write
*
* Check if the exception is a write attempt to the resource data.
* If yes, we unprotect the resources to let broken apps continue
* (Windows does this too).
*/
inline
static
BOOL
check_resource_write
(
const
EXCEPTION_RECORD
*
rec
)
{
void
*
addr
,
*
rsrc
;
DWORD
size
;
MEMORY_BASIC_INFORMATION
info
;
if
(
rec
->
ExceptionCode
!=
EXCEPTION_ACCESS_VIOLATION
)
return
FALSE
;
if
(
!
rec
->
ExceptionInformation
[
0
])
return
FALSE
;
/* not a write access */
addr
=
(
void
*
)
rec
->
ExceptionInformation
[
1
];
if
(
!
VirtualQuery
(
addr
,
&
info
,
sizeof
(
info
)
))
return
FALSE
;
if
(
!
(
rsrc
=
RtlImageDirectoryEntryToData
(
(
HMODULE
)
info
.
AllocationBase
,
TRUE
,
IMAGE_DIRECTORY_ENTRY_RESOURCE
,
&
size
)))
return
FALSE
;
if
(
addr
<
rsrc
||
(
char
*
)
addr
>=
(
char
*
)
rsrc
+
size
)
return
FALSE
;
FIXME
(
"Broken app is writing to the resource data, enabling work-around
\n
"
);
VirtualProtect
(
rsrc
,
size
,
PAGE_WRITECOPY
,
NULL
);
return
TRUE
;
}
/*******************************************************************
* UnhandledExceptionFilter (KERNEL32.@)
*/
DWORD
WINAPI
UnhandledExceptionFilter
(
PEXCEPTION_POINTERS
epointers
)
...
...
@@ -367,6 +394,8 @@ DWORD WINAPI UnhandledExceptionFilter(PEXCEPTION_POINTERS epointers)
int
status
;
int
loop
=
0
;
if
(
check_resource_write
(
epointers
->
ExceptionRecord
))
return
EXCEPTION_CONTINUE_EXECUTION
;
for
(
loop
=
0
;
loop
<=
1
;
loop
++
)
{
/* send a last chance event to the debugger */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment