Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions desktop-src/TaskSchd/daily-trigger-example--c---.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,12 @@ int __cdecl wmain()
// Securely get the user name and password. The task will
// be created to run with the credentials from the supplied
// user name and password.
//
// The CREDUI_FLAGS_COMPLETE_USERNAME flag ensures the
// username is syntax-checked and auto-completed to a fully
// qualified format (like .\user, DOMAIN\user or user@domain).
// Without this flag, bare usernames like "Administrator" pass
// through unvalidated, producing potentially ambiguous task principals.
CREDUI_INFO cui;
TCHAR pszName[CREDUI_MAX_USERNAME_LENGTH] = TEXT("");
TCHAR pszPwd[CREDUI_MAX_PASSWORD_LENGTH] = TEXT("");
Expand All @@ -353,8 +359,8 @@ int __cdecl wmain()
cui.hwndParent = NULL;
// Ensure that MessageText and CaptionText identify
// what credentials to use and which application requires them.
cui.pszMessageText = TEXT("Account information for task registration:");
cui.pszCaptionText = TEXT("Enter Account Information for Task Registration");
cui.pszMessageText = TEXT("Enter credentials for the task. Use a qualified account name such as DOMAIN\\username or .\\username for local accounts:");
cui.hbmBanner = NULL;
fSave = FALSE;

Expand All @@ -369,9 +375,9 @@ int __cdecl wmain()
pszPwd, // Password
CREDUI_MAX_PASSWORD_LENGTH, // Max number for password
&fSave, // State of save check box
CREDUI_FLAGS_GENERIC_CREDENTIALS | // Flags
CREDUI_FLAGS_ALWAYS_SHOW_UI |
CREDUI_FLAGS_DO_NOT_PERSIST);
CREDUI_FLAGS_COMPLETE_USERNAME | // Enforce fully qualified name format
CREDUI_FLAGS_ALWAYS_SHOW_UI | // Flags
CREDUI_FLAGS_DO_NOT_PERSIST); // Flags

if(dwErr)
{
Expand Down