Introduce 64bit builds and 32/64 bit mixed installer

This commit is contained in:
Ansgar Becker
2013-11-13 05:38:44 +00:00
parent 992ac90012
commit 59dbff06a2
18 changed files with 204 additions and 116 deletions

View File

@ -320,6 +320,7 @@ type
function GetOutputFilenamePlaceholders: TStringList;
function GetSystemImageList: TImageList;
function GetSystemImageIndex(Filename: String): Integer;
function GetExecutableBits: Byte;
var
@ -2631,6 +2632,45 @@ begin
end;
function GetExecutableBits: Byte;
const
kb32 = 1024 * 32;
var
ExeFilename: String;
Buffer: Array[0..kb32-1] of Byte; // warning: assuming both headers are in there!
hFile: DWord;
bRead: DWord;
bToRead: DWord;
pDos: PImageDosHeader;
pNt: PImageNtHeaders;
begin
Result := 32;
ExeFilename := ParamStr(0);
hFile := CreateFile(pChar(ExeFilename), GENERIC_READ, FILE_SHARE_READ, NIL, OPEN_EXISTING, 0, 0);
if hFile <> INVALID_HANDLE_VALUE then try
bToRead := GetFileSize(hFile, NIL);
if bToRead > kb32 then
bToRead := kb32;
if not ReadFile(hFile, Buffer, bToRead, bRead, NIL) then
Exit;
if bRead = bToRead then begin
pDos := @Buffer[0];
if pDos.e_magic = IMAGE_DOS_SIGNATURE then begin
pNt := PImageNtHeaders(LongInt(pDos) + pDos._lfanew);
if pNt.Signature = IMAGE_NT_SIGNATURE then begin
if pNt.FileHeader.Machine and IMAGE_FILE_32BIT_MACHINE > 0 then
Result := 32
else
Result := 64
end;
end;
end;
finally
CloseHandle(hFile);
end;
end;

View File

@ -117,7 +117,7 @@ begin
// Prepare download
CheckfileDownload := THttpDownload.Create(Self);
CheckfileDownload.TimeOut := 5;
CheckfileDownload.URL := APPDOMAIN+'updatecheck.php?r='+IntToStr(Mainform.AppVerRevision)+'&t='+DateTimeToStr(Now);
CheckfileDownload.URL := APPDOMAIN+'updatecheck.php?r='+IntToStr(Mainform.AppVerRevision)+'&bits='+IntToStr(GetExecutableBits)+'&t='+DateTimeToStr(Now);
CheckFilename := GetTempDir + APPNAME + '_updatecheck.ini';
// Download the check file