Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

Extract wallpaper path from registry

VBScript Windows 8 Registry Wallpaper

  • Please log in to reply
3 replies to this topic

#1
xpclient

xpclient

    XP was my idea. 3rd party apps make NT6 my idea.

  • Member
  • PipPipPip
  • 333 posts
  • Joined 30-July 05
  • OS:XP Pro x64
  • Country: Country Flag

So let me give you some background of my problem so you don't wonder "why would you want to do that"? Windows 7 introduced a nice slideshow feature so you can set for example, you entire Pictures library as wallpaper and have it cycle through your awesome collection. But when you install themepacks which come with multiple wallpapers in one theme, there are some pictures you don't like and wish to delete. So it would be nice while the slideshow was set, if you could determine the current wallpaper's path and delete the image if you don't like it. For Windows 7, I found a useful little script that precisely did this (http://www.pretentio...scsoft/#delwall). The current desktop background is stored in the Registry at HKCU\Software\Microsoft\Internet Explorer\Desktop\General: String value: WallpaperSource. The script reads the current desktop background image from the registry and deletes it.

 

Now we got Windows 8 and Microsoft as we know likes to make our lives more difficult, annoying and delete/change features just for fun. In Windows 8, the current wallpaper is no longer stored at the above mentioned registry key which is a plain string value. Instead it is stored at HKCU\Control Panel\Desktop\ as a REG_BINARY value: TranscodedImageCache. So I wrote a little VBScript again to decode the REG_BINARY value and get the wallpaper source. This script is attached to this post (Attached File  GetWallpaperSource.zip   593bytes   9 downloads). But the problem is that TranscodedImageCache value also seems to store some other garbage in that value besides the image path. The value I get as output contains these extra bits I don't want before the wallpaper path begins. And my VBScript skills aren't advanced enough to read only a portion of a REG_BINARY value ignoring the initial binary data which is garbage.

 

So my question is can anyone help me get *just* the wallpaper source in one way or the other by writing any script, VBS or PowerShell or a little program so I can delete the current wallpaper quickly?


Edited by xpclient, 28 September 2013 - 01:08 AM.

Impossible to run NT6 without third party fixes.



How to remove advertisement from MSFN

#2
MrJinje

MrJinje

    Toolâ„¢ Developer

  • Developer
  • 1,031 posts
  • Joined 14-October 09
  • OS:Server 2012R2
  • Country: Country Flag

Yeah, I think a powershell way would be easier, I've found some useful Hex bits at sans.org. 

 

http://www.sans.org/...ray-hex-convert

 

Looking at my 8.1 machine the first 24 bytes are garbage, then begins plain text path, followed by hundreds of zero's padding.

Header

7a,c3,01,00,c2,87,00,00,05,01,00,00,f1,00,00,00,dc,\
  b4,b1,18,d5,ab,ce,01,

Header is slightly different each time.

7a,c3,01,00,e4,ef,00,00,80,07,00,00,b0,04,00,00,aa,\
  ab,d2,f1,28,b5,ce,01,

The goods.   This is the path in plain text (as hex)

5a,00,3a,00,5c,00,53,00,68,00,61,00,72,00,65,00,64,00,\
  5c,00,4b,00,72,00,79,00,74,00,65,00,6e,00,2d,00,52,00,65,00,64,00,44,00,77,\
  00,61,00,72,00,66,00,2e,00,6a,00,70,00,67,00

"TranscodedImageCache"=hex:7a,c3,01,00,c2,87,00,00,05,01,00,00,f1,00,00,00,dc,\
  b4,b1,18,d5,ab,ce,01,5a,00,3a,00,5c,00,53,00,68,00,61,00,72,00,65,00,64,00,\
  5c,00,4b,00,72,00,79,00,74,00,65,00,6e,00,2d,00,52,00,65,00,64,00,44,00,77,\
  00,61,00,72,00,66,00,2e,00,6a,00,70,00,67,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\

I guess the simple way from VBS would be to skip over the first 24 bytes when you run your loop.   Start a counter, i = i+1, then make an if i = less than 24 skip to next byte.



#3
xpclient

xpclient

    XP was my idea. 3rd party apps make NT6 my idea.

  • Member
  • PipPipPip
  • 333 posts
  • Joined 30-July 05
  • OS:XP Pro x64
  • Country: Country Flag

Ah thank you very much. That helped. It is that easy! I fixed my script :) and updated that script by Leo Davidson to get current wallpaper and delete it. (Attached to post)

Attached Files


Edited by xpclient, 28 September 2013 - 05:38 AM.

Impossible to run NT6 without third party fixes.


#4
Akiobenjiro

Akiobenjiro
  • Member
  • 1 posts
  • Joined 27-October 14
  • OS:Windows 8.1 x64
  • Country: Country Flag

Ah thank you very much. That helped. It is that easy! I fixed my script :) and updated that script by Leo Davidson to get current wallpaper and delete it. (Attached to post)

Thanks, a lot! Great job







Also tagged with one or more of these keywords: VBScript, Windows 8, Registry, Wallpaper

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users