60 |
extern DEVICE_FNS printer_fns; |
extern DEVICE_FNS printer_fns; |
61 |
extern DEVICE_FNS parallel_fns; |
extern DEVICE_FNS parallel_fns; |
62 |
extern DEVICE_FNS disk_fns; |
extern DEVICE_FNS disk_fns; |
63 |
|
#ifdef WITH_SCARD |
64 |
|
extern DEVICE_FNS scard_fns; |
65 |
|
#endif |
66 |
extern FILEINFO g_fileinfo[]; |
extern FILEINFO g_fileinfo[]; |
67 |
extern BOOL g_notify_stamp; |
extern BOOL g_notify_stamp; |
68 |
|
|
69 |
|
#ifdef WITH_SCARD |
70 |
|
VCHANNEL *rdpdr_channel; |
71 |
|
#else |
72 |
static VCHANNEL *rdpdr_channel; |
static VCHANNEL *rdpdr_channel; |
73 |
|
#endif |
74 |
|
|
75 |
/* 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 */ |
76 |
NTHANDLE g_min_timeout_fd; |
NTHANDLE g_min_timeout_fd; |
316 |
channel_send(s, rdpdr_channel); |
channel_send(s, rdpdr_channel); |
317 |
} |
} |
318 |
|
|
319 |
static void |
void |
320 |
rdpdr_send_completion(uint32 device, uint32 id, uint32 status, uint32 result, uint8 * buffer, |
rdpdr_send_completion(uint32 device, uint32 id, uint32 status, uint32 result, uint8 * buffer, |
321 |
uint32 length) |
uint32 length) |
322 |
{ |
{ |
359 |
error_mode, |
error_mode, |
360 |
share_mode, disposition, total_timeout, interval_timeout, flags_and_attributes = 0; |
share_mode, disposition, total_timeout, interval_timeout, flags_and_attributes = 0; |
361 |
|
|
362 |
char filename[256]; |
char filename[PATH_MAX]; |
363 |
uint8 *buffer, *pst_buf; |
uint8 *buffer, *pst_buf; |
364 |
struct stream out; |
struct stream out; |
365 |
DEVICE_FNS *fns; |
DEVICE_FNS *fns; |
402 |
break; |
break; |
403 |
|
|
404 |
case DEVICE_TYPE_SCARD: |
case DEVICE_TYPE_SCARD: |
405 |
|
#ifdef WITH_SCARD |
406 |
|
fns = &scard_fns; |
407 |
|
rw_blocking = False; |
408 |
|
break; |
409 |
|
#endif |
410 |
default: |
default: |
411 |
|
|
412 |
error("IRP for bad device %ld\n", device); |
error("IRP for bad device %ld\n", device); |
683 |
|
|
684 |
out.data = out.p = buffer; |
out.data = out.p = buffer; |
685 |
out.size = sizeof(buffer); |
out.size = sizeof(buffer); |
686 |
|
|
687 |
|
DEBUG_SCARD(("[SMART-CARD TRACE]\n")); |
688 |
|
DEBUG_SCARD(("device 0x%.8x\n", device)); |
689 |
|
DEBUG_SCARD(("file 0x%.8x\n", file)); |
690 |
|
DEBUG_SCARD(("id 0x%.8x\n", id)); |
691 |
|
#ifdef WITH_SCARD |
692 |
|
scardSetInfo(device, id, bytes_out + 0x14); |
693 |
|
#endif |
694 |
status = fns->device_control(file, request, s, &out); |
status = fns->device_control(file, request, s, &out); |
695 |
result = buffer_len = out.p - out.data; |
result = buffer_len = out.p - out.data; |
696 |
|
|
697 |
|
DEBUG_SCARD(("[SMART-CARD TRACE] OUT 0x%.8x\n", status)); |
698 |
|
|
699 |
/* Serial SERIAL_WAIT_ON_MASK */ |
/* Serial SERIAL_WAIT_ON_MASK */ |
700 |
if (status == STATUS_PENDING) |
if (status == STATUS_PENDING) |
701 |
{ |
{ |
706 |
break; |
break; |
707 |
} |
} |
708 |
} |
} |
709 |
|
#ifdef WITH_SCARD |
710 |
|
else if (status == (STATUS_PENDING | 0xC0000000)) |
711 |
|
status = STATUS_PENDING; |
712 |
|
#endif |
713 |
break; |
break; |
714 |
|
|
715 |
|
|
955 |
} |
} |
956 |
|
|
957 |
/* Check if select() returned with one of the rdpdr file descriptors, and complete io if it did */ |
/* Check if select() returned with one of the rdpdr file descriptors, and complete io if it did */ |
958 |
void |
static void |
959 |
_rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out) |
_rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out) |
960 |
{ |
{ |
961 |
NTSTATUS status; |
NTSTATUS status; |