/* WehnTrust Kernel Driver Control Script
 * http://wehntrust.com
 *
 * To Install, enable cscript mode 
 * then copy the file anywhere in your path:
 * C:\>cscript //H:CScript
 * C:\>copy trust.js %SYSTEMROOT%\system32\
 * 
 * Now you can just run the command "trust" from anywhere 
 * to disable/enable/check status of the WehnTrust kernel driver.
 * C:\>trust status
 * Driver is currently disabled
 * Driver is set to be loaded at "Demand" Level
 *
 * satebackire
 */

var prog = "WehnTrust"; 
var key = "HKLM\\SYSTEM\\CurrentControlSet\\Services\\baserand\\start";
var WshShell = WScript.CreateObject("WScript.Shell");
var args = WScript.Arguments;

if( args.length == 1 ){
    if( args(0) == "on" ){
    WshShell.RegWrite( key, 0, "REG_DWORD");
    WScript.Echo(prog + " has been ENABLED, you must reboot for changes to take effect!!!!");
    }else if( args(0) == "off" ){
    WshShell.RegWrite( key, 3, "REG_DWORD");
    WScript.Echo(prog + " has been DISABLED, you must reboot for changes to take effect!!!!");
    }else if( args(0) == "status"){
    var start = WshShell.RegRead( key );
    
    switch( start ){
        case 0: msg = "Boot";break;
        case 1: msg = "System";break;
        case 2: msg = "Auto";break;
        case 3: msg = "Demand";break;
        case 4: msg = "Disabled";break;
        default: msg = "Unknown";
    }
        var str = (start > 1) ? "disabled" : "enabled";
        WScript.Echo( prog + " is currently " + str );
    WScript.Echo( prog + " is set to be loaded at \"" + msg + "\" Level");
    }
}else if( args.length == 0 || args.length > 1){
    WScript.Echo("Usage: C:\>Trust [on|off|status]");
}else{ WScript.Echo("And australia was all...wtf mate"); }
