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
33de7fb7
Commit
33de7fb7
authored
Nov 19, 2018
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Nov 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mountmgr: Add IOCTL_STORAGE_QUERY_PROPERTY stub.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b7402ddb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
0 deletions
+117
-0
volume.c
dlls/kernel32/tests/volume.c
+46
-0
device.c
dlls/mountmgr.sys/device.c
+71
-0
No files found.
dlls/kernel32/tests/volume.c
View file @
33de7fb7
...
...
@@ -21,6 +21,7 @@
#include "wine/test.h"
#include "winbase.h"
#include "winioctl.h"
#include "ntddstor.h"
#include <stdio.h>
#include "ddk/ntddcdvd.h"
...
...
@@ -590,6 +591,50 @@ static void test_disk_extents(void)
CloseHandle
(
handle
);
}
static
void
test_disk_query_property
(
void
)
{
STORAGE_PROPERTY_QUERY
query
=
{
0
};
STORAGE_DESCRIPTOR_HEADER
header
=
{
0
};
STORAGE_DEVICE_DESCRIPTOR
descriptor
=
{
0
};
HANDLE
handle
;
DWORD
error
;
DWORD
size
;
BOOL
ret
;
handle
=
CreateFileA
(
"
\\\\
.
\\
PhysicalDrive0"
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
win_skip
(
"can't open
\\\\
.
\\
PhysicalDrive0 %#x
\n
"
,
GetLastError
());
return
;
}
query
.
PropertyId
=
StorageDeviceProperty
;
query
.
QueryType
=
PropertyStandardQuery
;
SetLastError
(
0xdeadbeef
);
ret
=
DeviceIoControl
(
handle
,
IOCTL_STORAGE_QUERY_PROPERTY
,
&
query
,
sizeof
(
query
),
&
header
,
sizeof
(
header
),
&
size
,
NULL
);
error
=
GetLastError
();
ok
(
ret
,
"expect ret %#x, got %#x
\n
"
,
TRUE
,
ret
);
ok
(
error
==
0xdeadbeef
,
"expect err %#x, got err %#x
\n
"
,
0xdeadbeef
,
error
);
ok
(
size
==
sizeof
(
header
),
"got size %d
\n
"
,
size
);
ok
(
header
.
Version
==
sizeof
(
descriptor
),
"got header.Version %d
\n
"
,
header
.
Version
);
ok
(
header
.
Size
>=
sizeof
(
descriptor
),
"got header.Size %d
\n
"
,
header
.
Size
);
SetLastError
(
0xdeadbeef
);
ret
=
DeviceIoControl
(
handle
,
IOCTL_STORAGE_QUERY_PROPERTY
,
&
query
,
sizeof
(
query
),
&
descriptor
,
sizeof
(
descriptor
),
&
size
,
NULL
);
error
=
GetLastError
();
ok
(
ret
,
"expect ret %#x, got %#x
\n
"
,
TRUE
,
ret
);
ok
(
error
==
0xdeadbeef
,
"expect err %#x, got err %#x
\n
"
,
0xdeadbeef
,
error
);
ok
(
size
==
sizeof
(
descriptor
),
"got size %d
\n
"
,
size
);
ok
(
descriptor
.
Version
==
sizeof
(
descriptor
),
"got descriptor.Version %d
\n
"
,
descriptor
.
Version
);
ok
(
descriptor
.
Size
>=
sizeof
(
descriptor
),
"got descriptor.Size %d
\n
"
,
descriptor
.
Size
);
CloseHandle
(
handle
);
}
static
void
test_GetVolumePathNameA
(
void
)
{
char
volume_path
[
MAX_PATH
],
cwd
[
MAX_PATH
];
...
...
@@ -1238,6 +1283,7 @@ START_TEST(volume)
test_GetVolumeInformationA
();
test_enum_vols
();
test_disk_extents
();
test_disk_query_property
();
test_GetVolumePathNamesForVolumeNameA
();
test_GetVolumePathNamesForVolumeNameW
();
test_cdrom_ioctl
();
...
...
dlls/mountmgr.sys/device.c
View file @
33de7fb7
...
...
@@ -890,6 +890,74 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, ch
return
status
;
}
static
void
query_property
(
IRP
*
irp
)
{
IO_STACK_LOCATION
*
irpsp
=
IoGetCurrentIrpStackLocation
(
irp
);
STORAGE_PROPERTY_QUERY
*
query
=
irp
->
AssociatedIrp
.
SystemBuffer
;
if
(
!
irp
->
AssociatedIrp
.
SystemBuffer
||
irpsp
->
Parameters
.
DeviceIoControl
.
InputBufferLength
<
sizeof
(
STORAGE_PROPERTY_QUERY
))
{
irp
->
IoStatus
.
u
.
Status
=
STATUS_INVALID_PARAMETER
;
return
;
}
/* Try to persuade application not to check property */
if
(
query
->
QueryType
==
PropertyExistsQuery
)
{
irp
->
IoStatus
.
u
.
Status
=
STATUS_NOT_SUPPORTED
;
return
;
}
switch
(
query
->
PropertyId
)
{
case
StorageDeviceProperty
:
{
STORAGE_DEVICE_DESCRIPTOR
*
descriptor
;
if
(
!
irp
->
UserBuffer
||
irpsp
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
<
sizeof
(
STORAGE_DESCRIPTOR_HEADER
))
irp
->
IoStatus
.
u
.
Status
=
STATUS_INVALID_PARAMETER
;
else
if
(
irpsp
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
<
sizeof
(
STORAGE_DEVICE_DESCRIPTOR
))
{
descriptor
=
irp
->
UserBuffer
;
descriptor
->
Version
=
sizeof
(
STORAGE_DEVICE_DESCRIPTOR
);
descriptor
->
Size
=
sizeof
(
STORAGE_DEVICE_DESCRIPTOR
);
irp
->
IoStatus
.
Information
=
sizeof
(
STORAGE_DESCRIPTOR_HEADER
);
irp
->
IoStatus
.
u
.
Status
=
STATUS_SUCCESS
;
}
else
{
FIXME
(
"Faking StorageDeviceProperty data
\n
"
);
memset
(
irp
->
UserBuffer
,
0
,
irpsp
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
);
descriptor
=
irp
->
UserBuffer
;
descriptor
->
Version
=
sizeof
(
STORAGE_DEVICE_DESCRIPTOR
);
descriptor
->
Size
=
sizeof
(
STORAGE_DEVICE_DESCRIPTOR
);
descriptor
->
DeviceType
=
FILE_DEVICE_DISK
;
descriptor
->
DeviceTypeModifier
=
0
;
descriptor
->
RemovableMedia
=
FALSE
;
descriptor
->
CommandQueueing
=
FALSE
;
descriptor
->
VendorIdOffset
=
0
;
descriptor
->
ProductIdOffset
=
0
;
descriptor
->
ProductRevisionOffset
=
0
;
descriptor
->
SerialNumberOffset
=
0
;
descriptor
->
BusType
=
BusTypeScsi
;
descriptor
->
RawPropertiesLength
=
0
;
irp
->
IoStatus
.
Information
=
sizeof
(
STORAGE_DEVICE_DESCRIPTOR
);
irp
->
IoStatus
.
u
.
Status
=
STATUS_SUCCESS
;
}
break
;
}
default:
FIXME
(
"Unsupported property %#x
\n
"
,
query
->
PropertyId
);
irp
->
IoStatus
.
u
.
Status
=
STATUS_NOT_SUPPORTED
;
break
;
}
}
/* handler for ioctls on the harddisk device */
static
NTSTATUS
WINAPI
harddisk_ioctl
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
...
...
@@ -962,6 +1030,9 @@ static NTSTATUS WINAPI harddisk_ioctl( DEVICE_OBJECT *device, IRP *irp )
irp
->
IoStatus
.
u
.
Status
=
STATUS_SUCCESS
;
break
;
}
case
IOCTL_STORAGE_QUERY_PROPERTY
:
query_property
(
irp
);
break
;
default:
{
ULONG
code
=
irpsp
->
Parameters
.
DeviceIoControl
.
IoControlCode
;
...
...
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