2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/config/cmvalue.c
5 * PURPOSE: Configuration Manager - Cell Values
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
9 /* INCLUDES ******************************************************************/
16 /* GLOBALS *******************************************************************/
18 /* FUNCTIONS *****************************************************************/
22 CmpFindValueByName(IN PHHIVE Hive
,
23 IN PCM_KEY_NODE KeyNode
,
24 IN PUNICODE_STRING Name
)
26 HCELL_INDEX CellIndex
;
28 /* Call the main function */
29 if (!CmpFindNameInList(Hive
,
36 ASSERT(CellIndex
== HCELL_NIL
);
39 /* Return the index */
45 CmpGetValueData(IN PHHIVE Hive
,
46 IN PCM_KEY_VALUE Value
,
49 OUT PBOOLEAN BufferAllocated
,
50 OUT PHCELL_INDEX CellToRelease
)
55 ASSERT(Value
->Signature
== CM_KEY_VALUE_SIGNATURE
);
57 /* Set failure defaults */
58 *BufferAllocated
= FALSE
;
60 *CellToRelease
= HCELL_NIL
;
62 /* Check if this is a small key */
63 if (CmpIsKeyValueSmall(Length
, Value
->DataLength
))
65 /* Return the data immediately */
66 *Buffer
= &Value
->Data
;
70 /* Check if this is a big cell */
71 if (CmpIsKeyValueBig(Hive
, *Length
))
73 /* FIXME: We don't support big cells */
74 DPRINT1("Unsupported cell type!\n");
78 /* Get the data from the cell */
79 *Buffer
= HvGetCell(Hive
, Value
->Data
);
80 if (!(*Buffer
)) return FALSE
;
82 /* Return success and the cell to be released */
83 *CellToRelease
= Value
->Data
;
89 CmpValueToData(IN PHHIVE Hive
,
90 IN PCM_KEY_VALUE Value
,
94 BOOLEAN BufferAllocated
;
95 HCELL_INDEX CellToRelease
;
99 ASSERT(Hive
->ReleaseCellRoutine
== NULL
);
101 /* Get the actual data */
102 if (!CmpGetValueData(Hive
,
110 ASSERT(BufferAllocated
== FALSE
);
111 ASSERT(Buffer
== NULL
);
115 /* This should never happen!*/
118 /* Free the buffer and bugcheck */
120 KEBUGCHECKEX(REGISTRY_ERROR
, 8, 0, (ULONG_PTR
)Hive
, (ULONG_PTR
)Value
);
123 /* Otherwise, return the cell data */