/* * Enumerates a supplied registry key and returns a list of all the direct * sub-keys. * * TLVs: * * req: TLV_TYPE_HKEY - The HKEY that is to be enumerated */ DWORD request_registry_enum_key(Remote *remote, Packet *packet) { HKEY hkey = (HKEY)packet_get_tlv_value_qword(packet, TLV_TYPE_HKEY); enum_key(remote, packet, hkey); return ERROR_SUCCESS; }
/* * Enumerates a supplied registry key and returns a list of all the direct * sub-keys. * * TLVs: * * req: TLV_TYPE_ROOT_KEY - The root key * req: TLV_TYPE_BASE_KEY - The base key * opt: TLV_TYPE_PERMISSION - Permissions with which to open the key */ DWORD request_registry_enum_key_direct(Remote *remote, Packet *packet) { HKEY rootkey, hkey = NULL; open_key(packet, &rootkey, &hkey); enum_key(remote, packet, hkey); if (hkey) RegCloseKey(hkey); return ERROR_SUCCESS; }
HRESULT reg_enum_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out ) { VARIANT defkey, subkey, names, retval; IWbemClassObject *sig; HRESULT hr; TRACE("%p, %p\n", in, out); hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL ); if (hr != S_OK) return hr; hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL ); if (hr != S_OK) return hr; hr = create_signature( class_stdregprovW, method_enumkeyW, PARAM_OUT, &sig ); if (hr != S_OK) { VariantClear( &subkey ); return hr; } hr = IWbemClassObject_SpawnInstance( sig, 0, out ); if (hr != S_OK) { VariantClear( &subkey ); IWbemClassObject_Release( sig ); return hr; } VariantInit( &names ); hr = enum_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &names, &retval ); if (hr != S_OK) goto done; if (!V_UI4( &retval )) { hr = IWbemClassObject_Put( *out, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY ); if (hr != S_OK) goto done; } hr = IWbemClassObject_Put( *out, param_returnvalueW, 0, &retval, CIM_UINT32 ); done: VariantClear( &names ); VariantClear( &subkey ); IWbemClassObject_Release( sig ); if (hr != S_OK) IWbemClassObject_Release( *out ); return hr; }