Public Member Functions | |
| RegistryKey (RegistryKey &right) | |
| Copy constructor, adopts ownership. | |
| RegistryKey (HKEY hkey, const char *subkey, REGSAM samDesired=KEY_QUERY_VALUE) | |
| Constructor, opens the key. | |
| ~RegistryKey () | |
| Destructor, closes the key. | |
| operator bool () const | |
| int | setValueStr (const char *name, const char *data) |
| char * | queryValueStr (const char *name, const int maxlen=2048) const |
Private Member Functions | |
| RegistryKey () | |
| No implementation. | |
| RegistryKey (HKEY hkey, bool open=true) | |
Private Attributes | |
| HKEY | _hkey |
| bool | _open |
Upon failure, it emits an error message and then quits. Why do I have to write this class myself??
Definition at line 86 of file daemon_windows.cc.
|
|
No implementation.
|
|
||||||||||||
|
Definition at line 92 of file daemon_windows.cc.
|
|
|
Copy constructor, adopts ownership.
Definition at line 103 of file daemon_windows.cc.
|
|
||||||||||||||||
|
Constructor, opens the key.
Definition at line 110 of file daemon_windows.cc. 00114 :_hkey(), _open(false) 00115 { 00116 long ret=::RegOpenKeyEx(hkey,subkey,0,samDesired,&_hkey); 00117 ::SetLastError(ret); 00118 if(ret==ERROR_SUCCESS) 00119 _open=true; 00120 }
|
|
|
Destructor, closes the key.
Definition at line 123 of file daemon_windows.cc. References _hkey, _open, and HERE. 00124 {
00125 // Windows - why use two lines, when seven will do??
00126 // RegCloseKey() does not set last error, so complexity ensues...
00127 if(_open)
00128 {
00129 long ret =::RegCloseKey(_hkey);
00130 ::SetLastError(ret);
00131 if(ret!=ERROR_SUCCESS)
00132 Win::perror("Warning at " HERE);
00133 }
00134 }
|
|
|
Definition at line 97 of file daemon_windows.cc. References _open. 00097 { return _open; }
|
|
||||||||||||
|
Definition at line 150 of file daemon_windows.cc. References _hkey. Referenced by Omniifr::Service::readParameters(). 00151 {
00152 char* result =NULL;
00153 char* buf =new char[maxlen];
00154 DWORD len =maxlen;
00155
00156 long ret=::RegQueryValueEx(_hkey,name,NULL,NULL,(LPBYTE)buf,&len);
00157 ::SetLastError(ret);
00158 if(ret==ERROR_SUCCESS && len<=maxlen)
00159 result=::strdup(buf); // MSVC6 has no strndup()!!
00160 delete[] buf;
00161 return result;
00162 }
|
|
||||||||||||
|
Definition at line 136 of file daemon_windows.cc. References _hkey. Referenced by Omniifr::Service::install(), and Omniifr::Service::writeParameters(). 00137 {
00138 long ret=::RegSetValueEx(
00139 _hkey,name,0,REG_SZ,
00140 (const BYTE*)(data),
00141 1+::strlen(data)
00142 );
00143 ::SetLastError(ret);
00144 if(ret==ERROR_SUCCESS)
00145 return 0;
00146 else
00147 return 1;
00148 }
|
|
|
Definition at line 88 of file daemon_windows.cc. Referenced by queryValueStr(), RegistryKey(), setValueStr(), and ~RegistryKey(). |
|
|
Definition at line 89 of file daemon_windows.cc. Referenced by operator bool(), RegistryKey(), and ~RegistryKey(). |
1.4.1