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.

302 lines
6.8 KiB

  1. /*++
  2. Copyright (c) 1991-2001 Microsoft Corporation
  3. Module Name:
  4. system.hxx
  5. Abstract:
  6. This module contains the definition for the SYSTEM class. The SYSTEM
  7. class is an abstract class which offers an interface for communicating
  8. with the underlying operating system.
  9. Author:
  10. David J. Gilman (davegi) 13-Jan-1991
  11. Environment:
  12. ULIB, User Mode
  13. Notes:
  14. --*/
  15. #if ! defined( _SYSTEM_ )
  16. #define _SYSTEM_
  17. DECLARE_CLASS( FSN_DIRECTORY );
  18. DECLARE_CLASS( FSN_FILE );
  19. DECLARE_CLASS( FSNODE );
  20. DECLARE_CLASS( WSTRING );
  21. DECLARE_CLASS( STREAM );
  22. DECLARE_CLASS( TIMEINFO );
  23. #include "message.hxx"
  24. #include "path.hxx"
  25. #include "basesys.hxx"
  26. #include "ifsentry.hxx"
  27. extern "C" {
  28. #include <stdarg.h>
  29. }
  30. //
  31. // Exit codes
  32. //
  33. #define EXIT_NORMAL 0
  34. #define EXIT_NO_FILES 1
  35. #define EXIT_TERMINATED 2
  36. #define EXIT_MISC_ERROR 4
  37. #define EXIT_READWRITE_ERROR 5
  38. //
  39. // Error Codes from a copy
  40. //
  41. typedef enum _COPY_ERROR {
  42. COPY_ERROR_SUCCESS = ERROR_SUCCESS,
  43. COPY_ERROR_ACCESS_DENIED = ERROR_ACCESS_DENIED,
  44. COPY_ERROR_SHARE_VIOLATION = ERROR_SHARING_VIOLATION,
  45. COPY_ERROR_NO_MEMORY = ERROR_NOT_ENOUGH_MEMORY,
  46. COPY_ERROR_DISK_FULL = ERROR_DISK_FULL,
  47. COPY_ERROR_INVALID_NAME = ERROR_INVALID_NAME,
  48. COPY_ERROR_REQUEST_ABORTED = ERROR_REQUEST_ABORTED
  49. } COPY_ERROR, *PCOPY_ERROR;
  50. //
  51. // Flags that can be specified to FSN_FILE::Copy()
  52. //
  53. #define FSN_FILE_COPY_OVERWRITE_READ_ONLY (0x0001)
  54. #define FSN_FILE_COPY_RESET_READ_ONLY (0x0002)
  55. #define FSN_FILE_COPY_RESTARTABLE (0x0004)
  56. #define FSN_FILE_COPY_COPY_OWNER (0x0008)
  57. #define FSN_FILE_COPY_COPY_ACL (0x0010)
  58. #define FSN_FILE_COPY_ALLOW_DECRYPTED_DESTINATION (0x0020)
  59. enum FILE_TYPE {
  60. UnknownFile,
  61. DiskFile,
  62. CharFile,
  63. PipeFile
  64. };
  65. struct _VOL_SERIAL_NUMBER {
  66. ULONG HighOrder32Bits;
  67. ULONG LowOrder32Bits;
  68. };
  69. DEFINE_TYPE( struct _VOL_SERIAL_NUMBER, VOL_SERIAL_NUMBER );
  70. class SYSTEM : public BASE_SYSTEM {
  71. friend
  72. BOOLEAN
  73. InitializeUlib(
  74. IN HANDLE DllHandle,
  75. IN ULONG Reason,
  76. IN PVOID Reserved
  77. );
  78. public:
  79. STATIC
  80. ULIB_EXPORT
  81. PFSN_DIRECTORY
  82. MakeDirectory (
  83. IN PCPATH Path,
  84. IN PCPATH TemplatePath,
  85. OUT PCOPY_ERROR CopyError,
  86. IN LPPROGRESS_ROUTINE Callback,
  87. IN PVOID Data,
  88. IN PBOOL Cancel,
  89. IN ULONG CopyFlags
  90. );
  91. STATIC
  92. ULIB_EXPORT
  93. PFSN_FILE
  94. MakeFile (
  95. IN PCPATH Path
  96. );
  97. STATIC
  98. ULIB_EXPORT
  99. PFSN_FILE
  100. MakeTemporaryFile (
  101. IN PCWSTRING PrefixString,
  102. IN PCPATH Path DEFAULT NULL
  103. );
  104. STATIC
  105. ULIB_EXPORT
  106. BOOLEAN
  107. RemoveNode (
  108. IN PFSNODE *PointerToNode,
  109. IN BOOLEAN Force DEFAULT FALSE
  110. );
  111. STATIC
  112. ULIB_EXPORT
  113. BOOLEAN
  114. IsCorrectVersion (
  115. );
  116. STATIC
  117. PPATH
  118. QueryCurrentPath (
  119. );
  120. STATIC
  121. ULIB_EXPORT
  122. PFSN_DIRECTORY
  123. QueryDirectory (
  124. IN PCPATH Path,
  125. IN BOOLEAN GetWhatYouCan DEFAULT FALSE
  126. );
  127. STATIC
  128. ULIB_EXPORT
  129. PWSTRING
  130. QueryEnvironmentVariable (
  131. IN PCWSTRING Variable
  132. );
  133. STATIC
  134. ULIB_EXPORT
  135. PPATH
  136. QuerySystemDirectory (
  137. );
  138. STATIC
  139. ULIB_EXPORT
  140. PPATH
  141. SearchPath(
  142. PWSTRING pFileName,
  143. PWSTRING pSearchPath DEFAULT NULL
  144. );
  145. STATIC
  146. ULIB_EXPORT
  147. PFSN_FILE
  148. QueryFile (
  149. IN PCPATH Path,
  150. IN BOOLEAN SkipOffline DEFAULT FALSE,
  151. OUT PBOOLEAN pOfflineSkipped DEFAULT NULL
  152. );
  153. STATIC
  154. ULIB_EXPORT
  155. BOOLEAN
  156. QueryCurrentDosDriveName(
  157. OUT PWSTRING DosDriveName
  158. );
  159. STATIC
  160. ULIB_EXPORT
  161. DRIVE_TYPE
  162. QueryDriveType(
  163. IN PCWSTRING DosDriveName
  164. );
  165. STATIC
  166. ULIB_EXPORT
  167. FILE_TYPE
  168. QueryFileType(
  169. IN PCWSTRING DosFileName
  170. );
  171. STATIC
  172. ULIB_EXPORT
  173. PWSTRING
  174. QueryVolumeLabel(
  175. IN PPATH Path,
  176. OUT PVOL_SERIAL_NUMBER SerialNumber
  177. );
  178. STATIC
  179. ULIB_EXPORT
  180. FARPROC
  181. QueryLibraryEntryPoint(
  182. IN PCWSTRING LibraryName,
  183. IN PCWSTRING EntryPointName,
  184. OUT PHANDLE LibraryHandle
  185. );
  186. STATIC
  187. ULIB_EXPORT
  188. VOID
  189. FreeLibraryHandle(
  190. IN HANDLE LibraryHandle
  191. );
  192. STATIC
  193. BOOLEAN
  194. PutStandardStream(
  195. IN DWORD StdHandle,
  196. IN PSTREAM pStream
  197. );
  198. STATIC
  199. ULIB_EXPORT
  200. BOOLEAN
  201. QueryLocalTimeFromUTime(
  202. IN PCTIMEINFO UTimeInfo,
  203. OUT PTIMEINFO LocalTimeInfo
  204. );
  205. STATIC
  206. BOOLEAN
  207. QueryUTimeFromLocalTime(
  208. IN PCTIMEINFO LocalTimeInfo,
  209. OUT PTIMEINFO UTimeInfo
  210. );
  211. STATIC
  212. ULIB_EXPORT
  213. BOOLEAN
  214. QueryWindowsErrorMessage(
  215. IN ULONG WindowsErrorCode,
  216. OUT PWSTRING ErrorMessage
  217. );
  218. STATIC
  219. ULIB_EXPORT
  220. BOOLEAN
  221. GetFileSecurityBackup(
  222. IN PCPATH Path,
  223. IN SECURITY_INFORMATION SecurityInfo,
  224. OUT PSECURITY_ATTRIBUTES SecurityAttrib,
  225. OUT PULONG FileAttributes
  226. );
  227. STATIC
  228. ULIB_EXPORT
  229. VOID
  230. DisplaySystemError(
  231. IN DWORD ErrorCode,
  232. IN BOOL Exit
  233. );
  234. };
  235. INLINE
  236. PPATH
  237. SYSTEM::QueryCurrentPath (
  238. )
  239. {
  240. DebugAssert( FALSE );
  241. return( NEW PATH );
  242. }
  243. #endif // SYSTEM_DEFN