please, see introducing post http://reboot.pro/to...er-2013-syntax/
public RegHeader(String filePath)
RegHeader level:
public void buildStorage()
public RegKey buildTree()
// this statement wraps the above two statements
// you can use it,when the root key is not needed
// in project scripts root key is usually not needed
public void open()
public void setAllowValOverwrite(boolean val)
public void setAutoCreateKey(boolean val)
public boolean hasError()
public HiveError getErrorCode()
public String getErrorText()
public static enum HiveError {
Success, NoKey, NoVal, KeyExists, ValExists, NoHive, HiveInUse, InvalidData, IOError, NoMulti, MultiExists, NoMultiType, OverWroteDiff
}
public boolean createKey(String parentKey, String newKey)
public boolean deleteKey(String keyPath)
public boolean existKey(String keyPath)
public RegKey readKey(String keyPath) {
public boolean fetchOpen(String otherHivePath)
public boolean fetchKey(String key, boolean allowKeyOverWrite)
public void fetchRelease()
public boolean importReg(String regName)
public void commit()
public void release()
RegKey level:
public boolean createValue(String keyPath, String valName, int type, Object value)
public boolean modifyValue(String keyPath, String valName, Object value)
public boolean deleteValue(String keyPath, String valName)
public boolean existVal(String keyPath, String valName)
public int getValueType(String keyPath, String valName)
public String getValueString(String keyPath, String valName)
public byte[] getValueRaw(String keyPath, String valName)
public boolean createValueRaw(String keyPath, String valName, int type, byte[] newBytes)
public boolean modifyValueRaw(String keyPath, String valName, byte[] newBytes)
public boolean modifyValueMulti(String keyPath, String valName, String value, int insertIndex)
public boolean regExport(String theExport)
public boolean regExport(File theExport)
Example:
String trgString = "V:\\WB Test\\run\\output\\wim-boot\\Windows\\system32\\config\\default";
RegHeader defaultHive = new RegHeader(trgString);
if (defaultHive.getErrorCode() != RegHeader.HiveError.Success) {
System.out.println(defaultHive.getErrorText());
} else {
defaultHive.open();
defaultHive.setAutoCreateKey(true);
defaultHive.setAllowValOverwrite(true);
if (!defaultHive.existKey("Software\\Dino\\ValueTypes")) {
result = defaultHive.createKey("Software\\Dino", "ValueTypes");
if (!result) {
System.out.println(defaultHive.getErrorText());
}
}
File fetch = new File(sourceHivesDir, "DEFAULT");
String fetchString = fetch.getAbsolutePath();
defaultHive.fetchOpen(fetchString);
defaultHive.fetchKey("Control Panel\\International", true);
defaultHive.fetchRelease();
defaultHive.commit();
defaultHive.release();
}
A more detailed example can be found in the Win7PE project, StartupCode plugin, plugin_wim.bsh script.