summaryrefslogtreecommitdiffstats
path: root/windows/bootpgm/win32/RegistryBrowser.cpp
diff options
context:
space:
mode:
authorDirk2014-06-10 14:19:40 +0200
committerDirk2014-06-10 14:19:40 +0200
commit8bb7ed968db64e9b12a6447e2eec3586ef9e935c (patch)
treecd038af0c4b67b2f9a029e4a203fcf102f42aa13 /windows/bootpgm/win32/RegistryBrowser.cpp
parentMinor cleanup. (diff)
downloadtm-scripts-8bb7ed968db64e9b12a6447e2eec3586ef9e935c.tar.gz
tm-scripts-8bb7ed968db64e9b12a6447e2eec3586ef9e935c.tar.xz
tm-scripts-8bb7ed968db64e9b12a6447e2eec3586ef9e935c.zip
Windows system name changer during bootup.
Diffstat (limited to 'windows/bootpgm/win32/RegistryBrowser.cpp')
-rw-r--r--windows/bootpgm/win32/RegistryBrowser.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/windows/bootpgm/win32/RegistryBrowser.cpp b/windows/bootpgm/win32/RegistryBrowser.cpp
new file mode 100644
index 00000000..9254f8e8
--- /dev/null
+++ b/windows/bootpgm/win32/RegistryBrowser.cpp
@@ -0,0 +1,71 @@
+#include "StdAfx.h"
+#include "RegistryBrowser.h"
+#include "io.h"
+#include "main.h"
+#include "handle.h"
+
+RegKey *RegistryBrowser::get_current_key()
+{
+ if (!current)
+ current = new RegKey(L"");
+
+ return current;
+}
+
+void RegistryBrowser::lk(IO &io,char *args)
+{
+ get_current_key()->print_subkeys(io);
+}
+void RegistryBrowser::lv(IO &io,char *args)
+{
+ get_current_key()->print_values(io);
+}
+
+void RegistryBrowser::tk(IO &io,char *args)
+{
+ char buffer[1000];
+ io.println(get_current_key()->get_name().chars(buffer,sizeof(buffer)));
+}
+
+void RegistryBrowser::ck(IO &io,char *args)
+{
+ if (*args==0)
+ {
+ if (current) delete current;
+ current = 0;
+ return;
+ }
+
+ UnicodeString name(&args[1]);
+ RegKey *key=get_current_key()->subkey(name);
+ if (key)
+ {
+ if (current) delete current;
+ current = key;
+ }
+ else
+ io.println("Key not found");
+}
+
+RegistryBrowser::RegistryBrowser(Main &main) : current(0)
+{
+ main.addCommand("lk",make_dg(this,&RegistryBrowser::lk)
+ ,"List subkeys"
+ ,"Usage: lk\nList all subkeys of the current key");
+ main.addCommand("lv",make_dg(this,&RegistryBrowser::lv)
+ ,"List values"
+ ,"Usage: lv\nList the names of all values of the current key with their types");
+ main.addCommand("ck",make_dg(this,&RegistryBrowser::ck)
+ ,"Change current registry key"
+ ,"Usage: ck [<subkey>]\nGo into the subkey if specified or else to the root of the registry");
+ main.addCommand("tk",make_dg(this,&RegistryBrowser::tk)
+ ,"Show information about current key"
+ ,"Usage: tk\nShow information about the current key (*t*his *k*ey)");
+}
+
+RegistryBrowser::~RegistryBrowser(void)
+{
+ if (current)
+ delete current;
+ current = 0;
+}