52 |
|
|
53 |
static HANDLE g_mutex = NULL; |
static HANDLE g_mutex = NULL; |
54 |
static HANDLE g_vchannel = NULL; |
static HANDLE g_vchannel = NULL; |
55 |
|
static unsigned int g_opencount = 0; |
56 |
|
|
57 |
DLL_EXPORT void |
DLL_EXPORT void |
58 |
debug(char *format, ...) |
debug(char *format, ...) |
120 |
DLL_EXPORT int |
DLL_EXPORT int |
121 |
vchannel_open() |
vchannel_open() |
122 |
{ |
{ |
123 |
|
g_opencount++; |
124 |
|
if (g_opencount > 1) |
125 |
|
return 0; |
126 |
|
|
127 |
g_vchannel = WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE, |
g_vchannel = WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE, |
128 |
WTS_CURRENT_SESSION, CHANNELNAME); |
WTS_CURRENT_SESSION, CHANNELNAME); |
129 |
|
|
144 |
DLL_EXPORT void |
DLL_EXPORT void |
145 |
vchannel_close() |
vchannel_close() |
146 |
{ |
{ |
147 |
|
g_opencount--; |
148 |
|
if (g_opencount > 0) |
149 |
|
return; |
150 |
|
|
151 |
if (g_mutex) |
if (g_mutex) |
152 |
CloseHandle(g_mutex); |
CloseHandle(g_mutex); |
153 |
|
|