d13395893c3188f4c86e02a6caf662b5f8d69f8d
7 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 //#define dprintf _tprintf
32 #define dprintf printf
34 #define dprintf printf
37 void RegKeyPrint(int which
);
41 const char* default_cmd_line1
= "/E HKLM_EXPORT.TXT HKEY_LOCAL_MACHINE";
42 const char* default_cmd_line2
= "TEST_IMPORT.TXT";
43 const char* default_cmd_line3
= "/P HKEY_LOCAL_MACHINE\\SYSTEM";
44 const char* default_cmd_line4
= "/P HKEY_LOCAL_MACHINE\\SOFTWARE";
45 const char* default_cmd_line5
= "/P HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes";
46 const char* default_cmd_line6
= "/E HKCR_EXPORT.TXT HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes";
47 const char* default_cmd_line7
= "/D HKEY_LOCAL_MACHINE\\SYSTEM";
48 const char* default_cmd_line8
= "/D HKEY_LOCAL_MACHINE\\SOFTWARE";
49 const char* default_cmd_line9
= "/D HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes";
52 void usage(const char* appName
)
54 fprintf(stderr
, "%s: Dump registry key to console\n", appName
);
55 fprintf(stderr
, "%s HKCR | HKCU | HKLM | HKU | HKCC | HKRR\n", appName
);
60 _tprintf(_T("\nchoose test :\n"));
61 _tprintf(_T(" 0 = Exit\n"));
62 printf(" 1 = %s\n", default_cmd_line1
);
63 printf(" 2 = %s\n", default_cmd_line2
);
64 printf(" 3 = %s\n", default_cmd_line3
);
65 printf(" 4 = %s\n", default_cmd_line4
);
66 printf(" 5 = %s\n", default_cmd_line5
);
67 printf(" 6 = %s\n", default_cmd_line6
);
68 printf(" 7 = %s\n", default_cmd_line7
);
69 printf(" 8 = %s\n", default_cmd_line8
);
70 printf(" 9 = %s\n", default_cmd_line9
);
72 _tprintf(_T(" 1 = %s\n"), default_cmd_line1);
73 _tprintf(_T(" 2 = %s\n"), default_cmd_line2);
74 _tprintf(_T(" 3 = %s\n"), default_cmd_line3);
75 _tprintf(_T(" 4 = %s\n"), default_cmd_line4);
76 _tprintf(_T(" 5 = %s\n"), default_cmd_line5);
77 _tprintf(_T(" 6 = %s\n"), default_cmd_line6);
78 _tprintf(_T(" 7 = %s\n"), default_cmd_line7);
79 _tprintf(_T(" 8 = %s\n"), default_cmd_line8);
80 _tprintf(_T(" 9 = %s\n"), default_cmd_line9);
82 // _tprintf(_T(" A = HKEY_CLASSES_ROOT\n"));
83 // _tprintf(_T(" B = HKEY_CURRENT_USER\n"));
84 // _tprintf(_T(" C = HKEY_LOCAL_MACHINE\n"));
85 // _tprintf(_T(" D = HKEY_USERS\n"));
86 // _tprintf(_T(" E = HKEY_CURRENT_CONFIG\n"));
87 // _tprintf(_T(" F = REGISTRY ROOT\n"));
90 int regdump(int argc
, char* argv
[])
95 // if (0 == _tcsstr(argv[1], _T("HKLM"))) {
96 if (strstr(argv
[1], "help")) {
98 } else if (strstr(argv
[1], "HKCR")) {
100 } else if (strstr(argv
[1], "HKCU")) {
102 } else if (strstr(argv
[1], "HKLM")) {
104 } else if (strstr(argv
[1], "HKU")) {
106 } else if (strstr(argv
[1], "HKCC")) {
108 } else if (strstr(argv
[1], "HKRR")) {
111 dprintf("started with argc = %d, argv[1] = %s (unknown?)\n", argc
, argv
[1]);
117 GetInput(Buffer
, sizeof(Buffer
));
118 switch (toupper(Buffer
[0])) {
122 strcpy(Buffer
, default_cmd_line1
);
125 strcpy(Buffer
, default_cmd_line2
);
128 strcpy(Buffer
, default_cmd_line3
);
131 strcpy(Buffer
, default_cmd_line4
);
134 strcpy(Buffer
, default_cmd_line5
);
137 strcpy(Buffer
, default_cmd_line6
);
140 strcpy(Buffer
, default_cmd_line7
);
143 strcpy(Buffer
, default_cmd_line8
);
146 strcpy(Buffer
, default_cmd_line9
);
154 RegKeyPrint(toupper(Buffer
[0]) - 'A' + 1);
157 if (!ProcessCmdLine(Buffer
)) {
158 dprintf("invalid input.\n");