![]() |
Delphi-Version: 7
C Structures into Delphi
Hi, i'm trying to port some C code into Pascal , i did some part .
Code:
so i ported it in this way :
struct DLL{
char* Dllname; dword imagebase; dword size; dword vAddr; }; struct API{ char* ApiName; DLL* libName; dword args; dword addr; int (*Start_func)(Thread*,dword*); };
Delphi-Quellcode:
type
PDll = ^TDll; TDLL = record Dllname: Pchar; imagebase: dword; size: dword; vAddr: dword; end; API = record Apiname: PChar; libName: PDLL; args: dword; addr: dword; //*** But the problem is here int (*Start_func)(Thread*,dword*); //*** how it can be done ? How this can be done inside a Structure
Code:
int (*Start_func)(Thread*,dword*);
many thanks |
AW: C Structures into Delphi
Try this
Delphi-Quellcode:
Type
TMyFunction= Function (aThread : TThread; Var dwordParam : DWORD) : Int; TMyRecord = Record ... myFunc : TMyFunction; End |
AW: C Structures into Delphi
many thanks Furtbichler ,
what about this :
Code:
struct image_resource_directory_entry
{ union { struct { unsigned long name_offset : 31; unsigned long name_is_string : 1; }; unsigned long name; unsigned short id; }; union { unsigned long offset_to_data; struct { unsigned long offset_to_directory : 31; unsigned long data_is_directory : 1; }; }; }; |
AW: C Structures into Delphi
Delphi-Quellcode:
Foobar and Foo, Bar have the same physical memory space, i.e. if you modify e.g. Foobar, Foo and Bar will also be modified.
Type
TMyUnion = Record case boolean of false : (Foobar : Word); true : (Foo,Bar : Char); end; Adapt this idea to your challenge. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz