mirror of
				https://github.com/gnh1201/welsonjs.git
				synced 2025-10-31 04:51:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| var SHELL = require("lib/shell");
 | |
| 
 | |
| var SandboxieObject = function() {
 | |
|     this.binPath = "%PROGRAMFILES%\\Sandboxie-Plus\\Start.exe";
 | |
|     this.processID = 0;
 | |
|     this.sandboxName = "";
 | |
|     
 | |
|     this.setSandboxName = function(name) {
 | |
|         this.sandboxName = name;
 | |
|         return this;
 | |
|     };
 | |
| 
 | |
|     this.start = function(cmd) {
 | |
|         var process;
 | |
|         while (this.processID == 0) {
 | |
|             try {
 | |
|                 process = SHELL.createProcess([
 | |
|                     this.binPath,
 | |
|                     "/box:" + this.sandboxName,
 | |
|                     SHELL.build(cmd)
 | |
|                 ].join(' '));
 | |
|                 this.processID = process.ProcessID;
 | |
|             } catch (e) {
 | |
|                 console.error(e.message);
 | |
|             }
 | |
|         }
 | |
|         return this;
 | |
|     };
 | |
| };
 | |
| 
 | |
| exports.start = function(sandboxName, cmd) {
 | |
|     return (new SandboxieObject()).setSandboxName(sandboxName).start(cmd).processID;
 | |
| };
 | |
| 
 | |
| exports.VERSIONINFO = "Sandboxie interface (sandboxie.js) version 0.1";
 | |
| exports.global = global;
 | |
| exports.require = global.require;
 |