いいえ、Inno Setupはこれをサポートしていません。
しかし、Pascal Scriptingから呼び出すのはそれほど難しいことではありません。
HKEY_LOCAL_MACHINE
をHKEY_CURRENT_USER
にリダイレクトするのに、RegOverridePredefKey
を使用することはできませんが、ご注意ください。
hNewHKey:...開いているレジストリキーへのハンドルです。このハンドルは、RegCreateKeyEx
またはRegOpenKeyEx
関数によって返されます。 定義済みのキーの1つにすることはできません。
だから、DLLを登録した後、あなたはHKEY_CURRENT_USER
にサブキーをコピーし、(RegOverridePredefKey
のドキュメントが示すように)それを削除する必要があります。
一時的なサブキーにリダイレクトするための基本コード:
[Files]
Source: "MyDllServer.dll"; Flags: ignoreversion dontcopy
[Code]
const
KEY_WRITE = $20006;
function RegOverridePredefKey(Key: Integer; NewKey: Integer): Integer;
external '[email protected] stdcall';
function RegCreateKeyEx(
Key: Integer; SubKey: string; Reserved: Cardinal; Cls: Cardinal;
Options: Cardinal; Desired: Cardinal; SecurityAttributes: Cardinal;
var KeyResult: Integer; var Disposition: Cardinal): Integer;
external '[email protected] stdcall';
function MyDllRegisterServer: Integer;
external '[email protected]:MyDllServer.dll stdcall delayload';
{ ... }
begin
{ Create a subkey to redirect the HKLM to }
RegCreateKeyEx(HKEY_CURRENT_USER, 'MyProgTemp', 0, 0, 0, KEY_WRITE, 0, NewKey, Unused);
{ Redirect HKLM to the created subkey }
RegOverridePredefKey(HKEY_LOCAL_MACHINE, NewKey);
{ Call DllRegisterServer of the .dll }
MyDllRegisterServer;
{ Now you can copy the subkey to HKCU }
end;
は、いくつかのエラー処理を追加!
コードは、Unicode版のInno Setup用です。
は、コピーの場合、あなたは
Specify the registry uninstall key location/hive via [Code]から私のコードを再利用(および改善)することができます。
あなたは気付いていますか? –
あなたの質問が実際にはわかりません。 Inno Setupに内部的に 'RegOverridePredefKey'を呼び出すビルドインAPI(ディレクティブ、フラグなど)があるかどうかを尋ねていますので、プログラムで自分で呼び出す必要はありませんか? –
@MartinPrikryl良い質問!悪い言葉かもしれない:私は気づいていない。 'regserver'フラグをチェックして、それが何らかの種類のパラメータ/私を助ける別のフラグとペア設定できるかどうか疑問に思っていました。私はドキュメンテーションのすべての関連部分を読んだと思うが、ここで私は何かが欠けていたと思う。 –