[delayimp]

- move IndexFromPImgThunkData and PFromRva to delayimp.h
- use __ImageBase insetad of _image_base__
- fix include guard
- RVA is a DWORD, not a PVOID

svn path=/trunk/; revision=42172
This commit is contained in:
Timo Kreuzer 2009-07-24 10:25:53 +00:00
parent 9e27cfbe88
commit 07203a50c1
2 changed files with 24 additions and 21 deletions

View file

@ -10,21 +10,6 @@
#include <windows.h>
#include "delayimp.h"
inline
unsigned
IndexFromPImgThunkData(PCImgThunkData pData, PCImgThunkData pBase)
{
return pData - pBase;
}
extern const IMAGE_DOS_HEADER _image_base__;
inline PVOID
PFromRva(RVA rva)
{
return (PVOID)(((ULONG_PTR)(rva)) + ((ULONG_PTR)&_image_base__));
}
/**** load helper ****/
FARPROC WINAPI

View file

@ -1,14 +1,15 @@
#ifndef _DELAYIMP_H_
#define _DELAYIMP_H_
#ifndef _delayimp_h
#define _delayimp_h
typedef void *RVA;
#define DELAYLOAD_VERSION 0x200
typedef DWORD RVA;
typedef IMAGE_THUNK_DATA *PImgThunkData;
typedef const IMAGE_THUNK_DATA *PCImgThunkData;
enum
enum DLAttr
{
dlattrRva
dlattrRva = 0x1,
};
/* Notification codes */
@ -59,7 +60,24 @@ typedef struct DelayLoadInfo
typedef FARPROC (WINAPI *PfnDliHook)(unsigned, PDelayLoadInfo);
static __inline__
unsigned
IndexFromPImgThunkData(PCImgThunkData pData, PCImgThunkData pBase)
{
return pData - pBase;
}
extern const IMAGE_DOS_HEADER __ImageBase;
static __inline__
PVOID
PFromRva(RVA rva)
{
return (PVOID)(((ULONG_PTR)(rva)) + ((ULONG_PTR)&__ImageBase));
}
extern PfnDliHook __pfnDliNotifyHook2;
extern PfnDliHook __pfnDliFailureHook2;
#endif /* not _DELAYIMP_H_ */
#endif /* not _delayimp_h */