mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 15:38:37 +00:00
[SYSTEMINFO]
* Fix System Locale field * Fix Input Locale field svn path=/trunk/; revision=51228
This commit is contained in:
parent
91e657f782
commit
888f3912cb
2 changed files with 28 additions and 23 deletions
|
@ -18,13 +18,12 @@
|
||||||
|
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <lm.h>
|
#include <lm.h>
|
||||||
|
#include <shlwapi.h>
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
|
@ -56,7 +55,7 @@ RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR Buf)
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey) != ERROR_SUCCESS)
|
&hKey) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
//wprintf("Warning! Cannot open %s. Last error: %lu.\n", lpSubKey, GetLastError());
|
wprintf(L"Warning! Cannot open %s. Last error: %lu.\n", lpSubKey, GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +66,7 @@ RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR Buf)
|
||||||
(LPBYTE)Buf,
|
(LPBYTE)Buf,
|
||||||
&dwBytes) != ERROR_SUCCESS || (dwType != REG_SZ && dwType != REG_MULTI_SZ))
|
&dwBytes) != ERROR_SUCCESS || (dwType != REG_SZ && dwType != REG_MULTI_SZ))
|
||||||
{
|
{
|
||||||
//wprintf("Warning! Cannot query %s. Last error: %lu, type: %lu.\n", lpValueName, GetLastError(), dwType);
|
wprintf(L"Warning! Cannot query %s. Last error: %lu, type: %lu.\n", lpValueName, GetLastError(), dwType);
|
||||||
dwBytes = 0;
|
dwBytes = 0;
|
||||||
bRet = FALSE;
|
bRet = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +95,7 @@ RegGetDWORD(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPDWORD lpData)
|
||||||
KEY_QUERY_VALUE,
|
KEY_QUERY_VALUE,
|
||||||
&hKey) != ERROR_SUCCESS)
|
&hKey) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
wprintf(L"Warning! Cannot open %s. Last error: %lu.\n", lpSubKey, GetLastError());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ RegGetDWORD(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPDWORD lpData)
|
||||||
(LPBYTE)lpData,
|
(LPBYTE)lpData,
|
||||||
&dwBytes) != ERROR_SUCCESS || dwType != REG_DWORD)
|
&dwBytes) != ERROR_SUCCESS || dwType != REG_DWORD)
|
||||||
{
|
{
|
||||||
//wprintf("Warning! Cannot query %s. Last err: %lu, type: %lu\n", lpValueName, GetLastError(), dwType);
|
wprintf(L"Warning! Cannot query %s. Last err: %lu, type: %lu\n", lpValueName, GetLastError(), dwType);
|
||||||
*lpData = 0;
|
*lpData = 0;
|
||||||
bRet = FALSE;
|
bRet = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ AllSysInfo(VOID)
|
||||||
SYSTEM_INFO SysInfo;
|
SYSTEM_INFO SysInfo;
|
||||||
WCHAR Buf[BUFFER_SIZE], Tmp[BUFFER_SIZE], Msg[BUFFER_SIZE], szSystemDir[MAX_PATH];
|
WCHAR Buf[BUFFER_SIZE], Tmp[BUFFER_SIZE], Msg[BUFFER_SIZE], szSystemDir[MAX_PATH];
|
||||||
const WCHAR *lpcszSysType;
|
const WCHAR *lpcszSysType;
|
||||||
LPWSTR lpNetBuffer;
|
LPWSTR lpBuffer;
|
||||||
NETSETUP_JOIN_STATUS NetJoinStatus;
|
NETSETUP_JOIN_STATUS NetJoinStatus;
|
||||||
MEMORYSTATUS MemoryStatus;
|
MEMORYSTATUS MemoryStatus;
|
||||||
unsigned int cSeconds;
|
unsigned int cSeconds;
|
||||||
|
@ -367,32 +367,36 @@ AllSysInfo(VOID)
|
||||||
wprintf(Msg, Buf);
|
wprintf(Msg, Buf);
|
||||||
|
|
||||||
//getting System Locale
|
//getting System Locale
|
||||||
if (RegGetSZ(HKEY_CURRENT_USER,
|
if (GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, Tmp, BUFFER_SIZE))
|
||||||
L"Control Panel\\International",
|
|
||||||
L"Locale",
|
|
||||||
Tmp))
|
|
||||||
if (RegGetSZ(HKEY_CLASSES_ROOT,
|
if (RegGetSZ(HKEY_CLASSES_ROOT,
|
||||||
L"MIME\\Database\\Rfc1766",
|
L"MIME\\Database\\Rfc1766",
|
||||||
Tmp,
|
Tmp,
|
||||||
Buf))
|
Buf))
|
||||||
|
{
|
||||||
|
/* get rid of @filename,resource */
|
||||||
|
lpBuffer = wcschr(Buf, L';');
|
||||||
|
if (lpBuffer)
|
||||||
|
SHLoadIndirectString(lpBuffer+1, lpBuffer+1, BUFFER_SIZE - (lpBuffer-Buf) - 1, NULL);
|
||||||
|
|
||||||
if (GetOemStrings(IDS_SYS_LOCALE, Msg))
|
if (GetOemStrings(IDS_SYS_LOCALE, Msg))
|
||||||
wprintf(Msg, Buf);
|
wprintf(Msg, Buf);
|
||||||
|
}
|
||||||
|
|
||||||
//getting Input Locale
|
//getting Input Locale
|
||||||
if (RegGetSZ(HKEY_CURRENT_USER,
|
if (RegGetSZ(HKEY_CURRENT_USER,
|
||||||
L"Keyboard Layout\\Preload",
|
L"Keyboard Layout\\Preload",
|
||||||
L"1",
|
L"1",
|
||||||
Buf))
|
Tmp) && wcslen(Tmp) > 4)
|
||||||
{
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
for(j = 0, i = 4; i <= 8; j++, i++)
|
|
||||||
Tmp[j] = Buf[i];
|
|
||||||
|
|
||||||
if (RegGetSZ(HKEY_CLASSES_ROOT,
|
if (RegGetSZ(HKEY_CLASSES_ROOT,
|
||||||
L"MIME\\Database\\Rfc1766",
|
L"MIME\\Database\\Rfc1766",
|
||||||
Tmp,
|
Tmp + 4,
|
||||||
Buf))
|
Buf))
|
||||||
|
{
|
||||||
|
/* get rid of @filename,resource */
|
||||||
|
lpBuffer = wcschr(Buf, L';');
|
||||||
|
if (lpBuffer)
|
||||||
|
SHLoadIndirectString(lpBuffer+1, lpBuffer+1, BUFFER_SIZE - (lpBuffer-Buf) - 1, NULL);
|
||||||
|
|
||||||
if (GetOemStrings(IDS_INPUT_LOCALE, Msg))
|
if (GetOemStrings(IDS_INPUT_LOCALE, Msg))
|
||||||
wprintf(Msg, Buf);
|
wprintf(Msg, Buf);
|
||||||
}
|
}
|
||||||
|
@ -476,12 +480,12 @@ AllSysInfo(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting Domain
|
//getting Domain
|
||||||
if (NetGetJoinInformation (NULL, &lpNetBuffer, &NetJoinStatus) == NERR_Success)
|
if (NetGetJoinInformation (NULL, &lpBuffer, &NetJoinStatus) == NERR_Success)
|
||||||
{
|
{
|
||||||
if(GetOemStrings(IDS_DOMAIN, Msg))
|
if(GetOemStrings(IDS_DOMAIN, Msg))
|
||||||
wprintf(Msg, lpNetBuffer);
|
wprintf(Msg, lpBuffer);
|
||||||
|
|
||||||
NetApiBufferFree(lpNetBuffer);
|
NetApiBufferFree(lpBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
//getting Logon Server
|
//getting Logon Server
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<library>ntdll</library>
|
<library>ntdll</library>
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>netapi32</library>
|
<library>netapi32</library>
|
||||||
|
<library>shlwapi</library>
|
||||||
<file>systeminfo.c</file>
|
<file>systeminfo.c</file>
|
||||||
<file>systeminfo.rc</file>
|
<file>systeminfo.rc</file>
|
||||||
<file>rsrc.rc</file>
|
<file>rsrc.rc</file>
|
||||||
|
|
Loading…
Reference in a new issue