73{
75
80
83 {
85 }
87 {
89 goto CheckDirArgument;
90 }
91
93 {
94CheckDirArgument:
95 blnBadParameter =
FALSE;
98 {
100 blnDo = pszKey !=
NULL;
101 }
102 else if (!pszKey)
103 {
104 pszKey = pszParameter;
106 }
107 else
108 {
109 blnBadParameter =
TRUE;
110 }
111 if (blnBadParameter)
112 {
113 rConsole.
Write(
_T(
"Bad parameter: "));
114 rConsole.
Write(pszParameter);
116 }
117 }
118
120 const TCHAR *pszPath =
_T(
".");
121
122 if (pszKey)
123 {
124 pszPath = pszKey;
125
129
132
133 if (*
pch !=
_T(
'\\'))
134 {
135 while ((
pch > pszKey) && (*
pch !=
_T(
'\\')))
137
138 if (*
pch ==
_T(
'\\'))
139 {
141
143 {
146 }
147 else if (*
pch ==
_T(
'\\'))
148 {
150 }
151 }
152 else
153 {
154 pszPattern = pszKey;
156 }
157 }
158 }
159
161
163 {
165 rConsole.
Write(pszErrorMsg);
167 }
168
169 if (blnHelp)
170 {
172 }
173
175
176 if (!blnDo)
177 return 0;
178
179 rConsole.
Write(
_T(
"\n Key is "));
181
183 {
184 rConsole.
Write(
_T(
"\n Last modify time is "));
185 rConsole.
Write(
Key.GetLastWriteTime());
186 }
187
189 unsigned __int64 nTotalItems = 0;
190
191 try
192 {
194 rConsole.
Write(
_T(
"\t(KEY)\t\t\t\t..\\\n"));
195 nTotalItems = 1;
196
197 DWORD dwMaxSubkeyNameLength;
198 nError =
Key.GetSubkeyNameMaxLength(dwMaxSubkeyNameLength);
200 throw nError;
201
202 TCHAR *pszSubkeyNameBuffer =
new (std::nothrow)
TCHAR[dwMaxSubkeyNameLength];
203 if (!pszSubkeyNameBuffer)
205
206 Key.InitSubkeyEnumeration(pszSubkeyNameBuffer,dwMaxSubkeyNameLength);
208 {
210 {
211 rConsole.
Write(
_T(
"\t(KEY)\t\t\t\t"));
212 rConsole.
Write(pszSubkeyNameBuffer);
214 nTotalItems++;
215 }
216 }
217
218 delete[] pszSubkeyNameBuffer;
219
221 throw nError;
222
223 DWORD dwMaxValueNameBufferSize;
224 nError =
Key.GetMaxValueNameLength(dwMaxValueNameBufferSize);
226 throw nError;
227
228 TCHAR *pchValueNameBuffer =
new (std::nothrow)
TCHAR[dwMaxValueNameBufferSize];
229 if (!pchValueNameBuffer)
231
232
234 Key.InitValueEnumeration(pchValueNameBuffer,
235 dwMaxValueNameBufferSize,
237 0,
239
240 DWORD dwValueNameActualLength;
241 const TCHAR *pszValueTypeName;
243 unsigned int nTabs;
244 while((nError =
Key.GetNextValue(&dwValueNameActualLength)) ==
ERROR_SUCCESS)
245 {
247 {
250 nTabs =
_tcslen(pszValueTypeName)/nTabSize;
251 nTabs = (nTabs < 4)?(4-nTabs):1;
252 rConsole.
Write(pszValueTypeName);
253 while(nTabs--)
255 rConsole.
Write((dwValueNameActualLength == 0)?
_T(
"(Default)"):pchValueNameBuffer);
257 nTotalItems++;
258 }
259 }
260
261 delete[] pchValueNameBuffer;
262
264 throw nError;
265
266 }
268 {
273 }
274
275 rConsole.
Write(
_T(
"\n Total: "));
278 rConsole.
Write(
_T(
" item(s) listed.\n"));
279
280 return 0;
281}
BOOL PatternMatch(const TCHAR *pszPattern, const TCHAR *pszTry)
#define PATTERN_MATCH_ALL
void ResetArgumentIteration()
TCHAR * GetNextArgument()
unsigned int GetTabWidth()
BOOL Write(const TCHAR *p, DWORD dwChars=0)
static const TCHAR * GetValueTypeName(DWORD dwType)
BOOL GetKey(const TCHAR *pchRelativePath, REGSAM DesiredAccess, CRegistryKey &rKey)
const TCHAR * GetLastErrorDescription()
virtual const TCHAR * GetHelpString()
#define ERROR_NO_MORE_ITEMS
_CRTIMP char *__cdecl _itoa(_In_ int _Value, _Pre_notnull_ _Post_z_ char *_Dest, _In_ int _Radix)
#define KEY_ENUMERATE_SUB_KEYS