NTSTATUS Status;
WCHAR DeviceNameBuffer[32];
UNICODE_STRING DeviceName;
- //UNICODE_STRING SymbolicLinkName;
static ULONG DeviceNumber = 0;
static ULONG ComPortNumber = 1;
-
+
DPRINT("Serial: SerialAddDeviceInternal called\n");
-
+
+ ASSERT(DriverObject);
+ ASSERT(Pdo);
+
/* Create new device object */
swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceNumber);
RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
RtlZeroMemory(DeviceExtension, sizeof(SERIAL_DEVICE_EXTENSION));
/* Register device interface */
-#if 0 /* FIXME: activate */
- Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &SymbolicLinkName);
+ Status = IoRegisterDeviceInterface(Pdo, &GUID_DEVINTERFACE_COMPORT, NULL, &DeviceExtension->SerialInterfaceName);
if (!NT_SUCCESS(Status))
{
DPRINT("Serial: IoRegisterDeviceInterface() failed with status 0x%08x\n", Status);
goto ByeBye;
}
- DPRINT1("Serial: IoRegisterDeviceInterface() returned '%wZ'\n", &SymbolicLinkName);
- Status = IoSetDeviceInterfaceState(&SymbolicLinkName, TRUE);
- if (!NT_SUCCESS(Status))
- {
- DPRINT("Serial: IoSetDeviceInterfaceState() failed with status 0x%08x\n", Status);
- goto ByeBye;
- }
- RtlFreeUnicodeString(&SymbolicLinkName);
-#endif
-
+
DeviceExtension->SerialPortNumber = DeviceNumber++;
if (pComPortNumber == NULL)
DeviceExtension->ComPort = ComPortNumber++;
if (Pdo == NULL)
return STATUS_SUCCESS;
- /* We have here a PDO that does not correspond to a legacy
- * serial port. So call the internal AddDevice function.
+ /* We have here a PDO not null. It represents a real serial
+ * port. So call the internal AddDevice function.
*/
return SerialAddDeviceInternal(DriverObject, Pdo, UartUnknown, NULL, NULL);
-
-
}
NTSTATUS STDCALL
DeviceExtension = (PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ ASSERT(ResourceList);
+ ASSERT(DeviceExtension);
ASSERT(DeviceExtension->PnpState == dsStopped);
DeviceExtension->BaudRate = 19200 | SERIAL_BAUD_USER;
return Status;
}
+ /* Activate serial interface */
+ Status = IoSetDeviceInterfaceState(&DeviceExtension->SerialInterfaceName, TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("Serial: IoSetDeviceInterfaceState() failed with status 0x%08x\n", Status);
+ IoDeleteSymbolicLink(&LinkName);
+ return Status;
+ }
+
/* Connect interrupt and enable them */
Status = IoConnectInterrupt(
&DeviceExtension->Interrupt, SerialInterruptService,
if (!NT_SUCCESS(Status))
{
DPRINT("Serial: IoConnectInterrupt() failed with status 0x%08x\n", Status);
+ IoSetDeviceInterfaceState(&DeviceExtension->SerialInterfaceName, FALSE);
IoDeleteSymbolicLink(&LinkName);
return Status;
}
IoAcquireRemoveLock
IoReleaseRemoveLockAndWait
pass request to DeviceExtension-LowerDriver
+ disable interface
IoDeleteDevice(Fdo) and/or IoDetachDevice
break;
}*/