From 99c4031d89ce4f72e3899b3cac660082a1820a48 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 29 May 2016 01:30:53 +0200 Subject: Windows: better implementation for support of smart card PIN in command line. Supported now also on Format. --- src/Format/Tcformat.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/Format') diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 40c17d66..fc888886 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -51,6 +51,7 @@ #include "Volumes.h" #include "Wipe.h" #include "Xml.h" +#include "SecurityToken.h" #include @@ -8777,6 +8778,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) OptionNoIsoCheck, OptionQuit, OptionTokenLib, + OptionTokenPin, CommandResumeSysEncLogOn, CommandResumeSysEnc, CommandDecryptSysEnc, @@ -8806,6 +8808,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) { OptionHistory, L"/history", L"/h", FALSE }, { OptionNoIsoCheck, L"/noisocheck", L"/n", FALSE }, { OptionTokenLib, L"/tokenlib", NULL, FALSE }, + { OptionTokenPin, L"/tokenpin", NULL, FALSE }, { OptionQuit, L"/quit", L"/q", FALSE }, { OptionEncryption, L"/encryption", NULL , FALSE }, { OptionFilesystem, L"/filesystem", NULL , FALSE }, @@ -9190,6 +9193,20 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) break; + case OptionTokenPin: + { + wchar_t szTmp[SecurityToken::MaxPasswordLength + 1] = {0}; + if (GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)) == HAS_ARGUMENT) + { + if (0 == WideCharToMultiByte (CP_UTF8, 0, szTmp, -1, CmdTokenPin, TC_MAX_PATH, nullptr, nullptr)) + AbortProcess ("COMMAND_LINE_ERROR"); + } + else + AbortProcess ("COMMAND_LINE_ERROR"); + } + + break; + case OptionQuit: { // Used to indicate non-install elevation -- cgit v1.2.3