diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-06-07 01:37:23 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-06-07 01:38:34 +0200 |
commit | c3c1bdd29d932f2b38e7c3995498f9a4eab8702b (patch) | |
tree | 17442ccd96111eae10c729ac719f236e5e2ead21 /src/Common/Dlgcode.c | |
parent | 550e2bcf3bc1626ccb950c6bc97f1348e94cca76 (diff) | |
download | VeraCrypt-c3c1bdd29d932f2b38e7c3995498f9a4eab8702b.tar.gz VeraCrypt-c3c1bdd29d932f2b38e7c3995498f9a4eab8702b.zip |
Windows: Add support for PIN in favorites. Several enhancements to GUI handling of Dynamic Mode.
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r-- | src/Common/Dlgcode.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index bfa8a32e..cc66506c 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -4353,6 +4353,22 @@ string GetUserFriendlyVersionString (int version) return (versionString);
}
+string IntToString (int val)
+{
+ char szTmp [64];
+ StringCbPrintfA (szTmp, sizeof(szTmp), "%d", val);
+
+ return szTmp;
+}
+
+wstring IntToWideString (int val)
+{
+ wchar_t szTmp [64];
+ StringCbPrintfW (szTmp, sizeof(szTmp), L"%d", val);
+
+ return szTmp;
+}
+
void GetSizeString (unsigned __int64 size, wchar_t *str, size_t cbStr)
{
static wchar_t *b, *kb, *mb, *gb, *tb, *pb;
@@ -10720,14 +10736,16 @@ std::string FindLatestFileOrDirectory (const std::string &directory, const char int GetPin (HWND hwndDlg, UINT ctrlId)
{
int pin = 0;
- char szTmp[MAX_PIN + 1] = {0};
- GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIN + 1);
- if (strlen(szTmp))
- {
- char* endPtr = NULL;
- pin = strtol(szTmp, &endPtr, 0);
- if (pin < 0 || endPtr == szTmp || !endPtr || *endPtr != '\0')
- pin = 0;
+ if (IsWindowEnabled (GetDlgItem (hwndDlg, ctrlId)))
+ {
+ char szTmp[MAX_PIN + 1] = {0};
+ if (GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIN + 1) > 0)
+ {
+ char* endPtr = NULL;
+ pin = strtol(szTmp, &endPtr, 10);
+ if (pin < 0 || endPtr == szTmp || !endPtr || *endPtr != '\0')
+ pin = 0;
+ }
}
return pin;
}
|