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.

185 lines
6.9 KiB

  1. //=============================================================================
  2. // T127 PDU Types
  3. //=============================================================================
  4. typedef enum T127_PDU_TYPES
  5. {
  6. T127_FILE_OFFER = 0x0,
  7. T127_FILE_ACCEPT = 0x8,
  8. T127_FILE_REJECT = 0x10,
  9. T127_FILE_REQUEST = 0x18,
  10. T127_FILE_DENY = 0x20,
  11. T127_FILE_ERROR = 0x28,
  12. T127_FILE_ABORT = 0x30,
  13. T127_FILE_START = 0x38,
  14. T127_FILE_DATA = 0x40,
  15. T127_DIRECTORY_REQUEST = 0x48,
  16. T127_DIRECTORY_RESPONSE = 0x50,
  17. T127_MBFT_PRIVILEGE_REQUEST = 0x58,
  18. T127_MBFT_PRIVILEGE_ASSIGN = 0x60,
  19. T127_MBFT_NONSTANDARD = 0x68,
  20. T127_PRIVATE_CHANNEL_JOIN_INVITE = 0x70,
  21. T127_PRIVATE_CHANNEL_JOIN_RESPONSE = 0x78
  22. } T127_PDUS;
  23. #pragma pack(1)
  24. typedef struct _T_T127_FILE_PDU_HEADER
  25. {
  26. BYTE pduType;
  27. WORD fileHandle; // File size in bytes
  28. } T127_FILE_PDU_HEADER;
  29. typedef struct _T_T127_FILE_DATA_BLOCK_HEADER
  30. {
  31. BYTE EOFFlag;
  32. WORD FileDataSize; // File size in bytes
  33. }T127_FILE_DATA_BLOCK_HEADER;
  34. typedef struct _T_T127_PRIVATE_CHANNEL_INVITE
  35. {
  36. BYTE pduType;
  37. WORD ControlChannel;
  38. WORD DataChannel;
  39. BYTE EncodingMode;
  40. }T127_PRIVATE_CHANNEL_INVITE;
  41. typedef struct _T_T127_PRIVATE_CHANNEL_RESPONSE
  42. {
  43. BYTE pduType;
  44. WORD ControlChannel;
  45. BYTE Response;
  46. }T127_PRIVATE_CHANNEL_RESPONSE;
  47. typedef struct _T_T127_FILE_START_DATA_BLOCK_HEADER
  48. {
  49. BYTE EOFFlag;
  50. WORD CompressionFormat;
  51. WORD FileDataSize; // File size in bytes
  52. }T127_FILE_START_DATA_BLOCK_HEADER;
  53. typedef struct _T_T127_FILE_DATA_HEADER
  54. {
  55. T127_FILE_PDU_HEADER PDUHeader;
  56. T127_FILE_DATA_BLOCK_HEADER DataHeader; // File size in bytes
  57. } T127_FILE_DATA_HEADER;
  58. typedef struct _T_127_FILE_ERROR_HEADER
  59. {
  60. T127_FILE_PDU_HEADER PDUHeader;
  61. BYTE errorCode;
  62. } T127_FILE_ERROR_HEADER;
  63. typedef struct _T_T127_FILE_HEADER
  64. {
  65. DWORD presentFields;
  66. BYTE FileHeader;
  67. } T127_FILE_HEADER;
  68. typedef struct _T_T127_FILE_START_PDU
  69. {
  70. WORD FileHandle;
  71. }T127_FILE_START_PDU;
  72. typedef struct _T_T127_FILE_ABORT_PDU
  73. {
  74. WORD pduType_PresentFields;
  75. WORD dataChannel;
  76. WORD transmitterUserId;
  77. WORD fileHandle;
  78. } T127_FILE_ABORT_PDU;
  79. typedef struct _T_T127_PRIVILEGE_REQUEST_PDU
  80. {
  81. BYTE pduType;
  82. BYTE nPrivileges;
  83. BYTE privileges[3]; // 6/2 privileges.
  84. } T127_PRIVILEGE_REQUEST_PDU;
  85. typedef struct _T_T127_FILE_OFFER_PDU
  86. {
  87. WORD ChannelID;
  88. WORD FileHandle;
  89. WORD RosterInstance;
  90. BYTE AckFlag;
  91. } T127_FILE_OFFER_PDU;
  92. typedef struct _T_FILE_HEADER_INFO
  93. {
  94. BYTE pduType;
  95. PSTR fileName;
  96. LONG fileNameSize;
  97. LONG fileSize;
  98. LONG pduSize;
  99. BYTE nBytesForFileSize;
  100. } FILE_HEADER_INFO;
  101. typedef struct
  102. {
  103. unsigned wASNuser_visible_string_present :1; // 00000000 00000000 00000000 0000000? 0000 0001
  104. unsigned wASNFileHeader_pathname_present :1; // 00000000 00000000 00000000 000000?0 0000 0002
  105. unsigned wASNenvironment_present :1; // 00000000 00000000 00000000 00000?00 0000 0004
  106. unsigned wASNcompression_present :1; // 00000000 00000000 00000000 0000?000 0000 0008
  107. unsigned wASNcharacter_set_present :1; // 00000000 00000000 00000000 000?0000 0000 0010
  108. unsigned wASNrecipient_present :1; // 00000000 00000000 00000000 00?00000 0000 0020
  109. unsigned wASNoperating_system_present :1; // 00000000 00000000 00000000 0?000000 0000 0040
  110. unsigned wASNmachine_present :1; // 00000000 00000000 00000000 ?0000000 0000 0080
  111. unsigned wASNapplication_reference_present :1; // 00000000 00000000 0000000? 00000000 0000 0100
  112. unsigned wASNstructure_present :1; // 00000000 00000000 000000?0 00000000 0000 0200
  113. unsigned wASNprivate_use_present :1; // 00000000 00000000 00000?00 00000000 0000 0400
  114. unsigned :1; // 00000000 00000000 0000X000 00000000 0000 0800
  115. unsigned wASNaccess_control_present :1; // 00000000 00000000 000?0000 00000000 0000 1000
  116. unsigned wASNfuture_filesize_present :1; // 00000000 00000000 00?00000 00000000 0000 2000
  117. unsigned wASNfilesize_present :1; // 00000000 00000000 0?000000 00000000 0000 4000
  118. unsigned :3; // 00000000 000000XX X0000000 00000000 0003 8000
  119. unsigned wASNdate_and_time_of_last_read_access_present :1; // 00000000 00000?00 00000000 00000000 0004 0000
  120. unsigned wASNdate_and_time_of_last_modification_present :1; // 00000000 0000?000 00000000 00000000 0008 0000
  121. unsigned wASNdate_and_time_of_creation_present :1; // 00000000 000?0000 00000000 00000000 0010 0000
  122. unsigned :1; // 00000000 00X00000 00000000 00000000 0020 0000
  123. unsigned wASNcontents_type_present :1; // 00000000 0?000000 00000000 00000000 0040 0000
  124. unsigned wASNpermitted_actions_present :1; // 00000000 ?0000000 00000000 00000000 0080 0000
  125. unsigned wASNfilename_present :1; // 0000000? 00000000 00000000 00000000 0100 0000
  126. unsigned wASNprotocol_version_present :1; // 000000?0 00000000 00000000 00000000 0200 0000
  127. }T127_FILE_OFFER_PRESENT_FIELDS;
  128. #pragma pack()
  129. typedef enum T127_file_header_fields
  130. {
  131. user_visible_string_present = 0x00000001,//0x00010000, //0x00000001
  132. FileHeader_pathname_present = 0x00000002,//0x00020000, //0x00000002
  133. environment_present = 0x00000004,//0x00040000, //0x00000004
  134. compression_present = 0x00000008,//0x00080000, //0x00000008
  135. character_set_present = 0x00000010,//0x00100000, //0x00000010
  136. recipient_present = 0x00000020,//0x00200000, //0x00000020
  137. operating_system_present = 0x00000040,//0x00400000, //0x00000040
  138. machine_present = 0x00000080,//0x00800000, //0x00000080
  139. application_reference_present = 0x00000100,//0x00010000, //0x00000100
  140. structure_present = 0x00000200,//0x00020000, //0x00000200
  141. private_use_present = 0x00000400,//0x00040000, //0x00000400
  142. access_control_present = 0x00001000,//0x00100000, //0x00001000
  143. future_filesize_present = 0x00002000,//0x00200000, //0x00002000
  144. filesize_present = 0x00004000,//0x00400000, //0x00004000
  145. date_and_time_of_last_read_access_present= 0x00040000,//0x00000400, //0x00040000
  146. date_and_time_of_last_modification_present= 0x00080000,//0x00000800, //0x00080000
  147. date_and_time_of_creation_present = 0x00100000,//0x00001000, //0x00100000
  148. contents_type_present = 0x00400000,//0x00004000, //0x00400000
  149. permitted_actions_present = 0x00800000,//0x00000800, //0x00800000
  150. filename_present = 0x01000000,//0x00000001, //0x01000000
  151. protocol_version_present = 0x02000000 //0x00000002 //0x02000000
  152. }T127_FILE_HEADER_FIELDS;
  153. VOID GetFileHeaderSize (FILE_HEADER_INFO* fileHeader);
  154. BYTE GetLengthFieldSize (ULONG length);
  155. VOID SetLengthField(BYTE * pBuff, BYTE sizeOfLength, ULONG lengthOfField);
  156. BYTE* GetFileInfo (LPSTR lpEncodedBuffer, BYTE * lpszFileName, LONG * FileSize, ULONG* FileDateTime );
  157. #define SWAPWORD(a) (WORD)(HIBYTE(LOWORD(a)) | (LOBYTE(LOWORD(a)) << 8))
  158. #define MIN_ASNDynamicChannelID 1001
  159. #define MAX_ASNDynamicChannelID 65535
  160. #define SIZE_OF_DATE_TIME_STRING 14 // yyyymmddhhmmss