2011-03-28 6 views
0

Je suis en train d'ajouter mon jeu à GE avec InnoSetup, j'utilise ce script (uniquement le code): ProcédureInno Setup et Game Explorer (GAMEUX)

[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 '[email protected]:GameuxInstallHelper.dll stdcall setuponly'; 
function AddToGameExplorer(Binary: String; Path: String; InstallType: Integer; var GUID: TGUID): Cardinal; external '[email protected]:GameuxInstallHelper.dll stdcall setuponly'; 
function CreateTask(InstallType: Integer; var GUID: TGUID; TaskType: Integer; TaskNumber: Integer; TaskName: String; Binary: String; Parameters: String): Cardinal; external '[email protected]:GameuxInstallHelper.dll stdcall setuponly'; 
function RetrieveGUIDForApplication(Binary: String; var GUID: TGUID): Cardinal; external '[email protected]{app}\installer\GameuxInstallHelper.dll stdcall uninstallonly'; 
function RemoveFromGameExplorer(var GUID: TGUID): Cardinal; external '[email protected]{app}\installer\GameuxInstallHelper.dll stdcall uninstallonly'; 
function RemoveTasks(var GUID: TGUID): Cardinal; external '[email protected]{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; 

Mais le "win7fix" n » t travail. Ceci pour Windows 7 parce que si je crée mon propre fichier DLL de définition GDF, il n'est pas signé et l'explorateur de jeu ne montre pas certaines informations telles que Rating. Mais si je modifie la clé de registre "issigned" manuellement de 0 à 1 cela s'affiche. Comment puis-je modifier inno cette entrée (dword) pour le guid généré?

+0

_doesn't ne marche pas_ une bonne description du problème que vous avez, s'il vous plaît élaborer et répondre à ceci: êtes-vous sûr que la fonction est appelée? avez-vous une erreur? sinon, dans lequel des ifs la fonction ne fonctionne-t-elle pas? – jachguate

+0

Oui, il ajoute à GE, mais le registre n'a pas changé. Je ne sais pas si la procédure est correcte, j'ai juste besoin d'aide pour faire une procédure correcte "win7fix" qui peut écrire dans le registre et éditer la valeur IsSigned pour le jeu guid. – user680108

+0

@user Savez-vous que vous pouvez déboguer des scripts iss dans le programme de compilation d'inno setup (gui) ?. Si la routine ne fonctionne pas, vous pouvez placer un point d'arrêt sur la ligne de départ et l'exécuter pas à pas à ce moment-là, afin de trouver ce qui ne va pas. – jachguate

Répondre

3

La racine du problème est ce que vous essayez de lire & écrire l'arbre 32 bits de registre sur Win7x64 mais gameuxinstallhelper.dll rédigera info jeu à l'arbre 64 bits. Je utilisé votre code de procédure dans mon projet, la voici:

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;