MUSHClient and SQLite

MUSHClient, is a freeware MUD client. Since I wanted to be able to install the software on several systems, but have all of the systems use the same MUSHClient World Information files, which are stored as .MCL files, I wanted to see where the program stored the location for the worlds files. Of course, I could manually change the location within the Global Preferences on each system, but I wanted to see if there was a way I could just put the information in a .reg Windows registry file or set it with a script.

MUSHClient has a registry key for each user on a Windows 7 system at HKEY_CURRENT_USER\Software\Gammon Software Solutions. Beneath that key is HKEY_CURRENT_USER\Software\Gammon Software Solutions\MUSHclient\Global prefs, which contains default locations for directories.

NameTypeData
(Default)REG_SZ(value not set)
DefaultLogFileDirectoryREG_SZ C:\Program Files\MUSHclient\logs\
DefaultWorldFileDirectoryREG_SZ C:\Program Files\MUSHclient\worlds\
PluginsDirectoryREG_SZ C:\Program Files\MUSHclient\worlds\plugins\

If, within MUSHCient, you click on File, then Global Preferences, then click on the Worlds tab, then click on the Default world files directory, you can change the value for the directory where it looks for its world configuration files, which are .MCL, i.e. MUSHClient World Information files.

If you wish, you can specify a shared network location, so that multiple systems can use the same World Information files, e.g. \\MyServer\Shared\MUSHClient\worlds.

MUSHClient Global Preferences

You would think that changing the value for Global Preferences by that method would change the registry keys noted above. However, it does not. Instead, the information is stored in an mushclient_prefs.sqlite file at C:\Users\username\AppData\Local\VirtualStore\Windows\System32\mushclient_prefs.sqlite, where username is the Windows account name under which you are making the change.

When, I noticed that the registry keys remained the same even after I had changed the default location, I discovered that is the file where information was stored by filtering on all events associated with the process name MUSHClient.exe while running Process Monitor, a free utility for process monitoring from Microsoft.

I saw that that the program was opening C:\Users\username\AppData\Local\VirtualStore\Windows\System32\mushclient_prefs.sqlite. I looked at that file with FileAlyzer. When I opened mushclient_prefs.sqlite with that program, clicked on the Hex dump tab and then chose List strings, I saw the DefaultWorldFileDirectory pointing to the shared network location I had selected.

An .sqlite file is a database file. It is created with SQLite, a self-contained, embedded database management system (DBMS). SQLite stores data in tables, which may each contain multiple fields and data types, which can be accessed via SQL commands using any system that supports SQLite.

You can download an sqlite_analyzer.zip file from the SQLite Download Page. Unzip the file and run the .exe file within it from a command line.

C:\Program Files\Utilities\Database\SQLite>sqlite3_analyzer.exe "C:\Users\Jane\AppData\Local\VirtualStore\Windows\System32\mushclient_prefs.sqlite" >mush_client_pres-analysis.txt

You can see the results for this particular case in the output file mush_client_pres-analysis.txt.

You can also view information on the data within the file by downloading the sqlite command line program for accessing and modifying SQLite databases from the same URL. Unzip the contents of the zip file and then run the sqlite3.exe program from a command line. See Command Line Shell For SQLite for commands that you can use within the program.

C:\Program Files\Utilities\Database\SQLite>sqlite3 "C:\Users\Jane\AppData\Local\
VirtualStore\Windows\System32\mushclient_prefs.sqlite"
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

You can view the tables in the database file using the .tables command.

sqlite> .tables
control  prefs    worlds

I can see what the columns are in a table, such as the prefs table using the .schema command.

sqlite> .schema prefs
CREATE TABLE prefs (name VARCHAR(50) NOT NULL PRIMARY KEY, value TEXT NOT NULL )
;

I can see that there is a column titled name and see what entries are in that column with select name from prefs;.

sqlite> select name from prefs;
AllTypingToCommandWindow
AlwaysOnTop
AppendToLogFiles
AutoConnectWorlds
AutoExpandConfig
FlatToolbars
AutoLogWorld
BleedBackground
ColourGradientConfig
ConfirmBeforeClosingMXPdebug
ConfirmBeforeClosingMushclient
ConfirmBeforeClosingWorld
ConfirmBeforeSavingVariables
ConfirmLogFileClose
EnableSpellCheck
AllowLoadingDlls
F1macro
FixedFontForEditing
NotepadWordWrap
NotifyIfCannotConnect
ErrorNotificationToOutputWindow
NotifyOnDisconnect
OpenActivityWindow
OpenWorldsMaximised
WindowTabsStyle
ReconnectOnLinkFailure
RegexpMatchEmpty
ShowGridLinesInListViews
SmoothScrolling
SmootherScrolling
DisableKeyboardMenuActivation
TriggerRemoveCheck
NotepadBackColour
NotepadTextColour
ActivityButtonBarStyle
AsciiArtLayout
DefaultInputFontHeight
DefaultInputFontItalic
DefaultInputFontWeight
DefaultOutputFontHeight
Icon Placement
Tray Icon
ActivityWindowRefreshInterval
ActivityWindowRefreshType
ParenMatchFlags
PrinterFontSize
PrinterLeftMargin
PrinterLinesPerPage
PrinterTopMargin
TimerInterval
FixedPitchFontSize
AsciiArtFont
DefaultAliasesFile
DefaultColoursFile
DefaultInputFont
DefaultLogFileDirectory
DefaultMacrosFile
DefaultOutputFont
DefaultTimersFile
DefaultTriggersFile
DefaultWorldFileDirectory
NotepadQuoteString
PluginList
PluginsDirectory
PrinterFont
TrayIconFileName
WordDelimiters
WordDelimitersDblClick
WorldList
LuaScript
Locale
FixedPitchFont
sqlite>

I can find the value for DefaultWorldFileDirectory with the command select * from prefs where name='DefaultWorldFileDirectory'; .

sqlite> select * from prefs where name='DefaultWorldFileDirectory';
DefaultWorldFileDirectory|\\MyServer\Shared\MUSHClient\worlds

References:

  1. .SQLITE File Extension
    FileInfo.com
  2. SQLite Home Page
  3. Command Line Shell For SQLite
    SQLite.org
  4. SQL WHERE Clause
    SQL Tutorial
  5. Select (SQL)
    Wikipedia, the free encyclopedia
  6. SQLite Tutorial
    By: Mike Chirico
    Updated: January 11, 2007
    Souptonuts - Repository of Open Source Articles and Example Code

Valid HTML 4.01 Transitional