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.

251 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. basefile.c
  5. Abstract:
  6. Contains simple wrappers for commonly used file i/o functions.
  7. Author:
  8. Marc R. Whitten (marcw) 02-Sep-1999
  9. Revision History:
  10. <alias> <date> <comments>
  11. --*/
  12. #define INVALID_ATTRIBUTES 0xFFFFFFFF
  13. BOOL
  14. DoesFileExistExA (
  15. IN PCSTR Path,
  16. OUT PWIN32_FIND_DATAA FindData OPTIONAL
  17. );
  18. #define DoesFileExistA(x) DoesFileExistExA (x, NULL)
  19. BOOL
  20. DoesFileExistExW (
  21. IN PCWSTR Path,
  22. OUT PWIN32_FIND_DATAW FindData OPTIONAL
  23. );
  24. #define DoesFileExistW(x) DoesFileExistExW (x, NULL)
  25. BOOL
  26. PathIsDirectoryA (
  27. IN PCSTR PathSpec
  28. );
  29. BOOL
  30. PathIsDirectoryW (
  31. IN PCWSTR PathSpec
  32. );
  33. BOOL
  34. WriteFileStringA (
  35. IN HANDLE File,
  36. IN PCSTR String
  37. );
  38. BOOL
  39. WriteFileStringW (
  40. IN HANDLE File,
  41. IN PCWSTR String
  42. );
  43. PVOID
  44. MapFileIntoMemoryExA (
  45. IN PCSTR FileName,
  46. OUT PHANDLE FileHandle,
  47. OUT PHANDLE MapHandle,
  48. IN BOOL WriteAccess
  49. );
  50. PVOID
  51. MapFileIntoMemoryExW (
  52. IN PCWSTR FileName,
  53. OUT PHANDLE FileHandle,
  54. OUT PHANDLE MapHandle,
  55. IN BOOL WriteAccess
  56. );
  57. #define MapFileIntoMemoryA(FileName,FileHandle,MapHandle) MapFileIntoMemoryExA(FileName,FileHandle,MapHandle,FALSE)
  58. #define MapFileIntoMemoryW(FileName,FileHandle,MapHandle) MapFileIntoMemoryExW(FileName,FileHandle,MapHandle,FALSE)
  59. BOOL
  60. UnmapFile (
  61. IN PCVOID FileImage,
  62. IN HANDLE MapHandle,
  63. IN HANDLE FileHandle
  64. );
  65. BOOL
  66. BfGetTempFileNameA (
  67. OUT PSTR Buffer,
  68. IN UINT BufferTchars
  69. );
  70. BOOL
  71. BfGetTempFileNameW (
  72. OUT PWSTR Buffer,
  73. IN UINT BufferTchars
  74. );
  75. HANDLE
  76. BfGetTempFile (
  77. VOID
  78. );
  79. BOOL
  80. BfSetFilePointer (
  81. IN HANDLE File,
  82. IN LONGLONG Offset
  83. );
  84. HANDLE
  85. BfOpenFileA (
  86. IN PCSTR FileName
  87. );
  88. HANDLE
  89. BfOpenFileW (
  90. IN PCWSTR FileName
  91. );
  92. HANDLE
  93. BfCreateFileA (
  94. IN PCSTR FileName
  95. );
  96. HANDLE
  97. BfCreateFileW (
  98. IN PCWSTR FileName
  99. );
  100. HANDLE
  101. BfCreateSharedFileA (
  102. IN PCSTR FileName
  103. );
  104. HANDLE
  105. BfCreateSharedFileW (
  106. IN PCWSTR FileName
  107. );
  108. BOOL
  109. BfSetSizeOfFile (
  110. HANDLE File,
  111. LONGLONG Size
  112. );
  113. BOOL
  114. BfGoToEndOfFile (
  115. IN HANDLE File,
  116. OUT PLONGLONG FileSize OPTIONAL
  117. );
  118. BOOL
  119. BfGetFilePointer (
  120. IN HANDLE File,
  121. OUT PLONGLONG FilePointer OPTIONAL
  122. );
  123. BOOL
  124. BfReadFile (
  125. IN HANDLE File,
  126. OUT PBYTE Buffer,
  127. IN UINT BytesToRead
  128. );
  129. BOOL
  130. BfWriteFile (
  131. IN HANDLE File,
  132. OUT PCBYTE Buffer,
  133. IN UINT BytesToWrite
  134. );
  135. BOOL
  136. BfCreateDirectoryA (
  137. IN PCSTR FullPath
  138. );
  139. BOOL
  140. BfCreateDirectoryW (
  141. IN PCWSTR FullPath
  142. );
  143. LONGLONG
  144. BfGetFileSizeA (
  145. IN PCSTR FileName
  146. );
  147. LONGLONG
  148. BfGetFileSizeW (
  149. IN PCWSTR FileName
  150. );
  151. PCSTR
  152. BfGetLongFileNameA (
  153. IN PCSTR SrcFileName
  154. );
  155. BOOL
  156. BfGetLongFileNameExA (
  157. IN PCSTR SrcFileName,
  158. IN PGROWBUFFER GrowBuff
  159. );
  160. PCWSTR
  161. BfGetLongFileNameW (
  162. IN PCWSTR SrcFileName
  163. );
  164. BOOL
  165. BfGetLongFileNameExW (
  166. IN PCWSTR SrcFileName,
  167. IN PGROWBUFFER GrowBuff
  168. );
  169. #ifdef UNICODE
  170. #define DoesFileExist DoesFileExistW
  171. #define DoesFileExistEx DoesFileExistExW
  172. #define PathIsDirectory PathIsDirectoryW
  173. #define WriteFileString WriteFileStringW
  174. #define MapFileIntoMemory MapFileIntoMemoryW
  175. #define MapFileIntoMemoryEx MapFileIntoMemoryExW
  176. #define BfGetTempFileName BfGetTempFileNameW
  177. #define BfOpenFile BfOpenFileW
  178. #define BfCreateFile BfCreateFileW
  179. #define BfCreateSharedFile BfCreateSharedFileW
  180. #define BfCreateDirectory BfCreateDirectoryW
  181. #define BfGetFileSize BfGetFileSizeW
  182. #define BfGetLongFileName BfGetLongFileNameW
  183. #define BfGetLongFileNameEx BfGetLongFileNameExW
  184. #else
  185. #define DoesFileExist DoesFileExistA
  186. #define DoesFileExistEx DoesFileExistExA
  187. #define PathIsDirectory PathIsDirectoryA
  188. #define WriteFileString WriteFileStringA
  189. #define MapFileIntoMemory MapFileIntoMemoryA
  190. #define MapFileIntoMemoryEx MapFileIntoMemoryExA
  191. #define BfGetTempFileName BfGetTempFileNameA
  192. #define BfOpenFile BfOpenFileA
  193. #define BfCreateFile BfCreateFileA
  194. #define BfCreateSharedFile BfCreateSharedFileA
  195. #define BfCreateDirectory BfCreateDirectoryA
  196. #define BfGetFileSize BfGetFileSizeA
  197. #define BfGetLongFileName BfGetLongFileNameA
  198. #define BfGetLongFileNameEx BfGetLongFileNameExA
  199. #endif