Compartilhar via


3.3.5.54 Receiving an SMB_COM_OPEN_PRINT_FILE Request

Upon receipt of an SMB_COM_OPEN_PRINT_FILE Request (section 2.2.4.67.1), the server MUST perform the following actions:

  • Verify the TID as described in section 3.3.5.2.

  • Verify that the Server.Share identified by the SMB_Header.TID has a Server.Share.Type of Printer. If the share is not a printer share, the server MUST return an error response with Status set to STATUS_INVALID_DEVICE_REQUEST (ERRDOS/ERRbadfunc).

  • Verify the UID as described in section 3.3.5.2.

  • Verify that the Server.Session identified by the SMB_Header.UID in the request has a Server.Session.UserSecurityContext with sufficient privileges to create a new print spool file. If the underlying object store returns STATUS_ACCESS_DENIED, the server MUST increase Server.Statistics.sts0_permerrors by 1.

  • Create a temporary file on the server to receive the spool file data.<323>

If the spool file cannot be created, an error response MUST be sent to the client.

Otherwise, Server.Statistics.sts0_jobsqueued and Server.Statistics.sts0_fopens MUST be incremented by 1, and a new FID MUST be allocated and assigned to the newly created spool file. A new Open object MUST be created with the TID, UID and PID fields from the request header and the new FID. This Open MUST be entered into the Server.Connection.FileOpenTable with the following default values:

  • If Server.EnableOplock is TRUE and a requested OpLock was granted, the type of OpLock MUST be set in Server.Open.OpLock; otherwise, Server.Open.OpLock MUST be set to None.

  • Server.Open.TreeConnect MUST be set to the TreeConnect on which the open request was performed, and Server.Open.TreeConnect.OpenCount must be incremented by 1.

The server MUST register the Open by invoking the Server Registers a New Open event ([MS-SRVS] section 3.1.6.4) and MUST assign the return value to Server.Open.FileGlobalId.

The FID MUST be returned to the client in the response, which is formatted as specified in section 2.2.4.67.2. The response MUST be sent to the client as specified in section 3.3.4.1.

The first SetupLength bytes of Data written to the spool file MUST be passed to the spool file without modification. If the Mode is set to Text Mode in the Open request, the server might perform minimal processing on the data in the file, starting at the offset indicated by SetupLength. Several SMB commands, including SMB_COM_WRITE_ANDX, can be used to write data to the file.