Read registry keys recursively

TheDGuy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 29 08:48:49 PDT 2016


Hello,
i am wondering what is wrong with my code:

import std.windows.registry;
import std.stdio;

void main(){
     Key lclM = Registry.localMachine();
     Key hrdw = lclM.getKey("HARDWARE");
     writeRegistryKeys(hrdw);
}

void writeRegistryKeys(Key k){
     foreach(Key key; k.keys){
         writeRegistryKeys(key.getKey(key.name()));
     }
     writeln(k.name());
}

i get: 
std.windows.registry.RegistryException at std\windows\registry.d(511): Failed to open requested key: "ACPI"

Even though there is a key called 'ACPI' under 
localmachine/hardware?


More information about the Digitalmars-d-learn mailing list