Re: So Delphi can't do this ...
From: Brian Cook (bcook_at_rowdydogsoftware[REMOVE)
Date: 10/12/03
- Next message: Martin Harvey (Demon Account): "Re: Great compiler bug! - Comparing events."
- Previous message: Marjan Venema: "Re: Great compiler bug! - Comparing events."
- In reply to: Paul Surgeon: "Re: So Delphi can't do this ..."
- Next in thread: Martin Harvey (Demon Account): "Re: So Delphi can't do this ..."
- Reply: Martin Harvey (Demon Account): "Re: So Delphi can't do this ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 12 Oct 2003 12:31:36 -0500
> The only thing that I can't figure out is that the structure is actually a
> container to accept values from the calling app.
> It's an import structure that receives a function ID and pointer.
> Your example is setting the values not receiving the values.
> How do I go about receiving values?
The page where ImpStruct is located needs to be change to allow writing.
The new example is below my signature.
> > It does assuming the record alignment is correct; which is VERY likely.
> All the data is double word aligned - the code has a #pragma pack(4) before
> all the declarations.
Then you're good-to-go.
- Brian
library Project1;
uses
Windows, SysUtils;
{$R *.res}
function SomeFunction: Integer;
begin
Result := 1313;
end;
{
type
TImpStruct = record
fnID: Integer;
fnPtr: Pointer;
end;
}
procedure ImpStructPre;
asm
end;
procedure ImpStruct;
asm
dd 13 // This is fnID
dd SomeFunction // This is fnPtr
end;
procedure ImpStructPost;
asm
end;
exports
ImpStruct;
procedure MakeImpStructReadWrite;
var
Junk: DWORD;
begin
VirtualProtect(
@ImpStructPre,
Cardinal(@ImpStructPost) - Cardinal(@ImpStructPre),
PAGE_EXECUTE_WRITECOPY, Junk );
end;
begin
MakeImpStructReadWrite;
end.
- Next message: Martin Harvey (Demon Account): "Re: Great compiler bug! - Comparing events."
- Previous message: Marjan Venema: "Re: Great compiler bug! - Comparing events."
- In reply to: Paul Surgeon: "Re: So Delphi can't do this ..."
- Next in thread: Martin Harvey (Demon Account): "Re: So Delphi can't do this ..."
- Reply: Martin Harvey (Demon Account): "Re: So Delphi can't do this ..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]