ReactOS  0.4.14-dev-55-g2da92ac
adapter.cpp File Reference
#include <ntddk.h>
#include <portcls.h>
#include <debug.h>
Include dependency graph for adapter.cpp:

Go to the source code of this file.

Macros

#define MAX_MINIPORTS   1
 
#define PUT_GUIDS_HERE
 
#define INITGUID
 

Functions

NTSTATUS NTAPI StartDevice (IN PDEVICE_OBJECT pDeviceObject, IN PIRP pIrp, IN PRESOURCELIST ResourceList)
 
NTSTATUS NTAPI AddDevice (IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject)
 
NTSTATUS NTAPI DriverEntry (IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
 

Variables

WCHAR DeviceName [] = L"Uart"
 

Macro Definition Documentation

◆ INITGUID

#define INITGUID

Definition at line 15 of file adapter.cpp.

◆ MAX_MINIPORTS

#define MAX_MINIPORTS   1

Definition at line 13 of file adapter.cpp.

◆ PUT_GUIDS_HERE

#define PUT_GUIDS_HERE

Definition at line 14 of file adapter.cpp.

Function Documentation

◆ AddDevice()

NTSTATUS NTAPI AddDevice ( IN PDRIVER_OBJECT  DriverObject,
IN PDEVICE_OBJECT  PhysicalDeviceObject 
)

Definition at line 92 of file adapter.cpp.

95 {
96  DPRINT1("MPU401_KS AddDevice called\n");
101  0);
102 }
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1114
NTSTATUS NTAPI PcAddAdapterDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject, IN PCPFNSTARTDEVICE StartDevice, IN ULONG MaxObjects, IN ULONG DeviceExtensionSize)
Definition: adapter.cpp:76
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS(NTAPI * PCPFNSTARTDEVICE)(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PRESOURCELIST ResourceList)
Definition: portcls.h:2231
#define DPRINT1
Definition: precomp.h:8
#define MAX_MINIPORTS
Definition: adapter.cpp:13
NTSTATUS NTAPI StartDevice(PDEVICE_OBJECT DeviceObject, PIRP Irp, PRESOURCELIST ResourceList)
Definition: adapter.cpp:115

◆ DriverEntry()

NTSTATUS NTAPI DriverEntry ( IN PDRIVER_OBJECT  DriverObject,
IN PUNICODE_STRING  RegistryPath 
)

Definition at line 107 of file adapter.cpp.

110 {
112  DPRINT1("MPU401_KS DriverEntry\n");
113 
115  RegistryPath,
116  AddDevice);
117 
118  DPRINT1("PcInitializeAdapterDriver result 0x%08x\n", Status);
119 
120  return Status;
121 };
LONG NTSTATUS
Definition: precomp.h:26
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
NTSTATUS NTAPI PcInitializeAdapterDriver(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPathName, IN PDRIVER_ADD_DEVICE AddDevice)
Definition: adapter.cpp:32
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
NTSTATUS NTAPI AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject)
Definition: adapter.cpp:259

◆ StartDevice()

NTSTATUS NTAPI StartDevice ( IN PDEVICE_OBJECT  pDeviceObject,
IN PIRP  pIrp,
IN PRESOURCELIST  ResourceList 
)

Definition at line 25 of file adapter.cpp.

29 {
30  PPORT port;
31  PMINIPORT miniport;
33 
34  DPRINT1("MPU401_KS StartDevice called\n");
35 
36  if (!ResourceList)
38 
39  if (ResourceList->NumberOfEntries() == 0 )
40  {
42  }
43 
44 
45  DPRINT1("Calling PcNewPort with CLSID_PortMidi\n");
46  Status = PcNewPort(&port, CLSID_PortMidi);
47 
48  if (!NT_SUCCESS(Status))
49  {
50  DPRINT("PcNewPort FAILED with status 0x%08x\n", Status);
51  return Status;
52  }
53 
54  DPRINT1("Calling PcNewMiniport with CLSID_MiniportDriverUart\n");
55  Status = PcNewMiniport(&miniport, CLSID_MiniportDriverUart);
56 
57  if (!NT_SUCCESS(Status))
58  {
59  DPRINT1("PcNewMiniport FAILED with status 0x%08x\n", Status);
60  return Status;
61  }
62 
63  DPRINT1("Calling Init of port object\n");
64  Status = port->Init(pDeviceObject, pIrp, miniport, NULL, ResourceList);
65 
66  if (!NT_SUCCESS(Status))
67  {
68  DPRINT1("Init FAILED with status 0x%08x\n", Status);
69  return Status;
70  }
71 
72  DPRINT1("Registering subdevice via PcRegisterSubdevice\n");
74 
75  if (!NT_SUCCESS(Status))
76  {
77  /* just print an error here */
78  DPRINT1("PcRegisterSubdevice FAILED with status 0x%08x\n", Status);
79  }
80 
81  miniport->Release();
82  port->Release();
83 
84  DPRINT1("Device started\n");
85 
86  return Status;
87 }
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
LONG NTSTATUS
Definition: precomp.h:26
WCHAR DeviceName[]
Definition: adapter.cpp:21
const MUI_LANGUAGE_RESOURCE ResourceList[]
Definition: muilanguages.h:414
NTSTATUS NTAPI PcNewMiniport(OUT PMINIPORT *OutMiniport, IN REFCLSID ClassId)
Definition: miniport.cpp:48
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:463
IPort * PPORT
Definition: portcls.h:1093
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI PcNewPort(OUT PPORT *OutPort, IN REFCLSID ClassId)
Definition: port.cpp:20
USHORT port
Definition: uri.c:227
NTSTATUS NTAPI PcRegisterSubdevice(IN PDEVICE_OBJECT DeviceObject, IN PWCHAR Name, IN PUNKNOWN Unknown)
Definition: adapter.cpp:210

Variable Documentation

◆ DeviceName

_In_ PUNICODE_STRING DeviceName = L"Uart"

Definition at line 21 of file adapter.cpp.

Referenced by AddControllers(), AddDeviceInternal(), AddUnregisteredProvider(), AfdCreateSocket(), ArcOpen(), BasepGetComputerNameFromNtPath(), BindAdapterByName(), ChangeDisplaySettingsExA(), ChangeDisplaySettingsExW(), CheckTerminalDeviceType(), ClassUpdateInformationInRegistry(), CompareProductName(), CompBattAddDevice(), CompBattGetDeviceObjectPointer(), ConDrvCreateController(), ConstructDeviceName(), CopyDeviceFindData(), CreateDeviceName(), CHCDController::CreateFDO(), CreateNewDriveLetterName(), CHubController::CreatePDO(), CreateSoundDevice(), CreateUsbChildDeviceObject(), CSR_API(), DetectNt4SoundDevices(), DosCreateDevice(), DosCreateDeviceEx(), DosGetDevice(), DriveMapGetBiosDriveNumber(), DriverEntry(), Enum(), Ext2OpenDevice(), FdcFdoQueryBusRelations(), FdoCreateRawParallelPdo(), FilterConnectCommunicationPort(), FindAdapterContextByName(), FindDeviceInfo(), FindDevices(), FltpAttachToFileSystemDevice(), FltpEnumerateFileSystemVolumes(), FltpFsNotification(), FsRecRegisterFs(), FsRtlpOpenDev(), FsRtlpSetSymbolicLink(), GetPossibleSettings(), GlobalCreateSymbolicLink(), CHubController::HandlePnp(), HDA_PDOQueryId(), HidClassAddDevice(), InitDevice(), InitializeGlobalData(), InsertAudioDevice(), InstallNetDevice(), IntVideoPortCreateAdapterDeviceObject(), IntVideoPortFindAdapter(), IoCreateDevice(), IoCreateSymbolicLink(), IoCreateUnprotectedSymbolicLink(), IopEnumerateDetectedDevices(), IopMarkBootPartition(), IoVolumeDeviceToDosName(), IsAcpiComputer(), IssueUniqueIdChangeNotify(), KMix_AddDevice(), KsecOpenDevice(), KspCreateDeviceAssociation(), KspCreateDeviceReference(), KspCreatePDO(), MMixerAddMidiPin(), MMixerCreateMixerData(), MMixerGetDataByDeviceName(), MMixerGetDeviceName(), MMixerGetDeviceNameWithComponentId(), MMixerInitialize(), MMixerInitializeWaveInfo(), mountmgr_add_drive_letter(), MountMgrCreatePoint(), MountMgrCreatePointWorker(), MountMgrDeletePoints(), MountMgrMountedDeviceArrival(), MountMgrMountedDeviceRemoval(), MountMgrNextDriveLetter(), MountMgrNextDriveLetterWorker(), MountMgrNotifyNameChange(), MountMgrQueryDosVolumePaths(), MountMgrQueryPoints(), ndisBindMiniportsToProtocol(), NdisMRegisterDevice(), NduBindAdapter(), OpenDevice(), OpenDeviceReadWrite(), OpenInputDevice(), PciPdoCreate(), PortAddDevice(), PRINTDLG_CreateDevNames(), PRINTDLG_CreateDevNamesW(), ProtocolBindAdapter(), QueryDeviceInformation(), QueryPointsFromMemory(), QueryPointsFromSymbolicLinkName(), RamdiskAddDevice(), RamdiskCreateDiskDevice(), RawFsDriverEntry(), RxRegisterMinirdr(), ScsiPortInitialize(), SendLinkDeleted(), SerialAddDeviceInternal(), SerialPnpStartDevice(), SetupDiCreateDeviceInfoA(), SetupDiCreateDeviceInfoW(), StartDevice(), SysAudio_AddDevice(), SysAudioHandleProperty(), TdiOpenAddressFile(), TdiOpenConnectionEndpointFile(), TdiOpenDevice(), test_pack_DISPLAY_DEVICEA(), test_pack_DISPLAY_DEVICEW(), TestEntry(), TestProviderInfo(), UDFGetDeviceName(), USBH_CreateDevice(), USBPORT_AddDevice(), USBPORT_CreateLegacySymbolicLink(), USBPORT_CreatePdo(), ViCreateDriveLetter(), WdmAudOpenSysAudioDevice(), WdmAudOpenSysAudioDevices(), and xHalQueryDriveLayout().