VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/BaseCom.cpp4
-rw-r--r--src/Common/Dlgcode.c2
-rw-r--r--src/Common/SecurityToken.cpp12
-rw-r--r--src/Common/SecurityToken.h8
4 files changed, 13 insertions, 13 deletions
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 7a74e293..32859b11 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -129,9 +129,9 @@ BOOL BaseCom::IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly)
DWORD BaseCom::ReadWriteFile (BOOL write, BOOL device, BSTR filePath, BSTR *bufferBstr, unsigned __int64 offset, unsigned __int32 size, DWORD *sizeDone)
{
try
{
- auto_ptr <File> file (device ? new Device (filePath, !write) : new File (filePath, !write));
+ unique_ptr <File> file (device ? new Device (filePath, !write) : new File (filePath, !write));
file->CheckOpened (SRC_POS);
file->SeekAt (offset);
if (write)
@@ -193,9 +193,9 @@ DWORD BaseCom::GetFileSize (BSTR filePath, unsigned __int64 *pSize)
DWORD BaseCom::DeviceIoControl (BOOL readOnly, BOOL device, BSTR filePath, DWORD dwIoControlCode, BSTR input, BSTR *output)
{
try
{
- auto_ptr <File> file (device ? new Device (filePath, readOnly == TRUE) : new File (filePath, readOnly == TRUE));
+ unique_ptr <File> file (device ? new Device (filePath, readOnly == TRUE) : new File (filePath, readOnly == TRUE));
file->CheckOpened (SRC_POS);
if (!file->IoCtl (dwIoControlCode, (BYTE *) input, !(BYTE *) input ? 0 : ((DWORD *) ((BYTE *) input))[-1],
(BYTE *) *output, !(BYTE *) *output ? 0 : ((DWORD *) ((BYTE *) *output))[-1]))
{
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 3c4928e2..17a2f3fd 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -12103,9 +12103,9 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg)
};
try
{
- SecurityToken::InitLibrary (SecurityTokenLibraryPath, auto_ptr <GetPinFunctor> (new PinRequestHandler(MainDlg)), auto_ptr <SendExceptionFunctor> (new WarningHandler(MainDlg)));
+ SecurityToken::InitLibrary (SecurityTokenLibraryPath, unique_ptr <GetPinFunctor> (new PinRequestHandler(MainDlg)), unique_ptr <SendExceptionFunctor> (new WarningHandler(MainDlg)));
}
catch (Exception &e)
{
e.Show (hwndDlg);
diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp
index 841ca720..a6759bf8 100644
--- a/src/Common/SecurityToken.cpp
+++ b/src/Common/SecurityToken.cpp
@@ -512,11 +512,11 @@ namespace VeraCrypt
}
}
#ifdef TC_WINDOWS
- void SecurityToken::InitLibrary (const wstring &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback)
+ void SecurityToken::InitLibrary (const wstring &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback)
#else
- void SecurityToken::InitLibrary (const string &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback)
+ void SecurityToken::InitLibrary (const string &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback)
#endif
{
if (Initialized)
CloseLibrary();
@@ -547,10 +547,10 @@ namespace VeraCrypt
status = Pkcs11Functions->C_Initialize (NULL_PTR);
if (status != CKR_OK)
throw Pkcs11Exception (status);
- PinCallback = pinCallback;
- WarningCallback = warningCallback;
+ PinCallback = std::move(pinCallback);
+ WarningCallback = std::move(warningCallback);
Initialized = true;
}
@@ -727,10 +727,10 @@ namespace VeraCrypt
}
}
#endif // TC_HEADER_Common_Exception
- auto_ptr <GetPinFunctor> SecurityToken::PinCallback;
- auto_ptr <SendExceptionFunctor> SecurityToken::WarningCallback;
+ unique_ptr <GetPinFunctor> SecurityToken::PinCallback;
+ unique_ptr <SendExceptionFunctor> SecurityToken::WarningCallback;
bool SecurityToken::Initialized;
CK_FUNCTION_LIST_PTR SecurityToken::Pkcs11Functions;
map <CK_SLOT_ID, Pkcs11Session> SecurityToken::Sessions;
diff --git a/src/Common/SecurityToken.h b/src/Common/SecurityToken.h
index 1112f11c..6b228895 100644
--- a/src/Common/SecurityToken.h
+++ b/src/Common/SecurityToken.h
@@ -190,11 +190,11 @@ namespace VeraCrypt
static void GetKeyfileData (const SecurityTokenKeyfile &keyfile, vector <byte> &keyfileData);
static list <SecurityTokenInfo> GetAvailableTokens ();
static SecurityTokenInfo GetTokenInfo (CK_SLOT_ID slotId);
#ifdef TC_WINDOWS
- static void InitLibrary (const wstring &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback);
+ static void InitLibrary (const wstring &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback);
#else
- static void InitLibrary (const string &pkcs11LibraryPath, auto_ptr <GetPinFunctor> pinCallback, auto_ptr <SendExceptionFunctor> warningCallback);
+ static void InitLibrary (const string &pkcs11LibraryPath, unique_ptr <GetPinFunctor> pinCallback, unique_ptr <SendExceptionFunctor> warningCallback);
#endif
static bool IsInitialized () { return Initialized; }
static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath);
@@ -210,17 +210,17 @@ namespace VeraCrypt
static void OpenSession (CK_SLOT_ID slotId);
static void CheckLibraryStatus ();
static bool Initialized;
- static auto_ptr <GetPinFunctor> PinCallback;
+ static unique_ptr <GetPinFunctor> PinCallback;
static CK_FUNCTION_LIST_PTR Pkcs11Functions;
#ifdef TC_WINDOWS
static HMODULE Pkcs11LibraryHandle;
#else
static void *Pkcs11LibraryHandle;
#endif
static map <CK_SLOT_ID, Pkcs11Session> Sessions;
- static auto_ptr <SendExceptionFunctor> WarningCallback;
+ static unique_ptr <SendExceptionFunctor> WarningCallback;
};
}
#endif // TC_HEADER_Common_SecurityToken