ReactOS  0.4.15-dev-3453-gff89651
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 PGENERIC_LIST List, OUT PWSTR *AdditionalSectionName)
 
BOOLEAN ProcessDisplayRegistry (IN HINF InfFile, IN PGENERIC_LIST List)
 
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 PGENERIC_LIST List, IN PCWSTR LanguageId)
 
BOOLEAN ProcessKeyboardLayoutFiles (IN PGENERIC_LIST List)
 
BOOLEAN ProcessLocaleRegistry (IN PGENERIC_LIST List)
 
BOOLEAN SetGeoID (IN PCWSTR Id)
 
BOOLEAN SetDefaultPagefile (IN WCHAR Drive)
 

Typedef Documentation

◆ GENENTRY

◆ PGENENTRY

Function Documentation

◆ CreateComputerTypeList()

PGENERIC_LIST CreateComputerTypeList ( IN HINF  InfFile)

Definition at line 520 of file settings.c.

522 {
525 
527  if (List == NULL)
528  return NULL;
529 
530  Success = AddComputerTypeEntries(InfFile, List, L"Map.Computer");
531  Success |= AddComputerTypeEntries(InfFile, List, L"Map.Computer.NT" INF_ARCH);
532  if (!Success)
533  {
535  return NULL;
536  }
537 
538  return List;
539 }
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
#define TRUE
Definition: types.h:120
#define L(x)
Definition: ntvdm.h:50
BOOLEAN AddComputerTypeEntries(_In_ HINF InfFile, PGENERIC_LIST List, _In_ PWSTR SectionName)
Definition: settings.c:442
unsigned char BOOLEAN
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define NULL
Definition: types.h:112

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

◆ CreateDisplayDriverList()

PGENERIC_LIST CreateDisplayDriverList ( IN HINF  InfFile)

Definition at line 704 of file settings.c.

706 {
709  PCWSTR KeyName;
710  PCWSTR KeyValue;
711  WCHAR DisplayIdentifier[128];
712  WCHAR DisplayKey[32];
713 
714  /* Get the display identification */
715  if (!GetDisplayIdentifier(DisplayIdentifier, 128))
716  {
717  DisplayIdentifier[0] = 0;
718  }
719 
720  DPRINT("Display identifier: '%S'\n", DisplayIdentifier);
721 
722  /* Search for matching device identifier */
723  if (!SpInfFindFirstLine(InfFile, L"Map.Display", NULL, &Context))
724  {
725  /* FIXME: error message */
726  return NULL;
727  }
728 
729  do
730  {
731  BOOLEAN FoundId;
732 
733  if (!INF_GetDataField(&Context, 1, &KeyValue))
734  {
735  /* FIXME: Handle error! */
736  DPRINT("INF_GetDataField() failed\n");
737  return NULL;
738  }
739 
740  DPRINT("KeyValue: %S\n", KeyValue);
741  FoundId = !!wcsstr(DisplayIdentifier, KeyValue);
742  INF_FreeData(KeyValue);
743 
744  if (!FoundId)
745  continue;
746 
747  if (!INF_GetDataField(&Context, 0, &KeyName))
748  {
749  /* FIXME: Handle error! */
750  DPRINT("INF_GetDataField() failed\n");
751  return NULL;
752  }
753 
754  DPRINT("Display key: %S\n", KeyName);
755  RtlStringCchCopyW(DisplayKey, ARRAYSIZE(DisplayKey), KeyName);
757  } while (SpInfFindNextLine(&Context, &Context));
758 
760  if (List == NULL)
761  return NULL;
762 
764  InfFile,
765  L"Display",
766  &Context,
768  DisplayKey) == -1)
769  {
771  return NULL;
772  }
773 
774 #if 0
775  AppendGenericListEntry(List, L"Other display driver", NULL, TRUE);
776 #endif
777 
778  return List;
779 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
static UCHAR NTAPI DefaultProcessEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:404
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
#define TRUE
Definition: types.h:120
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
#define L(x)
Definition: ntvdm.h:50
unsigned char BOOLEAN
BOOLEAN INF_GetDataField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PCWSTR *Data)
Definition: infsupp.c:42
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
static BOOLEAN GetDisplayIdentifier(OUT PWSTR Identifier, IN ULONG IdentifierLength)
Definition: settings.c:543
__wchar_t WCHAR
Definition: xmlstorage.h:180
FORCEINLINE VOID INF_FreeData(IN PCWSTR InfData)
Definition: infsupp.h:157
BOOLEAN AppendGenericListEntry(IN OUT PGENERIC_LIST List, IN PVOID Data, IN BOOLEAN Current)
Definition: genlist.c:62
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:336
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:127
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88
#define NULL
Definition: types.h:112
struct tagContext Context
Definition: acpixf.h:1034
#define DPRINT
Definition: sndvol32.h:71

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

◆ CreateKeyboardDriverList()

PGENERIC_LIST CreateKeyboardDriverList ( IN HINF  InfFile)

Definition at line 1078 of file settings.c.

1080 {
1083 
1084  List = CreateGenericList();
1085  if (List == NULL)
1086  return NULL;
1087 
1089  InfFile,
1090  L"Keyboard",
1091  &Context,
1093  NULL) == -1)
1094  {
1096  return NULL;
1097  }
1098 
1099  return List;
1100 }
static UCHAR NTAPI DefaultProcessEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:404
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
#define TRUE
Definition: types.h:120
#define L(x)
Definition: ntvdm.h:50
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
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:336
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define NULL
Definition: types.h:112
struct tagContext Context
Definition: acpixf.h:1034

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

◆ CreateKeyboardLayoutList()

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

Definition at line 1215 of file settings.c.

1219 {
1222  PCWSTR KeyValue;
1223  const MUI_LAYOUTS* LayoutsList;
1224  ULONG uIndex = 0;
1225 
1226  /* Get default layout id */
1227  if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLayout", &Context))
1228  return NULL;
1229 
1230  if (!INF_GetData(&Context, NULL, &KeyValue))
1231  return NULL;
1232 
1233  wcscpy(DefaultKBLayout, KeyValue);
1234 
1235  List = CreateGenericList();
1236  if (List == NULL)
1237  return NULL;
1238 
1239  LayoutsList = MUIGetLayoutsList(LanguageId);
1240 
1241  do
1242  {
1243  // NOTE: See https://svn.reactos.org/svn/reactos?view=revision&revision=68354
1245  InfFile,
1246  L"KeyboardLayout",
1247  &Context,
1249  DefaultKBLayout) == -1)
1250  {
1252  return NULL;
1253  }
1254 
1255  uIndex++;
1256 
1257  } while (LayoutsList[uIndex].LangID != NULL);
1258 
1259  /* Check whether some keyboard layouts have been found */
1260  /* FIXME: Handle this case */
1261  if (GetNumberOfListEntries(List) == 0)
1262  {
1263  DPRINT1("No keyboard layouts have been found\n");
1265  return NULL;
1266  }
1267 
1268  return List;
1269 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
ULONG GetNumberOfListEntries(IN PGENERIC_LIST List)
Definition: genlist.c:140
static UCHAR NTAPI DefaultProcessEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:404
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
#define TRUE
Definition: types.h:120
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
#define L(x)
Definition: ntvdm.h:50
const MUI_LAYOUTS * MUIGetLayoutsList(IN PCWSTR LanguageId)
Definition: mui.c:112
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
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:336
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
BOOLEAN INF_GetData(IN PINFCONTEXT Context, OUT PCWSTR *Key, OUT PCWSTR *Data)
Definition: infsupp.c:90
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
struct tagContext Context
Definition: acpixf.h:1034
unsigned int ULONG
Definition: retypes.h:1
Definition: mui.h:9
_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:1075
static WCHAR DefaultKBLayout[20]
Definition: usetup.c:68

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

◆ CreateLanguageList()

PGENERIC_LIST CreateLanguageList ( IN HINF  InfFile,
OUT PWSTR  DefaultLanguage 
)

Definition at line 1165 of file settings.c.

1168 {
1171  PCWSTR KeyValue;
1172 
1173  LANG_ENTRY_PARAM LangEntryParam;
1174 
1175  LangEntryParam.uIndex = 0;
1176  LangEntryParam.DefaultLanguage = DefaultLanguage;
1177 
1178  /* Get default language id */
1179  if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLanguage", &Context))
1180  return NULL;
1181 
1182  if (!INF_GetData(&Context, NULL, &KeyValue))
1183  return NULL;
1184 
1185  wcscpy(DefaultLanguage, KeyValue);
1186 
1187  List = CreateGenericList();
1188  if (List == NULL)
1189  return NULL;
1190 
1192  InfFile,
1193  L"Language",
1194  &Context,
1196  &LangEntryParam) == -1)
1197  {
1199  return NULL;
1200  }
1201 
1202  /* Only one language available, make it the default one */
1203  if (LangEntryParam.uIndex == 1)
1204  {
1208  }
1209 
1210  return List;
1211 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
Definition: settings.c:1109
PGENERIC_LIST_ENTRY GetFirstListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:104
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
#define TRUE
Definition: types.h:120
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
DWORD Id
ULONG uIndex
Definition: settings.c:1111
#define L(x)
Definition: ntvdm.h:50
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
static UCHAR NTAPI ProcessLangEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:1117
static ULONG DefaultLanguageIndex
Definition: settings.c:41
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
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:336
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
BOOLEAN INF_GetData(IN PINFCONTEXT Context, OUT PCWSTR *Key, OUT PCWSTR *Data)
Definition: infsupp.c:90
#define NULL
Definition: types.h:112
static WCHAR DefaultLanguage[20]
Definition: usetup.c:67
struct tagContext Context
Definition: acpixf.h:1034
PWCHAR DefaultLanguage
Definition: settings.c:1112

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

◆ GetDefaultLanguageIndex()

ULONG GetDefaultLanguageIndex ( VOID  )

Definition at line 1104 of file settings.c.

1105 {
1106  return DefaultLanguageIndex;
1107 }
static ULONG DefaultLanguageIndex
Definition: settings.c:41

Referenced by LanguagePage().

◆ ProcessComputerFiles()

BOOLEAN ProcessComputerFiles ( IN HINF  InfFile,
IN PGENERIC_LIST  List,
OUT PWSTR AdditionalSectionName 
)

Definition at line 783 of file settings.c.

787 {
789  static WCHAR SectionName[128];
790 
791  DPRINT("ProcessComputerFiles() called\n");
792 
794  if (Entry == NULL)
795  return FALSE;
796 
797  RtlStringCchPrintfW(SectionName, ARRAYSIZE(SectionName),
798  L"Files.%s", ((PGENENTRY)GetListEntryData(Entry))->Id);
799  *AdditionalSectionName = SectionName;
800 
801  return TRUE;
802 }
Definition: genlist.h:10
struct _Entry Entry
Definition: kefuncs.h:627
#define TRUE
Definition: types.h:120
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 ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD Id
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
__wchar_t WCHAR
Definition: xmlstorage.h:180
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define NULL
Definition: types.h:112
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:82
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97

Referenced by PrepareCopyInfFile().

◆ ProcessDisplayRegistry()

BOOLEAN ProcessDisplayRegistry ( IN HINF  InfFile,
IN PGENERIC_LIST  List 
)

Definition at line 805 of file settings.c.

808 {
812  PCWSTR Buffer;
814  ULONG StartValue;
815  ULONG Width, Height, Bpp;
819  WCHAR RegPath[255];
820 
821  DPRINT("ProcessDisplayRegistry() called\n");
822 
824  if (Entry == NULL)
825  return FALSE;
826 
827  if (!SpInfFindFirstLine(InfFile, L"Display",
829  &Context))
830  {
831  DPRINT1("SpInfFindFirstLine() failed\n");
832  return FALSE;
833  }
834 
835  /* Enable the correct driver */
837  {
838  DPRINT1("INF_GetDataField() failed\n");
839  return FALSE;
840  }
841 
842  ASSERT(wcslen(ServiceName) < 10);
843  DPRINT("Service name: '%S'\n", ServiceName);
844 
845  RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
846  L"System\\CurrentControlSet\\Services\\%s",
847  ServiceName);
848  RtlInitUnicodeString(&KeyName, RegPath);
850  &KeyName,
853  NULL);
857  if (!NT_SUCCESS(Status))
858  {
859  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
860  return FALSE;
861  }
862 
863  StartValue = 1;
865  L"Start",
866  REG_DWORD,
867  &StartValue,
868  sizeof(StartValue));
870  if (!NT_SUCCESS(Status))
871  {
872  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
873  return FALSE;
874  }
875 
876  /* Set the resolution */
877 
878  if (!INF_GetDataField(&Context, 4, &Buffer))
879  {
880  DPRINT1("INF_GetDataField() failed\n");
881  return FALSE;
882  }
883 
884  RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
885  L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0",
886  ServiceName);
887  DPRINT("RegPath: '%S'\n", RegPath);
888  RtlInitUnicodeString(&KeyName, RegPath);
890  &KeyName,
893  NULL);
897  if (!NT_SUCCESS(Status))
898  {
899  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
900  return FALSE;
901  }
902 
903  Width = wcstoul(Buffer, NULL, 10);
905  L"DefaultSettings.XResolution",
906  REG_DWORD,
907  &Width,
908  sizeof(Width));
909  if (!NT_SUCCESS(Status))
910  {
911  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
913  return FALSE;
914  }
915 
916  if (!INF_GetDataField(&Context, 5, &Buffer))
917  {
918  DPRINT1("INF_GetDataField() failed\n");
920  return FALSE;
921  }
922 
923  Height = wcstoul(Buffer, 0, 0);
925  L"DefaultSettings.YResolution",
926  REG_DWORD,
927  &Height,
928  sizeof(Height));
929  if (!NT_SUCCESS(Status))
930  {
931  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
933  return FALSE;
934  }
935 
936  if (!INF_GetDataField(&Context, 6, &Buffer))
937  {
938  DPRINT1("INF_GetDataField() failed\n");
940  return FALSE;
941  }
942 
943  Bpp = wcstoul(Buffer, 0, 0);
945  L"DefaultSettings.BitsPerPel",
946  REG_DWORD,
947  &Bpp,
948  sizeof(Bpp));
949  if (!NT_SUCCESS(Status))
950  {
951  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
953  return FALSE;
954  }
955 
957 
958  DPRINT("ProcessDisplayRegistry() done\n");
959 
960  return TRUE;
961 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
const uint16_t * PCWSTR
Definition: typedefs.h:57
Definition: genlist.h:10
struct _Entry Entry
Definition: kefuncs.h:627
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define TRUE
Definition: types.h:120
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
LONG NTSTATUS
Definition: precomp.h:26
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
DWORD Id
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
BOOLEAN INF_GetDataField(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PCWSTR *Data)
Definition: infsupp.c:42
Definition: bufpool.h:45
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
Status
Definition: gdiplustypes.h:24
LPTSTR ServiceName
Definition: ServiceMain.c:15
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3398
#define RTL_REGISTRY_HANDLE
Definition: nt_native.h:168
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
struct tagContext Context
Definition: acpixf.h:1034
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define DPRINT
Definition: sndvol32.h:71
#define REG_DWORD
Definition: sdbapi.c:596
base of all file and directory entries
Definition: entries.h:82
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by UpdateRegistry().

◆ ProcessKeyboardLayoutFiles()

BOOLEAN ProcessKeyboardLayoutFiles ( IN PGENERIC_LIST  List)

◆ ProcessKeyboardLayoutRegistry()

BOOLEAN ProcessKeyboardLayoutRegistry ( IN PGENERIC_LIST  List,
IN PCWSTR  LanguageId 
)

Definition at line 1273 of file settings.c.

1276 {
1278  PCWSTR LayoutId;
1279  const MUI_LAYOUTS* LayoutsList;
1280  MUI_LAYOUTS NewLayoutsList[20];
1281  ULONG uIndex;
1282  ULONG uOldPos = 0;
1283 
1285  if (Entry == NULL)
1286  return FALSE;
1287 
1288  LayoutId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1289  if (LayoutId == NULL)
1290  return FALSE;
1291 
1292  LayoutsList = MUIGetLayoutsList(LanguageId);
1293 
1294  if (_wcsicmp(LayoutsList[0].LayoutID, LayoutId) == 0)
1295  return TRUE;
1296 
1297  for (uIndex = 1; LayoutsList[uIndex].LangID != NULL; uIndex++)
1298  {
1299  if (_wcsicmp(LayoutsList[uIndex].LayoutID, LayoutId) == 0)
1300  {
1301  uOldPos = uIndex;
1302  continue;
1303  }
1304 
1305  NewLayoutsList[uIndex].LangID = LayoutsList[uIndex].LangID;
1306  NewLayoutsList[uIndex].LayoutID = LayoutsList[uIndex].LayoutID;
1307  }
1308 
1309  NewLayoutsList[uIndex].LangID = NULL;
1310  NewLayoutsList[uIndex].LayoutID = NULL;
1311  NewLayoutsList[uOldPos].LangID = LayoutsList[0].LangID;
1312  NewLayoutsList[uOldPos].LayoutID = LayoutsList[0].LayoutID;
1313  NewLayoutsList[0].LangID = LayoutsList[uOldPos].LangID;
1314  NewLayoutsList[0].LayoutID = LayoutsList[uOldPos].LayoutID;
1315 
1316  return AddKbLayoutsToRegistry(NewLayoutsList);
1317 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
Definition: genlist.h:10
struct _Entry Entry
Definition: kefuncs.h:627
#define TRUE
Definition: types.h:120
PCWSTR LangID
Definition: mui.h:11
DWORD Id
#define FALSE
Definition: types.h:117
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
const MUI_LAYOUTS * MUIGetLayoutsList(IN PCWSTR LanguageId)
Definition: mui.c:112
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
#define NULL
Definition: types.h:112
struct _GENENTRY * PGENENTRY
BOOLEAN AddKbLayoutsToRegistry(IN const MUI_LAYOUTS *MuiLayouts)
Definition: mui.c:208
unsigned int ULONG
Definition: retypes.h:1
PCWSTR LayoutID
Definition: mui.h:12
Definition: mui.h:9
base of all file and directory entries
Definition: entries.h:82
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97

Referenced by UpdateRegistry().

◆ ProcessLocaleRegistry()

BOOLEAN ProcessLocaleRegistry ( IN PGENERIC_LIST  List)

Definition at line 964 of file settings.c.

966 {
968  PCWSTR LanguageId;
972 
975 
977  if (Entry == NULL)
978  return FALSE;
979 
980  LanguageId = ((PGENENTRY)GetListEntryData(Entry))->Id;
981  if (LanguageId == NULL)
982  return FALSE;
983 
984  DPRINT("LanguageId: %S\n", LanguageId);
985 
986  /* Open the default users locale key */
988  L".DEFAULT\\Control Panel\\International");
989 
991  &KeyName,
994  NULL);
995 
999  if (!NT_SUCCESS(Status))
1000  {
1001  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1002  return FALSE;
1003  }
1004 
1005  /* Set default user locale */
1006  RtlInitUnicodeString(&ValueName, L"Locale");
1008  &ValueName,
1009  0,
1010  REG_SZ,
1011  (PVOID)LanguageId,
1012  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1013  NtClose(KeyHandle);
1014  if (!NT_SUCCESS(Status))
1015  {
1016  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1017  return FALSE;
1018  }
1019 
1020  /* Skip first 4 zeroes */
1021  if (wcslen(LanguageId) >= 4)
1022  LanguageId += 4;
1023 
1024  /* Open the NLS language key */
1026  L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language");
1027 
1029  &KeyName,
1032  NULL);
1033 
1035  KEY_SET_VALUE,
1036  &ObjectAttributes);
1037  if (!NT_SUCCESS(Status))
1038  {
1039  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1040  return FALSE;
1041  }
1042 
1043  /* Set default language */
1044  RtlInitUnicodeString(&ValueName, L"Default");
1046  &ValueName,
1047  0,
1048  REG_SZ,
1049  (PVOID)LanguageId,
1050  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1051  if (!NT_SUCCESS(Status))
1052  {
1053  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1054  NtClose(KeyHandle);
1055  return FALSE;
1056  }
1057 
1058  /* Set install language */
1059  RtlInitUnicodeString(&ValueName, L"InstallLanguage");
1061  &ValueName,
1062  0,
1063  REG_SZ,
1064  (PVOID)LanguageId,
1065  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1066  NtClose(KeyHandle);
1067  if (!NT_SUCCESS(Status))
1068  {
1069  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1070  return FALSE;
1071  }
1072 
1073  return TRUE;
1074 }
#define HKEY_USERS
Definition: winreg.h:13
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
const uint16_t * PCWSTR
Definition: typedefs.h:57
Definition: genlist.h:10
struct _Entry Entry
Definition: kefuncs.h:627
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
DWORD Id
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3398
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
#define NULL
Definition: types.h:112
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
struct _GENENTRY * PGENENTRY
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
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)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define DPRINT
Definition: sndvol32.h:71
base of all file and directory entries
Definition: entries.h:82
PGENERIC_LIST_ENTRY GetCurrentListEntry(IN PGENERIC_LIST List)
Definition: genlist.c:97
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by UpdateRegistry().

◆ SetDefaultPagefile()

BOOLEAN SetDefaultPagefile ( IN WCHAR  Drive)

Definition at line 1372 of file settings.c.

1374 {
1375  NTSTATUS Status;
1376  HANDLE KeyHandle;
1378  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
1380  WCHAR ValueBuffer[] = L"?:\\pagefile.sys 0 0\0";
1381 
1383  &KeyName,
1386  NULL);
1389  &ObjectAttributes);
1390  if (!NT_SUCCESS(Status))
1391  return FALSE;
1392 
1393  ValueBuffer[0] = Drive;
1394 
1396  &ValueName,
1397  0,
1398  REG_MULTI_SZ,
1399  (PVOID)&ValueBuffer,
1400  sizeof(ValueBuffer));
1401 
1402  NtClose(KeyHandle);
1403  return TRUE;
1404 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define REG_MULTI_SZ
Definition: nt_native.h:1501
PWCHAR Drive
Definition: chkdsk.c:73
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3398
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define NULL
Definition: types.h:112
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
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by UpdateRegistry().

◆ SetGeoID()

BOOLEAN SetGeoID ( IN PCWSTR  Id)

Definition at line 1329 of file settings.c.

1331 {
1332  NTSTATUS Status;
1335  HANDLE KeyHandle;
1336 
1338  L".DEFAULT\\Control Panel\\International\\Geo");
1340  &Name,
1343  NULL);
1345  KEY_SET_VALUE,
1346  &ObjectAttributes);
1347  if (!NT_SUCCESS(Status))
1348  {
1349  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1350  return FALSE;
1351  }
1352 
1353  RtlInitUnicodeString(&Name, L"Nation");
1355  &Name,
1356  0,
1357  REG_SZ,
1358  (PVOID)Id,
1359  (wcslen(Id) + 1) * sizeof(WCHAR));
1360  NtClose(KeyHandle);
1361  if (!NT_SUCCESS(Status))
1362  {
1363  DPRINT1("NtSetValueKey() failed (Status = %lx)\n", Status);
1364  return FALSE;
1365  }
1366 
1367  return TRUE;
1368 }
#define HKEY_USERS
Definition: winreg.h:13
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
DWORD Id
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
struct NameRec_ * Name
Definition: cdprocs.h:459
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3398
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
#define NULL
Definition: types.h:112
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
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
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)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_SZ
Definition: layer.c:22

Referenced by UpdateRegistry().