static TW_UINT16 msg_set(pTW_CAPABILITY pCapability, TW_UINT32 *val) { if (pCapability->ConType == TWON_ONEVALUE) return get_onevalue(pCapability, NULL, val); FIXME("Partial Stub: MSG_SET only supports TW_ONEVALUE\n"); return TWCC_BADCAP; }
static void test_supported_sizes(TW_IDENTITY *appid, TW_IDENTITY *source, TW_INT32 minimum_support) { TW_UINT16 rc; TW_STATUS status; TW_CAPABILITY cap; TW_UINT32 val; TW_UINT16 type; TW_INT32 actual_support; TW_UINT32 orig_value = TWSS_NONE; TW_UINT32 default_value = TWSS_NONE; TW_UINT32 new_value = TWSS_NONE; memset(&cap, 0, sizeof(cap)); cap.Cap = ICAP_SUPPORTEDSIZES; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_QUERYSUPPORT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_QUERYSUPPORT for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode); if (rc != TWRC_SUCCESS) return; ok(get_onevalue(cap.hContainer, (TW_UINT32 *) &actual_support, NULL), "Returned cap.hContainer invalid for QuerySupport on ICAP_SUPPORTEDSIZES\n"); ok((actual_support & minimum_support) == minimum_support, "Error: minimum support 0x%x for ICAP_SUPPORTEDSIZES, got 0x%x\n", minimum_support, actual_support); if (actual_support & TWQC_GETCURRENT) { memset(&cap, 0, sizeof(cap)); cap.Cap = ICAP_SUPPORTEDSIZES; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GETCURRENT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GETCURRENT for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode); if (rc == TWRC_SUCCESS) { get_onevalue(cap.hContainer, &val, &type); ok(type == TWTY_UINT16, "GETCURRENT for ICAP_SUPPORTEDSIZES is not type UINT16, is type %d\n", type); trace("Current size is %d\n", val); GlobalFree(cap.hContainer); orig_value = val; } } if (actual_support & TWQC_GETDEFAULT) { memset(&cap, 0, sizeof(cap)); cap.Cap = ICAP_SUPPORTEDSIZES; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GETDEFAULT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GETDEFAULT for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode); if (rc == TWRC_SUCCESS) { get_onevalue(cap.hContainer, &val, &type); ok(type == TWTY_UINT16, "GETDEFAULT for PHYSICALXXX is not type TWTY_UINT16, is type %d\n", type); trace("Default size is %d\n", val); GlobalFree(cap.hContainer); default_value = val; } } if (actual_support & TWQC_GET) { memset(&cap, 0, sizeof(cap)); cap.Cap = ICAP_SUPPORTEDSIZES; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GET for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode); check_get(&cap, actual_support, orig_value, default_value, &new_value); } if (actual_support & TWQC_SET) { memset(&cap, 0, sizeof(cap)); cap.Cap = ICAP_SUPPORTEDSIZES; cap.ConType = TWON_ONEVALUE; cap.hContainer = alloc_and_set_onevalue(new_value, TWTY_UINT16); rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_SET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_SET for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode); GlobalFree(cap.hContainer); } if (actual_support & TWQC_RESET) { memset(&cap, 0, sizeof(cap)); cap.Cap = ICAP_SUPPORTEDSIZES; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_RESET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_RESET for ICAP_SUPPORTEDSIZES\n", rc, status.ConditionCode); if (rc == TWRC_SUCCESS) GlobalFree(cap.hContainer); } }
static void test_resolution(TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16 captype, TW_INT32 minimum_support) { TW_UINT16 rc; TW_STATUS status; TW_CAPABILITY cap; TW_UINT32 val; TW_UINT16 type; TW_INT32 actual_support; TW_FIX32 orig_value = { 0, 0 }; TW_UINT32 new_value = 0; TW_FIX32 default_value = { 0, 0 }; memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_QUERYSUPPORT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_QUERYSUPPORT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc != TWRC_SUCCESS) return; ok(get_onevalue(cap.hContainer, (TW_UINT32 *) &actual_support, NULL), "Returned cap.hContainer invalid for QuerySupport on type 0x%x\n", captype); ok((actual_support & minimum_support) == minimum_support, "Error: minimum support 0x%x for type 0x%x, got 0x%x\n", minimum_support, captype, actual_support); if (actual_support & TWQC_GETCURRENT) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GETCURRENT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GETCURRENT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) { get_onevalue(cap.hContainer, &val, &type); ok(type == TWTY_FIX32, "GETCURRENT for RESOLUTION is not type FIX32, is type %d\n", type); memcpy(&orig_value, &val, sizeof(orig_value)); GlobalFree(cap.hContainer); } } if (actual_support & TWQC_GETDEFAULT) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GETDEFAULT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GETDEFAULT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) { get_onevalue(cap.hContainer, &val, &type); ok(type == TWTY_FIX32, "GETDEFAULT for RESOLUTION is not type FIX32, is type %d\n", type); memcpy(&default_value, &val, sizeof(default_value)); GlobalFree(cap.hContainer); } } if (actual_support & TWQC_GET) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GET for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) { TW_RANGE *range; ok(cap.ConType == TWON_RANGE, "MSG_GET for ICAP_[XY]RESOLUTION did not return TWON_RANGE, but %d\n", cap.ConType); range = GlobalLock(cap.hContainer); trace("MSG_GET of 0x%x returned [ItemType %d|MinValue %d|MaxValue %d|StepSize %d|DefaultValue %d|CurrentValue %d]:\n", cap.Cap, range->ItemType, range->MinValue, range->MaxValue, range->StepSize, range->DefaultValue, range->CurrentValue); for (new_value = range->MinValue; new_value < range->MaxValue; new_value += range->StepSize) if (new_value != range->CurrentValue) break; GlobalUnlock(cap.hContainer); GlobalFree(cap.hContainer); } } if (actual_support & TWQC_SET) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_ONEVALUE; cap.hContainer = alloc_and_set_onevalue(new_value, TWTY_FIX32); rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_SET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_SET for type 0x%x\n", rc, status.ConditionCode, captype); GlobalFree(cap.hContainer); } if (actual_support & TWQC_RESET) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_RESET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_RESET for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) GlobalFree(cap.hContainer); } }
static void test_physical(TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16 captype, TW_INT32 minimum_support) { TW_UINT16 rc; TW_STATUS status; TW_CAPABILITY cap; TW_UINT32 val; TW_UINT16 type; TW_INT32 actual_support; memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_QUERYSUPPORT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_QUERYSUPPORT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc != TWRC_SUCCESS) return; ok(get_onevalue(cap.hContainer, (TW_UINT32 *) &actual_support, NULL), "Returned cap.hContainer invalid for QuerySupport on type 0x%x\n", captype); ok((actual_support & minimum_support) == minimum_support, "Error: minimum support 0x%x for type 0x%x, got 0x%x\n", minimum_support, captype, actual_support); if (actual_support & TWQC_GETCURRENT) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GETCURRENT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GETCURRENT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) { get_onevalue(cap.hContainer, &val, &type); ok(type == TWTY_FIX32, "GETCURRENT for PHYSICALXXX is not type FIX32, is type %d\n", type); GlobalFree(cap.hContainer); } } if (actual_support & TWQC_GETDEFAULT) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GETDEFAULT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GETDEFAULT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) { get_onevalue(cap.hContainer, &val, &type); ok(type == TWTY_FIX32, "GETDEFAULT for PHYSICALXXX is not type FIX32, is type %d\n", type); GlobalFree(cap.hContainer); } } if (actual_support & TWQC_GET) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GET for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) { get_onevalue(cap.hContainer, &val, &type); ok(type == TWTY_FIX32, "GET for PHYSICALXXX is not type FIX32, is type %d\n", type); trace("GET for Physical type 0x%x returns 0x%x\n", captype, val); GlobalFree(cap.hContainer); } } }
static void test_onevalue_cap(TW_IDENTITY *appid, TW_IDENTITY *source, TW_UINT16 captype, TW_UINT16 type, TW_INT32 minimum_support) { TW_UINT16 rc; TW_UINT16 rtype; TW_STATUS status; TW_CAPABILITY cap; TW_UINT32 orig_value = 0; TW_UINT32 new_value; TW_UINT32 default_value = 0; TW_INT32 actual_support; memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_QUERYSUPPORT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_QUERYSUPPORT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc != TWRC_SUCCESS) return; ok(get_onevalue(cap.hContainer, (TW_UINT32 *) &actual_support, NULL), "Returned cap.hContainer invalid for QuerySupport on type 0x%x\n", captype); ok((actual_support & minimum_support) == minimum_support, "Error: minimum support 0x%x for type 0x%x, got 0x%x\n", minimum_support, captype, actual_support); if (actual_support & TWQC_GETCURRENT) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GETCURRENT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GETCURRENT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) { ok(get_onevalue(cap.hContainer, &orig_value, &rtype), "Returned cap.hContainer invalid for GETCURRENT on type 0x%x\n", captype); ok(rtype == type, "Returned GETCURRENT type 0x%x for cap 0x%x is not expected 0x%x\n", rtype, captype, type); GlobalFree(cap.hContainer); } } if (actual_support & TWQC_GETDEFAULT) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GETDEFAULT, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GETDEFAULT for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) { ok(get_onevalue(cap.hContainer, &default_value, &rtype), "Returned cap.hContainer invalid for GETDEFAULT on type 0x%x\n", captype); ok(rtype == type, "Returned GETDEFAULT type 0x%x for cap 0x%x is not expected 0x%x\n", rtype, captype, type); GlobalFree(cap.hContainer); } } new_value = orig_value; if (actual_support & TWQC_GET) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_GET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_GET for type 0x%x\n", rc, status.ConditionCode, captype); check_get(&cap, actual_support, orig_value, default_value, &new_value); if (rc == TWRC_SUCCESS) GlobalFree(cap.hContainer); } if (actual_support & TWQC_SET) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_ONEVALUE; cap.hContainer = alloc_and_set_onevalue(new_value, type); rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_SET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_SET for type 0x%x\n", rc, status.ConditionCode, captype); GlobalFree(cap.hContainer); } if (actual_support & TWQC_RESET) { memset(&cap, 0, sizeof(cap)); cap.Cap = captype; cap.ConType = TWON_DONTCARE16; rc = pDSM_Entry(appid, source, DG_CONTROL, DAT_CAPABILITY, MSG_RESET, &cap); get_condition_code(appid, source, &status); ok(rc == TWRC_SUCCESS && status.ConditionCode == TWCC_SUCCESS, "Error [rc %d|cc %d] doing MSG_RESET for type 0x%x\n", rc, status.ConditionCode, captype); if (rc == TWRC_SUCCESS) GlobalFree(cap.hContainer); } }