mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Rebase against 416a273241e6eb7a8d15380387fef00e159b7277.
This commit is contained in:
parent
8bfcd6ad7d
commit
0860bc1c5e
@ -1,275 +0,0 @@
|
||||
From 3d93f5c74201ecde76a8bc7d53a3b80ae51344bb Mon Sep 17 00:00:00 2001
|
||||
From: Louis Lenders <xerox.xerox2000x@gmail.com>
|
||||
Date: Wed, 5 Aug 2020 09:09:45 +0200
|
||||
Subject: [PATCH] systeminfo: add basic functionality
|
||||
|
||||
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
|
||||
---
|
||||
programs/systeminfo/Makefile.in | 1 +
|
||||
programs/systeminfo/main.c | 226 +++++++++++++++++++++++++++++++-
|
||||
2 files changed, 223 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/programs/systeminfo/Makefile.in b/programs/systeminfo/Makefile.in
|
||||
index 6ddd309b2ef..a3c65f0a6c6 100644
|
||||
--- a/programs/systeminfo/Makefile.in
|
||||
+++ b/programs/systeminfo/Makefile.in
|
||||
@@ -1,4 +1,5 @@
|
||||
MODULE = systeminfo.exe
|
||||
+IMPORTS = ole32 oleaut32
|
||||
|
||||
EXTRADLLFLAGS = -mconsole -municode
|
||||
|
||||
diff --git a/programs/systeminfo/main.c b/programs/systeminfo/main.c
|
||||
index b633134a393..d5ff7f4def4 100644
|
||||
--- a/programs/systeminfo/main.c
|
||||
+++ b/programs/systeminfo/main.c
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Copyright 2014 Austin English
|
||||
+ * Copyright 2012 Hans Leidekker for CodeWeavers
|
||||
+ * Copyright 2020 Louis Lenders
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -16,18 +18,234 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
+#define COBJMACROS
|
||||
+
|
||||
+#include <stdio.h>
|
||||
+#include "windows.h"
|
||||
+#include "ocidl.h"
|
||||
+#include "initguid.h"
|
||||
+#include "objidl.h"
|
||||
+#include "wbemcli.h"
|
||||
+
|
||||
#include "wine/debug.h"
|
||||
+#include "wine/heap.h"
|
||||
+
|
||||
+#define new_line (i == (ARRAY_SIZE(pq) - 1) || wcslen( pq[i+1].row_name ) )
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(systeminfo);
|
||||
|
||||
+typedef struct {
|
||||
+ const WCHAR *row_name;
|
||||
+ const WCHAR *prepend;
|
||||
+ const WCHAR *class;
|
||||
+ const WCHAR *prop;
|
||||
+ const WCHAR *append;
|
||||
+} print_query_prop;
|
||||
+
|
||||
+static const print_query_prop pq[] = {
|
||||
+ /*row_name prepend prop append prop */
|
||||
+ /*(if any) with string (if any) with string (if any) */
|
||||
+ { L"OS Name", L"", L"Win32_OperatingSystem", L"Caption", L"" },
|
||||
+ { L"OS Version", L"", L"Win32_OperatingSystem", L"Version", L"" },
|
||||
+ { L"", L"", L"Win32_OperatingSystem", L"CSDVersion", L"" },
|
||||
+ { L"", L"Build ", L"Win32_OperatingSystem", L"BuildNumber", L"" },
|
||||
+ { L"Total Physical Memory", L"", L"Win32_ComputerSystem", L"TotalPhysicalMemory", L"" },
|
||||
+ { L"BIOS Version", L"", L"Win32_BIOS", L"Manufacturer", L"" },
|
||||
+ { L"", L", ", L"Win32_BIOS", L"ReleaseDate", L"" },
|
||||
+ { L"Processor(s)", L"", L"Win32_Processor", L"Caption", L"" },
|
||||
+ { L"", L"", L"Win32_Processor", L"Manufacturer", L"" },
|
||||
+ { L"", L"~", L"Win32_Processor", L"MaxClockSpeed", L"Mhz"}
|
||||
+};
|
||||
+
|
||||
+static int sysinfo_vprintfW(const WCHAR *msg, va_list va_args)
|
||||
+{
|
||||
+ int wlen;
|
||||
+ DWORD count, ret;
|
||||
+ WCHAR msg_buffer[8192];
|
||||
+
|
||||
+ wlen = vswprintf(msg_buffer, ARRAY_SIZE(msg_buffer), msg, va_args);
|
||||
+
|
||||
+ ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), msg_buffer, wlen, &count, NULL);
|
||||
+ if (!ret)
|
||||
+ {
|
||||
+ DWORD len;
|
||||
+ char *msgA;
|
||||
+
|
||||
+ /* On Windows WriteConsoleW() fails if the output is redirected. So fall
|
||||
+ * back to WriteFile(), assuming the console encoding is still the right
|
||||
+ * one in that case.
|
||||
+ */
|
||||
+ len = WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen,
|
||||
+ NULL, 0, NULL, NULL);
|
||||
+ msgA = heap_alloc(len);
|
||||
+ if (!msgA)
|
||||
+ return 0;
|
||||
+
|
||||
+ WideCharToMultiByte(GetConsoleOutputCP(), 0, msg_buffer, wlen, msgA, len,
|
||||
+ NULL, NULL);
|
||||
+ WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), msgA, len, &count, FALSE);
|
||||
+ heap_free(msgA);
|
||||
+ }
|
||||
+
|
||||
+ return count;
|
||||
+}
|
||||
+
|
||||
+static int WINAPIV sysinfo_printfW(const WCHAR *msg, ...)
|
||||
+{
|
||||
+ va_list va_args;
|
||||
+ int len;
|
||||
+
|
||||
+ va_start(va_args, msg);
|
||||
+ len = sysinfo_vprintfW(msg, va_args);
|
||||
+ va_end(va_args);
|
||||
+
|
||||
+ return len;
|
||||
+}
|
||||
+
|
||||
+static WCHAR *find_prop( IWbemClassObject *class, const WCHAR *prop )
|
||||
+{
|
||||
+ SAFEARRAY *sa;
|
||||
+ WCHAR *ret = NULL;
|
||||
+ LONG i, last_index = 0;
|
||||
+ BSTR str;
|
||||
+
|
||||
+ if (IWbemClassObject_GetNames( class, NULL, WBEM_FLAG_ALWAYS, NULL, &sa ) != S_OK) return NULL;
|
||||
+
|
||||
+ SafeArrayGetUBound( sa, 1, &last_index );
|
||||
+ for (i = 0; i <= last_index; i++)
|
||||
+ {
|
||||
+ SafeArrayGetElement( sa, &i, &str );
|
||||
+ if (!wcsicmp( str, prop ))
|
||||
+ {
|
||||
+ ret = _wcsdup( str );
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ SafeArrayDestroy( sa );
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int query_prop( const WCHAR *class, const WCHAR *propname )
|
||||
+{
|
||||
+ static const WCHAR select_allW[] = {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0};
|
||||
+ static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
|
||||
+ static const WCHAR wqlW[] = {'W','Q','L',0};
|
||||
+ HRESULT hr;
|
||||
+ IWbemLocator *locator = NULL;
|
||||
+ IWbemServices *services = NULL;
|
||||
+ IEnumWbemClassObject *result = NULL;
|
||||
+ LONG flags = WBEM_FLAG_RETURN_IMMEDIATELY | WBEM_FLAG_FORWARD_ONLY;
|
||||
+ BSTR path = NULL, wql = NULL, query = NULL;
|
||||
+ WCHAR *prop = NULL;
|
||||
+ int len, ret = -1;
|
||||
+ IWbemClassObject *obj;
|
||||
+ ULONG count = 0;
|
||||
+ VARIANT v;
|
||||
+
|
||||
+ WINE_TRACE("%s, %s\n", debugstr_w(class), debugstr_w(propname));
|
||||
+
|
||||
+ CoInitialize( NULL );
|
||||
+ CoInitializeSecurity( NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT,
|
||||
+ RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL );
|
||||
+
|
||||
+ hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator,
|
||||
+ (void **)&locator );
|
||||
+ if (hr != S_OK) goto done;
|
||||
+
|
||||
+ if (!(path = SysAllocString( cimv2W ))) goto done;
|
||||
+ hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services );
|
||||
+ if (hr != S_OK) goto done;
|
||||
+
|
||||
+ len = lstrlenW( class ) + ARRAY_SIZE(select_allW);
|
||||
+ if (!(query = SysAllocStringLen( NULL, len ))) goto done;
|
||||
+ lstrcpyW( query, select_allW );
|
||||
+ lstrcatW( query, class );
|
||||
+
|
||||
+ if (!(wql = SysAllocString( wqlW ))) goto done;
|
||||
+ hr = IWbemServices_ExecQuery( services, wql, query, flags, NULL, &result );
|
||||
+ if (hr != S_OK) goto done;
|
||||
+
|
||||
+ for (;;)
|
||||
+ {
|
||||
+ IEnumWbemClassObject_Next( result, WBEM_INFINITE, 1, &obj, &count );
|
||||
+ if (!count) break;
|
||||
+
|
||||
+ if (!prop && !(prop = find_prop( obj, propname )))
|
||||
+ {
|
||||
+ ERR("Error: Invalid query\n");
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ if (IWbemClassObject_Get( obj, prop, 0, &v, NULL, NULL ) == WBEM_S_NO_ERROR)
|
||||
+ {
|
||||
+ VariantChangeType( &v, &v, 0, VT_BSTR );
|
||||
+ sysinfo_printfW( V_BSTR( &v ) );
|
||||
+ VariantClear( &v );
|
||||
+ }
|
||||
+ IWbemClassObject_Release( obj );
|
||||
+ }
|
||||
+ ret = 0;
|
||||
+
|
||||
+done:
|
||||
+ if (result) IEnumWbemClassObject_Release( result );
|
||||
+ if (services) IWbemServices_Release( services );
|
||||
+ if (locator) IWbemLocator_Release( locator );
|
||||
+ SysFreeString( path );
|
||||
+ SysFreeString( query );
|
||||
+ SysFreeString( wql );
|
||||
+ HeapFree( GetProcessHeap(), 0, prop );
|
||||
+ CoUninitialize();
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
int __cdecl wmain(int argc, WCHAR *argv[])
|
||||
{
|
||||
int i;
|
||||
+ BOOL csv = FALSE;
|
||||
|
||||
- WINE_FIXME("stub:");
|
||||
- for (i = 0; i < argc; i++)
|
||||
- WINE_FIXME(" %s", wine_dbgstr_w(argv[i]));
|
||||
- WINE_FIXME("\n");
|
||||
+ for (i = 1; i < argc; i++)
|
||||
+ {
|
||||
+ if ( !wcsicmp( argv[i], L"/fo" ) && !wcsicmp( argv[i+1], L"csv" ) )
|
||||
+ csv = TRUE;
|
||||
+ else
|
||||
+ WINE_FIXME( "command line switch %s not supported\n", debugstr_w(argv[i]) );
|
||||
+ }
|
||||
|
||||
+ if( !csv )
|
||||
+ {
|
||||
+ for ( i = 0; i < ARRAYSIZE(pq); i++ )
|
||||
+ {
|
||||
+ if( wcslen(pq[i].row_name) )
|
||||
+ sysinfo_printfW( L"%-*s", 44, pq[i].row_name );
|
||||
+ if ( wcslen(pq[i].prepend) )
|
||||
+ sysinfo_printfW( L"%s", pq[i].prepend );
|
||||
+ query_prop( pq[i].class, pq[i].prop );
|
||||
+ if ( wcslen(pq[i].append) )
|
||||
+ sysinfo_printfW( L"%s", pq[i].append );
|
||||
+ sysinfo_printfW( new_line ? L"\r\n" : L" " );
|
||||
+ }
|
||||
+ }
|
||||
+ else /* only option "systeminfo /fo csv" supported for now */
|
||||
+ {
|
||||
+ for (i = 0; i < ARRAYSIZE(pq); i++)
|
||||
+ {
|
||||
+ if( wcslen(pq[i].row_name) )
|
||||
+ sysinfo_printfW( i ? L",\"%s\"" : L"\"%s\"", pq[i].row_name );
|
||||
+ }
|
||||
+ sysinfo_printfW( L"\r\n" );
|
||||
+
|
||||
+ for (i = 0; i < ARRAYSIZE(pq); i++)
|
||||
+ {
|
||||
+ if ( wcslen(pq[i].row_name) )
|
||||
+ sysinfo_printfW( i ? L",\"" : L"\"" );
|
||||
+ if ( wcslen(pq[i].prepend) )
|
||||
+ sysinfo_printfW( L"%s",pq[i].prepend );
|
||||
+ query_prop( pq[i].class, pq[i].prop );
|
||||
+ if ( wcslen(pq[i].append) )
|
||||
+ sysinfo_printfW( L"%s", pq[i].append );
|
||||
+ sysinfo_printfW( new_line ? L"\"" : L" " );
|
||||
+ }
|
||||
+ sysinfo_printfW( L"\r\n" );
|
||||
+ }
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.33.0
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: [42027] systeminfo: Add basic functionality.
|
@ -1,4 +1,4 @@
|
||||
From 80a3f0f4b75754f76e6644e43c637ea385889e5c Mon Sep 17 00:00:00 2001
|
||||
From f05f0efcd0cec49f3ad4faa2cc3bd21c7da75c44 Mon Sep 17 00:00:00 2001
|
||||
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
Date: Thu, 7 Apr 2016 16:04:36 +1000
|
||||
Subject: [PATCH] user32/msgbox: Support WM_COPY Message
|
||||
@ -7,12 +7,12 @@ Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=17205
|
||||
|
||||
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
||||
---
|
||||
dlls/user32/msgbox.c | 86 ++++++++++++++++-
|
||||
dlls/user32/tests/dialog.c | 183 +++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 264 insertions(+), 5 deletions(-)
|
||||
dlls/user32/msgbox.c | 86 +++++++++++++++++-
|
||||
dlls/user32/tests/dialog.c | 182 +++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 263 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/user32/msgbox.c b/dlls/user32/msgbox.c
|
||||
index 3da1c0a3445..b29af2161b6 100644
|
||||
index 4d345777a10..1136374deb1 100644
|
||||
--- a/dlls/user32/msgbox.c
|
||||
+++ b/dlls/user32/msgbox.c
|
||||
@@ -41,6 +41,11 @@ struct ThreadWindows
|
||||
@ -39,7 +39,7 @@ index 3da1c0a3445..b29af2161b6 100644
|
||||
nclm.cbSize = sizeof(nclm);
|
||||
SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0);
|
||||
|
||||
@@ -316,6 +316,77 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
|
||||
@@ -320,6 +320,77 @@ static void MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMSW lpmb)
|
||||
HeapFree( GetProcessHeap(), 0, buffer );
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ index 3da1c0a3445..b29af2161b6 100644
|
||||
|
||||
/**************************************************************************
|
||||
* MSGBOX_DlgProc
|
||||
@@ -334,6 +405,11 @@ static INT_PTR CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
|
||||
@@ -338,6 +409,11 @@ static INT_PTR CALLBACK MSGBOX_DlgProc( HWND hwnd, UINT message,
|
||||
SetPropA(hwnd, "WINE_MSGBOX_HELPCALLBACK", mbp->lpfnMsgBoxCallback);
|
||||
break;
|
||||
}
|
||||
@ -130,18 +130,10 @@ index 3da1c0a3445..b29af2161b6 100644
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
|
||||
index 46a12443a93..4fd5d211bea 100644
|
||||
index 7ea0d13c0f3..448b69ca2a3 100644
|
||||
--- a/dlls/user32/tests/dialog.c
|
||||
+++ b/dlls/user32/tests/dialog.c
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
+#include "winnls.h"
|
||||
|
||||
#define MAXHWNDS 1024
|
||||
static HWND hwnd [MAXHWNDS];
|
||||
@@ -1990,6 +1991,187 @@ static void test_MessageBoxFontTest(void)
|
||||
@@ -2068,6 +2068,187 @@ static void test_MessageBoxFontTest(void)
|
||||
DestroyWindow(hDlg);
|
||||
}
|
||||
|
||||
@ -329,12 +321,12 @@ index 46a12443a93..4fd5d211bea 100644
|
||||
static void test_SaveRestoreFocus(void)
|
||||
{
|
||||
HWND hDlg;
|
||||
@@ -2383,4 +2565,5 @@ START_TEST(dialog)
|
||||
@@ -2455,4 +2636,5 @@ START_TEST(dialog)
|
||||
test_timer_message();
|
||||
test_MessageBox();
|
||||
test_capture_release();
|
||||
+ test_MessageBox_WM_COPY_Test();
|
||||
}
|
||||
--
|
||||
2.29.2
|
||||
2.40.1
|
||||
|
||||
|
@ -1 +1 @@
|
||||
81c8c73de299c0d61d1fff8ad9b88a9deb5b9479
|
||||
416a273241e6eb7a8d15380387fef00e159b7277
|
||||
|
Loading…
Reference in New Issue
Block a user