本文整理汇总了C++中IRP类的典型用法代码示例。如果您正苦于以下问题:C++ IRP类的具体用法?C++ IRP怎么用?C++ IRP使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IRP类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: smartcard_free
static void smartcard_free(DEVICE* dev)
{
IRP* irp;
COMPLETIONIDINFO* CompletionIdInfo;
SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) dev;
SetEvent(smartcard->stopEvent);
WaitForSingleObject(smartcard->thread, INFINITE);
while ((irp = (IRP*) InterlockedPopEntrySList(smartcard->pIrpList)) != NULL)
irp->Discard(irp);
_aligned_free(smartcard->pIrpList);
/* Begin TS Client defect workaround. */
while ((CompletionIdInfo = (COMPLETIONIDINFO*) list_dequeue(smartcard->CompletionIds)) != NULL)
free(CompletionIdInfo);
CloseHandle(smartcard->thread);
CloseHandle(smartcard->irpEvent);
CloseHandle(smartcard->stopEvent);
CloseHandle(smartcard->CompletionIdsMutex);
Stream_Free(smartcard->device.data, TRUE);
list_free(smartcard->CompletionIds);
/* End TS Client defect workaround. */
free(dev);
}
示例2: __serial_check_fds
static void __serial_check_fds(SERIAL_DEVICE* serial)
{
IRP* irp;
IRP* prev;
SERIAL_TTY* tty;
uint32 result = 0;
memset(&serial->tv, 0, sizeof(struct timeval));
tty = serial->tty;
/* scan every pending */
irp = list_peek(serial->pending_irps);
while (irp)
{
DEBUG_SVC("MajorFunction %u", irp->MajorFunction);
switch (irp->MajorFunction)
{
case IRP_MJ_READ:
if (FD_ISSET(tty->fd, &serial->read_fds))
{
irp->IoStatus = STATUS_SUCCESS;
serial_process_irp_read(serial, irp);
}
break;
case IRP_MJ_WRITE:
if (FD_ISSET(tty->fd, &serial->write_fds))
{
irp->IoStatus = STATUS_SUCCESS;
serial_process_irp_write(serial, irp);
}
break;
case IRP_MJ_DEVICE_CONTROL:
if (serial_tty_get_event(tty, &result))
{
DEBUG_SVC("got event result %u", result);
irp->IoStatus = STATUS_SUCCESS;
stream_write_uint32(irp->output, result);
irp->Complete(irp);
}
break;
default:
DEBUG_SVC("no request found");
break;
}
prev = irp;
irp = (IRP*)list_next(serial->pending_irps, irp);
if (prev->IoStatus == STATUS_SUCCESS)
{
list_remove(serial->pending_irps, prev);
wait_obj_set(serial->in_event);
}
}
}
示例3: parallel_free
static void parallel_free(DEVICE* device)
{
IRP* irp;
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) device;
DEBUG_SVC("freeing device");
freerdp_thread_stop(parallel->thread);
freerdp_thread_free(parallel->thread);
while ((irp = (IRP*) InterlockedPopEntrySList(parallel->pIrpList)) != NULL)
irp->Discard(irp);
_aligned_free(parallel->pIrpList);
free(parallel);
}
示例4: parallel_free
static void parallel_free(DEVICE* device)
{
IRP* irp;
PARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*) device;
DEBUG_SVC("freeing device");
freerdp_thread_stop(parallel->thread);
freerdp_thread_free(parallel->thread);
while ((irp = (IRP*) list_dequeue(parallel->irp_list)) != NULL)
irp->Discard(irp);
list_free(parallel->irp_list);
xfree(parallel);
}
示例5: printer_free
static void printer_free(DEVICE* device) {
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) device;
IRP* irp;
freerdp_thread_stop(printer_dev->thread);
freerdp_thread_free(printer_dev->thread);
while ((irp = (IRP*) list_dequeue(printer_dev->irp_list)) != NULL)
irp->Discard(irp);
list_free(printer_dev->irp_list);
if (printer_dev->printer)
printer_dev->printer->Free(printer_dev->printer);
xfree(printer_dev->device.name);
xfree(printer_dev);
}
示例6: printer_free
static void printer_free(DEVICE* device)
{
IRP* irp;
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) device;
freerdp_thread_stop(printer_dev->thread);
freerdp_thread_free(printer_dev->thread);
while ((irp = (IRP*) InterlockedPopEntrySList(printer_dev->pIrpList)) != NULL)
irp->Discard(irp);
_aligned_free(printer_dev->pIrpList);
if (printer_dev->printer)
printer_dev->printer->Free(printer_dev->printer);
free(printer_dev->device.name);
free(printer_dev);
}
示例7: serial_free
static void serial_free(DEVICE* device)
{
SERIAL_DEVICE* serial = (SERIAL_DEVICE*)device;
IRP* irp;
DEBUG_SVC("freeing device");
freerdp_thread_stop(serial->thread);
freerdp_thread_free(serial->thread);
while ((irp = (IRP*)list_dequeue(serial->irp_list)) != NULL)
irp->Discard(irp);
list_free(serial->irp_list);
while ((irp = (IRP*)list_dequeue(serial->pending_irps)) != NULL)
irp->Discard(irp);
list_free(serial->pending_irps);
xfree(serial);
}
示例8: drive_free
static void drive_free(DEVICE* device)
{
IRP* irp;
DRIVE_FILE* file;
DRIVE_DEVICE* disk = (DRIVE_DEVICE*) device;
SetEvent(disk->stopEvent);
CloseHandle(disk->thread);
CloseHandle(disk->irpEvent);
while ((irp = (IRP*) InterlockedPopEntrySList(disk->pIrpList)) != NULL)
irp->Discard(irp);
_aligned_free(disk->pIrpList);
while ((file = (DRIVE_FILE*) list_dequeue(disk->files)) != NULL)
drive_file_free(file);
list_free(disk->files);
free(disk);
}
示例9: scard_free
static void
scard_free(DEVICE* dev)
{
SCARD_DEVICE* scard = (SCARD_DEVICE*)dev;
IRP* irp;
COMPLETIONIDINFO* CompletionIdInfo;
freerdp_thread_stop(scard->thread);
freerdp_thread_free(scard->thread);
while ((irp = (IRP*)list_dequeue(scard->irp_list)) != NULL)
irp->Discard(irp);
list_free(scard->irp_list);
/* Begin TS Client defect workaround. */
while ((CompletionIdInfo = (COMPLETIONIDINFO*)list_dequeue(scard->CompletionIds)) != NULL)
xfree(CompletionIdInfo);
list_free(scard->CompletionIds);
/* End TS Client defect workaround. */
xfree(dev);
return;
}
示例10: main
int main(int argc, char** argv)
{
if (argc<2)
{
usage:
printf("Usage MakeHex IrpFile {OutFile}\n");
return -1;
}
IRP Irp;
char* arg1=*(++argv);
if (arg1[0]=='-' && arg1[2]==0)
{
char s = toupper(arg1[1]);
if (s=='H')
Irp.m_numberFormat = 1;
else if (s=='B')
Irp.m_numberFormat = 2;
else
goto usage;
arg1 = *(++argv);
if (--argc == 1)
goto usage;
}
if (argc>3)
goto usage;
FILE *InFile = fopen(arg1, "r");
if (!InFile)
{
printf("Unable to open \"%s\"\n", arg1);
return -1;
}
if (! Irp.readIrpFile(InFile) )
{
printf("IRP file \"%s\" not processed\n");
return -1;
}
char *OutName;
if (argc==3)
{
OutName = argv[1];
}
else
{
char *tmp = strrchr(arg1, '.');
if (!tmp)
{
tmp = arg1 + strlen(arg1);
}
int len = tmp - arg1;
OutName = new char [len+5];
memcpy(OutName, arg1, len);
strcpy(OutName+len, ".hex");
}
FILE *OutFile = fopen(OutName, "w");
if (!OutFile)
{
printf("Unable to create \"%s\"\n", OutName);
return -1;
}
Irp.writeHex(OutFile);
fclose(OutFile);
return 0;
}