44#define IRP_MJ_CREATE 0x00
45#define IRP_MJ_CLOSE 0x02
46#define IRP_MJ_READ 0x03
47#define IRP_MJ_WRITE 0x04
48#define IRP_MJ_QUERY_INFORMATION 0x05
49#define IRP_MJ_SET_INFORMATION 0x06
50#define IRP_MJ_QUERY_VOLUME_INFORMATION 0x0a
51#define IRP_MJ_DIRECTORY_CONTROL 0x0c
52#define IRP_MJ_DEVICE_CONTROL 0x0e
53#define IRP_MJ_LOCK_CONTROL 0x11
55#define IRP_MN_QUERY_DIRECTORY 0x01
56#define IRP_MN_NOTIFY_CHANGE_DIRECTORY 0x02
91 switch (
This->rdpdr_device[
device].device_type)
114 struct async_iorequest *iorq;
118 This->iorequest = (
struct async_iorequest *)
xmalloc(
sizeof(
struct async_iorequest));
119 if (!
This->iorequest)
121 This->iorequest->fd = 0;
125 iorq =
This->iorequest;
127 while (iorq->fd != 0)
130 if (iorq->next ==
NULL)
133 (
struct async_iorequest *)
xmalloc(
sizeof(
struct async_iorequest));
137 iorq->next->next =
NULL;
146 iorq->partial_len = 0;
148 iorq->timeout = total_timeout;
149 iorq->itv_timeout = interval_timeout;
180 This->rdpdr_clientname =
This->hostname;
182 hostlen = (
strlen(
This->rdpdr_clientname) + 1) * 2;
205 for (
i = 0;
i <
This->num_devices;
i++)
209 printerinfo = (
PRINTER *)
This->rdpdr_device[
i].pdevice_data;
228 uint32 driverlen, printerlen, bloblen;
237 for (
i = 0;
i <
This->num_devices;
i++)
245 switch (
This->rdpdr_device[
i].device_type)
248 printerinfo = (
PRINTER *)
This->rdpdr_device[
i].pdevice_data;
252 bloblen = printerinfo->
bloblen;
264 if (printerinfo->
blob)
299#ifdef WITH_DEBUG_RDP5
300 printf(
"--> rdpdr_send_completion\n");
324 share_mode, disposition, total_timeout, interval_timeout, flags_and_attributes = 0;
343 switch (
This->rdpdr_device[
device].device_type)
507 (
This,
device,
file,
id,
major,
length, fns, 0, 0, pst_buf,
offset))
625 if (!fns->device_control)
652 (
This,
device,
file,
id,
major,
length, fns, 0, 0,
NULL, 0))
740 printf(
"--- rdpdr_process ---\n");
770 DEBUG((
"RDPDR: Server connected to resource %d\n",
handle));
794 if (
This->num_devices > 0)
796 This->rdpdr.channel =
802 return (
This->rdpdr.channel !=
NULL);
809 uint32 select_timeout = 0;
810 struct async_iorequest *iorq;
813 iorq =
This->iorequest;
827 *
n =
MAX(*
n, iorq->fd);
831 && (select_timeout == 0
832 || iorq->timeout < select_timeout))
835 select_timeout = iorq->timeout;
836 This->min_timeout_fd = iorq->fd;
837 tv->
tv_sec = select_timeout / 1000;
838 tv->
tv_usec = (select_timeout % 1000) * 1000;
842 if (iorq->itv_timeout && iorq->partial_len > 0
843 && (select_timeout == 0
844 || iorq->itv_timeout < select_timeout))
847 select_timeout = iorq->itv_timeout;
848 This->min_timeout_fd = iorq->fd;
849 tv->
tv_sec = select_timeout / 1000;
850 tv->
tv_usec = (select_timeout % 1000) * 1000;
862 *
n =
MAX(*
n, iorq->fd);
866 if (select_timeout > 5)
878struct async_iorequest *
888 prev->next = iorq->next;
895 This->iorequest = iorq->next;
909 struct async_iorequest *iorq;
910 struct async_iorequest *prev;
921 iorq =
This->iorequest;
925 if (iorq->fd ==
This->min_timeout_fd)
927 if ((iorq->partial_len > 0) &&
928 (
This->rdpdr_device[iorq->device].device_type ==
937 iorq->buffer, iorq->partial_len);
963 iorq =
This->iorequest;
978 (iorq->length - iorq->partial_len) >
979 8192 ? 8192 : (iorq->length -
983 iorq->buffer + iorq->partial_len,
984 req_size, iorq->offset, &
result);
988 iorq->partial_len +=
result;
996 if ((iorq->partial_len == iorq->length) ||
1000 DEBUG((
"RDPDR: AIO total %u bytes read of %u\n", iorq->partial_len, iorq->length));
1018 (iorq->length - iorq->partial_len) >
1019 8192 ? 8192 : (iorq->length -
1025 iorq->partial_len, req_size,
1030 iorq->partial_len +=
result;
1035 DEBUG((
"RDPDR: %d bytes of data written\n",
1040 if ((iorq->partial_len == iorq->length)
1044 DEBUG((
"RDPDR: AIO total %u bytes written of %u\n", iorq->partial_len, iorq->length));
1081 iorq =
This->iorequest;
1083 while (iorq !=
NULL)
1087 switch (iorq->major)
1091 if (
This->rdpdr_device[iorq->device].device_type ==
1095 if (
This->notify_stamp)
1147 struct async_iorequest *iorq;
1148 struct async_iorequest *prev;
1150 iorq =
This->iorequest;
1152 while (iorq !=
NULL)
1156 if ((iorq->fd ==
fd) && (
major == 0 || iorq->major ==
major))
ACPI_SIZE strlen(const char *String)
char * strchr(const char *String, int ch)
VCHANNEL * channel_register(char *name, uint32 flags, void(*callback)(STREAM))
STREAM channel_init(VCHANNEL *channel, uint32 length)
void channel_send(STREAM s, VCHANNEL *channel)
#define DEVICE_TYPE_SERIAL
#define DEVICE_TYPE_PRINTER
#define RDPDR_MAX_DEVICES
#define CHANNEL_OPTION_INITIALIZED
#define DEVICE_TYPE_SCARD
#define DEVICE_TYPE_PARALLEL
#define CHANNEL_OPTION_COMPRESS_RDP
#define out_uint32_le(s, v)
#define in_uint32_be(s, v)
#define out_uint32_be(s, v)
#define in_uint8p(s, v, n)
#define in_uint8a(s, v, n)
#define out_uint16_le(s, v)
#define out_uint8p(s, v, n)
#define in_uint32_le(s, v)
#define out_uint8a(s, v, n)
int printercache_load_blob(char *printer_name, uint8 **data)
RD_NTSTATUS disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
RD_BOOL serial_get_timeout(RD_NTHANDLE handle, uint32 length, uint32 *timeout, uint32 *itv_timeout)
void printercache_process(STREAM s)
RD_NTSTATUS disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
RD_NTSTATUS disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREAM out)
void rdp_in_unistr(STREAM s, int in_len, char **string, uint32 *str_size)
void unimpl(char *format,...)
void hexdump(unsigned char *p, unsigned int len)
void rdp_out_unistr(STREAM s, char *string, int len)
RD_NTSTATUS disk_check_notify(RD_NTHANDLE handle)
RD_NTSTATUS disk_create_notify(RD_NTHANDLE handle, uint32 info_class)
void * xrealloc(void *oldmem, size_t size)
RD_NTSTATUS disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out)
RD_BOOL serial_get_event(RD_NTHANDLE handle, uint32 *result)
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define STATUS_INVALID_HANDLE
#define STATUS_NOT_SUPPORTED
#define IRP_MJ_DIRECTORY_CONTROL
BOOL rdpdr_abort_io(RDPCLIENT *This, uint32 fd, uint32 major, NTSTATUS status)
void convert_to_unix_filename(char *filename)
#define IRP_MN_QUERY_DIRECTORY
static void rdpdr_send_connect(RDPCLIENT *This)
static BOOL rdpdr_handle_ok(RDPCLIENT *This, int device, int handle)
static void rdpdr_send_available(RDPCLIENT *This)
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY
static BOOL add_async_iorequest(RDPCLIENT *This, uint32 device, uint32 file, uint32 id, uint32 major, uint32 length, DEVICE_FNS *fns, uint32 total_timeout, uint32 interval_timeout, uint8 *buffer, uint32 offset)
static void rdpdr_send_completion(RDPCLIENT *This, uint32 device, uint32 id, uint32 status, uint32 result, uint8 *buffer, uint32 length)
int get_device_index(RDPCLIENT *This, NTHANDLE handle)
#define IRP_MJ_DEVICE_CONTROL
#define IRP_MJ_QUERY_VOLUME_INFORMATION
#define IRP_MJ_LOCK_CONTROL
void rdpdr_check_fds(RDPCLIENT *This, fd_set *rfds, fd_set *wfds, BOOL timed_out)
static void rdpdr_send_clientcapabilty(RDPCLIENT *This)
static int announcedata_size(RDPCLIENT *This)
static void rdpdr_process(RDPCLIENT *This, STREAM s)
void rdpdr_add_fds(RDPCLIENT *This, int *n, fd_set *rfds, fd_set *wfds, struct timeval *tv, BOOL *timeout)
struct async_iorequest * rdpdr_remove_iorequest(RDPCLIENT *This, struct async_iorequest *prev, struct async_iorequest *iorq)
#define IRP_MJ_SET_INFORMATION
static void rdpdr_send_name(RDPCLIENT *This)
static void rdpdr_process_irp(RDPCLIENT *This, STREAM s)
static void _rdpdr_check_fds(RDPCLIENT *This, fd_set *rfds, fd_set *wfds, BOOL timed_out)
#define IRP_MJ_QUERY_INFORMATION
RD_NTSTATUS(* read)(RD_NTHANDLE handle, uint8 *data, uint32 length, uint32 offset, uint32 *result)
RD_NTSTATUS(* write)(RD_NTHANDLE handle, uint8 *data, uint32 length, uint32 offset, uint32 *result)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_PARAMETER
#define FD_ISSET(fd, set)