Hans Leidekker : wbemprox: Implement Win32_DesktopMonitor.PixelsPerXLogicalInch.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jul 29 15:40:46 CDT 2015


Module: wine
Branch: master
Commit: deaf036992ba6aeb811ee77219ab862ad29ceb4a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=deaf036992ba6aeb811ee77219ab862ad29ceb4a

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Jul 29 11:39:28 2015 +0200

wbemprox: Implement Win32_DesktopMonitor.PixelsPerXLogicalInch.

---

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

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index f1e5c4a..1c960eb 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -60,6 +60,8 @@ static const WCHAR class_compsysproductW[] =
     {'W','i','n','3','2','_','C','o','m','p','u','t','e','r','S','y','s','t','e','m','P','r','o','d','u','c','t',0};
 static const WCHAR class_datafileW[] =
     {'C','I','M','_','D','a','t','a','F','i','l','e',0};
+static const WCHAR class_desktopmonitorW[] =
+    {'W','i','n','3','2','_','D','e','s','k','t','o','p','M','o','n','i','t','o','r',0};
 static const WCHAR class_directoryW[] =
     {'W','i','n','3','2','_','D','i','r','e','c','t','o','r','y',0};
 static const WCHAR class_diskdriveW[] =
@@ -267,6 +269,8 @@ static const WCHAR prop_parameterW[] =
     {'P','a','r','a','m','e','t','e','r',0};
 static const WCHAR prop_physicaladapterW[] =
     {'P','h','y','s','i','c','a','l','A','d','a','p','t','e','r',0};
+static const WCHAR prop_pixelsperxlogicalinchW[] =
+    {'P','i','x','e','l','s','P','e','r','X','L','o','g','i','c','a','l','I','n','c','h',0};
 static const WCHAR prop_pnpdeviceidW[] =
     {'P','N','P','D','e','v','i','c','e','I','D',0};
 static const WCHAR prop_pprocessidW[] =
@@ -406,6 +410,10 @@ static const struct column col_datafile[] =
     { prop_nameW,    CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
     { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
 };
+static const struct column col_desktopmonitor[] =
+{
+    { prop_pixelsperxlogicalinchW, CIM_UINT32 }
+};
 static const struct column col_directory[] =
 {
     { prop_accessmaskW, CIM_UINT32 },
@@ -789,6 +797,10 @@ struct record_datafile
     const WCHAR *name;
     const WCHAR *version;
 };
+struct record_desktopmonitor
+{
+    UINT32       pixelsperxlogicalinch;
+};
 struct record_directory
 {
     UINT32       accessmask;
@@ -1658,6 +1670,35 @@ done:
     return status;
 }
 
+static UINT32 get_pixelsperxlogicalinch(void)
+{
+    HDC hdc = GetDC( NULL );
+    UINT32 ret;
+
+    if (!hdc) return 96;
+    ret = GetDeviceCaps( hdc, LOGPIXELSX );
+    ReleaseDC( NULL, hdc );
+    return ret;
+}
+
+static enum fill_status fill_desktopmonitor( struct table *table, const struct expr *cond )
+{
+    struct record_desktopmonitor *rec;
+    enum fill_status status = FILL_STATUS_UNFILTERED;
+    UINT row = 0;
+
+    if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
+
+    rec = (struct record_desktopmonitor *)table->data;
+    rec->pixelsperxlogicalinch = get_pixelsperxlogicalinch();
+
+    if (match_row( table, row, cond, &status )) row++;
+
+    TRACE("created %u rows\n", row);
+    table->num_rows = row;
+    return status;
+}
+
 static enum fill_status fill_directory( struct table *table, const struct expr *cond )
 {
     static const WCHAR dotW[] = {'.',0}, dotdotW[] = {'.','.',0};
@@ -2859,6 +2900,7 @@ static struct table builtin_classes[] =
     { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys },
     { class_compsysproductW, SIZEOF(col_compsysproduct), col_compsysproduct, SIZEOF(data_compsysproduct), 0, (BYTE *)data_compsysproduct },
     { class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile },
+    { class_desktopmonitorW, SIZEOF(col_desktopmonitor), col_desktopmonitor, 0, 0, NULL, fill_desktopmonitor },
     { class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory },
     { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive },
     { class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition },




More information about the wine-cvs mailing list