1 /*++ 2 3 Copyright (c) Microsoft Corporation 4 5 Module Name: 6 7 FxAutoRegistry.hpp 8 9 Abstract: 10 11 This is the C++ header for registry related objects which follows the RAII 12 (resource acquisition is initialization) pattern where 13 it frees the allocated item when the struct goes out of scope. 14 15 Author: 16 17 18 19 Revision History: 20 21 22 23 24 --*/ 25 #ifndef _FXAUTOREGISTRY_H_ 26 #define _FXAUTOREGISTRY_H_ 27 28 struct FxAutoRegKey { 29 public: 30 FxAutoRegKey() 31 { 32 m_Key = NULL; 33 } 34 35 ~FxAutoRegKey() 36 { 37 if (m_Key != NULL) { 38 FxRegKey::_Close(m_Key); 39 } 40 } 41 42 public: 43 HANDLE m_Key; 44 }; 45 46 #endif // _FXAUTOREGISTRY_H_ 47