The GroupOrder registry value should start with a ULONG containing the number
of entries following it.
Modified: trunk/reactos/lib/setupapi/install.c

Modified: trunk/reactos/lib/setupapi/install.c
--- trunk/reactos/lib/setupapi/install.c	2005-11-11 21:30:55 UTC (rev 19149)
+++ trunk/reactos/lib/setupapi/install.c	2005-11-11 21:39:57 UTC (rev 19150)
@@ -1212,7 +1212,7 @@
             }
             rc = RegQueryValueExW(hGroupOrderListKey, lpLoadOrderGroup, NULL, &dwRegType, NULL, &bufferSize);
             if (rc == ERROR_FILE_NOT_FOUND)
-                bufferSize = 0;
+                bufferSize = sizeof(DWORD);
             else if (rc != ERROR_SUCCESS)
             {
                 SetLastError(rc);
@@ -1246,10 +1246,17 @@
                     goto cleanup;
                 }
             }
+            else
+            {
+                GroupOrder[0] = 0;
+            }
             if (flags & SPSVCINST_TAGTOFRONT)
-                GroupOrder[0] = tagId;
+                GroupOrder[1] = tagId;
             else
+            {
+                GroupOrder[0]++;
                 GroupOrder[bufferSize / sizeof(DWORD)] = tagId;
+            }
 
             rc = RegSetValueExW(
                 hGroupOrderListKey,