ReactOS 0.4.15-dev-7659-ga55345b
dsm.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winerror.h"
#include "winuser.h"
#include "twain.h"
#include "wine/test.h"
Include dependency graph for dsm.c:

Go to the source code of this file.

Functions

static BOOL dsm_RegisterWindowClasses (void)
 
static void get_condition_code (TW_IDENTITY *appid, TW_IDENTITY *source, TW_STATUS *status)
 
static BOOL get_onevalue (TW_HANDLE hcontainer, TW_UINT32 *ret, TW_UINT16 *type)
 
static TW_HANDLE alloc_and_set_onevalue (TW_UINT32 val, TW_UINT16 type)
 
static void check_get (TW_CAPABILITY *pCapability, TW_INT32 actual_support, TW_UINT32 orig_value, TW_UINT32 default_value, TW_UINT32 *suggested_set_value)
 
static void test_onevalue_cap (TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16 captype, TW_UINT16 type, TW_INT32 minimum_support)
 
static void test_resolution (TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16 captype, TW_INT32 minimum_support)
 
static void test_physical (TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16 captype, TW_INT32 minimum_support)
 
static void test_supported_sizes (TW_IDENTITY *appid, TW_IDENTITY *source, TW_INT32 minimum_support)
 
static void test_imagelayout (TW_IDENTITY *appid, TW_IDENTITY *source)
 
static void test_single_source (TW_IDENTITY *appid, TW_IDENTITY *source)
 
static void test_sources (TW_IDENTITY *appid)
 
 START_TEST (dsm)
 

Variables

static DSMENTRYPROC pDSM_Entry
 

Function Documentation

◆ alloc_and_set_onevalue()

static TW_HANDLE alloc_and_set_onevalue ( TW_UINT32  val,
TW_UINT16  type 
)
static

Definition at line 79 of file dsm.c.

80{
81 TW_HANDLE hcontainer;
82 TW_ONEVALUE *onev;
83 hcontainer = GlobalAlloc(0, sizeof(*onev));
84 if (hcontainer)
85 {
86 onev = GlobalLock(hcontainer);
87 if (onev)
88 {
89 onev->ItemType = type;
90 onev->Item = val;
91 GlobalUnlock(hcontainer);
92 }
93 else
94 {
95 GlobalFree(hcontainer);
96 hcontainer = 0;
97 }
98 }
99 return hcontainer;
100}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLfloat * val
Definition: glext.h:7180
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
TW_UINT16 ItemType
Definition: twain.h:208
TW_UINT32 Item
Definition: twain.h:209

Referenced by test_onevalue_cap(), test_resolution(), and test_supported_sizes().

◆ check_get()

static void check_get ( TW_CAPABILITY pCapability,
TW_INT32  actual_support,
TW_UINT32  orig_value,
TW_UINT32  default_value,
TW_UINT32 suggested_set_value 
)
static

Definition at line 102 of file dsm.c.

104{
105 void *p;
106 if (suggested_set_value)
107 *suggested_set_value = orig_value + 1;
108 p = GlobalLock(pCapability->hContainer);
109 if (p)
110 {
111 if (pCapability->ConType == TWON_ONEVALUE)
112 {
113 TW_ONEVALUE *onev = p;
114 ok(onev->Item == orig_value || !(actual_support & TWQC_GETCURRENT), "MSG_GET of 0x%x returned 0x%x, expecting 0x%x\n",
115 pCapability->Cap, onev->Item, orig_value);
116 trace("MSG_GET of 0x%x returned val 0x%x, type %d\n", pCapability->Cap, onev->Item, onev->ItemType);
117 if (suggested_set_value)
118 *suggested_set_value = onev->Item;
119 }
120 else if (pCapability->ConType == TWON_ENUMERATION)
121 {
122 int i;
123 TW_UINT8 *p8;
124 TW_UINT16 *p16;
125 TW_UINT32 *p32;
126 TW_ENUMERATION *enumv = p;
127 p8 = enumv->ItemList;
128 p16 = (TW_UINT16 *) p8;
129 p32 = (TW_UINT32 *) p8;
130 trace("MSG_GET of 0x%x returned %d items:\n", pCapability->Cap, enumv->NumItems);
131 for (i = 0; i < enumv->NumItems; i++)
132 {
133 if (enumv->ItemType == TWTY_UINT8 || enumv->ItemType == TWTY_INT8)
134 trace(" %d: 0x%x\n", i, p8[i]);
135 if (enumv->ItemType == TWTY_UINT16 || enumv->ItemType == TWTY_INT16)
136 trace(" %d: 0x%x\n", i, p16[i]);
137 if (enumv->ItemType == TWTY_UINT32 || enumv->ItemType == TWTY_INT32)
138 trace(" %d: 0x%x\n", i, p32[i]);
139 }
140 if (enumv->ItemType == TWTY_UINT16 || enumv->ItemType == TWTY_INT16)
141 {
142 ok(p16[enumv->CurrentIndex] == orig_value,
143 "Type 0x%x, values from MSG_GET (0x%x) and MSG_GETCURRENT (0x%x) do not match.\n",
144 pCapability->Cap, p16[enumv->CurrentIndex], orig_value);
145 ok(p16[enumv->DefaultIndex] == default_value,
146 "Type 0x%x, values from MSG_GET (0x%x) and MSG_GETDEFAULT (0x%x) do not match.\n",
147 pCapability->Cap, p16[enumv->DefaultIndex], default_value);
148 if (suggested_set_value)
149 *suggested_set_value = p16[(enumv->CurrentIndex + 1) % enumv->NumItems];
150 }
151 if (enumv->ItemType == TWTY_UINT32 || enumv->ItemType == TWTY_INT32)
152 {
153 ok(p32[enumv->CurrentIndex] == orig_value,
154 "Type 0x%x, values from MSG_GET (0x%x) and MSG_GETCURRENT (0x%x) do not match.\n",
155 pCapability->Cap, p32[enumv->CurrentIndex], orig_value);
156 ok(p32[enumv->DefaultIndex] == default_value,
157 "Type 0x%x, values from MSG_GET (0x%x) and MSG_GETDEFAULT (0x%x) do not match.\n",
158 pCapability->Cap, p32[enumv->DefaultIndex], default_value);
159 if (suggested_set_value)
160 *suggested_set_value = p32[(enumv->CurrentIndex + 1) % enumv->NumItems];
161 }
162 }
163 else
164 trace("MSG_GET on type 0x%x returned type 0x%x, which we didn't check.\n", pCapability->Cap, pCapability->ConType);
165 GlobalUnlock(pCapability->hContainer);
166 }
167}
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
TW_UINT32 DefaultIndex
Definition: twain.h:202
TW_UINT32 NumItems
Definition: twain.h:200
TW_UINT32 CurrentIndex
Definition: twain.h:201
TW_UINT8 ItemList[1]
Definition: twain.h:203
TW_UINT16 ItemType
Definition: twain.h:199
#define TWTY_UINT32
Definition: twain.h:546
#define TWQC_GETCURRENT
Definition: twain.h:1709
#define TWTY_INT16
Definition: twain.h:541
unsigned short TW_UINT16
Definition: twain.h:119
#define TWON_ONEVALUE
Definition: twain.h:505
#define TWTY_INT32
Definition: twain.h:542
ULONG TW_UINT32
Definition: twain.h:120
unsigned char TW_UINT8
Definition: twain.h:118
#define TWTY_UINT8
Definition: twain.h:544
#define TWTY_INT8
Definition: twain.h:540
#define TWON_ENUMERATION
Definition: twain.h:504
#define TWTY_UINT16
Definition: twain.h:545
_Check_return_ _Out_ PDWORD pCapability
Definition: winddi.h:2308

Referenced by test_onevalue_cap(), and test_supported_sizes().

◆ dsm_RegisterWindowClasses()

static BOOL dsm_RegisterWindowClasses ( void  )
static

Definition at line 33 of file dsm.c.

34{
35 WNDCLASSA cls;
36 BOOL rc;
37
38 cls.style = 0;
40 cls.cbClsExtra = 0;
41 cls.cbWndExtra = 0;
43 cls.hIcon = 0;
46 cls.lpszMenuName = NULL;
47 cls.lpszClassName = "TWAIN_dsm_class";
48
49 rc = RegisterClassA(&cls);
50 ok(rc, "RegisterClassA failed: le=%u\n", GetLastError());
51 return rc;
52}
#define NULL
Definition: types.h:112
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
unsigned int BOOL
Definition: ntddk_ex.h:94
HBRUSH hbrBackground
Definition: winuser.h:3169
HICON hIcon
Definition: winuser.h:3167
HINSTANCE hInstance
Definition: winuser.h:3166
HCURSOR hCursor
Definition: winuser.h:3168
int cbWndExtra
Definition: winuser.h:3165
UINT style
Definition: winuser.h:3162
LPCSTR lpszMenuName
Definition: winuser.h:3170
LPCSTR lpszClassName
Definition: winuser.h:3171
WNDPROC lpfnWndProc
Definition: winuser.h:3163
int cbClsExtra
Definition: winuser.h:3164
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2073
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().

◆ get_condition_code()

static void get_condition_code ( TW_IDENTITY appid,
TW_IDENTITY source,
TW_STATUS status 
)
static

Definition at line 55 of file dsm.c.

56{
57 TW_UINT16 rc;
59 ok(rc == TWRC_SUCCESS, "Condition code not available, rc %d\n", rc);
60}
static DSMENTRYPROC pDSM_Entry
Definition: dsm.c:31
char * appid
Definition: mkisofs.c:161
Definition: ps.c:97
#define TWRC_SUCCESS
Definition: twain.h:1664
#define MSG_GET
Definition: twain.h:1385
#define DAT_STATUS
Definition: twain.h:1342
#define DG_CONTROL
Definition: twain.h:1311

Referenced by test_imagelayout(), test_onevalue_cap(), test_physical(), test_resolution(), test_single_source(), test_sources(), and test_supported_sizes().

◆ get_onevalue()

static BOOL get_onevalue ( TW_HANDLE  hcontainer,
TW_UINT32 ret,
TW_UINT16 type 
)
static

Definition at line 62 of file dsm.c.

63{
64 TW_ONEVALUE *onev;
65 onev = GlobalLock(hcontainer);
66 if (onev)
67 {
68 *ret = onev->Item;
69 if (type)
70 *type = onev->ItemType;
71 GlobalUnlock(hcontainer);
72 return TRUE;
73 }
74 else
75 *ret = 0;
76 return FALSE;
77}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
int ret

Referenced by test_onevalue_cap(), test_physical(), test_resolution(), and test_supported_sizes().

◆ START_TEST()

START_TEST ( dsm  )

Definition at line 832 of file dsm.c.

833{
835 TW_UINT16 rc;
836 HANDLE hwnd;
837 HMODULE htwain;
838
840 {
841 skip("Could not register the test class, skipping tests\n");
842 return;
843 }
844
845 htwain = LoadLibraryA("twain_32.dll");
846 if (! htwain)
847 {
848 win_skip("twain_32.dll not available, skipping tests\n");
849 return;
850 }
851 pDSM_Entry = (void*)GetProcAddress(htwain, "DSM_Entry");
852 ok(pDSM_Entry != NULL, "Unable to GetProcAddress DSM_Entry\n");
853 if (! pDSM_Entry)
854 {
855 win_skip("DSM_Entry not available, skipping tests\n");
856 return;
857 }
858
859 memset(&appid, 0, sizeof(appid));
860 appid.Version.Language = TWLG_ENGLISH_USA;
861 appid.Version.Country = TWCY_USA;
862 appid.ProtocolMajor = TWON_PROTOCOLMAJOR;
863 appid.ProtocolMinor = TWON_PROTOCOLMINOR;
864 appid.SupportedGroups = DG_CONTROL | DG_IMAGE;
865
866 hwnd = CreateWindowA("TWAIN_dsm_class", "Twain Test", 0, CW_USEDEFAULT, CW_USEDEFAULT,
868
870 ok(rc == TWRC_SUCCESS, "MSG_OPENDSM returned %d\n", rc);
871
873
875 ok(rc == TWRC_SUCCESS, "MSG_CLOSEDSM returned %d\n", rc);
876
878 FreeLibrary(htwain);
879}
#define skip(...)
Definition: atltest.h:64
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static BOOL dsm_RegisterWindowClasses(void)
Definition: dsm.c:33
static void test_sources(TW_IDENTITY *appid)
Definition: dsm.c:759
#define win_skip
Definition: test.h:160
#define memset(x, y, z)
Definition: compat.h:39
#define DG_IMAGE
Definition: twain.h:1312
#define TWON_PROTOCOLMINOR
Definition: twain.h:69
#define MSG_CLOSEDSM
Definition: twain.h:1406
#define MSG_OPENDSM
Definition: twain.h:1405
#define TWLG_ENGLISH_USA
Definition: twain.h:1227
#define TWCY_USA
Definition: twain.h:1120
#define DAT_PARENT
Definition: twain.h:1338
#define TWON_PROTOCOLMAJOR
Definition: twain.h:70
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4314
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI DestroyWindow(_In_ HWND)

◆ test_imagelayout()

static void test_imagelayout ( TW_IDENTITY appid,
TW_IDENTITY source 
)
static

Definition at line 591 of file dsm.c.

592{
593 TW_UINT16 rc;
596
599 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
600 "Error [rc %d|cc %d] doing MSG_GET for DG_IMAGE/DAT_IMAGELAYOUT\n", rc, status.ConditionCode);
601 if (rc != TWRC_SUCCESS)
602 return;
603 trace("ImageLayout [Left %x.%x|Top %x.%x|Right %x.%x|Bottom %x.%x|Document %d|Page %d|Frame %d]\n",
604 layout.Frame.Left.Whole, layout.Frame.Left.Frac,
605 layout.Frame.Top.Whole, layout.Frame.Top.Frac,
606 layout.Frame.Right.Whole, layout.Frame.Right.Frac,
607 layout.Frame.Bottom.Whole, layout.Frame.Bottom.Frac,
608 layout.DocumentNumber, layout.PageNumber, layout.FrameNumber);
609
610 memset(&layout, 0, sizeof(layout));
611 layout.Frame.Left.Whole = 1;
612 layout.Frame.Right.Whole = 2;
613 layout.Frame.Top.Whole = 1;
614 layout.Frame.Bottom.Whole = 2;
617 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
618 "Error [rc %d|cc %d] doing MSG_SET for DG_IMAGE/DAT_IMAGELAYOUT\n", rc, status.ConditionCode);
619 if (rc != TWRC_SUCCESS)
620 return;
621
624 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
625 "Error [rc %d|cc %d] doing MSG_GET for DG_IMAGE/DAT_IMAGELAYOUT\n", rc, status.ConditionCode);
626 if (rc != TWRC_SUCCESS)
627 return;
628 trace("ImageLayout after set [Left %x.%x|Top %x.%x|Right %x.%x|Bottom %x.%x|Document %d|Page %d|Frame %d]\n",
629 layout.Frame.Left.Whole, layout.Frame.Left.Frac,
630 layout.Frame.Top.Whole, layout.Frame.Top.Frac,
631 layout.Frame.Right.Whole, layout.Frame.Right.Frac,
632 layout.Frame.Bottom.Whole, layout.Frame.Bottom.Frac,
633 layout.DocumentNumber, layout.PageNumber, layout.FrameNumber);
634}
static void get_condition_code(TW_IDENTITY *appid, TW_IDENTITY *source, TW_STATUS *status)
Definition: dsm.c:55
static DWORD layout
Definition: bitmap.c:46
#define DAT_IMAGELAYOUT
Definition: twain.h:1357
#define MSG_SET
Definition: twain.h:1390
#define TWCC_SUCCESS
Definition: twain.h:1678

Referenced by test_single_source().

◆ test_onevalue_cap()

static void test_onevalue_cap ( TW_IDENTITY appid,
TW_IDENTITY source,
TW_UINT16  captype,
TW_UINT16  type,
TW_INT32  minimum_support 
)
static

Definition at line 169 of file dsm.c.

170{
171 TW_UINT16 rc;
172 TW_UINT16 rtype;
175 TW_UINT32 orig_value = 0;
176 TW_UINT32 new_value;
177 TW_UINT32 default_value = 0;
178 TW_INT32 actual_support;
179
180 memset(&cap, 0, sizeof(cap));
181 cap.Cap = captype;
182 cap.ConType = TWON_DONTCARE16;
183
186 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
187 "Error [rc %d|cc %d] doing MSG_QUERYSUPPORT for type 0x%x\n", rc, status.ConditionCode, captype);
188 if (rc != TWRC_SUCCESS)
189 return;
190 ok(get_onevalue(cap.hContainer, (TW_UINT32 *) &actual_support, NULL), "Returned cap.hContainer invalid for QuerySupport on type 0x%x\n", captype);
191 ok((actual_support & minimum_support) == minimum_support,
192 "Error: minimum support 0x%x for type 0x%x, got 0x%x\n", minimum_support,
193 captype, actual_support);
194
195
196 if (actual_support & TWQC_GETCURRENT)
197 {
198 memset(&cap, 0, sizeof(cap));
199 cap.Cap = captype;
200 cap.ConType = TWON_DONTCARE16;
201
204 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
205 "Error [rc %d|cc %d] doing MSG_GETCURRENT for type 0x%x\n", rc, status.ConditionCode, captype);
206 if (rc == TWRC_SUCCESS)
207 {
208 ok(get_onevalue(cap.hContainer, &orig_value, &rtype), "Returned cap.hContainer invalid for GETCURRENT on type 0x%x\n", captype);
209 ok(rtype == type, "Returned GETCURRENT type 0x%x for cap 0x%x is not expected 0x%x\n", rtype, captype, type);
210 GlobalFree(cap.hContainer);
211 }
212 }
213
214 if (actual_support & TWQC_GETDEFAULT)
215 {
216 memset(&cap, 0, sizeof(cap));
217 cap.Cap = captype;
218 cap.ConType = TWON_DONTCARE16;
219
222 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
223 "Error [rc %d|cc %d] doing MSG_GETDEFAULT for type 0x%x\n", rc, status.ConditionCode, captype);
224 if (rc == TWRC_SUCCESS)
225 {
226 ok(get_onevalue(cap.hContainer, &default_value, &rtype), "Returned cap.hContainer invalid for GETDEFAULT on type 0x%x\n", captype);
227 ok(rtype == type, "Returned GETDEFAULT type 0x%x for cap 0x%x is not expected 0x%x\n", rtype, captype, type);
228 GlobalFree(cap.hContainer);
229 }
230 }
231
232 new_value = orig_value;
233 if (actual_support & TWQC_GET)
234 {
235 memset(&cap, 0, sizeof(cap));
236 cap.Cap = captype;
237 cap.ConType = TWON_DONTCARE16;
238
241 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
242 "Error [rc %d|cc %d] doing MSG_GET for type 0x%x\n", rc, status.ConditionCode, captype);
243 check_get(&cap, actual_support, orig_value, default_value, &new_value);
244 if (rc == TWRC_SUCCESS)
245 GlobalFree(cap.hContainer);
246 }
247
248 if (actual_support & TWQC_SET)
249 {
250 memset(&cap, 0, sizeof(cap));
251 cap.Cap = captype;
252 cap.ConType = TWON_ONEVALUE;
253 cap.hContainer = alloc_and_set_onevalue(new_value, type);
254
257 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
258 "Error [rc %d|cc %d] doing MSG_SET for type 0x%x\n", rc, status.ConditionCode, captype);
259 GlobalFree(cap.hContainer);
260 }
261
262 if (actual_support & TWQC_RESET)
263 {
264 memset(&cap, 0, sizeof(cap));
265 cap.Cap = captype;
266 cap.ConType = TWON_DONTCARE16;
267
270 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
271 "Error [rc %d|cc %d] doing MSG_RESET for type 0x%x\n", rc, status.ConditionCode, captype);
272 if (rc == TWRC_SUCCESS)
273 GlobalFree(cap.hContainer);
274 }
275}
static void check_get(TW_CAPABILITY *pCapability, TW_INT32 actual_support, TW_UINT32 orig_value, TW_UINT32 default_value, TW_UINT32 *suggested_set_value)
Definition: dsm.c:102
static TW_HANDLE alloc_and_set_onevalue(TW_UINT32 val, TW_UINT16 type)
Definition: dsm.c:79
static BOOL get_onevalue(TW_HANDLE hcontainer, TW_UINT32 *ret, TW_UINT16 *type)
Definition: dsm.c:62
GLenum cap
Definition: glext.h:9639
#define cap
Definition: glfuncs.h:226
#define MSG_GETDEFAULT
Definition: twain.h:1387
LONG TW_INT32
Definition: twain.h:117
#define TWQC_GETDEFAULT
Definition: twain.h:1708
#define TWON_DONTCARE16
Definition: twain.h:513
#define MSG_QUERYSUPPORT
Definition: twain.h:1392
#define DAT_CAPABILITY
Definition: twain.h:1335
#define TWQC_GET
Definition: twain.h:1706
#define TWQC_SET
Definition: twain.h:1707
#define MSG_GETCURRENT
Definition: twain.h:1386
#define TWQC_RESET
Definition: twain.h:1710
#define MSG_RESET
Definition: twain.h:1391

Referenced by test_single_source().

◆ test_physical()

static void test_physical ( TW_IDENTITY appid,
TW_IDENTITY source,
TW_UINT16  captype,
TW_INT32  minimum_support 
)
static

Definition at line 399 of file dsm.c.

400{
401 TW_UINT16 rc;
406 TW_INT32 actual_support;
407
408 memset(&cap, 0, sizeof(cap));
409 cap.Cap = captype;
410 cap.ConType = TWON_DONTCARE16;
411
414 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
415 "Error [rc %d|cc %d] doing MSG_QUERYSUPPORT for type 0x%x\n", rc, status.ConditionCode, captype);
416 if (rc != TWRC_SUCCESS)
417 return;
418 ok(get_onevalue(cap.hContainer, (TW_UINT32 *) &actual_support, NULL), "Returned cap.hContainer invalid for QuerySupport on type 0x%x\n", captype);
419 ok((actual_support & minimum_support) == minimum_support,
420 "Error: minimum support 0x%x for type 0x%x, got 0x%x\n", minimum_support,
421 captype, actual_support);
422
423
424 if (actual_support & TWQC_GETCURRENT)
425 {
426 memset(&cap, 0, sizeof(cap));
427 cap.Cap = captype;
428 cap.ConType = TWON_DONTCARE16;
429
432 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
433 "Error [rc %d|cc %d] doing MSG_GETCURRENT for type 0x%x\n", rc, status.ConditionCode, captype);
434 if (rc == TWRC_SUCCESS)
435 {
436 get_onevalue(cap.hContainer, &val, &type);
437 ok(type == TWTY_FIX32, "GETCURRENT for PHYSICALXXX is not type FIX32, is type %d\n", type);
438 GlobalFree(cap.hContainer);
439 }
440 }
441
442 if (actual_support & TWQC_GETDEFAULT)
443 {
444 memset(&cap, 0, sizeof(cap));
445 cap.Cap = captype;
446 cap.ConType = TWON_DONTCARE16;
447
450 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
451 "Error [rc %d|cc %d] doing MSG_GETDEFAULT for type 0x%x\n", rc, status.ConditionCode, captype);
452 if (rc == TWRC_SUCCESS)
453 {
454 get_onevalue(cap.hContainer, &val, &type);
455 ok(type == TWTY_FIX32, "GETDEFAULT for PHYSICALXXX is not type FIX32, is type %d\n", type);
456 GlobalFree(cap.hContainer);
457 }
458 }
459
460 if (actual_support & TWQC_GET)
461 {
462 memset(&cap, 0, sizeof(cap));
463 cap.Cap = captype;
464 cap.ConType = TWON_DONTCARE16;
465
468 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
469 "Error [rc %d|cc %d] doing MSG_GET for type 0x%x\n", rc, status.ConditionCode, captype);
470 if (rc == TWRC_SUCCESS)
471 {
472 get_onevalue(cap.hContainer, &val, &type);
473 ok(type == TWTY_FIX32, "GET for PHYSICALXXX is not type FIX32, is type %d\n", type);
474 trace("GET for Physical type 0x%x returns 0x%x\n", captype, val);
475 GlobalFree(cap.hContainer);
476 }
477 }
478
479}
#define TWTY_FIX32
Definition: twain.h:550

Referenced by test_single_source().

◆ test_resolution()

static void test_resolution ( TW_IDENTITY appid,
TW_IDENTITY source,
TW_UINT16  captype,
TW_INT32  minimum_support 
)
static

Definition at line 277 of file dsm.c.

278{
279 TW_UINT16 rc;
284 TW_INT32 actual_support;
285 TW_FIX32 orig_value = { 0, 0 };
286 TW_UINT32 new_value = 0;
287 TW_FIX32 default_value = { 0, 0 };
288
289 memset(&cap, 0, sizeof(cap));
290 cap.Cap = captype;
291 cap.ConType = TWON_DONTCARE16;
292
295 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
296 "Error [rc %d|cc %d] doing MSG_QUERYSUPPORT for type 0x%x\n", rc, status.ConditionCode, captype);
297 if (rc != TWRC_SUCCESS)
298 return;
299 ok(get_onevalue(cap.hContainer, (TW_UINT32 *) &actual_support, NULL), "Returned cap.hContainer invalid for QuerySupport on type 0x%x\n", captype);
300 ok((actual_support & minimum_support) == minimum_support,
301 "Error: minimum support 0x%x for type 0x%x, got 0x%x\n", minimum_support,
302 captype, actual_support);
303
304
305 if (actual_support & TWQC_GETCURRENT)
306 {
307 memset(&cap, 0, sizeof(cap));
308 cap.Cap = captype;
309 cap.ConType = TWON_DONTCARE16;
310
313 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
314 "Error [rc %d|cc %d] doing MSG_GETCURRENT for type 0x%x\n", rc, status.ConditionCode, captype);
315 if (rc == TWRC_SUCCESS)
316 {
317 get_onevalue(cap.hContainer, &val, &type);
318 ok(type == TWTY_FIX32, "GETCURRENT for RESOLUTION is not type FIX32, is type %d\n", type);
319 memcpy(&orig_value, &val, sizeof(orig_value));
320 GlobalFree(cap.hContainer);
321 }
322 }
323
324 if (actual_support & TWQC_GETDEFAULT)
325 {
326 memset(&cap, 0, sizeof(cap));
327 cap.Cap = captype;
328 cap.ConType = TWON_DONTCARE16;
329
332 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
333 "Error [rc %d|cc %d] doing MSG_GETDEFAULT for type 0x%x\n", rc, status.ConditionCode, captype);
334 if (rc == TWRC_SUCCESS)
335 {
336 get_onevalue(cap.hContainer, &val, &type);
337 ok(type == TWTY_FIX32, "GETDEFAULT for RESOLUTION is not type FIX32, is type %d\n", type);
338 memcpy(&default_value, &val, sizeof(default_value));
339 GlobalFree(cap.hContainer);
340 }
341 }
342
343 if (actual_support & TWQC_GET)
344 {
345 memset(&cap, 0, sizeof(cap));
346 cap.Cap = captype;
347 cap.ConType = TWON_DONTCARE16;
348
351 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
352 "Error [rc %d|cc %d] doing MSG_GET for type 0x%x\n", rc, status.ConditionCode, captype);
353 if (rc == TWRC_SUCCESS)
354 {
356 ok(cap.ConType == TWON_RANGE, "MSG_GET for ICAP_[XY]RESOLUTION did not return TWON_RANGE, but %d\n", cap.ConType);
357 range = GlobalLock(cap.hContainer);
358 trace("MSG_GET of 0x%x returned [ItemType %d|MinValue %d|MaxValue %d|StepSize %d|DefaultValue %d|CurrentValue %d]:\n",
359 cap.Cap, range->ItemType, range->MinValue, range->MaxValue, range->StepSize,
360 range->DefaultValue, range->CurrentValue);
361 for (new_value = range->MinValue; new_value < range->MaxValue; new_value += range->StepSize)
362 if (new_value != range->CurrentValue)
363 break;
364 GlobalUnlock(cap.hContainer);
365 GlobalFree(cap.hContainer);
366 }
367 }
368
369 if (actual_support & TWQC_SET)
370 {
371 memset(&cap, 0, sizeof(cap));
372 cap.Cap = captype;
373 cap.ConType = TWON_ONEVALUE;
374 cap.hContainer = alloc_and_set_onevalue(new_value, TWTY_FIX32);
375
378 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
379 "Error [rc %d|cc %d] doing MSG_SET for type 0x%x\n", rc, status.ConditionCode, captype);
380 GlobalFree(cap.hContainer);
381
382 }
383
384 if (actual_support & TWQC_RESET)
385 {
386 memset(&cap, 0, sizeof(cap));
387 cap.Cap = captype;
388 cap.ConType = TWON_DONTCARE16;
389
392 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
393 "Error [rc %d|cc %d] doing MSG_RESET for type 0x%x\n", rc, status.ConditionCode, captype);
394 if (rc == TWRC_SUCCESS)
395 GlobalFree(cap.hContainer);
396 }
397}
GLenum GLint * range
Definition: glext.h:7539
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TWON_RANGE
Definition: twain.h:506

◆ test_single_source()

static void test_single_source ( TW_IDENTITY appid,
TW_IDENTITY source 
)
static

Definition at line 637 of file dsm.c.

638{
639 TW_UINT16 rc;
642 UINT16 capabilities[CAP_CUSTOMBASE];
643
644 memset(&cap, 0, sizeof(cap));
646 cap.ConType = TWON_DONTCARE16;
647
650 ok(rc == TWRC_SUCCESS || status.ConditionCode == TWCC_SUCCESS,
651 "Error obtaining CAP_SUPPORTEDCAPS\n");
652
653 memset(capabilities, 0, sizeof(capabilities));
654 if (rc == TWRC_SUCCESS && cap.ConType == TWON_ARRAY)
655 {
656 TW_ARRAY *a;
657 a = GlobalLock(cap.hContainer);
658 if (a)
659 {
660 if (a->ItemType == TWTY_UINT16)
661 {
662 int i;
663 UINT16 *u = (UINT16 *) a->ItemList;
664 trace("%d Capabilities:\n", a->NumItems);
665 for (i = 0; i < a->NumItems; i++)
666 if (u[i] < ARRAY_SIZE(capabilities))
667 {
668 capabilities[u[i]] = 1;
669 trace(" %d: 0x%x\n", i, u[i]);
670 }
671 }
672 GlobalUnlock(cap.hContainer);
673 }
674 }
675
676 /* All sources must support: */
677 ok(capabilities[CAP_SUPPORTEDCAPS], "CAP_SUPPORTEDCAPS not supported\n");
678 ok(capabilities[CAP_XFERCOUNT], "CAP_XFERCOUNT not supported\n");
679 if (capabilities[CAP_XFERCOUNT])
682 ok(capabilities[CAP_UICONTROLLABLE], "CAP_UICONTROLLABLE not supported\n");
683 if (capabilities[CAP_UICONTROLLABLE])
685
686 if (source->SupportedGroups & DG_IMAGE)
687 {
688 /*
689 Sources that supply image information must support DG_CONTROL / DAT_CAPABILITY /
690 MSG_GET, MSG_GETCURRENT, MSG_GETDEFAULT on:
691 */
692 ok(capabilities[ICAP_COMPRESSION], "ICAP_COMPRESSION not supported\n");
693 if (capabilities[ICAP_COMPRESSION])
697 ok(capabilities[ICAP_PLANARCHUNKY], "ICAP_PLANARCHUNKY not supported\n");
698 ok(capabilities[ICAP_PHYSICALHEIGHT], "ICAP_PHYSICALHEIGHT not supported\n");
699 if (capabilities[ICAP_PHYSICALHEIGHT])
702 ok(capabilities[ICAP_PHYSICALWIDTH], "ICAP_PHYSICALWIDTH not supported\n");
703 if (capabilities[ICAP_PHYSICALWIDTH])
706 ok(capabilities[ICAP_PIXELFLAVOR], "ICAP_PIXELFLAVOR not supported\n");
707 if (capabilities[ICAP_PIXELFLAVOR])
710
711 /*
712 Sources that supply image information must support DG_CONTROL / DAT_CAPABILITY /
713 MSG_GET, MSG_GETCURRENT, MSG_GETDEFAULT, MSG_RESET and MSG_SET on:
714 */
715 ok(capabilities[ICAP_BITDEPTH], "ICAP_BITDEPTH not supported\n");
716 if (capabilities[ICAP_BITDEPTH])
720 ok(capabilities[ICAP_BITORDER], "ICAP_BITORDER not supported\n");
721 ok(capabilities[ICAP_PIXELTYPE], "ICAP_PIXELTYPE not supported\n");
722 if (capabilities[ICAP_PIXELTYPE])
725 ok(capabilities[ICAP_UNITS], "ICAP_UNITS not supported\n");
726 if (capabilities[ICAP_UNITS])
729 ok(capabilities[ICAP_XFERMECH], "ICAP_XFERMECH not supported\n");
730 if (capabilities[ICAP_XFERMECH])
733 ok(capabilities[ICAP_XRESOLUTION], "ICAP_XRESOLUTION not supported\n");
734 if (capabilities[ICAP_XRESOLUTION])
737 ok(capabilities[ICAP_YRESOLUTION], "ICAP_YRESOLUTION not supported\n");
738 if (capabilities[ICAP_YRESOLUTION])
741
742 /* Optional capabilities */
743 if (capabilities[CAP_AUTOFEED])
746 if (capabilities[CAP_FEEDERENABLED])
749 if (capabilities[ICAP_SUPPORTEDSIZES])
752
753 /* Additional tests */
755
756 }
757}
unsigned short UINT16
#define ARRAY_SIZE(A)
Definition: main.h:33
static void test_onevalue_cap(TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16 captype, TW_UINT16 type, TW_INT32 minimum_support)
Definition: dsm.c:169
static void test_physical(TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16 captype, TW_INT32 minimum_support)
Definition: dsm.c:399
static void test_imagelayout(TW_IDENTITY *appid, TW_IDENTITY *source)
Definition: dsm.c:591
static void test_supported_sizes(TW_IDENTITY *appid, TW_IDENTITY *source, TW_INT32 minimum_support)
Definition: dsm.c:481
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define a
Definition: ke_i.h:78
static void test_resolution(void)
Definition: image.c:1585
#define todo_wine
Definition: custom.c:79
#define CAP_FEEDERENABLED
Definition: twain.h:1457
#define ICAP_BITORDER
Definition: twain.h:1534
#define ICAP_COMPRESSION
Definition: twain.h:1449
#define ICAP_BITDEPTH
Definition: twain.h:1548
#define ICAP_XFERMECH
Definition: twain.h:1452
#define ICAP_XRESOLUTION
Definition: twain.h:1530
#define CAP_CUSTOMBASE
Definition: twain.h:1443
#define ICAP_UNITS
Definition: twain.h:1451
#define ICAP_PHYSICALHEIGHT
Definition: twain.h:1525
#define ICAP_PIXELTYPE
Definition: twain.h:1450
#define ICAP_YRESOLUTION
Definition: twain.h:1531
#define ICAP_PHYSICALWIDTH
Definition: twain.h:1524
#define ICAP_PIXELFLAVOR
Definition: twain.h:1537
#define CAP_AUTOFEED
Definition: twain.h:1462
#define CAP_XFERCOUNT
Definition: twain.h:1446
#define ICAP_SUPPORTEDSIZES
Definition: twain.h:1540
#define CAP_UICONTROLLABLE
Definition: twain.h:1469
#define TWTY_BOOL
Definition: twain.h:548
#define ICAP_PLANARCHUNKY
Definition: twain.h:1538
#define CAP_SUPPORTEDCAPS
Definition: twain.h:1460
#define TWON_ARRAY
Definition: twain.h:503

Referenced by test_sources().

◆ test_sources()

static void test_sources ( TW_IDENTITY appid)
static

Definition at line 759 of file dsm.c.

760{
761 TW_UINT16 rc;
764 int scannercount = 0;
765
766 memset(&source, 0, sizeof(source));
769 ok( (rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS) ||
770 (rc == TWRC_FAILURE && status.ConditionCode == TWCC_NODS),
771 "Get first invalid condition code, rc %d, cc %d\n", rc, status.ConditionCode);
772
773 while (rc == TWRC_SUCCESS)
774 {
775 scannercount++;
776 trace("[Scanner %d|Version %d.%d(%s)|Protocol %d.%d|SupportedGroups 0x%x|Manufacturer %s|Family %s|ProductName %s]\n",
777 scannercount,
778 source.Version.MajorNum, source.Version.MinorNum, source.Version.Info,
779 source.ProtocolMajor, source.ProtocolMinor, source.SupportedGroups,
780 source.Manufacturer, source.ProductFamily, source.ProductName);
781 memset(&source, 0, sizeof(source));
784 ok(rc == TWRC_SUCCESS || rc == TWRC_ENDOFLIST, "Get next source failed, rc %d, cc %d\n", rc, status.ConditionCode);
785 }
786
787 memset(&source, 0, sizeof(source));
790 ok( (rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS) ||
791 (rc == TWRC_FAILURE && status.ConditionCode == TWCC_NODS),
792 "Get default invalid condition code, rc %d, cc %d\n", rc, status.ConditionCode);
793
794 /* A DS might display a Popup during MSG_OPENDS, when the scanner is not connected */
795 if (rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS && winetest_interactive)
796 {
799
800 if (rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS)
801 {
804 ok(rc == TWRC_SUCCESS, "Close DS Failed, rc %d, cc %d\n", rc, status.ConditionCode);
805 }
806 }
807
809 {
810 trace("Interactive, so trying userselect\n");
811 memset(&source, 0, sizeof(source));
814 ok(rc == TWRC_SUCCESS || rc == TWRC_CANCEL, "Userselect failed, rc %d, cc %d\n", rc, status.ConditionCode);
815
816 if (rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS)
817 {
820 if (rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS)
821 {
825 ok(rc == TWRC_SUCCESS, "Close DS Failed, rc %d, cc %d\n", rc, status.ConditionCode);
826 }
827 }
828 }
829
830}
static void test_single_source(TW_IDENTITY *appid, TW_IDENTITY *source)
Definition: dsm.c:637
int winetest_interactive
#define TWRC_FAILURE
Definition: twain.h:1665
#define MSG_GETFIRST
Definition: twain.h:1388
#define DAT_IDENTITY
Definition: twain.h:1337
#define MSG_OPENDS
Definition: twain.h:1409
#define MSG_CLOSEDS
Definition: twain.h:1410
#define TWCC_NODS
Definition: twain.h:1681
#define MSG_USERSELECT
Definition: twain.h:1411
#define TWRC_ENDOFLIST
Definition: twain.h:1671
#define TWRC_CANCEL
Definition: twain.h:1667
#define MSG_GETNEXT
Definition: twain.h:1389

Referenced by START_TEST().

◆ test_supported_sizes()

static void test_supported_sizes ( TW_IDENTITY appid,
TW_IDENTITY source,
TW_INT32  minimum_support 
)
static

Definition at line 481 of file dsm.c.

482{
483 TW_UINT16 rc;
488 TW_INT32 actual_support;
489 TW_UINT32 orig_value = TWSS_NONE;
490 TW_UINT32 default_value = TWSS_NONE;
491 TW_UINT32 new_value = TWSS_NONE;
492
493
494 memset(&cap, 0, sizeof(cap));
496 cap.ConType = TWON_DONTCARE16;
497
500 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
501 "Error [rc %d|cc %d] doing MSG_QUERYSUPPORT for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode);
502 if (rc != TWRC_SUCCESS)
503 return;
504 ok(get_onevalue(cap.hContainer, (TW_UINT32 *) &actual_support, NULL), "Returned cap.hContainer invalid for QuerySupport on ICAP_SUPPORTEDSIZES\n");
505 ok((actual_support & minimum_support) == minimum_support,
506 "Error: minimum support 0x%x for ICAP_SUPPORTEDSIZES, got 0x%x\n", minimum_support, actual_support);
507
508 if (actual_support & TWQC_GETCURRENT)
509 {
510 memset(&cap, 0, sizeof(cap));
512 cap.ConType = TWON_DONTCARE16;
513
516 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
517 "Error [rc %d|cc %d] doing MSG_GETCURRENT for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode);
518 if (rc == TWRC_SUCCESS)
519 {
520 get_onevalue(cap.hContainer, &val, &type);
521 ok(type == TWTY_UINT16, "GETCURRENT for ICAP_SUPPORTEDSIZES is not type UINT16, is type %d\n", type);
522 trace("Current size is %d\n", val);
523 GlobalFree(cap.hContainer);
524 orig_value = val;
525 }
526 }
527
528 if (actual_support & TWQC_GETDEFAULT)
529 {
530 memset(&cap, 0, sizeof(cap));
532 cap.ConType = TWON_DONTCARE16;
533
536 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
537 "Error [rc %d|cc %d] doing MSG_GETDEFAULT for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode);
538 if (rc == TWRC_SUCCESS)
539 {
540 get_onevalue(cap.hContainer, &val, &type);
541 ok(type == TWTY_UINT16, "GETDEFAULT for PHYSICALXXX is not type TWTY_UINT16, is type %d\n", type);
542 trace("Default size is %d\n", val);
543 GlobalFree(cap.hContainer);
544 default_value = val;
545 }
546 }
547
548 if (actual_support & TWQC_GET)
549 {
550 memset(&cap, 0, sizeof(cap));
552 cap.ConType = TWON_DONTCARE16;
553
556 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
557 "Error [rc %d|cc %d] doing MSG_GET for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode);
558 check_get(&cap, actual_support, orig_value, default_value, &new_value);
559 }
560
561 if (actual_support & TWQC_SET)
562 {
563 memset(&cap, 0, sizeof(cap));
565 cap.ConType = TWON_ONEVALUE;
566 cap.hContainer = alloc_and_set_onevalue(new_value, TWTY_UINT16);
567
570 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
571 "Error [rc %d|cc %d] doing MSG_SET for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode);
572 GlobalFree(cap.hContainer);
573
574 }
575
576 if (actual_support & TWQC_RESET)
577 {
578 memset(&cap, 0, sizeof(cap));
580 cap.ConType = TWON_DONTCARE16;
581
584 ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS,
585 "Error [rc %d|cc %d] doing MSG_RESET for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode);
586 if (rc == TWRC_SUCCESS)
587 GlobalFree(cap.hContainer);
588 }
589}
#define TWSS_NONE
Definition: twain.h:649

Referenced by test_single_source().

Variable Documentation

◆ pDSM_Entry