无名设备自然无法创建符号链接,也无法和R3通信。不过你可以让系统给你个默认的名字。 if (DeviceCharacteristics & FILE_AUTOGENERATED_DEVICE_NAME) {
// // The caller has requested that we automatically generate a device // object name. Retrieve the next available number to use for this // purpose, and create a name of the form "\Device\<n>", where <n> // is the (8 hexadecimal digit) character representation of the unique // number we retrieve. //
// // We've already done this once (hence, the unicode device name string // is all set up, as is all the security information). Thus, we can // skip down to where we re-attempt the creation of the device object // using our new name. //
// // Set the DeviceName parameter to point to our unicode string, just as // if the caller had specified it (note, we explicitly ignore anything // the caller passes us for device name if the FILE_AUTOGENERATED_DEVICE_NAME // characteristic is specified. //