* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
NULL);
Status = NtOpenKey(&BusKey,
- KEY_ALL_ACCESS,
+ KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
NULL);
Status = NtOpenKey(&BusInstanceKey,
- KEY_ALL_ACCESS,
+ KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
NULL);
Status = NtOpenKey(&ControllerKey,
- KEY_ALL_ACCESS,
+ KEY_ENUMERATE_SUB_KEYS,
&ObjectAttributes);
if (NT_SUCCESS(Status))
{
NULL);
Status = NtOpenKey(&ControllerInstanceKey,
- KEY_ALL_ACCESS,
+ KEY_QUERY_VALUE,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
{
NULL);
Status = NtOpenKey(&KeyHandle,
- KEY_ALL_ACCESS,
+ KEY_SET_VALUE,
&ObjectAttributes);
if (!NT_SUCCESS(Status))
PWCHAR UserData;
const MUI_LAYOUTS * LayoutsList;
ULONG uIndex = 0;
+ BOOL KeyboardLayoutsFound = FALSE;
/* Get default layout id */
if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLayout", &Context))
/* FIXME: Handle error! */
DPRINT("INF_GetData() failed\n");
DestroyGenericList(List, FALSE);
- break;
+ return NULL;
}
if (_wcsicmp(LayoutsList[uIndex].LayoutID, KeyName) == 0)
if (UserData == NULL)
{
/* FIXME: Handle error! */
+ DPRINT("RtlAllocateHeap() failed\n");
+ DestroyGenericList(List, FALSE);
+ return NULL;
}
wcscpy(UserData, KeyName);
Buffer,
UserData,
_wcsicmp(KeyName, DefaultKBLayout) ? FALSE : TRUE);
+ KeyboardLayoutsFound = TRUE;
}
-
+
} while (SetupFindNextLine(&Context, &Context));
uIndex++;
} while (LayoutsList[uIndex].LangID != NULL);
+ /* FIXME: Handle this case */
+ if (!KeyboardLayoutsFound)
+ {
+ DPRINT1("No keyboard layouts have been found\n");
+ DestroyGenericList(List, FALSE);
+ return NULL;
+ }
+
return List;
}
PWCHAR LayoutId;
const MUI_LAYOUTS * LayoutsList;
MUI_LAYOUTS NewLayoutsList[20];
- ULONG uIndex = 0;
+ ULONG uIndex;
ULONG uOldPos = 0;
Entry = GetCurrentListEntry(List);
if (_wcsicmp(LayoutsList[0].LayoutID, LayoutId) != 0)
{
- do
+ for (uIndex = 1; LayoutsList[uIndex].LangID != NULL; uIndex++)
{
if (_wcsicmp(LayoutsList[uIndex].LayoutID, LayoutId) == 0)
{
uOldPos = uIndex;
+ continue;
}
- uIndex++;
-
- } while (LayoutsList[uIndex].LangID != NULL);
+ NewLayoutsList[uIndex].LangID = LayoutsList[uIndex].LangID;
+ NewLayoutsList[uIndex].LayoutID = LayoutsList[uIndex].LayoutID;
+ }
NewLayoutsList[uIndex].LangID = NULL;
NewLayoutsList[uIndex].LayoutID = NULL;
}
#endif
+BOOLEAN
+SetGeoID(PWCHAR Id)
+{
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ UNICODE_STRING KeyName;
+ UNICODE_STRING ValueName;
+ HANDLE KeyHandle;
+ WCHAR szKeyName[] = L"\\Registry\\User\\.DEFAULT\\Control Panel\\International\\Geo";
+ WCHAR szValueName[] = L"Nation";
+ NTSTATUS Status;
+ RtlInitUnicodeString(&KeyName,
+ szKeyName);
+ InitializeObjectAttributes(&ObjectAttributes,
+ &KeyName,
+ OBJ_CASE_INSENSITIVE,
+ NULL,
+ NULL);
+
+ Status = NtOpenKey(&KeyHandle,
+ KEY_SET_VALUE,
+ &ObjectAttributes);
+ if(!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
+ return FALSE;
+ }
+ RtlInitUnicodeString(&ValueName, szValueName);
+ Status = NtSetValueKey(KeyHandle,
+ &ValueName,
+ 0,
+ REG_SZ,
+ (PVOID)Id,
+ (wcslen(Id) * sizeof(WCHAR)));
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("NtSetValueKey() failed (Status = %lx)\n", Status);
+ NtClose(KeyHandle);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
/* EOF */