C 转 Delphi 几个声明 200分(200分)

  • 主题发起人 主题发起人 全文检索
  • 开始时间 开始时间

全文检索

Unregistered / Unconfirmed
GUEST, unregistred user!
typedef struct {
WORD offset:12;
WORD type:4;
} IMAGE_FIXUP_ENTRY, *PIMAGE_FIXUP_ENTRY;

typedef LONG NTSTATUS;

typedef NTSTATUS (WINAPI *PFNNtQuerySystemInformation)(
DWORD SystemInformationClass,
PVOID SystemInformation,
ULONG SystemInformationLength,
PULONG ReturnLength
);

typedef struct _SYSTEM_MODULE_INFORMATION {//Information Class 11
ULONG Reserved[2];
PVOID Base;
ULONG Size;
ULONG Flags;
USHORT Index;
USHORT Unknown;
USHORT LoadCount;
USHORT ModuleNameOffset;
CHAR ImageName[256];
}SYSTEM_MODULE_INFORMATION,*PSYSTEM_MODULE_INFORMATION;

typedef struct {
DWORD dwNumberOfModules;
SYSTEM_MODULE_INFORMATION smi;
} MODULES, *PMODULES;

请问怎么写成Delphi的 ?
 
typedef struct {
WORD offset:12;
WORD type:4;
} IMAGE_FIXUP_ENTRY, *PIMAGE_FIXUP_ENTRY;
[red]
IMAGE_FIXUP_ENTRY = packed record
offset:WORD
// Delphi没有Bit类型,只能以WORD同大小的类型代替,不过,赋值的时候必须这样赋值。IFE.offset := XXX and $FFF。和IFE.types := XXX and $F;(其中XX为任意一个整数。)
types:WORD;
end;

PIMAGE_FIXUP_ENTRY = ^IMAGE_FIXUP_ENTRY;

[/red]
typedef LONG NTSTATUS;
[red]
NTSTATUS = LongWord;
[/red]
typedef NTSTATUS (WINAPI *PFNNtQuerySystemInformation)(
DWORD SystemInformationClass,
PVOID SystemInformation,
ULONG SystemInformationLength,
PULONG ReturnLength
);
[red]
PFNNtQuerySystemInformation = function(
SystemInformationClass:DWORD;
SystemInformation:Pointer;
SystemInformationLength:LongWord;
ReturnLength:pLongWord):NTSTATUS;
[/red]
typedef struct _SYSTEM_MODULE_INFORMATION {//Information Class 11
ULONG Reserved[2];
PVOID Base;
ULONG Size;
ULONG Flags;
USHORT Index;
USHORT Unknown;
USHORT LoadCount;
USHORT ModuleNameOffset;
CHAR ImageName[256];
}SYSTEM_MODULE_INFORMATION,*PSYSTEM_MODULE_INFORMATION;


[red]
_SYSTEM_MODULE_INFORMATION = packed record
Reserved:Array[0..1] of LongWord;
Base:Pointer;
Size:LongWord;
Flags:LongWord;
Index:WORD;
Unknown:WORD;
LoadCount:WORD;
ModuleNameOffset:WORD;
ImageName:Array[0..255] of char;
end;

SYSTEM_MODULE_INFORMATION = _SYSTEM_MODULE_INFORMATION;
PSYSTEM_MODULE_INFORMATION = ^SYSTEM_MODULE_INFORMATION;
[/red]
typedef struct {
DWORD dwNumberOfModules;
SYSTEM_MODULE_INFORMATION smi;
} MODULES, *PMODULES;
[red]
MODULES = packed record
dwNumberOfModules:DWORD;
smi:SYSTEM_MODULE_INFORMATION;
end;

PMODULES = ^MODULES;
[/red]
 
谢谢 xiaopei

很高兴这么快就解决了.
 
Type
IMAGE_FIXUP_ENTRY = record
offset: Word;
type: Word;
end;
PIMAGE_FIXUP_ENTRY = ^IMAGE_FIXUP_ENTRY;
NTSTATUS = Long;
PFNNtQuerySystemInformation = function( SystemInformationClass: DWORD;
SystemInformation: PVOID;
SystemInformationLength: ULong;
ReturnLength : PULong ):NTSTATUS;

_SYSTEM_MODULE_INFORMATION = record
Reserved : array[0..1] of ULong;
Base : PVOID;
Size : ULong;
Flags : ULong;
Index : Short;
Unknown : Short;
LoadCount : Short;
ModuleNameOffset : Short;
ImageName: array[0..255] of Char;
end;
SYSTEM_MODULE_INFORMATION = _SYSTEM_MODULE_INFORMATION;
PSYSTEM_MODULE_INFORMATION = ^_SYSTEM_MODULE_INFORMATION;
MODULES = record
dwNumberOfModules : DWORD;
smi : SYSTEM_MODULE_INFORMATION;
end;
PMODULES = ^MODULES;
 
后退
顶部