Rob Shearman : ole32: Fix BindCtxImpl_GetBindOptions to return the correct locale and to not fail if the input size is too large .

Alexandre Julliard julliard at wine.codeweavers.com
Thu Mar 8 07:17:12 CST 2007


Module: wine
Branch: master
Commit: bdefb46d29a8d5a9cf9f3794648565c5dbfd7908
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bdefb46d29a8d5a9cf9f3794648565c5dbfd7908

Author: Rob Shearman <rob at codeweavers.com>
Date:   Thu Mar  8 11:00:21 2007 +0000

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 9a7e4df..636cdca 100644
--- a/dlls/ole32/bindctx.c
+++ b/dlls/ole32/bindctx.c
@@ -20,14 +20,15 @@
 
 #include <stdarg.h>
 #include <string.h>
-#include <assert.h>
 
 #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 e628aca..f084fbb 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);
 




More information about the wine-cvs mailing list