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
bb83b688
Commit
bb83b688
authored
Apr 04, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Define IsBadStringPtr to handle exceptions in debug traces.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a3cf86a1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
6 deletions
+44
-6
exception.c
dlls/ntdll/exception.c
+44
-0
debug.h
include/wine/debug.h
+0
-6
No files found.
dlls/ntdll/exception.c
View file @
bb83b688
...
...
@@ -346,3 +346,47 @@ void __wine_spec_unimplemented_stub( const char *module, const char *function )
record
.
ExceptionInformation
[
1
]
=
(
ULONG_PTR
)
function
;
for
(;;)
RtlRaiseException
(
&
record
);
}
/*************************************************************
* IsBadStringPtrA
*
* IsBadStringPtrA replacement for ntdll, to catch exception in debug traces.
*/
BOOL
WINAPI
IsBadStringPtrA
(
LPCSTR
str
,
UINT_PTR
max
)
{
if
(
!
str
)
return
TRUE
;
__TRY
{
volatile
const
char
*
p
=
str
;
while
(
p
!=
str
+
max
)
if
(
!*
p
++
)
break
;
}
__EXCEPT_PAGE_FAULT
{
return
TRUE
;
}
__ENDTRY
return
FALSE
;
}
/*************************************************************
* IsBadStringPtrW
*
* IsBadStringPtrW replacement for ntdll, to catch exception in debug traces.
*/
BOOL
WINAPI
IsBadStringPtrW
(
LPCWSTR
str
,
UINT_PTR
max
)
{
if
(
!
str
)
return
TRUE
;
__TRY
{
volatile
const
WCHAR
*
p
=
str
;
while
(
p
!=
str
+
max
)
if
(
!*
p
++
)
break
;
}
__EXCEPT_PAGE_FAULT
{
return
TRUE
;
}
__ENDTRY
return
FALSE
;
}
include/wine/debug.h
View file @
bb83b688
...
...
@@ -24,9 +24,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <windef.h>
#ifndef _NTSYSTEM_
#include <winbase.h>
#endif
#ifndef GUID_DEFINED
#include <guiddef.h>
#endif
...
...
@@ -227,9 +225,7 @@ static inline const char *wine_dbgstr_an( const char *str, int n )
if
(
!
str
)
return
"(null)"
;
if
(
!
((
ULONG_PTR
)
str
>>
16
))
return
wine_dbg_sprintf
(
"#%04x"
,
LOWORD
(
str
)
);
#ifndef _NTSYSTEM_
if
(
IsBadStringPtrA
(
str
,
n
))
return
"(invalid)"
;
#endif
if
(
n
==
-
1
)
for
(
n
=
0
;
str
[
n
];
n
++
)
;
*
dst
++
=
'"'
;
while
(
n
--
>
0
&&
dst
<=
buffer
+
sizeof
(
buffer
)
-
9
)
...
...
@@ -271,9 +267,7 @@ static inline const char *wine_dbgstr_wn( const WCHAR *str, int n )
if
(
!
str
)
return
"(null)"
;
if
(
!
((
ULONG_PTR
)
str
>>
16
))
return
wine_dbg_sprintf
(
"#%04x"
,
LOWORD
(
str
)
);
#ifndef _NTSYSTEM_
if
(
IsBadStringPtrW
(
str
,
n
))
return
"(invalid)"
;
#endif
if
(
n
==
-
1
)
for
(
n
=
0
;
str
[
n
];
n
++
)
;
*
dst
++
=
'L'
;
*
dst
++
=
'"'
;
...
...
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