Changing VM icon (#16489)

Discussions related to using VirtualBox on Windows hosts.
Post Reply
s_bonacina
Posts: 3
Joined: 19. Mar 2009, 16:42

Changing VM icon (#16489)

Post by s_bonacina »


ModEdit; related ticket: #16489: Cannot set VM icon
Dear all
I'm desperately trying to change a VM icon without success: we have several virtual machine which are dedicated each one to a purpose, and we need to distinguish the purposes of each machine to make users avoid mistakes.
I'm running VB 5.1.10

I use the command:

Code: Select all

set VBOX_USER_HOME=C:\Users\stefano\.VirtualBox & .\VBoxManage modifyvm "win7" --iconfile icon_file_in_ICO_format.ico
I tried with several icons in ICO format and I also tried with images in PNG format but the icon remains always the same.

I can see the icon definition has been modified in the .vbox file which stands in my \VirtualBox VMs\ folder. Please, see below the win7.vbox related line.
As you can see, the icon attribute is set with an icon definition in ASCII format. I did this operation several time to see what changed, and actually the icon definition changed everytime I run the vboxmanage command.
FYI, the icon definition you see in the line below is taken from the following file, which contain the Windows folder icon:
C:\Windows\Installer\{0EFDF2F9-836D-4EB7-A32D-038BD3F1FB2A}\folder.ico

Does anybody have any idea why the icon does not change and how to make it changing?

Thanks to all who will reply
Best regards
stefano

Code: Select all

  <Machine uuid="{5bb4a178-b5d9-4946-afaf-871fec24dbc9}" name="win7" OSType="Windows7" snapshotFolder="Snapshots" lastStateChange="2017-01-21T08:02:06Z" icon="AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAgBAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANRVgAHJC2ADKkygBIsNMATrPVAFC0
1gBswd0AkdHmAGuRngAeKS0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAJJC0AEkpcACB0kAAwn8QAParOAEmw0gBYudoAZsLjAHfK6ACH0usAbK3CADtw
ggAyXGoARGRuADhMUwATGh0AAAAAAAAAAAAAAAAAA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/8AAAP/AAAA/wAAAP8AAAA/AAAAPwAAAD8AAAA/AAAAPwAAAD8AA
AA/AAAAPwAAAD8AAAA/AAAAPwAAAD8AAAA/AAAAPwAAAD8AAAA/wAAAP8AAAD/wD
8A/8A/AP////P////z8=">
Last edited by socratis on 25. Dec 2018, 03:04, edited 1 time in total.
Reason: Added ticket related information.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Changing VM icon

Post by mpack »

I wasn't even aware that this feature existed. AFAIK VirtualBox doesn't have a VM icon, unless perhaps you make a desktop shortcut to the VM. The icon shown in the manager identifies the VBox template used (which can be thought of as a VM category), that icon is not bound to the individual VM.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Changing VM icon

Post by socratis »

Well, some source digging shows the following. There's a MODIFYVM_ICONFILE case in the "VBoxManageModifyVM.cpp", which covers the iconfile switch that you read about and trying to apply (line 576, as of rev. 5.1.14).

The function seems to not do too much. After some sanity checks, the only thing that "seems" to be going on is:

Code: Select all

RTFILE iconFile;
int vrc = RTFileOpen(&iconFile, ValueUnion.psz, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);
uint64_t cbSize;
vrc = RTFileGetSize(iconFile, &cbSize);
SafeArray<BYTE> icon((size_t)cbSize);
rc = RTFileRead(iconFile, icon.raw(), (size_t)cbSize, NULL);
RTFileClose(iconFile);
CHECK_ERROR(sessionMachine, COMSETTER(Icon)(ComSafeArrayAsInParam(icon)));
OK, I'm not a C guru by any stretch of the imagination, but it seems to me that the icon file needs to be not in ICO or PNG format, but raw. And yes, I tried it, and yes, it failed ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Changing VM icon

Post by mpack »

A raw image, not even a header? I can't see that being very useful as an icon. Where would it get the icon size, the transparency information?

Given that the code shown just loads the file contents into a memory block without any kind of processing, I'd expect that the icon has to be in .ICO format.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Changing VM icon

Post by Perryg »

Not sure about the modifyvm --iconfile, never used it, but all artwork for VBox is png and hard coded. I change artwork at the source and compile into a finished product.

I do know that these kind of things usually require absolute paths and may be case sensitive.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Changing VM icon

Post by mpack »

PNG is possible, because it supports transparency and has a header with size info of course. An ICO file is actually a library of 0 or more images (*) at different resolutions, I'm not sure if PNG has that feature, or indeed if VirtualBox requires it.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Changing VM icon

Post by Perryg »

There was some mention of bmp at one time but that has long past away for what ever reason. I did a quick test and it registers the raw data in the *.vbox file as an ICOn file ( really makes the .vbox file ugly with all the raw data ). but it does not change the file that is used. I wonder if this has not been deprecated and not removed from the docs or is broken and never realized sine very few including myself have been testing it. I would suggest posting a ticket at bugtracker and let the DEVs sort this out.

Edit: I remember what the bmp was in reference to. The main program logo. It had to be a specific size and must be a bitmap.
mikefletcher85
Posts: 4
Joined: 4. Aug 2009, 22:58
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Windows XP

Re: Changing VM icon

Post by mikefletcher85 »

I ran into the same issue. I assume that no one here figured it out yet. I opened a ticket: https://www.virtualbox.org/ticket/16489
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Changing VM icon

Post by mpack »

IMHO, you're rather quick on the draw with that ticket - and you don't give any indication of what you mean by "the VM icon". As already discussed above, the icon displayed in the GUI is not the VM icon, there is AFAIK no indication in the manual that this icon can be changed, and therefore your inability to do so cannot be called a defect.
johnhpatton
Posts: 2
Joined: 24. Dec 2018, 19:03

Re: Changing VM icon

Post by johnhpatton »

This appears to be working in version 6.0. I applied a custom icon to the VM and it stuck, also shows correctly on the taskbar.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Changing VM icon (#16489)

Post by mpack »

Interesting, so the feature changes the icon associated with the Window of a running VM? I guess I can see where that would be useful if you had multiple VMs running.
johnhpatton
Posts: 2
Joined: 24. Dec 2018, 19:03

Re: Changing VM icon (#16489)

Post by johnhpatton »

Yes, I have several VMs running at a time all the time... it's easier to find the one I want when switching between them on the host if I have a custom icon on each.
Post Reply