ReactOS 0.4.16-dev-329-g9223134
fxregistryapi.cpp
Go to the documentation of this file.
1/*++
2
3Copyright (c) Microsoft Corporation
4
5Module Name:
6
7 FxRegistryAPI.cpp
8
9Abstract:
10
11 This module implements registry access in the framework
12
13Author:
14
15
16
17Environment:
18
19 Both kernel and user mode
20
21Revision History:
22
23--*/
24
25#include "fxsupportpch.hpp"
26
27extern "C" {
28// #include "FxRegistryAPI.tmh"
29#define RtlSizeTToULong RtlULongPtrToULong
30}
31
32extern "C" {
33//
34// Not in a public header that we can reach, but is documented
35//
42 );
43}
44
45
46//
47// Extern "C" the entire file
48//
49extern "C" {
50
55WDFEXPORT(WdfRegistryOpenKey)(
56 __in
59 WDFKEY ParentKey,
60 __in
62 __in
66 __out
67 WDFKEY* Key
68 )
69{
70 DDI_ENTRY();
71
75 WDFKEY keyHandle;
77
80
81 if (ParentKey != NULL) {
83
87 (PVOID*) &pParent,
89
90 parentHandle = pParent->GetHandle();
91 }
92 else {
94
95 //
96 // Get the parent's globals if it is present
97 //
99 KeyAttributes))) {
101
103 KeyAttributes->ParentObject,
105 (PVOID*)&pParent,
107 }
108 }
109
112
113 *Key = NULL;
114
117 return status;
118 }
119
121 if (!NT_SUCCESS(status)) {
122 return status;
123 }
124
126 if (!NT_SUCCESS(status)) {
127 return status;
128 }
129
131 if (pKey == NULL) {
133
136 "Could not allocate memory for a WDFKEY, %!STATUS!", status);
137
138 return status;
139 }
140
142
145
146 if (NT_SUCCESS(status)) {
147 *Key = keyHandle;
148 }
149 else {
152 "new WDFKEY object open failed, %!STATUS!", status);
153 }
154 }
155
156 if (!NT_SUCCESS(status)) {
158 pKey = NULL;
159 }
160
161 return status;
162}
163
168WDFEXPORT(WdfRegistryCreateKey)(
169 __in
172 WDFKEY ParentKey,
173 __in
175 __in
177 __in
183 __out
184 WDFKEY* Key
185 )
186{
187 DDI_ENTRY();
188
190 FxRegKey* pKey;
192 WDFKEY keyHandle;
194
196
197 if (ParentKey != NULL) {
199
201 ParentKey,
203 (PVOID*) &pParent,
205
206 parentHandle = pParent->GetHandle();
207 }
208 else {
210
211 //
212 // Get the parent's globals if it is present
213 //
215 KeyAttributes))) {
217
219 KeyAttributes->ParentObject,
221 (PVOID*)&pParent,
223 }
224 }
225
228
229 *Key = NULL;
230 keyHandle = NULL;
231
233 if (!NT_SUCCESS(status)) {
234 return status;
235 }
236
238 if (!NT_SUCCESS(status)) {
239 return status;
240 }
241
243 if (!NT_SUCCESS(status)) {
244 return status;
245 }
246
248
249 if (pKey == NULL) {
253 "Could not allocate memory for WDFKEY, %!STATUS!", status);
254
255 return status;
256 }
257
259
260 if (NT_SUCCESS(status)) {
261 status = pKey->Create(parentHandle,
262 KeyName,
266
267 if (NT_SUCCESS(status)) {
268 *Key = keyHandle;
269 }
270 else {
273 "Registry key creation failed, %!STATUS!", status);
274 }
275 }
276
277 if (!NT_SUCCESS(status)) {
279 pKey = NULL;
280 }
281
282 return status;
283}
284
286VOID
288WDFEXPORT(WdfRegistryClose)(
289 __in
291 __in
292 WDFKEY Key
293 )
294{
295 DDI_ENTRY();
296
298 FxRegKey* pKey;
300
302 Key,
304 (PVOID*) &pKey,
306
308 if (!NT_SUCCESS(status)) {
310 return;
311 }
312
313 pKey->Close();
314
316}
317
319HANDLE
321WDFEXPORT(WdfRegistryWdmGetHandle)(
322 __in
324 __in
325 WDFKEY Key
326 )
327{
328 DDI_ENTRY();
329
330 FxRegKey* pKey;
331
333 Key,
335 (PVOID*) &pKey);
336
337 return pKey->GetHandle();
338}
339
344WDFEXPORT(WdfRegistryRemoveKey)(
345 __in
347 __in
348 WDFKEY Key
349 )
350{
351 DDI_ENTRY();
352
354 FxRegKey* pKey;
356
358 Key,
360 (PVOID*) &pKey,
362
364 if (!NT_SUCCESS(status)) {
365 return status;
366 }
367
369
370 if (NT_SUCCESS(status)) {
371 //
372 // pKey->GetHandle() is now useless, delete the Fx object
373 //
375 }
376
377 return status;
378}
379
384WDFEXPORT(WdfRegistryRemoveValue)(
385 __in
387 __in
388 WDFKEY Key,
389 __in
391 )
392{
393 DDI_ENTRY();
394
396 FxRegKey* pKey;
398
400 Key,
402 (PVOID*) &pKey,
404
406 if (!NT_SUCCESS(status)) {
407 return status;
408 }
409
411 if (!NT_SUCCESS(status)) {
412 return status;
413 }
414
416
418
419 return status;
420}
421
426WDFEXPORT(WdfRegistryQueryValue)(
427 __in
429 __in
430 WDFKEY Key,
431 __in
433 __in
436 PVOID Value,
441 )
442{
443 DDI_ENTRY();
444
446 FxRegKey* pKey;
448
450 Key,
452 (PVOID*) &pKey,
454
456
458 if (!NT_SUCCESS(status)) {
459 return status;
460 }
461
463 if (!NT_SUCCESS(status)) {
464 return status;
465 }
466
467 status = FxRegKey::_QueryValue(pFxDriverGlobals,
468 pKey->GetHandle(),
469 ValueName,
471 Value,
473 ValueType);
474 if (!NT_SUCCESS(status)) {
475 UCHAR traceLevel = TRACE_LEVEL_ERROR;
476
477 //
478 // Label message as Verbose if this is the known pattern of
479 // passing a 0-length NULL buffer to query the required buffer size.
480 //
481 if (status == STATUS_BUFFER_OVERFLOW && Value == NULL && ValueLength == 0) {
482 traceLevel = TRACE_LEVEL_VERBOSE;
483 }
484
486 "WDFKEY %p QueryValue failed, %!STATUS!",
487 Key, status);
488 }
489
490 return status;
491}
492
497WDFEXPORT(WdfRegistryQueryMemory)(
498 __in
500 __in
501 WDFKEY Key,
502 __in
504 __in
509 __out
510 WDFMEMORY* Memory,
513 )
514{
515 DDI_ENTRY();
516
517 FxRegKey* pKey;
522
524 Key,
526 (PVOID*) &pKey,
528
531
532 *Memory = NULL;
533
535 if (!NT_SUCCESS(status)) {
536 return status;
537 }
538
540
542 if (!NT_SUCCESS(status)) {
543 return status;
544 }
545
547 if (!NT_SUCCESS(status)) {
548 return status;
549 }
550
551 //
552 // Query the buffer length required.
553 //
554 status = pKey->QueryValue(ValueName, 0, NULL, &dataLength, NULL);
556 return status;
557 }
558
560 if (dataBuffer == NULL) {
562
565 "WDFKEY %p KEY_VALUE_PARTIAL_INFORMATION allocation failed, %!STATUS!",
566 Key, status);
567
568 return status;
569 }
570
572 if (NT_SUCCESS(status)) {
574
577 PoolType,
580 &pObject);
581
582 if (NT_SUCCESS(status)) {
584
585 if (NT_SUCCESS(status)) {
586 RtlCopyMemory(pObject->GetBuffer(),
588 dataLength);
589 }
590 else {
592 }
593 }
594 else {
597 "WDFKEY %p WDFMEMORY object create failed, %!STATUS!",
598 Key, status);
599 }
600 }
601 else {
603 "WDFKEY %p QueryPartial failed, %!STATUS!",
604 Key, status);
605 }
606
608
609 return status;
610}
611
616WDFEXPORT(WdfRegistryQueryMultiString)(
617 __in
619 __in
620 WDFKEY Key,
621 __in
625 __in
626 WDFCOLLECTION Collection
627 )
628{
629 DDI_ENTRY();
630
634 FxRegKey* pKey;
638
640 Key,
642 (PVOID*) &pKey,
644
646
649
651 if (!NT_SUCCESS(status)) {
652 return status;
653 }
654
656 if (!NT_SUCCESS(status)) {
657 return status;
658 }
659
661 if (!NT_SUCCESS(status)) {
662 return status;
663 }
664
668 (PVOID*) &pCollection);
669
672
673 status = pKey->QueryValue(ValueName, 0, NULL, &dataLength, &type);
677 "WDFKEY %p QueryPartial failed: %!STATUS!", Key, status);
678
679 return status;
680 }
681
684 }
685
687 if (dataBuffer == NULL) {
689
692 "WDFKEY %p KEY_VALUE_PARTIAL_INFORMATION allocation failed, %!STATUS!",
693 Key, status);
694
695 return status;
696 }
697
699 if (NT_SUCCESS(status)) {
700 //
701 // Verify that the data from the registry is a valid multi-sz string.
702 //
704 ValueName,
706 dataLength);
707 }
708
709 if (NT_SUCCESS(status)) {
710 ULONG initialCount;
711 PWCHAR pCur;
712
713 initialCount = pCollection->Count();
715
716 while (*pCur != UNICODE_NULL) {
718
721
722 if (pString != NULL) {
723 if (pDeviceBase != NULL) {
725 }
726
728
729 if (NT_SUCCESS(status)) {
731
733 }
734
735 if (NT_SUCCESS(status)) {
736 if (pCollection->Add(pString) == FALSE) {
738
741 "WDFKEY %p, WDFCOLLECTION %p, collection add failed "
742 "%!STATUS!", Key, Collection, status);
743 }
744 }
745
746 if (!NT_SUCCESS(status)) {
747 //
748 // Delete the string we just created
749 //
751 }
752 else {
753 //
754 // NT_SUCCES(status)
755 //
756 // Either the caller is responsible for freeing the
757 // WDFSTRING or it has been parented to another object.
758 //
759 DO_NOTHING();
760 }
761 }
762 else {
764 }
765
766 if (!NT_SUCCESS(status)) {
769 "WDFKEY %p: WDFSTRING creation failed: %!STATUS!",
770 Key, status);
771 break;
772 }
773
774 //
775 // Increment to the next string in the multi sz (length of string +
776 // 1 for the NULL)
777 //
778 pCur += wcslen(pCur) + 1;
779 }
780
781 if (!NT_SUCCESS(status)) {
782 //
783 // Clear out all the items we added to the collection
784 //
785 while (pCollection->Count() > initialCount) {
786 pCollection->Remove(initialCount);
787 }
788 }
789 }
790
792
793 return status;
794}
795
800WDFEXPORT(WdfRegistryQueryUnicodeString)(
801 __in
803 __in
804 WDFKEY Key,
805 __in
811 )
812{
813 DDI_ENTRY();
814
816 FxRegKey* pKey;
820
822 Key,
824 (PVOID*) &pKey,
826
828
830 if (!NT_SUCCESS(status)) {
831 return status;
832 }
833
835 if (!NT_SUCCESS(status)) {
836 return status;
837 }
838
839 if (Value != NULL) {
841 if (!NT_SUCCESS(status)) {
842 return status;
843 }
844 }
845
846 if (Value == NULL) {
847 //
848 // Caller wants to know just the length
849 //
850 dataLength = 0;
852 }
853 else {
854 dataLength = Value->MaximumLength;
856
857 if (dataBuffer == NULL) {
859
862 "WDFKEY %p KEY_VALUE_PARTIAL_INFORMATION allocation failed, "
863 "%!STATUS!", Key, status);
864
865 return status;
866 }
867 }
868
873 }
874
875 //
876 // Set ValueByteLength before doing the copy
877 //
879 //
880 // pPartial->DataLength is in bytes, convert to number of
881 // WCHARs
882 //
883 if (ValueByteLength != NULL) {
885 }
886 }
887
889
890
891
892
895
896 //
897 // pPartial->DataLength cannot be greater than Value->MaximumLength
898 // based on the call to _ComputePartialSize above. So it is safe to
899 // copy the pPartial data buffer to the Value buffer.
900 //
901 __analysis_assume(dataLength <= Value->MaximumLength);
903
904 //terminating null shouldn't be included in the Length
905 Value->Length = (USHORT)dataLength;
906
907 if (Value->Buffer[Value->Length/sizeof(WCHAR)-1] == UNICODE_NULL) {
908 Value->Length -= sizeof(WCHAR);
909 }
910 }
911
912 if (dataBuffer != NULL) {
914 }
915
916 return status;
917}
918
923WDFEXPORT(WdfRegistryQueryString)(
924 __in
926 __in
927 WDFKEY Key,
928 __in
930 __in
931 WDFSTRING String
932 )
933{
934 DDI_ENTRY();
935
938 FxRegKey* pKey;
942
944 Key,
946 (PVOID*) &pKey,
948
951
953 if (!NT_SUCCESS(status)) {
954 return status;
955 }
956
958 if (!NT_SUCCESS(status)) {
959 return status;
960 }
961
963 String,
965 (PVOID*) &pString);
966
967 status = pKey->QueryValue(ValueName, 0, NULL, &dataLength, &type);
968 if (NT_SUCCESS(status) &&
971 }
972
975 "WDFKEY %p, QueryPartial failed, %!STATUS!",
976 Key, status);
977 return status;
978 }
979
981 if (dataBuffer == NULL) {
983
986 "WDFKEY %p KEY_VALUE_PARTIAL_INFORMATION allocation failed, "
987 "%!STATUS!", Key, status);
988
989 return status;
990 }
991
993 if (NT_SUCCESS(status) &&
996 }
997
998 if (NT_SUCCESS(status)) {
999 if (dataLength <= USHORT_MAX) {
1000 UNICODE_STRING tmp;
1001
1002 if (dataLength == 0x0) {
1003 //
1004 // Empty string
1005 //
1006 tmp.Buffer = L"";
1007 tmp.Length = 0;
1008 tmp.MaximumLength = 0;
1009 }
1010 else {
1011
1012 //
1013 // The string we read may not be NULL terminated, so put it into a
1014 // UNICODE_STRING. If the final character is NULL, shorten the
1015 // length of the string so that it does not include for the NULL.
1016 //
1017 // If there are embedded NULLs in the string previous to the final
1018 // character, we leave them in place.
1019 //
1020 tmp.Buffer = (PWCHAR) dataBuffer;
1021 tmp.Length = (USHORT) dataLength;
1022 tmp.MaximumLength = tmp.Length;
1023
1024 if (tmp.Buffer[(tmp.Length/sizeof(WCHAR))-1] == UNICODE_NULL) {
1025 //
1026 // Do not include the UNICODE_NULL in the length
1027 //
1028 tmp.Length -= sizeof(WCHAR);
1029 }
1030 }
1031
1032 status = pString->Assign(&tmp);
1033 }
1034 else {
1036
1039 "WDFKEY %p QueryPartial failed, Length %d > max %d, %!STATUS!",
1041 }
1042 }
1043 else {
1046 "WDFKEY %p QueryPartial failed, Length %d, %!STATUS!",
1048 }
1049
1051
1052 return status;
1053}
1054
1058STDCALL
1059WDFEXPORT(WdfRegistryQueryULong)(
1060 __in
1062 __in
1063 WDFKEY Key,
1064 __in
1066 __out
1068 )
1069{
1070 DDI_ENTRY();
1071
1073 FxRegKey* pKey;
1075
1077 Key,
1079 (PVOID*) &pKey,
1081
1084
1086 if (!NT_SUCCESS(status)) {
1087 return status;
1088 }
1089
1091 if (!NT_SUCCESS(status)) {
1092 return status;
1093 }
1094
1095 status = FxRegKey::_QueryULong(pKey->GetHandle(), ValueName, Value);
1096
1097 if (!NT_SUCCESS(status)) {
1100 "WDFKEY %p, QueryULong, %!STATUS!", Key, status);
1101 }
1102
1103 return status;
1104}
1105
1106
1110STDCALL
1111WDFEXPORT(WdfRegistryAssignValue)(
1112 __in
1114 __in
1115 WDFKEY Key,
1116 __in
1118 __in
1120 __in
1123 PVOID Value
1124 )
1125{
1126 DDI_ENTRY();
1127
1129 FxRegKey* pKey;
1131
1133 Key,
1135 (PVOID*) &pKey,
1137
1139
1141 if (!NT_SUCCESS(status)) {
1142 return status;
1143 }
1144
1146 if (!NT_SUCCESS(status)) {
1147 return status;
1148 }
1149
1151
1152 if (!NT_SUCCESS(status)) {
1154 "WDFKEY %p SetValue, %!STATUS!", Key, status);
1155 }
1156
1157 return status;
1158}
1159
1160
1164STDCALL
1165WDFEXPORT(WdfRegistryAssignMemory)(
1166 __in
1168 __in
1169 WDFKEY Key,
1170 __in
1172 __in
1174 __in
1175 WDFMEMORY Memory,
1176 __in_opt
1178 )
1179{
1180 DDI_ENTRY();
1181
1184 FxRegKey* pKey;
1188
1190 Key,
1192 (PVOID*) &pKey,
1194
1197
1199 if (!NT_SUCCESS(status)) {
1200 return status;
1201 }
1202
1204 if (!NT_SUCCESS(status)) {
1205 return status;
1206 }
1207
1209 Memory,
1211 (PVOID*) &pMemory);
1212
1215
1218
1219 if (!NT_SUCCESS(status)) {
1222 "WDFKEY %p, WDFMEMORY %p Offsets overflowed, %!STATUS!",
1223 Key, Memory, status);
1224
1225 return status;
1226 }
1227
1228 if (MemoryOffsets->BufferLength > 0) {
1229 status = RtlSizeTToULong(MemoryOffsets->BufferLength, &length);
1230
1231 if (!NT_SUCCESS(status)) {
1234 "WDFKEY %p, WDFMEMORY %p BufferLength in Offsets truncated, "
1235 "%!STATUS!", Key, Memory, status);
1236
1237 return status;
1238 }
1239 }
1240
1242 }
1243
1244 status = pKey->SetValue(ValueName, ValueType, pBuffer, length);
1245
1246 if (!NT_SUCCESS(status)) {
1248 "WDFKEY handle %p SetValue, %!STATUS!", Key, status);
1249 }
1250
1251 return status;
1252}
1253
1257STDCALL
1258WDFEXPORT(WdfRegistryAssignULong)(
1259 __in
1261 __in
1262 WDFKEY Key,
1263 __in
1265 __in
1266 ULONG Value
1267 )
1268{
1269 DDI_ENTRY();
1270
1272 FxRegKey* pKey;
1274
1276 Key,
1278 (PVOID*) &pKey,
1280
1282
1284 if (!NT_SUCCESS(status)) {
1285 return status;
1286 }
1287
1289 if (!NT_SUCCESS(status)) {
1290 return status;
1291 }
1292
1293 status = pKey->SetValue(ValueName, REG_DWORD, &Value, sizeof(Value));
1294
1295 if (!NT_SUCCESS(status)) {
1297 "WDFKEY %p SetValue, %!STATUS!",
1298 Key, status);
1299 }
1300
1301 return status;
1302}
1303
1307STDCALL
1308WDFEXPORT(WdfRegistryAssignUnicodeString)(
1309 __in
1311 __in
1312 WDFKEY Key,
1313 __in
1315 __in
1317 )
1318{
1319 DDI_ENTRY();
1320
1322 FxRegKey* pKey;
1325 ULONG length;
1326
1328 Key,
1330 (PVOID*) &pKey,
1332
1335
1337
1339 if (!NT_SUCCESS(status)) {
1340 return status;
1341 }
1342
1344 if (!NT_SUCCESS(status)) {
1345 return status;
1346 }
1347
1349 if (!NT_SUCCESS(status)) {
1350 return status;
1351 }
1352
1353 length = Value->Length + sizeof(UNICODE_NULL);
1354
1355 //
1356 // Buffer must be NULL terminated and Length of the buffer must also include the NULL
1357 // Allocate a temporary buffer and NULL terminate it.
1358 //
1359 tempValueBuf = (PWCHAR) FxPoolAllocate(pFxDriverGlobals, PagedPool, length);
1360
1363
1365 "WDFKEY %p allocate temporary buffer failed, "
1366 "%!STATUS!", Key, status);
1367
1368 return status;
1369 }
1370
1371 //
1372 // Copy over the string from the callers buffer and make sure it is
1373 // NULL terminated.
1374 //
1376 tempValueBuf[Value->Length/sizeof(WCHAR)] = UNICODE_NULL;
1377
1379
1381
1382 if (!NT_SUCCESS(status)) {
1384 "WDFKEY %p set value failed, %!STATUS!",
1385 Key, status);
1386 }
1387
1388 return status;
1389}
1390
1394STDCALL
1395WDFEXPORT(WdfRegistryAssignString)(
1396 __in
1398 __in
1399 WDFKEY Key,
1400 __in
1402 __in
1403 WDFSTRING String
1404 )
1405{
1406 DDI_ENTRY();
1407
1410 FxRegKey* pKey;
1412
1414 Key,
1416 (PVOID*) &pKey,
1418
1421
1423 if (!NT_SUCCESS(status)) {
1424 return status;
1425 }
1426
1428 if (!NT_SUCCESS(status)) {
1429 return status;
1430 }
1431
1433 String,
1435 (PVOID*) &pString);
1436
1437 status = pKey->SetValue(ValueName,
1438 REG_SZ,
1439 pString->Buffer(),
1441
1442 if (!NT_SUCCESS(status)) {
1444 "WDFKEY handle %p SetValue, %!STATUS!",
1445 Key, status);
1446 }
1447
1448 return status;
1449}
1450
1454STDCALL
1455WDFEXPORT(WdfRegistryAssignMultiString)(
1456 __in
1458 __in
1459 WDFKEY Key,
1460 __in
1462 __in
1463 WDFCOLLECTION StringsCollection
1464 )
1465{
1466 DDI_ENTRY();
1467
1470 FxRegKey* pKey;
1473 ULONG length;
1475
1477 Key,
1479 (PVOID*) &pKey,
1481
1484
1486 if (!NT_SUCCESS(status)) {
1487 return status;
1488 }
1489
1491 if (!NT_SUCCESS(status)) {
1492 return status;
1493 }
1494
1498 (PVOID *) &pCollection);
1499
1500 valid = FALSE;
1501
1504 &length);
1505
1506 if (!NT_SUCCESS(status)) {
1508 "WDFCOLLECTION %p, collection too large to fit into "
1509 "a ULONG, %!STATUS!", StringsCollection, status);
1510 return status;
1511 }
1512
1513 if (valid == FALSE) {
1516 "WDFKEY %p, WDFCOLLECTION %p contains "
1517 "non string objects, %!STATUS!",
1519 return status;
1520 }
1521
1522 pValue = (PWCHAR) FxPoolAllocate(pFxDriverGlobals, PagedPool, length);
1523
1524 if (pValue == NULL) {
1526
1528 "WDFKEY %p allocate for query buffer failed, "
1529 "%!STATUS!", Key, status);
1530
1531 return status;
1532 }
1533
1535
1537
1538 if (!NT_SUCCESS(status)) {
1540 "WDFKEY %p SetValue, %!STATUS!",
1541 Key, status);
1542 }
1543
1545
1546 return status;
1547}
1548
1549} // extern "C"
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define NTSYSAPI
Definition: ntoskrnl.h:12
BOOLEAN Add(__in FxObject *Item)
static FxDeviceBase * _SearchForDevice(__in FxObject *Object, __out_opt IFxHasCallbacks **Callbacks)
static _Must_inspect_result_ NTSTATUS _Create(__in PFX_DRIVER_GLOBALS DriverGlobals, __in_opt PWDF_OBJECT_ATTRIBUTES Attributes, __in POOL_TYPE PoolType, __in ULONG PoolTag, __in size_t BufferSize, __out FxMemoryObject **Object)
VOID SetDeviceBase(__in CfxDeviceBase *DeviceBase)
Definition: fxobject.hpp:797
virtual VOID DeleteObject(VOID)
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
static _Must_inspect_result_ NTSTATUS _VerifyMultiSzString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING RegValueName, __in_bcount(DataLength) PWCHAR DataString, __in ULONG DataLength)
Definition: fxregkey.cpp:14
static BOOLEAN __inline _IsValidSzType(__in ULONG RegValueType)
Definition: fxregkey.hpp:230
__inline HANDLE GetHandle(VOID)
Definition: fxregkey.hpp:103
__inline USHORT ByteLength(__in BOOLEAN IncludeNull)
Definition: fxstring.hpp:94
__inline PWCHAR Buffer(VOID)
Definition: fxstring.hpp:144
_Must_inspect_result_ NTSTATUS Assign(__in PCWSTR SourceString)
Definition: fxstring.cpp:57
virtual size_t GetBufferSize(VOID)=0
_Must_inspect_result_ NTSTATUS ValidateMemoryOffsets(__in_opt PWDFMEMORY_OFFSET Offsets)
Definition: ifxmemory.hpp:105
virtual PVOID GetBuffer(VOID)=0
static __inline NTSTATUS MxDeleteKey(_In_ HANDLE KeyHandle)
Definition: mxgeneralkm.h:634
#define STATUS_OBJECT_TYPE_MISMATCH
Definition: d3dkmdt.h:46
#define __out_opt
Definition: dbghelp.h:65
#define __in_ecount(x)
Definition: dbghelp.h:47
#define __inout_opt
Definition: dbghelp.h:53
#define __in
Definition: dbghelp.h:35
#define __in_opt
Definition: dbghelp.h:38
#define __out
Definition: dbghelp.h:62
#define __out_bcount_opt(x)
Definition: dbghelp.h:71
#define TRACINGERROR
Definition: dbgtrace.h:63
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#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 PagedPool
Definition: env_spec_w32.h:308
DoTraceLevelMessage(pFxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGPNP, "Enter, WDFDEVICE %p", Device)
SINGLE_LIST_ENTRY * pCur
FxVerifierDbgBreakPoint(pFxDriverGlobals)
FxObject * pParent
Definition: fxdpcapi.cpp:86
DriverGlobals
__inline PFX_DRIVER_GLOBALS GetFxDriverGlobals(__in PWDF_DRIVER_GLOBALS DriverGlobals)
Definition: fxglobals.h:597
#define DDI_ENTRY()
Definition: fxglobalskm.h:56
#define WDFEXPORT(a)
Definition: fxmacros.hpp:157
#define FxPointerNotNull(FxDriverGlobals, Ptr)
Definition: fxmacros.hpp:253
FxObject * pObject
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in_opt PWDF_OBJECT_ATTRIBUTES StringsAttributes
FxDeviceBase * pDeviceBase
FxCollection * pCollection
FxRegKey * pKey
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in_opt PWDF_OBJECT_ATTRIBUTES __in WDFCOLLECTION Collection
_Must_inspect_result_ __in_opt WDFKEY __in PCUNICODE_STRING KeyName
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in WDFCOLLECTION StringsCollection
#define RtlSizeTToULong
FxObjectHandleGetPtr(GetFxDriverGlobals(DriverGlobals), Key, FX_TYPE_REG_KEY,(PVOID *) &pKey)
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in ULONG __out_opt PULONG __out_opt PULONG ValueType
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in ULONG __in WDFMEMORY __in_opt PWDFMEMORY_OFFSET MemoryOffsets
_Must_inspect_result_ __in_opt WDFKEY __in PCUNICODE_STRING __in ACCESS_MASK __in ULONG __out_opt PULONG CreateDisposition
BOOLEAN valid
FxCopyMultiSz(pValue, pCollection)
PVOID pBuffer
ULONG type
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in WDFSTRING String
_Must_inspect_result_ __in_opt WDFKEY ParentKey
FxPoolFree(dataBuffer)
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING ValueName
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in ULONG ValueLength
PWCHAR tempValueBuf
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __out_opt PUSHORT __inout_opt PUNICODE_STRING Value
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in ULONG __out_opt PULONG ValueLengthQueried
ULONG length
NTSTATUS status
PWCHAR pValue
IFxMemory * pMemory
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __out_opt PUSHORT ValueByteLength
FxString * pString
_Must_inspect_result_ __in WDFKEY __in PCUNICODE_STRING __in __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFMEMORY * Memory
FxObjectHandleGetPtrAndGlobals(GetFxDriverGlobals(DriverGlobals), Key, FX_TYPE_REG_KEY,(PVOID *) &pKey, &pFxDriverGlobals)
FxVerifierCheckNxPoolType(pFxDriverGlobals, PoolType, pFxDriverGlobals->Tag)
_Must_inspect_result_ __in_opt WDFKEY __in PCUNICODE_STRING __in ACCESS_MASK __in ULONG CreateOptions
NTSYSAPI NTSTATUS NTAPI ZwDeleteValueKey(__in IN HANDLE Key, __in IN PUNICODE_STRING ValueName)
PVOID dataBuffer
WDFKEY keyHandle
HANDLE parentHandle
_Must_inspect_result_ __in_opt WDFKEY __in PCUNICODE_STRING __in ACCESS_MASK DesiredAccess
_Must_inspect_result_ __in_opt WDFKEY __in PCUNICODE_STRING __in ACCESS_MASK __in_opt PWDF_OBJECT_ATTRIBUTES KeyAttributes
ULONG dataLength
_Must_inspect_result_ __in_opt WDFKEY __in PCUNICODE_STRING __in ACCESS_MASK __in_opt PWDF_OBJECT_ATTRIBUTES __out WDFKEY * Key
PFX_DRIVER_GLOBALS pFxDriverGlobals
@ FX_TYPE_REG_KEY
Definition: fxtypes.h:51
@ FX_TYPE_OBJECT
Definition: fxtypes.h:45
@ FX_TYPE_COLLECTION
Definition: fxtypes.h:59
@ IFX_TYPE_MEMORY
Definition: fxtypes.h:55
@ FX_TYPE_STRING
Definition: fxtypes.h:52
_Must_inspect_result_ NTSTATUS __inline FxValidateUnicodeString(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PCUNICODE_STRING String)
_Must_inspect_result_ NTSTATUS __inline FxValidateObjectAttributesForParentHandle(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in PWDF_OBJECT_ATTRIBUTES Attributes, __in ULONG Flags=FX_VALIDATE_OPTION_NONE_SPECIFIED)
_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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define USHORT_MAX
Definition: intsafe.h:147
#define REG_SZ
Definition: layer.c:22
#define ASSERT(a)
Definition: mode.c:44
#define __analysis_assume(expr)
Definition: ms_sal.h:2893
#define DO_NOTHING()
Definition: mxgeneral.h:32
#define _Must_inspect_result_
Definition: no_sal2.h:62
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define UNICODE_NULL
#define STATUS_INVALID_BUFFER_SIZE
Definition: ntstatus.h:650
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
#define REG_DWORD
Definition: sdbapi.c:596
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define TRACE_LEVEL_VERBOSE
Definition: storswtr.h:30
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
size_t FxCalculateTotalStringSize(__in FxCollectionInternal *StringCollection, __in BOOLEAN Verify=FALSE, __out_opt PBOOLEAN ContainsOnlyStrings=NULL)
Definition: stringutil.cpp:32
NTSTATUS Remove(__in ULONG Index)
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: ps.c:97
uint32_t * PULONG
Definition: typedefs.h:59
INT POOL_TYPE
Definition: typedefs.h:78
#define NTAPI
Definition: typedefs.h:36
uint16_t * PUSHORT
Definition: typedefs.h:56
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STDCALL
Definition: wdf.h:45
#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
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES MemoryAttributes
Definition: wdfmemory.h:409
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
_Must_inspect_result_ _In_opt_ WDFKEY _In_ PCUNICODE_STRING _In_ ACCESS_MASK _In_ ULONG _Out_opt_ PULONG CreateDisposition
Definition: wdfregistry.h:120
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ WDFCOLLECTION Collection
Definition: wdfregistry.h:374
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG ValueLengthQueried
Definition: wdfregistry.h:279
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_opt_ PWDF_OBJECT_ATTRIBUTES StringsAttributes
Definition: wdfregistry.h:371
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT ValueByteLength
Definition: wdfregistry.h:410
_Must_inspect_result_ _In_opt_ WDFKEY _In_ PCUNICODE_STRING _In_ ACCESS_MASK _In_ ULONG CreateOptions
Definition: wdfregistry.h:118
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ WDFCOLLECTION StringsCollection
Definition: wdfregistry.h:606
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
Definition: wdfregistry.h:69
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _Out_opt_ PULONG _Out_opt_ PULONG ValueType
Definition: wdfregistry.h:282
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:275
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG _In_ WDFMEMORY _In_opt_ PWDFMEMORY_OFFSET MemoryOffsets
Definition: wdfregistry.h:567
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180