Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
42c52151
Commit
42c52151
authored
Oct 08, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Moved the DeviceIoControl function to file.c.
parent
69a1fba4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
85 deletions
+82
-85
file.c
dlls/kernel32/file.c
+77
-0
kernel_private.h
dlls/kernel32/kernel_private.h
+3
-0
vxd.c
dlls/kernel32/vxd.c
+2
-85
No files found.
dlls/kernel32/file.c
View file @
42c52151
...
...
@@ -2310,6 +2310,83 @@ DWORD WINAPI GetCompressedFileSizeA( LPCSTR name, LPDWORD size_high )
/***********************************************************************
* OpenVxDHandle (KERNEL32.@)
*
* This function is supposed to return the corresponding Ring 0
* ("kernel") handle for a Ring 3 handle in Win9x.
* Evidently, Wine will have problems with this. But we try anyway,
* maybe it helps...
*/
HANDLE
WINAPI
OpenVxDHandle
(
HANDLE
hHandleRing3
)
{
FIXME
(
"(%p), stub! (returning Ring 3 handle instead of Ring 0)
\n
"
,
hHandleRing3
);
return
hHandleRing3
;
}
/****************************************************************************
* DeviceIoControl (KERNEL32.@)
*/
BOOL
WINAPI
DeviceIoControl
(
HANDLE
hDevice
,
DWORD
dwIoControlCode
,
LPVOID
lpvInBuffer
,
DWORD
cbInBuffer
,
LPVOID
lpvOutBuffer
,
DWORD
cbOutBuffer
,
LPDWORD
lpcbBytesReturned
,
LPOVERLAPPED
lpOverlapped
)
{
NTSTATUS
status
;
TRACE
(
"(%p,%x,%p,%d,%p,%d,%p,%p)
\n
"
,
hDevice
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
,
lpcbBytesReturned
,
lpOverlapped
);
/* Check if this is a user defined control code for a VxD */
if
(
HIWORD
(
dwIoControlCode
)
==
0
&&
(
GetVersion
()
&
0x80000000
))
{
DeviceIoProc
proc
=
VXD_get_proc
(
hDevice
);
if
(
proc
)
return
proc
(
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
,
lpcbBytesReturned
,
lpOverlapped
);
}
/* Not a VxD, let ntdll handle it */
if
(
lpOverlapped
)
{
LPVOID
cvalue
=
((
ULONG_PTR
)
lpOverlapped
->
hEvent
&
1
)
?
NULL
:
lpOverlapped
;
lpOverlapped
->
Internal
=
STATUS_PENDING
;
lpOverlapped
->
InternalHigh
=
0
;
if
(
HIWORD
(
dwIoControlCode
)
==
FILE_DEVICE_FILE_SYSTEM
)
status
=
NtFsControlFile
(
hDevice
,
lpOverlapped
->
hEvent
,
NULL
,
cvalue
,
(
PIO_STATUS_BLOCK
)
lpOverlapped
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
);
else
status
=
NtDeviceIoControlFile
(
hDevice
,
lpOverlapped
->
hEvent
,
NULL
,
cvalue
,
(
PIO_STATUS_BLOCK
)
lpOverlapped
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
);
if
(
lpcbBytesReturned
)
*
lpcbBytesReturned
=
lpOverlapped
->
InternalHigh
;
}
else
{
IO_STATUS_BLOCK
iosb
;
if
(
HIWORD
(
dwIoControlCode
)
==
FILE_DEVICE_FILE_SYSTEM
)
status
=
NtFsControlFile
(
hDevice
,
NULL
,
NULL
,
NULL
,
&
iosb
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
);
else
status
=
NtDeviceIoControlFile
(
hDevice
,
NULL
,
NULL
,
NULL
,
&
iosb
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
);
if
(
lpcbBytesReturned
)
*
lpcbBytesReturned
=
iosb
.
Information
;
}
if
(
status
)
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
!
status
;
}
/***********************************************************************
* OpenFile (KERNEL32.@)
*/
HFILE
WINAPI
OpenFile
(
LPCSTR
name
,
OFSTRUCT
*
ofs
,
UINT
mode
)
...
...
dlls/kernel32/kernel_private.h
View file @
42c52151
...
...
@@ -93,6 +93,9 @@ extern DWORD MODULE_GetBinaryType( HANDLE hfile, void **res_start, void **res_en
extern
BOOL
NLS_IsUnicodeOnlyLcid
(
LCID
);
/* vxd.c */
typedef
BOOL
(
WINAPI
*
DeviceIoProc
)(
DWORD
,
LPVOID
,
DWORD
,
LPVOID
,
DWORD
,
LPDWORD
,
LPOVERLAPPED
);
extern
DeviceIoProc
VXD_get_proc
(
HANDLE
handle
);
extern
HANDLE
VXD_Open
(
LPCWSTR
filename
,
DWORD
access
,
LPSECURITY_ATTRIBUTES
sa
);
/* environ.c */
...
...
dlls/kernel32/vxd.c
View file @
42c52151
...
...
@@ -39,6 +39,7 @@
#include "winerror.h"
#include "winternl.h"
#include "winioctl.h"
#include "kernel_private.h"
#include "kernel16_private.h"
#include "wine/library.h"
#include "wine/unicode.h"
...
...
@@ -47,7 +48,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
vxd
);
typedef
BOOL
(
WINAPI
*
DeviceIoProc
)(
DWORD
,
LPVOID
,
DWORD
,
LPVOID
,
DWORD
,
LPDWORD
,
LPOVERLAPPED
);
typedef
DWORD
(
WINAPI
*
VxDCallProc
)(
DWORD
,
CONTEXT86
*
);
struct
vxd_module
...
...
@@ -134,7 +134,7 @@ static HANDLE open_vxd_handle( LPCWSTR name )
}
/* retrieve the DeviceIoControl function for a Vxd given a file handle */
static
DeviceIoProc
get_vxd
_proc
(
HANDLE
handle
)
DeviceIoProc
VXD_get
_proc
(
HANDLE
handle
)
{
DeviceIoProc
ret
=
NULL
;
int
status
,
i
;
...
...
@@ -299,86 +299,3 @@ void WINAPI __regs_VxDCall( DWORD service, CONTEXT86 *context )
#ifdef DEFINE_REGS_ENTRYPOINT
DEFINE_REGS_ENTRYPOINT
(
VxDCall
,
1
)
#endif
/***********************************************************************
* OpenVxDHandle (KERNEL32.@)
*
* This function is supposed to return the corresponding Ring 0
* ("kernel") handle for a Ring 3 handle in Win9x.
* Evidently, Wine will have problems with this. But we try anyway,
* maybe it helps...
*/
HANDLE
WINAPI
OpenVxDHandle
(
HANDLE
hHandleRing3
)
{
FIXME
(
"(%p), stub! (returning Ring 3 handle instead of Ring 0)
\n
"
,
hHandleRing3
);
return
hHandleRing3
;
}
/****************************************************************************
* DeviceIoControl (KERNEL32.@)
* This is one of those big ugly nasty procedure which can do
* a million and one things when it comes to devices. It can also be
* used for VxD communication.
*
* A return value of FALSE indicates that something has gone wrong which
* GetLastError can decipher.
*/
BOOL
WINAPI
DeviceIoControl
(
HANDLE
hDevice
,
DWORD
dwIoControlCode
,
LPVOID
lpvInBuffer
,
DWORD
cbInBuffer
,
LPVOID
lpvOutBuffer
,
DWORD
cbOutBuffer
,
LPDWORD
lpcbBytesReturned
,
LPOVERLAPPED
lpOverlapped
)
{
NTSTATUS
status
;
TRACE
(
"(%p,%x,%p,%d,%p,%d,%p,%p)
\n
"
,
hDevice
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
,
lpcbBytesReturned
,
lpOverlapped
);
/* Check if this is a user defined control code for a VxD */
if
(
HIWORD
(
dwIoControlCode
)
==
0
&&
(
GetVersion
()
&
0x80000000
))
{
DeviceIoProc
proc
=
get_vxd_proc
(
hDevice
);
if
(
proc
)
return
proc
(
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
,
lpcbBytesReturned
,
lpOverlapped
);
}
/* Not a VxD, let ntdll handle it */
if
(
lpOverlapped
)
{
LPVOID
cvalue
=
((
ULONG_PTR
)
lpOverlapped
->
hEvent
&
1
)
?
NULL
:
lpOverlapped
;
lpOverlapped
->
Internal
=
STATUS_PENDING
;
lpOverlapped
->
InternalHigh
=
0
;
if
(
HIWORD
(
dwIoControlCode
)
==
FILE_DEVICE_FILE_SYSTEM
)
status
=
NtFsControlFile
(
hDevice
,
lpOverlapped
->
hEvent
,
NULL
,
cvalue
,
(
PIO_STATUS_BLOCK
)
lpOverlapped
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
);
else
status
=
NtDeviceIoControlFile
(
hDevice
,
lpOverlapped
->
hEvent
,
NULL
,
cvalue
,
(
PIO_STATUS_BLOCK
)
lpOverlapped
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
);
if
(
lpcbBytesReturned
)
*
lpcbBytesReturned
=
lpOverlapped
->
InternalHigh
;
}
else
{
IO_STATUS_BLOCK
iosb
;
if
(
HIWORD
(
dwIoControlCode
)
==
FILE_DEVICE_FILE_SYSTEM
)
status
=
NtFsControlFile
(
hDevice
,
NULL
,
NULL
,
NULL
,
&
iosb
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
);
else
status
=
NtDeviceIoControlFile
(
hDevice
,
NULL
,
NULL
,
NULL
,
&
iosb
,
dwIoControlCode
,
lpvInBuffer
,
cbInBuffer
,
lpvOutBuffer
,
cbOutBuffer
);
if
(
lpcbBytesReturned
)
*
lpcbBytesReturned
=
iosb
.
Information
;
}
if
(
status
)
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
!
status
;
}
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