-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathWinMain.cpp
46 lines (36 loc) · 884 Bytes
/
WinMain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <windows.h>
#include "ClassSecInfoTS.h"
#define _SafeCOMRelease(x) { if (NULL != x) { x->Release(); x = NULL; } }
HANDLE g_hHeap;
int
CALLBACK
WinMain (
_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nShowCmd
)
{
BOOL bResult;
HRESULT hResult;
CSecInfoTS *pSecInfo = NULL;
hResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (FAILED(hResult))
return EXIT_FAILURE;
g_hHeap = HeapCreate(
0, // flOptions
0, // dwInitialSize
0 // dwMaximumSize
);
if (g_hHeap == NULL)
return EXIT_FAILURE;
pSecInfo = new CSecInfoTS(TEXT("RDP-Tcp"));
if (pSecInfo != NULL)
{
bResult = EditSecurity(NULL, pSecInfo);
_SafeCOMRelease(pSecInfo);
}
HeapDestroy(g_hHeap);
CoUninitialize();
return EXIT_SUCCESS;
}