oledb32: Allow case-insensitive match for Provider keyword.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d08613e87
commit
ae9281e27f
|
@ -413,7 +413,7 @@ static HRESULT parse_init_string(const WCHAR *initstring, struct dbprops *props)
|
|||
if (scol) scol++;
|
||||
start = scol;
|
||||
|
||||
if (!strcmpW(name, providerW))
|
||||
if (!strcmpiW(name, providerW))
|
||||
{
|
||||
SysFreeString(name);
|
||||
SysFreeString(value);
|
||||
|
@ -548,6 +548,29 @@ static void datasource_release(BOOL created, IUnknown **datasource)
|
|||
*datasource = NULL;
|
||||
}
|
||||
|
||||
static inline WCHAR *strdupW(const WCHAR *src)
|
||||
{
|
||||
WCHAR *dest;
|
||||
if (!src) return NULL;
|
||||
dest = heap_alloc((strlenW(src)+1)*sizeof(WCHAR));
|
||||
if (dest)
|
||||
strcpyW(dest, src);
|
||||
return dest;
|
||||
}
|
||||
|
||||
static WCHAR *strstriW(const WCHAR *str, const WCHAR *sub)
|
||||
{
|
||||
LPWSTR strlower, sublower, r;
|
||||
strlower = CharLowerW(strdupW(str));
|
||||
sublower = CharLowerW(strdupW(sub));
|
||||
r = strstrW(strlower, sublower);
|
||||
if (r)
|
||||
r = (LPWSTR)str + (r - strlower);
|
||||
heap_free(strlower);
|
||||
heap_free(sublower);
|
||||
return r;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *outer, DWORD clsctx,
|
||||
LPWSTR initstring, REFIID riid, IUnknown **datasource)
|
||||
{
|
||||
|
@ -565,7 +588,7 @@ static HRESULT WINAPI datainit_GetDataSource(IDataInitialize *iface, IUnknown *o
|
|||
|
||||
/* first get provider name */
|
||||
provclsid = IID_NULL;
|
||||
if (initstring && (prov = strstrW(initstring, providerW)))
|
||||
if (initstring && (prov = strstriW(initstring, providerW)))
|
||||
{
|
||||
WCHAR *start, *progid;
|
||||
int len;
|
||||
|
|
|
@ -382,6 +382,8 @@ static void test_initializationstring(void)
|
|||
{
|
||||
static const WCHAR initstring_msdasql[] = {'P','r','o','v','i','d','e','r','=','M','S','D','A','S','Q','L','.','1',';',
|
||||
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y', 0};
|
||||
static const WCHAR initstring_msdasql2[] = {'p','R','o','V','i','D','e','R','=','M','S','D','A','S','Q','L','.','1',';',
|
||||
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y', 0};
|
||||
static const WCHAR initstring_sqloledb[] = {'P','r','o','v','i','d','e','r','=','S','Q','L','O','L','E','D','B','.','1',';',
|
||||
'D','a','t','a',' ','S','o','u','r','c','e','=','d','u','m','m','y', 0};
|
||||
IDataInitialize *datainit = NULL;
|
||||
|
@ -414,6 +416,13 @@ static void test_initializationstring(void)
|
|||
}
|
||||
|
||||
IDBInitialize_Release(dbinit);
|
||||
|
||||
/* mixed casing string */
|
||||
dbinit = NULL;
|
||||
hr = IDataInitialize_GetDataSource(datainit, NULL, CLSCTX_INPROC_SERVER, (WCHAR*)initstring_msdasql2,
|
||||
&IID_IDBInitialize, (IUnknown**)&dbinit);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
IDBInitialize_Release(dbinit);
|
||||
}
|
||||
else
|
||||
ok(dbinit == NULL, "got %p\n", dbinit);
|
||||
|
|
Loading…
Reference in New Issue