spiegel-keyman/windows/src/desktop/setup/RegistryHelpers.pas
Marc Durdin b65b982584 Keyman Desktop and Keyman Developer open source 10.0 alpha seed (#121)
* Keyman for Windows 10.0 Open Source

* Squashed 'windows/src/ext/jedi/jedi/' content from commit f444ad2

git-subtree-dir: windows/src/ext/jedi/jedi
git-subtree-split: f444ad2da4693851e523f1ea6bd541f701904c24

* Squashed 'windows/src/ext/jedi/jcl/' content from commit d63d3c9fd

git-subtree-dir: windows/src/ext/jedi/jcl
git-subtree-split: d63d3c9fd9ff84efdd8159084ec6a60313644243

* Squashed 'windows/src/ext/jedi/jvcl/' content from commit bee19f3b4

git-subtree-dir: windows/src/ext/jedi/jvcl
git-subtree-split: bee19f3b46909fde2fa92c06cd2706f41d99f6c3

* Add required .res files

* Add required .res files

* Add docbook files (forced)

* Add required libxslt

* Add required jedi files

* Add installation files

* Tweak .gitignore for open

* CI

* Remove KMW from Developer source (#122)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Remove KMW from Developer source (copies during build)

* Fixup release build and copy license, readme from kmw during build

* Remove obsolete build help documentation

* Keyman Engine 10 on Windows regression for shift states (#129)

* Improve #128 -- cleaner debug messages

* Fixes #127, shift state now resets correctly; and more work for #128

* Fixes #130 (#131)
2017-07-25 10:53:06 +07:00

65 lines
1.6 KiB
ObjectPascal

(*
Name: RegistryHelpers
Copyright: Copyright (C) 2003-2017 SIL International.
Documentation:
Description:
Create Date: 22 Feb 2011
Modified Date: 3 May 2011
Authors: mcdurdin
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
History: 22 Feb 2011 - mcdurdin - I2749 - Audit all uses of TRegistry, TTntRegistry and replace with TShellUserRegistry where appropriate
03 May 2011 - mcdurdin - I2890 - Record diagnostic data when encountering registry errors
*)
unit RegistryHelpers;
interface
uses
ShellUserRegistry,
ErrorControlledRegistry;
function CreateHKCURegistry: TRegistryErrorControlled; // I2890
function CreateHKLMRegistry: TRegistryErrorControlled; // I2890
implementation
uses
Windows,
SysUtils,
RunTools;
var
ShellUserRegistryFailed: Boolean = False;
function CreateHKCURegistry: TRegistryErrorControlled; // I2890
begin
if ShellUserRegistryFailed then
Result := TRegistryErrorControlled.Create // I2890
else
begin
try
Result := TShellUserRegistry.Create;
except
on E:EOSError do
begin
ShellUserRegistryFailed := True;
GetRunTools.LogError('Could not access the shell user registry; will be accessing Administrator user registry for remainder of setup', False);
Result := TRegistryErrorControlled.Create; // I2890
end;
end;
end;
end;
function CreateHKLMRegistry: TRegistryErrorControlled; // I2890
begin
Result := TRegistryErrorControlled.Create; // I2890
Result.RootKey := HKEY_LOCAL_MACHINE;
end;
end.