IoCreateSymbolicLink() returns STATUS_OBJECT_NAME_COLLISION

Hi Everyone,

I am working on a WDM driver for W2K. In my AddDevice() function,
I need to create a symbolic link using IoCreateSymbolicLink().
The return value by IoCreateSymbolicLink() is
STATUS_OBJECT_NAME_COLLISION.

What is wrong with IoCreateSymbolicLink()? Is it right to use
IoCreateSymbolicLink() in a WDM driver? Or should I use
IoRegisterDeviceInterface?

Thanks in advance.

NTSTATUS AddDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT pdo)
{

UNICODE_STRING devname;
UNICODE_STRING linkName;

RtlInitUnicodeString(&devname, L"\DosDevices\PCIAMCC");
RtlInitUnicodeString(&linkName, L"\DosDevices\PCIAMCC");

status = IoCreateSymbolicLink(&linkName, &devname);

}

If you used the \DosDevices\PCIAMCC in your IoCreateDevice call, the name is already taken (as I assume you did since the devName is set to that value). Try naming your device object something else like \Device\PCIAMCC on your IoCreateDevice call.

Doug

“Peter Ho” wrote in message news:xxxxx@ntdev…

> RtlInitUnicodeString(&devname, L"\DosDevices\PCIAMCC");
> RtlInitUnicodeString(&linkName, L"\DosDevices\PCIAMCC");