Edit

CRYPTPROTECT_PROMPTSTRUCT structure (dpapi.h)

The CRYPTPROTECT_PROMPTSTRUCT structure provides the text of a prompt and information about when and where that prompt is to be displayed when using the CryptProtectData and CryptUnprotectData functions.

Important

Deprecated — removal date: April 2027. The interactive prompt-based encryption and decryption flow provided by this structure (CRYPTPROTECT_PROMPT_ON_PROTECT and CRYPTPROTECT_PROMPT_ON_UNPROTECT) will be removed in April 2027. Applications that rely on prompt-based flows must migrate before that date; after removal, decryption attempts that depend on those flows will fail and the data will no longer be recoverable through them.

What is NOT affected: Non-interactive use of CryptProtectData and CryptUnprotectData (passing NULL for pPromptStruct, or supplying a struct with dwPromptFlags set to 0) is unaffected.

Required action: Update any calls to CryptProtectData or CryptUnprotectData that pass a CRYPTPROTECT_PROMPTSTRUCT with CRYPTPROTECT_PROMPT_ON_PROTECT or CRYPTPROTECT_PROMPT_ON_UNPROTECT set. Either pass NULL for pPromptStruct, or pass a struct with dwPromptFlags set to 0. There is no replacement for the interactive prompt behavior itself.

Syntax

typedef struct _CRYPTPROTECT_PROMPTSTRUCT {
  DWORD   cbSize;
  DWORD   dwPromptFlags;
  HWND    hwndApp;
  LPCWSTR szPrompt;
} CRYPTPROTECT_PROMPTSTRUCT, *PCRYPTPROTECT_PROMPTSTRUCT;

Members

cbSize

The size, in bytes, of this structure.

dwPromptFlags

DWORD flags that indicate when prompts to the user are to be displayed. Current dwPromptFlags values are as follows.

Value Meaning
CRYPTPROTECT_PROMPT_ON_PROTECT
This flag is used to provide the prompt for the protect phase.
CRYPTPROTECT_PROMPT_ON_UNPROTECT
This flag can be combined with CRYPTPROTECT_PROMPT_ON_PROTECT to enforce the UI (user interface) policy of the caller. When CryptUnprotectData is called, the dwPromptFlags specified in the CryptProtectData call are enforced.

hwndApp

Window handle to the parent window.

szPrompt

A string containing the text of a prompt to be displayed.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header dpapi.h

See also

CryptProtectData

CryptUnprotectData