2.2.6.1.1 Request

The TRANS2_OPEN2 request and response formats are a special case of SMB_COM_TRANSACTION2 (section 2.2.4.46) SMB. Only the TRANS2_OPEN2 request specifics are described here.

SMB_Parameters

WordCount (1 byte): This field MUST be0x0F.

Words (30 bytes):

TotalDataCount (2 bytes): This field MUST be zero (0x0000) if no Trans2_Data is being supplied. This field MUST be the total size of the Trans2_Data if extended attributes are being provided.

SetupCount (1 byte): This field MUST be 0x01.

Setup (2 bytes): This field MUST be TRANS2_OPEN2 (0x0000).

Trans2_Parameters

 Trans2_Parameters
   {
   USHORT              Flags;
   USHORT              AccessMode;
   USHORT              Reserved1;
   SMB_FILE_ATTRIBUTES FileAttributes;
   UTIME               CreationTime;
   USHORT              OpenMode;
   ULONG               AllocationSize;
   USHORT              Reserved[5];
   SMB_STRING          FileName;
   }


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

Flags

AccessMode

Reserved1

FileAttributes

CreationTime

OpenMode

AllocationSize

...

Reserved

...

...

FileName (variable)

...

Flags (2 bytes): This 16-bit field of flags is used to request that the server take certain actions.

Bitmask

Meaning

REQ_ATTRIB

0x0001

Return additional information in the response; populate the CreationTime, FileDataSize, AccessMode, ResourceType, and NMPipeStatus fields in the response.

REQ_OPLOCK

0x0002

Exclusive OpLock requested.

REQ_OPBATCH

0x0004

Batch OpLock requested.

REQ_EASIZE

0x0008

Return total length of Extended Attributes (EAs); populate the ExtendedAttributeLength field in the response.

AccessMode (2 bytes): A 16-bit field for encoding the requested access mode. See section 3.2.4.5.1 for a discussion on sharing modes.

Name and bitmask

Values

Meaning

AccessMode

0x0007

0

Open for reading.

1

Open for writing.

2

Open for reading and writing.

3

Open for execution.

0x0008

Reserved

SharingMode

0x0070

0

Compatibility mode

1

Deny read/write/execute to others (exclusive use requested).

2

Deny write to others.

3

Deny read/execute to others.

4

Deny nothing to others.

0x0080

Reserved

ReferenceLocality

0x0700

0

Unknown locality of reference

1

Mainly sequential access

2

Mainly random access

3

Random access with some locality

4 - 7

Undefined

0x0800

Reserved

CacheMode

0x1000

0

Perform caching on file.

1

Do not cache the file.

0x2000

Reserved

WritethroughMode

0x4000

0

Write-through mode. If this flag is set, then no read ahead or write behind is allowed on this file or device. When the response is returned, data is expected to be on the disk or device.

1

0x8000

Reserved

Reserved1 (2 bytes): This field MUST be set to zero (0x0000) and MUST be ignored by the server.

FileAttributes (2 bytes): Attributes to apply to the file if it needs to be created.

CreationTime (4 bytes): A 32-bit integer time value to be assigned to the file as the time of creation if the file is to be created.

OpenMode (2 bytes): A 16-bit field that controls the way that a file SHOULD be treated when it is opened for use by certain extended SMB requests.

Name and bitmask

Values

Meaning

FileExistsOpts

0x0003

0

The request SHOULD fail and an error SHOULD be returned indicating the prior existence of the file.

1

The file is to be appended.

2

The file is to be truncated to zero (0) length.

3

Reserved

CreateFile

0x0010

0

If the file does not exist, return error.

1

If the file does not exist, create it.

All other bits are reserved; they SHOULD NOT be used by the client and MUST be ignored by the server.

AllocationSize (4 bytes): The number of bytes to reserve for the file if the file is being created or truncated.

          

Reserved (10 bytes): All entries in this field MUST be set to zero (0x0000).

FileName (variable): A buffer containing the name of the file to be opened, created, or truncated. The string MUST be null terminated.

Trans2_Data

 Trans2_Data
   {
            
   SMB_FEA_LIST ExtendedAttributeList;
   }


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

ExtendedAttributeList (variable)

...

ExtendedAttributeList (variable): A list of extended attribute (EA) name/value pairs that are to be assigned to the file.