f71b6b46e8
- fixed invalid, missing or additional arguments - removed all type casts from arguments - added missing (void*) typecasts for %p arguments - use inttypes defines where appropriate
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
|
|
#include <stdio.h>
|
|
#include <winpr/crt.h>
|
|
#include <winpr/tchar.h>
|
|
#include <winpr/credui.h>
|
|
#include <winpr/windows.h>
|
|
|
|
static const TCHAR testUserName1[] = _T("LAB1\\JohnDoe");
|
|
static const TCHAR testUserName2[] = _T("JohnDoe@LAB1");
|
|
|
|
int TestCredUIParseUserName(int argc, char* argv[])
|
|
{
|
|
DWORD status;
|
|
TCHAR User[CREDUI_MAX_USERNAME_LENGTH + 1];
|
|
TCHAR Domain[CREDUI_MAX_DOMAIN_TARGET_LENGTH + 1];
|
|
|
|
/* Test LAB1\JohnDoe */
|
|
|
|
ZeroMemory(User, sizeof(User));
|
|
ZeroMemory(Domain, sizeof(Domain));
|
|
|
|
status = CredUIParseUserName(testUserName1, User, sizeof(User) / sizeof(TCHAR),
|
|
Domain, sizeof(Domain) / sizeof(TCHAR));
|
|
|
|
printf("CredUIParseUserName status: 0x%08"PRIX32"\n", status);
|
|
|
|
_tprintf(_T("UserName: %s -> Domain: %s User: %s\n"), testUserName1, Domain, User);
|
|
|
|
/* Test JohnDoe@LAB1 */
|
|
|
|
ZeroMemory(User, sizeof(User));
|
|
ZeroMemory(Domain, sizeof(Domain));
|
|
|
|
status = CredUIParseUserName(testUserName2, User, sizeof(User) / sizeof(TCHAR),
|
|
Domain, sizeof(Domain) / sizeof(TCHAR));
|
|
|
|
printf("CredUIParseUserName status: 0x%08"PRIX32"\n", status);
|
|
|
|
_tprintf(_T("UserName: %s -> Domain: %s User: %s\n"), testUserName2, Domain, User);
|
|
|
|
return 0;
|
|
}
|
|
|