IpcfEncryptFileWithMetadata function

Used to encrypt a file and optionally add metadata to the file encryption license.

Syntax

HRESULT WINAPI IpcfEncryptFileWithMetadata(
  _In_      LPCWSTR                wszInputFilePath,
  _In_      LPCVOID                pvLicenseInfo,
  _In_      DWORD                  dwType,
  _In_      DWORD                  dwFlags,
  _In_opt_  PCIPC_PROMPT_CTX       pContext,
  _In_opt_  LPCWSTR                wszOutputFileDirectory,
  _In_opt_  PCIPC_LICENSE_METADATA pLicenseMetadata,
  _Out_opt_ LPCWSTR                *pwszOutputFilePath
);

Parameters

wszInputFilePath [in]

Specifies a file name and file extension.

The file name and may also contain the path to the file. If a relative path is specified, the current working directory is used to create the absolute path.

pvLicenseInfo [in]

License information used for encryption.

For more information, see Encrypt file input type

dwType [in]

Type of license information used for encryption.

For a list of valid values, see Encrypt file input type

dwFlags [in]

Specify optional behavior for this API.

For a list of valid values, see Encrypt file flags

pContext [in, optional]

Optional pointer to user prompt information, PCIPC_PROMPT_CTX, for the client.

wszOutputFileDirectory [in, optional]

Optional pointer to the output file directory.

If wszOutputFileDirectory is not specified, the output file will be placed in the same directory as the input file.

If wszOutputFileDirectory is specified, the output file will be placed in this folder and the original file will be deleted.

pLicenseMetadata [in, optional]

Optional pointer to metadata information, PCIPC_LICENSE_METADATA, to be added to the file protection license.

pwszOutputFilePath [out, optional]

On success, the full path of the output file.

This should be freed using IpcFreeMemory.

If neither the file name nor directory changes, pwszOutputFilePath will be NULL.

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_ENCRYPT_BLOCKED

IPCERROR_FILE_UPDATELICENSE_BLOCKED

ERROR_FILE_READ_ONLY

IPCERROR_FILE_SYSTEM_FILE

IPCERROR_FILE_PROTECTOR_BAD_INSTALL

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

See also

License metadata property types

Notification preference

Notification type

IpcCreateLicenseMetadataHandle

IpcSetLicenseMetadataProperty

IpcSerializeLicenseWithMetadata

IpcfEncryptFileWithMetadata

IpcfEncryptFileStreamWithMetadata

IpcRegisterLicense