当我调用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;
}
答案 0 :(得分:1)
我认为您忘记了使用IoDeleteSymbolicLink
销毁符号链接。