Portable VirtualBox [VB launcher utility]

Submit portable freeware that you find here. It helps if you include information like description, extraction instruction, Unicode support, whether it writes to the registry, and so on.
Post Reply
Message
Author
User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

Portable VirtualBox [VB launcher utility]

#1 Post by m^(2) » Mon Jun 16, 2008 2:23 am

Hello,
VirtualBox Portable is a launcher that lets you use VirtualBox portably.
It was designed to be a direct replacement for a launcher created by michaelm_007 at geman-nlite.de (and is based on it).
The most important difference between the 2 is level of verbosity - my launcher is meant to do it's work without bothering the user, while the original implements things like splash screens or permanent tray icon with some options like hiding machine windows.
Other differences:
My launcher has several command line options, which make it more scripting friendly. Also, it runs from read only media like CDs.

Download the launcher (alternative source)
You also need VirtualBox binaries. Get any version from here.

Requirements:
-Windows XP or newer
-Admin rights unless there's VirtualBox installed already on the host machine.
-Read the readme. :P

Changes:

Code: Select all

[+]: Addition
[!]: Bug fix
[~]: Modified behaviour

2.0
[+] Automatically recreates deleted config file
[+] Supports hiding VBox widows
[+] Works on read-only devices (like DVD ROMs)
[+] Tray icon also during startup (which takes long on read only devices)
[+] Additional machine management options
[!] Build tools bug fixes
[~] Moved sources to doc direcory
PS. (5.09.2008) I edited this post to make it a better starting place for new users.
The original contents are in my second post.
Last edited by m^(2) on Thu Sep 16, 2010 2:36 am, edited 5 times in total.

GeddichNixan
Posts: 159
Joined: Fri May 09, 2008 6:03 am

#2 Post by GeddichNixan » Mon Jun 16, 2008 5:41 am

@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.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#3 Post by m^(2) » Mon Jun 16, 2008 6:23 am

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. ;)
Last edited by m^(2) on Fri Sep 05, 2008 8:42 am, edited 1 time in total.

GeddichNixan
Posts: 159
Joined: Fri May 09, 2008 6:03 am

#4 Post by GeddichNixan » Mon Jun 16, 2008 6:41 am

WOW, that was fast! Thanks a lot for your answer. I will try it ASAP, but I intend to bother you with further questions should I have any trouble if you don't mind. :D

GeddichNixan
Posts: 159
Joined: Fri May 09, 2008 6:03 am

#5 Post by GeddichNixan » Mon Jun 16, 2008 12:17 pm

@g-force
Welcome to this board. Thanks for the information I will take a look at the thread on your site but I am afraid not everybody who may be interested in PortableVirtualBox understands German. Anyhow please forward our thanks to the creator of the ProtableVirtualBox script.


@m^(2)

I followed your instructions. Modified the batch file (the original portable version worked fine with the modified batch). Then I copied the code into a file which I saved as xxx.au3. I also installed AutoIT started the script to exe conversion and converted the au3 file into an exe. After that I moved the new exe into the PortableVirtualBox folder and tried to start the app by executing the newly created exe. I received the following error message:


==============================================================================================================================
VirtualBox - Critical Error

The COM-object for VirtualBox could not be created.

The application will now be terminated.



Could not create the VirtualBox home directory 'C:\xxx\xxx\xxx\Portable-VirtualBox\data\ \.VirtualBox'(VERR_PATH_NOT_FOUND).


Error code: E_FAIL (0x80004005)
Component: VirtualBox
Interface: IVirtualBox {2d3b9ea7-25f5-4f07-a8e1-7dd7e0dcf667}
Callee RC: E_NOINTERFACE (0x80004002)

==============================================================================================================================


Then I tried to start my installed version of VirtualBox for reference. It did not started instead the following error message appeared:

==============================================================================================================================

VirtualBox - Critical Error

The COM-object for VirtualBox could not be created.

The application will now be terminated.

Callee RC: REGDB_E_CLASSNOTREG (0x80040154)
=============================================================================================================================

Then I tried to start a copy of the original PortableVirtualBox and it started fine.

Finally I uninstalled and re-installed VirtualBox and it worked too.

Is that a bug, or did I make a mistake?

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#6 Post by m^(2) » Mon Jun 16, 2008 12:53 pm

g-force wrote:Hi, this is g-force, admin @ german-nlite.

Link to the thread on german-nlite is:

http://www.german-nlite.de/index.php?sh ... ntry127493
Welcome.
Thank you for the link, I'll try to follow this topic (depending on automatic translation quality), but surely won't post there as I don't want to register on german forums.
As a visitor I cannot see michaelm_007's profile. Could you please give me his contact information, if he entered it?

@GeddichNixan

it seems there was a bug in the .bat file, I'm surprised that it worked. Following 1.6.2 by michaelm_007, I changed it, so the batch is no longer needed. Additionally, I modified it to work when working directory is different from Portable VBox directory.

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

EnvSet("VBOX_USER_HOME",@ScriptDir&"\data\.VirtualBox")
Run (@ScriptDir&"\app\VirtualBox.exe")

If $Installer Then
    ProcessWaitClose("VirtualBox.exe")
    Uninstall()
EndIf

Exit


Func Install()

    DllCall (@ScriptDir&"\app\VBoxRT.dll", "hwnd", "LoadLibraryA")
    DllCall (@ScriptDir&"\app\VBoxRT.dll", "hwnd", "GetProcAddress")
    DllCall (@ScriptDir&"\app\VBoxRT.dll", "hwnd", "VirtualProtect")
    DllCall (@ScriptDir&"\app\VBoxRT.dll", "hwnd", "VirtualAlloc")
    DllCall (@ScriptDir&"\app\VBoxRT.dll", "hwnd", "VirtualFree")
    DllCall (@ScriptDir&"\app\VBoxRT.dll", "hwnd", "ExitProcess")
    DllCall (@ScriptDir&"\app\VBoxRT.dll", "hwnd", "Exit")
    DllCall (@ScriptDir&"\app\VBoxRT.dll", "hwnd", "RTR3Init")

    RunWait ("app\VBoxSVC.exe /reregserver",  @ScriptDir, @SW_HIDE)
    RunWait ("regsvr32.exe /S app\VBoxC.dll", @ScriptDir, @SW_HIDE)

    RunWait ('cmd /c sc create VBoxDRV binpath= "%CD%\app\drivers\VBoxDrv\VBoxDrv.sys" type= kernel start= auto error= normal displayname= VBoxDRV',                           @ScriptDir, @SW_HIDE)
    RunWait ('cmd /c sc create VBoxTAP binpath= "%CD%\app\drivers\network\VBoxTAP.sys" type= kernel start= demand error= normal group= NDIS tag= yes displayname= VBoxTAP',    @ScriptDir, @SW_HIDE)
    RunWait ('cmd /c sc create VBoxUSB binpath= "%CD%\app\drivers\USB\device\VBoxUSB.sys" type= kernel start= demand error= normal group= Base tag= yes displayname= VBoxUSB', @ScriptDir, @SW_HIDE)
    RunWait ('cmd /c sc create VBoxUSBMon binpath= "%CD%\app\drivers\USB\filter\VBoxUSBMon.sys" type= kernel start= auto error= normal displayname= VBoxUSBMon',               @ScriptDir, @SW_HIDE)

    RunWait ("cmd /c sc start VBoxDRV",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc start VBoxTAP",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc start VBoxUSB",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc start VBoxUSBMon", @ScriptDir, @SW_HIDE)
    
EndFunc


Func Uninstall()

    Sleep (7000)
    
    RunWait ("\app\VBoxSVC.exe /unregserver",    @ScriptDir, @SW_HIDE)
    RunWait ("regsvr32.exe /S /U app\VBoxC.dll", @ScriptDir, @SW_HIDE)

    RunWait ("cmd /c sc stop VBoxDRV",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc stop VBoxTAP",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc stop VBoxUSB",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc stop VBoxUSBMon", @ScriptDir, @SW_HIDE)

    RunWait ("cmd /c sc delete VBoxDRV",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc delete VBoxTAP",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc delete VBoxUSB",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc delete VBoxUSBMon", @ScriptDir, @SW_HIDE)

EndFunc
Edit: some more minor upgrades that make it closer to the current version of the original.

GeddichNixan
Posts: 159
Joined: Fri May 09, 2008 6:03 am

#7 Post by GeddichNixan » Mon Jun 16, 2008 1:26 pm

Thanks again for the lightning fast answer.

The new script seems to work fine and it did not messed up my installed version either. I haven't had the time so far and could not find out all the differences between your version and the original. There are non splash screens at startup and shutdown and no icon in the taskbar. Anything else?

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#8 Post by m^(2) » Mon Jun 16, 2008 1:47 pm

If you take 1.6.2 as the original version, the differences are:
-this has no UI at all (allso lacks error messages in case you deleted some parts of VBox)
-doesn't register global hotkeys
ADDED:
-doesn't let you autorun VM. You can bypass it because of the following:
-lets you pass parameters to VBox executable, if you replace

Code: Select all

Run (@ScriptDir&"\app\VirtualBox.exe")
with

Code: Select all

ShellExecute(@ScriptDir&"\app\VirtualBox.exe",$CmdLineRaw)
EDIT2:
Mistake. :oops:
ShellExecute isn't needed because it's not VirtualBox.exe what starts VMs, it's VBoxManage.exe.
I'll keep it though it means nothing now because it adds some future-proofness.
Last edited by m^(2) on Mon Jun 16, 2008 2:31 pm, edited 3 times in total.

GeddichNixan
Posts: 159
Joined: Fri May 09, 2008 6:03 am

#9 Post by GeddichNixan » Mon Jun 16, 2008 1:51 pm

Well, then I will take 1.6.2 as the original started with your modified script. Thanks for your help.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#10 Post by m^(2) » Mon Jun 16, 2008 2:51 pm

michaelm_007 simplified installation / uninstallation, so I did.

Code: Select all

; AutoIt Version: 3.x
; Author:         michaelm_007
; Modified by:    m^2
; Version:        0.1
; Codebase:       1.3.5

; TODO:     
; - VBoxManage support
; - error management

Opt("TrayIconHide", 1)


Dim $Installer = FALSE

If NOT ProcessExists("VirtualBox.exe") Then
    Install()
    $Installer = TRUE
EndIf

EnvSet("VBOX_USER_HOME",@ScriptDir&"\data\.VirtualBox")
ShellExecute(@ScriptDir&"\app\VirtualBox.exe",$CmdLineRaw)

If $Installer Then
    ProcessWaitClose("VirtualBox.exe")
    Uninstall()
EndIf

Exit

Func Install()
    RunWait ("cmd /c sc create VBoxDRV binpath= ""%CD%\app\drivers\VBoxDrv\VBoxDrv.sys"" type= kernel start= auto error= normal displayname= VBoxDRV",             @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc create VBoxUSBMon binpath= ""%CD%\app\drivers\USB\filter\VBoxUSBMon.sys"" type= kernel start= auto error= normal displayname= VBoxUSBMon", @ScriptDir, @SW_HIDE)

    RunWait ("app\VBoxSVC.exe /reregserver",  @ScriptDir, @SW_HIDE)
    RunWait ("regsvr32.exe /S app\VBoxC.dll", @ScriptDir, @SW_HIDE)
    DllCall ("app\VBoxRT.dll", "hwnd", "RTR3Init")

    RunWait ("cmd /c sc start VBoxDRV",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc start VBoxUSBMon", @ScriptDir, @SW_HIDE)
EndFunc

Func Uninstall()

    Sleep (7000)
    
    RunWait ("cmd /c sc stop VBoxDRV",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc stop VBoxUSBMon", @ScriptDir, @SW_HIDE)

    RunWait ("app\VBoxSVC.exe /unregserver",     @ScriptDir, @SW_HIDE)
    RunWait ("regsvr32.exe /S /U app\VBoxC.dll", @ScriptDir, @SW_HIDE)

    RunWait ("cmd /c sc delete VBoxDRV",    @ScriptDir, @SW_HIDE)
    RunWait ("cmd /c sc delete VBoxUSBMon", @ScriptDir, @SW_HIDE)

EndFunc

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#11 Post by m^(2) » Mon Jun 16, 2008 4:52 pm

I rewrote the script to c++. Currently it's very raw, no error checks at all, I'll add them tomorrow (it's 3AM here now...).
Download

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#12 Post by m^(2) » Tue Jun 17, 2008 2:47 am


kuihdez
Posts: 94
Joined: Sat Jun 07, 2008 4:32 am

#13 Post by kuihdez » Tue Jun 17, 2008 7:34 am

how do we use your script ?

GeddichNixan
Posts: 159
Joined: Fri May 09, 2008 6:03 am

#14 Post by GeddichNixan » Tue Jun 17, 2008 9:06 am

@m^(2)

Your new C-script triggered a fatal error (the COM-object could not be created) with the following error code:


Callee RC: REGDB_E_CLASSNOTREG (0x80040154)

Since the first occurance of the error none of the VirtualBox variants (installed, portable with original loader, portable with your modified loader with the autoit script) starts.

User avatar
m^(2)
Posts: 890
Joined: Sat Mar 31, 2007 2:38 am
Location: Kce,PL
Contact:

#15 Post by m^(2) » Tue Jun 17, 2008 3:18 pm

GeddichNixan wrote:@m^(2)

Your new C-script triggered a fatal error (the COM-object could not be created) with the following error code:


Callee RC: REGDB_E_CLASSNOTREG (0x80040154)

Since the first occurance of the error none of the VirtualBox variants (installed, portable with original loader, portable with your modified loader with the autoit script) starts.
Can you check if it is the problem in the following link?
http://vbox.innotek.de/pipermail/vbox-u ... 00045.html
kuihdez wrote:how do we use your script ?
First I feel I have to notice that it's rather michaelm_007's script, not mine because he wrote all it's core...I just stripped the GUI, ported to C++ and did very slight mods.

But to answer your question, you need michaelm_007's Portable VirtualBox because I don't have storage space (and sun's permission) to host the whole package. When you have it on your drive, put VirtualBoxPortable.exe in it's main directory and just double click to start VirtualBox GUI. That's it. VirualBox-Portable.exe and data\settings directory (with contents) that come with michaelm_007's PVB are not needed, you can delete them.

Post Reply