Commit 89ef98ab authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ole32: Support BIND_OPTS3 in bind context.

parent ab627418
...@@ -57,7 +57,7 @@ typedef struct BindCtxImpl{ ...@@ -57,7 +57,7 @@ typedef struct BindCtxImpl{
DWORD bindCtxTableLastIndex; /* first free index in the table */ DWORD bindCtxTableLastIndex; /* first free index in the table */
DWORD bindCtxTableSize; /* size table */ DWORD bindCtxTableSize; /* size table */
BIND_OPTS2 bindOption2; /* a structure which contains the bind options*/ BIND_OPTS3 options;
} BindCtxImpl; } BindCtxImpl;
...@@ -246,17 +246,17 @@ BindCtxImpl_SetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts) ...@@ -246,17 +246,17 @@ BindCtxImpl_SetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
{ {
BindCtxImpl *This = impl_from_IBindCtx(iface); BindCtxImpl *This = impl_from_IBindCtx(iface);
TRACE("(%p,%p)\n",This,pbindopts); TRACE("(%p,%p)\n",This, pbindopts);
if (pbindopts==NULL) if (pbindopts==NULL)
return E_POINTER; return E_POINTER;
if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) if (pbindopts->cbStruct > sizeof(This->options))
{ {
WARN("invalid size\n"); WARN("invalid size %u.\n", pbindopts->cbStruct);
return E_INVALIDARG; /* FIXME : not verified */ return E_INVALIDARG;
} }
memcpy(&This->bindOption2, pbindopts, pbindopts->cbStruct); memcpy(&This->options, pbindopts, pbindopts->cbStruct);
return S_OK; return S_OK;
} }
...@@ -267,19 +267,16 @@ static HRESULT WINAPI ...@@ -267,19 +267,16 @@ static HRESULT WINAPI
BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts) BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
{ {
BindCtxImpl *This = impl_from_IBindCtx(iface); BindCtxImpl *This = impl_from_IBindCtx(iface);
ULONG cbStruct; DWORD size;
TRACE("(%p,%p)\n",This,pbindopts); TRACE("(%p,%p)\n",This,pbindopts);
if (pbindopts==NULL) if (pbindopts==NULL)
return E_POINTER; return E_POINTER;
cbStruct = pbindopts->cbStruct; size = min(pbindopts->cbStruct, sizeof(This->options));
if (cbStruct > sizeof(BIND_OPTS2)) memcpy(pbindopts, &This->options, size);
cbStruct = sizeof(BIND_OPTS2); pbindopts->cbStruct = size;
memcpy(pbindopts, &This->bindOption2, cbStruct);
pbindopts->cbStruct = cbStruct;
return S_OK; return S_OK;
} }
...@@ -520,16 +517,11 @@ static HRESULT BindCtxImpl_Construct(BindCtxImpl* This) ...@@ -520,16 +517,11 @@ static HRESULT BindCtxImpl_Construct(BindCtxImpl* This)
This->IBindCtx_iface.lpVtbl = &VT_BindCtxImpl; This->IBindCtx_iface.lpVtbl = &VT_BindCtxImpl;
This->ref = 0; This->ref = 0;
/* Initialize the BIND_OPTS2 structure */ memset(&This->options, 0, sizeof(This->options));
This->bindOption2.cbStruct = sizeof(BIND_OPTS2); This->options.cbStruct = sizeof(This->options);
This->bindOption2.grfFlags = 0; This->options.grfMode = STGM_READWRITE;
This->bindOption2.grfMode = STGM_READWRITE; This->options.dwClassContext = CLSCTX_SERVER;
This->bindOption2.dwTickCountDeadline = 0; This->options.locale = GetThreadLocale();
This->bindOption2.dwTrackFlags = 0;
This->bindOption2.dwClassContext = CLSCTX_SERVER;
This->bindOption2.locale = GetThreadLocale();
This->bindOption2.pServerInfo = 0;
/* Initialize the bindctx table */ /* Initialize the bindctx table */
This->bindCtxTableSize=0; This->bindCtxTableSize=0;
......
...@@ -1888,7 +1888,7 @@ static void test_bind_context(void) ...@@ -1888,7 +1888,7 @@ static void test_bind_context(void)
HRESULT hr; HRESULT hr;
IBindCtx *pBindCtx; IBindCtx *pBindCtx;
IEnumString *pEnumString; IEnumString *pEnumString;
BIND_OPTS2 bind_opts; BIND_OPTS3 bind_opts;
HeapUnknown *unknown; HeapUnknown *unknown;
HeapUnknown *unknown2; HeapUnknown *unknown2;
IUnknown *param_obj; IUnknown *param_obj;
...@@ -1908,19 +1908,20 @@ static void test_bind_context(void) ...@@ -1908,19 +1908,20 @@ static void test_bind_context(void)
bind_opts.cbStruct = -1; bind_opts.cbStruct = -1;
hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts); hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
ok_ole_success(hr, "IBindCtx_GetBindOptions"); ok_ole_success(hr, "IBindCtx_GetBindOptions");
ok(bind_opts.cbStruct == sizeof(bind_opts) || ok(bind_opts.cbStruct == sizeof(BIND_OPTS3) || broken(bind_opts.cbStruct == sizeof(BIND_OPTS2)) /* XP */,
bind_opts.cbStruct == sizeof(bind_opts) + sizeof(void*), /* Vista */ "Unexpected bind_opts.cbStruct %d.\n", bind_opts.cbStruct);
"bind_opts.cbStruct was %d\n", bind_opts.cbStruct);
bind_opts.cbStruct = sizeof(BIND_OPTS); bind_opts.cbStruct = sizeof(BIND_OPTS);
hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts); hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
ok_ole_success(hr, "IBindCtx_GetBindOptions"); ok_ole_success(hr, "IBindCtx_GetBindOptions");
ok(bind_opts.cbStruct == sizeof(BIND_OPTS), "bind_opts.cbStruct was %d\n", bind_opts.cbStruct); ok(bind_opts.cbStruct == sizeof(BIND_OPTS), "bind_opts.cbStruct was %d\n", bind_opts.cbStruct);
memset(&bind_opts, 0xfe, sizeof(bind_opts));
bind_opts.cbStruct = sizeof(bind_opts); bind_opts.cbStruct = sizeof(bind_opts);
hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts); hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
ok_ole_success(hr, "IBindCtx_GetBindOptions"); ok_ole_success(hr, "IBindCtx_GetBindOptions");
ok(bind_opts.cbStruct == sizeof(bind_opts), "bind_opts.cbStruct was %d\n", bind_opts.cbStruct); ok(bind_opts.cbStruct == sizeof(bind_opts) || bind_opts.cbStruct == sizeof(BIND_OPTS2) /* XP */,
"Unexpected bind_opts.cbStruct %d.\n", bind_opts.cbStruct);
ok(bind_opts.grfFlags == 0, "bind_opts.grfFlags was 0x%x instead of 0\n", bind_opts.grfFlags); ok(bind_opts.grfFlags == 0, "bind_opts.grfFlags was 0x%x instead of 0\n", bind_opts.grfFlags);
ok(bind_opts.grfMode == STGM_READWRITE, "bind_opts.grfMode was 0x%x instead of STGM_READWRITE\n", bind_opts.grfMode); ok(bind_opts.grfMode == STGM_READWRITE, "bind_opts.grfMode was 0x%x instead of STGM_READWRITE\n", bind_opts.grfMode);
ok(bind_opts.dwTickCountDeadline == 0, "bind_opts.dwTickCountDeadline was %d instead of 0\n", bind_opts.dwTickCountDeadline); ok(bind_opts.dwTickCountDeadline == 0, "bind_opts.dwTickCountDeadline was %d instead of 0\n", bind_opts.dwTickCountDeadline);
...@@ -1929,6 +1930,8 @@ static void test_bind_context(void) ...@@ -1929,6 +1930,8 @@ static void test_bind_context(void)
"bind_opts.dwClassContext should have been 0x15 instead of 0x%x\n", bind_opts.dwClassContext); "bind_opts.dwClassContext should have been 0x15 instead of 0x%x\n", bind_opts.dwClassContext);
ok(bind_opts.locale == GetThreadLocale(), "bind_opts.locale should have been 0x%x instead of 0x%x\n", GetThreadLocale(), bind_opts.locale); ok(bind_opts.locale == GetThreadLocale(), "bind_opts.locale should have been 0x%x instead of 0x%x\n", GetThreadLocale(), bind_opts.locale);
ok(bind_opts.pServerInfo == NULL, "bind_opts.pServerInfo should have been NULL instead of %p\n", bind_opts.pServerInfo); ok(bind_opts.pServerInfo == NULL, "bind_opts.pServerInfo should have been NULL instead of %p\n", bind_opts.pServerInfo);
if (bind_opts.cbStruct >= sizeof(BIND_OPTS3))
ok(bind_opts.hwnd == NULL, "Unexpected bind_opts.hwnd %p.\n", bind_opts.hwnd);
bind_opts.cbStruct = -1; bind_opts.cbStruct = -1;
hr = IBindCtx_SetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts); hr = IBindCtx_SetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment