| 1 |
|
| 2 |
#include <winpr/crt.h> |
| 3 |
#include <winpr/error.h> |
| 4 |
#include <winpr/wtsapi.h> |
| 5 |
#include <winpr/user.h> |
| 6 |
|
| 7 |
#define TITLE "thats the title" |
| 8 |
#define MESSAGE "thats the message" |
| 9 |
|
| 10 |
int TestWtsApiExtraSendMessage(int argc, char* argv[]) |
| 11 |
{ |
| 12 |
WINPR_UNUSED(argc); |
| 13 |
WINPR_UNUSED(argv); |
| 14 |
|
| 15 |
HANDLE hServer = WTS_CURRENT_SERVER_HANDLE; |
| 16 |
DWORD result = 0; |
| 17 |
BOOL bSuccess = WTSSendMessageA(hServer, WTS_CURRENT_SESSION, TITLE, strlen(TITLE) + 1, MESSAGE, |
| 18 |
strlen(MESSAGE) + 1, MB_CANCELTRYCONTINUE, 3, &result, TRUE); |
| 19 |
|
| 20 |
if (!bSuccess) |
| 21 |
{ |
| 22 |
printf("WTSSendMessage failed: %" PRIu32 "\n", GetLastError()); |
| 23 |
return -1; |
| 24 |
} |
| 25 |
|
| 26 |
printf("WTSSendMessage got result: %" PRIu32 "\n", result); |
| 27 |
|
| 28 |
return 0; |
| 29 |
} |