我正在尝试使用innosetup将我的游戏添加到GE,我正在使用此脚本(仅限代码):
[CODE]
type TGUID = record Data1: Cardinal; Data2, Data3: Word; Data4: array [0..8] of Char; end;
const PlayTask = 0;
SupportTask = 1;
var GameuxGUID: TGUID;
function GenerateGUID(var GUID: TGUID): Cardinal; external 'GenerateGUID@files:GameuxInstallHelper.dll stdcall setuponly';
function AddToGameExplorer(Binary: String; Path: String; InstallType: Integer; var GUID: TGUID): Cardinal; external 'AddToGameExplorerA@files:GameuxInstallHelper.dll stdcall setuponly';
function CreateTask(InstallType: Integer; var GUID: TGUID; TaskType: Integer; TaskNumber: Integer; TaskName: String; Binary: String; Parameters: String): Cardinal; external 'CreateTaskA@files:GameuxInstallHelper.dll stdcall setuponly';
function RetrieveGUIDForApplication(Binary: String; var GUID: TGUID): Cardinal; external 'RetrieveGUIDForApplicationA@{app}\installer\GameuxInstallHelper.dll stdcall uninstallonly';
function RemoveFromGameExplorer(var GUID: TGUID): Cardinal; external 'RemoveFromGameExplorer@{app}\installer\GameuxInstallHelper.dll stdcall uninstallonly';
function RemoveTasks(var GUID: TGUID): Cardinal; external 'RemoveTasks@{app}\installer\GameuxInstallHelper.dll stdcall uninstallonly';
function IntToHex(Int: Cardinal; Digits: Integer): String; var i, Digit: Integer; ch: Byte;
begin
result:='';
for i:=0 to Digits-1 do
begin
digit:=Int mod 16;
Int:=Int div 16;
if digit<0 then
digit:=digit+16;
ch:=Ord('0')+digit;
if digit>9 then
ch:=ch+7;
result:=chr(ch)+result;
end;
end;
function GetGUID(GGUID: TGUID): String; var i: Integer;
begin
result:='{'+IntToHex(GGUID.Data1, 8)+'-'+IntToHex(GGUID.Data2, 4)+'-'+IntToHex(GGUID.Data3, 4)+'-'+IntToHex(Ord(GGUID.Data4[0]), 2)+IntToHex(Ord(GGUID.Data4[1]), 2)+'-';
for i:=2 to 7 do result:=result+IntToHex(Ord(GGUID.Data4[i]), 2); result:=result+'}';
end;
procedure GDFInstall(Binary, MainExe: String);
begin
GenerateGUID(GameuxGUID);
AddToGameExplorer(ExpandConstant(Binary), ExpandConstant('{app}'), 3, GameuxGUID);
CreateTask(3, GameuxGUID, PlayTask, 0, 'Play', ExpandConstant(MainExe), '');
end;
**procedure win7fix;**
var regGDF: Cardinal;
begin
if RegQueryDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\GameUX\Games\'+GetGUID(GameuxGUID), 'IsSigned', regGDF) then
if regGDF=0 then
if RegDeleteValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\GameUX\Games\'+GetGUID(GameuxGUID), 'IsSigned') then
RegWriteDWordValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\GameUX\Games\'+GetGUID(GameuxGUID), 'IsSigned', 1);
end;
procedure CurStepChanged(CurStep: TSetupStep);
var Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if (CurStep = ssPostInstall) and Version.NTPlatform and (Version.Major > 5) then begin
GDFInstall('{#GDFBinary}', '{#GDFExe}');
win7fix;
end;
end;
但是“win7fix”程序不起作用。 这对于Windows 7,因为如果我创建自己的GDF定义dll文件,它没有签名,游戏资源管理器不会显示一些信息,如评级。 但是,如果我手动编辑注册表项“issigned”从0到1它显示。 如何使用inno自动编辑生成的guid的这个(dword)条目?
答案 0 :(得分:3)
问题的根源在于您尝试阅读并在Win7x64上写入32位注册表树,但 GameuxInstallHelper.dll 会将游戏信息写入64位树。 我在我的项目中使用了你的程序代码,这里是:
procedure win7fix;
var regGDF: Cardinal;
var GUXPath: string;
begin
GUXPath := 'Software\Microsoft\Windows\CurrentVersion\GameUX\Games\' + GetGUID(GameuxGUID);
if isWin64 then
begin
if RegQueryDWordValue(HKLM64, GUXPath, 'IsSigned', regGDF) then
if regGDF=0 then
if RegDeleteValue(HKLM64, GUXPath, 'IsSigned') then
RegWriteDWordValue(HKLM64, GUXPath, 'IsSigned', 1);
end
else
begin
if RegQueryDWordValue(HKLM, GUXPath, 'IsSigned', regGDF) then
if regGDF=0 then
if RegDeleteValue(HKLM, GUXPath, 'IsSigned') then
RegWriteDWordValue(HKLM, GUXPath, 'IsSigned', 1);
end;
end;