From 8bb7ed968db64e9b12a6447e2eec3586ef9e935c Mon Sep 17 00:00:00 2001 From: Dirk Date: Tue, 10 Jun 2014 14:19:40 +0200 Subject: Windows system name changer during bootup. --- windows/bootpgm/win32/RegistryBrowser.cpp | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 windows/bootpgm/win32/RegistryBrowser.cpp (limited to 'windows/bootpgm/win32/RegistryBrowser.cpp') 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 []\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; +} -- cgit v1.2.3-55-g7522