SVN maintenance
[reactos.git] / reactos / subsys / system / services / groupdb.c
index a5cfbc0..c2451f2 100644 (file)
-/*\r
- * groupdb.c\r
- */\r
-\r
-/* INCLUDES *****************************************************************/\r
-\r
-#include "services.h"\r
-\r
-#define NDEBUG\r
-#include <debug.h>\r
-\r
-\r
-/* GLOBALS *******************************************************************/\r
-\r
-LIST_ENTRY GroupListHead;\r
-\r
-\r
-/* FUNCTIONS *****************************************************************/\r
-\r
-static NTSTATUS STDCALL\r
-CreateGroupOrderListRoutine(PWSTR ValueName,\r
-                            ULONG ValueType,\r
-                            PVOID ValueData,\r
-                            ULONG ValueLength,\r
-                            PVOID Context,\r
-                            PVOID EntryContext)\r
-{\r
-    PSERVICE_GROUP Group;\r
-\r
-    DPRINT("CreateGroupOrderListRoutine(%S, %x, %x, %x, %x, %x)\n",\r
-           ValueName, ValueType, ValueData, ValueLength, Context, EntryContext);\r
-\r
-    if (ValueType == REG_BINARY &&\r
-        ValueData != NULL &&\r
-        ValueLength >= sizeof(DWORD) &&\r
-        ValueLength >= (*(PULONG)ValueData + 1) * sizeof(DWORD))\r
-    {\r
-        Group = (PSERVICE_GROUP)Context;\r
-        Group->TagCount = ((PULONG)ValueData)[0];\r
-        if (Group->TagCount > 0)\r
-        {\r
-            if (ValueLength >= (Group->TagCount + 1) * sizeof(DWORD))\r
-            {\r
-                Group->TagArray = (PULONG)HeapAlloc(GetProcessHeap(),\r
-                                                    HEAP_ZERO_MEMORY,\r
-                                                    Group->TagCount * sizeof(DWORD));\r
-                if (Group->TagArray == NULL)\r
-                {\r
-                    Group->TagCount = 0;\r
-                    return STATUS_INSUFFICIENT_RESOURCES;\r
-                }\r
-\r
-                RtlCopyMemory(Group->TagArray,\r
-                              (PULONG)ValueData + 1,\r
-                              Group->TagCount * sizeof(DWORD));\r
-            }\r
-            else\r
-            {\r
-                Group->TagCount = 0;\r
-                return STATUS_UNSUCCESSFUL;\r
-            }\r
-        }\r
-    }\r
-\r
-    return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-static NTSTATUS STDCALL\r
-CreateGroupListRoutine(PWSTR ValueName,\r
-                       ULONG ValueType,\r
-                       PVOID ValueData,\r
-                       ULONG ValueLength,\r
-                       PVOID Context,\r
-                       PVOID EntryContext)\r
-{\r
-    PSERVICE_GROUP Group;\r
-    RTL_QUERY_REGISTRY_TABLE QueryTable[2];\r
-    NTSTATUS Status;\r
-\r
-    if (ValueType == REG_SZ)\r
-    {\r
-        DPRINT("Data: '%S'\n", (PWCHAR)ValueData);\r
-\r
-        Group = (PSERVICE_GROUP)HeapAlloc(GetProcessHeap(),\r
-                                          HEAP_ZERO_MEMORY,\r
-                                          sizeof(SERVICE_GROUP) + (wcslen(ValueData) * sizeof(WCHAR)));\r
-        if (Group == NULL)\r
-        {\r
-            return STATUS_INSUFFICIENT_RESOURCES;\r
-        }\r
-\r
-        wcscpy(Group->szGroupName, ValueData);\r
-        Group->lpGroupName = Group->szGroupName;\r
-        Group->dwRefCount = (DWORD)-1;\r
-\r
-        RtlZeroMemory(&QueryTable, sizeof(QueryTable));\r
-        QueryTable[0].Name = (PWSTR)ValueData;\r
-        QueryTable[0].QueryRoutine = CreateGroupOrderListRoutine;\r
-\r
-        Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,\r
-                                        L"GroupOrderList",\r
-                                        QueryTable,\r
-                                        (PVOID)Group,\r
-                                        NULL);\r
-        DPRINT("%x %d %S\n", Status, Group->TagCount, (PWSTR)ValueData);\r
-\r
-        InsertTailList(&GroupListHead,\r
-                       &Group->GroupListEntry);\r
-    }\r
-\r
-    return STATUS_SUCCESS;\r
-}\r
-\r
-\r
-DWORD\r
-ScmCreateGroupList(VOID)\r
-{\r
-    RTL_QUERY_REGISTRY_TABLE QueryTable[2];\r
-    NTSTATUS Status;\r
-\r
-    InitializeListHead(&GroupListHead);\r
-\r
-    /* Build group order list */\r
-    RtlZeroMemory(&QueryTable,\r
-                  sizeof(QueryTable));\r
-\r
-    QueryTable[0].Name = L"List";\r
-    QueryTable[0].QueryRoutine = CreateGroupListRoutine;\r
-\r
-    Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,\r
-                                    L"ServiceGroupOrder",\r
-                                    QueryTable,\r
-                                    NULL,\r
-                                    NULL);\r
-\r
-    return RtlNtStatusToDosError(Status);\r
-}\r
-\r
-/* EOF */\r
+/*
+ * groupdb.c
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include "services.h"
+
+#define NDEBUG
+#include <debug.h>
+
+
+/* GLOBALS *******************************************************************/
+
+LIST_ENTRY GroupListHead;
+
+
+/* FUNCTIONS *****************************************************************/
+
+static NTSTATUS STDCALL
+CreateGroupOrderListRoutine(PWSTR ValueName,
+                            ULONG ValueType,
+                            PVOID ValueData,
+                            ULONG ValueLength,
+                            PVOID Context,
+                            PVOID EntryContext)
+{
+    PSERVICE_GROUP Group;
+
+    DPRINT("CreateGroupOrderListRoutine(%S, %x, %x, %x, %x, %x)\n",
+           ValueName, ValueType, ValueData, ValueLength, Context, EntryContext);
+
+    if (ValueType == REG_BINARY &&
+        ValueData != NULL &&
+        ValueLength >= sizeof(DWORD) &&
+        ValueLength >= (*(PULONG)ValueData + 1) * sizeof(DWORD))
+    {
+        Group = (PSERVICE_GROUP)Context;
+        Group->TagCount = ((PULONG)ValueData)[0];
+        if (Group->TagCount > 0)
+        {
+            if (ValueLength >= (Group->TagCount + 1) * sizeof(DWORD))
+            {
+                Group->TagArray = (PULONG)HeapAlloc(GetProcessHeap(),
+                                                    HEAP_ZERO_MEMORY,
+                                                    Group->TagCount * sizeof(DWORD));
+                if (Group->TagArray == NULL)
+                {
+                    Group->TagCount = 0;
+                    return STATUS_INSUFFICIENT_RESOURCES;
+                }
+
+                RtlCopyMemory(Group->TagArray,
+                              (PULONG)ValueData + 1,
+                              Group->TagCount * sizeof(DWORD));
+            }
+            else
+            {
+                Group->TagCount = 0;
+                return STATUS_UNSUCCESSFUL;
+            }
+        }
+    }
+
+    return STATUS_SUCCESS;
+}
+
+
+static NTSTATUS STDCALL
+CreateGroupListRoutine(PWSTR ValueName,
+                       ULONG ValueType,
+                       PVOID ValueData,
+                       ULONG ValueLength,
+                       PVOID Context,
+                       PVOID EntryContext)
+{
+    PSERVICE_GROUP Group;
+    RTL_QUERY_REGISTRY_TABLE QueryTable[2];
+    NTSTATUS Status;
+
+    if (ValueType == REG_SZ)
+    {
+        DPRINT("Data: '%S'\n", (PWCHAR)ValueData);
+
+        Group = (PSERVICE_GROUP)HeapAlloc(GetProcessHeap(),
+                                          HEAP_ZERO_MEMORY,
+                                          sizeof(SERVICE_GROUP) + (wcslen(ValueData) * sizeof(WCHAR)));
+        if (Group == NULL)
+        {
+            return STATUS_INSUFFICIENT_RESOURCES;
+        }
+
+        wcscpy(Group->szGroupName, ValueData);
+        Group->lpGroupName = Group->szGroupName;
+        Group->dwRefCount = (DWORD)-1;
+
+        RtlZeroMemory(&QueryTable, sizeof(QueryTable));
+        QueryTable[0].Name = (PWSTR)ValueData;
+        QueryTable[0].QueryRoutine = CreateGroupOrderListRoutine;
+
+        Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
+                                        L"GroupOrderList",
+                                        QueryTable,
+                                        (PVOID)Group,
+                                        NULL);
+        DPRINT("%x %d %S\n", Status, Group->TagCount, (PWSTR)ValueData);
+
+        InsertTailList(&GroupListHead,
+                       &Group->GroupListEntry);
+    }
+
+    return STATUS_SUCCESS;
+}
+
+
+DWORD
+ScmCreateGroupList(VOID)
+{
+    RTL_QUERY_REGISTRY_TABLE QueryTable[2];
+    NTSTATUS Status;
+
+    InitializeListHead(&GroupListHead);
+
+    /* Build group order list */
+    RtlZeroMemory(&QueryTable,
+                  sizeof(QueryTable));
+
+    QueryTable[0].Name = L"List";
+    QueryTable[0].QueryRoutine = CreateGroupListRoutine;
+
+    Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
+                                    L"ServiceGroupOrder",
+                                    QueryTable,
+                                    NULL,
+                                    NULL);
+
+    return RtlNtStatusToDosError(Status);
+}
+
+/* EOF */