AbstractIntended UsageDISCLAIMER OF WARRANTIES AND REPRESENTATIONSLIMITATION OF LIABILITYINTELLECTUAL PROPERTY RIGHTSCOPYRIGHT AND USAGE AGREEMENTAcknowledgementsTable of Contents1. Introduction1.1. Summary of features1.1.1. File access1.1.2. File and record locking1.1.3. Safe caching, read-ahead, and write-behind1.1.4. File change notification1.1.5. Protocol version negotiation1.1.6. Extended attributes1.1.7. Distributed replicated virtual volumes1.1.8. Server name resolution independence1.1.9. Batched requests1.1.10. Obsolescence2. Protocol Operation Overview2.1. Server Name Determination2.2. Server Name Resolution2.3. Sample Message Flow2.4. CIFS Protocol Dialect Negotiation2.5. Message Transport2.5.1. Connection Management2.6. Opportunistic Locks2.6.1. Oplock Types2.6.1.1. Exclusive and Batch Oplocks2.6.1.2. Level II Oplocks2.6.2. Comparison with Other File Locking Methods2.6.3. Oplock SMBs2.6.3.1. Obtaining an Oplock2.6.3.2. Releasing an Oplock2.6.3.3. Revoking an Oplock2.6.4. Other Issues2.7. Security Model2.8. Authentication2.8.1. Overview2.8.2. Base Algorithms2.8.3. Authentication Algorithms2.8.3.1. NT Session Key2.8.3.2. LM Session Key2.8.3.3. Response2.8.3.4. MAC key2.8.3.5. Message Authentication Code2.8.4. Session Authentication Protocol2.8.4.1. Plain Text Password2.8.4.2. Challenge/Response2.8.5. Message authentication code2.8.6. Security Level2.9. Distributed File System (DFS) Support3. SMB Message Formats and Data Types3.1. Notation3.2. SMB header3.2.1. Command field3.2.2. Flags field3.2.3. Flags2 Field3.2.4. Tid Field3.2.5. Pid Field3.2.6. Uid Field3.2.7. Mid Field3.2.8. Status Field3.2.9. Timeouts3.2.10. Data Buffer (BUFFER) and String Formats3.3. Name Restrictions3.4. File Names3.5. Wildcards3.6. DFS Pathnames3.7. Time And Date Encoding3.8. Access Mode Encoding3.9. Access Mask Encoding3.10. Open Function Encoding3.11. Open Action Encoding3.12. File Attribute Encoding3.13. Extended File Attribute Encoding3.14. Batching Requests (“AndX” Messages)3.15. “Transaction” Style Subprotocols3.15.1. SMB_COM_TRANSACTION2 Format3.15.2. SMB_COM_NT_TRANSACTION Formats3.15.3. Functional Description3.15.4. SMB_COM_TRANSACTION Operations3.15.4.1. Mail Slot Transaction Protocol3.15.4.2. Server Announcement Mailslot Transaction3.15.4.3. Named Pipe Transaction Protocol3.15.4.4. CallNamedPipe3.15.4.5. WaitNamedPipe3.15.4.6. PeekNamedPipe3.15.4.7. GetNamedPipeHandleState3.15.4.8. SetNamedPipeHandleState3.15.4.9. GetNamedPipeInfo3.15.4.10. TransactNamedPipe3.15.4.11. RawReadNamedPipe3.15.4.12. RawWriteNamedPipe3.16. Valid SMB Requests by Negotiated Dialect4. SMB Requests4.1. Session Requests4.1.1. NEGOTIATE: Negotiate Protocol4.1.1.1. Errors4.1.2. SESSION_SETUP_ANDX: Session Setup4.1.2.1. Pre NT LM 0.124.1.2.2. NT LM 0.124.1.2.3. Errors4.1.3. LOGOFF_ANDX: User Logoff4.1.3.1. Errors4.1.4. TREE_CONNECT_ANDX: Tree Connect4.1.4.1. Errors4.1.5. TREE_DISCONNECT: Tree Disconnect4.1.5.1. Errors4.1.6. TRANS2_QUERY_FS_INFORMATION: Get File System Information4.1.6.1. SMB_INFO_ALLOCATION4.1.6.2. SMB_INFO_VOLUME4.1.6.3. SMB_QUERY_FS_VOLUME_INFO4.1.6.4. SMB_QUERY_FS_SIZE_INFO4.1.6.5. SMB_QUERY_FS_DEVICE_INFO4.1.6.6. SMB_QUERY_FS_ATTRIBUTE_INFO4.1.6.7. SMB_QUERY_CIFS_UNIX_INFO4.1.6.8. SMB_QUERY_MAC_FS_INFO4.1.6.9. Errors4.1.7. ECHO: Ping the Server4.1.7.1. Errors4.1.8. NT_CANCEL: Cancel request4.2. File Requests4.2.1. NT_CREATE_ANDX: Create or Open File4.2.1.1. Errors4.2.2. NT_TRANSACT_CREATE: Create or Open File with EAs or SD4.2.2.1. Errors4.2.3. CREATE_TEMPORARY: Create Temporary File4.2.3.1. Errors4.2.4. READ_ANDX: Read Bytes4.2.4.1. Errors4.2.5. WRITE_ANDX: Write Bytes to file or resource4.2.5.1. Errors4.2.6. LOCKING_ANDX: Lock or Unlock Byte Ranges4.2.6.1. Errors4.2.7. SEEK: Seek in File4.2.7.1. Errors4.2.8. FLUSH: Flush File4.2.8.1. Errors4.2.9. CLOSE: Close File4.2.9.1. Errors4.2.10. CLOSE_AND_TREE_DISCONNECT4.2.10.1. Errors4.2.11. DELETE: Delete File4.2.11.1. Errors4.2.12. RENAME: Rename File4.2.12.1. Errors4.2.13. NT_RENAME:4.2.13.1. Errors4.2.14. MOVE: Rename File4.2.14.1. Errors4.2.15. COPY: Copy File4.2.15.1. Errors4.2.16. TRANS2_QUERY_PATH_INFORMATION: Get File Attributes Given Path4.2.16.1. SMB_INFO_STANDARD & SMB_INFO_QUERY_EA_SIZE4.2.16.2. SMB_INFO_QUERY_EAS_FROM_LIST & SMB_INFO_QUERY_ALL_EAS4.2.16.3. SMB_INFO_IS_NAME_VALID4.2.16.4. SMB_QUERY_FILE_BASIC_INFO4.2.16.5. SMB_QUERY_FILE_STANDARD_INFO4.2.16.6. SMB_QUERY_FILE_EA_INFO4.2.16.7. SMB_QUERY_FILE_NAME_INFO4.2.16.8. SMB_QUERY_FILE_ALL_INFO4.2.16.9. SMB_QUERY_FILE_ALT_NAME_INFO4.2.16.10. SMB_QUERY_FILE_STREAM_INFO4.2.16.11. SMB_QUERY_FILE_COMPRESSION_INFO4.2.16.12. SMB_QUERY_FILE_UNIX_BASIC4.2.16.13. SMB_QUERY_FILE_UNIX_LINK4.2.16.14. SMB_MAC_DT_GET_APPL4.2.16.15. SMB_MAC_DT_GET_ICON4.2.16.16. SMB_MAC_DT_GET_ICON_INFO4.2.16.17. Errors4.2.17. TRANS2_QUERY_FILE_INFORMATION: Get File Attributes Given FID4.2.18. TRANS2_SET_PATH_INFORMATION: Set File Attributes given Path4.2.18.1. SMB_INFO_STANDARD & SMB_INFO_QUERY_EA_SIZE4.2.18.2. SMB_INFO_QUERY_ALL_EAS4.2.18.3. SMB_SET_FILE_UNIX_BASIC4.2.18.4. SMB_SET_FILE_UNIX_LINK4.2.18.5. SMB_SET_FILE_UNIX_HLINK4.2.18.6. SMB_MAC_SET_FINDER_INFO4.2.18.7. SMB_MAC_DT_ADD_APPL4.2.18.8. SMB_MAC_DT_REMOVE_APPL4.2.18.9. SMB_MAC_DT_ADD_ICON4.2.18.10. Errors4.2.19. TRANS2_SET_FILE_INFORMATION: Set File Attributes Given FID4.2.19.1. SMB_FILE_BASIC_INFO4.2.19.2. SMB_FILE_DISPOSITION_INFO4.2.19.3. SMB_FILE_ALLOCATION_INFO4.2.19.4. SMB_FILE_END_OF_FILE_INFO4.2.19.5. Errors4.3. Directory Requests4.3.1. TRANS2_CREATE_DIRECTORY: Create Directory (with optional EAs)4.3.1.1. Errors4.3.2. DELETE_DIRECTORY: Delete Directory4.3.2.1. Errors4.3.3. CHECK_DIRECTORY: Check Directory4.3.3.1. Errors4.3.4. TRANS2_FIND_FIRST2: Search Directory using Wildcards4.3.4.1. SMB_INFO_STANDARD4.3.4.2. SMB_INFO_QUERY_EA_SIZE4.3.4.3. SMB_INFO_QUERY_EAS_FROM_LIST4.3.4.4. SMB_FIND_FILE_DIRECTORY_INFO4.3.4.5. SMB_FIND_FILE_FULL_DIRECTORY_INFO4.3.4.6. SMB_FIND_FILE_BOTH_DIRECTORY_INFO4.3.4.7. SMB_FIND_FILE_NAMES_INFO4.3.4.8. SMB_FIND_FILE_UNIX4.3.4.9. SMB_FINDBOTH_MAC_HFS_INFO4.3.4.10. Errors4.3.5. TRANS2_FIND_NEXT2: Resume Directory Search Using Wildcards4.3.5.1. Errors4.3.6. FIND_CLOSE2: Close Directory Search4.3.6.1. Errors4.3.7. NT_TRANSACT_NOTIFY_CHANGE: Request Change Notification4.3.7.1. Errors4.4. DFS Operations4.4.1. TRANS2_GET_DFS_REFERRAL: Retrieve Distributed Filesystem Referral4.4.1.1. Errors4.4.2. TRANS2_REPORT_DFS_INCONSISTENCY: Inform a server about DFS Error4.4.2.1. Errors4.5. Miscellaneous Operations4.5.1. NT_TRANSACT_IOCTL4.5.1.1. Errors4.5.2. NT_TRANSACT_QUERY_SECURITY_DESC4.5.2.1. Errors4.5.3. NT_TRANSACT_SET_SECURITY_DESC4.5.3.1. Errors5. SMB Symbolic Constants5.1. SMB Command Codes5.2. SMB_COM_TRANSACTION2 Subcommand codes5.3. SMB_COM_NT_TRANSACTION Subcommand Codes5.4. SMB Protocol Dialect Constants6. Error Codes and Classes7. Security Considerations8. References9. Appendix A -- NETBIOS transport over TCP9.1. Connection Establishment9.2. Connecting to a server using the NetBIOS name9.3. Connecting to a server using a DNS name or IP address9.3.1. NetBIOS Adapter Status9.3.2. Generic Server Name9.3.3. - Parsing the DNS Name (guessing)9.4. NetBIOS Name character set10. Appendix B -- TCP transport11. Appendix C – Share Level Server Security12. Appendix D – CIFS UNIX Extension12.1. Introduction12.2. Principles12.3. CIFS Protocol Modifications12.4. Modified SMBs12.5. Guidelines for implementers13. Appendix E – CIFS Macintosh Extension13.1. Introduction13.2. Principles13.3. CIFS Protocol Modifications13.4. Modified SMBs13.5. Guidelines for implementers14. Appendix F – API Numbers for Transact based RAP calls