From bdefb46d29a8d5a9cf9f3794648565c5dbfd7908 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Thu, 8 Mar 2007 11:00:21 +0000 Subject: [PATCH] ole32: Fix BindCtxImpl_GetBindOptions to return the correct locale and to not fail if the input size is too large. --- dlls/ole32/bindctx.c | 11 +++++------ dlls/ole32/tests/moniker.c | 10 +--------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/dlls/ole32/bindctx.c b/dlls/ole32/bindctx.c index 9a7e4df0a2d..636cdcac37e 100644 --- a/dlls/ole32/bindctx.c +++ b/dlls/ole32/bindctx.c @@ -20,14 +20,15 @@ #include #include -#include #define COBJMACROS #include "winerror.h" #include "windef.h" #include "winbase.h" +#include "winnls.h" #include "objbase.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -273,10 +274,8 @@ BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts) return E_POINTER; if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) - { - WARN("invalid size\n"); - return E_INVALIDARG; /* FIXME : not verified */ - } + pbindopts->cbStruct = sizeof(BIND_OPTS2); + memcpy(pbindopts, &This->bindOption2, pbindopts->cbStruct); return S_OK; } @@ -510,7 +509,7 @@ static HRESULT BindCtxImpl_Construct(BindCtxImpl* This) This->bindOption2.dwTrackFlags = 0; This->bindOption2.dwClassContext = CLSCTX_SERVER; - This->bindOption2.locale = 1033; + This->bindOption2.locale = GetThreadLocale(); This->bindOption2.pServerInfo = 0; /* Initialize the bindctx table */ diff --git a/dlls/ole32/tests/moniker.c b/dlls/ole32/tests/moniker.c index e628aca6f1a..f084fbbd845 100644 --- a/dlls/ole32/tests/moniker.c +++ b/dlls/ole32/tests/moniker.c @@ -1455,10 +1455,8 @@ static void test_bind_context(void) bind_opts.cbStruct = -1; hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts); - todo_wine { ok_ole_success(hr, "IBindCtx_GetBindOptions"); ok(bind_opts.cbStruct == sizeof(bind_opts), "bind_opts.cbStruct was %d\n", bind_opts.cbStruct); - } bind_opts.cbStruct = sizeof(bind_opts); hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts); @@ -1470,13 +1468,7 @@ static void test_bind_context(void) ok(bind_opts.dwTrackFlags == 0, "bind_opts.dwTrackFlags was 0x%x instead of 0\n", bind_opts.dwTrackFlags); ok(bind_opts.dwClassContext == (CLSCTX_INPROC_SERVER|CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER), "bind_opts.dwClassContext should have been 0x15 instead of 0x%x\n", bind_opts.dwClassContext); - if (bind_opts.locale != GetThreadLocale()) /* should be removed once wine is fixed */ - { - todo_wine - ok(bind_opts.locale == GetThreadLocale(), "bind_opts.locale should have been 0x%x instead of 0x%x\n", GetThreadLocale(), bind_opts.locale); - } - else - 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);