Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/pnp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 48430f31123..90da2b7ee37 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -785,6 +785,18 @@ static NTSTATUS WINAPI pnp_manager_device_pnp( DEVICE_OBJECT *device, IRP *irp )
TRACE("device %p, irp %p, minor function %#x.\n", device, irp, stack->MinorFunction);
+ switch (stack->MinorFunction) + { + case IRP_MN_START_DEVICE: + case IRP_MN_SURPRISE_REMOVAL: + case IRP_MN_REMOVE_DEVICE: + /* Nothing to do. */ + irp->IoStatus.u.Status = STATUS_SUCCESS; + break; + default: + FIXME("Unhandled PnP request %#x.\n", stack->MinorFunction); + } + IoCompleteRequest( irp, IO_NO_INCREMENT ); return irp->IoStatus.u.Status; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/pnp.c | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 90da2b7ee37..f5315275859 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -782,6 +782,7 @@ static struct wine_rb_tree root_pnp_devices = { root_pnp_devices_rb_compare }; static NTSTATUS WINAPI pnp_manager_device_pnp( DEVICE_OBJECT *device, IRP *irp ) { IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation( irp ); + struct root_pnp_device *root_device = device->DeviceExtension;
TRACE("device %p, irp %p, minor function %#x.\n", device, irp, stack->MinorFunction);
@@ -793,6 +794,49 @@ static NTSTATUS WINAPI pnp_manager_device_pnp( DEVICE_OBJECT *device, IRP *irp ) /* Nothing to do. */ irp->IoStatus.u.Status = STATUS_SUCCESS; break; + case IRP_MN_QUERY_ID: + { + BUS_QUERY_ID_TYPE type = stack->Parameters.QueryId.IdType; + WCHAR *id, *p; + + TRACE("Received IRP_MN_QUERY_ID, type %#x.\n", type); + + switch (type) + { + case BusQueryDeviceID: + p = wcsrchr( root_device->id, '\' ); + if ((id = ExAllocatePool( NonPagedPool, (p - root_device->id + 1) * sizeof(WCHAR) ))) + { + memcpy( id, root_device->id, (p - root_device->id) * sizeof(WCHAR) ); + id[p - root_device->id] = 0; + irp->IoStatus.Information = (ULONG_PTR)id; + irp->IoStatus.u.Status = STATUS_SUCCESS; + } + else + { + irp->IoStatus.Information = 0; + irp->IoStatus.u.Status = STATUS_NO_MEMORY; + } + break; + case BusQueryInstanceID: + p = wcsrchr( root_device->id, '\' ); + if ((id = ExAllocatePool( NonPagedPool, (wcslen( p + 1 ) + 1) * sizeof(WCHAR) ))) + { + wcscpy( id, p + 1 ); + irp->IoStatus.Information = (ULONG_PTR)id; + irp->IoStatus.u.Status = STATUS_SUCCESS; + } + else + { + irp->IoStatus.Information = 0; + irp->IoStatus.u.Status = STATUS_NO_MEMORY; + } + break; + default: + FIXME("Unhandled IRP_MN_QUERY_ID type %#x.\n", type); + } + break; + } default: FIXME("Unhandled PnP request %#x.\n", stack->MinorFunction); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/pnp.c | 8 ++++++++ include/ddk/wdm.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index d119f37d02f..99594c8fb3d 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -853,7 +853,7 @@ @ stdcall PoSetPowerState(ptr long long) @ stub PoSetSystemState @ stub PoShutdownBugCheck -@ stub PoStartNextPowerIrp +@ stdcall PoStartNextPowerIrp(ptr) @ stub PoUnregisterSystemState @ stdcall ProbeForRead(ptr long long) @ stdcall ProbeForWrite(ptr long long) diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index f5315275859..491f0165c00 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -760,6 +760,14 @@ POWER_STATE WINAPI PoSetPowerState( DEVICE_OBJECT *device, POWER_STATE_TYPE type return state; }
+/***************************************************** + * PoStartNextPowerIrp (NTOSKRNL.EXE.@) + */ +void WINAPI PoStartNextPowerIrp( IRP *irp ) +{ + FIXME("irp %p, stub!\n", irp); +} + static DRIVER_OBJECT *pnp_manager;
struct root_pnp_device diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index e3333e9e2bd..0adfac0cace 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1671,6 +1671,8 @@ NTSTATUS WINAPI ObReferenceObjectByPointer(void*,ACCESS_MASK,POBJECT_TYPE,KPROC void WINAPI ObUnRegisterCallbacks(void*);
POWER_STATE WINAPI PoSetPowerState(PDEVICE_OBJECT,POWER_STATE_TYPE,POWER_STATE); +void WINAPI PoStartNextPowerIrp(IRP*); + NTSTATUS WINAPI PsCreateSystemThread(PHANDLE,ULONG,POBJECT_ATTRIBUTES,HANDLE,PCLIENT_ID,PKSTART_ROUTINE,PVOID); #define PsGetCurrentProcess() IoGetCurrentProcess() #define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- dlls/ntoskrnl.exe/pnp.c | 9 +++++++++ include/ddk/wdm.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 99594c8fb3d..359e2d9e69b 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -841,7 +841,7 @@ @ stub PfxInitialize @ stub PfxInsertPrefix @ stub PfxRemovePrefix -@ stub PoCallDriver +@ stdcall PoCallDriver(ptr ptr) @ stub PoCancelDeviceNotify @ stub PoQueueShutdownWorkItem @ stub PoRegisterDeviceForIdleDetection diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c index 491f0165c00..4ec8aaaed27 100644 --- a/dlls/ntoskrnl.exe/pnp.c +++ b/dlls/ntoskrnl.exe/pnp.c @@ -768,6 +768,15 @@ void WINAPI PoStartNextPowerIrp( IRP *irp ) FIXME("irp %p, stub!\n", irp); }
+/***************************************************** + * PoCallDriver (NTOSKRNL.EXE.@) + */ +NTSTATUS WINAPI PoCallDriver( DEVICE_OBJECT *device, IRP *irp ) +{ + TRACE("device %p, irp %p.\n", device, irp); + return IoCallDriver( device, irp ); +} + static DRIVER_OBJECT *pnp_manager;
struct root_pnp_device diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 0adfac0cace..864c0c919b0 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1670,6 +1670,7 @@ NTSTATUS WINAPI ObReferenceObjectByName(UNICODE_STRING*,ULONG,ACCESS_STATE*,ACC NTSTATUS WINAPI ObReferenceObjectByPointer(void*,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE); void WINAPI ObUnRegisterCallbacks(void*);
+NTSTATUS WINAPI PoCallDriver(DEVICE_OBJECT*,IRP*); POWER_STATE WINAPI PoSetPowerState(PDEVICE_OBJECT,POWER_STATE_TYPE,POWER_STATE); void WINAPI PoStartNextPowerIrp(IRP*);