Fix runas dialog default username
@@ -795,12 +795,24 @@ INT_PTR CALLBACK PhpRunAsDlgProc(
if (!context->ProcessId)
{
- SetWindowText(
+ PPH_STRING runAsUserName = PhaGetStringSetting(L"RunAsUserName");
+ INT runAsUserNameIndex = CB_ERR;
+
+ // Fire the user name changed event so we can fix the logon type.
+ if (!PhIsNullOrEmptyString(runAsUserName))
+ {
+ runAsUserNameIndex = ComboBox_FindString(
context->UserComboBoxWindowHandle,
- PH_AUTO_T(PH_STRING, PhGetStringSetting(L"RunAsUserName"))->Buffer
+ 0,
+ PhGetString(runAsUserName)
);
+ }
+
+ if (runAsUserNameIndex != CB_ERR)
+ ComboBox_SetCurSel(context->UserComboBoxWindowHandle, runAsUserNameIndex);
+ else
+ ComboBox_SetCurSel(context->UserComboBoxWindowHandle, 0);
- // Fire the user name changed event so we can fix the logon type.
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_USERNAME, CBN_EDITCHANGE), 0);
}
else
