Page 1 of 1

Windows registry problem

Posted: Fri Aug 25, 2006 8:05 pm
by PB&J Lover
I have a problem with my ME registry. If a program queries the environment variables for the Documents Folder it returns this value:
DocumentsFolder: ::{450D8FBA-AD25-11D0-98A8-0800361B1103}
How does one repair this? That value is a CLSID. I'm not sure why it would return that instead of the My Documents path. Anyone know how to correct it?

Thanks :(

Posted: Sat Aug 26, 2006 2:37 pm
by eJan
Try to reregister mydocs.dll > regsvr32 mydocs.dll . "{450D8FBA-AD25-11D0-98A8-0800361B1103}" is correct CLSID for My Documents (You can use it instead of typing its path). Type SET in CMD window to see env. vars. My CLSID reg export:

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}]
"SortOrderIndex"=dword:00000054
"InfoTip"=hex(2):40,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,53,00,48,00,45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,\
  2d,00,32,00,32,00,39,00,31,00,34,00,00,00
"LocalizedString"=hex(2):40,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,53,00,48,00,45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,\
  2c,00,2d,00,39,00,32,00,32,00,37,00,00,00

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\DefaultIcon]
@=hex(2):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,53,00,48,00,\
  45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,32,00,33,\
  00,35,00,00,00

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\InProcServer32]
@=hex(2):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,53,00,48,00,\
  45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,00,00
"ThreadingModel"="Apartment"
"LoadWithoutCOM"=""

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shell]
@="none"

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shell\find]
"SuppressionPolicy"=dword:00000080

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shell\find\command]
@=hex(2):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,45,00,78,00,70,00,6c,00,6f,00,72,00,65,00,72,00,2e,00,65,00,78,00,\
  65,00,00,00

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shell\find\ddeexec]
@="[FindFolder(\"%l\", %I)]"

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shell\find\ddeexec\application]
@="Folders"

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shell\find\ddeexec\topic]
@="AppProperties"

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex]

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\ContextMenuHandlers]

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\ContextMenuHandlers\Offline Files]
@="{750fdf0e-2a26-11d1-a3ea-080036587f03}"

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\PropertySheetHandlers]

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\PropertySheetHandlers\{4a7ded0a-ad25-11d0-98a8-0800361b1103}]
@=""

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\PropertySheetHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]
@=""

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\ShellFolder]
"WantsFORPARSING"=""
"CallForAttributes"=dword:00020040
"HideOnDesktopPerUser"=""
"QueryForOverlay"=""
"Attributes"=dword:f080013d
XP Pro SP2

Posted: Sun Aug 27, 2006 4:20 am
by PB&J Lover
Can you be more specific? I know nothing about working with the registry.

Thanks. 8)

Posted: Sun Aug 27, 2006 4:19 pm
by eJan
To register mydocs.dll: In Start Menu > Run (box) type: regsvr32 mydocs.dll , message box will be displayed with text 'DllRegisterServer in mydocs.dll succeeded.' After reregistering mydocs.dll everything should be restored to its default state. To check Environment Variables: in Command Prompt type: SET

You can try to retrieve 'My Documents' location with this code:

Code: Select all

; Joakim Christiansen: http://www.purebasic.fr/english/viewtopic.php?p=154704#154704

Procedure.s GetSpecialFolderPath(CSIDL.l) 
  Protected Path.s = Space(#MAX_PATH), Library = OpenLibrary(#PB_Any,"shell32.dll") 
  If Library 
   CallFunctionFast(GetFunction(Library,"SHGetSpecialFolderPathA"),0,@Path,CSIDL,0) 
   CloseLibrary(Library) 
  EndIf 
  ProcedureReturn Path 
EndProcedure 

Debug GetSpecialFolderPath(#CSIDL_PERSONAL)
Additional Constants:

Code: Select all

DoubleDutch: http://www.purebasic.fr/english/viewtopic.php?p=79857#79857

#CSIDL_DESKTOP=$00                  ; Windows desktop—virtual folder that is the root of the name space. 
#CSIDL_INTERNET=$01                 ; Virtual folder that represents the Internet. 
#CSIDL_PROGRAMS=$02                 ; File system directory that contains the user's program groups (which are also file system directories). A typical path is C:\Documents and Settings\username\Start Menu\Programs. 
#CSIDL_CONTROLS=$03                 ; Control Panel - virtual folder containing icons for the control panel applications. 
#CSIDL_PRINTERS=$04                 ; Printers folder - virtual folder containing installed printers. 
#CSIDL_PERSONAL=$05                 ; File system directory that serves as a common repository for documents. A typical path is C:\Documents and Settings\username\My Documents. This is different from the My Documents virtual folder in the name space. To access that virtual folder, use the technique described in Managing the File System. 
#CSIDL_FAVORITES=$06                ; File system directory that serves as a common repository for the user's favourite items. A typical path is C:\Documents and Settings\username\Favorites. (Version 6.0. This is equivalent to CSIDL_MYDOCUMENTS) 
#CSIDL_STARTUP=$07                  ; File system directory that corresponds to the user's Startup program group. The system starts these programs whenever any user logs onto Microsoft® Windows NT® or starts Microsoft® Windows® 98. A typical path is C:\Documents and Settings\username\Start Menu\Programs\Startup 
#CSIDL_RECENT=$08                   ; File system directory that contains the user's most recently used documents. A typical path is C:\Documents and Settings\username\Recent. To create a shortcut in this folder, use SHAddToRecentDocs. In addition to creating the shortcut, this function updates the Shell's list of recent documents and adds the shortcut to the Documents submenu of the Start menu. 
#CSIDL_SENDTO=$09                   ; File system directory that contains Send To menu items. A typical path is C:\Documents and Settings\username\SendTo. 
#CSIDL_BITBUCKET=$0a                ; Virtual folder that contains the objects in the user's Recycle Bin. 
#CSIDL_STARTMENU=$0b                ; File system directory that contains Start Menu items. A typical path is C:\Documents and Settings\username\Start Menu. 
#CSIDL_MYDOCUMENTS=$0c              ; Virtual folder that contains the objects in the user's My Documents folder. 
#CSIDL_MYMUSIC=$0d                  ; File system directory that serves as a common repository for music files. A typical path is C:\My Music. 
#CSIDL_MYVIDEO=$0e                  ; File system directory that serves as a common repository for video files. 
#CSIDL_DESKTOPDIRECTORY=$10         ; File system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself). A typical path is C:\Documents and Settings\username\Desktop 
#CSIDL_DRIVES=$11                   ; My Computer - virtual folder containing everything on the local computer: storage devices, printers, and Control Panel. The folder may also contain mapped network drives. 
#CSIDL_NETWORK=$12                  ; Network Neighborhood—virtual folder that represents the root of the network namespace hierarchy. 
#CSIDL_NETHOOD=$13                  ; A file system folder that contains the link objects that can exist in the My Network Places virtual folder. It is not the same as CSIDL_NETWORK, which represents the network namespace root. A typical path is C:\Documents and Settings\username\NetHood. 
#CSIDL_FONTS=$14                    ; Virtual folder that contains fonts. A typical path is C:\WINNT\Fonts. 
#CSIDL_TEMPLATES=$15                ; File system directory that serves as a common repository for document templates. 
#CSIDL_COMMON_STARTMENU=$16         ; File system directory that contains the programs and folders that appear on the Start Menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu. Valid only for Windows NT systems. 
#CSIDL_COMMON_PROGRAMS=$17          ; File system directory that contains the directories for the common program groups that appear in the Start Menu for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs. Valid only for Windows NT systems. 
#CSIDL_COMMON_STARTUP=$18           ; File system directory that contains the programs that appear in the Startup folder for all users. A typical path is C:\Documents and Settings\All Users\Start Menu\Programs\Startup. Valid only for Windows NT systems. 
#CSIDL_COMMON_DESKTOPDIRECTORY=$19  ; File system directory that contains files and folders that appear on the desktop for all users. A typical path is C:\Documents and Settings\All Users\Desktop. Valid only for Windows NT systems. 
#CSIDL_APPDATA=$1a                  ; Version 4.71. File system directory that serves as a common repository for application-specific data. A typical path is C:\Documents and Settings\username\Application Data. This CSIDL is supported by the redistributable ShFolder.dll for systems that do not have the Microsoft® Internet Explorer 4.0 integrated Shell installed. 
#CSIDL_PRINTHOOD=$1b                ; File system directory that contains the link objects that can exist in the Printers virtual folder. A typical path is C:\Documents and Settings\username\PrintHood. 
#CSIDL_LOCAL_APPDATA=$1c            ; Version 5.0. File system directory that serves as a data repository for local (nonroaming) applications. A typical path is C:\Documents and Settings\username\Local Settings\Application Data. 
#CSIDL_ALTSTARTUP=$1d               ; File system directory that corresponds to the user's nonlocalized Startup program group. 
#CSIDL_COMMON_ALTSTARTUP=$1e        ; File system directory that corresponds to the nonlocalized Startup program group for all users. Valid only for Windows NT systems. 
#CSIDL_COMMON_FAVORITES=$1f         ; File system directory that serves as a common repository for all user's favorite items. Valid only for Windows NT systems. 
#CSIDL_INTERNET_CACHE=$20           ; Version 4.72. File system directory that serves as a common repository for temporary Internet files. A typical path is C:\Documents and Settings\username\Temporary Internet Files. 
#CSIDL_COOKIES=$21                  ; File system directory that serves as a common repository for Internet cookies. A typical path is C:\Documents and Settings\username\Cookies. 
#CSIDL_HISTORY=$22                  ; File system directory that serves as a common repository for Internet history items. 
#CSIDL_COMMON_APPDATA=$23           ; Version 5.0. Application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data. 
#CSIDL_WINDOWS=$24                  ; Version 5.0. Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. A typical path is C:\WINNT. 
#CSIDL_SYSTEM=$25                   ; Version 5.0. System folder. A typical path is C:\WINNT\SYSTEM32. 
#CSIDL_PROGRAM_FILES=$26            ; Version 5.0. Program Files folder. A typical path is C:\Program Files. 
#CSIDL_MYPICTURES=$27               ; Version 5.0. My Pictures folder. A typical path is C:\Documents and Settings\username\My Documents\My Pictures. 
#CSIDL_PROFILE=$28                  ; Version 5.0. User's profile folder. 
#CSIDL_SYSTEMX86=$29                ; The x86 system directory on Reduced Instruction Set Computer (RISC) systems. 
#CSIDL_PROGRAM_FILESX86=$2a         ; The x86 Program Files folder on RISC systems. 
#CSIDL_PROGRAM_FILES_COMMON=$2b     ; Version 5.0. A folder for components that are shared across applications. A typical path is C:\Program Files\Common. Valid only for Windows NT and Windows 2000 systems. 
#CSIDL_PROGRAM_FILES_COMMONX86=$2c  ; The x86 Program Files Common folder on RISC systems. 
#CSIDL_COMMON_TEMPLATES=$2d         ; File system directory that contains the templates that are available to all users. A typical path is C:\Documents and Settings\All Users\Templates. Valid only for Windows NT systems. 
#CSIDL_COMMON_DOCUMENTS=$2e         ; File system directory that contains documents that are common to all users. Typical paths are C:\Documents and Settings\All Users\Documents. Valid for Windows NT systems and Windows 95 and Windows 98 systems with Shfolder.dll installed 
#CSIDL_COMMON_ADMINTOOLS=$2f        ; Version 5.0. File system directory that contains administrative tools for all users. 
#CSIDL_ADMINTOOLS=$30               ; Version 5.0. File system directory used to store administrative tools for an individual user. The Microsoft Management Console (MMC) saves customized consoles to this directory, and it roams with the user. 
#CSIDL_CONNECTIONS=$31              ; Virtual folder that contains network and dial-up connections. 
#CSIDL_COMMON_MUSIC=$35             ; Version 6.0. My Music folder for all users. 
#CSIDL_COMMON_PICTURES=$36          ; Version 6.0. My Pictures folder for all users. 
#CSIDL_COMMON_VIDEO=$37             ; Version 6.0. My Video folder for all users. 
#CSIDL_RESOURCES=$38                ; System resource directory. A typical path is C:\WINNT\Resources. 
#CSIDL_RESOURCES_LOCALIZED=$39      ; Localized resource directory. 
#CSIDL_COMMON_OEM_LINKS=$3a         ; Folder containing links to OEM specific applications for all users 
#CSIDL_CDBURN_AREA=$3b              ; Version 6.0. File system folder used to hold data for burning to a CD. Typically [User Profile Folder]\Local Settings\Applications Data\Microsoft\CD Burning. 
#CSIDL_COMPUTERSNEARME=$3d          ; Computers Near Me folder. Virtual folder that contains links to nearby computers on the network. Nearness it is established by common work group membership 
#CSIDL_PROFILES=$3e                 ; Version 6.0. The file system directory containing user profile folders. A typical path is C:\Documents and Settings. 

#CSIDL_FLAG_PER_USER_INIT=$800      ; Combine this flag with the desired CSIDL_ value to indicate per-user initialization. 
#CSIDL_FLAG_NO_ALIAS=$1000          ; Combine this flag with the desired CSIDL_ value to force a non-alias version of the PIDL. 
#CSIDL_FLAG_DONT_VERIFY=$4000       ; Combine this flag with the desired CSIDL_ value to return an unverified folder path. 
#CSIDL_FLAG_CREATE=$8000            ; Version 5.0. Combine this flag with the desired CSIDL_ value to force the creation of the associated folder. 
#CSIDL_FLAG_MASK=$FF00              ; Mask for all possible CSIDL flag values 
Edit: See PB reply below.

Posted: Sun Aug 27, 2006 9:12 pm
by PB
> You can try to retrieve 'My Documents' location with this code [snip]

Two things to note:

(1) #CSIDL_PERSONAL is the constant for the "My Documents" folder.
(2) You don't need to specify all those constants, as PureBasic knows them.

Thus, all you need to do is:

Code: Select all

Procedure.s GetSpecialFolderPath(CSIDL.l)
  Protected Path.s = Space(#MAX_PATH), Library = OpenLibrary(#PB_Any,"shell32.dll")
  If Library
   CallFunctionFast(GetFunction(Library,"SHGetSpecialFolderPathA"),0,@Path,CSIDL,0)
   CloseLibrary(Library)
  EndIf
  ProcedureReturn Path
EndProcedure

Debug GetSpecialFolderPath(#CSIDL_PERSONAL)

Posted: Sun Aug 27, 2006 9:28 pm
by eJan
Thanks PB!