useUACPaths
Indicates whether or not dBASE or a dBASE application should create and maintain private copies of various files and folders for each user according to Window's User Account Control (UAC) rules.
Property of
_app object
Background - What is UAC (User Account Controls)
Starting with Vista (and subsequently Windows 7) Microsoft implemented the User Account Controls security component. UAC was implemented to make sure applications adhere to certain conventions to make it easier for Windows to prevent program files from being modified or corrupted - whether by user error or by malicious users or by viruses.
Window's UAC rules are intended to:
- Protect installed program files from being modified or damaged by users or programs that should not have access to them.
- Keep each user's files, configuration settings, etc. separate from other users except where shared files or settings are needed.
- Restrict access to any machine wide settings to the maximum extent possible. By default, only users with Administrator privileges have access to machine wide settings.
Windows Vista and Windows 7 implement these rules by carefully limiting default permissions on folders under the Program Files folder tree, the ProgramData folder tree, the Windows folder tree, and the Users folder tree.
Permissions to registry keys are also carefully limited so that standard users will not be allowed to modify any settings that can affect other users.
In order to follow UAC rules a program must:
- place executable code under the Program Files folder tree and NOT attempt to modify or create any new files under this folder tree while running the program. (Standard users generally have read and execute permissions to files under this folder tree. However, programs may be configured to require administrator privileges which would prevent standard users from running them).
- place shared configuration and data files under the ProgramData folder tree - but NOT attempt to modify or create any new files under this folder tree while running the program. (By default, standard users have readonly access to this folder tree).
- place master copies of files needed by each user under the ProgramData folder tree (to be copied to each user's private folder tree).
- setup a private folder tree under the Users folder tree for each user when a user first runs the program so that each user can modify their private files however they wish without interferring with other users.
What does this mean for dBASE Plus
the _app.useUACPaths property gives dBASE Plus the ability to adhere to the Vista and Windows 7 conventions with regard to:
- The location where dBASE Plus creates and stores its .ini files (containing user settings)
- The location where Source and BDE Aliases are pointing
- The location where dBASE Plus creates and stores samples files.
- Where dBASE instructs the BDE to create its temporary files and the default path for the default session at dBASE startup.
During startup, dBASE and dBASE applications will determine the setting for useUACPaths (as described below) and then check useUACpaths to determine the location for various files and folders mentioned above.
When useUACPaths = False, dBASE will NOT use UAC folders and all locations for .ini files, conversion utilities, include files and various sample files are set to subdirectories under the root dBASE directory.
When useUACPaths = True, dBASE will set the locations for .ini files, conversion utilities, include files, various sample files, and temporary files to folders within the current user's private folder tree as required by Window's UAC rules. dBASE determines the path for the user's private folder tree by retrieving the following Window's special folder paths: CSIDL_LOCAL_APPDATA and CSIDL_APPDATA.
How is _app.useUACPaths determined.
when opening Plus.exe or an application (which uses Plusrun.exe) the _app.useUACPaths property is determined in the following manner:
During startup of plus.exe:
- Checks if registry key HKEY_LOCAL_MACHINE\SOFTWARE\dBASE\PLUS\series1\useUACPaths exists and is set to "y" or "Y".
If yes,
Sets _app.useUACPaths to TRUE
Otherwise,
Sets _app.useUACPaths to FALSE
- Next, checks if -v switch was passed to plus.exe on the command line which would override default setting above.
If yes,
If -v1 (or -V1) found on command line,
Sets _app.useUACPaths to TRUE
If -v0 (or -V0) found on command line,
Sets _app.useUACPaths to FALSE
In summary for plus.exe:
If a useUACPaths registry key exists for dBASE Plus, it sets the default for _app.useUACPaths. If this key does NOT exist, _app.useUACPaths is defaulted to FALSE.
If a -v switch is passed on the command line, it will override the default set above.
During startup of plusrun.exe
- Check if registry key HKEY_LOCAL_MACHINE\SOFTWARE\dBASE\PLUS\series1\useUACPaths exists and is set to "y" or "Y".
If yes,
Sets _app.useUACPaths to TRUE
Otherwise,
Sets
_app.useUACPaths to FALSE
- Next, checks if -v switch was passed to plusrun.exe (or an application .exe) on the command line which would override default setting above.
If yes,
If -v1 (or -V1) found on command line,
Sets _app.useUACPaths to TRUE
If -v0 (or -V0) found on command line,
Sets _app.useUACPaths to FALSE
- If no -v switch was passed via command line plusrun.exe checks the registry for an application specific registry key specifying the setting for useUACPaths:
HKEY_LOCAL_MACHINE\SOFTWARE\dBASE\PLUS\RuntimeApps\<app file name>\useUACPaths
If this key is found, it overrides the default setting via the above dBASE\PLUS\series1 registry key
If its set to y or Y
Sets _app.useUACPaths to TRUE
If its set to n or N
Sets _app.useUACPaths to FALSE
- If no -v switch was passed via the command line AND no RuntimeApps registry key setting was found for the application, then the application .exe is checked to see if has an embedded setting to set _app.useUACPaths to TRUE.
If an embedded UAC flag is found
Sets _app.useUACPaths to TRUE
In summary for an application .exe:
If a useUACPaths registry key exists for dBASE Plus, its
used to set the default for app.useUACPaths.
If this key does NOT exist, _app.useUACPaths is defaulted to FALSE.
If an application .exe is built with an embedded UAC setting, the embedded setting will override the global default set for dBASE Plus above.
If an application specific registry key exists, its setting will override the dBASE Plus registry key setting and the embedded UAC setting in the application .exe (if one exists).
If a -v switch is passed on the command line, it will override all of the above settings.
Folders and files affected by _app.useUACPaths
During startup, dBASE PLUS or dBASE PLUS Runtime checks _app.useUACPaths for the following items:
INI file: Determines default location for plus.ini or an application .ini file
When useUACPaths is true the dBASE Plus plus.ini or an application .ini file will load from a user's local folder tree rather than from the same folder as plus.exe or an application .exe was launched.
First Plus.exe or plusrun.exe will ensure that the following folders exist and create them if they do not yet exist:
For PLUS.EXE:
<CSIDL_LOCAL_APPDATA>\<dBASE Plus subpath>
<CSIDL_APPDATA>\<dBASE Plus subpath>
For an application .exe:
<CSIDL_LOCAL_APPDATA>\<application launch subpath>
<CSIDL_APPDATA>\<application launch subpath>
The <... subpath> For Both dBASE PLUS IDE and a dBASE Plus Application are evaluated as follows...
If the launch path contains either "\Program Files" or "\Program Files (x86)", the launch subpath is set to the portion of the launch path remaining, once the portion containing the "\Program Files" or "\Program Files (x86)" folder is removed.
For Example:
If dBASE plus is installed in folder:
C:\Program Files\dBASE\Plus
the <dBASE Plus subpath> will be set to:
\dBASE\Plus
If an application .exe is installed in folder:
C:\Program Files\YourCompany\YourApp
the <application launch subpath> will be set to:
\YourCompany\YourApp
If the launch path does NOT contain "\Program Files" or "Program Files (x86)", then the <.... subpath> is set to the path remaining after removing the drive letter and colon or removing the top level UNC path from the launch path.
For Example:
If dBASE Plus is launched from:
C:\dBASE\PLUS
The <application launch subpath> is set to:
\dBASE\PLUS
An application built by dBASE Plus is launched from:
\\YourUNCPath\YourCompany\YourApp
The <application launch subpath> is set to:
\YourCompany\YourApp
Next plus.exe or plusrun.exe will ensure an .ini file is loaded as follows:
Check for ini file in a path passed via -C command line switch
If found, load .ini from this path
If not found,
Check for .ini in <CSIDL_LOCAL_APPDATA>\<.... subpath>[\Bin](for dBASE Plus.ini)
If not found,
Check for .ini in <CSIDL_COMMON_APPDATA>\<.... subpath>[\Bin](for dBASE Plus.ini)
if found, copy to <CSIDL_LOCAL_APPDATA>\<.... subpath>[\Bin](for dBASE Plus.ini)
if not found,
Check for .ini in Exe launch path
If found, copy to <CSIDL_LOCAL_APPDATA>\<.... subpath>[\Bin](for dBASE Plus.ini)
If not found,
Create new plus.ini file in:
<CSIDL_LOCAL_APPDATA>\<.... subpath>[\Bin](for dBASE Plus.ini)
The open .ini is now located in <CSIDL_LOCAL_APPDATA>\<.... subpath>[\Bin](for dBASE Plus.ini)
(NOTE: if useUACPaths is false the ini file is saved in the same location as the Plus.exe or application's exe)
Startup
and User files: on Startup dBASE determines whether or not this
is the first time a user has launched dBASE Plus. If so a new utility
(:dBStartup:InitNewUser.pro) is called to setup the new user.
In dBASE Plus, InitNewUser.pro will create private copies of the various
converter and sample folders as follows:
Converters
dBLClasses
dQuerySamples
Include
Media
Samples
Web
In a dBASE application, a custom InitNewUser.pro can be used to perform custom setup tasks for a new user.
(NOTE: if useUACPaths is false this entire step is skipped since no user files need to be created and these folders were installed under the root dBASE folder such as C:\Program Files\dBASE\PLUS)
Source Aliases: dBASE Sets Source Alias paths to match the private locations for the following Source Aliases:
DOS5Conv
Examples
FormControls
Forms
Images
Movies
Nonvisual
Output
ReportControls
Reports
Samples
Toolbars
Webwizards
(NOTE: if useUACPaths is false the source aliases are set to the non-UAC location for these files under the root dBASE folder such as C:\Program Files\dBASE\PLUS)
BDE Aliases: Determines the BDE paths matching the private locations for the following aliases and creates User Aliases in the user's Plus.ini file pointing to the user's sample folders:
dBASESamples
dQuerySamples
dBASEContax
dBASESignup
dBASETemp
dQueryTemp
See the INI topic for more information on User BDE Aliases.
(NOTE: if useUACPaths is false permanent BDE Aliases are created in the IDAPI.CFG file and set to the non-UAC location for these files under the root dBASE folder. e.x.: C:\Program Files\dBASE\PLUS\Samples)
dQuery: Used by dQuery to determine the location of:
dquery.ini
dquery temporary files
My DataModules folder
Default Location for generated code and project files
(NOTE: if useUACPaths is false the MyDatamodules folder can be found under the root dBASE folder such as. C:\Program Files\dBASE)
(NOTE: if useUACPaths is false the dQuery ini file can be found under in the same location as the dQuery.exe such as C:\Program Files\dBASE\PLUS\BIN\dBLCore\dQuery)
Project Explorer: Used by Project Explorer to determine the location of:
projexp.ini
Project Explorer temporary files
(NOTE: if useUACPaths is false the projexp.ini file can be found under in the Project Explorer root folder such as C:\Program Files\dBASE\PLUS\BIN\dBLCore\ProjExp)