Windows NT 4.0 source code leak
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.

87 lines
3.8 KiB

4 years ago
  1. /***********************************************************************
  2. * Microsoft (R) 32-Bit Incremental Linker
  3. *
  4. * Copyright (C) Microsoft Corp 1992-95. All rights reserved.
  5. *
  6. * File: bufio.h
  7. *
  8. * File Comments:
  9. *
  10. * This file contains the private data structures for file i/o.
  11. *
  12. ***********************************************************************/
  13. #ifndef BUFIO__H
  14. #define BUFIO__H
  15. // i/o buffer flags
  16. #define BUF_Active 0x01 // buffer is active
  17. #define BUF_Dirty 0x02 // buffer has been written to
  18. #define BUF_PreviousWrite 0x04 // buffer range was previously written to
  19. #define BUF_Random 0x08 // buffer has random contents
  20. #define BUF_Current 0x10 // current buffer for a file, !reallocatable
  21. // i/o buffer parameters
  22. #define cbIOBuf 4096L // size of buffer in bytes
  23. #define cshiftBuf 12 // log base two of cbIOBuf
  24. #define cbufTot 30 // number of buffers for system
  25. // logical file descriptor parameters
  26. #define cfiInSystemNT 16 // # logical file descriptors
  27. #define cfiCacheableInSystemNT 14 // # cacheable logical file descriptors
  28. #define cfiInSystemTNT 8 // # logical file descriptors
  29. #define cfiCacheableInSystemTNT 6 // # cacheable logical file descriptors
  30. typedef struct BUF // i/o buffer structure
  31. {
  32. INT ifi; // logical file descriptor
  33. LONG ibStart; // starting offset of buffer span in file
  34. LONG ibEnd; // ending offset of buffer span in file
  35. LONG ibCur; // current offset of buffer in file
  36. LONG ibLast; // highest memory address written to
  37. DWORD flags; // status flags
  38. BYTE rgbBuf[cbIOBuf]; // physical memory for buffer
  39. BYTE *pbCur; // pointer to current position in buffer
  40. struct BUF *pbufNext; // next contiguous memory, free chain
  41. struct BUF *pbufLRURight; // LRU next memory buffer to right
  42. struct BUF *pbufLRULeft; // LRU next memory buffer to left
  43. } BUF, *PBUF, **PPBUF;
  44. // logical file descriptor flags
  45. #define FI_Read 0x01 // file is open for read
  46. #define FI_Write 0x02 // file is open for write
  47. #define FI_Closed 0x04 // file is closed
  48. #define FI_Mapped 0x08 // file is opened for NT mapped i/o
  49. #define FI_Create 0x10 // file is being created
  50. // mapped I/O tuning constants
  51. #define cbMapViewDefault (512 * 1024) // map 0.5mb by default
  52. #define cbInitialILKMapSize (256 * 1024) // initial size of ILK map file
  53. typedef struct FI // linker file descriptor
  54. {
  55. char *szFileName; // name of file
  56. DWORD flags; // file flags, see above
  57. INT ifi; // index in rgpfi table
  58. LONG cbSoFar; // last seeked or written off !FI_Read
  59. union {
  60. struct { // buffering on top of low i/o
  61. INT fd; // physical file handle
  62. PPBUF rgpbuf; // buffer table for file
  63. DWORD cb; // size of file in bytes
  64. LONG cbMap; // amount of file spanned by buffers
  65. PBUF pbufCur; // current buffer for file
  66. };
  67. struct { // file mapped i/o
  68. HANDLE hFile; // file handle
  69. PVOID pvMapView; // view of file
  70. LONG cbMapView; // size of file mapping
  71. LONG ibCur; // current offset
  72. DWORD MapAddr; // start address of mapped view
  73. };
  74. };
  75. struct FI *pfiNext; // next logical file descriptor
  76. } FI, *PFI, **PPFI;
  77. #endif // BUFIO__H