# [VB.Net] WinXP Explorer Fixer



## bigredpk (Aug 27, 2003)

Ok, lame name I know, but here's a little backstory first:

I am a college student majoring in computer science who spends a lot of time in the school computer lab. The schools network runs windows server 2003 (I believe) and runs deepfreeze on all the lab computers (running winxp pro). All users of this network have administrator privileges and can modify the computers as they see fit as long as they restart when they are done (deepfreeze reimages the pc on every reboot). Keeping all this in mind, I am allowed to work in the computer's registry, so don't fret about that.

On every computer I run (ranging from winxp to vista to win7), I prefer to view all folders the same way. Details view > Grouped by Type with the statusbar showing at the bottom of the window. On Vista and Win7 this is a very simple task to do using the registry. But for windows xp I'm having a heck of a hard time getting this registry hack to work exactly as I want it.

*If I run the following program immediately after I sign in (before opening any explorer windows) this works exactly as I want minus the statusbar. I always have to manually add the status bar*

Below is the registry values I use to reset the view to the way I like:

```
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys]
"Flags"="506"

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Show_StatusBar"="yes"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"ShellState"=hex:24,00,00,00,70,28,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  01,00,00,00,0d,00,00,00,00,00,00,00,00,00,00,00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"ServerAdminUI"=dword:00000000
"Hidden"=dword:00000002
"ShowCompColor"=dword:00000001
"HideFileExt"=dword:00000000
"DontPrettyPath"=dword:00000000
"ShowInfoTip"=dword:00000001
"HideIcons"=dword:00000000
"MapNetDrvBtn"=dword:00000000
"WebView"=dword:00000001
"Filter"=dword:00000000
"SuperHidden"=dword:00000000
"SeparateProcess"=dword:00000000
"ListviewAlphaSelect"=dword:00000001
"ListviewShadow"=dword:00000001
"ListviewWatermark"=dword:00000001
"TaskbarAnimations"=dword:00000001
"StartMenuInit"=dword:00000002
"NoNetCrawling"=dword:00000000
"FolderContentsInfoTip"=dword:00000001
"FriendlyTree"=dword:00000001
"WebViewBarricade"=dword:00000001
"DisableThumbnailCache"=dword:00000000
"ShowSuperHidden"=dword:00000001
"ClassicViewState"=dword:00000000
"PersistBrowsers"=dword:00000000

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams]
"Settings"=hex:08,00,00,00,04,00,00,00,00,00,00,00,00,77,7e,13,73,35,cf,11,ae,\
  69,08,00,2b,2e,12,62,04,00,00,00,0d,00,00,00,43,00,00,00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults]
"{20D04FE0-3AEA-1069-A2D8-08002B30309D}"=hex:1c,00,00,00,06,00,00,00,00,00,00,\
  00,00,00,9a,00,00,00,00,00,01,00,00,00,00,00,00,00,f0,f0,f0,f0,14,00,03,00,\
  9a,00,00,00,00,00,00,00,30,00,00,00,fd,df,df,fd,0f,00,05,00,24,00,10,00,2e,\
  00,46,00,00,00,00,00,01,00,00,00,02,00,00,00,03,00,00,00,04,00,00,00,78,00,\
  96,00,60,00,60,00,78,00,00,00,00,00,01,00,00,00,02,00,00,00,03,00,00,00,05,\
  00,00,00,ff,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"{F3364BA0-65B9-11CE-A9BA-00AA004AE837}"=hex:1c,00,00,00,04,00,00,00,00,00,00,\
  00,00,00,90,00,00,00,00,00,01,00,00,00,00,00,00,00,f0,f0,f0,f0,14,00,03,00,\
  90,00,00,00,00,00,00,00,30,00,00,00,fd,df,df,fd,0f,00,04,00,20,00,10,00,28,\
  00,3c,00,00,00,00,00,01,00,00,00,02,00,00,00,03,00,00,00,b4,00,60,00,78,00,\
  78,00,00,00,00,00,01,00,00,00,02,00,00,00,03,00,00,00,ff,ff,ff,ff,22,3e,37,\
  3e,99,da,b7,4c,a8,86,75,4e,ae,98,4c,b4,30,f1,25,b7,ef,47,1a,10,a5,f1,02,60,\
  8c,9e,eb,ac,04,00,00,00
  
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{5E6AB780-7743-11CF-A12B-00AA004AE837}\Count]
"HRZR_HVGBBYONE"=hex:01,00,00,00,0d,00,00,00,50,ac,71,39,cc,9d,c9,01
"HRZR_HVGBBYONE:0k1,120"=hex:01,00,00,00,0d,00,00,00,50,ac,71,39,cc,9d,c9,01

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{75048700-EF1F-11D0-9888-006097DEACF9}\Count]
"HRZR_HVFPHG"=hex:01,00,00,00,20,00,00,00,a0,44,23,36,cc,9d,c9,01
"HRZR_EHACNGU"=hex:01,00,00,00,2a,00,00,00,60,eb,7c,75,cc,9d,c9,01
"HRZR_EHACNGU:::{20Q04SR0-3NRN-1069-N2Q8-08002O30309Q}"=hex:01,00,00,00,14,00,\
  00,00,a0,44,23,36,cc,9d,c9,01
"HRZR_EHACNGU:P:\\JVAQBJF\\ertrqvg.rkr"=hex:01,00,00,00,0f,00,00,00,50,df,48,\
  34,cc,9d,c9,01

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags]
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags]
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\BagMRU]
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\BagMRU]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"Shellstate"=-

[HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\Bags\1\Shell]
"Mode"=dword:00000004
"ScrollPos1280x1024(1).x"=dword:00000000
"ScrollPos1280x1024(1).y"=dword:00000000
"Sort"=dword:00000002
"SortDir"=dword:00000001
"Col"=dword:00000000
"ColInfo"=hex:00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,fd,df,df,fd,0f,\
  00,04,00,20,00,10,00,28,00,3c,00,00,00,00,00,01,00,00,00,02,00,00,00,03,00,\
  00,00,b4,00,60,00,78,00,78,00,00,00,00,00,01,00,00,00,02,00,00,00,03,00,00,\
  00,ff,ff,ff,ff,22,3e,37,3e,99,da,b7,4c,a8,86,75,4e,ae,98,4c,b4,30,f1,25,b7,\
  ef,47,1a,10,a5,f1,02,60,8c,9e,eb,ac,04,00,00,00
"FolderType"="Documents"

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{7584c670-2274-4efb-b00b-d6aaba6d3850}]
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{4eb89ff4-7f78-4a0f-8b8d-2bf02e94e4b2}]
[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Ext\Settings\{7390f3d8-0439-4c05-91e3-cf5cb290c3d0}]
```
And here is the vb.net code I use to run this registry file:

```
Imports Microsoft.win32                   'Registry Functions
Imports System.Runtime.InteropServices    'API functions

Public Class Form1
    Declare Auto Function SendNotifyMessage Lib "User32" (ByVal hWnd As Integer, ByVal Msg As UInt32, ByVal wParam As Integer, ByVal lParam As Integer) As Long
    Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Int32, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Object) As Int32
    Declare Function SendMessageTimeout Lib "user32" Alias "SendMessageTimeoutA" (ByVal hwnd As Int32, ByVal msg As Int32, ByVal wParam As Int32, ByVal lParam As String, ByVal fuFlags As Int32, ByVal uTimeout As Int32, ByVal lpdwResult As Int32) As Int32

    Private Const WM_WININICHANGE = &H1A       'INI File Update
    Private Const HWND_BROADCAST = &HFFFF&    'Send To All
    Private Const WM_SETTINGCHANGE = &H1A       'Setting Change
    Private Const SMTO_ABORTIFHUNG = &H2        'Stop If Hang
    Private Const WM_COMMAND As Int32 = &H111      'Send Command
    Private Const WM_USER As Int32 = &H400      'User
    Private Const WM_SETTEXT = &HC        'Change Text
    Private Const WM_GETTEXT = &HD        'Get Text

    Private Sub Form1_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'For Each a As Process In Process.GetProcesses()
        '    Try
        '        If a.ProcessName.StartsWith("explorer") Then
        '            a.Kill()
        '        End If
        '    Catch ex As Exception
        '
        '    End Try
        'Next

        'Launch our registry changes
        Dim Proc As Process = Process.Start("regedit.exe", "/S H:\explorer.reg")
        Do Until Proc.WaitForExit(1000)
            Application.DoEvents()
            System.Threading.Thread.Sleep(250)
        Loop
        Proc.Close()

        ' Refresh Explorer
        Dim EnvResult As IntPtr    'Result
        SendNotifyMessage(HWND_BROADCAST, Convert.ToUInt32(WM_SETTINGCHANGE), 0, 0)
        SendMessageTimeout(HWND_BROADCAST, Convert.ToUInt32(WM_SETTINGCHANGE), 0, 0, Convert.ToUInt32(SMTO_ABORTIFHUNG), Convert.ToUInt32(1000), EnvResult) 'Broadcast A Setting Change To All

        'Process.Start("explorer.exe")
        End
    End Sub
End Class
```
What I would like to know basically, first, is there any way to get the statusbar to show on folders using only the registry file. Second, assuming I opened My Computer (or any other explorer window) before running this script, is there any way to force explorer to update properly without killing the process as I have commented out. Apparently, the SendMessage code I have there is supposed to do it for me, and it does indeed do that, but only if I haven't opened any explorer window before the program is finished executing. I decided against the restarting explorer hack because it doesn't work most of the time, and hides many system tray icons.

Before you ask, most of the registry values there were found using Process Monitor. Not 100% positive if everything in that reg file is needed...

Hopefully I explained myself well enough.


----------

