ReactOS 0.4.15-dev-7931-gfd331f1
settings.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _GENENTRY
 

Typedefs

typedef struct _GENENTRY GENENTRY
 
typedef struct _GENENTRYPGENENTRY
 

Functions

PGENERIC_LIST CreateComputerTypeList (IN HINF InfFile)
 
PGENERIC_LIST CreateDisplayDriverList (IN HINF InfFile)
 
BOOLEAN ProcessComputerFiles (_In_ HINF InfFile, _In_ PCWSTR ComputerType, _Out_ PWSTR *AdditionalSectionName)
 
BOOLEAN ProcessDisplayRegistry (_In_ HINF InfFile, _In_ PCWSTR DisplayType)
 
PGENERIC_LIST CreateKeyboardDriverList (IN HINF InfFile)
 
PGENERIC_LIST CreateKeyboardLayoutList (IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
 
PGENERIC_LIST CreateLanguageList (IN HINF InfFile, OUT PWSTR DefaultLanguage)
 
ULONG GetDefaultLanguageIndex (VOID)
 
BOOLEAN ProcessKeyboardLayoutRegistry (_In_ PCWSTR pszLayoutId, _In_ PCWSTR LanguageId)
 
BOOLEAN ProcessLocaleRegistry (_In_ PCWSTR LanguageId)
 
BOOLEAN SetGeoID (_In_ GEOID GeoId)
 
BOOLEAN SetDefaultPagefile (_In_ WCHAR Drive)
 

Typedef Documentation

◆ GENENTRY

◆ PGENENTRY

Function Documentation

◆ CreateComputerTypeList()

PGENERIC_LIST CreateComputerTypeList ( IN HINF  InfFile)

Definition at line 524 of file settings.c.

526{
529
531 if (List == NULL)
532 return NULL;
533
534 Success = AddComputerTypeEntries(InfFile, List, L"Map.Computer");
535 Success |= AddComputerTypeEntries(InfFile, List, L"Map.Computer.NT" INF_ARCH);
536 if (!Success)
537 {
539 return NULL;
540 }
541
542 return List;
543}
unsigned char BOOLEAN
BOOLEAN AddComputerTypeEntries(_In_ HINF InfFile, PGENERIC_LIST List, _In_ PWSTR SectionName)
Definition: settings.c:446
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
@ Success
Definition: eventcreate.c:712
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
#define L(x)
Definition: ntvdm.h:50
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by DeviceSettingsPage(), LoadSetupData(), and SetupStartPage().

◆ CreateDisplayDriverList()

PGENERIC_LIST CreateDisplayDriverList ( IN HINF  InfFile)

Definition at line 708 of file settings.c.

710{
714 PCWSTR KeyValue;
715 WCHAR DisplayIdentifier[128];
716 WCHAR DisplayKey[32];
717
718 /* Get the display identification */
719 if (!GetDisplayIdentifier(DisplayIdentifier, 128))
720 {
721 DisplayIdentifier[0] = 0;
722 }
723
724 DPRINT("Display identifier: '%S'\n", DisplayIdentifier);
725
726 /* Search for matching device identifier */
727 if (!SpInfFindFirstLine(InfFile, L"Map.Display", NULL, &Context))
728 {
729 /* FIXME: error message */
730 return NULL;
731 }
732
733 do
734 {
735 BOOLEAN FoundId;
736
737 if (!INF_GetDataField(&Context, 1, &KeyValue))
738 {
739 /* FIXME: Handle error! */
740 DPRINT("INF_GetDataField() failed\n");
741 return NULL;
742 }
743
744 DPRINT("KeyValue: %S\n", KeyValue);
745 FoundId = !!wcsstr(DisplayIdentifier, KeyValue);
746 INF_FreeData(KeyValue);
747
748 if (!FoundId)
749 continue;
750
751 if (!INF_GetDataField(&Context, 0, &KeyName))
752 {
753 /* FIXME: Handle error! */
754 DPRINT("INF_GetDataField() failed\n");
755 return NULL;
756 }
757
758 DPRINT("Display key: %S\n", KeyName);
759 RtlStringCchCopyW(DisplayKey, ARRAYSIZE(DisplayKey), KeyName);
761 } while (SpInfFindNextLine(&Context, &Context));
762
764 if (List == NULL)
765 return NULL;
766
768 InfFile,
769 L"Display",
770 &Context,
772 DisplayKey) == -1)
773 {
775 return NULL;
776 }
777
778#if 0
779 AppendGenericListEntry(List, L"Other display driver", NULL, TRUE);
780#endif
781
782 return List;
783}
static LONG AddEntriesFromInfSection(IN OUT PGENERIC_LIST List, IN HINF InfFile, IN PCWSTR SectionName, IN PINFCONTEXT pContext, IN PPROCESS_ENTRY_ROUTINE ProcessEntry, IN PVOID Parameter OPTIONAL)
Definition: settings.c:340
static BOOLEAN GetDisplayIdentifier(OUT PWSTR Identifier, IN ULONG IdentifierLength)
Definition: settings.c:547
static UCHAR NTAPI DefaultProcessEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:408
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
FORCEINLINE VOID INF_FreeData(IN PCWSTR InfData)
Definition: infsupp.h:157
BOOLEAN INF_GetDataField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PCWSTR *Data)
Definition: infsupp.c:42
BOOLEAN AppendGenericListEntry(IN OUT PGENERIC_LIST List, IN PVOID Data, IN BOOLEAN Current)
Definition: genlist.c:62
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:127
#define DPRINT
Definition: sndvol32.h:71
const uint16_t * PCWSTR
Definition: typedefs.h:57
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by DeviceSettingsPage(), LoadSetupData(), and SetupStartPage().

◆ CreateKeyboardDriverList()

PGENERIC_LIST CreateKeyboardDriverList ( IN HINF  InfFile)

Definition at line 1072 of file settings.c.

1074{
1077
1079 if (List == NULL)
1080 return NULL;
1081
1083 InfFile,
1084 L"Keyboard",
1085 &Context,
1087 NULL) == -1)
1088 {
1090 return NULL;
1091 }
1092
1093 return List;
1094}

Referenced by DeviceSettingsPage(), LoadSetupData(), and SetupStartPage().

◆ CreateKeyboardLayoutList()

PGENERIC_LIST CreateKeyboardLayoutList ( IN HINF  InfFile,
IN PCWSTR  LanguageId,
OUT PWSTR  DefaultKBLayout 
)

Definition at line 1209 of file settings.c.

1213{
1216 PCWSTR KeyValue;
1217 const MUI_LAYOUTS* LayoutsList;
1218 ULONG uIndex = 0;
1219
1220 /* Get default layout id */
1221 if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLayout", &Context))
1222 return NULL;
1223
1224 if (!INF_GetData(&Context, NULL, &KeyValue))
1225 return NULL;
1226
1227 wcscpy(DefaultKBLayout, KeyValue);
1228
1230 if (List == NULL)
1231 return NULL;
1232
1233 LayoutsList = MUIGetLayoutsList(LanguageId);
1234
1235 do
1236 {
1237 // NOTE: See https://svn.reactos.org/svn/reactos?view=revision&revision=68354
1239 InfFile,
1240 L"KeyboardLayout",
1241 &Context,
1243 DefaultKBLayout) == -1)
1244 {
1246 return NULL;
1247 }
1248
1249 uIndex++;
1250
1251 } while (LayoutsList[uIndex].LangID != 0);
1252
1253 /* Check whether some keyboard layouts have been found */
1254 /* FIXME: Handle this case */
1255 if (GetNumberOfListEntries(List) == 0)
1256 {
1257 DPRINT1("No keyboard layouts have been found\n");
1259 return NULL;
1260 }
1261
1262 return List;
1263}
#define DPRINT1
Definition: precomp.h:8
const MUI_LAYOUTS * MUIGetLayoutsList(IN PCWSTR LanguageId)
Definition: mui.c:112
BOOLEAN INF_GetData(IN PINFCONTEXT Context, OUT PCWSTR *Key, OUT PCWSTR *Data)
Definition: infsupp.c:90
ULONG GetNumberOfListEntries(IN PGENERIC_LIST List)
Definition: genlist.c:140
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
uint32_t ULONG
Definition: typedefs.h:59
static WCHAR DefaultKBLayout[20]
Definition: usetup.c:68
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR _In_opt_ USHORT LangID
Definition: wdfusb.h:1083

Referenced by DeviceSettingsPage(), LoadSetupData(), SetupStartPage(), and UpdateKBLayout().

◆ CreateLanguageList()

PGENERIC_LIST CreateLanguageList ( IN HINF  InfFile,
OUT PWSTR  DefaultLanguage 
)

Definition at line 1159 of file settings.c.

1162{
1165 PCWSTR KeyValue;
1166
1167 LANG_ENTRY_PARAM LangEntryParam;
1168
1169 LangEntryParam.uIndex = 0;
1170 LangEntryParam.DefaultLanguage = DefaultLanguage;
1171
1172 /* Get default language id */
1173 if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLanguage", &Context))
1174 return NULL;
1175
1176 if (!INF_GetData(&Context, NULL, &KeyValue))
1177 return NULL;
1178
1179 wcscpy(DefaultLanguage, KeyValue);
1180
1182 if (List == NULL)
1183 return NULL;
1184
1186 InfFile,
1187 L"Language",
1188 &Context,
1190 &LangEntryParam) == -1)
1191 {
1193 return NULL;
1194 }
1195
1196 /* Only one language available, make it the default one */
1197 if (LangEntryParam.uIndex == 1)
1198 {
1202 }
1203
1204 return List;
1205}
DWORD Id
static UCHAR NTAPI ProcessLangEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:1111
static ULONG DefaultLanguageIndex
Definition: settings.c:41
PGENERIC_LIST_ENTRY GetFirstListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:104
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
Definition: settings.c:1104
ULONG uIndex
Definition: settings.c:1105
PWCHAR DefaultLanguage
Definition: settings.c:1106
static WCHAR DefaultLanguage[20]
Definition: usetup.c:67

Referenced by LanguagePage(), LoadSetupData(), and SetupStartPage().

◆ GetDefaultLanguageIndex()

ULONG GetDefaultLanguageIndex ( VOID  )

Definition at line 1098 of file settings.c.

1099{
1100 return DefaultLanguageIndex;
1101}

Referenced by LanguagePage().

◆ ProcessComputerFiles()

BOOLEAN ProcessComputerFiles ( _In_ HINF  InfFile,
_In_ PCWSTR  ComputerType,
_Out_ PWSTR AdditionalSectionName 
)

Definition at line 787 of file settings.c.

791{
792 static WCHAR SectionName[128];
793
794 DPRINT("ProcessComputerFiles(%S) called\n", ComputerType);
795
796 RtlStringCchPrintfW(SectionName, _countof(SectionName),
797 L"Files.%s", ComputerType);
798 *AdditionalSectionName = SectionName;
799
800 // TODO: More things to do?
801
802 return TRUE;
803}
NTSTRSAFEVAPI RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1110
#define _countof(array)
Definition: sndvol32.h:68

Referenced by PrepareCopyInfFile().

◆ ProcessDisplayRegistry()

BOOLEAN ProcessDisplayRegistry ( _In_ HINF  InfFile,
_In_ PCWSTR  DisplayType 
)

Definition at line 806 of file settings.c.

809{
814 ULONG StartValue;
815 ULONG Width, Height, Bpp;
819 WCHAR RegPath[255];
820
821 DPRINT("ProcessDisplayRegistry(%S) called\n", DisplayType);
822
823 if (!SpInfFindFirstLine(InfFile, L"Display", DisplayType, &Context))
824 {
825 DPRINT1("SpInfFindFirstLine() failed\n");
826 return FALSE;
827 }
828
829 /* Enable the correct driver */
831 {
832 DPRINT1("INF_GetDataField() failed\n");
833 return FALSE;
834 }
835
837 DPRINT("Service name: '%S'\n", ServiceName);
838
839 RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
840 L"System\\CurrentControlSet\\Services\\%s",
842 RtlInitUnicodeString(&KeyName, RegPath);
844 &KeyName,
847 NULL);
851 if (!NT_SUCCESS(Status))
852 {
853 DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
854 return FALSE;
855 }
856
857 StartValue = 1;
859 L"Start",
860 REG_DWORD,
861 &StartValue,
862 sizeof(StartValue));
864 if (!NT_SUCCESS(Status))
865 {
866 DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
867 return FALSE;
868 }
869
870 /* Set the resolution */
871
872 if (!INF_GetDataField(&Context, 4, &Buffer))
873 {
874 DPRINT1("INF_GetDataField() failed\n");
875 return FALSE;
876 }
877
878 RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
879 L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0",
881 DPRINT("RegPath: '%S'\n", RegPath);
882 RtlInitUnicodeString(&KeyName, RegPath);
884 &KeyName,
887 NULL);
892 {
893 /* Try without Hardware Profile part */
894 RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
895 L"System\\CurrentControlSet\\Services\\%s\\Device0",
897 RtlInitUnicodeString(&KeyName, RegPath);
901 }
902 if (!NT_SUCCESS(Status))
903 {
904 DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
905 return FALSE;
906 }
907
908 Width = wcstoul(Buffer, NULL, 10);
910 L"DefaultSettings.XResolution",
911 REG_DWORD,
912 &Width,
913 sizeof(Width));
914 if (!NT_SUCCESS(Status))
915 {
916 DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
918 return FALSE;
919 }
920
921 if (!INF_GetDataField(&Context, 5, &Buffer))
922 {
923 DPRINT1("INF_GetDataField() failed\n");
925 return FALSE;
926 }
927
928 Height = wcstoul(Buffer, NULL, 10);
930 L"DefaultSettings.YResolution",
931 REG_DWORD,
932 &Height,
933 sizeof(Height));
934 if (!NT_SUCCESS(Status))
935 {
936 DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
938 return FALSE;
939 }
940
941 if (!INF_GetDataField(&Context, 6, &Buffer))
942 {
943 DPRINT1("INF_GetDataField() failed\n");
945 return FALSE;
946 }
947
948 Bpp = wcstoul(Buffer, NULL, 10);
950 L"DefaultSettings.BitsPerPel",
951 REG_DWORD,
952 &Bpp,
953 sizeof(Bpp));
954 if (!NT_SUCCESS(Status))
955 {
956 DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
958 return FALSE;
959 }
960
962
963 DPRINT("ProcessDisplayRegistry() done\n");
964
965 return TRUE;
966}
LONG NTSTATUS
Definition: precomp.h:26
static WCHAR ServiceName[]
Definition: browser.c:19
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
Definition: bufpool.h:45
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:25
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
#define ASSERT(a)
Definition: mode.c:44
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define RTL_REGISTRY_HANDLE
Definition: nt_native.h:168
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define REG_DWORD
Definition: sdbapi.c:596
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by UpdateRegistry().

◆ ProcessKeyboardLayoutRegistry()

BOOLEAN ProcessKeyboardLayoutRegistry ( _In_ PCWSTR  pszLayoutId,
_In_ PCWSTR  LanguageId 
)

Definition at line 1267 of file settings.c.

1270{
1271 KLID LayoutId;
1272 const MUI_LAYOUTS* LayoutsList;
1273 MUI_LAYOUTS NewLayoutsList[20]; // HACK: Hardcoded fixed size "20" is a hack. Please verify against lang/*.h
1274 ULONG uIndex;
1275 ULONG uOldPos = 0;
1276
1277 LayoutId = (KLID)(pszLayoutId ? wcstoul(pszLayoutId, NULL, 16) : 0);
1278 if (LayoutId == 0)
1279 return FALSE;
1280
1281 LayoutsList = MUIGetLayoutsList(LanguageId);
1282
1283 /* If the keyboard layout is already at the top of the list, we are done */
1284 if (LayoutsList[0].LayoutID == LayoutId)
1285 return TRUE;
1286
1287 /* Otherwise, move it up to the top of the list */
1288 for (uIndex = 1; LayoutsList[uIndex].LangID != 0; ++uIndex)
1289 {
1290 if (LayoutsList[uIndex].LayoutID == LayoutId)
1291 {
1292 uOldPos = uIndex;
1293 continue;
1294 }
1295
1296 NewLayoutsList[uIndex].LangID = LayoutsList[uIndex].LangID;
1297 NewLayoutsList[uIndex].LayoutID = LayoutsList[uIndex].LayoutID;
1298 }
1299
1300 NewLayoutsList[uIndex].LangID = 0;
1301 NewLayoutsList[uIndex].LayoutID = 0;
1302 NewLayoutsList[uOldPos].LangID = LayoutsList[0].LangID;
1303 NewLayoutsList[uOldPos].LayoutID = LayoutsList[0].LayoutID;
1304 NewLayoutsList[0].LangID = LayoutsList[uOldPos].LangID;
1305 NewLayoutsList[0].LayoutID = LayoutsList[uOldPos].LayoutID;
1306
1307 return AddKbLayoutsToRegistry(NewLayoutsList);
1308}
BOOLEAN AddKbLayoutsToRegistry(_In_ const MUI_LAYOUTS *MuiLayouts)
Definition: mui.c:208
ULONG KLID
Definition: mui.h:10
LANGID LangID
Definition: mui.h:24
KLID LayoutID
Definition: mui.h:25

Referenced by UpdateRegistry().

◆ ProcessLocaleRegistry()

BOOLEAN ProcessLocaleRegistry ( _In_ PCWSTR  LanguageId)

Definition at line 969 of file settings.c.

971{
977
978 DPRINT("LanguageId: %S\n", LanguageId);
979
980 /* Open the default users locale key */
982 L".DEFAULT\\Control Panel\\International");
983
985 &KeyName,
988 NULL);
989
993 if (!NT_SUCCESS(Status))
994 {
995 DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
996 return FALSE;
997 }
998
999 /* Set default user locale */
1000 RtlInitUnicodeString(&ValueName, L"Locale");
1002 &ValueName,
1003 0,
1004 REG_SZ,
1005 (PVOID)LanguageId,
1006 (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1008 if (!NT_SUCCESS(Status))
1009 {
1010 DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1011 return FALSE;
1012 }
1013
1014 /* Skip first 4 zeroes */
1015 if (wcslen(LanguageId) >= 4)
1016 LanguageId += 4;
1017
1018 /* Open the NLS language key */
1020 L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language");
1021
1023 &KeyName,
1026 NULL);
1027
1031 if (!NT_SUCCESS(Status))
1032 {
1033 DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1034 return FALSE;
1035 }
1036
1037 /* Set default language */
1038 RtlInitUnicodeString(&ValueName, L"Default");
1040 &ValueName,
1041 0,
1042 REG_SZ,
1043 (PVOID)LanguageId,
1044 (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1045 if (!NT_SUCCESS(Status))
1046 {
1047 DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1049 return FALSE;
1050 }
1051
1052 /* Set install language */
1053 RtlInitUnicodeString(&ValueName, L"InstallLanguage");
1055 &ValueName,
1056 0,
1057 REG_SZ,
1058 (PVOID)LanguageId,
1059 (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1061 if (!NT_SUCCESS(Status))
1062 {
1063 DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1064 return FALSE;
1065 }
1066
1067 return TRUE;
1068}
#define REG_SZ
Definition: layer.c:22
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
#define HKEY_USERS
Definition: winreg.h:13

Referenced by UpdateRegistry().

◆ SetDefaultPagefile()

BOOLEAN SetDefaultPagefile ( _In_ WCHAR  Drive)

Definition at line 1370 of file settings.c.

1372{
1376 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
1378 WCHAR ValueBuffer[] = L"?:\\pagefile.sys 0 0\0";
1379
1381 &KeyName,
1384 NULL);
1388 if (!NT_SUCCESS(Status))
1389 return FALSE;
1390
1391 ValueBuffer[0] = Drive;
1392
1394 &ValueName,
1395 0,
1397 (PVOID)&ValueBuffer,
1398 sizeof(ValueBuffer));
1399
1401 return TRUE;
1402}
PWCHAR Drive
Definition: chkdsk.c:73
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by UpdateRegistry().

◆ SetGeoID()

BOOLEAN SetGeoID ( _In_ GEOID  GeoId)

Definition at line 1320 of file settings.c.

1322{
1327 /*
1328 * Buffer big enough to hold the NULL-terminated string L"4294967295",
1329 * corresponding to the literal 0xFFFFFFFF (MAXULONG) in decimal.
1330 */
1331 WCHAR Value[sizeof("4294967295")];
1332
1333 Status = RtlStringCchPrintfW(Value, _countof(Value), L"%lu", GeoId);
1335
1337 L".DEFAULT\\Control Panel\\International\\Geo");
1339 &Name,
1342 NULL);
1346 if (!NT_SUCCESS(Status))
1347 {
1348 DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1349 return FALSE;
1350 }
1351
1352 RtlInitUnicodeString(&Name, L"Nation");
1354 &Name,
1355 0,
1356 REG_SZ,
1357 (PVOID)Value,
1358 (wcslen(Value) + 1) * sizeof(WCHAR));
1360 if (!NT_SUCCESS(Status))
1361 {
1362 DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1363 return FALSE;
1364 }
1365
1366 return TRUE;
1367}
struct NameRec_ * Name
Definition: cdprocs.h:460
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by UpdateRegistry().