OSDN Git Service

windows/registory.hpp: 10102x_registory\7.2
authorMyun2 <myun2@nwhite.info>
Sun, 20 Mar 2011 09:41:34 +0000 (18:41 +0900)
committerMyun2 <myun2@nwhite.info>
Sun, 20 Mar 2011 09:41:34 +0000 (18:41 +0900)
roast_ex/include/roast/windows/registory.hpp

index a790414..0e51037 100644 (file)
@@ -27,11 +27,18 @@ namespace roast
                {
                        /////////////////////////////////////////////
 
-                       class reg_exception : public windows_exception
+                       class exception : public windows_exception
                        {
                        public:
-                               reg_exception(const char* s) : windows_exception(s) {}
-                               reg_exception(const ::std::string& s) : windows_exception(s) {}
+                               exception(const char* s) : windows_exception(s) {}
+                               exception(const ::std::string& s) : windows_exception(s) {}
+                       };
+
+                       class api_exception : public registory::exception
+                       {
+                       public:
+                               api_exception(const char* s) : registory::exception(s) {}
+                               api_exception(const ::std::string& s) : registory::exception(s) {}
                        };
 
                        /////
@@ -79,6 +86,15 @@ namespace roast
                                ::std::string m_nowKey;
                                bool m_mode_write;
 
+                               //      Query Infos
+                               DWORD m_dwSubKeyCount;
+                               DWORD m_dwValuesCount;
+                               DWORD m_dwMaxSubKeyLen;
+                               DWORD m_dwMaxValueNameLen;
+                               DWORD m_dwMaxValueLen;
+
+                               /////////////////////////////////////////////
+
                                bool _get_any_value(const char* szValueName, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
                                {
                                        ZeroMemory( lpData, *lpcbData );
@@ -96,6 +112,29 @@ namespace roast
                                                return false;
                                        }
                                }
+
+                               //      \83L\81[\82É\8aÖ\82·\82é\8ae\8eí\8fî\95ñ\82ð\8eæ\93¾\82µ\82Ä\82¨\82­
+                               void _update_key_infos()
+                               {
+                                       //      \8fî\95ñ\82ð\8eæ\93¾\82·\82é
+                                       LONG r = ::RegQueryInfoKey(
+                                               m_hKey,                         //      hKey                                    - \96â\82¢\8d\87\82í\82¹\82é\82×\82«\83L\81[\82Ì\83n\83\93\83h\83\8b
+                                               NULL,                           //      lpClass                                 - \83N\83\89\83X\95\8e\9a\97ñ\82ð\8ai\94[\82·\82é\83o\83b\83t\83@
+                                               NULL,                           //      lpcClass                                - \83N\83\89\83X\95\8e\9a\97ñ\83o\83b\83t\83@\82Ì\83T\83C\83Y
+                                               NULL,                           //      lpReserved                              - \97\\96ñ\8dÏ\82Ý
+                                               &m_dwSubKeyCount,       //      lpcSubKeys                              - \83T\83u\83L\81[\82Ì\90\94
+                                               &m_dwMaxSubKeyLen,      //      lpcMaxSubKeyLen                 - \83T\83u\83L\81[\96¼\82Ì\8dÅ\92·\82Ì\92·\82³
+                                               NULL,                           //      lpcMaxClassLen                  - \83N\83\89\83X\95\8e\9a\97ñ\82Ì\8dÅ\92·\82Ì\92·\82³
+                                               &m_dwValuesCount,       //      lpcValues                               - \83\8c\83W\83X\83g\83\8a\83G\83\93\83g\83\8a\82Ì\90\94
+                                               &m_dwMaxValueNameLen,// lpcMaxValueNameLen              - \83\8c\83W\83X\83g\83\8a\83G\83\93\83g\83\8a\96¼\82Ì\8dÅ\92·\82Ì\92·\82³
+                                               &m_dwMaxValueLen,       //      lpcMaxValueLen                  - \83\8c\83W\83X\83g\83\8a\83G\83\93\83g\83\8a\82Ì\83f\81[\83^\82Ì\8dÅ\92·\82Ì\92·\82³
+                                               NULL,                           //      lpcbSecurityDescriptor  - \83Z\83L\83\85\83\8a\83e\83B\8bL\8fq\8eq\82Ì\92·\82³
+                                               NULL                            //      lpftLastWriteTime               - \8dÅ\8cã\82Ì\8f\91\82«\8d\9e\82Ý\8e\9e\8d\8f
+                                       );
+
+                                       if ( r != ERROR_SUCCESS )
+                                               api_exception("::RegQueryInfoKey() Failed.");
+                               }
                        public:
                                key(const key& parent, const char* szSubKey){}
                                key(const key& parent, const char* szSubKey, bool mode_write){}
@@ -221,6 +260,7 @@ namespace roast
                        /////////////////////////////////////////////
                }
 
+               typedef registory::exception reg_exception;
                typedef registory::key reg_key, regkey;
        }
 }