home *** CD-ROM | disk | FTP | other *** search
- unit UnitMyKeys;
- {
- Purpose:
- define all registry keys used by ME
-
- Notes:
- There are some util functions that really don't belong here
- or anywhere else
- }
-
- interface
- uses SysUtils, StrUtils;
-
-
-
-
- const SR_SUB_RUN = 'Run';
- const SR_SUB_RUNSORT = 'RunSort';
- const SR_SUB_STARTUPSORT = 'StartupSort';
- const SR_SUB_RUNNEWITEMS = 'RunNewItems';
- const SR_SUB_STARTUPNEW = 'StartupNew';
-
- const SR_STARTRIGHT_VALUE = 'STARTRIGHT';
- const SR_EXCLUDE_DATA = 'EXCLUDE';
- const SR_SORTINDEX_VALUE = 'SortIndex';
-
- const SR_HOME_KEY = '\SOFTWARE\JackassArswareOrg\StartRight';
- const SR_RUN_KEY = SR_HOME_KEY + '\' + SR_SUB_RUN;
- const SR_RUNEXCLUDE_KEY = SR_HOME_KEY +'\RunExclude';
- const SR_RUNSORT_KEY = SR_HOME_KEY + '\' + SR_SUB_RUNSORT;
- const SR_RUNNEWITEMS_KEY = SR_HOME_KEY + '\' + SR_SUB_RUNNEWITEMS;
-
- const SR_STARTUPSORT_KEY = SR_HOME_KEY + '\' + SR_SUB_STARTUPSORT;
- const SR_STARTUPEXCLUDE_KEY = SR_HOME_KEY +'\StartupExclude';
- const SR_STARTUPDISABLE_KEY = SR_HOME_KEY +'\StartupDisable';
- const SR_STARTUPNEW_KEY = SR_HOME_KEY + '\' + SR_SUB_STARTUPNEW;
-
- const SR_RUNDISABLED_KEY = SR_HOME_KEY + '\RunDisabled';
-
- const WINDOWS_APPSPATH_KEY = '\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths';
- const WINDOWS_RUN_KEY = '\SOFTWARE\Microsoft\Windows\CurrentVersion\Run';
-
- function GetEXEPathFromRunValue(value : string) : string;
- function FindExecutableFromRunValue(value : string) : string;
-
- implementation
-
- uses Registry, Windows;
-
- {util function}
- function GetEXEPathFromRunValue(value : string) : string;
- var i : integer;
- begin
- i := pos('.exe', lowercase(value));
- result := '';
-
- if (i > 0) then begin
- result := LeftStr(value, i + 3);
-
- if leftstr(result,1) ='"' then
- result := RightStr(result, length(result) - 1);
- end;
- end;
-
-
-
- function FindExecutableFromRunValue(value : string) : string;
- var r : TRegistry;
- begin
- // extract EXE fullname from 'value'
- // if it doesn't exists, look it up in the registry under "AppsPath"
- // if it still doesn't exist, return an empty string
-
- result := GetEXEPathFromRunValue(value);
- if (result <> '') and
- (not FileExists(result)) then begin
- r := TRegistry.Create();
- r.RootKey := HKEY_LOCAL_MACHINE;
- r.OpenKeyReadOnly(WINDOWS_APPSPATH_KEY + '\' + result);
- result := r.ReadString('');
- if (not FileExists(result)) then begin
- result := '';
- end;
-
- r.free;
- end;
- end;
-
- end.
-