!!!!散分喽,高手请进!!!! 别让我失望!!!! (300分)

  • 主题发起人 主题发起人 wlmmlw
  • 开始时间 开始时间
W

wlmmlw

Unregistered / Unconfirmed
GUEST, unregistred user!
API:
ImageDirectoryEntryToData
在Windows.pas中未找到。
如果加入这个函数,请具体说明,谢谢

如果可能,请给出各种数据类型的转换关系。
 
在 ImageHlp.pas 里面,具体参数意思查一下 MSDN 吧
function ImageDirectoryEntryToData(Base: Pointer; MappedAsImage: ByteBool;
DirectoryEntry: Word; var Size: ULONG): Pointer; stdcall;
 
ImageDirectoryEntryToData
The ImageDirectoryEntryToData function obtains access to image-specific data.

PVOID ImageDirectoryEntryToData(
IN LPVOID Base,
IN BOOLEAN MappedAsImage,
IN USHORT DirectoryEntry,
OUT PULONG Size
);

Parameters
Base
Specifies the base address of the image.
MappedAsImage
Specifies how the image is mapped. If this flag is TRUE, the image is mapped by the system loader. If the flag is FALSE, the file is mapped by a call to the MapViewOfFile function.
DirectoryEntry
Specifies the index number of the desired directory entry. The value must be one of the following: Value Meaning
IMAGE_DIRECTORY_ENTRY_EXPORT Export directory
IMAGE_DIRECTORY_ENTRY_IMPORT Import directory
IMAGE_DIRECTORY_ENTRY_RESOURCE Resource directory
IMAGE_DIRECTORY_ENTRY_EXCEPTION Exception directory
IMAGE_DIRECTORY_ENTRY_SECURITY Security directory
IMAGE_DIRECTORY_ENTRY_BASERELOC Base relocation table
IMAGE_DIRECTORY_ENTRY_DEBUG Debug directory
IMAGE_DIRECTORY_ENTRY_COPYRIGHT
IMAGE_DIRECTORY_ENTRY_GLOBALPTR RVA of global pointer
IMAGE_DIRECTORY_ENTRY_TLS thread local storage directory
IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG Load configuration directory
IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT Bound import directory
IMAGE_DIRECTORY_ENTRY_IAT Import address table


Size
Specifies the size of the desired directory entry's data.
Return Values
If the function succeeds, the return value is a pointer to the directory entry's data.

If the function fails, the return value is NULL. To retrieve extended error information, call GetLastError.

Remarks
The ImageDirectoryEntryToData function is used to obtain access to image-specific data.

QuickInfo
Windows NT: Requires version 4.0 or later.
Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in imagehlp.h.
Import Library: Use imagehlp.lib.

See Also
PE Image Helper (ImageHlp) Overview, Image Access, MapViewOfFile


 
jsxjd:
这个我知道!!

我要得是Pascal 到 c 的变量类型的转换关系。

请高手们继续! 谢谢
 
带P的一般都是指针,LP就是Long Pointer
带VOID的一般是无类型指针。
带U的一般都是无符号(整形)
举几个简单的例子:
LPCSTR = PChar
LPVOID = Pointer
USHORT = Word

在Delphi的帮助中输入“Integer”或者其它任意一种常用的数据类型,就会出详尽的对照表了。
 
在Windows中,那些令人眼花缭乱的数据类型,其原形其实就是这么简单!
typedef unsigned long ULONG;
typedef ULONG *PULONG;
typedef unsigned short USHORT;
typedef USHORT *PUSHORT;
typedef unsigned char UCHAR;
typedef UCHAR *PUCHAR;
typedef char *PSZ;

typedef unsigned long DWORD;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef float FLOAT;
typedef FLOAT *PFLOAT;
typedef BOOL near *PBOOL;
typedef BOOL far *LPBOOL;
typedef BYTE near *PBYTE;
typedef BYTE far *LPBYTE;
typedef int near *PINT;
typedef int far *LPINT;
typedef WORD near *PWORD;
typedef WORD far *LPWORD;
typedef long far *LPLONG;
typedef DWORD near *PDWORD;
typedef DWORD far *LPDWORD;
typedef void far *LPVOID;
typedef CONST void far *LPCVOID;

typedef int INT;
typedef unsigned int UINT;
typedef unsigned int *PUINT;

(不要被near和far所迷惑,它们是为向下兼容16位Windows而设的,在32位程序中可以忽略
它们的存在)
 
function ImageDirectoryEntryToData(
Base:pinter;
MappedAsImage:BOOL;
DirectoryEntry:word;
Size:pdword
):pointer;stdcall;
 
如何找到 C
PIMAGE_IMPORT_DESCRIPTOR 的类型对应的 Pascal类型说明????
 
ImageHlp.pas
 
正在查找中....
 
找不到....
请提示
 
在MSDN里居然查不到
PIMAGE_IMPORT_DESCRIPTOR
的声明????????????????
它到底是什么东东???!!!!!!!!

请高手救我!!!!!
 
在MSDN里居然查不到
PIMAGE_IMPORT_DESCRIPTOR
的声明????????????????
它到底是什么东东???!!!!!!!!

请高手救我!!!!!
 
你说的那东东的定义如下:
typedef struct _IMAGE_IMPORT_DESCRIPTOR {
union {
DWORD Characteristics; // 0 for terminating null import descriptor
DWORD OriginalFirstThunk; // RVA to original unbound IAT (PIMAGE_THUNK_DATA)
};
DWORD TimeDateStamp; // 0 if not bound,
// -1 if bound, and real date/time stamp
// in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT (new BIND)
// O.W. date/time stamp of DLL bound to (Old BIND)

DWORD ForwarderChain; // -1 if no forwarders
DWORD Name;
DWORD FirstThunk; // RVA to IAT (if bound this IAT has actual addresses)
} IMAGE_IMPORT_DESCRIPTOR;
typedef IMAGE_IMPORT_DESCRIPTOR UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR;

如果翻译为PASCAL的话:
IMAGE_IMPORT_DESCRIPTOR = record
OriginalFirstThunk: DWORD;
TimeDateStamp: DWORD;
ForwarderChain: DWORD;
Name: DWORD;
FirstThunk: DWORD;
end;
PIMAGE_IMPORT_DESCRIPTOR = ^IMAGE_IMPORT_DESCRIPTOR;

要注意两个东西:
一是在C语言结构定义中的那个union,我不知道在PASCAL中有没有与union对应的数据类型,
但考虑到C语言中union的特点是共享存储区,而且这个union中的两个成员又是相同的数据
类型,故这个union可以当作一个DWORD来对待。
第二个是在C语言结构定义中的UNALIGNED标志,这是一个宏,是为了适应64位的系统而设的,
在32位的系统应该可以忽略。而且说实话,我不知道在Delphi编译器中该怎样设置像C语言
中这样的宏。
 
是啊,这也正是我头痛的问题。
 
Delphi应该有封闭这个吧。可不知在哪能找到!!!!?????
请高手指点,不胜感激。
 
太高兴了,终于找到了。
 
你就按我给的做一个试试看嘛,那两个不确定的因素不会有大的影响的,没试过怎么知道不行?
 
谢谢你Sachow!!!!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部