共用方式為


3.1.4.2.23 RpcDeletePrinterKey (Opnum 82)

RpcDeletePrinterKey deletes a specified key and all of its subkeys for a specified printer.<309>

 DWORD RpcDeletePrinterKey(
   [in] PRINTER_HANDLE hPrinter,
   [in, string] const wchar_t* pKeyName
 );

hPrinter: A handle to a printer object that was opened by RpcAddPrinter (section 3.1.4.2.3), RpcAddPrinterEx (section 3.1.4.2.15), RpcOpenPrinter (section 3.1.4.2.2), or RpcOpenPrinterEx (section 3.1.4.2.14) methods.

pKeyName: A pointer to a string that specifies the key to delete. A key name is an arbitrary string defined by the printer driver associated with the printer object. For rules governing key names, see section 2.2.4.7.

Return Values: This method MUST return zero (ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the server MUST validate parameters as follows:

  • Perform the validation steps that are specified in PRINTER_HANDLE Parameters (section 3.1.4.1.11).

  • Verify that the pKeyName parameter points to a string that complies with the rules for key names specified in section 2.2.4.7. If this verification fails, return ERROR_INVALID_PARAMETER.

  • Additional validation MAY<310> be performed.

If parameter validation fails, the server MUST fail the operation immediately and return a nonzero error response to the client. Otherwise, the server MUST process the message and compose a response to the client as follows:

  • Delete the printer data key indicated by the pKeyName parameter and all the subkeys of that key.

  • Return the status of the operation.