1*cdf0e10cSrcweir // RegistryException.cpp: Implementierung der Klasse RegistryException. 2*cdf0e10cSrcweir // 3*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 4*cdf0e10cSrcweir 5*cdf0e10cSrcweir #include "registryexception.hxx" 6*cdf0e10cSrcweir 7*cdf0e10cSrcweir #ifdef _MSC_VER 8*cdf0e10cSrcweir #pragma warning(push, 1) /* disable warnings within system headers */ 9*cdf0e10cSrcweir #endif 10*cdf0e10cSrcweir #include <windows.h> 11*cdf0e10cSrcweir #ifdef _MSC_VER 12*cdf0e10cSrcweir #pragma warning(pop) 13*cdf0e10cSrcweir #endif 14*cdf0e10cSrcweir 15*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 16*cdf0e10cSrcweir // Konstruktion/Destruktion 17*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 18*cdf0e10cSrcweir 19*cdf0e10cSrcweir RegistryException::RegistryException(long ErrorCode) : 20*cdf0e10cSrcweir m_ErrorCode(ErrorCode), 21*cdf0e10cSrcweir m_ErrorMsg(0) 22*cdf0e10cSrcweir { 23*cdf0e10cSrcweir } 24*cdf0e10cSrcweir 25*cdf0e10cSrcweir /** 26*cdf0e10cSrcweir */ 27*cdf0e10cSrcweir RegistryException::~RegistryException() throw() 28*cdf0e10cSrcweir { 29*cdf0e10cSrcweir if (m_ErrorMsg) 30*cdf0e10cSrcweir LocalFree(m_ErrorMsg); 31*cdf0e10cSrcweir } 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir /** 34*cdf0e10cSrcweir */ 35*cdf0e10cSrcweir const char* RegistryException::what() const throw() 36*cdf0e10cSrcweir { 37*cdf0e10cSrcweir FormatMessage( 38*cdf0e10cSrcweir FORMAT_MESSAGE_ALLOCATE_BUFFER | 39*cdf0e10cSrcweir FORMAT_MESSAGE_FROM_SYSTEM | 40*cdf0e10cSrcweir FORMAT_MESSAGE_IGNORE_INSERTS, 41*cdf0e10cSrcweir NULL, 42*cdf0e10cSrcweir m_ErrorCode, 43*cdf0e10cSrcweir MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language 44*cdf0e10cSrcweir (LPTSTR) &m_ErrorMsg, 45*cdf0e10cSrcweir 0, 46*cdf0e10cSrcweir NULL); 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir return reinterpret_cast<char*>(m_ErrorMsg); 49*cdf0e10cSrcweir } 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir /** 52*cdf0e10cSrcweir */ 53*cdf0e10cSrcweir long RegistryException::GetErrorCode() const 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir return m_ErrorCode; 56*cdf0e10cSrcweir } 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir //####################################### 59*cdf0e10cSrcweir // Thrown when a Registry key is accessed 60*cdf0e10cSrcweir // that is closed 61*cdf0e10cSrcweir //####################################### 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir RegistryIOException::RegistryIOException(long ErrorCode) : 64*cdf0e10cSrcweir RegistryException(ErrorCode) 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir }; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir //####################################### 69*cdf0e10cSrcweir // 70*cdf0e10cSrcweir //####################################### 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir RegistryNoWriteAccessException::RegistryNoWriteAccessException(long ErrorCode) : 73*cdf0e10cSrcweir RegistryException(ErrorCode) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir }; 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir //####################################### 78*cdf0e10cSrcweir // 79*cdf0e10cSrcweir //####################################### 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir RegistryAccessDeniedException::RegistryAccessDeniedException(long ErrorCode) : 82*cdf0e10cSrcweir RegistryException(ErrorCode) 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir }; 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir //####################################### 87*cdf0e10cSrcweir // 88*cdf0e10cSrcweir //####################################### 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir RegistryValueNotFoundException::RegistryValueNotFoundException(long ErrorCode) : 91*cdf0e10cSrcweir RegistryException(ErrorCode) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir }; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir //####################################### 96*cdf0e10cSrcweir // 97*cdf0e10cSrcweir //####################################### 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir RegistryKeyNotFoundException::RegistryKeyNotFoundException(long ErrorCode) : 100*cdf0e10cSrcweir RegistryException(ErrorCode) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir }; 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir //####################################### 105*cdf0e10cSrcweir // 106*cdf0e10cSrcweir //####################################### 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir RegistryInvalidOperationException::RegistryInvalidOperationException(long ErrorCode) : 109*cdf0e10cSrcweir RegistryException(ErrorCode) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir }; 112