ReactOS 0.4.16-dev-306-g647d351
fxdeviceapi.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxDeviceApi.cpp
8
9Abstract:
10
11 This module exposes the "C" interface to the FxDevice object.
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23--*/
24
25#include "coreprivshared.hpp"
26#include "fxiotarget.hpp"
27
28extern "C" {
29// #include "FxDeviceApi.tmh"
30}
31
35};
36
37#define OFFSET_AND_NAME(type, offset) { #offset, FIELD_OFFSET(type, offset) }
38
39//
40// extern "C" the entire file
41//
42extern "C" {
43
45WDFDRIVER
47WDFEXPORT(WdfDeviceGetDriver)(
48 __in
50 __in
51 WDFDEVICE Device
52 )
53/*++
54
55Routine Description:
56
57 Given a Device Handle, return a Handle to the Driver object
58 containing this device.
59
60Arguments:
61 Device - WDF Device handle.
62
63Returns:
64 WDF Driver handle.
65
66--*/
67
68{
69 DDI_ENTRY();
70
72
74 Device,
76 (PVOID*) &pDevice);
77
78 //
79 // No need to ref count the driver handle b/c it will be around as long
80 // as the device handle is.
81 //
83}
84
86WDFIOTARGET
88WDFEXPORT(WdfDeviceGetIoTarget)(
89 __in
91 __in
92 WDFDEVICE Device
93 )
94{
95 DDI_ENTRY();
96
99
101 Device,
103 (PVOID*) &pDeviceBase);
104
106
107 if (pTarget != NULL) {
108 return pTarget->GetHandle();
109 }
110
111 return NULL;
112}
113
115WDFIOTARGET
117WDFEXPORT(WdfDeviceGetSelfIoTarget)(
118 _In_
120 _In_
121 WDFDEVICE Device
122 )
123
124/*++
125
126Routine Description:
127
128 Return the handle to the Self IO target for the device. A Self
129 IO target is only created if the client opted for it by calling
130 WdfDeviceInitAllowSelfTarget
131
132Arguments:
133
134 Device - Handle to the Device Object for which Self IO target is needed
135
136Returns:
137
138 WDFIOTARGET handle to the Self IO Target. NULL is returned in case the
139 device does not have an Self IO target.
140
141--*/
142
143{
144 DDI_ENTRY();
145
148
150 Device,
152 (PVOID*) &pDevice);
153
155
156 if (pTarget != NULL) {
157 return pTarget->GetHandle();
158 }
159
160 return NULL;
161}
162
167WDFEXPORT(WdfDeviceRetrieveDeviceName)(
168 __in
170 __in
171 WDFDEVICE Device,
172 __in
173 WDFSTRING String
174 )
175{
176 DDI_ENTRY();
177
182
184 Device,
186 (PVOID *) &pDevice,
188
191 return status;
192 }
193
195 String,
197 (PVOID*) &pString);
198
201 }
202 else {
206 "Device name for WDFDEVICE 0x%p is NULL. Possibly incorrect "
207 "device handle was passed, %!STATUS!", Device, status);
208 }
209
210 return status;
211}
212
214VOID
216WDFEXPORT(WdfDeviceSetCharacteristics)(
217 __in
219 __in
220 WDFDEVICE Device,
221 __in
223 )
224{
225 DDI_ENTRY();
226
229
231 Device,
233 (PVOID*) &pDevice);
234
238}
239
241ULONG
243WDFEXPORT(WdfDeviceGetCharacteristics)(
244 __in
246 __in
247 WDFDEVICE Device
248 )
249{
250 DDI_ENTRY();
251
254
256 Device,
258 (PVOID*) &pDevice);
259
261
263}
264
266ULONG
268WDFEXPORT(WdfDeviceGetAlignmentRequirement)(
269 __in
271 __in
272 WDFDEVICE Device
273 )
274{
275 DDI_ENTRY();
276
279
281 Device,
283 (PVOID*) &pDeviceBase);
284
286
288}
289
291VOID
293WDFEXPORT(WdfDeviceSetAlignmentRequirement)(
294 __in
296 __in
297 WDFDEVICE Device,
298 __in
300 )
301{
302 DDI_ENTRY();
303
306
308 Device,
310 (PVOID*) &pDeviceBase);
311
313
315}
316
320WDFEXPORT(WdfDeviceGetDevicePnpState)(
321 __in
323 __in
324 WDFDEVICE Device
325 )
326{
327 DDI_ENTRY();
328
330
332 Device,
334 (PVOID*) &pDevice);
335
337}
338
342WDFEXPORT(WdfDeviceGetDevicePowerState)(
343 __in
345 __in
346 WDFDEVICE Device
347 )
348{
349 DDI_ENTRY();
350
352
354 Device,
356 (PVOID*) &pDevice);
357
359}
360
364WDFEXPORT(WdfDeviceGetDevicePowerPolicyState)(
365 __in
367 __in
368 WDFDEVICE Device
369 )
370{
371 DDI_ENTRY();
372
374
376 Device,
378 (PVOID*) &pDevice);
379
381}
382
387WDFEXPORT(WdfDeviceAssignS0IdleSettings)(
388 __in
390 __in
391 WDFDEVICE Device,
392 __in
394 )
395{
396 DDI_ENTRY();
397
401
403 Device,
405 (PVOID *) &pDevice,
407
409
412
415 "Device 0x%p is not the power policy owner, caller cannot set S0"
416 " idle settings %!STATUS!", Device, status);
417
418 return status;
419 }
420
421 //
422 // Validate the Settings parameter
423 //
430 "Expected Settings Size %d, got %d, %!STATUS!",
432 status);
433 return status;
434 }
435 else if (Settings->DxState < PowerDeviceD1 ||
436 Settings->DxState > PowerDeviceMaximum ||
437 Settings->IdleCaps < IdleCannotWakeFromS0 ||
438 Settings->IdleCaps > IdleUsbSelectiveSuspend ||
439 Settings->UserControlOfIdleSettings < IdleDoNotAllowUserControl ||
440 Settings->UserControlOfIdleSettings > IdleAllowUserControl ||
441 Settings->Enabled < WdfFalse ||
442 Settings->Enabled > WdfUseDefault) {
443
447 "a field (DxState, IdleCaps, Enabled, or UserControlOfIdleSettings)"
448 " is out range, %!STATUS!", status);
449 return status;
450 }
451
452 //
453 // PowerUpIdleDeviceOnSystemWake is available only on > 1.7 and can be set to true
454 // only when IdleCaps is IdleCannotWakeFromS0
455 //
457 if (Settings->PowerUpIdleDeviceOnSystemWake < WdfFalse ||
458 Settings->PowerUpIdleDeviceOnSystemWake > WdfUseDefault) {
459
463 "value of field PowerUpIdleDeviceOnSystemWake is out of range,"
464 " %!STATUS!", status);
465 return status;
466 }
467 else if (Settings->IdleCaps != IdleCannotWakeFromS0 &&
468 Settings->PowerUpIdleDeviceOnSystemWake != WdfUseDefault) {
469
473 "value of field PowerUpIdleDeviceOnSystemWake should be set only when"
474 " IdleCaps is IdleCannotWakeFromS0, %!STATUS!", status);
475 return status;
476 }
477 }
478
479 //
480 // IdleTimeoutType is available only on > 1.9
481 //
483 if (Settings->IdleTimeoutType > SystemManagedIdleTimeoutWithHint) {
487 "WDFDEVICE %p, value of field IdleTimeoutType is out of range,"
488 " %!STATUS!", Device, status);
489 return status;
490 }
491 }
492
494}
495
500WDFEXPORT(WdfDeviceAssignSxWakeSettings)(
501 __in
503 __in
504 WDFDEVICE Device,
505 __in
507 )
508{
509 DDI_ENTRY();
510
516
518 Device,
520 (PVOID *) &pDevice,
522
524
527
530 "Device 0x%p is not the power policy owner, caller cannot set Sx"
531 " wake settings %!STATUS!", Device, status);
532
533 return status;
534 }
535
536 //
537 // Validate the Settings parameter
538 //
539 if (Settings->Size != sizeof(WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS) &&
543 "Expected Settings Size %x, got %x, %!STATUS!",
545 Settings->Size,
546 status);
547 return status;
548 }
549 else if (Settings->DxState < PowerDeviceD1 ||
550 Settings->DxState > PowerDeviceMaximum ||
551 Settings->UserControlOfWakeSettings < WakeDoNotAllowUserControl ||
552 Settings->UserControlOfWakeSettings > WakeAllowUserControl ||
553 Settings->Enabled < WdfFalse ||
554 Settings->Enabled > WdfUseDefault) {
555
559 "a field (DxState, Enabled, or UserControlOfIdleSettings) is out "
560 "range, %!STATUS!", status);
561 return status;
562 }
563
564 //
565 // Extract the values from the structure for all the parameters that were
566 // added after v1.5. Since the size of the structure can only grow, get
567 // the values only if we are using a version of the struct after v1.5
568 //
569
570 //
571 // ArmForWakeIfChildrenAreArmedForWake added after v1.5
572 //
575 Settings->ArmForWakeIfChildrenAreArmedForWake :
576 FALSE;
577
578 //
579 // IndicateChildWakeOnParentWake added after v1.5
580 //
583 Settings->IndicateChildWakeOnParentWake :
584 FALSE;
585
587 Settings,
590}
591
596WDFEXPORT(WdfDeviceOpenRegistryKey)(
597 __in
599 __in
600 WDFDEVICE Device,
601 __in
603 __in
607 __out
608 WDFKEY* Key
609 )
610{
611 DDI_ENTRY();
612
616
618 Device,
620 (PVOID *) &pDevice,
622
624
625 *Key = NULL;
626
628 if (!NT_SUCCESS(status)) {
630 return status;
631 }
632
635 if (!NT_SUCCESS(status)) {
636
637 return status;
638 }
639
641 NULL,
642 pDevice,
646 Key);
647}
648
653WDFEXPORT(WdfDeviceOpenDevicemapKey) (
654 _In_
656 _In_
657 WDFDEVICE Device,
658 _In_
660 _In_
664 _Out_
665 WDFKEY* Key
666 )
667{
668 DDI_ENTRY();
669
674 WDFKEY keyHandle;
675
677 Device,
679 (PVOID *) &pDevice,
681
683
684 *Key = NULL;
685
687 if (!NT_SUCCESS(status)) {
688 return status;
689 }
690
691 if (KeyName->Length == 0) {
695 "The subkey cannot be of length zero, %!STATUS!", status);
696 return status;
697 }
698
700 if (!NT_SUCCESS(status)) {
702 return status;
703 }
704
707 if (!NT_SUCCESS(status)) {
708 return status;
709 }
710
712
713 if (pKey == NULL) {
717 "Unable to allocate memory for WDFKEY object, %!STATUS!", status);
718 return status;
719 }
720
722
725
727 KeyName,
729 pKey);
730 if (NT_SUCCESS(status)) {
731 *Key = keyHandle;
732 }
733 }
734
735 if (!NT_SUCCESS(status)) {
737 pKey = NULL;
738 }
739
740 return status;
741}
742
744VOID
746WDFEXPORT(WdfDeviceGetDeviceState)(
747 __in
749 __in
750 WDFDEVICE Device,
751 __out
753 )
754{
755 DDI_ENTRY();
756
759
761 Device,
763 (PVOID *) &pDevice,
765
767
768 if (DeviceState->Size != sizeof(WDF_DEVICE_STATE)) {
771 "WDFDEVICE 0x%p DeviceState Size %d, expected %d",
772 Device, DeviceState->Size, sizeof(WDF_DEVICE_STATE));
773
775
776 return; // STATUS_INFO_LENGTH_MISMATCH;
777 }
778
780}
781
783VOID
785WDFEXPORT(WdfDeviceSetDeviceState)(
786 __in
788 __in
789 WDFDEVICE Device,
790 __in
792 )
793{
794 DDI_ENTRY();
795
799
800 const static FxOffsetAndName offsets[] = {
802 OFFSET_AND_NAME(WDF_DEVICE_STATE, DontDisplayInUI),
804 OFFSET_AND_NAME(WDF_DEVICE_STATE, NotDisableable),
806 OFFSET_AND_NAME(WDF_DEVICE_STATE, ResourcesChanged),
807 };
808
810 Device,
812 (PVOID *) &pDevice,
814
816
817 if (DeviceState->Size != sizeof(WDF_DEVICE_STATE)) {
820 "WDFDEVICE 0x%p, DeviceState Size %d, expected %d",
821 Device, DeviceState->Size, sizeof(WDF_DEVICE_STATE));
822
824 return; // STATUS_INFO_LENGTH_MISMATCH;
825 }
826
827 for (i = 0; i < ARRAY_SIZE(offsets); i++) {
829
830 //
831 // This check makes prefast happy
832 //
833 if (offsets[i].Offset + sizeof(WDF_TRI_STATE) > sizeof(*DeviceState)) {
834 return;
835 }
836
838 offsets[i].Offset);
839
840 switch (value) {
841 case WdfFalse:
842 case WdfTrue:
843 case WdfUseDefault:
844 break;
845
846 default:
849 "WDFDEVICE 0x%p DeviceState WDF_TRI_STATE %s value out of range, "
850 "value is %d", Device, offsets[i].Name, value);
852
853 return; // STATUS_INVALID_PARAMETER
854 }
855 }
856
858
860}
861
862
867WDFEXPORT(WdfDeviceCreate)(
868 __in
870
871
872 __inout
873
877 __out
878 WDFDEVICE* Device
879 )
880{
881 DDI_ENTRY();
882
886
888
892
893 //
894 // Use the object's globals, not the caller's globals
895 //
896 pFxDriverGlobals = (*DeviceInit)->DriverGlobals;
897
898 *Device = NULL;
899
901 if (!NT_SUCCESS(status)) {
902 return status;
903 }
904
905 //
906 // Make sure the device attributes is initialized properly if passed in
907 //
913
914 if (!NT_SUCCESS(status)) {
915 return status;
916 }
917
918 if ((*DeviceInit)->CreatedDevice != NULL) {
919 //
920 // Already created the device!
921 //
923 "WDFDEVICE 0x%p already created"
924 "STATUS_INVALID_DEVICE_STATE",
925 Device);
926
928 }
929
930 //
931 // If security is specified, then the device being created *must* have a
932 // name to apply that security too.
933 //
934 if ((*DeviceInit)->Security.Sddl != NULL || (*DeviceInit)->Security.DeviceClassSet) {
935 if ((*DeviceInit)->HasName()) {
936 //
937 // Driver writer specified a name, all is good
938 //
939 DO_NOTHING();
940 }
941 else {
943
946 "Device init: has device class or SDDL set, but does not have "
947 "a name, %!STATUS!", status);
948
949 return status;
950 }
951 }
952
953 if ((*DeviceInit)->RequiresSelfIoTarget) {
954 if ((*DeviceInit)->InitType != FxDeviceInitTypeFdo) {
958 "Client called WdfDeviceInitAllowSelfTarget. Self "
959 "IO Targets are supported only for FDOs, %!STATUS!", status);
960 return status;
961 }
962 }
963
967 &pDevice);
968 if (NT_SUCCESS(status)) {
970 }
971
972 return status;
973}
974
979WDFEXPORT(WdfDeviceCreateSymbolicLink)(
980 __in
982 __in
983 WDFDEVICE Device,
984 __in
986 )
987{
988 DDI_ENTRY();
989
994
996 Device,
998 (PVOID *) &pDevice,
1000
1002
1003 if (SymbolicLinkName->Length == 0) {
1005
1007 "WDFDEVICE %p, SymbolicLinkName has no length, %!STATUS!",
1008 Device, status);
1009
1010 return status;
1011 }
1012
1014 if (!NT_SUCCESS(status)) {
1015 return status;
1016 }
1017
1019 if (!NT_SUCCESS(status)) {
1020 return status;
1021 }
1022
1025
1028 "WDFDEVICE %p already has a symbolic link associated with it, %!STATUS!",
1029 Device, status);
1030
1031 return status;
1032 }
1033
1035
1036 return status;
1037}
1038
1042STDCALL
1043WDFEXPORT(WdfDeviceQueryProperty)(
1044 __in
1046 __in
1047 WDFDEVICE Device,
1048 __in
1050 __in
1054 __out
1056 )
1057/*++
1058
1059Routine Description:
1060 Retrieves the requested device property for the given device
1061
1062Arguments:
1063 Device - the device whose PDO whose will be queried
1064
1065 DeviceProperty - the property being queried
1066
1067 BufferLength - length of PropertyBuffer in bytes
1068
1069 PropertyBuffer - Buffer which will receive the property being queried
1070
1071 ResultLength - if STATUS_BUFFER_TOO_SMALL is returned, then this will contain
1072 the required length
1073
1074Return Value:
1075 NTSTATUS
1076
1077 --*/
1078{
1079 DDI_ENTRY();
1080
1084
1086 Device,
1088 (PVOID *) &pDevice,
1090
1092 if (BufferLength > 0) {
1094 }
1095
1097 if (!NT_SUCCESS(status)) {
1098 return status;
1099 }
1100
1103
1105 "WDFDEVICE 0x%p is not a PnP device %!STATUS!",
1106 Device, status);
1107
1108 return status;
1109 }
1110
1112 NULL,
1113 pDevice,
1114 NULL,
1118 ResultLength);
1119
1121 "exit WDFDEVICE %p, Property %d, %!STATUS!",
1123
1124 return status;
1125}
1126
1130STDCALL
1131WDFEXPORT(WdfDeviceAllocAndQueryProperty)(
1132 __in
1134 __in
1135 WDFDEVICE Device,
1136 __in
1138 __in
1141 __in_opt
1143 __out
1145 )
1146/*++
1147
1148Routine Description:
1149 Allocates and retrieves the requested device property for the given device
1150
1151Arguments:
1152 Device - the pnp device whose PDO whose will be queried
1153
1154 DeviceProperty - the property being queried
1155
1156 PoolType - what type of pool to allocate
1157
1158 PropertyMemoryAttributes - attributes to associate with PropertyMemory
1159
1160 PropertyMemory - handle which will receive the property buffer
1161
1162Return Value:
1163 NTSTATUS
1164
1165 --*/
1166{
1167 DDI_ENTRY();
1168
1172
1174 Device,
1176 (PVOID *) &pDevice,
1178
1180
1182
1184 if (!NT_SUCCESS(status)) {
1185 return status;
1186 }
1187
1189
1191 if (!NT_SUCCESS(status)) {
1192 return status;
1193 }
1194
1195 if (pDevice->IsLegacy()) {
1197
1199 "WDFDEVICE %p is not a PnP device, %!STATUS!",
1200 Device, status);
1201
1202 return status;
1203 }
1204
1206 NULL,
1207 pDevice,
1208 NULL,
1210 PoolType,
1213
1215 "exit WDFDEVICE %p, Property %d, %!STATUS!",
1217
1218 return status;
1219}
1220
1222VOID
1223STDCALL
1224WDFEXPORT(WdfDeviceSetStaticStopRemove)(
1225 __in
1227 __in
1228 WDFDEVICE Device,
1229 __in
1231 )
1232{
1233 DDI_ENTRY();
1234
1236
1238 Device,
1240 (PVOID*) &pDevice);
1241
1243 //
1244 // Stoppable means that query stop / query remove can succeed.
1245 // This means m_DeviceStopCount == 0 (eventually if there are nested
1246 // calls to this function).
1247 //
1250 }
1251 else {
1253 }
1254
1255 return;
1256}
1257
1259VOID
1260STDCALL
1261WDFEXPORT(WdfDeviceSetFailed)(
1262 __in
1264 __in
1265 WDFDEVICE Device,
1266 __in
1268 )
1269{
1270 DDI_ENTRY();
1271
1274
1276 Device,
1278 (PVOID *) &pDevice,
1280
1285 "Invalid FailedAction %d", FailedAction);
1287 return;
1288 }
1289
1292 "WDFDEVICE %p, !devobj %p SetFailed %!WDF_DEVICE_FAILED_ACTION!",
1294
1296}
1297
1298__inline
1301 __in
1303 __in
1304 WDFDEVICE Device,
1305 __in
1307 __in
1308 PVOID Tag,
1309 __in
1310 LONG Line,
1311 __in
1312 PSTR File
1313 )
1314{
1318
1320 Device,
1322 (PVOID *) &pDevice,
1324
1325 if (WaitForD0) {
1328 if (!NT_SUCCESS(status)) {
1329 return status;
1330 }
1331 }
1332
1333
1338 "WDFDEVICE %p WdfDeviceStopIdle does nothing if you are not the power "
1339 "policy owner for the stack, %!STATUS!", Device, status);
1340 return status;
1341 }
1342
1344
1347 "WDFDEVICE %p WdfDeviceStopIdle, WaitForD0 %d %!STATUS!",
1349
1350 return status;
1351}
1352
1353__inline
1354VOID
1356 __in
1358 __in
1359 WDFDEVICE Device,
1360 __in
1361 PVOID Tag,
1362 __in
1363 LONG Line,
1364 __in
1365 PSTR File
1366 )
1367{
1370
1372 Device,
1374 (PVOID *) &pDevice,
1376
1380 "WdfDeviceResumeIdle does nothing if you are not the power "
1381 "policy owner for the stack");
1382 return;
1383 }
1384
1386}
1387
1392STDCALL
1393WDFEXPORT(WdfDeviceStopIdleNoTrack)(
1394 __in
1396 __in
1397 WDFDEVICE Device,
1398 __in
1400 )
1401{
1402 DDI_ENTRY();
1403
1405
1407 Device,
1408 WaitForD0,
1409 NULL,
1410 0,
1411 NULL);
1412
1413 return status;
1414}
1415
1420STDCALL
1421WDFEXPORT(WdfDeviceStopIdleActual)(
1422 __in
1424 __in
1425 WDFDEVICE Device,
1426 __in
1428 __in_opt
1430 __in
1432 __in
1434 )
1435{
1436 DDI_ENTRY();
1437
1439
1441 Device,
1442 WaitForD0,
1443 Tag,
1444 Line,
1445 File);
1446
1447 return status;
1448}
1449
1451VOID
1452STDCALL
1453WDFEXPORT(WdfDeviceResumeIdleNoTrack)(
1454 __in
1456 __in
1457 WDFDEVICE Device
1458 )
1459{
1460 DDI_ENTRY();
1461
1463 Device,
1464 NULL,
1465 0,
1466 NULL);
1467}
1468
1470VOID
1471STDCALL
1472WDFEXPORT(WdfDeviceResumeIdleActual)(
1473 __in
1475 __in
1476 WDFDEVICE Device,
1477 __in_opt
1478 PVOID Tag,
1479 __in
1480 LONG Line,
1481 __in
1482 PSTR File
1483 )
1484{
1485 DDI_ENTRY();
1486
1488 Device,
1489 Tag,
1490 Line,
1491 File);
1492}
1493
1495VOID
1496STDCALL
1497WDFEXPORT(WdfDeviceSetPnpCapabilities)(
1498 __in
1500 __in
1501 WDFDEVICE Device,
1502 __in
1504 )
1505/*++
1506
1507Routine Description:
1508 Sets the pnp capabilities of the device. This function is usually called
1509 during AddDevice or EvtDevicePrepareHardware since these values are queried
1510 by the stack and pnp during start device processing or immediately afterwards.
1511
1512Arguments:
1513 Device - Device being set
1514
1515 PnpCapabilities - Caps being set
1516
1517Return Value:
1518 None
1519
1520 --*/
1521{
1522 DDI_ENTRY();
1523
1526 ULONG i;
1527
1528 const static FxOffsetAndName offsets[] = {
1535 OFFSET_AND_NAME(WDF_DEVICE_PNP_CAPABILITIES, SurpriseRemovalOK),
1538 };
1539
1541 Device,
1543 (PVOID *) &pDevice,
1545
1547
1551 "WDFDEVICE 0x%p PnpCapabilities Size %d, expected %d",
1554
1555 return; // STATUS_INFO_LENGTH_MISMATCH;
1556 }
1557 else {
1558 for (i = 0; i < ARRAY_SIZE(offsets); i++) {
1560
1561 //
1562 // This check makes prefast happy
1563 //
1564 if (offsets[i].Offset + sizeof(WDF_TRI_STATE) >
1565 sizeof(*PnpCapabilities)) {
1566 return;
1567 }
1568
1570 offsets[i].Offset);
1571 switch (value) {
1572 case WdfFalse:
1573 case WdfTrue:
1574 case WdfUseDefault:
1575 break;
1576
1577 default:
1580 "WDFDEVICE 0x%p PnpCapabilities WDF_TRI_STATE %s value out "
1581 "of range, value is %d", Device, offsets[i].Name, value);
1583
1584 return; // STATUS_INVALID_PARAMETER
1585 }
1586 }
1587 }
1588
1590}
1591
1593VOID
1594STDCALL
1595WDFEXPORT(WdfDeviceSetPowerCapabilities)(
1596 __in
1598 __in
1599 WDFDEVICE Device,
1600 __in
1602 )
1603/*++
1604
1605Routine Description:
1606 Sets the power capabilities of the device. This function is usually called
1607 during AddDevice or EvtDevicePrepareHardware since these values are queried
1608 by the stack and power during start device processing or immediately afterwards.
1609
1610Arguments:
1611 Device - Device being set
1612
1613 PowerCapabilities - Caps being set
1614
1615Return Value:
1616 None
1617
1618 --*/
1619{
1620 DDI_ENTRY();
1621
1623 ULONG i;
1625
1626 const static FxOffsetAndName offsets[] = {
1633 };
1634
1636 Device,
1638 (PVOID *) &pDevice,
1640
1642
1644
1647 "WDFDEVICE 0x%p PowerCapabilities Size %d, expected %d",
1650
1652
1653 return; // STATUS_INFO_LENGTH_MISMATCH;
1654 }
1655 else {
1656 for (i = 0; i < ARRAY_SIZE(offsets); i++) {
1658
1659 //
1660 // This check makes prefast happy
1661 //
1662 if (offsets[i].Offset + sizeof(WDF_TRI_STATE) >
1663 sizeof(*PowerCapabilities)) {
1664 return;
1665 }
1666
1668 offsets[i].Offset);
1669 switch (value) {
1670 case WdfFalse:
1671 case WdfTrue:
1672 case WdfUseDefault:
1673 break;
1674
1675 default:
1678 "WDFDEVICE 0x%p PowerCapabilities WDF_TRI_STATE %s value out "
1679 "of range, value is %d",
1682
1683 return; // STATUS_INVALID_PARAMETER
1684 }
1685 }
1686
1687 for (i = 0; i < ARRAY_SIZE(PowerCapabilities->DeviceState); i++) {
1688 if (PowerCapabilities->DeviceState[i] < PowerDeviceUnspecified ||
1689 PowerCapabilities->DeviceState[i] > PowerDeviceMaximum) {
1690
1692 "WDFDEVICE 0x%p PowerCapabilities DeviceState is invalid",
1693 Device);
1694
1696
1697 return; // STATUS_INVALID_PARAMETER;
1698 }
1699 }
1700
1701 if (PowerCapabilities->DeviceWake < PowerDeviceUnspecified ||
1702 PowerCapabilities->DeviceWake > PowerDeviceMaximum) {
1703
1706 "WDFDEVICE 0x%p PowerCapabilities DeviceWake %d is out of range",
1707 Device, PowerCapabilities->DeviceWake);
1708
1710
1711 return; // STATUS_INVALID_PARAMETER;
1712 }
1713
1714 if (PowerCapabilities->SystemWake < PowerSystemUnspecified ||
1715 PowerCapabilities->SystemWake > PowerSystemMaximum) {
1716
1719 "WDFDEVICE 0x%p PowerCapabilities SystemWake %d is out of range",
1720 Device, PowerCapabilities->SystemWake);
1721
1723
1724 return; // STATUS_INVALID_PARAMETER;
1725 }
1726
1728 PowerCapabilities->IdealDxStateForSx != PowerDeviceMaximum) {
1731 "WDFDEVICE 0x%p PowerCapabilities IdealDxStateForSx %d can only"
1732 " be set by the power policy owner",
1733 Device, PowerCapabilities->IdealDxStateForSx);
1734
1736
1737 return; // STATUS_INVALID_PARAMETER;
1738 }
1739
1740 //
1741 // D0 is not allowed as an ideal Dx state
1742 //
1743 if (PowerCapabilities->IdealDxStateForSx < PowerDeviceD1 ||
1744 PowerCapabilities->IdealDxStateForSx > PowerDeviceMaximum) {
1745
1748 "WDFDEVICE 0x%p PowerCapabilities IdealDxStateForSx %d is out "
1749 "of range", Device, PowerCapabilities->IdealDxStateForSx);
1750
1752
1753 return; // STATUS_INVALID_PARAMETER;
1754 }
1755 }
1756
1757
1759}
1760
1764STDCALL
1765WDFEXPORT(WdfDeviceConfigureRequestDispatching)(
1766 __in
1768 __in
1769 WDFDEVICE Device,
1770 __in
1771 WDFQUEUE Queue,
1772 __in
1775 )
1776
1777/*++
1778
1779Routine Description:
1780
1781 Configure which IRP_MJ_* requests are automatically
1782 forwarded by the I/O package to the specified Queue.
1783
1784 By default the I/O package sends all requests to the
1785 devices default queue. This API allows certain requests
1786 to be specified to their own queues under driver control.
1787
1788Arguments:
1789
1790 Device - The device which is handling the IO.
1791
1792 Queue - I/O Queue object to forward specified request to.
1793
1794 RequestType - WDF Request type to be forwarded to the queue
1795
1796Returns:
1797
1798 NTSTATUS
1799
1800--*/
1801
1802{
1803 DDI_ENTRY();
1804
1809
1810 pDevice = NULL;
1811 pFxIoQueue = NULL;
1812
1814 Device,
1816 (PVOID *) &pDevice,
1818
1826 "Invalid RequestType %!WDF_REQUEST_TYPE!, %!STATUS!",
1828 return status;
1829 }
1830
1831 //
1832 // Validate the Queue handle
1833 //
1835 Queue,
1837 (PVOID*)&pFxIoQueue);
1838
1839 if (pDevice != pFxIoQueue->GetDevice()) {
1841
1844 "Input WDFQUEUE 0x%p doesn't belong to the WDFDEVICE 0x%p, %!STATUS!",
1845 Queue, Device, status);
1846
1847 return status;
1848 }
1849
1850 if (pDevice->IsLegacy()) {
1851 //
1852 // This is a controldevice. Make sure the create is called after the device
1853 // is initialized and ready to accept I/O.
1854 //
1856 if ((deviceObject.GetFlags() & DO_DEVICE_INITIALIZING) == 0x0) {
1857
1861 "Queue cannot be configured for automatic dispatching"
1862 " after WdfControlDeviceFinishInitializing"
1863 "is called on the WDFDEVICE %p is called %!STATUS!",
1864 Device,
1865 status);
1866 return status;
1867 }
1868 }
1869 else {
1870 //
1871 // This is either FDO or PDO. Make sure it's not started yet.
1872 //
1877 "Queue cannot be configured for automatic dispatching"
1878 "after the WDFDEVICE %p is started, %!STATUS!",
1879 Device, status);
1880 return status;
1881 }
1882 }
1883
1886 }
1887 else {
1889 }
1890
1891 return status;
1892}
1893
1895WDFQUEUE
1896STDCALL
1897WDFEXPORT(WdfDeviceGetDefaultQueue)(
1898 __in
1900 __in
1901 WDFDEVICE Device
1902 )
1903
1904/*++
1905
1906Routine Description:
1907
1908 Return the handle to the default queue for the device.
1909
1910Arguments:
1911
1912 Device - Handle to the Device Object
1913
1914Returns:
1915
1916 WDFQUEUE
1917
1918--*/
1919
1920{
1921 DDI_ENTRY();
1922
1927
1928 pPkgIo = NULL;
1929 pFxIoQueue = NULL;
1930
1931 //
1932 // Validate the I/O Package handle, and get the FxPkgIo*
1933 //
1935 Device,
1937 (PVOID *) &pFxDevice,
1939
1942
1943 //
1944 // A default queue is optional
1945 //
1948 "No default Queue configured "
1949 "for Device 0x%p", Device);
1950 return NULL;
1951 }
1952
1953 return (WDFQUEUE)pFxIoQueue->GetObjectHandle();;
1954}
1955
1959STDCALL
1960WDFEXPORT(WdfDeviceEnqueueRequest)(
1961 __in
1963 __in
1964 WDFDEVICE Device,
1965 __in
1966 WDFREQUEST Request
1967 )
1968
1969/*++
1970
1971Routine Description:
1972
1973 Inserts a request into the I/O Package processing pipeline.
1974
1975 The given request is processed by the I/O package, forwarding
1976 it to its configured destination or the default queue.
1977
1978 If an EvtIoInCallerContext is callback is registered, it is not called.
1979
1980Arguments:
1981
1982 Device - Handle to the Device Object
1983
1984 Request - Request to insert in the processing pipeline
1985
1986Return Value:
1987
1988 STATUS_SUCCESS - Request has been inserted into the I/O processing pipeline
1989
1990 !NT_SUCCESS(status)
1991 STATUS_WDF_BUSY - Device is not accepting requests, the driver still owns the
1992 the request and must complete it, or correct the conditions.
1993
1994--*/
1995
1996{
1997 DDI_ENTRY();
1998
2002
2003 //
2004 // Validate the device object handle
2005 //
2007 Device,
2009 (PVOID *) &pDevice,
2011 //
2012 // Validate Device object handle
2013 //
2015 Device,
2017 (PVOID *) &pDevice);
2018
2019 //
2020 // Validate the request object handle
2021 //
2023 Request,
2025 (PVOID *) &pRequest);
2026
2027 //
2028 // Dispatch it to the Io Package object
2029 //
2031}
2032
2035STDCALL
2036WDFEXPORT(WdfDeviceGetSystemPowerAction)(
2037 __in
2039 __in
2040 WDFDEVICE Device
2041 )
2042
2043/*++
2044
2045Routine Description:
2046
2047 This DDI returns the System power action.
2048
2049 If the DDI is called in the power down path of a device, it will return the
2050 current system power transition type because of which the device is powering
2051 down. If the DDI is called in the power up path of a device, it will return
2052 the system power transition type which initially put the device into a lower
2053 power state. If the DDI is called during the normal functioning of a device
2054 that is not undergoing a power state transition, or if the device is powering
2055 up as part of the system start up, the DDI will return the PowerActionNone
2056 value.
2057
2058Arguments:
2059
2060 Device - Handle to the Device Object
2061
2062Return Value:
2063
2064 Returns a POWER_ACTION enum value that represents the current system power
2065 action with regards to any system power transition underway.
2066
2067--*/
2068
2069{
2070 DDI_ENTRY();
2071
2073
2074 //
2075 // Validate Device object handle
2076 //
2078 Device,
2080 (PVOID*) &pDevice);
2081
2083}
2084
2087WDFAPI
2089STDCALL
2090WDFEXPORT(WdfDeviceQueryPropertyEx)(
2091 _In_
2093 _In_
2094 WDFDEVICE Device,
2095 _In_
2097 _In_
2099 _Out_
2101 _Out_
2103 _Out_
2105 )
2106/*++
2107
2108Routine Description:
2109
2110 This routine queries interface property.
2111
2112Arguments:
2113
2114 DriverGlobals - DriverGlobals pointer
2115
2116 Device - WDF Device handle.
2117
2118 DeviceProperty - A pointer to WDF_DEVICE_PROPERTY_ DATA structure.
2119
2120 BufferLength - The size, in bytes, of the buffer that is pointed to by
2121 PropertyBuffer.
2122
2123 PropertyBuffer - A caller-supplied pointer to a caller-allocated buffer that
2124 receives the requested information. The pointer can be NULL
2125 if the BufferLength parameter is zero.
2126
2127 ResultLength - A caller-supplied location that, on return, contains the
2128 size, in bytes, of the information that the method stored in
2129 PropertyBuffer. If the function's return value is
2130 STATUS_BUFFER_TOO_SMALL, this location receives the required
2131 buffer size.
2132
2133 Type - A pointer to a DEVPROPTYPE variable. If method successfully retrieves
2134 the property data, the routine writes the property type value
2135 to this variable. This value indicates the type of property
2136 data that is in the Data buffer.
2137
2138Return Value:
2139
2140 Method returns an NTSTATUS value. This routine might return one of the
2141 following values.
2142
2143 STATUS_BUFFER_TOO_SMALL - The supplied buffer is too small to receive the
2144 information. The ResultLength member receives the
2145 size of buffer required.
2146 STATUS_SUCCESS - The operation succeeded.
2147 STATUS_INVALID_PARAMETER - One of the parameters is incorrect.
2148
2149 The method might return other NTSTATUS values.
2150
2151--*/
2152
2153{
2154 DDI_ENTRY();
2155
2159
2161 Device,
2163 (PVOID *) &pDevice,
2165
2167
2168 //
2169 // Validate PropertyData
2170 //
2174 "PropertyData size (%d) incorrect, expected %d, %!STATUS!",
2175 DeviceProperty->Size,
2177 return status;
2178 }
2179
2181 if (!NT_SUCCESS(status)) {
2183 return status;
2184 }
2185
2188
2192 "Property buffer size is non-zero, while the buffer is NULL"
2193 ", %!STATUS!", status);
2194 return status;
2195 }
2196
2200 "Property buffer size is zero, while the buffer is non-NULL"
2201 ", %!STATUS!", status);
2202 return status;
2203 }
2204
2206 NULL,
2207 pDevice,
2213 Type);
2214 return status;
2215}
2216
2219WDFAPI
2221STDCALL
2222WDFEXPORT(WdfDeviceAllocAndQueryPropertyEx)(
2223 _In_
2225 _In_
2226 WDFDEVICE Device,
2227 _In_
2229 _In_
2232 _In_opt_
2234 _Out_
2235 WDFMEMORY* PropertyMemory,
2236 _Out_
2238 )
2239/*++
2240
2241Routine Description:
2242
2243 This routine queries device property.
2244
2245Arguments:
2246
2247 DriverGlobals - DriverGlobals pointer
2248
2249 Device - WDF Device handle.
2250
2251 PropertyData - A pointer to WDF_DEVICE_PROPERTY_ DATA structure.
2252
2253 PoolType - A POOL_TYPE-typed enumerator that specifies the type of memory
2254 to be allocated.
2255
2256 PropertyMemoryAttributes - optional, A pointer to a caller-allocated
2257 WDF_OBJECT_ATTRIBUTES structure that describes object attributes
2258 for the memory object that the function will allocate. This
2259 parameter is optional and can be WDF_NO_OBJECT_ATTRIBUTES.
2260
2261 PropertyMemory - A pointer to a WDFMEMORY-typed location that receives a
2262 handle to a framework memory object.
2263
2264 Type - A pointer to a DEVPROPTYPE variable. If method successfully retrieves
2265 the property data, the routine writes the property type value to
2266 this variable. This value indicates the type of property data
2267 that is in the Data buffer.
2268
2269Return Value:
2270
2271 Method returns an NTSTATUS value. This routine might return one of the
2272 following values. It might return other NTSTATUS-codes as well.
2273
2274 STATUS_SUCCESS The operation succeeded.
2275 STATUS_INVALID_PARAMETER One of the parameters is incorrect.
2276
2277--*/
2278{
2279 DDI_ENTRY();
2280
2284
2286 Device,
2288 (PVOID *) &pDevice,
2290
2292
2293 //
2294 // Validate PropertyData
2295 //
2296 if (DeviceProperty->Size != sizeof(WDF_DEVICE_PROPERTY_DATA)) {
2299 "PropertyData size (%d) incorrect, expected %d, %!STATUS!",
2300 DeviceProperty->Size,
2302 return status;
2303 }
2304
2306 if (!NT_SUCCESS(status)) {
2308 return status;
2309 }
2310
2312
2315
2317
2319 if (!NT_SUCCESS(status)) {
2320 return status;
2321 }
2322
2324 NULL,
2325 pDevice,
2328 PoolType,
2331 Type);
2332 return status;
2333}
2334
2337WDFAPI
2339STDCALL
2340WDFEXPORT(WdfDeviceAssignProperty)(
2341 _In_
2343 _In_
2344 WDFDEVICE Device,
2345 _In_
2347 _In_
2349 _In_
2351 _In_opt_
2353 )
2354/*++
2355
2356Routine Description:
2357
2358 This routine assigns interface property.
2359
2360Arguments:
2361
2362 DriverGlobals - DriverGlobals pointer
2363
2364 Device - WDF Device handle.
2365
2366 PropertyData - A pointer to WDF_DEVICE_PROPERTY_ DATA structure.
2367
2368 Type - Set this parameter to the DEVPROPTYPE value that specifies the type
2369 of the data that is supplied in the Data buffer.
2370
2371 BufferLength - Specifies the length, in bytes, of the buffer that
2372 PropertyBuffer points to.
2373
2374 PropertyBuffer - optional, A pointer to the device interface property data.
2375 Set this parameter to NULL to delete the specified property.
2376
2377Return Value:
2378
2379 Mthod returns an NTSTATUS value. This routine might return one of the
2380 following values. It might return other NTSTATUS-codes as well.
2381
2382 STATUS_SUCCESS - The operation succeeded.
2383 STATUS_INVALID_PARAMETER - One of the parameters is incorrect.
2384
2385--*/
2386
2387{
2388 DDI_ENTRY();
2389
2393
2394 //
2395 // Validate the Device object handle and get its FxDevice. Also get the
2396 // driver globals pointer.
2397 //
2399 Device,
2401 (PVOID *) &pDevice,
2403
2405
2406 //
2407 // Validate PropertyData
2408 //
2409 if (DeviceProperty->Size != sizeof(WDF_DEVICE_PROPERTY_DATA)) {
2412 "PropertyData size (%d) incorrect, expected %d, %!STATUS!",
2413 DeviceProperty->Size,
2415 return status;
2416 }
2417
2419 if (!NT_SUCCESS(status)) {
2421 return status;
2422 }
2423
2424 if (BufferLength == 0 && PropertyBuffer != NULL) {
2427 "Property buffer size is zero, while the buffer is non-NULL"
2428 ", %!STATUS!", status);
2429 return status;
2430 }
2431
2434 Type,
2437 );
2438 return status;
2439}
2440
2443WDFAPI
2445STDCALL
2446WDFEXPORT(WdfDeviceConfigureWdmIrpDispatchCallback)(
2447 _In_
2449 _In_
2450 WDFDEVICE Device,
2451 _In_opt_
2452 WDFDRIVER Driver,
2453 _In_
2455 _In_
2457 _In_opt_
2459 )
2460
2461/*++
2462
2463 Routine Description:
2464
2465 Configure callbacks for IRP_MJ_READ, IRP_MJ_WRITE, IRP_MJ_DEVICE_CONTROL, and
2466 IRP_MJ_INTERNAL_DEVICE_CONTROL (KMDF only). By default the I/O package sends all requests to
2467 a device's default queue, or to the queues configured with
2468 WdfDeviceConfigureRequestDisaptching. This DDI allows a driver specified
2469 callback to select a different queue dynamically during runtime.
2470
2471 Arguments:
2472
2473 Device - The device which is handling the I/O.
2474
2475 Driver - An optional driver handle. Used to associate the
2476 callback with a specific class extension.
2477
2478 MajorFunction - IRP major function type to be forwarded to the callback
2479
2480 EvtDeviceWdmIrpDispatch - Callback invoked when encountering the given major function.
2481
2482 DriverContext - An optional untyped driver specified context.
2483
2484 Returns:
2485
2486 STATUS_SUCCESS on success
2487 STATUS_INVALID_PARAMETER if an incorrect MajorFunction was provided
2488 STATUS_INSUFFICIENT_RESOURCES if insufficient memory was available
2489 STATUS_INVALID_DEVICE_STATE if this DDI was called at an improper time
2490
2491 --*/
2492{
2498
2499 pDevice = NULL;
2501
2503 Device,
2505 (PVOID *) &pDevice,
2507
2508 //
2509 // Validate the MajorFunction provided. Note that
2510 // IRP_MJ_INTERNAL_DEVICE_CONTROL is KMDF only.
2511 //
2512 switch (MajorFunction) {
2513 case IRP_MJ_WRITE:
2514 case IRP_MJ_READ:
2516#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
2518#endif
2519 break;
2520 default:
2524 "Invalid MajorFunction provided %!IRPMJ!, %!STATUS!",
2526 goto exit;
2527 }
2528
2529 //
2530 // Validate the driver handle and get (if present) the associated cx info.
2531 //
2532 if (Driver != NULL) {
2534
2536 Driver,
2538 (PVOID*)&pDriver);
2539
2540 //
2541 // Find the driver's cx info if it's not the main driver for this device.
2542 // cx struct info can be NULL if cx acts as client driver.
2543 //
2545 }
2546
2547 //
2548 // Make sure callback is not null.
2549 //
2551
2552 //
2553 // This callback can only be called during initialization.
2554 //
2555 if (pDevice->IsLegacy()) {
2556
2557 //
2558 // Extract the device flags from the device object
2559 //
2560#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
2562#else
2563 deviceFlags = pDevice->GetDeviceObject()->GetDeviceObjectWdmFlags();
2564#endif
2565
2566 //
2567 // This is a controldevice. Make sure the create is called after the device
2568 // is initialized and ready to accept I/O.
2569 //
2570 if ((deviceFlags & DO_DEVICE_INITIALIZING) == 0x0) {
2574 "Driver cannot set IRP dispatch callback "
2575 "after WdfControlDeviceFinishInitializing "
2576 "is called on the WDFDEVICE %p, %!STATUS!",
2577 pDevice, status);
2578 goto exit;
2579 }
2580 } else {
2581 //
2582 // This is either FDO or PDO. Make sure it's not started yet.
2583 //
2588 "Driver cannot set IRP dispatch callback "
2589 "after the WDFDEVICE %p is started, %!STATUS!",
2590 pDevice, status);
2591 goto exit;
2592 }
2593 }
2594
2595 //
2596 // Let I/O package do the rest.
2597 //
2603 return status;
2604}
2605
2609 _In_ PFX_DRIVER_GLOBALS FxDriverGlobals,
2611 _In_ MdIrp Irp,
2614 )
2615{
2617 UCHAR majorFunction, minorFunction;
2618 FxIrp fxIrp(Irp);
2619
2621
2623 minorFunction = fxIrp.GetMinorFunction();
2624
2626 FxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIO,
2627 "WDFDEVICE 0x%p !devobj 0x%p %!IRPMJ!, IRP_MN %x, IRP 0x%p",
2628 device->GetHandle(), device->GetDeviceObject(),
2629 majorFunction, minorFunction, Irp);
2630
2631 //
2632 // Validate Flags. For UMDF, this field is reserved and must be zero.
2633 //
2634#if (FX_CORE_MODE == FX_CORE_KERNEL_MODE)
2636#else
2638#endif
2641 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIO,
2642 "Flags 0x%x are invalid, %!STATUS!",
2643 Flags, status);
2644 FxVerifierDbgBreakPoint(FxDriverGlobals);
2645 goto Done;
2646 }
2647
2648 //
2649 // Only read/writes/ctrls/internal_ctrls IRPs are allowed, i.e., the I/O request set.
2650 //
2651 if (device->GetDispatchPackage(majorFunction) != device->m_PkgIo) {
2654 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIO,
2655 "Only Read/Write/Control/Internal-Control IRPs can be "
2656 "forwarded to I/O Queue 0x%p, Irp 0x%p, %!IRPMJ!, "
2657 "IRP_MN %x, Device 0x%p, %!STATUS!",
2658 queue->GetHandle(), Irp, majorFunction, minorFunction,
2659 device->GetObjectHandle(), status);
2660 FxVerifierDbgBreakPoint(FxDriverGlobals);
2661 goto Done;
2662 }
2663
2664 //
2665 // Make sure queue can handle the request.
2666 //
2667 if (FALSE == queue->IsIoEventHandlerRegistered(
2669
2672 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIO,
2673 "I/O Queue 0x%p cannot handle Irp 0x%p, %!IRPMJ!, "
2674 "IRP_MN %x, Device 0x%p, %!STATUS!",
2675 queue->GetHandle(), Irp, majorFunction, minorFunction,
2676 device->GetObjectHandle(), status);
2677 FxVerifierDbgBreakPoint(FxDriverGlobals);
2678 goto Done;
2679 }
2680
2681 if (device->m_ParentDevice == queue->GetDevice()) {
2682 //
2683 // Send to parent device's queue validation.
2684 //
2685 if (device->m_ParentDevice == NULL) {
2688 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIO,
2689 "No parent device for Device 0x%p, %!STATUS!",
2690 device->GetObjectHandle(), status);
2691 FxVerifierDbgBreakPoint(FxDriverGlobals);
2692 goto Done;
2693 }
2694
2695 //
2696 // Make sure the child device is a PDO
2697 //
2698 ASSERT(device->IsPdo());
2699
2700 //
2701 // Check if the WdfPdoInitSetForwardRequestToParent was called to
2702 // increase the StackSize of the child Device to include the stack
2703 // size of the parent Device
2704 //
2705 if (device->IsPnp() &&
2706 device->GetPdoPkg()->m_AllowForwardRequestToParent == FALSE) {
2709 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIO,
2710 "WdfPdoInitSetForwardRequestToParent not called on "
2711 "Device 0x%p, %!STATUS!",
2712 device->GetObjectHandle(), status);
2713 FxVerifierDbgBreakPoint(FxDriverGlobals);
2714 goto Done;
2715 }
2716 }
2717 else {
2718 //
2719 // Send to current device's queue validation.
2720 //
2721 if (device != queue->GetDevice()) {
2724 FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGIO,
2725 "Cannot forward a request to "
2726 "a different Device 0x%p, %!STATUS!",
2727 queue->GetDevice()->GetObjectHandle(), status);
2728 FxVerifierDbgBreakPoint(FxDriverGlobals);
2729 goto Done;
2730 }
2731 }
2732
2733Done:
2734 return status;
2735}
2736
2737} // extern "C"
unsigned char BOOLEAN
Type
Definition: Type.h:7
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
LONG NTSTATUS
Definition: precomp.h:26
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
Definition: File.h:16
virtual FxIoTarget * GetDefaultIoTarget(VOID)
Definition: fxdevice.hpp:438
__inline FxDriver * GetDriver(VOID)
Definition: fxdevice.hpp:164
WDFDEVICE __inline GetHandle(VOID)
Definition: fxdevice.hpp:237
MdDeviceObject __inline GetDeviceObject(VOID)
Definition: fxdevice.hpp:174
static _Must_inspect_result_ NTSTATUS _QueryProperty(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_opt_ MdDeviceObject RemotePdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ ULONG BufferLength, _Out_opt_ PVOID PropertyBuffer, _Out_opt_ PULONG ResultLength)
Definition: fxdevicekm.cpp:939
NTSTATUS CreateSymbolicLink(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ PCUNICODE_STRING SymbolicLinkName)
Definition: fxdevicekm.cpp:513
UNICODE_STRING m_DeviceName
Definition: fxdevice.hpp:578
FxCxDeviceInfo * GetCxDeviceInfo(__in FxDriver *CxDriver)
Definition: fxdevice.hpp:1560
static _Must_inspect_result_ NTSTATUS _QueryPropertyEx(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ ULONG BufferLength, _Out_ PVOID PropertyBuffer, _Out_ PULONG ResultLength, _Out_ PDEVPROPTYPE PropertyType)
Definition: fxdevicekm.cpp:859
__inline WDF_DEVICE_POWER_POLICY_STATE GetDevicePowerPolicyState()
Definition: fxdevice.hpp:1165
FxPkgPnp * m_PkgPnp
Definition: fxdevice.hpp:670
VOID InvalidateDeviceState(VOID)
FxPkgGeneral * m_PkgGeneral
Definition: fxdevice.hpp:671
FxIoTargetSelf * GetSelfIoTarget(VOID)
Definition: fxdevice.cpp:1831
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDFDEVICE_INIT *DeviceInit, __in_opt PWDF_OBJECT_ATTRIBUTES DeviceAttributes, __out FxDevice **Device)
Definition: fxdevice.cpp:366
__inline WDF_DEVICE_POWER_STATE GetDevicePowerState()
Definition: fxdevice.hpp:1157
_Must_inspect_result_ NTSTATUS AssignProperty(_In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ DEVPROPTYPE Type, _In_ ULONG BufferLength, _In_opt_ PVOID PropertyBuffer)
Definition: fxdevicekm.cpp:668
__inline BOOLEAN IsLegacy(VOID)
Definition: fxdevice.hpp:1209
FxPkgIo * m_PkgIo
Definition: fxdevice.hpp:669
static _Must_inspect_result_ NTSTATUS _AllocAndQueryProperty(_In_ PFX_DRIVER_GLOBALS Globals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_opt_ MdDeviceObject RemotePdo, _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty, _In_ POOL_TYPE PoolType, _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, _Out_ WDFMEMORY *PropertyMemory)
Definition: fxdevice.cpp:1988
UNICODE_STRING m_SymbolicLinkName
Definition: fxdevice.hpp:580
static _Must_inspect_result_ NTSTATUS _AllocAndQueryPropertyEx(_In_ PFX_DRIVER_GLOBALS DriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ PVOID PropertyData, _In_ FxPropertyType FxPropertyType, _In_ POOL_TYPE PoolType, _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes, _Out_ WDFMEMORY *PropertyMemory, _Out_ PDEVPROPTYPE PropertyType)
Definition: fxdevice.cpp:2063
_Must_inspect_result_ NTSTATUS OpenDevicemapKeyWorker(_In_ PFX_DRIVER_GLOBALS pFxDriverGlobals, _In_ PCUNICODE_STRING KeyName, _In_ ACCESS_MASK DesiredAccess, _In_ FxRegKey *pKey)
Definition: fxdevicekm.cpp:995
static _Must_inspect_result_ NTSTATUS _OpenKey(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_opt_ PWDFDEVICE_INIT DeviceInit, _In_opt_ FxDevice *Device, _In_ ULONG DeviceInstanceKeyType, _In_ ACCESS_MASK DesiredAccess, _In_opt_ PWDF_OBJECT_ATTRIBUTES KeyAttributes, _Out_ WDFKEY *Key)
Definition: fxdevicekm.cpp:731
__inline WDF_DEVICE_PNP_STATE GetDevicePnpState()
Definition: fxdevice.hpp:1149
__inline WDFDRIVER GetHandle(VOID)
Definition: fxdriver.hpp:202
__inline CfxDevice * GetDevice(VOID)
Definition: fxioqueue.hpp:773
WDFIOTARGET GetHandle(VOID)
Definition: fxiotarget.hpp:307
Definition: fxirp.hpp:28
UCHAR GetMajorFunction(VOID)
Definition: fxirpum.cpp:217
UCHAR GetMinorFunction(VOID)
Definition: fxirpum.cpp:297
PVOID __inline GetObjectHandle(VOID)
Definition: fxobject.hpp:603
VOID SetDeviceBase(__in CfxDeviceBase *DeviceBase)
Definition: fxobject.hpp:797
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition: fxobject.hpp:734
VOID DeleteFromFailedCreate(VOID)
Definition: fxobject.cpp:391
_Must_inspect_result_ NTSTATUS Commit(__in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __out_opt WDFOBJECT *ObjectHandle, __in_opt FxObject *Parent=NULL, __in BOOLEAN AssignDriverAsDefaultParent=TRUE)
Definition: fxobject.cpp:904
_Must_inspect_result_ NTSTATUS ConfigureForwarding(__in FxIoQueue *FxQueue)
_Must_inspect_result_ NTSTATUS ConfigureForwarding(__inout FxIoQueue *TargetQueue, __in WDF_REQUEST_TYPE RequestType)
Definition: fxpkgio.cpp:910
_Must_inspect_result_ NTSTATUS EnqueueRequest(__in CfxDevice *Device, __inout FxRequest *pRequest)
Definition: fxpkgio.cpp:607
__inline FxIoQueue * GetDefaultQueue(VOID)
Definition: fxpkgio.hpp:243
_Must_inspect_result_ NTSTATUS ConfigureDynamicDispatching(__in UCHAR MajorFunction, __in_opt FxCxDeviceInfo *CxDeviceInfo, __in PFN_WDFDEVICE_WDM_IRP_DISPATCH EvtDeviceWdmIrpDispatch, __in_opt WDFCONTEXT DriverContext)
Definition: fxpkgio.cpp:786
_Must_inspect_result_ NTSTATUS __inline PowerReference(__in BOOLEAN WaitForD0, __in_opt PVOID Tag=NULL, __in_opt LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxpkgpnp.hpp:3486
BOOLEAN IsPowerPolicyOwner(VOID)
Definition: fxpkgpnp.hpp:3612
VOID SetPowerCaps(__in PWDF_DEVICE_POWER_CAPABILITIES PowerCapabilities)
Definition: fxpkgpnp.cpp:5683
VOID SetPnpCaps(__in PWDF_DEVICE_PNP_CAPABILITIES PnpCapabilities)
Definition: fxpkgpnp.cpp:5496
VOID __inline PowerDereference(__in_opt PVOID Tag=NULL, __in_opt LONG Line=0, __in_opt PSTR File=NULL)
Definition: fxpkgpnp.hpp:3498
VOID GetPnpState(__out PWDF_DEVICE_STATE State)
Definition: fxpkgpnp.cpp:5549
POWER_ACTION GetSystemPowerAction(VOID)
Definition: fxpkgpnp.hpp:3768
NTSTATUS PowerPolicySetS0IdleSettings(__in PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings)
Definition: fxpkgpnp.cpp:2778
VOID SetPnpState(__in PWDF_DEVICE_STATE State)
Definition: fxpkgpnp.cpp:5579
ULONG m_DeviceStopCount
Definition: fxpkgpnp.hpp:4146
VOID SetDeviceFailed(__in WDF_DEVICE_FAILED_ACTION FailedAction)
Definition: fxpkgpnp.cpp:3775
NTSTATUS PowerPolicySetSxWakeSettings(__in PWDF_DEVICE_POWER_POLICY_WAKE_SETTINGS Settings, __in BOOLEAN ArmForWakeIfChildrenAreArmedForWake, __in BOOLEAN IndicateChildWakeOnParentWake)
Definition: fxpkgpnp.cpp:3245
_Must_inspect_result_ NTSTATUS Assign(__in PCWSTR SourceString)
Definition: fxstring.cpp:57
__inline VOID SetObject(__in_opt MdDeviceObject DeviceObject)
ULONG GetAlignmentRequirement(VOID)
VOID SetAlignmentRequirement(_In_ ULONG Value)
VOID SetCharacteristics(ULONG Characteristics)
ULONG GetFlags(VOID)
ULONG GetCharacteristics(VOID)
Definition: _queue.h:67
_In_ PIRP Irp
Definition: csq.h:116
#define __in
Definition: dbghelp.h:35
#define __inout
Definition: dbghelp.h:50
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define TRACINGIO
Definition: dbgtrace.h:66
#define TRACINGPNP
Definition: dbgtrace.h:67
#define TRACINGDEVICE
Definition: dbgtrace.h:58
ULONG DEVPROPTYPE
Definition: devpropdef.h:24
ULONG * PDEVPROPTYPE
Definition: devpropdef.h:24
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define __drv_when(cond, annotes)
Definition: driverspecs.h:335
#define _IRQL_requires_max_(irql)
Definition: driverspecs.h:230
#define __drv_maxIRQL(irql)
Definition: driverspecs.h:291
#define __drv_strictTypeMatch(mode)
Definition: driverspecs.h:330
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
@ Removed
Definition: fbtusb.h:86
#define FX_DISPATCH_IRP_TO_IO_QUEUE_FLAGS_MASK
Definition: fxdevice.hpp:93
@ FxDeviceProperty
Definition: fxdevice.hpp:86
__in WDFDEVICE __in PWDF_DEVICE_POWER_CAPABILITIES PowerCapabilities
__in WDFDEVICE __in ULONG AlignmentRequirement
_Must_inspect_result_ __inout PWDFDEVICE_INIT __in_opt PWDF_OBJECT_ATTRIBUTES DeviceAttributes
static const FxOffsetAndName offsets[]
ULONG i
_Must_inspect_result_ NTSTATUS FX_VF_FUNCTION() VerifyWdfDeviceWdmDispatchIrpToIoQueue(_In_ PFX_DRIVER_GLOBALS FxDriverGlobals, _In_ FxDevice *device, _In_ MdIrp Irp, _In_ FxIoQueue *queue, _In_ ULONG Flags)
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGPNP, "Device name for WDFDEVICE 0x%p is NULL. Possibly incorrect " "device handle was passed, %!STATUS!", Device, status)
return NULL
__in WDFDEVICE Device
Definition: fxdeviceapi.cpp:68
_Must_inspect_result_ __in WDFDEVICE __in WDFSTRING String
__in WDFDEVICE __in BOOLEAN Stoppable
FxCxDeviceInfo * pCxDeviceInfo
_Must_inspect_result_ __in WDFDEVICE __in ULONG __in ACCESS_MASK __in_opt PWDF_OBJECT_ATTRIBUTES KeyAttributes
__inline NTSTATUS StopIdleWorker(__in PWDF_DRIVER_GLOBALS DriverGlobals, __in WDFDEVICE Device, __in BOOLEAN WaitForD0, __in PVOID Tag, __in LONG Line, __in PSTR File)
_Must_inspect_result_ __in WDFDEVICE __in ULONG DeviceInstanceKeyType
__in WDFDEVICE __in ULONG DeviceCharacteristics
__in WDFDEVICE __out PWDF_DEVICE_STATE DeviceState
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *) &pDevice)
NTSTATUS status
__inline VOID ResumeIdleWorker(__in PWDF_DRIVER_GLOBALS DriverGlobals, __in WDFDEVICE Device, __in PVOID Tag, __in LONG Line, __in PSTR File)
MxDeviceObject deviceObject
BOOLEAN indicateChildWakeOnParentWake
ULONG deviceFlags
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ __in WDFDEVICE __in DEVICE_REGISTRY_PROPERTY __in ULONG __out PULONG ResultLength
__in WDFDEVICE __in WDF_DEVICE_FAILED_ACTION FailedAction
_Must_inspect_result_ __in WDFDEVICE __in PCUNICODE_STRING SymbolicLinkName
_Must_inspect_result_ __in WDFDEVICE __in PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
FxString * pString
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ WDFDRIVER _In_ UCHAR _In_ PFN_WDFDEVICE_WDM_IRP_DISPATCH _In_opt_ WDFCONTEXT DriverContext
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
_Must_inspect_result_ __in WDFDEVICE __in DEVICE_REGISTRY_PROPERTY DeviceProperty
_Must_inspect_result_ __in WDFDEVICE __in BOOLEAN __in_opt PVOID __in LONG __in PSTR File
__in WDFDEVICE __in PWDF_DEVICE_PNP_CAPABILITIES PnpCapabilities
FxIoQueue * pFxIoQueue
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Device, FX_TYPE_DEVICE,(PVOID *) &pDevice, &pFxDriverGlobals)
FxRegKey * pKey
FxDevice * pDevice
Definition: fxdeviceapi.cpp:71
FxDevice * pFxDevice
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
_Must_inspect_result_ __in WDFDEVICE __in ULONG __in ACCESS_MASK __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFKEY * Key
FxRequest * pRequest
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ WDFDRIVER _In_ UCHAR MajorFunction
FxVerifierCheckNxPoolType(pFxDriverGlobals, PoolType, pFxDriverGlobals->Tag)
FxAutoString pdoName
WDFKEY keyHandle
_Must_inspect_result_ __inout PWDFDEVICE_INIT * DeviceInit
_Must_inspect_result_ __in WDFDEVICE __in BOOLEAN WaitForD0
_Must_inspect_result_ __in WDFDEVICE __in DEVICE_REGISTRY_PROPERTY __in ULONG BufferLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ WDFDRIVER Driver
_Must_inspect_result_ __in WDFDEVICE __in WDFQUEUE Queue
_Must_inspect_result_ __in WDFDEVICE __in ULONG __in ACCESS_MASK DesiredAccess
_Must_inspect_result_ __in WDFDEVICE __in DEVICE_REGISTRY_PROPERTY __in __in_opt PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes
BOOLEAN armForWakeIfChildrenAreArmedForWake
FxPkgIo * pPkgIo
_Must_inspect_result_ __in WDFDEVICE __in BOOLEAN __in_opt PVOID __in LONG Line
#define OFFSET_AND_NAME(type, offset)
Definition: fxdeviceapi.cpp:37
_Must_inspect_result_ __in WDFDEVICE __in DEVICE_REGISTRY_PROPERTY __in __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFMEMORY * PropertyMemory
_Must_inspect_result_ __in WDFDEVICE __in WDFREQUEST Request
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG _Out_ PDEVPROPTYPE Type
_Must_inspect_result_ _In_ WDFDEVICE _In_opt_ WDFDRIVER _In_ UCHAR _In_ PFN_WDFDEVICE_WDM_IRP_DISPATCH EvtDeviceWdmIrpDispatch
_Must_inspect_result_ __in WDFDEVICE __in BOOLEAN __in_opt PVOID Tag
FxDeviceBase * pDeviceBase
Definition: fxdeviceapi.cpp:98
PFX_DRIVER_GLOBALS pFxDriverGlobals
FxIrp fxIrp(Irp)
@ FxDeviceInitTypeFdo
FxDriver * pDriver
FxVerifierDbgBreakPoint(pFxDriverGlobals)
DriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#define FX_VF_FUNCTION(fnName)
Definition: fxmacros.hpp:47
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
UCHAR majorFunction
@ FX_TYPE_DEVICE
Definition: fxtypes.h:47
@ FX_TYPE_QUEUE
Definition: fxtypes.h:48
@ FX_TYPE_REQUEST
Definition: fxtypes.h:53
@ FX_TYPE_DRIVER
Definition: fxtypes.h:46
@ FX_TYPE_STRING
Definition: fxtypes.h:52
@ FX_TYPE_DEVICE_BASE
Definition: fxtypes.h:83
@ FX_VALIDATE_OPTION_SYNCHRONIZATION_SCOPE_ALLOWED
@ FX_VALIDATE_OPTION_EXECUTION_LEVEL_ALLOWED
@ FX_VALIDATE_OPTION_PARENT_NOT_ALLOWED
_Must_inspect_result_ NTSTATUS __inline FxValidateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING String)
_Must_inspect_result_ NTSTATUS FxValidateObjectAttributes(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
__inline NTSTATUS FxVerifierCheckIrqlLevel(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in KIRQL Irql)
Definition: fxverifier.h:158
#define ASSERT(a)
Definition: mode.c:44
@ Disabled
Definition: mountmgr.h:178
#define DO_NOTHING()
Definition: mxgeneral.h:32
IWudfIrp * MdIrp
Definition: mxum.h:103
#define _Must_inspect_result_
Definition: no_sal2.h:62
#define _Out_
Definition: no_sal2.h:160
#define _Strict_type_match_
Definition: no_sal2.h:406
#define _In_
Definition: no_sal2.h:158
#define _In_opt_
Definition: no_sal2.h:212
ULONG ACCESS_MASK
Definition: nt_native.h:40
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
@ PowerSystemMaximum
Definition: ntpoapi.h:42
@ PowerSystemUnspecified
Definition: ntpoapi.h:35
POWER_ACTION
Definition: ntpoapi.h:122
@ PowerDeviceD1
Definition: ntpoapi.h:50
@ PowerDeviceUnspecified
Definition: ntpoapi.h:48
@ PowerDeviceMaximum
Definition: ntpoapi.h:53
#define STATUS_INVALID_SECURITY_DESCR
Definition: ntstatus.h:357
long LONG
Definition: pedump.c:60
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
#define __out_bcount_full(size)
Definition: sal_old.h:277
#define __nullterminated
Definition: sal_old.h:272
@ Failed
Definition: arc.h:79
@ Removable
Definition: arc.h:81
#define exit(n)
Definition: config.h:202
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE_LEVEL_WARNING
Definition: storswtr.h:28
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
#define TRACE_LEVEL_INFORMATION
Definition: storswtr.h:29
__nullterminated PCHAR Name
Definition: fxdeviceapi.cpp:33
Definition: ncftp.h:79
Definition: devices.h:37
Definition: ps.c:97
uint32_t * PULONG
Definition: typedefs.h:59
char * PSTR
Definition: typedefs.h:51
INT POOL_TYPE
Definition: typedefs.h:78
int32_t * PLONG
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INVALID_DEVICE_STATE
Definition: udferr_usr.h:178
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Definition: pdh_main.c:94
struct _WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_V1_5 WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_V1_5
#define STDCALL
Definition: wdf.h:45
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDRIVER Driver
Definition: wdfcontrol.h:83
_In_ PWDFDEVICE_INIT DeviceInit
Definition: wdfcontrol.h:113
#define WDF_PTR_ADD_OFFSET(_ptr, _offset)
Definition: wdfcore.h:144
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK _In_opt_ PWDF_OBJECT_ATTRIBUTES KeyAttributes
Definition: wdfdevice.h:2660
@ WakeAllowUserControl
Definition: wdfdevice.h:418
@ WakeDoNotAllowUserControl
Definition: wdfdevice.h:417
@ WdfDevStatePnpInit
Definition: wdfdevice.h:69
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES PropertyMemoryAttributes
Definition: wdfdevice.h:3817
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFMEMORY * PropertyMemory
Definition: wdfdevice.h:3820
_In_ UCHAR _In_ UCHAR _In_ ULONG _In_ WDFCONTEXT DriverContext
Definition: wdfdevice.h:1703
_In_ WDFDEVICE _Out_ PWDF_DEVICE_STATE DeviceState
Definition: wdfdevice.h:1999
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
EVT_WDFDEVICE_WDM_IRP_DISPATCH * PFN_WDFDEVICE_WDM_IRP_DISPATCH
Definition: wdfdevice.h:1710
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_In_ WDFDEVICE _In_ ULONG AlignmentRequirement
Definition: wdfdevice.h:2854
@ WDF_DISPATCH_IRP_TO_IO_QUEUE_NO_FLAGS
Definition: wdfdevice.h:435
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG DeviceInstanceKeyType
Definition: wdfdevice.h:2656
enum _WDF_REQUEST_TYPE WDF_REQUEST_TYPE
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
enum _WDF_DEVICE_POWER_STATE WDF_DEVICE_POWER_STATE
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2595
@ WdfDeviceFailedNoRestart
Definition: wdfdevice.h:470
@ WdfDeviceFailedAttemptRestart
Definition: wdfdevice.h:469
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID PropertyBuffer
Definition: wdfdevice.h:4437
_Must_inspect_result_ _In_ WDFDEVICE _In_ PIRP _In_ WDFQUEUE Queue
Definition: wdfdevice.h:2225
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN WaitForD0
Definition: wdfdevice.h:4006
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING SymbolicLinkName
Definition: wdfdevice.h:3739
_In_ WDFDEVICE _In_ WDF_DEVICE_FAILED_ACTION FailedAction
Definition: wdfdevice.h:3975
@ WdfRequestTypeDeviceControlInternal
Definition: wdfdevice.h:518
@ WdfRequestTypeCreate
Definition: wdfdevice.h:503
@ WdfRequestTypeWrite
Definition: wdfdevice.h:507
@ WdfRequestTypeRead
Definition: wdfdevice.h:506
@ WdfRequestTypeDeviceControl
Definition: wdfdevice.h:517
enum _WDF_DEVICE_POWER_POLICY_STATE WDF_DEVICE_POWER_POLICY_STATE
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY DeviceProperty
Definition: wdfdevice.h:3769
@ IdleDoNotAllowUserControl
Definition: wdfdevice.h:407
@ IdleAllowUserControl
Definition: wdfdevice.h:408
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4439
_Must_inspect_result_ _Inout_ PWDFDEVICE_INIT _In_opt_ PWDF_OBJECT_ATTRIBUTES DeviceAttributes
Definition: wdfdevice.h:3563
_In_ WDFDEVICE _In_ PWDF_DEVICE_PNP_CAPABILITIES PnpCapabilities
Definition: wdfdevice.h:3857
_In_ UCHAR MajorFunction
Definition: wdfdevice.h:1697
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
enum _WDF_DEVICE_PNP_STATE WDF_DEVICE_PNP_STATE
_In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_CAPABILITIES PowerCapabilities
Definition: wdfdevice.h:3886
@ SystemManagedIdleTimeoutWithHint
Definition: wdfdevice.h:1245
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFQUEUE _In_ _Strict_type_match_ WDF_REQUEST_TYPE RequestType
Definition: wdfdevice.h:4233
_In_ WDFDEVICE _In_ BOOLEAN Stoppable
Definition: wdfdevice.h:3598
enum _WDF_DEVICE_FAILED_ACTION WDF_DEVICE_FAILED_ACTION
_In_ WDFDEVICE _In_ ULONG DeviceCharacteristics
Definition: wdfdevice.h:2775
@ IdleUsbSelectiveSuspend
Definition: wdfdevice.h:402
@ IdleCannotWakeFromS0
Definition: wdfdevice.h:400
_In_ WDFREQUEST Request
Definition: wdfdevice.h:547
@ WdfTrue
Definition: wdftypes.h:88
@ WdfUseDefault
Definition: wdftypes.h:89
@ WdfFalse
Definition: wdftypes.h:87
#define WDFAPI
Definition: wdftypes.h:53
enum _WDF_TRI_STATE WDF_TRI_STATE
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
DEVICE_REGISTRY_PROPERTY
Definition: iotypes.h:1194
#define IRP_MJ_INTERNAL_DEVICE_CONTROL
#define PAGED_CODE_LOCKED()
Definition: kefuncs.h:1417
unsigned char UCHAR
Definition: xmlstorage.h:181