3.1.4.18.6 IsSafeToDelete (Opnum 8)

This method is called by a client application to determine if a file is safe to delete. For historical reasons, the results of this method are likely to be interpreted by a client application or user as a guarantee that deleting a file will not cause problems on a server. Because it is usually impossible for a server to reliably make such a determination, a server SHOULD simply ignore the file name specified and return a result that indicates the file is not safe to delete.

 HRESULT IsSafeToDelete(
   [in] BSTR bstrFile,
   [out, retval] long* pInUse
 );

bstrFile: MUST be a path to a file in a format the server will understand, which SHOULD<345> be ignored on receipt.

pInUse: A pointer to a value that, upon successful completion, MUST be set to one of the values in the following table.

Value

Meaning

0x00000000

The file is safe to delete.

0x00000001

The file is not safe to delete because it is referenced in the catalog, or it is not possible to determine whether the file is safe to delete.

0x00000002

The server determined that the file is not safe to delete, but was unable to determine the reason.

0x00000003

The file is not safe to delete because it contains support code for communication between components.

0x00000004

The file is not safe to delete because a type library in the file is in use.

0x00000005

The file is not safe to delete because it is referenced by a system resource.

Return Values: This method MUST return S_OK (0x00000000) on success, and a failure result, as specified in [MS-ERREF] section 2.1, on failure. All failure results MUST be treated identically.

Upon receiving a call to this method, the server SHOULD<346> immediately set the value referenced by pInUse to 1 to indicate that the file is not safe to delete, and return S_OK (0x00000000).

A server MAY<347> instead, by some implementation-specific mechanism, attempt to determine if the file is safe to delete, and fail the call if it cannot.

The server then MUST set the value referenced by pInUse to the value previously specified that indicates whether the file is safe to delete, and if not, the reason the file is not safe to delete.