?
Solved

Registry HKLM - Explorer -  "User Shell folders" content damaged by installation; how to fix it?

Posted on 2005-04-21
8
Medium Priority
?
504 Views
Last Modified: 2008-01-09
Registry path in scope: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

Reason: The above registry keys content was deleted after un-installation of a program. How to 'restore'?

Restoring the english Win XP is easy?
But what about a German, French and Korean Win XP versions?

I hope to make a program which automatically can go into the registry and puts some default content no matter the language version of the windows XP.

English content is normally something like
"Common Favorites" = "%ALLUSERSPROFILE%\Favorites"
"Common Documents" = "%ALLUSERSPROFILE%\Documents"

I.e. content in the User Shell Folders key is not very dynamic, so it should be just a matter of finding windows translations of "Favorites" etc. to Korean, German, French etc ???

Note: Restore is not an opetion unfortunately.
Note#2: I have InstallShield 10.5, so maybe I can use this to make a fix?
0
Comment
Question by:lienjohs
  • 5
  • 2
8 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 13835510
The localized names will expand correctly on all XP versions. This e.g. is %ALLUSERSPROFILE% from a German version:

ALLUSERSPROFILE=C:\Dokumente und Einstellungen\All Users
0
 
LVL 16

Expert Comment

by:craylord
ID: 13835594
Just export that registy part from a functional pc and you could push it out by whatever means you prefer. script, user initiated, installshield.

or copy this to a .txt file and rename to .reg and test:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
"Common Desktop"=hex(2):25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,00,\
  50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,44,00,65,00,73,00,6b,\
  00,74,00,6f,00,70,00,00,00
"Common Start Menu"=hex(2):25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,\
  00,50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,53,00,74,00,61,00,\
  72,00,74,00,20,00,4d,00,65,00,6e,00,75,00,00,00
"Common Programs"=hex(2):25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,00,\
  50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,53,00,74,00,61,00,72,\
  00,74,00,20,00,4d,00,65,00,6e,00,75,00,5c,00,50,00,72,00,6f,00,67,00,72,00,\
  61,00,6d,00,73,00,00,00
"Common Startup"=hex(2):25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,00,\
  50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,53,00,74,00,61,00,72,\
  00,74,00,20,00,4d,00,65,00,6e,00,75,00,5c,00,50,00,72,00,6f,00,67,00,72,00,\
  61,00,6d,00,73,00,5c,00,53,00,74,00,61,00,72,00,74,00,75,00,70,00,00,00
"Common AppData"=hex(2):25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,00,\
  50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,41,00,70,00,70,00,6c,\
  00,69,00,63,00,61,00,74,00,69,00,6f,00,6e,00,20,00,44,00,61,00,74,00,61,00,\
  00,00
"Common Templates"=hex(2):25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,\
  00,50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,54,00,65,00,6d,00,\
  70,00,6c,00,61,00,74,00,65,00,73,00,00,00
"Common Favorites"=hex(2):25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,\
  00,50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,46,00,61,00,76,00,\
  6f,00,72,00,69,00,74,00,65,00,73,00,00,00
"Common Documents"=hex(2):25,00,41,00,4c,00,4c,00,55,00,53,00,45,00,52,00,53,\
  00,50,00,52,00,4f,00,46,00,49,00,4c,00,45,00,25,00,5c,00,44,00,6f,00,63,00,\
  75,00,6d,00,65,00,6e,00,74,00,73,00,00,00

0
 

Author Comment

by:lienjohs
ID: 13838158
Thaks for the aswers JKR and CRAYLORD; I need to test this, but still have a important question in mind:
My major concern is that e.g. the "Common Documents" ="%ALLUSERSPROFILE%\Documents" is for the english version of windows. What about the German; is it not something like "%ALLUSERSPROFILE%\Dokumente"?
I.e. it will not work if I put the english exported "User Shell Folders" to a german XP registry, because the directory on the harddisk is "Dokumente" and the registry is set to "Documents"!??

Note: I do not have a german XP - so I cannot look in a german registry regarding "User Shell Folders".
Any body have a German, French ... XP, then please export User Shell Folders under HKLM and post it here!  
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 13838286
>>What about the German; is it not something like "%ALLUSERSPROFILE%\Dokumente"?

Yes, it is. If you are about to write a program, all those paths can be obtained using 'SHGetSpecialFolderPath()' (http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/shgetspecialfolderpath.asp)
0
 

Author Comment

by:lienjohs
ID: 13838692
Tanks JKR,

'SHGetSpecialFolderPath' will return something like "C:\Documents and Settings\All Users\Application Data" for "Common AppData". I need something like "%ALLUSERSPROFILE%\Application Data". I guess I can use the PathUnExpandEnvStrings to get to this result, since all User Shell Folders key data items contains this:)
I am quite new to Shell; has primary been writing code in Delphi 6.0 (and Java).
I hope the Shell functions does not use the registry information, because then the above will not work; Calling SHGetSpecialFolderPath to get the Common AppData will make the shell function try retreiving the value by going to the registry, which is empty due to un-install program which made the damage ; Circle is closed :(
If shell does not fetch information from registry, then 'SHGetSpecialFolderPath'  will work!  
0
 

Author Comment

by:lienjohs
ID: 13860732
I have now tested it.
It works ok on my XP, but on a clean (new) XP Pro without service packs it does not:

SHGetSpecialFolderPath() pointer is nil after the call with CSIDL = CSIDL_COMMON_PROGRAMS.
Calling SHGetFolderPath() instead does neither give any usefull return.
0
 

Author Comment

by:lienjohs
ID: 13861508
JKR got 'Average' above because the desciped solution was not solving the issu 100%
The solution did not, as it state, enable me to get all special folders information in XP. E.g.  CSIDL_COMMON_PROGRAMS did not work.
Else a good hint; so its worth something :)
0
 

Author Comment

by:lienjohs
ID: 13864911
Her is the method I use to retreive the shell-path's (Maybee someone can use this as well):
Coded in Delphi 6.0 Enterprice.

{
 Input:
   CSIDL:  A CSIDL_X value, which uniquely identifies the item
 Throws:
   Thrown if path is not possible to retreive
 Return:
   The path.
 Subject:
   Get the CSIDL no matter if it is a special folder or just a SHFolder.
}
function getShellPath(CSIDL: DWord): string;
const
  //The below value found in www.experts-exchange.com, issue
  // "Solution Title: How to find path to standard Win98 folders?"
  //    Current value for user, verify it exists
  MISSING_SHFOLDER__SHGFP_TYPE_CURRENT = 0;
  MISSING_SHFOLDER__SHGFP_TYPE_DEFAULT = 1; // default value, may not exist
var
  pidl: PItemIDList;
  InFolder: array[0..MAX_PATH] of Char;
  SHresult: HRESULT;
begin
  SHGetSpecialFolderLocation(0, CSIDL, pidl);
  if Assigned(pidl) then
  begin
    SHGetPathFromIDList(PIDL, InFolder);
    Result := InFolder;
  end else
  begin //Try SH folders then
    SHresult := SHGetFolderPath(0, CSIDL, 0,
      MISSING_SHFOLDER__SHGFP_TYPE_CURRENT, InFolder);
    if SHresult = S_OK then
    begin
      Result := InFolder;
    end  else
    begin
      raise Exception.Create(
        'Error (' + IntToStr(SHresult) + '): Path retreival of CSIDL #' +
        IntToStr(CSIDL) + ' failed!');
    end;
  end;
end;
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question