Jak w temacie. Potrzebuje to rozpoznac bo jak odpalam LOADLIBARY to aplikacja musi byc 32 bitowa, try except nie pomaga bo wywala blad systemowy a nie programu.
0
0
Kiedys cos uzylem
unit Is16;
interface
uses Windows, Dialogs;
Type
POLDEXE = ^OLDEXE;
OLDEXE = Record
wFileSignature : WORD; { 0x5A4D }
wLengthMod512 : WORD; { bytes on last page }
wLength : WORD; { 512 byte pages }
wRelocationTableItems : WORD;
wHeaderSize : WORD; { Paragraphs }
wMinAbove : WORD; { Paragraphs }
wDesiredAbove : WORD; { Paragraphs }
wStackDisplacement : WORD; { Paragraphs }
wSP : WORD; { On entry }
wCheckSum : WORD;
wIP : WORD; { On entry }
wCodeDisplacement : WORD; { Paragraphs }
wFirstRelocationItem : WORD; { Offset from beginning }
wOverlayNumber : WORD;
wReserved : array [0..15] of WORD;
lNewExeOffset : LongInt;
end;
Const OLDSIG = $5a4d; {MZ}
Const NEWSIG = $454e; {NE}
Const NTSIG = $4550; {PE}
function Is16Bit(const AFileName: string):Boolean;
implementation
uses Classes, SysUtils;
function Is16Bit(const AFileName: string):Boolean;
Var
OE:OLDEXE;
Rf : TFileStream;
X:array[0..1] of Char;
begin
Result := False;
FillChar(OE,SizeOf(OE),0);
Rf := TFileStream.Create(AFileName,fmOpenRead or fmShareExclusive);
Try
Rf.Read(OE,SizeOf(OE));
if OE.wFileSignature = OLDSIG then
begin
Rf.Position := OE.lNewExeOffset;
Rf.Read(X,SizeOf(X));
if (X[0] = 'N') and (X[1] = 'E') then Result := True;
end;
Finally
Rf.Free;
end;
end;
end.
0
Wielkie dzieki, skrypt dziala [rotfl]
0
reichel napisał(a)
Const OLDSIG = $5a4d; {MZ}
Const NEWSIG = $454e; {NE}
Const NTSIG = $4550; {PE}
Małe sprostowanie. Sygnatura Portable Executable to PE\0\0 a nie PE ;-)
0
Zgadza sie, ale dla prostoty - tak latwiej :-P
Naturalnie nie jest to Profesjonalizm
.