IoCreateSymbolicLink何时返回STATUS_OBJECT_NAME_COLLISION

时间:2013-04-23 13:15:01

标签: c windows device-driver

当我调用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;

}

1 个答案:

答案 0 :(得分:1)

我认为您忘记了使用IoDeleteSymbolicLink销毁符号链接。