To read registry i have running code. but it wont work on restricted environment. following is the code.
private ArrayList<String> getVirtualPrinterlist(){
ArrayList<String> VirtualPrinterlist = new ArrayList<String>();
try{
String [] keys = Advapi32Util.registryGetKeys (HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" );
for (String key : keys) {
System.out.print(key+" # ");
String ipString=Advapi32Util.registryGetStringValue (HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers\\"+key, "Port");
System.out.println(ipString) );
VirtualPrinterlist.add(key);
}
}catch (Exception e) {
e.printStackTrace();
}
return VirtualPrinterlist;
}