EDIT (5.09.2008):
I changed the first post in the topic to make it a better starting place for new users. You can find it's original contents merged with the second post below:
I can't find any contact information about the author w/out registering on german forums, so I'll post my solution here.
The main script:
Code: Select all
; AutoIt Version: 3.x
; Language: Deutsch
; Author: michaelm_007
; Modified by: m^2
Opt("TrayIconHide", 1)
Dim $Installer = FALSE
If NOT ProcessExists("VirtualBox.exe") Then
Install()
$Installer = TRUE
EndIf
RunWait ("cmd /c set VBOX_USER_HOME=%CD%\data\.VirtualBox & start .\app\VirtualBox.exe", @ScriptDir, @SW_HIDE)
If $Installer Then
ProcessWaitClose("VirtualBox.exe")
Uninstall()
EndIf
Exit
Func Install()
DllCall ("app\VBoxRT.dll", "hwnd", "LoadLibraryA")
DllCall ("app\VBoxRT.dll", "hwnd", "GetProcAddress")
DllCall ("app\VBoxRT.dll", "hwnd", "VirtualProtect")
DllCall ("app\VBoxRT.dll", "hwnd", "VirtualAlloc")
DllCall ("app\VBoxRT.dll", "hwnd", "VirtualFree")
DllCall ("app\VBoxRT.dll", "hwnd", "ExitProcess")
DllCall ("app\VBoxRT.dll", "hwnd", "Exit")
DllCall ("app\VBoxRT.dll", "hwnd", "RTR3Init")
RunWait ("app\VBoxSVC.exe /reregserver", "", @SW_HIDE)
RunWait ("regsvr32.exe /S app\VBoxC.dll", @ScriptDir)
FileCopy ("app\drivers\VBoxDrv\VBoxDRV.sys", @SystemDir&"\drivers")
FileCopy ("app\drivers\network\VBoxTAP.sys", @SystemDir&"\drivers")
FileCopy ("app\drivers\USB\device\VBoxUSB.sys", @SystemDir&"\drivers")
FileCopy ("app\drivers\USB\filter\VBoxUSBMon.sys", @SystemDir&"\drivers")
RunWait ("cmd /c sc create VBoxDRV binpath= system32\drivers\VBoxDRV.sys type= kernel start= auto error= normal displayname= VBoxDRV", "", @SW_HIDE)
RunWait ("cmd /c sc create VBoxTAP binpath= system32\drivers\VBoxTAP.sys type= kernel start= demand error= normal displayname= VBoxTAP", "", @SW_HIDE)
RunWait ("cmd /c sc create VBoxUSB binpath= system32\drivers\VBoxUSB.sys type= kernel start= demand error= normal displayname= VBoxUSB", "", @SW_HIDE)
RunWait ("cmd /c sc create VBoxUSBMon binpath= system32\drivers\VBoxUSBMon.sys type= kernel start= auto error= normal displayname= VBoxUSBMon", "", @SW_HIDE)
RunWait ("cmd /c sc start VBoxDRV", "", @SW_HIDE)
RunWait ("cmd /c sc start VBoxTAP", "", @SW_HIDE)
RunWait ("cmd /c sc start VBoxUSB", "", @SW_HIDE)
RunWait ("cmd /c sc start VBoxUSBMon", "", @SW_HIDE)
EndFunc
Func Uninstall()
Sleep (7000)
RunWait ("app\VBoxSVC.exe /unregserver", "", @SW_HIDE)
RunWait ("regsvr32.exe /S /U app\VBoxC.dll", @ScriptDir)
RunWait ("cmd /c sc stop VBoxDRV", "", @SW_HIDE)
RunWait ("cmd /c sc stop VBoxTAP", "", @SW_HIDE)
RunWait ("cmd /c sc stop VBoxUSB", "", @SW_HIDE)
RunWait ("cmd /c sc stop VBoxUSBMon", "", @SW_HIDE)
RunWait ("cmd /c sc delete VBoxDRV", "", @SW_HIDE)
RunWait ("cmd /c sc delete VBoxTAP", "", @SW_HIDE)
RunWait ("cmd /c sc delete VBoxUSB", "", @SW_HIDE)
RunWait ("cmd /c sc delete VBoxUSBMon", "", @SW_HIDE)
FileDelete (@SystemDir&"\drivers\VBoxDRV.sys")
FileDelete (@SystemDir&"\drivers\VBoxTAP.sys")
FileDelete (@SystemDir&"\drivers\VBoxUSB.sys")
FileDelete (@SystemDir&"\drivers\VBoxUSBMon.sys")
EndFunc
Also you need to modify DataDir.bat placed in data dir.
Code: Select all
@ECHO OFF
SET datadir=%~dp0
SET VBOX_USER_HOME=%datadir%\.VirtualBox
start app\VirtualBox.exe
EXIT
EDIT: Following 1.6.2 version, I modified th AutoIt script in a way that does not require the helper DataDir.bat.
---------------------------------------------------------------------------------------------------------------------
END OF THE FIRST POST
---------------------------------------------------------------------------------------------------------------------
GeddichNixan wrote:@m^(2)
If it doesn't bother you too much could you please give those enthusiastic portable freeware users but coding analphabets (like me) a cookbook like description of what to do with your code? Just like this:
"Take the code, copy and paste it into a file, name XXX and put it into the dir YYY. Ejoy!"
I would appreciate it a lot. Modifying a batch file is within my competence but I have absolutely no experience with autoit codes.
BTW, many thanks for you work.
Save the first code as VBoxLauncher.au3.
Download and install AutoIT.
Go to it's subdirectory named Aut2exe. Run Aut2exe.exe. As source, select VBoxLauncher.au3. Type some name for your executable. Select icon - you can find VBox icon in the PortableVirtualBox\sources as packed originally by michaelm_007. Press convert, copy the executable to PortableVirtualBox directory.
And, as I wrote before, modify PortableVirtualBox\data\DataDir.bat code to look as in the second code box in my previous post.
Enjoy and report all bugs you find.