/Develop_Branch/NPL/common/Smb.npl

# · Unknown · 10693 lines · 10365 code · 328 blank · 0 comment · 0 complexity · 49a0b3005c99b78e36f712f2f6815c07 MD5 · raw file

  1. //# (c) 2010 Outercurve Foundation
  2. //#
  3. //# Title: Server Message Block Protocol (SMB)
  4. //#
  5. //# Details:
  6. //#
  7. //# Public References: RFC 2478 - Security Blob is Authentication token in RFC 2478 format
  8. //# ftp://ftp.microsoft.com/developr/drg/CIFS/
  9. //# Section "Server Message Block Protocol" of http://protoserver/protocol_without_lh/
  10. //# http://www.jalix.org/ressources/reseaux/nfs-samba/samba/~smb/SMBPUB.DOC
  11. //# Microsoft References: [MS-MSRP]: Messenger Service Remote Protocol Specification
  12. //# [MS-MAIL]: Remote Mailslot Protocol Specification
  13. //# [MS-SMB]: Server Message Block (SMB) Protocol Specification (27.0)
  14. //# [MS-CIFS]: Common Internet File System (CIFS) Protocol Specification (7.0)
  15. //#
  16. //# Comments:
  17. //#
  18. //# Revision Class and Date:Major, 3/25/2009
  19. //# Minor, 10/17/2012
  20. //#
  21. //####
  22. [BuildConversationWithParent]
  23. Protocol SMBOverTCP = FormatString("%s", Property.SMBOverTCPSummary)
  24. {
  25. [
  26. Post.Property.SMBOverTCPIsFirst = Conversation.SMBOverTCPIsStartSeq$[Property.NetworkDirection, Property.TcpSeqNumber] && (Tcp.Flags.Push || HighestReassembledProtocol == "TCP" || HighestReassembledProtocol == "SMBOverTCP"),
  27. Post.Property.SMBOverTCPIsLast = Conversation.SMBOverTCPIsStartSeq$[Property.NetworkDirection, Property.TcpNextSeqNumber] || HighestReassembledProtocol == "SMBOverTCP",
  28. Post.PayloadStart
  29. (
  30. NetworkDirection, /* direction */
  31. 0, /* id */
  32. 0, /* sequence token */
  33. 0, /* next sequence token */
  34. 0, /* total payload length*/
  35. Property.SMBOverTCPIsFirst, /* is first */
  36. Property.SMBOverTCPIsLast, /* is last */
  37. RssmblyIndStartBit+RssmblyIndEndBit+RssmblySelfBit
  38. )
  39. ]
  40. while [FrameLength > FrameOffset]
  41. {
  42. [
  43. Conversation.SMBIsRawData ? Conversation.IsSMBRawDataMV$[FrameNumber] = Conversation.SMBIsRawData : 0,
  44. Property.SMBIsRawData = Conversation.IsSMBRawDataMV$[FrameNumber],
  45. Post.Conversation.SMBIsRawData = Property.SMBIsRawData,
  46. Post.Conversation.SMBOverTCPEndSeqTable$[MakeByteArray(Property.NetworkDirection, Property.TcpNextSeqNumber)] = Conversation.SMBOverTCPEndSeqVar$[Property.NetworkDirection]
  47. ]
  48. SMBOverTCPPacket SMBOverTCPPacket;
  49. }
  50. }
  51. struct SMBOverTCPPacket = IsValueNone(ZERO) ? "Continuation Data" : FormatString("Length = %u%s", Length, Length == 0 ? ", RawDataEnd":"")
  52. {
  53. switch
  54. {
  55. case Property.SMBIsRawData || (UINT8(FrameData, FrameOffset) == 0 && (UINT8(FrameData, FrameOffset + 4) == 0xFF || UINT8(FrameData, FrameOffset + 4) == 0xFE || UINT8(FrameData, FrameOffset + 4) == 0xFD) && Asciistring(FrameData,FrameOffset+5,3) == "SMB"):
  56. [Conversation.SMBOverTCPIsStartSeq$[Property.NetworkDirection, Property.TcpSeqNumber + CurrentProtocolOffset] = true]
  57. [Conversation.SMBOverTCPIsStartSeq$[Property.NetworkDirection, Property.TcpSeqNumber + CurrentProtocolOffset + 4 + UINT24(FrameData, FrameOffset + 1)] = true]
  58. [Conversation.SMBOverTCPEndSeqVar$[Property.NetworkDirection] = Property.TcpSeqNumber + CurrentProtocolOffset + 4 + UINT24(FrameData, FrameOffset + 1)]
  59. [Property.IsMoreThanOneSMBOverTcp = Property.IsMoreThanOneSMBOverTcp ? true : ((FrameLength - FrameOffset) > (4 + UINT24(FrameData, FrameOffset + 1)))]
  60. [Property.SMBOverTCPCount = Property.SMBOverTCPCount + 1]
  61. [Property.SMBOverTCPSummary = Property.SMBOverTCPCount == 1 ? FormatString("Length = %u%s", Length, Length == 0 ? ", RawDataEnd":"") : FormatString("SMBOverTcp Packet Count : %u", Property.SMBOverTCPCount)]
  62. struct
  63. {
  64. UINT8 ZERO;
  65. [DataFieldByteOrder = BigEndian, Property.SMBOverTCPLength]
  66. UINT24 Length;
  67. switch
  68. {
  69. case Length > 0:
  70. [DataFieldFrameLength = FrameOffset + Length]
  71. struct
  72. {
  73. switch
  74. {
  75. case UINT8(FrameData,FrameOffset) == 0xFF &&Asciistring(FrameData,FrameOffset+1,3) == "SMB": // 0xFFSMB
  76. SMB Smb;
  77. case UINT8(FrameData,FrameOffset) == 0xFE &&Asciistring(FrameData,FrameOffset+1,3) == "SMB": // 0xFESMB
  78. case UINT8(FrameData,FrameOffset) == 0xFD &&Asciistring(FrameData,FrameOffset+1,3) == "SMB": // 0xFDSMB
  79. while [FrameOffset < FrameLength]
  80. {
  81. SMB2 SMB2;
  82. }
  83. default:
  84. SMB SmbRawData;
  85. }
  86. switch
  87. {
  88. case FrameOffset < FrameLength:
  89. BLOB(FrameLength - FrameOffset) Padding;
  90. }
  91. }
  92. }
  93. }
  94. default:
  95. switch
  96. {
  97. case IsValueNone(Conversation.SMBOverTCPEndSeqTable$[MakeByteArray(Property.NetworkDirection, Property.TcpSeqNumber)] ):
  98. Blob(FrameLength - FrameOffset) SMBOverTCPContinuationData;
  99. default:
  100. [
  101. Property.SMBOverTCPSummary = "Continuation Data",
  102. Local.SMBOverTCPRemainLengthData = Conversation.SMBOverTCPEndSeqTable$[MakeByteArray(Property.NetworkDirection, Property.TcpSeqNumber)] - Property.TcpSeqNumber,
  103. Local.SMBOverTCPRemainLengthData = FrameLength - FrameOffset > local.SMBOverTCPRemainLengthData ? local.SMBOverTCPRemainLengthData : FrameLength - FrameOffset
  104. ]
  105. Blob(local.SMBOverTCPRemainLengthData) ContinuationData;
  106. }
  107. }
  108. }
  109. ////////////////****************************************************************////////////////
  110. ////////////////************************ SMB Protocol **************************////////////////
  111. ////////////////****************************************************************////////////////
  112. // R - Response, C - Command
  113. [DataTypeByteOrder = LittleEndian, DefaultTimeOut = SMBConversationTimeout]
  114. Protocol SMB = (Property.KrbError ? "KrbError: " + KrbErrorCodeTable(Property.KrbError) + " " : "") +
  115. (Property.SMBResponse ? "R":"C") +
  116. (Property.SMBInterimResponse ? "; InterimResponse" : "") +
  117. (Property.SMBComSummary) +
  118. (Property.AuthSummary ? ", " + Property.AuthSummary : "") +
  119. (Property.SMBFileName.Contains("\\Policies\\{") ? " - Group Policy" : "") +
  120. (Property.SMBErrorSummary) +
  121. ((Property.ParserWarning == 1) ? "; Warning: " + Property.ParserWarningMessage : "")
  122. {
  123. switch(UINT32(FrameData, FrameOffset))
  124. {
  125. case 0x424D53FF:
  126. struct
  127. {
  128. [
  129. SMBCommand = UINT8(FrameData, FrameOffset + 4),
  130. SMBResponse = ( ( UINT8(FrameData, FrameOffset + 9) & 0x80 ) == 0x80 ) ? true : false,
  131. SMBTID = UINT16(FrameData, FrameOffset + 24),
  132. SMBPID = IPX.SMB ? UINT16(FrameData, FrameOffset + 26) : (UINT16(FrameData, FrameOffset + 12)<<16) + UINT16(FrameData, FrameOffset + 26),
  133. SMBUID = UINT16(FrameData, FrameOffset + 28),
  134. SMBMID = UINT16(FrameData, FrameOffset + 30)
  135. ]
  136. [Property.SMBIsRawData = (SMBCommand == 0x1A || SMBCommand == 0x1D)]
  137. switch
  138. {
  139. case SMBResponse /* SMB Response */
  140. && SMBCommand == 0x32: /* SMB Transaction2 */
  141. [
  142. conversation.SMBSubCommandPerFrame$[FrameNumber] = conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],//get from SMB parent protocol conversation
  143. SMBSubCommand = conversation.SMBSubCommandPerFrame$[FrameNumber],
  144. conversation.TransactRequestSetupCountPerFrame$[FrameNumber] = conversation.SMBTransactSetupCount$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  145. TransactRequestSetupCount = conversation.TransactRequestSetupCountPerFrame$[FrameNumber],
  146. conversation.SMBTransInfoLevelPerFrame$[FrameNumber] = conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],//get from SMB conversation
  147. TransInformationLevel = conversation.SMBTransInfoLevelPerFrame$[FrameNumber],//get from SMB parent protocol conversation
  148. conversation.SMBFindResumeKeyRequestedPerFrame$[FrameNumber] = conversation.SMBTransact2FindResumeKey$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  149. FindResumeKeyRequested = conversation.SMBFindResumeKeyRequestedPerFrame$[FrameNumber],
  150. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  151. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  152. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  153. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  154. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, conversation.SMBFileIDCountTable$[FrameNumber])],
  155. conversation.SMBParameterCountPerFrame$[FrameNumber] = conversation.SMBParaCountTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  156. SMBParameterCount = conversation.SMBParameterCountPerFrame$[FrameNumber]
  157. ]
  158. _struct _GetSMBTrans2ResponseProperties{};
  159. }
  160. //
  161. // BuildConversation for SMB Transaction2 Response 0x01, 0x02, 0x05, 0x07, 0x08, 0x10, 0x03, 0x0F, 0x04
  162. //
  163. switch
  164. {
  165. case !conversation.SMB.Id /* Do NOT have a SMB Conversation */
  166. && SMBResponse /* SMB Response */
  167. && SMBCommand == 0x32 /* SMB Transaction2 */
  168. && (SMBSubCommand == 0x01
  169. || SMBSubCommand == 0x02
  170. || SMBSubCommand == 0x05
  171. || SMBSubCommand == 0x07
  172. || SMBSubCommand == 0x08
  173. || SMBSubCommand == 0x10
  174. ||(SMBSubCommand == 0x03 && SMBParameterCount == 0x04)
  175. ||(SMBSubCommand == 0x0F && SMBParameterCount == 0x04)
  176. || SMBSubCommand == 0x04
  177. ):
  178. [
  179. BuildConversationWithParent(
  180. (SMBSubCommand == 0x07 || SMBSubCommand == 0x08|| SMBSubCommand == 0x03|| SMBSubCommand == 0x04|| SMBSubCommand == 0x0F)
  181. ? (Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount))
  182. : MakeByteArray(SMBTID, SMBPID, SMBMID)
  183. ),
  184. Post.Conversation.ConversationDescription
  185. = (SMBSubCommand == 0x07 || SMBSubCommand == 0x08|| SMBSubCommand == 0x03|| SMBSubCommand == 0x04|| SMBSubCommand == 0x0F)
  186. ? (Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID))
  187. : FormatString("(TID:0x%04X, PID:0x%04X, MID:0x%04X) ConvID = %d", SMBTID, SMBPID, SMBMID, ConvID),
  188. conversation.SMBSubCommandPerFrame$[FrameNumber] = conversation.SMB.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],//get from SMB parent protocol conversation
  189. SMBSubCommand = conversation.SMBSubCommandPerFrame$[FrameNumber],
  190. conversation.SMBTransInfoLevelPerFrame$[FrameNumber] = conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],//get from SMB conversation
  191. TransInformationLevel = conversation.SMBTransInfoLevelPerFrame$[FrameNumber]
  192. ]
  193. _struct _BuildConversation{};
  194. }
  195. //
  196. // PaylaodStart for SMB Transaction2 Response 0x01, 0x02, 0x05, 0x07, 0x10
  197. //
  198. switch
  199. {
  200. case (UINT8( Framedata, Offset + 9 ) & 0x80) == 0x80 /* SMB Response */
  201. && !((UINT32(FrameData, FrameOffset + 5) & 0x0000FFFF) == 0x00000005) /* NOT STATUS_BUFFER_OVERFLOW */
  202. && UINT16(FrameData, FrameOffset + 43) == 0 /* ParamDisplacement == 0 */
  203. && UINT16(FrameData, FrameOffset + 49) == 0 /* DataDisplacement == 0 */
  204. && SMBCommand == 0x32 /* SMB Transaction2 */
  205. && (SMBSubCommand == 0x01
  206. || SMBSubCommand == 0x02
  207. || SMBSubCommand == 0x05
  208. || SMBSubCommand == 0x07
  209. || SMBSubCommand == 0x10
  210. ):
  211. [PayloadStart(
  212. NetworkDirection, /* direction */
  213. 0, /* id */
  214. UINT16(FrameData, FrameOffset + 49), //0 /* sequence token */
  215. UINT16(FrameData, FrameOffset + 45), //DataOffset /* next sequence token */
  216. 0, //UINT16(FrameData, FrameOffset + 35) + UINT16(FrameData, FrameOffset + 47), /* total payload length: TotalDataCount + DataOffset*/
  217. 1, /* is first */
  218. UINT16(FrameData, FrameOffset + 35) == UINT16(FrameData, FrameOffset + 45), /* is last */
  219. RssmblyIndStartBit+RssmblyIndEndBit+RssmblySequenceBit+RssmblySelfBit,
  220. 0x0000, /* Properties... */
  221. SMBResponse,
  222. 0x0000,
  223. ""
  224. )
  225. ]
  226. _struct _PayloadStart{};
  227. }
  228. }
  229. }
  230. [
  231. SMBComSummary = "",
  232. SMBComPramSummary = ""
  233. ]
  234. switch(UINT32(FrameData, FrameOffset))
  235. {
  236. case 0x424D53FF:
  237. AsciiString(4) Protocol = AsciiString(frameData,offset +1, 3);
  238. default:
  239. // 0x1A - SMB_COM_READ_RAW, 0x1D - SMB_COM_WRITE_RAW
  240. [
  241. Property.TCPAckNumber = Property.TCPAckNumber ? Property.TCPAckNumber : Conversation.TCPAckToSeqMap$[MakeByteArray(Property.NetworkDirection,Property.TCPSeqNumber)],
  242. Conversation.TCPAckToSeqMap$[MakeByteArray(Property.NetworkDirection,Property.TCPSeqNumber)] = Property.TCPAckNumber,
  243. Property.SMBCommand = Conversation.SMBReadRawFileID$[Property.TCPAckNumber] ? 0x1A : 0x1D,
  244. Property.SMBResponse = Property.SMBCommand == 0x1A ? True : False,
  245. Property.SMBFileID = Property.SMBCommand == 0x1A ? Conversation.SMBReadRawFileID$[Property.TCPAckNumber] : Conversation.SMBWriteRawFileID$[Property.TCPSeqNumber],
  246. Property.SMBFileName = Property.SMBCommand == 0x1A ? Conversation.SMBReadRawFileName$[Property.TCPAckNumber] : Conversation.SMBWriteRawFileName$[Property.TCPSeqNumber],
  247. Property.SMBFIDCount = Property.SMBCommand == 0x1A ? Conversation.SMBReadRawFileIdCount$[Property.TCPAckNumber] : Conversation.SMBWriteRawFileIDCount$[Property.TCPSeqNumber],
  248. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  249. Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  250. SMBComSummary = FormatString("; %s, FID = 0x%04X%s", SMBCommandTable(SMBCommand), SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  251. ]
  252. BLOB(FrameLength - FrameOffset) RawData;
  253. }
  254. [
  255. SMBAndXOffset = 32,
  256. SMBCommand
  257. ]
  258. UINT8 Command = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  259. //#
  260. //# becaust the byteOrder of SMB is LittleEndian, so UINT8( Framedata, Offset + 6 ) is the Most significant Byte of FLAGS2
  261. //# and UINT8( Framedata, Offset + 6 ) & 0x40 refer to FLAGS2.CODES
  262. //#
  263. switch (UINT8( Framedata, Offset + 6 ) & 0x40)
  264. {
  265. case 0x40:
  266. [SMBStatus]
  267. UINT32 NTStatus = FormatString("0x%X, Facility = %s, Severity = %s, Code = %s",
  268. this,
  269. SMBNTStatusFacilityValueTable(Facility),
  270. SMBNTStatusSeverityValueTable(Severity),
  271. SMBNTStatusCodeTable(Facility, Severity, Code)
  272. )
  273. {
  274. UINT32 Code:16 = FormatString(" (%s) %s", this.ToBitString,
  275. SMBNTStatusCodeTable(UINT16(FrameData, FrameOffset+2) & 0x1FFF, /* Facility */
  276. (UINT16(FrameData, FrameOffset+2) & 0xE000) >> 14, /* Severity */
  277. this) /* Code */
  278. );
  279. UINT32 Facility:13 = FormatString("(%s) %s", this.ToBitString, SMBNTStatusFacilityValueTable(this));
  280. UINT32 Customer:1 = FormatString("(%s) %s", this.ToBitString, this ? "Customer Defined" : "NOT Customer Defined");
  281. [SMBNTstatusSeverity,
  282. SMBErrorSummary = (Severity != 0) ? FormatString(" - NT Status: %s - %s, Code = %s",
  283. SMBNTStatusFacilityTable(Facility),
  284. SMBNTStatusSeverityTable(Severity),
  285. SMBNTStatusCodeTable(Facility, Severity, Code)
  286. )
  287. : ""]
  288. UINT32 Severity:2 = FormatString("(%s) %s", this.ToBitString, SMBNTStatusSeverityValueTable(this));
  289. };
  290. case 0x00:
  291. [SMBStatus]
  292. struct DOSError = ErrorClass > 0 ? ErrorClass.ToString + " - " + Error.ToString : ErrorClass.ToString
  293. {
  294. [SMBErrorClass]
  295. UINT8 ErrorClass = SMBErrorClassTable(this);
  296. UINT8 Reserved;
  297. [SMBErrorSummary = ErrorClass > 0 ? " - " + ErrorClass.ToString + ", " + Error.ToString : ""]
  298. UINT16 Error = SMBErrorCodesTable(ErrorClass, this);
  299. };
  300. };
  301. struct SMBHeader = FormatString("%s, TID: 0x%04X, PID: 0x%04X, UID: 0x%04X, MID: 0x%04X", SMBResponse?"Response":"Command", SMBTID, SMBPID, SMBUID, SMBMID)
  302. {
  303. UINT8 Flags
  304. {
  305. UINT8 LockAndRead:1 = FormatString(" (%s) %s (SMB_FLAGS_LOCK_AND_READ_OK)", this.ToBitString, this ? "LOCK_AND_READ and WRITE_AND_UNLOCK supported (Obsolete)" : "LOCK_AND_READ and WRITE_AND_UNLOCK NOT supported (Obsolete)");
  306. UINT8 NoAck:1 = FormatString(" (%s) %s (SMB_FLAGS_SEND_NO_ACK[only applicable when SMB transport is NetBIOS over IPX])", this.ToBitString, this ? "An ACK response is NOT needed" : "An ACK response is needed");
  307. UINT8 Reserved_bit2:1 = FormatString(" (%s) %s (Must Be Zero)", this.ToBitString, "Reserved");
  308. UINT8 CaseInsensitive:1 = FormatString("(%s) %s (SMB_FLAGS_CASE_INSENSITIVE)", this.ToBitString, this ? "SMB paths are case-insensitive" : "SMB paths are case-sensitive");
  309. UINT8 Canonicalized:1 = FormatString(" (%s) %s (SMB_FLAGS_CANONICALIZED_PATHS)", this.ToBitString, this ? "Canonicalized File and pathnames (Obsolete)" : "No canonicalized File and pathnames (Obsolete)");
  310. UINT8 Oplock:1 = FormatString(" (%s) %s (SMB_FLAGS_OPLOCK)", this.ToBitString, this ? "Oplocks supported for OPEN, CREATE & CREATE_NEW (Obsolete)" : "Oplocks NOT supported for OPEN, CREATE & CREATE_NEW (Obsolete)");
  311. UINT8 OplockNotify:1 = FormatString(" (%s) %s (SMB_FLAGS_OPLOCK_NOTIFY_ANY)", this.ToBitString, this ? "Notifications supported for OPEN, CREATE & CREATE_NEW (Obsolete)" : "Notifications NOT supported for OPEN, CREATE & CREATE_NEW (Obsolete)");
  312. [SMBResponse]
  313. UINT8 FromServer:1 = FormatString(" (%s) %s (SMB_FLAGS_SERVER_TO_REDIR)", this.ToBitString, this ? "Response - SMB is being sent from the server" : "Command - SMB is being sent from the client");
  314. };
  315. UINT16 Flags2
  316. {
  317. UINT16 KnowsLongFiles:1 = FormatString(" (%s) %s (SMB_FLAGS2_KNOWS_LONG_NAMES)", this.ToBitString, this ? "Understands Long File Names" : "Understands only DOS 8.3 filenames");
  318. UINT16 KnowsEas:1 = FormatString(" (%s) %s (SMB_FLAGS2_KNOWS_EAS)", this.ToBitString, this ? "Understands extended attributes" : "Does NOT understand extended attributes");
  319. UINT16 SmbSecuritySignature:1 = FormatString(" (%s) %s (SMB_FLAGS2_SMB_SECURITY_SIGNATURE)", this.ToBitString, this ? "Security signatures enabled" : "Security signatures NOT enabled");
  320. UINT16 Compressed:1 = FormatString(" (%s) %s (SMB_FLAGS2_COMPRESSED)", this.ToBitString, this ? "Compression Enabled for REQ_NT_WRITE_ANDX and RESP_READ_ANDX" : "Compression Disabled for REQ_NT_WRITE_ANDX and RESP_READ_ANDX");
  321. UINT16 SecuritySignatureRequired:1 = FormatString("(%s) %s (SMB_FLAGS2_SMB_SECURITY_SIGNATURE_REQUIRED)", this.ToBitString, this ? "Security Signatures are required" : "Security Signatures are NOT required");
  322. UINT16 Reserved_bit5:1 = FormatString(" (%s) %s (Must Be Zero)", this.ToBitString, "Reserved");
  323. UINT16 IsLongName:1 = FormatString(" (%s) %s (SMB_FLAGS2_IS_LONG_NAME)", this.ToBitString, this ? "Use Long File Names" : "DO NOT use Long File Names");
  324. UINT16 Reserved_bits7_9:3 = FormatString(" (%s) %s (Must Be Zero)", this.ToBitString, "Reserved");
  325. [Property.SmbHeaderReparsePath]
  326. UINT16 ReparsePath:1 = FormatString(" (%s) %s (SMB_FLAGS2_REPARSE_PATH)", this.ToBitString, this ? "Reparse path" : "NOT a Reparse path");
  327. [ExtensionSecurity]
  328. UINT16 ExtendedSecurity:1 = FormatString(" (%s) %s (SMB_FLAGS2_EXTENDED_SECURITY)", this.ToBitString, this ? "Aware of extended security" : "NOT aware of extended security");
  329. UINT16 Dfs:1 = FormatString(" (%s) %s (SMB_FLAGS2_DFS)", this.ToBitString, this ? "Filenames use DFS namespace" : "NO DFS namespace");
  330. UINT16 Paging:1 = FormatString(" (%s) %s (SMB_FLAGS2_PAGING_IO)", this.ToBitString, this ? "Read operation allowed with only execute permission (Paging IO)" : "Read operation will NOT be permitted unless user has permission (NO Paging IO)");
  331. UINT16 NTStatus:1 = FormatString(" (%s) %s (SMB_FLAGS2_NT_STATUS)", this.ToBitString, this ? "Using 32-bit NT status error codes" : "Using DOS-style error codes");
  332. [SMBUnicode]
  333. UINT16 Unicode:1 = FormatString(" (%s) %s (SMB_FLAGS2_UNICODE)", this.ToBitString, this ? "Using UNICODE strings" : "Using ASCII strings");
  334. };
  335. // The security signature field and PidHigh was introduced for NT LM 0.12, so earlier dialects did not have these fields
  336. // Since filtering for SMB captures is very common, we will not differentiate the negotiated versions
  337. [Property.PIDHigh]
  338. UINT16 PIDHigh;
  339. Struct SecurityFeatures
  340. {
  341. Switch
  342. {
  343. Case IPX.SMB:
  344. Struct
  345. {
  346. UINT32 Key;
  347. UINT16 Cid;
  348. UINT16 SequenceNumber;
  349. }
  350. Default: BLOB(8) SecuritySignature = FormatString("0x%I64X", this);
  351. }
  352. }
  353. UINT16 Unused;
  354. [SMBTID]
  355. UINT16 TreeID;
  356. [SMBPID = Property.PIDHigh*65536 + ProcessID]
  357. UINT16 ProcessID;
  358. [SMBUID]
  359. UINT16 UserID;
  360. [SMBMID]
  361. UINT16 MultiplexID;
  362. };//# End of struct SMBHeader
  363. switch
  364. {
  365. //
  366. // this is a Error message with no Data
  367. //
  368. case UINT8( Framedata, Offset ) == 0 && (SMBErrorClass > 0 || SMBNTstatusSeverity == 3) && !(SMBCommand == 0x29) && !(SMBCommand == 0x2A):
  369. [
  370. conversation.SMBSubCommandPerFrame$[FrameNumber] = conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  371. SMBSubCommand = conversation.SMBSubCommandPerFrame$[FrameNumber],
  372. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  373. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  374. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]
  375. ? conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] /*If this is a response of create/open...*/
  376. : conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, conversation.SMBFileIDCountTable$[FrameNumber])], /*Get File Name using File ID*/
  377. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  378. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  379. Property.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  380. SMBComSummary = "; " + SMBCommandTable(SMBCommand),
  381. SMBComSummary = ( SMBCommand == 0x32 || SMBCommand == 0xA0 ) ? SMBComSummary + ", " + SMBComSubCommandTable(SMBCommand, SMBSubCommand) : SMBComSummary,
  382. Post.SMBComSummary = SMBComSummary + SMBComPramSummary
  383. ]
  384. struct ErrorMessage
  385. {
  386. UINT8 WordCount;
  387. switch
  388. {
  389. case SMBFileID || Property.SMBFileName:
  390. [
  391. SMBCommand = 0xFF,
  392. SMBComPramSummary = (!conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] && SMBFileID) ? FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "") : ""
  393. ]
  394. _struct BuildConversationForErrorMessage
  395. {
  396. UINT16 ByteCount;
  397. switch
  398. {
  399. case !conversation.SMB.Id:
  400. [ BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  401. Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID)]
  402. struct{};
  403. }
  404. }
  405. default:
  406. [SMBCommand = 0xFF]
  407. UINT16 ByteCount;
  408. }
  409. switch
  410. {
  411. case FrameOffset < FrameLength:
  412. BLOB(FrameLength - FrameOffset) UnknownData;
  413. }
  414. };
  415. default:
  416. [Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber]]
  417. While /*SMBCommands*/[ frameOffset < frameLength && SMBCommand <> 0xFF && frameOffset == ProtocolOffset + SMBAndXOffset ]
  418. {
  419. [
  420. SMBComSummary = SMBComSummary + "; " + SMBCommandTable(SMBCommand),
  421. Post.SMBComSummary = SMBComSummary + SMBComPramSummary
  422. ]
  423. switch(SMBResponse)
  424. {
  425. case 0:
  426. // Request
  427. switch(SMBCommand)
  428. {
  429. case 0x00: SMBComCreateDirectoryRequest CCreateDirectory;
  430. case 0x01: SMBComDeleteDirectoryRequest CDeleteDirectory;
  431. case 0x02: SMBComOpenRequest COpen;
  432. case 0x03: SMBComCreateRequest CCreate;
  433. case 0x04: SMBComCloseRequest CClose;
  434. case 0x05: SMBComFlushRequest CFlush;
  435. case 0x06: SMBComDeleteRequest CDelete;
  436. case 0x07: SMBComRenameRequest CRename;
  437. case 0x08: SMBComQueryInformationRequest CQueryInformation;
  438. case 0x09: SMBComSetInformationRequest CSetInformation;
  439. case 0x0A: SMBComReadRequest CRead;
  440. case 0x0B: SMBComWriteRequest CWrite;
  441. case 0x0C: SMBComLockByteRangeRequest CLockByteRange;
  442. case 0x0D: SMBComUnlockByteRangeRequest CUnlockByteRange;
  443. case 0x0E: SMBComCreateTemporaryRequest CCreateTemporary;
  444. case 0x0F: SMBComCreateNewRequest CCreateNew;
  445. case 0x10: SMBComCheckDirectoryRequest CCheckDirectory;
  446. case 0x11: SMBComProcessExitRequest CProcessExit;
  447. case 0x12: SMBComSeekRequest CSeek;
  448. case 0x13: SMBComLockAndReadRequest CLockAndRead;
  449. case 0x14: SMBComWriteRequestAndUnlockRequest CWriteAndUnlock;
  450. case 0x1A: SMBComReadRequestRawRequest CReadRaw;
  451. case 0x1B: SMBComReadRequestMPXRequest CReadMPX;
  452. case 0x1C: SMBComReadRequestMPXSecondaryRequest CReadMPXSecondary;
  453. case 0x1D: SMBComWriteRequestRawRequest CWriteRaw;
  454. case 0x1E: SMBComWriteRequestMPXRequest CWriteMPX;
  455. case 0x1F: SMBComWriteRequestMPXSecondaryRequest CWriteMPXSecondary;
  456. case 0x22: SMBComSetInformationRequest2 CSetInformation2;
  457. case 0x23: SMBComQueryInformationRequest2 CQueryInformation2;
  458. case 0x24: SMBComLockingAndXRequest CLockingAndX;
  459. case 0x25: SMBComTransactionRequest CTransaction;
  460. case 0x26: SMBComTransactionSecondaryRequest CTransactionSecondary;
  461. case 0x27: SMBComIOCTLPrimaryRequest CIOCTL;
  462. case 0x28: SMBComIOCTLSecondaryRequest CSecondaryIOCTL;
  463. case 0x29: SMBComCopyRequest CCopy;
  464. case 0x2A: SMBComMoveRequest CMove;
  465. case 0x2B: SMBComEchoRequest CEcho;
  466. case 0x2C: SMBComWriteRequestAndCloseRequest CWriteAndClose;
  467. case 0x2D: SmbComOpenAndxClientRequest COpenAndX;
  468. case 0x2E: SMBComReadRequestAndXRequest CReadAndX;
  469. case 0x2F: SMBComWriteRequestAndXRequest CWriteAndX;
  470. case 0x31: SMBComCloseAndTreeDisconnectedRequest CCloseAndTreeDisconnected;
  471. case 0x32: SMBComTransaction2Request CTransaction2;
  472. case 0x33: SMBComTransaction2SecondaryRequest CTransaction2Secondary;
  473. case 0x34: SMBComFindClose2Request CFindClose2;
  474. case 0x35: SMBComFindNotifyCloseRequest CFindNotifyClose;
  475. case 0x70: SMBComTreeConnectRequest CTreeConnect;
  476. case 0x71: SMBComTreeDisconnectRequest CTreeDisconnect;
  477. case 0x72: SMBComNegotiateRequest CNegotiate;
  478. case 0x73: switch(UINT8( Framedata, Offset ))
  479. {
  480. case 10:
  481. switch (ExtensionSecurity)
  482. {
  483. case 0: SmbComSessionSetupAndxClientRequest CSessionSetupAndXRequest;
  484. case 1: SmbComSessionSetupAndxClientRequestExtension CSessionSetupAndXRequestExtension;
  485. }
  486. case 12: SMBComSessionSetupAndXNTLMESSRequest CSessionSetupAndXNTLMESS;
  487. case 13: SMBComSessionSetupAndXNTLMNoESSRequest CSessionSetupAndXNTLMNoESS;
  488. default:
  489. switch (ExtensionSecurity)
  490. {
  491. case 0: SmbComSessionSetupAndxClientRequest CSessionSetupAndXRequest;
  492. case 1: SmbComSessionSetupAndxClientRequestExtension CSessionSetupAndXRequestExtension;
  493. }
  494. }
  495. case 0x74: SMBComLogoffAndXRequest CLogoffAndX;
  496. case 0x75: SmbComTreeConnectAndxClientRequest CTreeConnectAndX;
  497. case 0x80: SMBComQueryInformationDiskRequest CQueryInformationDisk;
  498. case 0x81: SMBComSearchRequest CSearch;
  499. case 0x82: SMBComFindRequest CFind;
  500. case 0x83: SMBComFindUniqueRequest CFindUnique;
  501. case 0x84: SMBComFindCloseRequest CFindClose;
  502. case 0xA0: SMBComNTTransactionRequest CNTTransaction;
  503. case 0xA1: SMBComNTTransactionSecondaryRequest CNTTransactSecondary;
  504. case 0xA2: SMBRequestNTCreateAndX CNTCreateAndX;
  505. case 0xA4: SMBComNTCancelRequest CNTCancel;
  506. case 0xA5: SMBComNTRenameRequest CNTRename;
  507. case 0xC0: SMBComOpenPrintFileRequest COpenPrintFile;
  508. case 0xC1: SMBComWriteRequestPrintFileRequest CWritePrintFile;
  509. case 0xC2: SMBComClosePrintFileRequest CClosePrintFile;
  510. case 0xC3: SMBComGetPrintQueueRequest CGetPrintQueue;
  511. case 0xD0: SMBComSendSingleMessageRequest CSendSingleMessage;
  512. case 0xD1: SMBComSendBroadcastMessageRequest CSendBroadcastMessage;
  513. case 0xD2: SMBComForwardUserNameRequest CForwardUserName;
  514. case 0xD3: SMBComCancelForwardRequest CCancelForward;
  515. case 0xD4: SMBComGetMachineNameRequest CGetMachineName;
  516. case 0xD5: SMBComSendStartOfMultiBlockMessageRequest CSendStartOfMultiBlockMessage;
  517. case 0xD6: SMBComSendEndOfMultiBlockMessageRequest CSendEndOfMultiBlockMessage;
  518. case 0xD7: SMBComSendTextOfMultiBlockMessageRequest CSendTextOfMultiBlockMessage;
  519. case 0xFE: Blob(FrameLength-FrameOffset) SMBCOMINVALIDData;
  520. //NOT implemented
  521. //0xD8 SMBreadbulk
  522. //0xD9 SMBwritebulk
  523. //0xDA SMBwritebulkdata
  524. default: ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("Unknown SMB Command, Command = 0x%X", SMBCommand)) SMBCommandError;
  525. }
  526. case 1:
  527. // Response
  528. switch(SMBCommand)
  529. {
  530. case 0x00: SMBComCreateDirectoryResp RCreateDirectory;
  531. case 0x01: SMBComDeleteDirectoryResp RDeleteDirectory;
  532. case 0x02: SMBComOpenResp ROpen;
  533. case 0x03: SMBComCreateResp RCreate;
  534. case 0x04: SMBComCloseResp RClose;
  535. case 0x05: SMBComFlushResp RFlush;
  536. case 0x06: SMBComDeleteResp RDelete;
  537. case 0x07: SMBComRenameResp RRename;
  538. case 0x08: SMBComQueryInformationResp RQueryInformation;
  539. case 0x09: SMBComSetInformationResp RSetInformation;
  540. case 0x0A: SMBComReadResp RRead;
  541. case 0x0B: SMBComWriteResp RWrite;
  542. case 0x0C: SMBComLockByteRangeResp RLockByteRange;
  543. case 0x0D: SMBComUnlockByteRangeResp RUnlockByteRange;
  544. case 0x0E: SMBComCreateTemporaryResp RCreateTemporary;
  545. case 0x0F: SMBComCreateNewResp RCreateNew;
  546. case 0x10: SMBComCheckDirectoryResp RCheckDirectory;
  547. case 0x11: SMBComProcessExitResp RProcessExit;
  548. case 0x12: SMBComSeekResp RSeek;
  549. case 0x13: SMBComLockAndReadResp RLockAndRead;
  550. case 0x14: SMBComWriteAndUnlockResp RWriteAndUnlock;
  551. case 0x1A: SMBComReadRawResp RReadRaw;
  552. case 0x1B:
  553. case 0x1C: SMBComReadMPXResp RReadMPX;
  554. case 0x1D: SMBComWriteRawResp RWriteRaw;
  555. case 0x1E: SMBComWriteMPXResp RWriteMPX;
  556. case 0x20: SMBComWriteCompleteResp RWriteComplete;
  557. case 0x22: SMBComSetInformation2Resp RSetInformation2;
  558. case 0x23: SMBComQueryInformation2Resp RQueryInformation2;
  559. case 0x24: SMBComLockingAndXResp RLockingAndX;
  560. case 0x25:
  561. case 0x26:
  562. switch(UINT8( Framedata, Offset ))
  563. {
  564. case 0: SMBComInterimTransactionResp RInterimTransaction;
  565. default: SMBComTransactionResp RTransaction;
  566. }
  567. case 0x27:
  568. case 0x28:
  569. switch(UINT8( Framedata, Offset ))
  570. {
  571. case 0 : SMBComInterimResponseIOCTL RInterimIOCTL;
  572. case 8 : SMBComIOCTLResp RIOCTL;
  573. }
  574. case 0x29: SMBComCopyResp RCopy;
  575. case 0x2A: SMBComMoveResp RMove;
  576. case 0x2B: SMBComEchoResp REcho;
  577. case 0x2C: SMBComWriteAndCloseResp RWriteAndClose;
  578. case 0x2D:
  579. switch(UINT8( Framedata, Offset ))
  580. {
  581. case 19: SmbComOpenAndxServerResponseExtension ROpenAndXExtension;
  582. default: SmbComOpenAndxServerResponse ROpenAndX;
  583. }
  584. case 0x2E: SMBComReadAndXResp RReadAndX;
  585. case 0x2F: SMBComWriteAndXResp RWriteAndX;
  586. case 0x31: SMBComCloseAndTreeDisconnectedResp RCloseAndTreeDisconnected;
  587. case 0x32:
  588. case 0x33: switch(UINT8( Framedata, Offset ))
  589. {
  590. case 0: SMBComInterimTransaction2Resp RTransaction2Interim;
  591. default: SMBComTransaction2Resp RTransaction2;
  592. }
  593. case 0x34: SMBComFindClose2Resp RFindClose2;
  594. case 0x35: SMBComFindNotifyCloseResp RFindNotifyClose;
  595. case 0x70: SMBComTreeConnectResp RTreeConnect;
  596. case 0x71: SMBComTreeDisconnectResp RTreeDisconnect;
  597. case 0x72:switch(UINT8( Framedata, Offset ))
  598. {
  599. case 1: SMBComNegotiateDialectUnknownResp RNegotiateDialectUnknown;
  600. case 13: SmbComNegotiateResponseLM21 RNegotiateDialectLANMAN21; // LAN Manager 2.1
  601. case 17: SmbComNegotiateResp RNegotiateDialectNTLM; // NT LAN Manager
  602. default:
  603. ReportParserError(ParserErrorProtocolClassWindows, "SMB", "Unknown SMB Negotiate Response") SMBNegotiateError;
  604. }
  605. case 0x73: switch(UINT8( Framedata, Offset ))
  606. {
  607. case 3: SmbComSessionSetupAndxServerResponse RSessionSetupAndXPriorNTLM;
  608. case 4: SmbComSessionSetupAndxServerResponseExtension RSessionSetupAndXNTLMAll;
  609. default: SmbComSessionSetupAndxServerResponse RSessionSetupAndXDefault;
  610. }
  611. case 0x74: SMBComLogoffAndX RLogoffAndX;
  612. case 0x75: switch(UINT8( Framedata, Offset ))
  613. {
  614. case 2: SMBComTreeConnectAndXBeforeLANMAN2Resp RTreeConnectAndXBeforeLANMAN2;
  615. case 3: SMBComTreeConnectAndXAfterLANMAN2Resp RTreeConnectAndXAfterLANMAN2;
  616. case 7: SmbComTreeConnectAndxServerResponseExtension RTreeConnectAndXExtended;
  617. default: SMBComTreeConnectAndXAfterLANMAN2Resp RTreeConnectAndXDefault;
  618. }
  619. case 0x80: SMBComQueryInformationDiskResp RQueryInformationDisk;
  620. case 0x81: SMBComSearchResp RSearch;
  621. case 0x82: SMBComFindResp RFind;
  622. case 0x83: SMBComFindUniqueResp RFindUnique;
  623. case 0x84: SMBComFindCloseResp RFindClose;
  624. case 0xA0:
  625. case 0xA1: switch(UINT8( Framedata, Offset ))
  626. {
  627. case 0: SMBComInterimResponseNTTransaction RNTTransactionInterim;
  628. default: SMBComNTTransactionResp RNTTransaction;
  629. }
  630. case 0xA2: SMBResponseNTCreateAndX RNTCreateAndX;
  631. case 0xA5: SMBComNTRenameResp RNTRename;
  632. case 0xC0: SMBComOpenPrintFileResp ROpenPrintFile;
  633. case 0xC1: SMBComWritePrintFileResp RWritePrintFile;
  634. case 0xC2: SMBComClosePrintFileResp RClosePrintFile;
  635. case 0xC3: SMBComGetPrintQueueResp RGetPrintQueue;
  636. case 0xD0: SMBComSendSingleMessageResp RSendSingleMessage;
  637. case 0xD2: SMBComForwardUserNameResp RForwardUserName;
  638. case 0xD3: SMBComCancelForwardResp RCancelForward;
  639. case 0xD4: SMBComGetMachineNameResp RGetMachineName;
  640. case 0xD5: SMBComSendStartOfMultiBlockMessageResp RSendStartOfMultiBlockMessage;
  641. case 0xD6: SMBComSendEndOfMultiBlockMessageResp RSendEndOfMultiBlockMessage;
  642. case 0xD7: SMBComSendTextOfMultiBlockMessageResp RSendTextOfMultiBlockMessage;
  643. default: ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("Unknown SMB Command, Command = 0x%X", SMBCommand)) SMBCommandError;
  644. }
  645. default: ReportParserError(ParserErrorProtocolClassWindows, "SMB", "NOT Request or Response") SMBReqResError;
  646. }
  647. }
  648. }
  649. }
  650. Table SMBFormatNumber(format, IsLarge, value)
  651. {
  652. switch
  653. {
  654. case IsLarge && format == "%u": FormatString("%I64u", value);
  655. case IsLarge && format == "%d": FormatString("%I64d", value);
  656. case IsLarge && format == "%x": FormatString("%I64x", value);
  657. case IsLarge && format == "%X": FormatString("%I64X", value);
  658. case format == "%u": FormatString("%u", value);
  659. case format == "%d": FormatString("%d", value);
  660. case format == "%x": FormatString("%x", value);
  661. case format == "%X": FormatString("%X", value);
  662. default: FormatString(format, value);
  663. }
  664. }
  665. /*
  666. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/kmarch/hh/kmarch/Other_2c5642f4-2661-4b69-b503-da1e92ab0db7.xml.asp
  667. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csalpha98/html/5.1.4_status_values_and_exception_codes.asp
  668. smbtab.c line 1756 ~
  669. format of 32 bit NT status
  670. 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  671. 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  672. +---+-+-------------------------+-------------------------------+
  673. |Sev|C| Facility | Code |
  674. +---+-+-------------------------+-------------------------------+
  675. */
  676. Table SMBNTStatusSeverityTable(Severity)
  677. {
  678. switch(Severity)
  679. {
  680. case 0: "Success";
  681. case 1: "Informational";
  682. case 2: "Warning";
  683. case 3: "Error";
  684. default: "Unknown Severity";
  685. }
  686. }
  687. Table SMBNTStatusSeverityValueTable(Severity)
  688. {
  689. switch(Severity)
  690. {
  691. case 0: "STATUS_SEVERITY_SUCCESS";
  692. case 1: "STATUS_SEVERITY_INFORMATIONAL";
  693. case 2: "STATUS_SEVERITY_WARNING";
  694. case 3: "STATUS_SEVERITY_ERROR";
  695. default: "Unknown Severity";
  696. }
  697. }
  698. Table SMBNTStatusFacilityTable(Facility)
  699. {
  700. switch(Facility)
  701. {
  702. case 0: "System";
  703. case 2: "Rpc Runtime";
  704. case 3: "Rpc Stubs";
  705. case 4: "Io Error Code";
  706. case 10: "Terminal Server";
  707. case 16: "Usb Error Code";
  708. case 17: "Hid Error Code";
  709. case 18: "Firewire Error Code";
  710. case 19: "Cluster Error Code";
  711. case 20: "Acpi Error Code";
  712. case 21: "Sxs Error Code";
  713. default: "Unknown Facility";
  714. }
  715. }
  716. Table SMBNTStatusFacilityValueTable(Facility)
  717. {
  718. switch(Facility)
  719. {
  720. case 0: "FACILITY_SYSTEM";
  721. case 2: "FACILITY_RPC_RUNTIME";
  722. case 3: "FACILITY_RPC_STUBS";
  723. case 4: "FACILITY_IO_ERROR_CODE";
  724. case 10: "FACILITY_TERMINAL_SERVER";
  725. case 16: "FACILITY_USB_ERROR_CODE";
  726. case 17: "FACILITY_HID_ERROR_CODE";
  727. case 18: "FACILITY_FIREWIRE_ERROR_CODE";
  728. case 19: "FACILITY_CLUSTER_ERROR_CODE";
  729. case 20: "FACILITY_ACPI_ERROR_CODE";
  730. case 21: "FACILITY_SXS_ERROR_CODE";
  731. default: "Unknown Facility";
  732. }
  733. }
  734. Table SMBNTStatusSystemSuccessCodeTable(code)
  735. {
  736. switch(code)
  737. {
  738. case 0x0000: "STATUS_SUCCESS";
  739. case 0x0001: "STATUS_WAIT_1";
  740. case 0x0002: "STATUS_WAIT_2";
  741. case 0x0003: "STATUS_WAIT_3";
  742. case 0x003F: "STATUS_WAIT_63";
  743. case 0x0080: "STATUS_ABANDONED_WAIT_0";
  744. case 0x00BF: "STATUS_ABANDONED_WAIT_63";
  745. case 0x00C0: "STATUS_USER_APC";
  746. case 0x0100: "STATUS_KERNEL_APC";
  747. case 0x0101: "STATUS_ALERTED";
  748. case 0x0102: "STATUS_TIMEOUT";
  749. case 0x0103: "STATUS_PENDING";
  750. case 0x0104: "STATUS_REPARSE";
  751. case 0x0105: "STATUS_MORE_ENTRIES";
  752. case 0x0106: "STATUS_NOT_ALL_ASSIGNED";
  753. case 0x0107: "STATUS_SOME_NOT_MAPPED";
  754. case 0x0108: "STATUS_OPLOCK_BREAK_IN_PROGRESS";
  755. case 0x0109: "STATUS_VOLUME_MOUNTED";
  756. case 0x010A: "STATUS_RXACT_COMMITTED";
  757. case 0x010B: "STATUS_NOTIFY_CLEANUP";
  758. case 0x010C: "STATUS_NOTIFY_ENUM_DIR";
  759. case 0x010D: "STATUS_NO_QUOTAS_FOR_ACCOUNT";
  760. case 0x010E: "STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED";
  761. case 0x0110: "STATUS_PAGE_FAULT_TRANSITION";
  762. case 0x0111: "STATUS_PAGE_FAULT_DEMAND_ZERO";
  763. case 0x0112: "STATUS_PAGE_FAULT_COPY_ON_WRITE";
  764. case 0x0113: "STATUS_PAGE_FAULT_GUARD_PAGE";
  765. case 0x0114: "STATUS_PAGE_FAULT_PAGING_FILE";
  766. case 0x0115: "STATUS_CACHE_PAGE_LOCKED";
  767. case 0x0116: "STATUS_CRASH_DUMP";
  768. case 0x0117: "STATUS_BUFFER_ALL_ZEROS";
  769. case 0x0118: "STATUS_REPARSE_OBJECT";
  770. default: "Unhandled Success code";
  771. }
  772. }
  773. Table SMBNTStatusSystemInfoCodeTable(code)
  774. {
  775. switch(code)
  776. {
  777. case 0x0000: "STATUS_OBJECT_NAME_EXISTS";
  778. case 0x0001: "STATUS_THREAD_WAS_SUSPENDED";
  779. case 0x0002: "STATUS_WORKING_SET_LIMIT_RANGE";
  780. case 0x0003: "STATUS_IMAGE_NOT_AT_BASE";
  781. case 0x0004: "STATUS_RXACT_STATE_CREATED";
  782. case 0x0005: "STATUS_SEGMENT_NOTIFICATION";
  783. case 0x0006: "STATUS_LOCAL_USER_SESSION_KEY";
  784. case 0x0007: "STATUS_BAD_CURRENT_DIRECTORY";
  785. case 0x0008: "STATUS_SERIAL_MORE_WRITES";
  786. case 0x0009: "STATUS_REGISTRY_RECOVERED";
  787. case 0x000A: "STATUS_FT_READ_RECOVERY_FROM_BACKUP";
  788. case 0x000B: "STATUS_FT_WRITE_RECOVERY";
  789. case 0x000C: "STATUS_SERIAL_COUNTER_TIMEOUT";
  790. case 0x000D: "STATUS_NULL_LM_PASSWORD";
  791. case 0x000E: "STATUS_IMAGE_MACHINE_TYPE_MISMATCH";
  792. case 0x000F: "STATUS_RECEIVE_PARTIAL";
  793. case 0x0010: "STATUS_RECEIVE_EXPEDITED";
  794. case 0x0011: "STATUS_RECEIVE_PARTIAL_EXPEDITED";
  795. case 0x0012: "STATUS_EVENT_DONE";
  796. case 0x0013: "STATUS_EVENT_PENDING";
  797. case 0x0014: "STATUS_CHECKING_FILE_SYSTEM";
  798. case 0x0015: "STATUS_FATAL_APP_EXIT";
  799. case 0x0016: "STATUS_PREDEFINED_HANDLE";
  800. case 0x0017: "STATUS_WAS_UNLOCKED";
  801. case 0x0018: "STATUS_SERVICE_NOTIFICATION";
  802. case 0x0019: "STATUS_WAS_LOCKED";
  803. case 0x001a: "STATUS_LOG_HARD_ERROR";
  804. case 0x001b: "STATUS_ALREADY_WIN32";
  805. default: "Unhandled Info code";
  806. }
  807. }
  808. Table SMBNTStatusSystemWarningCodeTable(code)
  809. {
  810. switch(code)
  811. {
  812. case 0x0001: "STATUS_GUARD_PAGE_VIOLATION";
  813. case 0x0002: "STATUS_DATATYPE_MISALIGNMENT";
  814. case 0x0003: "STATUS_BREAKPOINT";
  815. case 0x0004: "STATUS_SINGLE_STEP";
  816. case 0x0005: "STATUS_BUFFER_OVERFLOW";
  817. case 0x0006: "STATUS_NO_MORE_FILES";
  818. case 0x0007: "STATUS_WAKE_SYSTEM_DEBUGGER";
  819. case 0x0008: "STATUS_WAS_LOCKED";
  820. case 0x0009: "STATUS_WAS_UNLOCKED";
  821. case 0x000A: "STATUS_HANDLES_CLOSED";
  822. case 0x000B: "STATUS_NO_INHERITANCE";
  823. case 0x000C: "STATUS_GUID_SUBSTITUTION_MADE";
  824. case 0x000D: "STATUS_PARTIAL_COPY";
  825. case 0x000E: "STATUS_DEVICE_PAPER_EMPTY";
  826. case 0x000F: "STATUS_DEVICE_POWERED_OFF";
  827. case 0x0010: "STATUS_DEVICE_OFF_LINE";
  828. case 0x0011: "STATUS_DEVICE_BUSY";
  829. case 0x0012: "STATUS_NO_MORE_EAS";
  830. case 0x0013: "STATUS_INVALID_EA_NAME";
  831. case 0x0014: "STATUS_EA_LIST_INCONSISTENT";
  832. case 0x0015: "STATUS_INVALID_EA_FLAG";
  833. case 0x0016: "STATUS_VERIFY_REQUIRED";
  834. case 0x0017: "STATUS_EXTRANEOUS_INFORMATION";
  835. case 0x0018: "STATUS_RXACT_COMMIT_NECESSARY";
  836. case 0x001A: "STATUS_NO_MORE_ENTRIES";
  837. case 0x001B: "STATUS_FILEMARK_DETECTED";
  838. case 0x001C: "STATUS_MEDIA_CHANGED";
  839. case 0x001D: "STATUS_BUS_RESET";
  840. case 0x001E: "STATUS_END_OF_MEDIA";
  841. case 0x001F: "STATUS_BEGINNING_OF_MEDIA";
  842. case 0x0020: "STATUS_MEDIA_CHECK";
  843. case 0x0021: "STATUS_SETMARK_DETECTED";
  844. case 0x0022: "STATUS_NO_DATA_DETECTED";
  845. case 0x0023: "STATUS_REDIRECTOR_HAS_OPEN_HANDLES";
  846. case 0x0024: "STATUS_SERVER_HAS_OPEN_HANDLES";
  847. case 0x0025: "STATUS_ALREADY_DISCONNECTED";
  848. case 0x0026: "STATUS_LONGJUMP";
  849. case 0x002D: "STATUS_STOPPED_ON_SYMLINK";
  850. default: "Unhandled Warning code";
  851. }
  852. }
  853. Table SMBNTStatusSystemErrorCodeTable(code)
  854. {
  855. switch(code)
  856. {
  857. case 0x0001: "STATUS_UNSUCCESSFUL";
  858. case 0x0002: "STATUS_NOT_IMPLEMENTED";
  859. case 0x0003: "STATUS_INVALID_INFO_CLASS";
  860. case 0x0004: "STATUS_INFO_LENGTH_MISMATCH";
  861. case 0x0005: "STATUS_ACCESS_VIOLATION";
  862. case 0x0006: "STATUS_IN_PAGE_ERROR";
  863. case 0x0007: "STATUS_PAGEFILE_QUOTA";
  864. case 0x0008: "STATUS_INVALID_HANDLE";
  865. case 0x0009: "STATUS_BAD_INITIAL_STACK";
  866. case 0x000A: "STATUS_BAD_INITIAL_PC";
  867. case 0x000B: "STATUS_INVALID_CID";
  868. case 0x000C: "STATUS_TIMER_NOT_CANCELED";
  869. case 0x000D: "STATUS_INVALID_PARAMETER";
  870. case 0x000E: "STATUS_NO_SUCH_DEVICE";
  871. case 0x000F: "STATUS_NO_SUCH_FILE";
  872. case 0x0010: "STATUS_INVALID_DEVICE_REQUEST";
  873. case 0x0011: "STATUS_END_OF_FILE";
  874. case 0x0012: "STATUS_WRONG_VOLUME";
  875. case 0x0013: "STATUS_NO_MEDIA_IN_DEVICE";
  876. case 0x0014: "STATUS_UNRECOGNIZED_MEDIA";
  877. case 0x0015: "STATUS_NONEXISTENT_SECTOR";
  878. case 0x0016: "STATUS_MORE_PROCESSING_REQUIRED";
  879. case 0x0017: "STATUS_NO_MEMORY ;// winnt";
  880. case 0x0018: "STATUS_CONFLICTING_ADDRESSES";
  881. case 0x0019: "STATUS_NOT_MAPPED_VIEW";
  882. case 0x001A: "STATUS_UNABLE_TO_FREE_VM";
  883. case 0x001B: "STATUS_UNABLE_TO_DELETE_SECTION";
  884. case 0x001C: "STATUS_INVALID_SYSTEM_SERVICE";
  885. case 0x001D: "STATUS_ILLEGAL_INSTRUCTION";
  886. case 0x001E: "STATUS_INVALID_LOCK_SEQUENCE";
  887. case 0x001F: "STATUS_INVALID_VIEW_SIZE";
  888. case 0x0020: "STATUS_INVALID_FILE_FOR_SECTION";
  889. case 0x0021: "STATUS_ALREADY_COMMITTED";
  890. case 0x0022: "STATUS_ACCESS_DENIED";
  891. case 0x0023: "STATUS_BUFFER_TOO_SMALL";
  892. case 0x0024: "STATUS_OBJECT_TYPE_MISMATCH";
  893. case 0x0025: "STATUS_NONCONTINUABLE_EXCEPTION";
  894. case 0x0026: "STATUS_INVALID_DISPOSITION";
  895. case 0x0027: "STATUS_UNWIND";
  896. case 0x0028: "STATUS_BAD_STACK";
  897. case 0x0029: "STATUS_INVALID_UNWIND_TARGET";
  898. case 0x002A: "STATUS_NOT_LOCKED";
  899. case 0x002B: "STATUS_PARITY_ERROR";
  900. case 0x002C: "STATUS_UNABLE_TO_DECOMMIT_VM";
  901. case 0x002D: "STATUS_NOT_COMMITTED";
  902. case 0x002E: "STATUS_INVALID_PORT_ATTRIBUTES";
  903. case 0x002F: "STATUS_PORT_MESSAGE_TOO_LONG";
  904. case 0x0030: "STATUS_INVALID_PARAMETER_MIX";
  905. case 0x0031: "STATUS_INVALID_QUOTA_LOWER";
  906. case 0x0032: "STATUS_DISK_CORRUPT_ERROR";
  907. case 0x0033: "STATUS_OBJECT_NAME_INVALID";
  908. case 0x0034: "STATUS_OBJECT_NAME_NOT_FOUND";
  909. case 0x0035: "STATUS_OBJECT_NAME_COLLISION";
  910. case 0x0036: "STATUS_HANDLE_NOT_WAITABLE";
  911. case 0x0037: "STATUS_PORT_DISCONNECTED";
  912. case 0x0038: "STATUS_DEVICE_ALREADY_ATTACHED";
  913. case 0x0039: "STATUS_OBJECT_PATH_INVALID";
  914. case 0x003A: "STATUS_OBJECT_PATH_NOT_FOUND";
  915. case 0x003B: "STATUS_OBJECT_PATH_SYNTAX_BAD";
  916. case 0x003C: "STATUS_DATA_OVERRUN";
  917. case 0x003D: "STATUS_DATA_LATE_ERROR";
  918. case 0x003E: "STATUS_DATA_ERROR";
  919. case 0x003F: "STATUS_CRC_ERROR";
  920. case 0x0040: "STATUS_SECTION_TOO_BIG";
  921. case 0x0041: "STATUS_PORT_CONNECTION_REFUSED";
  922. case 0x0042: "STATUS_INVALID_PORT_HANDLE";
  923. case 0x0043: "STATUS_SHARING_VIOLATION";
  924. case 0x0044: "STATUS_QUOTA_EXCEEDED";
  925. case 0x0045: "STATUS_INVALID_PAGE_PROTECTION";
  926. case 0x0046: "STATUS_MUTANT_NOT_OWNED";
  927. case 0x0047: "STATUS_SEMAPHORE_LIMIT_EXCEEDED";
  928. case 0x0048: "STATUS_PORT_ALREADY_SET";
  929. case 0x0049: "STATUS_SECTION_NOT_IMAGE";
  930. case 0x004A: "STATUS_SUSPEND_COUNT_EXCEEDED";
  931. case 0x004B: "STATUS_THREAD_IS_TERMINATING";
  932. case 0x004C: "STATUS_BAD_WORKING_SET_LIMIT";
  933. case 0x004D: "STATUS_INCOMPATIBLE_FILE_MAP";
  934. case 0x004E: "STATUS_SECTION_PROTECTION";
  935. case 0x004F: "STATUS_EAS_NOT_SUPPORTED";
  936. case 0x0050: "STATUS_EA_TOO_LARGE";
  937. case 0x0051: "STATUS_NONEXISTENT_EA_ENTRY";
  938. case 0x0052: "STATUS_NO_EAS_ON_FILE";
  939. case 0x0053: "STATUS_EA_CORRUPT_ERROR";
  940. case 0x0054: "STATUS_FILE_LOCK_CONFLICT";
  941. case 0x0055: "STATUS_LOCK_NOT_GRANTED";
  942. case 0x0056: "STATUS_DELETE_PENDING";
  943. case 0x0057: "STATUS_CTL_FILE_NOT_SUPPORTED";
  944. case 0x0058: "STATUS_UNKNOWN_REVISION";
  945. case 0x0059: "STATUS_REVISION_MISMATCH";
  946. case 0x005A: "STATUS_INVALID_OWNER";
  947. case 0x005B: "STATUS_INVALID_PRIMARY_GROUP";
  948. case 0x005C: "STATUS_NO_IMPERSONATION_TOKEN";
  949. case 0x005D: "STATUS_CANT_DISABLE_MANDATORY";
  950. case 0x005E: "STATUS_NO_LOGON_SERVERS";
  951. case 0x005F: "STATUS_NO_SUCH_LOGON_SESSION";
  952. case 0x0060: "STATUS_NO_SUCH_PRIVILEGE";
  953. case 0x0061: "STATUS_PRIVILEGE_NOT_HELD";
  954. case 0x0062: "STATUS_INVALID_ACCOUNT_NAME";
  955. case 0x0063: "STATUS_USER_EXISTS";
  956. case 0x0064: "STATUS_NO_SUCH_USER";
  957. case 0x0065: "STATUS_GROUP_EXISTS";
  958. case 0x0066: "STATUS_NO_SUCH_GROUP";
  959. case 0x0067: "STATUS_MEMBER_IN_GROUP";
  960. case 0x0068: "STATUS_MEMBER_NOT_IN_GROUP";
  961. case 0x0069: "STATUS_LAST_ADMIN";
  962. case 0x006A: "STATUS_WRONG_PASSWORD";
  963. case 0x006B: "STATUS_ILL_FORMED_PASSWORD";
  964. case 0x006C: "STATUS_PASSWORD_RESTRICTION";
  965. case 0x006D: "STATUS_LOGON_FAILURE";
  966. case 0x006E: "STATUS_ACCOUNT_RESTRICTION";
  967. case 0x006F: "STATUS_INVALID_LOGON_HOURS";
  968. case 0x0070: "STATUS_INVALID_WORKSTATION";
  969. case 0x0071: "STATUS_PASSWORD_EXPIRED";
  970. case 0x0072: "STATUS_ACCOUNT_DISABLED";
  971. case 0x0073: "STATUS_NONE_MAPPED";
  972. case 0x0074: "STATUS_TOO_MANY_LUIDS_REQUESTED";
  973. case 0x0075: "STATUS_LUIDS_EXHAUSTED";
  974. case 0x0076: "STATUS_INVALID_SUB_AUTHORITY";
  975. case 0x0077: "STATUS_INVALID_ACL";
  976. case 0x0078: "STATUS_INVALID_SID";
  977. case 0x0079: "STATUS_INVALID_SECURITY_DESCR";
  978. case 0x007A: "STATUS_PROCEDURE_NOT_FOUND";
  979. case 0x007B: "STATUS_INVALID_IMAGE_FORMAT";
  980. case 0x007C: "STATUS_NO_TOKEN";
  981. case 0x007D: "STATUS_BAD_INHERITANCE_ACL";
  982. case 0x007E: "STATUS_RANGE_NOT_LOCKED";
  983. case 0x007F: "STATUS_DISK_FULL";
  984. case 0x0080: "STATUS_SERVER_DISABLED";
  985. case 0x0081: "STATUS_SERVER_NOT_DISABLED";
  986. case 0x0082: "STATUS_TOO_MANY_GUIDS_REQUESTED";
  987. case 0x0083: "STATUS_GUIDS_EXHAUSTED";
  988. case 0x0084: "STATUS_INVALID_ID_AUTHORITY";
  989. case 0x0085: "STATUS_AGENTS_EXHAUSTED";
  990. case 0x0086: "STATUS_INVALID_VOLUME_LABEL";
  991. case 0x0087: "STATUS_SECTION_NOT_EXTENDED";
  992. case 0x0088: "STATUS_NOT_MAPPED_DATA";
  993. case 0x0089: "STATUS_RESOURCE_DATA_NOT_FOUND";
  994. case 0x008A: "STATUS_RESOURCE_TYPE_NOT_FOUND";
  995. case 0x008B: "STATUS_RESOURCE_NAME_NOT_FOUND";
  996. case 0x008C: "STATUS_ARRAY_BOUNDS_EXCEEDED";
  997. case 0x008D: "STATUS_FLOAT_DENORMAL_OPERAND";
  998. case 0x008E: "STATUS_FLOAT_DIVIDE_BY_ZERO";
  999. case 0x008F: "STATUS_FLOAT_INEXACT_RESULT";
  1000. case 0x0090: "STATUS_FLOAT_INVALID_OPERATION";
  1001. case 0x0091: "STATUS_FLOAT_OVERFLOW";
  1002. case 0x0092: "STATUS_FLOAT_STACK_CHECK";
  1003. case 0x0093: "STATUS_FLOAT_UNDERFLOW";
  1004. case 0x0094: "STATUS_INTEGER_DIVIDE_BY_ZERO";
  1005. case 0x0095: "STATUS_INTEGER_OVERFLOW";
  1006. case 0x0096: "STATUS_PRIVILEGED_INSTRUCTION";
  1007. case 0x0097: "STATUS_TOO_MANY_PAGING_FILES";
  1008. case 0x0098: "STATUS_FILE_INVALID";
  1009. case 0x0099: "STATUS_ALLOTTED_SPACE_EXCEEDED";
  1010. case 0x009A: "STATUS_INSUFFICIENT_RESOURCES";
  1011. case 0x009B: "STATUS_DFS_EXIT_PATH_FOUND";
  1012. case 0x009C: "STATUS_DEVICE_DATA_ERROR";
  1013. case 0x009D: "STATUS_DEVICE_NOT_CONNECTED";
  1014. case 0x009E: "STATUS_DEVICE_POWER_FAILURE";
  1015. case 0x009F: "STATUS_FREE_VM_NOT_AT_BASE";
  1016. case 0x00A0: "STATUS_MEMORY_NOT_ALLOCATED";
  1017. case 0x00A1: "STATUS_WORKING_SET_QUOTA";
  1018. case 0x00A2: "STATUS_MEDIA_WRITE_PROTECTED";
  1019. case 0x00A3: "STATUS_DEVICE_NOT_READY";
  1020. case 0x00A4: "STATUS_INVALID_GROUP_ATTRIBUTES";
  1021. case 0x00A5: "STATUS_BAD_IMPERSONATION_LEVEL";
  1022. case 0x00A6: "STATUS_CANT_OPEN_ANONYMOUS";
  1023. case 0x00A7: "STATUS_BAD_VALIDATION_CLASS";
  1024. case 0x00A8: "STATUS_BAD_TOKEN_TYPE";
  1025. case 0x00A9: "STATUS_BAD_MASTER_BOOT_RECORD";
  1026. case 0x00AA: "STATUS_INSTRUCTION_MISALIGNMENT";
  1027. case 0x00AB: "STATUS_INSTANCE_NOT_AVAILABLE";
  1028. case 0x00AC: "STATUS_PIPE_NOT_AVAILABLE";
  1029. case 0x00AD: "STATUS_INVALID_PIPE_STATE";
  1030. case 0x00AE: "STATUS_PIPE_BUSY";
  1031. case 0x00AF: "STATUS_ILLEGAL_FUNCTION";
  1032. case 0x00B0: "STATUS_PIPE_DISCONNECTED";
  1033. case 0x00B1: "STATUS_PIPE_CLOSING";
  1034. case 0x00B2: "STATUS_PIPE_CONNECTED";
  1035. case 0x00B3: "STATUS_PIPE_LISTENING";
  1036. case 0x00B4: "STATUS_INVALID_READ_MODE";
  1037. case 0x00B5: "STATUS_IO_TIMEOUT";
  1038. case 0x00B6: "STATUS_FILE_FORCED_CLOSED";
  1039. case 0x00B7: "STATUS_PROFILING_NOT_STARTED";
  1040. case 0x00B8: "STATUS_PROFILING_NOT_STOPPED";
  1041. case 0x00B9: "STATUS_COULD_NOT_INTERPRET";
  1042. case 0x00BA: "STATUS_FILE_IS_A_DIRECTORY";
  1043. case 0x00BB: "STATUS_NOT_SUPPORTED";
  1044. case 0x00BC: "STATUS_REMOTE_NOT_LISTENING";
  1045. case 0x00BD: "STATUS_DUPLICATE_NAME";
  1046. case 0x00BE: "STATUS_BAD_NETWORK_PATH";
  1047. case 0x00BF: "STATUS_NETWORK_BUSY";
  1048. case 0x00C0: "STATUS_DEVICE_DOES_NOT_EXIST";
  1049. case 0x00C1: "STATUS_TOO_MANY_COMMANDS";
  1050. case 0x00C2: "STATUS_ADAPTER_HARDWARE_ERROR";
  1051. case 0x00C3: "STATUS_INVALID_NETWORK_RESPONSE";
  1052. case 0x00C4: "STATUS_UNEXPECTED_NETWORK_ERROR";
  1053. case 0x00C5: "STATUS_BAD_REMOTE_ADAPTER";
  1054. case 0x00C6: "STATUS_PRINT_QUEUE_FULL";
  1055. case 0x00C7: "STATUS_NO_SPOOL_SPACE";
  1056. case 0x00C8: "STATUS_PRINT_CANCELLED";
  1057. case 0x00C9: "STATUS_NETWORK_NAME_DELETED";
  1058. case 0x00CA: "STATUS_NETWORK_ACCESS_DENIED";
  1059. case 0x00CB: "STATUS_BAD_DEVICE_TYPE";
  1060. case 0x00CC: "STATUS_BAD_NETWORK_NAME";
  1061. case 0x00CD: "STATUS_TOO_MANY_NAMES";
  1062. case 0x00CE: "STATUS_TOO_MANY_SESSIONS";
  1063. case 0x00CF: "STATUS_SHARING_PAUSED";
  1064. case 0x00D0: "STATUS_REQUEST_NOT_ACCEPTED";
  1065. case 0x00D1: "STATUS_REDIRECTOR_PAUSED";
  1066. case 0x00D2: "STATUS_NET_WRITE_FAULT";
  1067. case 0x00D3: "STATUS_PROFILING_AT_LIMIT";
  1068. case 0x00D4: "STATUS_NOT_SAME_DEVICE";
  1069. case 0x00D5: "STATUS_FILE_RENAMED";
  1070. case 0x00D6: "STATUS_VIRTUAL_CIRCUIT_CLOSED";
  1071. case 0x00D7: "STATUS_NO_SECURITY_ON_OBJECT";
  1072. case 0x00D8: "STATUS_CANT_WAIT";
  1073. case 0x00D9: "STATUS_PIPE_EMPTY";
  1074. case 0x00DA: "STATUS_CANT_ACCESS_DOMAIN_INFO";
  1075. case 0x00DB: "STATUS_CANT_TERMINATE_SELF";
  1076. case 0x00DC: "STATUS_INVALID_SERVER_STATE";
  1077. case 0x00DD: "STATUS_INVALID_DOMAIN_STATE";
  1078. case 0x00DE: "STATUS_INVALID_DOMAIN_ROLE";
  1079. case 0x00DF: "STATUS_NO_SUCH_DOMAIN";
  1080. case 0x00E0: "STATUS_DOMAIN_EXISTS";
  1081. case 0x00E1: "STATUS_DOMAIN_LIMIT_EXCEEDED";
  1082. case 0x00E2: "STATUS_OPLOCK_NOT_GRANTED";
  1083. case 0x00E3: "STATUS_INVALID_OPLOCK_PROTOCOL";
  1084. case 0x00E4: "STATUS_INTERNAL_DB_CORRUPTION";
  1085. case 0x00E5: "STATUS_INTERNAL_ERROR";
  1086. case 0x00E6: "STATUS_GENERIC_NOT_MAPPED";
  1087. case 0x00E7: "STATUS_BAD_DESCRIPTOR_FORMAT";
  1088. case 0x00E8: "STATUS_INVALID_USER_BUFFER";
  1089. case 0x00E9: "STATUS_UNEXPECTED_IO_ERROR";
  1090. case 0x00EA: "STATUS_UNEXPECTED_MM_CREATE_ERR";
  1091. case 0x00EB: "STATUS_UNEXPECTED_MM_MAP_ERROR";
  1092. case 0x00EC: "STATUS_UNEXPECTED_MM_EXTEND_ERR";
  1093. case 0x00ED: "STATUS_NOT_LOGON_PROCESS";
  1094. case 0x00EE: "STATUS_LOGON_SESSION_EXISTS";
  1095. case 0x00EF: "STATUS_INVALID_PARAMETER_1";
  1096. case 0x00F0: "STATUS_INVALID_PARAMETER_2";
  1097. case 0x00F1: "STATUS_INVALID_PARAMETER_3";
  1098. case 0x00F2: "STATUS_INVALID_PARAMETER_4";
  1099. case 0x00F3: "STATUS_INVALID_PARAMETER_5";
  1100. case 0x00F4: "STATUS_INVALID_PARAMETER_6";
  1101. case 0x00F5: "STATUS_INVALID_PARAMETER_7";
  1102. case 0x00F6: "STATUS_INVALID_PARAMETER_8";
  1103. case 0x00F7: "STATUS_INVALID_PARAMETER_9";
  1104. case 0x00F8: "STATUS_INVALID_PARAMETER_10";
  1105. case 0x00F9: "STATUS_INVALID_PARAMETER_11";
  1106. case 0x00FA: "STATUS_INVALID_PARAMETER_12";
  1107. case 0x00FB: "STATUS_REDIRECTOR_NOT_STARTED";
  1108. case 0x00FC: "STATUS_REDIRECTOR_STARTED";
  1109. case 0x00FD: "STATUS_STACK_OVERFLOW ;// winnt";
  1110. case 0x00FE: "STATUS_NO_SUCH_PACKAGE";
  1111. case 0x00FF: "STATUS_BAD_FUNCTION_TABLE";
  1112. case 0x0100: "STATUS_VARIABLE_NOT_FOUND";
  1113. case 0x0101: "STATUS_DIRECTORY_NOT_EMPTY";
  1114. case 0x0102: "STATUS_FILE_CORRUPT_ERROR";
  1115. case 0x0103: "STATUS_NOT_A_DIRECTORY";
  1116. case 0x0104: "STATUS_BAD_LOGON_SESSION_STATE";
  1117. case 0x0105: "STATUS_LOGON_SESSION_COLLISION";
  1118. case 0x0106: "STATUS_NAME_TOO_LONG";
  1119. case 0x0107: "STATUS_FILES_OPEN";
  1120. case 0x0108: "STATUS_CONNECTION_IN_USE";
  1121. case 0x0109: "STATUS_MESSAGE_NOT_FOUND";
  1122. case 0x010A: "STATUS_PROCESS_IS_TERMINATING";
  1123. case 0x010B: "STATUS_INVALID_LOGON_TYPE";
  1124. case 0x010C: "STATUS_NO_GUID_TRANSLATION";
  1125. case 0x010D: "STATUS_CANNOT_IMPERSONATE";
  1126. case 0x010E: "STATUS_IMAGE_ALREADY_LOADED";
  1127. case 0x010F: "STATUS_ABIOS_NOT_PRESENT";
  1128. case 0x0110: "STATUS_ABIOS_LID_NOT_EXIST";
  1129. case 0x0111: "STATUS_ABIOS_LID_ALREADY_OWNED";
  1130. case 0x0112: "STATUS_ABIOS_NOT_LID_OWNER";
  1131. case 0x0113: "STATUS_ABIOS_INVALID_COMMAND";
  1132. case 0x0114: "STATUS_ABIOS_INVALID_LID";
  1133. case 0x0115: "STATUS_ABIOS_SELECTOR_NOT_AVAILABLE";
  1134. case 0x0116: "STATUS_ABIOS_INVALID_SELECTOR";
  1135. case 0x0117: "STATUS_NO_LDT";
  1136. case 0x0118: "STATUS_INVALID_LDT_SIZE";
  1137. case 0x0119: "STATUS_INVALID_LDT_OFFSET";
  1138. case 0x011A: "STATUS_INVALID_LDT_DESCRIPTOR";
  1139. case 0x011B: "STATUS_INVALID_IMAGE_NE_FORMAT";
  1140. case 0x011C: "STATUS_RXACT_INVALID_STATE";
  1141. case 0x011D: "STATUS_RXACT_COMMIT_FAILURE";
  1142. case 0x011E: "STATUS_MAPPED_FILE_SIZE_ZERO";
  1143. case 0x011F: "STATUS_TOO_MANY_OPENED_FILES";
  1144. case 0x0120: "STATUS_CANCELLED";
  1145. case 0x0121: "STATUS_CANNOT_DELETE";
  1146. case 0x0122: "STATUS_INVALID_COMPUTER_NAME";
  1147. case 0x0123: "STATUS_FILE_DELETED";
  1148. case 0x0124: "STATUS_SPECIAL_ACCOUNT";
  1149. case 0x0125: "STATUS_SPECIAL_GROUP";
  1150. case 0x0126: "STATUS_SPECIAL_USER";
  1151. case 0x0127: "STATUS_MEMBERS_PRIMARY_GROUP";
  1152. case 0x0128: "STATUS_FILE_CLOSED";
  1153. case 0x0129: "STATUS_TOO_MANY_THREADS";
  1154. case 0x012A: "STATUS_THREAD_NOT_IN_PROCESS";
  1155. case 0x012B: "STATUS_TOKEN_ALREADY_IN_USE";
  1156. case 0x012C: "STATUS_PAGEFILE_QUOTA_EXCEEDED";
  1157. case 0x012D: "STATUS_COMMITMENT_LIMIT";
  1158. case 0x012E: "STATUS_INVALID_IMAGE_LE_FORMAT";
  1159. case 0x012F: "STATUS_INVALID_IMAGE_NOT_MZ";
  1160. case 0x0130: "STATUS_INVALID_IMAGE_PROTECT";
  1161. case 0x0131: "STATUS_INVALID_IMAGE_WIN_16";
  1162. case 0x0132: "STATUS_LOGON_SERVER_CONFLICT";
  1163. case 0x0133: "STATUS_TIME_DIFFERENCE_AT_DC";
  1164. case 0x0134: "STATUS_SYNCHRONIZATION_REQUIRED";
  1165. case 0x0135: "STATUS_DLL_NOT_FOUND";
  1166. case 0x0136: "STATUS_OPEN_FAILED";
  1167. case 0x0137: "STATUS_IO_PRIVILEGE_FAILED";
  1168. case 0x0138: "STATUS_ORDINAL_NOT_FOUND";
  1169. case 0x0139: "STATUS_ENTRYPOINT_NOT_FOUND";
  1170. case 0x013A: "STATUS_CONTROL_C_EXIT ;// winnt";
  1171. case 0x013B: "STATUS_LOCAL_DISCONNECT";
  1172. case 0x013C: "STATUS_REMOTE_DISCONNECT";
  1173. case 0x013D: "STATUS_REMOTE_RESOURCES";
  1174. case 0x013E: "STATUS_LINK_FAILED";
  1175. case 0x013F: "STATUS_LINK_TIMEOUT";
  1176. case 0x0140: "STATUS_INVALID_CONNECTION";
  1177. case 0x0141: "STATUS_INVALID_ADDRESS";
  1178. case 0x0142: "STATUS_DLL_INIT_FAILED";
  1179. case 0x0143: "STATUS_MISSING_SYSTEMFILE";
  1180. case 0x0144: "STATUS_UNHANDLED_EXCEPTION";
  1181. case 0x0145: "STATUS_APP_INIT_FAILURE";
  1182. case 0x0146: "STATUS_PAGEFILE_CREATE_FAILED";
  1183. case 0x0147: "STATUS_NO_PAGEFILE";
  1184. case 0x0148: "STATUS_INVALID_LEVEL";
  1185. case 0x0149: "STATUS_WRONG_PASSWORD_CORE";
  1186. case 0x014A: "STATUS_ILLEGAL_FLOAT_CONTEXT";
  1187. case 0x014B: "STATUS_PIPE_BROKEN";
  1188. case 0x014C: "STATUS_REGISTRY_CORRUPT";
  1189. case 0x014d: "STATUS_REGISTRY_IO_FAILED";
  1190. case 0x014e: "STATUS_NO_EVENT_PAIR";
  1191. case 0x014f: "STATUS_UNRECOGNIZED_VOLUME";
  1192. case 0x0150: "STATUS_SERIAL_NO_DEVICE_INITED";
  1193. case 0x0151: "STATUS_NO_SUCH_ALIAS";
  1194. case 0x0152: "STATUS_MEMBER_NOT_IN_ALIAS";
  1195. case 0x0153: "STATUS_MEMBER_IN_ALIAS";
  1196. case 0x0154: "STATUS_ALIAS_EXISTS";
  1197. case 0x0155: "STATUS_LOGON_NOT_GRANTED";
  1198. case 0x0156: "STATUS_TOO_MANY_SECRETS";
  1199. case 0x0157: "STATUS_SECRET_TOO_LONG";
  1200. case 0x0158: "STATUS_INTERNAL_DB_ERROR";
  1201. case 0x0159: "STATUS_FULLSCREEN_MODE";
  1202. case 0x015A: "STATUS_TOO_MANY_CONTEXT_IDS";
  1203. case 0x015B: "STATUS_LOGON_TYPE_NOT_GRANTED";
  1204. case 0x015C: "STATUS_NOT_REGISTRY_FILE";
  1205. case 0x015D: "STATUS_NT_CROSS_ENCRYPTION_REQUIRED";
  1206. case 0x015E: "STATUS_DOMAIN_CTRLR_CONFIG_ERROR";
  1207. case 0x015F: "STATUS_FT_MISSING_MEMBER";
  1208. case 0x0160: "STATUS_ILL_FORMED_SERVICE_ENTRY";
  1209. case 0x0161: "STATUS_ILLEGAL_CHARACTER";
  1210. case 0x0162: "STATUS_UNMAPPABLE_CHARACTER";
  1211. case 0x0163: "STATUS_UNDEFINED_CHARACTER";
  1212. case 0x0164: "STATUS_FLOPPY_VOLUME";
  1213. case 0x0165: "STATUS_FLOPPY_ID_MARK_NOT_FOUND";
  1214. case 0x0166: "STATUS_FLOPPY_WRONG_CYLINDER";
  1215. case 0x0167: "STATUS_FLOPPY_UNKNOWN_ERROR";
  1216. case 0x0168: "STATUS_FLOPPY_BAD_REGISTERS";
  1217. case 0x0169: "STATUS_DISK_RECALIBRATE_FAILED";
  1218. case 0x016A: "STATUS_DISK_OPERATION_FAILED";
  1219. case 0x016B: "STATUS_DISK_RESET_FAILED";
  1220. case 0x016C: "STATUS_SHARED_IRQ_BUSY";
  1221. case 0x016D: "STATUS_FT_ORPHANING";
  1222. case 0x0172: "STATUS_PARTITION_FAILURE";
  1223. case 0x0173: "STATUS_INVALID_BLOCK_LENGTH";
  1224. case 0x0174: "STATUS_DEVICE_NOT_PARTITIONED";
  1225. case 0x0175: "STATUS_UNABLE_TO_LOCK_MEDIA";
  1226. case 0x0176: "STATUS_UNABLE_TO_UNLOAD_MEDIA";
  1227. case 0x0177: "STATUS_EOM_OVERFLOW";
  1228. case 0x0178: "STATUS_NO_MEDIA";
  1229. case 0x017A: "STATUS_NO_SUCH_MEMBER";
  1230. case 0x017B: "STATUS_INVALID_MEMBER";
  1231. case 0x017C: "STATUS_KEY_DELETED";
  1232. case 0x017D: "STATUS_NO_LOG_SPACE";
  1233. case 0x017E: "STATUS_TOO_MANY_SIDS";
  1234. case 0x017F: "STATUS_LM_CROSS_ENCRYPTION_REQUIRED";
  1235. case 0x0180: "STATUS_KEY_HAS_CHILDREN";
  1236. case 0x0181: "STATUS_CHILD_MUST_BE_VOLATILE";
  1237. case 0x0182: "STATUS_DEVICE_CONFIGURATION_ERROR";
  1238. case 0x0183: "STATUS_DRIVER_INTERNAL_ERROR";
  1239. case 0x0184: "STATUS_INVALID_DEVICE_STATE";
  1240. case 0x0185: "STATUS_IO_DEVICE_ERROR";
  1241. case 0x0186: "STATUS_DEVICE_PROTOCOL_ERROR";
  1242. case 0x0187: "STATUS_BACKUP_CONTROLLER";
  1243. case 0x0188: "STATUS_LOG_FILE_FULL";
  1244. case 0x0189: "STATUS_TOO_LATE";
  1245. case 0x018A: "STATUS_NO_TRUST_LSA_SECRET";
  1246. case 0x018B: "STATUS_NO_TRUST_SAM_ACCOUNT";
  1247. case 0x018C: "STATUS_TRUSTED_DOMAIN_FAILURE";
  1248. case 0x018D: "STATUS_TRUSTED_RELATIONSHIP_FAILURE";
  1249. case 0x018E: "STATUS_EVENTLOG_FILE_CORRUPT";
  1250. case 0x018F: "STATUS_EVENTLOG_CANT_START";
  1251. case 0x0190: "STATUS_TRUST_FAILURE";
  1252. case 0x0191: "STATUS_MUTANT_LIMIT_EXCEEDED";
  1253. case 0x0192: "STATUS_NETLOGON_NOT_STARTED";
  1254. case 0x0193: "STATUS_ACCOUNT_EXPIRED";
  1255. case 0x0194: "STATUS_POSSIBLE_DEADLOCK";
  1256. case 0x0195: "STATUS_NETWORK_CREDENTIAL_CONFLICT";
  1257. case 0x0196: "STATUS_REMOTE_SESSION_LIMIT";
  1258. case 0x0197: "STATUS_EVENTLOG_FILE_CHANGED";
  1259. case 0x0198: "STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT";
  1260. case 0x0199: "STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT";
  1261. case 0x019A: "STATUS_NOLOGON_SERVER_TRUST_ACCOUNT";
  1262. case 0x019B: "STATUS_DOMAIN_TRUST_INCONSISTENT";
  1263. case 0x019C: "STATUS_FS_DRIVER_REQUIRED";
  1264. case 0x0202: "STATUS_NO_USER_SESSION_KEY";
  1265. case 0x0203: "STATUS_USER_SESSION_DELETED";
  1266. case 0x0204: "STATUS_RESOURCE_LANG_NOT_FOUND";
  1267. case 0x0205: "STATUS_INSUFF_SERVER_RESOURCES";
  1268. case 0x0206: "STATUS_INVALID_BUFFER_SIZE";
  1269. case 0x0207: "STATUS_INVALID_ADDRESS_COMPONENT";
  1270. case 0x0208: "STATUS_INVALID_ADDRESS_WILDCARD";
  1271. case 0x0209: "STATUS_TOO_MANY_ADDRESSES";
  1272. case 0x020A: "STATUS_ADDRESS_ALREADY_EXISTS";
  1273. case 0x020B: "STATUS_ADDRESS_CLOSED";
  1274. case 0x020C: "STATUS_CONNECTION_DISCONNECTED";
  1275. case 0x020D: "STATUS_CONNECTION_RESET";
  1276. case 0x020E: "STATUS_TOO_MANY_NODES";
  1277. case 0x020F: "STATUS_TRANSACTION_ABORTED";
  1278. case 0x0210: "STATUS_TRANSACTION_TIMED_OUT";
  1279. case 0x0211: "STATUS_TRANSACTION_NO_RELEASE";
  1280. case 0x0212: "STATUS_TRANSACTION_NO_MATCH";
  1281. case 0x0213: "STATUS_TRANSACTION_RESPONDED";
  1282. case 0x0214: "STATUS_TRANSACTION_INVALID_ID";
  1283. case 0x0215: "STATUS_TRANSACTION_INVALID_TYPE";
  1284. case 0x0216: "STATUS_NOT_SERVER_SESSION";
  1285. case 0x0217: "STATUS_NOT_CLIENT_SESSION";
  1286. case 0x0218: "STATUS_CANNOT_LOAD_REGISTRY_FILE";
  1287. case 0x0219: "STATUS_DEBUG_ATTACH_FAILED";
  1288. case 0x021A: "STATUS_SYSTEM_PROCESS_TERMINATED";
  1289. case 0x021B: "STATUS_DATA_NOT_ACCEPTED";
  1290. case 0x021C: "STATUS_NO_BROWSER_SERVERS_FOUND";
  1291. case 0x021D: "STATUS_VDM_HARD_ERROR";
  1292. case 0x021E: "STATUS_DRIVER_CANCEL_TIMEOUT";
  1293. case 0x021F: "STATUS_REPLY_MESSAGE_MISMATCH";
  1294. case 0x0220: "STATUS_MAPPED_ALIGNMENT";
  1295. case 0x0221: "STATUS_IMAGE_CHECKSUM_MISMATCH";
  1296. case 0x0222: "STATUS_LOST_WRITEBEHIND_DATA";
  1297. case 0x0223: "STATUS_CLIENT_SERVER_PARAMETERS_INVALID";
  1298. case 0x0224: "STATUS_PASSWORD_MUST_CHANGE";
  1299. case 0x0225: "STATUS_NOT_FOUND";
  1300. case 0x0226: "STATUS_NOT_TINY_STREAM";
  1301. case 0x0227: "STATUS_RECOVERY_FAILURE";
  1302. case 0x0228: "STATUS_STACK_OVERFLOW_READ";
  1303. case 0x0229: "STATUS_FAIL_CHECK";
  1304. case 0x022a: "STATUS_DUPLICATE_OBJECTID";
  1305. case 0x022b: "STATUS_OBJECTID_EXISTS";
  1306. case 0x022c: "STATUS_CONVERT_TO_LARGE";
  1307. case 0x022d: "STATUS_RETRY";
  1308. case 0x022e: "STATUS_FOUND_OUT_OF_SCOPE";
  1309. case 0x022f: "STATUS_ALLOCATE_BUCKET";
  1310. case 0x0230: "STATUS_PROPSET_NOT_FOUND";
  1311. case 0x0231: "STATUS_MARSHALL_OVERFLOW";
  1312. case 0x0232: "STATUS_INVALID_VARIANT";
  1313. case 0x0233: "STATUS_DOMAIN_CONTROLLER_NOT_FOUND";
  1314. case 0x0234: "STATUS_ACCOUNT_LOCKED_OUT";
  1315. case 0x0235: "STATUS_HANDLE_NOT_CLOSABLE";
  1316. case 0x0236: "STATUS_CONNECTION_REFUSED";
  1317. case 0x0237: "STATUS_GRACEFUL_DISCONNECT";
  1318. case 0x0238: "STATUS_ADDRESS_ALREADY_ASSOCIATED";
  1319. case 0x0239: "STATUS_ADDRESS_NOT_ASSOCIATED";
  1320. case 0x023a: "STATUS_CONNECTION_INVALID";
  1321. case 0x023b: "STATUS_CONNECTION_ACTIVE";
  1322. case 0x023c: "STATUS_NETWORK_UNREACHABLE";
  1323. case 0x023d: "STATUS_HOST_UNREACHABLE";
  1324. case 0x023e: "STATUS_PROTOCOL_UNREACHABLE";
  1325. case 0x023f: "STATUS_PORT_UNREACHABLE";
  1326. case 0x0240: "STATUS_REQUEST_ABORTED";
  1327. case 0x0241: "STATUS_CONNECTION_ABORTED";
  1328. case 0x0242: "STATUS_BAD_COMPRESSION_BUFFER";
  1329. case 0x0243: "STATUS_USER_MAPPED_FILE";
  1330. case 0x0244: "STATUS_AUDIT_FAILED";
  1331. case 0x0245: "STATUS_TIMER_RESOLUTION_NOT_SET";
  1332. case 0x0246: "STATUS_CONNECTION_COUNT_LIMIT";
  1333. case 0x0247: "STATUS_LOGIN_TIME_RESTRICTION";
  1334. case 0x0248: "STATUS_LOGIN_WKSTA_RESTRICTION";
  1335. case 0x0249: "STATUS_IMAGE_MP_UP_MISMATCH";
  1336. case 0x0250: "STATUS_INSUFFICIENT_LOGON_INFO";
  1337. case 0x0251: "STATUS_BAD_DLL_ENTRYPOINT";
  1338. case 0x0252: "STATUS_BAD_SERVICE_ENTRYPOINT";
  1339. case 0x0253: "STATUS_LPC_REPLY_LOST";
  1340. case 0x0254: "STATUS_IP_ADDRESS_CONFLICT1";
  1341. case 0x0255: "STATUS_IP_ADDRESS_CONFLICT2";
  1342. case 0x0256: "STATUS_REGISTRY_QUOTA_LIMIT";
  1343. case 0x0257: "STATUS_PATH_NOT_COVERED";
  1344. case 0x0258: "STATUS_NO_CALLBACK_ACTIVE";
  1345. case 0x0259: "STATUS_LICENSE_QUOTA_EXCEEDED";
  1346. case 0x025a: "STATUS_PWD_TOO_SHORT";
  1347. case 0x025b: "STATUS_PWD_TOO_RECENT";
  1348. case 0x025c: "STATUS_PWD_HISTORY_CONFLICT";
  1349. case 0x025e: "STATUS_PLUGPLAY_NO_DEVICE";
  1350. case 0x025f: "STATUS_UNSUPPORTED_COMPRESSION";
  1351. case 0x0260: "STATUS_INVALID_HW_PROFILE";
  1352. case 0x0261: "STATUS_INVALID_PLUGPLAY_DEVICE_PATH";
  1353. case 0x0262: "STATUS_DRIVER_ORDINAL_NOT_FOUND";
  1354. case 0x0263: "STATUS_DRIVER_ENTRYPOINT_NOT_FOUND";
  1355. case 0x0264: "STATUS_RESOURCE_NOT_OWNED";
  1356. case 0x0265: "STATUS_TOO_MANY_LINKS";
  1357. case 0x0266: "STATUS_QUOTA_LIST_INCONSISTENT";
  1358. case 0x0267: "STATUS_FILE_IS_OFFLINE";
  1359. case 0x035C: "STATUS_NETWORK_SESSION_EXPIRED";
  1360. case 0x2001: "STATUS_INVALID_SMB";
  1361. case 0x2005: "STATUS_SMB_BAD_TID";
  1362. case 0x2016: "STATUS_SMB_BAD_COMMAND";
  1363. case 0x205A: "STATUS_SMB_TOO_MANY_UIDS";
  1364. case 0x205B: "STATUS_SMB_BAD_UID";
  1365. case 0x20FB: "STATUS_SMB_USE_STANDARD";
  1366. case 0xA100: "STATUS_HASH_NOT_SUPPORTED";
  1367. case 0xA101: "STATUS_HASH_NOT_PRESENT";
  1368. case 0x0275: "STATUS_NOT_A_REPARSE_POINT";
  1369. default: "Unhandled Error code";
  1370. }
  1371. }
  1372. Table SMBNTStatusCodeTable(Facility, Severity, Code)
  1373. {
  1374. switch
  1375. {
  1376. case Facility == 0 && Severity == 0: FormatString("(%d) %s", Code, SMBNTStatusSystemSuccessCodeTable(Code));
  1377. case Facility == 0 && Severity == 1: FormatString("(%d) %s", Code, SMBNTStatusSystemInfoCodeTable(Code));
  1378. case Facility == 0 && Severity == 2: FormatString("(%d) %s", Code, SMBNTStatusSystemWarningCodeTable(Code));
  1379. case Facility == 0 && Severity == 3: FormatString("(%d) %s", Code, SMBNTStatusSystemErrorCodeTable(Code));
  1380. default: FormatString("(%d) Unhandled status code", code);
  1381. }
  1382. }
  1383. Table SMBComMoveOpenFuncTable( value )
  1384. {
  1385. switch
  1386. {
  1387. case value == 0: "Fail if file exists (0)";
  1388. case value == 1: "Open file if it exists (1)";
  1389. case value == 2: "Replace if target file exists (2)";
  1390. case value == 3: "Unknown (3)";
  1391. }
  1392. }
  1393. [DataTypeByteOrder = LittleEndian]
  1394. struct SMBDATE = FormatString("%d-%02d-%02d", Year + 1980, Month, Day)
  1395. {
  1396. UINT16 Day:5;
  1397. UINT16 Month:4;
  1398. UINT16 Year:7;
  1399. };
  1400. [DataTypeByteOrder = LittleEndian]
  1401. struct SMBTIME = FormatString("%02d:%02d:%02d", Hours, Minutes, TwoSeconds * 2)
  1402. {
  1403. UINT16 TwoSeconds:5;
  1404. UINT16 Minutes:6;
  1405. UINT16 Hours:5;
  1406. };
  1407. Table SMBNTRenameInformationLevel (value)
  1408. {
  1409. switch(value)
  1410. {
  1411. case 0x0001: "Allocation information";
  1412. case 0x0002: "Volume information";
  1413. case 0x0102: "File system volume information";
  1414. case 0x0103: "SMB_NT_RENAME_SET_LINK_INFO";
  1415. case 0x0104: "SMB_NT_RENAME_RENAME_FILE";
  1416. case 0x0105: "SMB_NT_RENAME_MOVE_FILE";
  1417. default: "Unknown";
  1418. }
  1419. }
  1420. Table SMBErrorClassTable(value)
  1421. {
  1422. switch(value)
  1423. {
  1424. case 0x00: "No Error";
  1425. case 0x01: "DOS OS Error";
  1426. case 0x02: "Server Error"; //Server Network File Manager Error
  1427. case 0x03: "Hard Error"; //Hardware Error
  1428. case 0x04: "Extended-OS Error";
  1429. case 0xE1: "RMXError1";
  1430. case 0xE2: "RMXError2";
  1431. case 0xE3: "RMXError3";
  1432. case 0xFF: "Bad SMB format";
  1433. default: FormatString("Unknown (0x%x)", value);
  1434. }
  1435. }
  1436. //
  1437. //http://www.megos.ch/support/doserrors.txt
  1438. //
  1439. Table SMBErrorCodesERRDOSTable(value)
  1440. {
  1441. switch(value)
  1442. {
  1443. case 0x0: FormatString("(%d) NO_ERROR", value);
  1444. case 0x1: FormatString("(%d) INVALID_FUNCTION", value);
  1445. case 0x2: FormatString("(%d) FILE_NOT_FOUND", value);
  1446. case 0x3: FormatString("(%d) PATH_NOT_FOUND", value);
  1447. case 0x4: FormatString("(%d) TOO_MANY_OPEN_FILES", value);
  1448. case 0x5: FormatString("(%d) ACCESS_DENIED", value);
  1449. case 0x6: FormatString("(%d) INVALID_HANDLE", value);
  1450. case 0x7: FormatString("(%d) ARENA_TRASHED", value);
  1451. case 0x8: FormatString("(%d) NOT_ENOUGH_MEMORY", value);
  1452. case 0x9: FormatString("(%d) INVALID_BLOCK", value);
  1453. case 0x0A: FormatString("(%d) BAD_ENVIRONMENT", value);
  1454. case 0x0B: FormatString("(%d) BAD_FORMAT", value);
  1455. case 0x0C: FormatString("(%d) INVALID_ACCESS", value);
  1456. case 0x0D: FormatString("(%d) INVALID_DATA", value);
  1457. case 0x0E: FormatString("(%d) OUTOFMEMORY", value);
  1458. case 0x0F: FormatString("(%d) INVALID_DRIVE", value);
  1459. case 0x10: FormatString("(%d) CURRENT_DIRECTORY", value);
  1460. case 0x11: FormatString("(%d) NOT_SAME_DEVICE", value);
  1461. case 0x12: FormatString("(%d) NO_MORE_FILES", value);
  1462. case 0x13: FormatString("(%d) WRITE_PROTECT", value);
  1463. case 0x14: FormatString("(%d) BAD_UNIT", value);
  1464. case 0x15: FormatString("(%d) NOT_READY", value);
  1465. case 0x16: FormatString("(%d) BAD_COMMAND", value);
  1466. case 0x17: FormatString("(%d) CRC", value);
  1467. case 0x18: FormatString("(%d) BAD_LENGTH", value);
  1468. case 0x19: FormatString("(%d) SEEK", value);
  1469. case 0x1A: FormatString("(%d) NOT_DOS_DISK", value);
  1470. case 0x1B: FormatString("(%d) SECTOR_NOT_FOUND", value);
  1471. case 0x1C: FormatString("(%d) OUT_OF_PAPER", value);
  1472. case 0x1D: FormatString("(%d) WRITE_FAULT", value);
  1473. case 0x1E: FormatString("(%d) READ_FAULT", value);
  1474. case 0x1F: FormatString("(%d) GEN_FAILURE", value);
  1475. case 0x20: FormatString("(%d) SHARING_VIOLATION", value);
  1476. case 0x21: FormatString("(%d) LOCK_VIOLATION", value);
  1477. case 0x22: FormatString("(%d) WRONG_DISK", value);
  1478. case 0x23: FormatString("(%d) FCB_UNAVAILABLE", value);
  1479. case 0x24: FormatString("(%d) SHARING_BUFFER_EXCEEDED", value);
  1480. case 0x26: FormatString("(%d) HANDLE_EOF", value);
  1481. case 0x27: FormatString("(%d) HANDLE_DISK_FULL", value);
  1482. case 0x32: FormatString("(%d) NOT_SUPPORTED", value);
  1483. case 0x33: FormatString("(%d) REM_NOT_LIST", value);
  1484. case 0x34: FormatString("(%d) DUP_NAME", value);
  1485. case 0x35: FormatString("(%d) BAD_NETPATH", value);
  1486. case 0x36: FormatString("(%d) NETWORK_BUSY", value);
  1487. case 0x37: FormatString("(%d) DEV_NOT_EXIST", value);
  1488. case 0x38: FormatString("(%d) TOO_MANY_CMDS", value);
  1489. case 0x39: FormatString("(%d) ADAP_HDW_ERR", value);
  1490. case 0x3A: FormatString("(%d) BAD_NET_RESP", value);
  1491. case 0x3B: FormatString("(%d) UNEXP_NET_ERR", value);
  1492. case 0x3C: FormatString("(%d) BAD_REM_ADAP", value);
  1493. case 0x3D: FormatString("(%d) PRINTQ_FULL", value);
  1494. case 0x3E: FormatString("(%d) NO_SPOOL_SPACE", value);
  1495. case 0x3F: FormatString("(%d) PRINT_CANCELLED", value);
  1496. case 0x40: FormatString("(%d) NETNAME_DELETED", value);
  1497. case 0x41: FormatString("(%d) NETWORK_ACCESS_DENIED", value);
  1498. case 0x42: FormatString("(%d) BAD_DEV_TYPE", value);
  1499. case 0x43: FormatString("(%d) BAD_NET_NAME", value);
  1500. case 0x44: FormatString("(%d) TOO_MANY_NAMES", value);
  1501. case 0x45: FormatString("(%d) TOO_MANY_SESS", value);
  1502. case 0x46: FormatString("(%d) SHARING_PAUSED", value);
  1503. case 0x47: FormatString("(%d) REQ_NOT_ACCEP", value);
  1504. case 0x48: FormatString("(%d) REDIR_PAUSED", value);
  1505. case 0x50: FormatString("(%d) FILE_EXISTS", value);
  1506. case 0x51: FormatString("(%d) DUP_FCB", value);
  1507. case 0x52: FormatString("(%d) CANNOT_MAKE", value);
  1508. case 0x53: FormatString("(%d) FAIL_I24", value);
  1509. case 0x54: FormatString("(%d) OUT_OF_STRUCTURES", value);
  1510. case 0x55: FormatString("(%d) ALREADY_ASSIGNED", value);
  1511. case 0x56: FormatString("(%d) INVALID_PASSWORD", value);
  1512. case 0x57: FormatString("(%d) INVALID_PARAMETER", value);
  1513. case 0x58: FormatString("(%d) NET_WRITE_FAULT", value);
  1514. case 0x59: FormatString("(%d) NO_PROC_SLOTS", value);
  1515. case 0x5A: FormatString("(%d) NOT_FROZEN", value);
  1516. case 0x5B: FormatString("(%d) ERR_TSTOVFL", value);
  1517. case 0x5C: FormatString("(%d) ERR_TSTDUP", value);
  1518. case 0x5D: FormatString("(%d) NO_ITEMS", value);
  1519. case 0x5F: FormatString("(%d) INTERRUPT", value);
  1520. case 0x63: FormatString("(%d) DEVICE_IN_USE", value);
  1521. case 0x64: FormatString("(%d) TOO_MANY_SEMAPHORES", value);
  1522. case 0x65: FormatString("(%d) EXCL_SEM_ALREADY_OWNED", value);
  1523. case 0x66: FormatString("(%d) SEM_IS_SET", value);
  1524. case 0x67: FormatString("(%d) TOO_MANY_SEM_REQUESTS", value);
  1525. case 0x68: FormatString("(%d) INVALID_AT_INTERRUPT_TIME", value);
  1526. case 0x69: FormatString("(%d) SEM_OWNER_DIED", value);
  1527. case 0x6A: FormatString("(%d) SEM_USER_LIMIT", value);
  1528. case 0x6B: FormatString("(%d) DISK_CHANGE", value);
  1529. case 0x6C: FormatString("(%d) DRIVE_LOCKED", value);
  1530. case 0x6D: FormatString("(%d) BROKEN_PIPE", value);
  1531. case 0x6E: FormatString("(%d) OPEN_FAILED", value);
  1532. case 0x6F: FormatString("(%d) BUFFER_OVERFLOW", value);
  1533. case 0x70: FormatString("(%d) DISK_FULL", value);
  1534. case 0x71: FormatString("(%d) NO_MORE_SEARCH_HANDLES", value);
  1535. case 0x72: FormatString("(%d) INVALID_TARGET_HANDLE", value);
  1536. case 0x73: FormatString("(%d) PROTECTION_VIOLATION", value);
  1537. case 0x74: FormatString("(%d) VIOKBD_REQUEST", value);
  1538. case 0x75: FormatString("(%d) INVALID_CATEGORY", value);
  1539. case 0x76: FormatString("(%d) INVALID_VERIFY_SWITCH", value);
  1540. case 0x77: FormatString("(%d) BAD_DRIVER_LEVEL", value);
  1541. case 0x78: FormatString("(%d) CALL_NOT_IMPLEMENTED", value);
  1542. case 0x79: FormatString("(%d) SEM_TIMEOUT", value);
  1543. case 0x7A: FormatString("(%d) INSUFFICIENT_BUFFER", value);
  1544. case 0x7B: FormatString("(%d) INVALID_NAME", value);
  1545. case 0x7C: FormatString("(%d) INVALID_LEVEL", value);
  1546. case 0x7D: FormatString("(%d) NO_VOLUME_LABEL", value);
  1547. case 0x7E: FormatString("(%d) MOD_NOT_FOUND", value);
  1548. case 0x7F: FormatString("(%d) PROC_NOT_FOUND", value);
  1549. case 0x80: FormatString("(%d) WAIT_NO_CHILDREN", value);
  1550. case 0x81: FormatString("(%d) CHILD_NOT_COMPLETE", value);
  1551. case 0x82: FormatString("(%d) DIRECT_ACCESS_HANDLE", value);
  1552. case 0x83: FormatString("(%d) NEGATIVE_SEEK", value);
  1553. case 0x84: FormatString("(%d) SEEK_ON_DEVICE", value);
  1554. case 0x85: FormatString("(%d) IS_JOIN_TARGET", value);
  1555. case 0x86: FormatString("(%d) IS_JOINED", value);
  1556. case 0x87: FormatString("(%d) IS_SUBSTED", value);
  1557. case 0x88: FormatString("(%d) NOT_JOINED", value);
  1558. case 0x89: FormatString("(%d) NOT_SUBSTED", value);
  1559. case 0x8A: FormatString("(%d) JOIN_TO_JOIN", value);
  1560. case 0x8B: FormatString("(%d) SUBST_TO_SUBST", value);
  1561. case 0x8C: FormatString("(%d) JOIN_TO_SUBST", value);
  1562. case 0x8D: FormatString("(%d) SUBST_TO_JOIN", value);
  1563. case 0x8E: FormatString("(%d) BUSY_DRIVE", value);
  1564. case 0x8F: FormatString("(%d) SAME_DRIVE", value);
  1565. case 0x90: FormatString("(%d) DIR_NOT_ROOT", value);
  1566. case 0x91: FormatString("(%d) DIR_NOT_EMPTY", value);
  1567. case 0x92: FormatString("(%d) IS_SUBST_PATH", value);
  1568. case 0x93: FormatString("(%d) IS_JOIN_PATH", value);
  1569. case 0x94: FormatString("(%d) PATH_BUSY", value);
  1570. case 0x95: FormatString("(%d) IS_SUBST_TARGET", value);
  1571. case 0x96: FormatString("(%d) SYSTEM_TRACE", value);
  1572. case 0x97: FormatString("(%d) INVALID_EVENT_COUNT", value);
  1573. case 0x98: FormatString("(%d) TOO_MANY_MUXWAITERS", value);
  1574. case 0x99: FormatString("(%d) INVALID_LIST_FORMAT", value);
  1575. case 0x9A: FormatString("(%d) LABEL_TOO_LONG", value);
  1576. case 0x9B: FormatString("(%d) TOO_MANY_TCBS", value);
  1577. case 0x9C: FormatString("(%d) SIGNAL_REFUSED", value);
  1578. case 0x9D: FormatString("(%d) DISCARDED", value);
  1579. case 0x9E: FormatString("(%d) NOT_LOCKED", value);
  1580. case 0x9F: FormatString("(%d) BAD_THREADID_ADDR", value);
  1581. case 0xA0: FormatString("(%d) BAD_ARGUMENTS", value);
  1582. case 0xA1: FormatString("(%d) BAD_PATHNAME", value);
  1583. case 0xA2: FormatString("(%d) SIGNAL_PENDING", value);
  1584. case 0xA3: FormatString("(%d) UNCERTAIN_MEDIA", value);
  1585. case 0xA4: FormatString("(%d) MAX_THRDS_REACHED", value);
  1586. case 0xA5: FormatString("(%d) MONITORS_NOT_SUPPORTED", value);
  1587. case 0xA6: FormatString("(%d) UNC_DRIVER_NOT_INSTALLED", value);
  1588. case 0xA7: FormatString("(%d) LOCK_FAILED", value);
  1589. case 0xA8: FormatString("(%d) SWAPIO_FAILED", value);
  1590. case 0xA9: FormatString("(%d) SWAPIN_FAILED", value);
  1591. case 0xAA: FormatString("(%d) BUSY", value);
  1592. case 0xAD: FormatString("(%d) CANCEL_VIOLATION", value);
  1593. case 0xAE: FormatString("(%d) ATOMIC_LOCKS_NOT_SUPPORTED", value);
  1594. case 0xB4: FormatString("(%d) INVALID_SEGMENT_NUMBER", value);
  1595. case 0xB5: FormatString("(%d) INVALID_CALLGATE", value);
  1596. case 0xB6: FormatString("(%d) INVALID_ORDINAL", value);
  1597. case 0xB7: FormatString("(%d) ALREADY_EXISTS", value);
  1598. case 0xB8: FormatString("(%d) NO_CHILD_PROCESS", value);
  1599. case 0xB9: FormatString("(%d) CHILD_ALIVE_NOWAIT", value);
  1600. case 0xBA: FormatString("(%d) INVALID_FLAG_NUMBER", value);
  1601. case 0xBB: FormatString("(%d) SEM_NOT_FOUND", value);
  1602. case 0xBC: FormatString("(%d) INVALID_STARTING_CODESEG", value);
  1603. case 0xBD: FormatString("(%d) INVALID_STACKSEG", value);
  1604. case 0xBE: FormatString("(%d) INVALID_MODULETYPE", value);
  1605. case 0xBF: FormatString("(%d) INVALID_EXE_SIGNATURE", value);
  1606. case 0xC0: FormatString("(%d) EXE_MARKED_INVALID", value);
  1607. case 0xC1: FormatString("(%d) BAD_EXE_FORMAT", value);
  1608. case 0xC2: FormatString("(%d) ITERATED_DATA_EXCEEDS_64K", value);
  1609. case 0xC3: FormatString("(%d) INVALID_MINALLOCSIZE", value);
  1610. case 0xC4: FormatString("(%d) DYNLINK_FROM_INVALID_RING", value);
  1611. case 0xC5: FormatString("(%d) IOPL_NOT_ENABLED", value);
  1612. case 0xC6: FormatString("(%d) INVALID_SEGDPL", value);
  1613. case 0xC7: FormatString("(%d) AUTODATASEG_EXCEEDS_64k", value);
  1614. case 0xC8: FormatString("(%d) RING2SEG_MUST_BE_MOVABLE", value);
  1615. case 0xC9: FormatString("(%d) RELOC_CHAIN_XEEDS_SEGLIM", value);
  1616. case 0xCA: FormatString("(%d) INFLOOP_IN_RELOC_CHAIN", value);
  1617. case 0xCB: FormatString("(%d) ENVVAR_NOT_FOUND", value);
  1618. case 0xCC: FormatString("(%d) NOT_CURRENT_CTRY", value);
  1619. case 0xCD: FormatString("(%d) NO_SIGNAL_SENT", value);
  1620. case 0xCE: FormatString("(%d) FILENAME_EXCED_RANGE", value);
  1621. case 0xCF: FormatString("(%d) RING2_STACK_IN_USE", value);
  1622. case 0xD0: FormatString("(%d) META_EXPANSION_TOO_LONG", value);
  1623. case 0xD1: FormatString("(%d) INVALID_SIGNAL_NUMBER", value);
  1624. case 0xD2: FormatString("(%d) THREAD_1_INACTIVE", value);
  1625. case 0xD3: FormatString("(%d) INFO_NOT_AVAIL", value);
  1626. case 0xD4: FormatString("(%d) LOCKED", value);
  1627. case 0xD5: FormatString("(%d) BAD_DYNALINK", value);
  1628. case 0xD6: FormatString("(%d) TOO_MANY_MODULES", value);
  1629. case 0xD7: FormatString("(%d) NESTING_NOT_ALLOWED", value);
  1630. case 0xD8: FormatString("(%d) CANNOT_SHRINK", value);
  1631. case 0xD9: FormatString("(%d) ZOMBIE_PROCESS", value);
  1632. case 0xDA: FormatString("(%d) STACK_IN_HIGH_MEMORY", value);
  1633. case 0xDB: FormatString("(%d) INVALID_EXITROUTINE_RING", value);
  1634. case 0xDC: FormatString("(%d) GETBUF_FAILED", value);
  1635. case 0xDD: FormatString("(%d) FLUSHBUF_FAILED", value);
  1636. case 0xDE: FormatString("(%d) TRANSFER_TOO_LONG", value);
  1637. case 0xE4: FormatString("(%d) NO_CHILDREN", value);
  1638. case 0xE5: FormatString("(%d) INVALID_SCREEN_GROUP", value);
  1639. case 0xE6: FormatString("(%d) BAD_PIPE", value);
  1640. case 0xE7: FormatString("(%d) PIPE_BUSY", value);
  1641. case 0xE8: FormatString("(%d) NO_DATA", value);
  1642. case 0xE9: FormatString("(%d) PIPE_NOT_CONNECTED", value);
  1643. case 0xEA: FormatString("(%d) MORE_DATA", value);
  1644. case 0xF0: FormatString("(%d) VC_DISCONNECTED", value);
  1645. case 0xFA: FormatString("(%d) CIRCULARITY_REQUESTED", value);
  1646. case 0xFB: FormatString("(%d) DIRECTORY_IN_CDS", value);
  1647. case 0xFC: FormatString("(%d) INVALID_FSD_NAME", value);
  1648. case 0xFD: FormatString("(%d) INVALID_PATH", value);
  1649. case 0xFE: FormatString("(%d) INVALID_EA_NAME", value);
  1650. case 0xFF: FormatString("(%d) EA_LIST_INCONSISTENT", value);
  1651. case 0x100: FormatString("(%d) EA_LIST_TOO_LONG", value);
  1652. case 0x101: FormatString("(%d) NO_META_MATCH", value);
  1653. case 0x102: FormatString("(%d) FINDNOTIFY_TIMEOUT", value);
  1654. case 0x103: FormatString("(%d) NO_MORE_ITEMS", value);
  1655. case 0x104: FormatString("(%d) SEARCH_STRUC_REUSED", value);
  1656. case 0x105: FormatString("(%d) CHAR_NOT_FOUND", value);
  1657. case 0x106: FormatString("(%d) TOO_MUCH_STACK", value);
  1658. case 0x107: FormatString("(%d) INVALID_ATTR", value);
  1659. case 0x108: FormatString("(%d) INVALID_STARTING_RING", value);
  1660. case 0x109: FormatString("(%d) INVALID_DLL_INIT_RING", value);
  1661. case 0x10A: FormatString("(%d) CANNOT_COPY", value);
  1662. case 0x10B: FormatString("(%d) DIRECTORY", value);
  1663. case 0x10C: FormatString("(%d) OPLOCKED_FILE", value);
  1664. case 0x10D: FormatString("(%d) OPLOCK_THREAD_EXISTS", value);
  1665. case 0x10E: FormatString("(%d) VOLUME_CHANGED", value);
  1666. case 0x10F: FormatString("(%d) FINDNOTIFY_HANDLE_IN_USE", value);
  1667. case 0x110: FormatString("(%d) FINDNOTIFY_HANDLE_CLOSED", value);
  1668. case 0x111: FormatString("(%d) NOTIFY_OBJECT_REMOVED", value);
  1669. case 0x112: FormatString("(%d) ALREADY_SHUTDOWN", value);
  1670. case 0x113: FormatString("(%d) EAS_DIDNT_FIT", value);
  1671. case 0x114: FormatString("(%d) EA_FILE_CORRUPT", value);
  1672. case 0x115: FormatString("(%d) EA_TABLE_FULL", value);
  1673. case 0x116: FormatString("(%d) INVALID_EA_HANDLE", value);
  1674. case 0x117: FormatString("(%d) NO_CLUSTER", value);
  1675. case 0x118: FormatString("(%d) CREATE_EA_FILE", value);
  1676. case 0x119: FormatString("(%d) CANNOT_OPEN_EA_FILE", value);
  1677. case 0x11A: FormatString("(%d) EAS_NOT_SUPPORTED", value);
  1678. case 0x120: FormatString("(%d) NOT_OWNER", value);
  1679. case 0x12A: FormatString("(%d) TOO_MANY_POSTS", value);
  1680. case 0x12B: FormatString("(%d) PARTIAL_COPY", value);
  1681. case 0x12F: FormatString("(%d) INVALID_PROCID", value);
  1682. case 0x130: FormatString("(%d) INVALID_PDELTA", value);
  1683. case 0x131: FormatString("(%d) NOT_DESCENDANT", value);
  1684. case 0x132: FormatString("(%d) NOT_SESSION_MANAGER", value);
  1685. case 0x133: FormatString("(%d) INVALID_PCLASS", value);
  1686. case 0x134: FormatString("(%d) INVALID_SCOPE", value);
  1687. case 0x135: FormatString("(%d) INVALID_THREADID", value);
  1688. case 0x136: FormatString("(%d) DOSSUB_SHRINK", value);
  1689. case 0x137: FormatString("(%d) DOSSUB_NOMEM", value);
  1690. case 0x138: FormatString("(%d) DOSSUB_OVERLAP", value);
  1691. case 0x139: FormatString("(%d) DOSSUB_BADSIZE", value);
  1692. case 0x13A: FormatString("(%d) DOSSUB_BADFLAG", value);
  1693. case 0x13B: FormatString("(%d) DOSSUB_BADSELECTOR", value);
  1694. case 0x13C: FormatString("(%d) MR_MSG_TOO_LONG", value);
  1695. case 0x13D: FormatString("(%d) MR_MID_NOT_FOUND", value);
  1696. case 0x13E: FormatString("(%d) MR_UN_ACC_MSGF", value);
  1697. case 0x13F: FormatString("(%d) MR_INV_MSGF_FORMAT", value);
  1698. case 0x140: FormatString("(%d) MR_INV_IVCOUNT", value);
  1699. case 0x141: FormatString("(%d) MR_UN_PERFORM", value);
  1700. case 0x142: FormatString("(%d) TS_WAKEUP", value);
  1701. case 0x143: FormatString("(%d) TS_SEMHANDLE", value);
  1702. case 0x144: FormatString("(%d) TS_NOTIMER", value);
  1703. case 0x146: FormatString("(%d) TS_HANDLE", value);
  1704. case 0x147: FormatString("(%d) TS_DATETIME", value);
  1705. case 0x148: FormatString("(%d) SYS_INTERNAL", value);
  1706. case 0x149: FormatString("(%d) QUE_CURRENT_NAME", value);
  1707. case 0x14A: FormatString("(%d) QUE_PROC_NOT_OWNED", value);
  1708. case 0x14B: FormatString("(%d) QUE_PROC_OWNED", value);
  1709. case 0x14C: FormatString("(%d) QUE_DUPLICATE", value);
  1710. case 0x14D: FormatString("(%d) QUE_ELEMENT_NOT_EXIST", value);
  1711. case 0x14E: FormatString("(%d) QUE_NO_MEMORY", value);
  1712. case 0x14F: FormatString("(%d) QUE_INVALID_NAME", value);
  1713. case 0x150: FormatString("(%d) QUE_INVALID_PRIORITY", value);
  1714. case 0x151: FormatString("(%d) QUE_INVALID_HANDLE", value);
  1715. case 0x152: FormatString("(%d) QUE_LINK_NOT_FOUND", value);
  1716. case 0x153: FormatString("(%d) QUE_MEMORY_ERROR", value);
  1717. case 0x154: FormatString("(%d) QUE_PREV_AT_END", value);
  1718. case 0x155: FormatString("(%d) QUE_PROC_NO_ACCESS", value);
  1719. case 0x156: FormatString("(%d) QUE_EMPTY", value);
  1720. case 0x157: FormatString("(%d) QUE_NAME_NOT_EXIST", value);
  1721. case 0x158: FormatString("(%d) QUE_NOT_INITIALIZED", value);
  1722. case 0x159: FormatString("(%d) QUE_UNABLE_TO_ACCESS", value);
  1723. case 0x15A: FormatString("(%d) QUE_UNABLE_TO_ADD", value);
  1724. case 0x15B: FormatString("(%d) QUE_UNABLE_TO_INIT", value);
  1725. case 0x15D: FormatString("(%d) VIO_INVALID_MASK", value);
  1726. case 0x15E: FormatString("(%d) VIO_PTR", value);
  1727. case 0x15F: FormatString("(%d) VIO_APTR", value);
  1728. case 0x160: FormatString("(%d) VIO_RPTR", value);
  1729. case 0x161: FormatString("(%d) VIO_CPTR", value);
  1730. case 0x162: FormatString("(%d) VIO_LPTR", value);
  1731. case 0x163: FormatString("(%d) VIO_MODE", value);
  1732. case 0x164: FormatString("(%d) VIO_WIDTH", value);
  1733. case 0x165: FormatString("(%d) VIO_ATTR", value);
  1734. case 0x166: FormatString("(%d) VIO_ROW", value);
  1735. case 0x167: FormatString("(%d) VIO_COL", value);
  1736. case 0x168: FormatString("(%d) VIO_TOPROW", value);
  1737. case 0x169: FormatString("(%d) VIO_BOTROW", value);
  1738. case 0x16A: FormatString("(%d) VIO_RIGHTCOL", value);
  1739. case 0x16B: FormatString("(%d) VIO_LEFTCOL", value);
  1740. case 0x16C: FormatString("(%d) SCS_CALL", value);
  1741. case 0x16D: FormatString("(%d) SCS_VALUE", value);
  1742. case 0x16E: FormatString("(%d) VIO_WAIT_FLAG", value);
  1743. case 0x16F: FormatString("(%d) VIO_UNLOCK", value);
  1744. case 0x170: FormatString("(%d) SGS_NOT_SESSION_MGR", value);
  1745. case 0x171: FormatString("(%d) SMG_INVALID_SESSION_ID", value);
  1746. case 0x172: FormatString("(%d) SMG_NO_SESSIONS", value);
  1747. case 0x173: FormatString("(%d) SMG_SESSION_NOT_FOUND", value);
  1748. case 0x174: FormatString("(%d) SMG_SET_TITLE", value);
  1749. case 0x175: FormatString("(%d) KBD_PARAMETER", value);
  1750. case 0x176: FormatString("(%d) KBD_NO_DEVICE", value);
  1751. case 0x177: FormatString("(%d) KBD_INVALID_IOWAIT", value);
  1752. case 0x178: FormatString("(%d) KBD_INVALID_LENGTH", value);
  1753. case 0x179: FormatString("(%d) KBD_INVALID_ECHO_MASK", value);
  1754. case 0x17A: FormatString("(%d) KBD_INVALID_INPUT_MASK", value);
  1755. case 0x17B: FormatString("(%d) MON_INVALID_PARMS", value);
  1756. case 0x17C: FormatString("(%d) MON_INVALID_DEVNAME", value);
  1757. case 0x17D: FormatString("(%d) MON_INVALID_HANDLE", value);
  1758. case 0x17E: FormatString("(%d) MON_BUFFER_TOO_SMALL", value);
  1759. case 0x17F: FormatString("(%d) MON_BUFFER_EMPTY", value);
  1760. case 0x180: FormatString("(%d) MON_DATA_TOO_LARGE", value);
  1761. case 0x181: FormatString("(%d) MOUSE_NO_DEVICE", value);
  1762. case 0x182: FormatString("(%d) MOUSE_INV_HANDLE", value);
  1763. case 0x183: FormatString("(%d) MOUSE_INV_PARMS", value);
  1764. case 0x184: FormatString("(%d) MOUSE_CANT_RESET", value);
  1765. case 0x185: FormatString("(%d) MOUSE_DISPLAY_PARMS", value);
  1766. case 0x186: FormatString("(%d) MOUSE_INV_MODULE", value);
  1767. case 0x187: FormatString("(%d) MOUSE_INV_ENTRY_PT", value);
  1768. case 0x188: FormatString("(%d) MOUSE_INV_MASK", value);
  1769. case 0x189: FormatString("(%d) NO_MOUSE_NO_DATA", value);
  1770. case 0x18A: FormatString("(%d) NO_MOUSE_PTR_DRAWN", value);
  1771. case 0x18B: FormatString("(%d) INVALID_FREQUENCY", value);
  1772. case 0x18C: FormatString("(%d) NLS_NO_COUNTRY_FILE", value);
  1773. case 0x18D: FormatString("(%d) NLS_OPEN_FAILED", value);
  1774. case 0x18E: FormatString("(%d) NO_COUNTRY_OR_CODEPAGE", value);
  1775. case 0x18F: FormatString("(%d) NLS_TABLE_TRUNCATED", value);
  1776. case 0x190: FormatString("(%d) NLS_BAD_TYPE", value);
  1777. case 0x191: FormatString("(%d) NLS_TYPE_NOT_FOUND", value);
  1778. case 0x192: FormatString("(%d) VIO_SMG_ONLY", value);
  1779. case 0x193: FormatString("(%d) VIO_INVALID_ASCIIZ", value);
  1780. case 0x194: FormatString("(%d) VIO_DEREGISTER", value);
  1781. case 0x195: FormatString("(%d) VIO_NO_POPUP", value);
  1782. case 0x196: FormatString("(%d) VIO_EXISTING_POPUP", value);
  1783. case 0x197: FormatString("(%d) KBD_SMG_ONLY", value);
  1784. case 0x198: FormatString("(%d) KBD_INVALID_ASCIIZ", value);
  1785. case 0x199: FormatString("(%d) KBD_INVALID_MASK", value);
  1786. case 0x19A: FormatString("(%d) KBD_REGISTER", value);
  1787. case 0x19B: FormatString("(%d) KBD_DEREGISTER", value);
  1788. case 0x19C: FormatString("(%d) MOUSE_SMG_ONLY", value);
  1789. case 0x19D: FormatString("(%d) MOUSE_INVALID_ASCIIZ", value);
  1790. case 0x19E: FormatString("(%d) MOUSE_INVALID_MASK", value);
  1791. case 0x19F: FormatString("(%d) MOUSE_REGISTER", value);
  1792. case 0x1A0: FormatString("(%d) MOUSE_DEREGISTER", value);
  1793. case 0x1A1: FormatString("(%d) SMG_BAD_ACTION", value);
  1794. case 0x1A2: FormatString("(%d) SMG_INVALID_CALL", value);
  1795. case 0x1A3: FormatString("(%d) SCS_SG_NOTFOUND", value);
  1796. case 0x1A4: FormatString("(%d) SCS_NOT_SHELL", value);
  1797. case 0x1A5: FormatString("(%d) VIO_INVALID_PARMS", value);
  1798. case 0x1A6: FormatString("(%d) VIO_FUNCTION_OWNED", value);
  1799. case 0x1A7: FormatString("(%d) VIO_RETURN", value);
  1800. case 0x1A8: FormatString("(%d) SCS_INVALID_FUNCTION", value);
  1801. case 0x1A9: FormatString("(%d) SCS_NOT_SESSION_MGR", value);
  1802. case 0x1AA: FormatString("(%d) VIO_REGISTER", value);
  1803. case 0x1AB: FormatString("(%d) VIO_NO_MODE_THREAD", value);
  1804. case 0x1AC: FormatString("(%d) VIO_NO_SAVE_RESTORE_THD", value);
  1805. case 0x1AD: FormatString("(%d) VIO_IN_BG", value);
  1806. case 0x1AE: FormatString("(%d) VIO_ILLEGAL_DURING_POPUP", value);
  1807. case 0x1AF: FormatString("(%d) SMG_NOT_BASESHELL", value);
  1808. case 0x1B0: FormatString("(%d) SMG_BAD_STATUSREQ", value);
  1809. case 0x1B1: FormatString("(%d) QUE_INVALID_WAIT", value);
  1810. case 0x1B2: FormatString("(%d) VIO_LOCK", value);
  1811. case 0x1B3: FormatString("(%d) MOUSE_INVALID_IOWAIT", value);
  1812. case 0x1B4: FormatString("(%d) VIO_INVALID_HANDLE", value);
  1813. case 0x1B5: FormatString("(%d) VIO_ILLEGAL_DURING_LOCK", value);
  1814. case 0x1B6: FormatString("(%d) VIO_INVALID_LENGTH", value);
  1815. case 0x1B7: FormatString("(%d) KBD_INVALID_HANDLE", value);
  1816. case 0x1B8: FormatString("(%d) KBD_NO_MORE_HANDLE", value);
  1817. case 0x1B9: FormatString("(%d) KBD_CANNOT_CREATE_KCB", value);
  1818. case 0x1BA: FormatString("(%d) KBD_CODEPAGE_LOAD_INCOMPL", value);
  1819. case 0x1BB: FormatString("(%d) KBD_INVALID_CODEPAGE_ID", value);
  1820. case 0x1BC: FormatString("(%d) KBD_NO_CODEPAGE_SUPPORT", value);
  1821. case 0x1BD: FormatString("(%d) KBD_FOCUS_REQUIRED", value);
  1822. case 0x1BE: FormatString("(%d) KBD_FOCUS_ALREADY_ACTIVE", value);
  1823. case 0x1BF: FormatString("(%d) KBD_KEYBOARD_BUSY", value);
  1824. case 0x1C0: FormatString("(%d) KBD_INVALID_CODEPAGE", value);
  1825. case 0x1C1: FormatString("(%d) KBD_UNABLE_TO_FOCUS", value);
  1826. case 0x1C2: FormatString("(%d) SMG_SESSION_NON_SELECT", value);
  1827. case 0x1C3: FormatString("(%d) SMG_SESSION_NOT_FOREGRND", value);
  1828. case 0x1C4: FormatString("(%d) SMG_SESSION_NOT_PARENT", value);
  1829. case 0x1C5: FormatString("(%d) SMG_INVALID_START_MODE", value);
  1830. case 0x1C6: FormatString("(%d) SMG_INVALID_RELATED_OPT", value);
  1831. case 0x1C7: FormatString("(%d) SMG_INVALID_BOND_OPTION", value);
  1832. case 0x1C8: FormatString("(%d) SMG_INVALID_SELECT_OPT", value);
  1833. case 0x1C9: FormatString("(%d) SMG_START_IN_BACKGROUND", value);
  1834. case 0x1CA: FormatString("(%d) SMG_INVALID_STOP_OPTION", value);
  1835. case 0x1CB: FormatString("(%d) SMG_BAD_RESERVE", value);
  1836. case 0x1CC: FormatString("(%d) SMG_PROCESS_NOT_PARENT", value);
  1837. case 0x1CD: FormatString("(%d) SMG_INVALID_DATA_LENGTH", value);
  1838. case 0x1CE: FormatString("(%d) SMG_NOT_BOUND", value);
  1839. case 0x1CF: FormatString("(%d) SMG_RETRY_SUB_ALLOC", value);
  1840. case 0x1D0: FormatString("(%d) KBD_DETACHED", value);
  1841. case 0x1D1: FormatString("(%d) VIO_DETACHED", value);
  1842. case 0x1D2: FormatString("(%d) MOU_DETACHED", value);
  1843. case 0x1D3: FormatString("(%d) VIO_FONT", value);
  1844. case 0x1D4: FormatString("(%d) VIO_USER_FONT", value);
  1845. case 0x1D5: FormatString("(%d) VIO_BAD_CP", value);
  1846. case 0x1D6: FormatString("(%d) VIO_NO_CP", value);
  1847. case 0x1D7: FormatString("(%d) VIO_NA_CP", value);
  1848. case 0x1D8: FormatString("(%d) INVALID_CODE_PAGE", value);
  1849. case 0x1D9: FormatString("(%d) CPLIST_TOO_SMALL", value);
  1850. case 0x1DA: FormatString("(%d) CP_NOT_MOVED", value);
  1851. case 0x1DB: FormatString("(%d) MODE_SWITCH_INIT", value);
  1852. case 0x1DC: FormatString("(%d) CODE_PAGE_NOT_FOUND", value);
  1853. case 0x1DD: FormatString("(%d) UNEXPECTED_SLOT_RETURNED", value);
  1854. case 0x1DE: FormatString("(%d) SMG_INVALID_TRACE_OPTION", value);
  1855. case 0x1DF: FormatString("(%d) VIO_INTERNAL_RESOURCE", value);
  1856. case 0x1E0: FormatString("(%d) VIO_SHELL_INIT", value);
  1857. case 0x1E1: FormatString("(%d) SMG_NO_HARD_ERRORS", value);
  1858. case 0x1E2: FormatString("(%d) CP_SWITCH_INCOMPLETE", value);
  1859. case 0x1E3: FormatString("(%d) VIO_TRANSPARENT_POPUP", value);
  1860. case 0x1E4: FormatString("(%d) CRITSEC_OVERFLOW", value);
  1861. case 0x1E5: FormatString("(%d) CRITSEC_UNDERFLOW", value);
  1862. case 0x1E6: FormatString("(%d) VIO_BAD_RESERVE", value);
  1863. case 0x1E7: FormatString("(%d) INVALID_ADDRESS", value);
  1864. case 0x1E8: FormatString("(%d) ZERO_SELECTORS_REQUESTED", value);
  1865. case 0x1E9: FormatString("(%d) NOT_ENOUGH_SELECTORS_AVA", value);
  1866. case 0x1EA: FormatString("(%d) INVALID_SELECTOR", value);
  1867. case 0x1EB: FormatString("(%d) SMG_INVALID_PROGRAM_TYPE", value);
  1868. case 0x1EC: FormatString("(%d) SMG_INVALID_PGM_CONTROL", value);
  1869. case 0x1ED: FormatString("(%d) SMG_INVALID_INHERIT_OPT", value);
  1870. case 0x1EE: FormatString("(%d) VIO_EXTENDED_SG", value);
  1871. case 0x1EF: FormatString("(%d) VIO_NOT_PRES_MGR_SG", value);
  1872. case 0x1F0: FormatString("(%d) VIO_SHIELD_OWNED", value);
  1873. case 0x1F1: FormatString("(%d) VIO_NO_MORE_HANDLES", value);
  1874. case 0x1F2: FormatString("(%d) VIO_SEE_LOG", value);
  1875. case 0x1F3: FormatString("(%d) VIO_ASSOCIATED_DC", value);
  1876. case 0x1F4: FormatString("(%d) KBD_NO_CONSOLE", value);
  1877. case 0x1F5: FormatString("(%d) MOUSE_NO_CONSOLE", value);
  1878. case 0x1F6: FormatString("(%d) MOUSE_INVALID_HANDLE", value);
  1879. case 0x1F7: FormatString("(%d) SMG_INVALID_DEBUG_PARMS", value);
  1880. case 0x1F8: FormatString("(%d) KBD_EXTENDED_SG", value);
  1881. case 0x1F9: FormatString("(%d) MOU_EXTENDED_SG", value);
  1882. case 0x1FA: FormatString("(%d) SMG_INVALID_ICON_FILE", value);
  1883. case 0x216: FormatString("(%d) ARITHMETIC_OVERFLOW", value);
  1884. case 0x217: FormatString("(%d) PIPE_CONNECTED", value);
  1885. case 0x218: FormatString("(%d) PIPE_LISTENING", value);
  1886. case 0x258: FormatString("(%d) PENDING", value);
  1887. case 0x259: FormatString("(%d) INVALID_PORT_HANDLE", value);
  1888. case 0x25A: FormatString("(%d) PORT_ALREADY_OPEN", value);
  1889. case 0x25B: FormatString("(%d) BUFFER_TOO_SMALL", value);
  1890. case 0x25C: FormatString("(%d) WRONG_INFO_SPECIFIED", value);
  1891. case 0x25D: FormatString("(%d) CANNOT_SET_PORT_INFO", value);
  1892. case 0x25E: FormatString("(%d) PORT_NOT_CONNECTED", value);
  1893. case 0x25F: FormatString("(%d) EVENT_INVALID", value);
  1894. case 0x260: FormatString("(%d) DEVICE_DOES_NOT_EXIST", value);
  1895. case 0x261: FormatString("(%d) DEVICETYPE_DOES_NOT_EXIST", value);
  1896. case 0x262: FormatString("(%d) BUFFER_INVALID", value);
  1897. case 0x263: FormatString("(%d) ROUTE_NOT_AVAILABLE", value);
  1898. case 0x264: FormatString("(%d) ROUTE_NOT_ALLOCATED", value);
  1899. case 0x265: FormatString("(%d) INVALID_COMPRESSION_SPECIFIED", value);
  1900. case 0x266: FormatString("(%d) OUT_OF_BUFFERS", value);
  1901. case 0x267: FormatString("(%d) PORT_NOT_FOUND", value);
  1902. case 0x268: FormatString("(%d) ASYNC_REQUEST_PENDING", value);
  1903. case 0x269: FormatString("(%d) ALREADY_DISCONNECTING", value);
  1904. case 0x26A: FormatString("(%d) PORT_NOT_OPEN", value);
  1905. case 0x26B: FormatString("(%d) PORT_DISCONNECTED", value);
  1906. case 0x26C: FormatString("(%d) NO_ENDPOINTS", value);
  1907. case 0x26D: FormatString("(%d) CANNOT_OPEN_PHONEBOOK", value);
  1908. case 0x26E: FormatString("(%d) CANNOT_LOAD_PHONEBOOK", value);
  1909. case 0x26F: FormatString("(%d) CANNOT_FIND_PHONEBOOK_ENTRY", value);
  1910. case 0x270: FormatString("(%d) CANNOT_WRITE_PHONEBOOK", value);
  1911. case 0x271: FormatString("(%d) CORRUPT_PHONEBOOK", value);
  1912. case 0x272: FormatString("(%d) CANNOT_LOAD_STRING", value);
  1913. case 0x273: FormatString("(%d) KEY_NOT_FOUND", value);
  1914. case 0x274: FormatString("(%d) DISCONNECTION", value);
  1915. case 0x275: FormatString("(%d) REMOTE_DISCONNECTION", value);
  1916. case 0x276: FormatString("(%d) HARDWARE_FAILURE", value);
  1917. case 0x277: FormatString("(%d) USER_DISCONNECTION", value);
  1918. case 0x278: FormatString("(%d) INVALID_SIZE", value);
  1919. case 0x279: FormatString("(%d) PORT_NOT_AVAILABLE", value);
  1920. case 0x27A: FormatString("(%d) CANNOT_PROJECT_CLIENT", value);
  1921. case 0x27B: FormatString("(%d) UNKNOWN", value);
  1922. case 0x27C: FormatString("(%d) WRONG_DEVICE_ATTACHED", value);
  1923. case 0x27D: FormatString("(%d) BAD_STRING", value);
  1924. case 0x27E: FormatString("(%d) REQUEST_TIMEOUT", value);
  1925. case 0x27F: FormatString("(%d) CANNOT_GET_LANA", value);
  1926. case 0x280: FormatString("(%d) NETBIOS_ERROR", value);
  1927. case 0x281: FormatString("(%d) SERVER_OUT_OF_RESOURCES", value);
  1928. case 0x282: FormatString("(%d) NAME_EXISTS_ON_NET", value);
  1929. case 0x283: FormatString("(%d) SERVER_GENERAL_NET_FAILURE", value);
  1930. case 0x284: FormatString("(%d) WARNING_MSG_ALIAS_NOT_ADDED", value);
  1931. case 0x285: FormatString("(%d) AUTH_INTERNAL", value);
  1932. case 0x286: FormatString("(%d) RESTRICTED_LOGON_HOURS", value);
  1933. case 0x287: FormatString("(%d) ACCT_DISABLED", value);
  1934. case 0x288: FormatString("(%d) PASSWD_EXPIRED", value);
  1935. case 0x289: FormatString("(%d) NO_DIALIN_PERMISSION", value);
  1936. case 0x28A: FormatString("(%d) SERVER_NOT_RESPONDING", value);
  1937. case 0x28B: FormatString("(%d) FROM_DEVICE", value);
  1938. case 0x28C: FormatString("(%d) UNRECOGNIZED_RESPONSE", value);
  1939. case 0x28D: FormatString("(%d) MACRO_NOT_FOUND", value);
  1940. case 0x28E: FormatString("(%d) MACRO_NOT_DEFINED", value);
  1941. case 0x28F: FormatString("(%d) MESSAGE_MACRO_NOT_FOUND", value);
  1942. case 0x290: FormatString("(%d) DEFAULTOFF_MACRO_NOT_FOUND", value);
  1943. case 0x291: FormatString("(%d) FILE_COULD_NOT_BE_OPENED", value);
  1944. case 0x292: FormatString("(%d) DEVICENAME_TOO_LONG", value);
  1945. case 0x293: FormatString("(%d) DEVICENAME_NOT_FOUND", value);
  1946. case 0x294: FormatString("(%d) NO_RESPONSES", value);
  1947. case 0x295: FormatString("(%d) NO_COMMAND_FOUND", value);
  1948. case 0x296: FormatString("(%d) WRONG_KEY_SPECIFIED", value);
  1949. case 0x297: FormatString("(%d) UNKNOWN_DEVICE_TYPE", value);
  1950. case 0x298: FormatString("(%d) ALLOCATING_MEMORY", value);
  1951. case 0x299: FormatString("(%d) PORT_NOT_CONFIGURED", value);
  1952. case 0x29A: FormatString("(%d) DEVICE_NOT_READY", value);
  1953. case 0x29B: FormatString("(%d) READING_INI_FILE", value);
  1954. case 0x29C: FormatString("(%d) NO_CONNECTION", value);
  1955. case 0x29D: FormatString("(%d) BAD_USAGE_IN_INI_FILE", value);
  1956. case 0x29E: FormatString("(%d) READING_SECTIONNAME", value);
  1957. case 0x29F: FormatString("(%d) READING_DEVICETYPE", value);
  1958. case 0x2A0: FormatString("(%d) READING_DEVICENAME", value);
  1959. case 0x2A1: FormatString("(%d) READING_USAGE", value);
  1960. case 0x2A2: FormatString("(%d) READING_MAXCONNECTBPS", value);
  1961. case 0x2A3: FormatString("(%d) READING_MAXCARRIERBPS", value);
  1962. case 0x2A4: FormatString("(%d) LINE_BUSY", value);
  1963. case 0x2A5: FormatString("(%d) VOICE_ANSWER", value);
  1964. case 0x2A6: FormatString("(%d) NO_ANSWER", value);
  1965. case 0x2A7: FormatString("(%d) NO_CARRIER", value);
  1966. case 0x2A8: FormatString("(%d) NO_DIALTONE", value);
  1967. case 0x2A9: FormatString("(%d) IN_COMMAND", value);
  1968. case 0x2AA: FormatString("(%d) WRITING_SECTIONNAME", value);
  1969. case 0x2AB: FormatString("(%d) WRITING_DEVICETYPE", value);
  1970. case 0x2AC: FormatString("(%d) WRITING_DEVICENAME", value);
  1971. case 0x2AD: FormatString("(%d) WRITING_MAXCONNECTBPS", value);
  1972. case 0x2AE: FormatString("(%d) WRITING_MAXCARRIERBPS", value);
  1973. case 0x2AF: FormatString("(%d) WRITING_USAGE", value);
  1974. case 0x2B0: FormatString("(%d) WRITING_DEFAULTOFF", value);
  1975. case 0x2B1: FormatString("(%d) READING_DEFAULTOFF", value);
  1976. case 0x2B2: FormatString("(%d) EMPTY_INI_FILE", value);
  1977. case 0x2B3: FormatString("(%d) AUTHENTICATION_FAILURE", value);
  1978. case 0x2B4: FormatString("(%d) PORT_OR_DEVICE", value);
  1979. case 0x2B5: FormatString("(%d) NOT_BINARY_MACRO", value);
  1980. case 0x2B6: FormatString("(%d) DCB_NOT_FOUND", value);
  1981. case 0x2B7: FormatString("(%d) STATE_MACHINES_NOT_STARTED", value);
  1982. case 0x2B8: FormatString("(%d) STATE_MACHINES_ALREADY_STARTED", value);
  1983. case 0x2B9: FormatString("(%d) PARTIAL_RESPONSE_LOOPING", value);
  1984. case 0x2BA: FormatString("(%d) UNKNOWN_RESPONSE_KEY", value);
  1985. case 0x2BB: FormatString("(%d) RECV_BUF_FULL", value);
  1986. case 0x2BC: FormatString("(%d) CMD_TOO_LONG", value);
  1987. case 0x2BD: FormatString("(%d) UNSUPPORTED_BPS", value);
  1988. case 0x2BE: FormatString("(%d) UNEXPECTED_RESPONSE", value);
  1989. case 0x2BF: FormatString("(%d) INTERACTIVE_MODE", value);
  1990. case 0x2C0: FormatString("(%d) BAD_CALLBACK_NUMBER", value);
  1991. case 0x2C1: FormatString("(%d) INVALID_AUTH_STATE", value);
  1992. case 0x2C2: FormatString("(%d) WRITING_INITBPS", value);
  1993. case 0x2C3: FormatString("(%d) X25_DIAGNOSTIC", value);
  1994. case 0x2C4: FormatString("(%d) ACCT_EXPIRED", value);
  1995. case 0x2C5: FormatString("(%d) CHANGING_PASSWORD", value);
  1996. case 0x2C6: FormatString("(%d) OVERRUN", value);
  1997. case 0x2C7: FormatString("(%d) RASMAN_CANNOT_INITIALIZE", value);
  1998. case 0x2C8: FormatString("(%d) BIPLEX_PORT_NOT_AVAILABLE", value);
  1999. case 0x2C9: FormatString("(%d) NO_ACTIVE_ISDN_LINES", value);
  2000. case 0x2CA: FormatString("(%d) NO_ISDN_CHANNELS_AVAILABLE", value);
  2001. case 0x2CB: FormatString("(%d) TOO_MANY_LINE_ERRORS", value);
  2002. case 0x2CC: FormatString("(%d) IP_CONFIGURATION", value);
  2003. case 0x2CD: FormatString("(%d) NO_IP_ADDRESSES", value);
  2004. case 0x2CE: FormatString("(%d) PPP_TIMEOUT", value);
  2005. case 0x2CF: FormatString("(%d) PPP_REMOTE_TERMINATED", value);
  2006. case 0x2D0: FormatString("(%d) PPP_NO_PROTOCOLS_CONFIGURED", value);
  2007. case 0x2D1: FormatString("(%d) PPP_NO_RESPONSE", value);
  2008. case 0x2D2: FormatString("(%d) PPP_INVALID_PACKET", value);
  2009. case 0x2D3: FormatString("(%d) PHONE_NUMBER_TOO_LONG", value);
  2010. case 0x2D4: FormatString("(%d) IPXCP_NO_DIALOUT_CONFIGURED", value);
  2011. case 0x2D5: FormatString("(%d) IPXCP_NO_DIALIN_CONFIGURED", value);
  2012. case 0x2D6: FormatString("(%d) IPXCP_DIALOUT_ALREADY_ACTIVE", value);
  2013. case 0x2D7: FormatString("(%d) ACCESSING_TCPCFGDLL", value);
  2014. case 0x2D8: FormatString("(%d) NO_IP_RAS_ADAPTER", value);
  2015. case 0x2D9: FormatString("(%d) SLIP_REQUIRES_IP", value);
  2016. case 0x2DA: FormatString("(%d) PROJECTION_NOT_COMPLETE", value);
  2017. case 0x2DB: FormatString("(%d) PROTOCOL_NOT_CONFIGURED", value);
  2018. case 0x2DC: FormatString("(%d) PPP_NOT_CONVERGING", value);
  2019. case 0x2DD: FormatString("(%d) PPP_CP_REJECTED", value);
  2020. case 0x2DE: FormatString("(%d) PPP_LCP_TERMINATED", value);
  2021. case 0x2DF: FormatString("(%d) PPP_REQUIRED_ADDRESS_REJECTED", value);
  2022. case 0x2E0: FormatString("(%d) PPP_NCP_TERMINATED", value);
  2023. case 0x2E1: FormatString("(%d) PPP_LOOPBACK_DETECTED", value);
  2024. case 0x2E2: FormatString("(%d) PPP_NO_ADDRESS_ASSIGNED", value);
  2025. case 0x2E3: FormatString("(%d) CANNOT_USE_LOGON_CREDENTIALS", value);
  2026. case 0x2E4: FormatString("(%d) TAPI_CONFIGURATION", value);
  2027. case 0x2E5: FormatString("(%d) NO_LOCAL_ENCRYPTION", value);
  2028. case 0x2E6: FormatString("(%d) NO_REMOTE_ENCRYPTION", value);
  2029. case 0x2E7: FormatString("(%d) REMOTE_REQUIRES_ENCRYPTION", value);
  2030. case 0x2E8: FormatString("(%d) IPXCP_NET_NUMBER_CONFLICT", value);
  2031. case 0x2E9: FormatString("(%d) INVALID_SMM", value);
  2032. case 0x2EA: FormatString("(%d) SMM_UNINITIALIZED", value);
  2033. case 0x2EB: FormatString("(%d) NO_MAC_FOR_PORT", value);
  2034. case 0x2EC: FormatString("(%d) SMM_TIMEOUT", value);
  2035. case 0x2ED: FormatString("(%d) BAD_PHONE_NUMBER", value);
  2036. case 0x2EE: FormatString("(%d) WRONG_MODULE", value);
  2037. case 0x2EF: FormatString("(%d) INVALID_CALLBACK_NUMBER", value);
  2038. case 0x2F0: FormatString("(%d) SCRIPT_SYNTAX", value);
  2039. case 0x76D: FormatString("(%d) INVALID_TIME", value);
  2040. case 0x76E: FormatString("(%d) INVALID_FORM_NAME", value);
  2041. case 0x76F: FormatString("(%d) INVALID_FORM_SIZE", value);
  2042. case 0x770: FormatString("(%d) ALREADY_WAITING", value);
  2043. case 0x771: FormatString("(%d) PRINTER_DELETED", value);
  2044. case 0x772: FormatString("(%d) INVALID_PRINTER_STATE", value);
  2045. case 0x773: FormatString("(%d) PASSWORD_MUST_CHANGE", value);
  2046. case 0x774: FormatString("(%d) DOMAIN_CONTROLLER_NOT_FOUND", value);
  2047. case 0x775: FormatString("(%d) ACCOUNT_LOCKED_OUT", value);
  2048. case 0x842: FormatString("(%d) ServerNotStarted", value);
  2049. case 0x843: FormatString("(%d) ItemNotFound", value);
  2050. case 0x844: FormatString("(%d) UnknownDevDir", value);
  2051. case 0x845: FormatString("(%d) RedirectedPath", value);
  2052. case 0x846: FormatString("(%d) DuplicateShare", value);
  2053. case 0x847: FormatString("(%d) NoRoom", value);
  2054. case 0x849: FormatString("(%d) TooManyItems", value);
  2055. case 0x84A: FormatString("(%d) InvalidMaxUsers", value);
  2056. case 0x84B: FormatString("(%d) BufTooSmall", value);
  2057. case 0x84F: FormatString("(%d) RemoteErr", value);
  2058. case 0x853: FormatString("(%d) LanmanIniError", value);
  2059. case 0x856: FormatString("(%d) OS2IoctlError", value);
  2060. case 0x858: FormatString("(%d) NetworkError", value);
  2061. case 0x85A: FormatString("(%d) WkstaNotStarted", value);
  2062. case 0x85B: FormatString("(%d) BrowserNotStarted", value);
  2063. case 0x85C: FormatString("(%d) InternalError", value);
  2064. case 0x85D: FormatString("(%d) BadTransactConfig", value);
  2065. case 0x85E: FormatString("(%d) InvalidAPI", value);
  2066. case 0x85F: FormatString("(%d) BadEventName", value);
  2067. default: FormatString("(%d) Unknown", value);
  2068. }
  2069. }
  2070. Table SMBErrorCodesERRSRVTable(value)
  2071. {
  2072. switch(value)
  2073. {
  2074. case 1: FormatString("(%d) Non-specific error code", value);
  2075. case 2: FormatString("(%d) Bad name/password pair", value);
  2076. case 3: FormatString("(%d) DFS PATH_NOT_FOUND", value);
  2077. case 4: FormatString("(%d) Network access denied", value);
  2078. case 5: FormatString("(%d) Invalid tree identifier (TID)", value);
  2079. case 6: FormatString("(%d) Invalid network name in tree connect", value);
  2080. case 7: FormatString("(%d) Invalid device type", value);
  2081. case 16: FormatString("(%d) Bad SID", value);
  2082. case 17: FormatString("(%d) Working...", value);
  2083. case 18: FormatString("(%d) NOT Me", value);
  2084. case 49: FormatString("(%d) Print queue full--returned print file", value);
  2085. case 50: FormatString("(%d) Print queue full--no space", value);
  2086. case 51: FormatString("(%d) End of print queue list", value);
  2087. case 52: FormatString("(%d) Invalid print file identifier (FID)", value);
  2088. case 64: FormatString("(%d) SMB command NOT recognized", value);
  2089. case 65: FormatString("(%d) Internal server error", value);
  2090. case 67: FormatString("(%d) File identifier and pathname were invalid", value);
  2091. case 68: FormatString("(%d) Reserved", value);
  2092. case 69: FormatString("(%d) Insufficient access permissions", value);
  2093. case 70: FormatString("(%d) Reserved", value);
  2094. case 71: FormatString("(%d) Invalid attribute mode specified", value);
  2095. case 81: FormatString("(%d) Server is paused", value);
  2096. case 82: FormatString("(%d) Server is NOT receiving messages", value);
  2097. case 83: FormatString("(%d) No room to buffer message", value);
  2098. case 87: FormatString("(%d) Too many remote user names", value);
  2099. case 88: FormatString("(%d) Operation timed out", value);
  2100. case 89: FormatString("(%d) No resources available for request", value);
  2101. case 90: FormatString("(%d) Too many user identifiers active in session", value);
  2102. case 91: FormatString("(%d) Invalid user identifier", value);
  2103. case 123: FormatString("(%d) Invalid name returned from FAT", value);
  2104. case 206: FormatString("(%d) Non 8.3 name passed to FAT (or non 255 name to HPFS)", value);
  2105. case 250: FormatString("(%d) Can't support Raw; use MPX", value);
  2106. case 251: FormatString("(%d) Can't support Raw, use core read and write", value);
  2107. case 252: FormatString("(%d) Continue in MPX mode", value);
  2108. case 253: FormatString("(%d) Reserved", value);
  2109. case 254: FormatString("(%d) Reserved", value);
  2110. case 255: FormatString("(%d) Function NOT supported", value);
  2111. case 2242: FormatString("(%d) Password Expired", value);
  2112. case 0xFFFF: FormatString("(%d) Function NOT supported", value);
  2113. default: FormatString("(%d) Unknown", value);
  2114. }
  2115. }
  2116. Table SMBErrorCodesERRHRDTable(value)
  2117. {
  2118. switch(value)
  2119. {
  2120. case 0x0013: FormatString("(%d) Write attempted on write-protected disk", value);
  2121. case 0x0014: FormatString("(%d) Unknown unit", value);
  2122. case 0x0015: FormatString("(%d) Disk drive NOT ready", value);
  2123. case 0x0016: FormatString("(%d) Unknown command", value);
  2124. case 0x0017: FormatString("(%d) Data error (CRC)", value);
  2125. case 0x0018: FormatString("(%d) Bad request structure length", value);
  2126. case 0x0019: FormatString("(%d) Seek error", value);
  2127. case 0x001A: FormatString("(%d) Unknown media type", value);
  2128. case 0x001B: FormatString("(%d) Sector NOT found", value);
  2129. case 0x001C: FormatString("(%d) Printer out of paper", value);
  2130. case 0x001D: FormatString("(%d) Write fault", value);
  2131. case 0x001E: FormatString("(%d) Read fault", value);
  2132. case 0x001F: FormatString("(%d) General failure", value);
  2133. case 0x0020: FormatString("(%d) A open conflicts with an existing open", value);
  2134. case 0x0021: FormatString("(%d) Lock conflicts with existing lock", value);
  2135. case 0x0022: FormatString("(%d) Wrong disk was found in a drive", value);
  2136. case 0x0023: FormatString("(%d) No FCBs available to process request", value);
  2137. case 0x0024: FormatString("(%d) Buffer overflow", value);
  2138. case 0x0025: FormatString("(%d) Disk full", value);
  2139. default: FormatString("(%d) Unknown", value);
  2140. }
  2141. }
  2142. Table SMBCreateActionTable(value)
  2143. {
  2144. switch(value)
  2145. {
  2146. case 0: "FILE_SUPERSEDED";
  2147. case 1: "FILE_OPENED";
  2148. case 2: "FILE_CREATED";
  2149. case 3: "FILE_OVERWRITTEN";
  2150. default: FormatString("(%d) Unknown", value);
  2151. }
  2152. }
  2153. Table SMBCommandTable(value)
  2154. {
  2155. //SMB_COM_CREATE_DIRECTORY (0x00)
  2156. //SMB_COM_DELETE_DIRECTORY (0x01)
  2157. //SMB_COM_OPEN (0x02)
  2158. //SMB_COM_CREATE (0x03)
  2159. //SMB_COM_CLOSE (0x04)
  2160. //SMB_COM_FLUSH (0x05)
  2161. //SMB_COM_DELETE (0x06)
  2162. //SMB_COM_RENAME (0x07)
  2163. //SMB_COM_QUERY_INFORMATION (0x08)
  2164. //SMB_COM_SET_INFORMATION (0x09)
  2165. //SMB_COM_READ (0x0A)
  2166. //SMB_COM_WRITE (0x0B)
  2167. //SMB_COM_LOCK_BYTE_RANGE (0x0C)
  2168. //SMB_COM_UNLOCK_BYTE_RANGE (0x0D)
  2169. //SMB_COM_CREATE_TEMPORARY (0x0E)
  2170. //SMB_COM_CREATE_NEW (0x0F)
  2171. //SMB_COM_CHECK_DIRECTORY (0x10)
  2172. //SMB_COM_PROCESS_EXIT (0x11)
  2173. //SMB_COM_SEEK (0x12)
  2174. //SMB_COM_LOCK_AND_READ (0x13)
  2175. //SMB_COM_WRITE_AND_UNLOCK (0x14)
  2176. //SMB_COM_READ_RAW (0x1A)
  2177. //SMB_COM_READ_MPX (0x1B)
  2178. //SMB_COM_READ_MPX_SECONDARY (0x1C)
  2179. //SMB_COM_WRITE_RAW (0x1D)
  2180. //SMB_COM_WRITE_MPX (0x1E)
  2181. //SMB_COM_WRITE_MPX_SECONDARY (0x1F)
  2182. //SMB_COM_WRITE_COMPLETE (0x20)
  2183. //SMB_COM_SET_INFORMATION2 (0x22)
  2184. //SMB_COM_QUERY_INFORMATION2 (0x23)
  2185. //SMB_COM_LOCKING_ANDX (0x24)
  2186. //SMB_COM_TRANSACTION (0x25)
  2187. //SMB_COM_TRANSACTION_SECONDARY (0x26)
  2188. //SMB_COM_IOCTL (0x27)
  2189. //SMB_COM_IOCTL_SECONDARY (0x28)
  2190. //SMB_COM_COPY (0x29)
  2191. //SMB_COM_MOVE (0x2A)
  2192. //SMB_COM_ECHO (0x2B)
  2193. //SMB_COM_WRITE_AND_CLOSE (0x2C)
  2194. //SMB_COM_OPEN_ANDX (0x2D)
  2195. //SMB_COM_READ_ANDX (0x2E)
  2196. //SMB_COM_WRITE_ANDX (0x2F)
  2197. //SMB_COM_CLOSE_AND_TREE_DISC (0x31)
  2198. //SMB_COM_TRANSACTION2 (0x32)
  2199. //SMB_COM_TRANSACTION2_SECONDARY (0x33)
  2200. //SMB_COM_FIND_CLOSE2 (0x34)
  2201. //SMB_COM_FIND_NOTIFY_CLOSE (0x35)
  2202. //SMB_COM_TREE_CONNECT (0x70)
  2203. //SMB_COM_TREE_DISCONNECT (0x71)
  2204. //SMB_COM_NEGOTIATE (0x72)
  2205. //SMB_COM_SESSION_SETUP_ANDX (0x73)
  2206. //SMB_COM_LOGOFF_ANDX (0x74)
  2207. //SMB_COM_TREE_CONNECT_ANDX (0x75)
  2208. //SMB_COM_QUERY_INFORMATION_DISK (0x80)
  2209. //SMB_COM_SEARCH (0x81)
  2210. //SMB_COM_FIND (0x82)
  2211. //SMB_COM_FIND_UNIQUE (0x83)
  2212. //SMB_COM_FIND_CLOSE ( 0x84)
  2213. //SMB_COM_NT_TRANSACTION (0xA0)
  2214. //SMB_COM_NT_TRANSACTION_SECONDARY (0xA1)
  2215. //SMB_COM_NT_CREATE_ANDX (0xA2)
  2216. //SMB_COM_NT_CANCEL (0xA4)
  2217. //SMB_COM_NT_RENAME (0xA5)
  2218. //SMB_COM_OPEN_PRINT_FILE (0xC0)
  2219. //SMB_COM_WRITE_PRINT_FILE (0xC1)
  2220. //SMB_COM_CLOSE_PRINT_FILE (0xC2)
  2221. //SMB_COM_GET_PRINT_QUEUE (0xC3)
  2222. //SMB_COM_SEND_MESSAGE (0xD0)
  2223. //SMB_COM_SEND_BROADCAST_MESSAGE (0xD1)
  2224. //SMB_COM_FORWARD_USER_NAME (0xD2)
  2225. //SMB_COM_CANCEL_FORWARD (0xD3)
  2226. //SMB_COM_GET_MACHINE_NAME (0xD4)
  2227. //SMB_COM_SEND_START_MB_MESSAGE (OxD5)
  2228. //SMB_COM_SEND_END_MB_MESSAGE (0xD6)
  2229. //SMB_COM_SEND_TEXT_MB_MESSAGE (0xD7)
  2230. //SMB_COM_READ_BULK (0xD8)
  2231. //SMB_COM_WRITE_BULK (0xD9)
  2232. //SMB_COM_WRITE_BULK_DATA (0xDA)
  2233. switch
  2234. {
  2235. case value == 0x00: "Create Directory";
  2236. case value == 0x01: "Delete Directory";
  2237. case value == 0x02: "Open";
  2238. case value == 0x03: "Create";
  2239. case value == 0x04: "Close";
  2240. case value == 0x05: "Flush";
  2241. case value == 0x06: "Delete";
  2242. case value == 0x07: "Rename";
  2243. case value == 0x08: "Query Information";
  2244. case value == 0x09: "Set Information";
  2245. case value == 0x0A: "Read";
  2246. case value == 0x0B: "Write";
  2247. case value == 0x0C: "Lock Byte Range";
  2248. case value == 0x0D: "Unlock Byte Range";
  2249. case value == 0x0E: "Create Temporary";
  2250. case value == 0x0F: "Create New";
  2251. case value == 0x10: "Check Directory";
  2252. case value == 0x11: "Process Exit";
  2253. case value == 0x12: "Seek";
  2254. case value == 0x13: "Lock And Read";
  2255. case value == 0x14: "Write And Unlock";
  2256. case value >= 0x15 && value <= 0x19: "Unused";
  2257. case value == 0x1A: "Read Raw";
  2258. case value == 0x1B: "Read MPX";
  2259. case value == 0x1C: "Read MPX Secondary";
  2260. case value == 0x1D: "Write Raw";
  2261. case value == 0x1E: "Write Mpx";
  2262. case value == 0x1F: "Write MPX Secondary";
  2263. case value == 0x20: "Write Complete";
  2264. case value == 0x21: "Query Server";
  2265. case value == 0x22: "Set Information2";
  2266. case value == 0x23: "Query Information2";
  2267. case value == 0x24: "Locking Andx";
  2268. case value == 0x25: "Transaction";
  2269. case value == 0x26: "Transaction Secondary";
  2270. case value == 0x27: "IOCTL";
  2271. case value == 0x28: "IOCTL Secondary";
  2272. case value == 0x29: "Copy";
  2273. case value == 0x2A: "Move";
  2274. case value == 0x2B: "Echo";
  2275. case value == 0x2C: "Write And Close";
  2276. case value == 0x2D: "Open Andx";
  2277. case value == 0x2E: "Read Andx";
  2278. case value == 0x2F: "Write Andx";
  2279. case value == 0x30: "New File Size";
  2280. case value == 0x31: "Close And Tree Disconnect";
  2281. case value == 0x32: "Transact2";
  2282. case value == 0x33: "Transact2 Secondary";
  2283. case value == 0x34: "Find Close2";
  2284. case value == 0x35: "Find Notify Close";
  2285. case value >= 0x36 && value <=0x5f: "Unused";
  2286. case value >= 0x60 && value <=0x6f: "Reserved";
  2287. case value == 0x70: "Tree Connect";
  2288. case value == 0x71: "Tree Disconnect";
  2289. case value == 0x72: "Negotiate";
  2290. case value == 0x73: "Session Setup Andx";
  2291. case value == 0x74: "Logoff Andx";
  2292. case value == 0x75: "Tree Connect Andx";
  2293. case value >= 0x76 && value <= 0x7d: "Unused ";
  2294. case value == 0x7e: "Security Package Andx";
  2295. case value == 0x7f: "Unused";
  2296. case value == 0x80: "Query Information Disk";
  2297. case value == 0x81: "Search";
  2298. case value == 0x82: "Find";
  2299. case value == 0x83: "Find Unique";
  2300. case value == 0x84: "Find Close";
  2301. case value>=0x85 && value <= 0x9f: "Unused";
  2302. case value == 0xa0: "Nt Transact";
  2303. case value == 0xa1: "Nt Transact Secondary";
  2304. case value == 0xa2: "Nt Create Andx";
  2305. case value == 0xa3: "Unused";
  2306. case value == 0xa4: "Nt Cancel";
  2307. case value == 0xa5: "Nt Rename";
  2308. case value >= 0xa6 && value <=0xbf: "Unused";
  2309. case value == 0xc0: "Open Print File";
  2310. case value == 0xC1: "Write Print File";
  2311. case value == 0xC2: "Close Print File";
  2312. case value == 0xC3: "Get Print Queue";
  2313. case value >= 0xC4 && value <=0xcf: "Unused";
  2314. case value == 0xD0: "Send Single Block Message";
  2315. case value == 0xD1: "Send Broadcast Message";
  2316. case value == 0xD2: "Forward User Name";
  2317. case value == 0xD3: "Cancel Forward";
  2318. case value == 0xD4: "Get Machine Name";
  2319. case value == 0xD5: "Send Start of Multi-Block Message";
  2320. case value == 0xD6: "Send End of Multi-Block Message";
  2321. case value == 0xD7: "Send Text of Multi-Block Message";
  2322. case value == 0xD8: "SMB Read Bulk";
  2323. case value == 0xD9: "SMB Write Bulk";
  2324. case value == 0xDA: "SMB Write Bulk Data";
  2325. case value == 0xFE: "SMB COM INVALID";
  2326. case value == 0xFF: "No Secondary Command";
  2327. default: FormatString("Invalid value: %d",value);
  2328. }
  2329. }
  2330. Table SMBErrorCodesTable(errClass, errCode)
  2331. {
  2332. switch(errClass)
  2333. {
  2334. case 0x00: "No Error";
  2335. case 0x01: SMBErrorCodesERRDOSTable(errCode);
  2336. case 0x02: SMBErrorCodesERRSRVTable(errCode);
  2337. case 0x03: SMBErrorCodesERRHRDTable(errCode);
  2338. case 0xFF: FormatString("(%d) Unknown", errCode);
  2339. default: FormatString("(%d) Unknown", errCode);
  2340. }
  2341. }
  2342. Table SMBNTCreateDisposition(value)
  2343. {
  2344. switch(value)
  2345. {
  2346. case 0: "FILE_SUPERSEDE: If the file exists, replace it with the given file, otherwise create the given file.";
  2347. case 1: "FILE_OPEN: If the file exists, open it instead of creating a new file, otherwise fail the request and do NOT create a new file.";
  2348. case 2: "FILE_CREATE: If the file exists, fail the request and do NOT create or open the given file, otherwise create the given file.";
  2349. case 3: "FILE_OPEN_IF: If the file exists, open it, otherwise create the given file.";
  2350. case 4: "FILE_OVERWRITE: If the file exists, open and overwrite it, otherwise fail the request.";
  2351. case 5: "FILE_OVERWRITE_IF: If the file exists, open and overwrite it, otherwise create the given file.";
  2352. default: FormatString("Invalid value: %d",value);
  2353. }
  2354. }
  2355. Table SMBNTCreateAction(value)
  2356. {
  2357. //
  2358. // RESP_NT_CREATE_ANDX
  2359. // RESP_EXTENDED_NT_CREATE_ANDX,
  2360. // RESP_CREATE_WITH_SD_OR_EA
  2361. // RESP_EXTENDED_NT_CREATE_ANDX2
  2362. // ULONG CreateAction
  2363. //
  2364. switch(value)
  2365. {
  2366. case 0: "FILE_SUPERSEDED: The file already existed, and was replaced with the given file.";
  2367. case 1: "FILE_OPENED: The file already existed and was opened.";
  2368. case 2: "FILE_CREATED: The file did NOT exist and was created.";
  2369. case 3: "FILE_OVERWRITTEN: The file already existed and was truncated.";
  2370. case 4: "FILE_EXISTS: The file exists and was opened.";
  2371. case 5: "FILE_DOES_NOT_EXIST: The file does NOT exist.";
  2372. default: FormatString("Invalid value: %d",value);
  2373. }
  2374. }
  2375. Table SMBNTImpersonationLevelTable(value)
  2376. {
  2377. switch(value)
  2378. {
  2379. case 0 : "Anonymous";
  2380. case 1 : "Identification";
  2381. case 2 : "Impersonation";
  2382. case 3 : "Delegation";
  2383. default: FormatString("Unknown impersonation");
  2384. }
  2385. }
  2386. Table SMBOplockTable(value)
  2387. {
  2388. switch(value)
  2389. {
  2390. case 0: "No oplock granted";
  2391. case 1: "Exclusive oplock";
  2392. case 2: "Batch oplock";
  2393. case 3: "Level II oplock";
  2394. default: FormatString("%d",value);
  2395. }
  2396. }
  2397. Table SMBFileAccessModeTable(mode)
  2398. {
  2399. switch(mode)
  2400. {
  2401. case 0: "Open for reading";
  2402. case 1: "Open for writing";
  2403. case 2: "Open for reading and writing";
  2404. case 3: "Open for execute";
  2405. default: "unhandled FileAccessMode";
  2406. }
  2407. }
  2408. Table SMBFileSharingModeTable(mode)
  2409. {
  2410. switch(mode)
  2411. {
  2412. case 0: "Compatibility mode";
  2413. case 1: "Deny read/write/execute (exclusive)";
  2414. case 2: "Deny write";
  2415. case 3: "Deny read/execute";
  2416. case 4: "Deny none";
  2417. default: "unhandled FileSharingMode";
  2418. }
  2419. }
  2420. Table SMBFileLocalityOfReferenceTable(mode)
  2421. {
  2422. switch(mode)
  2423. {
  2424. case 0: "Locality unknown";
  2425. case 1: "Mainly sequential access";
  2426. case 2: "Mainly random access";
  2427. case 3: "Random access with some locally";
  2428. default: "Currently undefined";
  2429. }
  2430. }
  2431. Table SMBDeviceStateReadModeTable(value)
  2432. {
  2433. switch(value)
  2434. {
  2435. case 0: "Read pipe as a byte stream";
  2436. case 1: "Read messages from pipe";
  2437. default: "Unknown read mode";
  2438. }
  2439. }
  2440. Table SMBDeviceStatePipeTypeTable(value)
  2441. {
  2442. switch(value)
  2443. {
  2444. case 0: "Byte stream pipe";
  2445. case 1: "Message mode pipe";
  2446. default: "Unknown pipe type";
  2447. }
  2448. }
  2449. Table SMBBufferStringFormatsTable(format)
  2450. {
  2451. switch(format)
  2452. {
  2453. case 1: FormatString("Data block %d(%#x)", format, format);
  2454. case 2: FormatString("Dialect %d(%#x)", format, format);
  2455. case 3: FormatString("Pathname %d(%#x)", format, format);
  2456. case 4: FormatString("ASCII %d(%#x)", format, format);
  2457. case 5: FormatString("Variable block %d(%#x)", format, format);
  2458. default: FormatString("Undefined Format %d(%#x)", format, format);
  2459. }
  2460. }
  2461. //
  2462. //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cifs/protocol/tree_connect_andx.asp
  2463. //
  2464. Table SMBTreeConnectAndXServiceTable(service)
  2465. {
  2466. switch
  2467. {
  2468. case service.contains("A"): FormatString("%s - Disk share for PC NETWORK PROGRAM 1.0 or later", service);
  2469. case service.contains("LPT1"): FormatString("%s - Printer for PC NETWORK PROGRAM 1.0 or later", service);
  2470. case service.contains("IPC"): FormatString("%s - Named pipe for MICROSOFT NETWORKS 3.0 or later", service);
  2471. case service.contains("COMM"): FormatString("%s - Communications device for MICROSOFT NETWORKS 3.0 or later", service);
  2472. case service.contains("?????"): FormatString("%s - Any device type for MICROSOFT NETWORKS 3.0 or later", service);
  2473. default: FormatString("%s", service);
  2474. }
  2475. }
  2476. Table SMBOpenFunctionTable(value)
  2477. {
  2478. switch(value)
  2479. {
  2480. case 0: "Fail if the target file exists (SMB_OFUN_OPEN_FAIL)";
  2481. case 1: "Open or Append file if it exists (SMB_OFUN_OPEN_OPEN)";
  2482. case 2: "Truncate file if it exists (SMB_OFUN_OPEN_TRUNCATE)";
  2483. default: FormatString("Invalid Open Function %d", value);
  2484. }
  2485. }
  2486. Struct SMBAccessMask
  2487. {
  2488. SMBAccessMaskAccessMask AccessMask;
  2489. }
  2490. //SMB_COM_NT_CREATE_ANDX Client Request Extension
  2491. [DataTypeByteOrder = LittleEndian]
  2492. Struct SMBAccessMaskAccessMask
  2493. {
  2494. UINT32 ReadData:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "FILE_READ_DATA (file & named pipe), FILE_LIST_DIRECTORY (directory)");
  2495. UINT32 WriteData:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "FILE_WRITE_DATA (file & named pipe), FILE_ADD_FILE (directory");
  2496. UINT32 AppendData:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "FILE_APPEND_DATA (file), FILE_ADD_SUBDIRECTORY (directory), FILE_CREATE_PIPE_INSTANCE (named pipe)");
  2497. UINT32 ReadEA:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "FILE_READ_EA (file & directory)");
  2498. UINT32 WriteEA:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "FILE_WRITE_EA (file & directory)");
  2499. UINT32 Execute:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "FILE_EXECUTE (file), FILE_TRAVERSE (directory)");
  2500. UINT32 Reserved_bits:1 = FormatString(" (%s) Reserved" , this.ToBitString);
  2501. UINT32 ReadAttributes:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "FILE_READ_ATTRIBUTES (all)");
  2502. UINT32 WriteAttributes:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "FILE_WRITE_ATTRIBUTES (all)");
  2503. UINT32 Reserved_bits9_15:7 = FormatString(" (%s) Reserved" , this.ToBitString);
  2504. UINT32 Delete:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "DELETE (the right to delete the object)");
  2505. UINT32 ReadControl:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "READ_CONTROL (read the object's security descriptor NOT including SACL)");
  2506. UINT32 WriteDAC:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "WRITE_DAC (modify the DACL in the object's security descriptor)");
  2507. UINT32 WriteOwner:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "WRITE_OWNER (change the owner in the object's security descriptor)");
  2508. UINT32 Synchronize:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "SYNCHRONIZE (use the object for synchronization)");
  2509. UINT32 Reserved_bits21_23:3 = FormatString(" (%s) Reserved" , this.ToBitString);
  2510. UINT32 AccessSystemSecurity:1 = FormatString("(%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "ACCESS_SYSTEM_SECURITY (get or set the SACL in an object's security descriptor)");
  2511. UINT32 MaximumAllowed:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "MAXIMUM_ALLOWED (all access rights valid for the caller)");
  2512. UINT32 Reserved_bits26_27:2 = FormatString(" (%s) Reserved" , this.ToBitString);
  2513. UINT32 GenericAll:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "GENERIC_ALL");
  2514. UINT32 GenericExecute:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "GENERIC_EXECUTE");
  2515. UINT32 GenericWrite:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "GENERIC_WRITE");
  2516. UINT32 GenericRead:1 = FormatString(" (%s) %s %s" , this.ToBitString, this ? "Set" : "NOT Set", "GENERIC_READ");
  2517. }
  2518. [DataTypeByteOrder = LittleEndian]
  2519. struct SMBOpenFunction = FormatString("0x%04X", UINT16(FrameData, FrameOffset))
  2520. {
  2521. UINT16 Open:2 = FormatString(" (%s) %s", this.ToBitString, SMBOpenFunctionTable(this));
  2522. UINT16 Rsvd_bits2_3:2 = FormatString(" (%s) Reserved", this.ToBitString);
  2523. UINT16 Create:1 = FormatString(" (%s) %s (SMB_OFUN_CREATE)", this.ToBitString, this ? "If the file does NOT exist, create a file" : "If the file does NOT exist, return Fail");
  2524. UINT16 Unused_bits5_15:11 = FormatString("(%s) Unused", this.ToBitString);
  2525. };
  2526. Table SMBActionTable(value)
  2527. {
  2528. switch(value)
  2529. {
  2530. case 1: "The file existed and was opened (SMB_OACT_OPENED)";
  2531. case 2: "The file did NOT exist but was created (SMB_OACT_CREATED)";
  2532. case 3: "The file existed and was truncated (SMB_OACT_TRUNCATED)";
  2533. default: FormatString("Unknown Action: %d",value);
  2534. }
  2535. }
  2536. [DataTypeByteOrder = LittleEndian]
  2537. struct SMBOpenAction = FormatString("0x%04X", UINT16(FrameData, FrameOffset))
  2538. {
  2539. UINT16 Open:2 = FormatString("(%s) %s", this.ToBitString, SMBActionTable(this));
  2540. UINT16 Rsvd:13 = FormatString("(%s) Unused", this.ToBitString);
  2541. UINT16 Lock:1 = FormatString("(%s) %s (SMB_OACT_OPLOCK)", this.ToBitString, this ? "File opened by this user only" : "File opened by another client or batch oplocks NOT supported");
  2542. };
  2543. [DataTypeByteOrder = LittleEndian]
  2544. struct SMBAccessMode = FormatString("0x%04X", UINT16(FrameData, FrameOffset))
  2545. {
  2546. UINT16 AccessMode:3 = FormatString(" (%s) %s", this.ToBitString, SMBFileAccessModeTable(this));
  2547. UINT16 Reserved_bit3:1 = FormatString(" (%s) Unused", this.ToBitString);
  2548. UINT16 SharingMode:3 = FormatString(" (%s) %s", this.ToBitString, SMBFileSharingModeTable(this));
  2549. UINT16 Reserved_bit7:1 = FormatString(" (%s) Unused", this.ToBitString);
  2550. UINT16 LocalityOfReference:3 = FormatString("(%s) %s", this.ToBitString, SMBFileLocalityOfReferenceTable(this));
  2551. UINT16 Reserved_bit11:1 = FormatString(" (%s) Unused", this.ToBitString);
  2552. UINT16 CacheMode:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Do NOT cache this file (SMB_DO_NOT_CACHE)" : "Normal file (SMB_CACHE_NORMAL)");
  2553. UINT16 Reserved_bit13:1 = FormatString(" (%s) Unused", this.ToBitString);
  2554. UINT16 WriteThroughMode:1 = FormatString(" (%s) %s (SMB_DA_WRITE_THROUGH)", this.ToBitString, this ? "Read ahead or write behind allowed" : "Read ahead or write behind NOT allowed");
  2555. UINT16 Reserved_bit15:1 = FormatString(" (%s) Unused", this.ToBitString);
  2556. }
  2557. [DataTypeByteOrder = LittleEndian]
  2558. struct SMBFileBYTEAttributes = FormatString("0x%02X", UINT8( Framedata, Offset ))
  2559. {
  2560. UINT8 Readonly:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_READONLY)", this.ToBitString, this ? "Read Only" : "NOT Read only");
  2561. UINT8 Hidden:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_HIDDEN)", this.ToBitString, this ? "Hidden" : "NOT Hidden");
  2562. UINT8 System:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_SYSTEM)", this.ToBitString, this ? "System" : "NOT System");
  2563. UINT8 Volume:1 = FormatString(" (%s) %s (_A_VOLID [Must Be Zero])", this.ToBitString, this ? "[INVALID] MS-DOS volume label" : "[DEPRECATED] NOT an MS-DOS volume label");
  2564. UINT8 Directory:1 = FormatString("(%s) %s (FILE_ATTRIBUTE_DIRECTORY)", this.ToBitString, this ? "Directory" : "NOT a Directory");
  2565. UINT8 Archive:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_ARCHIVE)", this.ToBitString, this ? "Archive" : "NOT Archive");
  2566. UINT8 Reverved:2 = FormatString(" (%s) Reserved", this.ToBitString);
  2567. }
  2568. [DataTypeByteOrder = LittleEndian]
  2569. struct SMBFileAttributes = FormatString("0x%04X", UINT16(FrameData, FrameOffset))
  2570. {
  2571. UINT16 Readonly:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_READONLY)", this.ToBitString, this ? "Read Only" : "NOT Read only");
  2572. UINT16 Hidden:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_HIDDEN)", this.ToBitString, this ? "Hidden" : "NOT Hidden");
  2573. UINT16 System:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_SYSTEM)", this.ToBitString, this ? "System" : "NOT System");
  2574. UINT16 Volume:1 = FormatString(" (%s) %s (_A_VOLID [Must Be Zero])", this.ToBitString, this ? "[INVALID] MS-DOS volume label" : "[DEPRECATED] NOT an MS-DOS volume label");
  2575. UINT16 Directory:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_DIRECTORY)", this.ToBitString, this ? "Directory" : "NOT a Directory");
  2576. UINT16 Archive:1 = FormatString(" (%s) %s (FILE_ATTRIBUTE_ARCHIVE)", this.ToBitString, this ? "Archive" : "NOT Archive");
  2577. UINT16 Reverved1:2 = FormatString(" (%s) Reserved", this.ToBitString);
  2578. UINT16 SearchReadonlyFile:1 = FormatString(" (%s) %s (SEARCH_ATTRIBUTE_READONLY)", this.ToBitString, this ? "Search for Read-only files" : "NOT Search for Read-only files");
  2579. UINT16 SearchHiddenFile:1 = FormatString(" (%s) %s (SEARCH_ATTRIBUTE_HIDDEN)", this.ToBitString, this ? "Search for Hidden files" : "NOT Search for Hidden files");
  2580. UINT16 SearchSystemFile:1 = FormatString(" (%s) %s (SEARCH_ATTRIBUTE_SYSTEM)", this.ToBitString, this ? "Search for System files" : "NOT Search for System files");
  2581. UINT16 Reverved2:1 = FormatString(" (%s) Reserved", this.ToBitString);
  2582. UINT16 SearchDirectoryFile:1 = FormatString("(%s) %s (SEARCH_ATTRIBUTE_DIRECTORY)", this.ToBitString, this ? "Search for Directory files" : "NOT Search for Directory files");
  2583. UINT16 SearchArchiveFile:1 = FormatString(" (%s) %s (SEARCH_ATTRIBUTE_ARCHIVE)", this.ToBitString, this ? "Search for files that have changed since they were last archived" : "NOT Search for files that have changed since they were last archived");
  2584. UINT16 Reverved3:2 = FormatString(" (%s) Reserved", this.ToBitString);
  2585. }
  2586. //
  2587. //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cifs/protocol/cifs_file_attribute_encoding.asp
  2588. //
  2589. [DataTypeByteOrder = LittleEndian]
  2590. struct SMBNTFileAttributes = FormatString("0x%04X", UINT32(FrameData, FrameOffset))
  2591. {
  2592. UINT32 ReadOnly:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Read-only file or directory" : "NOT a read-only file or directory"),"FILE_ATTRIBUTE_READONLY");
  2593. UINT32 Hidden:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Hidden file or directory" : "NOT a hidden file or directory"),"FILE_ATTRIBUTE_HIDDEN");
  2594. UINT32 System:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "System file or directory" : "NOT a system file or directory"),"FILE_ATTRIBUTE_SYSTEM");
  2595. UINT32 AVolid:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "[INVALID] MS-DOS volume label" : "[DEPRECATED] NOT an MS-DOS volume label"),"_A_VOLID)(Must Be Zero");
  2596. UINT32 Directory:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Is a directory" : "Is NOT a Directory"),"FILE_ATTRIBUTE_DIRECTORY");
  2597. UINT32 Archive:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Archived file or directory" : "NOT an archived file or directory"),"FILE_ATTRIBUTE_ARCHIVE");
  2598. UINT32 Device:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "[INVALID] device" : "NOT a device"),"FILE_ATTRIBUTE_DEVICE)(Must Be Zero");
  2599. UINT32 Normal:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Must be the only set attribute" : "At least one other attribute normally set"),"FILE_ATTRIBUTE_NORMAL");
  2600. UINT32 Temporary:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Temporary file" : "NOT a temporary file"),"FILE_ATTRIBUTE_TEMPORARY");
  2601. UINT32 SparseFile:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Sparse file" : "NOT a sparse file"),"FILE_ATTRIBUTE_SPARSE_FILE");
  2602. UINT32 ReparsePoint:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Reparse point" : "NOT a reparse point"),"FILE_ATTRIBUTE_REPARSE_POINT");
  2603. UINT32 Compressed:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Compressed file or directory" : "NOT a compressed file or directory"),"FILE_ATTRIBUTE_COMPRESSED");
  2604. UINT32 Offline:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Offline file" : "NOT an Offline file"),"FILE_ATTRIBUTE_OFFLINE");
  2605. UINT32 NotContentIndexed:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "NOT content indexed" : "Content indexed"),"FILE_ATTRIBUTE_NOT_CONTENT_INDEXED");
  2606. UINT32 Encrypted:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Encrypted file" : "NOT an Encrypted file"),"FILE_ATTRIBUTE_ENCRYPTED");
  2607. UINT32 Reserved_bit15:1 = FormatString(" (%s) Reserved (Must Be Zero)" , this.ToBitString);
  2608. UINT32 Virtual:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Virtual file (Windows Vista and beyond)" : "NOT a virtual file (Windows Vista and beyond)"),"FILE_ATTRIBUTE_VIRTUAL");
  2609. UINT32 Reserved_bits17_18:2 = FormatString("(%s) Reserved (Must Be Zero)" , this.ToBitString);
  2610. UINT32 FirstPipeInstance:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Allow a single pipe instance (Windows 2000 SP2 and beyond)" : "Allow multiple instances of this pipe (Windows 2000 SP2 and beyond)"),"FILE_FLAG_FIRST_PIPE_INSTANCE");
  2611. UINT32 OpenNoRecall:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Do NOT transport file data to local storage" : "Transport file data to local storage"),"FILE_FLAG_OPEN_NO_RECALL");
  2612. UINT32 OpenReparsePoint:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Inhibit NTFS reparse behavior" : "Allow NTFS reparse behavior"),"FILE_FLAG_OPEN_REPARSE_POINT");
  2613. UINT32 Reserved_bits22_23:2 = FormatString("(%s) Reserved (Must Be Zero)" , this.ToBitString);
  2614. UINT32 PosixSemantics:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "File is to be accessed according to POSIX rules" : "File is NOT to be accessed according to POSIX rules"),"FILE_FLAG_POSIX_SEMANTICS");
  2615. UINT32 BackupSemantics:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Open or create for a backup or restore operation" : "Don't open or create for backup or restore operation"),"FILE_FLAG_BACKUP_SEMANTICS");
  2616. UINT32 DeleteNoClose:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Server deletes file after all handles are closed" : "Server does NOT delete file after all handles are closed"),"FILE_FLAG_DELETE_ON_CLOSE");
  2617. UINT32 SequentialScan:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Hint to optimize server cache for sequential access" : "No hint for server to optimize cache for sequential access"),"FILE_FLAG_SEQUENTIAL_SCAN");
  2618. UINT32 RandomAccess:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Hint to optimize server cache for random access" : "No hint for server to optimize cache for random access"),"FILE_FLAG_RANDOM_ACCESS");
  2619. UINT32 NoBuffering:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Disallow intermediate buffering or caching" : "Allow intermediate buffering or caching"),"FILE_FLAG_NO_BUFFERING");
  2620. UINT32 Overlapped:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Use OVERLAPPED I/O" : "NOT Using OVERLAPPED I/O"),"FILE_FLAG_OVERLAPPED");
  2621. UINT32 WriteThrough:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Disallow lazy write caching" : "Allow lazy write caching"),"FILE_FLAG_WRITE_THROUGH");
  2622. }
  2623. [DataTypeByteOrder = LittleEndian]
  2624. struct SMBNTCreateFlags = FormatString("0x%08X", UINT32(FrameData, FrameOffset))
  2625. {
  2626. UINT32 Reserved_bit0:1 = FormatString(" (%s) Reserved", this.ToBitString);
  2627. UINT32 RequestOplock:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Request a dynamic lock" : "Does NOT request a dynamic lock");
  2628. UINT32 BatchLock:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Request a batch dynamic lock" : "Does NOT request a batch dynamic lock");
  2629. UINT32 Target:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Parent directory of the target is opened" : "Parent directory of the target is not opened");
  2630. UINT32 ExtendedResponse:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Request extented response" : "Does NOT request extended response");
  2631. UINT32 Reserved_bits5_31:27 = FormatString("(%s) Reserved", this.ToBitString);
  2632. }
  2633. [DataTypeByteOrder = LittleEndian]
  2634. struct SMBNTCreateShareAccess = UINT32(FrameData, FrameOffset)? FormatString("0x%08X", UINT32(FrameData, FrameOffset)):"FILE_NO_SHARE-Prevents the file from being shared."
  2635. {
  2636. UINT32 Read:1 = FormatString(" (%s) Read %sAllowed", this.ToBitString, this ? "" : "NOT ");
  2637. UINT32 Write:1 = FormatString(" (%s) Write %sAllowed", this.ToBitString, this ? "" : "NOT ");
  2638. UINT32 Delete:1 = FormatString("(%s) Delete %sAllowed", this.ToBitString, this ? "" : "NOT ");
  2639. UINT32 Rsvd:29 = FormatString(" (%s) Reserved(Must be zero)", this.ToBitString);
  2640. }
  2641. Table SMBNTCreateOptionsTable(Options)
  2642. {
  2643. switch(Options)
  2644. {
  2645. case 0x00000041: FormatString("Open as COM/DCOM structured storage (0x%08X)", Options);
  2646. case 0x00000441: FormatString("COM structured storage (0x%08X)", Options);
  2647. default: FormatString("0x%08X", Options);
  2648. }
  2649. }
  2650. [DataTypeByteOrder = LittleEndian]
  2651. struct SMBNTCreateOptions = SMBNTCreateOptionsTable(UINT32(FrameData, FrameOffset))
  2652. {
  2653. UINT32 DirectoryFile:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "The file being created or opened is a directory file" : "NOT a directory file") , "FILE_DIRECTORY_FILE");
  2654. UINT32 WriteThrough:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Data must be written to the file before operation is complete" : "NOT write through") , "FILE_WRITE_THROUGH");
  2655. UINT32 SequentialOnly:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "File access is sequential only" : "File access can be Random") , "FILE_SEQUENTIAL_ONLY");
  2656. UINT32 NoIntermediateBuffering:1 = FormatString("(%s) %s (%s)" , this.ToBitString , (this ? "Intermediate Buffering NOT allowed" : "Intermediate Buffering allowed") , "FILE_NO_INTERMEDIATE_BUFFERING");
  2657. UINT32 SynchronousIoAlert:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Any wait on behalf of the caller is subject to premature termination from alerts" : "Synchronous Io Alert NOT set") , "FILE_SYNCHRONOUS_IO_ALERT");
  2658. UINT32 SynchronousIoNonAlert:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Waits in the system to synchronize I/O queuing and completion are NOT subject to alerts" : "Synchronous Io NonAlert NOT set") , "FILE_SYNCHRONOUS_IO_NONALERT");
  2659. UINT32 NonDirectoryFile:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "The file being opened must NOT be a directory file" : "The file being opened may be a directory file") , "FILE_NON_DIRECTORY_FILE");
  2660. UINT32 CreateTreeConnecton:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Create a tree connection for this file" : "Create Tree Connection NOT set") , "FILE_CREATE_TREE_CONNECTION");
  2661. UINT32 CompleteOplocked:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Complete this operation if the target file is oplocked" : "Complete If Oplocked is NOT set") , "FILE_COMPLETE_IF_OPLOCKED");
  2662. UINT32 NoEA:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Client does NOT understand EA's" : "No EA knowledge bit is NOT set") , "FILE_NO_EA_KNOWLEDGE");
  2663. UINT32 OpenForRecovery:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Windows Vista Client-side caching (CSC) specify a network open and bypass the cache" : "Open Remote Instance is NOT set") , "FILE_OPEN_FOR_RECOVERY");
  2664. UINT32 RandomAccess:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Accesses to the file can be random" : "Random Access bit is NOT set") , "FILE_RANDOM_ACCESS");
  2665. UINT32 DeleteOnClose:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Delete the file when the last handle to it is closed" : "Delete On Close bit is NOT set") , "FILE_DELETE_ON_CLOSE");
  2666. UINT32 OpenBy:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Open By File ID" : "Open By FileName") , "FILE_OPEN_BY_FILE_ID");
  2667. UINT32 OpenForBackup:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Open For Backup" : "Do NOT Open For Backup") , "FILE_OPEN_FOR_BACKUP_INTENT");
  2668. UINT32 CannotBeCompressed:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "The file cannot be compressed" : "The file may be compressed") , "FILE_NO_COMPRESSION");
  2669. UINT32 Reserved_bits16_19:4 = FormatString(" (%s) Reserved" , this.ToBitString);
  2670. UINT32 ReserveOpfilter:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Break the oplock to none" : "Reserve Opfilter is NOT set") , "FILE_RESERVE_OPFILTER");
  2671. UINT32 OpenReparsePoint:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "The caller wants a handle to the reparse point itself" : "Open Reparse Point is NOT set") , "FILE_OPEN_REPARSE_POINT");
  2672. UINT32 OpenNoRecall:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Read without recalling" : "Open No Recall is NOT set") , "FILE_OPEN_NO_RECALL");
  2673. UINT32 OpenForFreeSpaceQuery:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Querying volume free space" : "NOT Querying volume free space") , "FILE_OPEN_FOR_FREE_SPACE_QUERY");
  2674. UINT32 Reserved_bits24_31:8 = FormatString(" (%s) Reserved" , this.ToBitString);
  2675. }
  2676. [DataTypeByteOrder = LittleEndian]
  2677. struct SMBWriteMode = FormatString("0x%04X", UINT16(FrameData, FrameOffset))
  2678. {
  2679. UINT16 Cache:1 = FormatString(" (%s) %s write caching", this.ToBitString, this ? "Write through mode - no" : "Allow" );
  2680. UINT16 Remaining:1 = FormatString("(%s) %s bytes remaining", this.ToBitString, this ? "Return" : "Do NOT return" );
  2681. UINT16 RawName:1 = FormatString(" (%s) %s raw named pipe protocol", this.ToBitString, this ? "Use" : "Do NOT use" );
  2682. UINT16 Start:1 = FormatString(" (%s) %s of message mode named pipe message", this.ToBitString, this ? "Start" : "NOT start" );
  2683. UINT16 Reserved:12 = FormatString(" (%s) Reserved", this.ToBitString );
  2684. }
  2685. [DataTypeByteOrder = LittleEndian]
  2686. struct SMBDeviceState = FormatString("0x%04X", UINT16(FrameData, FrameOffset))
  2687. {
  2688. UINT16 InstanceCount:8 = FormatString("(%s) %d (0x%X)", this.ToBitString, this, this );
  2689. UINT16 ReadMode:2 = FormatString(" (%s) %s", this.ToBitString, SMBDeviceStateReadModeTable(this) );
  2690. UINT16 PipeType:2 = FormatString(" (%s) %s", this.ToBitString, SMBDeviceStatePipeTypeTable(this) );
  2691. UINT16 Unused:2 = FormatString(" (%s)", this.ToBitString );
  2692. UINT16 Endpoint:1 = FormatString(" (%s) %s end of pipe", this.ToBitString, this ? "Server" : "Client" );
  2693. UINT16 NonBlocking:1 = FormatString(" (%s) Reads/Writes %s", this.ToBitString, this ? "returns all data available" : "blocks until its data is consumed or canceled" );
  2694. }
  2695. [DataTypeByteOrder = LittleEndian]
  2696. struct SMBSecurityFlags
  2697. {
  2698. UINT8 Dynamic:1 = FormatString(" (%s) %s security tracking mode.", this.ToBitString, this ? "Dynamic" : "Static");
  2699. UINT8 Effective:1 = FormatString("(%s) %s aspects of the client's security context are available to the server", this.ToBitString, this ? "Only the enabled" : "All");
  2700. UINT8 Reserved:6 = FormatString(" (%s)", this.ToBitString);
  2701. }
  2702. Table SMBPrintFileMode(mode)
  2703. {
  2704. switch(mode)
  2705. {
  2706. case 0: "Text mode (DOS expands TABs)";
  2707. case 1: "Graphics mode";
  2708. default: "Unhandled Mode";
  2709. }
  2710. }
  2711. Table SMBPrintJobStatusTable(status)
  2712. {
  2713. switch(status)
  2714. {
  2715. case 1: FormatString("Held or stopped, %d (0x%02X)", status, status);
  2716. case 2: FormatString("Printing, %d (0x%02X)", status, status);
  2717. case 3: FormatString("Awaiting print, %d (0x%02X)", status, status);
  2718. case 4: FormatString("In intercept, %d (0x%02X)", status, status);
  2719. case 5: FormatString("File had error, %d (0x%02X)", status, status);
  2720. case 6: FormatString("Printer error, %d (0x%02X)", status, status);
  2721. default: FormatString("Reserved, %d (0x%02X)", status, status);
  2722. }
  2723. }
  2724. [DataTypeByteOrder = LittleEndian]
  2725. struct SMBCapability = FormatString("0x%08X", UINT32(FrameData, FrameOffset))
  2726. {
  2727. UINT32 RawMode:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports SMB_COM_READ_RAW and SMB_COM_WRITE_RAW" : "No Support for SMB_COM_READ_RAW and SMB_COM_WRITE_RAW") , "CAP_RAW_MODE");
  2728. UINT32 MpxMode:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports SMB_COM_READ_MPX and SMB_COM_WRITE_MPX" : "No Support for SMB_COM_READ_MPX or SMB_COM_WRITE_MPX") , "CAP_MPX_MODE");
  2729. UINT32 Unicode:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports Unicode Strings" : "No Support for Unicode Strings") , "CAP_UNICODE");
  2730. UINT32 LargeFiles:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports large files with 64-bit offsets" : "No Support for large files with 64-bit offsets") , "CAP_LARGE_FILES");
  2731. UINT32 NTSMBs:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports SMB NTLM 0.12 dialect commands (implies CAP_NT_FIND)" : "No Support for SMB NTLM 0.12 dialect commands") , "CAP_NT_SMBS");
  2732. UINT32 RPCRemoteAPIs:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports remote API requests using RPC over named pipe connections" : "No Support for remote API requests using RPC over named pipe connections") , "CAP_RPC_REMOTE_APIS");
  2733. UINT32 NTStatus:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Can respond with 32-bit NT status codes in Status" : "Cannot respond with 32-bit NT status codes in Status") , "CAP_NT_STATUS");
  2734. UINT32 LevelIIOplocks:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports Level II oplocks" : "No Support for Level II oplocks") , "CAP_LEVEL_II_OPLOCKS");
  2735. UINT32 LockAndRead:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports SMB_COM_LOCK_AND_READ and SMB_COM_WRITE_AND_UNLOCK" : "No Support for SMB_COM_LOCK_AND_READ and SMB_COM_WRITE_AND_UNLOCK") , "CAP_LOCK_AND_READ");
  2736. UINT32 NtFind:1 = FormatString(" (%s) %s (%s)", this.ToBitString, (this ? "Supports Windows NT information level requests (SMB_QUERY_?, SMB_SET_?)" : "No support for Windows NT information level requests"), "CAP_NT_FIND");
  2737. UINT32 Reserved_bits10_11:2 = FormatString("(%s) Reserved", this.ToBitString);
  2738. UINT32 Dfs:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "This server is Distributed File System (Dfs) aware (via TRANS2_GET_DFS_REFERRAL)" : "This server is NOT Distributed File System (Dfs) aware") , "CAP_DFS");
  2739. UINT32 InfolevelPassthru:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports Windows NT information level pass-through requests [SMB_INFO_PASSTHROUGH]" : "No Support for Windows NT information level pass-through requests [SMB_INFO_PASSTHROUGH]") , "CAP_INFOLEVEL_PASSTHRU");
  2740. UINT32 LargeReadx:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports large read operations" : "No Support for large read operations") , "CAP_LARGE_READX");
  2741. UINT32 LargeWritex:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports large write operations" : "No Support for large write operations") , "CAP_LARGE_WRITEX");
  2742. UINT32 Lwio:1 = FormatString(" (%s) Reserved", this.ToBitString);
  2743. UINT32 Txf:1 = FormatString(" (%s) %s (%s)", this.ToBitString, (this ? "Transacted filesystem aware" : "NOT transacted filesystem aware"), "CAP_TXF");
  2744. UINT32 ClientSideEncrypt:1 = FormatString(" (%s) %s (%s)", this.ToBitString, (this ? "Can do client side encryption" : "Can NOT do client side encryption"), "CAP_CLIENT_SIDE_ENCRYPTION");
  2745. UINT32 Reserved_bit19:1 = FormatString(" (%s) Reserved", this.ToBitString);
  2746. UINT32 Reserved1:1 = FormatString(" (%s) %s (%s)", this.ToBitString, "Reserved for third party SMB server", "CAP_RESERVED1");
  2747. UINT32 Reserved2:1 = FormatString(" (%s) %s (%s)", this.ToBitString, "Reserved for third party SMB server", "CAP_RESERVED2");
  2748. UINT32 Reserved3:1 = FormatString(" (%s) %s (%s)", this.ToBitString, "Reserved for third party SMB server", "CAP_RESERVED3");
  2749. UINT32 Unix:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports UNIX CIFS Extensions" : "No Support for UNIX CIFS Extensions") , "CAP_UNIX");
  2750. UINT32 Reserved_bits24:1 = FormatString(" (%s) Reserved", this.ToBitString);
  2751. UINT32 CompressedData:1 = FormatString(" (%s) %s (%s)", this.ToBitString, (this ? "Supports compressed data transfer" : "No support for compressed data transfer"), "CAP_COMPRESSED_DATA [NOT implemented]");
  2752. UINT32 Reserved_bits26_28:3 = FormatString("(%s) Reserved", this.ToBitString);
  2753. UINT32 DynamicReauth:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports dynamic reauthorization" : "No Support for dynamic reauthorization") , "CAP_DYNAMIC_REAUTH");
  2754. UINT32 PersistentHandles:1 = FormatString(" (%s) %s (%s)", this.ToBitString, (this ? "Supports persistent handles" : "No Support for persistent handles"), "CAP_PERSISTENT_HANDLES");
  2755. UINT32 ExtendedSecurity:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports extended security exchange" : "No Support for extended security exchange") , "CAP_EXTENDED_SECURITY");
  2756. }
  2757. // Usage:
  2758. //
  2759. // Encoding
  2760. // 0 - Ascii Encoded
  2761. // 1 - Unicode Encoded
  2762. // IsLengthValid
  2763. // TRUE - Parameter "Length" is valid
  2764. // FALSE - Ignore Parameter "Length"
  2765. // Length
  2766. // If IsLengthValid == TRUE, indicate the length of the string in bytes
  2767. // AlignOffset
  2768. // If the string is Unicode encoded, indicates the base alignment offset
  2769. //
  2770. struct SMBFileNameString(Encoding, IsLengthValid, Length, AlignOffset) = SMBFileNameValue
  2771. {
  2772. switch(Encoding)
  2773. {
  2774. case 0:
  2775. switch
  2776. {
  2777. case IsLengthValid:
  2778. [SMBFileNameValue]
  2779. AsciiString(Length) Name;
  2780. default:
  2781. _struct NullTerminatedName
  2782. {
  2783. [SMBFileNameValue]
  2784. AsciiString Name;
  2785. }
  2786. }
  2787. case 1:
  2788. _struct UnicodeName
  2789. {
  2790. ALIGN(AlignOffset, 2) Align;
  2791. switch
  2792. {
  2793. case IsLengthValid:
  2794. [SMBFileNameValue]
  2795. UnicodeString(Length/2) Name;
  2796. default:
  2797. _struct NullTerminatedName
  2798. {
  2799. [SMBFileNameValue]
  2800. UnicodeString Name;
  2801. }
  2802. }
  2803. }
  2804. }
  2805. }
  2806. //
  2807. // Command/Response structures
  2808. //
  2809. struct SmbComOpenAndxClientRequest
  2810. {
  2811. UINT8 WordCount = MUSTBeSetToTable( this, "0x0F");
  2812. [SMBCommand]
  2813. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  2814. UINT8 ANDXReserved;
  2815. [SMBAndXOffset]
  2816. UINT16 ANDXOffset;
  2817. [DataFieldByteOrder = LittleEndian]
  2818. UINT16 Flags
  2819. {
  2820. UINT16 QueryInformation:1 = FormatString(" (%s) %s (SMB_OPEN_QUERY_INFORMATION)", this.ToBitString, this ? "Return additional info(FileAttributes, DataSize, GrantedAccess, FileType, and DeviceState)" : "FileAttributes, DataSize, GrantedAccess, FileType, and DeviceState have indeterminate values and client ignores them");
  2821. UINT16 Oplock:1 = FormatString(" (%s) %s (SMB_OPEN_OPLOCK)", this.ToBitString, this ? "Exclusive oplock requested" : "Exclusive oplock NOT requested");
  2822. UINT16 Opbatch:1 = FormatString(" (%s) %s (SMB_OPEN_OPBATCH)", this.ToBitString, this ? "Batch oplock requested" : "Batch oplock NOT requested");
  2823. UINT16 Reserved_bit3:1 = FormatString(" (%s) Reserved", this.ToBitString);
  2824. UINT16 ExtendedResponse:1 = FormatString(" (%s) %s (SMB_OPEN_EXTENDED_RESPONSE)", this.ToBitString, this ? "RESP_EXTENDED_OPEN_ANDX reply" : "RESP_OPEN_ANDX reply");
  2825. UINT16 Reserved_bits5_15:11 = FormatString("(%s) Reserved", this.ToBitString);
  2826. };
  2827. SMBAccessMode AccessMode;
  2828. SMBFileAttributes SearchAttributes;
  2829. SMBFileAttributes FileAttributes;
  2830. //# ? TD review: FileAttributes may be 2-byte
  2831. //SMBNTFileAttributes FileAttributes;
  2832. SMBTIME CreationTime;
  2833. SMBDATE CreationDate;
  2834. SMBOpenFunction OpenMode;
  2835. UINT32 AllocationSize;
  2836. UINT32 TimeOut = FormatString("%d milli sec(s)",this);
  2837. UINT32 Reserved = MUSTBeSetToTable( this, "0x00000000");
  2838. [Post.SMBBytesEndOffset = Frameoffset + 2 + ByteCount]
  2839. UINT16 ByteCount;
  2840. //#? seems sometimes there is no BufferFormat, direct followed by FileName
  2841. //UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  2842. While [!UINT8( Framedata, Offset )]
  2843. {
  2844. UINT8 Pad;
  2845. }
  2846. switch(Property.SMBUnicode)
  2847. {
  2848. case 0:
  2849. [
  2850. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  2851. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  2852. Post.BuildConversationWithParent(Property.SMBFileName),
  2853. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  2854. SMBComPramSummary = ", FileName = " + this
  2855. ]
  2856. AsciiString AsciiFileName;
  2857. case 1:
  2858. _struct FileName
  2859. {
  2860. ALIGN2 Align;
  2861. [
  2862. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  2863. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  2864. Post.BuildConversationWithParent(Property.SMBFileName),
  2865. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  2866. SMBComPramSummary = ", FileName = " + this
  2867. ]
  2868. UnicodeString UnicodeFileName;
  2869. }
  2870. }
  2871. switch
  2872. {
  2873. case FrameOffset < SMBBytesEndOffset:
  2874. BLOB (SMBBytesEndOffset - FrameOffset) Padding;
  2875. }
  2876. switch
  2877. {
  2878. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  2879. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  2880. };
  2881. }
  2882. struct SmbComOpenAndxServerResponse
  2883. {
  2884. UINT8 WordCount = MUSTBeSetToTable( this, "0x0F");
  2885. [SMBCommand]
  2886. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  2887. UINT8 ANDXReserved;
  2888. [SMBAndXOffset]
  2889. UINT16 ANDXOffset;
  2890. [
  2891. SMBFileID,
  2892. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  2893. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  2894. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  2895. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  2896. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  2897. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  2898. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  2899. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  2900. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  2901. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  2902. ]
  2903. UINT16 FileID;
  2904. SMBFileAttributes FileAttributes;
  2905. //# ? TD review: FileAttributes may be 2-byte
  2906. //SMBNTFileAttributes FileAttributes;
  2907. SMBTIME LastWriteTime;
  2908. SMBDATE LastWriteDate;
  2909. UINT32 FileDataSize;
  2910. SMBAccessMode AccessRights;
  2911. UINT16 ResourceType = SMBFileTypeTable(this);
  2912. switch (ResourceType)
  2913. {
  2914. case 1:
  2915. case 2:
  2916. SMBDeviceState NMPipeStatus;
  2917. default:
  2918. UINT16 ReservedDS;
  2919. }
  2920. SMBOpenAction OpenResults;
  2921. [SMBComPramSummary = SMBComPramSummary + ", ServerFID = " + this]
  2922. UINT32 ServerFID;
  2923. UINT16 Reserved = MUSTBeSetToTable( this, "0x0000");
  2924. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  2925. switch
  2926. {
  2927. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  2928. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  2929. };
  2930. }
  2931. struct SmbComOpenAndxServerResponseExtension
  2932. {
  2933. UINT8 WordCount;
  2934. [SMBCommand]
  2935. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  2936. UINT8 ANDXReserved;
  2937. [SMBAndXOffset]
  2938. UINT16 ANDXOffset;
  2939. [
  2940. SMBFileID,
  2941. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  2942. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  2943. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  2944. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  2945. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  2946. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  2947. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  2948. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  2949. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  2950. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  2951. ]
  2952. UINT16 FileID;
  2953. SMBFileAttributes FileAttributes;
  2954. //# ? TD review: FileAttributes may be 2-byte
  2955. //SMBNTFileAttributes FileAttributes;
  2956. SMBTIME LastWriteTime;
  2957. SMBDATE LastWriteDate;
  2958. UINT32 DataSize;
  2959. SMBAccessMode GrantedAccess;
  2960. UINT16 ResourceType = SMBFileTypeTable(this);
  2961. switch (ResourceType)
  2962. {
  2963. case 1:
  2964. case 2:
  2965. SMBDeviceState NMPipeStatus;
  2966. default:
  2967. UINT16 ReservedDS;
  2968. }
  2969. SMBOpenAction OpenResults;
  2970. [SMBComPramSummary = SMBComPramSummary + ", ServerFID = " + this]
  2971. UINT32 ServerFID;
  2972. UINT16 Reserved;
  2973. _struct ExtendedResponse
  2974. {
  2975. SMBAccessMask MaxAccessRights;
  2976. SMBAccessMask GuestMaxAccessRights;
  2977. };
  2978. UINT16 ByteCount;
  2979. switch
  2980. {
  2981. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  2982. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  2983. };
  2984. }
  2985. struct SMBComUnlockByteRangeRequest
  2986. {
  2987. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  2988. [
  2989. SMBFileID,
  2990. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  2991. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  2992. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  2993. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  2994. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  2995. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  2996. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  2997. ]
  2998. UINT16 FileID;
  2999. UINT32 Count;
  3000. UINT32 Offset;
  3001. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  3002. }
  3003. struct SMBComUnlockByteRangeResp
  3004. {
  3005. [
  3006. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3007. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  3008. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3009. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3010. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3011. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3012. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3013. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3014. ]
  3015. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  3016. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  3017. }
  3018. Table SMBMailSlotOpcodeTable(code)
  3019. {
  3020. switch(code)
  3021. {
  3022. case 1: "Write Mail Slot";
  3023. default: FormatString("%d (0x%X)", code, code);
  3024. }
  3025. }
  3026. Table SMBMailSlotClassTable(class)
  3027. {
  3028. switch(class)
  3029. {
  3030. case 1: "Reliable";
  3031. case 2: "Unreliable & Broadcast";
  3032. default: FormatString("%d (0x%02X)", class, class);
  3033. }
  3034. }
  3035. Table SMBTransNamePipeFunctionTable(func)
  3036. {
  3037. //0x01 TRANS_SetNamedPipeHandleState
  3038. //0x11 TRANS_RawReadNamedPipe
  3039. //0x21 TRANS_GetNamedPipeHandleState
  3040. //0x22 TRANS_GetNamedPipeInfo
  3041. //0x23 TRANS_PeekNamedPipe
  3042. //0x26 TRANS_TransactNamedPipe
  3043. //0x31 TRANS_RawWriteNamedPipe
  3044. //0x53 TRANS_WaitNamedPipe
  3045. //0x54 TRANS_CallNamedPipe
  3046. switch(func)
  3047. {
  3048. case 0x01: "Set named pipe handle state";
  3049. case 0x11: "Raw read named pipe";
  3050. case 0x21: "Get named pipe handle state";
  3051. case 0x22: "Get named pipe information";
  3052. case 0x23: "Peek named pipe";
  3053. case 0x26: "Transact named pipe";
  3054. case 0x31: "Raw write named pipe";
  3055. case 0x36: "Pipe Read";
  3056. case 0x37: "Pipe Write";
  3057. case 0x53: "Wait named pipe";
  3058. case 0x54: "Call named pipe";
  3059. default: "Named pipe request";
  3060. }
  3061. }
  3062. Table SMBUnixFileType(type)
  3063. {
  3064. switch(type)
  3065. {
  3066. case 0x00000000: "File";
  3067. case 0x00000001: "Directory";
  3068. case 0x00000002: "Symbolic link";
  3069. case 0x00000003: "Character device";
  3070. case 0x00000004: "Block device";
  3071. case 0x00000005: "FIFO";
  3072. default: "Unknown file type";
  3073. }
  3074. }
  3075. Table SMBTransactSetupCountTable(setupCount)
  3076. {
  3077. switch(setupCount)
  3078. {
  3079. case 0: "Remote Administration Protocol";
  3080. case 1: "Named Pipe";
  3081. case 2: "Named Pipe";
  3082. case 3: "Mail Slots";
  3083. }
  3084. }
  3085. Table SMBPipeStateReadModeTable(mode)
  3086. {
  3087. switch(mode)
  3088. {
  3089. case 0: "Read pipe as a byte stream";
  3090. case 1: "Read messages from pipe";
  3091. default: FormatString("%d", mode);
  3092. }
  3093. }
  3094. struct SMBComTransactionRequest
  3095. {
  3096. UINT8 WordCount;
  3097. UINT16 TotalParameterCount;
  3098. UINT16 TotalDataCount;
  3099. UINT16 MaxParameterCount;
  3100. UINT16 MaxDataCount;
  3101. UINT8 MaxSetupCount;
  3102. UINT8 Reserved;
  3103. [DataFieldByteOrder = LittleEndian]
  3104. UINT16 Flags = Disconnect ? "Disconnect TID" : "Do NOT disconnect TID"
  3105. {
  3106. UINT16 Disconnect:1 = FormatString("(%s) %s", This.ToBitString, this ? "Disconnect TID" : "Do NOT disconnect TID");
  3107. UINT16 NoResponse:1 = FormatString("(%s) %s",this.toBitString,this?"One-way transaction without server's response":"Server response to the client");
  3108. UINT16 Reserved:14 = FormatString(" (%s) Reserved",this.toBitString);
  3109. };
  3110. UINT32 Timeout = FormatString("%d milli sec(s)",this);
  3111. UINT16 Reserved2;
  3112. UINT16 ParameterCount;
  3113. UINT16 ParameterOffset;
  3114. UINT16 DataCount;
  3115. UINT16 DataOffset;
  3116. [
  3117. TransactRequestSetupCount,
  3118. conversation.SMBTransactSetupCount$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3119. SMBComSummary = SMBComSummary + FormatString(", %s", SMBTransactSetupCountTable(this))
  3120. ]
  3121. UINT8 SetupCount;
  3122. UINT8 Reserved3;
  3123. //
  3124. // These are Setup Words
  3125. //
  3126. switch(SetupCount)
  3127. {
  3128. case 1:
  3129. case 2:
  3130. struct NamedPipeSetupWords
  3131. {
  3132. [
  3133. PipeFunction,
  3134. Post.SMBComSummary = SMBComSummary + ", " + SMBTransNamePipeFunctionTable(this),
  3135. Conversation.SMBTransactPipeFuncTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]
  3136. ]
  3137. UINT16 Subcommand = FormatString("%s, %d(0x%04X)", SMBTransNamePipeFunctionTable(this), this, this);
  3138. switch(SetupCount)
  3139. {
  3140. case 2:
  3141. switch
  3142. {
  3143. case PipeFunction == 0x53:
  3144. case PipeFunction == 0x54:
  3145. case SMBComSummary.contains("Named pipe request"):
  3146. UINT16 Priority;
  3147. default:
  3148. [
  3149. SMBFileID,
  3150. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3151. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3152. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, conversation.SMBFileIDCountTable$[FrameNumber])],
  3153. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3154. ]
  3155. UINT16 FileID;
  3156. }
  3157. }
  3158. }
  3159. case 3:
  3160. struct MailSlotsSetupWords
  3161. {
  3162. [Post.SMBComSummary = SMBComSummary + ", " + SMBMailSlotOpcodeTable(Subcommand)]
  3163. UINT16 Subcommand = SMBMailSlotOpcodeTable(this);
  3164. UINT16 Priority;
  3165. UINT16 Class = SMBMailSlotClassTable(this);
  3166. }
  3167. default:
  3168. switch
  3169. {
  3170. case SetupCount > 0:
  3171. _struct ErrorSetupWords
  3172. {
  3173. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("SMB: Unknown Transaction Request SetupWords, SetupCount = %d", SetupCount)) TransactionSetupWordsError;
  3174. UINT16 SetupWords[SetupCount];
  3175. }
  3176. }
  3177. }
  3178. [
  3179. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3180. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3181. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : (SMBFileID ? MakeByteArray(SMBFileID, SMBFIDCount) : MakeByteArray(SMBTID, SMBPID, SMBMID) ) ),
  3182. Post.Conversation.ConversationDescription
  3183. = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID)
  3184. : SMBFileID ? FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID)
  3185. : FormatString("(TID:0x%04X, PID:0x%04X, MID:0x%04X) ConvID = %d", SMBTID, SMBPID, SMBMID, ConvID),
  3186. Post.SMBBytesEndOffset = FrameOffset + 2 + ByteCount
  3187. ]
  3188. UINT16 ByteCount;
  3189. switch(SetupCount)
  3190. {
  3191. // accroding to netmon2 source Smbtrans.c line 1010
  3192. // Remote API - just list the pipe name
  3193. case 0:
  3194. struct RemoteAPIBuffer
  3195. {
  3196. [Post.SMBComPramSummary = ", FileName = " + SMBFileNameValue]
  3197. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  3198. switch
  3199. {
  3200. case ParameterOffset - CurrentProtocolOffset > 0:
  3201. BLOB(ParameterOffset-CurrentProtocolOffset) Pad1;
  3202. }
  3203. switch
  3204. {
  3205. case ParameterCount > 0:
  3206. RAP(ParameterCount, DataCount) RAPRequest;
  3207. }
  3208. switch
  3209. {
  3210. case DataOffset - CurrentProtocolOffset > 0:
  3211. BLOB(DataOffset-CurrentProtocolOffset) Pad2;
  3212. }
  3213. //#? these Parameters should be parsed as a Protocol: Remote API
  3214. switch
  3215. {
  3216. case DataCount > 0:
  3217. BLOB(DataCount) Data;
  3218. }
  3219. };
  3220. case 1:
  3221. case 2:
  3222. struct NamedPipeBuffer
  3223. {
  3224. [Post.SMBComPramSummary = SMBComPramSummary + ", PathName = " + SMBFileNameValue]
  3225. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) PathName;
  3226. switch
  3227. {
  3228. case ParameterOffset - CurrentProtocolOffset > 0:
  3229. BLOB(ParameterOffset-CurrentProtocolOffset) Pad1;
  3230. }
  3231. switch(PipeFunction)
  3232. {
  3233. //TRANS_SetNamedPipeHandleState TRANS_SET_NMPIPE_STATE (0x0001)
  3234. case 0x01:
  3235. _struct SetNamedPipeHandleStateParameters
  3236. {
  3237. //#???
  3238. //UINT16 UnknownData;
  3239. [DataFieldByteOrder = LittleEndian]
  3240. UINT16 PipeState
  3241. {
  3242. UINT16 Reserved_bits0_7:8 = FormatString(" (%s) Reserved", this.ToBitString);
  3243. UINT16 ReadMode:2 = FormatString(" (%s) %s", this.ToBitString, SMBPipeStateReadModeTable(this));
  3244. UINT16 Reserved_bits10_14:5 = FormatString("(%s) Reserved", this.ToBitString);
  3245. UINT16 NonBlocking:1 = FormatString(" (%s) Reads/Writes %s if data available", this.ToBitString, this ? "return immediately" : "block");
  3246. };
  3247. };
  3248. //TRANS_GetNamedPipeInfo
  3249. case 0x22:
  3250. _struct GetNamedPipeInfoParameters
  3251. {
  3252. UINT16 InfoLevel = SMBNTRenameInformationLevel(this);
  3253. };
  3254. default:
  3255. switch
  3256. {
  3257. case ParameterCount > 0:
  3258. BLOB(ParameterCount) Parameters;
  3259. }
  3260. }
  3261. switch
  3262. {
  3263. case DataOffset - CurrentProtocolOffset > 0:
  3264. BLOB(DataOffset - CurrentProtocolOffset) Pad2;
  3265. }
  3266. switch
  3267. {
  3268. case UINT8( Framedata, Offset ) == 0x05 && // RPC Protocol Version = 5, Connection-oriented RPC
  3269. ( UINT8( Framedata, Offset + 1 ) == 0 || UINT8( Framedata, Offset + 1 ) == 1 ) && // RPC minor version
  3270. ( FrameLength - frameOffset >= 16 ) && // RPC connection-oriented header length
  3271. ( UINT8( Framedata, Offset + 2 ) == 0 || // RPC ptype, connection-oriented packet types
  3272. UINT8( Framedata, Offset + 2 ) == 2 ||
  3273. UINT8( Framedata, Offset + 2 ) == 3 ||
  3274. UINT8( Framedata, Offset + 2 ) >= 11 && UINT8( Framedata, Offset + 2 ) <= 19 ) &&
  3275. ( UINT8( Framedata, Offset + 4 ) & 0xEE ) == 0 && // RPC integer and character data representation, drep octet0
  3276. UINT8( Framedata, Offset + 5 ) < 4 && // RPC floating point data representation, drep octet1
  3277. UINT8( Framedata, Offset + 6 ) == 0 && // RPC data representation drep octet2 & 3 m.b.z.
  3278. UINT8( Framedata, Offset + 7 ) == 0 :
  3279. MSRPC MSRPC;
  3280. case Property.SMBFileName.contains("MsFteWds"):
  3281. MSWSP MSWSP;
  3282. case (UINT32( FrameData, Offset ) >= 200 && UINT32( FrameData, Offset ) <= 209) ||
  3283. (UINT32( FrameData, Offset ) >= 230 && UINT32( FrameData, Offset ) <= 233) ||
  3284. UINT32( FrameData, Offset ) == 215 ||
  3285. UINT32( FrameData, Offset ) == 217 ||
  3286. UINT32( FrameData, Offset ) == 225 ||
  3287. UINT32( FrameData, Offset ) == 228 ||
  3288. UINT32( FrameData, Offset ) == 236:
  3289. // 200-209, 215, 217, 225, 228, 230-233, 236
  3290. CIS CIS;
  3291. default:
  3292. switch
  3293. {
  3294. case DataCount > 0:
  3295. BLOB(DataCount) Data;
  3296. }
  3297. }
  3298. };
  3299. //
  3300. //http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/mailslots.asp
  3301. //
  3302. case 3:
  3303. struct MailSlotsBuffer
  3304. {
  3305. [
  3306. Post.SMBComPramSummary = ", FileName = " + SMBFileNameValue,
  3307. Post.MailSlotName = SMBFileNameValue
  3308. ]
  3309. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  3310. switch
  3311. {
  3312. case DataOffset - CurrentProtocolOffset > 0:
  3313. BLOB(DataOffset-CurrentProtocolOffset) Pad2;
  3314. }
  3315. switch
  3316. {
  3317. case MailSlotName.Contains("\\BROWSE"):
  3318. BROWSER Browser;
  3319. case MailSlotName.Contains("\\NET"):
  3320. NetLogon Netlogon;
  3321. case MailSlotName.Contains("\\tapi"):
  3322. [
  3323. SMBComSummary = SMBComSummary + ", tapi",
  3324. SMBComPramSummary = SMBComPramSummary + FormatString(", TRP InitContext = 0x%08X", this)
  3325. ]
  3326. UINT32 InitContext;
  3327. case MailSlotName.Contains("\\MESSNGR"):
  3328. _struct MESSENGER
  3329. {
  3330. BLOB(DataCount) Data;
  3331. }
  3332. default:
  3333. BLOB(SMBBytesEndOffset - FrameOffset) MailSlotData;
  3334. }
  3335. };
  3336. default:
  3337. _struct OthersBuffer
  3338. {
  3339. switch
  3340. {
  3341. case ParameterOffset - CurrentProtocolOffset > 0:
  3342. BLOB(ParameterOffset-CurrentProtocolOffset) Pad1;
  3343. }
  3344. switch
  3345. {
  3346. case ParameterCount > 0:
  3347. BLOB(ParameterCount) Parameters;
  3348. }
  3349. switch
  3350. {
  3351. case DataOffset - CurrentProtocolOffset > 0:
  3352. BLOB(DataOffset-CurrentProtocolOffset) Pad2;
  3353. }
  3354. switch
  3355. {
  3356. case DataCount > 0:
  3357. BLOB(DataCount) Data;
  3358. }
  3359. }
  3360. }
  3361. }
  3362. Table SMBPipeStatusTable(status)
  3363. {
  3364. switch(status)
  3365. {
  3366. case 1: "Disconnected by server";
  3367. case 2: "Listening";
  3368. case 3: "Connection to server is okay";
  3369. case 4: "Server end of pipe is closed";
  3370. default: "Uknown";
  3371. }
  3372. }
  3373. struct SMBComTransactionResp
  3374. {
  3375. [
  3376. Conversation.SMBTransactSetupCountPerFrame$[FrameNumber] = conversation.SMBTransactSetupCount$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3377. TransactRequestSetupCount = Conversation.SMBTransactSetupCountPerFrame$[FrameNumber],
  3378. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3379. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  3380. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3381. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3382. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3383. Conversation.SMBTransactFuncPerFrame$[FrameNumber] = conversation.SMBTransactPipeFuncTable$[MakeByteArray(SMBTID, SMBPID,SMBMID)],
  3384. Property.PipeFunction = Conversation.SMBTransactFuncPerFrame$[FrameNumber],
  3385. SMBComSummary = SMBComSummary + FormatString(", %s", SMBTransactSetupCountTable(TransactRequestSetupCount)),
  3386. SMBComSummary = PipeFunction ? SMBComSummary + ", " + SMBTransNamePipeFunctionTable(PipeFunction): SMBComSummary,
  3387. SMBComPramSummary = (TransactRequestSetupCount == 2) ? SMBComPramSummary + FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "") : SMBComPramSummary,
  3388. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : (SMBFileID ? MakeByteArray(SMBFileID, SMBFIDCount) : MakeByteArray(SMBTID, SMBPID, SMBMID) ) ),
  3389. Post.Conversation.ConversationDescription
  3390. = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID)
  3391. : SMBFileID ? FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID)
  3392. : FormatString("(TID:0x%04X, PID:0x%04X, MID:0x%04X) ConvID = %d", SMBTID, SMBPID, SMBMID, ConvID)
  3393. ]
  3394. UINT8 WordCount;
  3395. UINT16 TotalParameterCount;
  3396. UINT16 TotalDataCount;
  3397. UINT16 Reserved;
  3398. UINT16 ParameterCount;
  3399. UINT16 ParameterOffset;
  3400. UINT16 ParamDisplacement;
  3401. UINT16 DataCount;
  3402. [SMBDataAlignCount = DataOffset - ParameterOffset - ParameterCount]
  3403. UINT16 DataOffset;
  3404. UINT16 DataDisplacement;
  3405. UINT8 SetupCount;
  3406. UINT8 Reserved2;
  3407. switch
  3408. {
  3409. // SetupCount could be set to any value if TRANS_CALL_NMPIPE response fails with STATUS_BUFFER_OVERFLOW
  3410. case (Property.SMBStatus & 0x30000005) != 0x00000005 && SetupCount > 0:
  3411. _struct ErrorSetupWords
  3412. {
  3413. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("SMB: Unknown Transaction Response SetupWords, SetupCount = %d", SetupCount)) TransactionSetupWordsError;
  3414. UINT16 SetupWords[SetupCount];
  3415. }
  3416. };
  3417. UINT16 ByteCount;
  3418. switch
  3419. {
  3420. case ParameterOffset - CurrentProtocolOffset > 0:
  3421. BLOB(ParameterOffset-CurrentProtocolOffset) Pad1;
  3422. }
  3423. //
  3424. // This is Transaction Parameter Block
  3425. //
  3426. switch
  3427. {
  3428. case ParameterCount > 0 && ParamDisplacement == 0:
  3429. switch
  3430. {
  3431. case !(ConvID > 0):
  3432. _struct ReportWarning
  3433. {
  3434. ReportParserWarning( "SMB", "May not parse correctly when conversation off") ParserWarning;
  3435. BLOB(ParameterCount) Parameters;
  3436. };
  3437. case Property.TransactRequestSetupCount == 0:
  3438. RAP(ParameterCount, DataCount) RAPResponse;
  3439. case Property.TransactRequestSetupCount == 1:
  3440. case Property.TransactRequestSetupCount == 2:
  3441. switch(Property.PipeFunction)
  3442. {
  3443. //TRANS_GetNamedPipeHandleState
  3444. case 0x21:
  3445. [DataFieldByteOrder = LittleEndian]
  3446. UINT16 PipeState
  3447. {
  3448. UINT16 ICount:8 = FormatString(" (%s) %d", this.ToBitString, this);
  3449. UINT16 ReadMode:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Pipe should be read as a message" : "Pipe should be read as a byte stream");
  3450. UINT16 Reserved_bit9:1 = FormatString(" (%s) Reserved", this.ToBitString);
  3451. UINT16 NamedPipeType:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Pipe is a message pipe" : "Pipe is a byte stream pipe");
  3452. UINT16 Reserved_bits11_13:3 = FormatString("(%s) Reserved", this.ToBitString);
  3453. UINT16 EndPoint:1 = FormatString(" (%s) %s", this.ToBitString, this ? "The server end of the pipe" : "The client end of the pipe");
  3454. UINT16 Blocking:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Reads and writes return immediately if no data" : "Reads and writed block if no data avaliable");
  3455. }
  3456. //TRANS_PEEK_NMPIPE Response
  3457. case 0x23:
  3458. struct
  3459. {
  3460. UINT16 ReadDataAvailable;
  3461. UINT16 MessageBytesLength;
  3462. UINT16 NamedPipeState = SMBPipeStatusTable(this);
  3463. }
  3464. //TRANS_RawWriteNamedPipe
  3465. case 0x31:
  3466. UINT16 BytesWritten;
  3467. default:
  3468. BLOB(ParameterCount) Parameters;
  3469. }
  3470. case Property.TransactRequestSetupCount == 3:
  3471. switch(Property.PipeFunction)
  3472. {
  3473. //TRANS_MAILSLOT_WRITE
  3474. case 0x0001:
  3475. UINT16 OperationStatus;
  3476. }
  3477. }
  3478. }
  3479. switch
  3480. {
  3481. case DataOffset - CurrentProtocolOffset > 0:
  3482. BLOB(DataOffset-CurrentProtocolOffset) Pad2;
  3483. }
  3484. //
  3485. // This is Transaction Data Block
  3486. //
  3487. switch
  3488. {
  3489. case DataCount > 0 && DataDisplacement == 0:
  3490. switch
  3491. {
  3492. case UINT8( Framedata, Offset ) == 0x05 && // RPC Protocol Version = 5, Connection-oriented RPC
  3493. ( UINT8( Framedata, Offset + 1 ) == 0 || UINT8( Framedata, Offset + 1 ) == 1 ) && // RPC minor version
  3494. ( FrameLength - frameOffset >= 16 ) && // RPC connection-oriented header length
  3495. ( UINT8( Framedata, Offset + 2 ) == 0 || // RPC ptype, connection-oriented packet types
  3496. UINT8( Framedata, Offset + 2 ) == 2 ||
  3497. UINT8( Framedata, Offset + 2 ) == 3 ||
  3498. UINT8( Framedata, Offset + 2 ) >= 11 && UINT8( Framedata, Offset + 2 ) <= 19 ) &&
  3499. ( UINT8( Framedata, Offset + 4 ) & 0xEE ) == 0 && // RPC integer and character data representation, drep octet0
  3500. UINT8( Framedata, Offset + 5 ) < 4 && // RPC floating point data representation, drep octet1
  3501. UINT8( Framedata, Offset + 6 ) == 0 && // RPC data representation drep octet2 & 3 m.b.z.
  3502. UINT8( Framedata, Offset + 7 ) == 0 :
  3503. [
  3504. PayloadStart(
  3505. NetworkDirection, /* direction */
  3506. Property.SMBFileID, //identifier
  3507. 0, //sequence token
  3508. 0, //next sequence
  3509. UINT16( FrameData, FrameOffset + 8 ), //total payload length
  3510. SMBStatus != 0x80000005||(DataDisplacement == 0 && SMBStatus == 0x80000005), //is first
  3511. 0, //is last
  3512. RssmblyIndStartBit+RssmblyIndLengthBit, //has start and end indication
  3513. 0x0000, /* Properties... */
  3514. SMBResponse,
  3515. 0x0000,
  3516. ""
  3517. )
  3518. ]
  3519. MSRPC MSRPC;
  3520. default:
  3521. [
  3522. PayloadStart(
  3523. NetworkDirection, /* direction */
  3524. 0, /* id */
  3525. DataDisplacement, /* sequence token */
  3526. DataDisplacement + DataCount, /* next sequence token */
  3527. 0, /* total payload length */
  3528. (ParamDisplacement == 0) && (DataDisplacement == 0), /* is first */
  3529. (TotalParameterCount == ParamDisplacement + ParameterCount) && (TotalDataCount == DataDisplacement + DataCount), /* is last */
  3530. RssmblyIndStartBit+RssmblyIndEndBit+RssmblySequenceBit, //has start and end indication
  3531. 0x0000, /* Properties... */
  3532. SMBResponse,
  3533. 0x0000,
  3534. ""
  3535. )
  3536. ]
  3537. switch
  3538. {
  3539. case !(ConvID > 0):
  3540. _struct ReportWarning
  3541. {
  3542. ReportParserWarning( "SMB", "May not parse correctly when conversation off") ParserWarning;
  3543. BLOB(DataCount) Data;
  3544. };
  3545. //TRANS_GetNamedPipeInfo
  3546. case PipeFunction == 0x22:
  3547. struct PipeInformationDataBlock
  3548. {
  3549. UINT16 OutputBufferSize;
  3550. UINT16 InputBufferSize;
  3551. UINT8 MaximumInstances;
  3552. UINT8 CurrentInstances;
  3553. UINT8 PipeNameLength;
  3554. [Post.SMBComPramSummary = SMBComPramSummary + ", PipeName = " + SMBFileNameValue]
  3555. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) PipeName;
  3556. }
  3557. //TRANS_PeekNamedPipe
  3558. case PipeFunction == 0x23:
  3559. BLOB(DataCount) PeekedData;
  3560. case Property.SMBFileName.contains("MsFteWds"):
  3561. MSWSP MSWSP;
  3562. case (UINT32( FrameData, Offset ) >= 200 && UINT32( FrameData, Offset ) <= 209) ||
  3563. (UINT32( FrameData, Offset ) >= 230 && UINT32( FrameData, Offset ) <= 233) ||
  3564. UINT32( FrameData, Offset ) == 215 ||
  3565. UINT32( FrameData, Offset ) == 217 ||
  3566. UINT32( FrameData, Offset ) == 225 ||
  3567. UINT32( FrameData, Offset ) == 228 ||
  3568. UINT32( FrameData, Offset ) == 236:
  3569. // 200-209, 215, 217, 225, 228, 230-233, 236
  3570. CIS CIS;
  3571. case TransactRequestSetupCount == 0:
  3572. // This may be RAP (Remote Administration Protocol, was Remote API in Netmon2) response datas
  3573. BLOB(DataCount) RAPData;
  3574. default:
  3575. BLOB(DataCount) Data;
  3576. }
  3577. };
  3578. case DataCount > 0 && DataDisplacement > 0:
  3579. //
  3580. // This is a Fragmented Ttransact Frame
  3581. //
  3582. [
  3583. PayloadStart(
  3584. NetworkDirection, /* direction */
  3585. 0, /* id */
  3586. DataDisplacement, /* sequence token */
  3587. DataDisplacement + DataCount, /* next sequence token */
  3588. 0, /* total payload length */
  3589. (ParamDisplacement == 0) && (DataDisplacement == 0), /* is first */
  3590. (TotalParameterCount == ParamDisplacement + ParameterCount) && (TotalDataCount == DataDisplacement + DataCount), /* is last */
  3591. RssmblyIndStartBit+RssmblyIndEndBit+RssmblySequenceBit, //has start and end indication
  3592. 0x0000, /* Properties... */
  3593. SMBResponse,
  3594. 0x0000,
  3595. ""
  3596. )
  3597. ]
  3598. BLOB(DataCount > FrameLength - FrameOffset ? FrameLength - FrameOffset : DataCount) ContinuationData;
  3599. }
  3600. }
  3601. struct SMBComTransactionSecondaryRequest
  3602. {
  3603. UINT8 WordCount = MUSTBeSetToTable( this, "0x08");
  3604. UINT16 TotalParameterCount;
  3605. UINT16 TotalDataCount;
  3606. UINT16 ParameterCount;
  3607. UINT16 ParameterOffset;
  3608. UINT16 ParamDisplacement;
  3609. UINT16 DataCount;
  3610. UINT16 DataOffset;
  3611. UINT16 DataDisplacement;
  3612. [
  3613. SMBFileID = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3614. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3615. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3616. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3617. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3618. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3619. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3620. ]
  3621. UINT16 ByteCount;
  3622. switch
  3623. {
  3624. case ParameterOffset - CurrentProtocolOffset > 0:
  3625. BLOB(ParameterOffset-CurrentProtocolOffset) Pad1;
  3626. }
  3627. switch
  3628. {
  3629. case ParameterCount > 0:
  3630. BLOB(ParameterCount) Parameters;
  3631. }
  3632. switch
  3633. {
  3634. case DataOffset - CurrentProtocolOffset > 0:
  3635. BLOB(DataOffset-CurrentProtocolOffset) Pad2;
  3636. }
  3637. switch
  3638. {
  3639. case DataCount > 0:
  3640. BLOB(DataCount) Data;
  3641. }
  3642. }
  3643. [Property.SMBInterimResponse = true]
  3644. struct SMBComInterimTransactionResp
  3645. {
  3646. [
  3647. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3648. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber]
  3649. ]
  3650. UINT8 WordCount;
  3651. switch
  3652. {
  3653. case SMBFileID:
  3654. [
  3655. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3656. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3657. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3658. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3659. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3660. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3661. ]
  3662. _struct BuildConversationForInterimResponse
  3663. {
  3664. UINT16 ByteCount;
  3665. };
  3666. default:
  3667. UINT16 ByteCount;
  3668. }
  3669. }
  3670. struct SMBComWriteRequestAndXRequest
  3671. {
  3672. UINT8 WordCount;
  3673. [SMBCommand]
  3674. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  3675. UINT8 ANDXReserved;
  3676. [SMBAndXOffset]
  3677. UINT16 ANDXOffset;
  3678. [
  3679. SMBFileID,
  3680. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3681. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3682. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3683. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3684. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3685. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3686. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3687. ]
  3688. UINT16 FID;
  3689. [Property.SMBFileOffset]
  3690. UINT32 FileOffset;
  3691. UINT32 Timeout;
  3692. SMBWriteMode WriteMode;
  3693. UINT16 Remaining;
  3694. UINT16 DataLengthHigh;
  3695. [Property.SMBDataLength = DataLengthHigh * 65536 + this]
  3696. [post.property.SmbFileFragmentLen = Property.SMBDataLength]
  3697. UINT16 DataLength;
  3698. UINT16 DataOffset;
  3699. switch(WordCount)
  3700. {
  3701. case 14:
  3702. [
  3703. SMBLargeFileOffset = this <> 0xFFFFFFFF && this > 0,
  3704. Property.SMBFileOffset = (this <> 0xFFFFFFFF) ? (SMBFileOffset + this * 4294967296) : SMBFileOffset
  3705. ]
  3706. UINT32 OffsetHigh;
  3707. }
  3708. [SMBComPramSummary = SMBComPramSummary + ", "
  3709. + SMBFormatNumber("%u", FALSE, Property.SMBDataLength)
  3710. + " bytes at Offset "
  3711. + SMBFormatNumber("%u", SMBIsLargeFileOffset, SMBFileOffset)
  3712. ]
  3713. UINT16 ByteCount;
  3714. switch
  3715. {
  3716. case CurrentProtocolOffset < DataOffset:
  3717. BLOB(DataOffset - CurrentProtocolOffset) Pad;
  3718. }
  3719. switch
  3720. {
  3721. case UINT8( Framedata, Offset ) == 0x05 && // RPC Protocol Version = 5, Connection-oriented RPC
  3722. ( UINT8( Framedata, Offset + 1 ) == 0 || UINT8( Framedata, Offset + 1 ) == 1 ) && // RPC minor version
  3723. ( FrameLength - frameOffset >= 16 ) && // RPC connection-oriented header length
  3724. ( UINT8( Framedata, Offset + 2 ) == 0 || // RPC ptype, connection-oriented packet types
  3725. UINT8( Framedata, Offset + 2 ) == 2 ||
  3726. UINT8( Framedata, Offset + 2 ) == 3 ||
  3727. UINT8( Framedata, Offset + 2 ) >= 11 && UINT8( Framedata, Offset + 2 ) <= 19 ) &&
  3728. ( UINT8( Framedata, Offset + 4 ) & 0xEE ) == 0 && // RPC integer and character data representation, drep octet0
  3729. UINT8( Framedata, Offset + 5 ) < 4 && // RPC floating point data representation, drep octet1
  3730. UINT8( Framedata, Offset + 6 ) == 0 && // RPC data representation drep octet2 & 3 m.b.z.
  3731. UINT8( Framedata, Offset + 7 ) == 0 :
  3732. MSRPC MSRPC;
  3733. case AsciiString( FrameData, Offset, 4 ) == "MSCF":
  3734. BLOB(Property.SMBDataLength > (FrameLength - FrameOffset)?(FrameLength - FrameOffset):Property.SMBDataLength) CabinetFile;
  3735. default:
  3736. struct
  3737. {
  3738. [Local.SMBFileNameRemain = Property.SMBFileName]
  3739. [MaxLoopCount = 200]
  3740. while [Local.SMBFileNameRemain.ContainsBin(2, "5C")]
  3741. {
  3742. [Local.SMBFileNameRemain = UnicodeString(Local.SMBFileNameRemain, 2)]
  3743. struct{};
  3744. }
  3745. switch
  3746. {
  3747. case contains(Property.SMBFileName, "\\ci_skads"):
  3748. CIS CIS;
  3749. case Local.SMBFileNameRemain.containsBin(2, "2E")://It's not pipe data when include "." in the file name
  3750. switch
  3751. {
  3752. case conversation.Parent.SmbIsNotPipe$[property.SMBTID] || IsValueNone(conversation.Parent.SmbIsNotPipe$[property.SMBTID]):
  3753. [
  3754. PayloadStart(
  3755. NetworkDirection, /* direction */
  3756. 0, /* id */
  3757. property.SMBFileOffset, /* sequence token */
  3758. property.SMBFileOffset + property.SmbFileFragmentLen, /* next sequence token */
  3759. 0, /* total payload length */
  3760. Property.IsMoreThanOneSMBOverTcp ? 1 : property.SMBFileOffset == 0, /* is first */
  3761. Property.IsMoreThanOneSMBOverTcp ? 1 : 0, /* is last */
  3762. RssmblyIndStartBit + RssmblyIndEndBit + RssmblySequenceBit,
  3763. 0x0000,
  3764. 0,
  3765. 0x0000,
  3766. Property.SMBFileName
  3767. )
  3768. ]
  3769. [DataFieldFrameLength = FrameOffset + property.SmbFileFragmentLen]
  3770. switch
  3771. {
  3772. case property.SMBFileOffset == 0:
  3773. FileTypeContent FileTypeContent;
  3774. default:
  3775. blob(FrameLength - FrameOffset) ContinualData;
  3776. }
  3777. default:
  3778. BLOB(Property.SmbFileFragmentLen) Payload;
  3779. }
  3780. default:
  3781. BLOB(Property.SmbFileFragmentLen) PipePayload;
  3782. }
  3783. }
  3784. }
  3785. switch
  3786. {
  3787. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  3788. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  3789. };
  3790. }
  3791. struct SMBComWriteAndXResp
  3792. {
  3793. [
  3794. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3795. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  3796. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3797. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3798. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3799. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3800. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3801. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3802. ]
  3803. UINT8 WordCount = MUSTBeSetToTable( this, "0x06");
  3804. [SMBCommand]
  3805. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  3806. UINT8 ANDXReserved;
  3807. [SMBAndXOffset]
  3808. UINT16 ANDXOffset;
  3809. [SMBComPramSummary = SMBComPramSummary + FormatString(", %d bytes", Count)]
  3810. UINT16 Count;
  3811. UINT16 Available;
  3812. UINT16 CountHigh;
  3813. UINT16 Reserved = MUSTBeSetToTable( this, "0x0000");
  3814. UINT16 ByteCount;
  3815. switch
  3816. {
  3817. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  3818. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  3819. };
  3820. }
  3821. struct SMBComLockAndReadRequest
  3822. {
  3823. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  3824. [
  3825. SMBFileID,
  3826. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3827. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3828. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3829. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3830. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3831. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3832. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3833. ]
  3834. UINT16 FileID;
  3835. UINT16 CountOfBytesToRead;
  3836. [Post.SMBComPramSummary = SMBComPramSummary + FormatString(", FileOffset = %d", ReadOffsetInBytes)]
  3837. UINT32 ReadOffsetInBytes;
  3838. UINT16 EstimateOfRemainingBytesToBeRead;
  3839. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  3840. }
  3841. struct SMBComLockAndReadResp
  3842. {
  3843. [
  3844. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3845. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  3846. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3847. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3848. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3849. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3850. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3851. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3852. ]
  3853. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  3854. UINT16 CountOfBytesReturned;
  3855. BLOB(8) Reserved;
  3856. UINT16 ByteCount;
  3857. UINT8 BufferType = SMBBufferStringFormatsTable(this);
  3858. UINT16 CountOfBytesRead;
  3859. BLOB(DataLength) Bytes;
  3860. }
  3861. struct SMBComWriteRequestAndUnlockRequest
  3862. {
  3863. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  3864. [
  3865. SMBFileID,
  3866. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3867. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3868. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3869. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3870. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3871. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3872. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3873. ]
  3874. UINT16 FileID;
  3875. UINT16 CountOfBytesToWrite;
  3876. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes at Offset %u", CountOfBytesToWrite, WriteOffsetInBytes)]
  3877. UINT32 WriteOffsetInBytes;
  3878. UINT16 EstimateOfRemainingBytesToBeWritten;
  3879. UINT16 ByteCount;
  3880. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  3881. UINT16 DataLength;
  3882. BLOB(DataLength) Data;
  3883. }
  3884. struct SMBComWriteAndUnlockResp
  3885. {
  3886. [
  3887. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3888. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  3889. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3890. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3891. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3892. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3893. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3894. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3895. ]
  3896. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  3897. [SMBComPramSummary = SMBComPramSummary + FormatString(", %d bytes", CountOfBytesWritten)]
  3898. UINT16 CountOfBytesWritten;
  3899. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  3900. }
  3901. struct SMBComReadRequestRawRequest
  3902. {
  3903. UINT8 WordCount;
  3904. [
  3905. SMBFileID,
  3906. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3907. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3908. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3909. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3910. Post.Conversation.SMBReadRawFileId$[Property.TCPNextSeqNumber] = Property.SMBFileId,
  3911. Post.Conversation.SMBReadRawFileIdCount$[Property.TCPNextSeqNumber] = Property.SMBFIDCount,
  3912. Post.Conversation.SMBReadRawFileName$[Property.TCPNextSeqNumber] = Property.SMBFileName,
  3913. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3914. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3915. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3916. ]
  3917. UINT16 FileID;
  3918. [SMBFileOffset]
  3919. UINT32 Offset;
  3920. UINT16 MaxCountOfBytesToReturn;
  3921. UINT16 MinCountOfBytesToReturn;
  3922. UINT32 TimeOut = FormatString("%d milli secs (ignored)",this);
  3923. UINT16 Reserved= ShouldBeSetToTable( this, "0x0000");
  3924. switch(WordCount)
  3925. {
  3926. case 10:
  3927. [
  3928. SMBIsLargeFileOffset = this <> 0xFFFFFFFF && this > 0,
  3929. SMBFileOffset = (this <> 0xFFFFFFFF) ? (SMBFileOffset + this * 4294967296) : SMBFileOffset
  3930. ]
  3931. UINT32 OffsetHigh;
  3932. }
  3933. [SMBComPramSummary = SMBComPramSummary + ", "
  3934. + SMBFormatNumber("%u", FALSE, MaxCountOfBytesToReturn)
  3935. + " bytes at Offset "
  3936. + SMBFormatNumber("%u", SMBIsLargeFileOffset, SMBFileOffset)
  3937. ]
  3938. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  3939. }
  3940. struct SMBComReadRawResp
  3941. {
  3942. [
  3943. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3944. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  3945. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3946. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3947. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3948. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3949. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3950. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3951. ]
  3952. UINT8 WordCount;
  3953. BLOB(WordCount*2) WordData;
  3954. UINT16 ByteCount;
  3955. BLOB(ByteCount) ByteData;
  3956. }
  3957. struct SMBComReadRequestMPXRequest
  3958. {
  3959. UINT8 WordCount = MUSTBeSetToTable( this, "0x08");
  3960. [
  3961. SMBFileID,
  3962. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3963. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3964. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3965. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3966. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3967. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3968. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  3969. ]
  3970. UINT16 FileID;
  3971. UINT32 FileOffset;
  3972. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes at Offset %u", MaxCountOfBytesToReturn, FileOffset)]
  3973. UINT16 MaxCountOfBytesToReturn;
  3974. UINT16 MinCountOfBytesToReturn;
  3975. UINT32 Timeout = FormatString("%d milli secs (ignored)",this);
  3976. UINT16 Reserved = ShouldBeSetToTable( this, "0x0000");
  3977. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  3978. }
  3979. //#? This command is enabled for direct-IPX networks only,
  3980. //#? and is used by a client to request an MPX read for a large range.
  3981. //#? Direct-IPX networks are no longer common and are not a default configuration.
  3982. struct SMBComReadRequestMPXSecondaryRequest
  3983. {
  3984. UINT8 WordCount;
  3985. BLOB(WordCount*2) WordParameters;
  3986. UINT16 ByteCount;
  3987. BLOB(ByteCount) ByteParameters;
  3988. }
  3989. struct SMBComReadMPXResp
  3990. {
  3991. [
  3992. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  3993. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  3994. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  3995. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  3996. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  3997. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  3998. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  3999. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4000. ]
  4001. UINT8 WordCount = MUSTBeSetToTable( this, "0x08");
  4002. UINT32 FileOffset;
  4003. UINT16 Count;
  4004. UINT16 Remaining;
  4005. UINT16 DataCompactionMode = MUSTBeSetToTable( this, "0x0000");
  4006. UINT16 Reserved = MUSTBeSetToTable( this, "0x0000");
  4007. UINT16 DataLength;
  4008. UINT16 DataOffset;
  4009. UINT16 ByteCount;
  4010. switch
  4011. {
  4012. case CurrentProtocolOffset < DataOffset:
  4013. BLOB(DataOffset-CurrentProtocolOffset) Pad;
  4014. }
  4015. switch
  4016. {
  4017. case DataLength > 0:
  4018. BLOB(DataLength) Data;
  4019. }
  4020. }
  4021. struct SMBComWriteRequestRawRequest
  4022. {
  4023. UINT8 WordCount;
  4024. [
  4025. SMBFileID,
  4026. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4027. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4028. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4029. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4030. Post.Conversation.SMBWriteRawFileID$[Property.TCPNextSeqNumber] = Property.SMBFileID,
  4031. Post.Conversation.SMBWriteRawFileIdCount$[Property.TCPNextSeqNumber] = Property.SMBFIDCount,
  4032. Post.Conversation.SMBWriteRawFileName$[Property.TCPNextSeqNumber] = Property.SMBFileName,
  4033. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4034. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4035. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4036. ]
  4037. UINT16 FileID;
  4038. UINT16 CountOfBytes;
  4039. UINT16 Reserved1;
  4040. [SMBFileOffset]
  4041. UINT32 FileOffset;
  4042. UINT32 Timeout = FormatString("%d milli secs (ignored)",this);
  4043. SMBWriteMode WriteMode;
  4044. UINT32 Reserved2 = MUSTBeSetToTable( this, "0x00000000");
  4045. UINT16 DataLength;
  4046. UINT16 DataOffset;
  4047. switch(WordCount)
  4048. {
  4049. case 14:
  4050. [
  4051. SMBIsLargeFileOffset = this <> 0xFFFFFFFF && this > 0,
  4052. SMBFileOffset = (this <> 0xFFFFFFFF) ? (SMBFileOffset + this * 4294967296) : SMBFileOffset
  4053. ]
  4054. UINT32 OffsetHigh;
  4055. }
  4056. [SMBComPramSummary = SMBComPramSummary + ", "
  4057. + SMBFormatNumber("%u", FALSE, CountOfBytes)
  4058. + " bytes at Offset "
  4059. + SMBFormatNumber("%u", SMBIsLargeFileOffset, SMBFileOffset)
  4060. ]
  4061. UINT16 ByteCount;
  4062. switch
  4063. {
  4064. case CurrentProtocolOffset < DataOffset:
  4065. BLOB(DataOffset-CurrentProtocolOffset) Pad;
  4066. }
  4067. UINT8 Data[DataLength];
  4068. }
  4069. struct SMBComWriteRawResp
  4070. {
  4071. [
  4072. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4073. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4074. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4075. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4076. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4077. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4078. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4079. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4080. ]
  4081. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  4082. UINT16 Remaining;
  4083. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4084. }
  4085. struct SMBComWriteRequestMPXRequest
  4086. {
  4087. UINT8 WordCount = MUSTBeSetToTable( this, "0x0C");
  4088. [
  4089. SMBFileID,
  4090. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4091. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4092. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4093. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4094. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4095. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4096. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4097. ]
  4098. UINT16 FileID;
  4099. UINT16 TotalByteCount;
  4100. UINT16 Reserved;
  4101. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes at Offset %u", TotalByteCount, ByteOffsetToBeginWrite)]
  4102. UINT32 ByteOffsetToBeginWrite;
  4103. UINT32 TimeOut = FormatString("%d milli secs (ignored)",this);
  4104. SMBWriteMode WriteMode;
  4105. UINT32 RequestMask;
  4106. UINT16 DataLength;
  4107. UINT16 DataOffset;
  4108. UINT16 ByteCount;
  4109. switch
  4110. {
  4111. case DataOffset > CurrentProtocolOffset:
  4112. BLOB(DataOffset - CurrentProtocolOffset) Padding;
  4113. }
  4114. switch
  4115. {
  4116. case DataLength > 0:
  4117. BLOB(DataLength) Data;
  4118. }
  4119. }
  4120. struct SMBComWriteMPXResp
  4121. {
  4122. [
  4123. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4124. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4125. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4126. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4127. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4128. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4129. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4130. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4131. ]
  4132. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  4133. UINT32 ResponseMask;
  4134. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4135. }
  4136. struct SMBComWriteRequestMPXSecondaryRequest
  4137. {
  4138. UINT8 WordCount;
  4139. [
  4140. SMBFileID,
  4141. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4142. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4143. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4144. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4145. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4146. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4147. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4148. ]
  4149. UINT16 FileID;
  4150. UINT16 Count;
  4151. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes at Offset %u", Count, FileOffset)]
  4152. UINT32 FileOffset;
  4153. UINT32 Reserved;
  4154. UINT16 DataLength;
  4155. UINT16 DataOffset;
  4156. UINT16 ByteCount;
  4157. switch
  4158. {
  4159. case DataOffset > CurrentProtocolOffset:
  4160. BLOB(DataOffset - CurrentProtocolOffset) Padding;
  4161. }
  4162. switch
  4163. {
  4164. case DataLength > 0:
  4165. BLOB(DataLength) Data;
  4166. }
  4167. }
  4168. struct SMBComWriteCompleteResp
  4169. {
  4170. [
  4171. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4172. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4173. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4174. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4175. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4176. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4177. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4178. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4179. ]
  4180. UINT8 WordCount;
  4181. [SMBComPramSummary = SMBComPramSummary + FormatString(", %d bytes", Count)]
  4182. UINT16 Count;
  4183. UINT16 ByteCount;
  4184. }
  4185. struct SMBComSetInformationRequest2
  4186. {
  4187. UINT8 WordCount = MUSTBeSetToTable( this, "0x07");
  4188. [
  4189. SMBFileID,
  4190. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4191. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4192. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4193. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4194. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4195. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4196. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4197. ]
  4198. UINT16 FileID;
  4199. SMBDATE CreationDate;
  4200. SMBTIME CreationTime;
  4201. SMBDATE LastAccessDate;
  4202. SMBTIME LastAccessTime;
  4203. SMBDATE LastWriteDate;
  4204. SMBTIME LastWriteTime;
  4205. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4206. UINT8 Buffer;
  4207. }
  4208. struct SMBComSetInformation2Resp
  4209. {
  4210. [
  4211. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4212. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4213. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4214. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4215. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4216. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4217. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4218. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4219. ]
  4220. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  4221. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4222. }
  4223. struct SMBComQueryInformationRequest2
  4224. {
  4225. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  4226. [
  4227. SMBFileID,
  4228. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4229. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4230. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4231. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4232. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4233. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4234. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4235. ]
  4236. UINT16 FileID;
  4237. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4238. }
  4239. struct SMBComQueryInformation2Resp
  4240. {
  4241. [
  4242. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4243. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4244. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4245. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4246. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4247. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4248. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4249. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4250. ]
  4251. UINT8 WordCount = MUSTBeSetToTable( this, "0x0B");
  4252. SMBDATE CreationDate;
  4253. SMBTIME CreationTime;
  4254. SMBDATE LastAccessDate;
  4255. SMBTIME LastAccessTime;
  4256. SMBDATE LastWriteDate;
  4257. SMBTIME LastWriteTime;
  4258. UINT32 FileDataSize;
  4259. UINT32 FileAllocationSize;
  4260. SMBFileAttributes FileAttributes;
  4261. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4262. }
  4263. struct SMBComWriteRequestAndCloseRequest
  4264. {
  4265. UINT8 WordCount;
  4266. [
  4267. SMBFileID,
  4268. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4269. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4270. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4271. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4272. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4273. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4274. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4275. ]
  4276. UINT16 FileID;
  4277. UINT16 CountOfBytesToWrite;
  4278. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes at Offset %u", CountOfBytesToWrite, WriteOffsetInBytes)]
  4279. UINT32 WriteOffsetInBytes;
  4280. SMBTIME LastWriteTime;
  4281. SMBDATE LastWriteDate;
  4282. switch(WordCount)
  4283. {
  4284. case 12:
  4285. UINT32 Reserved[3];
  4286. }
  4287. UINT16 ByteCount;
  4288. UINT8 Pad;
  4289. UINT8 Buffer[CountOfBytesToWrite];
  4290. }
  4291. struct SMBComWriteAndCloseResp
  4292. {
  4293. [
  4294. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4295. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4296. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4297. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4298. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4299. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount), Disconnected),
  4300. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4301. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4302. ]
  4303. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  4304. [SMBComPramSummary = SMBComPramSummary + FormatString(", %d bytes", CountOfBytesWritten)]
  4305. UINT16 CountOfBytesWritten;
  4306. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4307. }
  4308. struct SMBComCreateDirectoryRequest
  4309. {
  4310. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  4311. UINT16 ByteCount;
  4312. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  4313. [Post.SMBComPramSummary = ", Directory = " + SMBFileNameValue]
  4314. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) DirectoryName;
  4315. }
  4316. struct SMBComCreateDirectoryResp
  4317. {
  4318. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  4319. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4320. }
  4321. struct SMBRequestNTCreateAndX
  4322. {
  4323. UINT8 WordCount = MUSTBeSetToTable( this, "0x18");
  4324. [SMBCommand]
  4325. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  4326. UINT8 AndXReserved;
  4327. [SMBAndXOffset]
  4328. UINT16 ANDXOffset;
  4329. UINT8 Reserved;
  4330. UINT16 NameLength;
  4331. SMBNTCreateFlags Flags;
  4332. UINT32 RootDirectotyFID;
  4333. SMBAccessMask DesiredAccess;
  4334. SMBLargeInteger AllocationSize;
  4335. SMBNTFileAttributes ExtFileAttributes;
  4336. SMBNTCreateShareAccess ShareAccess;
  4337. UINT32 CreateDisposition = SMBNTCreateDisposition(this);
  4338. SMBNTCreateOptions CreateOptions;
  4339. UINT32 ImpersonationLevel = SMBNTImpersonationLevelTable(UINT8( Framedata, Offset ));
  4340. SMBSecurityFlags SecurityFlags;
  4341. [Post.SMBBytesEndOffset = frameOffset + 2 + ByteCount]
  4342. UINT16 ByteCount;
  4343. //#? NOT mentioned in Doc
  4344. //UINT8 Pad;
  4345. switch(Property.SMBUnicode)
  4346. {
  4347. case 0:
  4348. _struct AsciiFileName
  4349. {
  4350. [
  4351. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4352. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4353. Post.BuildConversationWithParent(Property.SMBFileName),
  4354. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4355. SMBComPramSummary = ", FileName = " + this
  4356. ]
  4357. AsciiString FileName;
  4358. }
  4359. case 1:
  4360. _struct UnicodeFileName
  4361. {
  4362. ALIGN2 Align;
  4363. [
  4364. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4365. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4366. Post.BuildConversationWithParent(Property.SMBFileName),
  4367. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4368. SMBComPramSummary = ", FileName = " + this
  4369. ]
  4370. UnicodeString FileName;
  4371. }
  4372. }
  4373. switch
  4374. {
  4375. case FrameOffset < SMBBytesEndOffset:
  4376. BLOB (SMBBytesEndOffset - FrameOffset) Padding;
  4377. }
  4378. switch
  4379. {
  4380. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  4381. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  4382. };
  4383. }
  4384. struct SMBResponseNTCreateAndX
  4385. {
  4386. UINT8 WordCount = MUSTBeSetToTable( this, "0x1A");
  4387. [SMBCommand]
  4388. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  4389. UINT8 AndXReserved;
  4390. [SMBAndXOffset]
  4391. UINT16 ANDXOffset;
  4392. UINT8 OpLockLevel = SMBOplockTable(this);
  4393. [
  4394. SMBFileID,
  4395. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4396. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4397. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  4398. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  4399. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4400. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4401. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  4402. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4403. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4404. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4405. ]
  4406. UINT16 FileID;
  4407. UINT32 CreateDisposition = SMBNTCreateDisposition(this);
  4408. //#? SMB Time Structure
  4409. FILETIME CreationTime;
  4410. FILETIME LastAccessTime;
  4411. FILETIME LastWriteTime;
  4412. FILETIME LastChangeTime;
  4413. SMBNTFileAttributes ExtFileAttributes;
  4414. SMBLargeInteger AllocationSize;
  4415. SMBLargeInteger EndOfFile;
  4416. UINT16 ResourceType = SMBFileTypeTable(this);
  4417. [Local.SMBFileAttributesInfo = 0]
  4418. switch(ResourceType)
  4419. {
  4420. case 1:
  4421. case 2:
  4422. SMBDeviceState DeviceState;
  4423. default:
  4424. UINT16 FileStatus
  4425. {
  4426. UINT16 NoEAs:1 = FormatString(" (%s) File or Directory has %sextended attributes (NO_EAS)", this.ToBitString, this ? "NO ":"");
  4427. UINT16 NoSubstreams:1 = FormatString("(%s) File or Directory has %ssubstreams (NO_SUBSTREAMS)", this.ToBitString, this ? "NO ":"");
  4428. UINT16 NoReparseTag:1 = FormatString("(%s) File or Directory is %sa reparse point (NO_REPARSETAG)", this.ToBitString, this ? "NOT ":"");
  4429. UINT16 Reserved:13 = FormatString(" (%s) Reserved", this.ToBitString);
  4430. };
  4431. }
  4432. BOOLEAN Directory = this ? "This is a directory" : "NOT a directory";
  4433. switch
  4434. {
  4435. case WordCount == 0x2A :
  4436. _struct ExtendedCreateAndx
  4437. {
  4438. GUID(FALSE) VolumeGUID;
  4439. UINT64 FileId;
  4440. SMBAccessMask MaxAccessRights;
  4441. SMBAccessMask GuestMaxAccessRights;
  4442. };
  4443. }
  4444. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4445. switch
  4446. {
  4447. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  4448. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  4449. };
  4450. }
  4451. struct SMBComTreeConnectRequest
  4452. {
  4453. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  4454. UINT16 ByteCount;
  4455. //must be 0x04
  4456. UINT8 BufferFormat1 = SMBBufferStringFormatsTable(this);
  4457. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) Path;
  4458. //must be 0x04
  4459. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  4460. AsciiString Password;
  4461. //must be 0x04
  4462. UINT8 BufferFormat3 = SMBBufferStringFormatsTable(this);
  4463. [conversation.SmbIsNotPipeConv = !this.contains("IPC")]
  4464. AsciiString Service = SMBTreeConnectAndXServiceTable(this);
  4465. }
  4466. struct SMBComTreeConnectResp
  4467. {
  4468. //The value must be 2.
  4469. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  4470. UINT16 MaxBufferSize;
  4471. [conversation.SmbIsNotPipe$[this] = conversation.SmbIsNotPipeConv]
  4472. UINT16 Tid;
  4473. //This value must be 0.
  4474. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4475. }
  4476. struct SmbComTreeConnectAndxClientRequest
  4477. {
  4478. UINT8 WordCount = MUSTBeSetToTable( this, "0x04");
  4479. [SMBCommand]
  4480. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  4481. UINT8 AndXReserved;
  4482. [SMBAndXOffset]
  4483. UINT16 ANDXOffset;
  4484. [DataFieldByteOrder = LittleEndian]
  4485. UINT16 Flags = FormatString("%s Tree connection to Tid, %s security", (TidDisconnected ? "Disconnect" : "Retain"), ((ExSecuritySignatures || ExSecurityResponse) ? "Extended" : "No extended"))
  4486. {
  4487. UINT16 TidDisconnected:1 = FormatString(" (%s) Tree connection to Tid should %s", this.ToBitString, this ? "be disconnected" : "NOT be disconnected" );
  4488. UINT16 Windows9X:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Set by Windows 9x (ignored)" : "Should be Zero" );
  4489. UINT16 ExSecuritySignatures:1 = FormatString("(%s) %s extended security signatures", this.ToBitString, this ? "Requesting" : "NOT requesting" );
  4490. UINT16 ExSecurityResponse:1 = FormatString(" (%s) %s extended security response", this.ToBitString, this ? "Requesting" : "NOT requesting" );
  4491. UINT16 Reserved:15 = FormatString(" (%s) Reserved", this.ToBitString );
  4492. };
  4493. UINT16 PasswordLength;
  4494. UINT16 ByteCount;
  4495. AsciiString( PasswordLength ) Password;
  4496. [Post.SMBComPramSummary = ", Path = " + SMBFileNameValue]
  4497. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) Path;
  4498. [SMBComPramSummary = SMBComPramSummary + ", Service = " + this]
  4499. [conversation.SmbIsNotPipeConv = !this.contains("IPC")]
  4500. AsciiString Service = SMBTreeConnectAndXServiceTable(this);
  4501. switch
  4502. {
  4503. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  4504. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  4505. };
  4506. }
  4507. struct SMBComTreeConnectAndXBeforeLANMAN2Resp
  4508. {
  4509. UINT8 WordCount = MUSTBeSetToTable( this, "0x03");
  4510. [SMBCommand]
  4511. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  4512. UINT8 AndXReserved;
  4513. [SMBAndXOffset]
  4514. UINT16 ANDXOffset;
  4515. UINT16 ByteCount;
  4516. [SMBComPramSummary = ", Service = " + this]
  4517. [conversation.SmbIsNotPipe$[property.SMBTID] = conversation.SmbIsNotPipeConv]
  4518. AsciiString Service = SMBTreeConnectAndXServiceTable(this);
  4519. switch
  4520. {
  4521. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  4522. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  4523. };
  4524. }
  4525. Table SMBCSCTable(value)
  4526. {
  4527. switch (value)
  4528. {
  4529. case 0: "Automatic file-by-file reintegration is NOT allowed on the share (SMB_CSC_CACHE_MANUAL_REINT)";
  4530. case 1: "Automatic file-by-file reintegration is allowed on the share (SMB_CSC_CACHE_AUTO_REINT)";
  4531. case 2: "Autocaching for programs is enabled (SMB_CSC_CACHE_VDO)";
  4532. case 3: "No client-side caching is allowed on the share (SMB_CSC_NO_CACHING)";
  4533. }
  4534. }
  4535. [DataTypeByteOrder = LittleEndian]
  4536. struct SMBOptionalSupport = FormatString("%d (0x%04X)", UINT16(FrameData,Offset),UINT16(FrameData,Offset))
  4537. {
  4538. UINT16 SupportSearchBits:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Search bits supported" : "Search bits NOT supported"), "SMB_SUPPORT_SEARCH_BITS");
  4539. UINT16 ShareIsInDFS:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "DFS share" : "NOT a DFS share") , "SMB_SHARE_IS_IN_DFS");
  4540. UINT16 CacheSupportMask:2 = FormatString(" (%s) %s" , this.ToBitString , SMBCSCTable(this));
  4541. UINT16 UniqueFileName:1 = FormatString(" (%s) %s (%s)" , this.ToBitString , (this ? "Client intends to cache share namespace" : "Client will NOT cache share namespace"), "SMB_UNIQUE_FILE_NAME");
  4542. UINT16 ExtendedSignatures:1 = FormatString("(%s) %s (%s)" , this.ToBitString , (this ? "Extended signatures supported" : "Extended signatures NOT supported") , "SMB_EXTENDED_SIGNATURES");
  4543. UINT16 Reserved_bits6_15:10 = FormatString(" (%s) Reserved" , this.ToBitString);
  4544. }
  4545. struct SMBComTreeConnectAndXAfterLANMAN2Resp
  4546. {
  4547. UINT8 WordCount;//3
  4548. [SMBCommand]
  4549. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  4550. UINT8 AndXReserved;
  4551. [SMBAndXOffset]
  4552. UINT16 ANDXOffset;
  4553. SMBOptionalSupport OptionalSupport;
  4554. UINT16 ByteCount;
  4555. [SMBComPramSummary = ", Service = " + this]
  4556. [conversation.SmbIsNotPipe$[property.SMBTID] = conversation.SmbIsNotPipeConv]
  4557. AsciiString Service = SMBTreeConnectAndXServiceTable(this);
  4558. SMBFileNameString(Property.SMBUnicode, FALSE, 0, ProtocolOffset) NativeFS;
  4559. switch
  4560. {
  4561. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  4562. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  4563. };
  4564. }
  4565. struct SmbComTreeConnectAndxServerResponseExtension
  4566. {
  4567. UINT8 WordCount;//7
  4568. [SMBCommand]
  4569. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  4570. UINT8 AndXReserved;
  4571. [SMBAndXOffset]
  4572. UINT16 ANDXOffset;
  4573. SMBOptionalSupport OptionalSupport;
  4574. SMBAccessMask MaximalShareAccessRights;
  4575. SMBAccessMask GuestMaximalShareAccessRights;
  4576. [Post.SMBBytesEndOffset = frameOffset + 2 + ByteCount]
  4577. UINT16 ByteCount;
  4578. [SMBComPramSummary = ", Service = " + this]
  4579. [conversation.SmbIsNotPipe$[property.SMBTID] = conversation.SmbIsNotPipeConv]
  4580. AsciiString Service = SMBTreeConnectAndXServiceTable(this);
  4581. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) NativeFileSystem = FormatString("%s",SMBFileNameValue? SMBFileNameValue :"For resources that are not backed by a file system, such as the IPC$ share used for named pipes, this field MUST be set to a single null character");
  4582. switch
  4583. {
  4584. case frameOffset < SMBBytesEndOffset &&
  4585. frameOffset < ProtocolOffset + ANDXOffset &&
  4586. frameOffset < frameLength:
  4587. BLOB(SMBBytesEndOffset - frameOffset) ExtraBytePrameter;
  4588. }
  4589. switch
  4590. {
  4591. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  4592. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  4593. };
  4594. }
  4595. struct SMBComOpenRequest
  4596. {
  4597. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  4598. SMBAccessMode AccessMode;
  4599. SMBFileAttributes SearchAttributes;
  4600. UINT16 ByteCount;
  4601. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  4602. switch(SMBUnicode)
  4603. {
  4604. case 0:
  4605. _struct AsciiFileName
  4606. {
  4607. [
  4608. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4609. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4610. Post.BuildConversationWithParent(Property.SMBFileName),
  4611. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4612. SMBComPramSummary = ", FileName = " + this
  4613. ]
  4614. AsciiString FileName;
  4615. }
  4616. case 1:
  4617. _struct UnicodeFileName
  4618. {
  4619. ALIGN2 Align;
  4620. [
  4621. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4622. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4623. Post.BuildConversationWithParent(Property.SMBFileName),
  4624. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4625. SMBComPramSummary = ", FileName = " + this
  4626. ]
  4627. UnicodeString FileName;
  4628. }
  4629. }
  4630. }
  4631. struct SMBComOpenResp
  4632. {
  4633. UINT8 WordCount = MUSTBeSetToTable( this, "0x07");
  4634. [
  4635. SMBFileID,
  4636. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4637. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4638. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  4639. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  4640. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4641. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4642. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  4643. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4644. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4645. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4646. ]
  4647. UINT16 FileID;
  4648. SMBFileAttributes FileAttributes;
  4649. UINT32 LastModified = FormatString("%d sec(s)",this);
  4650. UINT32 FileSize;
  4651. SMBAccessMode AccessMode;
  4652. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4653. }
  4654. struct SMBComCreateRequest
  4655. {
  4656. UINT8 WordCount = MUSTBeSetToTable( this, "0x03");
  4657. SMBFileAttributes FileAttribute;
  4658. //#? Incomplete
  4659. UNIXTIMESTAMP CreationTime;
  4660. UINT16 ByteCount;
  4661. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  4662. switch(SMBUnicode)
  4663. {
  4664. case 0:
  4665. _struct AsciiFileName
  4666. {
  4667. [
  4668. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4669. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4670. Post.BuildConversationWithParent(Property.SMBFileName),
  4671. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4672. SMBComPramSummary = ", FileName = " + this
  4673. ]
  4674. AsciiString FileName;
  4675. }
  4676. case 1:
  4677. _struct UnicodeFileName
  4678. {
  4679. ALIGN2 Align;
  4680. [
  4681. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4682. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4683. Post.BuildConversationWithParent(Property.SMBFileName),
  4684. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4685. SMBComPramSummary = ", FileName = " + this
  4686. ]
  4687. UnicodeString FileName;
  4688. }
  4689. }
  4690. }
  4691. struct SMBComCreateResp
  4692. {
  4693. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  4694. [
  4695. SMBFileID,
  4696. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4697. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4698. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  4699. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  4700. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4701. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4702. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  4703. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4704. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4705. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4706. ]
  4707. UINT16 FileID;
  4708. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4709. }
  4710. struct SMBComQueryInformationRequest
  4711. {
  4712. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  4713. UINT16 ByteCount;
  4714. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  4715. switch(Property.SMBUnicode)
  4716. {
  4717. case 0:
  4718. _struct AsciiFileName
  4719. {
  4720. [
  4721. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4722. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4723. Post.BuildConversationWithParent(Property.SMBFileName),
  4724. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4725. SMBComPramSummary = ", FileName = " + this
  4726. ]
  4727. AsciiString FileName;
  4728. }
  4729. case 1:
  4730. _struct UnicodeFileName
  4731. {
  4732. ALIGN2 Align;
  4733. [
  4734. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4735. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4736. Post.BuildConversationWithParent(Property.SMBFileName),
  4737. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4738. SMBComPramSummary = ", FileName = " + this
  4739. ]
  4740. UnicodeString FileName;
  4741. }
  4742. }
  4743. }
  4744. struct SMBComQueryInformationResp
  4745. {
  4746. [
  4747. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4748. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  4749. Post.SMBComPramSummary = FormatString(", FileName = %s", Property.SMBFileName),
  4750. Post.BuildConversationWithParent(Property.SMBFileName),
  4751. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID)
  4752. ]
  4753. UINT8 WordCount = MUSTBeSetToTable( this, "0x0A");
  4754. SMBFileAttributes FileAttribute;
  4755. UNIXTIMESTAMP LastWriteTime;
  4756. UINT32 FileSize;
  4757. UINT16 Reserved[5];
  4758. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4759. }
  4760. struct SMBComSetInformationRequest
  4761. {
  4762. UINT8 WordCount = MUSTBeSetToTable( this, "0x08");
  4763. SMBFileAttributes FileAttribute;
  4764. //# seconds since 00:00:00 on January 1, 1970 (UTC)
  4765. UINT32 LastWriteTime;
  4766. UINT16 Reserved[5];
  4767. UINT16 ByteCount;
  4768. //# Buffer format is always 4.
  4769. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  4770. switch(SMBUnicode)
  4771. {
  4772. case 0:
  4773. _struct AsciiFileName
  4774. {
  4775. [
  4776. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4777. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4778. Post.BuildConversationWithParent(Property.SMBFileName),
  4779. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4780. SMBComPramSummary = ", FileName = " + this
  4781. ]
  4782. AsciiString FileName;
  4783. }
  4784. case 1:
  4785. _struct UnicodeFileName
  4786. {
  4787. ALIGN2 Align;
  4788. [
  4789. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4790. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4791. Post.BuildConversationWithParent(Property.SMBFileName),
  4792. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  4793. SMBComPramSummary = ", FileName = " + this
  4794. ]
  4795. UnicodeString FileName;
  4796. }
  4797. }
  4798. }
  4799. struct SMBComSetInformationResp
  4800. {
  4801. [
  4802. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4803. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  4804. Post.SMBComPramSummary = FormatString(", FileName = %s", Property.SMBFileName),
  4805. Post.BuildConversationWithParent(Property.SMBFileName),
  4806. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID)
  4807. ]
  4808. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  4809. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4810. }
  4811. struct SMBComReadRequest
  4812. {
  4813. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  4814. [
  4815. SMBFileID,
  4816. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4817. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4818. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4819. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4820. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4821. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4822. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4823. ]
  4824. UINT16 FileID;
  4825. UINT16 CountOfBytesToRead;
  4826. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes at Offset %u", CountOfBytesToRead, ReadOffsetInBytes)]
  4827. [conversation.SmbFileOffsetConv]
  4828. UINT32 ReadOffsetInBytes;
  4829. UINT16 EstimateOfRemainingBytesToBeRead;
  4830. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4831. }
  4832. struct SMBComReadResp
  4833. {
  4834. [
  4835. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4836. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4837. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4838. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4839. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4840. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4841. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4842. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4843. ]
  4844. [conversation.SmbFileOffsetMVS$[Framenumber] = conversation.SmbFileOffsetConv]
  4845. [property.SMBFileOffset = conversation.SmbFileOffsetMVS$[Framenumber]]
  4846. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  4847. [SMBComPramSummary = SMBComPramSummary + FormatString(", %d bytes", CountOfBytesReturned)]
  4848. UINT16 CountOfBytesReturned;
  4849. BLOB(8) Reserved;
  4850. UINT16 ByteCount;
  4851. //always be 1 "data blob"
  4852. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  4853. [property.SmbFileFragmentLen]
  4854. UINT16 CountOfBytesRead;
  4855. [Local.SMBFileNameRemain = Property.SMBFileName]
  4856. [MaxLoopCount = 200]
  4857. while [Local.SMBFileNameRemain.ContainsBin(2, "5C")]
  4858. {
  4859. [Local.SMBFileNameRemain = UnicodeString(Local.SMBFileNameRemain, 2)]
  4860. struct{};
  4861. }
  4862. switch
  4863. {
  4864. case contains(Property.SMBFileName, "\\ci_skads"):
  4865. CIS CIS;
  4866. case Local.SMBFileNameRemain.containsBin(2, "2E")://It's not pipe data when include "." in the file name
  4867. switch
  4868. {
  4869. case conversation.Parent.SmbIsNotPipe$[property.SMBTID] || IsValueNone(conversation.Parent.SmbIsNotPipe$[property.SMBTID]):
  4870. [
  4871. PayloadStart(
  4872. NetworkDirection, /* direction */
  4873. 0, /* id */
  4874. property.SMBFileOffset, /* sequence token */
  4875. property.SMBFileOffset + property.SmbFileFragmentLen, /* next sequence token */
  4876. 0, /* total payload length */
  4877. Property.IsMoreThanOneSMBOverTcp ? 1 : property.SMBFileOffset == 0, /* is first */
  4878. Property.IsMoreThanOneSMBOverTcp ? 1 : 0, /* is last */
  4879. RssmblyIndStartBit + RssmblyIndEndBit + RssmblySequenceBit,
  4880. 0x0000,
  4881. 0,
  4882. 0x0000,
  4883. Property.SMBFileName
  4884. )
  4885. ]
  4886. [DataFieldFrameLength = FrameOffset + property.SmbFileFragmentLen]
  4887. switch
  4888. {
  4889. case property.SMBFileOffset == 0:
  4890. FileTypeContent FileTypeContent;
  4891. default:
  4892. blob(FrameLength - FrameOffset) ContinualData;
  4893. }
  4894. default:
  4895. BLOB(Property.SmbFileFragmentLen) Payload;
  4896. }
  4897. default:
  4898. BLOB(Property.SmbFileFragmentLen) PipePayload;
  4899. }
  4900. }
  4901. struct SMBComWriteRequest
  4902. {
  4903. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  4904. [
  4905. SMBFileID,
  4906. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4907. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4908. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4909. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4910. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4911. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4912. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4913. ]
  4914. UINT16 FileID;
  4915. UINT16 CountOfBytesToWrite;
  4916. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes at Offset %u", CountOfBytesToWrite, WriteOffsetInBytes)]
  4917. UINT32 WriteOffsetInBytes;
  4918. UINT16 EstimateOfRemainingBytesToBeWritten;
  4919. UINT16 ByteCount;
  4920. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  4921. UINT16 DataLength;
  4922. switch
  4923. {
  4924. case DataLength > 0:
  4925. BLOB(DataLength) Data;
  4926. }
  4927. }
  4928. struct SMBComWriteResp
  4929. {
  4930. [
  4931. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4932. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4933. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4934. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4935. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4936. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4937. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4938. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4939. ]
  4940. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  4941. [SMBComPramSummary = SMBComPramSummary + FormatString(", %d bytes", CountOfBytesWritten)]
  4942. UINT16 CountOfBytesWritten;
  4943. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4944. }
  4945. struct SMBComLockByteRangeRequest
  4946. {
  4947. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  4948. [
  4949. SMBFileID,
  4950. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4951. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4952. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4953. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4954. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4955. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4956. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4957. ]
  4958. UINT16 FileID;
  4959. //#? Reversed
  4960. UINT32 CountOfBytesToLock;
  4961. //#? Reversed
  4962. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes at Offset %u", CountOfBytesToLock, LockOffsetInBytes)]
  4963. UINT32 LockOffsetInBytes;
  4964. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4965. //#maybe NOT finished
  4966. }
  4967. struct SMBComLockByteRangeResp
  4968. {
  4969. [
  4970. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  4971. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  4972. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  4973. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  4974. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  4975. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  4976. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  4977. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  4978. ]
  4979. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  4980. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  4981. }
  4982. struct SMBComCreateNewRequest
  4983. {
  4984. UINT8 WordCount = MUSTBeSetToTable( this, "0x03");
  4985. //#? Incomplete
  4986. SMBFileAttributes FileAttribute;
  4987. //#? Incomplete
  4988. UNIXTIMESTAMP FileCreationTime;
  4989. UINT16 ByteCount;
  4990. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  4991. switch(SMBUnicode)
  4992. {
  4993. case 0:
  4994. _struct AsciiFileName
  4995. {
  4996. [
  4997. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  4998. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  4999. Post.BuildConversationWithParent(Property.SMBFileName),
  5000. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  5001. SMBComPramSummary = ", FileName = " + this
  5002. ]
  5003. AsciiString FileName;
  5004. }
  5005. case 1:
  5006. _struct UnicodeFileName
  5007. {
  5008. ALIGN2 Align;
  5009. [
  5010. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  5011. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  5012. Post.BuildConversationWithParent(Property.SMBFileName),
  5013. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  5014. SMBComPramSummary = ", FileName = " + this
  5015. ]
  5016. UnicodeString FileName;
  5017. }
  5018. }
  5019. }
  5020. struct SMBComCreateNewResp
  5021. {
  5022. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5023. [
  5024. SMBFileID,
  5025. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5026. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5027. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  5028. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  5029. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5030. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5031. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  5032. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5033. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5034. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5035. ]
  5036. UINT16 FileID;
  5037. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5038. }
  5039. struct SMBComProcessExitRequest
  5040. {
  5041. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5042. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5043. }
  5044. struct SMBComProcessExitResp
  5045. {
  5046. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5047. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5048. }
  5049. struct SMBComQueryInformationDiskRequest
  5050. {
  5051. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5052. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5053. }
  5054. struct SMBComQueryInformationDiskResp
  5055. {
  5056. UINT8 WordCount = MUSTBeSetToTable( this, "0x05");
  5057. UINT16 TotalUnits;
  5058. UINT16 BlocksPerUnit;
  5059. UINT16 BlockSize;
  5060. UINT16 FreeUnits;
  5061. UINT16 Reserved;
  5062. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5063. }
  5064. //# SMBPUB.DOC page 43 SEARCH: Search Directory
  5065. struct SMBComSearchRequest
  5066. {
  5067. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  5068. UINT16 MaxCount;
  5069. //#? Incomplete
  5070. SMBFileAttributes SearchAttribute;
  5071. UINT16 ByteCount;
  5072. //0x04 -- ASCII
  5073. UINT8 BufferFormat1 = SMBBufferStringFormatsTable(this);
  5074. [Post.SMBComPramSummary = ", Filename = " + SMBFileNameValue]
  5075. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  5076. //0x05 -- Variable block
  5077. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  5078. UINT16 ResumeKeyLength;
  5079. switch
  5080. {
  5081. case ResumeKeyLength > 0:
  5082. SMBResumeKey ResumeKey;
  5083. }
  5084. }
  5085. //# SMBPUB.DOC page 43 SEARCH: Search Directory
  5086. struct SMBComSearchResp
  5087. {
  5088. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5089. [Post.SMBComPramSummary = FormatString(", FindCount = %d", FindCount)]
  5090. UINT16 FindCount;
  5091. UINT16 ByteCount;
  5092. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5093. UINT16 DataLength;
  5094. while[FrameOffset < FrameLength]
  5095. {
  5096. SMBDirectoryInformation DirectoryInformation;
  5097. }
  5098. }
  5099. struct SMBComOpenPrintFileRequest
  5100. {
  5101. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  5102. UINT16 SetupLength;
  5103. UINT16 Mode = SMBPrintFileMode(this);
  5104. UINT16 ByteCount;
  5105. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5106. switch(SMBUnicode)
  5107. {
  5108. case 0:
  5109. _struct AsciiIDstring
  5110. {
  5111. [
  5112. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  5113. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  5114. Post.BuildConversationWithParent(Property.SMBFileName),
  5115. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  5116. SMBComPramSummary = ", FileName = " + this
  5117. ]
  5118. AsciiString IdentifierString;
  5119. }
  5120. case 1:
  5121. _struct UnicodeIDstring
  5122. {
  5123. ALIGN2 Align;
  5124. [
  5125. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  5126. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  5127. Post.BuildConversationWithParent(Property.SMBFileName),
  5128. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  5129. SMBComPramSummary = ", FileName = " + this
  5130. ]
  5131. UnicodeString IdentifierString;
  5132. }
  5133. }
  5134. }
  5135. struct SMBComOpenPrintFileResp
  5136. {
  5137. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5138. [
  5139. SMBFileID,
  5140. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5141. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5142. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  5143. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  5144. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5145. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5146. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  5147. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5148. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5149. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5150. ]
  5151. UINT16 FileID;
  5152. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5153. }
  5154. struct SMBComWriteRequestPrintFileRequest
  5155. {
  5156. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5157. [
  5158. SMBFileID,
  5159. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5160. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5161. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5162. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5163. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5164. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5165. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5166. ]
  5167. UINT16 FileID;
  5168. UINT16 ByteCount;
  5169. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5170. UINT16 DataLength;
  5171. BLOB(DataLength > FrameLength - FrameOffset ? FrameLength - FrameOffset : DataLength) FileData;
  5172. }
  5173. struct SMBComWritePrintFileResp
  5174. {
  5175. [
  5176. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5177. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5178. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5179. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5180. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5181. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5182. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5183. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5184. ]
  5185. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5186. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5187. }
  5188. struct SMBComClosePrintFileRequest
  5189. {
  5190. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5191. [
  5192. SMBFileID,
  5193. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5194. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5195. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5196. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5197. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5198. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5199. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5200. ]
  5201. UINT16 FileID;
  5202. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5203. }
  5204. struct SMBComClosePrintFileResp
  5205. {
  5206. [
  5207. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5208. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5209. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5210. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5211. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5212. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount), Disconnected),
  5213. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5214. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5215. ]
  5216. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5217. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5218. }
  5219. struct SMBComGetPrintQueueRequest
  5220. {
  5221. UINT8 WordCount;
  5222. UINT16 MaxCount;
  5223. UINT16 StartIndex;
  5224. UINT16 ByteCount;
  5225. }
  5226. struct SMBComGetPrintQueueResp
  5227. {
  5228. UINT8 WordCount;
  5229. UINT16 Count;
  5230. UINT16 RestartIndex;
  5231. UINT16 ByteCount;
  5232. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5233. [PrintQueueInfoEndOffset = FrameOffset + DataLength]
  5234. UINT16 DataLength;
  5235. while PrintQueueEntries[FrameOffset < PrintQueueInfoEndOffset]
  5236. {
  5237. struct PrintQueueInfo = this.SpoolFileName.ToString
  5238. {
  5239. SMBDATE PrintQueueDate;
  5240. SMBTIME PrintQueueTime;
  5241. UINT8 Status = SMBPrintJobStatusTable(this);
  5242. UINT16 SpoolFileNumber;
  5243. UINT32 SpoolFileSize;
  5244. UINT8 Reserved;
  5245. //UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5246. SMBFileNameString(SMBUnicode, TRUE, 16, ProtocolOffset) SpoolFileName;
  5247. }
  5248. }
  5249. switch
  5250. {
  5251. case FrameOffset < PrintQueueInfoEndOffset:
  5252. BLOB(PrintQueueInfoEndOffset - FrameOffset) LeftData;
  5253. }
  5254. }
  5255. struct SMBComSendSingleMessageRequest
  5256. {
  5257. UINT8 WordCount;
  5258. UINT16 ByteCount;
  5259. UINT8 BufferFormat1 = SMBBufferStringFormatsTable(this);
  5260. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) OriginatorName;
  5261. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  5262. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) DestinationName;
  5263. UINT8 BufferFormat3 = SMBBufferStringFormatsTable(this);
  5264. UINT16 DataLength;
  5265. AsciiString(DataLength) Message;
  5266. }
  5267. struct SMBComSendSingleMessageResp
  5268. {
  5269. UINT8 WordCount;
  5270. UINT16 ByteCount;
  5271. //UINT8 Buffer;
  5272. }
  5273. // This message is broadcast and there is no response to this message.
  5274. struct SMBComSendBroadcastMessageRequest
  5275. {
  5276. UINT8 WordCount;
  5277. UINT16 ByteCount;
  5278. UINT8 BufferFormat1 = SMBBufferStringFormatsTable(this);
  5279. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) OriginatorName;
  5280. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  5281. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) DestinationName;
  5282. UINT8 BufferFormat3 = SMBBufferStringFormatsTable(this);
  5283. UINT16 DataLength;
  5284. AsciiString(DataLength) Message;
  5285. }
  5286. struct SMBComForwardUserNameRequest
  5287. {
  5288. UINT8 WordCount;
  5289. UINT16 ByteCount;
  5290. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5291. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) ForwardedName;
  5292. }
  5293. struct SMBComForwardUserNameResp
  5294. {
  5295. UINT8 WordCount;
  5296. UINT16 ByteCount;
  5297. UINT8 Buffer;
  5298. }
  5299. struct SMBComCancelForwardRequest
  5300. {
  5301. UINT8 WordCount;
  5302. UINT16 ByteCount;
  5303. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5304. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) ForwardedName;
  5305. }
  5306. struct SMBComCancelForwardResp
  5307. {
  5308. UINT8 WordCount;
  5309. UINT16 ByteCount;
  5310. UINT8 Buffer;
  5311. }
  5312. struct SMBComGetMachineNameRequest
  5313. {
  5314. UINT8 WordCount;
  5315. UINT16 ByteCount;
  5316. UINT8 Buffer;
  5317. }
  5318. struct SMBComGetMachineNameResp
  5319. {
  5320. UINT8 WordCount;
  5321. UINT16 ByteCount;
  5322. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5323. [Post.SMBComPramSummary = ", MachineName = " + SMBFileNameValue]
  5324. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) MachineName;
  5325. }
  5326. struct SMBComSendStartOfMultiBlockMessageRequest
  5327. {
  5328. UINT8 WordCount;
  5329. UINT16 ByteCount;
  5330. UINT8 BufferFormat1 = SMBBufferStringFormatsTable(this);
  5331. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) OriginatorName;
  5332. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  5333. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) DestinationName;
  5334. }
  5335. struct SMBComSendStartOfMultiBlockMessageResp
  5336. {
  5337. UINT8 WordCount;
  5338. UINT16 MessageGroupId;
  5339. UINT16 ByteCount;
  5340. //UINT8 Buffer;
  5341. }
  5342. struct SMBComSendEndOfMultiBlockMessageRequest
  5343. {
  5344. UINT8 WordCount;
  5345. UINT16 MessageGroupId;
  5346. UINT16 ByteCount;
  5347. //UINT8 Buffer;
  5348. }
  5349. struct SMBComSendEndOfMultiBlockMessageResp
  5350. {
  5351. UINT8 WordCount;
  5352. UINT16 ByteCount;
  5353. //UINT8 Buffer;
  5354. }
  5355. struct SMBComSendTextOfMultiBlockMessageRequest
  5356. {
  5357. UINT8 WordCount;
  5358. UINT16 MessageGroupId;
  5359. UINT16 ByteCount;
  5360. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5361. UINT16 DataLength;
  5362. AsciiString(DataLength) Message;
  5363. }
  5364. struct SMBComSendTextOfMultiBlockMessageResp
  5365. {
  5366. UINT8 WordCount;
  5367. UINT16 ByteCount;
  5368. //UINT8 Buffer;
  5369. }
  5370. struct SMBComDeleteDirectoryRequest
  5371. {
  5372. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5373. UINT16 ByteCount;
  5374. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5375. [Post.SMBComPramSummary = ", Dir = " + SMBFileNameValue]
  5376. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) DirectoryName;
  5377. }
  5378. struct SMBComDeleteDirectoryResp
  5379. {
  5380. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5381. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5382. }
  5383. struct SMBComCloseRequest
  5384. {
  5385. UINT8 WordCount = MUSTBeSetToTable( this, "0x03");
  5386. [
  5387. SMBFileID,
  5388. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5389. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5390. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5391. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5392. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5393. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5394. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " , FileName=" + Property.SMBFileName + " " : "")
  5395. ]
  5396. UINT16 FileID;
  5397. UINT32 LastTimeModified;
  5398. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5399. }
  5400. struct SMBComCloseResp
  5401. {
  5402. [
  5403. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5404. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5405. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5406. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5407. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5408. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount), Disconnected),
  5409. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5410. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " , FileName=" + Property.SMBFileName + " " : "")
  5411. ]
  5412. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5413. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5414. }
  5415. struct SMBComFlushRequest
  5416. {
  5417. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5418. [
  5419. SMBFileID,
  5420. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5421. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5422. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5423. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5424. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5425. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5426. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5427. ]
  5428. UINT16 FileID;
  5429. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5430. }
  5431. struct SMBComFlushResp
  5432. {
  5433. [
  5434. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5435. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5436. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5437. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5438. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5439. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5440. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5441. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5442. ]
  5443. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5444. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5445. }
  5446. struct SMBComDeleteRequest
  5447. {
  5448. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5449. SMBFileAttributes SearchAttribute;
  5450. UINT16 ByteCount;
  5451. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5452. [Post.SMBComPramSummary = ", File = " + SMBFileNameValue]
  5453. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  5454. }
  5455. struct SMBComDeleteResp
  5456. {
  5457. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5458. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5459. }
  5460. struct SMBComRenameRequest
  5461. {
  5462. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5463. SMBFileAttributes SearchAttributes;
  5464. UINT16 ByteCount;
  5465. //BLOB( ByteCount ) ByteParamenters;
  5466. //Buffer format contains value 0x04.
  5467. UINT8 BufferFormat1 = SMBBufferStringFormatsTable(this);
  5468. [Post.SMBComPramSummary = ", " + SMBFileNameValue]
  5469. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) OldFileName;
  5470. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  5471. [Post.SMBComPramSummary = SMBComPramSummary + " To " + SMBFileNameValue]
  5472. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) NewFileName;
  5473. }
  5474. struct SMBComRenameResp
  5475. {
  5476. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5477. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5478. }
  5479. struct SMBComCreateTemporaryRequest
  5480. {
  5481. UINT8 WordCount = MUSTBeSetToTable( this, "0x03");
  5482. SMBFileAttributes SearchAttributes;
  5483. UNIXTIMESTAMP CreationTime;
  5484. UINT16 ByteCount;
  5485. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5486. switch(SMBUnicode)
  5487. {
  5488. case 0:
  5489. _struct AsciiFileName
  5490. {
  5491. [
  5492. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  5493. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  5494. Post.BuildConversationWithParent(Property.SMBFileName),
  5495. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  5496. SMBComPramSummary = ", Dir = " + this
  5497. ]
  5498. AsciiString DirectoryName;
  5499. }
  5500. case 1:
  5501. _struct UnicodeFileName
  5502. {
  5503. ALIGN2 Align;
  5504. [
  5505. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  5506. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  5507. Post.BuildConversationWithParent(Property.SMBFileName),
  5508. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  5509. SMBComPramSummary = ", Dir = " + this
  5510. ]
  5511. UnicodeString DirectoryName;
  5512. }
  5513. }
  5514. }
  5515. struct SMBComCreateTemporaryResp
  5516. {
  5517. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  5518. [
  5519. SMBFileID,
  5520. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5521. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5522. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  5523. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  5524. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5525. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5526. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  5527. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5528. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5529. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5530. ]
  5531. UINT16 FileID;
  5532. UINT16 ByteCount;
  5533. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5534. [Post.SMBComPramSummary = ", File = " + SMBFileNameValue]
  5535. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  5536. }
  5537. struct SMBComCheckDirectoryRequest
  5538. {
  5539. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5540. UINT16 ByteCount;
  5541. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  5542. [Post.SMBComPramSummary = ", Dir = " + SMBFileNameValue]
  5543. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) DirectoryName;
  5544. }
  5545. struct SMBComCheckDirectoryResp
  5546. {
  5547. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  5548. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5549. }
  5550. Table SMBFileSeekModeTable(mode)
  5551. {
  5552. switch(mode)
  5553. {
  5554. case 0: FormatString("From Start Of File, %d(0x%X)", mode, mode);
  5555. case 1: FormatString("From Current Position, %d(0x%X)", mode, mode);
  5556. case 2: FormatString("From End Of File, %d(0x%X)", mode, mode);
  5557. default: FormatString("Unknown seek mode %d(0x%X)", mode, mode);
  5558. }
  5559. }
  5560. struct SMBComSeekRequest
  5561. {
  5562. UINT8 WordCount = MUSTBeSetToTable( this, "0x04");
  5563. [
  5564. SMBFileID,
  5565. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5566. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5567. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5568. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5569. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5570. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5571. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5572. ]
  5573. UINT16 FileID;
  5574. UINT16 SeekMode = SMBFileSeekModeTable(this);
  5575. UINT32 Offset;
  5576. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5577. };
  5578. struct SMBComSeekResp
  5579. {
  5580. [
  5581. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5582. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5583. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5584. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5585. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5586. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5587. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5588. SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5589. ]
  5590. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  5591. UINT32 Offset;
  5592. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5593. }
  5594. struct SMBLockRange = FormatString("PID: %u, %s at Offset %u of Length %u", Pid, SMBIsLock?"Lock":"Unlock", FileOffset, Length)
  5595. {
  5596. UINT16 Pid;
  5597. UINT32 FileOffset;
  5598. UINT32 Length;
  5599. }
  5600. struct SMBLargeLockRange = FormatString("PID: %u, %s at Offset %s of Length %s",
  5601. Pid,
  5602. SMBIsLock?"Lock":"Unlock",
  5603. SMBFormatNumber("%u", SMBIsLargeLockOffset, SMBLockOffset),
  5604. SMBFormatNumber("%u", SMBIsLargeLength, SMBLockLength))
  5605. {
  5606. UINT16 Pid;
  5607. UINT16 Padding;
  5608. [SMBIsLargeLockOffset = this <> 0xFFFFFFFF && this > 0]
  5609. UINT32 OffsetHigh;
  5610. [SMBLockOffset = (OffsetHigh <> 0xFFFFFFFF) ? (OffsetLow + OffsetHigh * 4294967296) : OffsetLow]
  5611. UINT32 OffsetLow;
  5612. [SMBIsLargeLength = this <> 0xFFFFFFFF && this > 0]
  5613. UINT32 LengthHigh;
  5614. [SMBLockLength = (OffsetHigh <> 0xFFFFFFFF) ? (LengthLow + LengthHigh * 4294967296) : LengthLow]
  5615. UINT32 LengthLow;
  5616. }
  5617. Table SMBLockingAndXTimeout(timeout)
  5618. {
  5619. switch(timeout)
  5620. {
  5621. case 0x00000000: "Fail if a specified byte range is already locked";
  5622. case 0xFFFFFFFF: "Wait for each byte range become unlocked";
  5623. default: FormatString("Maximum wait for %d Milliseconds",timeout);
  5624. }
  5625. }
  5626. Table SMBNewFileLockingLevelTable(value)
  5627. {
  5628. switch(value)
  5629. {
  5630. case 0: "The client will not own an Oplock";
  5631. case 1: "The client will own a Level II Oplock";
  5632. default: "Unknown Level";
  5633. }
  5634. }
  5635. struct SMBComLockingAndXRequest
  5636. {
  5637. UINT8 WordCount = MUSTBeSetToTable( this, "0x08");
  5638. [SMBCommand]
  5639. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  5640. UINT8 AndXReserved;
  5641. [SMBAndXOffset]
  5642. UINT16 ANDXOffset;
  5643. [
  5644. SMBFileID,
  5645. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5646. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5647. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5648. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5649. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5650. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5651. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5652. ]
  5653. UINT16 FileID;
  5654. [DataFieldByteOrder = LittleEndian]
  5655. UINT8 TypeOfLock
  5656. {
  5657. UINT8 Shared:1 = FormatString(" (%s) %s lock", this.ToBitString, this ? "Read-only" : "Exclusive");
  5658. UINT8 OpLock:1 = FormatString(" (%s) %s of dynamic lock break", this.ToBitString, this ? "Notification" : "No notification");
  5659. UINT8 Change:1 = FormatString(" (%s) %s lock type", this.ToBitString, this ? "Change" : "Do NOT change");
  5660. UINT8 Cancel:1 = FormatString(" (%s) %s outstanding lock request", this.ToBitString, this ? "Cancel" : "Do NOT cancel");
  5661. UINT8 LargeFile:1 = FormatString("(%s) Large file Locking format %s", this.ToBitString, this ? "requested" : "NOT requested");
  5662. UINT8 Reserved:3 = FormatString(" (%s) Reserved", this.ToBitString);
  5663. };
  5664. UINT8 NewOpLockLevel = SMBNewFileLockingLevelTable(this);
  5665. UINT32 TimeOut = SMBLockingAndXTimeout(this);
  5666. UINT16 NumberOfRequestedUnlocks;
  5667. UINT16 NumberOfRequestedLocks;
  5668. UINT16 ByteCount;
  5669. [SMBIsLock = FALSE]
  5670. switch
  5671. {
  5672. case TypeOfLock.LargeFile:
  5673. SMBLargeLockRange LargeUnlock[NumberOfRequestedUnlocks];
  5674. default:
  5675. SMBLockRange Unlock[NumberOfRequestedUnlocks];
  5676. }
  5677. [SMBIsLock = TRUE]
  5678. switch
  5679. {
  5680. case TypeOfLock.LargeFile:
  5681. SMBLargeLockRange LargeLock[NumberOfRequestedLocks];
  5682. default:
  5683. SMBLockRange Lock[NumberOfRequestedLocks];
  5684. }
  5685. switch
  5686. {
  5687. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  5688. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  5689. };
  5690. }
  5691. struct SMBComLockingAndXResp
  5692. {
  5693. [
  5694. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5695. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5696. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5697. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5698. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5699. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5700. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5701. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5702. ]
  5703. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  5704. [SMBCommand]
  5705. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  5706. UINT8 AndXReserved;
  5707. [SMBAndXOffset]
  5708. UINT16 ANDXOffset;
  5709. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  5710. switch
  5711. {
  5712. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  5713. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  5714. };
  5715. }
  5716. struct SMBComIOCTLPrimaryRequest
  5717. {
  5718. UINT8 WordCount = MUSTBeSetToTable( this, "0x0E");
  5719. [
  5720. SMBFileID,
  5721. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5722. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5723. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5724. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5725. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5726. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5727. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5728. ]
  5729. UINT16 FileID;
  5730. UINT16 Category;
  5731. UINT16 Function;
  5732. UINT16 TotalParameterCount;
  5733. UINT16 TotalDataCount;
  5734. UINT16 MaxParameterCount;
  5735. UINT16 MaxDataCount;
  5736. UINT32 TimeOut = FormatString("%d milli sec(s)",this);
  5737. UINT16 Reserved;
  5738. UINT16 ParameterCount;
  5739. UINT16 ParameterOffset;
  5740. UINT16 DataCount;
  5741. UINT16 DataOffset;
  5742. UINT16 ByteCount;
  5743. switch
  5744. {
  5745. case CurrentProtocolOffset < ParameterOffset:
  5746. BLOB(ParameterOffset - CurrentProtocolOffset) Pad1;
  5747. }
  5748. switch
  5749. {
  5750. case ParameterCount > 0:
  5751. BLOB(ParameterCount) Parameters;
  5752. }
  5753. switch
  5754. {
  5755. case CurrentProtocolOffset < DataOffset:
  5756. BLOB(DataOffset - CurrentProtocolOffset) Pad2;
  5757. }
  5758. switch
  5759. {
  5760. case DataCount > 0:
  5761. BLOB(DataCount) Data;
  5762. }
  5763. }
  5764. struct SMBComIOCTLSecondaryRequest
  5765. {
  5766. [
  5767. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5768. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5769. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5770. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5771. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5772. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5773. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5774. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5775. ]
  5776. UINT8 WordCount;
  5777. UINT16 TotalParameterCount;
  5778. UINT16 TotalDataCount;
  5779. UINT16 ParameterCount;
  5780. UINT16 ParameterOffset;
  5781. UINT16 ParameterDisplacement;
  5782. UINT16 DataCount;
  5783. UINT16 DataOffset;
  5784. UINT16 DataDisplacement;
  5785. UINT16 ByteCount;
  5786. BLOB(ByteCount) Buffer;
  5787. }
  5788. [Property.SMBInterimResponse = true]
  5789. struct SMBComInterimResponseIOCTL
  5790. {
  5791. [
  5792. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5793. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5794. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5795. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5796. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5797. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5798. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5799. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5800. ]
  5801. UINT8 WordCount;
  5802. UINT16 ByteCount;
  5803. }
  5804. struct SMBComIOCTLResp
  5805. {
  5806. [
  5807. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  5808. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  5809. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  5810. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  5811. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  5812. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  5813. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  5814. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  5815. ]
  5816. UINT8 WordCount = MUSTBeSetToTable( this, "0x08");
  5817. UINT16 TotalParameterCount;
  5818. UINT16 TotalDataCount;
  5819. UINT16 ParameterCount;
  5820. UINT16 ParameterOffset;
  5821. UINT16 ParameterDisplacement = ShouldBeSetToTable( this, "0x0000");
  5822. UINT16 DataCount;
  5823. UINT16 DataOffset;
  5824. UINT16 DataDisplacement = ShouldBeSetToTable( this, "0x0000");
  5825. UINT16 ByteCount;
  5826. switch
  5827. {
  5828. case CurrentProtocolOffset < ParameterOffset:
  5829. BLOB(ParameterOffset - CurrentProtocolOffset) Pad1;
  5830. }
  5831. switch
  5832. {
  5833. case ParameterCount > 0:
  5834. BLOB(ParameterCount) Parameters;
  5835. }
  5836. switch
  5837. {
  5838. case CurrentProtocolOffset < DataOffset:
  5839. BLOB(DataOffset - CurrentProtocolOffset) Pad2;
  5840. }
  5841. switch
  5842. {
  5843. case DataCount > 0:
  5844. BLOB(DataCount) Data;
  5845. }
  5846. }
  5847. struct SMBComCopyRequest
  5848. {
  5849. UINT8 WordCount ;
  5850. UINT16 Tid2;
  5851. SMBOpenFunction OpenFunction;
  5852. [DataFieldByteOrder = LittleEndian]
  5853. UINT16 Flags
  5854. {
  5855. UINT16 TargetFile:1 = FormatString(" (%s) Target %s be a file", this.ToBitString, this ? "must" : "is NOT required to be");
  5856. UINT16 TargetDirectory:1 = FormatString(" (%s) Target %s be a directory", this.ToBitString, this ? "must" : "is NOT required to be");
  5857. UINT16 TargetMode:1 = FormatString(" (%s) %s copy target mode", this.ToBitString, this ? "ASCII" : "Binary");
  5858. UINT16 SourceMode:1 = FormatString(" (%s) %s copy source mode", this.ToBitString, this ? "ASCII" : "Binary");
  5859. UINT16 WriteOptVerification:1 = FormatString("(%s) %s write operations", this.ToBitString, this ? "Verify" : "Do NOT verify");
  5860. UINT16 TreeCopy:1 = FormatString(" (%s) %s copy", this.ToBitString, this ? "Tree" : "NOT a tree");
  5861. UINT16 Reserved_bits6_15:10 = FormatString(" (%s) Reserved", this.ToBitString);
  5862. };
  5863. UINT16 ByteCount;
  5864. //UINT8 SourceFileNameFormat = SMBBufferStringFormatsTable(this);
  5865. [Post.SMBComPramSummary = ", " + SMBFileNameValue]
  5866. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) SourceFileName;
  5867. // skipping Null to end the SMB frame
  5868. while [!UINT8( Framedata, Offset )]
  5869. {
  5870. UINT8 skip_NULL;
  5871. };
  5872. //UINT8 TargetFileNameFormat = SMBBufferStringFormatsTable(this);
  5873. [Post.SMBComPramSummary = SMBComPramSummary + " To " + SMBFileNameValue]
  5874. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) TargetFileName;
  5875. }
  5876. struct SMBComCopyResp
  5877. {
  5878. UINT8 WordCount;
  5879. UINT16 Count;
  5880. UINT16 ByteCount;
  5881. // These fields exist only when an error has occurred
  5882. switch
  5883. {
  5884. case ByteCount > 0:
  5885. switch(WordCount)
  5886. {
  5887. case 0: // Window implement different from CIFS
  5888. [Post.SMBComPramSummary = SMBComPramSummary + ", ErrorFile = " + ErrorFileName]
  5889. UnicodeString ErrorFileName;
  5890. case 1:
  5891. _struct ErrorFile
  5892. {
  5893. UINT8 ErrorFileFormat = SMBBufferStringFormatsTable(this);
  5894. [Post.SMBComPramSummary = SMBComPramSummary + ", ErrorFile = " + SMBFileNameValue]
  5895. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) ErrorFileName;
  5896. }
  5897. }
  5898. }
  5899. }
  5900. Table SMBMoveOpenFunctionTable(value)
  5901. {
  5902. switch
  5903. {
  5904. case (value & 0x30) == 0x00: "Operation failure";
  5905. case (value & 0x30) == 0x20: "Overwrite target file";
  5906. default: "Undefined";
  5907. }
  5908. }
  5909. struct SMBComMoveRequest
  5910. {
  5911. UINT8 WordCount;
  5912. UINT16 Tid2;
  5913. UINT16 OpenFunction = FormatString("%s, %d(%#x)", SMBMoveOpenFunctionTable(this), this, this);
  5914. [DataFieldByteOrder = LittleEndian]
  5915. UINT16 Flags
  5916. {
  5917. UINT16 TargetFile:1 = FormatString(" (%s) Target %s be a file", this.ToBitString, this ? "must" : "is NOT required to be");
  5918. UINT16 TargetDirectory:1 = FormatString(" (%s) Target %s be a directory", this.ToBitString, this ? "must" : "is NOT required to be");
  5919. UINT16 Reserved_bits2_3:2 = FormatString(" (%s) Reserved", this.ToBitString);
  5920. UINT16 WriteOptVerification:1 = FormatString("(%s) %s write operations", this.ToBitString, this ? "Verify" : "Do NOT verify");
  5921. UINT16 Reserved_bits5_15:11 = FormatString(" (%s) Reserved", this.ToBitString);
  5922. };
  5923. UINT16 ByteCount;
  5924. // reference CIFS-TR-1p00-FINAL.pdf , page 92
  5925. //UINT8 FormatOld;
  5926. [Post.SMBComPramSummary = ", " + SMBFileNameValue]
  5927. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) OldFilename;
  5928. // skipping Null to end the SMB frame
  5929. while [ !UINT8( Framedata, Offset )]
  5930. {
  5931. UINT8 skip_NULL;
  5932. };
  5933. // reference CIFS-TR-1p00-FINAL.pdf , page 92
  5934. //UINT8 FormatNew;
  5935. [Post.SMBComPramSummary = SMBComPramSummary + " To " + SMBFileNameValue]
  5936. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) NewFilename;
  5937. }
  5938. struct SMBComMoveResp
  5939. {
  5940. UINT8 WordCount;
  5941. UINT16 Count;
  5942. UINT16 ByteCount;
  5943. // These fields exist only when an error has occurred
  5944. switch
  5945. {
  5946. case ByteCount > 0:
  5947. switch(WordCount)
  5948. {
  5949. case 0: // Window implement different from CIFS
  5950. [Post.SMBComPramSummary = SMBComPramSummary + ", ErrorFile = " + ErrorFileName]
  5951. UnicodeString ErrorFileName;
  5952. case 1:
  5953. _struct ErrorFile
  5954. {
  5955. UINT8 ErrorFileFormat = SMBBufferStringFormatsTable(this);
  5956. [Post.SMBComPramSummary = SMBComPramSummary + ", ErrorFile = " + SMBFileNameValue]
  5957. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) ErrorFileName;
  5958. }
  5959. }
  5960. }
  5961. }
  5962. struct SMBComEchoRequest
  5963. {
  5964. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5965. UINT16 Echocount;
  5966. UINT16 ByteCount;
  5967. BLOB( ByteCount) Buffer;
  5968. }
  5969. struct SMBComEchoResp
  5970. {
  5971. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  5972. UINT16 SequenceNumber;
  5973. UINT16 ByteCount;
  5974. BLOB( ByteCount) Buffer;
  5975. }
  5976. struct SMBResumeKey
  5977. {
  5978. [DataFieldByteOrder = LittleEndian]
  5979. UINT8 Reserved
  5980. {
  5981. UINT8 Client:7 = FormatString("(%s) Reserved for use by client", this.ToBitString);
  5982. UINT8 Server:1 = FormatString("(%s) Reserved for use by server", this.ToBitString);
  5983. };
  5984. AsciiString(11) FileName;
  5985. BLOB(5) ReservedForServer;
  5986. BLOB(4) ReservedForConsumer;
  5987. }
  5988. struct SMBComFindRequest
  5989. {
  5990. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  5991. UINT16 MaxCount;
  5992. SMBFileAttributes SearchAttributes;
  5993. UINT16 ByteCount;
  5994. UINT8 BufferFormat1 = SMBBufferStringFormatsTable(this);
  5995. [Post.SMBComPramSummary = ", File = " + SMBFileNameValue]
  5996. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  5997. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  5998. UINT16 ResumeKeyLength;
  5999. SMBResumeKey ResumeKey;
  6000. }
  6001. struct SMBComFindResp
  6002. {
  6003. //This value must be 1.
  6004. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  6005. UINT16 Count;
  6006. UINT16 ByteCount;
  6007. //This value must be "0x05".
  6008. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  6009. [SMBFindEndOffset = FrameOffset + 2 + this]
  6010. UINT16 DataLength;
  6011. While DirectoryInformationData[frameOffset < SMBFindEndOffset]
  6012. {
  6013. SMBDirectoryInformation DirectoryInformation;
  6014. }
  6015. }
  6016. struct SMBComFindUniqueRequest
  6017. {
  6018. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  6019. UINT16 MaxCount;
  6020. SMBFileAttributes SearchAttributes;
  6021. UINT16 ByteCount;
  6022. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  6023. [Post.SMBComPramSummary = ", File = " + SMBFileNameValue]
  6024. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  6025. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  6026. UINT16 ResumeKeyLength = MUSTBeSetToTable( this, "0x0000");
  6027. switch
  6028. {
  6029. case ResumeKeyLength > 0:
  6030. SMBResumeKey ResumeKey;
  6031. }
  6032. }
  6033. struct SMBDirectoryInformation = FormatString("%s %s %s %d %s",
  6034. LastWriteDate.ToString,
  6035. LastWriteTime.ToString,
  6036. FileAttributes.Directory ? "<Dir> " : "<File>", /* FILE_ATTRIBUTE_DIRECTORY */
  6037. FileSize,
  6038. FileName)
  6039. {
  6040. SMBResumeKey ResumeKey;
  6041. SMBFileBYTEAttributes FileAttributes;
  6042. SMBTIME LastWriteTime;
  6043. SMBDATE LastWriteDate;
  6044. UINT32 FileSize;
  6045. AsciiString(13) FileName;
  6046. }
  6047. struct SMBComFindUniqueResp
  6048. {
  6049. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  6050. UINT16 Count;
  6051. UINT16 ByteCount;
  6052. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  6053. [SMBFindUniqueEndOffset = FrameOffset + 2 + this]
  6054. UINT16 DataLength;
  6055. while[FrameOffset < SMBFindUniqueEndOffset]
  6056. {
  6057. SMBDirectoryInformation DirectoryInformation;
  6058. }
  6059. }
  6060. struct SMBComFindCloseRequest
  6061. {
  6062. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  6063. UINT16 MaxCount;
  6064. UINT16 SearchAttributes;
  6065. UINT16 ByteCount = MUSTBeSetToTable( this, "0x001A");
  6066. UINT8 BufferFormat1 = SMBBufferStringFormatsTable(this);
  6067. [Post.SMBComPramSummary = SMBFileNameValue ? ", File = " + SMBFileNameValue : ""]
  6068. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  6069. UINT8 BufferFormat2 = SMBBufferStringFormatsTable(this);
  6070. UINT16 ResumeKeyLength;
  6071. SMBResumeKey ResumeKey = MUSTBeSetToTable( this, "0x0015");
  6072. }
  6073. struct SMBComFindCloseResp
  6074. {
  6075. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  6076. UINT16 Count;
  6077. UINT16 ByteCount = MUSTBeSetToTable( this, "0x03"); // min = 3
  6078. switch
  6079. {
  6080. case FrameOffset < FrameLength:
  6081. // Even ByteCount = 3, this buffer may not exist
  6082. _struct Buffer
  6083. {
  6084. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  6085. UINT16 DataLength;
  6086. BLOB(DataLength) Data;
  6087. }
  6088. }
  6089. }
  6090. //
  6091. //SNIA Technical Proposal, Revision 1.0, page 70, 4.2.4. READ_ANDX: Read Bytes
  6092. //
  6093. struct SMBComReadRequestAndXRequest
  6094. {
  6095. UINT8 WordCount;
  6096. [SMBCommand]
  6097. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6098. UINT8 ANDXReserved;
  6099. [SMBAndXOffset]
  6100. UINT16 ANDXOffset;
  6101. [
  6102. SMBFileID,
  6103. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  6104. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  6105. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  6106. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  6107. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  6108. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  6109. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  6110. ]
  6111. UINT16 FileID;
  6112. [property.SMBFileOffset]
  6113. UINT32 FileOffset;
  6114. UINT16 MaxCountOfBytesToReturn;
  6115. UINT16 MinCountOfBytesToReturn;
  6116. [
  6117. SMBIsLargeMaxCount = this <> 0xFFFFFFFF && this > 65535,
  6118. SMBMaxCount = (this <> 0xFFFFFFFF) ? (this * 65536 + MaxCountOfBytesToReturn) : MaxCountOfBytesToReturn
  6119. ]
  6120. UINT32 TimeoutOrMaxCountHigh;
  6121. UINT16 Remaining;
  6122. switch(WordCount)
  6123. {
  6124. case 12:
  6125. [
  6126. SMBIsLargeFileOffset = this <> 0xFFFFFFFF && this > 0,
  6127. SMBFileOffset = (this <> 0xFFFFFFFF) ? (SMBFileOffset + this * 4294967296) : SMBFileOffset
  6128. ]
  6129. UINT32 OffsetHigh;
  6130. };
  6131. [conversation.SmbFileOffsetConv = SMBFileOffset]
  6132. [SMBComPramSummary = SMBComPramSummary + ", "
  6133. + SMBFormatNumber("%u", SMBIsLargeMaxCount, SMBMaxCount)
  6134. + " bytes at Offset "
  6135. + SMBFormatNumber("%u", SMBIsLargeFileOffset, SMBFileOffset)
  6136. ]
  6137. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  6138. switch
  6139. {
  6140. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6141. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6142. };
  6143. }
  6144. struct SMBComReadAndXResp
  6145. {
  6146. [
  6147. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  6148. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  6149. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  6150. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  6151. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  6152. BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  6153. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  6154. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  6155. ]
  6156. [conversation.SmbFileOffsetMVS$[Framenumber] = conversation.SmbFileOffsetConv]
  6157. [property.SMBFileOffset = conversation.SmbFileOffsetMVS$[Framenumber]]
  6158. UINT8 WordCount = MUSTBeSetToTable( this, "0x0C");
  6159. [SMBCommand]
  6160. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6161. UINT8 ANDXReserved;
  6162. [SMBAndXOffset]
  6163. UINT16 ANDXOffset;
  6164. UINT16 Available;
  6165. UINT16 DataCompactionMode;
  6166. UINT16 Reserved1;
  6167. UINT16 DataLength;
  6168. UINT16 DataOffset;
  6169. [Property.SMBDataLength = this * 65536 + DataLength]
  6170. [post.property.SmbFileFragmentLen = Property.SMBDataLength]
  6171. UINT16 DataLengthHigh;
  6172. [SMBComPramSummary = SMBComPramSummary + FormatString(", %u bytes", Property.SMBDataLength)]
  6173. BLOB(8) Reserved2;
  6174. UINT16 ByteCount;
  6175. switch
  6176. {
  6177. case DataOffset > CurrentProtocolOffset:
  6178. BLOB(DataOffset - CurrentProtocolOffset) Padding;
  6179. }
  6180. Switch
  6181. {
  6182. case UINT8( Framedata, Offset ) == 0x05 &&
  6183. ( UINT8( Framedata, Offset + 1 ) == 0 || UINT8( Framedata, Offset + 1 ) == 1 ) &&
  6184. ( FrameLength - FrameOffset >= 16 ) &&
  6185. ( UINT8( Framedata, Offset + 2 ) == 0 ||
  6186. UINT8( Framedata, Offset + 2 ) == 2 ||
  6187. UINT8( Framedata, Offset + 2 ) == 3 ||
  6188. ( UINT8( Framedata, Offset + 2 ) >= 11 &&
  6189. UINT8( Framedata, Offset + 2 ) <= 19 )) &&
  6190. ( UINT8( Framedata, Offset + 4 ) & 0xEE ) == 0 &&
  6191. UINT8( Framedata, Offset + 5 ) < 4 &&
  6192. UINT8( Framedata, Offset + 6 ) == 0 &&
  6193. UINT8( Framedata, Offset + 7 ) == 0 :
  6194. MSRPC MSRPC;
  6195. default:
  6196. switch
  6197. {
  6198. case !(ConvID > 0):
  6199. _struct ReportWarning
  6200. {
  6201. ReportParserWarning( "SMB", "May not parse correctly when conversation off") ParserWarning;
  6202. BLOB( (Property.SMBDataLength < FrameLength - FrameOffset) ? Property.SMBDataLength : (FrameLength - FrameOffset)) Buffer;
  6203. };
  6204. default:
  6205. struct
  6206. {
  6207. [Local.SMBFileNameRemain = Property.SMBFileName]
  6208. [MaxLoopCount = 200]
  6209. while [Local.SMBFileNameRemain.ContainsBin(2, "5C")]
  6210. {
  6211. [Local.SMBFileNameRemain = UnicodeString(Local.SMBFileNameRemain, 2)]
  6212. struct{};
  6213. }
  6214. switch
  6215. {
  6216. case Local.SMBFileNameRemain.containsBin(2, "2E")://It's not pipe data when include "." in the file name
  6217. switch
  6218. {
  6219. case conversation.Parent.SmbIsNotPipe$[property.SMBTID] || IsValueNone(conversation.Parent.SmbIsNotPipe$[property.SMBTID]):
  6220. [
  6221. PayloadStart(
  6222. NetworkDirection, /* direction */
  6223. 0, /* id */
  6224. property.SMBFileOffset, /* sequence token */
  6225. property.SMBFileOffset + property.SmbFileFragmentLen, /* next sequence token */
  6226. 0, /* total payload length */
  6227. Property.IsMoreThanOneSMBOverTcp ? 1 : property.SMBFileOffset == 0, /* is first */
  6228. Property.IsMoreThanOneSMBOverTcp ? 1 : 0, /* is last */
  6229. RssmblyIndStartBit + RssmblyIndEndBit + RssmblySequenceBit,
  6230. 0x0000,
  6231. 0,
  6232. 0x0000,
  6233. Property.SMBFileName
  6234. )
  6235. ]
  6236. [DataFieldFrameLength = FrameOffset + property.SmbFileFragmentLen]
  6237. switch
  6238. {
  6239. case property.SMBFileOffset == 0:
  6240. FileTypeContent FileTypeContent;
  6241. default:
  6242. blob(FrameLength - FrameOffset) ContinualData;
  6243. }
  6244. default:
  6245. BLOB(Property.SmbFileFragmentLen) Payload;
  6246. }
  6247. default:
  6248. [PayloadStart(
  6249. NetworkDirection, /* direction */
  6250. Property.SMBFileID, //identifier
  6251. 0, //sequence token
  6252. 0, //next sequence
  6253. 0, //total payload length
  6254. 0, //is first
  6255. 0, //is last
  6256. RssmblyIndStartBit+RssmblyIndLengthBit, //has start and end indication
  6257. 0x0000, /* Properties... */
  6258. SMBResponse,
  6259. 0x0000,
  6260. ""
  6261. )
  6262. ]
  6263. switch
  6264. {
  6265. case contains(Property.SMBFileName, "\\ci_skads"):
  6266. CIS CIS;
  6267. default:
  6268. BLOB(Property.SmbFileFragmentLen) PipePayload;
  6269. }
  6270. }
  6271. }
  6272. };
  6273. }
  6274. switch
  6275. {
  6276. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6277. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6278. };
  6279. }
  6280. struct SMBComCloseAndTreeDisconnectedRequest
  6281. {
  6282. UINT8 WordCount;
  6283. [
  6284. SMBFileID,
  6285. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  6286. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  6287. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  6288. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  6289. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  6290. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  6291. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  6292. ]
  6293. UINT16 FileID;
  6294. TIMESTAMP LastWriteTime;
  6295. UINT16 ByteCount;
  6296. }
  6297. struct SMBComCloseAndTreeDisconnectedResp
  6298. {
  6299. [
  6300. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  6301. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  6302. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  6303. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  6304. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  6305. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount), Disconnected),
  6306. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  6307. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  6308. ]
  6309. UINT8 WordCount ;
  6310. UINT16 ByteCount;
  6311. }
  6312. struct SMBComFindClose2Request
  6313. {
  6314. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  6315. [
  6316. SMBFileID,
  6317. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  6318. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  6319. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  6320. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  6321. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  6322. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  6323. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  6324. ]
  6325. UINT16 FileID;
  6326. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  6327. }
  6328. struct SMBComFindClose2Resp
  6329. {
  6330. [
  6331. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  6332. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  6333. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  6334. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  6335. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  6336. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount), Disconnected),
  6337. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  6338. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  6339. ]
  6340. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  6341. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  6342. }
  6343. struct SMBComFindNotifyCloseRequest
  6344. {
  6345. UINT8 WordCount;
  6346. [
  6347. SMBFileID,
  6348. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  6349. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  6350. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  6351. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  6352. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  6353. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  6354. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  6355. ]
  6356. UINT16 FileID;
  6357. UINT16 ByteCount;
  6358. }
  6359. struct SMBComFindNotifyCloseResp
  6360. {
  6361. [
  6362. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  6363. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber],
  6364. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  6365. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  6366. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  6367. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount), Disconnected),
  6368. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  6369. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  6370. ]
  6371. UINT8 WORDCount;
  6372. UINT16 ByteCount;
  6373. }
  6374. struct SMBComTreeDisconnectRequest
  6375. {
  6376. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  6377. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  6378. }
  6379. struct SMBComTreeDisconnectResp
  6380. {
  6381. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  6382. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  6383. }
  6384. struct SMBComNegotiateRequest
  6385. {
  6386. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  6387. [SMBNegotiateEndOffset = frameOffset + 2 + this]
  6388. UINT16 ByteCount;
  6389. //
  6390. // Here, the dialect Names are always transmitted as ASCII String
  6391. //
  6392. [DialectCount = 0]
  6393. while Dialects [( frameOffset < SMBNegotiateEndOffset) && UINT8( Framedata, Offset ) == 0x02]
  6394. {
  6395. struct Dialect = DialectName
  6396. {
  6397. UINT8 BufferFormat = SMBBufferStringFormatsTable(this);
  6398. [
  6399. Post.SMBComPramSummary = (DialectCount == 0) ? ", Dialect = " + DialectName : SMBComPramSummary + ", " + DialectName,
  6400. conversation.SMBDialectTable$[DialectCount],
  6401. Post.DialectCount = DialectCount + 1
  6402. ]
  6403. AsciiString DialectName;
  6404. };
  6405. }
  6406. }
  6407. struct SMBComNegotiateDialectUnknownResp
  6408. {
  6409. UINT8 WordCount = MUSTBeSetToTable( this, "0x01");
  6410. [Post.SMBComPramSummary = FormatString(", Dialect is %s (#%d)", conversation.SMBDialectTable$[DialectIndex], DialectIndex)]
  6411. UINT16 DialectIndex;
  6412. UINT16 ByteCount;
  6413. switch
  6414. {
  6415. case ByteCount > 0:
  6416. BLOB(ByteCount) BytePrameters;
  6417. }
  6418. }
  6419. // http://www.cifs.org/mediawiki/images/b/b9/1992-02-29-SMB-LM21.pdf
  6420. struct SmbComNegotiateResponseLM21
  6421. {
  6422. UINT8 WordCount = MUSTBeSetToTable( this, "0x0D");
  6423. [Post.SMBComPramSummary = FormatString(", Dialect is %s (#%d)", conversation.SMBDialectTable$[DialectIndex], DialectIndex)]
  6424. UINT16 DialectIndex;
  6425. UINT16 SecurityMode;
  6426. UINT16 MaxXmt;
  6427. UINT16 MaxMux;
  6428. UINT16 MaxVcs;
  6429. UINT16 BlkMode;
  6430. UINT32 SessionKey;
  6431. SMBTIME ServerTime;
  6432. SMBDATE ServerDate;
  6433. INT16 ServerTimeZone;
  6434. UINT16 CryptKeyLength;
  6435. UINT16 Reserved;
  6436. UINT16 ByteCount;
  6437. Blob(CryptKeyLength) CryptKey;
  6438. SMBFileNameString(SMBUnicode, FALSE, 0, FrameOffset) DomainName;
  6439. }
  6440. struct SmbComNegotiateResp
  6441. {
  6442. UINT8 WordCount = MUSTBeSetToTable( this, "0x11");
  6443. [Post.SMBComPramSummary = FormatString(", Dialect is %s (#%d)", conversation.SMBDialectTable$[DialectIndex], DialectIndex)]
  6444. UINT16 DialectIndex;
  6445. [DataFieldByteOrder = LittleEndian]
  6446. UINT8 SecurityMode
  6447. {
  6448. UINT8 UserSecurity:1 = FormatString(" (%s) %s", this.ToBitString, this ? "User Mode" : "Share Mode");
  6449. UINT8 EncryptedPasswords:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Encrypted Passwords Required" : "Encrypted Passwords NOT Required");
  6450. UINT8 SecuritySignaturesEnable:1 = FormatString(" (%s) Security signatures(SMB sequence numbers) %s", this.ToBitString, this ? "enabled" : "disabled");
  6451. UINT8 SecuritySignaturesRequired:1 = FormatString("(%s) Security signatures(SMB sequence numbers) %s", this.ToBitString, this ? "required" : "NOT required");
  6452. UINT8 Reserved_bits4_7:4 = FormatString(" (%s) %s", this.ToBitString, "Reserved");
  6453. };
  6454. UINT16 MaxMpxCount;
  6455. UINT16 MaxNumberVcs;
  6456. UINT32 MaxBufferSize;
  6457. UINT32 MaxRawSize;
  6458. UINT32 SessionKey;
  6459. [DataFieldByteOrder = LittleEndian]
  6460. UINT32 Capabilities
  6461. {
  6462. UINT32 Reserved_bits1_13:13 = FormatString(" (%s) Reserved", this.ToBitString);
  6463. UINT32 InfolevelPassthru:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports Windows NT information level pass-through requests [SMB_INFO_PASSTHROUGH]" : "No Support for Windows NT information level pass-through requests [SMB_INFO_PASSTHROUGH]") , "CAP_INFOLEVEL_PASSTHRU");
  6464. UINT32 Reserved_bits15:1 = FormatString(" (%s) Reserved", this.ToBitString);
  6465. UINT32 LargeWritex:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports large write operations" : "No Support for large write operations") , "CAP_LARGE_WRITEX");
  6466. UINT32 Lwio:1 = FormatString(" (%s) Reserved", this.ToBitString);
  6467. UINT32 Reserved_bit18_23:6 = FormatString(" (%s) Reserved", this.ToBitString);
  6468. UINT32 Unix:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports UNIX CIFS Extensions" : "No Support for UNIX CIFS Extensions") , "CAP_UNIX");
  6469. UINT32 Reserved_bits24:1 = FormatString(" (%s) Reserved", this.ToBitString);
  6470. UINT32 CompressedData:1 = FormatString(" (%s) %s (%s)", this.ToBitString, (this ? "Supports compressed data transfer" : "No support for compressed data transfer"), "CAP_COMPRESSED_DATA [NOT implemented]");
  6471. UINT32 Reserved_bits26_28:3 = FormatString("(%s) Reserved", this.ToBitString);
  6472. UINT32 DynamicReauth:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports dynamic reauthorization" : "No Support for dynamic reauthorization") , "CAP_DYNAMIC_REAUTH");
  6473. UINT32 Reserved_bits31:1 = FormatString(" (%s) Reserved", this.ToBitString);
  6474. UINT32 ExtendedSecurity:1 = FormatString(" (%s) %s (%s)", this.ToBitString , (this ? "Supports extended security exchange" : "No Support for extended security exchange") , "CAP_EXTENDED_SECURITY");
  6475. };
  6476. FILETIME SystemTime;
  6477. UINT16 SystemTimeZone = FormatString("%d Min From UTC", this);
  6478. UINT8 ChallengeLength = MUSTBeSetToTable( this, "0x08");
  6479. UINT16 ByteCount;
  6480. [ SMBNegotiateBuffEndOffset = FrameOffset + ByteCount ]
  6481. switch
  6482. {
  6483. case FrameOffset < SMBNegotiateBuffEndOffset:
  6484. _struct AuthenticationData
  6485. {
  6486. Switch( Capabilities.ExtendedSecurity )
  6487. {
  6488. case 0:
  6489. _struct ChallengeAuthData
  6490. {
  6491. Blob(ChallengeLength) Challenge;
  6492. //Windows NT servers always send the DomainName field in Unicode characters and never add a padding byte for alignment.
  6493. SMBFileNameString(SMBUnicode, FALSE, 0, FrameOffset) DomainName;
  6494. switch
  6495. {
  6496. case FrameOffset < SMBNegotiateBuffEndOffset:
  6497. UnicodeString((SMBNegotiateBuffEndOffset - FrameOffset) /2) ServerName;
  6498. }
  6499. }
  6500. case 1:
  6501. _struct GSSAPISpecificInformation
  6502. {
  6503. GUID(FALSE) ServerGUID;
  6504. SMBSecurityBlob(FrameLength - FrameOffset) SecurityBlob;
  6505. }
  6506. }
  6507. }
  6508. }
  6509. }
  6510. // http://www.cifs.org/mediawiki/images/b/b9/1992-02-29-SMB-LM21.pdf
  6511. struct SmbComSessionSetupAndxClientRequest
  6512. {
  6513. UINT8 WordCount = MUSTBeSetToTable(this, "0x0A");
  6514. [SMBCommand]
  6515. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6516. UINT8 AndXReserved;
  6517. [SMBAndXOffset]
  6518. UINT16 ANDXOffset;
  6519. UINT16 MaxBufferSize;
  6520. UINT16 MaxMpxCount;
  6521. UINT16 VcNumber;
  6522. UINT32 SessionKey;
  6523. UINT16 AccountPasswordLength;
  6524. UINT32 Reserved;
  6525. [EndByteCountOffset = frameOffset + ByteCount + 2 ]
  6526. UINT16 ByteCount;
  6527. switch
  6528. {
  6529. case AccountPasswordLength > 0:
  6530. BLOB(AccountPasswordLength) AccountPassword;
  6531. }
  6532. [DataFieldFrameLength = (ANDXOffset == 0) ? FrameLength : (ProtocolOffset + ANDXOffset)]
  6533. switch
  6534. {
  6535. case CurrentProtocolOffset < ANDXOffset || ANDXOffset == 0:
  6536. switch(Property.SMBUnicode)
  6537. {
  6538. case 1:
  6539. _struct UnicodeParameters
  6540. {
  6541. ALIGN2 Align;
  6542. [SMBComPramSummary = ", AccountName = " + this]
  6543. UnicodeString AccountName;
  6544. UnicodeString PrimaryDomain;
  6545. UnicodeString NativeOS;
  6546. While [CurrentProtocolOffset<ANDXOffset && UINT16(FrameData, FrameOffset) == 0x0000]
  6547. {
  6548. UINT16 NULL;
  6549. }
  6550. UnicodeString NativeLANMan;
  6551. };
  6552. case 0:
  6553. _struct AsciiParameters
  6554. {
  6555. [SMBComPramSummary = ", AccountName = " + this]
  6556. AsciiString AccountName;
  6557. AsciiString PrimaryDomain;
  6558. AsciiString NativeOS;
  6559. While [CurrentProtocolOffset<ANDXOffset && UINT8(FrameData, FrameOffset) == 0x00]
  6560. {
  6561. UINT8 NULL;
  6562. }
  6563. AsciiString NativeLANMan;
  6564. };
  6565. }
  6566. }
  6567. switch
  6568. {
  6569. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6570. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6571. };
  6572. }
  6573. struct SmbComSessionSetupAndxClientRequestExtension
  6574. {
  6575. UINT8 WordCount = MUSTBeSetToTable( this, "0x0C");
  6576. [SMBCommand]
  6577. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6578. UINT8 AndXReserved;
  6579. [SMBAndXOffset]
  6580. UINT16 ANDXOffset;
  6581. UINT16 MaxBufferSize;
  6582. UINT16 MaxMpxCount;
  6583. UINT16 VcNumber;
  6584. UINT32 SessionKey;
  6585. UINT16 SecurityBlobLength;
  6586. UINT32 Reserved;
  6587. UINT32 Capabilities;
  6588. [EndByteCountOffset = frameOffset + ByteCount + 2 ]
  6589. UINT16 ByteCount;
  6590. SMBSecurityBlob(SecurityBlobLength) SecurityBlob;
  6591. [DataFieldFrameLength = (ANDXOffset == 0) ? FrameLength : (ProtocolOffset + ANDXOffset)]
  6592. switch
  6593. {
  6594. case CurrentProtocolOffset < ANDXOffset || ANDXOffset == 0:
  6595. switch(Property.SMBUnicode)
  6596. {
  6597. case 1:
  6598. _struct UnicodeParameters
  6599. {
  6600. ALIGN2 Align;
  6601. UnicodeString NativeOS;
  6602. While [CurrentProtocolOffset<ANDXOffset && UINT16(FrameData, FrameOffset) == 0x0000]
  6603. {
  6604. UINT16 NULL;
  6605. }
  6606. UnicodeString NativeLANMan;
  6607. };
  6608. case 0:
  6609. _struct AsciiParameters
  6610. {
  6611. AsciiString NativeOS;
  6612. While [CurrentProtocolOffset<ANDXOffset && UINT8(FrameData, FrameOffset) == 0x00]
  6613. {
  6614. UINT8 NULL;
  6615. }
  6616. AsciiString NativeLANMan;
  6617. };
  6618. }
  6619. }
  6620. switch
  6621. {
  6622. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6623. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6624. };
  6625. }
  6626. // http://www.cifs.org/mediawiki/images/b/b9/1992-02-29-SMB-LM21.pdf
  6627. struct SmbComSessionSetupAndxServerResponse
  6628. {
  6629. UINT8 WordCount = MUSTBeSetToTable( this, "0x03");
  6630. [SMBCommand]
  6631. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6632. UINT8 AndXReserved;
  6633. [SMBAndXOffset]
  6634. UINT16 ANDXOffset;
  6635. [DataFieldByteOrder = LittleEndian]
  6636. UINT16 Action = Guest ? " Logged in as Guest" : " Logged in as User"
  6637. {
  6638. UINT16 Guest:1 = FormatString("(%s) SMB_SETUP_GUEST: Logged on as %s",
  6639. this.ToBitString,
  6640. this ? "Guest" : "User");
  6641. UINT16 LMKey:1 = FormatString("(%s) SMB_SETUP_USE_LANMAN_KEY: %s",
  6642. this.ToBitString,
  6643. this ? "Using the Lan Manager setup key" : "Using the User setup key");
  6644. UINT16 Resvd:14 = FormatString("(%s) Reserved", this.ToBitString);
  6645. };
  6646. [EndByteCountOffset = frameOffset + ByteCount + 2 ]
  6647. UINT16 ByteCount;
  6648. [DataFieldFrameLength = (ANDXOffset == 0) ? FrameLength : (ProtocolOffset + ANDXOffset)]
  6649. switch
  6650. {
  6651. case CurrentProtocolOffset < ANDXOffset || ANDXOffset == 0:
  6652. switch(SMBUnicode)
  6653. {
  6654. case 1:
  6655. _struct UnicodeParameters
  6656. {
  6657. ALIGN2 Align;
  6658. UnicodeString NativeOS;
  6659. UnicodeString NativeLANMan;
  6660. While [CurrentProtocolOffset<ANDXOffset && UINT16(FrameData, FrameOffset) == 0x0000]
  6661. {
  6662. UINT16 NULL;
  6663. }
  6664. // NOT guaranteed to be properly NUL terminated
  6665. switch
  6666. {
  6667. case ANDXOffset == 0 && (FrameLength-FrameOffset)/2 > 0:
  6668. UnicodeStringTerm("\0x00", true) PrimaryDomainpad;
  6669. case (ANDXOffset-CurrentProtocolOffset)/2 > 0:
  6670. UnicodeString( (ANDXOffset-CurrentProtocolOffset)/2 ) PrimaryDomain;
  6671. }
  6672. };
  6673. case 0:
  6674. _struct AsciiParameters
  6675. {
  6676. AsciiString NativeOS;
  6677. AsciiString NativeLANMan;
  6678. While [CurrentProtocolOffset<ANDXOffset && UINT8(FrameData, FrameOffset) == 0x00]
  6679. {
  6680. UINT8 NULL;
  6681. }
  6682. // NOT guaranteed to be properly NUL terminated
  6683. switch
  6684. {
  6685. case ANDXOffset == 0 && FrameOffset < FrameLength:
  6686. AsciiStringTerm("\0x00", true) PrimaryDomainpad;
  6687. case ANDXOffset-CurrentProtocolOffset > 0:
  6688. AsciiString(ANDXOffset-CurrentProtocolOffset) PrimaryDomain;
  6689. }
  6690. };
  6691. }
  6692. }
  6693. switch
  6694. {
  6695. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6696. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6697. };
  6698. }
  6699. struct SMBComSessionSetupAndXNTLMNoESSRequest
  6700. {
  6701. UINT8 WordCount;
  6702. [SMBCommand]
  6703. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6704. UINT8 AndXReserved;
  6705. [SMBAndXOffset]
  6706. UINT16 ANDXOffset;
  6707. UINT16 MaxBufferSize;
  6708. UINT16 MaxMpxCount;
  6709. UINT16 VcNumber;
  6710. UINT32 SessionKey;
  6711. UINT16 CaseInsensitivePwdLen; // ANSI
  6712. UINT16 CaseSensitivePwdLen;// Unicode
  6713. UINT32 Reserved;
  6714. SMBCapability Capabilities;
  6715. UINT16 ByteCount;
  6716. switch
  6717. {
  6718. case CaseInsensitivePwdLen > 0:
  6719. BLOB(CaseInsensitivePwdLen) CaseInsensitivePwd;
  6720. };
  6721. switch
  6722. {
  6723. case CaseSensitivePwdLen > 0 && CaseSensitivePwdLen < 24:
  6724. BLOB(CaseSensitivePwdLen) CaseSensitivePwd;
  6725. case CaseSensitivePwdLen == 24:
  6726. [Property.NTLMSSPLmChallengeLength = 24]
  6727. NLMPLmv2Response NlmpLmv2Response;
  6728. case CaseSensitivePwdLen > 24:
  6729. [DataFieldFrameLength = FrameOffset + CaseSensitivePwdLen]
  6730. NLMPV2Response NlmpV2Response;
  6731. };
  6732. switch
  6733. {
  6734. case CaseInsensitivePwdLen == 0
  6735. && CaseSensitivePwdLen == 0
  6736. && UINT8(FrameData,FrameOffset) == 0:
  6737. BLOB(1) NullPwd;
  6738. };
  6739. [DataFieldFrameLength = (ANDXOffset == 0) ? FrameLength : (ProtocolOffset + ANDXOffset)]
  6740. switch
  6741. {
  6742. case CurrentProtocolOffset < ANDXOffset || ANDXOffset == 0:
  6743. switch(SMBUnicode)
  6744. {
  6745. case 1:
  6746. _struct UnicodeParameters
  6747. {
  6748. ALIGN2 Align;
  6749. [SMBComPramSummary = ", Account = " + (this ? this : "anonymous")]
  6750. UnicodeString AccountName;
  6751. UnicodeString PrimaryDomain;
  6752. UnicodeString NativeOS;
  6753. switch
  6754. {
  6755. case UINT16(FrameData,FrameOffset) == 0:
  6756. UINT16 Null;
  6757. }
  6758. UnicodeString NativeLANMan;
  6759. };
  6760. case 0:
  6761. _struct AsciiParameters
  6762. {
  6763. [SMBComPramSummary = ", Account = " + (this ? this : "anonymous")]
  6764. AsciiString AccountName;
  6765. AsciiString PrimaryDomain;
  6766. AsciiString NativeOS;
  6767. AsciiString NativeLANMan;
  6768. };
  6769. }
  6770. }
  6771. switch
  6772. {
  6773. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6774. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6775. };
  6776. }
  6777. struct SMBComSessionSetupAndXNTLMESSRequest
  6778. {
  6779. UINT8 WordCount;
  6780. [WordPramEndOffset = frameOffset + WordCount*2, SMBCommand]
  6781. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6782. UINT8 AndXReserved;
  6783. [SMBAndXOffset]
  6784. UINT16 ANDXOffset;
  6785. UINT16 MaxBufferSize;
  6786. UINT16 MaxMpxCount;
  6787. UINT16 VcNumber;
  6788. UINT32 SessionKey;
  6789. UINT16 SecurityBlobLength;
  6790. UINT32 Reserved;
  6791. SMBCapability Capabilities;
  6792. switch
  6793. {
  6794. case frameOffset < WordPramEndOffset:
  6795. BLOB(WordPramEndOffset - frameOffset) WordPad;
  6796. }
  6797. [EndByteCountOffset = frameOffset + ByteCount + 2 ]
  6798. UINT16 ByteCount;
  6799. SMBSecurityBlob(SecurityBlobLength) SecurityBlob;
  6800. [DataFieldFrameLength = (ANDXOffset == 0) ? FrameLength : (ProtocolOffset + ANDXOffset)]
  6801. switch
  6802. {
  6803. case FrameOffset < EndByteCountOffset:
  6804. switch(SMBUnicode)
  6805. {
  6806. case 1:
  6807. _struct UnicodeParameters
  6808. {
  6809. ALIGN2 Align;
  6810. switch
  6811. {
  6812. case FrameOffset < EndByteCountOffset:
  6813. UnicodeString NativeOS;
  6814. }
  6815. switch
  6816. {
  6817. case (FrameOffset < EndByteCountOffset) && (UINT16(FrameData,FrameOffset) == 0):
  6818. UINT16 Null;
  6819. }
  6820. switch
  6821. {
  6822. case FrameOffset < EndByteCountOffset:
  6823. UnicodeString NativeLANMan;
  6824. }
  6825. };
  6826. case 0:
  6827. _struct AsciiParameters
  6828. {
  6829. switch
  6830. {
  6831. case FrameOffset < EndByteCountOffset:
  6832. AsciiString NativeOS;
  6833. }
  6834. switch
  6835. {
  6836. case FrameOffset < EndByteCountOffset:
  6837. AsciiString NativeLANMan;
  6838. }
  6839. };
  6840. }
  6841. }
  6842. switch
  6843. {
  6844. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6845. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6846. };
  6847. }
  6848. struct SmbComSessionSetupAndxServerResponseExtension
  6849. {
  6850. UINT8 WordCount;
  6851. [WordPramEndOffset = frameOffset + WordCount*2, SMBCommand]
  6852. UINT8 AndXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6853. UINT8 AndXReserved;
  6854. [SMBAndXOffset]
  6855. UINT16 ANDXOffset;
  6856. [DataFieldByteOrder = LittleEndian]
  6857. UINT16 Action = Guest ? " Logged in as Guest" : " Logged in as User"
  6858. {
  6859. UINT16 Guest:1 = FormatString(" (%s) SMB_SETUP_GUEST: Logged on as %s", this.ToBitString, this ? "Guest" : "User");
  6860. UINT16 LMAuth:1 = FormatString("(%s) %suse the LM setup key", this.ToBitString, this ? "" : "Do NOT ");
  6861. UINT16 Resvd:14 = FormatString(" (%s) Reserved", this.ToBitString);
  6862. };
  6863. UINT16 SecurityBlobLength;
  6864. switch
  6865. {
  6866. case frameOffset < WordPramEndOffset:
  6867. BLOB(WordPramEndOffset - frameOffset) WordPad;
  6868. }
  6869. [EndByteCountOffset = frameOffset + ByteCount + 2 ]
  6870. UINT16 ByteCount;
  6871. SMBSecurityBlob(SecurityBlobLength) SecurityBlob;
  6872. // Packet could be fragmented anywhere in here
  6873. [DataFieldFrameLength = (ANDXOffset == 0) ? FrameLength : (ProtocolOffset + ANDXOffset)]
  6874. switch
  6875. {
  6876. case CurrentProtocolOffset < ANDXOffset || ANDXOffset == 0:
  6877. switch(SMBUnicode)
  6878. {
  6879. case 1:
  6880. _struct UnicodeParameters
  6881. {
  6882. ALIGN2 Align;
  6883. UnicodeString NativeOS;
  6884. UnicodeString NativeLANMan;
  6885. };
  6886. case 0:
  6887. _struct AsciiParameters
  6888. {
  6889. AsciiString NativeOS;
  6890. AsciiString NativeLANMan;
  6891. };
  6892. }
  6893. }
  6894. switch
  6895. {
  6896. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6897. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6898. };
  6899. }
  6900. struct SMBComLogoffAndXRequest
  6901. {
  6902. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  6903. [SMBCommand]
  6904. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6905. UINT8 AndXReserved;
  6906. [SMBAndXOffset]
  6907. UINT16 ANDXOffset;
  6908. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  6909. switch
  6910. {
  6911. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6912. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6913. };
  6914. }
  6915. struct SMBComLogoffAndX
  6916. {
  6917. UINT8 WordCount = MUSTBeSetToTable( this, "0x02");
  6918. [SMBCommand]
  6919. UINT8 ANDXCommand = FormatString("%s %d(0x%X)", SMBCommandTable(this), this, this);
  6920. UINT8 AndXReserved;
  6921. [SMBAndXOffset]
  6922. UINT16 ANDXOffset;
  6923. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  6924. switch
  6925. {
  6926. case FrameOffset < frameLength && ANDXOffset > CurrentProtocolOffset:
  6927. BLOB(ANDXOffset - CurrentProtocolOffset) ANDXPadding;
  6928. };
  6929. }
  6930. Table SMBNTTransactFunctionTable(func)
  6931. {
  6932. switch(func)
  6933. {
  6934. case 1: "NT_TRANSACT_CREATE";
  6935. case 2: "NT_TRANSACT_IOCTL";
  6936. case 3: "NT_TRANSACT_SET_SECURITY_DESC";
  6937. case 4: "NT_TRANSACT_NOTIFY_CHANGE";
  6938. case 5: "NT_TRANSACT_RENAME";
  6939. case 6: "NT_TRANSACT_QUERY_SECURITY_DESC";
  6940. case 7: "NT_TRANSACT_QUERY_QUOTA";
  6941. case 8: "NT_TRANSACT_SET_QUOTA";
  6942. case 9: "NT_TRANSACT_CREATE2";
  6943. default: "Unknown NT Transaction Function";
  6944. }
  6945. }
  6946. Table SMBNTTransactCreationFlagTable(flag)
  6947. {
  6948. switch(flag)
  6949. {
  6950. case 0x02: FormatString("Level I oplock requested, %d(%#X)", flag, flag);
  6951. case 0x04: FormatString("Batch oplock requested, %d(%#X)", flag, flag);
  6952. case 0x08: FormatString("Target for open is a directory, %d(%#X)", flag, flag);
  6953. default: FormatString("%d(%#X)", flag, flag);
  6954. }
  6955. }
  6956. [DataTypeByteOrder = LittleEndian]
  6957. struct SMBNTTransSecurityInformation
  6958. {
  6959. UINT32 Owner:1 = FormatString("(%s) OWNER_SECURITY_INFORMATION: %sRequesting Owner of the object or resource", this.ToBitString, this ? "" : "NOT");
  6960. UINT32 Group:1 = FormatString("(%s) GROUP_SECURITY_INFORMATION: %%sRequesting Group associated with the object or resource", this.ToBitString, this ? "" : "NOT");
  6961. UINT32 DACL:1 = FormatString(" (%s) DACL_SECURITY_INFORMATION: %sRequesting Discretionary Access Control List(ACL) associated with the object or resource.", this.ToBitString, this ? "" : "NOT");
  6962. UINT32 SACL:1 = FormatString(" (%s) SACL_SECURITY_INFORMATION: %sRequesting System Access Control List(ACL) associated with the object or resource.", this.ToBitString, this ? "" : "NOT");
  6963. UINT32 Revd:28 = FormatString(" (%s) Reserved", this.ToBitString );
  6964. }
  6965. //CIFS-TR-1p00_FINAL, page 34, SMB_COM_NT_TRANSACTION Formats
  6966. struct SMBComNTTransactionRequest
  6967. {
  6968. UINT8 WordCount;
  6969. UINT8 MaxSetupCount;
  6970. UINT16 Reserved;
  6971. UINT32 TotalParameterCount;
  6972. UINT32 TotalDataCount;
  6973. UINT32 MaxParameterCount;
  6974. UINT32 MaxDataCount;
  6975. UINT32 ParameterCount;
  6976. UINT32 ParameterOffset;
  6977. UINT32 DataCount;
  6978. UINT32 DataOffset;
  6979. UINT8 SetupCount;
  6980. [
  6981. SMBSubcommand,
  6982. SMBComSummary = SMBComSummary + ", " + SMBNTTransactFunctionTable(this),
  6983. conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] // save into SMB parent protocol conversation
  6984. ]
  6985. UINT16 Function = SMBNTTransactFunctionTable(this);
  6986. //
  6987. // These are NT Transaction Setup Words
  6988. //
  6989. switch
  6990. {
  6991. case Function == 0x0002 && SetupCount > 0:
  6992. struct IOCTLSetupWords
  6993. {
  6994. [
  6995. IOCTLFunctionCode,
  6996. Conversation.SMBFunctionCodeTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]
  6997. ]
  6998. UINT32 FunctionCode = FormatString("%s, %u (0x%X)", FSCCCtlCodeTable(this), this, this);
  6999. [
  7000. SMBFileID,
  7001. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7002. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7003. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7004. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7005. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7006. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7007. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : ""),
  7008. SMBComSummary = (FunctionCode == 0x00144064 || FunctionCode == 0x00140078 || FunctionCode == 0x001440F2) ?
  7009. (SMBComSummary + FormatString(" (%s Request)",FunctionCode.toString)) : SMBComSummary
  7010. ]
  7011. UINT16 FileID;
  7012. BOOLEAN IsFsctl = this ? "File system control command" : "Device control command";
  7013. [DataFieldByteOrder = LittleEndian]
  7014. UINT8 IsFlag
  7015. {
  7016. UINT8 ShareRoot:1 = FormatString("(%s) %s", this.ToBitString, this ? "Command is to be applied to share root handle" : "Command is NOT to be applied to share root handle");
  7017. UINT8 Reserved:7 = FormatString(" (%s) Reserved", this.ToBitString);
  7018. };
  7019. };
  7020. //
  7021. //CIFS-TR-1p00_FINAL, page 106, 4.3.7.NT_TRANSACT_NOTIFY_CHANGE: Request Change Notification
  7022. //
  7023. case Function == 0x0004 && SetupCount > 0:
  7024. struct NotifyChangeSetupWords
  7025. {
  7026. [DataFieldByteOrder = LittleEndian]
  7027. UINT32 CompletionFilter
  7028. {
  7029. UINT32 FileName: 1 = FormatString(" (%s) %sFile Change Name Notify (FILE_NOTIFY_CHANGE_FILE_NAME)", this.ToBitString, this ? "" : "NOT ");
  7030. UINT32 DirName: 1 = FormatString(" (%s) %sFile Change Dir Name Notify (FILE_NOTIFY_CHANGE_DIR_NAME)", this.ToBitString, this ? "" : "NOT ");
  7031. UINT32 Attributes: 1 = FormatString(" (%s) %sFile Change Attributes Notify (FILE_NOTIFY_CHANGE_ATTRIBUTES)", this.ToBitString, this ? "" : "NOT ");
  7032. UINT32 Size: 1 = FormatString(" (%s) %sFile Change Size Notify (FILE_NOTIFY_CHANGE_SIZE)", this.ToBitString, this ? "" : "NOT ");
  7033. UINT32 LastWrite: 1 = FormatString(" (%s) %sFile Change Last Write Notify (FILE_NOTIFY_CHANGE_LAST_WRITE)", this.ToBitString, this ? "" : "NOT ");
  7034. UINT32 LastAccess: 1 = FormatString(" (%s) %sFile Change Last Access Notify (FILE_NOTIFY_CHANGE_LAST_ACCESS)", this.ToBitString, this ? "" : "NOT ");
  7035. UINT32 Creation: 1 = FormatString(" (%s) %sFile Change Creation Notify (FILE_NOTIFY_CHANGE_CREATION)", this.ToBitString, this ? "" : "NOT ");
  7036. UINT32 Ea: 1 = FormatString(" (%s) %sFile Change EA Notify (FILE_NOTIFY_CHANGE_EA)", this.ToBitString, this ? "" : "NOT ");
  7037. UINT32 Security: 1 = FormatString(" (%s) %sFile Change Security Notify (FILE_NOTIFY_CHANGE_SECURITY)", this.ToBitString, this ? "" : "NOT ");
  7038. UINT32 StreamName: 1 = FormatString(" (%s) %sFile Change Stream Name Notify (FILE_NOTIFY_CHANGE_STREAM_NAME)", this.ToBitString, this ? "" : "NOT ");
  7039. UINT32 StreamSize: 1 = FormatString(" (%s) %sFile Change Stream Size Notify (FILE_NOTIFY_CHANGE_STREAM_SIZE)", this.ToBitString, this ? "" : "NOT ");
  7040. UINT32 StreamWrite: 1 = FormatString("(%s) %sFile Change Stream Write Notify (FILE_NOTIFY_CHANGE_STREAM_WRITE)", this.ToBitString, this ? "" : "NOT ");
  7041. UINT32 Reserved:20 = FormatString(" (%s) Reserved", this.ToBitString);
  7042. };
  7043. [
  7044. SMBFileID,
  7045. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7046. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7047. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7048. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7049. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7050. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7051. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  7052. ]
  7053. UINT16 FileID;
  7054. BOOLEAN WatchTree = FormatString("%s - %s", this?"TRUE":"FALSE", this?"Watch all subdirectories too":"No Watch any subdirectory");
  7055. UINT8 Reserved;
  7056. };
  7057. case SetupCount > 0:
  7058. _struct ErrorSetupWords
  7059. {
  7060. ReportParserError(ParserErrorProtocolClassWindows, "SMB", "SMB: Unknown NT Transaction Request SetupWords") NTTransactionSetupWordsError;
  7061. UINT16 SetupWords[SetupCount];
  7062. };
  7063. }
  7064. [SMBBytesEndOffset = frameOffset + 2 + ByteCount]
  7065. UINT16 ByteCount;
  7066. switch
  7067. {
  7068. case frameOffset < frameLength &&
  7069. CurrentProtocolOffset < ParameterOffset:
  7070. BLOB(ParameterOffset-CurrentProtocolOffset) Pad1;
  7071. }
  7072. //
  7073. // This is NT Transaction Parameter Block
  7074. //
  7075. switch
  7076. {
  7077. case Function == 0x0001 && ParameterCount > 0:
  7078. case Function == 0x0009 && ParameterCount > 0:
  7079. struct NTCreateParameterBlock
  7080. {
  7081. [DataFieldByteOrder = LittleEndian]
  7082. UINT32 Flags
  7083. {
  7084. UINT32 Unused:1 = FormatString(" (%s)", this.ToBitString);
  7085. UINT32 DynamicLock:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Level I oplock requested" : "Level I oplock NOT requested");
  7086. UINT32 BatchLock:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Batch oplock requested" : "Batch oplock NOT requested");
  7087. UINT32 Target:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Target for open is a directory" : "Target for open is NOT a directory");
  7088. UINT32 ExtentedResponse:1 = FormatString("(%s) %s", this.ToBitString, this ? "Request extented response" : "Does NOT request extended response");
  7089. UINT32 Reserved:27 = FormatString(" (%s)", this.ToBitString);
  7090. }
  7091. UINT32 RootDirectoryFid;
  7092. SMBAccessMask DesiredAccess;
  7093. SMBLargeInteger AllocationSize;
  7094. SMBNTFileAttributes ExtFileAttributes;
  7095. SMBNTCreateShareAccess ShareAccess;
  7096. UINT32 CreateDisposition = SMBNTCreateDisposition(this);
  7097. SMBNTCreateOptions CreateOptions;
  7098. [NTTransSecurityDescriptorLength]
  7099. UINT32 SecurityDescriptorLength;
  7100. [NTTransEaLength]
  7101. UINT32 EaLength;
  7102. UINT32 NameLength;
  7103. UINT32 ImpersonationLevel = SMBNTImpersonationLevelTable(UINT8( Framedata, Offset ));
  7104. SMBSecurityFlags SecurityFlags;
  7105. switch(SMBUnicode)
  7106. {
  7107. case 0:
  7108. _struct AsciiFileName
  7109. {
  7110. [
  7111. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  7112. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  7113. Post.BuildConversationWithParent(Property.SMBFileName),
  7114. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  7115. SMBComPramSummary = ", FileName = " + this
  7116. ]
  7117. AsciiString(NameLength) FileName;
  7118. }
  7119. case 1:
  7120. _struct UnicodeFileName
  7121. {
  7122. ALIGN2 Align;
  7123. [
  7124. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  7125. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  7126. Post.BuildConversationWithParent(Property.SMBFileName),
  7127. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  7128. SMBComPramSummary = ", FileName = " + this
  7129. ]
  7130. UnicodeString(NameLength / 2) FileName;
  7131. }
  7132. }
  7133. };
  7134. case Function == 0x0003 && ParameterCount > 0:
  7135. struct NTSetSecurityDescParameterBlock
  7136. {
  7137. [
  7138. SMBFileID,
  7139. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7140. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7141. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7142. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7143. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7144. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7145. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  7146. ]
  7147. UINT16 FileID;
  7148. UINT16 Reserved;
  7149. SMBNTTransSecurityInformation SecurityInformation;
  7150. };
  7151. case Function == 0x0005 && ParameterCount > 0://NT_TRANSACT_RENAME Client Request Clarification
  7152. struct NTRenameParameterBlock
  7153. {
  7154. [
  7155. SMBFileID,
  7156. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7157. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7158. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7159. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7160. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7161. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7162. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  7163. ]
  7164. UINT16 FileID;
  7165. UINT16 RenameFlags = this ? "replace the target file if the target name exists" : "fail if the target name exists";
  7166. [SMBComPramSummary = ", NewFileName = " + this]
  7167. SMBFileNameString(Property.SMBUnicode, FALSE, 0, ProtocolOffset) NewName;
  7168. }
  7169. case Function == 0x0006 && ParameterCount > 0:
  7170. struct NTQuerySecurityDescParameterBlock
  7171. {
  7172. [
  7173. SMBFileID,
  7174. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7175. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7176. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7177. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7178. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7179. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7180. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  7181. ]
  7182. UINT16 FileID;
  7183. UINT16 Reserved;
  7184. SMBNTTransSecurityInformation SecurityInformation;
  7185. };
  7186. case Function == 0x0007 && ParameterCount > 0://NT_TRANSACT_QUERY_QUOTA
  7187. struct NTQueryQuotaInfoParameterBlock
  7188. {
  7189. [
  7190. SMBFileID,
  7191. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7192. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7193. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7194. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7195. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7196. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7197. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  7198. ]
  7199. UINT16 FileID;
  7200. UINT8 ReturnSingleEntry;
  7201. UINT8 RestartScan;
  7202. UINT32 SIDListLength;
  7203. UINT32 StartSIDLength;
  7204. UINT32 StartSIDOffset;
  7205. };
  7206. case Function == 0x0008 && ParameterCount > 0://NT_TRANSACT_SET_QUOTA
  7207. struct NTSetQuotaInfoParameterBlock
  7208. {
  7209. [
  7210. SMBFileID,
  7211. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7212. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7213. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7214. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7215. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7216. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7217. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  7218. ]
  7219. UINT16 FileID;
  7220. };
  7221. case ParameterCount > 0:
  7222. struct ErrorParameterBlock
  7223. {
  7224. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("SMB: Unknown NT Transaction Request Parameters, Function = 0x%X", Function)) NTTransactionParameterError;
  7225. BLOB(ParameterCount) Parameters;
  7226. }
  7227. }
  7228. switch
  7229. {
  7230. case frameOffset < frameLength && CurrentProtocolOffset < DataOffset:
  7231. BLOB(DataOffset-CurrentProtocolOffset) Pad2;
  7232. }
  7233. //
  7234. // This is NT Transaction Data Block
  7235. //
  7236. [conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Function]// save into SMB conversation
  7237. switch
  7238. {
  7239. case Function == 0x0001 && DataCount > 0:
  7240. _struct NTCreateDataBlock
  7241. {
  7242. switch
  7243. {
  7244. case NTTransSecurityDescriptorLength > 0:
  7245. SecurityDescriptorRelative SecurityDescriptor;
  7246. };
  7247. switch
  7248. {
  7249. case NTTransEaLength > 0:
  7250. Blob(NTTransEaLength) ExtendedAttributes;
  7251. };
  7252. }
  7253. case Function == 0x0002 && DataCount > 0:
  7254. _struct FSCTLDataStruct
  7255. {
  7256. switch( IOCTLFunctionCode )
  7257. {
  7258. case 0x001440F2:
  7259. _struct FSCTL_SRV_COPYCHUNKRequestData//FSCTL_SRV_COPYCHUNK Request
  7260. {
  7261. BLOB(24) CopychunkResumeKey;
  7262. UINT32 ChunkCount;
  7263. UINT32 Unused;
  7264. ChunkDataList List[ChunkCount];
  7265. }
  7266. case 0x000900AC:
  7267. FSCCFSCTLDeleteReparsePointRequest DeleteReparsePoint;
  7268. case 0x0009008F:
  7269. FSCCFSCTLFindFilesBySidRequest FindFilesBySid;
  7270. case 0x00090073:
  7271. FSCCFSCTLGetRetrievalPointersRequest GetRetrievalPointers;
  7272. case 0x0009002C:
  7273. FSCCFSCTLIsPathnameValidRequest IsPathnameValid;
  7274. case 0x001400EC:
  7275. FSCCFSCTLLMRSetLinkTrackingInformationRequest LMRSetLinkTrackingInformation;
  7276. case 0x0011C017:
  7277. FSCCFSCTLPipetransceiveRequest( DataCount ) Pipetransceive;
  7278. case 0x00110018:
  7279. FSCCFSCTLPipeWaitRequest PipeWait;
  7280. case 0x000940CF:
  7281. FSCCFSCTLQueryAllocatedRangesRequest QueryAllocatedRanges;
  7282. case 0x0009C040:
  7283. FSCCFSCTLSetCompressionRequest SetCompression;
  7284. case 0x00098134:
  7285. FSCCFSCTLSetDefectManagementRequest SetDefectManagement;
  7286. case 0x000900D7:
  7287. FSCCFSCTLSetEncryptionRequest SetEncryption;
  7288. case 0x00090098:
  7289. FSCCFSCTLSetObjectIDRequest SetObjectID;
  7290. case 0x000900BC:
  7291. FSCCFSCTLSetObjectIDExtendedRequest SetObjectIDExtended;
  7292. case 0x000900A4:
  7293. FSCCFSCTLSetReparsePointRequest SetReparsePoint;
  7294. case 0x000901B4:
  7295. FSCCFSCTLSetShortNameBehaviorRequest SetShortNameBehavior;
  7296. case 0x000980C8:
  7297. FSCCFSCTLSetZeroDataRequest SetZeroData;
  7298. case 0x00090100:
  7299. FSCCFSCTLSISCopyFileRequest SISCopyFile;
  7300. case 0x000900c4:
  7301. FSCCFSCTLSetSparseRequest SetSparse;
  7302. case 0x00098208:
  7303. FSCCFSCTLFileLevelTrimRequest FileLevelTrim
  7304. case 0x0009C280:
  7305. FSCCFSCTLSetIntegrityInformationRequest SetIntegrityInformation;
  7306. case 0x00094264:
  7307. FSCCFSCTLOffloadReadRequest OffloadRead;
  7308. case 0x00098268:
  7309. FSCCFSCTLOffloadWriteRequest OffloadWrite;
  7310. default:
  7311. BLOB(DataCount > FrameLength - FrameOffset ? FrameLength - FrameOffset : DataCount) FsctlData;
  7312. };
  7313. }
  7314. case Function == 0x0003 && DataCount > 0:
  7315. SecurityDescriptorRelative SecurityDescriptor;
  7316. case Function == 0x0008 && DataCount > 0:
  7317. [NextEntry = 1]
  7318. while options[NextEntry != 0]
  7319. {
  7320. struct NTTransactSetQuotaDataBuffer //NT_TRANSACT_QUERY_QUOTA
  7321. {
  7322. [NextEntry]
  7323. UINT32 NextEntryOffset;
  7324. UINT32 SidLength;
  7325. FILETIME ChangeTime;
  7326. SMBLargeInteger QuotaUsed;
  7327. SMBLargeInteger QuotaThreshold;
  7328. SMBLargeInteger QuotaLimit;
  7329. switch
  7330. {
  7331. case SIDLength > 0:
  7332. SID(false) Sid;
  7333. }
  7334. switch
  7335. {
  7336. case frameOffset < Property.NextEntry:
  7337. BLOB(Property.NextEntry - offset) Padding;
  7338. }
  7339. }
  7340. }
  7341. case DataCount > 0:
  7342. _struct UnknownDataBlock
  7343. {
  7344. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("SMB: Unknown NT Transaction Request Data, Function = 0x%X", Function)) NTTransactionDataEError;
  7345. BLOB(DataCount > FrameLength - FrameOffset ? FrameLength - FrameOffset : DataCount) Data;
  7346. };
  7347. }
  7348. switch
  7349. {
  7350. case frameOffset < frameLength && frameOffset < SMBBytesEndOffset:
  7351. BLOB(SMBBytesEndOffset - frameOffset > frameLength - frameOffset ? frameLength - frameOffset : SMBBytesEndOffset - frameOffset) Pad;
  7352. }
  7353. }
  7354. //FSCTL_SRV_COPYCHUNK Request List
  7355. struct ChunkDataList
  7356. {
  7357. SMBLargeInteger SourceOffset;
  7358. SMBLargeInteger DestinationOffset;
  7359. UINT32 CopyLength;
  7360. UINT32 Reserved;
  7361. }
  7362. struct SMBComNTTransactionSecondaryRequest
  7363. {
  7364. UINT8 WordCount = MUSTBeSetToTable( this, "0x12");
  7365. UINT8 Reserved1;
  7366. UINT16 Reserved2;
  7367. UINT32 TotalParameterCount;
  7368. UINT32 TotalDataCount;
  7369. UINT32 ParameterCount;
  7370. UINT32 ParameterOffset;
  7371. UINT32 ParamDisplacement;
  7372. UINT32 DataCount;
  7373. UINT32 DataOffset;
  7374. UINT32 DataDisplacement;
  7375. UINT8 Reserved = MUSTBeSetToTable( this, "0x00");
  7376. [SMBBytesEndOffset = frameOffset + 2 + ByteCount]
  7377. UINT16 ByteCount;
  7378. switch
  7379. {
  7380. case CurrentProtocolOffset < ParameterOffset:
  7381. BLOB(ParameterOffset - CurrentProtocolOffset) Pad1;
  7382. }
  7383. switch
  7384. {
  7385. case ParameterCount > 0:
  7386. BLOB(ParameterCount) Parameters;
  7387. }
  7388. switch
  7389. {
  7390. case CurrentProtocolOffset < DataOffset:
  7391. BLOB(DataOffset - CurrentProtocolOffset) Pad2;
  7392. }
  7393. switch
  7394. {
  7395. case DataCount > 0:
  7396. BLOB(DataCount) Data;
  7397. }
  7398. switch
  7399. {
  7400. case frameOffset < frameLength && frameOffset < SMBBytesEndOffset:
  7401. BLOB(SMBBytesEndOffset - frameOffset > frameLength - frameOffset ? frameLength - frameOffset : SMBBytesEndOffset - frameOffset) Pad;
  7402. }
  7403. }
  7404. Table SMBNTTransCreateOplockLevelTable( level )
  7405. {
  7406. switch( level )
  7407. {
  7408. case 0: "No oplock granted";
  7409. case 1: "Exclusive oplock granted";
  7410. case 2: "Batch oplock granted";
  7411. case 3: "Level II oplock granted";
  7412. default: FormatString("Undefined level(%d)", level);
  7413. }
  7414. }
  7415. [Property.SMBInterimResponse = true]
  7416. struct SMBComInterimResponseNTTransaction
  7417. {
  7418. [
  7419. conversation.SMBSubCommandPerFrame$[FrameNumber] = conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7420. SMBSubCommand = conversation.SMBSubCommandPerFrame$[FrameNumber],
  7421. SMBComSummary = SMBComSummary + ", " + SMBNTTransactFunctionTable(SMBSubCommand),
  7422. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7423. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber]
  7424. ]
  7425. UINT8 WordCount;
  7426. switch
  7427. {
  7428. case SMBFileID:
  7429. [
  7430. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7431. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7432. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7433. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7434. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7435. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  7436. ]
  7437. _struct BuildConversationForInterimResponse
  7438. {
  7439. UINT16 ByteCount;
  7440. };
  7441. default:
  7442. UINT16 ByteCount;
  7443. }
  7444. }
  7445. Table FileNotifyActionTable(action)
  7446. {
  7447. switch(action)
  7448. {
  7449. case 0x00000001: "FILE_ACTION_ADDED";
  7450. case 0x00000002: "FILE_ACTION_REMOVED";
  7451. case 0x00000003: "FILE_ACTION_MODIFIED";
  7452. case 0x00000004: "FILE_ACTION_RENAMED_OLD_NAME";
  7453. case 0x00000005: "FILE_ACTION_RENAMED_NEW_NAME";
  7454. case 0x00000006: "FILE_ACTION_ADDED_STREAM";
  7455. case 0x00000007: "FILE_ACTION_REMOVED_STREAM";
  7456. case 0x00000008: "FILE_ACTION_MODIFIED_STREAM";
  7457. default: "Unhandled Action";
  7458. }
  7459. }
  7460. struct SMBComNTTransactionResp
  7461. {
  7462. [
  7463. conversation.SMBSubCommandPerFrame$[FrameNumber] = conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],//get from SMB parent protocol conversation
  7464. SMBSubCommand = conversation.SMBSubCommandPerFrame$[FrameNumber],
  7465. SMBComSummary = SMBComSummary + ", " + SMBNTTransactFunctionTable(SMBSubCommand),
  7466. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7467. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber]
  7468. ]
  7469. // here 1 should be treated specially
  7470. // {2, 3, 4, 6, 7, 8} should have conversation def
  7471. UINT8 WordCount;
  7472. switch
  7473. {
  7474. case SMBFileID && (SMBSubCommand != 1):
  7475. [
  7476. conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7477. SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7478. Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  7479. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7480. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7481. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : ""),
  7482. conversation.SMBSubCommandPerFrame$[FrameNumber] = conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7483. SMBSubCommand = conversation.SMBSubCommandPerFrame$[FrameNumber]
  7484. ]
  7485. _struct BuildConversationForNTTransactResponse{};
  7486. }
  7487. UINT24 Reserved;
  7488. [Property.TotalParameterCount]
  7489. UINT32 TotalParameterCount;
  7490. UINT32 TotalDataCount;
  7491. UINT32 ParameterCount;
  7492. [ParameterEndOffset = ProtocolOffset + this + ParameterCount]
  7493. UINT32 ParameterOffset;
  7494. UINT32 ParamDisplacement;
  7495. UINT32 DataCount;
  7496. UINT32 DataOffset;
  7497. UINT32 DataDisplacement;
  7498. UINT8 SetupCount;
  7499. //
  7500. // Setup Words
  7501. //
  7502. [
  7503. conversation.SMBNTFunctionCodePerFrame$[FrameNumber] = Conversation.SMBFunctionCodeTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7504. SMBNTFunctionCode = conversation.SMBNTFunctionCodePerFrame$[FrameNumber]
  7505. ]/* Get from SMB Conversation*/
  7506. switch
  7507. {
  7508. case !(ConvID > 0):
  7509. _struct ReportWarning
  7510. {
  7511. ReportParserWarning( "SMB", "May not parse correctly when conversation off") ParserWarning;
  7512. UINT16 SetupWords[SetupCount];
  7513. };
  7514. case SMBSubCommand == 2 && SetupCount == 4:
  7515. struct IOCTLSetupWords
  7516. {
  7517. UINT16 Function = SMBNTTransactFunctionTable(this);
  7518. UINT32 FunctionCode;
  7519. UINT16 FileID;
  7520. }
  7521. case SMBSubCommand == 2:
  7522. _struct UnknownIOCTLSetupWords
  7523. {
  7524. UINT16 SetupWords[SetupCount];
  7525. }
  7526. case SetupCount > 0:
  7527. _struct ErrorSetupWords
  7528. {
  7529. switch
  7530. {
  7531. case IsValueNone(SMBSubCommand):
  7532. ReportParserWarning("SMB", "May not parse correctly when NTTransaction Request is missing") NTTransactionSetupWordsWarning;
  7533. default:
  7534. ReportParserError(ParserErrorProtocolClassWindows, "SMB", "SMB: Unknown NTTransaction Response SetupWords") NTTransactionSetupWordsError;
  7535. }
  7536. UINT16 SetupWords[SetupCount];
  7537. }
  7538. }
  7539. [SMBBytesEndOffset = frameOffset + 2 + ByteCount]
  7540. UINT16 ByteCount;
  7541. switch
  7542. {
  7543. case CurrentProtocolOffset < ParameterOffset:
  7544. BLOB(ParameterOffset - CurrentProtocolOffset) Pad1;
  7545. }
  7546. //
  7547. // This is NTTransaction Parameter Block
  7548. //
  7549. switch
  7550. {
  7551. case ParameterCount > 0 && ParamDisplacement == 0:
  7552. switch
  7553. {
  7554. case !(ConvID > 0):
  7555. _struct ReportWarning
  7556. {
  7557. ReportParserWarning( "SMB", "May not parse correctly when conversation off") ParserWarning;
  7558. BLOB(ParameterCount) Parameters;
  7559. };
  7560. case SMBSubCommand == 1:
  7561. case SMBSubCommand == 9:
  7562. struct CreateParameterBlock
  7563. {
  7564. UINT8 OplockLevel = SMBNTTransCreateOplockLevelTable(this);
  7565. UINT8 ResponseType = this ? "Response is extended" : "Response is NOT extended";
  7566. [
  7567. SMBFileID,
  7568. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7569. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  7570. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  7571. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  7572. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  7573. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  7574. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  7575. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  7576. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  7577. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  7578. ]
  7579. UINT16 FileID;
  7580. UINT32 CreateAction = SMBCreateActionTable(this);
  7581. UINT32 EaErrorOffset;
  7582. FILETIME CreationTime;
  7583. FILETIME LastAccessTime;
  7584. FILETIME LastWriteTime;
  7585. FILETIME ChangeTime;
  7586. SMBNTFileAttributes FileAttributes;
  7587. SMBLargeInteger AllocationSize;
  7588. SMBLargeInteger EndOfFile;
  7589. UINT16 FileType = SMBFileTypeTable(this);
  7590. switch(FileType)
  7591. {
  7592. case 1:
  7593. case 2:
  7594. SMBDeviceState DeviceState;
  7595. default:
  7596. UINT16 FileStatus
  7597. {
  7598. UINT16 NoEAs:1 = FormatString(" (%s) File or Directory has %sextended attributes (NO_EAS)", this.ToBitString, this ? "NO ":"");
  7599. UINT16 NoSubstreams:1 = FormatString("(%s) File or Directory has %ssubstreams (NO_SUBSTREAMS)", this.ToBitString, this ? "NO ":"");
  7600. UINT16 NoReparseTag:1 = FormatString("(%s) File or Directory is %sa reparse point (NO_REPARSETAG)", this.ToBitString, this ? "NOT ":"");
  7601. UINT16 Reserved:13 = FormatString(" (%s) Reserved", this.ToBitString);
  7602. };
  7603. }
  7604. BOOLEAN IsDirectory = this ? "Is a directory." : "NOT a directory.";
  7605. switch
  7606. {
  7607. case ResponseType != 0:
  7608. _struct NTRransCreaterExtendedResponse
  7609. {
  7610. GUID(FALSE) VolumeGuid;
  7611. UINT64 FileID;
  7612. UINT32 MaximalAccessRights;
  7613. UINT32 GuestMaximalAccessRights;
  7614. }
  7615. }
  7616. };
  7617. case SMBSubCommand == 4:
  7618. struct NotifyParameterBlock
  7619. {
  7620. [SMBNTTransactNextEntryOffset = 1]
  7621. while FindEntries[offset < Property.ParameterEndOffset && Property.SMBNTTransactNextEntryOffset]
  7622. {
  7623. struct FindEntry
  7624. {
  7625. [
  7626. StructBaseOffset = FrameOffset,
  7627. SMBNTTransactNextEntryOffset
  7628. ]
  7629. UINT32 NextEntryOffset;
  7630. UINT32 NotifyAction = FileNotifyActionTable(this);
  7631. UINT32 FileNameLength;
  7632. [Post.SMBComPramSummary = SMBComPramSummary + ", File = " + SMBFileNameValue]
  7633. SMBFileNameString(SMBUnicode, TRUE, FileNameLength, StructBaseOffset) FileName;
  7634. switch
  7635. {
  7636. case frameOffset < Property.SMBNTTransactNextEntryOffset:
  7637. BLOB(Property.SMBNTTransactNextEntryOffset - offset) Padding;
  7638. }
  7639. };
  7640. };
  7641. };
  7642. Case SMBSubCommand == 5:
  7643. BLOB(Property.TotalParameterCount) ParameterBlock;
  7644. case SMBSubCommand == 6:
  7645. struct QuerySecDescParameterBlock
  7646. {
  7647. UINT32 SecurityDescriptorLength; //#? The server response doesn't have a Parameter block.
  7648. };
  7649. case SMBSubCommand == 7:
  7650. struct GetUserQuotaParameterBlock
  7651. {
  7652. UINT32 ReturnedQuotaDataSize;
  7653. };
  7654. default:
  7655. switch
  7656. {
  7657. case SMBSubCommand >= 0x00:
  7658. _struct ErrorParameterBlock
  7659. {
  7660. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("Unknown SMB NT Transaction Parameter Block, SubCommand = 0x%X", SMBSubCommand)) SMBNTTransFunctionError;
  7661. BLOB(ParameterCount) Parameters;
  7662. };
  7663. default:
  7664. _struct WarningParameterBlock
  7665. {
  7666. ReportParserWarning("SMB", "May not parse correctly when NT Transaction request is missing") SMBParameterBlockWarning;
  7667. BLOB(ParameterCount) Parameters;
  7668. };
  7669. }
  7670. }
  7671. }
  7672. switch
  7673. {
  7674. case CurrentProtocolOffset < DataOffset:
  7675. BLOB(DataOffset - CurrentProtocolOffset) Pad2;
  7676. }
  7677. //
  7678. // This is NTTransaction Data Block
  7679. //
  7680. [
  7681. PayloadStart(
  7682. NetworkDirection, /* direction */
  7683. 0, /* id */
  7684. DataDisplacement, /* sequence token */
  7685. DataDisplacement + DataCount, /* next sequence token */
  7686. 0, /* total payload length */
  7687. ParamDisplacement == 0 && DataDisplacement == 0, /* is first */
  7688. (TotalParameterCount == ParamDisplacement + ParameterCount) && (TotalDataCount == DataDisplacement + DataCount), /* is last */
  7689. RssmblyIndStartBit+RssmblyIndEndBit+RssmblySequenceBit+RssmblySelfBit, //has start and end indication
  7690. 0x0000, /* Properties... */
  7691. SMBResponse,
  7692. 0x0000, /* Properties... */
  7693. ""
  7694. )
  7695. ]
  7696. switch
  7697. {
  7698. case DataDisplacement == 0 && DataCount > 0:
  7699. switch
  7700. {
  7701. case !(ConvID > 0):
  7702. _struct ReportWarning
  7703. {
  7704. ReportParserWarning( "SMB", "May not parse correctly when conversation off") ParserWarning;
  7705. BLOB(DataCount > FrameLength - FrameOffset ? FrameLength - FrameOffset : DataCount) Data;
  7706. };
  7707. case SMBSubCommand == 2:
  7708. _Struct FSCTLDataStruct
  7709. {
  7710. switch( SMBNTFunctionCode )
  7711. {
  7712. case 0x00144064://FSCTL_SRV_ENUMERATE_SNAPSHOTS
  7713. SMBFsctlSrvenumErateSnapShots FsctlSrvenumErateSnapShotsResponseData;
  7714. case 0x00140078://FSCTL_SRV_REQUEST_RESUME_KEY
  7715. _struct FSCTL_SRV_REQUEST_RESUME_KEYResponseData
  7716. {
  7717. BLOB(24) CopychunkResumeKey;
  7718. UINT32 ContextLength;
  7719. switch
  7720. {
  7721. case DataCount > 28: BLOB(DataCount - 28) Context;
  7722. }
  7723. }
  7724. case 0x001440F2://FSCTL_SRV_COPYCHUNK
  7725. _struct FSCTL_SRV_COPYCHUNKResponseData
  7726. {
  7727. UINT32 ChunksWritten;
  7728. UINT32 ChunkBytesWritten;
  7729. UINT32 TotalBytesWritten;
  7730. }
  7731. case 0x000900c0:
  7732. FSCCFSCTLCreateOrGetObjectIDResponse CreateOrGetObjectID;
  7733. case 0x00090060:
  7734. FSCCFSCTLFilesystemGetStatisticsResponse FilesystemGetStatistics;
  7735. case 0x0009008f:
  7736. FSCCFSCTLFindFilesBySidResponse FindFilesBySid;
  7737. case 0x0009003c:
  7738. FSCCFSCTLGetCompressionResponse GetCompression;
  7739. case 0x00090064:
  7740. FSCCFSCTLGetNtfsVolumeDataResponse GetNtfsVolumeData;
  7741. case 0x0009009c:
  7742. FSCCFSCTLGetObjectIDResponse GetObjectID;
  7743. case 0x000900a8:
  7744. FSCCFSCTLGetReparsePointResponse GetReparsePoint;
  7745. case 0x00090073:
  7746. FSCCFSCTLGetRetrievalPointersResponse GetRetrievalPointers;
  7747. case 0x00090078:
  7748. FSCCFSCTLIsVolumeDirtyResponse IsVolumeDirty;
  7749. case 0x001400e8:
  7750. FSCCFSCTLLMRGetLinkTrackingInformationResponse LMRGetLinkTrackingInformation;
  7751. case 0x0011400c:
  7752. FSCCFSCTLPipePeekResponse PipePeek;
  7753. case 0x0011c017:
  7754. FSCCFSCTLPipetransceiveResponse( DataCount ) Pipetransceive;
  7755. case 0x00090058:
  7756. FSCCFSCTLQueryFatBPBResponse QueryFatBPB;
  7757. case 0x000940cf:
  7758. FSCCFSCTLQueryAllocatedRangesResponse( DataCount ) QueryAllocatedRanges;
  7759. case 0x00090138:
  7760. FSCCFSCTLQuerySparingInfoResponse QuerySparingInfo;
  7761. case 0x000900eb:
  7762. FSCCFSCTLReadFileUSNDataResponse ReadFileUSNData;
  7763. case 0x000900ef:
  7764. FSCCFSCTLWriteUSNCloseRecordResponse WriteUSNCloseRecord;
  7765. case 0x0009027c:
  7766. FSCCFSCTLGetIntegrityInformationResponse GetIntegrityInformation;
  7767. case 0x00098208:
  7768. FSCCFSCTLFileLevelTrimResponse FileLevelTrim;
  7769. case 0x0009013c:
  7770. FSCCFSCTLQueryOnDiskVolumeInfoResponse QueryOnDiskVolumeInfo;
  7771. case 0x000900D7:
  7772. FSCCFSCTLDecryptionStatusBuffer DecryptionStatusBuffer;
  7773. case 0x00094264:
  7774. FSCCFSCTLOffloadReadResponse OffloadRead;
  7775. case 0x00098268:
  7776. FSCCFSCTLOffloadWriteResponse OffloadWrite;
  7777. default:
  7778. BLOB(DataCount) IoctlData;
  7779. }
  7780. }
  7781. case SMBSubCommand == 6:
  7782. SecurityDescriptorRelative SecurityDescriptor;
  7783. case SMBSubCommand == 7:
  7784. struct UserQuotaData
  7785. {
  7786. [Local.NextEntryOffset = 1]
  7787. while QuotaDatas[offset < FrameLength && Local.NextEntryOffset]
  7788. {
  7789. [Local.NextEntryOffset]
  7790. UINT32 NextEntryOffset;
  7791. UINT32 SIDLength;
  7792. FILETIME ChangeTime;
  7793. SMBLargeInteger QuotaUsed;
  7794. SMBLargeInteger QuotaThreshold;
  7795. SMBLargeInteger QuotaLimit;
  7796. switch
  7797. {
  7798. case SIDLength > 0:
  7799. SID(FALSE) UserSID;
  7800. }
  7801. };
  7802. };
  7803. default:
  7804. switch
  7805. {
  7806. case SMBSubCommand >= 0x00:
  7807. _struct ErrorParameterBlock
  7808. {
  7809. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("Unknown SMB NT Transaction Data Block, SubCommand = 0x%X", SMBSubCommand)) SMBNTTransFunctionError;
  7810. BLOB(DataCount) Data;
  7811. };
  7812. default:
  7813. _struct WarningParameterBlock
  7814. {
  7815. ReportParserWarning("SMB", "May not parse correctly when NT Transaction request is missing") SMBParameterBlockWarning;
  7816. BLOB(DataCount) Data;
  7817. };
  7818. }
  7819. }
  7820. case DataDisplacement > 0 && DataCount > 0:
  7821. //
  7822. // This is a Fragmented NTTtransact Frame
  7823. //
  7824. [SMBContinuation = TRUE, SMBComPramSummary = SMBComPramSummary + " - Continued Response"]
  7825. BLOB(DataCount > FrameLength - FrameOffset ? FrameLength - FrameOffset : DataCount) Data;
  7826. }
  7827. switch
  7828. {
  7829. case frameOffset < frameLength && frameOffset < SMBBytesEndOffset:
  7830. BLOB(SMBBytesEndOffset - frameOffset > frameLength - frameOffset ? frameLength - frameOffset : SMBBytesEndOffset - frameOffset) Pad;
  7831. }
  7832. }
  7833. //FSCTL_SRV_ENUMERATE_SNAPSHOTS
  7834. struct SMBFsctlSrvenumErateSnapShots
  7835. {
  7836. UINT32 NumberOfSnapShots = FormatString( "%u", this );
  7837. UINT32 NumberOfSnapShotsReturned = FormatString( "%u", this );
  7838. UINT32 SnapShotArraySize = FormatString( "%u", this );
  7839. Switch
  7840. {
  7841. Case NumberOfSnapShotsReturned > 0:
  7842. Struct SnapShotMultiSZ = FormatString( "%u Snapshots", NumberOfSnapShotsReturned )
  7843. {
  7844. While Snapshots[!(UINT16(FrameData, Offset) == 0x0000)]
  7845. {
  7846. [DataFieldByteOrder = LittleEndian]
  7847. UnicodeString Snapshot;
  7848. }
  7849. Struct SnapshotListTerminator = NullTerminator.ToString
  7850. {
  7851. UINT16 NullTerminator = "NULL";
  7852. }
  7853. }
  7854. }
  7855. }
  7856. //0xA4: There is no server SMB_COM_NT_CANCEL response.
  7857. struct SMBComNTCancelRequest
  7858. {
  7859. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  7860. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  7861. UINT8 Reserved;
  7862. }
  7863. struct SMBComNTRenameRequest
  7864. {
  7865. UINT8 WordCount = MUSTBeSetToTable( this, "0x04");
  7866. SMBFileAttributes SearchAttributes;
  7867. UINT16 InformationLevel = FormatString("%s %d(0x%04X)", SMBNTRenameInformationLevel(this), this, this);
  7868. UINT32 ClusterCount;
  7869. UINT16 ByteCount;
  7870. UINT8 OldFileNameFormat = SMBBufferStringFormatsTable(this);
  7871. [Post.SMBComPramSummary = ", " + SMBFileNameValue]
  7872. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) OldFileName;
  7873. UINT8 NewFileNameFormat;
  7874. [Post.SMBComPramSummary = SMBComPramSummary + " To " + SMBFileNameValue]
  7875. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) NewFileName;
  7876. }
  7877. struct SMBComNTRenameResp
  7878. {
  7879. UINT8 WordCount = MUSTBeSetToTable( this, "0x00");
  7880. UINT16 ByteCount = MUSTBeSetToTable( this, "0x0000");
  7881. }
  7882. Table SMBTrans2SubCommandTable(command)
  7883. {
  7884. //0x00 TRANS2_OPEN2
  7885. //0x01 TRANS2_FIND_FIRST2
  7886. //0x02 TRANS2_FIND_NEXT2
  7887. //0x03 TRANS2_QUERY_FS_INFORMATION
  7888. //0x04 TRANS_SET_FS_INFORMATION
  7889. //0x05 TRANS2_QUERY_PATH_INFORMATION
  7890. //0x06 TRANS2_SET_PATH_INFORMATION
  7891. //0x07 TRANS2_QUERY_FILE_INFORMATION
  7892. //0x08 TRANS2_SET_FILE_INFORMATION
  7893. //0x09 TRANS2_FSCTL
  7894. //0x0A TRANS2_IOCTL2
  7895. //0x0B TRANS2_FIND_NOTIFY_FIRST
  7896. //0x0C TRANS2_FIND_NOTIFY_NEXT
  7897. //0x0D TRANS2_CREATE_DIRECTORY
  7898. //0x0E TRANS2_SESSION_SETUP
  7899. //0x0F TRANS2_QUERY_FS_INFORMATION_FID
  7900. //0x10 TRANS2_GET_DFS_REFERRAL
  7901. //0x11 TRANS2_REPORT_DFS_INCONSISTENCY
  7902. //0x09 ~ 0x0C: NOT used by Windows NT Server and later.
  7903. switch(command)
  7904. {
  7905. case 0x00: "Open2";
  7906. case 0x01: "Find First2";
  7907. case 0x02: "Find Next2";
  7908. case 0x03: "Query FS Info";
  7909. case 0x04: "Set Fs Info";
  7910. case 0x05: "Query Path Info";
  7911. case 0x06: "Set Path Info";
  7912. case 0x07: "Query File Info";
  7913. case 0x08: "Set File Info";
  7914. case 0x09: "FSctl";
  7915. case 0x0A: "IOctl2";
  7916. case 0x0B: "Find Notify First";
  7917. case 0x0C: "Find Notify Next";
  7918. case 0x0D: "Create Directory";
  7919. case 0x0E: "Session Setup";
  7920. case 0x0F: "Query FS Info Fid";
  7921. case 0x10: "Get Dfs Referral";
  7922. case 0x11: "Report Dfs Inconsistency";
  7923. default: "Unhandled Transact2 Subcommand";
  7924. }
  7925. }
  7926. // used for 0x03 TRANS2_QUERY_FS_INFORMATION (all)
  7927. // and 0x0F TRANS2_QUERY_FS_INFORMATION_FID (the first 7)
  7928. Table SMBTrans2QueryFSInfoLevelTable(level)
  7929. {
  7930. //0x0001 SMB_INFO_ALLOCATION
  7931. //0x0002 SMB_INFO_VOLUME
  7932. //0x0101 SMB_QUERY_FS_LABEL_INFO
  7933. //0x0102 SMB_QUERY_FS_VOLUME_INFO
  7934. //0x0103 SMB_QUERY_FS_SIZE_INFO
  7935. //0x0104 SMB_QUERY_FS_DEVICE_INFO
  7936. //0x0105 SMB_QUERY_FS_ATTRIBUTE_INFO
  7937. //0x0200 SMB_UNIX_QUERY_FS_INFO
  7938. //0x0301: SMB_Mac_Query_FS_Info
  7939. //0x03E9: FileFsVolumeInformation
  7940. //0x03EA: FileFsLabelInformation
  7941. //0x03EB: FileFsSizeInformation
  7942. //0x03EC: FileFsDeviceInformation
  7943. //0x03ED: FileFsAttributeInformation
  7944. //0x03EE: FileFsControlInformation
  7945. //0x03EF: FileFsFullSizeInformation
  7946. //0x03F0: FileFsObjectIdInformation
  7947. //0x03F1: FileFsDriverPathInformation
  7948. //0x03F2: FileFsVolumeFlagsInformation
  7949. switch(level)
  7950. {
  7951. case 0x0001: "Query Info Allocation";
  7952. case 0x0002: "Query Info Volume";
  7953. case 0x0101: "Query FS Label Info (NT)";
  7954. case 0x0102: "Query FS Volume Info (NT)";
  7955. case 0x0103: "Query FS Size Info (NT)";
  7956. case 0x0104: "Query FS Device Info (NT)";
  7957. case 0x0105: "Query FS Attribute Info (NT)";
  7958. case 0x0200: "Unix Query FS Info";
  7959. case 0x0301: "Mac Query FS Info";
  7960. case 0x03E9: "Query FS Volume Info";
  7961. case 0x03EA: "Query FS Label Info";
  7962. case 0x03EB: "Query FS Size Info";
  7963. case 0x03EC: "Query FS Device Info";
  7964. case 0x03ED: "Query FS Attribute Info";
  7965. case 0x03EE: "Query FS Control Info";
  7966. case 0x03EF: "Query Full FS Size Info";
  7967. case 0x03F0: "Object ID Info";
  7968. case 0x03F1: "Query FS Drive Path Info";
  7969. case 0x03F2: "Query FS Volume Flags Info";
  7970. default: FormatString("(0x%04X) UnknownValue",level );
  7971. }
  7972. }
  7973. Table SMBTrans2FindInfoLevelTable(level)
  7974. {
  7975. switch(level)
  7976. {
  7977. case 0x0001: "Standard"; //SMB_INFO_STANDARD
  7978. case 0x0002: "Query EA Size"; //SMB_INFO_QUERY_EA_SIZE
  7979. case 0x0003: "Query EA's From List"; //SMB_INFO_QUERY_EAS_FROM_LIST
  7980. case 0x0004: "Query All EA's"; //SMB_INFO_QUERY_ALL_EAS
  7981. case 0x0101: "Directory Info (NT)"; //SMB_FIND_FILE_DIRECTORY_INFO
  7982. case 0x0102: "Full Directory Info (NT)"; //SMB_FIND_FILE_FULL_DIRECTORY_INFO
  7983. case 0x0103: "Names Info (NT)"; //SMB_FIND_FILE_NAMES_INFO
  7984. case 0x0104: "Both Directory Info (NT)"; //SMB_FIND_FILE_BOTH_DIRECTORY_INFO
  7985. // case 0x0105: "OLE Directory Info"; //SMB_FIND_FILE_OLE_DIRECTORY_INFO
  7986. case 0x0105: "ID Full Directory Info"; //SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO
  7987. case 0x0106: "ID Both Directory Info"; // SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO
  7988. default: FormatString("%d(0x%04X)", level, level);
  7989. }
  7990. }
  7991. Table SMBTrans2QueryFileInfoLevelTable(level)
  7992. {
  7993. // 0x0001 SMB_INFO_STANDARD
  7994. // 0x0002 SMB_INFO_QUERY_EA_SIZE
  7995. // 0x0003 SMB_INFO_QUERY_EAS_FROM_LIST
  7996. // 0x0004 SMB_INFO_QUERY_ALL_EAS
  7997. // 0x0005 SMB_INFO_QUERY_FULL_NAME
  7998. // 0x0006 SMB_INFO_IS_NAME_VALID
  7999. // 0x0101 SMB_QUERY_FILE_BASIC_INFO
  8000. // 0x0102 SMB_QUERY_FILE_STANDARD_INFO
  8001. // 0x0103 SMB_QUERY_FILE_EA_INFO
  8002. // 0x0104 SMB_QUERY_FILE_NAME_INFO
  8003. // 0x0105 SMB_QUERY_FILE_ALLOCATION_INFO
  8004. // 0x0106 SMB_QUERY_FILE_END_OF_FILEINFO
  8005. // 0x0107 SMB_QUERY_FILE_ALL_INFO
  8006. // 0x0108 SMB_QUERY_FILE_ALT_NAME_INFO
  8007. // 0x0109 SMB_QUERY_FILE_STREAM_INFO
  8008. // 0x010A SMB_QUERY_FILE_OLE_ALL_INFO
  8009. // 0x010B SMB_QUERY_FILE_COMPRESSION_INFO
  8010. // 0x010C SMB_QUERY_FILE_OLE_INFO
  8011. // 0x0200 SMB_QUERY_FILE_UNIX_BASIC
  8012. // 0x0201 SMB_QUERY_FILE_UNIX_LINK
  8013. // 0x03E8 SMB_INFO_PASSTHROUGH
  8014. //
  8015. // Notes: If the InformationLevel field is greater than SMB_INFO_PASSTHROUGH (1000 decimal),
  8016. // the remainder of the InformationLevel field minus 1000 specifies the file information being requested.
  8017. // Dec Dec+ Hex Info level
  8018. // 1 1001 0x03E9 FileDirectoryInformation
  8019. // 2 1002 0x03EA FileFullDirectoryInformation
  8020. // 3 1003 0x03EB FileBothDirectoryInformation
  8021. // 4 1004 0x03EC FileBasicInformation
  8022. // 5 1005 0x03ED FileStandardInformation
  8023. // 6 1006 0x03EE FileInternalInformation
  8024. // 7 1007 0x03EF FileEaInformation
  8025. // 8 1008 0x03F0 FileAccessInformation
  8026. // 9 1009 0x03F1 FileNameInformation
  8027. // 10 1010 0x03F2 FileRenameInformation
  8028. // 11 1011 0x03F3 FileLinkInformation
  8029. // 12 1012 0x03F4 FileNamesInformation
  8030. // 13 1013 0x03F5 FileDispositionInformation
  8031. // 14 1014 0x03F6 FilePositionInformation
  8032. // 15 1015 0x03F7 FileFullEaInformation
  8033. // 16 1016 0x03F8 FileModeInformation
  8034. // 17 1017 0x03F9 FileAlignmentInformation
  8035. // 18 1018 0x03FA FileAllInformation
  8036. // 19 1019 0x03FB FileAllocationInformation
  8037. // 20 1020 0x03FC FileEndOfFileInformation
  8038. // 21 1021 0x03FD FileAlternateNameInformation
  8039. // 22 1022 0x03FE FileStreamInformation
  8040. // 23 1023 0x03FF FilePipeInformation
  8041. // 24 1024 0x0400 FilePipeLocalInformation
  8042. // 25 1025 0x0401 FilePipeRemoteInformation
  8043. // 26 1026 0x0402 FileMailslotQueryInformation
  8044. // 27 1027 0x0403 FileMailslotSetInformation
  8045. // 28 1028 0x0404 FileCompressionInformation
  8046. // 29 1029 0x0405 FileObjectIdInformation
  8047. // 30 1030 0x0406 FileCompletionInformation
  8048. // 31 1031 0x0407 FileMoveClusterInformation
  8049. // 32 1032 0x0408 FileQuotaInformation
  8050. // 33 1033 0x0409 FileReparsePointInformation
  8051. // 34 1034 0x040A FileNetworkOpenInformation
  8052. // 35 1035 0x040B FileAttributeTagInformation
  8053. // 36 1036 0x040C FileTrackingInformation
  8054. // 37 1037 0x040D FileIdBothDirectoryInformation
  8055. // 38 1038 0x040E FileIdFullDirectoryInformation
  8056. // 39 1039 0x040F FileValidDataLengthInformation
  8057. // 40 1040 0x0410 FileShortNameInformation
  8058. switch(level)
  8059. {
  8060. case 0x0001: "Query Standard Info";
  8061. case 0x0002: "Query EA Size";
  8062. case 0x0003: "Query EAs From List";
  8063. case 0x0004: "Query All EAs";
  8064. case 0x0005: "Query Full Name";
  8065. case 0x0006: "Info Is Name Valid";
  8066. case 0x0101: "Query File Basic Info";
  8067. case 0x0102: "Query File Standard Info";
  8068. case 0x0103: "Query File EA Info";
  8069. case 0x0104: "Query File Name Info";
  8070. case 0x0105: "Query File Allocation Info";
  8071. case 0x0106: "Query File End of File Info";
  8072. case 0x0107: "Query File All Info";
  8073. case 0x0108: "Query File Alternate Name Info";
  8074. case 0x0109: "Query File Stream Info";
  8075. case 0x010A: "Query File OLE All Info";
  8076. case 0x010B: "Query File Compression Info";
  8077. case 0x010C: "Query File OLE Info";
  8078. case 0x0200: "Query File Unix Basic";
  8079. case 0x0201: "Query File Unix Link";
  8080. // Larger than 1000 (0x03E8 SMB_INFO_PASSTHROUGH)
  8081. case 0x03E9: "Query File Dir Info";
  8082. case 0x03EA: "Query File Full Dir Info";
  8083. case 0x03EB: "Query File Both Dir Info";
  8084. case 0x03EC: "Query File Basic Info";
  8085. case 0x03ED: "Query File Standard Info";
  8086. case 0x03EE: "Query File Internal Info";
  8087. case 0x03EF: "Query File EA Info";
  8088. case 0x03F0: "Query File Access Info";
  8089. case 0x03F1: "Query File Name Info";
  8090. case 0x03F2: "Query File Rename Info";
  8091. case 0x03F3: "Query File Link Info";
  8092. case 0x03F4: "Query File Names Info";
  8093. case 0x03F5: "Query File Disposition Info";
  8094. case 0x03F6: "Query File Position Info";
  8095. case 0x03F7: "Query File Full EA Info";
  8096. case 0x03F8: "Query File Mode Info";
  8097. case 0x03F9: "Query File Alignment Info";
  8098. case 0x03FA: "Query File All Info";
  8099. case 0x03FB: "Query File Allocation Info";
  8100. case 0x03FC: "Query File End of File Info";
  8101. case 0x03FD: "Query File Alternate Name Info";
  8102. case 0x03FE: "Query File Stream Info";
  8103. case 0x03FF: "Query File Pipe Info";
  8104. case 0x0400: "Query File Pipe Local Info";
  8105. case 0x0401: "Query File Pipe Remote Info";
  8106. case 0x0402: "Query File Mailslot Query Info";
  8107. case 0x0403: "Query File Mailslot Set Info";
  8108. case 0x0404: "Query File Compression Info";
  8109. case 0x0405: "Query File ObjectID Info";
  8110. case 0x0406: "Query File Completion Info";
  8111. case 0x0407: "Query File Move Cluster Info";
  8112. case 0x0408: "Query File Quota Info";
  8113. case 0x0409: "Query File Reparse Point Info";
  8114. case 0x040A: "Query File Network Open Info";
  8115. case 0x040B: "Query File Attribute Tag Info";
  8116. case 0x040C: "Query File Tracking Info";
  8117. case 0x040D: "Query ID Both Dir Info";
  8118. case 0x040E: "Query ID Full Dir Info";
  8119. case 0x040F: "Query Valid DataLength Info";
  8120. case 0x0410: "Query ShortName Info";
  8121. case 0x0411: "Query File Maximum Info";
  8122. default: FormatString("0x%04X", level);
  8123. }
  8124. }
  8125. Table SMBTrans2SetFileInfoLevelTable(level)
  8126. {
  8127. //0x0001 SMB_INFO_STANDARD
  8128. //0x0002 SMB_INFO_SET_EAS
  8129. //0x0101 SMB_SET_FILE_BASIC_INFO
  8130. //0x0102 SMB_SET_FILE_DISPOSITION_INFO
  8131. //0x0103 SMB_SET_FILE_ALLOCATION_INFO
  8132. //0x0104 SMB_SET_FILE_END_OF_FILE_INFO
  8133. //0x0105 SMB_SET_FILE_OLE_CLASSID_INFO
  8134. //0x0106 SMB_SET_FILE_OLE_STATE_BITS_INFO
  8135. //0x0107 SMB_SET_FILE_OBJECTID_INFO
  8136. //0x0108 SMB_SET_FILE_CONTENT_INDEX_INFO
  8137. //0x0109 SMB_SET_FILE_INHERIT_CONTENT_INDEX_INFO
  8138. //0x010A SMB_SET_FILE_OLE_INFO
  8139. //0x0200 SMB_SET_FILE_UNIX_BASIC
  8140. //0x0201 SMB_SET_FILE_UNIX_LINK
  8141. //0x0203 SMB_SET_FILE_UNIX_HLINK
  8142. // 4 1004 0x03EC FileBasicInformation
  8143. //10 1010 0x03F2 FileRenameInformation
  8144. //13 1013 0x03F5 FileDispositionInformation
  8145. //14 1014 0x03F6 FilePositionInformation
  8146. //16 1016 0x03F8 FileModeInformation
  8147. //19 1019 0x03FB FileAllocationInformation
  8148. //20 1020 0x03FC FileEndOfFileInformation
  8149. //23 1023 0x03FF FilePipeInformation
  8150. //25 1025 0x0401 FilePipeRemoteInformation
  8151. //29 1029 0x0405 FileObjectIdInformation
  8152. //32 1032 0x0408 FileQuotaInformation
  8153. //39 1039 0x040F FileValidDataLengthInformation
  8154. //40 1040 0x0410 FileNameInformation
  8155. switch(level)
  8156. {
  8157. case 0x0001: "Set Standard Info";
  8158. case 0x0002: "Set EA Size";
  8159. case 0x0101: "Set File Basic Info";
  8160. case 0x0102: "Set File Disposition Info";
  8161. case 0x0103: "Set File Allocation Info";
  8162. case 0x0104: "Set File EOF Info";
  8163. case 0x0105: "Set File Ole Classid Info";
  8164. case 0x0106: "Set File Ole State Bits Info";
  8165. case 0x0107: "Set File ObjectID Info";
  8166. case 0x0108: "Set File Content Index Info";
  8167. case 0x0109: "Set File Inherit Content Index Info";
  8168. case 0x010A: "Set File Ole Info";
  8169. case 0x0200: "Set File Unix Basic";
  8170. case 0x0201: "Set File Unix Link";
  8171. case 0x0203: "Set File Unix HLink";
  8172. // Larger than 1000 (0x03E8 SMB_INFO_PASSTHROUGH)
  8173. case 0x03EC: "Set File Basic Info";
  8174. case 0x03F2: "Set File Rename Info";
  8175. case 0x03F3: "Set File Link Info";
  8176. case 0x03F5: "Set File Disposition Info";
  8177. case 0x03F6: "Set File Position Info";
  8178. case 0x03F8: "Set File Mode Info";
  8179. case 0x03FB: "Set File Allocation Info";
  8180. case 0x03FC: "Set File End of File Info";
  8181. case 0x03FF: "Set File Pipe Info";
  8182. case 0x0401: "Set File Pipe Remote Info";
  8183. case 0x0405: "Set File ObjectID Info";
  8184. case 0x0408: "Set File Quota Info";
  8185. case 0x040F: "Set Valid DataLength Info";
  8186. case 0x0410: "Set Name Info";
  8187. default: FormatString("0x%04X", level);
  8188. }
  8189. }
  8190. Table SMBTrans2InfoLevelTable(subCommand, level)
  8191. {
  8192. switch(subCommand)
  8193. {
  8194. case 0x01: SMBTrans2FindInfoLevelTable(level);
  8195. case 0x02: SMBTrans2FindInfoLevelTable(level);
  8196. case 0x03: SMBTrans2QueryFSInfoLevelTable(level);
  8197. case 0x04: SMBTrans2QueryFSInfoLevelTable(level);
  8198. case 0x05: SMBTrans2QueryFileInfoLevelTable(level);
  8199. case 0x06: SMBTrans2SetFileInfoLevelTable(level);
  8200. case 0x07: SMBTrans2QueryFileInfoLevelTable(level);
  8201. case 0x08: SMBTrans2SetFileInfoLevelTable(level);
  8202. case 0x0F: SMBTrans2QueryFSInfoLevelTable(level);
  8203. default: "Unhandled Transact2 Information Level";
  8204. }
  8205. }
  8206. //netmon2 code, smbtab.c, line 1073
  8207. Table SMBT2IOCtlCategoryTable(value)
  8208. {
  8209. switch(value)
  8210. {
  8211. case 1: FormatString("Comm Device %d(0x%X)", value, value);
  8212. case 5: FormatString("Printer Device %d(0x%X)", value, value);
  8213. case 11: FormatString("Character Device %d(0x%X)", value, value);
  8214. default: FormatString("Unknown Device %d(0x%X)", value, value);
  8215. }
  8216. }
  8217. //netmon2 code, smbtab.c, line 1084
  8218. Table SMBT2IOCtlFunctionTable(category, value)
  8219. {
  8220. switch
  8221. {
  8222. case category == 0x01 && value == 0x41: FormatString("Set baud rate %d(0x%X)", value, value);
  8223. case category == 0x01 && value == 0x42: FormatString("Set line control register %d(0x%X)", value, value);
  8224. case category == 0x01 && value == 0x43: FormatString("Set flow control characters %d(0x%X)", value, value);
  8225. case category == 0x01 && value == 0x44: FormatString("Transmit immediate %d(0x%X)", value, value);
  8226. case category == 0x01 && value == 0x45: FormatString("Set break off %d(0x%X)", value, value);
  8227. case category == 0x01 && value == 0x46: FormatString("Set modem control register %d(0x%X)", value, value);
  8228. case category == 0x01 && value == 0x4b: FormatString("Set break on %d(0x%X)", value, value);
  8229. case category == 0x01 && value == 0x4c: FormatString("Stop transmit %d(0x%X)", value, value);
  8230. case category == 0x01 && value == 0x4d: FormatString("Start transmit %d(0x%X)", value, value);
  8231. case category == 0x01 && value == 0x4e: FormatString("Set I/O behavior %d(0x%X)", value, value);
  8232. case category == 0x01 && value == 0x52: FormatString("Set communications event %d(0x%X)", value, value);
  8233. case category == 0x01 && value == 0x53: FormatString("Set device control block infomation %d(0x%X)", value, value);
  8234. case category == 0x01 && value == 0x61: FormatString("Return current baud rate %d(0x%X)", value, value);
  8235. case category == 0x01 && value == 0x62: FormatString("Return line control register %d(0x%X)", value, value);
  8236. case category == 0x01 && value == 0x63: FormatString("Return flow control characters %d(0x%X)", value, value);
  8237. case category == 0x01 && value == 0x65: FormatString("Return current line status %d(0x%X)", value, value);
  8238. case category == 0x01 && value == 0x66: FormatString("Return modem control register %d(0x%X)", value, value);
  8239. case category == 0x01 && value == 0x67: FormatString("Return current modem status %d(0x%X)", value, value);
  8240. case category == 0x01 && value == 0x68: FormatString("Return number of characters in input queue %d(0x%X)", value, value);
  8241. case category == 0x01 && value == 0x69: FormatString("Return number of characters in output queue %d(0x%X)", value, value);
  8242. case category == 0x01 && value == 0x6b: FormatString("Return communications status %d(0x%X)", value, value);
  8243. case category == 0x01 && value == 0x6d: FormatString("Return communications error %d(0x%X)", value, value);
  8244. case category == 0x01 && value == 0x6e: FormatString("Return I/O control setting %d(0x%X)", value, value);
  8245. case category == 0x01 && value == 0x72: FormatString("Return communication event mask %d(0x%X)", value, value);
  8246. case category == 0x01 && value == 0x73: FormatString("Return device control information %d(0x%X)", value, value);
  8247. case category == 0x05 && value == 0x42: FormatString("Set frame control %d(0x%X)", value, value);
  8248. case category == 0x05 && value == 0x44: FormatString("Set infinite retry %d(0x%X)", value, value);
  8249. case category == 0x05 && value == 0x46: FormatString("Initialize printer %d(0x%X)", value, value);
  8250. case category == 0x05 && value == 0x48: FormatString("Activate font %d(0x%X)", value, value);
  8251. case category == 0x05 && value == 0x62: FormatString("Return frame control %d(0x%X)", value, value);
  8252. case category == 0x05 && value == 0x64: FormatString("Return infinite retry %d(0x%X)", value, value);
  8253. case category == 0x05 && value == 0x66: FormatString("Return printer status %d(0x%X)", value, value);
  8254. case category == 0x05 && value == 0x69: FormatString("Query active font %d(0x%X)", value, value);
  8255. case category == 0x05 && value == 0x6a: FormatString("Verify font %d(0x%X)", value, value);
  8256. case category == 0x0B && value == 0x01: FormatString("Flush input buffer %d(0x%X)", value, value);
  8257. case category == 0x0B && value == 0x02: FormatString("Flush output buffer %d(0x%X)", value, value);
  8258. case category == 0x0B && value == 0x60: FormatString("Query monitor support %d(0x%X)", value, value);
  8259. default: FormatString("Unknown Function %d(0x%X)", value, value);
  8260. }
  8261. }
  8262. struct SMBComTransaction2Request
  8263. {
  8264. UINT8 WordCount;
  8265. UINT16 TotalParameterCount;
  8266. UINT16 TotalDataCount;
  8267. UINT16 MaxParameterCount;
  8268. UINT16 MaxDataCount;
  8269. UINT8 MaxSetupCount ;
  8270. UINT8 Reserved;
  8271. // reference CIFS-TR-1p00_FINAL.pdf , page 44
  8272. [DataFieldByteOrder = LittleEndian]
  8273. UINT16 Flags = Disconnect ? "Disconnect TID" : "Do NOT disconnect TID"
  8274. {
  8275. UINT16 Disconnect:1 = FormatString("(%s) %s", This.ToBitString, this ? "Disconnect TID" : "Do NOT disconnect TID");
  8276. UINT16 NoResponse:1 = FormatString("(%s) %s", This.ToBitString, this ? "MUST NOT send a response back to the client" : " ");
  8277. UINT16 Reserved:14 = FormatString(" (%s) Reserved", This.ToBitString);
  8278. };
  8279. UINT32 Timeout = FormatString("%d sec(s)",this);
  8280. UINT16 Reserved2;
  8281. UINT16 ParameterCount;
  8282. UINT16 ParameterOffset;
  8283. UINT16 DataCount;
  8284. UINT16 DataOffset;
  8285. UINT8 SetupCount;
  8286. UINT8 Reserved3;
  8287. //These are Setup Words
  8288. [
  8289. SMBSubCommand,
  8290. SMBComSummary = SMBComSummary + ", " + SMBTrans2SubCommandTable(this),
  8291. conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]//save into SMB parent protocol conversation
  8292. ]
  8293. UINT16 SubCommand = FormatString("%s, %d(0x%04X)", SMBTrans2SubCommandTable(this), this, this);
  8294. switch
  8295. {
  8296. case SubCommand == 0x09 && SetupCount >= 4:
  8297. struct FSCTLSetupWords
  8298. {
  8299. UINT16 FileHandle;
  8300. UINT16 FunctionCode;
  8301. UINT16 RouteMethod;
  8302. AsciiString((SetupCount-4)*2) RouteName;
  8303. };
  8304. case SubCommand == 0x0A && SetupCount == 4:
  8305. struct IOCTL2SetupWords
  8306. {
  8307. UINT16 DeviceHandle;
  8308. UINT16 DeviceCategory = SMBT2IOCtlCategoryTable(this);
  8309. UINT16 DeviceFunction = SMBT2IOCtlFunctionTable(DeviceCategory, this);
  8310. };
  8311. case SetupCount > 1:
  8312. UINT16 setupWord[SetupCount - 1];
  8313. }
  8314. [SMBBytesEndOffset = frameOffset + 2 + ByteCount]
  8315. UINT16 ByteCount;
  8316. switch
  8317. {
  8318. case CurrentProtocolOffset < ParameterOffset:
  8319. BLOB(ParameterOffset - CurrentProtocolOffset) Pad1;
  8320. }
  8321. //
  8322. // These are Transact2 Request parameters
  8323. //
  8324. switch (SubCommand)
  8325. {
  8326. case 0x00: //TRANS2_OPEN2
  8327. struct Open2ParameterBlock
  8328. {
  8329. UINT16 Flags
  8330. {
  8331. UINT16 AdditionalInfo: 1 = FormatString(" (%s) %s", this.ToBitString, this ? "Return additional info(FileAttributes, DataSize, GrantedAccess, FileType, and DeviceState)" : "FileAttributes, DataSize, GrantedAccess, FileType, and DeviceState have indeterminate values and client ignores them");
  8332. UINT16 ExclusiveOplock: 1 = FormatString("(%s) %s", this.ToBitString, this ? "Exclusive oplock requested" : "Exclusive oplock NOT requested");
  8333. UINT16 BatchOplock: 1 = FormatString(" (%s) %s", this.ToBitString, this ? "Batch oplock requested" : "Batch oplock NOT requested");
  8334. UINT16 EALength: 1 = FormatString(" (%s) %s", this.ToBitString, this ? "Return total length of EAs" : "Do NOT Return total length of EAs");
  8335. UINT16 Reserved:12 = FormatString(" (%s) %s", this.ToBitString, "Reserved");
  8336. };
  8337. SMBAccessMode DesiredAccess;
  8338. UINT16 Reserved1;
  8339. SMBFileAttributes FileAttributes;
  8340. SMBTIME CreationTime;
  8341. SMBDATE CreationDate;
  8342. SMBOpenFunction OpenMode;
  8343. UINT32 AllocationSize;
  8344. UINT16 Reserved [5];
  8345. switch(Property.SMBUnicode)
  8346. {
  8347. case 0:
  8348. _struct AsciiFileName
  8349. {
  8350. [
  8351. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  8352. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  8353. Post.BuildConversationWithParent(Property.SMBFileName),
  8354. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  8355. SMBComPramSummary = ", FileName = " + this
  8356. ]
  8357. AsciiString FileName;
  8358. }
  8359. case 1:
  8360. _struct UnicodeFileName
  8361. {
  8362. ALIGN2 Align;
  8363. [
  8364. Property.SMBFileName = this ? FormatString("%s@#%u", this, FrameNumber + 1): FormatString("%s@#%u", NullFileName, FrameNumber + 1),
  8365. Post.conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = Property.SMBFileName,
  8366. Post.BuildConversationWithParent(Property.SMBFileName),
  8367. Post.Conversation.ConversationDescription = FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID),
  8368. SMBComPramSummary = ", FileName = " + this
  8369. ]
  8370. UnicodeString FileName;
  8371. }
  8372. }
  8373. }
  8374. case 0x01: //TRANS2_FIND_FIRST2
  8375. struct FindFirst2ParameterBlock
  8376. {
  8377. SMBFileAttributes SearchAttributes;
  8378. UINT16 SearchCount;
  8379. [DataFieldByteOrder = LittleEndian]
  8380. UINT16 Flags
  8381. {
  8382. UINT16 CloseAfterRequest:1 = FormatString("(%s) %s", this.ToBitString, this ? "Close search after this request" : "Do NOT close search after this request");
  8383. UINT16 CloseIfEndReached:1 = FormatString("(%s) %s", this.ToBitString, this ? "Close the search if the end of the search is reached" : "Do NOT close the search if the end of the search is reached");
  8384. [conversation.SMBTransact2FindResumeKey$[MakeByteArray(SMBTID, SMBPID, SMBMID)]]
  8385. UINT16 ReturnResumeKeys:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Return resume keys for each entry found" : "Don't Return resume keys for each entry found");
  8386. UINT16 PreviousEnding:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Resume/control from previous ending place" : "Do NOT Resume/control from previous ending place");
  8387. UINT16 BackupIntent:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Find with backup intent" : "find without backup intent");
  8388. UINT16 Reserved:11 = FormatString(" (%s) %s", this.ToBitString, "Reserved");
  8389. };
  8390. [
  8391. TransInformationLevel,
  8392. SMBComSummary = SMBComSummary + ", " + SMBTrans2FindInfoLevelTable(this),
  8393. conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]
  8394. ]
  8395. UINT16 InformationLevel = SMBTrans2FindInfoLevelTable(this);
  8396. [
  8397. BuildConversationWithParent(MakeByteArray(SMBTID, SMBPID, SMBMID)),
  8398. Post.Conversation.ConversationDescription = FormatString("(TID:0x%04X, PID:0x%04X, MID:0x%04X) ConvID = %d", SMBTID, SMBPID, SMBMID, ConvID)
  8399. ]
  8400. UINT32 SearchStorageType = SMBSearchStorageTypeTable(this);
  8401. [Post.SMBComPramSummary = ", Pattern = " + SMBFileNameValue]
  8402. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) SearchPattern;
  8403. }
  8404. case 0x02: // TRANS2_FIND_NEXT2
  8405. struct FindNext2ParameterBlock
  8406. {
  8407. UINT16 Sid;
  8408. UINT16 SearchCount;
  8409. [
  8410. TransInformationLevel,
  8411. SMBComSummary = SMBComSummary + ", " + SMBTrans2FindInfoLevelTable(this),
  8412. conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]
  8413. ]
  8414. UINT16 InformationLevel = SMBTrans2FindInfoLevelTable(this);
  8415. UINT32 ResumeKey;
  8416. [DataFieldByteOrder = LittleEndian]
  8417. UINT16 Flags
  8418. {
  8419. UINT16 CloseAfterRequest:1 = FormatString("(%s) %s", this.ToBitString, this ? "Close search after this request" : "Do NOT close search after this request");
  8420. UINT16 CloseIfEndReached:1 = FormatString("(%s) %s", this.ToBitString, this ? "Close the search if the end of the search is reached" : "Do NOT close the search if the end of the search is reached");
  8421. [conversation.SMBTransact2FindResumeKey$[MakeByteArray(SMBTID, SMBPID, SMBMID)]]
  8422. UINT16 ReturnResumeKeys:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Return resume keys for each entry found" : "Don't Return resume keys for each entry found");
  8423. UINT16 PreviousEnding:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Resume/control from previous ending place" : "Do NOT Resume/control from previous ending place");
  8424. UINT16 BackupIntent:1 = FormatString(" (%s) %s", this.ToBitString, this ? "Find with backup intent" : "find without backup intent");
  8425. UINT16 Reserved:11 = FormatString(" (%s) %s", this.ToBitString, "Reserved");
  8426. };
  8427. [
  8428. BuildConversationWithParent(MakeByteArray(SMBTID, SMBPID, SMBMID)),
  8429. Post.Conversation.ConversationDescription = FormatString("(TID:0x%04X, PID:0x%04X, MID:0x%04X) ConvID = %d", SMBTID, SMBPID, SMBMID, ConvID),
  8430. Post.SMBComPramSummary = ", FileName = " + SMBFileNameValue
  8431. ]
  8432. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  8433. }
  8434. case 0x03: //TRANS2_QUERY_FS_INFORMATION
  8435. case 0x0F: //TRANS2_QUERY_FS_INFORMATION_FID
  8436. struct QueryFSInfoParameterBlock
  8437. {
  8438. [
  8439. TransInformationLevel,
  8440. SMBComSummary = SMBComSummary + ", " + SMBTrans2QueryFSInfoLevelTable(this),
  8441. conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]
  8442. ]
  8443. UINT16 QueryInfoLevel = SMBTrans2QueryFSInfoLevelTable(this);
  8444. switch(ParameterCount)
  8445. {
  8446. case 4:
  8447. [
  8448. SMBFileID,
  8449. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  8450. conversation.SMBParaCountTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = ParameterCount,
  8451. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  8452. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  8453. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  8454. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  8455. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  8456. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  8457. ]
  8458. UINT16 FileID;
  8459. }
  8460. };
  8461. case 0x04: //TRANS2_SET_FS_INFORMATION
  8462. struct SetFSInfoParameterBlock
  8463. {
  8464. [
  8465. SMBFileID,
  8466. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  8467. Conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = UINT16(FrameData, FrameOffset + 2),
  8468. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  8469. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  8470. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  8471. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  8472. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  8473. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  8474. ]
  8475. UINT16 FileID;
  8476. [
  8477. TransInformationLevel,
  8478. SMBComSummary = SMBComSummary + ", " + SMBTrans2QueryFSInfoLevelTable(this)
  8479. ]
  8480. UINT16 InformationLevel = SMBTrans2QueryFSInfoLevelTable(this);
  8481. };
  8482. case 0x05: //TRANS2_QUERY_PATH_INFORMATION
  8483. struct QueryPathInfoParameterBlock
  8484. {
  8485. [
  8486. TransInformationLevel,
  8487. SMBComSummary = SMBComSummary + ", " + SMBTrans2QueryFileInfoLevelTable(this),
  8488. conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]
  8489. ]
  8490. UINT16 InformationLevel = SMBTrans2QueryFileInfoLevelTable(this);
  8491. [
  8492. BuildConversationWithParent(MakeByteArray(SMBTID, SMBPID, SMBMID)),
  8493. Post.Conversation.ConversationDescription = FormatString("(TID:0x%04X, PID:0x%04X, MID:0x%04X) ConvID = %d", SMBTID, SMBPID, SMBMID, ConvID)
  8494. ]
  8495. UINT32 Reserved;
  8496. [Post.SMBComPramSummary = ", Pattern = " + SMBFileNameValue]
  8497. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) Pattern;
  8498. }
  8499. case 0x06: // TRANS2_SET_PATH_INFORMATION
  8500. struct SetPathInfoParameterBlock
  8501. {
  8502. [
  8503. TransInformationLevel,
  8504. SMBComSummary = SMBComSummary + ", " + SMBTrans2SetFileInfoLevelTable(this),
  8505. conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)]
  8506. ]
  8507. UINT16 InformationLevel = SMBTrans2SetFileInfoLevelTable(this);
  8508. UINT32 Reserved;
  8509. [Post.SMBComPramSummary = ", Path = " + SMBFileNameValue]
  8510. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) PathName;
  8511. }
  8512. case 0x07: // TRANS2_QUERY_FILE_INFORMATION
  8513. struct QueryFileInfoParameterBlock
  8514. {
  8515. [
  8516. SMBFileID,
  8517. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  8518. Conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = UINT16(FrameData, FrameOffset + 2),
  8519. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  8520. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  8521. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  8522. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  8523. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  8524. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  8525. ]
  8526. UINT16 FileID;
  8527. [
  8528. TransInformationLevel,
  8529. SMBComSummary = SMBComSummary + ", " + SMBTrans2QueryFileInfoLevelTable(FileInfoLevel)
  8530. ]
  8531. UINT16 FileInfoLevel = SMBTrans2QueryFileInfoLevelTable(this);
  8532. }
  8533. case 0x08: //TRANS2_SET_FILE_INFORMATION
  8534. struct SetFileInfoParameterBlock
  8535. {
  8536. [
  8537. SMBFileID,
  8538. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  8539. Conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = UINT16(FrameData, FrameOffset + 2),
  8540. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  8541. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  8542. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  8543. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  8544. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  8545. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  8546. ]
  8547. UINT16 FileID;
  8548. [
  8549. TransInformationLevel,
  8550. SMBComSummary = SMBComSummary + ", " + SMBTrans2SetFileInfoLevelTable(InformationLevel)
  8551. ]
  8552. UINT16 InformationLevel = SMBTrans2SetFileInfoLevelTable(this);
  8553. UINT16 Reserved;
  8554. // documentation and captured data doesn't match to parse from here
  8555. }
  8556. case 0x0D: //TRANS2_CREATE_DIRECTORY
  8557. struct CreateDirectoryParameterBlock
  8558. {
  8559. UINT32 Reserved;
  8560. [Post.SMBComPramSummary = ", Dir = " + SMBFileNameValue]
  8561. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) DirectoryName;
  8562. };
  8563. case 0x10: //TRANS2_GET_DFS_REFERRAL
  8564. [
  8565. DataFieldFrameLength = SMBBytesEndOffset,
  8566. BuildConversationWithParent(MakeByteArray(SMBTID, SMBPID, SMBMID)),
  8567. Post.Conversation.ConversationDescription = FormatString("(TID:0x%04X, PID:0x%04X, MID:0x%04X) ConvID = %d", SMBTID, SMBPID, SMBMID, ConvID)
  8568. ]
  8569. DFSC Dfsc;
  8570. case 0x11: //TRANS2_REPORT_DFS_INCONSISTENCY
  8571. struct ReportDFSInconsistencyParameterBlock
  8572. {
  8573. [Post.SMBComPramSummary = ", RequestFileName = " + SMBFileNameValue]
  8574. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FileName;
  8575. };
  8576. default:
  8577. _struct ErrorParameterBlock
  8578. {
  8579. switch
  8580. {
  8581. case frameOffset < SMBBytesEndOffset &&
  8582. frameOffset < frameLength &&
  8583. ParameterCount > 0:
  8584. BLOB(ParameterCount > SMBBytesEndOffset-offset ? SMBBytesEndOffset-offset : ParameterCount) Parameters;
  8585. }
  8586. }
  8587. }
  8588. switch
  8589. {
  8590. case frameOffset < SMBBytesEndOffset &&
  8591. frameOffset < frameLength &&
  8592. CurrentProtocolOffset < DataOffset:
  8593. BLOB(DataOffset-CurrentProtocolOffset > SMBBytesEndOffset-offset ? SMBBytesEndOffset-offset : DataOffset-CurrentProtocolOffset) Pad2;
  8594. }
  8595. //
  8596. // These are Transact2 Request Datas
  8597. //
  8598. [conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = SubCommand,// save into SMB conversation
  8599. conversation.SMBTransact2InformationLevelTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)] = TransInformationLevel]// save into SMB conversation
  8600. switch (SubCommand)
  8601. {
  8602. case 0x00: // TRANS2_OPEN2
  8603. //This is the EAList[*]
  8604. SMBFEAList FEAList;
  8605. case 0x01: //TRANS2_FIND_FIRST2
  8606. case 0x02: //TRANS2_FIND_NEXT2
  8607. case 0x05: //TRANS2_QUERY_PATH_INFORMATION
  8608. case 0x07: //TRANS2_QUERY_FILE_INFORMATION
  8609. switch
  8610. {
  8611. case TransInformationLevel == 0x0003:
  8612. //This is the EAList[*]
  8613. SMBGEAList GetExtendedAttributeList;
  8614. }
  8615. case 0x04: //TRANS_SET_FS_INFORMATION
  8616. SMBTrans2FSInfoDataBlock(TransInformationLevel) SetFSInfoDataBlock;
  8617. case 0x06: // TRANS2_SET_PATH_INFORMATION
  8618. case 0x08: // TRANS2_SET_FILE_INFORMATION
  8619. switch(TransInformationLevel)
  8620. {
  8621. case 0x0001: // SMB_INFO_STANDARD
  8622. case 0x0002: // SMB_INFO_SET_EAS
  8623. SMBFEAList ExtendedAttributeList2;
  8624. case 0x0101: // SMB_QUERY_FILE_BASIC_INFO
  8625. case 0x03EC: // FileBasicInformation
  8626. SMBTrans2FileBasicInfo FileBasicDataBlock;
  8627. case 0x0102: // SMB_SET_FILE_DISPOSITION_INFO
  8628. case 0x03F5: // FileDispositionInformation
  8629. _struct FileDispositionInfoDataBlock
  8630. {
  8631. BOOLEAN DeleteFile;
  8632. };
  8633. case 0x0103: // SMB_SET_FILE_ALLOCATION_INFO
  8634. case 0x03FB: // FileAllocationInformation
  8635. _struct FileAllocationInfoDataBlock
  8636. {
  8637. SMBLargeInteger AllocationSize;
  8638. };
  8639. case 0x0104: // SMB_SET_FILE_END_OF_FILE_INFO
  8640. case 0x03FC: // FileEndOfFileInformation
  8641. _struct FileEndOfFileInfoDataBlock
  8642. {
  8643. SMBLargeInteger EndOfFile;
  8644. };
  8645. case 0x0200: // SMB_QUERY_FILE_UNIX_BASIC
  8646. SMBTrans2FileUnixBasicInfo FileUnixBasicInfoDataBlock;
  8647. case 0x0201: // SMB_QUERY_FILE_UNIX_LINK
  8648. case 0x0203: // SMB_QUERY_FILE_UNIX_HLINK
  8649. [Post.SMBComPramSummary = ", Link Destination = " + SMBFileNameValue]
  8650. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) LinkDest;
  8651. case 0x03F2: // FileRenameInformation
  8652. FSCCFileRenameInformationForSMB FileRenameInfoDataBlock;
  8653. case 0x03F3: // FileLinkInformation
  8654. FSCCFileLinkInformationForSMB FileLinkInfoDataBlock;
  8655. case 0x03F6: // FilePositionInformation
  8656. _struct FilePositionInfoDataBlock
  8657. {
  8658. UINT64 CurrentByteOffset;
  8659. };
  8660. case 0x03F8: // FileModeInformation
  8661. _struct FileModeInfoDataBlock
  8662. {
  8663. UINT32 Mode
  8664. {
  8665. UINT32 Reserved1:1 = FormatString(" (%s) UnUsed",this.ToBitString);
  8666. UINT32 WriteThrough:1 = FormatString(" (%s) %s",this.ToBitString,this ? "Data is written to file before the driver completes a write request" : "Data is NOT written to file before the driver completes a write request");
  8667. UINT32 SequentialOnly:1 = FormatString("(%s) %s",this.ToBitString,this ? "All access to the file is sequential" : "NOT All access to the file is sequential");
  8668. UINT32 Reserved2:1 = FormatString(" (%s) UnUsed",this.ToBitString);
  8669. UINT32 SynIOAlert:1 = FormatString(" (%s) %s",this.ToBitString,this ? "All operations on the file are performed synchronously" : "NOT All operations on the file are performed synchronously");
  8670. UINT32 SynIONonalert:1 = FormatString(" (%s) %s",this.ToBitString,this ? "All operations on the file are to be performed synchronously" :"NOT All operations on the file are to be performed synchronously");
  8671. UINT32 Reserved3:26 = FormatString(" (%s) UnUsed",this.ToBitString);
  8672. };
  8673. };
  8674. case 0x03FF: // FilePipeInformation
  8675. SMBTrans2FilePipeInfo FilePipeInfoDataBlock;
  8676. case 0x0401: // FilePipeRemoteInformation
  8677. SMBTrans2FilePipeRemoteInfo FilePipeRemoteInfoDataBlock;
  8678. case 0x0405: // FileObjectIDInformation
  8679. SMBTrans2FileObjectIDInfo FileObjectIDInfoDataBlock;
  8680. case 0x0408: // FileQuotaInformation
  8681. [SmbRTransact2NxtEntryOffset = FrameOffset]
  8682. While FileQuotaInfo[FrameOffset + 8 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  8683. {
  8684. SMBFileQuotaInfo QuotaInfo;
  8685. };
  8686. case 0x040F: // FileValidDataLengthInformation
  8687. _struct FileValidDataLengthInfoDataBlock
  8688. {
  8689. UINT64 ValidDataLength;
  8690. };
  8691. case 0x0410: // FileNameInformation
  8692. SMBTrans2FileNameInfo NameInfoDataBlock;
  8693. //case 0x0105: //SMB_SET_FILE_OLE_CLASSID_INFO
  8694. //case 0x0106: //SMB_SET_FILE_OLE_STATE_BITS_INFO
  8695. //case 0x0107: //SMB_SET_FILE_OBJECTID_INFO
  8696. //case 0x0108: //SMB_SET_FILE_CONTENT_INDEX_INFO
  8697. //case 0x0109: //SMB_SET_FILE_INHERIT_CONTENT_INDEX_INFO
  8698. //case 0x010A: //SMB_SET_FILE_OLE_INFO
  8699. default:
  8700. _struct ErrorDataBlock
  8701. {
  8702. SMBReportUnknownInfoLevel(TransInformationLevel) WarningErrorInfo;
  8703. BLOB(FrameLength - FrameOffset) Data;
  8704. };
  8705. }
  8706. case 0x0E: //#? TRANS2_SESSION_SETUP
  8707. struct SessionSetupDataBlock
  8708. {
  8709. UINT8 WordCount;
  8710. UINT8 Pad;
  8711. UINT16 MaxBufferSize;
  8712. UINT16 MaxMpxCount;
  8713. UINT16 VcNumber;
  8714. UINT32 SessionKey;
  8715. SMBCapability Capabilities;
  8716. UINT32 SecurityBlobLength;
  8717. SMBSecurityBlob(SecurityBlobLength) SecurityBlob;
  8718. [Post.SMBComPramSummary = ", UserName = " + SMBFileNameValue]
  8719. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) UserName;
  8720. }
  8721. case 0x0D: // TRANS2_CREATE_DIRECTORY
  8722. //This is the EAList[*]
  8723. SMBFEAList ExtendedAttributeList1;
  8724. default:
  8725. switch
  8726. {
  8727. case DataCount > 0:
  8728. _struct ErrorDataBlock
  8729. {
  8730. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("Unknown SMB Transaction2 Response Data, SubCommand = 0x%X", SubCommand)) Trans2ResponseDataError;
  8731. BLOB(DataCount) Data;
  8732. }
  8733. }
  8734. }
  8735. switch
  8736. {
  8737. case frameOffset < frameLength &&
  8738. frameOffset < SMBBytesEndOffset:
  8739. BLOB(SMBBytesEndOffset - frameOffset > frameLength - frameOffset ? frameLength - frameOffset : SMBBytesEndOffset - frameOffset) Pad;
  8740. }
  8741. }
  8742. // [MS-CIFS] 2.2.1.2.2 SMB_FEA
  8743. struct SMBFEA = AttributeName
  8744. {
  8745. UINT8 ExtendedAttributeFlag;
  8746. UINT8 AttributeNameLengthInBytes;
  8747. UINT16 AttributeValueLengthInBytes;
  8748. AsciiString(AttributeNameLengthInBytes + 1) AttributeName;
  8749. AsciiString(AttributeValueLengthInBytes) ValueName;
  8750. }
  8751. [Property.SMBInterimResponse = true]
  8752. struct SMBComInterimTransaction2Resp
  8753. {
  8754. [
  8755. conversation.SMBSubCommandPerFrame$[FrameNumber] = conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  8756. SMBSubCommand = conversation.SMBSubCommandPerFrame$[FrameNumber],
  8757. SMBComSummary = SMBComSummary + ", " + SMBTrans2SubCommandTable(Property.SMBSubCommand),
  8758. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  8759. SMBFileID = conversation.SMBFileIDPerFrame$[FrameNumber]
  8760. ]
  8761. UINT8 WordCount;
  8762. switch
  8763. {
  8764. case !conversation.SMB.Id:
  8765. [
  8766. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  8767. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  8768. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  8769. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  8770. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  8771. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  8772. ]
  8773. _struct _BuildConversation{};
  8774. }
  8775. UINT16 ByteCount;
  8776. }
  8777. Table SMBFileTypeTable( type )
  8778. {
  8779. switch( type )
  8780. {
  8781. case 0: "FileTypeDisk: Disk file or directory as defined in the attribute field";
  8782. case 1: "FileTypeByteModePipe: Named pipe in byte mode";
  8783. case 2: "FileTypeMessageModePipe: Named pipe in message mode";
  8784. case 3: "FileTypePrinter: Spooled printer";
  8785. case 4: "FileTypeCommDevice: Communications device";
  8786. case 0xFFFF: "FileTypeUnknown: Unrecognized resource type";
  8787. default: "Unhandled file type";
  8788. }
  8789. }
  8790. struct SMBComTransaction2SecondaryRequest
  8791. {
  8792. [
  8793. conversation.SMBSubCommandPerFrame$[FrameNumber] = conversation.SMBSubCommandTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  8794. SMBSubCommand = conversation.SMBSubCommandPerFrame$[FrameNumber]
  8795. ]
  8796. UINT8 WordCount = MUSTBeSetToTable( this, "0x09");
  8797. UINT16 TotalParameterCount;
  8798. UINT16 TotalDataCount;
  8799. UINT16 ParameterCount;
  8800. UINT16 ParameterOffset;
  8801. UINT16 ParameterDisplacement;
  8802. UINT16 DataCount;
  8803. UINT16 DataOffset;
  8804. UINT16 DataDiaplacement;
  8805. [
  8806. conversation.SMBFileIDPerFrame$[FrameNumber] = conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  8807. SMBFileID = this == 0xFFFF ? conversation.SMBFileIDPerFrame$[FrameNumber] : this,
  8808. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  8809. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  8810. Post.Property.SMBFileName = conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)],
  8811. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  8812. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  8813. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  8814. ]
  8815. UINT16 FileID;
  8816. [SMBBytesEndOffset = frameOffset + 2 + ByteCount]
  8817. UINT16 ByteCount;
  8818. switch
  8819. {
  8820. case ParameterOffset > CurrentProtocolOffset:
  8821. BLOB(ParameterOffset - CurrentProtocolOffset) Pad1;
  8822. }
  8823. switch
  8824. {
  8825. case ParameterCount > 0:
  8826. BLOB(ParameterCount) Parameters;
  8827. }
  8828. switch
  8829. {
  8830. case DataOffset > CurrentProtocolOffset:
  8831. BLOB(DataOffset-CurrentProtocolOffset) Pad2;
  8832. }
  8833. switch
  8834. {
  8835. case DataCount > 0:
  8836. BLOB(DataCount > frameLength - frameOffset ? frameLength - frameOffset : DataCount) Datas;
  8837. }
  8838. switch
  8839. {
  8840. case frameOffset < frameLength &&
  8841. frameOffset < SMBBytesEndOffset:
  8842. BLOB(SMBBytesEndOffset - frameOffset > frameLength - frameOffset ? frameLength - frameOffset : SMBBytesEndOffset - frameOffset) Pad;
  8843. }
  8844. }
  8845. Table SMBDeviceTypeTable(type)
  8846. {
  8847. switch(type)
  8848. {
  8849. case 0x00000001: "FILE_DEVICE_BEEP";
  8850. case 0x00000002: "FILE_DEVICE_CD_ROM";
  8851. case 0x00000003: "FILE_DEVICE_CD_ROM_FILE_SYSTEM";
  8852. case 0x00000004: "FILE_DEVICE_CONTROLLER";
  8853. case 0x00000005: "FILE_DEVICE_DATALINK";
  8854. case 0x00000006: "FILE_DEVICE_DFS";
  8855. case 0x00000007: "FILE_DEVICE_DISK";
  8856. case 0x00000008: "FILE_DEVICE_DISK_FILE_SYSTEM";
  8857. case 0x00000009: "FILE_DEVICE_FILE_SYSTEM";
  8858. case 0x0000000A: "FILE_DEVICE_INPORT_PORT";
  8859. case 0x0000000B: "FILE_DEVICE_KEYBOARD";
  8860. case 0x0000000C: "FILE_DEVICE_MAILSLOT";
  8861. case 0x0000000D: "FILE_DEVICE_MIDI_IN";
  8862. case 0x0000000E: "FILE_DEVICE_MIDI_OUT";
  8863. case 0x0000000F: "FILE_DEVICE_MOUSE";
  8864. case 0x00000010: "FILE_DEVICE_MULTI_UNC_PROVIDER";
  8865. case 0x00000011: "FILE_DEVICE_NAMED_PIPE";
  8866. case 0x00000012: "FILE_DEVICE_NETWORK";
  8867. case 0x00000013: "FILE_DEVICE_NETWORK_BROWSER";
  8868. case 0x00000014: "FILE_DEVICE_NETWORK_FILE_SYSTEM";
  8869. case 0x00000015: "FILE_DEVICE_NULL";
  8870. case 0x00000016: "FILE_DEVICE_PARALLEL_PORT";
  8871. case 0x00000017: "FILE_DEVICE_PHYSICAL_NETCARD";
  8872. case 0x00000018: "FILE_DEVICE_PRINTER";
  8873. case 0x00000019: "FILE_DEVICE_SCANNER";
  8874. case 0x0000001A: "FILE_DEVICE_SERIAL_MOUSE_PORT";
  8875. case 0x0000001B: "FILE_DEVICE_SERIAL_PORT";
  8876. case 0x0000001C: "FILE_DEVICE_SCREEN";
  8877. case 0x0000001D: "FILE_DEVICE_SOUND";
  8878. case 0x0000001E: "FILE_DEVICE_STREAMS";
  8879. case 0x0000001F: "FILE_DEVICE_TAPE";
  8880. case 0x00000020: "FILE_DEVICE_TAPE_FILE_SYSTEM";
  8881. case 0x00000021: "FILE_DEVICE_TRANSPORT";
  8882. case 0x00000022: "FILE_DEVICE_UNKNOWN";
  8883. case 0x00000023: "FILE_DEVICE_VIDEO";
  8884. case 0x00000024: "FILE_DEVICE_VIRTUAL_DISK";
  8885. case 0x00000025: "FILE_DEVICE_WAVE_IN";
  8886. case 0x00000026: "FILE_DEVICE_WAVE_OUT";
  8887. case 0x00000027: "FILE_DEVICE_8042_PORT";
  8888. case 0x00000028: "FILE_DEVICE_NETWORK_REDIRECTOR";
  8889. case 0x00000029: "FILE_DEVICE_BATTERY";
  8890. case 0x0000002A: "FILE_DEVICE_BUS_EXTENDER";
  8891. case 0x0000002B: "FILE_DEVICE_MODEM";
  8892. case 0x0000002C: "FILE_DEVICE_VDM";
  8893. default: "Unhandled Device Type";
  8894. }
  8895. }
  8896. Table SMBAlignmentRequirementTable(type)
  8897. {
  8898. switch(type)
  8899. {
  8900. case 0x00000000: "FILE_BYTE_ALIGNMENT";
  8901. case 0x00000001: "FILE_WORD_ALIGNMENT";
  8902. case 0x00000003: "FILE_LONG_ALIGNMENT";
  8903. case 0x00000007: "FILE_QUAD_ALIGNMENT";
  8904. case 0x0000000F: "FILE_OCTA_ALIGNMENT";
  8905. case 0x0000001F: "FILE_32_BYTE_ALIGNMENT";
  8906. case 0x0000003F: "FILE_64_BYTE_ALIGNMENT";
  8907. case 0x0000007F: "FILE_128_BYTE_ALIGNMENT";
  8908. case 0x000000FF: "FILE_256_BYTE_ALIGNMENT";
  8909. case 0x000001FF: "FILE_512_BYTE_ALIGNMENT";
  8910. Default: "Unhandled Alignment";
  8911. }
  8912. }
  8913. Table SMBDirStorageTypeTable(type)
  8914. {
  8915. switch(type)
  8916. {
  8917. case 1: FormatString("Default, %d(0x%X)", type, type);
  8918. case 2: FormatString("Directory, %d(0x%X)", type, type);
  8919. case 3: FormatString("File, %d(0x%X)", type, type);
  8920. case 5: FormatString("DFS Junction Point, %d(0x%X)", type, type);
  8921. case 6: FormatString("Catalog, %d(0x%X)", type, type);
  8922. case 7: FormatString("Structured Storage, %d(0x%X)", type, type);
  8923. case 8: FormatString("Embedding, %d(0x%X)", type, type);
  8924. case 9: FormatString("Stream, %d(0x%X)", type, type);
  8925. default: FormatString("Unhandled Storage Type, %d(0x%X)", type, type);
  8926. }
  8927. }
  8928. Table SMBFileCompressionFormatTable(format)
  8929. {
  8930. switch(format)
  8931. {
  8932. case 0x0000: FormatString("There is no compression %d(%#x)", format, format);
  8933. case 0x0002: FormatString("Compression format is LZNT %d(%#x)", format, format);
  8934. default: FormatString("Unknown Compression format %d(%#x)", format, format);
  8935. }
  8936. }
  8937. struct SMBFileStandardInfo(ResumeKeyExist, UnicodeName) = this.FileName.ToString
  8938. {
  8939. [StructBaseOffset = FrameOffset]
  8940. switch
  8941. {
  8942. case ResumeKeyExist:
  8943. UINT32 FindResumeKey;
  8944. }
  8945. SMBDATE CreationDate;
  8946. SMBTIME CreationTime;
  8947. SMBDATE LastAccessDate;
  8948. SMBTIME LastAccessTime;
  8949. SMBDATE LastWriteDate;
  8950. SMBTIME LastWriteTime;
  8951. UINT32 DataSize;
  8952. UINT32 AllocationSize;
  8953. SMBFileAttributes Attributes;
  8954. UINT8 FileNameLength;
  8955. struct FileName = SMBFileNameValue
  8956. {
  8957. switch( UnicodeName )
  8958. {
  8959. case 0:
  8960. [SMBFileNameValue]
  8961. AsciiString( FileNameLength) AsciiName;
  8962. case 1:
  8963. [SMBFileNameValue]
  8964. UnicodeString( FileNameLength/2) UnicodeName;
  8965. }
  8966. }
  8967. [SmbRTransact2NxtEntryOffset = FrameOffset]
  8968. _struct SetNxtEntryOffset{};
  8969. }
  8970. struct SMBFileEASizeInfo(ResumeKeyExist, UnicodeName) = SMBFileNameValue
  8971. {
  8972. [StructBaseOffset = FrameOffset]
  8973. switch
  8974. {
  8975. case ResumeKeyExist:
  8976. UINT32 ResumeKey;
  8977. }
  8978. SMBDATE CreationDate;
  8979. SMBTIME CreationTime;
  8980. SMBDATE LastAccessDate;
  8981. SMBTIME LastAccessTime;
  8982. SMBDATE LastWriteDate;
  8983. SMBTIME LastWriteTime;
  8984. UINT32 FileDataSize;
  8985. UINT32 AllocationSize;
  8986. SMBFileAttributes Attributes;
  8987. UINT32 EaSize;
  8988. UINT8 FileNameLength;
  8989. struct FileName = SMBFileNameValue
  8990. {
  8991. switch( UnicodeName )
  8992. {
  8993. case 0:
  8994. [SMBFileNameValue]
  8995. AsciiString( FileNameLength ) AsciiName;
  8996. case 1:
  8997. [SMBFileNameValue]
  8998. UnicodeString( FileNameLength/2 ) UnicodeName;
  8999. }
  9000. }
  9001. CHAR FileNameTerminator;
  9002. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9003. _struct SetNxtEntryOffset{};
  9004. }
  9005. struct SMBFileEASFromList(ResumeKeyExist, UnicodeName) = SMBFileNameValue
  9006. {
  9007. [StructBaseOffset = FrameOffset]
  9008. switch
  9009. {
  9010. case ResumeKeyExist:
  9011. UINT32 ResumeKey;
  9012. }
  9013. SMBDATE CreationDate;
  9014. SMBTIME CreationTime;
  9015. SMBDATE LastAccessDate;
  9016. SMBTIME LastAccessTime;
  9017. SMBDATE LastWriteDate;
  9018. SMBTIME LastWriteTime;
  9019. UINT32 FileDataSize;
  9020. UINT32 AllocationSize;
  9021. SMBFileAttributes Attributes;
  9022. SMBFEAList ExtendedAttributeList;
  9023. UINT8 FileNameLength = UnicodeName? FormatString("%u - an arbitrary value", this) : this;
  9024. Struct FileName = SMBFileNameValue
  9025. {
  9026. switch( UnicodeName )
  9027. {
  9028. case 0:
  9029. [SMBFileNameValue]
  9030. AsciiString( FileNameLength ) AsciiName;
  9031. case 1:
  9032. [SMBFileNameValue]
  9033. UnicodeString( FileNameLength / 2 ) UnicodeName;
  9034. }
  9035. }
  9036. CHAR FileNameTerminator;
  9037. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9038. _struct SetNxtEntryOffset{};
  9039. }
  9040. //SMB_FIND_FILE_DIRECTORY_INFO
  9041. struct SMBFileDirInfo(UnicodeName) = this.FileName.ToString
  9042. {
  9043. [
  9044. StructBaseOffset = FrameOffset,
  9045. SmbRTransact2NxtEntryOffset = frameOffset + this
  9046. ]
  9047. UINT32 NextEntryOffset;
  9048. UINT32 FileIndex;
  9049. FILETIME CreationTime;
  9050. FILETIME LastAccessTime;
  9051. FILETIME LastWriteTime;
  9052. FILETIME LastAttrChangeTime;
  9053. SMBLargeInteger EndOfFile;
  9054. SMBLargeInteger AllocationSize;
  9055. SMBNTFileAttributes ExtFileAttributes;
  9056. UINT32 FileNameLength;
  9057. Struct FileName = SMBFileNameValue
  9058. {
  9059. switch( UnicodeName )
  9060. {
  9061. case 0:
  9062. [SMBFileNameValue]
  9063. AsciiString( FileNameLength ) AsciiName;
  9064. case 1:
  9065. [SMBFileNameValue]
  9066. UnicodeString( FileNameLength/2 ) UnicodeName;
  9067. }
  9068. }
  9069. switch
  9070. {
  9071. case frameOffset < SmbRTransact2NxtEntryOffset:
  9072. BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9073. }
  9074. }
  9075. //SMB_FIND_FILE_FULL_DIRECTORY_INFO
  9076. struct SMBFileFullDirInfo(UnicodeName) = this.FileName.ToString
  9077. {
  9078. [
  9079. StructBaseOffset = FrameOffset,
  9080. SmbRTransact2NxtEntryOffset = frameOffset + this
  9081. ]
  9082. UINT32 NextEntryOffset;
  9083. UINT32 FileIndex;
  9084. FILETIME CreationTime;
  9085. FILETIME LastAccessTime;
  9086. FILETIME LastWriteTime;
  9087. FILETIME ChangeTime;
  9088. SMBLargeInteger EndOfFile;
  9089. SMBLargeInteger AllocationSize;
  9090. SMBNTFileAttributes FileAttributes;
  9091. UINT32 FileNameLength;
  9092. UINT32 EaSize;
  9093. Struct FileName = SMBFileNameValue
  9094. {
  9095. switch( UnicodeName )
  9096. {
  9097. case 0:
  9098. [SMBFileNameValue]
  9099. AsciiString( FileNameLength ) AsciiName;
  9100. case 1:
  9101. [SMBFileNameValue]
  9102. UnicodeString( FileNameLength/2 ) UnicodeName;
  9103. }
  9104. }
  9105. switch
  9106. {
  9107. case frameOffset < SmbRTransact2NxtEntryOffset:
  9108. BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9109. }
  9110. }
  9111. //SMB_FIND_FILE_NAMES_INFO
  9112. struct SMBFileNamesInfo(UnicodeName) = this.FileName.ToString
  9113. {
  9114. [
  9115. StructBaseOffset = FrameOffset,
  9116. SmbRTransact2NxtEntryOffset = frameOffset + this
  9117. ]
  9118. UINT32 NextEntryOffset;
  9119. UINT32 FileIndex;
  9120. UINT32 FileNameLength;
  9121. Struct FileName = SMBFileNameValue
  9122. {
  9123. switch( UnicodeName )
  9124. {
  9125. case 0:
  9126. [SMBFileNameValue]
  9127. AsciiString( FileNameLength ) AsciiValue;
  9128. case 1:
  9129. [SMBFileNameValue]
  9130. UnicodeString( FileNameLength / 2 ) UnicodeValue;
  9131. }
  9132. }
  9133. switch
  9134. {
  9135. case frameOffset < SmbRTransact2NxtEntryOffset:
  9136. BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9137. }
  9138. }
  9139. //SMB_FIND_FILE_BOTH_DIRECTORY_INFO for Previous File Version Enumeration
  9140. struct SmbFindFileBothDirectoryInfoPrevFile(UnicodeName) = this.FileName.ToString
  9141. {
  9142. [
  9143. StructBaseOffset = FrameOffset,
  9144. SmbRTransact2NxtEntryOffset = frameOffset + this
  9145. ]
  9146. UINT32 NextEntryOffset;
  9147. UINT32 FileIndex;
  9148. FILETIME CreationTime;
  9149. FILETIME LastAccessTime;
  9150. FILETIME LastWriteTime;
  9151. FILETIME ChangeTime;
  9152. SMBLargeInteger EndOfFile;
  9153. SMBLargeInteger AllocationSize;
  9154. SMBNTFileAttributes FileAttributes;
  9155. UINT32 FileNameLength;
  9156. UINT32 EaSize;
  9157. UINT8 ShortNameLength;
  9158. Blob(1) Reserved;
  9159. UnicodeString(12) ShortName;
  9160. SMBFileNameString(SMBUnicode, true, FileNameLength, ProtocolOffset) FileName;
  9161. switch
  9162. {
  9163. case frameOffset < SmbRTransact2NxtEntryOffset:
  9164. BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9165. }
  9166. }
  9167. //struct SMBFileOLEDirInfo(UnicodeName) = this.FileName.ToString
  9168. //{
  9169. // [
  9170. // StructBaseOffset = FrameOffset,
  9171. // SmbRTransact2NxtEntryOffset = frameOffset + this
  9172. // ]
  9173. // UINT32 NextEntryOffset;
  9174. // UINT32 FileIndex;
  9175. // FILETIME CreationTime;
  9176. // FILETIME LastAccessTime;
  9177. // FILETIME LastWriteTime;
  9178. // FILETIME ChangeTime;
  9179. // UINT64 EndOfFile;
  9180. // UINT64 AllocationSize;
  9181. // SMBNTFileAttributes FileAttributes;
  9182. // UINT32 FileNameLength;
  9183. // UINT32 StorageType = SMBDirStorageTypeTable(this); //#? DataType
  9184. // GUID(false) OleClassId;
  9185. // UINT32 OleStateBits;
  9186. // BOOLEAN ContentIndexDisable;
  9187. // BOOLEAN InheritContentIndexDisable;
  9188. // SMBFileNameString(UnicodeName, TRUE, FileNameLength, StructBaseOffset) FileName;
  9189. // switch
  9190. // {
  9191. // case frameOffset < SmbRTransact2NxtEntryOffset:
  9192. // BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9193. // }
  9194. //}
  9195. //SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO
  9196. struct SmbFindFileIdFullDirectoryInfo(UnicodeName) = this.FileName.ToString
  9197. {
  9198. [
  9199. StructBaseOffset = FrameOffset,
  9200. SmbRTransact2NxtEntryOffset = frameOffset + this
  9201. ]
  9202. UINT32 NextEntryOffset;
  9203. UINT32 FileIndex;
  9204. FILETIME CreationTime;
  9205. FILETIME LastAccessTime;
  9206. FILETIME LastWriteTime;
  9207. FILETIME LastChangeTime;
  9208. SMBLargeInteger EndOfFile;
  9209. SMBLargeInteger AllocationSize;
  9210. SMBNTFileAttributes ExtFileAttributes;
  9211. UINT32 FileNameLength;
  9212. UINT32 EaSize;
  9213. SMBLargeInteger FileId;
  9214. SMBFileNameString(UnicodeName, TRUE, FileNameLength, StructBaseOffset) FileName;
  9215. switch
  9216. {
  9217. case frameOffset < SmbRTransact2NxtEntryOffset:
  9218. BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9219. }
  9220. }
  9221. //SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO
  9222. struct SmbFindFileIdBothDirectoryInfo(UnicodeName) = this.FileName.ToString
  9223. {
  9224. [
  9225. StructBaseOffset = FrameOffset,
  9226. SmbRTransact2NxtEntryOffset = frameOffset + this
  9227. ]
  9228. UINT32 NextEntryOffset;
  9229. UINT32 FileIndex;
  9230. FILETIME CreationTime;
  9231. FILETIME LastAccessTime;
  9232. FILETIME LastWriteTime;
  9233. FILETIME LastChangeTime;
  9234. SMBLargeInteger EndOfFile;
  9235. SMBLargeInteger AllocationSize;
  9236. SMBNTFileAttributes ExtFileAttributes;
  9237. UINT32 FileNameLength;
  9238. UINT32 EaSize;
  9239. UINT8 ShortNameLength;
  9240. ALIGN(StructBaseOffset, 2) Align2;
  9241. SMBFileNameString(SMBUnicode, TRUE, 24, StructBaseOffset) ShortName;
  9242. ALIGN(StructBaseOffset, 8) Align8;
  9243. SMBLargeInteger FileID;
  9244. SMBFileNameString(UnicodeName, TRUE, FileNameLength, StructBaseOffset) FileName;
  9245. switch
  9246. {
  9247. case frameOffset < SmbRTransact2NxtEntryOffset:
  9248. BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9249. }
  9250. }
  9251. struct SMBFileFullEAInfo(UnicodeName) = EAName.ToString
  9252. {
  9253. [
  9254. StructBaseOffset = FrameOffset,
  9255. SmbRTransact2NxtEntryOffset = frameOffset + this
  9256. ]
  9257. UINT32 NextEntryOffset;
  9258. UINT8 Flags;
  9259. UINT8 EaNameLength;
  9260. UINT16 EaValueLength;
  9261. SMBFileNameString(UnicodeName, TRUE, EaNameLength, StructBaseOffset) EAName;
  9262. switch
  9263. {
  9264. case frameOffset < SmbRTransact2NxtEntryOffset:
  9265. BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9266. }
  9267. }
  9268. //NT_TRANSACT_SET_QUOTA or NT_TRANSACT_QUERY_QUOTA
  9269. struct SMBFileQuotaInfo = this.Sid.ToString
  9270. {
  9271. [
  9272. StructBaseOffset = FrameOffset,
  9273. SmbRTransact2NxtEntryOffset = frameOffset + this
  9274. ]
  9275. UINT32 NextEntryOffset;
  9276. UINT32 SidLength;
  9277. FILETIME ChangeTime;
  9278. SMBLargeInteger QuotaUsed;
  9279. SMBLargeInteger QuotaThreshold;
  9280. SMBLargeInteger QuotaLimit;
  9281. Switch
  9282. {
  9283. case SidLength > 0:
  9284. SID(FALSE) Sid;
  9285. }
  9286. switch
  9287. {
  9288. case frameOffset < SmbRTransact2NxtEntryOffset:
  9289. BLOB(SmbRTransact2NxtEntryOffset - frameOffset) EntryPad;
  9290. }
  9291. }
  9292. struct SMBComTransaction2Resp
  9293. {
  9294. [
  9295. SMBComSummary = SMBComSummary + ((ConvID > 0) ? (", " + SMBTrans2SubCommandTable(SMBSubCommand)) : ""),
  9296. SMBComSummary = SMBComSummary + ((SMBSubCommand >= 1 && SMBSubCommand <= 8)||SMBSubCommand == 0x0F ? ", " + SMBTrans2InfoLevelTable(SMBSubCommand, TransInformationLevel) : "")
  9297. ]
  9298. UINT8 WordCount;
  9299. UINT16 TotalParameterCount;
  9300. UINT16 TotalDataCount;
  9301. UINT16 Reserved;
  9302. UINT16 ParameterCount;
  9303. UINT16 ParameterOffset;
  9304. UINT16 ParamDisplacement;
  9305. UINT16 DataCount;
  9306. [Post.DataEndOffset = ProtocolOffset + DataOffset + DataCount]
  9307. UINT16 DataOffset;
  9308. UINT16 DataDisplacement;
  9309. // Here, SerupCount will always be 0
  9310. UINT8 SetupCount;
  9311. UINT8 Reserved2;
  9312. switch
  9313. {
  9314. case SetupCount > 0:
  9315. _struct ErrorSetupWords
  9316. {
  9317. // ReportParserError(ParserErrorProtocolClassWindows, "SMB", "Setupcount in SMB Transaction2 Response should always be 0") SetupCountError;
  9318. UINT16 Setup[SetupCount];
  9319. }
  9320. }
  9321. [SMBBytesEndOffset = frameOffset + 2 + ByteCount]
  9322. UINT16 ByteCount;
  9323. switch
  9324. {
  9325. case frameOffset < SMBBytesEndOffset &&
  9326. frameOffset < frameLength &&
  9327. CurrentProtocolOffset < ParameterOffset:
  9328. BLOB(ParameterOffset-CurrentProtocolOffset > SMBBytesEndOffset-offset ? SMBBytesEndOffset-offset : ParameterOffset-CurrentProtocolOffset) Pad1;
  9329. }
  9330. [SMBT2ParameterEndOffset = frameOffset + ParameterCount]
  9331. //
  9332. // These are Transaction2 Response Parameter Block
  9333. //
  9334. switch
  9335. {
  9336. case frameOffset < SMBBytesEndOffset &&
  9337. frameOffset < frameLength &&
  9338. ParamDisplacement == 0 &&
  9339. ParameterCount > 0:
  9340. switch
  9341. {
  9342. case !(ConvID > 0):
  9343. _struct ReportWarning
  9344. {
  9345. ReportParserWarning( "SMB", "May not parse correctly when conversation off") ParserWarning;
  9346. BLOB(ParameterCount > SMBBytesEndOffset-offset ? SMBBytesEndOffset-offset : ParameterCount) Parameters;
  9347. };
  9348. case SMBSubCommand == 0x00: //TRANS2_OPEN2
  9349. struct Open2ParameterBlock
  9350. {
  9351. [
  9352. SMBFileID,
  9353. conversation.SMBFileIDTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  9354. conversation.SMBFileNamePerFrame$[FrameNumber] = conversation.SMBFileNameTable$[MakeByteArray(SMBTID, SMBPID, SMBMID)],
  9355. Property.SMBFileName = conversation.SMBFileNamePerFrame$[FrameNumber],
  9356. Post.conversation.SMBFileIDCount$[SMBFileID] = conversation.SMBFileIDCount$[SMBFileID] + 1,
  9357. Post.conversation.SMBFileIDCountTable$[FrameNumber] = conversation.SMBFileIDCount$[SMBFileID],
  9358. Post.SMBFIDCount = conversation.SMBFileIDCountTable$[FrameNumber],
  9359. Post.conversation.SMBFileNameMVS$[MakeByteArray(SMBTID, SMBFileID, SMBFIDCount)] = Property.SMBFileName,
  9360. Post.BuildConversationWithParent(Property.SMBFileName ? Property.SMBFileName : MakeByteArray(SMBFileID, SMBFIDCount)),
  9361. Post.Conversation.ConversationDescription = Property.SMBFileName ? FormatString("(FileName: %s) ConvID = %d", Property.SMBFileName, ConvID) : FormatString("(FID: 0x%04X) ConvID = %d", SMBFileID, ConvID),
  9362. Post.SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")
  9363. ]
  9364. UINT16 FileID;
  9365. SMBFileAttributes FileAttributes;
  9366. SMBTIME CreationTime;
  9367. SMBDATE CreationDate;
  9368. UINT32 FileDataSize;
  9369. SMBAccessMode GrantedAccess;
  9370. UINT16 FileType = SMBFileTypeTable(this);
  9371. switch(FileType)
  9372. {
  9373. case 1:
  9374. case 2:
  9375. SMBDeviceState DeviceState;
  9376. default:
  9377. UINT16 FileStatus
  9378. {
  9379. UINT16 NoEAs:1 = FormatString(" (%s) File or Directory has %sextended attributes (NO_EAS)", this.ToBitString, this ? "NO ":"");
  9380. UINT16 NoSubstreams:1 = FormatString("(%s) File or Directory has %ssubstreams (NO_SUBSTREAMS)", this.ToBitString, this ? "NO ":"");
  9381. UINT16 NoReparseTag:1 = FormatString("(%s) File or Directory is %sa reparse point (NO_REPARSETAG)", this.ToBitString, this ? "NOT ":"");
  9382. UINT16 Reserved:13 = FormatString(" (%s) Reserved", this.ToBitString);
  9383. };
  9384. }
  9385. SMBOpenAction ActionTaken;
  9386. UINT32 Reserved;
  9387. UINT16 ExtendedAttributeErrorOffset;
  9388. UINT32 ExtendedAttributeLength;
  9389. };
  9390. case SMBSubCommand == 0x01: //TRANS2_FIND_FIRST2
  9391. struct FindFirst2ParameterBlock
  9392. {
  9393. UINT16 Sid;
  9394. [SearchCount]
  9395. UINT16 SearchCount;
  9396. UINT16 EndOfSearch = this? "This response is the last and the find has reached the end of the search results." : "The search MAY be continued using the TRANS2_FIND_NEXT2 transaction.";
  9397. UINT16 EaErrorOffset;
  9398. UINT16 LastNameOffset;
  9399. };
  9400. case SMBSubCommand == 0x02: // TRANS2_FIND_NEXT2
  9401. struct FindNext2ParameterBlock
  9402. {
  9403. UINT16 SearchCount;
  9404. UINT16 EndOfSearch;
  9405. UINT16 EaErrorOffset;
  9406. UINT16 LastNameOffset;
  9407. };
  9408. case SMBSubCommand == 0x05: //TRANS2_QUERY_PATH_INFORMATION
  9409. struct QueryPathInfoParameterBlock
  9410. {
  9411. UINT16 EaErrorOffset;
  9412. };
  9413. case SMBSubCommand == 0x06: // TRANS2_SET_PATH_INFORMATION
  9414. struct SetPathInfoParameters
  9415. {
  9416. switch(TransInformationLevel)
  9417. {
  9418. case 4:
  9419. UINT16 EaErrorOffset;
  9420. default:
  9421. UINT16 Reserved;
  9422. }
  9423. };
  9424. case SMBSubCommand == 0x07: // TRANS2_QUERY_FILE_INFORMATION
  9425. struct QueryFileInfoParameterBlock
  9426. {
  9427. [SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")]
  9428. UINT16 EaErrorOffset;
  9429. };
  9430. case SMBSubCommand == 0x08: //TRANS2_SET_FILE_INFORMATION
  9431. struct SetFileInfoParameterBlock
  9432. {
  9433. [SMBComPramSummary = FormatString(", FID = 0x%04X%s", SMBFileID, Property.SMBFileName ? " (" + Property.SMBFileName + ")" : "")]
  9434. UINT16 EaErrorOffset;
  9435. };
  9436. case SMBSubCommand == 0x0B: //TRANS2_FIND_NOTIFY_FIRST
  9437. struct FindNotifyFirstParameterBlock
  9438. {
  9439. UINT16 MonitorHandle;
  9440. UINT16 ChangeCount;
  9441. UINT16 EaErrorOffset;
  9442. };
  9443. case SMBSubCommand == 0x0C: //TRANS2_FIND_NOTIFY_NEXT
  9444. struct FindNotifyNextParameterBlock
  9445. {
  9446. UINT16 ChangeCount;
  9447. UINT16 EaErrorOffset;
  9448. };
  9449. case SMBSubCommand == 0x0D: //TRANS2_CREATE_DIRECTORY
  9450. struct CreateDirectoryParameterBlock
  9451. {
  9452. UINT16 EaErrorOffset;
  9453. };
  9454. default:
  9455. switch
  9456. {
  9457. case SMBSubCommand >= 0x00:
  9458. _struct ErrorParameterBlock
  9459. {
  9460. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("Unknown SMB Transaction2 Parameter Block, SubCommand = 0x%X", SMBSubCommand)) SMBSubCommandError;
  9461. BLOB(ParameterCount > SMBBytesEndOffset-offset ? SMBBytesEndOffset-offset : ParameterCount) Parameters;
  9462. };
  9463. default:
  9464. _struct WarningParameterBlock
  9465. {
  9466. ReportParserWarning("SMB", "May not parse correctly when Transaction2 request is missing") SMBParameterBlockWarning;
  9467. BLOB(ParameterCount > SMBBytesEndOffset-offset ? SMBBytesEndOffset-offset : ParameterCount) Parameters;
  9468. };
  9469. }
  9470. }
  9471. }
  9472. switch
  9473. {
  9474. case frameOffset < SMBBytesEndOffset &&
  9475. frameOffset < frameLength &&
  9476. CurrentProtocolOffset < DataOffset:
  9477. BLOB(DataOffset-CurrentProtocolOffset > SMBBytesEndOffset-offset ? SMBBytesEndOffset-offset : DataOffset-CurrentProtocolOffset) Pad2;
  9478. }
  9479. [SMBT2DataEndOffset = frameOffset + DataCount]
  9480. //
  9481. // These are Transaction2 Response Data Block
  9482. //
  9483. switch
  9484. {
  9485. case frameOffset < SMBBytesEndOffset &&
  9486. frameOffset < frameLength &&
  9487. DataDisplacement == 0 &&
  9488. DataCount > 0:
  9489. _struct DataBlock
  9490. {
  9491. switch
  9492. {
  9493. case !(ConvID > 0):
  9494. _struct ReportWarning
  9495. {
  9496. ReportParserWarning( "SMB", "May not parse correctly when conversation off") ParserWarning;
  9497. BLOB(ParameterCount > SMBBytesEndOffset-offset ? SMBBytesEndOffset-offset : ParameterCount) Parameters;
  9498. };
  9499. case SMBSubCommand == 0x01: // FindFirst2
  9500. case SMBSubCommand == 0x02: // FindNext2
  9501. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9502. While Entries[FrameOffset + 12 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9503. {
  9504. switch(TransInformationLevel)
  9505. {
  9506. case 0x0001: // SMB_INFO_STANDARD
  9507. SMBFileStandardInfo(FindResumeKeyRequested, Property.SMBUnicode) StandardInfo;
  9508. case 0x0002: // SMB_INFO_QUERY_EA_SIZE
  9509. SMBFileEASizeInfo(FindResumeKeyRequested, Property.SMBUnicode) EASizeInfo;
  9510. case 0x0003: // SMB_INFO_QUERY_EAS_FROM_LIST
  9511. SMBFileEASFromList(FindResumeKeyRequested, Property.SMBUnicode) EASFromList;
  9512. case 0x0101: // SMB_FIND_FILE_DIRECTORY_INFO
  9513. SMBFileDirInfo(Property.SMBUnicode) DirInfo;
  9514. case 0x0102: // SMB_FIND_FILE_FULL_DIRECTORY_INFO
  9515. SMBFileFullDirInfo(Property.SMBUnicode) FullDirInfo;
  9516. case 0x0103: // SMB_FIND_FILE_NAMES_INFO
  9517. SMBFileNamesInfo(Property.SMBUnicode) NamesInfo;
  9518. case 0x0104: // SMB_FIND_FILE_BOTH_DIRECTORY_INFO
  9519. SmbFindFileBothDirectoryInfoPrevFile(Property.SMBUnicode) BothDirInfo;
  9520. /*
  9521. case 0x0105: // SMB_FIND_FILE_OLE_DIRECTORY_INFO
  9522. SMBFileOLEDirInfo(Property.SMBUnicode) OLEDirInfo;
  9523. */
  9524. case 0x0105: // SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO
  9525. SmbFindFileIdFullDirectoryInfo(Property.SMBUnicode) IDFullDirInfo;
  9526. case 0x0106: // SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO
  9527. SmbFindFileIdBothDirectoryInfo(Property.SMBUnicode) IDBothDirInfo;
  9528. default:
  9529. _struct Transact2Find2Datas
  9530. {
  9531. SMBReportUnknownInfoLevel(TransInformationLevel) WarningErrorInfo;
  9532. BLOB(FrameLength - FrameOffset) Data;
  9533. };
  9534. }// switch (TransInformationLevel)
  9535. }// While
  9536. case SMBSubCommand == 0x03: //TRANS2_QUERY_FS_INFORMATION
  9537. case SMBSubCommand == 0x0F: //TRANS2_QUERY_FS_INFORMATION_FID
  9538. SMBTrans2FSInfoDataBlock(TransInformationLevel) QueryFSInfoDataBlock;
  9539. case SMBSubCommand == 0x05: //TRANS2_QUERY_PATH_INFORMATION
  9540. case SMBSubCommand == 0x07: //TRANS2_QUERY_FILE_INFORMATION
  9541. switch(TransInformationLevel)
  9542. {
  9543. case 0x0001: // SMB_INFO_STANDARD
  9544. case 0x0002: // SMB_INFO_QUERY_EA_SIZE
  9545. SMBTrans2FileStandard(TransInformationLevel) FileStandard;
  9546. case 0x0003: // SMB_INFO_QUERY_EAS_FROM_LIST
  9547. case 0x0004: // SMB_INFO_QUERY_ALL_EAS
  9548. SMBFEAList FileEAs;
  9549. case 0x0101: // SMB_QUERY_FILE_BASIC_INFO
  9550. case 0x03EC: // FileBasicInformation
  9551. SMBTrans2FileBasicInfo FileBasicInfo;
  9552. case 0x0102: // SMB_QUERY_FILE_STANDARD_INFO
  9553. case 0x03ED: // FileStandardInformation
  9554. SMBTrans2FileStandardInfo FileStandardInfo;
  9555. case 0x0103: // SMB_QUERY_FILE_EA_INFO
  9556. case 0x03EF: // FileEaInformation
  9557. SMBTrans2FileEAInfo FileEAInfo;
  9558. case 0x0104: // SMB_QUERY_FILE_NAME_INFO
  9559. case 0x03F1: // FileNameInformation
  9560. case 0x0108: // SMB_QUERY_FILE_ALT_NAME_INFO
  9561. case 0x03FD: // FileAlternateNameInformation
  9562. case 0x0410: // FileShortNameInformation
  9563. SMBTrans2FileNameInfo NameInfo;
  9564. case 0x0107: // SMB_QUERY_FILE_ALL_INFO
  9565. case 0x03FA: // FileAllInformation
  9566. [property.LengthOfFileName1 = DataOffset % 2 > 0 ? UINT32(FrameData, FrameOffset + 69) : UINT32(FrameData, FrameOffset + 68),
  9567. property.LengthOfFileName2 = DataOffset % 2 > 0 ? UINT32(FrameData, FrameOffset + 89) : UINT32(FrameData, FrameOffset + 88)]
  9568. switch
  9569. {
  9570. //Windows NT Servers send 4 more bytes that are set to arbitrary values and are ignored on receipt
  9571. case DataOffset % 2 > 0 && (property.LengthOfFileName1 + 73 == DataCount || property.LengthOfFileName1 + 73 + 4== DataCount ):
  9572. case DataOffset % 2 == 0 && (property.LengthOfFileName1 + 72 == DataCount || property.LengthOfFileName1 + 72 + 4== DataCount ):
  9573. SMBTrans2FileAllInfoPrivate FileAllInfoPrivate;
  9574. case DataOffset % 2 > 0 && (property.LengthOfFileName2 + 93 == DataCount || property.LengthOfFileName1 + 93 + 4== DataCount ):
  9575. case DataOffset % 2 == 0 && (property.LengthOfFileName2 + 92 == DataCount || property.LengthOfFileName1 + 92 + 4== DataCount ):
  9576. SMBTrans2FileAllInfo FileAllInfo;
  9577. }
  9578. case 0x0109: // SMB_QUERY_FILE_STREAM_INFO
  9579. case 0x03FE: // FileStreamInformation
  9580. SMBTrans2FileStreamInfo FileStreamInfo;
  9581. case 0x010B: // SMB_QUERY_FILE_COMPRESSION_INFO
  9582. case 0x0404: // FileCompressionInformation
  9583. SMBTrans2FileCompressionInfo FileCompressionInfo;
  9584. case 0x0200: // SMB_QUERY_FILE_UNIX_BASIC
  9585. SMBTrans2FileUnixBasicInfo FileUnixBasicInfo;
  9586. case 0x0201: // SMB_QUERY_FILE_UNIX_LINK
  9587. [Post.SMBComPramSummary = ", Link Destination = " + SMBFileNameValue]
  9588. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) LinkDest;
  9589. case 0x03E9: // FileDirectoryInformation
  9590. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9591. While FileDirInfo[FrameOffset + 64 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9592. {
  9593. SMBFileDirInfo(Property.SMBUnicode) DirInfo;
  9594. };
  9595. case 0x03EA: // FileFullDirectoryInformation
  9596. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9597. While FileFullDirInfo[FrameOffset + 68 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9598. {
  9599. SMBFileFullDirInfo(Property.SMBUnicode) FullDirInfo;
  9600. };
  9601. case 0x03EB: // FileBothDirectoryInformation
  9602. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9603. While FileBothDirInfo[FrameOffset + 69 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9604. {
  9605. SmbFindFileBothDirectoryInfoPrevFile(Property.SMBUnicode) BothDirInfo;
  9606. };
  9607. case 0x03EE: // FileInternalInformation
  9608. _struct FileInternalInfor
  9609. {
  9610. UINT64 IndexNumber;
  9611. };
  9612. case 0x03F0: // FileAccessInformation
  9613. _struct FileAccessInfo
  9614. {
  9615. SMBAccessMask AccessFlags;
  9616. };
  9617. case 0x03F2: // FileRenameInformation
  9618. FSCCFileRenameInformationForSMB FileRenameInfo;
  9619. case 0x03F3: // FileLinkInformation
  9620. FSCCFileLinkInformationForSMB FileLinkInfo;
  9621. case 0x03F4: // FileNamesInformation
  9622. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9623. While FileNamesInfo[FrameOffset + 12 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9624. {
  9625. SMBFileNamesInfo(Property.SMBUnicode) NamesInfo;
  9626. };
  9627. case 0x03F5: // FileDispositionInformation
  9628. _struct FileDispositionInfo
  9629. {
  9630. BOOLEAN DeleteFile;
  9631. };
  9632. case 0x03F6: // FilePositionInformation
  9633. _struct FilePositionInfo
  9634. {
  9635. UINT64 CurrentByteOffset;
  9636. };
  9637. case 0x03F7: // FileFullEaInformation
  9638. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9639. While FileFullEaInfo[FrameOffset + 8 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9640. {
  9641. SMBFileFullEAInfo(Property.SMBUnicode) FullEAInfo;
  9642. };
  9643. case 0x03F8: // FileModeInformation
  9644. _struct FileModeInfo
  9645. {
  9646. UINT32 Mode
  9647. {
  9648. UINT32 Reserved1:1 = FormatString(" (%s) UnUsed",this.ToBitString);
  9649. UINT32 WriteThrough:1 = FormatString(" (%s) %s",this.ToBitString,this ? "Data is written to file before the driver completes a write request" : "Data is NOT written to file before the driver completes a write request");
  9650. UINT32 SequentialOnly:1 = FormatString("(%s) %s",this.ToBitString,this ? "All access to the file is sequential" : "NOT All access to the file is sequential");
  9651. UINT32 Reserved2:1 = FormatString(" (%s) UnUsed",this.ToBitString);
  9652. UINT32 SynIOAlert:1 = FormatString(" (%s) %s",this.ToBitString,this ? "All operations on the file are performed synchronously" : "NOT All operations on the file are performed synchronously");
  9653. UINT32 SynIONonalert:1 = FormatString(" (%s) %s",this.ToBitString,this ? "All operations on the file are to be performed synchronously" :"NOT All operations on the file are to be performed synchronously");
  9654. UINT32 Reserved3:26 = FormatString(" (%s) UnUsed",this.ToBitString);
  9655. };
  9656. };
  9657. case 0x03F9: // FileAlignmentInformation
  9658. _struct FileAlignmentInfo
  9659. {
  9660. UINT32 AlignmentRequirement = SMBAlignmentRequirementTable(this);
  9661. };
  9662. case 0x03FB: // FileAllocationInformation
  9663. _struct FileAllocationInfo
  9664. {
  9665. SMBLargeInteger AllocationSize;
  9666. };
  9667. case 0x03FC: // FileEndOfFileInformation
  9668. _struct FileEndOfFileInfo
  9669. {
  9670. SMBLargeInteger EndOfFile;
  9671. };
  9672. case 0x03FF: // FilePipeInformation
  9673. SMBTrans2FilePipeInfo FilePipeInfo;
  9674. case 0x0400: // FilePipeLocalInformation
  9675. SMBTrans2FilePipeLocalInfo FilePipeLocalInfo;
  9676. case 0x0401: // FilePipeRemoteInformation
  9677. SMBTrans2FilePipeRemoteInfo FilePipeRemoteInfo;
  9678. case 0x0402: // FileMailslotQueryInformation
  9679. SMBTrans2FileMailslotQueryInfo FileMailslotQueryInfo;
  9680. case 0x0403: // FileMailslotSetInformation
  9681. _struct FileMailslotSetInfo
  9682. {
  9683. FILETIME ReadTimeout;
  9684. };
  9685. case 0x0405: // FileObjectIDInformation
  9686. SMBTrans2FileObjectIDInfo FileObjectIDInfo;
  9687. //case 0x0406: // FileCompletionInformation
  9688. case 0x0408: // FileQuotaInformation
  9689. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9690. While FileQuotaInfo[FrameOffset + 8 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9691. {
  9692. SMBFileQuotaInfo QuotaInfo;
  9693. };
  9694. case 0x0409: // FileReparsePointInformation
  9695. _struct FileReparsePointInfo
  9696. {
  9697. UINT64 FileReference;
  9698. UINT32 Tag;
  9699. };
  9700. case 0x040A: // FileNetworkOpenInformation
  9701. SMBTrans2FileNetworkOpenInfo FileNetworkOpenInfo;
  9702. case 0x040B: // FileAttributeTagInformation
  9703. _struct FileAttributeTagInfo
  9704. {
  9705. SMBNTFileAttributes Attributes;
  9706. UINT32 ReparseTag;
  9707. };
  9708. case 0x040C: // FileTrackingInformation
  9709. _struct FileTrackingInfo
  9710. {
  9711. UINT32 DestinationFile;
  9712. UINT32 ObjectInformationLength;
  9713. BLOB(ObjectInformationLength) ObjectInformation;
  9714. };
  9715. case 0x040D: // FileIdBothDirectoryInformation
  9716. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9717. While FileIdBothDirInfo[FrameOffset + 69 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9718. {
  9719. SmbFindFileIdBothDirectoryInfo(Property.SMBUnicode) IDBothDirInfo;
  9720. };
  9721. case 0x040E: // FileIdFullDirectoryInformation
  9722. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9723. While FileIdFullDirInfo[FrameOffset + 76 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9724. {
  9725. SmbFindFileIdFullDirectoryInfo(Property.SMBUnicode) IDFullDirInfo;
  9726. };
  9727. case 0x040F: // FileValidDataLengthInformation
  9728. _struct FileValidDataLengthInfo
  9729. {
  9730. UINT64 ValidDataLength;
  9731. };
  9732. default:
  9733. _struct Transact2Datas
  9734. {
  9735. SMBReportUnknownInfoLevel(TransInformationLevel) WarningErrorInfo;
  9736. BLOB(FrameLength - FrameOffset) Data;
  9737. };
  9738. }
  9739. case SMBSubCommand == 0x08://TRANS2_SET_FILE_INFORMATION: Set File Attributes Given FID
  9740. switch(TransInformationLevel)
  9741. {
  9742. case 0x0001: // SMB_INFO_STANDARD
  9743. case 0x0002: // SMB_INFO_QUERY_EA_SIZE
  9744. SMBTrans2FileStandard(TransInformationLevel) FileStandardDataBlock;
  9745. case 0x0101: // SMB_QUERY_FILE_BASIC_INFO
  9746. case 0x03EC: // FileBasicInformation
  9747. SMBTrans2FileBasicInfo FileBasicDataBlock;
  9748. case 0x0102: // SMB_SET_FILE_DISPOSITION_INFO
  9749. case 0x03F5: // FileDispositionInformation
  9750. _struct FileDispositionInfoDataBlock
  9751. {
  9752. BOOLEAN DeleteFile;
  9753. };
  9754. case 0x0103: // SMB_SET_FILE_ALLOCATION_INFO
  9755. case 0x03FB: // FileAllocationInformation
  9756. _struct FileAllocationInfoDataBlock
  9757. {
  9758. SMBLargeInteger AllocationSize;
  9759. };
  9760. case 0x0104: // SMB_SET_FILE_END_OF_FILE_INFO
  9761. case 0x03FC: // FileEndOfFileInformation
  9762. _struct FileEndOfFileInfoDataBlock
  9763. {
  9764. SMBLargeInteger EndOfFile;
  9765. };
  9766. case 0x0200: // SMB_QUERY_FILE_UNIX_BASIC
  9767. SMBTrans2FileUnixBasicInfo FileUnixBasicInfoDataBlock;
  9768. case 0x0201: // SMB_QUERY_FILE_UNIX_LINK
  9769. case 0x0203: // SMB_QUERY_FILE_UNIX_HLINK
  9770. [Post.SMBComPramSummary = ", Link Destination = " + SMBFileNameValue]
  9771. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) LinkDest;
  9772. case 0x03F2: // FileRenameInformation
  9773. FSCCFileRenameInformationForSMB FileRenameInfoDataBlock;
  9774. case 0x03F3: // FileLinkInformation
  9775. FSCCFileLinkInformationForSMB FileLinkInfoDataBlock;
  9776. case 0x03F6: // FilePositionInformation
  9777. _struct FilePositionInfoDataBlock
  9778. {
  9779. UINT64 CurrentByteOffset;
  9780. };
  9781. case 0x03F8: // FileModeInformation
  9782. _struct FileModeInfoDataBlock
  9783. {
  9784. UINT32 Mode
  9785. {
  9786. UINT32 Reserved1:1 = FormatString(" (%s) UnUsed",this.ToBitString);
  9787. UINT32 WriteThrough:1 = FormatString(" (%s) %s",this.ToBitString,this ? "Data is written to file before the driver completes a write request" : "Data is NOT written to file before the driver completes a write request");
  9788. UINT32 SequentialOnly:1 = FormatString("(%s) %s",this.ToBitString,this ? "All access to the file is sequential" : "NOT All access to the file is sequential");
  9789. UINT32 Reserved2:1 = FormatString(" (%s) UnUsed",this.ToBitString);
  9790. UINT32 SynIOAlert:1 = FormatString(" (%s) %s",this.ToBitString,this ? "All operations on the file are performed synchronously" : "NOT All operations on the file are performed synchronously");
  9791. UINT32 SynIONonalert:1 = FormatString(" (%s) %s",this.ToBitString,this ? "All operations on the file are to be performed synchronously" :"NOT All operations on the file are to be performed synchronously");
  9792. UINT32 Reserved3:26 = FormatString(" (%s) UnUsed",this.ToBitString);
  9793. };
  9794. };
  9795. case 0x03FF: // FilePipeInformation
  9796. SMBTrans2FilePipeInfo FilePipeInfoDataBlock;
  9797. case 0x0401: // FilePipeRemoteInformation
  9798. SMBTrans2FilePipeRemoteInfo FilePipeRemoteInfoDataBlock;
  9799. case 0x0405: // FileObjectIDInformation
  9800. SMBTrans2FileObjectIDInfo FileObjectIDInfoDataBlock;
  9801. case 0x0408: // FileQuotaInformation
  9802. [SmbRTransact2NxtEntryOffset = FrameOffset]
  9803. While FileQuotaInfo[FrameOffset + 8 < FrameLength && SmbRTransact2NxtEntryOffset == FrameOffset]
  9804. {
  9805. SMBFileQuotaInfo QuotaInfo;
  9806. };
  9807. case 0x040F: // FileValidDataLengthInformation
  9808. _struct FileValidDataLengthInfoDataBlock
  9809. {
  9810. UINT64 ValidDataLength;
  9811. };
  9812. case 0x0410: // FileNameInformation
  9813. SMBTrans2FileNameInfo NameInfoDataBlock;
  9814. //case 0x0105: //SMB_SET_FILE_OLE_CLASSID_INFO
  9815. //case 0x0106: //SMB_SET_FILE_OLE_STATE_BITS_INFO
  9816. //case 0x0107: //SMB_SET_FILE_OBJECTID_INFO
  9817. //case 0x0108: //SMB_SET_FILE_CONTENT_INDEX_INFO
  9818. //case 0x0109: //SMB_SET_FILE_INHERIT_CONTENT_INDEX_INFO
  9819. //case 0x010A: //SMB_SET_FILE_OLE_INFO
  9820. default:
  9821. _struct ErrorDataBlock
  9822. {
  9823. SMBReportUnknownInfoLevel(TransInformationLevel) WarningErrorInfo;
  9824. BLOB(FrameLength - FrameOffset) Data;
  9825. };
  9826. }
  9827. case SMBSubCommand == 0x0E: //#? TRANS2_SESSION_SETUP
  9828. struct SessionSetupDataBlock
  9829. {
  9830. UINT8 WordCount;
  9831. UINT8 Pad;
  9832. UINT16 UserID;
  9833. UINT32 SecurityBlobLength;
  9834. SMBSecurityBlob(SecurityBlobLength) SecurityBlob;
  9835. }
  9836. case SMBSubCommand == 0x10: //TRANS2_GET_DFS_REFERRAL
  9837. [DataFieldFrameLength = SMBBytesEndOffset]
  9838. DFSC Dfsc;
  9839. default:
  9840. switch
  9841. {
  9842. case SMBSubCommand >= 0x00:
  9843. _struct ErrorDataBlock
  9844. {
  9845. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("Unknown SMB Transaction2 Data Block, SubCommand = 0x%X", SMBSubCommand)) SMBSubCommandError;
  9846. BLOB(FrameLength - FrameOffset) Data;
  9847. };
  9848. default:
  9849. _struct WarningDataBlock
  9850. {
  9851. ReportParserWarning("SMB", "May not parse correctly when Transaction2 request is missing") SMBDataBlockWarning;
  9852. BLOB(FrameLength - FrameOffset) Data;
  9853. };
  9854. }
  9855. }//End of switch(SMBSubCommand)
  9856. switch
  9857. {
  9858. case FrameOffset < FrameLength:
  9859. BLOB(FrameLength - FrameOffset) OtherData;
  9860. }
  9861. }//End of struct SMBTrans2DataBlock
  9862. case DataDisplacement > 0 && DataCount > 0:
  9863. //
  9864. // These are Fragmented Ttrans2 Response Data
  9865. //
  9866. [
  9867. SMBContinuation = TRUE,
  9868. SMBComPramSummary = SMBComPramSummary + " - Continued Response",
  9869. PayloadStart(
  9870. NetworkDirection, /* direction */
  9871. 0, /* id */
  9872. DataDisplacement, /* sequence token */
  9873. DataDisplacement + DataCount, /* next sequence token */
  9874. 0, /* total payload length */
  9875. 0, /* is first */
  9876. TotalParameterCount == ParamDisplacement + ParameterCount && TotalDataCount == DataDisplacement + DataCount, /* is last */
  9877. RssmblyIndStartBit+RssmblyIndEndBit+RssmblySequenceBit+RssmblySelfBit, //has start and end indication
  9878. 0x0000, /* Properties... */
  9879. SMBResponse,
  9880. 0x0000, /* Properties... */
  9881. ""
  9882. )
  9883. ]
  9884. BLOB(DataCount > FrameLength - FrameOffset ? FrameLength - FrameOffset : DataCount) Data;
  9885. }
  9886. switch
  9887. {
  9888. case frameOffset < frameLength &&
  9889. frameOffset < SMBBytesEndOffset:
  9890. BLOB(SMBBytesEndOffset - frameOffset > frameLength - frameOffset ? frameLength - frameOffset : SMBBytesEndOffset - frameOffset) Pad;
  9891. }
  9892. }
  9893. Struct SMBReportUnknownInfoLevel(InfoLevel)
  9894. {
  9895. Switch
  9896. {
  9897. case IsValueNone(InfoLevel):
  9898. ReportParserWarning("SMB", "May not parse correct, the InformationLevel is missing.") SMBInformationLevelWarning;
  9899. default:
  9900. ReportParserError(ParserErrorProtocolClassWindows, "SMB", FormatString("Unknown SMB Transaction2 Data Block, Information Level = 0x%X", InfoLevel)) SMBInformationLevelError;
  9901. }
  9902. }
  9903. struct SMBTrans2FSInfoDataBlock(TransInformationLevel) = SMBTrans2QueryFSInfoLevelTable(TransInformationLevel)
  9904. {
  9905. switch(TransInformationLevel)
  9906. {
  9907. case 0x0001: //SMB_INFO_ALLOCATION
  9908. _struct Standard
  9909. {
  9910. UINT32 FileSystemID;
  9911. UINT32 cSectorUnit;
  9912. UINT32 cUnit;
  9913. UINT32 cUnitAvailable ;
  9914. UINT16 cbSector;
  9915. };
  9916. case 0x0002: // SMB_INFO_VOLUME
  9917. _struct VolumeInfo
  9918. {
  9919. UINT32 ulVolSerialNbr;
  9920. UINT8 cCharCount;
  9921. [Post.SMBComPramSummary = ", Volume = " + SMBFileNameValue]
  9922. struct VolumeLabel = SMBFileNameValue
  9923. {
  9924. switch( SMBUnicode )
  9925. {
  9926. case 0:
  9927. [SMBFileNameValue]
  9928. AsciiString( cCharCount ) AsciiVolumeLabel;
  9929. case 1:
  9930. [SMBFileNameValue]
  9931. UnicodeString( cCharCount ) UnicodeVolumeLabel;
  9932. }
  9933. }
  9934. switch
  9935. {
  9936. case !SMBUnicode:
  9937. BLOB( FrameLength - FrameOffset ) ExtraNullPad;
  9938. }
  9939. };
  9940. case 0x0101: // SMB_QUERY_FS_LABEL_INFO
  9941. case 0x03EA: // FileFsLabelInformation
  9942. _struct FSLabelInformation
  9943. {
  9944. UINT32 VolumeLabelLength;
  9945. [Post.SMBComPramSummary = ", FSLabel = " + SMBFileNameValue]
  9946. SMBFileNameString(SMBUnicode, FALSE, 0, ProtocolOffset) FSLabel;
  9947. };
  9948. case 0x0102: // SMB_QUERY_FS_VOLUME_INFO
  9949. case 0x03E9: // FileFsVolumeInformation
  9950. _struct FsVolumeInformation
  9951. {
  9952. FILETIME CreationTime;
  9953. UINT32 VolumeSerialNumber;
  9954. UINT32 VolumeLabelLength;
  9955. BOOLEAN SupportsObjects;
  9956. [Post.SMBComPramSummary = SMBFileNameValue ? ", Label = " + SMBFileNameValue :""]
  9957. SMBFileNameString(SMBUnicode, TRUE, VolumeLabelLength, ProtocolOffset) VolumeLabel;
  9958. }
  9959. case 0x0103: // SMB_QUERY_FS_SIZE_INFO
  9960. case 0x03EB: // FileFsSizeInformation
  9961. _struct FsSizeInformation
  9962. {
  9963. UINT64 TotalAllocationUnits;
  9964. UINT64 AvailableAllocationUnits;
  9965. UINT32 SectorsPerAllocationUnit;
  9966. UINT32 BytesPerSector;
  9967. }
  9968. case 0x0104: // SMB_QUERY_FS_DEVICE_INFO
  9969. case 0x03EC: // FileFsDeviceInformation
  9970. _struct FsDeviceInformation
  9971. {
  9972. UINT32 DeviceType = SMBDeviceTypeTable(this);
  9973. // # ? this field will be enriched in future.
  9974. [DataFieldByteOrder = LittleEndian]
  9975. UINT32 DeviceCharacteristics
  9976. {
  9977. UINT32 Removable:1 = FormatString(" (%s) %s (FILE_REMOVABLE_MEDIA)", this.ToBitString, this ? "Removable Media" : "NOT Removable Media");
  9978. UINT32 ReadOnly:1 = FormatString(" (%s) %s (FILE_READ_ONLY_DEVICE)", this.ToBitString, this ? "Read Only Device" : "NOT Read Only Device");
  9979. UINT32 Floppy:1 = FormatString(" (%s) %s (FILE_FLOPPY_DISKETTE)", this.ToBitString, this ? "Floppy Diskette" : "NOT Floppy Diskette");
  9980. UINT32 WriteOne:1 = FormatString(" (%s) %s (FILE_WRITE_ONE_MEDIA)", this.ToBitString, this ? "Write One Media" : "NOT Write One Media");
  9981. UINT32 Remote:1 = FormatString(" (%s) %s (FILE_REMOTE_DEVICE)", this.ToBitString, this ? "Remote Device" : "NOT Remote Device");
  9982. UINT32 IsMounted:1 = FormatString(" (%s) %s (FILE_DEVICE_IS_MOUNTED)", this.ToBitString, this ? "Device Is Mounted" : "Device Is NOT Mounted");
  9983. UINT32 VirtualVolume:1 = FormatString(" (%s) %s (FILE_VIRTUAL_VOLUME)", this.ToBitString, this ? "Virtual Volume" : "NOT Virtual Volume");
  9984. UINT32 DeviceSecureOpen:1 = FormatString(" (%s) %s (FILE_DEVICE_SECURE_OPEN)", this.ToBitString, this ? "Volume ACL Is Checked" : "Volume ACL Is Not Checked" );
  9985. UINT32 CharacteristicsTsDevice:1 = FormatString(" (%s) %s (FILE_CHARACTERISTIC_TS_DEVICE)", this.ToBitString , this ? "Device object is part of a Terminal Services device stack" : "Device object is part of a Terminal Services device stack");
  9986. UINT32 CharacteristicsWebDavDevice:1 = FormatString("(%s) %s (FILE_CHARACTERISTIC_WEBDAV_DEVICE)", this.ToBitString , this ? "Web-based Distributed Authoring and Versioning (WebDAV) file system is mounted on the device" : "Web-based Distributed Authoring and Versioning (WebDAV) file system is not mounted on the device");
  9987. UINT32 Reserved:22 = FormatString(" (%s) Reserved", this.ToBitString);
  9988. };
  9989. };
  9990. case 0x0105: // SMB_QUERY_FS_ATTRIBUTE_INFO
  9991. case 0x03ED: // FileFsAttributeInformation
  9992. _struct FsAttributeInformation
  9993. {
  9994. UINT32 FileSystemAttributes
  9995. {
  9996. UINT32 CaseSensitiveSearch:1 = FormatString(" (%s) %s (FILE_CASE_SENSITIVE_SEARCH)", this.ToBitString, this ? "Case Sensitive Search" : "NOT Case Sensitive Search");
  9997. UINT32 CasePreservedNames:1 = FormatString(" (%s) %s (FILE_CASE_PRESERVED_NAMES)", this.ToBitString, this ? "Use Case Preserved Names" : "Do NOT Use Case Preserved Names");
  9998. UINT32 UnicodeonDisk:1 = FormatString(" (%s) %s (FILE_UNICODE_ON_DISK)",this.toBitString,this?"File supports unicode name":"File does not support unicode name");
  9999. UINT32 PersistentAcls:1 = FormatString(" (%s) %s (FILE_PERSISTENT_ACLS)", this.ToBitString, this ? "Has Persistent ACLs" : "Does NOT Have Persistent ACLs");
  10000. UINT32 FileCompression:1 = FormatString(" (%s) %s (FILE_FILE_COMPRESSION)", this.ToBitString, this ? "File is Compressed" : "File is NOT Compressed");
  10001. UINT32 VolumeQuotas:1 = FormatString(" (%s) %s (FILE_VOLUME_QUOTAS)", this.ToBitString, this ? "Volume Quotas" : "NO Volume Quotas");
  10002. UINT32 SupportSparseFile:1 = FormatString(" (%s) %s (FILE_SUPPORTS_SPARSE_FILES)",this.toBitString,this?"File supports sparse files":"File does not support sparse file");
  10003. UINT32 SupportReparsePoint:1 = FormatString(" (%s) %s (FILE_SUPPORTS_REPARSE_POINTS)",this.toBitString,this?"File supports Reparse points":"File does not support reparse points");
  10004. UINT32 SupportRemoteStorage:1 = FormatString(" (%s) %s (FILE_SUPPORTS_REMOTE_STORAGE)",this.toBitString,this?"File supports remote storage":"File does not support remote storage");
  10005. UINT32 Reserved:6 = FormatString(" (%s) Reserved (Reserved)",this.toBitString);
  10006. UINT32 VolumeCompressed:1 = FormatString(" (%s) %s (FILE_VOLUME_IS_COMPRESSED)",this.toBitString,this?"Volume is Compressed":"Volume is not compressed");
  10007. UINT32 SupportObject:1 = FormatString(" (%s) %s (FILE_SUPPORTS_OBJECT_IDS)",this.toBitString,this?"File support object":"File does not support object");
  10008. UINT32 SupportEncryption:1 = FormatString(" (%s) %s (FILE_SUPPORTS_ENCRYPTION)",this.toBitString,this?"File supports encryption":"File does not support encryption");
  10009. UINT32 NamedStream:1 = FormatString(" (%s) %s (FILE_NAMED_STREAMS)",this.toBitString,this?"File supports multiple named data streams for a file":"File does not support multiple named data streams for a file");
  10010. UINT32 ReadOnlyVolume:1 = FormatString(" (%s) %s (FILE_READ_ONLY_VOLUME)",this.toBitString,this?"Specified volume is read only":"Specified volume can be write");
  10011. UINT32 SequentialWriteOnce:1 = FormatString(" (%s) %s (FILE_SEQUENTIAL_WRITE_ONCE)",this.toBitString,this?"Specified volume can be written to one time":"Specified volume can be written not only to one time");
  10012. UINT32 SupportTransactions:1 = FormatString(" (%s) %s (FILE_SUPPORTS_TRANSACTIONS)",this.toBitString,this?"File system supports transaction processing":"File system dose not support transaction processing");
  10013. UINT32 SupportHardLinks:1 = FormatString(" (%s) %s (FILE_SUPPORTS_HARD_LINKS)",this.toBitString,this?"File system supports direct links to other devices and partitions":"File system does not support direct links to other devices and partitions");
  10014. UINT32 SupportsExtendedAttributes:1 = FormatString("(%s) %s (FILE_SUPPORTS_EXTENDED_ATTRIBUTES)",this.toBitString,this?"File system stores extended attribute information per file":"File system doesnot stores extended attribute information per file");
  10015. UINT32 Reserved_bits24_31:8 = FormatString(" (%s) Reserved", this.ToBitString);
  10016. }
  10017. UINT32 MaximumComponentNameLength;
  10018. UINT32 FileSystemNameLength;
  10019. [Post.SMBComPramSummary = ", FS = " + SMBFileNameValue]
  10020. SMBFileNameString(SMBUnicode, TRUE, FileSystemNameLength, ProtocolOffset) FSName;
  10021. }
  10022. case 0x200: // SMB_UNIX_QUERY_FS_INFO
  10023. _struct UnixQueryFSInfomation
  10024. {
  10025. UINT16 MajorVersionNumber;
  10026. UINT16 MinorVersionNumber;
  10027. // #? this capability is 8 bytes.
  10028. UINT64 Capability;
  10029. };
  10030. case 0x301: // SMB_Mac_Query_FS_Info
  10031. _struct SMBMacQueryFSInfomation
  10032. {
  10033. FILETIME CreationTime;
  10034. FILETIME ModifyTime;
  10035. FILETIME BackupTime;
  10036. UINT32 AllocationBlocks;
  10037. UINT32 AllocationBlockSize;
  10038. UINT32 FreeBlockCount;
  10039. Blob(32) FinderInfo = FormatString("%X", this);
  10040. UINT32 RootFilesNumber;
  10041. UINT32 RootDirectoriesNumber;
  10042. UINT32 FilesNumber;
  10043. UINT32 DirectoriesNumber;
  10044. // #? this flags will be enriched in future.
  10045. UINT32 SupportFlags;
  10046. };
  10047. case 0x03EE: // FileFsControlInformation
  10048. _struct SMBFSControlInfomation
  10049. {
  10050. UINT64 FreeSpaceStartFiltering;
  10051. UINT64 FreeSpaceThreshold;
  10052. UINT64 FreeSpaceStopFiltering;
  10053. UINT64 DefaultQuotaThreshold;
  10054. UINT64 DefaultQuotaLimit;
  10055. UINT32 FileSystemControlFlags;
  10056. };
  10057. case 0x03EF: // FileFsFullSizeInformation
  10058. _struct FsFullSizeInformation
  10059. {
  10060. UINT64 TotalAllocationUnits;
  10061. UINT64 CallerAvailableAllocationUnits;
  10062. UINT64 ActualAvailableAllocationUnits;
  10063. UINT32 SectorsPerAllocationUnit;
  10064. UINT32 BytesPerSector;
  10065. }
  10066. case 0x03F0: // FileFsObjectIdInformation
  10067. _struct FsObjectIDInformation
  10068. {
  10069. GUID(FALSE) QueryObjectID;
  10070. // this did NOT desc in the doc
  10071. UINT8 ExtendedInfo[48];
  10072. }
  10073. case 0x03F1: // FileFsDriverPathInformation
  10074. _struct FsDriverPathInformation
  10075. {
  10076. BOOLEAN DriverInPath;
  10077. UINT32 DriverNameLength;
  10078. ALIGN2 Align;
  10079. UnicodeString(DriverNameLength/2) DriverName;
  10080. }
  10081. case 0x03F2: // FileFsVolumeFlagsInformation
  10082. _struct FsVolumeFlagsInformation
  10083. {
  10084. UINT32 Flags;
  10085. }
  10086. default:
  10087. _struct Transact2UnknownDatas
  10088. {
  10089. SMBReportUnknownInfoLevel(TransInformationLevel) WarningErrorInfo;
  10090. BLOB(FrameLength - FrameOffset) Data;
  10091. };
  10092. }
  10093. }
  10094. struct SMBTrans2FileStandard(InfoLevel)
  10095. {
  10096. SMBDATE CreationDate;
  10097. SMBTIME CreationTime;
  10098. SMBDATE LastAccessDate;
  10099. SMBTIME LastAccessTime;
  10100. SMBDATE LastWriteDate;
  10101. SMBTIME LastWriteTime;
  10102. UINT32 DataSize;
  10103. UINT32 AllocationSize;
  10104. SMBFileAttributes Attributes;
  10105. switch(InfoLevel)
  10106. {
  10107. case 0x0002:
  10108. UINT32 EaSize;
  10109. };
  10110. }
  10111. struct SMBTrans2FileBasicInfo
  10112. {
  10113. FILETIME CreationTime;
  10114. FILETIME AccessTime;
  10115. FILETIME LastWriteTime;
  10116. FILETIME LastChangeTime;
  10117. SMBNTFileAttributes Attributes;
  10118. };
  10119. struct SMBTrans2FileStandardInfo
  10120. {
  10121. SMBLargeInteger AllocationSize;
  10122. SMBLargeInteger EndOfFile;
  10123. UINT32 NumberOfLinks;
  10124. BOOLEAN DeletePending;
  10125. BOOLEAN IsDirectory;
  10126. };
  10127. struct SMBTrans2FileEAInfo
  10128. {
  10129. UINT32 EaLength;
  10130. }
  10131. struct SMBTrans2FileNameInfo
  10132. {
  10133. [StructBaseOffset = FrameOffset]
  10134. UINT32 FileNameLength;
  10135. [Post.SMBComPramSummary = ", FileName = " + SMBFileNameValue]
  10136. SMBFileNameString(SMBUnicode, TRUE, FileNameLength, StructBaseOffset) FileName;
  10137. }
  10138. //TRANS2_QUERY_FILE_INFORMATION Response
  10139. struct SMBTrans2FileAllInfoPrivate
  10140. {
  10141. //BasicInformation
  10142. FILETIME CreationTime;
  10143. FILETIME LastAccessTime;
  10144. FILETIME LastWriteTime;
  10145. FILETIME ChangeTime;
  10146. SMBNTFileAttributes Attributes;
  10147. //StandardInformation
  10148. UINT32 Reserved1;
  10149. SMBLargeInteger AllocationSize;
  10150. SMBLargeInteger EndOfFile;
  10151. UINT32 NumberOfLinks;
  10152. BOOLEAN DeletePending;
  10153. BOOLEAN Directory;
  10154. UINT16 Reserved2;
  10155. UINT32 EASize;
  10156. UINT32 FileNameLength;
  10157. [Post.SMBComPramSummary = ", FileName = " + SMBFileNameValue]
  10158. SMBFileNameString(1, TRUE, FileNameLength, ProtocolOffset) FileName;
  10159. }
  10160. struct SMBTrans2FileAllInfo
  10161. {
  10162. //BasicInformation
  10163. FILETIME CreationTime;
  10164. FILETIME AccessTime;
  10165. FILETIME LastWriteTime;
  10166. FILETIME LastChangeTime;
  10167. SMBNTFileAttributes Attributes;
  10168. //StandardInformation
  10169. SMBLargeInteger AllocationSize;
  10170. SMBLargeInteger EndOfFile;
  10171. UINT32 NumberOfLinks;
  10172. BOOLEAN DeletePending;
  10173. BOOLEAN IsDirectory;
  10174. //InternalInformation
  10175. UINT64 IndexNumber;
  10176. //EaInformation
  10177. UINT32 EaLength;
  10178. //AccessInformation
  10179. SMBAccessMask AccessFlags;
  10180. //PositionInformation
  10181. UINT64 CurrentByteOffset;
  10182. //ModeInformation
  10183. UINT32 Mode
  10184. {
  10185. UINT32 Reserved1:1 = FormatString(" (%s) UnUsed",this.ToBitString);
  10186. UINT32 WriteThrough:1 = FormatString(" (%s) %s",this.ToBitString,this ? "Data is written to file before the driver completes a write request" : "Data is NOT written to file before the driver completes a write request");
  10187. UINT32 SequentialOnly:1 = FormatString("(%s) %s",this.ToBitString,this ? "All access to the file is sequential" : "NOT All access to the file is sequential");
  10188. UINT32 Reserved2:1 = FormatString(" (%s) UnUsed",this.ToBitString);
  10189. UINT32 SynIOAlert:1 = FormatString(" (%s) %s",this.ToBitString,this ? "All operations on the file are performed synchronously" : "NOT All operations on the file are performed synchronously");
  10190. UINT32 SynIONonalert:1 = FormatString(" (%s) %s",this.ToBitString,this ? "All operations on the file are to be performed synchronously" :"NOT All operations on the file are to be performed synchronously");
  10191. UINT32 Reserved3:26= FormatString(" (%s) UnUsed",this.ToBitString);
  10192. };
  10193. //AlignmentInformation
  10194. UINT32 AlignmentRequirement;
  10195. //NameInformation
  10196. UINT32 FileNameLength;
  10197. [Post.SMBComPramSummary = ", FileName = " + SMBFileNameValue]
  10198. SMBFileNameString(1 , TRUE, FileNameLength, ProtocolOffset) FileName;
  10199. }
  10200. struct SMBTrans2FileStreamInfo
  10201. {
  10202. [StreamNextEntryOffset = frameOffset]
  10203. while StreamEntries[StreamNextEntryOffset == frameOffset]
  10204. {
  10205. [
  10206. StructBaseOffset = FrameOffset,
  10207. StreamNextEntryOffset = frameOffset + NextEntryOffset
  10208. ]
  10209. UINT32 NextEntryOffset;
  10210. UINT32 StreamNameLength;
  10211. UINT64 StreamSize;
  10212. SMBLargeInteger AllocationSize;
  10213. SMBFileNameString(1, TRUE, StreamNameLength, StructBaseOffset) StreamName;
  10214. switch
  10215. {
  10216. case FrameOffset < StreamNextEntryOffset:
  10217. BLOB(StreamNextEntryOffset - FrameOffset) Padding;
  10218. }
  10219. }
  10220. }
  10221. struct SMBTrans2FileCompressionInfo
  10222. {
  10223. UINT64 CompressedFileSize;
  10224. UINT16 CompressionFormat = SMBFileCompressionFormatTable(this);
  10225. UINT8 CompressionUnitShift;
  10226. UINT8 CompressionChunkShift;
  10227. UINT8 CompressionClusterShift;
  10228. UINT24 Reserved;
  10229. }
  10230. struct SMBTrans2FileUnixBasicInfo
  10231. {
  10232. SMBLargeInteger EndOfFile;
  10233. UINT64 BytesNumber;
  10234. FILETIME LastStatusChange;
  10235. FILETIME LastAccessTime;
  10236. FILETIME LastModificationTime;
  10237. UINT64 FileOwnerUID;
  10238. UINT64 FileGroupGID;
  10239. UINT32 FileType = SMBUnixFileType(this);
  10240. UINT64 MajorDeviceNumber;
  10241. UINT64 MinorDeviceNumber;
  10242. UINT64 UniqueID;
  10243. UINT64 Permissions;
  10244. UINT64 Nlinks;
  10245. }
  10246. struct SMBTrans2FilePipeInfo
  10247. {
  10248. UINT32 ReadMode;
  10249. UINT32 CompletionMode;
  10250. }
  10251. struct SMBTrans2FilePipeLocalInfo
  10252. {
  10253. UINT32 NamedPipeType;
  10254. UINT32 NamedPipeConfiguration;
  10255. UINT32 MaximumInstances;
  10256. UINT32 CurrentInstances;
  10257. UINT32 InboundQuota;
  10258. UINT32 ReadDataAvailable;
  10259. UINT32 OutboundQuota;
  10260. UINT32 WriteQuotaAvailable;
  10261. UINT32 NamedPipeState;
  10262. UINT32 NamedPipeEnd;
  10263. }
  10264. struct SMBTrans2FilePipeRemoteInfo
  10265. {
  10266. FILETIME CollectDataTime;
  10267. UINT32 MaximumCollectionCount;
  10268. }
  10269. struct SMBTrans2FileMailslotQueryInfo
  10270. {
  10271. UINT32 MaximumMessageSize;
  10272. UINT32 MailslotQuota;
  10273. UINT32 NextMessageSize;
  10274. UINT32 MessagesAvailable;
  10275. FILETIME ReadTimeout;
  10276. }
  10277. struct SMBTrans2FileObjectIDInfo
  10278. {
  10279. UINT64 FileReference;
  10280. GUID(FALSE) ObjectID;
  10281. GUID(FALSE) BirthVolumeId;
  10282. GUID(FALSE) BirthObjectId;
  10283. GUID(FALSE) DomainId;
  10284. }
  10285. struct SMBTrans2FileNetworkOpenInfo
  10286. {
  10287. FILETIME CreationTime;
  10288. FILETIME AccessTime;
  10289. FILETIME LastWriteTime;
  10290. FILETIME LastChangeTime;
  10291. SMBLargeInteger AllocationSize;
  10292. SMBLargeInteger EndOfFile;
  10293. SMBNTFileAttributes Attributes;
  10294. UINT32 Unknown;
  10295. }
  10296. Table SMBComSubCommandTable(command, subCommand)
  10297. {
  10298. switch(command)
  10299. {
  10300. case 0x32: SMBTrans2SubCommandTable(subCommand);
  10301. case 0xA0: SMBNTTransactFunctionTable(subCommand);
  10302. default: "";
  10303. }
  10304. }
  10305. [Property.NLMPCurrentProtocol = "smb"]
  10306. struct SMBSecurityBlob(Length) = FormatString("%s %s %s", Property.KrbSname, Property.KrbReam, Property.KrbErrorCode)
  10307. {
  10308. switch
  10309. {
  10310. case Length > 0:
  10311. [DataFieldFrameLength = FrameOffset + Length]
  10312. struct
  10313. {
  10314. [SMBSummary = SMBSummary + " Authentication Method: GSSAPI"]
  10315. GSSAPI GSSAPI;
  10316. switch
  10317. {
  10318. case FrameLength > FrameOffset:
  10319. BLOB(FrameLength - FrameOffset) UnknownSecurityBlobData;
  10320. }
  10321. }
  10322. }
  10323. }
  10324. struct SMBLargeInteger = FormatString("%d",LargeInteger)
  10325. {
  10326. INT64 LargeInteger;
  10327. }
  10328. // [MS-CIFS] 2.2.6.2.1 Request (TRANS2_FIND_FIRST2)
  10329. Table SMBSearchStorageTypeTable(type)
  10330. {
  10331. switch(type)
  10332. {
  10333. case 0x01 : FormatString("%d (%#x) FILE_DIRECTORY_FILE: Search only for directories.", type, type);
  10334. case 0x40 : FormatString("%d (%#x) FILE_NON_DIRECTORY_FILE: Search only for files.", type, type);
  10335. default : FormatString("%d (%#x)", type, type);
  10336. }
  10337. }
  10338. // [MS-CIFS] 2.2.1.2.2.1 SMB_FEA_LIST
  10339. struct SMBFEAList = FormatString("%d SMB_FEA elements in %d bytes", Property.SmbFeaListCount, SizeOfListInBytes)
  10340. {
  10341. UINT32 SizeOfListInBytes;
  10342. [Local.SMBEADataStartOffSet = FrameOffSet, Property.SmbFeaListCount = 0]
  10343. while[FrameOffSet < (Local.SMBEADataStartOffSet + SizeOfListInBytes - 4)]
  10344. {
  10345. [Property.SmbFeaListCount = Property.SmbFeaListCount + 1]
  10346. SMBFEA FEA;
  10347. }
  10348. };
  10349. // [MS-CIFS] 2.2.1.2.1 SMB_GEA
  10350. struct SMBGEA = AttributeName
  10351. {
  10352. UINT8 AttributeNameLengthInBytes;
  10353. AsciiString(AttributeNameLengthInBytes + 1) AttributeName;
  10354. }
  10355. // [MS-CIFS] 2.2.1.2.1.1 SMB_GEA_LIST
  10356. struct SMBGEAList = FormatString("%d SMB_GEA elements in %d bytes", Property.SmbGeaListCount, SizeOfListInBytes)
  10357. {
  10358. UINT32 SizeOfListInBytes;
  10359. [Local.SMBEADataStartOffSet = FrameOffSet, Property.SmbGeaListCount = 0]
  10360. while[FrameOffSet < (Local.SMBEADataStartOffSet + SizeOfListInBytes - 4)]
  10361. {
  10362. [Property.SmbGeaListCount = Property.SmbGeaListCount + 1]
  10363. SMBGEA GEA;
  10364. }
  10365. };