1 | #include <windows.h>
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <WinCred.h>
|
---|
4 |
|
---|
5 | int main(int argc, TCHAR* argv[])
|
---|
6 | {
|
---|
7 | BOOL save = false;
|
---|
8 | DWORD authPackage = 0;
|
---|
9 | LPVOID authBuffer;
|
---|
10 | ULONG authBufferSize = 0;
|
---|
11 | CREDUI_INFO credUiInfo;
|
---|
12 |
|
---|
13 | credUiInfo.pszCaptionText = TEXT("VBoxCaption");
|
---|
14 | credUiInfo.pszMessageText = TEXT("VBoxMessage");
|
---|
15 | credUiInfo.cbSize = sizeof(credUiInfo);
|
---|
16 | credUiInfo.hbmBanner = NULL;
|
---|
17 | credUiInfo.hwndParent = NULL;
|
---|
18 |
|
---|
19 | DWORD dwErr = CredUIPromptForWindowsCredentials(&(credUiInfo), 0, &(authPackage),
|
---|
20 | NULL, 0, &authBuffer, &authBufferSize, &(save), 0);
|
---|
21 | printf("Test returned %ld\n", dwErr);
|
---|
22 |
|
---|
23 | return dwErr == ERROR_SUCCESS ? 0 : 1;
|
---|
24 | }
|
---|