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.

211 lines
6.6 KiB

  1. #define COPY_BUFF_SIZE 4096
  2. #define BCS_OEM 1
  3. #define BCS_UNI 2
  4. #define ACCESS_MODE_MASK 0x0007 /* Mask for access mode bits */
  5. #define ACCESS_READONLY 0x0000 /* open for read-only access */
  6. #define ACCESS_WRITEONLY 0x0001 /* open for write-only access */
  7. #define ACCESS_READWRITE 0x0002 /* open for read and write access */
  8. #define ACCESS_EXECUTE 0x0003 /* open for execute access */
  9. #define SHARE_MODE_MASK 0x0070 /* Mask for share mode bits */
  10. #define SHARE_COMPATIBILITY 0x0000 /* open in compatability mode */
  11. #define SHARE_DENYREADWRITE 0x0010 /* open for exclusive access */
  12. #define SHARE_DENYWRITE 0x0020 /* open allowing read-only access */
  13. #define SHARE_DENYREAD 0x0030 /* open allowing write-only access */
  14. #define SHARE_DENYNONE 0x0040 /* open allowing other processes access */
  15. #define SHARE_FCB 0x0070 /* FCB mode open */
  16. /** Values for ir_options for VFN_OPEN: */
  17. #define ACTION_MASK 0xff /* Open Actions Mask */
  18. #define ACTION_OPENEXISTING 0x01 /* open an existing file */
  19. #define ACTION_REPLACEEXISTING 0x02 /* open existing file and set length */
  20. #define ACTION_CREATENEW 0x10 /* create a new file, fail if exists */
  21. #define ACTION_OPENALWAYS 0x11 /* open file, create if does not exist */
  22. #define ACTION_CREATEALWAYS 0x12 /* create a new file, even if it exists */
  23. /** Alternate method: bit assignments for the above values: */
  24. #define ACTION_EXISTS_OPEN 0x01 // BIT: If file exists, open file
  25. #define ACTION_TRUNCATE 0x02 // BIT: Truncate file
  26. #define ACTION_NEXISTS_CREATE 0x10 // BIT: If file does not exist, create
  27. #define OPEN_FLAGS_NOINHERIT 0x0080
  28. //#define OPEN_FLAGS_NO_CACHE R0_NO_CACHE /* 0x0100 */
  29. #define OPEN_FLAGS_NO_COMPRESS 0x0200
  30. #define OPEN_FLAGS_ALIAS_HINT 0x0400
  31. #define OPEN_FLAGS_REOPEN 0x0800
  32. #define OPEN_FLAGS_RSVD_1 0x1000 /* NEVER #define this */
  33. #define OPEN_FLAGS_NOCRITERR 0x2000
  34. #define OPEN_FLAGS_COMMIT 0x4000
  35. #define OPEN_FLAGS_RSVD_2 0x8000 /* NEVER #define this */
  36. #define OPEN_FLAGS_EXTENDED_SIZE 0x00010000
  37. #define OPEN_FLAGS_RAND_ACCESS_HINT 0x00020000
  38. #define OPEN_FLAGS_SEQ_ACCESS_HINT 0x00040000
  39. #define OPEN_EXT_FLAGS_MASK 0x00FF0000
  40. #define ATTRIB_DEL_ANY 0x0007 // Attrib passed to ring0 delete
  41. #define FLAG_RW_OSLAYER_INSTRUMENT 0x00000001
  42. #define FLAG_RW_OSLAYER_PAGED_BUFFER 0x00000002
  43. typedef HANDLE CSCHFILE;
  44. typedef int (*PATHPROC)(USHORT *, USHORT *, LPVOID);
  45. #define CSCHFILE_NULL 0
  46. //typedef USHORT USHORT;
  47. //typedef ULONG ULONG;
  48. #define _FILETIME FILETIME
  49. #define _WIN32_FIND_DATA WIN32_FIND_DATA
  50. #define string_t unsigned short *
  51. #define FILE_ATTRIBUTE_ALL (FILE_ATTRIBUTE_READONLY| FILE_ATTRIBUTE_HIDDEN \
  52. | FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY \
  53. | FILE_ATTRIBUTE_ARCHIVE)
  54. #define IsFile(dwAttr) (!((dwAttr) & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_DEVICE)))
  55. #define CheckHeap(a) {;}
  56. #define GetLastErrorLocal() GetLastError()
  57. #define SetLastErrorLocal(X) SetLastError(X)
  58. #ifndef KdPrint
  59. #ifdef DEBUG
  60. #define KdPrint(X) PrintFn X
  61. #else
  62. #define KdPrint(X)
  63. #endif
  64. #endif
  65. CSCHFILE CreateFileLocal(LPSTR lpName);
  66. CSCHFILE OpenFileLocal(LPSTR lpName);
  67. int DeleteFileLocal(LPSTR lpName, USHORT usAttrib);
  68. int FileExists (LPSTR lpName);
  69. long ReadFileLocal (CSCHFILE handle, ULONG pos, LPVOID lpBuff, long lCount);
  70. long WriteFileLocal (CSCHFILE handle, ULONG pos, LPVOID lpBuff, long lCount);
  71. long WriteFileInContextLocal (CSCHFILE, ULONG, LPVOID, long);
  72. ULONG CloseFileLocal (CSCHFILE handle);
  73. ULONG CloseFileLocalFromHandleCache (CSCHFILE handle);
  74. int GetFileSizeLocal (CSCHFILE, PULONG);
  75. int GetDiskFreeSpaceLocal(int indx
  76. , ULONG *lpuSectorsPerCluster
  77. , ULONG *lpuBytesPerSector
  78. , ULONG *lpuFreeClusters
  79. , ULONG *lpuTotalClusters
  80. );
  81. int GetAttributesLocal (LPSTR, ULONG *);
  82. int GetAttributesLocalEx (LPSTR lpPath, BOOL fFile, ULONG *lpuAttr);
  83. int SetAttributesLocal (LPSTR, ULONG);
  84. int RenameFileLocal (LPSTR, LPSTR);
  85. int FileLockLocal(CSCHFILE, ULONG, ULONG, ULONG, BOOL);
  86. LPVOID AllocMem (ULONG uSize);
  87. VOID FreeMem (LPVOID lpBuff);
  88. //VOID CheckHeap(LPVOID lpBuff);
  89. LPVOID AllocMemPaged (ULONG uSize);
  90. VOID FreeMemPaged(LPVOID lpBuff);
  91. CSCHFILE R0OpenFile (USHORT usOpenFlags, UCHAR bAction, LPSTR lpPath);
  92. CSCHFILE OpenFileLocalEx(LPSTR lpPath, BOOL fInstrument);
  93. long ReadFileLocalEx
  94. (
  95. CSCHFILE handle,
  96. ULONG pos,
  97. LPVOID pBuff,
  98. long lCount,
  99. BOOL fInstrument
  100. );
  101. long WriteFileLocalEx(CSCHFILE handle, ULONG pos, LPVOID lpBuff, long lCount, BOOL fInstrument);
  102. CSCHFILE R0OpenFileEx
  103. (
  104. USHORT usOpenFlags,
  105. UCHAR bAction,
  106. ULONG ulAttr,
  107. LPSTR lpPath,
  108. BOOL fInstrument
  109. );
  110. long ReadFileLocalEx2(CSCHFILE handle, ULONG pos, LPVOID lpBuff, long lCount, ULONG flags);
  111. long WriteFileLocalEx2(CSCHFILE handle, ULONG pos, LPVOID lpBuff, long lCount, ULONG flags);
  112. int HexToA(ULONG ulHex, LPSTR lpBuff, int count);
  113. ULONG AtoHex(LPSTR lpBuff, int count);
  114. int wstrnicmp(const USHORT *, const USHORT *, ULONG);
  115. ULONG strmcpy(LPSTR, LPSTR, ULONG);
  116. int DosToWin32FileSize(ULONG, int *, int *);
  117. int Win32ToDosFileSize(int, int, ULONG *);
  118. int CompareTimes(_FILETIME, _FILETIME);
  119. int CompareSize(long nHighDst, long nLowDst, long nHighSrc, long nLowSrc);
  120. LPSTR mystrpbrk(LPSTR, LPSTR);
  121. int CompareTimesAtDosTimePrecision( _FILETIME ftDst,
  122. _FILETIME ftSrc
  123. );
  124. VOID
  125. IncrementFileTime(
  126. _FILETIME *lpft
  127. );
  128. unsigned int
  129. UniToBCS (
  130. unsigned char *pStr,
  131. unsigned short *pUni,
  132. unsigned int length,
  133. unsigned int maxLength,
  134. int charSet
  135. );
  136. unsigned int
  137. BCSToUni (
  138. unsigned short *pUni,
  139. unsigned char *pStr,
  140. unsigned int length,
  141. int charSet
  142. );
  143. ULONG wstrlen(
  144. USHORT *lpuStr
  145. );
  146. int
  147. PUBLIC
  148. mystrnicmp(
  149. LPCSTR pStr1,
  150. LPCSTR pStr2,
  151. unsigned count
  152. );
  153. int CreateDirectoryLocal(
  154. LPSTR lpszPath
  155. );
  156. ULONG
  157. GetTimeInSecondsSince1970(
  158. VOID
  159. );
  160. BOOL
  161. IterateOnUNCPathElements(
  162. USHORT *lpuPath,
  163. PATHPROC lpfn,
  164. LPVOID lpCookie
  165. );
  166. BOOL
  167. IsPathUNC(
  168. USHORT *lpuPath,
  169. int cntMaxChars
  170. );
  171. #define JOE_DECL_PROGRESS()
  172. #define JOE_INIT_PROGRESS(counter,nearargs)
  173. #define JOE_PROGRESS(bit)