[−][src]Type Definition wcxhead::tPkCryptProc
type tPkCryptProc = extern "stdcall" fn(CryptoNr: c_int, Mode: c_int, ArchiveName: *mut char, Password: *mut char, maxlen: c_int) -> c_int;
PkCryptProc is a callback function, which the plugin can call to store passwords in the secure password store, read them back, or copy them to a new connection.
Declaration:
int __stdcall PkCryptProc(int CryptoNumber,int mode,
char* ArchiveName,char* Password,int maxlen);
Description of parameters:
CryptoNumber | Here the plugin needs to pass the crypto number received through the `PkSetCryptCallback()` function. |
mode | The mode of operation: PK_CRYPT_SAVE_PASSWORD: Save password to password store PK_CRYPT_LOAD_PASSWORD: Load password from password store PK_CRYPT_LOAD_PASSWORD_NO_UI: Load password only if master password has already been entered PK_CRYPT_COPY_PASSWORD: Copy password to new connection. Here the second string parameter "Password" is not a password, but the name of the target archive name PK_CRYPT_MOVE_PASSWORD: As above, but delete the source password PK_CRYPT_DELETE_PASSWORD: Delete the password of the given archive name |
ArchiveName | Name of the archive for this operation. The plugin can give any name here which can be stored in Windows ini files. The plugin should encode names which cannot be stored in ini files, or give a reference code or so instead of the file name. |
Password | Operation-specific, usually the password to be stored/retrieved, or the target name when copying/moving a connection |
maxlen | Maximum length, in characters, the password buffer can store when calling one of the load functions |
Return value:
Total Commander returns one of these values:
FS_FILE_OK | Success |
E_ECREATE | Encrypt/Decrypt failed |
E_EWRITE | Could not write password to password store |
E_EREAD | Password not found in password store |
E_NO_FILES | No master password entered yet |
Note:
When showing the details of an existing archive, you should call PK_CRYPT_LOAD_PASSWORD_NO_UI first. In case of error E_NO_FILES, show a button "Edit password". Only call PK_CRYPT_LOAD_PASSWORD when the user clicks that button, or tries to decrypt the archive. This way the user doesn't have to enter the master password if he just wanted to make some other changes to the archive settings.