Author: ekohl Date: Wed Apr 15 21:04:43 2015 New Revision: 67210
URL: http://svn.reactos.org/svn/reactos?rev=67210&view=rev Log: [SRVSVC] Implement NetrRemoteTOD. CORE-5423 #resolve #comment Committed in r67210.
Modified: trunk/reactos/base/services/srvsvc/rpcserver.c
Modified: trunk/reactos/base/services/srvsvc/rpcserver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/srvsvc/rpcser... ============================================================================== --- trunk/reactos/base/services/srvsvc/rpcserver.c [iso-8859-1] (original) +++ trunk/reactos/base/services/srvsvc/rpcserver.c [iso-8859-1] Wed Apr 15 21:04:43 2015 @@ -28,6 +28,8 @@
#include "precomp.h"
+#include "ndk/kefuncs.h" +#include "ndk/rtlfuncs.h" #include "winerror.h" #include "lmerr.h"
@@ -446,8 +448,64 @@ SRVSVC_HANDLE ServerName, LPTIME_OF_DAY_INFO *BufferPtr) { - UNIMPLEMENTED; - return ERROR_CALL_NOT_IMPLEMENTED; + SYSTEMTIME SystemTime; + LARGE_INTEGER Time; + TIME_ZONE_INFORMATION TimeZoneInfo; + DWORD TimeZoneId; + LPTIME_OF_DAY_INFO lpTod; + + TRACE("NetrRemoteTOD(%p %p)\n", ServerName, BufferPtr); + + *BufferPtr = midl_user_allocate(sizeof(TIME_OF_DAY_INFO)); + if (*BufferPtr == NULL) + return ERROR_NOT_ENOUGH_MEMORY; + + lpTod = *BufferPtr; + + /* Set the seconds since 1970 */ + NtQuerySystemTime(&Time); + RtlTimeToSecondsSince1970(&Time, + &lpTod->tod_elapsedt); + + /* Set the tick count */ + lpTod->tod_msecs = GetTickCount(); + + /* Set the timezone */ + TimeZoneId = GetTimeZoneInformation(&TimeZoneInfo); + + switch (TimeZoneId) + { + case TIME_ZONE_ID_UNKNOWN: + lpTod->tod_timezone = TimeZoneInfo.Bias; + break; + + case TIME_ZONE_ID_STANDARD: + lpTod->tod_timezone = TimeZoneInfo.Bias + TimeZoneInfo.StandardBias; + break; + + case TIME_ZONE_ID_DAYLIGHT: + lpTod->tod_timezone = TimeZoneInfo.Bias + TimeZoneInfo.DaylightBias; + break; + + default: + lpTod->tod_timezone = 0; + } + + /* Set the ??? */ + lpTod->tod_tinterval = 310; + + /* Set the date and time */ + GetSystemTime(&SystemTime); + lpTod->tod_hours = SystemTime.wHour; + lpTod->tod_mins = SystemTime.wMinute; + lpTod->tod_secs = SystemTime.wSecond; + lpTod->tod_hunds = SystemTime.wMilliseconds / 10; + lpTod->tod_day = SystemTime.wDay; + lpTod->tod_month = SystemTime.wMonth; + lpTod->tod_year = SystemTime.wYear; + lpTod->tod_weekday = SystemTime.wDayOfWeek; + + return NERR_Success; }