Platform SDK: Files and I/O

DecryptFile

The DecryptFile function decrypts an encrypted file or directory.

BOOL DecryptFile(
  LPCTSTR lpFileName,  // file name
  DWORD dwReserved     // reserved; must be zero
);

Parameters

lpFileName
[in] Pointer to a null-terminated Unicode string that specifies the name of the file to decrypt.

The caller must have FILE_READ_DATA, FILE_WRITE_DATA, FILE_READ_ATTRIBUTES, FILE_WRITE_ATTRIBUTES, and SYNCHRONIZE access to the file.

dwReserved
Reserved; must be zero.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The DecryptFile function requires exclusive access to the file being decrypted, and will fail if another process is using the file. If the file is not encrypted, DecryptFile simply returns a nonzero value, which indicates success.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Unsupported.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows 2000.

See Also

File Systems Overview, File System Functions, CreateFile, EncryptFile