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
f54a59c0
Commit
f54a59c0
authored
Dec 31, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Try to fail more gracefully on win9x.
Link to NtCurrentTeb dynamically.
parent
0ab7cfc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
exception.c
dlls/ntdll/tests/exception.c
+16
-5
No files found.
dlls/ntdll/tests/exception.c
View file @
f54a59c0
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
#include <assert.h>
#include <stdarg.h>
#include <stdarg.h>
#ifndef _WIN32_WINNT
#ifndef _WIN32_WINNT
...
@@ -36,6 +37,8 @@
...
@@ -36,6 +37,8 @@
#ifdef __i386__
#ifdef __i386__
static
struct
_TEB
*
(
WINAPI
*
pNtCurrentTeb
)(
void
);
/* Test various instruction combinations that cause a protection fault on the i386,
/* Test various instruction combinations that cause a protection fault on the i386,
* and check what the resulting exception looks like.
* and check what the resulting exception looks like.
*/
*/
...
@@ -51,6 +54,8 @@ static const struct exception
...
@@ -51,6 +54,8 @@ static const struct exception
}
exceptions
[]
=
}
exceptions
[]
=
{
{
/* test some privileged instructions */
/* test some privileged instructions */
{
{
0xfb
,
0xc3
},
/* sti; ret */
0
,
1
,
STATUS_PRIVILEGED_INSTRUCTION
,
0
},
{
{
0x6c
,
0xc3
},
/* insb (%dx); ret */
{
{
0x6c
,
0xc3
},
/* insb (%dx); ret */
0
,
1
,
STATUS_PRIVILEGED_INSTRUCTION
,
0
},
0
,
1
,
STATUS_PRIVILEGED_INSTRUCTION
,
0
},
{
{
0x6d
,
0xc3
},
/* insl (%dx); ret */
{
{
0x6d
,
0xc3
},
/* insl (%dx); ret */
...
@@ -77,8 +82,6 @@ static const struct exception
...
@@ -77,8 +82,6 @@ static const struct exception
0
,
1
,
STATUS_PRIVILEGED_INSTRUCTION
,
0
},
0
,
1
,
STATUS_PRIVILEGED_INSTRUCTION
,
0
},
{
{
0xfa
,
0xc3
},
/* cli; ret */
{
{
0xfa
,
0xc3
},
/* cli; ret */
0
,
1
,
STATUS_PRIVILEGED_INSTRUCTION
,
0
},
0
,
1
,
STATUS_PRIVILEGED_INSTRUCTION
,
0
},
{
{
0xfb
,
0xc3
},
/* sti; ret */
0
,
1
,
STATUS_PRIVILEGED_INSTRUCTION
,
0
},
/* test long jump to invalid selector */
/* test long jump to invalid selector */
{
{
0xea
,
0
,
0
,
0
,
0
,
0
,
0
,
0xc3
},
/* ljmp $0,$0; ret */
{
{
0xea
,
0
,
0
,
0
,
0
,
0
,
0
,
0xc3
},
/* ljmp $0,$0; ret */
...
@@ -198,19 +201,27 @@ static void test_prot_fault(void)
...
@@ -198,19 +201,27 @@ static void test_prot_fault(void)
const
struct
exception
*
except
;
const
struct
exception
*
except
;
}
exc_frame
;
}
exc_frame
;
pNtCurrentTeb
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"ntdll.dll"
),
"NtCurrentTeb"
);
assert
(
pNtCurrentTeb
);
exc_frame
.
frame
.
Handler
=
handler
;
exc_frame
.
frame
.
Handler
=
handler
;
exc_frame
.
frame
.
Prev
=
NtCurrentTeb
()
->
Tib
.
ExceptionList
;
exc_frame
.
frame
.
Prev
=
p
NtCurrentTeb
()
->
Tib
.
ExceptionList
;
NtCurrentTeb
()
->
Tib
.
ExceptionList
=
&
exc_frame
.
frame
;
p
NtCurrentTeb
()
->
Tib
.
ExceptionList
=
&
exc_frame
.
frame
;
for
(
i
=
0
;
i
<
sizeof
(
exceptions
)
/
sizeof
(
exceptions
[
0
]);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
exceptions
)
/
sizeof
(
exceptions
[
0
]);
i
++
)
{
{
void
(
*
func
)(
void
)
=
(
void
*
)
exceptions
[
i
].
code
;
void
(
*
func
)(
void
)
=
(
void
*
)
exceptions
[
i
].
code
;
exc_frame
.
except
=
&
exceptions
[
i
];
exc_frame
.
except
=
&
exceptions
[
i
];
got_exception
=
0
;
got_exception
=
0
;
func
();
func
();
if
(
!
i
&&
!
got_exception
)
{
trace
(
"No exception, assuming win9x, no point in testing further
\n
"
);
break
;
}
ok
(
got_exception
==
(
exceptions
[
i
].
status
!=
0
),
ok
(
got_exception
==
(
exceptions
[
i
].
status
!=
0
),
"%u: bad exception count %d
\n
"
,
i
,
got_exception
);
"%u: bad exception count %d
\n
"
,
i
,
got_exception
);
}
}
NtCurrentTeb
()
->
Tib
.
ExceptionList
=
exc_frame
.
frame
.
Prev
;
p
NtCurrentTeb
()
->
Tib
.
ExceptionList
=
exc_frame
.
frame
.
Prev
;
}
}
#endif
/* __i386__ */
#endif
/* __i386__ */
...
...
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