[fedora-virt] modifying per-user registry values?

Tom Horsley horsley1953 at gmail.com
Sun May 15 13:09:41 UTC 2011

On Sun, 15 May 2011 10:15:44 +0100
Richard W.M. Jones wrote:

> I tried to change the background by altering the registry key but
> could come up with anything that actually worked.  I'm not exactly
> sure what I'm doing wrong, but if you make it work please post how you
> did it ...

Well, it was tricky. The registry key (actually two different ones
apparently) holds the name of the image last used to make the
cached .bmp file that is really used as the background, so it turned
out I really needed to change two registry keys, convert the
jpeg those keys point at to a .bmp and update the .bmp file
really being used as the background (whew! :-).

Here's the last half of my update-image script (which will probably
get mangled by line wrapping :-)

# Next we need to do the much more complex task of updating the wallpaper
# image for the default login user (me). Start by grabbing the NTUSER.DAT
# hive file.

guestfish --ro -i -a $name.img download 'WIN:C:\Documents and Settings\'"$user"'\NTUSER.DAT' $tmpdir/NTUSER.DAT

# Then update that hive to indicate that the wallpaper comes from the desired
# standard wallpaper image

sed -e 's/@JPEG@/'"$wallpaper"'/g' > $bak <<'EOF'
[Control Panel\Desktop]
"ConvertedWallpaper"="C:\\WINDOWS\\Web\\Wallpaper\\@JPEG at .jpg"

"Wallpaper"="%SystemRoot%\\Web\\Wallpaper\\@JPEG at .jpg"
hivexregedit --merge $tmpdir/NTUSER.DAT $bak
guestfish -i -a $name.img upload $tmpdir/NTUSER.DAT 'WIN:C:\Documents and Settings\'"$user"'\NTUSER.DAT'

# But wait! There's more, we not only need to fix the registry, but also
# update the cached bitmap image of the jpg file.

guestfish --ro -i -a $name.img download 'WIN:C:\WINDOWS\Web\Wallpaper\'"$wallpaper"'.jpg' $tmpdir/wall.jpg
convert $tmpdir/wall.jpg $bmp
guestfish -i -a $name.img upload $bmp 'WIN:C:\Documents and Settings\'"$user"'\Local Settings\Application Data\Microsoft\Wallpaper1.bmp'

I'm going to write this up in more detail and stick it on my web
site, but I haven't gotten around to it yet (just got the script
to finally work yesterday).

More information about the virt mailing list