2.2.4.41.2 Response
The server MUST populate the FID field only, unless the client has requested file attribute data by setting bit 0 of the Flags field in the request. If file attribute data is not requested, all fields following the FID in the response MUST be set to zero.
-
SMB_Parameters { UCHAR WordCount; Words { UCHAR AndXCommand; UCHAR AndXReserved; USHORT AndXOffset; USHORT FID; SMB_FILE_ATTRIBUTES FileAttrs; UTIME LastWriteTime; ULONG FileDataSize; USHORT AccessRights; USHORT ResourceType; SMB_NMPIPE_STATUS NMPipeStatus; USHORT OpenResults; USHORT Reserved[3]; } } SMB_Data { USHORT ByteCount; }
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
|
|
3 |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SMB_Parameters (31 bytes) |
|||||||||||||||||||||||||||||||
... |
|||||||||||||||||||||||||||||||
... |
|||||||||||||||||||||||||||||||
... |
SMB_Data |
||||||||||||||||||||||||||||||
... |
SMB_Parameters (31 bytes):
-
0
1
2
3
4
5
6
7
8
91
0
1
2
3
4
5
6
7
8
92
0
1
2
3
4
5
6
7
8
93
0
1WordCount
Words (30 bytes)
...
...
...
-
WordCount (1 byte): This field MUST be 0x0F.
-
Words (30 bytes):
-
0
1
2
3
4
5
6
7
8
91
0
1
2
3
4
5
6
7
8
92
0
1
2
3
4
5
6
7
8
93
0
1AndXCommand
AndXReserved
AndXOffset
FID
FileAttrs
LastWriteTime
FileDataSize
AccessRights
ResourceType
NMPipeStatus
OpenResults
Reserved
...
-
AndXCommand (1 byte): The command code for the next SMB command in the packet. This value MUST be set to 0xFF if there are no additional SMB command responses in the server response packet.
-
AndXReserved (1 byte): A reserved field. This MUST be set to 0x00 when this response is sent, and the client MUST ignore this field.
-
AndXOffset (2 bytes): This field MUST be set to the offset, in bytes, from the start of the SMB Header (section 2.2.3.1) to the start of the WordCount field in the next SMB command response in this packet. This field is valid only if the AndXCommand field is not set to 0xFF. If AndXCommand is 0xFF, this field MUST be ignored by the client.
-
FID (2 bytes): A valid FID representing the open instance of the file.
-
FileAttrs (2 bytes): The actual file system attributes of the file. If none of the attribute bytes is set, the file attributes refer to a regular file.
-
LastWriteTime (4 bytes): A 32-bit integer time value of the last modification to the file.
-
FileDataSize (4 bytes): The number of bytes in the file. This field is advisory and MAY be used.
-
AccessRights (2 bytes): A 16-bit field that shows granted access rights to the file.
-
-
Name andvalue
Meaning
SMB_DA_ACCESS_READ
0x0000
Read-only Access
SMB_DA_ACCESS_WRITE
0x0001
Write-only Access
SMB_DA_ACCESS_READ_WRITE
0x0002
Read/Write Access
-
-
All other values are reserved and MUST NOT be used.
-
-
ResourceType (2 bytes): A 16-bit field that shows the resource type opened.
-
-
Name and value
Meaning
FileTypeDisk
0x0000
Disk file or directory.
FileTypeByteModePipe
0x0001
Byte mode named pipe.
FileTypeMessageModePipe
0x0002
Message-mode named pipe.
FileTypePrinter
0x0003
Printer device.
FileTypeCommDevice
0x0004
Character-mode device. When an extended protocol has been negotiated, this value allows a device to be opened for driver-level I/O. This provides direct access to real-time and interactive devices such as modems, scanners, and so on.
FileTypeUnknown
0xFFFF
Unknown file type.
-
-
All other values are reserved and MUST NOT be used.
-
-
NMPipeStatus (2 bytes): A 16-bit field that contains the status of the named pipe if the resource type opened is a named pipe.
-
This field is formatted as an SMB_NMPIPE_STATUS (section 2.2.1.3).
-
-
OpenResults (2 bytes): A 16-bit field that shows the results of the open operation.
-
-
Name and
bitmask
Values
Meaning
OpenResult
0x0003
1
The file existed and was opened.
2
The file did not exist and was therefore created.
3
The file existed and was truncated.
Other
Reserved
LockStatus
0x8000
0
No OpLock was requested, the OpLock could not be granted, or the server does not support OpLocks.
1
An OpLock was requested by the client and was granted by the server.
-
-
-
Reserved (6 bytes): All entries MUST be 0x0000.
-
SMB_Data (2 bytes):
-
0
1
2
3
4
5
6
7
8
91
0
1
2
3
4
5
6
7
8
92
0
1
2
3
4
5
6
7
8
93
0
1ByteCount
-
ByteCount (2 bytes): This field MUST be 0x0000. No data is sent by this message.
Error Codes
SMB error class |
SMB error code |
NT status code |
POSIX equivalent |
Description |
---|---|---|---|---|
ERRDOS (0x01) |
ERRbadfile (0x0002) |
STATUS_NO_SUCH_FILE (0xC000000F) |
ENOENT |
The named file was not found. |
ERRDOS (0x01) |
ERRbadpath (0x0003) |
STATUS_OBJECT_PATH_SYNTAX_BAD (0xC000003B) |
ENOENT |
The file path syntax is invalid. |
ERRDOS (0x01) |
ERRbadpath (0x0003) |
STATUS_OBJECT_PATH_INVALID (0xC0000039) |
ENOTDIR |
A component of the path-prefix was not a directory. |
ERRDOS (0x01) |
ERRnofids (0x0004) |
STATUS_OS2_TOO_MANY_OPEN_FILES (0x00040001) STATUS_TOO_MANY_OPENED_FILES (0xC000011F) |
ENFILE |
Too many open files, no more FIDs available. |
ERRDOS (0x01) |
ERRnoaccess (0x0005) |
STATUS_ACCESS_DENIED (0xC0000022) |
EACCESS |
A component of the path-prefix denied search permission OR requested access permission is denied for the file OR open mode failure. |
ERRDOS (0x01) |
ERRnoaccess (0x0005) |
STATUS_FILE_IS_A_DIRECTORY (0xC00000BA) |
EISDIR |
Named file is an existing directory and requested open mode is write or read/write. |
ERRDOS (0x01) |
ERRnomem (0x0008) |
STATUS_INSUFF_SERVER_RESOURCES (0xC0000205) |
ENOMEM |
The server is out of resources. |
ERRDOS (0x01) |
ERRbadshare (0x0020) |
STATUS_SHARING_VIOLATION (0xC0000043) |
EAGAIN |
File exists, mandatory file/record locking is set, and there are outstanding record locks on the file. |
ERRSRV (0x02) |
ERRerror (0x0001) |
STATUS_INVALID_SMB (0x00010002) |
|
Invalid SMB. Not enough parameter bytes were sent or the ANDX command is invalid. |
ERRSRV (0x02) |
ERRerror (0x0001) |
|
EFAULT |
Path points outside the allocated address space of the process. |
ERRSRV (0x02) |
ERRerror (0x0001) |
|
EINTR |
A signal was caught during the open operation. |
ERRSRV (0x02) |
ERRerror (0x0001) |
|
ENXIO |
Generic server open failure |
ERRSRV (0x02) |
ERRerror (0x0001) |
|
EEXIST |
The file could not be created because another file with attributes that do not match those specified in the SMB_Parameters.Words.FileAttrs field already exists and has a conflicting name. |
ERRSRV (0x02) |
ERRerror (0x0001) |
|
EMFILE |
The maximum number of file descriptors available on the server for this session are currently open. |
ERRSRV (0x02) |
ERRerror (0x0001) |
|
ENOSPC |
No space left on device. The system is out of resources required to create the file. |
ERRSRV (0x02) |
ERRerror (0x0001) |
|
EROFS |
Read-Only File System. Write or read/write access was requested on a file existing within a read-only file system. |
ERRSRV (0x02) |
ERRerror (0x0001) |
|
ETXTBSY |
Text file is busy. Write or read/write access was requested on a batch script that is currently being executed. |
ERRSRV (0x02) |
ERRerror (0x0001) |
STATUS_ACCESS_DENIED (0xC0000022) |
EROFS |
Named file resides on read-only file system, and requested access permission is write or read/write. |
ERRSRV (0x02) |
ERRaccess (0x0004) |
STATUS_NETWORK_ACCESS_DENIED (0xC00000CA) |
|
Permission conflict between requested permission and permissions for the shared resource: for example, open for write of a file in a read-only file system subtree. |
ERRSRV (0x02) |
ERRinvtid (0x0005) |
STATUS_SMB_BAD_TID (0x00050002) |
|
The TID is no longer valid. |
ERRSRV (0x02) |
ERRinvdevice (0x0007) |
STATUS_BAD_DEVICE_TYPE (0xC00000CB) |
|
Server does not support the requested device type. |
ERRSRV (0x02) |
ERRbaduid (0x005B) |
STATUS_SMB_BAD_UID (0x005B0002) |
|
The UID supplied is not defined to the session, or the user identified by the UID does not have sufficient privileges. |
ERRHRD (0x03) |
ERRnowrite (0x0013) |
STATUS_MEDIA_WRITE_PROTECTED (0xC00000A2) |
EROFS |
Attempt to write to a read-only file system. |
ERRHRD (0x03) |
ERRdata (0x0017) |
STATUS_DATA_ERROR (0xC000003E) |
EIO |
Disk I/O error. |