wbemprox: Implement Win32_OperatingSystem.LocalDateTime.

Sylvain Petreolle spetreolle at yahoo.fr
Sun Jun 23 11:55:30 CDT 2013


---
 dlls/wbemprox/builtin.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 9e2369a..823ba39 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -160,6 +160,8 @@ static const WCHAR prop_intvalueW[] =
     {'I','n','t','e','g','e','r','V','a','l','u','e',0};
 static const WCHAR prop_lastbootuptimeW[] =
     {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0};
+static const WCHAR prop_localdatetimeW[] =
+    {'L','o','c','a','l','D','a','t','e','T','i','m','e',0};
 static const WCHAR prop_localeW[] =
     {'L','o','c','a','l','e',0};
 static const WCHAR prop_macaddressW[] =
@@ -339,6 +341,7 @@ static const struct column col_os[] =
     { prop_countrycodeW,      CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_csdversionW,       CIM_STRING },
     { prop_lastbootuptimeW,   CIM_DATETIME|COL_FLAG_DYNAMIC },
+    { prop_localdatetimeW,    CIM_DATETIME|COL_FLAG_DYNAMIC },
     { prop_localeW,           CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_osarchitectureW,   CIM_STRING },
     { prop_oslanguageW,       CIM_UINT32, VT_I4 },
@@ -591,6 +594,7 @@ struct record_operatingsystem
     const WCHAR *countrycode;
     const WCHAR *csdversion;
     const WCHAR *lastbootuptime;
+    const WCHAR *localdatetime;
     const WCHAR *locale;
     const WCHAR *osarchitecture;
     UINT32       oslanguage;
@@ -1774,6 +1778,22 @@ static WCHAR *get_lastbootuptime(void)
     sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
     return ret;
 }
+static WCHAR *get_localdatetime(void)
+{
+    static const WCHAR fmtW[] =
+        {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u',
+         '.','%','0','6','u','+','0','0','0',0};
+    SYSTEM_TIMEOFDAY_INFORMATION ti;
+    TIME_FIELDS tf;
+    WCHAR *ret;
+
+    if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL;
+
+    NtQuerySystemInformation( SystemTimeOfDayInformation, &ti, sizeof(ti), NULL );
+    RtlTimeToTimeFields( &ti.liKeBootTime, &tf );
+    sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 );
+    return ret;
+}
 static WCHAR *get_systemdirectory(void)
 {
     void *redir;
@@ -1819,6 +1839,7 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond )
     rec->countrycode      = get_countrycode();
     rec->csdversion       = os_csdversionW;
     rec->lastbootuptime   = get_lastbootuptime();
+    rec->localdatetime    = get_localdatetime();
     rec->locale           = get_locale();
     rec->osarchitecture   = get_osarchitecture();
     rec->oslanguage       = GetSystemDefaultLangID();
-- 
1.8.2.1




More information about the wine-patches mailing list