Implement CM_Delete_Class_Key[_Ex].
Modified: trunk/reactos/include/idl/pnp.idl
Modified: trunk/reactos/include/wine/cfgmgr32.h
Modified: trunk/reactos/lib/setupapi/cfgmgr.c
Modified: trunk/reactos/lib/setupapi/setupapi.spec
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.xml
Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h
_____
Modified: trunk/reactos/include/idl/pnp.idl
--- trunk/reactos/include/idl/pnp.idl 2005-09-10 10:31:22 UTC (rev
17772)
+++ trunk/reactos/include/idl/pnp.idl 2005-09-10 13:02:02 UTC (rev
17773)
@@ -75,6 +75,10 @@
[in, out] unsigned long *Length,
[in] unsigned long Flags);
+ CONFIGRET PNP_DeleteClassKey(handle_t BindingHandle,
+ [in, string] wchar_t *ClassGuid,
+ [in] unsigned long Flags);
+
CONFIGRET PNP_GetDeviceStatus(handle_t BindingHandle,
[in, string] wchar_t *DeviceInstance,
[out] unsigned long *Status,
_____
Modified: trunk/reactos/include/wine/cfgmgr32.h
--- trunk/reactos/include/wine/cfgmgr32.h 2005-09-10 10:31:22 UTC
(rev 17772)
+++ trunk/reactos/include/wine/cfgmgr32.h 2005-09-10 13:02:02 UTC
(rev 17773)
@@ -123,11 +123,17 @@
#define CM_DRP_MIN 0x00000001
#define CM_DRP_MAX 0x00000017
+/* ulFlags for CM_Delete_Class_Key[_Ex] */
+#define CM_DELETE_CLASS_ONLY 0x00000000
+#define CM_DELETE_CLASS_SUBKEYS 0x00000001
+#define CM_DELETE_CLASS_BITS 0x00000001
CONFIGRET WINAPI CM_Connect_MachineA( PCSTR, PHMACHINE );
CONFIGRET WINAPI CM_Connect_MachineW( PCWSTR, PHMACHINE );
#define CM_Connect_Machine WINELIB_NAME_AW(CM_Connect_Machine)
+CONFIGRET WINAPI CM_Delete_Class_Key( LPGUID, ULONG );
+CONFIGRET WINAPI CM_Delete_Class_Key_Ex( LPGUID, ULONG, HANDLE );
CONFIGRET WINAPI CM_Disconnect_Machine( HMACHINE );
CONFIGRET WINAPI CM_Enumerate_Classes( ULONG, LPGUID, ULONG );
CONFIGRET WINAPI CM_Enumerate_Classes_Ex( ULONG, LPGUID, ULONG,
HMACHINE );
@@ -140,7 +146,7 @@
CONFIGRET WINAPI CM_Get_Class_Key_Name_ExW( LPGUID, LPWSTR, PULONG,
ULONG, HMACHINE );
#define CM_Get_Class_Key_Name_Ex
WINELIB_NAME_AW(CM_Get_Class_Key_Name_Ex)
CONFIGRET WINAPI CM_Get_Class_NameA( LPGUID, PCHAR, PULONG, ULONG );
-CONFIGRET WINAPI CM_Get_Class_NameW( LPGUID, PWCHAR, PULONG, ULONG);
+CONFIGRET WINAPI CM_Get_Class_NameW( LPGUID, PWCHAR, PULONG, ULONG );
#define CM_Get_Class_Name WINELIB_NAME_AW(CM_Get_Class_Name)
CONFIGRET WINAPI CM_Get_Class_Name_ExA( LPGUID, PCHAR, PULONG, ULONG,
HMACHINE );
CONFIGRET WINAPI CM_Get_Class_Name_ExW( LPGUID, PWCHAR, PULONG, ULONG,
HMACHINE );
_____
Modified: trunk/reactos/lib/setupapi/cfgmgr.c
--- trunk/reactos/lib/setupapi/cfgmgr.c 2005-09-10 10:31:22 UTC (rev
17772)
+++ trunk/reactos/lib/setupapi/cfgmgr.c 2005-09-10 13:02:02 UTC (rev
17773)
@@ -62,6 +62,25 @@
} MACHINE_INFO, *PMACHINE_INFO;
+static BOOL GuidToString(LPGUID Guid, LPWSTR String)
+{
+ LPWSTR lpString;
+
+ if (UuidToStringW(Guid, &lpString) != RPC_S_OK)
+ return FALSE;
+
+ lstrcpyW(&String[1], lpString);
+
+ String[0] = L'{';
+ String[MAX_GUID_STRING_LEN - 2] = L'}';
+ String[MAX_GUID_STRING_LEN - 1] = 0;
+
+ RpcStringFree(&lpString);
+
+ return TRUE;
+}
+
+
/***********************************************************************
* CM_Connect_MachineA [SETUPAPI.@]
*/
@@ -124,6 +143,54 @@
/***********************************************************************
+ * CM_Delete_Class_Key [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Delete_Class_Key(LPGUID ClassGuid, ULONG ulFlags)
+{
+ TRACE("%p %lx\n", ClassGuid, ulFlags);
+ return CM_Delete_Class_Key_Ex(ClassGuid, ulFlags, NULL);
+}
+
+
+/**********************************************************************
*
+ * CM_Delete_Class_Key_Ex [SETUPAPI.@]
+ */
+CONFIGRET WINAPI CM_Delete_Class_Key_Ex(
+ LPGUID ClassGuid, ULONG ulFlags, HANDLE hMachine)
+{
+ WCHAR szGuidString[MAX_GUID_STRING_LEN];
+ RPC_BINDING_HANDLE BindingHandle = NULL;
+
+ TRACE("%p %lx %lx\n", ClassGuid, ulFlags, hMachine);
+
+ if (ClassGuid == NULL)
+ return CR_INVALID_POINTER;
+
+ if (ulFlags & ~CM_DELETE_CLASS_BITS)
+ return CR_INVALID_FLAG;
+
+ if (!GuidToString(ClassGuid, szGuidString))
+ return CR_INVALID_DATA;
+
+ if (hMachine != NULL)
+ {
+ BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle;
+ if (BindingHandle == NULL)
+ return CR_FAILURE;
+ }
+ else
+ {
+ if (!PnpGetLocalHandles(&BindingHandle, NULL))
+ return CR_FAILURE;
+ }
+
+ return PNP_DeleteClassKey(BindingHandle,
+ szGuidString,
+ ulFlags);
+}
+
+
+/**********************************************************************
*
* CM_Disconnect_Machine [SETUPAPI.@]
*/
CONFIGRET WINAPI CM_Disconnect_Machine(HMACHINE hMachine)
@@ -393,25 +460,6 @@
}
-static BOOL GuidToString(LPGUID Guid, LPWSTR String)
-{
- LPWSTR lpString;
-
- if (UuidToStringW(Guid, &lpString) != RPC_S_OK)
- return FALSE;
-
- lstrcpyW(&String[1], lpString);
-
- String[0] = L'{';
- String[MAX_GUID_STRING_LEN - 2] = L'}';
- String[MAX_GUID_STRING_LEN - 1] = 0;
-
- RpcStringFree(&lpString);
-
- return TRUE;
-}
-
-
/***********************************************************************
* CM_Get_Class_Key_Name_ExW [SETUPAPI.@]
*/
_____
Modified: trunk/reactos/lib/setupapi/setupapi.spec
--- trunk/reactos/lib/setupapi/setupapi.spec 2005-09-10 10:31:22 UTC
(rev 17772)
+++ trunk/reactos/lib/setupapi/setupapi.spec 2005-09-10 13:02:02 UTC
(rev 17773)
@@ -25,8 +25,8 @@
@ stub CM_Create_DevNode_ExA
@ stub CM_Create_DevNode_ExW
@ stub CM_Create_Range_List
-@ stub CM_Delete_Class_Key
-@ stub CM_Delete_Class_Key_Ex
+@ stdcall CM_Delete_Class_Key(ptr long)
+@ stdcall CM_Delete_Class_Key_Ex(ptr long long)
@ stub CM_Delete_DevNode_Key
@ stub CM_Delete_DevNode_Key_Ex
@ stub CM_Delete_Range
_____
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c
--- trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-09-10 10:31:22 UTC
(rev 17772)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-09-10 13:02:02 UTC
(rev 17773)
@@ -636,9 +636,9 @@
CONFIGRET
PNP_GetClassName(handle_t BindingHandle,
- wchar_t *ClassGuid, /* in */
- wchar_t *Buffer, /* out */
- unsigned long *Length, /* in out */
+ wchar_t *ClassGuid,
+ wchar_t *Buffer,
+ unsigned long *Length,
unsigned long Flags)
{
WCHAR szKeyName[MAX_PATH];
@@ -646,7 +646,7 @@
HKEY hKey = NULL;
ULONG ulSize;
- DPRINT1("PNP_GetClassName() called\n");
+ DPRINT("PNP_GetClassName() called\n");
lstrcpyW(szKeyName, L"System\\CurrentControlSet\\Control\\Class");
lstrcatW(szKeyName, L"\\");
@@ -677,13 +677,39 @@
RegCloseKey(hKey);
- DPRINT1("PNP_GetClassName() done (returns %lx)\n", ret);
+ DPRINT("PNP_GetClassName() done (returns %lx)\n", ret);
return ret;
}
CONFIGRET
+PNP_DeleteClassKey(handle_t BindingHandle,
+ wchar_t *ClassGuid,
+ unsigned long Flags)
+{
+ CONFIGRET ret = CR_SUCCESS;
+
+ DPRINT("PNP_GetClassName(%S, %lx) called\n", ClassGuid, Flags);
+
+ if (Flags & CM_DELETE_CLASS_SUBKEYS)
+ {
+ if (RegDeleteTreeW(hClassKey, ClassGuid) != ERROR_SUCCESS)
+ ret = CR_REGISTRY_ERROR;
+ }
+ else
+ {
+ if (RegDeleteKeyW(hClassKey, ClassGuid) != ERROR_SUCCESS)
+ ret = CR_REGISTRY_ERROR;
+ }
+
+ DPRINT("PNP_DeleteClassKey() done (returns %lx)\n", ret);
+
+ return ret;
+}
+
+
+CONFIGRET
PNP_GetDeviceStatus(handle_t BindingHandle,
wchar_t *DeviceInstance,
unsigned long *pStatus,
_____
Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.xml
--- trunk/reactos/services/umpnpmgr/umpnpmgr.xml 2005-09-10
10:31:22 UTC (rev 17772)
+++ trunk/reactos/services/umpnpmgr/umpnpmgr.xml 2005-09-10
13:02:02 UTC (rev 17773)
@@ -3,6 +3,9 @@
<include base="pnp_server">.</include>
<include base="pnp_client">.</include>
<define name="__USE_W32API" />
+ <define name="WINVER">0x600</define>
+ <define name="_WIN32_IE">0x0500</define>
+ <define name="_WIN32_WINNT">0x0600</define>
<define name="UNICODE" />
<define name="_UNICODE" />
<library>pnp_server</library>
_____
Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h
--- trunk/reactos/w32api/include/ddk/cfgmgr32.h 2005-09-10 10:31:22 UTC
(rev 17772)
+++ trunk/reactos/w32api/include/ddk/cfgmgr32.h 2005-09-10 13:02:02 UTC
(rev 17773)
@@ -708,8 +708,27 @@
/* FIXME: Obsolete CM_Create_DevNode */
/* FIXME: Obsolete CM_Create_DevNodeEx */
/* FIXME: Obsolete CM_Create_Range_List */
-/* FIXME: Obsolete CM_Delete_Class_Key */
-/* FIXME: Obsolete CM_Delete_Class_Key_Ex */
+
+/* Flags for CM_Delete_Class_Key.ulFlags constants */
+#define CM_DELETE_CLASS_ONLY 0x00000000
+#define CM_DELETE_CLASS_SUBKEYS 0x00000001
+#define CM_DELETE_CLASS_BITS 0x00000001
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Delete_Class_Key(
+ IN LPGUID ClassGuid,
+ IN ULONG ulFlags);
+
+CMAPI
+CONFIGRET
+WINAPI
+CM_Delete_Class_Key_Ex(
+ IN LPGUID ClassGuid,
+ IN ULONG ulFlags,
+ IN HANDLE hMachine);
+
/* FIXME: Obsolete CM_Delete_DevNode_Key */
/* FIXME: Obsolete CM_Delete_DevNode_Key_Ex */
/* FIXME: Obsolete CM_Delete_Range */