ReactOS  0.4.15-dev-3163-gf17c2c0
settings.c File Reference
#include "precomp.h"
#include "genlist.h"
#include "infsupp.h"
#include "mui.h"
#include "registry.h"
#include "settings.h"
#include <debug.h>
Include dependency graph for settings.c:

Go to the source code of this file.

Classes

struct  _LANG_ENTRY_PARAM
 

Macros

#define NDEBUG
 

Typedefs

typedef UCHAR(NTAPIPPROCESS_ENTRY_ROUTINE) (IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
 
typedef struct _LANG_ENTRY_PARAM LANG_ENTRY_PARAM
 
typedef struct _LANG_ENTRY_PARAMPLANG_ENTRY_PARAM
 

Functions

static BOOLEAN IsAcpiComputer (VOID)
 
static BOOLEAN GetComputerIdentifier (OUT PWSTR Identifier, IN ULONG IdentifierLength)
 
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)
 
static UCHAR NTAPI DefaultProcessEntry (IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
 
BOOLEAN AddComputerTypeEntries (_In_ HINF InfFile, PGENERIC_LIST List, _In_ PWSTR SectionName)
 
PGENERIC_LIST CreateComputerTypeList (IN HINF InfFile)
 
static BOOLEAN GetDisplayIdentifier (OUT PWSTR Identifier, IN ULONG IdentifierLength)
 
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)
 
BOOLEAN ProcessLocaleRegistry (IN PGENERIC_LIST List)
 
PGENERIC_LIST CreateKeyboardDriverList (IN HINF InfFile)
 
ULONG GetDefaultLanguageIndex (VOID)
 
static UCHAR NTAPI ProcessLangEntry (IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
 
PGENERIC_LIST CreateLanguageList (IN HINF InfFile, OUT PWSTR DefaultLanguage)
 
PGENERIC_LIST CreateKeyboardLayoutList (IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
 
BOOLEAN ProcessKeyboardLayoutRegistry (IN PGENERIC_LIST List, IN PCWSTR LanguageId)
 
BOOLEAN SetGeoID (IN PCWSTR Id)
 
BOOLEAN SetDefaultPagefile (IN WCHAR Drive)
 

Variables

static ULONG DefaultLanguageIndex = 0
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 36 of file settings.c.

Typedef Documentation

◆ LANG_ENTRY_PARAM

◆ PLANG_ENTRY_PARAM

◆ PPROCESS_ENTRY_ROUTINE

typedef UCHAR(NTAPI * PPROCESS_ENTRY_ROUTINE) (IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)

Definition at line 328 of file settings.c.

Function Documentation

◆ AddComputerTypeEntries()

BOOLEAN AddComputerTypeEntries ( _In_ HINF  InfFile,
PGENERIC_LIST  List,
_In_ PWSTR  SectionName 
)

Definition at line 442 of file settings.c.

446 {
448  PCWSTR KeyName;
449  PCWSTR KeyValue;
450  WCHAR ComputerIdentifier[128];
451  WCHAR ComputerKey[32];
452  ULONG Count1, Count2;
453 
454  /* Get the computer identification */
455  if (!GetComputerIdentifier(ComputerIdentifier, 128))
456  {
457  ComputerIdentifier[0] = 0;
458  }
459 
460  DPRINT("Computer identifier: '%S'\n", ComputerIdentifier);
461 
462  /* Search for matching device identifier */
463  if (!SpInfFindFirstLine(InfFile, SectionName, NULL, &Context))
464  {
465  /* FIXME: error message */
466  return FALSE;
467  }
468 
469  do
470  {
471  BOOLEAN FoundId;
472 
473  if (!INF_GetDataField(&Context, 1, &KeyValue))
474  {
475  /* FIXME: Handle error! */
476  DPRINT("INF_GetDataField() failed\n");
477  return FALSE;
478  }
479 
480  DPRINT("KeyValue: %S\n", KeyValue);
481  FoundId = !!wcsstr(ComputerIdentifier, KeyValue);
482  INF_FreeData(KeyValue);
483 
484  if (!FoundId)
485  continue;
486 
487  if (!INF_GetDataField(&Context, 0, &KeyName))
488  {
489  /* FIXME: Handle error! */
490  DPRINT("INF_GetDataField() failed\n");
491  return FALSE;
492  }
493 
494  DPRINT("Computer key: %S\n", KeyName);
495  RtlStringCchCopyW(ComputerKey, ARRAYSIZE(ComputerKey), KeyName);
497  } while (SpInfFindNextLine(&Context, &Context));
498 
500  InfFile,
501  L"Computer",
502  &Context,
504  ComputerKey);
506  InfFile,
507  L"Computer.NT" INF_ARCH,
508  &Context,
510  ComputerKey);
511  if ((Count1 == -1) && (Count2 == -1))
512  {
513  return FALSE;
514  }
515 
516  return TRUE;
517 }
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
#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 FALSE
Definition: types.h:117
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
FORCEINLINE VOID INF_FreeData(IN PCWSTR InfData)
Definition: infsupp.h:157
static const WCHAR L[]
Definition: oid.c:1250
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
static BOOLEAN GetComputerIdentifier(OUT PWSTR Identifier, IN ULONG IdentifierLength)
Definition: settings.c:213
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
unsigned int ULONG
Definition: retypes.h:1
#define DPRINT
Definition: sndvol32.h:71

Referenced by CreateComputerTypeList().

◆ AddEntriesFromInfSection()

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 
)
static

Definition at line 336 of file settings.c.

343 {
344  LONG TotalCount = 0;
345  PCWSTR KeyName;
346  PCWSTR KeyValue;
347  PVOID UserData;
348  BOOLEAN Current;
349  UCHAR RetVal;
350 
351  if (!SpInfFindFirstLine(InfFile, SectionName, NULL, pContext))
352  return -1;
353 
354  do
355  {
356  /*
357  * NOTE: Do not use INF_GetData() as it expects INF entries of exactly
358  * two fields ("key = value"); however we expect to be able to deal with
359  * entries having more than two fields, the only requirement being that
360  * the second field (field number 1) contains the field description.
361  */
362  if (!INF_GetDataField(pContext, 0, &KeyName))
363  {
364  DPRINT("INF_GetDataField() failed\n");
365  return -1;
366  }
367 
368  if (!INF_GetDataField(pContext, 1, &KeyValue))
369  {
370  DPRINT("INF_GetDataField() failed\n");
372  return -1;
373  }
374 
375  UserData = NULL;
376  Current = FALSE;
377  RetVal = ProcessEntry(KeyName,
378  KeyValue,
379  &UserData,
380  &Current,
381  Parameter);
383  INF_FreeData(KeyValue);
384 
385  if (RetVal == 0)
386  {
387  DPRINT("ProcessEntry() failed\n");
388  return -1;
389  }
390  else if (RetVal == 1)
391  {
393  ++TotalCount;
394  }
395  // else if (RetVal == 2), skip the entry.
396 
397  } while (SpInfFindNextLine(pContext, pContext));
398 
399  return TotalCount;
400 }
const uint16_t * PCWSTR
Definition: typedefs.h:57
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
_In_ PVOID Parameter
Definition: ldrtypes.h:241
#define FALSE
Definition: types.h:117
long LONG
Definition: pedump.c:60
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
struct tagUserData UserData
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
unsigned char UCHAR
Definition: xmlstorage.h:181
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88
#define NULL
Definition: types.h:112
#define DPRINT
Definition: sndvol32.h:71

Referenced by AddComputerTypeEntries(), CreateDisplayDriverList(), CreateKeyboardDriverList(), CreateKeyboardLayoutList(), and CreateLanguageList().

◆ 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
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
static const WCHAR L[]
Definition: oid.c:1250
_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
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 const WCHAR L[]
Definition: oid.c:1250
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
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
static const WCHAR L[]
Definition: oid.c:1250
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
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 const WCHAR L[]
Definition: oid.c:1250
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
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 const WCHAR L[]
Definition: oid.c:1250
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().

◆ DefaultProcessEntry()

static UCHAR NTAPI DefaultProcessEntry ( IN PCWSTR  KeyName,
IN PCWSTR  KeyValue,
OUT PVOID UserData,
OUT PBOOLEAN  Current,
IN PVOID Parameter  OPTIONAL 
)
static

Definition at line 404 of file settings.c.

410 {
411  PWSTR CompareKey = (PWSTR)Parameter;
412 
413  PGENENTRY GenEntry;
414  SIZE_T IdSize, ValueSize;
415 
416  IdSize = (wcslen(KeyName) + 1) * sizeof(WCHAR);
417  ValueSize = (wcslen(KeyValue) + 1) * sizeof(WCHAR);
418 
419  GenEntry = RtlAllocateHeap(ProcessHeap, 0,
420  sizeof(*GenEntry) + IdSize + ValueSize);
421  if (GenEntry == NULL)
422  {
423  /* Failure, stop enumeration */
424  DPRINT1("RtlAllocateHeap() failed\n");
425  return 0;
426  }
427 
428  GenEntry->Id = (PCWSTR)((ULONG_PTR)GenEntry + sizeof(*GenEntry));
429  GenEntry->Value = (PCWSTR)((ULONG_PTR)GenEntry + sizeof(*GenEntry) + IdSize);
430  RtlStringCbCopyW((PWSTR)GenEntry->Id, IdSize, KeyName);
431  RtlStringCbCopyW((PWSTR)GenEntry->Value, ValueSize, KeyValue);
432 
433  *UserData = GenEntry;
434  *Current = (CompareKey ? !_wcsicmp(KeyName, CompareKey) : FALSE);
435 
436  /* Add the entry */
437  return 1;
438 }
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:174
const uint16_t * PCWSTR
Definition: typedefs.h:57
uint16_t * PWSTR
Definition: typedefs.h:56
PCWSTR Value
Definition: settings.h:33
_In_ PVOID Parameter
Definition: ldrtypes.h:241
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE ProcessHeap
Definition: servman.c:15
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define NULL
Definition: types.h:112
PCWSTR Id
Definition: settings.h:32
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by AddComputerTypeEntries(), CreateDisplayDriverList(), CreateKeyboardDriverList(), and CreateKeyboardLayoutList().

◆ GetComputerIdentifier()

static BOOLEAN GetComputerIdentifier ( OUT PWSTR  Identifier,
IN ULONG  IdentifierLength 
)
static

Definition at line 213 of file settings.c.

216 {
219  LPCWSTR ComputerIdentifier;
220  HANDLE ProcessorsKey;
221  PKEY_FULL_INFORMATION pFullInfo;
222  ULONG Size, SizeNeeded;
224 
225  DPRINT("GetComputerIdentifier() called\n");
226 
227  Size = sizeof(KEY_FULL_INFORMATION);
228  pFullInfo = (PKEY_FULL_INFORMATION)RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);
229  if (!pFullInfo)
230  {
231  DPRINT("RtlAllocateHeap() failed\n");
232  return FALSE;
233  }
234 
235  /* Open the processors key */
237  L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor");
239  &KeyName,
241  NULL,
242  NULL);
243 
244  Status = NtOpenKey(&ProcessorsKey,
247  if (!NT_SUCCESS(Status))
248  {
249  DPRINT("NtOpenKey() failed (Status 0x%lx)\n", Status);
250  RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
251  return FALSE;
252  }
253 
254  /* Get number of subkeys */
255  Status = NtQueryKey(ProcessorsKey,
257  pFullInfo,
258  Size,
259  &Size);
260  NtClose(ProcessorsKey);
262  {
263  DPRINT("NtQueryKey() failed (Status 0x%lx)\n", Status);
264  RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
265  return FALSE;
266  }
267 
268  /* Find computer identifier */
269  if (pFullInfo->SubKeys == 0)
270  {
271  /* Something strange happened. No processor detected */
272  RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
273  return FALSE;
274  }
275 
276 #ifdef _M_AMD64
277  /* On x64 we are l33t and use the MP config by default */
278  ComputerIdentifier = L"X64 MP";
279 #else
280  if (IsAcpiComputer())
281  {
282  if (pFullInfo->SubKeys == 1)
283  {
284  /* Computer is mono-CPU */
285  ComputerIdentifier = L"ACPI UP";
286  }
287  else
288  {
289  /* Computer is multi-CPUs */
290  ComputerIdentifier = L"ACPI MP";
291  }
292  }
293  else
294  {
295  if (pFullInfo->SubKeys == 1)
296  {
297  /* Computer is mono-CPU */
298  ComputerIdentifier = L"PC UP";
299  }
300  else
301  {
302  /* Computer is multi-CPUs */
303  ComputerIdentifier = L"PC MP";
304  }
305  }
306 #endif
307 
308  RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
309 
310  /* Copy computer identifier to return buffer */
311  SizeNeeded = (wcslen(ComputerIdentifier) + 1) * sizeof(WCHAR);
312  if (SizeNeeded > IdentifierLength)
313  return FALSE;
314 
315  RtlCopyMemory(Identifier, ComputerIdentifier, SizeNeeded);
316 
317  return TRUE;
318 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
NTSTATUS NTAPI NtQueryKey(IN HANDLE KeyHandle, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:632
#define FALSE
Definition: types.h:117
static BOOLEAN IsAcpiComputer(VOID)
Definition: settings.c:47
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _KEY_FULL_INFORMATION KEY_FULL_INFORMATION
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3398
static const WCHAR L[]
Definition: oid.c:1250
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
struct _KEY_FULL_INFORMATION * PKEY_FULL_INFORMATION
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
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 RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define DPRINT
Definition: sndvol32.h:71

Referenced by AddComputerTypeEntries().

◆ 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().

◆ GetDisplayIdentifier()

static BOOLEAN GetDisplayIdentifier ( OUT PWSTR  Identifier,
IN ULONG  IdentifierLength 
)
static

Definition at line 543 of file settings.c.

546 {
549  WCHAR Buffer[32];
550  HANDLE BusKey;
551  HANDLE BusInstanceKey;
552  HANDLE ControllerKey;
553  HANDLE ControllerInstanceKey;
554  ULONG BusInstance;
555  ULONG ControllerInstance;
560 
561  DPRINT("GetDisplayIdentifier() called\n");
562 
563  /* Open the bus key */
565  L"\\Registry\\Machine\\HARDWARE\\Description\\System\\MultifunctionAdapter");
567  &KeyName,
569  NULL,
570  NULL);
571 
572  Status = NtOpenKey(&BusKey,
575  if (!NT_SUCCESS(Status))
576  {
577  DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
578  return FALSE;
579  }
580 
581  BusInstance = 0;
582  while (TRUE)
583  {
584  RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer), L"%lu", BusInstance);
587  &KeyName,
589  BusKey,
590  NULL);
591 
592  Status = NtOpenKey(&BusInstanceKey,
595  if (!NT_SUCCESS(Status))
596  {
597  DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
598  NtClose(BusKey);
599  return FALSE;
600  }
601 
602  /* Open the controller type key */
603  RtlInitUnicodeString(&KeyName, L"DisplayController");
605  &KeyName,
607  BusInstanceKey,
608  NULL);
609 
610  Status = NtOpenKey(&ControllerKey,
613  if (NT_SUCCESS(Status))
614  {
615  ControllerInstance = 0;
616 
617  while (TRUE)
618  {
619  /* Open the pointer controller instance key */
620  RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer), L"%lu", ControllerInstance);
623  &KeyName,
625  ControllerKey,
626  NULL);
627 
628  Status = NtOpenKey(&ControllerInstanceKey,
631  if (!NT_SUCCESS(Status))
632  {
633  DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
634  NtClose(ControllerKey);
635  NtClose(BusInstanceKey);
636  NtClose(BusKey);
637  return FALSE;
638  }
639 
640  /* Get controller identifier */
641  RtlInitUnicodeString(&KeyName, L"Identifier");
642 
644  256 * sizeof(WCHAR);
645  ValueInfo = (KEY_VALUE_PARTIAL_INFORMATION*) RtlAllocateHeap(RtlGetProcessHeap(),
646  0,
647  BufferLength);
648  if (ValueInfo == NULL)
649  {
650  DPRINT("RtlAllocateHeap() failed\n");
651  NtClose(ControllerInstanceKey);
652  NtClose(ControllerKey);
653  NtClose(BusInstanceKey);
654  NtClose(BusKey);
655  return FALSE;
656  }
657 
658  Status = NtQueryValueKey(ControllerInstanceKey,
659  &KeyName,
661  ValueInfo,
662  BufferLength,
663  &ReturnedLength);
664  if (NT_SUCCESS(Status))
665  {
666  DPRINT("Identifier: %S\n", (PWSTR)ValueInfo->Data);
667 
668  BufferLength = min(ValueInfo->DataLength / sizeof(WCHAR), IdentifierLength);
669  RtlCopyMemory(Identifier,
670  ValueInfo->Data,
671  BufferLength * sizeof(WCHAR));
672  Identifier[BufferLength] = 0;
673 
674  RtlFreeHeap(RtlGetProcessHeap(),
675  0,
676  ValueInfo);
677 
678  NtClose(ControllerInstanceKey);
679  NtClose(ControllerKey);
680  NtClose(BusInstanceKey);
681  NtClose(BusKey);
682  return TRUE;
683  }
684 
685  NtClose(ControllerInstanceKey);
686 
687  ControllerInstance++;
688  }
689 
690  NtClose(ControllerKey);
691  }
692 
693  NtClose(BusInstanceKey);
694 
695  BusInstance++;
696  }
697 
698  NtClose(BusKey);
699 
700  return FALSE;
701 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
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
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
Status
Definition: gdiplustypes.h:24
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
__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
static const WCHAR L[]
Definition: oid.c:1250
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
Definition: batclass.h:187
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
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 RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define DPRINT
Definition: sndvol32.h:71
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

Referenced by CreateDisplayDriverList().

◆ IsAcpiComputer()

static BOOLEAN IsAcpiComputer ( VOID  )
static

Definition at line 47 of file settings.c.

48 {
49  UNICODE_STRING MultiKeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter");
50  UNICODE_STRING IdentifierU = RTL_CONSTANT_STRING(L"Identifier");
51  UNICODE_STRING AcpiBiosIdentifier = RTL_CONSTANT_STRING(L"ACPI BIOS");
53  PKEY_BASIC_INFORMATION pDeviceInformation = NULL;
54  ULONG DeviceInfoLength = sizeof(KEY_BASIC_INFORMATION) + 50 * sizeof(WCHAR);
55  PKEY_VALUE_PARTIAL_INFORMATION pValueInformation = NULL;
56  ULONG ValueInfoLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 50 * sizeof(WCHAR);
58  ULONG IndexDevice = 0;
60  HANDLE hDevicesKey = NULL;
61  HANDLE hDeviceKey = NULL;
63  BOOLEAN ret = FALSE;
64 
66  &MultiKeyPathU,
68  NULL,
69  NULL);
70  Status = NtOpenKey(&hDevicesKey,
73  if (!NT_SUCCESS(Status))
74  {
75  DPRINT("NtOpenKey() failed with status 0x%08lx\n", Status);
76  goto cleanup;
77  }
78 
79  pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength);
80  if (!pDeviceInformation)
81  {
82  DPRINT("RtlAllocateHeap() failed\n");
84  goto cleanup;
85  }
86 
87  pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength);
88  if (!pValueInformation)
89  {
90  DPRINT("RtlAllocateHeap() failed\n");
92  goto cleanup;
93  }
94 
95  while (TRUE)
96  {
97  Status = NtEnumerateKey(hDevicesKey,
98  IndexDevice,
100  pDeviceInformation,
101  DeviceInfoLength,
102  &RequiredSize);
104  break;
106  {
107  RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation);
108  DeviceInfoLength = RequiredSize;
109  pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength);
110  if (!pDeviceInformation)
111  {
112  DPRINT("RtlAllocateHeap() failed\n");
114  goto cleanup;
115  }
116  Status = NtEnumerateKey(hDevicesKey,
117  IndexDevice,
119  pDeviceInformation,
120  DeviceInfoLength,
121  &RequiredSize);
122  }
123  if (!NT_SUCCESS(Status))
124  {
125  DPRINT("NtEnumerateKey() failed with status 0x%08lx\n", Status);
126  goto cleanup;
127  }
128  IndexDevice++;
129 
130  /* Open device key */
131  DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength;
132  DeviceName.Buffer = pDeviceInformation->Name;
134  &DeviceName,
136  hDevicesKey,
137  NULL);
138  Status = NtOpenKey(&hDeviceKey,
141  if (!NT_SUCCESS(Status))
142  {
143  DPRINT("NtOpenKey() failed with status 0x%08lx\n", Status);
144  goto cleanup;
145  }
146 
147  /* Read identifier */
148  Status = NtQueryValueKey(hDeviceKey,
149  &IdentifierU,
151  pValueInformation,
152  ValueInfoLength,
153  &RequiredSize);
155  {
156  RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation);
157  ValueInfoLength = RequiredSize;
158  pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength);
159  if (!pValueInformation)
160  {
161  DPRINT("RtlAllocateHeap() failed\n");
163  goto cleanup;
164  }
165  Status = NtQueryValueKey(hDeviceKey,
166  &IdentifierU,
168  pValueInformation,
169  ValueInfoLength,
170  &RequiredSize);
171  }
172  if (!NT_SUCCESS(Status))
173  {
174  DPRINT("NtQueryValueKey() failed with status 0x%08lx\n", Status);
175  goto nextdevice;
176  }
177  else if (pValueInformation->Type != REG_SZ)
178  {
179  DPRINT("Wrong registry type: got 0x%lx, expected 0x%lx\n", pValueInformation->Type, REG_SZ);
180  goto nextdevice;
181  }
182 
183  ValueName.Length = ValueName.MaximumLength = pValueInformation->DataLength;
184  ValueName.Buffer = (PWCHAR)pValueInformation->Data;
185  if (ValueName.Length >= sizeof(WCHAR) && ValueName.Buffer[ValueName.Length / sizeof(WCHAR) - 1] == UNICODE_NULL)
186  ValueName.Length -= sizeof(WCHAR);
187  if (RtlEqualUnicodeString(&ValueName, &AcpiBiosIdentifier, FALSE))
188  {
189  DPRINT("Found ACPI BIOS\n");
190  ret = TRUE;
191  goto cleanup;
192  }
193 
194 nextdevice:
195  NtClose(hDeviceKey);
196  hDeviceKey = NULL;
197  }
198 
199 cleanup:
200  if (pDeviceInformation)
201  RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation);
202  if (pValueInformation)
203  RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation);
204  if (hDevicesKey)
205  NtClose(hDevicesKey);
206  if (hDeviceKey)
207  NtClose(hDeviceKey);
208  return ret;
209 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:205
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
struct _KEY_BASIC_INFORMATION KEY_BASIC_INFORMATION
uint16_t * PWCHAR
Definition: typedefs.h:56
if(dx==0 &&dy==0)
Definition: linetemp.h:174
NTSYSAPI NTSTATUS NTAPI NtEnumerateKey(IN HANDLE KeyHandle, IN ULONG Index, IN KEY_INFORMATION_CLASS KeyInformationClass, IN PVOID KeyInformation, IN ULONG Length, IN PULONG ResultLength)
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3272
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
unsigned char BOOLEAN
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
Status
Definition: gdiplustypes.h:24
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
__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
int ret
static const WCHAR L[]
Definition: oid.c:1250
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
struct _KEY_VALUE_PARTIAL_INFORMATION KEY_VALUE_PARTIAL_INFORMATION
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
unsigned int ULONG
Definition: retypes.h:1
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
char * cleanup(char *str)
Definition: wpickclick.c:99
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4431
#define DPRINT
Definition: sndvol32.h:71
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define REG_SZ
Definition: layer.c:22

Referenced by GetComputerIdentifier().

◆ 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 FALSE
Definition: types.h:117
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
_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 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
static const WCHAR L[]
Definition: oid.c:1250
#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().

◆ 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().

◆ ProcessLangEntry()

static UCHAR NTAPI ProcessLangEntry ( IN PCWSTR  KeyName,
IN PCWSTR  KeyValue,
OUT PVOID UserData,
OUT PBOOLEAN  Current,
IN PVOID Parameter  OPTIONAL 
)
static

Definition at line 1117 of file settings.c.

1123 {
1124  PLANG_ENTRY_PARAM LangEntryParam = (PLANG_ENTRY_PARAM)Parameter;
1125 
1126  PGENENTRY GenEntry;
1127  SIZE_T IdSize, ValueSize;
1128 
1130  {
1131  /* The specified language is unavailable, skip the entry */
1132  return 2;
1133  }
1134 
1135  IdSize = (wcslen(KeyName) + 1) * sizeof(WCHAR);
1136  ValueSize = (wcslen(KeyValue) + 1) * sizeof(WCHAR);
1137 
1138  GenEntry = RtlAllocateHeap(ProcessHeap, 0,
1139  sizeof(*GenEntry) + IdSize + ValueSize);
1140  if (GenEntry == NULL)
1141  {
1142  /* Failure, stop enumeration */
1143  DPRINT1("RtlAllocateHeap() failed\n");
1144  return 0;
1145  }
1146 
1147  GenEntry->Id = (PCWSTR)((ULONG_PTR)GenEntry + sizeof(*GenEntry));
1148  GenEntry->Value = (PCWSTR)((ULONG_PTR)GenEntry + sizeof(*GenEntry) + IdSize);
1149  RtlStringCbCopyW((PWSTR)GenEntry->Id, IdSize, KeyName);
1150  RtlStringCbCopyW((PWSTR)GenEntry->Value, ValueSize, KeyValue);
1151 
1152  *UserData = GenEntry;
1153  *Current = FALSE;
1154 
1155  if (!_wcsicmp(KeyName, LangEntryParam->DefaultLanguage))
1156  DefaultLanguageIndex = LangEntryParam->uIndex;
1157 
1158  LangEntryParam->uIndex++;
1159 
1160  /* Add the entry */
1161  return 1;
1162 }
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:174
const uint16_t * PCWSTR
Definition: typedefs.h:57
Definition: settings.c:1109
uint16_t * PWSTR
Definition: typedefs.h:56
PCWSTR Value
Definition: settings.h:33
_In_ PVOID Parameter
Definition: ldrtypes.h:241
uint32_t ULONG_PTR
Definition: typedefs.h:65
ULONG uIndex
Definition: settings.c:1111
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
static ULONG DefaultLanguageIndex
Definition: settings.c:41
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE ProcessHeap
Definition: servman.c:15
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define NULL
Definition: types.h:112
BOOLEAN IsLanguageAvailable(IN PCWSTR LanguageId)
Definition: mui.c:70
PCWSTR Id
Definition: settings.h:32
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DPRINT1
Definition: precomp.h:8
PWCHAR DefaultLanguage
Definition: settings.c:1112
struct _LANG_ENTRY_PARAM * PLANG_ENTRY_PARAM
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by CreateLanguageList().

◆ 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 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
static const WCHAR L[]
Definition: oid.c:1250
_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 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
static const WCHAR L[]
Definition: oid.c:1250
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 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
static const WCHAR L[]
Definition: oid.c:1250
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().

Variable Documentation

◆ DefaultLanguageIndex

ULONG DefaultLanguageIndex = 0
static

Definition at line 41 of file settings.c.

Referenced by CreateLanguageList(), GetDefaultLanguageIndex(), and ProcessLangEntry().