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,
|
||||
DEVICE_OBJECT **ret_device )
|
||||
{
|
||||
static const WCHAR auto_format[] = {'\\','D','e','v','i','c','e','\\','%','0','8','x',0};
|
||||
NTSTATUS status;
|
||||
DEVICE_OBJECT *device;
|
||||
HANDLE manager = get_device_manager();
|
||||
static unsigned int auto_idx = 0;
|
||||
WCHAR autoW[17];
|
||||
|
||||
TRACE( "(%p, %u, %s, %u, %x, %u, %p)\n",
|
||||
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->StackSize = 1;
|
||||
|
||||
SERVER_START_REQ( create_device )
|
||||
if (characteristics & FILE_AUTOGENERATED_DEVICE_NAME)
|
||||
{
|
||||
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 );
|
||||
do
|
||||
{
|
||||
sprintfW( autoW, auto_format, auto_idx++ );
|
||||
SERVER_START_REQ( create_device )
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue