FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
TestClientRdpFile.c
1#include <freerdp/config.h>
2
3#include <stdio.h>
4#include <winpr/crt.h>
5#include <winpr/windows.h>
6#include <winpr/path.h>
7#include <winpr/crypto.h>
8
9#include <freerdp/client/file.h>
10#include <freerdp/channels/rdpecam.h>
11
12static const BYTE testRdpFileUTF16[] = {
13 0xff, 0xfe, 0x73, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x20, 0x00,
14 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x20, 0x00, 0x69, 0x00, 0x64, 0x00, 0x3a, 0x00,
15 0x69, 0x00, 0x3a, 0x00, 0x32, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x75, 0x00, 0x73, 0x00, 0x65, 0x00,
16 0x20, 0x00, 0x6d, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6d, 0x00, 0x6f, 0x00,
17 0x6e, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00,
18 0x65, 0x00, 0x73, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x70, 0x00, 0x77, 0x00, 0x69, 0x00,
19 0x64, 0x00, 0x74, 0x00, 0x68, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x39, 0x00,
20 0x32, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x65, 0x00, 0x73, 0x00, 0x6b, 0x00,
21 0x74, 0x00, 0x6f, 0x00, 0x70, 0x00, 0x68, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00,
22 0x74, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x30, 0x00, 0x38, 0x00, 0x30, 0x00,
23 0x0d, 0x00, 0x0a, 0x00, 0x73, 0x00, 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00,
24 0x6e, 0x00, 0x20, 0x00, 0x62, 0x00, 0x70, 0x00, 0x70, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
25 0x33, 0x00, 0x32, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x77, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x70, 0x00,
26 0x6f, 0x00, 0x73, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00,
27 0x30, 0x00, 0x2c, 0x00, 0x31, 0x00, 0x2c, 0x00, 0x35, 0x00, 0x35, 0x00, 0x33, 0x00, 0x2c, 0x00,
28 0x32, 0x00, 0x31, 0x00, 0x31, 0x00, 0x2c, 0x00, 0x31, 0x00, 0x33, 0x00, 0x35, 0x00, 0x33, 0x00,
29 0x2c, 0x00, 0x38, 0x00, 0x31, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x63, 0x00, 0x6f, 0x00,
30 0x6d, 0x00, 0x70, 0x00, 0x72, 0x00, 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00,
31 0x6e, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x6b, 0x00,
32 0x65, 0x00, 0x79, 0x00, 0x62, 0x00, 0x6f, 0x00, 0x61, 0x00, 0x72, 0x00, 0x64, 0x00, 0x68, 0x00,
33 0x6f, 0x00, 0x6f, 0x00, 0x6b, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x32, 0x00, 0x0d, 0x00,
34 0x0a, 0x00, 0x61, 0x00, 0x75, 0x00, 0x64, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x63, 0x00, 0x61, 0x00,
35 0x70, 0x00, 0x74, 0x00, 0x75, 0x00, 0x72, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00,
36 0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x76, 0x00,
37 0x69, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6f, 0x00, 0x70, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x79, 0x00,
38 0x62, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00,
39 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x63, 0x00, 0x6f, 0x00,
40 0x6e, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
41 0x20, 0x00, 0x74, 0x00, 0x79, 0x00, 0x70, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
42 0x37, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x74, 0x00, 0x77, 0x00, 0x6f, 0x00,
43 0x72, 0x00, 0x6b, 0x00, 0x61, 0x00, 0x75, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00,
44 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00,
45 0x0d, 0x00, 0x0a, 0x00, 0x62, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x77, 0x00, 0x69, 0x00,
46 0x64, 0x00, 0x74, 0x00, 0x68, 0x00, 0x61, 0x00, 0x75, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x64, 0x00,
47 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
48 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x70, 0x00, 0x6c, 0x00,
49 0x61, 0x00, 0x79, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x63, 0x00,
50 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0x3a, 0x00,
51 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00,
52 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x77, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x6b, 0x00, 0x73, 0x00,
53 0x70, 0x00, 0x61, 0x00, 0x63, 0x00, 0x65, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x6f, 0x00,
54 0x6e, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
55 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x62, 0x00,
56 0x6c, 0x00, 0x65, 0x00, 0x20, 0x00, 0x77, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x70, 0x00,
57 0x61, 0x00, 0x70, 0x00, 0x65, 0x00, 0x72, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00,
58 0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x6f, 0x00, 0x77, 0x00, 0x20, 0x00,
59 0x66, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x20, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x6f, 0x00,
60 0x6f, 0x00, 0x74, 0x00, 0x68, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x3a, 0x00, 0x69, 0x00,
61 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x6f, 0x00,
62 0x77, 0x00, 0x20, 0x00, 0x64, 0x00, 0x65, 0x00, 0x73, 0x00, 0x6b, 0x00, 0x74, 0x00, 0x6f, 0x00,
63 0x70, 0x00, 0x20, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x6f, 0x00, 0x73, 0x00,
64 0x69, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
65 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x62, 0x00,
66 0x6c, 0x00, 0x65, 0x00, 0x20, 0x00, 0x66, 0x00, 0x75, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x20, 0x00,
67 0x77, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x77, 0x00, 0x20, 0x00, 0x64, 0x00,
68 0x72, 0x00, 0x61, 0x00, 0x67, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00,
69 0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00,
70 0x20, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x75, 0x00, 0x20, 0x00, 0x61, 0x00, 0x6e, 0x00,
71 0x69, 0x00, 0x6d, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00,
72 0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00,
73 0x20, 0x00, 0x74, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x73, 0x00, 0x3a, 0x00,
74 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x69, 0x00, 0x73, 0x00,
75 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x20, 0x00, 0x63, 0x00, 0x75, 0x00, 0x72, 0x00,
76 0x73, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0x73, 0x00, 0x65, 0x00, 0x74, 0x00, 0x74, 0x00,
77 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00,
78 0x0a, 0x00, 0x62, 0x00, 0x69, 0x00, 0x74, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x70, 0x00, 0x63, 0x00,
79 0x61, 0x00, 0x63, 0x00, 0x68, 0x00, 0x65, 0x00, 0x70, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00,
80 0x69, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00,
81 0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x66, 0x00,
82 0x75, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x61, 0x00, 0x64, 0x00, 0x64, 0x00, 0x72, 0x00,
83 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x4c, 0x00, 0x41, 0x00,
84 0x42, 0x00, 0x31, 0x00, 0x2d, 0x00, 0x57, 0x00, 0x37, 0x00, 0x2d, 0x00, 0x44, 0x00, 0x4d, 0x00,
85 0x2d, 0x00, 0x30, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x62, 0x00, 0x31, 0x00,
86 0x2e, 0x00, 0x61, 0x00, 0x77, 0x00, 0x61, 0x00, 0x6b, 0x00, 0x65, 0x00, 0x2e, 0x00, 0x6c, 0x00,
87 0x6f, 0x00, 0x63, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x75, 0x00,
88 0x64, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x3a, 0x00,
89 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00,
90 0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x70, 0x00, 0x72, 0x00, 0x69, 0x00,
91 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
92 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x69, 0x00, 0x72, 0x00,
93 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x6f, 0x00,
94 0x72, 0x00, 0x74, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00,
95 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00,
96 0x74, 0x00, 0x73, 0x00, 0x6d, 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x63, 0x00, 0x61, 0x00,
97 0x72, 0x00, 0x64, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00,
98 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00,
99 0x74, 0x00, 0x63, 0x00, 0x6c, 0x00, 0x69, 0x00, 0x70, 0x00, 0x62, 0x00, 0x6f, 0x00, 0x61, 0x00,
100 0x72, 0x00, 0x64, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00,
101 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00,
102 0x70, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x64, 0x00, 0x65, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00,
103 0x65, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00,
104 0x61, 0x00, 0x75, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x6f, 0x00,
105 0x6e, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
106 0x20, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x64, 0x00,
107 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x75, 0x00,
108 0x74, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x69, 0x00, 0x63, 0x00, 0x61, 0x00,
109 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x76, 0x00,
110 0x65, 0x00, 0x6c, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x32, 0x00, 0x0d, 0x00, 0x0a, 0x00,
111 0x70, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x74, 0x00, 0x20, 0x00, 0x66, 0x00,
112 0x6f, 0x00, 0x72, 0x00, 0x20, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x65, 0x00,
113 0x6e, 0x00, 0x74, 0x00, 0x69, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x69, 0x00,
114 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x67, 0x00, 0x6f, 0x00,
115 0x74, 0x00, 0x69, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x20, 0x00, 0x73, 0x00, 0x65, 0x00,
116 0x63, 0x00, 0x75, 0x00, 0x72, 0x00, 0x69, 0x00, 0x74, 0x00, 0x79, 0x00, 0x20, 0x00, 0x6c, 0x00,
117 0x61, 0x00, 0x79, 0x00, 0x65, 0x00, 0x72, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00,
118 0x0d, 0x00, 0x0a, 0x00, 0x72, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x74, 0x00, 0x65, 0x00,
119 0x61, 0x00, 0x70, 0x00, 0x70, 0x00, 0x6c, 0x00, 0x69, 0x00, 0x63, 0x00, 0x61, 0x00, 0x74, 0x00,
120 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x6d, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x3a, 0x00,
121 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x74, 0x00,
122 0x65, 0x00, 0x72, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x20, 0x00, 0x73, 0x00,
123 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x0d, 0x00,
124 0x0a, 0x00, 0x73, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00, 0x20, 0x00, 0x77, 0x00,
125 0x6f, 0x00, 0x72, 0x00, 0x6b, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x20, 0x00, 0x64, 0x00,
126 0x69, 0x00, 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x79, 0x00,
127 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x67, 0x00, 0x61, 0x00, 0x74, 0x00,
128 0x65, 0x00, 0x77, 0x00, 0x61, 0x00, 0x79, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x74, 0x00,
129 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x4c, 0x00,
130 0x41, 0x00, 0x42, 0x00, 0x31, 0x00, 0x2d, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00, 0x38, 0x00,
131 0x52, 0x00, 0x32, 0x00, 0x2d, 0x00, 0x47, 0x00, 0x57, 0x00, 0x2e, 0x00, 0x6c, 0x00, 0x61, 0x00,
132 0x62, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x61, 0x00, 0x77, 0x00, 0x61, 0x00, 0x6b, 0x00, 0x65, 0x00,
133 0x2e, 0x00, 0x6c, 0x00, 0x6f, 0x00, 0x63, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x0d, 0x00, 0x0a, 0x00,
134 0x67, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x77, 0x00, 0x61, 0x00, 0x79, 0x00, 0x75, 0x00,
135 0x73, 0x00, 0x61, 0x00, 0x67, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x74, 0x00, 0x68, 0x00,
136 0x6f, 0x00, 0x64, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00,
137 0x67, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x77, 0x00, 0x61, 0x00, 0x79, 0x00, 0x63, 0x00,
138 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x69, 0x00, 0x61, 0x00,
139 0x6c, 0x00, 0x73, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x75, 0x00, 0x72, 0x00, 0x63, 0x00, 0x65, 0x00,
140 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x67, 0x00, 0x61, 0x00,
141 0x74, 0x00, 0x65, 0x00, 0x77, 0x00, 0x61, 0x00, 0x79, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6f, 0x00,
142 0x66, 0x00, 0x69, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x75, 0x00, 0x73, 0x00, 0x61, 0x00, 0x67, 0x00,
143 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x74, 0x00, 0x68, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x3a, 0x00,
144 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x70, 0x00, 0x72, 0x00, 0x6f, 0x00,
145 0x6d, 0x00, 0x70, 0x00, 0x74, 0x00, 0x63, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x65, 0x00,
146 0x6e, 0x00, 0x74, 0x00, 0x69, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x63, 0x00,
147 0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x31, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x75, 0x00,
148 0x73, 0x00, 0x65, 0x00, 0x20, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x69, 0x00, 0x72, 0x00,
149 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x20, 0x00, 0x73, 0x00,
150 0x65, 0x00, 0x72, 0x00, 0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x20, 0x00, 0x6e, 0x00, 0x61, 0x00,
151 0x6d, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00, 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00,
152 0x72, 0x00, 0x64, 0x00, 0x67, 0x00, 0x69, 0x00, 0x73, 0x00, 0x6b, 0x00, 0x64, 0x00, 0x63, 0x00,
153 0x70, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x78, 0x00, 0x79, 0x00, 0x3a, 0x00, 0x69, 0x00, 0x3a, 0x00,
154 0x30, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x6b, 0x00, 0x64, 0x00, 0x63, 0x00, 0x70, 0x00, 0x72, 0x00,
155 0x6f, 0x00, 0x78, 0x00, 0x79, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x3a, 0x00,
156 0x73, 0x00, 0x3a, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x64, 0x00, 0x72, 0x00, 0x69, 0x00, 0x76, 0x00,
157 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00, 0x69, 0x00,
158 0x72, 0x00, 0x65, 0x00, 0x63, 0x00, 0x74, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x2a, 0x00,
159 0x0d, 0x00, 0x0a, 0x00, 0x75, 0x00, 0x73, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6e, 0x00, 0x61, 0x00,
160 0x6d, 0x00, 0x65, 0x00, 0x3a, 0x00, 0x73, 0x00, 0x3a, 0x00, 0x4c, 0x00, 0x41, 0x00, 0x42, 0x00,
161 0x31, 0x00, 0x5c, 0x00, 0x4a, 0x00, 0x6f, 0x00, 0x68, 0x00, 0x6e, 0x00, 0x44, 0x00, 0x6f, 0x00,
162 0x65, 0x00, 0x0d, 0x00, 0x0a, 0x00
163};
164
165#if defined(CHANNEL_RDPECAM_CLIENT)
166static const char* camera_args[] = { RDPECAM_DVC_CHANNEL_NAME,
167 "device:*",
168 "device:\\?\\usb#vid_0bda&pid_58b0&mi",
169 "device:-\\?\\usb#vid_0bdc&pid_58b1&mi",
170 "encode:1",
171 "quality:2" };
172#endif
173
174#if defined(CHANNEL_URBDRC_CLIENT)
175static const char* urbdrc_args[] = { "urbdrc", "device:*", "device:USBInstanceID:someid",
176 "device:{72631e54-78a4-11d0-bcf7-00aa00b7b32a}" };
177#endif
178
179static char testRdpFileUTF8[] =
180 "screen mode id:i:2\n"
181 "use multimon:i:0\n"
182 "desktopwidth:i:1920\n"
183 "desktopheight:i:1080\n"
184 "dynamic resolution:i:1080\n"
185 "desktopscalefactor:i:1080\n"
186 "redirected video capture encoding quality:i:2\n"
187 "encode redirected video capture:i:1\n"
188 "camerastoredirect:s:*,\\?\\usb#vid_0bda&pid_58b0&mi,-\\?\\usb#vid_0bdc&pid_58b1&mi\n"
189 "usbdevicestoredirect:s:*,USBInstanceID:someid,{72631e54-78a4-11d0-bcf7-00aa00b7b32a}\n"
190 "selectedmonitors:s:3,2,42,23"
191 "session bpp:i:32\n"
192 "winposstr:s:0,1,553,211,1353,811\n"
193 "compression:i:1\n"
194 "keyboardhook:i:2\n"
195 "audiocapturemode:i:0\n"
196 "videoplaybackmode:i:2\n"
197 "connection type:i:7\n"
198 "networkautodetect:i:1\n"
199 "bandwidthautodetect:i:1\n"
200 "displayconnectionbar:i:1\n"
201 "enableworkspacereconnect:i:0\n"
202 "disable wallpaper:i:0\n"
203 "allow font smoothing:i:0\n"
204 "allow desktop composition:i:0\n"
205 "disable full window drag:i:1\n"
206 "disable menu anims:i:1\n"
207 "disable themes:i:0\n"
208 "disable cursor setting:i:0\n"
209 "bitmapcachepersistenable:i:1\n"
210 "full address:s:LAB1-W7-DM-01.lab1.awake.local\n"
211 "alternate full address:s:LAB1-W7-DM-01.lab1.awake.global\n"
212 "audiomode:i:0\n"
213 "redirectprinters:i:1\n"
214 "redirectcomports:i:0\n"
215 "redirectsmartcards:i:1\n"
216 "redirectclipboard:i:1\n"
217 "redirectposdevices:i:0\n"
218 "autoreconnection enabled:i:1\n"
219 "authentication level:i:2\n"
220 "prompt for credentials:i:0\n"
221 "negotiate security layer:i:1\n"
222 "remoteapplicationmode:i:0\n"
223 "alternate shell:s:\n"
224 "shell working directory:s:\n"
225 "gatewayhostname:s:LAB1-W2K8R2-GW.lab1.awake.local\n"
226 "gatewayusagemethod:i:1\n"
227 "gatewaycredentialssource:i:0\n"
228 "gatewayprofileusagemethod:i:1\n"
229 "promptcredentialonce:i:1\n"
230 "use redirection server name:i:0\n"
231 "rdgiskdcproxy:i:0\n"
232 "kdcproxyname:s:\n"
233 "drivestoredirect:s:*\n"
234 "username:s:LAB1\\JohnDoe\n"
235 "vendor integer:i:123\n"
236 "vendor string:s:microsoft\n";
237
238static char* append(const char* fmt, ...)
239{
240 int rc = 0;
241 char* dst = NULL;
242 va_list ap = { 0 };
243
244 va_start(ap, fmt);
245 rc = vsnprintf(NULL, 0, fmt, ap);
246 va_end(ap);
247 if (rc < 0)
248 return NULL;
249 dst = malloc((size_t)rc + 1);
250 if (!dst)
251 return NULL;
252
253 va_start(ap, fmt);
254 rc = vsnprintf(dst, (size_t)rc + 1, fmt, ap);
255 va_end(ap);
256 if (rc < 0)
257 {
258 free(dst);
259 return NULL;
260 }
261 return dst;
262}
263
264int TestClientRdpFile(int argc, char* argv[])
265{
266 int rc = -1;
267 int iValue = 0;
268 UINT32 uValue = 0;
269 const UINT32* puValue = NULL;
270 const char* sValue = NULL;
271 char* utfname = NULL;
272 char* uniname = NULL;
273 char* base = NULL;
274 char* tmp = NULL;
275 UINT64 id = 0;
276 rdpFile* file = NULL;
277 rdpSettings* settings = NULL;
278
279 WINPR_UNUSED(argc);
280 WINPR_UNUSED(argv);
281 winpr_RAND(&id, sizeof(id));
282
283 /* Unicode */
284 file = freerdp_client_rdp_file_new();
285 settings = freerdp_settings_new(0);
286
287 if (!file || !settings)
288 {
289 printf("rdp_file_new failed\n");
290 goto fail;
291 }
292
293 if (!freerdp_client_parse_rdp_file_buffer(file, testRdpFileUTF16, sizeof(testRdpFileUTF16)))
294 goto fail;
295
296 if (!freerdp_client_populate_settings_from_rdp_file(file, settings))
297 goto fail;
298
299 if (freerdp_settings_get_bool(settings, FreeRDP_UseMultimon))
300 {
301 printf("UseMultiMon mismatch: Actual: %" PRIu32 ", Expected: 0\n",
302 freerdp_settings_get_bool(settings, FreeRDP_UseMultimon));
303 goto fail;
304 }
305
306 if (!freerdp_settings_get_bool(settings, FreeRDP_Fullscreen))
307 {
308 printf("ScreenModeId mismatch: Actual: %" PRIu32 ", Expected: TRUE\n",
309 freerdp_settings_get_bool(settings, FreeRDP_Fullscreen));
310 goto fail;
311 }
312
313 if (strcmp(freerdp_settings_get_string(settings, FreeRDP_GatewayHostname),
314 "LAB1-W2K8R2-GW.lab1.awake.local") != 0)
315 {
316 printf("GatewayHostname mismatch: Actual: %s, Expected: %s\n",
317 freerdp_settings_get_string(settings, FreeRDP_GatewayHostname),
318 "LAB1-W2K8R2-GW.lab1.awake.local");
319 goto fail;
320 }
321
322 if (strcmp(freerdp_settings_get_string(settings, FreeRDP_ServerHostname),
323 "LAB1-W7-DM-01.lab1.awake.local") != 0)
324 {
325 printf("ServerHostname mismatch: Actual: %s, Expected: %s\n",
326 freerdp_settings_get_string(settings, FreeRDP_ServerHostname),
327 "LAB1-W7-DM-01.lab1.awake.local");
328 goto fail;
329 }
330
331 freerdp_client_rdp_file_free(file);
332 freerdp_settings_free(settings);
333 /* Ascii */
334 file = freerdp_client_rdp_file_new();
335 settings = freerdp_settings_new(0);
336 if (!file || !settings)
337 {
338 printf("rdp_file_new failed\n");
339 goto fail;
340 }
341
342 if (!freerdp_client_parse_rdp_file_buffer(file, (BYTE*)testRdpFileUTF8,
343 sizeof(testRdpFileUTF8)))
344 goto fail;
345
346 if (!freerdp_client_populate_settings_from_rdp_file(file, settings))
347 goto fail;
348
349 if (freerdp_settings_get_bool(settings, FreeRDP_UseMultimon))
350 {
351 printf("UseMultiMon mismatch: Actual: %" PRIu32 ", Expected: 0\n",
352 freerdp_settings_get_bool(settings, FreeRDP_UseMultimon));
353 return -1;
354 }
355
356 if (!freerdp_settings_get_bool(settings, FreeRDP_Fullscreen))
357 {
358 printf("ScreenModeId mismatch: Actual: %" PRIu32 ", Expected: TRUE\n",
359 freerdp_settings_get_bool(settings, FreeRDP_Fullscreen));
360 return -1;
361 }
362
363 if (strcmp(freerdp_settings_get_string(settings, FreeRDP_ServerHostname),
364 "LAB1-W7-DM-01.lab1.awake.global") != 0)
365 {
366 printf("ServerHostname mismatch: Actual: %s, Expected: %s\n",
367 freerdp_settings_get_string(settings, FreeRDP_ServerHostname),
368 "LAB1-W7-DM-01.lab1.awake.global");
369 goto fail;
370 }
371
372 if (strcmp(freerdp_settings_get_string(settings, FreeRDP_GatewayHostname),
373 "LAB1-W2K8R2-GW.lab1.awake.local") != 0)
374 {
375 printf("GatewayHostname mismatch: Actual: %s, Expected: %s\n",
376 freerdp_settings_get_string(settings, FreeRDP_GatewayHostname),
377 "LAB1-W2K8R2-GW.lab1.awake.local");
378 goto fail;
379 }
380
381 iValue = freerdp_client_rdp_file_get_integer_option(file, "dynamic resolution");
382 if (iValue != 1080)
383 {
384 printf("dynamic resolution uses invalid default value %d", iValue);
385 goto fail;
386 }
387 if (!freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate))
388 {
389 printf("FreeRDP_DynamicResolutionUpdate has invalid value");
390 goto fail;
391 }
392 iValue = freerdp_client_rdp_file_get_integer_option(file, "desktopscalefactor");
393 if (iValue != 1080)
394 {
395 printf("desktopscalefactor uses invalid default value %d", iValue);
396 goto fail;
397 }
398 if ((INT64)freerdp_settings_get_uint32(settings, FreeRDP_DesktopScaleFactor) != iValue)
399 {
400 printf("FreeRDP_DesktopScaleFactor has invalid value");
401 goto fail;
402 }
403
404 /* Check [MS-RDPECAM] related options */
405#if defined(CHANNEL_RDPECAM_CLIENT)
406 {
407 ADDIN_ARGV* args = NULL;
408 iValue =
409 freerdp_client_rdp_file_get_integer_option(file, "encode redirected video capture");
410 if (iValue != 1)
411 {
412 printf("encode redirected video capture uses invalid default value %d", iValue);
413 goto fail;
414 }
415 iValue = freerdp_client_rdp_file_get_integer_option(
416 file, "redirected video capture encoding quality");
417 if (iValue != 2)
418 {
419 printf("redirected video capture encoding quality uses invalid default value %d",
420 iValue);
421 goto fail;
422 }
423 args = freerdp_dynamic_channel_collection_find(settings, RDPECAM_DVC_CHANNEL_NAME);
424 if (!args)
425 {
426 printf("rdpecam channel was not loaded");
427 goto fail;
428 }
429 if (args->argc != 6)
430 {
431 printf("rdpecam channel was not loaded");
432 goto fail;
433 }
434
435 for (int x = 0; x < args->argc; x++)
436 {
437 if (strcmp(args->argv[x], camera_args[x]) != 0)
438 {
439 printf("rdpecam invalid argument argv[%d]: %s", x, args->argv[x]);
440 goto fail;
441 }
442 }
443 }
444#endif
445
446 /* Check [URBDRC] related options */
447#if defined(CHANNEL_URBDRC_CLIENT)
448 {
449 ADDIN_ARGV* args = freerdp_dynamic_channel_collection_find(settings, "urbdrc");
450 if (!args)
451 {
452 printf("urbdrc channel was not loaded");
453 goto fail;
454 }
455 if (args->argc != 4)
456 {
457 printf("urbdrc channel was not loaded");
458 goto fail;
459 }
460
461 for (int x = 0; x < args->argc; x++)
462 {
463 if (strcmp(args->argv[x], urbdrc_args[x]) != 0)
464 {
465 printf("urbdrc invalid argument argv[%d]: %s", x, args->argv[x]);
466 goto fail;
467 }
468 }
469 }
470#endif
471
472 /* Validate selectedmonitors:s:3,2,42,23 */
473 uValue = freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds);
474 if (uValue != 4)
475 {
476 printf("FreeRDP_NumMonitorIds has invalid value %" PRIu32, uValue);
477 goto fail;
478 }
479 puValue = (const UINT32*)freerdp_settings_get_pointer_array(settings, FreeRDP_MonitorIds, 0);
480 if (!puValue)
481 {
482 printf("FreeRDP_MonitorIds has invalid value %p", (const void*)puValue);
483 goto fail;
484 }
485 if ((puValue[0] != 3) || (puValue[1] != 2) || (puValue[2] != 42) || (puValue[3] != 23))
486 {
487 printf("FreeRDP_MonitorIds has invalid values: [%" PRIu32 ",%" PRIu32 ",%" PRIu32
488 ",%" PRIu32 "]",
489 puValue[0], puValue[1], puValue[2], puValue[3]);
490 goto fail;
491 }
492
493 iValue = freerdp_client_rdp_file_get_integer_option(file, "videoplaybackmode");
494 if (iValue != 2)
495 {
496 printf("videoplaybackmode uses invalid default value %d", iValue);
497 goto fail;
498 }
499 if (!freerdp_settings_get_bool(settings, FreeRDP_SupportVideoOptimized))
500 {
501 printf("FreeRDP_SupportVideoOptimized has invalid value");
502 goto fail;
503 }
504 if (!freerdp_settings_get_bool(settings, FreeRDP_SupportGeometryTracking))
505 {
506 printf("FreeRDP_SupportGeometryTracking has invalid value");
507 goto fail;
508 }
509
510 iValue = freerdp_client_rdp_file_get_integer_option(file, "vendor integer");
511 if (iValue != 123)
512 goto fail;
513
514 if (freerdp_client_rdp_file_set_integer_option(file, "vendor integer", 456) == -1)
515 {
516 printf("failed to set integer: vendor integer");
517 goto fail;
518 }
519
520 iValue = freerdp_client_rdp_file_get_integer_option(file, "vendor integer");
521 if (iValue != 456)
522 return -1;
523
524 const char microsoft[] = "microsoft";
525 sValue = freerdp_client_rdp_file_get_string_option(file, "vendor string");
526 if (strncmp(sValue, microsoft, sizeof(microsoft)) != 0)
527 goto fail;
528
529 const char apple[] = "apple";
530 freerdp_client_rdp_file_set_string_option(file, "vendor string", "apple");
531 sValue = freerdp_client_rdp_file_get_string_option(file, "vendor string");
532 if (strncmp(sValue, apple, sizeof(apple)) != 0)
533 goto fail;
534
535 freerdp_client_rdp_file_set_string_option(file, "fruits", "banana,oranges");
536
537 if (freerdp_client_rdp_file_set_integer_option(file, "numbers", 123456789) == -1)
538 {
539 printf("failed to set integer: numbers");
540 return -1;
541 }
542
543 freerdp_client_rdp_file_free(file);
544
545 tmp = GetKnownPath(KNOWN_PATH_TEMP);
546 if (!tmp)
547 goto fail;
548
549 base = append("%s/rdp-file-test-%" PRIx64, tmp, id);
550 if (!base)
551 goto fail;
552 if (!CreateDirectoryA(base, NULL))
553 goto fail;
554 utfname = append("%s/utfname", base);
555 uniname = append("%s/uniname", base);
556 file = freerdp_client_rdp_file_new();
557 if (!file || !utfname || !uniname)
558 goto fail;
559
560 if (!freerdp_client_populate_rdp_file_from_settings(file, settings))
561 goto fail;
562
563 if (!freerdp_client_write_rdp_file(file, utfname, FALSE))
564 goto fail;
565
566 if (!freerdp_client_write_rdp_file(file, uniname, TRUE))
567 goto fail;
568
569 rc = 0;
570fail:
571 if (utfname)
572 winpr_DeleteFile(utfname);
573 if (uniname)
574 winpr_DeleteFile(uniname);
575 if (base)
576 winpr_RemoveDirectory(base);
577 free(utfname);
578 free(uniname);
579 free(base);
580 free(tmp);
581 freerdp_client_rdp_file_free(file);
582 freerdp_settings_free(settings);
583 return rc;
584}
FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id)
Returns a UINT32 settings value.
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.
FREERDP_API rdpSettings * freerdp_settings_new(DWORD flags)
creates a new setting struct
FREERDP_API void freerdp_settings_free(rdpSettings *settings)
Free a settings struct with all data in it.
FREERDP_API const char * freerdp_settings_get_string(const rdpSettings *settings, FreeRDP_Settings_Keys_String id)
Returns a immutable string settings value.