[twain_32 7/7] Return TWRC_FAILURE/TWCC_NODS when we have no sources

Jeremy White jwhite at codeweavers.com
Wed Jan 28 07:48:17 CST 2009


---
  dlls/twain_32/dsm_ctrl.c  |    4 ++--
  dlls/twain_32/tests/dsm.c |    9 +++------
  2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/dlls/twain_32/dsm_ctrl.c b/dlls/twain_32/dsm_ctrl.c
index 16bffc3..325b49d 100644
--- a/dlls/twain_32/dsm_ctrl.c
+++ b/dlls/twain_32/dsm_ctrl.c
@@ -169,8 +169,8 @@ TW_UINT16 TWAIN_IdentityGetFirst (pTW_IDENTITY 
pOrigin, TW_MEMREF pData)
  	twain_autodetect();
  	if (!nrdevices) {
  		TRACE ("no entries found.\n");
-		DSM_twCC = TWCC_SUCCESS;
-		return TWRC_ENDOFLIST;
+		DSM_twCC = TWCC_NODS;
+		return TWRC_FAILURE;
  	}
  	DSM_currentDevice = 0;
  	*pSourceIdentity = devices[DSM_currentDevice++].identity;
diff --git a/dlls/twain_32/tests/dsm.c b/dlls/twain_32/tests/dsm.c
index 8f3c7bf..bf91ba2 100644
--- a/dlls/twain_32/tests/dsm.c
+++ b/dlls/twain_32/tests/dsm.c
@@ -150,12 +150,9 @@ static void test_sources(TW_IDENTITY *appid)
      memset(&source, 0, sizeof(source));
      rc = pDSM_Entry(appid, NULL, DG_CONTROL, DAT_IDENTITY, 
MSG_GETFIRST, &source);
      get_condition_code(appid, NULL, &status);
-    todo_wine
-    ok(rc == TWRC_SUCCESS || rc == TWRC_FAILURE, "Get first error code, 
rc %d, cc %d\n", rc, status.ConditionCode);
-    if (rc == TWRC_SUCCESS)
-        ok(status.ConditionCode == TWCC_SUCCESS,"Get first invalid 
condition code, rc %d, cc %d\n", rc, status.ConditionCode);
-    if (rc == TWRC_FAILURE)
-        ok(status.ConditionCode == TWCC_NODS,"Get first invalid 
condition code, rc %d, cc %d\n", rc, status.ConditionCode);
+    ok( (rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS) ||
+        (rc == TWRC_FAILURE && status.ConditionCode == TWCC_NODS),
+            "Get first invalid condition code, rc %d, cc %d\n", rc, 
status.ConditionCode);

      while (rc == TWRC_SUCCESS)
      {
-- 
1.5.6.5




More information about the wine-patches mailing list