本文整理汇总了C++中IoGetRelatedDeviceObject函数的典型用法代码示例。如果您正苦于以下问题:C++ IoGetRelatedDeviceObject函数的具体用法?C++ IoGetRelatedDeviceObject怎么用?C++ IoGetRelatedDeviceObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IoGetRelatedDeviceObject函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TdiDisconnect
NTSTATUS
TdiDisconnect(
PFILE_OBJECT ConnectionObject
)
{
NTSTATUS ntStatus;
KEVENT Event;
PIRP Irp;
PDEVICE_OBJECT DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
IO_STATUS_BLOCK IoStatus;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
if (!(Irp = TdiBuildInternalDeviceControlIrp(TDI_DISCONNECT, DeviceObject, ConnectionObject, &Event, &IoStatus)))
return STATUS_INSUFFICIENT_RESOURCES;
TdiBuildDisconnect(Irp, DeviceObject, ConnectionObject, 0, 0, 0, TDI_DISCONNECT_RELEASE, 0, 0);
ntStatus = IoCallDriver(DeviceObject, Irp);
if (ntStatus == STATUS_PENDING)
ntStatus = KeWaitForSingleObject(&Event, UserRequest, KernelMode, FALSE, 0);
return(ntStatus == STATUS_SUCCESS ? IoStatus.Status : ntStatus);
}
开发者ID:0x00dec0de,项目名称:Rovnix,代码行数:26,代码来源:tdi.c
示例2: TdiSetEventHandler
NTSTATUS
TdiSetEventHandler(
PFILE_OBJECT AddressObject,
LONG EventType,
PVOID EventHandler,
PVOID EventContext
)
{
NTSTATUS ntStatus;
KEVENT Event;
PIRP Irp;
PDEVICE_OBJECT DeviceObject = IoGetRelatedDeviceObject(AddressObject);
IO_STATUS_BLOCK IoStatus;
KeInitializeEvent(&Event, NotificationEvent, FALSE);
if (!(Irp = TdiBuildInternalDeviceControlIrp(TDI_SET_EVENT_HANDLER, DeviceObject, AddressObject, &Event, &IoStatus)))
return STATUS_INSUFFICIENT_RESOURCES;
TdiBuildSetEventHandler(Irp, DeviceObject, AddressObject, 0, 0, EventType, EventHandler, EventContext);
ntStatus = IoCallDriver(DeviceObject, Irp);
if (ntStatus == STATUS_PENDING)
ntStatus = KeWaitForSingleObject(&Event, UserRequest, KernelMode, FALSE, 0);
return(ntStatus == STATUS_SUCCESS ? IoStatus.Status : ntStatus);
}
开发者ID:0x00dec0de,项目名称:Rovnix,代码行数:28,代码来源:tdi.c
示例3: TdiQueryAddress
NTSTATUS
TdiQueryAddress(
PFILE_OBJECT AddressObject,
PTDI_ADDRESS_INFO AddressInfo,
PULONG pInfoLength
)
{
NTSTATUS ntStatus;
PIRP Irp;
PMDL Mdl;
PDEVICE_OBJECT DeviceObject = IoGetRelatedDeviceObject(AddressObject);
IO_STATUS_BLOCK IoStatus;
if (!(Irp = TdiBuildInternalDeviceControlIrp(TDI_QUERY_INFORMATION, DeviceObject, FileObject, NULL, &IoStatus)))
return STATUS_INSUFFICIENT_RESOURCES;
if (!(Mdl = IoAllocateMdl(AddressInfo, *pInfoLength, FALSE, FALSE, Irp)))
{
IoFreeIrp(Irp);
return STATUS_INSUFFICIENT_RESOURCES;
}
MmProbeAndLockPages(Mdl, KernelMode, IoModifyAccess);
TdiBuildQueryInformation(Irp, DeviceObject, AddressObject, NULL, NULL, TDI_QUERY_ADDRESS_INFO, Mdl);
ntStatus = IoCallDriver(DeviceObject, Irp);
return(ntStatus == STATUS_SUCCESS ? IoStatus.Status : ntStatus);
}
开发者ID:0x00dec0de,项目名称:Rovnix,代码行数:31,代码来源:tdi.c
示例4: EVhdGetQosStatusDisk
NTSTATUS EVhdGetQosStatusDisk(ParserInstance *parser, PVOID pSystemBuffer, ULONG32 dwSize, QoSStatusCompletionRoutine pfnCompletionCb, PVOID pInterface)
{
PDEVICE_OBJECT pDeviceObject = NULL;
parser->pQoSStatusInterface = pInterface;
parser->pfnQoSStatusCallback = pfnCompletionCb;
memmove(parser->pQoSStatusBuffer, pSystemBuffer, dwSize);
IoReuseIrp(parser->pQoSStatusIrp, STATUS_PENDING);
parser->pQoSStatusIrp->Tail.Overlay.Thread = (PETHREAD)__readgsqword(0x188); // Pointer to calling thread control block
parser->pQoSStatusIrp->AssociatedIrp.SystemBuffer = parser->pQoSStatusBuffer; // IO buffer for buffered control code
PIO_STACK_LOCATION pStackFrame = IoGetNextIrpStackLocation(parser->pQoSStatusIrp);
pDeviceObject = IoGetRelatedDeviceObject(parser->pVhdmpFileObject);
pStackFrame->FileObject = parser->pVhdmpFileObject;
pStackFrame->DeviceObject = pDeviceObject;
pStackFrame->Parameters.DeviceIoControl.IoControlCode = IOCTL_STORAGE_VHD_GET_QOS_STATUS;
pStackFrame->Parameters.DeviceIoControl.InputBufferLength = dwSize;
pStackFrame->Parameters.DeviceIoControl.OutputBufferLength = 0x58;
pStackFrame->MajorFunction = IRP_MJ_DEVICE_CONTROL;
pStackFrame->MinorFunction = 0;
pStackFrame->Flags = 0;
pStackFrame->Control = SL_INVOKE_ON_CANCEL | SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
pStackFrame->Context = parser;
pStackFrame->CompletionRoutine = EvhdGetQosStatusCompletionRoutine;
IoCallDriver(pDeviceObject, parser->pQoSStatusIrp);
return STATUS_PENDING;
}
开发者ID:the-alien,项目名称:evhdparser,代码行数:26,代码来源:parser.c
示例5: tdi_disconnect
NTSTATUS tdi_disconnect(PFILE_OBJECT connectionFileObject, ULONG flags)
{
PDEVICE_OBJECT devObj;
KEVENT event;
PIRP irp;
IO_STATUS_BLOCK iosb;
NTSTATUS status;
devObj = IoGetRelatedDeviceObject(connectionFileObject);
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = TdiBuildInternalDeviceControlIrp(TDI_DISCONNECT, devObj, connectionFileObject, &event, &iosb);
if (irp == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
TdiBuildDisconnect(irp, devObj, connectionFileObject, NULL, NULL, NULL, flags, NULL, NULL);
status = IoCallDriver(devObj, irp);
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = iosb.Status;
}
return status;
}
开发者ID:baselsayeh,项目名称:winvblock,代码行数:31,代码来源:ktdi.c
示例6: EVhdNotifyRecoveryStatus
NTSTATUS EVhdNotifyRecoveryStatus(ParserInstance *parser, RecoveryStatusCompletionRoutine pfnCompletionCb, void *pInterface)
{
PDEVICE_OBJECT pDeviceObject = NULL;
if (parser->bResiliencyEnabled)
{
if (!ExAcquireRundownProtection(&parser->RecoveryRundownProtection))
return STATUS_UNSUCCESSFUL;
parser->pfnRecoveryStatusCallback = pfnCompletionCb;
parser->pRecoveryStatusInterface = pInterface;
IoReuseIrp(parser->pRecoveryStatusIrp, STATUS_PENDING);
parser->pRecoveryStatusIrp->Tail.Overlay.Thread = (PETHREAD)__readgsqword(0x188); // Pointer to calling thread control block
PIO_STACK_LOCATION pStackFrame = IoGetNextIrpStackLocation(parser->pRecoveryStatusIrp);
pDeviceObject = IoGetRelatedDeviceObject(parser->pVhdmpFileObject);
pStackFrame->FileObject = parser->pVhdmpFileObject;
pStackFrame->DeviceObject = pDeviceObject;
pStackFrame->Parameters.DeviceIoControl.IoControlCode = IOCTL_STORAGE_VHD_NOTIFY_RECOVERY_STATUS;
pStackFrame->Parameters.DeviceIoControl.InputBufferLength = 0;
pStackFrame->Parameters.DeviceIoControl.OutputBufferLength = 0;
pStackFrame->MajorFunction = IRP_MJ_DEVICE_CONTROL;
pStackFrame->MinorFunction = 0;
pStackFrame->Flags = 0;
pStackFrame->Control = SL_INVOKE_ON_CANCEL | SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR;
pStackFrame->Context = parser;
pStackFrame->CompletionRoutine = EvhdRecoveryStatusCompletionRoutine;
IoCallDriver(pDeviceObject, parser->pRecoveryStatusIrp);
return STATUS_PENDING;
}
else
return STATUS_UNSUCCESSFUL;
}
开发者ID:the-alien,项目名称:evhdparser,代码行数:32,代码来源:parser.c
示例7: tdi_recv_stream
NTSTATUS tdi_recv_stream(PFILE_OBJECT connectionFileObject, char *buf, int len, ULONG flags)
{
PDEVICE_OBJECT devObj;
KEVENT event;
PIRP irp;
PMDL mdl;
IO_STATUS_BLOCK iosb;
NTSTATUS status;
devObj = IoGetRelatedDeviceObject(connectionFileObject);
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = TdiBuildInternalDeviceControlIrp(TDI_RECEIVE, devObj, connectionFileObject, &event, &iosb);
if (irp == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
if (len)
{
mdl = IoAllocateMdl((void*) buf, len, FALSE, FALSE, NULL);
if (mdl == NULL)
{
IoFreeIrp(irp);
return STATUS_INSUFFICIENT_RESOURCES;
}
__try
{
MmProbeAndLockPages(mdl, KernelMode, IoWriteAccess);
status = STATUS_SUCCESS;
}
__except (EXCEPTION_EXECUTE_HANDLER)
{
IoFreeMdl(mdl);
IoFreeIrp(irp);
status = STATUS_INVALID_USER_BUFFER;
}
if (!NT_SUCCESS(status))
{
return status;
}
}
TdiBuildReceive(irp, devObj, connectionFileObject, NULL, NULL, len ? mdl : 0, flags, len);
status = IoCallDriver(devObj, irp);
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = iosb.Status;
}
return NT_SUCCESS(status) ? iosb.Information : status;
}
开发者ID:baselsayeh,项目名称:winvblock,代码行数:60,代码来源:ktdi.c
示例8: EvhdDirectIoControl
static NTSTATUS EvhdDirectIoControl(ParserInstance *parser, ULONG ControlCode, PVOID pSystemBuffer, ULONG InputBufferSize,
ULONG OutputBufferSize)
{
NTSTATUS status = STATUS_SUCCESS;
PDEVICE_OBJECT pDeviceObject = NULL;
KeEnterCriticalRegion();
FltAcquirePushLockExclusive(&parser->DirectIoPushLock);
IoReuseIrp(parser->pDirectIoIrp, STATUS_PENDING);
parser->pDirectIoIrp->Flags |= IRP_NOCACHE;
parser->pDirectIoIrp->Tail.Overlay.Thread = (PETHREAD)__readgsqword(0x188); // Pointer to calling thread control block
parser->pDirectIoIrp->AssociatedIrp.SystemBuffer = pSystemBuffer; // IO buffer for buffered control code
// fill stack frame parameters for synchronous IRP call
PIO_STACK_LOCATION pStackFrame = IoGetNextIrpStackLocation(parser->pDirectIoIrp);
pDeviceObject = IoGetRelatedDeviceObject(parser->pVhdmpFileObject);
pStackFrame->FileObject = parser->pVhdmpFileObject;
pStackFrame->DeviceObject = pDeviceObject;
pStackFrame->Parameters.DeviceIoControl.IoControlCode = ControlCode;
pStackFrame->Parameters.DeviceIoControl.InputBufferLength = InputBufferSize;
pStackFrame->Parameters.DeviceIoControl.OutputBufferLength = OutputBufferSize;
pStackFrame->MajorFunction = IRP_MJ_DEVICE_CONTROL;
pStackFrame->MinorFunction = 0;
pStackFrame->Flags = 0;
pStackFrame->Control = 0;
IoSynchronousCallDriver(pDeviceObject, parser->pDirectIoIrp);
status = parser->pDirectIoIrp->IoStatus.Status;
FltReleasePushLock(&parser->DirectIoPushLock);
KeLeaveCriticalRegion();
return status;
}
开发者ID:the-alien,项目名称:evhdparser,代码行数:30,代码来源:parser.c
示例9: CcMdlWriteComplete
VOID
CcMdlWriteComplete (
IN PFILE_OBJECT FileObject,
IN PLARGE_INTEGER FileOffset,
IN PMDL MdlChain
)
{
PDEVICE_OBJECT DeviceObject;
PFAST_IO_DISPATCH FastIoDispatch;
DeviceObject = IoGetRelatedDeviceObject( FileObject );
FastIoDispatch = DeviceObject->DriverObject->FastIoDispatch;
if ((FastIoDispatch != NULL) &&
(FastIoDispatch->SizeOfFastIoDispatch > FIELD_OFFSET(FAST_IO_DISPATCH, MdlWriteComplete)) &&
(FastIoDispatch->MdlWriteComplete != NULL) &&
FastIoDispatch->MdlWriteComplete( FileObject, FileOffset, MdlChain, DeviceObject )) {
NOTHING;
} else {
CcMdlWriteComplete2( FileObject, FileOffset, MdlChain );
}
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:25,代码来源:mdlsup.c
示例10: tdi_set_event_handler
NTSTATUS tdi_set_event_handler(PFILE_OBJECT addressFileObject, LONG eventType, PVOID eventHandler, PVOID eventContext)
{
PDEVICE_OBJECT devObj;
KEVENT event;
PIRP irp;
IO_STATUS_BLOCK iosb;
NTSTATUS status;
devObj = IoGetRelatedDeviceObject(addressFileObject);
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = TdiBuildInternalDeviceControlIrp(TDI_SET_EVENT_HANDLER, devObj, addressFileObject, &event, &iosb);
if (irp == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
TdiBuildSetEventHandler(irp, devObj, addressFileObject, NULL, NULL, eventType, eventHandler, eventContext);
status = IoCallDriver(devObj, irp);
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = iosb.Status;
}
return status;
}
开发者ID:baselsayeh,项目名称:winvblock,代码行数:31,代码来源:ktdi.c
示例11: tdi_associate_address
NTSTATUS tdi_associate_address(PFILE_OBJECT connectionFileObject, HANDLE addressHandle)
{
PDEVICE_OBJECT devObj;
KEVENT event;
PIRP irp;
IO_STATUS_BLOCK iosb;
NTSTATUS status;
devObj = IoGetRelatedDeviceObject(connectionFileObject);
KeInitializeEvent(&event, NotificationEvent, FALSE);
irp = TdiBuildInternalDeviceControlIrp(TDI_ASSOCIATE_ADDRESS, devObj, connectionFileObject, &event, &iosb);
if (irp == NULL)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
TdiBuildAssociateAddress(irp, devObj, connectionFileObject, NULL, NULL, addressHandle);
status = IoCallDriver(devObj, irp);
if (status == STATUS_PENDING)
{
KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
status = iosb.Status;
}
return status;
}
开发者ID:baselsayeh,项目名称:winvblock,代码行数:31,代码来源:ktdi.c
示例12: TdiSetEventHandler
NTSTATUS TdiSetEventHandler(
PFILE_OBJECT FileObject,
LONG EventType,
PVOID Handler,
PVOID Context)
/*
* FUNCTION: Sets or resets an event handler
* ARGUMENTS:
* FileObject = Pointer to file object
* EventType = Event code
* Handler = Event handler to be called when the event occurs
* Context = Context input to handler when the event occurs
* RETURNS:
* Status of operation
* NOTES:
* Specify NULL for Handler to stop calling event handler
*/
{
PDEVICE_OBJECT DeviceObject;
IO_STATUS_BLOCK Iosb;
KEVENT Event;
PIRP Irp;
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
if (!FileObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(FileObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = TdiBuildInternalDeviceControlIrp(TDI_SET_EVENT_HANDLER, /* Sub function */
DeviceObject, /* Device object */
FileObject, /* File object */
&Event, /* Event */
&Iosb); /* Status */
if (!Irp)
return STATUS_INSUFFICIENT_RESOURCES;
TdiBuildSetEventHandler(Irp,
DeviceObject,
FileObject,
NULL,
NULL,
EventType,
Handler,
Context);
return TdiCall(Irp, DeviceObject, &Event, &Iosb);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:59,代码来源:tdi.c
示例13: TdiQueryDeviceControl
NTSTATUS TdiQueryDeviceControl(
PFILE_OBJECT FileObject,
ULONG IoControlCode,
PVOID InputBuffer,
ULONG InputBufferLength,
PVOID OutputBuffer,
ULONG OutputBufferLength,
PULONG Return)
/*
* FUNCTION: Queries a device for information
* ARGUMENTS:
* FileObject = Pointer to file object
* IoControlCode = I/O control code
* InputBuffer = Pointer to buffer with input data
* InputBufferLength = Length of InputBuffer
* OutputBuffer = Address of buffer to place output data
* OutputBufferLength = Length of OutputBuffer
* RETURNS:
* Status of operation
*/
{
PDEVICE_OBJECT DeviceObject;
IO_STATUS_BLOCK Iosb;
NTSTATUS Status;
KEVENT Event;
PIRP Irp;
if (!FileObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad file object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(FileObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Irp = IoBuildDeviceIoControlRequest(IoControlCode,
DeviceObject,
InputBuffer,
InputBufferLength,
OutputBuffer,
OutputBufferLength,
FALSE,
&Event,
&Iosb);
if (!Irp)
return STATUS_INSUFFICIENT_RESOURCES;
Status = TdiCall(Irp, DeviceObject, &Event, &Iosb);
if (Return)
*Return = Iosb.Information;
return Status;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:59,代码来源:tdi.c
示例14: Pin_fnWrite
NTSTATUS
NTAPI
Pin_fnWrite(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
PDISPATCH_CONTEXT Context;
PIO_STACK_LOCATION IoStack;
PFILE_OBJECT FileObject;
NTSTATUS Status;
/* Get current stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
/* The dispatch context is stored in the FsContext member */
Context = (PDISPATCH_CONTEXT)IoStack->FileObject->FsContext;
/* Sanity check */
ASSERT(Context);
if (Context->hMixerPin)
{
// FIXME
// call kmixer to convert stream
UNIMPLEMENTED
}
/* acquire real pin file object */
Status = ObReferenceObjectByHandle(Context->Handle, GENERIC_WRITE, *IoFileObjectType, KernelMode, (PVOID*)&FileObject, NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("failed\n");
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = Status;
/* Complete the irp */
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return Status;
}
/* skip current irp location */
IoSkipCurrentIrpStackLocation(Irp);
/* get next stack location */
IoStack = IoGetNextIrpStackLocation(Irp);
/* store file object of next device object */
IoStack->FileObject = FileObject;
IoStack->MajorFunction = IRP_MJ_DEVICE_CONTROL;
//ASSERT(Irp->AssociatedIrp.SystemBuffer);
/* now call the driver */
Status = IoCallDriver(IoGetRelatedDeviceObject(FileObject), Irp);
/* dereference file object */
ObDereferenceObject(FileObject);
return Status;
}
开发者ID:GYGit,项目名称:reactos,代码行数:58,代码来源:pin.c
示例15: EngFileIoControl
NTSTATUS
APIENTRY
EngFileIoControl(
IN PFILE_OBJECT pFileObject,
IN DWORD dwIoControlCode,
IN PVOID lpInBuffer,
IN SIZE_T nInBufferSize,
OUT PVOID lpOutBuffer,
IN SIZE_T nOutBufferSize,
OUT PULONG_PTR lpInformation)
{
PDEVICE_OBJECT pDeviceObject;
KEVENT Event;
PIRP pIrp;
IO_STATUS_BLOCK Iosb;
NTSTATUS Status;
/* Get corresponding device object */
pDeviceObject = IoGetRelatedDeviceObject(pFileObject);
if (!pDeviceObject)
{
return STATUS_INVALID_PARAMETER;
}
/* Initialize an event */
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
/* Build IO control IRP */
pIrp = IoBuildDeviceIoControlRequest(dwIoControlCode,
pDeviceObject,
lpInBuffer,
(ULONG)nInBufferSize,
lpOutBuffer,
(ULONG)nOutBufferSize,
FALSE,
&Event,
&Iosb);
if (!pIrp)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Call the driver */
Status = IoCallDriver(pDeviceObject, pIrp);
/* Wait if neccessary */
if (Status == STATUS_PENDING)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, 0);
Status = Iosb.Status;
}
/* Return information to the caller about the operation. */
*lpInformation = Iosb.Information;
/* This function returns NTSTATUS */
return Status;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:58,代码来源:device.c
示例16: EngpFileIoRequest
static
NTSTATUS
EngpFileIoRequest(
PFILE_OBJECT pFileObject,
ULONG ulMajorFunction,
LPVOID lpBuffer,
SIZE_T nBufferSize,
ULONGLONG ullStartOffset,
OUT PULONG_PTR lpInformation)
{
PDEVICE_OBJECT pDeviceObject;
KEVENT Event;
PIRP pIrp;
IO_STATUS_BLOCK Iosb;
NTSTATUS Status;
LARGE_INTEGER liStartOffset;
/* Get corresponding device object */
pDeviceObject = IoGetRelatedDeviceObject(pFileObject);
if (!pDeviceObject)
{
return STATUS_INVALID_PARAMETER;
}
/* Initialize an event */
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
/* Build IRP */
liStartOffset.QuadPart = ullStartOffset;
pIrp = IoBuildSynchronousFsdRequest(ulMajorFunction,
pDeviceObject,
lpBuffer,
(ULONG)nBufferSize,
&liStartOffset,
&Event,
&Iosb);
if (!pIrp)
{
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Call the driver */
Status = IoCallDriver(pDeviceObject, pIrp);
/* Wait if neccessary */
if (STATUS_PENDING == Status)
{
KeWaitForSingleObject(&Event, Executive, KernelMode, TRUE, 0);
Status = Iosb.Status;
}
/* Return information to the caller about the operation. */
*lpInformation = Iosb.Information;
/* Return NTSTATUS */
return Status;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:57,代码来源:device.c
示例17: EvhdInitialize
static NTSTATUS EvhdInitialize(HANDLE hFileHandle, PFILE_OBJECT pFileObject, ParserInstance *parser)
{
NTSTATUS status = STATUS_SUCCESS;
parser->pVhdmpFileObject = pFileObject;
parser->FileHandle = hFileHandle;
/* Initialize Direct IO */
parser->pDirectIoIrp = IoAllocateIrp(IoGetRelatedDeviceObject(parser->pVhdmpFileObject)->StackSize, FALSE);
if (!parser->pDirectIoIrp)
{
LOG_PARSER(LL_FATAL, "IoAllocateIrp failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Initialize QoS */
parser->pQoSStatusIrp = IoAllocateIrp(IoGetRelatedDeviceObject(parser->pVhdmpFileObject)->StackSize, FALSE);
if (!parser->pQoSStatusIrp)
{
LOG_PARSER(LL_FATAL, "IoAllocateIrp failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
parser->pQoSStatusBuffer = ExAllocatePoolWithTag(NonPagedPoolNx, QoSBufferSize, EvhdQoSPoolTag);
if (!parser->pQoSStatusBuffer)
{
LOG_PARSER(LL_FATAL, "ExAllocatePoolWithTag failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
/* Initialize CTL */
ExInitializeRundownProtection(&parser->RecoveryRundownProtection);
parser->pRecoveryStatusIrp = IoAllocateIrp(IoGetRelatedDeviceObject(parser->pVhdmpFileObject)->StackSize, FALSE);
if (!parser->pRecoveryStatusIrp)
{
LOG_PARSER(LL_FATAL, "IoAllocateIrp failed\n");
return STATUS_INSUFFICIENT_RESOURCES;
}
parser->FileHandle = hFileHandle;
parser->pVhdmpFileObject = pFileObject;
return status;
}
开发者ID:the-alien,项目名称:evhdparser,代码行数:44,代码来源:parser.c
示例18: IoGetRelatedDeviceObject
BOOLEAN KTdiStreamSocket::Unbind()
{
//KLocker locker(&m_KSynchroObject);
BOOLEAN bRes = TRUE;
PIRP pIrp = NULL, pIrpError = NULL;
PDEVICE_OBJECT pDeviceObject;
NTSTATUS NtStatus;
IO_STATUS_BLOCK IoStatusBlock;
__try
{
if (m_bOpen == TRUE && m_bBind == TRUE && m_bConnected == FALSE && m_bListen == FALSE)
{
bRes = FALSE;
pDeviceObject = IoGetRelatedDeviceObject(m_pTdiConnectionObject);
pIrp = TdiBuildInternalDeviceControlIrp(
TDI_DISASSOCIATE_ADDRESS,
pDeviceObject,
m_pTdiConnectionObject,
NULL,
NULL);
pIrpError = pIrp;
if (pIrp != NULL)
{
TdiBuildDisassociateAddress(
pIrp,
pDeviceObject,
m_pTdiConnectionObject,
NULL,
NULL);
pIrpError = NULL;
NtStatus = TdiCall(pIrp, pDeviceObject, &IoStatusBlock);
if (NT_SUCCESS(NtStatus))
{
m_bBind = FALSE;
bRes = TRUE;
}
else
{
DbgPrint ("TdiUnbind: ERROR (%08x)!!!\n", NtStatus);
}
}
}
}
__finally
{
if (pIrpError != NULL)
IoFreeIrp(pIrpError);
}
return bRes;
}
开发者ID:Artorios,项目名称:rootkit.com,代码行数:56,代码来源:KTdiStreamSocket.cpp
示例19: TdiConnect
NTSTATUS TdiConnect(
PIRP *Irp,
PFILE_OBJECT ConnectionObject,
PTDI_CONNECTION_INFORMATION ConnectionCallInfo,
PTDI_CONNECTION_INFORMATION ConnectionReturnInfo,
PIO_COMPLETION_ROUTINE CompletionRoutine,
PVOID CompletionContext)
/*
* FUNCTION: Connect a connection endpoint to a remote peer
* ARGUMENTS:
* ConnectionObject = Pointer to connection endpoint file object
* RemoteAddress = Pointer to remote address
* RETURNS:
* Status of operation
*/
{
PDEVICE_OBJECT DeviceObject;
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
ASSERT(*Irp == NULL);
if (!ConnectionObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
*Irp = TdiBuildInternalDeviceControlIrp(TDI_CONNECT, /* Sub function */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
NULL, /* Event */
NULL); /* Status */
if (!*Irp) {
return STATUS_INSUFFICIENT_RESOURCES;
}
TdiBuildConnect(*Irp, /* IRP */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
CompletionRoutine, /* Completion routine */
CompletionContext, /* Completion routine context */
NULL, /* Time */
ConnectionCallInfo, /* Request connection information */
ConnectionReturnInfo); /* Return connection information */
TdiCall(*Irp, DeviceObject, NULL, NULL);
return STATUS_PENDING;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:55,代码来源:tdi.c
示例20: TdiListen
NTSTATUS TdiListen(
PIRP *Irp,
PFILE_OBJECT ConnectionObject,
PTDI_CONNECTION_INFORMATION *RequestConnectionInfo,
PTDI_CONNECTION_INFORMATION *ReturnConnectionInfo,
PIO_COMPLETION_ROUTINE CompletionRoutine,
PVOID CompletionContext)
/*
* FUNCTION: Listen on a connection endpoint for a connection request from a remote peer
* ARGUMENTS:
* CompletionRoutine = Routine to be called when IRP is completed
* CompletionContext = Context for CompletionRoutine
* RETURNS:
* Status of operation
* May return STATUS_PENDING
*/
{
PDEVICE_OBJECT DeviceObject;
AFD_DbgPrint(MAX_TRACE, ("Called\n"));
ASSERT(*Irp == NULL);
if (!ConnectionObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n"));
return STATUS_INVALID_PARAMETER;
}
DeviceObject = IoGetRelatedDeviceObject(ConnectionObject);
if (!DeviceObject) {
AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n"));
return STATUS_INVALID_PARAMETER;
}
*Irp = TdiBuildInternalDeviceControlIrp(TDI_LISTEN, /* Sub function */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
NULL, /* Event */
NULL); /* Status */
if (*Irp == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
TdiBuildListen(*Irp, /* IRP */
DeviceObject, /* Device object */
ConnectionObject, /* File object */
CompletionRoutine, /* Completion routine */
CompletionContext, /* Completion routine context */
0, /* Flags */
*RequestConnectionInfo, /* Request connection information */
*ReturnConnectionInfo); /* Return connection information */
TdiCall(*Irp, DeviceObject, NULL /* Don't wait for completion */, NULL);
return STATUS_PENDING;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:55,代码来源:tdi.c
注:本文中的IoGetRelatedDeviceObject函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论