Visual C++ backend for rbuild (for now just a hacked mingw backend) and related compi...
[reactos.git] / ntoskrnl / io / pnpmgr / pnpreport.c
1 /*
2 * PROJECT: ReactOS Kernel
3 * COPYRIGHT: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/io/pnpmgr/pnpreport.c
5 * PURPOSE: Device Changes Reporting Functions
6 * PROGRAMMERS: Filip Navara (xnavara@volny.cz)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14
15 /* PUBLIC FUNCTIONS **********************************************************/
16
17 /*
18 * @implemented
19 */
20 NTSTATUS
21 NTAPI
22 IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject,
23 IN INTERFACE_TYPE LegacyBusType,
24 IN ULONG BusNumber,
25 IN ULONG SlotNumber,
26 IN PCM_RESOURCE_LIST ResourceList,
27 IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirements OPTIONAL,
28 IN BOOLEAN ResourceAssigned,
29 IN OUT PDEVICE_OBJECT *DeviceObject OPTIONAL)
30 {
31 PDEVICE_NODE DeviceNode;
32 PDEVICE_OBJECT Pdo;
33 NTSTATUS Status = STATUS_SUCCESS;
34
35 DPRINT("__FUNCTION__ (DeviceObject %p, *DeviceObject %p)\n",
36 DeviceObject, DeviceObject ? *DeviceObject : NULL);
37
38 /* if *DeviceObject is not NULL, we must use it as a PDO, and don't create a new one */
39 if (DeviceObject && *DeviceObject)
40 {
41 Pdo = *DeviceObject;
42 }
43 else
44 {
45 UNICODE_STRING ServiceName;
46 ServiceName.Buffer = DriverObject->DriverName.Buffer +
47 sizeof(DRIVER_ROOT_NAME) / sizeof(WCHAR) - 1;
48 ServiceName.Length = DriverObject->DriverName.Length -
49 sizeof(DRIVER_ROOT_NAME) + sizeof(WCHAR);
50 ServiceName.MaximumLength = ServiceName.Length;
51
52 /* create a new PDO and return it in *DeviceObject */
53 Status = IopCreateDeviceNode(IopRootDeviceNode,
54 NULL,
55 &ServiceName,
56 &DeviceNode);
57
58 if (!NT_SUCCESS(Status))
59 {
60 DPRINT("IopCreateDeviceNode() failed (Status 0x%08lx)\n", Status);
61 return Status;
62 }
63
64 Pdo = DeviceNode->PhysicalDeviceObject;
65 if (DeviceObject) *DeviceObject = Pdo;
66 }
67
68 /* we don't need to call AddDevice and send IRP_MN_START_DEVICE */
69 return Status;
70 }
71
72 /*
73 * @unimplemented
74 */
75 NTSTATUS
76 NTAPI
77 IoReportResourceForDetection(IN PDRIVER_OBJECT DriverObject,
78 IN PCM_RESOURCE_LIST DriverList OPTIONAL,
79 IN ULONG DriverListSize OPTIONAL,
80 IN PDEVICE_OBJECT DeviceObject OPTIONAL,
81 IN PCM_RESOURCE_LIST DeviceList OPTIONAL,
82 IN ULONG DeviceListSize OPTIONAL,
83 OUT PBOOLEAN ConflictDetected)
84 {
85 static int warned = 0;
86 if (!warned)
87 {
88 DPRINT1("IoReportResourceForDetection partly implemented\n");
89 warned = 1;
90 }
91
92 *ConflictDetected = FALSE;
93
94 if (PopSystemPowerDeviceNode && DriverListSize > 0)
95 {
96 /* We hope legacy devices will be enumerated by ACPI */
97 *ConflictDetected = TRUE;
98 return STATUS_CONFLICTING_ADDRESSES;
99 }
100
101 return STATUS_SUCCESS;
102 }
103
104 VOID
105 NTAPI
106 IopSetEvent(IN PVOID Context)
107 {
108 PKEVENT Event = Context;
109
110 /* Set the event */
111 KeSetEvent(Event, IO_NO_INCREMENT, FALSE);
112 }
113
114 /*
115 * @unimplemented
116 */
117 NTSTATUS
118 NTAPI
119 IoReportTargetDeviceChange(IN PDEVICE_OBJECT PhysicalDeviceObject,
120 IN PVOID NotificationStructure)
121 {
122 UNIMPLEMENTED;
123 return STATUS_NOT_IMPLEMENTED;
124 }
125
126 /*
127 * @unimplemented
128 */
129 NTSTATUS
130 NTAPI
131 IoReportTargetDeviceChangeAsynchronous(IN PDEVICE_OBJECT PhysicalDeviceObject,
132 IN PVOID NotificationStructure,
133 IN PDEVICE_CHANGE_COMPLETE_CALLBACK Callback OPTIONAL,
134 IN PVOID Context OPTIONAL)
135 {
136 UNIMPLEMENTED;
137 return STATUS_NOT_IMPLEMENTED;
138 }