I'm taking on a new project -- "NSIS-izing" the batch files in this thread. It should be pretty interesting...
Unfortunately, I won't be able to fix this up entirely in NSIS, unless I can resolve the "REMOVE" issues I'm having (I tell it to delete a file, and I find the file is still there -- even after reboot!). It looks like I'll be using a bit of Registry Rapper and probably several different executables (unless I can fit it all into one somehow...). Wish me luck!
For my reference, and in case anyone wants to look, here's the code:
start.cmd
cmdow @ /hid SET sandboxdir=%~dp0 cd %sandboxdir% REG.exe HKLM\Software\tzuk\Sandboxie\Home=%sandboxdir% REG.exe UPDATE HKLM\Software\tzuk\Sandboxie\Home=%sandboxdir% regedit /s Sandboxie+.reg copy Sandboxie.ini %SystemRoot%\ sc.exe create Sandbox binpath= "%sandboxdir%Sandbox.sys" type= kernel start= auto error= normal DisplayName= Sandbox sc.exe start sandbox %sandboxdir%Start.exe notepad.exe
stop.cmd
cmdow @ /hid sc.exe stop Sandbox sc.exe delete Sandbox pskill.exe Control.exe pskill.exe SandboxieDcomLaunch.exe pskill.exe SandboxieRpcSs.exe rd /s /q "%APPDATA%\Sandbox" del %SystemRoot%\Sandboxie.ini REG.exe DELETE HKCU\Sandbox\ /FORCE REG.exe DELETE HKLM\SOFTWARE\tzuk /FORCE REG.exe DELETE HKCU\Software\tzuk /FORCE
sandboxie.ini
# Sandboxie Configuration File # Automatically generated whenever the configuration changes. # Set ConfigLevel to 99 to prevent the overwriting of this file. [GlobalSettings] ConfigLevel=1 BoxRootFolder=%AppData% CopyLimitKb=32768 [DefaultBox] Enabled=yes OpenFilePath=msimn.exe,%AppData%\Identities OpenFilePath=msimn.exe,%Local AppData%\Identities OpenKeyPath=msimn.exe,HKEY_CURRENT_USER\Identities OpenKeyPath=msimn.exe,HKEY_CURRENT_USER\Software\Microsoft\Outlook Express RecoverFolder=%Favorites% RecoverFolder=%Personal% RecoverFolder=%Desktop%
Sandboxie.reg
REGEDIT4 [HKEY_CURRENT_USER\Software\tzuk] [HKEY_CURRENT_USER\Software\tzuk\Sandboxie] [HKEY_CURRENT_USER\Software\tzuk\Sandboxie\Control] "Window_Top"=dword:0000000e "Window_Left"=dword:00000007 "Window_Bottom"=dword:0000016c "Window_Right"=dword:0000012e "Column 0 Width"=dword:00000097 "Column 1 Width"=dword:0000002f "Column 2 Width"=dword:00000050 "Show_All_Processes"=dword:00000000 "FirstRun"=dword:00000000 "Last_Version_Check"=hex:46,02,cc,30,d7,43,c6,01
There's also clean.cmd to clean out the sandbox:
cmdow @ /hid rd /s /q "%APPDATA%\Sandbox"
Comments
I wish you Good Luck Im
I wish you Good Luck
Im looking this with great interest.
Sand
This Line in start.cmd
REG HKLM\Software\tzuk\Sandboxie\Home=%sandboxdir%
Should Be
REG ADD HKLM\Software\tzuk\Sandboxie\Home=%sandboxdir%
Sorry, my mistake.
I´´m happy to see some people interested in this.
Looking forward to this. I
Looking forward to this. I tried to do it in vbs but quickly got in over my head (got to find a decent tutorial on this stuff...).
Tappet
__________________
"I am still learning."
--Socrates
vbs
Hello Friends
I made a vbs script, but i have a little problem.
I need to translate this into vbs.
I currently call the S.cmd within the script to make the service.
It´s the only needed thing to make it work, and some cleanup off course.
Anyone knows how %APPDATA% and %SYSTEMDRIVE% are used or translated into vbs?
Bye
S.cmd------------------------
SET sandboxdir=%~dp0
cd %sandboxdir%
sc.exe create Sandbox binpath= "%sandboxdir%Sandbox.sys" type= kernel start= auto error= normal DisplayName= Sandbox
in VBS i made this, but not work:
WSHShell.Run "sc.exe create Sandbox binpath= " & chr(34) & strdrivedir & chr(34) & "\Sandbox.sys" & chr(34) & " type= kernel start= auto error= normal DisplayName= Sandbox", 0, TRUE
Here are my vbs scripts:
START.VBS---------------------------
Dim objShell
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
arrPath = Split(Wscript.ScriptFullName, "\")
strdriveletter = arrPath(0)
set colVolatileEnvVars = objShell.Environment("Process")
colVolatileEnvVars("sandboxdrive") = strdriveletter
arrPath = Split(Wscript.ScriptFullName, Wscript.ScriptName)
strdrivedir = arrPath(0)
set colVolatileEnvVars = objShell.Environment("Process")
colVolatileEnvVars("sandboxdir") = strdrivedir
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry=GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
objRegistry.CreateKey HKEY_LOCAL_MACHINE, "Software\tzuk\Sandboxie"
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, "Software\tzuk\Sandboxie", "Home", strdrivedir
objRegistry.CreateKey HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control"
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Window_Top", 14
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Window_Left", 7
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Window_Bottom", 364
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Window_Right", 302
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Column 0 Width", 151
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Column 1 Width", 47
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Column 2 Width", 80
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Show_All_Processes", 0
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "FirstRun", 0
arrValues = Array(54,8,90,163,84,87,198,1)
objRegistry.SetBinaryValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Last_Version_Check", arrValues
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "Sandboxie.ini" , "c:\windows\", OverwriteExisting
objShell.CurrentDirectory = strdrivedir
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
'WSHShell.Run "sc.exe create Sandbox binpath= " & chr(34) & strdrivedir & chr(34) & "\Sandbox.sys" & chr(34) & " type= kernel start= auto error= normal DisplayName= Sandbox", 0, TRUE
WSHShell.Run "S.cmd", 0, TRUE
WSHShell.Run "sc.exe start sandbox", 0, TRUE
'HERE YOU REPLACE NOTEPAD.EXE WITH PSTART.EXE OR OTHER SHELL OR SOFTWARE
WSHShell.Run "Start.exe notepad.exe", 1, TRUE
Set WSHShell = Nothing
WScript.Quit(0)
STOP.VBS-------------------------------------
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.Run "sc.exe stop Sandbox", 0, TRUE
WSHShell.Run "sc.exe delete Sandbox", 0, TRUE
Set WSHShell = Nothing
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Control.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'SandboxieDcomLaunch.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'SandboxieRpcSs.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
oReg.DeleteKey HKEY_CURRENT_USER, "Sandbox"
oReg.DeleteKey HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control"
oReg.DeleteKey HKEY_CURRENT_USER, "Software\tzuk\Sandboxie"
oReg.DeleteKey HKEY_CURRENT_USER, "Software\tzuk"
oReg.DeleteKey HKEY_LOCAL_MACHINE, "SOFTWARE\tzuk\Sandboxie"
oReg.DeleteKey HKEY_LOCAL_MACHINE, "SOFTWARE\tzuk"
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("c:\windows\Sandboxie.ini")
This START.VBS WORKS!!Dim
This START.VBS WORKS!!
Dim objShell
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
arrPath = Split(Wscript.ScriptFullName, "\")
strdriveletter = arrPath(0)
set colVolatileEnvVars = objShell.Environment("Process")
colVolatileEnvVars("sandboxdrive") = strdriveletter
arrPath = Split(Wscript.ScriptFullName, Wscript.ScriptName)
strdrivedir = arrPath(0)
set colVolatileEnvVars = objShell.Environment("Process")
colVolatileEnvVars("sandboxdir") = strdrivedir
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry=GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
objRegistry.CreateKey HKEY_LOCAL_MACHINE, "Software\tzuk\Sandboxie"
objRegistry.SetStringValue HKEY_LOCAL_MACHINE, "Software\tzuk\Sandboxie", "Home", strdrivedir
objRegistry.CreateKey HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control"
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Window_Top", 14
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Window_Left", 7
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Window_Bottom", 364
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Window_Right", 302
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Column 0 Width", 151
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Column 1 Width", 47
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Column 2 Width", 80
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Show_All_Processes", 0
objRegistry.SetDWORDValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "FirstRun", 0
arrValues = Array(54,8,90,163,84,87,198,1)
objRegistry.SetBinaryValue HKEY_CURRENT_USER, "Software\tzuk\Sandboxie\Control", "Last_Version_Check", arrValues
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "Sandboxie.ini" , "c:\windows\", OverwriteExisting
objShell.CurrentDirectory = strdrivedir
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.Run "sc.exe create Sandbox binpath= " & chr(34) & chr(37) & "sandboxdir" & chr(37) & "Sandbox.sys" & chr(34) & " type= kernel start= auto error= normal DisplayName= Sandbox", 0, TRUE
WSHShell.Run "sc.exe start sandbox", 0, TRUE
WSHShell.Run "Start.exe notepad.exe", 1, TRUE
Set WSHShell = Nothing
WScript.Quit(0)
Since this start.vbs is
Since this start.vbs is working, would you like me to still try my hand at NSIS-izing it?
I don't think it'll be particularly easy, though -- it looks like I'll be making around four different executables.
~nm35
a.k.a. Mark
If it's not too much
If it's not too much trouble, please go ahead. It would be useful for machines on which vbs scripting has been disabled.
Thanks,
Tappet
__________________
"I am still learning."
--Socrates
I'll try. Don't expect
I'll try. Don't expect anything too soon, though, because I'm extremely busy at the moment.
~nm35
a.k.a. Mark
Fair enough. I'll keep an
Fair enough. I'll keep an eye on this blog for updates, whenever they come out.
Thanks again,
Tappet
__________________
"I am still learning."
--Socrates
Sandboxie
I have made an AutoIt script to make Sandboxie work...i currently use 2.30 to make this. Have anyone interest on this?
My hand's waving in the air...
Yes, please post this!
Thanks.
Sandbox
https://portableapps.com/node/1124#comment-6841