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
73cc00f9
Commit
73cc00f9
authored
May 18, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe: Reuse the kernel32 instruction emulation support for kernel-mode drivers.
parent
e1cbec75
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
6 deletions
+26
-6
instr.c
dlls/kernel32/instr.c
+3
-3
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-0
kernel_private.h
dlls/kernel32/kernel_private.h
+1
-1
wowthunk.c
dlls/kernel32/wowthunk.c
+2
-2
ntoskrnl.c
dlls/ntoskrnl.exe/ntoskrnl.c
+19
-0
No files found.
dlls/kernel32/instr.c
View file @
73cc00f9
...
...
@@ -428,12 +428,12 @@ static void INSTR_outport( WORD port, int size, DWORD val, CONTEXT86 *context )
/***********************************************************************
*
INSTR_EmulateI
nstruction
*
__wine_emulate_i
nstruction
*
* Emulate a privileged instruction.
* Returns exception continuation status.
*/
DWORD
INSTR_EmulateI
nstruction
(
EXCEPTION_RECORD
*
rec
,
CONTEXT86
*
context
)
DWORD
__wine_emulate_i
nstruction
(
EXCEPTION_RECORD
*
rec
,
CONTEXT86
*
context
)
{
int
prefix
,
segprefix
,
prefixlen
,
len
,
repX
,
long_op
,
long_addr
;
BYTE
*
instr
;
...
...
@@ -886,7 +886,7 @@ LONG CALLBACK INSTR_vectored_handler( EXCEPTION_POINTERS *ptrs )
(
record
->
ExceptionCode
==
EXCEPTION_ACCESS_VIOLATION
||
record
->
ExceptionCode
==
EXCEPTION_PRIV_INSTRUCTION
))
{
if
(
INSTR_EmulateI
nstruction
(
record
,
context
)
==
ExceptionContinueExecution
)
if
(
__wine_emulate_i
nstruction
(
record
,
context
)
==
ExceptionContinueExecution
)
return
EXCEPTION_CONTINUE_EXECUTION
;
}
return
EXCEPTION_CONTINUE_SEARCH
;
...
...
dlls/kernel32/kernel32.spec
View file @
73cc00f9
...
...
@@ -1234,6 +1234,7 @@
@ cdecl __wine_dll_register_16(ptr str)
@ cdecl __wine_dll_unregister_16(ptr)
@ varargs -private __wine_call_from_16_regs()
@ cdecl __wine_emulate_instruction(ptr ptr)
# Unix files
@ cdecl wine_get_unix_file_name(wstr)
...
...
dlls/kernel32/kernel_private.h
View file @
73cc00f9
...
...
@@ -79,7 +79,7 @@ extern void FILE_SetDosError(void);
extern
WCHAR
*
FILE_name_AtoW
(
LPCSTR
name
,
BOOL
alloc
);
extern
DWORD
FILE_name_WtoA
(
LPCWSTR
src
,
INT
srclen
,
LPSTR
dest
,
INT
destlen
);
extern
DWORD
INSTR_EmulateI
nstruction
(
EXCEPTION_RECORD
*
rec
,
CONTEXT86
*
context
);
extern
DWORD
__wine_emulate_i
nstruction
(
EXCEPTION_RECORD
*
rec
,
CONTEXT86
*
context
);
extern
LONG
CALLBACK
INSTR_vectored_handler
(
EXCEPTION_POINTERS
*
ptrs
);
extern
void
INSTR_CallBuiltinHandler
(
CONTEXT86
*
context
,
BYTE
intnum
);
...
...
dlls/kernel32/wowthunk.c
View file @
73cc00f9
...
...
@@ -256,7 +256,7 @@ static DWORD call16_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RE
else
{
SEGPTR
gpHandler
;
DWORD
ret
=
INSTR_EmulateI
nstruction
(
record
,
context
);
DWORD
ret
=
__wine_emulate_i
nstruction
(
record
,
context
);
/*
* Insert check for pending DPMI events. Note that this
...
...
@@ -310,7 +310,7 @@ static DWORD vm86_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RECO
if
(
record
->
ExceptionCode
==
EXCEPTION_ACCESS_VIOLATION
||
record
->
ExceptionCode
==
EXCEPTION_PRIV_INSTRUCTION
)
{
return
INSTR_EmulateI
nstruction
(
record
,
context
);
return
__wine_emulate_i
nstruction
(
record
,
context
);
}
return
ExceptionContinueSearch
;
...
...
dlls/ntoskrnl.exe/ntoskrnl.c
View file @
73cc00f9
...
...
@@ -30,6 +30,7 @@
#define WIN32_NO_STATUS
#include "windef.h"
#include "winternl.h"
#include "excpt.h"
#include "ddk/wdm.h"
#include "wine/unicode.h"
#include "wine/server.h"
...
...
@@ -103,6 +104,23 @@ static HANDLE get_device_manager(void)
return
ret
;
}
/* exception handler for emulation of privileged instructions */
static
LONG
CALLBACK
vectored_handler
(
EXCEPTION_POINTERS
*
ptrs
)
{
extern
DWORD
__wine_emulate_instruction
(
EXCEPTION_RECORD
*
rec
,
CONTEXT86
*
context
);
EXCEPTION_RECORD
*
record
=
ptrs
->
ExceptionRecord
;
CONTEXT86
*
context
=
ptrs
->
ContextRecord
;
if
(
record
->
ExceptionCode
==
EXCEPTION_ACCESS_VIOLATION
||
record
->
ExceptionCode
==
EXCEPTION_PRIV_INSTRUCTION
)
{
if
(
__wine_emulate_instruction
(
record
,
context
)
==
ExceptionContinueExecution
)
return
EXCEPTION_CONTINUE_EXECUTION
;
}
return
EXCEPTION_CONTINUE_SEARCH
;
}
/* process an ioctl request for a given device */
static
NTSTATUS
process_ioctl
(
DEVICE_OBJECT
*
device
,
ULONG
code
,
void
*
in_buff
,
ULONG
in_size
,
void
*
out_buff
,
ULONG
*
out_size
)
...
...
@@ -479,6 +497,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
{
case
DLL_PROCESS_ATTACH
:
DisableThreadLibraryCalls
(
inst
);
RtlAddVectoredExceptionHandler
(
TRUE
,
vectored_handler
);
break
;
}
return
TRUE
;
...
...
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