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 // RegistryException.cpp: Implementierung der Klasse RegistryException. 23 // 24 ////////////////////////////////////////////////////////////////////// 25 26 #include "registryexception.hxx" 27 28 #ifdef _MSC_VER 29 #pragma warning(push, 1) /* disable warnings within system headers */ 30 #endif 31 #include <windows.h> 32 #ifdef _MSC_VER 33 #pragma warning(pop) 34 #endif 35 36 ////////////////////////////////////////////////////////////////////// 37 // Konstruktion/Destruktion 38 ////////////////////////////////////////////////////////////////////// 39 40 RegistryException::RegistryException(long ErrorCode) : 41 m_ErrorCode(ErrorCode), 42 m_ErrorMsg(0) 43 { 44 } 45 46 /** 47 */ 48 RegistryException::~RegistryException() throw() 49 { 50 if (m_ErrorMsg) 51 LocalFree(m_ErrorMsg); 52 } 53 54 /** 55 */ 56 const char* RegistryException::what() const throw() 57 { 58 FormatMessage( 59 FORMAT_MESSAGE_ALLOCATE_BUFFER | 60 FORMAT_MESSAGE_FROM_SYSTEM | 61 FORMAT_MESSAGE_IGNORE_INSERTS, 62 NULL, 63 m_ErrorCode, 64 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language 65 (LPTSTR) &m_ErrorMsg, 66 0, 67 NULL); 68 69 return reinterpret_cast<char*>(m_ErrorMsg); 70 } 71 72 /** 73 */ 74 long RegistryException::GetErrorCode() const 75 { 76 return m_ErrorCode; 77 } 78 79 //####################################### 80 // Thrown when a Registry key is accessed 81 // that is closed 82 //####################################### 83 84 RegistryIOException::RegistryIOException(long ErrorCode) : 85 RegistryException(ErrorCode) 86 { 87 }; 88 89 //####################################### 90 // 91 //####################################### 92 93 RegistryNoWriteAccessException::RegistryNoWriteAccessException(long ErrorCode) : 94 RegistryException(ErrorCode) 95 { 96 }; 97 98 //####################################### 99 // 100 //####################################### 101 102 RegistryAccessDeniedException::RegistryAccessDeniedException(long ErrorCode) : 103 RegistryException(ErrorCode) 104 { 105 }; 106 107 //####################################### 108 // 109 //####################################### 110 111 RegistryValueNotFoundException::RegistryValueNotFoundException(long ErrorCode) : 112 RegistryException(ErrorCode) 113 { 114 }; 115 116 //####################################### 117 // 118 //####################################### 119 120 RegistryKeyNotFoundException::RegistryKeyNotFoundException(long ErrorCode) : 121 RegistryException(ErrorCode) 122 { 123 }; 124 125 //####################################### 126 // 127 //####################################### 128 129 RegistryInvalidOperationException::RegistryInvalidOperationException(long ErrorCode) : 130 RegistryException(ErrorCode) 131 { 132 }; 133