ole32: Fix cbStruct handling in IBindCtx:GetBindOptions.

This commit is contained in:
Rob Shearman 2007-03-09 09:47:43 +00:00 committed by Alexandre Julliard
parent e14e464df6
commit ba3ceaa4b8
2 changed files with 7 additions and 4 deletions

View File

@ -267,16 +267,20 @@ static HRESULT WINAPI
BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
{
BindCtxImpl *This = (BindCtxImpl *)iface;
ULONG cbStruct;
TRACE("(%p,%p)\n",This,pbindopts);
if (pbindopts==NULL)
return E_POINTER;
if (pbindopts->cbStruct > sizeof(BIND_OPTS2))
pbindopts->cbStruct = sizeof(BIND_OPTS2);
cbStruct = pbindopts->cbStruct;
if (cbStruct > sizeof(BIND_OPTS2))
cbStruct = sizeof(BIND_OPTS2);
memcpy(pbindopts, &This->bindOption2, cbStruct);
pbindopts->cbStruct = cbStruct;
memcpy(pbindopts, &This->bindOption2, pbindopts->cbStruct);
return S_OK;
}

View File

@ -1466,7 +1466,6 @@ static void test_bind_context(void)
bind_opts.cbStruct = sizeof(BIND_OPTS);
hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
ok_ole_success(hr, "IBindCtx_GetBindOptions");
todo_wine
ok(bind_opts.cbStruct == sizeof(BIND_OPTS), "bind_opts.cbStruct was %d\n", bind_opts.cbStruct);
bind_opts.cbStruct = sizeof(bind_opts);