Like many Delphi 3rd party product, new ModelMaker Code Explorer (often abbreviated as MMX) releases have not been as thick as in the heydays (look at the history for versions 7, 8 , 9, 10, 11 and 12).
Unlike a lot of products it is still there, still very stable and hasn’t been acquired which it means it is available for a wide range of Delphi versions. So I still use it, but know certain issues will likely be never solved.
One of these issues is running ModelMaker Code Explorer as a different user than the installing user. In the authors words:
You need to install MMX as the same user that will run MMX.
MMX does not support running as a different user than the one installed.
This requirement becomes increasingly difficult to satisfy. This especially happens in more security conscious organisations where there is a clear distinction in rights between users that can install software and the ones that use the software. But it can also happen when you switch users because of infrastructure changes (new Windows domain, no Windows domain, etc).
Delphi itself copes reasonably well with that, as does GExperts, but MMX doesn’t. Despite the writeup on How to verify a Code Explorer installation? it lacks two things:
- explaining the below kinds of error messages when you run MMX with a different user than you installed MMX
- explaining some easy steps to fix this
As I roam a lot, I’ve spent about a day fiddling and writing up the below information:
Errors that can occur when the running MMX user is not the installing user
Lets start with the errors you can get in various stages of the fixing process
Unable to create ModelMaker Tools Shared Directory
[Window Title] Error [Content]Unable to create ModelMaker Tools Shared Directory: C:\Users\jeroenp\AppData\Roaming\ModelMakerTools\Shared\ [OK]
This is caused by your current user not having rights to the directory of the user that installed ModelMaker Code Explorer.
Note that C:\Users\jeroenp\AppData\Roaming
for my previous user. Better use %APPDATA%
although that’s not even documented.
Embarcadero RAD Studio for Windows has stopped working
followed by
[Window Title] Embarcadero RAD Studio for Windows [Main Instruction] Embarcadero RAD Studio for Windows has stopped working [Content] Windows is checking for a solution to the problem... [Cancel]
Followed by:
[Window Title] Application Error [Content] Exception EFCreateError in module rtl220.bpl at 0010DEBC. Cannot create file "C:\HungarianTypeLookup.txt". Access is denied. [OK]
This has to do with missing registry settings and MMX taking the wrong defaults values.
Updated documentation on MMX registry settings
According to How to verify a Code Explorer installation? you need the below keys and values which I’ve divided by realm and indicated if they were present:
I’ve used these abbreviations:
HKCU
forHKEY_CURRENT_USER
(which isn’t documented any more – the HKCU documentation reference at Predefined Keys has moved to the “retired content”)HKLM
forHKEY_LOCAL_MACHINE
(which isn’t documented any more either – like HKCU, the HKLM documentation has moved to the “retired content”)
Realm | Key Path | Value Names | Exists? | Notes |
---|---|---|---|---|
HKCU |
\Software\ModelMaker\Shared |
RootDir |
Yes | Points to "%APPDATA%\Shared" |
HKCU |
\Software\ModelMaker\Shared\Templates |
Array List Indexer |
Yes | Each point to a quoted file path within a"%APPDATA%\ModelMakerTools\Shared\Templates\" followed by a comma and the kind of Template (always Wizards ) |
HKLM |
\Software\ModelMaker\midex\12.0 |
InstallDir |
Yes | Points to the unquoted directory path where MMX is installed.
Note Note on my system inside the key it’s not |
HKLM |
\SOFTWARE\ModelMaker\Shared |
RootDir |
Yes | Points to "%APPDATA%\Shared" This is wrong as a machine wide key should not point to a user-specific location. The documentation mentions \Software\ but this is in fact \SOFTWARE\ or on an x64 system in \SOFTWARE\Wow6432Node\ On an x64 system it is in \SOFTWARE\Wow6432Node\ModelMaker\Shared |
HKLM |
\Software\ModelMaker\Shared\Templates |
RootDir |
No | The documentation mentions \Software\ but this is in fact \SOFTWARE\ or on an x64 system in \SOFTWARE\Wow6432Node\ |
In addition, these keys not mentioned in the documentation are present on my system:
Realm | Key Path | Value Names | Exists? | Notes |
---|---|---|---|---|
HKCU |
\Software\ModelMaker\MideX\12.0 |
JumpStart |
Yes | Has this value: 1 Note 12.0 is the installed MMX version |
HKCU |
\Software\ModelMaker\MideX\12.0\* |
* |
Yes | Many values in many formats. These are the user settings. Note 12.0 is the installed MMX version |
Fixing the errors: files and registry entries
Based on the above information, I’ve created a few batch files to get a basic setup going. It doesn’t save all registry settings to a file yet (I wish MMX kept user-settings in a file, but back then it was good custom to keep everything in the registry. Now we’re back at configuration files.).
The batch files use these tools:
- junction (from SysInternals) to create NTFS symbolic links to directories without the administrative rights required my mklink.
- reg (built into Windows) for the reg add functionality.
I move between systems a lot, so I even like settings to be in a version control system. I’ve opened up my own settings and a few batch files in this repository: https://github.com/jpluimers/Roaming-ModelMakerTools.
Since I queued this blog post a while ago, the repository might be more up to date. This is even more likely after it got published, to refer to the repository for the latest state of the art.
https://github.com/jpluimers/Roaming-ModelMakerTools/blob/master/create-directory-links.bat
junction "%APPDATA%\ModelMakerTools\Code Explorer" "%HOMEPATH%\Versioned\Roaming-ModelMakerTools\Code Explorer" junction "%APPDATA%\ModelMakerTools\Shared" "%HOMEPATH%\Versioned\Roaming-ModelMakerTools\Shared"
I keep all of my version control based stuff under "%HOMEPATH%\Versioned\"
but may change the batch file so it doesn’t depend on that. Not sure how yet.
There are two junction calls as I might want to put the two directories in different places in the future.
https://github.com/jpluimers/Roaming-ModelMakerTools/blob/master/create-HKCU-keys-and-values.bat
reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared" /v "RootDir" /t REG_SZ /d "%APPDATA%\ModelMakerTools\Shared" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\PredefinedTypes" /v "Object Pascal" /t REG_SZ /d "Integer,LongInt,LongWord,Boolean,Extended,Double,Char,Variant,string,WideString,TRect,TList,TStrings,TStringList" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\PredefinedTypes" /v "C#" /t REG_SZ /d "int,bool,string,char,uint,long,ulong,sbyte,byte,short,ushort,decimal,float,double" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "IUnknown Implementation" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\IUnknown.pas\",Wizards" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "Array Property" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\ArrayProp_List.pas\",Wizards" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "Begin/EndUpdate" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\BeginEndUpdate.pas\",Wizards" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "Singleton" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\Singleton.pas\",Wizards" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "Reference Count" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\ReferenceCount.pas\",Wizards" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "Observer" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\Observer.pas\",Wizards" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "Array List Indexer" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\Indexer.cs\",Wizards" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "BeginUpdate/EndUpdate" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\BeginEndUpdate.cs\",Wizards" /f reg add "HKEY_CURRENT_USER\Software\ModelMaker\Shared\Templates" /v "Simple Singleton" /t REG_SZ /d "\"%APPDATA%\ModelMakerTools\Shared\Templates\Singleton.cs\",Wizards" /f
This forcibly adds the values (overwriting any current values). If you don’t like that, remove the /f
flag at the end.
https://github.com/jpluimers/Roaming-ModelMakerTools/blob/master/create-HKCU-keys-and-values.bat
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\ModelMaker\Shared" /v "RootDir" /t REG_SZ /d "%APPDATA%\ModelMakerTools\Shared" /f
This forcibly adds the values (overwriting any current values) which is required when you move users.
It doesn’t support \SOFTWARE\Wow6432Node\
yet but without it it still seems to work. I will keep an eye on that.
–jeroen
Filed under: Delphi, Development, ModelMaker Code Explorer, Software Development
