static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) { char* path = NULL; int status; SERIAL_TTY* tty; UINT32 PathLength; UINT32 FileId; Stream_Seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */ /* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */ Stream_Read_UINT32(irp->input, PathLength); status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(irp->input), PathLength / 2, &path, 0, NULL, NULL); if (status < 1) path = (char*) calloc(1, 1); FileId = irp->devman->id_sequence++; tty = serial_tty_new(serial->path, FileId); if (tty == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; FileId = 0; DEBUG_WARN("failed to create %s", path); } else { serial->tty = tty; serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_NONE, STATUS_CANCELLED); serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_READ, STATUS_CANCELLED); serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_WRITE, STATUS_CANCELLED); serial->mthread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) serial_thread_mfunc, (void*) serial, 0, NULL); DEBUG_SVC("%s(%d) created.", serial->path, FileId); } Stream_Write_UINT32(irp->output, FileId); Stream_Write_UINT8(irp->output, 0); free(path); irp->Complete(irp); }
static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) { char* path = NULL; int status; SERIAL_TTY* tty; UINT32 PathLength; UINT32 FileId; stream_seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */ /* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */ stream_read_UINT32(irp->input, PathLength); status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(irp->input), PathLength / 2, &path, 0, NULL, NULL); if (status < 1) path = (char*) calloc(1, 1); FileId = irp->devman->id_sequence++; tty = serial_tty_new(serial->path, FileId); if (tty == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; FileId = 0; DEBUG_WARN("failed to create %s", path); } else { serial->tty = tty; DEBUG_SVC("%s(%d) created.", serial->path, FileId); } stream_write_UINT32(irp->output, FileId); stream_write_BYTE(irp->output, 0); free(path); irp->Complete(irp); }
static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) { SERIAL_TTY* tty; uint32 PathLength; uint32 FileId; char* path; UNICONV* uniconv; stream_seek(irp->input, 28); /* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */ /* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */ stream_read_uint32(irp->input, PathLength); uniconv = freerdp_uniconv_new(); path = freerdp_uniconv_in(uniconv, stream_get_tail(irp->input), PathLength); freerdp_uniconv_free(uniconv); FileId = irp->devman->id_sequence++; tty = serial_tty_new(serial->path, FileId); if (tty == NULL) { irp->IoStatus = STATUS_UNSUCCESSFUL; FileId = 0; DEBUG_WARN("failed to create %s", path); } else { serial->tty = tty; DEBUG_SVC("%s(%d) created.", serial->path, FileId); } stream_write_uint32(irp->output, FileId); stream_write_uint8(irp->output, 0); xfree(path); irp->Complete(irp); }