VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWendigo <84196391+wendig0x@users.noreply.github.com>2022-08-25 09:57:34 +0300
committerGitHub <noreply@github.com>2022-08-25 08:57:34 +0200
commit46ecb1a66de8abade4566cf73dcaec5d70e18920 (patch)
treeb587c4930bab847e29145ec4df55d6e012386495
parenta23d4392fb9b570edd1c0eac9c267a50a6e2dfd7 (diff)
downloadVeraCrypt-46ecb1a66de8abade4566cf73dcaec5d70e18920.tar.gz
VeraCrypt-46ecb1a66de8abade4566cf73dcaec5d70e18920.zip
Minor bugfixes (#950)
* Update Dlgcode.c minor bugfixes * GlobalMemoryStatus x64 bugfix GlobalMemoryStatus deprecated in x64
-rw-r--r--src/Common/Dlgcode.c16
-rw-r--r--src/Common/Random.c2
2 files changed, 12 insertions, 6 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 7b3d2d45..2c707f5d 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -14546,9 +14546,12 @@ static bool RunAsDesktopUser(
tkp.PrivilegeCount = 1;
LookupPrivilegeValueW(NULL, SE_INCREASE_QUOTA_NAME, &tkp.Privileges[0].Luid);
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
- SetThreadToken (NULL, NULL);
+ if (!SetThreadToken(NULL, NULL))
+ {
+ goto cleanup;
+ }
AdjustTokenPrivileges(hThreadToken, FALSE, &tkp, 0, NULL, NULL);
dwLastErr = GetLastError();
if (ERROR_SUCCESS != dwLastErr)
@@ -14632,9 +14635,12 @@ cleanup:
if (hShellProcessToken) CloseHandle(hShellProcessToken);
if (hPrimaryToken) CloseHandle(hPrimaryToken);
if (hShellProcess) CloseHandle(hShellProcess);
if (hThreadToken) CloseHandle(hThreadToken);
- RevertToSelf ();
+
+ if (!RevertToSelf())
+ return false;
+
if (!retval)
SetLastError (dwLastErr);
return retval;
}
@@ -15040,9 +15046,9 @@ ULONG GenericDropTarget::Release(void)
//*************************************************************
BOOL GenericDropTarget::Register(HWND hWnd)
{
if(NULL == hWnd)
- return E_FAIL;
+ return FALSE;
OleInitialize(NULL);
// required: these MUST be strong locked
@@ -15261,9 +15267,9 @@ DWORD PasswordEditDropTarget::GotEnter(void)
int maxLen;
HWND hChild = WindowFromPoint (m_DropPoint);
// check that we are on password edit control (we use maximum length to correctly identify password fields since they don't always have ES_PASSWORD style (if the the user checked show password)
if (hChild && GetClassName (hChild, szClassName, ARRAYSIZE (szClassName)) && (0 == _tcsicmp (szClassName, _T("EDIT")))
- && (dwStyles = GetWindowLong (hChild, GWL_STYLE)) && !(dwStyles & ES_NUMBER)
+ && (dwStyles = GetWindowLongPtr (hChild, GWL_STYLE)) && !(dwStyles & ES_NUMBER)
&& (maxLen = (int) SendMessage (hChild, EM_GETLIMITTEXT, 0, 0)) && (maxLen == MAX_PASSWORD || maxLen == MAX_LEGACY_PASSWORD)
)
{
return DROPEFFECT_COPY;
@@ -15286,9 +15292,9 @@ void PasswordEditDropTarget::GotDrop(CLIPFORMAT format)
DWORD dwStyles;
int maxLen;
HWND hChild = WindowFromPoint (m_DropPoint);
if (hChild && GetClassName (hChild, szClassName, ARRAYSIZE (szClassName)) && (0 == _tcsicmp (szClassName, _T("EDIT")))
- && (dwStyles = GetWindowLong (hChild, GWL_STYLE)) && !(dwStyles & ES_NUMBER)
+ && (dwStyles = GetWindowLongPtr (hChild, GWL_STYLE)) && !(dwStyles & ES_NUMBER)
&& (maxLen = (int) SendMessage (hChild, EM_GETLIMITTEXT, 0, 0)) && (maxLen == MAX_PASSWORD || maxLen == MAX_LEGACY_PASSWORD)
)
{
WCHAR* wszText;
diff --git a/src/Common/Random.c b/src/Common/Random.c
index c44c69d7..d5c09848 100644
--- a/src/Common/Random.c
+++ b/src/Common/Random.c
@@ -871,9 +871,9 @@ BOOL FastPoll (void)
/* Get percent of memory in use, bytes of physical memory, bytes of
free physical memory, bytes in paging file, free bytes in paging
file, user bytes of address space, and free user bytes */
memoryStatus.dwLength = sizeof (MEMORYSTATUS);
- GlobalMemoryStatus (&memoryStatus);
+ GlobalMemoryStatusEx (&memoryStatus);
RandaddBuf ((unsigned char *) &memoryStatus, sizeof (MEMORYSTATUS));
/* Get thread and process creation time, exit time, time in kernel
mode, and time in user mode in 100ns intervals */