Quantcast
Viewing all articles
Browse latest Browse all 1056

WinBuilder 2013 registry functions syntax

please, see introducing post http://reboot.pro/topic/18685-winbuilder-2013-syntax/

 

public RegHeader(String filePath)

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 HiveError getErrorCode()

public String getErrorText()

public boolean createKey(String parentKey, String newKey)
public boolean renameKey(String keyPath, String newName)
public boolean deleteKey(String keyPath)
public boolean existKey(String keyPath)

public boolean createValue(String keyPath, String valName, int type, Object value)
public boolean modifyValue(String keyPath, String valName, Object value)
public boolean renameValue(String keyPath, String valName, String newValName)
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 void commit()

 

public static enum HiveError {

        Success, NoKey, NoVal, KeyExists, ValExists, NoHive, HiveInUse, InvalidData, IOError, NoMulti, MultiExists, NoMultiType, OverWroteDiff
}

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());

        }
    }
    defaultHive.commit();

}

A more detailed example can be found in the Win7PE project, StartupCode plugin, plugin_wim.bsh script.


Viewing all articles
Browse latest Browse all 1056

Trending Articles