コード例 #1
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI DropSource_QueryContinueDrag(
    IDropSource *iface,
    BOOL fEscapePressed,
    DWORD grfKeyState)
{
    return check_expect(DS_QueryContinueDrag, 0, NULL);
}
コード例 #2
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI DropTarget_DragOver(IDropTarget* iface,
                                          DWORD grfKeyState,
                                          POINTL pt,
                                          DWORD* pdwEffect)
{
    return check_expect(DT_DragOver, *pdwEffect, pdwEffect);
}
コード例 #3
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI DataObject_EnumFormatEtc(
    IDataObject *iface,
    DWORD dwDirection,
    IEnumFORMATETC **ppenumFormatEtc)
{
    HRESULT hr = check_expect(DO_EnumFormatEtc, 0, NULL);
    *ppenumFormatEtc = &EnumFORMATETC;
    return hr;
}
コード例 #4
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI EnumFORMATETC_Next(IEnumFORMATETC *iface,
        ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
{
    static FORMATETC format = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
    HRESULT hr = check_expect(EnumFMT_Next, 0, NULL);

    ok(celt == 1, "celt = %d\n", celt);
    ok(rgelt != NULL, "rgelt == NULL\n");
    ok(pceltFetched == NULL, "pceltFetched != NULL\n");

    *rgelt = format;
    return hr;
}
コード例 #5
0
ファイル: pgp-pgsql.c プロジェクト: adunstan/pg-cvs-mirror
static bytea *
decrypt_internal(int is_pubenc, int need_text, text *data,
				 text *key, text *keypsw, text *args)
{
	int			err;
	MBuf	   *src = NULL,
			   *dst = NULL;
	uint8		tmp[VARHDRSZ];
	uint8	   *restmp;
	bytea	   *res;
	int			res_len;
	PGP_Context *ctx = NULL;
	struct debug_expect ex;
	int			got_unicode = 0;


	init_work(&ctx, need_text, args, &ex);

	src = mbuf_create_from_data((uint8 *) VARDATA(data),
								VARSIZE(data) - VARHDRSZ);
	dst = mbuf_create(VARSIZE(data) + 2048);

	/*
	 * reserve room for header
	 */
	mbuf_append(dst, tmp, VARHDRSZ);

	/*
	 * set key
	 */
	if (is_pubenc)
	{
		uint8	   *psw = NULL;
		int			psw_len = 0;
		MBuf	   *kbuf;

		if (keypsw)
		{
			psw = (uint8 *) VARDATA(keypsw);
			psw_len = VARSIZE(keypsw) - VARHDRSZ;
		}
		kbuf = create_mbuf_from_vardata(key);
		err = pgp_set_pubkey(ctx, kbuf, psw, psw_len, 1);
		mbuf_free(kbuf);
	}
	else
		err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
							 VARSIZE(key) - VARHDRSZ);

	/*
	 * decrypt
	 */
	if (err >= 0)
		err = pgp_decrypt(ctx, src, dst);

	/*
	 * failed?
	 */
	if (err < 0)
		goto out;

	if (ex.expect)
		check_expect(ctx, &ex);

	/* remember the setting */
	got_unicode = pgp_get_unicode_mode(ctx);

out:
	if (src)
		mbuf_free(src);
	if (ctx)
		pgp_free(ctx);

	if (err)
	{
		px_set_debug_handler(NULL);
		if (dst)
			mbuf_free(dst);
		ereport(ERROR,
				(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
				 errmsg("%s", px_strerror(err))));
	}

	res_len = mbuf_steal_data(dst, &restmp);
	mbuf_free(dst);

	/* res_len includes VARHDRSZ */
	res = (bytea *) restmp;
	SET_VARSIZE(res, res_len);

	if (need_text && got_unicode)
	{
		text	   *utf = convert_from_utf8(res);

		if (utf != res)
		{
			clear_and_pfree(res);
			res = utf;
		}
	}
	px_set_debug_handler(NULL);

	/*
	 * add successfull decryptions also into RNG
	 */
	add_entropy(res, key, keypsw);

	return res;
}
コード例 #6
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static void test_DoDragDrop(void)
{
    DWORD effect;
    HRESULT hr;
    HWND hwnd;
    RECT rect;
    int seq;

    hwnd = CreateWindowExA(WS_EX_TOPMOST, "WineOleTestClass", "Test", 0,
        CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL,
        NULL, NULL, NULL);
    ok(IsWindow(hwnd), "failed to create window\n");

    hr = OleInitialize(NULL);
    ok(hr == S_OK, "got 0x%08x\n", hr);

    hr = RegisterDragDrop(hwnd, &DropTarget);
    ok(hr == S_OK, "got 0x%08x\n", hr);

    /* incomplete arguments set */
    hr = DoDragDrop(NULL, NULL, 0, NULL);
    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);

    hr = DoDragDrop(NULL, &DropSource, 0, NULL);
    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);

    hr = DoDragDrop(&DataObject, NULL, 0, NULL);
    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);

    hr = DoDragDrop(NULL, NULL, 0, &effect);
    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);

    hr = DoDragDrop(&DataObject, &DropSource, 0, NULL);
    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);

    hr = DoDragDrop(NULL, &DropSource, 0, &effect);
    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);

    hr = DoDragDrop(&DataObject, NULL, 0, &effect);
    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);

    ShowWindow(hwnd, SW_SHOW);
    GetWindowRect(hwnd, &rect);
    ok(SetCursorPos(rect.left+50, rect.top+50), "SetCursorPos failed\n");

    for (seq = 0; seq < sizeof(call_lists) / sizeof(call_lists[0]); seq++)
    {
        DWORD effect_in;
        trace("%d\n", seq);
        call_ptr = call_lists[seq];
        effect_in = call_ptr->set_param;
        call_ptr++;

        hr = DoDragDrop(&DataObject, &DropSource, effect_in, &effect);
        check_expect(DoDragDrop_ret, hr, NULL);
        check_expect(DoDragDrop_effect_out, effect, NULL);
    }

    OleUninitialize();

    DestroyWindow(hwnd);
}
コード例 #7
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI DataObject_QueryGetData(
    IDataObject *iface,
    FORMATETC *pformatetc)
{
    return check_expect(DO_QueryGetData, 0, NULL);
}
コード例 #8
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI EnumFORMATETC_Reset(IEnumFORMATETC *iface)
{
    return check_expect(EnumFMT_Reset, 0, NULL);
}
コード例 #9
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI EnumFORMATETC_Skip(IEnumFORMATETC *iface, ULONG celt)
{
    return check_expect(EnumFMT_Skip, 0, NULL);
}
コード例 #10
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI DropSource_GiveFeedback(
    IDropSource *iface,
    DWORD dwEffect)
{
    return check_expect(DS_GiveFeedback, dwEffect, NULL);
}
コード例 #11
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI DropTarget_Drop(IDropTarget* iface,
                                      IDataObject* pDataObj, DWORD grfKeyState,
                                      POINTL pt, DWORD* pdwEffect)
{
    return check_expect(DT_Drop, *pdwEffect, pdwEffect);
}
コード例 #12
0
ファイル: dragdrop.c プロジェクト: AmesianX/wine
static HRESULT WINAPI DropTarget_DragLeave(IDropTarget* iface)
{
    return check_expect(DT_DragLeave, 0, NULL);
}