ntoskrnl.exe: Implement automatically generated device names.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9392aaa17f
commit
365f162fb1
|
@ -1466,9 +1466,12 @@ NTSTATUS WINAPI IoCreateDevice( DRIVER_OBJECT *driver, ULONG ext_size,
|
||||||
ULONG characteristics, BOOLEAN exclusive,
|
ULONG characteristics, BOOLEAN exclusive,
|
||||||
DEVICE_OBJECT **ret_device )
|
DEVICE_OBJECT **ret_device )
|
||||||
{
|
{
|
||||||
|
static const WCHAR auto_format[] = {'\\','D','e','v','i','c','e','\\','%','0','8','x',0};
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
DEVICE_OBJECT *device;
|
DEVICE_OBJECT *device;
|
||||||
HANDLE manager = get_device_manager();
|
HANDLE manager = get_device_manager();
|
||||||
|
static unsigned int auto_idx = 0;
|
||||||
|
WCHAR autoW[17];
|
||||||
|
|
||||||
TRACE( "(%p, %u, %s, %u, %x, %u, %p)\n",
|
TRACE( "(%p, %u, %s, %u, %x, %u, %p)\n",
|
||||||
driver, ext_size, debugstr_us(name), type, characteristics, exclusive, ret_device );
|
driver, ext_size, debugstr_us(name), type, characteristics, exclusive, ret_device );
|
||||||
|
@ -1481,15 +1484,34 @@ NTSTATUS WINAPI IoCreateDevice( DRIVER_OBJECT *driver, ULONG ext_size,
|
||||||
device->DeviceType = type;
|
device->DeviceType = type;
|
||||||
device->StackSize = 1;
|
device->StackSize = 1;
|
||||||
|
|
||||||
SERVER_START_REQ( create_device )
|
if (characteristics & FILE_AUTOGENERATED_DEVICE_NAME)
|
||||||
{
|
{
|
||||||
req->rootdir = 0;
|
do
|
||||||
req->manager = wine_server_obj_handle( manager );
|
{
|
||||||
req->user_ptr = wine_server_client_ptr( device );
|
sprintfW( autoW, auto_format, auto_idx++ );
|
||||||
if (name) wine_server_add_data( req, name->Buffer, name->Length );
|
SERVER_START_REQ( create_device )
|
||||||
status = wine_server_call( req );
|
{
|
||||||
|
req->rootdir = 0;
|
||||||
|
req->manager = wine_server_obj_handle( manager );
|
||||||
|
req->user_ptr = wine_server_client_ptr( device );
|
||||||
|
wine_server_add_data( req, autoW, strlenW(autoW) * sizeof(WCHAR) );
|
||||||
|
status = wine_server_call( req );
|
||||||
|
}
|
||||||
|
SERVER_END_REQ;
|
||||||
|
} while (status == STATUS_OBJECT_NAME_COLLISION);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SERVER_START_REQ( create_device )
|
||||||
|
{
|
||||||
|
req->rootdir = 0;
|
||||||
|
req->manager = wine_server_obj_handle( manager );
|
||||||
|
req->user_ptr = wine_server_client_ptr( device );
|
||||||
|
if (name) wine_server_add_data( req, name->Buffer, name->Length );
|
||||||
|
status = wine_server_call( req );
|
||||||
|
}
|
||||||
|
SERVER_END_REQ;
|
||||||
}
|
}
|
||||||
SERVER_END_REQ;
|
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue