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.

102 lines
3.3 KiB

  1. #include <windows.h>
  2. #define IDS_ERRBADFILENAME 1000
  3. #define IDR_CURSOR 1
  4. #define IDR_BITMAP 2
  5. #define IDR_ICON 3
  6. #define IDR_MENU 4
  7. #define IDR_DIALOG 5
  8. #define IDR_STRING 6
  9. #define IDR_FONTDIR 7
  10. #define IDR_FONT 8
  11. #define IDR_ACCELERATOR 9
  12. #define IDR_RCDATA 10
  13. #define IDR_MESSAGETABLE 11
  14. #define SIZE_OF_NT_SIGNATURE sizeof (DWORD)
  15. #define MAXRESOURCENAME 13
  16. /* global macros to define header offsets into file */
  17. /* offset to PE file signature */
  18. #define NTSIGNATURE(a) ((LPVOID)((BYTE *)a + \
  19. ((PIMAGE_DOS_HEADER)a)->e_lfanew))
  20. /* DOS header identifies the NT PEFile signature dword
  21. the PEFILE header exists just after that dword */
  22. #define PEFHDROFFSET(a) ((LPVOID)((BYTE *)a + \
  23. ((PIMAGE_DOS_HEADER)a)->e_lfanew + \
  24. SIZE_OF_NT_SIGNATURE))
  25. /* PE optional header is immediately after PEFile header */
  26. #define OPTHDROFFSET(a) ((LPVOID)((BYTE *)a + \
  27. ((PIMAGE_DOS_HEADER)a)->e_lfanew + \
  28. SIZE_OF_NT_SIGNATURE + \
  29. sizeof (IMAGE_FILE_HEADER)))
  30. /* section headers are immediately after PE optional header */
  31. #define SECHDROFFSET(a) ((LPVOID)((BYTE *)a + \
  32. ((PIMAGE_DOS_HEADER)a)->e_lfanew + \
  33. SIZE_OF_NT_SIGNATURE + \
  34. sizeof (IMAGE_FILE_HEADER) + \
  35. sizeof (IMAGE_OPTIONAL_HEADER)))
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. typedef struct tagImportDirectory
  40. {
  41. DWORD dwRVAFunctionNameList;
  42. DWORD dwUseless1;
  43. DWORD dwUseless2;
  44. DWORD dwRVAModuleName;
  45. DWORD dwRVAFunctionAddressList;
  46. }IMAGE_IMPORT_MODULE_DIRECTORY, * PIMAGE_IMPORT_MODULE_DIRECTORY;
  47. /* global prototypes for functions in pefile.c */
  48. /* PE file header info */
  49. BOOL WINAPI GetDosHeader (LPVOID, PIMAGE_DOS_HEADER);
  50. DWORD WINAPI ImageFileType (LPVOID);
  51. BOOL WINAPI GetPEFileHeader (LPVOID, PIMAGE_FILE_HEADER);
  52. /* PE optional header info */
  53. BOOL WINAPI GetPEOptionalHeader (LPVOID, PIMAGE_OPTIONAL_HEADER);
  54. LONG_PTR WINAPI GetModuleEntryPoint (LPVOID);
  55. int WINAPI NumOfSections (LPVOID);
  56. LPVOID WINAPI GetImageBase (LPVOID);
  57. LPVOID WINAPI ImageDirectoryOffset (LPVOID, DWORD);
  58. /* PE section header info */
  59. int WINAPI GetSectionNames (LPVOID, HANDLE, char **);
  60. BOOL WINAPI GetSectionHdrByName (LPVOID, PIMAGE_SECTION_HEADER, char *);
  61. /* import section info */
  62. int WINAPI GetImportModuleNames (LPVOID, char*, char **);
  63. int WINAPI GetImportFunctionNamesByModule (LPVOID, char*, char *, char **);
  64. /* export section info */
  65. int WINAPI GetExportFunctionNames (LPVOID, HANDLE, char **);
  66. int WINAPI GetNumberOfExportedFunctions (LPVOID);
  67. LPVOID WINAPI GetExportFunctionEntryPoints (LPVOID);
  68. LPVOID WINAPI GetExportFunctionOrdinals (LPVOID);
  69. /* resource section info */
  70. int WINAPI GetNumberOfResources (LPVOID);
  71. int WINAPI GetListOfResourceTypes (LPVOID, HANDLE, char **);
  72. /* debug section info */
  73. BOOL WINAPI IsDebugInfoStripped (LPVOID);
  74. int WINAPI RetrieveModuleName (LPVOID, HANDLE, char **);
  75. BOOL WINAPI IsDebugFile (LPVOID);
  76. BOOL WINAPI GetSeparateDebugHeader (LPVOID, PIMAGE_SEPARATE_DEBUG_HEADER);
  77. #ifdef __cplusplus
  78. }
  79. #endif