ReactOS 0.4.15-dev-5666-gc548b97
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}
NTSTATUS NTAPI PcAddAdapterDevice(IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT PhysicalDeviceObject, IN PCPFNSTARTDEVICE StartDevice, IN ULONG MaxObjects, IN ULONG DeviceExtensionSize)
Definition: adapter.cpp:76
#define DPRINT1
Definition: precomp.h:8
PDEVICE_OBJECT PhysicalDeviceObject
Definition: btrfs_drv.h:1157
#define MAX_MINIPORTS
Definition: adapter.cpp:13
static BOOL StartDevice(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DevInfoData OPTIONAL, IN BOOL bEnable, IN DWORD HardwareProfile OPTIONAL, OUT BOOL *bNeedReboot OPTIONAL)
Definition: wizard.c:173
NTSTATUS(NTAPI * PCPFNSTARTDEVICE)(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PRESOURCELIST ResourceList)
Definition: portcls.h:2304
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213

◆ 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
116 AddDevice);
117
118 DPRINT1("PcInitializeAdapterDriver result 0x%08x\n", Status);
119
120 return Status;
121};
NTSTATUS NTAPI PcInitializeAdapterDriver(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPathName, IN PDRIVER_ADD_DEVICE AddDevice)
Definition: adapter.cpp:32
LONG NTSTATUS
Definition: precomp.h:26
Status
Definition: gdiplustypes.h:25
DRIVER_ADD_DEVICE AddDevice
Definition: parport.h:72
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215

◆ 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}
NTSTATUS NTAPI PcRegisterSubdevice(IN PDEVICE_OBJECT DeviceObject, IN PWCHAR Name, IN PUNKNOWN Unknown)
Definition: adapter.cpp:210
NTSTATUS NTAPI PcNewMiniport(OUT PMINIPORT *OutMiniport, IN REFCLSID ClassId)
Definition: miniport.cpp:48
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
USHORT port
Definition: uri.c:228
FxIrp * pIrp
_In_ PNDIS_STRING _In_ PNDIS_STRING _Out_ PDEVICE_OBJECT * pDeviceObject
Definition: ndis.h:4679
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:477
NTSTATUS NTAPI PcNewPort(OUT PPORT *OutPort, IN REFCLSID ClassId)
Definition: port.cpp:20
IPort * PPORT
Definition: portcls.h:1105
#define DPRINT
Definition: sndvol32.h:71
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ WDFIORESREQLIST _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFIORESLIST * ResourceList
Definition: wdfresource.h:309

Variable Documentation

◆ DeviceName

WCHAR DeviceName[] = L"Uart"

Definition at line 21 of file adapter.cpp.