Fix for the loading of the "KnownDlls" in SMSS. Patch by Hermès BÉLUSCA - MAÏTO.
The patch was applied without changes to comments, indentation and coding style.
See issue #6159 for more details.
svn path=/trunk/; revision=51511
{TRUE, SmInitDosDevices, "create dos device links"},
{TRUE, SmRunBootApplications, "run boot applications"},
{TRUE, SmProcessFileRenameList, "process the file rename list"},
{TRUE, SmInitDosDevices, "create dos device links"},
{TRUE, SmRunBootApplications, "run boot applications"},
{TRUE, SmProcessFileRenameList, "process the file rename list"},
+ {FALSE, SmUpdateEnvironment, "update environment variables"},
{FALSE, SmLoadKnownDlls, "preload system DLLs"},
{TRUE, SmCreatePagingFiles, "create paging files"},
{TRUE, SmInitializeRegistry, "initialize the registry"},
{FALSE, SmLoadKnownDlls, "preload system DLLs"},
{TRUE, SmCreatePagingFiles, "create paging files"},
{TRUE, SmInitializeRegistry, "initialize the registry"},
- {FALSE, SmUpdateEnvironment, "update environment variables"},
{TRUE, SmInitializeClientManagement, "initialize client management"},
{TRUE, SmLoadSubsystems, "load subsystems"}
};
{TRUE, SmInitializeClientManagement, "initialize client management"},
{TRUE, SmLoadSubsystems, "load subsystems"}
};
-done:
- NtClose(EnvironmentKey);
-
-
/* Set the 'PROCESSOR_IDENTIFIER' system environment variable */
RtlInitUnicodeString(&Identifier, NULL);
RtlInitUnicodeString(&VendorIdentifier, NULL);
/* Set the 'PROCESSOR_IDENTIFIER' system environment variable */
RtlInitUnicodeString(&Identifier, NULL);
RtlInitUnicodeString(&VendorIdentifier, NULL);
- if (NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
- DPRINT("SM: szIdentifier: %wZ\n", &Identifier);
- DPRINT("SM: szVendorIdentifier: %wZ\n", &VendorIdentifier);
+ DPRINT1("SM: Failed to retrieve processor Identifier and/or VendorIdentifier (Status %08lx)", Status);
+ goto done;
+ }
- swprintf(Buffer, L"%wZ, %wZ", &Identifier, &VendorIdentifier);
+ DPRINT("SM: szIdentifier: %wZ\n" , &Identifier);
+ DPRINT("SM: szVendorIdentifier: %wZ\n", &VendorIdentifier);
- RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
- L"Session Manager\\Environment",
- L"PROCESSOR_IDENTIFIER",
- REG_SZ,
- Buffer,
- (wcslen(Buffer) + 1) * sizeof(WCHAR));
+ RtlInitUnicodeString(&VariableName, L"PROCESSOR_IDENTIFIER");
+ swprintf(Buffer, L"%wZ, %wZ", &Identifier, &VendorIdentifier);
+ RtlFreeUnicodeString(&VendorIdentifier);
+ RtlFreeUnicodeString(&Identifier);
+
+ Status = NtSetValueKey(EnvironmentKey,
+ &VariableName,
+ 0,
+ REG_SZ,
+ Buffer,
+ (wcslen(Buffer) + 1) * sizeof(WCHAR));
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("SM: Failed to set the PROCESSOR_IDENTIFIER environment variable (Status %08lx)", Status);
+ goto done;
- RtlFreeUnicodeString(&Identifier);
- RtlFreeUnicodeString(&VendorIdentifier);
+done:
+ /* Close the handle */
+ NtClose(EnvironmentKey);
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
WCHAR ValueBuffer[MAX_PATH];
NTSTATUS Status;
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
WCHAR ValueBuffer[MAX_PATH];
NTSTATUS Status;
+#ifndef NDEBUG
+ ULONG ii;
+ PWSTR envp;
+#endif
/*
* The following environment variables must be set prior to reading
/*
* The following environment variables must be set prior to reading
&SmSystemEnvironment,
SmSystemEnvironment);
&SmSystemEnvironment,
SmSystemEnvironment);
+#ifndef NDEBUG
+ /* Print all environment varaibles */
+ ii = 0;
+ envp = SmSystemEnvironment;
+ DbgPrint("SmUpdateEnvironment:\n");
+ while (*envp)
+ {
+ DbgPrint(" %u: %S\n", ii++, envp);
+ envp += wcslen(envp) + 1;
+ }
+#endif
+