1 /* 2 * PROJECT: ReactOS Kernel 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: ntoskrnl/wmi/wmi.c 5 * PURPOSE: I/O Windows Management Instrumentation (WMI) Support 6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) 7 */ 8 9 /* INCLUDES *****************************************************************/ 10 11 #include <ntoskrnl.h> 12 #define INITGUID 13 #include <wmiguid.h> 14 #include <wmidata.h> 15 #include <wmistr.h> 16 17 #include "wmip.h" 18 19 #define NDEBUG 20 #include <debug.h> 21 22 typedef PVOID PWMI_LOGGER_INFORMATION; // FIXME 23 24 typedef enum _WMI_CLOCK_TYPE 25 { 26 WMICT_DEFAULT, 27 WMICT_SYSTEMTIME, 28 WMICT_PERFCOUNTER, 29 WMICT_PROCESS, 30 WMICT_THREAD, 31 WMICT_CPUCYCLE 32 } WMI_CLOCK_TYPE; 33 34 /* FUNCTIONS *****************************************************************/ 35 36 BOOLEAN 37 NTAPI 38 WmiInitialize( 39 VOID) 40 { 41 UNICODE_STRING DriverName = RTL_CONSTANT_STRING(L"\\Driver\\WMIxWDM"); 42 NTSTATUS Status; 43 44 /* Initialize the GUID object type */ 45 Status = WmipInitializeGuidObjectType(); 46 if (!NT_SUCCESS(Status)) 47 { 48 DPRINT1("WmipInitializeGuidObjectType() failed: 0x%lx\n", Status); 49 return FALSE; 50 } 51 52 /* Create the WMI driver */ 53 Status = IoCreateDriver(&DriverName, WmipDriverEntry); 54 if (!NT_SUCCESS(Status)) 55 { 56 DPRINT1("Failed to create WMI driver: 0x%lx\n", Status); 57 return FALSE; 58 } 59 60 return TRUE; 61 } 62 63 /* 64 * @unimplemented 65 */ 66 NTSTATUS 67 NTAPI 68 IoWMIRegistrationControl(IN PDEVICE_OBJECT DeviceObject, 69 IN ULONG Action) 70 { 71 DPRINT("IoWMIRegistrationControl() called for DO %p, requesting %lu action, returning success\n", 72 DeviceObject, Action); 73 74 return STATUS_SUCCESS; 75 } 76 77 /* 78 * @unimplemented 79 */ 80 NTSTATUS 81 NTAPI 82 IoWMIAllocateInstanceIds(IN GUID *Guid, 83 IN ULONG InstanceCount, 84 OUT ULONG *FirstInstanceId) 85 { 86 UNIMPLEMENTED; 87 return STATUS_NOT_IMPLEMENTED; 88 } 89 90 /* 91 * @unimplemented 92 */ 93 NTSTATUS 94 NTAPI 95 IoWMISuggestInstanceName(IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, 96 IN PUNICODE_STRING SymbolicLinkName OPTIONAL, 97 IN BOOLEAN CombineNames, 98 OUT PUNICODE_STRING SuggestedInstanceName) 99 { 100 UNIMPLEMENTED; 101 return STATUS_NOT_IMPLEMENTED; 102 } 103 104 /* 105 * @unimplemented 106 */ 107 NTSTATUS 108 NTAPI 109 IoWMIWriteEvent(IN PVOID WnodeEventItem) 110 { 111 DPRINT1("IoWMIWriteEvent() called for WnodeEventItem %p, returning success\n", 112 WnodeEventItem); 113 114 /* Free the buffer if we are returning success */ 115 if (WnodeEventItem != NULL) 116 ExFreePool(WnodeEventItem); 117 118 return STATUS_SUCCESS; 119 } 120 121 /* 122 * @unimplemented 123 */ 124 NTSTATUS 125 NTAPI 126 IoWMIOpenBlock( 127 _In_ LPCGUID DataBlockGuid, 128 _In_ ULONG DesiredAccess, 129 _Out_ PVOID *DataBlockObject) 130 { 131 HANDLE GuidObjectHandle; 132 NTSTATUS Status; 133 134 /* Open the GIOD object */ 135 Status = WmipOpenGuidObject(DataBlockGuid, 136 DesiredAccess, 137 KernelMode, 138 &GuidObjectHandle, 139 DataBlockObject); 140 if (!NT_SUCCESS(Status)) 141 { 142 DPRINT1("WmipOpenGuidObject failed: 0x%lx\n", Status); 143 return Status; 144 } 145 146 147 return STATUS_SUCCESS; 148 } 149 150 /* 151 * @unimplemented 152 */ 153 NTSTATUS 154 NTAPI 155 IoWMIQueryAllData( 156 IN PVOID DataBlockObject, 157 IN OUT ULONG *InOutBufferSize, 158 OUT PVOID OutBuffer) 159 { 160 PWMIP_GUID_OBJECT GuidObject; 161 NTSTATUS Status; 162 163 164 Status = ObReferenceObjectByPointer(DataBlockObject, 165 WMIGUID_QUERY, 166 WmipGuidObjectType, 167 KernelMode); 168 if (!NT_SUCCESS(Status)) 169 { 170 return Status; 171 } 172 173 GuidObject = DataBlockObject; 174 175 /* Huge HACK! */ 176 if (IsEqualGUID(&GuidObject->Guid, &MSSmBios_RawSMBiosTables_GUID)) 177 { 178 Status = WmipQueryRawSMBiosTables(InOutBufferSize, OutBuffer); 179 } 180 else 181 { 182 Status = STATUS_NOT_SUPPORTED; 183 } 184 185 ObDereferenceObject(DataBlockObject); 186 187 return Status; 188 } 189 190 /* 191 * @unimplemented 192 */ 193 NTSTATUS 194 NTAPI 195 IoWMIQueryAllDataMultiple(IN PVOID *DataBlockObjectList, 196 IN ULONG ObjectCount, 197 IN OUT ULONG *InOutBufferSize, 198 OUT PVOID OutBuffer) 199 { 200 UNIMPLEMENTED; 201 return STATUS_NOT_IMPLEMENTED; 202 } 203 204 /* 205 * @unimplemented 206 */ 207 NTSTATUS 208 NTAPI 209 IoWMIQuerySingleInstance(IN PVOID DataBlockObject, 210 IN PUNICODE_STRING InstanceName, 211 IN OUT ULONG *InOutBufferSize, 212 OUT PVOID OutBuffer) 213 { 214 UNIMPLEMENTED; 215 return STATUS_NOT_IMPLEMENTED; 216 } 217 218 /* 219 * @unimplemented 220 */ 221 NTSTATUS 222 NTAPI 223 IoWMIQuerySingleInstanceMultiple(IN PVOID *DataBlockObjectList, 224 IN PUNICODE_STRING InstanceNames, 225 IN ULONG ObjectCount, 226 IN OUT ULONG *InOutBufferSize, 227 OUT PVOID OutBuffer) 228 { 229 UNIMPLEMENTED; 230 return STATUS_NOT_IMPLEMENTED; 231 } 232 233 /* 234 * @unimplemented 235 */ 236 NTSTATUS 237 NTAPI 238 IoWMISetSingleInstance(IN PVOID DataBlockObject, 239 IN PUNICODE_STRING InstanceName, 240 IN ULONG Version, 241 IN ULONG ValueBufferSize, 242 IN PVOID ValueBuffer) 243 { 244 UNIMPLEMENTED; 245 return STATUS_NOT_IMPLEMENTED; 246 } 247 248 /* 249 * @unimplemented 250 */ 251 NTSTATUS 252 NTAPI 253 IoWMISetSingleItem(IN PVOID DataBlockObject, 254 IN PUNICODE_STRING InstanceName, 255 IN ULONG DataItemId, 256 IN ULONG Version, 257 IN ULONG ValueBufferSize, 258 IN PVOID ValueBuffer) 259 { 260 UNIMPLEMENTED; 261 return STATUS_NOT_IMPLEMENTED; 262 } 263 264 /* 265 * @unimplemented 266 */ 267 NTSTATUS 268 NTAPI 269 IoWMIExecuteMethod(IN PVOID DataBlockObject, 270 IN PUNICODE_STRING InstanceName, 271 IN ULONG MethodId, 272 IN ULONG InBufferSize, 273 IN OUT PULONG OutBufferSize, 274 IN OUT PUCHAR InOutBuffer) 275 { 276 UNIMPLEMENTED; 277 return STATUS_NOT_IMPLEMENTED; 278 } 279 280 /* 281 * @unimplemented 282 */ 283 NTSTATUS 284 NTAPI 285 IoWMISetNotificationCallback(IN PVOID Object, 286 IN WMI_NOTIFICATION_CALLBACK Callback, 287 IN PVOID Context) 288 { 289 UNIMPLEMENTED; 290 return STATUS_NOT_IMPLEMENTED; 291 } 292 293 /* 294 * @unimplemented 295 */ 296 NTSTATUS 297 NTAPI 298 IoWMIHandleToInstanceName(IN PVOID DataBlockObject, 299 IN HANDLE FileHandle, 300 OUT PUNICODE_STRING InstanceName) 301 { 302 UNIMPLEMENTED; 303 return STATUS_NOT_IMPLEMENTED; 304 } 305 306 /* 307 * @unimplemented 308 */ 309 NTSTATUS 310 NTAPI 311 IoWMIDeviceObjectToInstanceName(IN PVOID DataBlockObject, 312 IN PDEVICE_OBJECT DeviceObject, 313 OUT PUNICODE_STRING InstanceName) 314 { 315 UNIMPLEMENTED; 316 return STATUS_NOT_IMPLEMENTED; 317 } 318 319 /* 320 * @unimplemented 321 */ 322 NTSTATUS 323 NTAPI 324 WmiQueryTraceInformation(IN TRACE_INFORMATION_CLASS TraceInformationClass, 325 OUT PVOID TraceInformation, 326 IN ULONG TraceInformationLength, 327 OUT PULONG RequiredLength OPTIONAL, 328 IN PVOID Buffer OPTIONAL) 329 { 330 UNIMPLEMENTED; 331 return STATUS_NOT_IMPLEMENTED; 332 } 333 334 /* 335 * @unimplemented 336 */ 337 NTSTATUS 338 __cdecl 339 WmiTraceMessage(IN TRACEHANDLE LoggerHandle, 340 IN ULONG MessageFlags, 341 IN LPGUID MessageGuid, 342 IN USHORT MessageNumber, 343 IN ...) 344 { 345 UNIMPLEMENTED; 346 return STATUS_NOT_IMPLEMENTED; 347 } 348 349 /* 350 * @unimplemented 351 */ 352 NTSTATUS 353 NTAPI 354 WmiTraceMessageVa(IN TRACEHANDLE LoggerHandle, 355 IN ULONG MessageFlags, 356 IN LPGUID MessageGuid, 357 IN USHORT MessageNumber, 358 IN va_list MessageArgList) 359 { 360 UNIMPLEMENTED; 361 return STATUS_NOT_IMPLEMENTED; 362 } 363 364 NTSTATUS 365 NTAPI 366 WmiFlushTrace(IN OUT PWMI_LOGGER_INFORMATION LoggerInfo) 367 { 368 UNIMPLEMENTED; 369 return STATUS_NOT_IMPLEMENTED; 370 } 371 372 LONG64 373 FASTCALL 374 WmiGetClock(IN WMI_CLOCK_TYPE ClockType, 375 IN PVOID Context) 376 { 377 UNIMPLEMENTED; 378 return STATUS_NOT_IMPLEMENTED; 379 } 380 381 NTSTATUS 382 NTAPI 383 WmiQueryTrace(IN OUT PWMI_LOGGER_INFORMATION LoggerInfo) 384 { 385 UNIMPLEMENTED; 386 return STATUS_NOT_IMPLEMENTED; 387 } 388 389 NTSTATUS 390 NTAPI 391 WmiStartTrace(IN OUT PWMI_LOGGER_INFORMATION LoggerInfo) 392 { 393 UNIMPLEMENTED; 394 return STATUS_NOT_IMPLEMENTED; 395 } 396 397 NTSTATUS 398 NTAPI 399 WmiStopTrace(IN PWMI_LOGGER_INFORMATION LoggerInfo) 400 { 401 UNIMPLEMENTED; 402 return STATUS_NOT_IMPLEMENTED; 403 } 404 405 NTSTATUS 406 FASTCALL 407 WmiTraceFastEvent(IN PWNODE_HEADER Wnode) 408 { 409 UNIMPLEMENTED; 410 return STATUS_NOT_IMPLEMENTED; 411 } 412 413 NTSTATUS 414 NTAPI 415 WmiUpdateTrace(IN OUT PWMI_LOGGER_INFORMATION LoggerInfo) 416 { 417 UNIMPLEMENTED; 418 return STATUS_NOT_IMPLEMENTED; 419 } 420 421 /* 422 * @unimplemented 423 */ 424 NTSTATUS 425 NTAPI 426 NtTraceEvent(IN ULONG TraceHandle, 427 IN ULONG Flags, 428 IN ULONG TraceHeaderLength, 429 IN struct _EVENT_TRACE_HEADER* TraceHeader) 430 { 431 UNIMPLEMENTED; 432 return STATUS_NOT_IMPLEMENTED; 433 } 434 435 /*Eof*/ 436