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

This commit is contained in:
Rob Shearman 2007-03-08 11:00:21 +00:00 committed by Alexandre Julliard
parent bf4b5188e0
commit bdefb46d29
2 changed files with 6 additions and 15 deletions

View File

@ -20,14 +20,15 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <assert.h>
#define COBJMACROS #define COBJMACROS
#include "winerror.h" #include "winerror.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h"
#include "objbase.h" #include "objbase.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
@ -273,10 +274,8 @@ BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
return E_POINTER; return E_POINTER;
if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) if (pbindopts->cbStruct > sizeof(BIND_OPTS2))
{ pbindopts->cbStruct = sizeof(BIND_OPTS2);
WARN("invalid size\n");
return E_INVALIDARG; /* FIXME : not verified */
}
memcpy(pbindopts, &This->bindOption2, pbindopts->cbStruct); memcpy(pbindopts, &This->bindOption2, pbindopts->cbStruct);
return S_OK; return S_OK;
} }
@ -510,7 +509,7 @@ static HRESULT BindCtxImpl_Construct(BindCtxImpl* This)
This->bindOption2.dwTrackFlags = 0; This->bindOption2.dwTrackFlags = 0;
This->bindOption2.dwClassContext = CLSCTX_SERVER; This->bindOption2.dwClassContext = CLSCTX_SERVER;
This->bindOption2.locale = 1033; This->bindOption2.locale = GetThreadLocale();
This->bindOption2.pServerInfo = 0; This->bindOption2.pServerInfo = 0;
/* Initialize the bindctx table */ /* Initialize the bindctx table */

View File

@ -1455,10 +1455,8 @@ 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);
todo_wine {
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);
}
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);
@ -1470,12 +1468,6 @@ 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.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), 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); "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); ok(bind_opts.pServerInfo == NULL, "bind_opts.pServerInfo should have been NULL instead of %p\n", bind_opts.pServerInfo);