From: Vibhav Pant vibhavp@gmail.com
--- dlls/structuredquery/Makefile.in | 3 +- dlls/structuredquery/classes.idl | 9 ++ dlls/structuredquery/main.c | 1 + dlls/structuredquery/private.h | 1 + dlls/structuredquery/queryparsermanager.c | 126 ++++++++++++++++++++++ dlls/structuredquery/tests/query.c | 2 +- 6 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 dlls/structuredquery/queryparsermanager.c
diff --git a/dlls/structuredquery/Makefile.in b/dlls/structuredquery/Makefile.in index 673ab666aa1..7caa33a3a21 100644 --- a/dlls/structuredquery/Makefile.in +++ b/dlls/structuredquery/Makefile.in @@ -6,4 +6,5 @@ EXTRADLLFLAGS = -Wb,--prefer-native SOURCES = \ classes.idl \ main.c \ - queryparser.c + queryparser.c \ + queryparsermanager.c diff --git a/dlls/structuredquery/classes.idl b/dlls/structuredquery/classes.idl index d5cf17fd37c..666393f0d01 100644 --- a/dlls/structuredquery/classes.idl +++ b/dlls/structuredquery/classes.idl @@ -26,3 +26,12 @@ coclass QueryParser { interface IQueryParser; } + +[ + uuid(5088b39a-29b4-4d9d-8245-4ee289222f66), + threading(both) +] +coclass QueryParserManager +{ + interface IQueryParserManager; +}; diff --git a/dlls/structuredquery/main.c b/dlls/structuredquery/main.c index 939b5da251f..2e7221c8a30 100644 --- a/dlls/structuredquery/main.c +++ b/dlls/structuredquery/main.c @@ -30,6 +30,7 @@ static const struct class_info HRESULT (*constructor)(REFIID, void **); } class_info[] = { { &CLSID_QueryParser, queryparser_create }, + { &CLSID_QueryParserManager, queryparsermanager_create }, };
struct class_factory diff --git a/dlls/structuredquery/private.h b/dlls/structuredquery/private.h index 52c968b9a89..5221888a839 100644 --- a/dlls/structuredquery/private.h +++ b/dlls/structuredquery/private.h @@ -21,4 +21,5 @@ #include <structuredquery.h>
extern HRESULT queryparser_create( REFIID iid, void **out ); +extern HRESULT queryparsermanager_create( REFIID iid, void **out ); #endif diff --git a/dlls/structuredquery/queryparsermanager.c b/dlls/structuredquery/queryparsermanager.c new file mode 100644 index 00000000000..50f6582f93b --- /dev/null +++ b/dlls/structuredquery/queryparsermanager.c @@ -0,0 +1,126 @@ +/* + * Copyright 2024 Vibhav Pant + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#include "private.h" + +#include <wine/debug.h> + +WINE_DEFAULT_DEBUG_CHANNEL( structquery ); + +struct queryparsermanager +{ + IQueryParserManager iface; + LONG ref; +}; + +static inline struct queryparsermanager *impl_from_IQueryParserManager( IQueryParserManager *iface ) +{ + return CONTAINING_RECORD( iface, struct queryparsermanager, iface ); +} + +static HRESULT WINAPI queryparsermanager_QueryInterface( IQueryParserManager *iface, REFIID iid, void **out ) +{ + TRACE( "(%p, %s, %p)\n", iface, debugstr_guid( iid ), out ); + + *out = NULL; + if (IsEqualGUID( &IID_IUnknown, iid ) || + IsEqualGUID( &IID_IQueryParserManager, iid )) + { + *out = iface; + IUnknown_AddRef( iface ); + return S_OK; + } + + FIXME( "interface not implemented, returning E_NOINTERFACE\n" ); + return E_NOINTERFACE; +} + +static ULONG WINAPI queryparsermanager_AddRef( IQueryParserManager *iface ) +{ + struct queryparsermanager *impl; + TRACE( "(%p)\n", iface ); + + impl = impl_from_IQueryParserManager( iface ); + return InterlockedIncrement( &impl->ref ); +} + +static ULONG WINAPI queryparsermanager_Release( IQueryParserManager *iface ) +{ + struct queryparsermanager *impl; + ULONG ref; + + TRACE( "(%p)\n", iface ); + + impl = impl_from_IQueryParserManager( iface ); + ref = InterlockedDecrement( &impl->ref ); + if (!ref) + free( impl ); + return ref; +} + + +static HRESULT WINAPI queryparsermanager_CreateLoadedParser( IQueryParserManager *iface, + LPCWSTR catalog, LANGID langid, + REFIID iid, void **out ) +{ + FIXME( "(%p, %s, %d, %s, %p) stub!\n", iface, debugstr_w( catalog ), langid, + debugstr_guid( iid ), out ); + return E_NOTIMPL; +} + +static HRESULT WINAPI queryparsermanager_InitializeOptions( IQueryParserManager *iface, BOOL nqs, + BOOL auto_wildcard, + IQueryParser *parser ) +{ + FIXME( "(%p, %d, %d, %p) stub!\n", iface, nqs, auto_wildcard, parser ); + return E_NOTIMPL; +} + +static HRESULT WINAPI queryparsermanager_SetOption( IQueryParserManager *iface, + QUERY_PARSER_MANAGER_OPTION opt, + const PROPVARIANT *val ) +{ + FIXME("(%p, %d, %p) stub!\n", iface, opt, val); + return E_NOTIMPL; +} + +const static IQueryParserManagerVtbl queryparsermanager_vtbl = +{ + /* IUnknown */ + queryparsermanager_QueryInterface, + queryparsermanager_AddRef, + queryparsermanager_Release, + /* IQueryParserManager */ + queryparsermanager_CreateLoadedParser, + queryparsermanager_InitializeOptions, + queryparsermanager_SetOption, +}; + +HRESULT queryparsermanager_create( REFIID iid, void **out ) +{ + struct queryparsermanager *impl; + + impl = calloc( 1, sizeof( *impl ) ); + if (!impl) + return E_OUTOFMEMORY; + impl->iface.lpVtbl = &queryparsermanager_vtbl; + impl->ref = 1; + *out = &impl->iface; + return S_OK; +} diff --git a/dlls/structuredquery/tests/query.c b/dlls/structuredquery/tests/query.c index b7e2face959..8933e93b7b9 100644 --- a/dlls/structuredquery/tests/query.c +++ b/dlls/structuredquery/tests/query.c @@ -55,7 +55,7 @@ void test_IQueryParserManager( void )
hr = CoCreateInstance( &CLSID_QueryParserManager, NULL, CLSCTX_INPROC, &IID_IQueryParserManager, (void **)&manager ); - todo_wine ok( SUCCEEDED( hr ), "got %#lx\n", hr ); + ok( SUCCEEDED( hr ), "got %#lx\n", hr ); if (!manager) { skip( "Could not create IQueryParserManager instance.\n" );