Author: ion
Date: Thu Aug 29 21:00:54 2013
New Revision: 59882
URL:
http://svn.reactos.org/svn/reactos?rev=59882&view=rev
Log:
[BASESRV]: Fix definition of NLS_USER_INFO so that it matches exactly that of Server 2003
(this now makes BASE_SERVER_STATIC_DATA correct too).
[BASESRV]: Implement BaseSrvNlsGetUserInfo.
Modified:
trunk/reactos/include/reactos/subsys/win/base.h
trunk/reactos/include/reactos/subsys/win/basemsg.h
trunk/reactos/subsystems/win/basesrv/init.c
trunk/reactos/subsystems/win/basesrv/nls.c
Modified: trunk/reactos/include/reactos/subsys/win/base.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win…
==============================================================================
--- trunk/reactos/include/reactos/subsys/win/base.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/win/base.h [iso-8859-1] Thu Aug 29 21:00:54 2013
@@ -17,6 +17,7 @@
typedef struct _NLS_USER_INFO
{
+ WCHAR sLanguage[80];
WCHAR iCountry[80];
WCHAR sCountry[80];
WCHAR sList[80];
@@ -29,7 +30,7 @@
WCHAR iLZero[80];
WCHAR iNegNumber[80];
WCHAR sNativeDigits[80];
- WCHAR iDigitSubstitution[80];
+ WCHAR NumShape[80];
WCHAR sCurrency[80];
WCHAR sMonDecSep[80];
WCHAR sMonThouSep[80];
@@ -37,25 +38,29 @@
WCHAR iCurrDigits[80];
WCHAR iCurrency[80];
WCHAR iNegCurr[80];
- WCHAR sPosSign[80];
- WCHAR sNegSign[80];
+ WCHAR sPositiveSign[80];
+ WCHAR sNegativeSign[80];
WCHAR sTimeFormat[80];
+ WCHAR sTime[80];
+ WCHAR iTime[80];
+ WCHAR iTLZero[80];
+ WCHAR iTimePrefix[80];
WCHAR s1159[80];
WCHAR s2359[80];
WCHAR sShortDate[80];
+ WCHAR sDate[80];
+ WCHAR iDate[80];
WCHAR sYearMonth[80];
WCHAR sLongDate[80];
WCHAR iCalType[80];
- WCHAR iFirstDay[80];
- WCHAR iFirstWeek[80];
- WCHAR sLocale[80];
- WCHAR sLocaleName[85];
+ WCHAR iFirstDayOfWeek[80];
+ WCHAR iFirstWeekOfYear[80];
+ WCHAR Locale[80];
LCID UserLocaleId;
LUID InteractiveUserLuid;
- CHAR InteractiveUserSid[68]; // SECURITY_MAX_SID_SIZE to make ROS happy
ULONG ulCacheUpdateCount;
} NLS_USER_INFO, *PNLS_USER_INFO;
-
+C_ASSERT(sizeof(NLS_USER_INFO) == 0x1870);
typedef struct _BASE_STATIC_SERVER_DATA
{
@@ -82,6 +87,9 @@
BOOLEAN LUIDDeviceMapsEnabled;
ULONG TermsrvClientTimeZoneChangeNum;
} BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA;
+C_ASSERT(sizeof(BASE_STATIC_SERVER_DATA) == 0x1AC8);
+
+VOID WINAPI BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData);
#endif // _BASE_H
Modified: trunk/reactos/include/reactos/subsys/win/basemsg.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win…
==============================================================================
--- trunk/reactos/include/reactos/subsys/win/basemsg.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/win/basemsg.h [iso-8859-1] Thu Aug 29 21:00:54
2013
@@ -268,6 +268,12 @@
ULONG LocaleId;
} BASE_NLS_CREATE_SECTION, *PBASE_NLS_CREATE_SECTION;
+typedef struct
+{
+ PVOID /*PNLS_USER_INFO*/ NlsUserInfo;
+ ULONG Size;
+} BASE_NLS_GET_USER_INFO, *PBASE_NLS_GET_USER_INFO;
+
typedef struct _BASE_API_MESSAGE
{
PORT_MESSAGE Header;
@@ -297,6 +303,7 @@
BASE_REFRESH_INIFILE_MAPPING RefreshIniFileMappingRequest;
BASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest;
BASE_NLS_CREATE_SECTION NlsCreateSection;
+ BASE_NLS_GET_USER_INFO NlsGetUserInfo;
} Data;
} BASE_API_MESSAGE, *PBASE_API_MESSAGE;
Modified: trunk/reactos/subsystems/win/basesrv/init.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win/basesrv/ini…
==============================================================================
--- trunk/reactos/subsystems/win/basesrv/init.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win/basesrv/init.c [iso-8859-1] Thu Aug 29 21:00:54 2013
@@ -525,6 +525,9 @@
ASSERT(NT_SUCCESS(Status));
}
+ /* Initialize NLS */
+ BaseSrvNLSInit(BaseStaticServerData);
+
/* Finally, set the pointer */
LoadedServerDll->SharedSection = BaseStaticServerData;
}
Modified: trunk/reactos/subsystems/win/basesrv/nls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win/basesrv/nls…
==============================================================================
--- trunk/reactos/subsystems/win/basesrv/nls.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win/basesrv/nls.c [iso-8859-1] Thu Aug 29 21:00:54 2013
@@ -14,6 +14,9 @@
#include <debug.h>
/* GLOBALS ********************************************************************/
+
+RTL_CRITICAL_SECTION NlsCacheCriticalSection;
+PNLS_USER_INFO pNlsRegUserInfo;
BOOLEAN BaseSrvKernel32DelayLoadComplete;
HANDLE BaseSrvKernel32DllHandle;
@@ -102,6 +105,29 @@
return Status;
}
+VOID
+WINAPI
+BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData)
+{
+ /* Initialize the lock */
+ RtlInitializeCriticalSection(&NlsCacheCriticalSection);
+
+ /* Initialize the data with all F's */
+ pNlsRegUserInfo = &StaticData->NlsUserInfo;
+ RtlFillMemory(&StaticData->NlsUserInfo, 0xFF,
sizeof(StaticData->NlsUserInfo));
+
+ /* Set empty LCID */
+ pNlsRegUserInfo->UserLocaleId = 0;
+
+ /* Reset the cache update counter */
+ RtlEnterCriticalSection(&NlsCacheCriticalSection);
+ pNlsRegUserInfo->ulCacheUpdateCount = 0;
+ RtlLeaveCriticalSection(&NlsCacheCriticalSection);
+
+ /* Get the LCID */
+ NtQueryDefaultLocale(0, &pNlsRegUserInfo->UserLocaleId);
+}
+
/* PUBLIC SERVER APIS *********************************************************/
CSR_API(BaseSrvNlsSetUserInfo)
@@ -268,8 +294,32 @@
CSR_API(BaseSrvNlsGetUserInfo)
{
- DPRINT1("%s not yet implemented\n", __FUNCTION__);
- return STATUS_NOT_IMPLEMENTED;
+ NTSTATUS Status;
+ PBASE_NLS_GET_USER_INFO NlsMsg =
&((PBASE_API_MESSAGE)ApiMessage)->Data.NlsGetUserInfo;
+
+ /* Make sure the buffer is valid and of the right size */
+ if ((CsrValidateMessageBuffer(ApiMessage, &NlsMsg->NlsUserInfo,
NlsMsg->Size, TRUE)) &&
+ (NlsMsg->Size == sizeof(NLS_USER_INFO)))
+ {
+ /* Acquire the lock to prevent updates while we copy */
+ Status = RtlEnterCriticalSection(&NlsCacheCriticalSection);
+ if (NT_SUCCESS(Status))
+ {
+ /* Do the copy now, then drop the lock */
+ RtlCopyMemory(&NlsMsg->NlsUserInfo, pNlsRegUserInfo,
NlsMsg->Size);
+ DPRINT1("NLS Data copy complete\n");
+ RtlLeaveCriticalSection(&NlsCacheCriticalSection);
+ }
+ }
+ else
+ {
+ /* The data was invalid, bail out */
+ DPRINT1("NLS: Size of info is invalid: %lx vs %lx\n", NlsMsg->Size,
sizeof(NLS_USER_INFO));
+ Status = STATUS_INVALID_PARAMETER;
+ }
+
+ /* All done */
+ return Status;
}
/* EOF */