ArcGetPasswordProcW function

Top  Previous  Next

The function gets called to get archive password from the user.

Plugin must remember the pointer on the function in ArcInitPluginW.

Syntax C++

typedef int (__stdcall *ArcGetPasswordProcW)(

                _In_ LONG_PTR Session,

                _In_ HANDLE hArcData,

                _In_ wchar_t *ArcFileName,

                _In_ wchar_t *FileNameInArc,

                _Out_ wchar_t *PasswordBuf,

                _In_ int PasswordMaxLen

);

 

Parameters

Session [in]

Type: LONG_PTR

Session identifier.

hArcData [in]

Type: HANDLE

Archive identifier. If the file packing or another operation when no function ArcOpenW get called, the parameter must be 0.

ArcFileName [in]

Type: wchar_t*

Pointer on a string with archive name.

FileNameInArc [in]

Type: wchar_t*

Pointer on a string with the name of unarchived file. If password is required for the whole archive, not just a specific file, the pointer must be NULL.

PasswordBuf [out]

Type: wchar_t*

Pointer on a buffer, containing 0-terminated password. The length of the buffer allocated by the plugin must be no less than PasswordMaxLen+1 characters.

PasswordMaxLen [in]

Type: int

Maximum password buffer length.

Return value

Type: int

Returns one of following values:

Code

Comments

PK_GETPASS_OK

0

User pressed button "Ok"

PK_GETPASS_CANCEL

1

User pressed button "Cancel" (unpacking must be interrupted)

PK_GETPASS_SKIP

2

User pressed button "Skip" (in case the password is entered for a specific file)

PK_GETPASS_UNEXPECTED_ERR

-1

Unexpected error

Notes

The function gets called by the plugin as needed. During execution of the function an appropriate dialog is shown to get password from the user.

A password can be received for a specific file, or the entire archive.

Returning value allows handling buttons "OK", "Cancel", "Skip" (if password was for a specific file).