https://git.reactos.org/?p=reactos.git;a=commitdiff;h=507c44247344fc88a0d8646bdfc91007a86dd1a4

commit 507c44247344fc88a0d8646bdfc91007a86dd1a4
Author:     Thomas Faber <[email protected]>
AuthorDate: Fri Oct 30 17:29:29 2020 +0100
Commit:     Thomas Faber <[email protected]>
CommitDate: Sat Nov 14 15:11:00 2020 +0100

    [NTOS:CM] Implement support for KeyValuePartialInformationAlign64. 
CORE-17358
---
 ntoskrnl/config/cmvalche.c | 46 +++++++++++++++++++++++++++++++++++-----------
 1 file changed, 35 insertions(+), 11 deletions(-)

diff --git a/ntoskrnl/config/cmvalche.c b/ntoskrnl/config/cmvalche.c
index 7759b7c646f..07190266e92 100644
--- a/ntoskrnl/config/cmvalche.c
+++ b/ntoskrnl/config/cmvalche.c
@@ -574,16 +574,23 @@ CmpQueryKeyValueData(IN PCM_KEY_CONTROL_BLOCK Kcb,
 
         /* Partial information requested (no name or alignment!) */
         case KeyValuePartialInformation:
+        case KeyValuePartialInformationAlign64:
 
             /* Check if this is a small key and compute key size */
             IsSmall = CmpIsKeyValueSmall(&KeySize,
                                          CellData->u.KeyValue.DataLength);
 
-            /* Calculate the total size required */
-            Size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data) + KeySize;
-
-            /* And this is the least we can work with */
-            MinimumSize = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data);
+            /* Calculate the total size required and the least we can work 
with */
+            if (KeyValueInformationClass == KeyValuePartialInformationAlign64)
+            {
+                Size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, 
Data) + KeySize;
+                MinimumSize = 
FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION_ALIGN64, Data);
+            }
+            else
+            {
+                Size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data) + 
KeySize;
+                MinimumSize = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, 
Data);
+            }
 
             /* Tell the caller the size we'll finally need, and set success */
             *ResultLength = Size;
@@ -598,9 +605,17 @@ CmpQueryKeyValueData(IN PCM_KEY_CONTROL_BLOCK Kcb,
             }
 
             /* Fill out the basic information */
-            Info->KeyValuePartialInformation.TitleIndex = 0;
-            Info->KeyValuePartialInformation.Type = CellData->u.KeyValue.Type;
-            Info->KeyValuePartialInformation.DataLength = KeySize;
+            if (KeyValueInformationClass == KeyValuePartialInformationAlign64)
+            {
+                Info->KeyValuePartialInformationAlign64.Type = 
CellData->u.KeyValue.Type;
+                Info->KeyValuePartialInformationAlign64.DataLength = KeySize;
+            }
+            else
+            {
+                Info->KeyValuePartialInformation.TitleIndex = 0;
+                Info->KeyValuePartialInformation.Type = 
CellData->u.KeyValue.Type;
+                Info->KeyValuePartialInformation.DataLength = KeySize;
+            }
 
             /* Now check if the key had any data */
             if (KeySize > 0)
@@ -649,9 +664,18 @@ CmpQueryKeyValueData(IN PCM_KEY_CONTROL_BLOCK Kcb,
                 if (Buffer)
                 {
                     /* Copy the data into the aligned offset */
-                    RtlCopyMemory(Info->KeyValuePartialInformation.Data,
-                                  Buffer,
-                                  Size);
+                    if (KeyValueInformationClass == 
KeyValuePartialInformationAlign64)
+                    {
+                        
RtlCopyMemory(Info->KeyValuePartialInformationAlign64.Data,
+                                      Buffer,
+                                      Size);
+                    }
+                    else
+                    {
+                        RtlCopyMemory(Info->KeyValuePartialInformation.Data,
+                                      Buffer,
+                                      Size);
+                    }
                 }
             }
 

Reply via email to