5 |
#include <time.h> |
#include <time.h> |
6 |
#include "rdesktop.h" |
#include "rdesktop.h" |
7 |
|
|
|
#define IRP_MJ_CREATE 0x00 |
|
|
#define IRP_MJ_CLOSE 0x02 |
|
|
#define IRP_MJ_READ 0x03 |
|
|
#define IRP_MJ_WRITE 0x04 |
|
|
#define IRP_MJ_DEVICE_CONTROL 0x0e |
|
|
|
|
8 |
#define IRP_MJ_CREATE 0x00 |
#define IRP_MJ_CREATE 0x00 |
9 |
#define IRP_MJ_CLOSE 0x02 |
#define IRP_MJ_CLOSE 0x02 |
10 |
#define IRP_MJ_READ 0x03 |
#define IRP_MJ_READ 0x03 |
14 |
#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a |
#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a |
15 |
#define IRP_MJ_DIRECTORY_CONTROL 0x0c |
#define IRP_MJ_DIRECTORY_CONTROL 0x0c |
16 |
#define IRP_MJ_DEVICE_CONTROL 0x0e |
#define IRP_MJ_DEVICE_CONTROL 0x0e |
17 |
|
#define IRP_MJ_LOCK_CONTROL 0x11 |
18 |
|
|
19 |
#define IRP_MN_QUERY_DIRECTORY 0x01 |
#define IRP_MN_QUERY_DIRECTORY 0x01 |
20 |
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 |
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02 |
34 |
|
|
35 |
/* Table with information about rdpdr devices */ |
/* Table with information about rdpdr devices */ |
36 |
RDPDR_DEVICE g_rdpdr_device[RDPDR_MAX_DEVICES]; |
RDPDR_DEVICE g_rdpdr_device[RDPDR_MAX_DEVICES]; |
37 |
|
char * g_rdpdr_clientname = NULL; |
38 |
|
|
39 |
/* Used to store incoming io request, until they are ready to be completed */ |
/* Used to store incoming io request, until they are ready to be completed */ |
40 |
/* using a linked list ensures that they are processed in the right order, */ |
/* using a linked list ensures that they are processed in the right order, */ |
164 |
rdpdr_send_name(void) |
rdpdr_send_name(void) |
165 |
{ |
{ |
166 |
uint8 magic[4] = "rDNC"; |
uint8 magic[4] = "rDNC"; |
|
uint32 hostlen = (strlen(hostname) + 1) * 2; |
|
167 |
STREAM s; |
STREAM s; |
168 |
|
uint32 hostlen; |
169 |
|
|
170 |
|
if (NULL == g_rdpdr_clientname) { |
171 |
|
g_rdpdr_clientname = hostname; |
172 |
|
} |
173 |
|
hostlen = (strlen(g_rdpdr_clientname) + 1) * 2; |
174 |
|
|
175 |
s = channel_init(rdpdr_channel, 16 + hostlen); |
s = channel_init(rdpdr_channel, 16 + hostlen); |
176 |
out_uint8a(s, magic, 4); |
out_uint8a(s, magic, 4); |
178 |
out_uint16_le(s, 0x72); |
out_uint16_le(s, 0x72); |
179 |
out_uint32(s, 0); |
out_uint32(s, 0); |
180 |
out_uint32_le(s, hostlen); |
out_uint32_le(s, hostlen); |
181 |
rdp_out_unistr(s, hostname, hostlen - 2); |
rdp_out_unistr(s, g_rdpdr_clientname, hostlen - 2); |
182 |
s_mark_end(s); |
s_mark_end(s); |
183 |
channel_send(s, rdpdr_channel); |
channel_send(s, rdpdr_channel); |
184 |
} |
} |