mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-09 14:00:17 +00:00
Merge pull request #248 from mkilgore/fix-password-inputbox
Fix password handling in _InputBox$ on Windows
This commit is contained in:
commit
bd6ad5fde6
1 changed files with 13 additions and 5 deletions
|
@ -1299,6 +1299,18 @@ static LRESULT displayInputBox(HINSTANCE hinst, HWND hwndOwner, const wchar_t *t
|
||||||
LPWSTR lpwsz;
|
LPWSTR lpwsz;
|
||||||
LRESULT ret;
|
LRESULT ret;
|
||||||
int nchar;
|
int nchar;
|
||||||
|
int isPassword = 0;
|
||||||
|
|
||||||
|
if (!title)
|
||||||
|
title = L"";
|
||||||
|
|
||||||
|
if (!lpszMessage)
|
||||||
|
lpszMessage = L"";
|
||||||
|
|
||||||
|
if (!defaultText) {
|
||||||
|
isPassword = 1;
|
||||||
|
defaultText = L"";
|
||||||
|
}
|
||||||
|
|
||||||
// The extra 500 accounts for the default button text, alignment padding, and a few other small things
|
// The extra 500 accounts for the default button text, alignment padding, and a few other small things
|
||||||
hgbl = GlobalAlloc(GMEM_ZEROINIT, sizeof(DLGTEMPLATE)
|
hgbl = GlobalAlloc(GMEM_ZEROINIT, sizeof(DLGTEMPLATE)
|
||||||
|
@ -1343,7 +1355,7 @@ static LRESULT displayInputBox(HINSTANCE hinst, HWND hwndOwner, const wchar_t *t
|
||||||
lpdit->id = ID_TEXT; // Text identifier
|
lpdit->id = ID_TEXT; // Text identifier
|
||||||
lpdit->style = WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL | ES_LEFT;
|
lpdit->style = WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL | ES_LEFT;
|
||||||
|
|
||||||
if (wcslen(defaultText) == 0)
|
if (isPassword)
|
||||||
lpdit->style |= ES_PASSWORD;
|
lpdit->style |= ES_PASSWORD;
|
||||||
|
|
||||||
lpw = (LPWORD)(lpdit + 1);
|
lpw = (LPWORD)(lpdit + 1);
|
||||||
|
@ -1431,10 +1443,6 @@ wchar_t * tinyfd_inputBoxW(
|
||||||
|
|
||||||
memset(dialogContents, 0, sizeof(dialogContents));
|
memset(dialogContents, 0, sizeof(dialogContents));
|
||||||
|
|
||||||
aTitle = aTitle? aTitle: L"";
|
|
||||||
aMessage = aMessage? aMessage: L"";
|
|
||||||
aDefaultInput = aDefaultInput? aDefaultInput: L"";
|
|
||||||
|
|
||||||
displayInputBox(GetModuleHandle(NULL), GetDialogWindow(), aTitle, aMessage, aDefaultInput);
|
displayInputBox(GetModuleHandle(NULL), GetDialogWindow(), aTitle, aMessage, aDefaultInput);
|
||||||
|
|
||||||
mbstowcs(lBuff, dialogContents, MAX_PATH_OR_CMD);
|
mbstowcs(lBuff, dialogContents, MAX_PATH_OR_CMD);
|
||||||
|
|
Loading…
Reference in a new issue