Share via


IpcfOpenFileOnHandle function

Gets an IPCF_FILE_HANDLE associated with an encrypted file which can be used to access and modify that file's data. This operation requires that the current user has at least the VIEW right for the content.

Syntax

EXTERN_C HRESULT WINAPI IpcfOpenFileOnHandle(
  _In_     HANDLE            hFileStream,
  _In_opt_ PCIPC_PROMPT_CTX  pContext,
           DWORD             dwFlags,
  _Out_    PIPCF_FILE_HANDLE phFile
);

Parameters

hFileStream [in]

HANDLE to a file, opened by a Windows API ::CreateFile function, that represents an encrypted file.

This function will fail for un-unencrypted files or custom-encrypted files (i.e., files for which IpcfIsFileEncrypted returns IPCF_FILE_STATUS_ENCRYPTED_CUSTOM.

hFileStream must not be freed or modified until the phFile is closed.

pContext [in, optional]

Optional pointer to information that helps the MSIPC client decide what the user prompt behavior should be.

dwFlags

This must be set to 0 (zero).

phFile [out]

Pointer to an IPCF_FILE_HANDLE which can be used to read/write the encrypted data. This pointer must be closed using the IpcCloseHandle function.

Return value

If the function succeeds, the return value is S_OK. If the function fails, it returns an HRESULT value that indicates the error.

For more information, see Error codes for a description of all RMS SDK 2.1 return values.

Possible values include, but are not limited to, those in the following list.

IPCERROR_FILE_NOT_ENCRYPTED

Function failed due to an un-unencrypted files.

Requirements

Minimum supported client
Windows Vista with SP2
Minimum supported server
Windows Server 2008
Header
Ipcfile.h (include Msipc.h)
Library
Msipc.lib
DLL
Msipc.dll