Commit 50210ea2 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler Committed by Alexandre Julliard

ntoskrnl: Implement IoSetDevicePropertyData().

parent daf95aaa
......@@ -465,6 +465,7 @@
@ stdcall IoReuseIrp(ptr long)
@ stub IoSetCompletionRoutineEx
@ stdcall IoSetDeviceInterfaceState(ptr long)
@ stdcall IoSetDevicePropertyData(ptr ptr long long long long ptr)
@ stub IoSetDeviceToVerify
@ stub IoSetFileOrigin
@ stub IoSetHardErrorOrVerifyDevice
......
......@@ -38,6 +38,12 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
static inline const char *debugstr_propkey( const DEVPROPKEY *id )
{
if (!id) return "(null)";
return wine_dbg_sprintf( "{%s,%04x}", wine_dbgstr_guid( &id->fmtid ), id->pid );
}
#define MAX_SERVICE_NAME 260
struct device_interface
......@@ -784,6 +790,51 @@ NTSTATUS WINAPI IoSetDeviceInterfaceState( UNICODE_STRING *name, BOOLEAN enable
}
/***********************************************************************
* IoSetDevicePropertyData (NTOSKRNL.EXE.@)
*/
NTSTATUS WINAPI IoSetDevicePropertyData( DEVICE_OBJECT *device, const DEVPROPKEY *property_key, LCID lcid,
ULONG flags, DEVPROPTYPE type, ULONG size, void *data )
{
SP_DEVINFO_DATA sp_device = {sizeof(sp_device)};
WCHAR device_instance_id[MAX_DEVICE_ID_LEN];
NTSTATUS status;
HDEVINFO set;
TRACE( "device %p, property_key %s, lcid %#x, flags %#x, type %#x, size %u, data %p.\n",
device, debugstr_propkey(property_key), lcid, flags, type, size, data );
/* flags is always treated as PLUGPLAY_PROPERTY_PERSISTENT starting with Win 8 / 2012 */
if (lcid != LOCALE_NEUTRAL) FIXME( "only LOCALE_NEUTRAL is supported\n" );
if ((status = get_device_instance_id( device, device_instance_id ))) return status;
if ((set = SetupDiCreateDeviceInfoList( &GUID_NULL, NULL )) == INVALID_HANDLE_VALUE)
{
ERR( "Failed to create device list, error %#x.\n", GetLastError() );
return GetLastError();
}
if (!SetupDiOpenDeviceInfoW( set, device_instance_id, NULL, 0, &sp_device ))
{
ERR( "Failed to open device, error %#x.\n", GetLastError() );
SetupDiDestroyDeviceInfoList( set );
return GetLastError();
}
if (!SetupDiSetDevicePropertyW( set, &sp_device, property_key, type, data, size, 0 ))
{
ERR( "Failed to set property, error %#x.\n", GetLastError() );
SetupDiDestroyDeviceInfoList( set );
return GetLastError();
}
SetupDiDestroyDeviceInfoList( set );
return STATUS_SUCCESS;
}
/***********************************************************************
* IoRegisterDeviceInterface (NTOSKRNL.EXE.@)
*/
NTSTATUS WINAPI IoRegisterDeviceInterface(DEVICE_OBJECT *device, const GUID *class_guid,
......
......@@ -21,6 +21,7 @@
#define _NTDDK_
#include <ntstatus.h>
#include <devpropdef.h>
#ifdef _WIN64
#define POINTER_ALIGNMENT DECLSPEC_ALIGN(8)
......@@ -1681,6 +1682,8 @@ void WINAPI ExReleaseResourceForThreadLite(ERESOURCE*,ERESOURCE_THREAD);
ULONG WINAPI ExSetTimerResolution(ULONG,BOOLEAN);
void WINAPI ExUnregisterCallback(void*);
#define PLUGPLAY_PROPERTY_PERSISTENT 0x0001
void WINAPI IoAcquireCancelSpinLock(KIRQL*);
NTSTATUS WINAPI IoAcquireRemoveLockEx(IO_REMOVE_LOCK*,void*,const char*,ULONG, ULONG);
NTSTATUS WINAPI IoAllocateDriverObjectExtension(PDRIVER_OBJECT,PVOID,ULONG,PVOID*);
......@@ -1728,6 +1731,7 @@ void WINAPI IoReleaseRemoveLockAndWaitEx(IO_REMOVE_LOCK*,void*,ULONG);
void WINAPI IoReleaseRemoveLockEx(IO_REMOVE_LOCK*,void*,ULONG);
void WINAPI IoReuseIrp(IRP*,NTSTATUS);
NTSTATUS WINAPI IoSetDeviceInterfaceState(UNICODE_STRING*,BOOLEAN);
NTSTATUS WINAPI IoSetDevicePropertyData(DEVICE_OBJECT*,const DEVPROPKEY*,LCID,ULONG,DEVPROPTYPE,ULONG,void*);
NTSTATUS WINAPI IoWMIRegistrationControl(PDEVICE_OBJECT,ULONG);
void FASTCALL KeAcquireInStackQueuedSpinLockAtDpcLevel(KSPIN_LOCK*,KLOCK_QUEUE_HANDLE*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment