Пример #1
0
IRP* irp_new(DEVMAN* devman, wStream* s)
{
	IRP* irp;
	DEVICE* device;
	UINT32 DeviceId;

	Stream_Read_UINT32(s, DeviceId); /* DeviceId (4 bytes) */
	device = devman_get_device_by_id(devman, DeviceId);

	if (!device)
		return NULL;

	irp = (IRP*) _aligned_malloc(sizeof(IRP), MEMORY_ALLOCATION_ALIGNMENT);

	if (!irp)
		return NULL;

	ZeroMemory(irp, sizeof(IRP));

	irp->input = s;
	irp->device = device;
	irp->devman = devman;

	Stream_Read_UINT32(s, irp->FileId); /* FileId (4 bytes) */
	Stream_Read_UINT32(s, irp->CompletionId); /* CompletionId (4 bytes) */
	Stream_Read_UINT32(s, irp->MajorFunction); /* MajorFunction (4 bytes) */
	Stream_Read_UINT32(s, irp->MinorFunction); /* MinorFunction (4 bytes) */

	irp->output = Stream_New(NULL, 256);
	Stream_Write_UINT16(irp->output, RDPDR_CTYP_CORE); /* Component (2 bytes) */
	Stream_Write_UINT16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION); /* PacketId (2 bytes) */
	Stream_Write_UINT32(irp->output, DeviceId); /* DeviceId (4 bytes) */
	Stream_Write_UINT32(irp->output, irp->CompletionId); /* CompletionId (4 bytes) */
	Stream_Write_UINT32(irp->output, 0); /* IoStatus (4 bytes) */

	irp->Complete = irp_complete;
	irp->Discard = irp_free;

	irp->thread = NULL;
	irp->cancelled = FALSE;

	return irp;
}
Пример #2
0
IRP* irp_new(DEVMAN* devman, STREAM* data_in)
{
	IRP* irp;
	UINT32 DeviceId;
	DEVICE* device;

	stream_read_UINT32(data_in, DeviceId);
	device = devman_get_device_by_id(devman, DeviceId);

	if (device == NULL)
	{
		DEBUG_WARN("unknown DeviceId %d", DeviceId);
		return NULL;
	}

	irp = (IRP*) _aligned_malloc(sizeof(IRP), MEMORY_ALLOCATION_ALIGNMENT);
	ZeroMemory(irp, sizeof(IRP));

	irp->device = device;
	irp->devman = devman;
	stream_read_UINT32(data_in, irp->FileId);
	stream_read_UINT32(data_in, irp->CompletionId);
	stream_read_UINT32(data_in, irp->MajorFunction);
	stream_read_UINT32(data_in, irp->MinorFunction);
	irp->input = data_in;

	irp->output = stream_new(256);
	stream_write_UINT16(irp->output, RDPDR_CTYP_CORE);
	stream_write_UINT16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION);
	stream_write_UINT32(irp->output, DeviceId);
	stream_write_UINT32(irp->output, irp->CompletionId);
	stream_seek_UINT32(irp->output); /* IoStatus */

	irp->Complete = irp_complete;
	irp->Discard = irp_free;

	DEBUG_SVC("DeviceId %d FileId %d CompletionId %d MajorFunction 0x%X MinorFunction 0x%x",
		irp->device->id, irp->FileId, irp->CompletionId, irp->MajorFunction, irp->MinorFunction);

	return irp;
}
Пример #3
0
IRP* irp_new(DEVMAN* devman, STREAM* data_in)
{
	IRP* irp;
	uint32 DeviceId;
	DEVICE* device;

	stream_read_uint32(data_in, DeviceId);
	device = devman_get_device_by_id(devman, DeviceId);
	if (device == NULL)
	{
		DEBUG_WARN("unknown DeviceId %d", DeviceId);
		return NULL;
	}

	irp = xnew(IRP);
	irp->device = device;
	irp->devman = devman;
	stream_read_uint32(data_in, irp->FileId);
	stream_read_uint32(data_in, irp->CompletionId);
	stream_read_uint32(data_in, irp->MajorFunction);
	stream_read_uint32(data_in, irp->MinorFunction);
	irp->input = data_in;

	irp->output = stream_new(256);
	stream_write_uint16(irp->output, RDPDR_CTYP_CORE);
	stream_write_uint16(irp->output, PAKID_CORE_DEVICE_IOCOMPLETION);
	stream_write_uint32(irp->output, DeviceId);
	stream_write_uint32(irp->output, irp->CompletionId);
	stream_seek_uint32(irp->output); /* IoStatus */

	irp->Complete = irp_complete;
	irp->Discard = irp_free;

	DEBUG_SVC("DeviceId %d FileId %d CompletionId %d MajorFunction 0x%X MinorFunction 0x%x",
		irp->device->id, irp->FileId, irp->CompletionId, irp->MajorFunction, irp->MinorFunction);

	return irp;
}