Source code of Windows XP (NT5)
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.

179 lines
3.9 KiB

  1. #ifndef _SCAN_H_
  2. #define _SCAN_H_
  3. #if SCAN_DEBUG
  4. extern BOOL scan_dprinton;
  5. #endif
  6. typedef struct _SMALL_WIN32_FIND_DATAW {
  7. DWORD dwFileAttributes;
  8. FILETIME ftCreationTime;
  9. FILETIME ftLastAccessTime;
  10. FILETIME ftLastWriteTime;
  11. DWORD nFileSizeHigh;
  12. DWORD nFileSizeLow;
  13. WCHAR cAlternateFileName[ 14 ];
  14. WCHAR cFileName[ 1 ];
  15. } SMALL_WIN32_FIND_DATAW, *PSMALL_WIN32_FIND_DATAW, *LPSMALL_WIN32_FIND_DATAW;
  16. typedef
  17. VOID
  18. (* PSCAN_FREE_USER_DATA_CALLBACK) (
  19. IN PVOID UserData
  20. );
  21. typedef
  22. DWORD
  23. (* PSCAN_NEW_FILE_CALLBACK) (
  24. IN PVOID Context,
  25. IN PWCH Path,
  26. IN PSMALL_WIN32_FIND_DATAW ExistingFileData OPTIONAL,
  27. IN PWIN32_FIND_DATAW NewFileData,
  28. IN PVOID *FileUserData,
  29. IN PVOID *ParentDirectoryUserData
  30. );
  31. typedef
  32. DWORD
  33. (* PSCAN_NEW_DIRECTORY_CALLBACK) (
  34. IN PVOID Context,
  35. IN PWCH Path,
  36. IN PSMALL_WIN32_FIND_DATAW ExistingDirectoryData OPTIONAL,
  37. IN PWIN32_FIND_DATAW NewDirectoryData,
  38. IN PVOID *DirectoryUserData,
  39. IN PVOID *ParentDirectoryUserData
  40. );
  41. typedef
  42. DWORD
  43. (* PSCAN_CHECK_FILE_CALLBACK) (
  44. IN PVOID Context,
  45. IN PWCH Path,
  46. IN PSMALL_WIN32_FIND_DATAW FileData,
  47. IN PVOID *FileUserData,
  48. IN PVOID *ParentDirectoryUserData
  49. );
  50. typedef
  51. DWORD
  52. (* PSCAN_CHECK_DIRECTORY_CALLBACK) (
  53. IN PVOID Context,
  54. IN PWCH Path,
  55. IN PSMALL_WIN32_FIND_DATAW DirectoryData,
  56. IN PVOID *DirectoryUserData,
  57. IN PVOID *ParentDirectoryUserData OPTIONAL
  58. );
  59. typedef
  60. DWORD
  61. (* PSCAN_ENUM_FILE_CALLBACK) (
  62. IN PVOID Context,
  63. IN PWCH Path,
  64. IN PSMALL_WIN32_FIND_DATAW FileData,
  65. IN PVOID *FileUserData,
  66. IN PVOID *ParentDirectoryUserData
  67. );
  68. typedef
  69. DWORD
  70. (* PSCAN_ENUM_DIRECTORY_CALLBACK) (
  71. IN PVOID Context,
  72. IN PWCH Path,
  73. IN PSMALL_WIN32_FIND_DATAW DirectoryData,
  74. IN PVOID *DirectoryUserData,
  75. IN PVOID *ParentDirectoryUserData OPTIONAL
  76. );
  77. typedef
  78. BOOL
  79. (* PSCAN_RECURSE_DIRECTORY_CALLBACK) (
  80. IN PVOID Context,
  81. IN PWCH Path,
  82. IN PSMALL_WIN32_FIND_DATAW DirectoryData,
  83. IN PVOID *DirectoryUserData,
  84. IN PVOID *ParentDirectoryUserData OPTIONAL
  85. );
  86. DWORD
  87. ScanInitialize (
  88. OUT PVOID *ScanHandle,
  89. IN BOOL Recurse,
  90. IN BOOL SkipRoot,
  91. IN PSCAN_FREE_USER_DATA_CALLBACK FreeUserDataCallback OPTIONAL
  92. );
  93. DWORD
  94. ScanDirectory (
  95. IN PVOID ScanHandle,
  96. IN PWCH ScanPath,
  97. IN PVOID Context OPTIONAL,
  98. IN PSCAN_NEW_DIRECTORY_CALLBACK NewDirectoryCallback OPTIONAL,
  99. IN PSCAN_CHECK_DIRECTORY_CALLBACK CheckDirectoryCallback OPTIONAL,
  100. IN PSCAN_RECURSE_DIRECTORY_CALLBACK RecurseDirectoryCallback OPTIONAL,
  101. IN PSCAN_NEW_FILE_CALLBACK NewFileCallback OPTIONAL,
  102. IN PSCAN_CHECK_FILE_CALLBACK CheckFileCallback OPTIONAL
  103. );
  104. DWORD
  105. ScanEnumTree (
  106. IN PVOID ScanHandle,
  107. IN PVOID Context,
  108. IN PSCAN_ENUM_DIRECTORY_CALLBACK EnumDirectoryCallback OPTIONAL,
  109. IN PSCAN_ENUM_FILE_CALLBACK EnumFileCallback OPTIONAL
  110. );
  111. VOID
  112. ScanTerminate (
  113. IN PVOID ScanHandle
  114. );
  115. DWORD
  116. OpenAndMapFile (
  117. IN PWCH FileName,
  118. IN DWORD DesiredAccess,
  119. OUT PHANDLE FileHandle,
  120. OUT PLARGE_INTEGER Size,
  121. OUT PHANDLE MappingHandle,
  122. OUT PVOID *MappedBase
  123. );
  124. DWORD
  125. OpenAndMapFileA (
  126. IN PSZ FileName,
  127. IN DWORD DesiredAccess,
  128. OUT PHANDLE FileHandle,
  129. OUT PLARGE_INTEGER Size,
  130. OUT PHANDLE MappingHandle,
  131. OUT PVOID *MappedBase
  132. );
  133. VOID
  134. CloseMappedFile (
  135. IN HANDLE FileHandle,
  136. IN HANDLE MappingHandle,
  137. IN PVOID MappedBase
  138. );
  139. #define SCAN_FILETYPE_TEXT 0
  140. #define SCAN_FILETYPE_UNICODE_TEXT 1
  141. #define SCAN_FILETYPE_BINARY 2
  142. #define SCAN_FILETYPE_MAYBE_BINARY 3
  143. DWORD
  144. DataLooksBinary (
  145. IN PVOID MappedBase,
  146. IN DWORD FileSize,
  147. OUT PUCHAR BinaryData OPTIONAL,
  148. OUT PDWORD BinaryDataOffset OPTIONAL
  149. );
  150. DWORD
  151. FileLooksBinary (
  152. IN PWCH DirectoryName,
  153. IN PWCH FileName,
  154. OUT PUCHAR BinaryData OPTIONAL,
  155. OUT PDWORD BinaryDataOffset OPTIONAL
  156. );
  157. #endif // _SCAN_H_