220 |
rdp_out_unistr(s, printerinfo->printer, printerlen - 2); |
rdp_out_unistr(s, printerinfo->printer, printerlen - 2); |
221 |
out_uint8a(s, printerinfo->blob, bloblen); |
out_uint8a(s, printerinfo->blob, bloblen); |
222 |
|
|
223 |
xfree(printerinfo->blob); /* Blob is sent twice if reconnecting */ |
if (printerinfo->blob) |
224 |
|
xfree(printerinfo->blob); /* Blob is sent twice if reconnecting */ |
225 |
break; |
break; |
226 |
default: |
default: |
227 |
out_uint32(s, 0); |
out_uint32(s, 0); |
318 |
case DEVICE_TYPE_DISK: |
case DEVICE_TYPE_DISK: |
319 |
|
|
320 |
fns = &disk_fns; |
fns = &disk_fns; |
321 |
/*rw_blocking = False; */ |
rw_blocking = False; |
322 |
break; |
break; |
323 |
|
|
324 |
case DEVICE_TYPE_SCARD: |
case DEVICE_TYPE_SCARD: |
737 |
DEVICE_FNS *fns; |
DEVICE_FNS *fns; |
738 |
struct async_iorequest *iorq; |
struct async_iorequest *iorq; |
739 |
struct async_iorequest *prev; |
struct async_iorequest *prev; |
740 |
|
uint32 req_size = 0; |
741 |
|
|
742 |
if (timed_out) |
if (timed_out) |
743 |
{ |
{ |
749 |
prev = NULL; |
prev = NULL; |
750 |
while (iorq != NULL) |
while (iorq != NULL) |
751 |
{ |
{ |
|
|
|
752 |
if (iorq->fd != 0) |
if (iorq->fd != 0) |
753 |
{ |
{ |
754 |
switch (iorq->major) |
switch (iorq->major) |
759 |
/* Read the data */ |
/* Read the data */ |
760 |
fns = iorq->fns; |
fns = iorq->fns; |
761 |
|
|
762 |
|
req_size = |
763 |
|
(iorq->length - iorq->partial_len) > |
764 |
|
8192 ? 8192 : (iorq->length - |
765 |
|
iorq->partial_len); |
766 |
/* never read larger chunks than 8k - chances are that it will block */ |
/* never read larger chunks than 8k - chances are that it will block */ |
767 |
status = fns->read(iorq->fd, |
status = fns->read(iorq->fd, |
768 |
iorq->buffer + iorq->partial_len, |
iorq->buffer + iorq->partial_len, |
769 |
(iorq->length - |
req_size, 0, &result); |
|
iorq->partial_len) > |
|
|
8192 ? 8192 : (iorq->length - |
|
|
iorq-> |
|
|
partial_len), 0, |
|
|
&result); |
|
770 |
iorq->partial_len += result; |
iorq->partial_len += result; |
771 |
|
|
772 |
#if WITH_DEBUG_RDP5 |
#if WITH_DEBUG_RDP5 |
773 |
DEBUG(("RDPDR: %d bytes of data read\n", result)); |
DEBUG(("RDPDR: %d bytes of data read\n", result)); |
774 |
#endif |
#endif |
775 |
/* only delete link if all data has been transfered */ |
/* only delete link if all data has been transfered */ |
776 |
if (iorq->partial_len == iorq->length) |
/* or if result was 0 and status success - EOF */ |
777 |
|
if ((iorq->partial_len == iorq->length) || |
778 |
|
(result == 0)) |
779 |
{ |
{ |
780 |
|
#if WITH_DEBUG_RDP5 |
781 |
|
DEBUG(("RDPDR: AIO total %u bytes read of %u\n", iorq->partial_len, iorq->length)); |
782 |
|
#endif |
783 |
/* send the data */ |
/* send the data */ |
784 |
status = STATUS_SUCCESS; |
status = STATUS_SUCCESS; |
785 |
rdpdr_send_completion(iorq->device, |
rdpdr_send_completion(iorq->device, |
786 |
iorq->id, status, |
iorq->id, status, |
787 |
iorq->length, |
iorq->partial_len, |
788 |
iorq->buffer, result); |
iorq->buffer, |
789 |
|
iorq->partial_len); |
790 |
xfree(iorq->buffer); |
xfree(iorq->buffer); |
791 |
iorq->fd = 0; |
iorq->fd = 0; |
792 |
if (prev != NULL) |
if (prev != NULL) |
809 |
/* Write data. */ |
/* Write data. */ |
810 |
fns = iorq->fns; |
fns = iorq->fns; |
811 |
|
|
812 |
|
req_size = |
813 |
|
(iorq->length - iorq->partial_len) > |
814 |
|
8192 ? 8192 : (iorq->length - |
815 |
|
iorq->partial_len); |
816 |
|
|
817 |
/* never write larger chunks than 8k - chances are that it will block */ |
/* never write larger chunks than 8k - chances are that it will block */ |
818 |
status = fns->write(iorq->fd, |
status = fns->write(iorq->fd, |
819 |
iorq->buffer + |
iorq->buffer + |
820 |
iorq->partial_len, |
iorq->partial_len, req_size, 0, |
|
(iorq->length - |
|
|
iorq->partial_len) > |
|
|
8192 ? 8192 : (iorq->length - |
|
|
iorq-> |
|
|
partial_len), 0, |
|
821 |
&result); |
&result); |
822 |
iorq->partial_len += result; |
iorq->partial_len += result; |
823 |
#if WITH_DEBUG_RDP5 |
#if WITH_DEBUG_RDP5 |
825 |
result)); |
result)); |
826 |
#endif |
#endif |
827 |
/* only delete link if all data has been transfered */ |
/* only delete link if all data has been transfered */ |
828 |
if (iorq->partial_len == iorq->length) |
/* or we couldn't write */ |
829 |
|
if ((iorq->partial_len == iorq->length) |
830 |
|
|| (result == 0)) |
831 |
{ |
{ |
832 |
|
#if WITH_DEBUG_RDP5 |
833 |
|
DEBUG(("RDPDR: AIO total %u bytes written of %u\n", iorq->partial_len, iorq->length)); |
834 |
|
#endif |
835 |
/* send a status success */ |
/* send a status success */ |
836 |
status = STATUS_SUCCESS; |
status = STATUS_SUCCESS; |
837 |
rdpdr_send_completion(iorq->device, |
rdpdr_send_completion(iorq->device, |
838 |
iorq->id, status, |
iorq->id, status, |
839 |
iorq->length, "", 1); |
iorq->partial_len, "", |
840 |
|
1); |
841 |
|
|
842 |
xfree(iorq->buffer); |
xfree(iorq->buffer); |
843 |
iorq->fd = 0; |
iorq->fd = 0; |