Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.4 KiB

  1. #define SIZE_OF_NT_SIGNATURE sizeof (DWORD)
  2. /* global macros to define header offsets into file */
  3. /* offset to PE file signature */
  4. #define NTSIGNATURE(a) ((LPVOID)((BYTE *)a + \
  5. ((PIMAGE_DOS_HEADER)a)->e_lfanew))
  6. /* DOS header identifies the NT PEFile signature dword
  7. the PEFILE header exists just after that dword */
  8. #define PEFHDROFFSET(a) ((LPVOID)((BYTE *)a + \
  9. ((PIMAGE_DOS_HEADER)a)->e_lfanew + \
  10. SIZE_OF_NT_SIGNATURE))
  11. /* PE optional header is immediately after PEFile header */
  12. #define OPTHDROFFSET(a) ((LPVOID)((BYTE *)a + \
  13. ((PIMAGE_DOS_HEADER)a)->e_lfanew + \
  14. SIZE_OF_NT_SIGNATURE + \
  15. sizeof (IMAGE_FILE_HEADER)))
  16. /* section headers are immediately after PE optional header */
  17. #define SECHDROFFSET(a) ((LPVOID) IMAGE_FIRST_SECTION(NTSIGNATURE(a)))
  18. /* global prototypes for functions in pefile.c */
  19. /* PE file header info */
  20. DWORD WINAPI ImageFileType (LPVOID);
  21. BOOL WINAPI GetPEFileHeader (LPVOID, PIMAGE_FILE_HEADER);
  22. LPVOID WINAPI GetImageBase (LPVOID);
  23. LPVOID WINAPI ImageDirectoryOffset (LPVOID, DWORD);
  24. /* PE section header info */
  25. int WINAPI GetSectionNames (LPVOID, HANDLE, char **);
  26. BOOL WINAPI GetSectionHdrByName (LPVOID, PIMAGE_SECTION_HEADER, char *);
  27. /* export section info */
  28. int WINAPI GetExportFunctionNames (LPVOID);