ReactOS  0.4.14-dev-608-gd495a4f
settings.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _GENENTRY
 

Typedefs

typedef struct _GENENTRY GENENTRY
 
typedef struct _GENENTRYPGENENTRY
 

Functions

PGENERIC_LIST CreateComputerTypeList (IN HINF InfFile)
 
PGENERIC_LIST CreateDisplayDriverList (IN HINF InfFile)
 
BOOLEAN ProcessComputerFiles (IN HINF InfFile, IN PGENERIC_LIST List, OUT PWSTR *AdditionalSectionName)
 
BOOLEAN ProcessDisplayRegistry (IN HINF InfFile, IN PGENERIC_LIST List)
 
PGENERIC_LIST CreateKeyboardDriverList (IN HINF InfFile)
 
PGENERIC_LIST CreateKeyboardLayoutList (IN HINF InfFile, IN PCWSTR LanguageId, OUT PWSTR DefaultKBLayout)
 
PGENERIC_LIST CreateLanguageList (IN HINF InfFile, OUT PWSTR DefaultLanguage)
 
ULONG GetDefaultLanguageIndex (VOID)
 
BOOLEAN ProcessKeyboardLayoutRegistry (IN PGENERIC_LIST List, IN PCWSTR LanguageId)
 
BOOLEAN ProcessKeyboardLayoutFiles (IN PGENERIC_LIST List)
 
BOOLEAN ProcessLocaleRegistry (IN PGENERIC_LIST List)
 
BOOLEAN SetGeoID (IN PCWSTR Id)
 
BOOLEAN SetDefaultPagefile (IN WCHAR Drive)
 

Typedef Documentation

◆ GENENTRY

◆ PGENENTRY

Function Documentation

◆ CreateComputerTypeList()

PGENERIC_LIST CreateComputerTypeList ( IN HINF  InfFile)

Definition at line 515 of file settings.c.

517 {
520 
522  if (List == NULL)
523  return NULL;
524 
525  Success = AddComputerTypeEntries(InfFile, List, L"Map.Computer");
526  Success |= AddComputerTypeEntries(InfFile, List, L"Map.Computer.NT" INF_ARCH);
527  if (!Success)
528  {
530  return NULL;
531  }
532 
533  return List;
534 }
#define TRUE
Definition: types.h:120
VOID DestroyGenericList(IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
Definition: genlist.c:36
BOOLEAN AddComputerTypeEntries(_In_ HINF InfFile, PGENERIC_LIST List, _In_ PWSTR SectionName)
Definition: settings.c:437
unsigned char BOOLEAN
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

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

◆ CreateDisplayDriverList()

PGENERIC_LIST CreateDisplayDriverList ( IN HINF  InfFile)

Definition at line 699 of file settings.c.

701 {
704  PCWSTR KeyName;
705  PCWSTR KeyValue;
706  WCHAR DisplayIdentifier[128];
707  WCHAR DisplayKey[32];
708 
709  /* Get the display identification */
710  if (!GetDisplayIdentifier(DisplayIdentifier, 128))
711  {
712  DisplayIdentifier[0] = 0;
713  }
714 
715  DPRINT("Display identifier: '%S'\n", DisplayIdentifier);
716 
717  /* Search for matching device identifier */
718  if (!SpInfFindFirstLine(InfFile, L"Map.Display", NULL, &Context))
719  {
720  /* FIXME: error message */
721  return NULL;
722  }
723 
724  do
725  {
726  BOOLEAN FoundId;
727 
728  if (!INF_GetDataField(&Context, 1, &KeyValue))
729  {
730  /* FIXME: Handle error! */
731  DPRINT("INF_GetDataField() failed\n");
732  return NULL;
733  }
734 
735  DPRINT("KeyValue: %S\n", KeyValue);
736  FoundId = !!wcsstr(DisplayIdentifier, KeyValue);
737  INF_FreeData(KeyValue);
738 
739  if (!FoundId)
740  continue;
741 
742  if (!INF_GetDataField(&Context, 0, &KeyName))
743  {
744  /* FIXME: Handle error! */
745  DPRINT("INF_GetDataField() failed\n");
746  return NULL;
747  }
748 
749  DPRINT("Display key: %S\n", KeyName);
750  RtlStringCchCopyW(DisplayKey, ARRAYSIZE(DisplayKey), KeyName);
752  } while (SpInfFindNextLine(&Context, &Context));
753 
755  if (List == NULL)
756  return NULL;
757 
759  InfFile,
760  L"Display",
761  &Context,
763  DisplayKey) == -1)
764  {
766  return NULL;
767  }
768 
769 #if 0
770  AppendGenericListEntry(List, L"Other display driver", NULL, TRUE);
771 #endif
772 
773  return List;
774 }
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
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:538
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:127
pSpInfFindNextLine SpInfFindNextLine
Definition: infsupp.c:88
struct tagContext Context
Definition: acpixf.h:1030

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

◆ CreateKeyboardDriverList()

PGENERIC_LIST CreateKeyboardDriverList ( IN HINF  InfFile)

Definition at line 1073 of file settings.c.

1075 {
1078 
1079  List = CreateGenericList();
1080  if (List == NULL)
1081  return NULL;
1082 
1084  InfFile,
1085  L"Keyboard",
1086  &Context,
1088  NULL) == -1)
1089  {
1091  return NULL;
1092  }
1093 
1094  return List;
1095 }
#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:1030

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

◆ CreateKeyboardLayoutList()

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

Definition at line 1210 of file settings.c.

1214 {
1217  PCWSTR KeyValue;
1218  const MUI_LAYOUTS* LayoutsList;
1219  ULONG uIndex = 0;
1220 
1221  /* Get default layout id */
1222  if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLayout", &Context))
1223  return NULL;
1224 
1225  if (!INF_GetData(&Context, NULL, &KeyValue))
1226  return NULL;
1227 
1228  wcscpy(DefaultKBLayout, KeyValue);
1229 
1230  List = CreateGenericList();
1231  if (List == NULL)
1232  return NULL;
1233 
1234  LayoutsList = MUIGetLayoutsList(LanguageId);
1235 
1236  do
1237  {
1238  // NOTE: See https://svn.reactos.org/svn/reactos?view=revision&revision=68354
1240  InfFile,
1241  L"KeyboardLayout",
1242  &Context,
1244  DefaultKBLayout) == -1)
1245  {
1247  return NULL;
1248  }
1249 
1250  uIndex++;
1251 
1252  } while (LayoutsList[uIndex].LangID != NULL);
1253 
1254  /* Check whether some keyboard layouts have been found */
1255  /* FIXME: Handle this case */
1256  if (GetNumberOfListEntries(List) == 0)
1257  {
1258  DPRINT1("No keyboard layouts have been found\n");
1260  return NULL;
1261  }
1262 
1263  return List;
1264 }
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:1030
unsigned int ULONG
Definition: retypes.h:1
Definition: mui.h:9
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 1160 of file settings.c.

1163 {
1166  PCWSTR KeyValue;
1167 
1168  LANG_ENTRY_PARAM LangEntryParam;
1169 
1170  LangEntryParam.uIndex = 0;
1171  LangEntryParam.DefaultLanguage = DefaultLanguage;
1172 
1173  /* Get default language id */
1174  if (!SpInfFindFirstLine(InfFile, L"NLS", L"DefaultLanguage", &Context))
1175  return NULL;
1176 
1177  if (!INF_GetData(&Context, NULL, &KeyValue))
1178  return NULL;
1179 
1180  wcscpy(DefaultLanguage, KeyValue);
1181 
1182  List = CreateGenericList();
1183  if (List == NULL)
1184  return NULL;
1185 
1187  InfFile,
1188  L"Language",
1189  &Context,
1191  &LangEntryParam) == -1)
1192  {
1194  return NULL;
1195  }
1196 
1197  /* Only one language available, make it the default one */
1198  if (LangEntryParam.uIndex == 1)
1199  {
1203  }
1204 
1205  return List;
1206 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
Definition: settings.c:1104
#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:1106
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:1112
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:67
PWCHAR DefaultLanguage
Definition: settings.c:1107
struct tagContext Context
Definition: acpixf.h:1030

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

◆ GetDefaultLanguageIndex()

ULONG GetDefaultLanguageIndex ( VOID  )

Definition at line 1099 of file settings.c.

1100 {
1101  return DefaultLanguageIndex;
1102 }
static ULONG DefaultLanguageIndex
Definition: settings.c:41

Referenced by LanguagePage().

◆ ProcessComputerFiles()

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

Definition at line 778 of file settings.c.

782 {
784  static WCHAR SectionName[128];
785 
786  DPRINT("ProcessComputerFiles() called\n");
787 
789  if (Entry == NULL)
790  return FALSE;
791 
792  RtlStringCchPrintfW(SectionName, ARRAYSIZE(SectionName),
793  L"Files.%s", ((PGENENTRY)GetListEntryData(Entry))->Id);
794  *AdditionalSectionName = SectionName;
795 
796  return TRUE;
797 }
Definition: genlist.h:10
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
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
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
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 800 of file settings.c.

803 {
807  PCWSTR Buffer;
809  ULONG StartValue;
810  ULONG Width, Height, Bpp;
814  WCHAR RegPath[255];
815 
816  DPRINT("ProcessDisplayRegistry() called\n");
817 
819  if (Entry == NULL)
820  return FALSE;
821 
822  if (!SpInfFindFirstLine(InfFile, L"Display",
824  &Context))
825  {
826  DPRINT1("SpInfFindFirstLine() failed\n");
827  return FALSE;
828  }
829 
830  /* Enable the correct driver */
832  {
833  DPRINT1("INF_GetDataField() failed\n");
834  return FALSE;
835  }
836 
837  ASSERT(wcslen(ServiceName) < 10);
838  DPRINT("Service name: '%S'\n", ServiceName);
839 
840  RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
841  L"System\\CurrentControlSet\\Services\\%s",
842  ServiceName);
843  RtlInitUnicodeString(&KeyName, RegPath);
845  &KeyName,
848  NULL);
852  if (!NT_SUCCESS(Status))
853  {
854  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
855  return FALSE;
856  }
857 
858  StartValue = 1;
860  L"Start",
861  REG_DWORD,
862  &StartValue,
863  sizeof(StartValue));
865  if (!NT_SUCCESS(Status))
866  {
867  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
868  return FALSE;
869  }
870 
871  /* Set the resolution */
872 
873  if (!INF_GetDataField(&Context, 4, &Buffer))
874  {
875  DPRINT1("INF_GetDataField() failed\n");
876  return FALSE;
877  }
878 
879  RtlStringCchPrintfW(RegPath, ARRAYSIZE(RegPath),
880  L"System\\CurrentControlSet\\Hardware Profiles\\Current\\System\\CurrentControlSet\\Services\\%s\\Device0",
881  ServiceName);
882  DPRINT("RegPath: '%S'\n", RegPath);
883  RtlInitUnicodeString(&KeyName, RegPath);
885  &KeyName,
888  NULL);
892  if (!NT_SUCCESS(Status))
893  {
894  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
895  return FALSE;
896  }
897 
898  Width = wcstoul(Buffer, NULL, 10);
900  L"DefaultSettings.XResolution",
901  REG_DWORD,
902  &Width,
903  sizeof(Width));
904  if (!NT_SUCCESS(Status))
905  {
906  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
908  return FALSE;
909  }
910 
911  if (!INF_GetDataField(&Context, 5, &Buffer))
912  {
913  DPRINT1("INF_GetDataField() failed\n");
915  return FALSE;
916  }
917 
918  Height = wcstoul(Buffer, 0, 0);
920  L"DefaultSettings.YResolution",
921  REG_DWORD,
922  &Height,
923  sizeof(Height));
924  if (!NT_SUCCESS(Status))
925  {
926  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
928  return FALSE;
929  }
930 
931  if (!INF_GetDataField(&Context, 6, &Buffer))
932  {
933  DPRINT1("INF_GetDataField() failed\n");
935  return FALSE;
936  }
937 
938  Bpp = wcstoul(Buffer, 0, 0);
940  L"DefaultSettings.BitsPerPel",
941  REG_DWORD,
942  &Bpp,
943  sizeof(Bpp));
944  if (!NT_SUCCESS(Status))
945  {
946  DPRINT1("RtlWriteRegistryValue() failed (Status %lx)\n", Status);
948  return FALSE;
949  }
950 
952 
953  DPRINT("ProcessDisplayRegistry() done\n");
954 
955  return TRUE;
956 }
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:4711
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:4711
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
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
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:1030
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().

◆ ProcessKeyboardLayoutFiles()

BOOLEAN ProcessKeyboardLayoutFiles ( IN PGENERIC_LIST  List)

◆ ProcessKeyboardLayoutRegistry()

BOOLEAN ProcessKeyboardLayoutRegistry ( IN PGENERIC_LIST  List,
IN PCWSTR  LanguageId 
)

Definition at line 1268 of file settings.c.

1271 {
1273  PCWSTR LayoutId;
1274  const MUI_LAYOUTS* LayoutsList;
1275  MUI_LAYOUTS NewLayoutsList[20];
1276  ULONG uIndex;
1277  ULONG uOldPos = 0;
1278 
1280  if (Entry == NULL)
1281  return FALSE;
1282 
1283  LayoutId = ((PGENENTRY)GetListEntryData(Entry))->Id;
1284  if (LayoutId == NULL)
1285  return FALSE;
1286 
1287  LayoutsList = MUIGetLayoutsList(LanguageId);
1288 
1289  if (_wcsicmp(LayoutsList[0].LayoutID, LayoutId) == 0)
1290  return TRUE;
1291 
1292  for (uIndex = 1; LayoutsList[uIndex].LangID != NULL; uIndex++)
1293  {
1294  if (_wcsicmp(LayoutsList[uIndex].LayoutID, LayoutId) == 0)
1295  {
1296  uOldPos = uIndex;
1297  continue;
1298  }
1299 
1300  NewLayoutsList[uIndex].LangID = LayoutsList[uIndex].LangID;
1301  NewLayoutsList[uIndex].LayoutID = LayoutsList[uIndex].LayoutID;
1302  }
1303 
1304  NewLayoutsList[uIndex].LangID = NULL;
1305  NewLayoutsList[uIndex].LayoutID = NULL;
1306  NewLayoutsList[uOldPos].LangID = LayoutsList[0].LangID;
1307  NewLayoutsList[uOldPos].LayoutID = LayoutsList[0].LayoutID;
1308  NewLayoutsList[0].LangID = LayoutsList[uOldPos].LangID;
1309  NewLayoutsList[0].LayoutID = LayoutsList[uOldPos].LayoutID;
1310 
1311  return AddKbLayoutsToRegistry(NewLayoutsList);
1312 }
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().

◆ ProcessLocaleRegistry()

BOOLEAN ProcessLocaleRegistry ( IN PGENERIC_LIST  List)

Definition at line 959 of file settings.c.

961 {
963  PCWSTR LanguageId;
967 
970 
972  if (Entry == NULL)
973  return FALSE;
974 
975  LanguageId = ((PGENENTRY)GetListEntryData(Entry))->Id;
976  if (LanguageId == NULL)
977  return FALSE;
978 
979  DPRINT("LanguageId: %S\n", LanguageId);
980 
981  /* Open the default users locale key */
983  L".DEFAULT\\Control Panel\\International");
984 
986  &KeyName,
989  NULL);
990 
994  if (!NT_SUCCESS(Status))
995  {
996  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
997  return FALSE;
998  }
999 
1000  /* Set default user locale */
1001  RtlInitUnicodeString(&ValueName, L"Locale");
1003  &ValueName,
1004  0,
1005  REG_SZ,
1006  (PVOID)LanguageId,
1007  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1008  NtClose(KeyHandle);
1009  if (!NT_SUCCESS(Status))
1010  {
1011  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1012  return FALSE;
1013  }
1014 
1015  /* Skip first 4 zeroes */
1016  if (wcslen(LanguageId) >= 4)
1017  LanguageId += 4;
1018 
1019  /* Open the NLS language key */
1021  L"SYSTEM\\CurrentControlSet\\Control\\NLS\\Language");
1022 
1024  &KeyName,
1027  NULL);
1028 
1030  KEY_SET_VALUE,
1031  &ObjectAttributes);
1032  if (!NT_SUCCESS(Status))
1033  {
1034  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1035  return FALSE;
1036  }
1037 
1038  /* Set default language */
1039  RtlInitUnicodeString(&ValueName, L"Default");
1041  &ValueName,
1042  0,
1043  REG_SZ,
1044  (PVOID)LanguageId,
1045  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1046  if (!NT_SUCCESS(Status))
1047  {
1048  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1049  NtClose(KeyHandle);
1050  return FALSE;
1051  }
1052 
1053  /* Set install language */
1054  RtlInitUnicodeString(&ValueName, L"InstallLanguage");
1056  &ValueName,
1057  0,
1058  REG_SZ,
1059  (PVOID)LanguageId,
1060  (wcslen(LanguageId) + 1) * sizeof(WCHAR));
1061  NtClose(KeyHandle);
1062  if (!NT_SUCCESS(Status))
1063  {
1064  DPRINT1("NtSetValueKey() failed (Status %lx)\n", Status);
1065  return FALSE;
1066  }
1067 
1068  return TRUE;
1069 }
#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:4711
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:4711
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 1367 of file settings.c.

1369 {
1370  NTSTATUS Status;
1371  HANDLE KeyHandle;
1373  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Memory Management");
1375  WCHAR ValueBuffer[] = L"?:\\pagefile.sys 0 0\0";
1376 
1378  &KeyName,
1381  NULL);
1384  &ObjectAttributes);
1385  if (!NT_SUCCESS(Status))
1386  return FALSE;
1387 
1388  ValueBuffer[0] = Drive;
1389 
1391  &ValueName,
1392  0,
1393  REG_MULTI_SZ,
1394  (PVOID)&ValueBuffer,
1395  sizeof(ValueBuffer));
1396 
1397  NtClose(KeyHandle);
1398  return TRUE;
1399 }
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:4711
#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:4711
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 1324 of file settings.c.

1326 {
1327  NTSTATUS Status;
1330  HANDLE KeyHandle;
1331 
1333  L".DEFAULT\\Control Panel\\International\\Geo");
1335  &Name,
1338  NULL);
1340  KEY_SET_VALUE,
1341  &ObjectAttributes);
1342  if (!NT_SUCCESS(Status))
1343  {
1344  DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
1345  return FALSE;
1346  }
1347 
1348  RtlInitUnicodeString(&Name, L"Nation");
1350  &Name,
1351  0,
1352  REG_SZ,
1353  (PVOID)Id,
1354  (wcslen(Id) + 1) * sizeof(WCHAR));
1355  NtClose(KeyHandle);
1356  if (!NT_SUCCESS(Status))
1357  {
1358  DPRINT1("NtSetValueKey() failed (Status = %lx)\n", Status);
1359  return FALSE;
1360  }
1361 
1362  return TRUE;
1363 }
#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:4711
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().