This method retrieves the current protection status.

[Visual Basic] Public Function QueryProtect() As Integer
[C#] public int QueryProtect();

Return Value

Value Explanation
-1 The file set in the DllFileName property is disabled.
0 Unlocked
1 Locked
2 Number of uses has been exceeded. (For Number of Use Protection only)
3 Number of days has been exceeded. (For Number of Days Protection only)
4 Number of months has been exceeded. (For Number of Months Protection only)
5 The expiration date has been exceeded. (For Expiration Date Protection only)
6 The PC's clock has been turned back. (For Number of Uses, Days, Months, Expiration Date Protection only)
7 The running environment (PC) has changed.
8 The protection information file is incorrect.
9 The lockword is incorrect.
10 The password is incorrect.
11 Other
12 The protection file is being used incorrectly.

Explanation

The QueryProtect method retrieves the current protection status. The Initialize method must be executed before executing the QueryProtect method. If the Initialize method has not been successfully executed, the QueryProtect method is disabled.

When the return value is 0 and you are using "Number of Uses", "Number of Days", "Number of Months", or "Expiration Date" protection, you can get more detailed information about the protection status by referring to the QueryRemainCount, QueryRemainDays, and QueryRemainMonths methods.

 

Using password with and without expirations results in different return values.

When using passwords that do not expire with protection types; "Number of Uses", "Number of Days", "Number of Months", or "Expiration Date", when the limits have been exceeded, this method will return values from 2 through 5.

When using passwords that do expire with protection types; "Number of Uses", "Number of Days", "Number of Months", or "Expiration Date", when the limits have been exceeded, this method will return a value of 1.

 

The return value of 12 usually indicates that the limits of "Number of Uses", "Number of Days", "Number of Months", or "Expiration Date" protection have been exceeded and then the existing protection information file has been overwritten by a different protection file.

Also See

PasswordProtect Members | Newtone.ProtectKit.Win.PasswordProtect