本文整理汇总了C++中IoDeleteDevice函数的典型用法代码示例。如果您正苦于以下问题:C++ IoDeleteDevice函数的具体用法?C++ IoDeleteDevice怎么用?C++ IoDeleteDevice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IoDeleteDevice函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: driver_unload
static
VOID
NTAPI
driver_unload(IN PDRIVER_OBJECT DriverObject)
{
WCHAR deviceLinkBuffer[] = L"\\DosDevices\\"CO_DRIVER_NAME;
UNICODE_STRING deviceLinkUnicodeString;
co_manager_t *manager;
manager = DriverObject->DeviceObject->DeviceExtension;
if (manager) {
co_manager_unload(manager);
}
RtlInitUnicodeString(&deviceLinkUnicodeString, deviceLinkBuffer);
IoDeleteSymbolicLink(&deviceLinkUnicodeString);
IoDeleteDevice(DriverObject->DeviceObject);
}
开发者ID:matt81093,项目名称:Original-Colinux,代码行数:19,代码来源:interface.c
示例2: CreateDevice
NTSTATUS CreateDevice (
IN PDRIVER_OBJECT pDriverObject)
{
NTSTATUS status;
PDEVICE_OBJECT pDevObj;
PDEVICE_EXTENSION pDevExt;
//创建设备名称
UNICODE_STRING devName;
RtlInitUnicodeString(&devName,L"\\Device\\MyDDKDevice");
//创建设备
status = IoCreateDevice( pDriverObject,
sizeof(DEVICE_EXTENSION),
&(UNICODE_STRING)devName,
FILE_DEVICE_UNKNOWN,
0, TRUE,
&pDevObj );
if (!NT_SUCCESS(status))
return status;
pDevObj->Flags |= DO_DIRECT_IO;
pDevExt = (PDEVICE_EXTENSION)pDevObj->DeviceExtension;
pDevExt->pDevice = pDevObj;
pDevExt->ustrDeviceName = devName;
//申请模拟文件的缓冲区
pDevExt->buffer = (PUCHAR)ExAllocatePool(PagedPool,MAX_FILE_LENGTH);
//设置模拟文件大小
pDevExt->file_length = 0;
//创建符号链接
UNICODE_STRING symLinkName;
RtlInitUnicodeString(&symLinkName,L"\\??\\HelloDDK");
pDevExt->ustrSymLinkName = symLinkName;
status = IoCreateSymbolicLink( &symLinkName,&devName );
if (!NT_SUCCESS(status))
{
IoDeleteDevice( pDevObj );
return status;
}
return STATUS_SUCCESS;
}
开发者ID:caidongyun,项目名称:libs,代码行数:43,代码来源:Driver.cpp
示例3: BBUnload
VOID BBUnload( IN PDRIVER_OBJECT DriverObject )
{
UNICODE_STRING deviceLinkUnicodeString;
// Unregister notification
PsSetCreateProcessNotifyRoutine( BBProcessNotify, TRUE );
// Cleanup physical regions
BBCleanupProcessPhysList();
// Cleanup process mapping info
BBCleanupProcessTable();
RtlUnicodeStringInit( &deviceLinkUnicodeString, DOS_DEVICE_NAME );
IoDeleteSymbolicLink( &deviceLinkUnicodeString );
IoDeleteDevice( DriverObject->DeviceObject );
return;
}
开发者ID:Retord,项目名称:Blackbone,代码行数:19,代码来源:BlackBoneDrv.c
示例4: i8042RemoveDevice
static VOID
i8042RemoveDevice(
IN PDEVICE_OBJECT DeviceObject)
{
PI8042_DRIVER_EXTENSION DriverExtension;
KIRQL OldIrql;
PFDO_DEVICE_EXTENSION DeviceExtension;
DriverExtension = (PI8042_DRIVER_EXTENSION)IoGetDriverObjectExtension(DeviceObject->DriverObject, DeviceObject->DriverObject);
DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
KeAcquireSpinLock(&DriverExtension->DeviceListLock, &OldIrql);
RemoveEntryList(&DeviceExtension->ListEntry);
KeReleaseSpinLock(&DriverExtension->DeviceListLock, OldIrql);
IoDetachDevice(DeviceExtension->LowerDevice);
IoDeleteDevice(DeviceObject);
}
开发者ID:Strongc,项目名称:reactos,代码行数:19,代码来源:pnp.c
示例5: HelloDDKUnload
VOID HelloDDKUnload (IN PDRIVER_OBJECT pDriverObject)
{
PDEVICE_OBJECT pNextObj;
KdPrint(("DriverB:Enter B DriverUnload\n"));
pNextObj = pDriverObject->DeviceObject;
while (pNextObj != NULL)
{
PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION)
pNextObj->DeviceExtension;
//删除符号链接
UNICODE_STRING pLinkName = pDevExt->ustrSymLinkName;
IoDeleteSymbolicLink(&pLinkName);
pNextObj = pNextObj->NextDevice;
IoDeleteDevice( pDevExt->pDevice );
}
KdPrint(("DriverB:Enter B DriverUnload\n"));
}
开发者ID:caidongyun,项目名称:libs,代码行数:19,代码来源:Driver.cpp
示例6: DriverEntry
NTSTATUS DriverEntry(PDRIVER_OBJECT DrvObj, PUNICODE_STRING RegPath)
{
PDEVICE_OBJECT DevObj;
NTSTATUS status;
status = IoCreateDevice(DrvObj, 0, &deviceName, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN,
FALSE, &DevObj);
if(NT_SUCCESS(status)) {
status = IoCreateSymbolicLink (&deviceLink, &deviceName);
DrvObj->MajorFunction[IRP_MJ_CREATE] = DtraceOpen;
DrvObj->MajorFunction[IRP_MJ_CLOSE] = DtraceClose;
DrvObj->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DtraceIoctl;
DrvObj->DriverUnload = DtraceUnload;
}
if (!NT_SUCCESS(status)) {
IoDeleteSymbolicLink(&deviceLink);
if(DevObj)
IoDeleteDevice( DevObj);
return status;
}
status = IoCreateSymbolicLink(&deviceHelperLink, &deviceName);
if (!NT_SUCCESS(status))
dprintf("DriverEntry: dtrace helper creation failed\n");
DtraceGetSystemHertz();
DtraceWinOSKernelModuleInfo();
DtraceWinOSInitFunctions();
if (DtraceWinOSHackData() == 0)
dprintf("DriverEntry: DtraceWinOSPortData() hack data failure\n");
if (PsSetLoadImageNotifyRoutine(ProcKernelModuleLoaded) != STATUS_SUCCESS)
dprintf("DriverEntry: failed to register PsSetLoadImageNotifyRoutine\n");
WorkItem1 = IoAllocateWorkItem(DevObj);
WorkItem2 = IoAllocateWorkItem(DevObj);
int_morecore();
(void) dtrace_load((void *) RegPath);
return status;
}
开发者ID:KnowNo,项目名称:DTrace-win32,代码行数:43,代码来源:driver.c
示例7: ParUnload
VOID
ParUnload(
IN PDRIVER_OBJECT DriverObject
)
/*++
Routine Description:
This routine loops through the device list and cleans up after
each of the devices.
Arguments:
DriverObject - Supplies the driver object.
Return Value:
None.
--*/
{
PDEVICE_OBJECT currentDevice;
PDEVICE_EXTENSION extension;
KEVENT event;
PARALLEL_INTERRUPT_SERVICE_ROUTINE interruptService;
PIRP irp;
IO_STATUS_BLOCK ioStatus;
while (currentDevice = DriverObject->DeviceObject) {
extension = currentDevice->DeviceExtension;
if (extension->CreatedSymbolicLink) {
IoDeleteSymbolicLink(&extension->SymbolicLinkName);
ExFreePool(extension->SymbolicLinkName.Buffer);
}
IoDeleteDevice(currentDevice);
}
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:42,代码来源:parvdm.c
示例8: DestroySoundDevice
NTSTATUS
DestroySoundDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PCWSTR WideDosDeviceName,
IN UCHAR Index)
{
NTSTATUS Status;
UNICODE_STRING DosDeviceName;
/* Check for NULL parameters */
if ( ( ! WideDosDeviceName ) || ( ! DeviceObject ) )
{
DPRINT("Unexpected NULL parameter");
return STATUS_INVALID_PARAMETER;
}
/* Range-check */
if ( Index >= SOUND_MAX_DEVICES )
{
DPRINT("Device %d exceeds maximum", Index);
return STATUS_INVALID_PARAMETER;
}
Status = ConstructDeviceName(WideDosDeviceName, Index, &DosDeviceName);
if ( ! NT_SUCCESS(Status) )
{
return Status;
}
DPRINT("Deleting symlink %ws\n", DosDeviceName.Buffer);
Status = IoDeleteSymbolicLink(&DosDeviceName);
DPRINT("Status of symlink deletion is 0x%08x\n", Status);
/*
ASSERT(NT_SUCCESS(Status));
*/
IoDeleteDevice(DeviceObject);
return STATUS_SUCCESS;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:42,代码来源:devname.c
示例9: VBoxIrpPnP
NTSTATUS VBoxIrpPnP(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
PIO_STACK_LOCATION pStack;
PVBOXMOUSE_DEVEXT pDevExt;
NTSTATUS rc;
LOGF_ENTER();
pStack = IoGetCurrentIrpStackLocation(Irp);
pDevExt = (PVBOXMOUSE_DEVEXT) DeviceObject->DeviceExtension;
switch (pStack->MinorFunction)
{
case IRP_MN_REMOVE_DEVICE:
{
LOGF(("IRP_MN_REMOVE_DEVICE"));
IoReleaseRemoveLockAndWait(&pDevExt->RemoveLock, pDevExt);
VBoxDeviceRemoved(pDevExt);
Irp->IoStatus.Status = STATUS_SUCCESS;
rc = VBoxIrpPassthrough(DeviceObject, Irp);
IoDetachDevice(pDevExt->pdoParent);
IoDeleteDevice(DeviceObject);
break;
}
default:
{
rc = VBoxIrpPassthrough(DeviceObject, Irp);
break;
}
}
if (!NT_SUCCESS(rc) && rc != STATUS_NOT_SUPPORTED)
{
WARN(("rc=%#x", rc));
}
LOGF_LEAVE();
return rc;
}
开发者ID:OSLL,项目名称:vboxhsm,代码行数:42,代码来源:VBoxMFDriver.cpp
示例10: PassThruAddDevice
NTSTATUS PassThruAddDevice( IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT pdo)
{
DebugPrint("AddDevice");
NTSTATUS status;
PDEVICE_OBJECT fdo;
// Create our Functional Device Object in fdo
status = IoCreateDevice (DriverObject,
sizeof(PASSTHRU_DEVICE_EXTENSION),
NULL, // No Name
FILE_DEVICE_UNKNOWN,
0,
FALSE, // Not exclusive
&fdo);
if( !NT_SUCCESS(status))
return status;
// Remember fdo in our device extension
PPASSTHRU_DEVICE_EXTENSION dx = (PPASSTHRU_DEVICE_EXTENSION)fdo->DeviceExtension;
dx->fdo = fdo;
DebugPrint("FDO is %x",fdo);
// Register and enable our device interface
status = IoRegisterDeviceInterface(pdo, &WDM1_GUID, NULL, &dx->ifSymLinkName);
if( !NT_SUCCESS(status))
{
IoDeleteDevice(fdo);
return status;
}
IoSetDeviceInterfaceState(&dx->ifSymLinkName, TRUE);
DebugPrint("Symbolic Link Name is %T",&dx->ifSymLinkName);
// Attach to the driver stack below us
dx->NextStackDevice = IoAttachDeviceToDeviceStack(fdo,pdo);
// Set fdo flags appropriately
fdo->Flags |= DO_BUFFERED_IO|DO_POWER_PAGABLE;
fdo->Flags &= ~DO_DEVICE_INITIALIZING;
return STATUS_SUCCESS;
}
开发者ID:Kallameet,项目名称:TPG2,代码行数:42,代码来源:Pnp.cpp
示例11: AoeBusIrpDispatch
/* Handle an IRP. */
NTSTATUS AoeBusIrpDispatch(
IN PDEVICE_OBJECT dev_obj,
IN PIRP irp
) {
PIO_STACK_LOCATION io_stack_loc;
NTSTATUS status;
ULONG POINTER_ALIGNMENT code;
io_stack_loc = IoGetCurrentIrpStackLocation(irp);
switch (io_stack_loc->MajorFunction) {
case IRP_MJ_PNP:
status = WvlBusPnp(&AoeBusMain, irp);
/* Did the bus detach? */
if (AoeBusMain.State == WvlBusStateDeleted) {
AoeStop();
/* Delete. */
IoDeleteDevice(AoeBusMain.Fdo);
/* Disassociate. */
AoeBusMain.Fdo = NULL;
}
return status;
case IRP_MJ_DEVICE_CONTROL:
code = io_stack_loc->Parameters.DeviceIoControl.IoControlCode;
return AoeBusDevCtl(irp, code);
case IRP_MJ_POWER:
return WvlBusPower(&AoeBusMain, irp);
case IRP_MJ_CREATE:
case IRP_MJ_CLOSE:
/* Always succeed with nothing to do. */
return WvlIrpComplete(irp, 0, STATUS_SUCCESS);
case IRP_MJ_SYSTEM_CONTROL:
return WvlBusSysCtl(&AoeBusMain, irp);
default:
;
}
return WvlIrpComplete(irp, 0, STATUS_NOT_SUPPORTED);
}
开发者ID:ngaut,项目名称:winvblock,代码行数:43,代码来源:bus.c
示例12: DriverEntry
NTSTATUS DriverEntry(
IN PDRIVER_OBJECT InDriverObject,
IN PUNICODE_STRING InRegistryPath)
{
UNREFERENCED_PARAMETER(InRegistryPath);
NTSTATUS Status;
PDEVICE_OBJECT DeviceObject = NULL;
/*
Create device...
*/
if (!NT_SUCCESS(Status = IoCreateDevice(
InDriverObject,
0, // DeviceExtensionSize
NULL,
0x893D, // DeviceType
0, // DeviceCharacteristics
TRUE, // Exclusive
&DeviceObject // [OUT]
)))
goto ERROR_ABORT;
InDriverObject->MajorFunction[IRP_MJ_CREATE] = TestDriverDispatchCreate;
InDriverObject->MajorFunction[IRP_MJ_CLOSE] = TestDriverDispatchClose;
InDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = TestDriverDispatchDeviceControl;
InDriverObject->DriverUnload = TestDriverUnload;
// run test code...
return RunTestSuite();
ERROR_ABORT:
/*
Rollback in case of errors...
*/
if (DeviceObject != NULL)
IoDeleteDevice(DeviceObject);
return Status;
}
开发者ID:Alois-xx,项目名称:EasyHook,代码行数:42,代码来源:main.c
示例13: DriverEntry
//entry point
STDCALL NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING RegistryPath){
UNICODE_STRING DeviceNameUnicodeString;
UNICODE_STRING DeviceLinkUnicodeString;
NTSTATUS ntStatus;
PDEVICE_OBJECT DeviceObject = NULL;
OutputDebugString ("dhahelper: entering DriverEntry");
RtlInitUnicodeString (&DeviceNameUnicodeString, L"\\Device\\DHAHELPER");
// Create an EXCLUSIVE device object (only 1 thread at a time
// can make requests to this device).
ntStatus = IoCreateDevice(DriverObject,0,&DeviceNameUnicodeString,FILE_DEVICE_DHAHELPER,0,TRUE,&DeviceObject);
if (NT_SUCCESS(ntStatus)){
// Create dispatch points for device control, create, close.
DriverObject->MajorFunction[IRP_MJ_CREATE] =
DriverObject->MajorFunction[IRP_MJ_CLOSE] =
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = dhahelperdispatch;
DriverObject->DriverUnload = dhahelperunload;
// Create a symbolic link, e.g. a name that a Win32 app can specify
// to open the device.
RtlInitUnicodeString (&DeviceLinkUnicodeString, L"\\DosDevices\\DHAHELPER");
ntStatus = IoCreateSymbolicLink(&DeviceLinkUnicodeString,&DeviceNameUnicodeString);
if (!NT_SUCCESS(ntStatus)){
// Symbolic link creation failed- note this & then delete the
// device object (it's useless if a Win32 app can't get at it).
OutputDebugString ("dhahelper: IoCreateSymbolicLink failed");
IoDeleteDevice (DeviceObject);
}
}
else{
OutputDebugString ("dhahelper: IoCreateDevice failed");
}
OutputDebugString ("dhahelper: leaving DriverEntry");
return ntStatus;
}
开发者ID:Gamer125,项目名称:wiibrowser,代码行数:43,代码来源:dhahelper.c
示例14: RwPortsUnload
//
// Delete the associated device and return
//
static STDCALL void RwPortsUnload(IN PDRIVER_OBJECT DriverObject)
{
UNICODE_STRING DeviceLinkUnicodeString;
NTSTATUS ntStatus=STATUS_SUCCESS;
OutputDebugString ("rwports: entering RwPortsUnload");
OutputDebugString ("rwports: unmapping remaining memory");
RtlInitUnicodeString (&DeviceLinkUnicodeString, L"\\DosDevices\\rwports");
ntStatus = IoDeleteSymbolicLink (&DeviceLinkUnicodeString);
if (NT_SUCCESS(ntStatus))
{
IoDeleteDevice (DriverObject->DeviceObject);
}
else
{
OutputDebugString ("rwports: IoDeleteSymbolicLink failed");
}
OutputDebugString ("rwports: leaving RwPortsUnload");
}
开发者ID:Jonimoose,项目名称:tilp-libticables,代码行数:23,代码来源:rwports.c
示例15: UnloadDriver
VOID UnloadDriver(PDRIVER_OBJECT DriverObject)
{
UNICODE_STRING uniLinkName;
PDEVICE_OBJECT CurrentDeviceObject;
PDEVICE_OBJECT NextDeviceObject;
RtlInitUnicodeString(&uniLinkName,LINK_NAME);
IoDeleteSymbolicLink(&uniLinkName);
if (DriverObject->DeviceObject!=NULL)
{
CurrentDeviceObject = DriverObject->DeviceObject;
while(CurrentDeviceObject!=NULL)
{
NextDeviceObject = CurrentDeviceObject->NextDevice;
IoDeleteDevice(CurrentDeviceObject);
CurrentDeviceObject = NextDeviceObject;
}
}
DbgPrint("UnloadDriver\r\n");
}
开发者ID:ChengChengCC,项目名称:Ark-tools,代码行数:20,代码来源:DpcTimerDrv.c
示例16: DkDetachAndDeleteTgt
VOID DkDetachAndDeleteTgt(PDEVICE_EXTENSION pDevExt)
{
PUSBPCAP_DEVICE_DATA pDeviceData = pDevExt->context.usb.pDeviceData;
if (pDevExt->parentRemoveLock)
{
IoReleaseRemoveLock(pDevExt->parentRemoveLock, NULL);
}
if (pDevExt->pNextDevObj)
{
IoDetachDevice(pDevExt->pNextDevObj);
pDevExt->pNextDevObj = NULL;
}
if (pDevExt->pThisDevObj)
{
IoDeleteDevice(pDevExt->pThisDevObj);
pDevExt->pThisDevObj = NULL;
}
USBPcapFreeDeviceData(pDevExt);
}
开发者ID:52M,项目名称:usbpcap,代码行数:20,代码来源:USBPcapFilterManager.c
示例17: DriverUnload
/**
* @name DriverUnload
*
* Driver cleanup funtion.
*
* @param DriverObject
* Driver Object
*/
static
VOID
NTAPI
DriverUnload(
IN PDRIVER_OBJECT DriverObject)
{
PAGED_CODE();
UNREFERENCED_PARAMETER(DriverObject);
DPRINT("DriverUnload\n");
TestUnload(DriverObject);
if (TestDeviceObject)
IoDeleteDevice(TestDeviceObject);
if (KmtestDeviceObject)
ObDereferenceObject(KmtestDeviceObject);
}
开发者ID:reactos,项目名称:reactos,代码行数:28,代码来源:kmtest_standalone.c
示例18: AWEAllocUnload
VOID
AWEAllocUnload(IN PDRIVER_OBJECT DriverObject)
{
PDEVICE_OBJECT device_object = DriverObject->DeviceObject;
UNICODE_STRING sym_link;
KdPrint(("AWEAlloc: Unload.\n"));
PAGED_CODE();
RtlInitUnicodeString(&sym_link, AWEALLOC_SYMLINK_NAME);
IoDeleteSymbolicLink(&sym_link);
while (device_object != NULL)
{
PDEVICE_OBJECT next_device = device_object->NextDevice;
IoDeleteDevice(device_object);
device_object = next_device;
}
}
开发者ID:sundiyone,项目名称:virtual-disk,代码行数:20,代码来源:awealloc.c
示例19: XFilter_Delete
//
// 删除一个设备
//
VOID
XFilter_Delete(
IN PDEVICE_OBJECT pDeviceObject
)
{
PXPACKET_DEVICE_EXTENSION pDeviceExtension;
UNICODE_STRING SymbolicLinkName;
pDeviceExtension = (PXPACKET_DEVICE_EXTENSION)pDeviceObject->DeviceExtension;
RtlInitUnicodeString(&SymbolicLinkName, XPACKET_XFILTER_DOS_DEVICE_NAME);
IoDeleteSymbolicLink( &SymbolicLinkName );
pDeviceExtension->ulNodeType = 0;
pDeviceExtension->ulNodeSize = 0;
IoDeleteDevice( pDeviceObject );
dprintf(("XFilter_Delete Success\n"));
}
开发者ID:340211173,项目名称:hf-2011,代码行数:23,代码来源:XFilter.c
示例20: DriverUnload
//-------------------------------------------------------------------------------------------------------------------
VOID DriverUnload(IN PDRIVER_OBJECT DriverObject)
{
UNICODE_STRING deviceLinkUnicodeString;
PDEVICE_EXTENSION extension;
PIRP pNewIrp = NULL;
ULONG m_size;
NTSTATUS ntStatus;
extension = DriverObject->DeviceObject->DeviceExtension;
// Create counted string version of our Win32 device name.
RtlInitUnicodeString(&deviceLinkUnicodeString, DOS_DEVICE_NAME);
// Delete the link from our device name to a name in the Win32 namespace.
IoDeleteSymbolicLink(&deviceLinkUnicodeString);
// Finally delete our device object
IoDeleteDevice(DriverObject->DeviceObject);
}
开发者ID:RussianPenguin,项目名称:samples,代码行数:21,代码来源:driver.c
注:本文中的IoDeleteDevice函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论