Bazaar problem with %SystemDrive% / Device Manager

Questions about Update Pack making? Ask here.
Post Reply
StealthMonkey
Posts: 7
Joined: Thu Jul 27, 2006 12:24 am

Bazaar problem with %SystemDrive% / Device Manager

Post by StealthMonkey » Thu Jul 27, 2006 1:13 am

I am having a really weird problem. This problem may not be caused by the Update Pack, but it definitely involves it.

Here is a overview of my problem:
I've made custom XP CDs for over a year now. I've always used the Update Pack and loved it. Recently, I've had a weird problem. I use a registry file to add Device Manger to the right click of My Computer. It now gives an error. It only happens when I integrate the Update Pack. It appears to have something to do with the %SystemDrive% variable.

Here is what I'm using:
Windows XP Pro
Update Pack 2.1.0
RVM Integrator 1.4
nLite 1.0.1

Here is my custom CD creation process:
1. Rip CD
2. Add My %OEM% Folder
3. Remove Components & Apply Patches & Setup Unattended Install (nLite)
4. Integrate WMP 10
5. Integrate Update Pack (Integrator)
6. Create ISO (nLite)

Here are the details:
I have this command within a registry file:

Code: Select all

; Add Device Manager to Right Click Menu of My Computer
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Device Manager\command]
@="mmc.exe %%SYSTEMDRIVE%%\\WINDOWS\\SYSTEM32\\devmgmt.msc"
The registry file executes properly and the key is added. If I look in the registry, the REG_SZ is set to:

Code: Select all

mmc.exe %%SYSTEMDRIVE%%\WINDOWS\SYSTEM32\devmgmt.msc
The device manger link appears on the right click menu of My Computer. If I then select it, I receive the following error:

Code: Select all

MMC cannot open the file %SYSTEMDRIVE%\WINDOWS\SYSTEM32\devmgmt.msc.

This may be because the file does not exist, is not an MMC console, or was created by a later version of MMC. This may also be because you do not have sufficient access rights to the file.
HERE IS THE CATCH: If I change the registry entry to the following, then it works perfectly:

Code: Select all

mmc.exe C:\WINDOWS\SYSTEM32\devmgmt.msc
If I open a command prompt and type "set", it says "SystemDrive=C:"

The mmc.exe file is there. If I open the device manager from the full management console, or from the hardware tab in My Computer properties, then it comes up perfectly.

If I skip step 5 from above (adding the Update Pack), this problem does not occur. This problem is relatively new. I'm doing the same thing with custom CDs that I always have, except I have kept up to version with nLite, Update Pack, and Integrator.

Since I found a work-a-round, this isn't a huge problem in itself, however, I am concerned that if this is messed up, then something else might be.

Ideas?

Thanks in advance.

User avatar
Siginet
Site Admin
Posts: 2894
Joined: Fri May 27, 2005 1:07 pm
Location: Planet Earth
Contact:

Post by Siginet » Thu Jul 27, 2006 2:00 am

What if you change this:
mmc.exe %%SYSTEMDRIVE%%\WINDOWS\SYSTEM32\devmgmt.msc

To This:
mmc.exe %SYSTEMDRIVE%\WINDOWS\SYSTEM32\devmgmt.msc
Image
--Siginet--

Techware
Your Virtual Technician
Computer Management Software

StealthMonkey
Posts: 7
Joined: Thu Jul 27, 2006 12:24 am

Post by StealthMonkey » Thu Jul 27, 2006 2:16 am

I tried that too, it looks like % is an excape character. If I try it with only one % like you said, then it gives this error:

Code: Select all

MMC cannot open the file 10YSTEMDRIVE\WINDOWS\SYSTEM32\devmgmt.msc.

This may be because the file does not exist, is not an MMC console, or was created by a later version of MMC. This may also be because you do not have sufficient access rights to the file.
Remember, this has worked in the past with the same command. The computer I am on right now was installed from a custom CD I made in the past and it works perfectly. The registry entry on my computer is the same as the registry entry in my virtual machine with the problem.

User avatar
Zacam
Moderator
Posts: 615
Joined: Tue Sep 13, 2005 7:46 pm
Location: Portland, OR

Post by Zacam » Thu Jul 27, 2006 2:51 am

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\DevMgr\]
@="&Device Manager"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\DevMgr\command\]
@="mmc.exe %%SystemRoot%%\SYSTEM32\devmgmt.msc"
I've used this since I started using the update packs as an update to the original. I think it's the space in "Device Manager" which I've done away with (since it doesn't really matter what it's called, so long as consistancy is retained). Also note that I'm passing directly to SystemRoot instead of the long way around.

StealthMonkey
Posts: 7
Joined: Thu Jul 27, 2006 12:24 am

Post by StealthMonkey » Thu Jul 27, 2006 3:36 am

Thanks for the reply, but that didn't help. I tried it the way you said, and I get the same result. However it works if I change it to:

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\DevMgr\] 
@="&Device Manager" 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\DevMgr\command\] 
@="mmc.exe C:\SYSTEM32\devmgmt.msc"
Yet again, it doesn't seem to like the system variables.

Also, I add other things to right click (Add/Remove Programs & Services) menu and they both work.

StealthMonkey
Posts: 7
Joined: Thu Jul 27, 2006 12:24 am

Post by StealthMonkey » Thu Jul 27, 2006 3:41 am

UPDATE:
I am trying to narrow this down. Here is the procedure that reproduces the problem for me:

1. Ripped Windows XP SP2 CD To Hard Drive
2. Add OEM Folder
3. Add WINNT.SIF File
4. Integrate Update Pack With Integrator
5. Create ISO With nLite

My OEM folder is simple, it basically executes a registry file. It puts in it Windows/Install Folder and then runs it:

cmdlines.txt

Code: Select all

[COMMANDS]
"installregistry.cmd"
installregistry.cmd

Code: Select all

REGEDIT /S %systemroot%\Install\registry_setup.reg
EXIT
registry_setup.reg

Code: Select all

Windows Registry Editor Version 5.00

; Disable Security Warning Popup when Running Files
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Download]
"CheckExeSignatures"="no"
"RunInvalidSignatures"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments]
"SaveZoneInformation"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Associations]
"LowRiskFileTypes"=".zip;.rar;.nfo;.txt;.exe;.bat;.com;.cmd;.reg;.msi;.htm;.html;.gif;.bmp;.jpg;.avi;.mpg;.mpeg;.mov;.mp3;.m3u;.wav;"

; Disable Anti-Virus Notifications
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Security Center]
"AntiVirusDisableNotify"=dword:00000001

; Disable Search Windows Update for Drivers Prompt
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\DriverSearching]
"DontSearchWindowsUpdate"=dword:00000001
"DontPromptForWindowsUpdate"=dword:00000001

; Disable Internet Explorer Cookie 'Privacy Icon' Prompt
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"PrivDiscUiShown"=dword:00000001

; Set HomePage
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Start Page"="http://www.google.com/ig"

; Enable Status Bar
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"StatusBarWeb"=dword:00000001
"StatusBarOther"=dword:00000001

; Use Smooth Scrolling
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"SmoothScroll"=dword:00000001

; Set Tahoma Font in Notepad
[HKEY_CURRENT_USER\Software\Microsoft\Notepad]
"lfFaceName"="Tahoma"

; Open .nfo Files in Notepad
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.nfo]
"Application"="NOTEPAD.EXE"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.nfo\OpenWithList]
"a"="Explorer.exe"
"MRUList"="ba"
"b"="NOTEPAD.EXE"
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.nfo\OpenWithProgids]
"MSInfo.Document"=hex(0):

; Remove Shared Documents from My Computer
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\DelegateFolders\{59031a47-3f72-44a7-89c5-5595fe6b30ee}]

; Disable Simple File Sharing
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"forceguest"=dword:00000000

; Show Volume Icon in the System Tray
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\SysTray]
"Services"=dword:0000001f

; Show File Extensions (.exe/.bmp etc.)
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"HideFileExt"=dword:00000000

; Force The Control Panel Classic Display Style
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"ForceClassicControlPanel"=dword:00000001

; Set Keyboard Num-Lock to be ON by Default
[HKEY_CURRENT_USER\Control Panel\Keyboard]
"InitialKeyboardIndicators"="2"

; Remove Search Dog Assistant
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CabinetState]
"Use Search Asst"="no"

; Disable ToggleKeys
[HKEY_CURRENT_USER\Control Panel\Accessibility\ToggleKeys]
"Flags"="58"

; Disable FilterKeys
[HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response]
"Flags"="122"

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

; Add Command Prompt Here to Right Click Menu of Folders
[HKEY_CLASSES_ROOT\Directory\shell\Command Prompt Here\command]
@="cmd.exe /k cd %1 "

; Remove Briefcase and Rich-Text-Document from New Menu
[-HKEY_CLASSES_ROOT\.bfc\ShellNew]
[-HKEY_CLASSES_ROOT\.rtf\ShellNew]
[-HKEY_CLASSES_ROOT\.bmp\ShellNew]
[-HKEY_CLASSES_ROOT\.wav\ShellNew]
[-HKEY_CLASSES_ROOT\.zip\CompressedFolder\ShellNew]

; Add Add/Remove Programs to Right Click Menu of My Computer
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Add/Remove Programs\command]
@="control appwiz.cpl"

; Add Device Manager to Right Click Menu of My Computer
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Device Manager\command]
@="mmc.exe %%SYSTEMDRIVE%%\\WINDOWS\\SYSTEM32\\devmgmt.msc"

; Add Services to Right Click Menu of My Computer
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Services]
@=hex(2):53,00,65,00,72,00,76,00,69,00,63,00,65,00,73,00,00,00
"SuppressionPolicy"=dword:4000003c
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Services\command]
@=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,73,00,79,00,73, 00,74,00,65,00,6d,00,33,00,32,00,5c,00,6d,00,6d,00,63,00,2e,00,65,00,78,00, 65,00,20,00,2f,00,73,00,20,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52, 00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00, 32,00,5c,00,73,00,65,00,72,00,76,00,69,00,63,00,65,00,73,00,2e,00,6d,00,73, 00,63,00,20,00,2f,00,73,00,00,00

; Enable Clear Type Font Smoothing for ALL Users
[HKEY_CURRENT_USER\Control Panel\Desktop]
"FontSmoothingType"=dword:00000002

; Disable Desktop Cleanup Wizard
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Desktop\CleanupWiz]
"NoRun"=dword:00000001

; Remove Shotcut To.. Prefix on Desktop Shorcut Names
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"Link"=hex:00,00,00,00

; Disable Highlighting of New Applications in Start Menu
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"Start_NotifyNewApps"=dword:00000000
My WINNT.SIF is pretty straight forward also:

Code: Select all

[Data]
AutomaticUpdates = "No"
Autopartition = 0
MsDosInitiated = 0
UnattendedInstall = "Yes"

[Unattended]
UnattendMode = FullUnattended
UnattendSwitch = "Yes"
OemPreinstall = "Yes"
OemSkipEula = "Yes"
ProgramFilesDir = "D:\Program Files"
CommonProgramFilesDir = "D:\Program Files\Common Files"
FileSystem = *
WaitForReboot = "No"
NoWaitAfterTextMode = 1
NoWaitAfterGUIMode = 1
DriverSigningPolicy = Ignore
NonDriverSigningPolicy = Ignore

[Display]
AutoConfirm = 1

[SetupParams]
SkipMissingFiles = "No"

[GuiUnattended]
EncryptedAdminPassword = "No"
AdminPassword = "XXXXX"
TimeZone = 020
OEMSkipRegional = 1
OemSkipWelcome = 1

[Components]

[UserData]
ProductKey = "XXXXX"
ComputerName = MONK
FullName = "XXXXX"

[RegionalSettings]
Language =  "0409"

[Networking]
InstallDefaultComponents = "Yes"

[Identification]
JoinWorkgroup = "WORKGROUP"
I'm not doing anything weird that I know of. All I know is that if I don't integrate the Update Pack this problem doesn't occur. I'm going to try to narrow this down more tomorrow.

User avatar
RyanVM
Site Admin
Posts: 5190
Joined: Tue Nov 23, 2004 6:03 pm
Location: Pennsylvania
Contact:

Post by RyanVM » Thu Jul 27, 2006 8:35 am

The issue is related to MMC3 and I know people a) have discussed it here before and b) posted a solution that seems to work. See what you can find if you search for a bit.
Get up to $200 off on hosting from the same people who host this website!
http://www.ryanvm.net/forum/viewtopic.php?t=2357

User avatar
RyanVM
Site Admin
Posts: 5190
Joined: Tue Nov 23, 2004 6:03 pm
Location: Pennsylvania
Contact:

Post by RyanVM » Thu Jul 27, 2006 8:38 am

Get up to $200 off on hosting from the same people who host this website!
http://www.ryanvm.net/forum/viewtopic.php?t=2357

marzsyndrome
Posts: 239
Joined: Sun May 28, 2006 6:01 am

Post by marzsyndrome » Thu Jul 27, 2006 8:47 am

You do realise nLite's regtweaks section has an option to enable Device Manager in the M.C. context menu? It works for me.

StealthMonkey
Posts: 7
Joined: Thu Jul 27, 2006 12:24 am

Post by StealthMonkey » Thu Jul 27, 2006 5:22 pm

I can try some of the things you guys suggested when I get home (I'm at work right now), but one thing still remains.

If I installed XP fresh and then use Windows Update to install all of the updates manually, the Device Manager link still works. However, if I use the Update Pack, this error occurs.

It appears that there is a somewhat significant difference between installing the updates manually and using the Update Pack.

It's not like I am doing something a non-standard way (which I might actually be) and then an update from Microsoft breaks it. Installing all of the updates doesn't break it. Just the Update Pack does. :?

User avatar
RyanVM
Site Admin
Posts: 5190
Joined: Tue Nov 23, 2004 6:03 pm
Location: Pennsylvania
Contact:

Post by RyanVM » Thu Jul 27, 2006 5:48 pm

RyanVM wrote:The issue is related to MMC3
Get up to $200 off on hosting from the same people who host this website!
http://www.ryanvm.net/forum/viewtopic.php?t=2357

StealthMonkey
Posts: 7
Joined: Thu Jul 27, 2006 12:24 am

Post by StealthMonkey » Thu Jul 27, 2006 11:19 pm

I was looking for a little more information, but I found it on my own. It is KB907265 (http://support.microsoft.com/kb/907265/en-us) that updates MMC and causes the problem. GJ Microsoft. That was added in Update Pack 2.0.2. I didn't really realize that Update Pack includes updates that don't appear on Windows Update.

User avatar
mionica
Posts: 30
Joined: Sat Mar 11, 2006 8:35 am
Location: Timisoara TM, RO
Contact:

You need REG_EXPAND_SZ

Post by mionica » Fri Jul 28, 2006 9:46 am

For %var%s to be guaranteed to work in file paths/names, the registry key must be of type REG_EXPAND_SZ instead of REG_SZ.

These show in .reg's as hex(2), for example, a REG_EXPAND_SZ value named "asd" with a value of "qwe" would show like
"asd"=hex(2):71,77,65,00
while a REG_SZ value with same name and value would show as
"asd"="qwe"

Note the ending [,00]; this is required, since all ASCIIZ values must end with a null.

The easiest way to solve your problem would be to add that value as an expandable string value using regedit, exporting the result, and copy-pasting it into your .reg.

WARNING. REG_EXPAND_SZ's are UNICODE not ASCII, therefore what you get by exporting is heavily dependent upon the export format; if your .reg is in the Windows 4 format (9x/NT4 - ASCII), you need to export using the ASCII .reg format; and if your .reg is in the Windows 5 format (UNICODE), you need to export using the default .reg format.

The diference is obvious:
1. The actual binary representation of the string (in the registry) is 71,00,77,00,65,00,00,00 - it is UNICODE;
2. If you would have the .reg file in NT5 format, and you had a line like "asd"=hex(2):71,77,65,00 in your .reg, you'd get
two characters (the characters with the codes 0x7771 and 0x0065), and no terminator - which can eventualy break some registry tools
3. If you would have the .reg file in NT4 format, and you had a line like "asd"=hex(2):71,00,77,00,65,00,00,00 in your .reg, you'd get
seven characters; but because 00 is the terminator, only one (q = 0x71) would be read by any tool (including RegEdit).
So, don't mix the formats!
Mircea Horea IONICA
mionica@as.ro
+40 (0)766 694495

User avatar
mionica
Posts: 30
Joined: Sat Mar 11, 2006 8:35 am
Location: Timisoara TM, RO
Contact:

Post by mionica » Fri Jul 28, 2006 9:53 am

On your exact situation: consider the following (from your .reg)
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Device Manager\command]
@="mmc.exe %%SYSTEMDRIVE%%\\WINDOWS\\SYSTEM32\\devmgmt.msc"

[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Services\command]
@=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,73,00,79,00,73, 00,74,00,65,00,6d,00,33,00,32,00,5c,00,6d,00,6d,00,63,00,2e,00,65,00,78,00, 65,00,20,00,2f,00,73,00,20,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52, 00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00, 32,00,5c,00,73,00,65,00,72,00,76,00,69,00,63,00,65,00,73,00,2e,00,6d,00,73, 00,63,00,20,00,2f,00,73,00,00,00
The second spells as "%windir%\system32\mmc.exe /s %SystemRoot%\system32\services.msc /s" - but it's an REG_EXPAND_SZ not an REG_SZ.

SO. What you need, is to replace the first thingie with
[HKEY_CLASSES_ROOT\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Device Manager\command]
@=hex(2):6d,00,6d,00,63,00,2e,00,65,00,78,00,65,00,20,00,25,00,53,00,59,00,53,\
00,54,00,45,00,4d,00,44,00,52,00,49,00,56,00,45,00,25,00,5c,00,57,00,49,00,\
4e,00,44,00,4f,00,57,00,53,00,5c,00,53,00,59,00,53,00,54,00,45,00,4d,00,33,\
00,32,00,5c,00,64,00,65,00,76,00,6d,00,67,00,6d,00,74,00,2e,00,6d,00,73,00,\
63,00,00,00
Mircea Horea IONICA
mionica@as.ro
+40 (0)766 694495

StealthMonkey
Posts: 7
Joined: Thu Jul 27, 2006 12:24 am

Post by StealthMonkey » Fri Jul 28, 2006 7:14 pm

Thanks for the details!

Post Reply