Implement CM_Delete_Class_Key[_Ex].

svn path=/trunk/; revision=17773
This commit is contained in:
Eric Kohl 2005-09-10 13:02:02 +00:00
parent 7ad59b629a
commit 71dc00530f
7 changed files with 135 additions and 29 deletions

View file

@ -75,6 +75,10 @@ interface pnp
[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,

View file

@ -123,11 +123,17 @@ DECL_WINELIB_CFGMGR32_TYPE_AW(DEVINSTID)
#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_ExA( LPGUID, LPSTR, PULONG, ULONG, HMACHI
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 );

View file

@ -62,6 +62,25 @@ typedef struct _MACHINE_INFO
} 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.@]
*/
@ -123,6 +142,54 @@ CONFIGRET WINAPI CM_Connect_MachineW(PCWSTR UNCServerName, PHMACHINE phMachine)
}
/***********************************************************************
* 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.@]
*/
@ -393,25 +460,6 @@ CONFIGRET WINAPI CM_Get_Class_Key_Name_ExA(
}
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.@]
*/

View file

@ -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

View file

@ -636,9 +636,9 @@ PNP_GetDeviceRegProp(handle_t BindingHandle,
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 @@ PNP_GetClassName(handle_t BindingHandle,
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,7 +677,33 @@ PNP_GetClassName(handle_t BindingHandle,
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;
}

View file

@ -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>

View file

@ -708,8 +708,27 @@ CM_Connect_MachineW(
/* 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 */