Exemplo n.º 1
0
/**
 * Function description
 *
 * @return 0 on success, otherwise a Win32 error code
 */
static UINT printer_process_irp(PRINTER_DEVICE* printer_dev, IRP* irp)
{
	UINT error;

	switch (irp->MajorFunction)
	{
		case IRP_MJ_CREATE:
			if ((error = printer_process_irp_create(printer_dev, irp)))
			{
				WLog_ERR(TAG, "printer_process_irp_create failed with error %lu!", error);
				return error;
			}

			break;

		case IRP_MJ_CLOSE:
			if ((error = printer_process_irp_close(printer_dev, irp)))
			{
				WLog_ERR(TAG, "printer_process_irp_close failed with error %lu!", error);
				return error;
			}

			break;

		case IRP_MJ_WRITE:
			if ((error = printer_process_irp_write(printer_dev, irp)))
			{
				WLog_ERR(TAG, "printer_process_irp_write failed with error %lu!", error);
				return error;
			}

			break;

		case IRP_MJ_DEVICE_CONTROL:
			if ((error = printer_process_irp_device_control(printer_dev, irp)))
			{
				WLog_ERR(TAG, "printer_process_irp_device_control failed with error %lu!",
				         error);
				return error;
			}

			break;

		default:
			irp->IoStatus = STATUS_NOT_SUPPORTED;
			return irp->Complete(irp);
			break;
	}

	return CHANNEL_RC_OK;
}
Exemplo n.º 2
0
static void printer_process_irp(PRINTER_DEVICE* printer_dev, IRP* irp) {
	switch (irp->MajorFunction) {
	case IRP_MJ_CREATE:
		printer_process_irp_create(printer_dev, irp);
		break;

	case IRP_MJ_CLOSE:
		printer_process_irp_close(printer_dev, irp);
		break;

	case IRP_MJ_WRITE:
		printer_process_irp_write(printer_dev, irp);
		break;

	default:
		log_warning("MajorFunction 0x%X not supported", irp->MajorFunction);
		irp->IoStatus = STATUS_NOT_SUPPORTED;
		irp->Complete(irp);
		break;
	}
}