Zebediah Figura : ntoskrnl.exe: Implement IoOpenDeviceRegistryKey().
Alexandre Julliard
julliard at winehq.org
Mon Mar 16 16:49:06 CDT 2020
Module: wine
Branch: master
Commit: bd00dedecd83935c45d32657dd8c60a44cd1c817
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bd00dedecd83935c45d32657dd8c60a44cd1c817
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Mar 15 10:09:03 2020 -0500
ntoskrnl.exe: Implement IoOpenDeviceRegistryKey().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
dlls/ntoskrnl.exe/pnp.c | 29 +++++++++++++++++++++++++++++
include/ddk/wdm.h | 1 +
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 6b5b127a62..40341d8f0c 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -423,7 +423,7 @@
@ stdcall IoIsWdmVersionAvailable(long long)
@ stub IoMakeAssociatedIrp
@ stub IoOpenDeviceInterfaceRegistryKey
-@ stub IoOpenDeviceRegistryKey
+@ stdcall IoOpenDeviceRegistryKey(ptr long long ptr)
@ stub IoPageRead
@ stub IoPnPDeliverServicePowerNotification
@ stdcall IoQueryDeviceDescription(ptr ptr ptr ptr ptr ptr ptr ptr)
diff --git a/dlls/ntoskrnl.exe/pnp.c b/dlls/ntoskrnl.exe/pnp.c
index 863e1d9d53..75310f7b35 100644
--- a/dlls/ntoskrnl.exe/pnp.c
+++ b/dlls/ntoskrnl.exe/pnp.c
@@ -844,6 +844,35 @@ NTSTATUS WINAPI IoRegisterDeviceInterface(DEVICE_OBJECT *device, const GUID *cla
return status;
}
+/***********************************************************************
+ * IoOpenDeviceRegistryKey (NTOSKRNL.EXE.@)
+ */
+NTSTATUS WINAPI IoOpenDeviceRegistryKey( DEVICE_OBJECT *device, ULONG type, ACCESS_MASK access, HANDLE *key )
+{
+ SP_DEVINFO_DATA sp_device = {sizeof(sp_device)};
+ WCHAR device_instance_id[MAX_DEVICE_ID_LEN];
+ NTSTATUS status;
+ HDEVINFO set;
+
+ TRACE("device %p, type %#x, access %#x, key %p.\n", device, type, access, key);
+
+ if ((status = get_device_instance_id( device, device_instance_id )))
+ {
+ ERR("Failed to get device instance ID, error %#x.\n", status);
+ return status;
+ }
+
+ set = SetupDiCreateDeviceInfoList( &GUID_NULL, NULL );
+
+ SetupDiOpenDeviceInfoW( set, device_instance_id, NULL, 0, &sp_device );
+
+ *key = SetupDiOpenDevRegKey( set, &sp_device, DICS_FLAG_GLOBAL, 0, type, access );
+ SetupDiDestroyDeviceInfoList( set );
+ if (*key == INVALID_HANDLE_VALUE)
+ return GetLastError();
+ return STATUS_SUCCESS;
+}
+
/***********************************************************************
* PoSetPowerState (NTOSKRNL.EXE.@)
*/
diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h
index 53ea9e17cf..b4325cec6c 100644
--- a/include/ddk/wdm.h
+++ b/include/ddk/wdm.h
@@ -1607,6 +1607,7 @@ void WINAPI IoGetStackLimits(ULONG_PTR*,ULONG_PTR*);
void WINAPI IoInitializeIrp(IRP*,USHORT,CCHAR);
VOID WINAPI IoInitializeRemoveLockEx(PIO_REMOVE_LOCK,ULONG,ULONG,ULONG,ULONG);
void WINAPI IoInvalidateDeviceRelations(PDEVICE_OBJECT,DEVICE_RELATION_TYPE);
+NTSTATUS WINAPI IoOpenDeviceRegistryKey(DEVICE_OBJECT*,ULONG,ACCESS_MASK,HANDLE*);
void WINAPI IoQueueWorkItem(PIO_WORKITEM,PIO_WORKITEM_ROUTINE,WORK_QUEUE_TYPE,void*);
NTSTATUS WINAPI IoRegisterDeviceInterface(PDEVICE_OBJECT,const GUID*,PUNICODE_STRING,PUNICODE_STRING);
void WINAPI IoReleaseCancelSpinLock(KIRQL);
More information about the wine-cvs
mailing list