You are here 3z5a6i

New Project -- NSIS-izing this... 1k4g4a

Submitted by nm35 on April 3, 2006 - 7:50pm

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_\Identities
OpenKeyPath=msimn.exe,HKEY_CURRENT_\Software\Microsoft\Outlook Express

RecoverFolder=%Favorites%
RecoverFolder=%Personal%
RecoverFolder=%Desktop%

Sandboxie.reg

REGEDIT4

[HKEY_CURRENT_\Software\tzuk]

[HKEY_CURRENT_\Software\tzuk\Sandboxie]

[HKEY_CURRENT_\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 1q5n3q

I wish you Good Luck Im 5r5z39

I wish you Good Luck
Im looking this with great interest.

Sand 2e515s

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 3f701w

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

Tappet
__________________
"I am still learning."
--Socrates

vbs 5m3815

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_ = &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_, "Software\tzuk\Sandboxie\Control"
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Window_Top", 14
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Window_Left", 7
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Window_Bottom", 364
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Window_Right", 302
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Column 0 Width", 151
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Column 1 Width", 47
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Column 2 Width", 80
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Show_All_Processes", 0
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "FirstRun", 0
arrValues = Array(54,8,90,163,84,87,198,1)
objRegistry.SetBinaryValue HKEY_CURRENT_, "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_ = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

oReg.DeleteKey HKEY_CURRENT_, "Sandbox"
oReg.DeleteKey HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control"
oReg.DeleteKey HKEY_CURRENT_, "Software\tzuk\Sandboxie"
oReg.DeleteKey HKEY_CURRENT_, "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 234n5c

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_ = &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_, "Software\tzuk\Sandboxie\Control"
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Window_Top", 14
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Window_Left", 7
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Window_Bottom", 364
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Window_Right", 302
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Column 0 Width", 151
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Column 1 Width", 47
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Column 2 Width", 80
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "Show_All_Processes", 0
objRegistry.SetDWORDValue HKEY_CURRENT_, "Software\tzuk\Sandboxie\Control", "FirstRun", 0
arrValues = Array(54,8,90,163,84,87,198,1)
objRegistry.SetBinaryValue HKEY_CURRENT_, "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 5x345x

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 491354

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

Tappet
__________________
"I am still learning."
--Socrates

I'll try. Don't expect 622o54

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 405x4j

Fair enough. I'll keep an eye on this blog for updates, whenever they come out.

Thanks again,

Tappet
__________________
"I am still learning."
--Socrates

Tappet
__________________
"I am still learning."
--Socrates

Sandboxie 702919

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... 113f3w

Yes, please post this!

Thanks.