Module: wine
Branch: stable
Commit: 6d695ef5e994314dc4f4e349928fde7154e701f3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6d695ef5e994314dc4f4e349…
Author: Markus Engel <markus_wine(a)familie-engel.online>
Date: Mon May 18 18:35:58 2020 +0200
user32: Force undefined bits in GetKeyState() and GetKeyboardState() to zero.
Only the highest and lowest bits in the return values of these functions
have a meaning, the others are undefined. While the other bits are
always cleared in Windows, wine stores information there. Some programs
expect these undefined bits to be zero, though, so make sure they are
not set.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=30814
Signed-off-by: Markus Engel <markus_wine(a)familie-engel.online>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
(cherry picked from commit d9855df17f905da97b4bd92227427c4f899babf1)
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/user32/input.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/input.c b/dlls/user32/input.c
index 0325e2ce3d..ac90c12c60 100644
--- a/dlls/user32/input.c
+++ b/dlls/user32/input.c
@@ -555,7 +555,7 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState(INT vkey)
{
req->tid = GetCurrentThreadId();
req->key = vkey;
- if (!wine_server_call( req )) retval = (signed char)reply->state;
+ if (!wine_server_call( req )) retval = (signed char)(reply->state & 0x81);
}
SERVER_END_REQ;
TRACE("key (0x%x) -> %x\n", vkey, retval);
@@ -569,6 +569,7 @@ SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState(INT vkey)
BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state )
{
BOOL ret;
+ UINT i;
TRACE("(%p)\n", state);
@@ -579,6 +580,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state )
req->key = -1;
wine_server_set_reply( req, state, 256 );
ret = !wine_server_call_err( req );
+ for (i = 0; i < 256; i++) state[i] &= 0x81;
}
SERVER_END_REQ;
return ret;
Module: wine
Branch: stable
Commit: 749d86ca7d21ab48e16301336e199b593ea241b1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=749d86ca7d21ab48e1630133…
Author: Bernhard Übelacker <bernhardu(a)mailbox.org>
Date: Sun May 3 17:05:24 2020 +0200
cmd: Fix crash in if condition parsing.
Regression introduced in f238e846e701d2039eceb51f2f6e9d936f8c791c.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47770
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48738
Signed-off-by: Bernhard Übelacker <bernhardu(a)mailbox.org>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
(cherry picked from commit b1e91a36a75fd8ae27a999248aa034e69227bc02)
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
programs/cmd/builtins.c | 6 ++++++
programs/cmd/wcmdmain.c | 15 +++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 43c4d9efef..8911a597eb 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -2938,9 +2938,15 @@ void WCMD_if (WCHAR *p, CMD_LIST **cmdList)
int test; /* Condition evaluation result */
WCHAR *command;
+ /* Function evaluate_if_condition relies on the global variables quals, param1 and param2
+ set in a call to WCMD_parse before */
if (evaluate_if_condition(p, &command, &test, &negate) == -1)
goto syntax_err;
+ WINE_TRACE("p: %s, quals: %s, param1: %s, param2: %s, command: %s\n",
+ wine_dbgstr_w(p), wine_dbgstr_w(quals), wine_dbgstr_w(param1),
+ wine_dbgstr_w(param2), wine_dbgstr_w(command));
+
/* Process rest of IF statement which is on the same line
Note: This may process all or some of the cmdList (eg a GOTO) */
WCMD_part_execute(cmdList, command, TRUE, (test != negate));
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 5cad22b7ee..f6c770c9b8 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -1947,8 +1947,6 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
To be able to handle ('s in the condition part take as much as evaluate_if_condition
would take and skip parsing it here. */
} else if (WCMD_keyword_ws_found(ifCmd, ARRAY_SIZE(ifCmd), curPos)) {
- static const WCHAR parmI[] = {'/','I','\0'};
- static const WCHAR notW[] = {'n','o','t','\0'};
int negate; /* Negate condition */
int test; /* Condition evaluation result */
WCHAR *p, *command;
@@ -1956,17 +1954,18 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
inIf = TRUE;
p = curPos+(ARRAY_SIZE(ifCmd));
- while (*p == ' ' || *p == '\t') {
+ while (*p == ' ' || *p == '\t')
p++;
- if (lstrcmpiW(WCMD_parameter(p, 0, NULL, TRUE, FALSE), notW) == 0)
- p += lstrlenW(notW);
- if (lstrcmpiW(WCMD_parameter(p, 0, NULL, TRUE, FALSE), parmI) == 0)
- p += lstrlenW(parmI);
- }
+ WCMD_parse (p, quals, param1, param2);
+ /* Function evaluate_if_condition relies on the global variables quals, param1 and param2
+ set in a call to WCMD_parse before */
if (evaluate_if_condition(p, &command, &test, &negate) != -1)
{
int if_condition_len = command - curPos;
+ WINE_TRACE("p: %s, quals: %s, param1: %s, param2: %s, command: %s, if_condition_len: %d\n",
+ wine_dbgstr_w(p), wine_dbgstr_w(quals), wine_dbgstr_w(param1),
+ wine_dbgstr_w(param2), wine_dbgstr_w(command), if_condition_len);
memcpy(&curCopyTo[*curLen], curPos, if_condition_len*sizeof(WCHAR));
(*curLen)+=if_condition_len;
curPos+=if_condition_len;