News, links, downloads, tips and tricks on Microsoft Access and related

About Me Search
Name:Alex Dybenko

Location:Moscow, Russia

Tuesday, January 08, 2008

Do you really need to save settings at HKLM?

In Windows 95 time I often used HKEY_LOCAL_MACHINE registry hive to store user data, for example path to backend, user settings. Security was at low level, user management was not really used, user could easy create a new account just logging first time on the PC. And the only permanent storage for data was HKEY_LOCAL_MACHINE. But not now!

Security getting stronger, and with Windows Vista you are not allowed to write to HKEY_LOCAL_MACHINE hive even you are administrator (unless you disable UAC)! The only good place to store user data – is HKEY_CURRENT_USER registry hive. But, as I recently read in newsgroups – developers are still trying to use HKEY_LOCAL_MACHINE. And now it could be dangerous!

Imagine we have Access application with linked tables, and we store path to BE in HKEY_LOCAL_MACHINE (using some dirty hacks). When user gets new FE version and first run it – we read saved path and relink new FE to it. Looks ok? But then network administrator decided to install Active Directory security with roaming user profiles stored on server. And here we get a problem – user could easy use any PC to log in, but he don’t know that last user, logged into that PC, have connected to different BE! And he starts to delete data from real database instead of a test copy, or type new data into archive database. whatever. We are in trouble!

One more dilemma – where to install FE? In corporate environment, terminal services and Window Vista users are not allowed to write to C:\Program Files, so they can’t update FE version using VersionCheck or any other similar program. I think that <$USER>\Local Settings\Application Data folder could be a good place to save FE – VersionCheck will deliver new version to this folder when user start application.

Do you have other suggestions?


Technorati tags: ,


Blogger Garry Robinson said...

Hi Alex
I have used something like this to store in registry, works fine. Uppercase are global constants and sample shows how to save a value in a field


SaveSetting APPLICATIONNAME, FORMSETTINGS, Me.Name & "FieldName", FieldName.Value

Your Blog is coming out in soon in Max Out.

Garry Robinson

12:28 AM  
Blogger Alex Dybenko said...

Thanks Garry, this is what i meant. SaveSetting method also saving under HKCU

9:44 AM  

Post a Comment

<< Home