3

当我调用 IoCreateSymbolicLink 以状态 STATUS_OBJECT_NAME_COLLISION 失败时。我的驱动程序中有代码,我试图在 NT 和 DOS 之间创建符号链接名称。

通常这个错误会在什么时候引起?

   RtlInitUnicodeString(

  &deviceName,

  L"\\Device\\StreamEitor"

  );


 RtlInitUnicodeString(

  &symbolicLinkName,

  L"\\DosDevices\\StreamEitor"

  );



   status = IoCreateDevice(

 driverObject, 

           0, 

           &deviceName, 

           FILE_DEVICE_NETWORK, 

           0, 

           FALSE, 

           &gDeviceObject

           );

   if (!NT_SUCCESS(status))

   {
  goto Exit;

   }

status = IoCreateSymbolicLink( &symbolicLinkName, &deviceName );


if ( !NT_SUCCESS( status )) {

    //IoDeleteDevice(ControlDeviceObject);

    DbgPrint("IoCreateSymbolicLink failed %x\n", status);

    goto Exit;

}
4

1 回答 1

1

I think you forgot destroy symbolic link using IoDeleteSymbolicLink.

于 2013-04-24T01:18:19.077 回答