mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 15:30:52 +02:00
FpDbg: ifdef all windows specific code
git-svn-id: trunk@42897 -
This commit is contained in:
parent
0c327b42bc
commit
16fc76f1ab
@ -38,8 +38,9 @@ unit FpDbgLoader;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
LCLType,
|
||||||
{$ifdef windows}
|
{$ifdef windows}
|
||||||
Windows,
|
Windows, // After LCLType
|
||||||
{$endif}
|
{$endif}
|
||||||
Classes, SysUtils, FpDbgPETypes;
|
Classes, SysUtils, FpDbgPETypes;
|
||||||
|
|
||||||
@ -216,11 +217,13 @@ end;
|
|||||||
|
|
||||||
constructor TDbgWinPEImageLoader.Create(const AFileName: String);
|
constructor TDbgWinPEImageLoader.Create(const AFileName: String);
|
||||||
begin
|
begin
|
||||||
|
{$ifdef windows}
|
||||||
FFileHandle := CreateFile(PChar(AFileName), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
FFileHandle := CreateFile(PChar(AFileName), GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
if FFileHandle = INVALID_HANDLE_VALUE
|
if FFileHandle = INVALID_HANDLE_VALUE
|
||||||
then begin
|
then begin
|
||||||
WriteLN('Cannot open file: ', AFileName);
|
WriteLN('Cannot open file: ', AFileName);
|
||||||
end;
|
end;
|
||||||
|
{$endif}
|
||||||
inherited Create;
|
inherited Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -236,12 +239,14 @@ end;
|
|||||||
|
|
||||||
procedure TDbgWinPEImageLoader.DoCleanup;
|
procedure TDbgWinPEImageLoader.DoCleanup;
|
||||||
begin
|
begin
|
||||||
|
{$ifdef windows}
|
||||||
if FModulePtr <> nil
|
if FModulePtr <> nil
|
||||||
then UnmapViewOfFile(FModulePtr);
|
then UnmapViewOfFile(FModulePtr);
|
||||||
if FMapHandle <> 0
|
if FMapHandle <> 0
|
||||||
then CloseHandle(FMapHandle);
|
then CloseHandle(FMapHandle);
|
||||||
if FFileHandle <> INVALID_HANDLE_VALUE
|
if FFileHandle <> INVALID_HANDLE_VALUE
|
||||||
then CloseHandle(FFileHandle);
|
then CloseHandle(FFileHandle);
|
||||||
|
{$endif}
|
||||||
|
|
||||||
FFileHandle := INVALID_HANDLE_VALUE;
|
FFileHandle := INVALID_HANDLE_VALUE;
|
||||||
FMapHandle := 0;
|
FMapHandle := 0;
|
||||||
@ -254,6 +259,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
|
{$ifdef windows}
|
||||||
try
|
try
|
||||||
FMapHandle := CreateFileMapping(FFileHandle, nil, PAGE_READONLY{ or SEC_IMAGE}, 0, 0, nil);
|
FMapHandle := CreateFileMapping(FFileHandle, nil, PAGE_READONLY{ or SEC_IMAGE}, 0, 0, nil);
|
||||||
if FMapHandle = 0
|
if FMapHandle = 0
|
||||||
@ -287,6 +293,7 @@ begin
|
|||||||
DoCleanup;
|
DoCleanup;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDbgWinPEImageLoader.UnloadData;
|
procedure TDbgWinPEImageLoader.UnloadData;
|
||||||
|
@ -23,14 +23,26 @@
|
|||||||
unit FpDbgPETypes;
|
unit FpDbgPETypes;
|
||||||
{$mode objfpc}{$H+}{$inline on}
|
{$mode objfpc}{$H+}{$inline on}
|
||||||
interface
|
interface
|
||||||
|
{$ifdef windows}
|
||||||
uses
|
uses
|
||||||
Windows;
|
Windows;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Image Format
|
// Image Format
|
||||||
//
|
//
|
||||||
|
|
||||||
|
{$IFNDEF windows}
|
||||||
|
type
|
||||||
|
SHORT = smallint;
|
||||||
|
LONG = longint;
|
||||||
|
ULONGLONG = qword; // used in AMD64 CONTEXT
|
||||||
|
GUID = system.tguid;
|
||||||
|
CLSID = GUID;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
{$ifdef ENDIAN_LITTLE}
|
{$ifdef ENDIAN_LITTLE}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user