FreeRDP
TestFileGetStdHandle.c
1
22
#include <winpr/file.h>
23
#include <winpr/handle.h>
24
#include <string.h>
25
#include <stdio.h>
26
27
int
TestFileGetStdHandle(
int
argc,
char
* argv[])
28
{
29
HANDLE so = NULL;
30
const
char
buf[] =
"happy happy"
;
31
DWORD bytesWritten = 0;
32
WINPR_UNUSED(argc);
33
WINPR_UNUSED(argv);
34
so = GetStdHandle(STD_OUTPUT_HANDLE);
35
if
(so == INVALID_HANDLE_VALUE)
36
{
37
(void)fprintf(stderr,
"GetStdHandle failed ;(\n"
);
38
return
-1;
39
}
40
WriteFile(so, buf, strnlen(buf,
sizeof
(buf)), &bytesWritten, FALSE);
41
if
(bytesWritten != strnlen(buf,
sizeof
(buf)))
42
{
43
(void)fprintf(stderr,
"write failed\n"
);
44
return
-1;
45
}
46
(void)CloseHandle(so);
47
48
return
0;
49
}
winpr
libwinpr
file
test
TestFileGetStdHandle.c
Generated by
1.9.1