=?UTF-8?Q?Michael=20M=C3=BCller=20?=: user32: Add semi-stub for GetAutoRotationState.

Alexandre Julliard julliard at winehq.org
Tue Jul 3 15:58:56 CDT 2018


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

Author: Michael Müller <michael at fds-team.de>
Date:   Mon Jul  2 05:24:02 2018 +0000

user32: Add semi-stub for GetAutoRotationState.

We cannot check the status value reliable since there is a good
chance that all the possible values will be returned from different
setups.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/sysparams.c       | 11 +++++++++--
 dlls/user32/tests/sysparams.c | 24 ++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 3245f20..fc55b06 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -3387,8 +3387,15 @@ BOOL WINAPI PhysicalToLogicalPointForPerMonitorDPI( HWND hwnd, POINT *pt )
  */
 BOOL WINAPI GetAutoRotationState( AR_STATE *state )
 {
-    FIXME("(%p): stub\n", state);
-    *state = AR_NOT_SUPPORTED;
+    TRACE("(%p)\n", state);
+
+    if (!state)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
+    *state = AR_NOSENSOR;
     return TRUE;
 }
 
diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c
index 3db058f..fec37b6 100644
--- a/dlls/user32/tests/sysparams.c
+++ b/dlls/user32/tests/sysparams.c
@@ -55,6 +55,7 @@ static INT (WINAPI *pGetSystemMetricsForDpi)(INT,UINT);
 static BOOL (WINAPI *pSystemParametersInfoForDpi)(UINT,UINT,void*,UINT,UINT);
 static BOOL (WINAPI *pLogicalToPhysicalPointForPerMonitorDPI)(HWND,POINT*);
 static BOOL (WINAPI *pPhysicalToLogicalPointForPerMonitorDPI)(HWND,POINT*);
+static LONG (WINAPI *pGetAutoRotationState)(PAR_STATE);
 
 static BOOL strict;
 static int dpi, real_dpi;
@@ -3621,6 +3622,27 @@ static void test_dpi_window(void)
     pSetThreadDpiAwarenessContext( orig );
 }
 
+static void test_GetAutoRotationState(void)
+{
+    AR_STATE state;
+    BOOL ret;
+
+    if (!pGetAutoRotationState)
+    {
+        win_skip("GetAutoRotationState not supported\n");
+        return;
+    }
+
+    SetLastError(0xdeadbeef);
+    ret = pGetAutoRotationState(NULL);
+    ok(!ret, "Expected GetAutoRotationState to fail\n");
+    ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
+
+    state = 0;
+    ret = pGetAutoRotationState(&state);
+    ok(ret, "Expected GetAutoRotationState to succeed, error %d\n", GetLastError());
+}
+
 START_TEST(sysparams)
 {
     int argc;
@@ -3650,6 +3672,7 @@ START_TEST(sysparams)
     pSystemParametersInfoForDpi = (void*)GetProcAddress(hdll, "SystemParametersInfoForDpi");
     pLogicalToPhysicalPointForPerMonitorDPI = (void*)GetProcAddress(hdll, "LogicalToPhysicalPointForPerMonitorDPI");
     pPhysicalToLogicalPointForPerMonitorDPI = (void*)GetProcAddress(hdll, "PhysicalToLogicalPointForPerMonitorDPI");
+    pGetAutoRotationState = (void*)GetProcAddress(hdll, "GetAutoRotationState");
 
     hInstance = GetModuleHandleA( NULL );
     hdc = GetDC(0);
@@ -3671,6 +3694,7 @@ START_TEST(sysparams)
     test_metrics_for_dpi( 192 );
     test_EnumDisplaySettings( );
     test_GetSysColorBrush( );
+    test_GetAutoRotationState( );
 
     change_counter = 0;
     change_last_param = 0;




More information about the wine-cvs mailing list