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