1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef REGISTRY_HXX_INCLUDED 25 #define REGISTRY_HXX_INCLUDED 26 27 //----------------------------- 28 // registry helper functions 29 //----------------------------- 30 31 #if defined _MSC_VER 32 #pragma warning(push, 1) 33 #endif 34 #include <objbase.h> 35 #if defined _MSC_VER 36 #pragma warning(pop) 37 #endif 38 #include <string> 39 40 /** Sets a value of the specified registry key, an empty ValueName sets the default 41 value 42 Returns true on success 43 */ 44 bool SetRegistryKey(HKEY RootKey, const char* KeyName, const char* ValueName, const char* Value); 45 46 /** Deletes the specified registry key and all of its subkeys 47 Returns true on success 48 */ 49 bool DeleteRegistryKey(HKEY RootKey, const char* KeyName); 50 51 /** May be used to determine if the specified registry key has subkeys 52 The function returns true on success else if an error occurs false 53 */ 54 bool HasSubkeysRegistryKey(HKEY RootKey, const char* KeyName, bool& bResult); 55 56 /** Converts a GUID to its string representation 57 */ 58 std::string ClsidToString(const CLSID& clsid); 59 60 /** Get the content of a specific key. 61 */ 62 bool QueryRegistryKey(HKEY RootKey, const char* KeyName, const char* ValueName, char *pszData, DWORD dwBufLen); 63 64 65 #endif 66