/[rdesktop]/sourceforge.net/trunk/rdesktop/rdpdr.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/rdpdr.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 673 by astrand, Mon Apr 19 08:24:54 2004 UTC revision 776 by jsorg71, Sat Oct 2 01:30:33 2004 UTC
# Line 38  Line 38 
38  #include <sys/time.h>  #include <sys/time.h>
39  #include <dirent.h>             /* opendir, closedir, readdir */  #include <dirent.h>             /* opendir, closedir, readdir */
40  #include <time.h>  #include <time.h>
41    #include <errno.h>
42  #include "rdesktop.h"  #include "rdesktop.h"
43    
44  #define IRP_MJ_CREATE                   0x00  #define IRP_MJ_CREATE                   0x00
# Line 54  Line 55 
55  #define IRP_MN_QUERY_DIRECTORY          0x01  #define IRP_MN_QUERY_DIRECTORY          0x01
56  #define IRP_MN_NOTIFY_CHANGE_DIRECTORY  0x02  #define IRP_MN_NOTIFY_CHANGE_DIRECTORY  0x02
57    
58  extern char hostname[16];  extern char g_hostname[16];
59  extern DEVICE_FNS serial_fns;  extern DEVICE_FNS serial_fns;
60  extern DEVICE_FNS printer_fns;  extern DEVICE_FNS printer_fns;
61  extern DEVICE_FNS parallel_fns;  extern DEVICE_FNS parallel_fns;
# Line 64  extern FILEINFO g_fileinfo[]; Line 65  extern FILEINFO g_fileinfo[];
65  static VCHANNEL *rdpdr_channel;  static VCHANNEL *rdpdr_channel;
66    
67  /* If select() times out, the request for the device with handle g_min_timeout_fd is aborted */  /* If select() times out, the request for the device with handle g_min_timeout_fd is aborted */
68  HANDLE g_min_timeout_fd;  NTHANDLE g_min_timeout_fd;
69  uint32 g_num_devices;  uint32 g_num_devices;
70    
71  /* Table with information about rdpdr devices */  /* Table with information about rdpdr devices */
# Line 89  struct async_iorequest *g_iorequest; Line 90  struct async_iorequest *g_iorequest;
90    
91  /* Return device_id for a given handle */  /* Return device_id for a given handle */
92  int  int
93  get_device_index(HANDLE handle)  get_device_index(NTHANDLE handle)
94  {  {
95          int i;          int i;
96          for (i = 0; i < RDPDR_MAX_DEVICES; i++)          for (i = 0; i < RDPDR_MAX_DEVICES; i++)
# Line 204  rdpdr_send_name(void) Line 205  rdpdr_send_name(void)
205    
206          if (NULL == g_rdpdr_clientname)          if (NULL == g_rdpdr_clientname)
207          {          {
208                  g_rdpdr_clientname = hostname;                  g_rdpdr_clientname = g_hostname;
209          }          }
210          hostlen = (strlen(g_rdpdr_clientname) + 1) * 2;          hostlen = (strlen(g_rdpdr_clientname) + 1) * 2;
211    
# Line 265  rdpdr_send_available(void) Line 266  rdpdr_send_available(void)
266          {          {
267                  out_uint32_le(s, g_rdpdr_device[i].device_type);                  out_uint32_le(s, g_rdpdr_device[i].device_type);
268                  out_uint32_le(s, i);    /* RDP Device ID */                  out_uint32_le(s, i);    /* RDP Device ID */
269                    /* Is it possible to use share names longer than 8 chars?
270                       /astrand */
271                  out_uint8p(s, g_rdpdr_device[i].name, 8);                  out_uint8p(s, g_rdpdr_device[i].name, 8);
272    
273                  switch (g_rdpdr_device[i].device_type)                  switch (g_rdpdr_device[i].device_type)
# Line 824  rdpdr_add_fds(int *n, fd_set * rfds, fd_ Line 827  rdpdr_add_fds(int *n, fd_set * rfds, fd_
827                                             reconnecting. FIXME: Real                                             reconnecting. FIXME: Real
828                                             support for reconnects. */                                             support for reconnects. */
829    
830                                          if (read(iorq->fd, &c, 0) != 0)                                          if ((read(iorq->fd, &c, 0) != 0) && (errno == EBADF))
831                                                  break;                                                  break;
832    
833                                          FD_SET(iorq->fd, rfds);                                          FD_SET(iorq->fd, rfds);
# Line 847  rdpdr_add_fds(int *n, fd_set * rfds, fd_ Line 850  rdpdr_add_fds(int *n, fd_set * rfds, fd_
850    
851                                  case IRP_MJ_WRITE:                                  case IRP_MJ_WRITE:
852                                          /* FD still valid? See above. */                                          /* FD still valid? See above. */
853                                          if (write(iorq->fd, &c, 0) != 0)                                          if ((write(iorq->fd, &c, 0) != 0) && (errno == EBADF))
854                                                  break;                                                  break;
855    
856                                          FD_SET(iorq->fd, wfds);                                          FD_SET(iorq->fd, wfds);
# Line 937  rdpdr_check_fds(fd_set * rfds, fd_set * Line 940  rdpdr_check_fds(fd_set * rfds, fd_set *
940                                                  /* only delete link if all data has been transfered */                                                  /* only delete link if all data has been transfered */
941                                                  /* or if result was 0 and status success - EOF      */                                                  /* or if result was 0 and status success - EOF      */
942                                                  if ((iorq->partial_len == iorq->length) ||                                                  if ((iorq->partial_len == iorq->length) ||
943                                                      (result == 0))                                                      (g_rdpdr_device[iorq->device].device_type ==
944                                                         DEVICE_TYPE_SERIAL) || (result == 0))
945                                                  {                                                  {
946  #if WITH_DEBUG_RDP5  #if WITH_DEBUG_RDP5
947                                                          DEBUG(("RDPDR: AIO total %u bytes read of %u\n", iorq->partial_len, iorq->length));                                                          DEBUG(("RDPDR: AIO total %u bytes read of %u\n", iorq->partial_len, iorq->length));

Legend:
Removed from v.673  
changed lines
  Added in v.776

  ViewVC Help
Powered by ViewVC 1.1.26