ReactOS  0.4.13-dev-73-gcfe54aa
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)
 
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 323 of file settings.c.

Function Documentation

◆ 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 331 of file settings.c.

338 {
339  LONG TotalCount = 0;
340  PCWSTR KeyName;
341  PCWSTR KeyValue;
342  PVOID UserData;
343  BOOLEAN Current;
344  UCHAR RetVal;
345 
346  if (!SpInfFindFirstLine(InfFile, SectionName, NULL, pContext))
347  return -1;
348 
349  do
350  {
351  /*
352  * NOTE: Do not use INF_GetData() as it expects INF entries of exactly
353  * two fields ("key = value"); however we expect to be able to deal with
354  * entries having more than two fields, the only requirement being that
355  * the second field (field number 1) contains the field description.
356  */
357  if (!INF_GetDataField(pContext, 0, &KeyName))
358  {
359  DPRINT("INF_GetDataField() failed\n");
360  return -1;
361  }
362 
363  if (!INF_GetDataField(pContext, 1, &KeyValue))
364  {
365  DPRINT("INF_GetDataField() failed\n");
367  return -1;
368  }
369 
370  UserData = NULL;
371  Current = FALSE;
372  RetVal = ProcessEntry(KeyName,
373  KeyValue,
374  &UserData,
375  &Current,
376  Parameter);
378  INF_FreeData(KeyValue);
379 
380  if (RetVal == 0)
381  {
382  DPRINT("ProcessEntry() failed\n");
383  return -1;
384  }
385  else if (RetVal == 1)
386  {
388  ++TotalCount;
389  }
390  // else if (RetVal == 2), skip the entry.
391 
392  } while (SpInfFindNextLine(pContext, pContext));
393 
394  return TotalCount;
395 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
const uint16_t * PCWSTR
Definition: typedefs.h:55
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
_In_ PVOID Parameter
Definition: ldrtypes.h:240
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
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
LIST_ENTRY List
Definition: psmgr.c:57
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
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88

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

◆ CreateComputerTypeList()

PGENERIC_LIST CreateComputerTypeList ( IN HINF  InfFile)

Definition at line 437 of file settings.c.

439 {
442  PCWSTR KeyName;
443  PCWSTR KeyValue;
444  WCHAR ComputerIdentifier[128];
445  WCHAR ComputerKey[32];
446 
447  /* Get the computer identification */
448  if (!GetComputerIdentifier(ComputerIdentifier, 128))
449  {
450  ComputerIdentifier[0] = 0;
451  }
452 
453  DPRINT("Computer identifier: '%S'\n", ComputerIdentifier);
454 
455  /* Search for matching device identifier */
456  if (!SpInfFindFirstLine(InfFile, L"Map.Computer", NULL, &Context))
457  {
458  /* FIXME: error message */
459  return NULL;
460  }
461 
462  do
463  {
464  BOOLEAN FoundId;
465 
466  if (!INF_GetDataField(&Context, 1, &KeyValue))
467  {
468  /* FIXME: Handle error! */
469  DPRINT("INF_GetDataField() failed\n");
470  return NULL;
471  }
472 
473  DPRINT("KeyValue: %S\n", KeyValue);
474  FoundId = !!wcsstr(ComputerIdentifier, KeyValue);
475  INF_FreeData(KeyValue);
476 
477  if (!FoundId)
478  continue;
479 
480  if (!INF_GetDataField(&Context, 0, &KeyName))
481  {
482  /* FIXME: Handle error! */
483  DPRINT("INF_GetDataField() failed\n");
484  return NULL;
485  }
486 
487  DPRINT("Computer key: %S\n", KeyName);
488  RtlStringCchCopyW(ComputerKey, ARRAYSIZE(ComputerKey), KeyName);
490  } while (SpInfFindNextLine(&Context, &Context));
491 
493  if (List == NULL)
494  return NULL;
495 
497  InfFile,
498  L"Computer",
499  &Context,
501  ComputerKey) == -1)
502  {
504  return NULL;
505  }
506 
507  return List;
508 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define TRUE
Definition: types.h:120
static UCHAR NTAPI DefaultProcessEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:399
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
_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
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
LIST_ENTRY List
Definition: psmgr.c:57
__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:331
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:135
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88
struct tagContext Context
Definition: acpixf.h:1012

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

◆ CreateDisplayDriverList()

PGENERIC_LIST CreateDisplayDriverList ( IN HINF  InfFile)

Definition at line 673 of file settings.c.

675 {
678  PCWSTR KeyName;
679  PCWSTR KeyValue;
680  WCHAR DisplayIdentifier[128];
681  WCHAR DisplayKey[32];
682 
683  /* Get the display identification */
684  if (!GetDisplayIdentifier(DisplayIdentifier, 128))
685  {
686  DisplayIdentifier[0] = 0;
687  }
688 
689  DPRINT("Display identifier: '%S'\n", DisplayIdentifier);
690 
691  /* Search for matching device identifier */
692  if (!SpInfFindFirstLine(InfFile, L"Map.Display", NULL, &Context))
693  {
694  /* FIXME: error message */
695  return NULL;
696  }
697 
698  do
699  {
700  BOOLEAN FoundId;
701 
702  if (!INF_GetDataField(&Context, 1, &KeyValue))
703  {
704  /* FIXME: Handle error! */
705  DPRINT("INF_GetDataField() failed\n");
706  return NULL;
707  }
708 
709  DPRINT("KeyValue: %S\n", KeyValue);
710  FoundId = !!wcsstr(DisplayIdentifier, KeyValue);
711  INF_FreeData(KeyValue);
712 
713  if (!FoundId)
714  continue;
715 
716  if (!INF_GetDataField(&Context, 0, &KeyName))
717  {
718  /* FIXME: Handle error! */
719  DPRINT("INF_GetDataField() failed\n");
720  return NULL;
721  }
722 
723  DPRINT("Display key: %S\n", KeyName);
724  RtlStringCchCopyW(DisplayKey, ARRAYSIZE(DisplayKey), KeyName);
726  } while (SpInfFindNextLine(&Context, &Context));
727 
729  if (List == NULL)
730  return NULL;
731 
733  InfFile,
734  L"Display",
735  &Context,
737  DisplayKey) == -1)
738  {
740  return NULL;
741  }
742 
743 #if 0
744  AppendGenericListEntry(List, L"Other display driver", NULL, TRUE);
745 #endif
746 
747  return List;
748 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define TRUE
Definition: types.h:120
static UCHAR NTAPI DefaultProcessEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:399
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
_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
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
static BOOLEAN GetDisplayIdentifier(OUT PWSTR Identifier, IN ULONG IdentifierLength)
Definition: settings.c:512
LIST_ENTRY List
Definition: psmgr.c:57
__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:331
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:135
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88
struct tagContext Context
Definition: acpixf.h:1012

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

◆ CreateKeyboardDriverList()

PGENERIC_LIST CreateKeyboardDriverList ( IN HINF  InfFile)

Definition at line 1047 of file settings.c.

1049 {
1052 
1053  List = CreateGenericList();
1054  if (List == NULL)
1055  return NULL;
1056 
1058  InfFile,
1059  L"Keyboard",
1060  &Context,
1062  NULL) == -1)
1063  {
1065  return NULL;
1066  }
1067 
1068  return List;
1069 }
#define TRUE
Definition: types.h:120
static UCHAR NTAPI DefaultProcessEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:399
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
smooth NULL
Definition: ftsmooth.c:416
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
LIST_ENTRY List
Definition: psmgr.c:57
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:331
struct tagContext Context
Definition: acpixf.h:1012

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

◆ CreateKeyboardLayoutList()

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

Definition at line 1184 of file settings.c.

1188 {
1191  PCWSTR KeyValue;
1192  const MUI_LAYOUTS* LayoutsList;
1193  ULONG uIndex = 0;
1194 
1195  /* Get default layout id */
1196  if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLayout", &Context))
1197  return NULL;
1198 
1199  if (!INF_GetData(&Context, NULL, &KeyValue))
1200  return NULL;
1201 
1202  wcscpy(DefaultKBLayout, KeyValue);
1203 
1204  List = CreateGenericList();
1205  if (List == NULL)
1206  return NULL;
1207 
1208  LayoutsList = MUIGetLayoutsList(LanguageId);
1209 
1210  do
1211  {
1212  // NOTE: See https://svn.reactos.org/svn/reactos?view=revision&revision=68354
1214  InfFile,
1215  L"KeyboardLayout",
1216  &Context,
1218  DefaultKBLayout) == -1)
1219  {
1221  return NULL;
1222  }
1223 
1224  uIndex++;
1225 
1226  } while (LayoutsList[uIndex].LangID != NULL);
1227 
1228  /* Check whether some keyboard layouts have been found */
1229  /* FIXME: Handle this case */
1230  if (GetNumberOfListEntries(List) == 0)
1231  {
1232  DPRINT1("No keyboard layouts have been found\n");
1234  return NULL;
1235  }
1236 
1237  return List;
1238 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define TRUE
Definition: types.h:120
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:399
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
const MUI_LAYOUTS * MUIGetLayoutsList(IN PCWSTR LanguageId)
Definition: mui.c:111
smooth NULL
Definition: ftsmooth.c:416
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
LIST_ENTRY List
Definition: psmgr.c:57
_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:331
BOOLEAN INF_GetData(IN PINFCONTEXT Context, OUT PCWSTR *Key, OUT PCWSTR *Data)
Definition: infsupp.c:90
#define DPRINT1
Definition: precomp.h:8
struct tagContext Context
Definition: acpixf.h:1012
unsigned int ULONG
Definition: retypes.h:1
Definition: mui.h:9
static WCHAR DefaultKBLayout[20]
Definition: usetup.c:60

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

◆ CreateLanguageList()

PGENERIC_LIST CreateLanguageList ( IN HINF  InfFile,
OUT PWSTR  DefaultLanguage 
)

Definition at line 1134 of file settings.c.

1137 {
1140  PCWSTR KeyValue;
1141 
1142  LANG_ENTRY_PARAM LangEntryParam;
1143 
1144  LangEntryParam.uIndex = 0;
1145  LangEntryParam.DefaultLanguage = DefaultLanguage;
1146 
1147  /* Get default language id */
1148  if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLanguage", &Context))
1149  return NULL;
1150 
1151  if (!INF_GetData(&Context, NULL, &KeyValue))
1152  return NULL;
1153 
1154  wcscpy(DefaultLanguage, KeyValue);
1155 
1156  List = CreateGenericList();
1157  if (List == NULL)
1158  return NULL;
1159 
1161  InfFile,
1162  L"Language",
1163  &Context,
1165  &LangEntryParam) == -1)
1166  {
1168  return NULL;
1169  }
1170 
1171  /* Only one language available, make it the default one */
1172  if (LangEntryParam.uIndex == 1)
1173  {
1177  }
1178 
1179  return List;
1180 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
Definition: settings.c:1078
#define TRUE
Definition: types.h:120
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
pSpInfFindFirstLine SpInfFindFirstLine
Definition: infsupp.c:87
DWORD Id
ULONG uIndex
Definition: settings.c:1080
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
smooth NULL
Definition: ftsmooth.c:416
static UCHAR NTAPI ProcessLangEntry(IN PCWSTR KeyName, IN PCWSTR KeyValue, OUT PVOID *UserData, OUT PBOOLEAN Current, IN PVOID Parameter OPTIONAL)
Definition: settings.c:1086
static ULONG DefaultLanguageIndex
Definition: settings.c:41
PGENERIC_LIST CreateGenericList(VOID)
Definition: genlist.c:20
LIST_ENTRY List
Definition: psmgr.c:57
_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:331
BOOLEAN INF_GetData(IN PINFCONTEXT Context, OUT PCWSTR *Key, OUT PCWSTR *Data)
Definition: infsupp.c:90
static WCHAR DefaultLanguage[20]
Definition: usetup.c:59
PWCHAR DefaultLanguage
Definition: settings.c:1081
struct tagContext Context
Definition: acpixf.h:1012

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 399 of file settings.c.

405 {
406  PWSTR CompareKey = (PWSTR)Parameter;
407 
408  PGENENTRY GenEntry;
409  SIZE_T IdSize, ValueSize;
410 
411  IdSize = (wcslen(KeyName) + 1) * sizeof(WCHAR);
412  ValueSize = (wcslen(KeyValue) + 1) * sizeof(WCHAR);
413 
414  GenEntry = RtlAllocateHeap(ProcessHeap, 0,
415  sizeof(*GenEntry) + IdSize + ValueSize);
416  if (GenEntry == NULL)
417  {
418  /* Failure, stop enumeration */
419  DPRINT1("RtlAllocateHeap() failed\n");
420  return 0;
421  }
422 
423  GenEntry->Id = (PCWSTR)((ULONG_PTR)GenEntry + sizeof(*GenEntry));
424  GenEntry->Value = (PCWSTR)((ULONG_PTR)GenEntry + sizeof(*GenEntry) + IdSize);
425  RtlStringCbCopyW((PWSTR)GenEntry->Id, IdSize, KeyName);
426  RtlStringCbCopyW((PWSTR)GenEntry->Value, ValueSize, KeyValue);
427 
428  *UserData = GenEntry;
429  *Current = (CompareKey ? !_wcsicmp(KeyName, CompareKey) : FALSE);
430 
431  /* Add the entry */
432  return 1;
433 }
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:179
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
const uint16_t * PCWSTR
Definition: typedefs.h:55
uint16_t * PWSTR
Definition: typedefs.h:54
PCWSTR Value
Definition: settings.h:33
_In_ PVOID Parameter
Definition: ldrtypes.h:240
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE ProcessHeap
Definition: servman.c:15
ULONG_PTR SIZE_T
Definition: typedefs.h:78
PCWSTR Id
Definition: settings.h:32
#define DPRINT1
Definition: precomp.h:8
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by CreateComputerTypeList(), 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  if (IsAcpiComputer())
277  {
278  if (pFullInfo->SubKeys == 1)
279  {
280  /* Computer is mono-CPU */
281  ComputerIdentifier = L"ACPI UP";
282  }
283  else
284  {
285  /* Computer is multi-CPUs */
286  ComputerIdentifier = L"ACPI MP";
287  }
288  }
289  else
290  {
291  if (pFullInfo->SubKeys == 1)
292  {
293  /* Computer is mono-CPU */
294  ComputerIdentifier = L"PC UP";
295  }
296  else
297  {
298  /* Computer is multi-CPUs */
299  ComputerIdentifier = L"PC MP";
300  }
301  }
302 
303  RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
304 
305  /* Copy computer identifier to return buffer */
306  SizeNeeded = (wcslen(ComputerIdentifier) + 1) * sizeof(WCHAR);
307  if (SizeNeeded > IdentifierLength)
308  return FALSE;
309 
310  RtlCopyMemory(Identifier, ComputerIdentifier, SizeNeeded);
311 
312  return TRUE;
313 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
NTSTATUS NTAPI NtQueryKey(IN HANDLE KeyHandle, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG Length, OUT PULONG ResultLength)
Definition: ntapi.c:632
static BOOLEAN IsAcpiComputer(VOID)
Definition: settings.c:47
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
__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:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
struct _KEY_FULL_INFORMATION * PKEY_FULL_INFORMATION
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
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
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by CreateComputerTypeList().

◆ GetDefaultLanguageIndex()

ULONG GetDefaultLanguageIndex ( VOID  )

Definition at line 1073 of file settings.c.

1074 {
1075  return DefaultLanguageIndex;
1076 }
static ULONG DefaultLanguageIndex
Definition: settings.c:41

Referenced by LanguagePage().

◆ GetDisplayIdentifier()

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

Definition at line 512 of file settings.c.

515 {
518  WCHAR Buffer[32];
519  HANDLE BusKey;
520  HANDLE BusInstanceKey;
521  HANDLE ControllerKey;
522  HANDLE ControllerInstanceKey;
523  ULONG BusInstance;
524  ULONG ControllerInstance;
529 
530  DPRINT("GetDisplayIdentifier() called\n");
531 
532  /* Open the bus key */
534  L"\\Registry\\Machine\\HARDWARE\\Description\\System\\MultifunctionAdapter");
536  &KeyName,
538  NULL,
539  NULL);
540 
541  Status = NtOpenKey(&BusKey,
544  if (!NT_SUCCESS(Status))
545  {
546  DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
547  return FALSE;
548  }
549 
550  BusInstance = 0;
551  while (TRUE)
552  {
553  RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer), L"%lu", BusInstance);
556  &KeyName,
558  BusKey,
559  NULL);
560 
561  Status = NtOpenKey(&BusInstanceKey,
564  if (!NT_SUCCESS(Status))
565  {
566  DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
567  NtClose(BusKey);
568  return FALSE;
569  }
570 
571  /* Open the controller type key */
572  RtlInitUnicodeString(&KeyName, L"DisplayController");
574  &KeyName,
576  BusInstanceKey,
577  NULL);
578 
579  Status = NtOpenKey(&ControllerKey,
582  if (NT_SUCCESS(Status))
583  {
584  ControllerInstance = 0;
585 
586  while (TRUE)
587  {
588  /* Open the pointer controller instance key */
589  RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer), L"%lu", ControllerInstance);
592  &KeyName,
594  ControllerKey,
595  NULL);
596 
597  Status = NtOpenKey(&ControllerInstanceKey,
600  if (!NT_SUCCESS(Status))
601  {
602  DPRINT("NtOpenKey() failed (Status %lx)\n", Status);
603  NtClose(ControllerKey);
604  NtClose(BusInstanceKey);
605  NtClose(BusKey);
606  return FALSE;
607  }
608 
609  /* Get controller identifier */
610  RtlInitUnicodeString(&KeyName, L"Identifier");
611 
613  256 * sizeof(WCHAR);
614  ValueInfo = (KEY_VALUE_PARTIAL_INFORMATION*) RtlAllocateHeap(RtlGetProcessHeap(),
615  0,
616  BufferLength);
617  if (ValueInfo == NULL)
618  {
619  DPRINT("RtlAllocateHeap() failed\n");
620  NtClose(ControllerInstanceKey);
621  NtClose(ControllerKey);
622  NtClose(BusInstanceKey);
623  NtClose(BusKey);
624  return FALSE;
625  }
626 
627  Status = NtQueryValueKey(ControllerInstanceKey,
628  &KeyName,
630  ValueInfo,
631  BufferLength,
632  &ReturnedLength);
633  if (NT_SUCCESS(Status))
634  {
635  DPRINT("Identifier: %S\n", (PWSTR)ValueInfo->Data);
636 
637  BufferLength = min(ValueInfo->DataLength / sizeof(WCHAR), IdentifierLength);
638  RtlCopyMemory(Identifier,
639  ValueInfo->Data,
640  BufferLength * sizeof(WCHAR));
641  Identifier[BufferLength] = 0;
642 
643  RtlFreeHeap(RtlGetProcessHeap(),
644  0,
645  ValueInfo);
646 
647  NtClose(ControllerInstanceKey);
648  NtClose(ControllerKey);
649  NtClose(BusInstanceKey);
650  NtClose(BusKey);
651  return TRUE;
652  }
653 
654  NtClose(ControllerInstanceKey);
655 
656  ControllerInstance++;
657  }
658 
659  NtClose(ControllerKey);
660  }
661 
662  NtClose(BusInstanceKey);
663 
664  BusInstance++;
665  }
666 
667  NtClose(BusKey);
668 
669  return FALSE;
670 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
uint16_t * PWSTR
Definition: typedefs.h:54
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
_In_ ULONG BufferLength
Definition: usbdlib.h:225
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
static __inline NTSTATUS RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1064
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
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:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
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
Status
Definition: gdiplustypes.h:24
#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
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 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 TRUE
Definition: types.h:120
#define STATUS_NO_MORE_ENTRIES
Definition: ntstatus.h:193
USHORT MaximumLength
Definition: env_spec_w32.h:370
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
struct _KEY_BASIC_INFORMATION KEY_BASIC_INFORMATION
uint16_t * PWCHAR
Definition: typedefs.h:54
WCHAR DeviceName[]
Definition: adapter.cpp:21
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:64
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
#define UNICODE_NULL
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
_Inout_ PRTL_BUFFER _In_ SIZE_T RequiredSize
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
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)
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
int ret
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
#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:246
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
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 752 of file settings.c.

756 {
758  static WCHAR SectionName[128];
759 
760  DPRINT("ProcessComputerFiles() called\n");
761 
763  if (Entry == NULL)
764  return FALSE;
765 
766  RtlStringCchPrintfW(SectionName, ARRAYSIZE(SectionName),
767  L"Files.%s", ((PGENENTRY)GetListEntryData(Entry))->Id);
768  *AdditionalSectionName = SectionName;
769 
770  return TRUE;
771 }
Definition: genlist.h:10
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
DWORD Id
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
static __inline NTSTATUS RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1064
LIST_ENTRY List
Definition: psmgr.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR L[]
Definition: oid.c:1250
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 774 of file settings.c.

777 {
781  PCWSTR Buffer;
783  ULONG StartValue;
784  ULONG Width, Height, Bpp;
788  WCHAR RegPath[255];
789 
790  DPRINT("ProcessDisplayRegistry() called\n");
791 
793  if (Entry == NULL)
794  return FALSE;
795 
796  if (!SpInfFindFirstLine(InfFile, L"Display",
798  &Context))
799  {
800  DPRINT1("SpInfFindFirstLine() failed\n");
801  return FALSE;
802  }
803 
804  /* Enable the correct driver */
806  {
807  DPRINT1("INF_GetDataField() failed\n");
808  return FALSE;
809  }
810 
811  ASSERT(wcslen(ServiceName) < 10);
812  DPRINT("Service name: '%S'\n", ServiceName);
813 
814  RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
815  L"System\\CurrentControlSet\\Services\\%s",
816  ServiceName);
817  RtlInitUnicodeString(&KeyName, RegPath);
819  &KeyName,
822  NULL);
826  if (!NT_SUCCESS(Status))
827  {
828  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
829  return FALSE;
830  }
831 
832  StartValue = 1;
834  L"Start",
835  REG_DWORD,
836  &StartValue,
837  sizeof(StartValue));
839  if (!NT_SUCCESS(Status))
840  {
841  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
842  return FALSE;
843  }
844 
845  /* Set the resolution */
846 
847  if (!INF_GetDataField(&Context, 4, &Buffer))
848  {
849  DPRINT1("INF_GetDataField() failed\n");
850  return FALSE;
851  }
852 
853  RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
854  L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0",
855  ServiceName);
856  DPRINT("RegPath: '%S'\n", RegPath);
857  RtlInitUnicodeString(&KeyName, RegPath);
859  &KeyName,
862  NULL);
866  if (!NT_SUCCESS(Status))
867  {
868  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
869  return FALSE;
870  }
871 
872  Width = wcstoul(Buffer, NULL, 10);
874  L"DefaultSettings.XResolution",
875  REG_DWORD,
876  &Width,
877  sizeof(Width));
878  if (!NT_SUCCESS(Status))
879  {
880  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
882  return FALSE;
883  }
884 
885  if (!INF_GetDataField(&Context, 5, &Buffer))
886  {
887  DPRINT1("INF_GetDataField() failed\n");
889  return FALSE;
890  }
891 
892  Height = wcstoul(Buffer, 0, 0);
894  L"DefaultSettings.YResolution",
895  REG_DWORD,
896  &Height,
897  sizeof(Height));
898  if (!NT_SUCCESS(Status))
899  {
900  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
902  return FALSE;
903  }
904 
905  if (!INF_GetDataField(&Context, 6, &Buffer))
906  {
907  DPRINT1("INF_GetDataField() failed\n");
909  return FALSE;
910  }
911 
912  Bpp = wcstoul(Buffer, 0, 0);
914  L"DefaultSettings.BitsPerPel",
915  REG_DWORD,
916  &Bpp,
917  sizeof(Bpp));
918  if (!NT_SUCCESS(Status))
919  {
920  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
922  return FALSE;
923  }
924 
926 
927  DPRINT("ProcessDisplayRegistry() done\n");
928 
929  return TRUE;
930 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
const uint16_t * PCWSTR
Definition: typedefs.h:55
Definition: genlist.h:10
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
#define KEY_SET_VALUE
Definition: nt_native.h:1017
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
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
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
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
static __inline NTSTATUS RtlStringCchPrintfW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1064
LPTSTR ServiceName
Definition: ServiceMain.c:15
LIST_ENTRY List
Definition: psmgr.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG, PCWSTR, PCWSTR, ULONG, PVOID, ULONG)
static const WCHAR L[]
Definition: oid.c:1250
#define RTL_REGISTRY_HANDLE
Definition: nt_native.h:168
Status
Definition: gdiplustypes.h:24
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
#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:1012
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
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
#define REG_DWORD
Definition: sdbapi.c:596
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
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 1242 of file settings.c.

1245 {
1247  PCWSTR LayoutId;
1248  const MUI_LAYOUTS* LayoutsList;
1249  MUI_LAYOUTS NewLayoutsList[20];
1250  ULONG uIndex;
1251  ULONG uOldPos = 0;
1252 
1254  if (Entry == NULL)
1255  return FALSE;
1256 
1257  LayoutId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1258  if (LayoutId == NULL)
1259  return FALSE;
1260 
1261  LayoutsList = MUIGetLayoutsList(LanguageId);
1262 
1263  if (_wcsicmp(LayoutsList[0].LayoutID, LayoutId) == 0)
1264  return TRUE;
1265 
1266  for (uIndex = 1; LayoutsList[uIndex].LangID != NULL; uIndex++)
1267  {
1268  if (_wcsicmp(LayoutsList[uIndex].LayoutID, LayoutId) == 0)
1269  {
1270  uOldPos = uIndex;
1271  continue;
1272  }
1273 
1274  NewLayoutsList[uIndex].LangID = LayoutsList[uIndex].LangID;
1275  NewLayoutsList[uIndex].LayoutID = LayoutsList[uIndex].LayoutID;
1276  }
1277 
1278  NewLayoutsList[uIndex].LangID = NULL;
1279  NewLayoutsList[uIndex].LayoutID = NULL;
1280  NewLayoutsList[uOldPos].LangID = LayoutsList[0].LangID;
1281  NewLayoutsList[uOldPos].LayoutID = LayoutsList[0].LayoutID;
1282  NewLayoutsList[0].LangID = LayoutsList[uOldPos].LangID;
1283  NewLayoutsList[0].LayoutID = LayoutsList[uOldPos].LayoutID;
1284 
1285  return AddKbLayoutsToRegistry(NewLayoutsList);
1286 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
Definition: genlist.h:10
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
PCWSTR LangID
Definition: mui.h:11
DWORD Id
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
const MUI_LAYOUTS * MUIGetLayoutsList(IN PCWSTR LanguageId)
Definition: mui.c:111
smooth NULL
Definition: ftsmooth.c:416
LIST_ENTRY List
Definition: psmgr.c:57
struct _GENENTRY * PGENENTRY
BOOLEAN AddKbLayoutsToRegistry(IN const MUI_LAYOUTS *MuiLayouts)
Definition: mui.c:207
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 1086 of file settings.c.

1092 {
1093  PLANG_ENTRY_PARAM LangEntryParam = (PLANG_ENTRY_PARAM)Parameter;
1094 
1095  PGENENTRY GenEntry;
1096  SIZE_T IdSize, ValueSize;
1097 
1099  {
1100  /* The specified language is unavailable, skip the entry */
1101  return 2;
1102  }
1103 
1104  IdSize = (wcslen(KeyName) + 1) * sizeof(WCHAR);
1105  ValueSize = (wcslen(KeyValue) + 1) * sizeof(WCHAR);
1106 
1107  GenEntry = RtlAllocateHeap(ProcessHeap, 0,
1108  sizeof(*GenEntry) + IdSize + ValueSize);
1109  if (GenEntry == NULL)
1110  {
1111  /* Failure, stop enumeration */
1112  DPRINT1("RtlAllocateHeap() failed\n");
1113  return 0;
1114  }
1115 
1116  GenEntry->Id = (PCWSTR)((ULONG_PTR)GenEntry + sizeof(*GenEntry));
1117  GenEntry->Value = (PCWSTR)((ULONG_PTR)GenEntry + sizeof(*GenEntry) + IdSize);
1118  RtlStringCbCopyW((PWSTR)GenEntry->Id, IdSize, KeyName);
1119  RtlStringCbCopyW((PWSTR)GenEntry->Value, ValueSize, KeyValue);
1120 
1121  *UserData = GenEntry;
1122  *Current = FALSE;
1123 
1124  if (!_wcsicmp(KeyName, LangEntryParam->DefaultLanguage))
1125  DefaultLanguageIndex = LangEntryParam->uIndex;
1126 
1127  LangEntryParam->uIndex++;
1128 
1129  /* Add the entry */
1130  return 1;
1131 }
NTSTRSAFEAPI RtlStringCbCopyW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:179
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
const uint16_t * PCWSTR
Definition: typedefs.h:55
Definition: settings.c:1078
uint16_t * PWSTR
Definition: typedefs.h:54
PCWSTR Value
Definition: settings.h:33
_In_ PVOID Parameter
Definition: ldrtypes.h:240
uint32_t ULONG_PTR
Definition: typedefs.h:63
ULONG uIndex
Definition: settings.c:1080
smooth NULL
Definition: ftsmooth.c:416
static ULONG DefaultLanguageIndex
Definition: settings.c:41
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
__wchar_t WCHAR
Definition: xmlstorage.h:180
HANDLE ProcessHeap
Definition: servman.c:15
ULONG_PTR SIZE_T
Definition: typedefs.h:78
BOOLEAN IsLanguageAvailable(IN PCWSTR LanguageId)
Definition: mui.c:69
PCWSTR Id
Definition: settings.h:32
#define DPRINT1
Definition: precomp.h:8
PWCHAR DefaultLanguage
Definition: settings.c:1081
struct _LANG_ENTRY_PARAM * PLANG_ENTRY_PARAM
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_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 933 of file settings.c.

935 {
937  PCWSTR LanguageId;
941 
944 
946  if (Entry == NULL)
947  return FALSE;
948 
949  LanguageId = ((PGENENTRY)GetListEntryData(Entry))->Id;
950  if (LanguageId == NULL)
951  return FALSE;
952 
953  DPRINT("LanguageId: %S\n", LanguageId);
954 
955  /* Open the default users locale key */
957  L".DEFAULT\\Control Panel\\International");
958 
960  &KeyName,
963  NULL);
964 
968  if (!NT_SUCCESS(Status))
969  {
970  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
971  return FALSE;
972  }
973 
974  /* Set default user locale */
975  RtlInitUnicodeString(&ValueName, L"Locale");
977  &ValueName,
978  0,
979  REG_SZ,
980  (PVOID)LanguageId,
981  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
983  if (!NT_SUCCESS(Status))
984  {
985  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
986  return FALSE;
987  }
988 
989  /* Skip first 4 zeroes */
990  if (wcslen(LanguageId) >= 4)
991  LanguageId += 4;
992 
993  /* Open the NLS language key */
995  L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language");
996 
998  &KeyName,
1001  NULL);
1002 
1004  KEY_SET_VALUE,
1005  &ObjectAttributes);
1006  if (!NT_SUCCESS(Status))
1007  {
1008  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1009  return FALSE;
1010  }
1011 
1012  /* Set default language */
1013  RtlInitUnicodeString(&ValueName, L"Default");
1015  &ValueName,
1016  0,
1017  REG_SZ,
1018  (PVOID)LanguageId,
1019  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1020  if (!NT_SUCCESS(Status))
1021  {
1022  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1023  NtClose(KeyHandle);
1024  return FALSE;
1025  }
1026 
1027  /* Set install language */
1028  RtlInitUnicodeString(&ValueName, L"InstallLanguage");
1030  &ValueName,
1031  0,
1032  REG_SZ,
1033  (PVOID)LanguageId,
1034  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1035  NtClose(KeyHandle);
1036  if (!NT_SUCCESS(Status))
1037  {
1038  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1039  return FALSE;
1040  }
1041 
1042  return TRUE;
1043 }
#define HKEY_USERS
Definition: winreg.h:13
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
const uint16_t * PCWSTR
Definition: typedefs.h:55
Definition: genlist.h:10
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
#define KEY_SET_VALUE
Definition: nt_native.h:1017
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
LONG NTSTATUS
Definition: precomp.h:26
DWORD Id
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
PVOID GetListEntryData(IN PGENERIC_LIST_ENTRY Entry)
Definition: genlist.c:126
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
LIST_ENTRY List
Definition: psmgr.c:57
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
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
#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
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
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 1341 of file settings.c.

1343 {
1344  NTSTATUS Status;
1345  HANDLE KeyHandle;
1347  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
1349  WCHAR ValueBuffer[] = L"?:\\pagefile.sys 0 0\0";
1350 
1352  &KeyName,
1355  NULL);
1358  &ObjectAttributes);
1359  if (!NT_SUCCESS(Status))
1360  return FALSE;
1361 
1362  ValueBuffer[0] = Drive;
1363 
1365  &ValueName,
1366  0,
1367  REG_MULTI_SZ,
1368  (PVOID)&ValueBuffer,
1369  sizeof(ValueBuffer));
1370 
1371  NtClose(KeyHandle);
1372  return TRUE;
1373 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4693
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
#define REG_MULTI_SZ
Definition: nt_native.h:1501
PWCHAR Drive
Definition: chkdsk.c:73
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
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 1298 of file settings.c.

1300 {
1301  NTSTATUS Status;
1304  HANDLE KeyHandle;
1305 
1307  L".DEFAULT\\Control Panel\\International\\Geo");
1309  &Name,
1312  NULL);
1314  KEY_SET_VALUE,
1315  &ObjectAttributes);
1316  if (!NT_SUCCESS(Status))
1317  {
1318  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1319  return FALSE;
1320  }
1321 
1322  RtlInitUnicodeString(&Name, L"Nation");
1324  &Name,
1325  0,
1326  REG_SZ,
1327  (PVOID)Id,
1328  (wcslen(Id) + 1) * sizeof(WCHAR));
1329  NtClose(KeyHandle);
1330  if (!NT_SUCCESS(Status))
1331  {
1332  DPRINT1("NtSetValueKey() failed (Status = %lx)\n", Status);
1333  return FALSE;
1334  }
1335 
1336  return TRUE;
1337 }
#define HKEY_USERS
Definition: winreg.h:13
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
#define KEY_SET_VALUE
Definition: nt_native.h:1017
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4693
LONG NTSTATUS
Definition: precomp.h:26
DWORD Id
struct NameRec_ * Name
Definition: cdprocs.h:464
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
HANDLE GetRootKeyByPredefKey(IN HANDLE KeyHandle, OUT PCWSTR *RootKeyMountPoint OPTIONAL)
Definition: registry.c:90
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
#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
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#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().