2.2.2.3.1 CreateFile Request Message

A server sends this message to open a file handle on the client-side device. This message MUST be sent only once for a given connection within the dynamic virtual channel. A one-to-one correspondence exists between file handles opened on the client side and dynamic virtual channels used. All I/O traffic that is associated with a file handle MUST be done on the virtual channel used to create the file handle. As a result, to open multiple file handles, multiple dynamic virtual channels are established between client and server.


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

Header

...

DeviceId

dwDesiredAccess

dwShareMode

dwCreationDisposition

dwFlagsAndAttributes

Header (8 bytes):  A SERVER_IO_HEADER request header. The FunctionId field MUST be set to CREATE_FILE_REQUEST (0x00000004).

DeviceId (4 bytes):  A 32-bit unsigned integer. This field MUST identify the device redirected by the client. Device IDs are initially established as described in section 2.2.1.3.1.

dwDesiredAccess (4 bytes):  A 32-bit unsigned integer. This is a flag field that indicates various access modes to use for creating and opening the file. This value SHOULD be set to 0xC0000000, meaning generic read and generic write.<9>

dwShareMode (4 bytes):  A 32-bit unsigned integer that represents a set of bit flags indicating the sharing mode that the server application requested. This field SHOULD be composed of the bitwise OR of one or more of the following values.

Name

Value

FILE_SHARE_READ

0x00000001

FILE_SHARE_WRITE

0x00000002

dwCreationDisposition (4 bytes): A 32-bit unsigned integer that specifies the mode for creating or opening the file. This field SHOULD be one of the following values.<10>

Name

Value

CREATE_NEW

0x00000001

CREATE_ALWAYS

0x00000002

OPEN_EXISTING

0x00000003

OPEN_ALWAYS

0x00000004

TRUNCATE_EXISTING

0x00000005

dwFlagsAndAttributes (4 bytes):  A 32-bit unsigned integer that represents a set of bit flags specifying other flags and attributes associated with the request. This value MUST be composed of the bitwise OR of one or more of the following values.

Name

Value

FILE_ATTRIBUTE_DIRECTORY

0x00000010

FILE_ATTRIBUTE_ARCHIVE

0x00000020

FILE_ATTRIBUTE_DEVICE

0x00000040

FILE_ATTRIBUTE_NORMAL

0x00000080

FILE_FLAG_FIRST_PIPE_INSTANCE

0x00080000

FILE_FLAG_OPEN_NO_RECALL

0x00100000

FILE_FLAG_OPEN_REPARSE_POINT

0x00200000

FILE_FLAG_POSIX_SEMANTICS

0x01000000

FILE_FLAG_BACKUP_SEMANTICS

0x02000000

FILE_FLAG_DELETE_ON_CLOSE

0x04000000

FILE_FLAG_SEQUENTIAL_SCAN

0x08000000

FILE_FLAG_RANDOM_ACCESS

0x10000000

FILE_FLAG_NO_BUFFERING

0x20000000

FILE_FLAG_OVERLAPPED

0x40000000

FILE_FLAG_WRITE_THROUGH

0x80000000