From: Vibhav Pant vibhavp@gmail.com
--- configure | 3 + configure.ac | 2 + dlls/structuredquery/Makefile.in | 8 ++ dlls/structuredquery/classes.idl | 28 +++++ dlls/structuredquery/main.c | 130 ++++++++++++++++++++++ dlls/structuredquery/structuredquery.spec | 4 + 6 files changed, 175 insertions(+) create mode 100644 dlls/structuredquery/Makefile.in create mode 100644 dlls/structuredquery/classes.idl create mode 100644 dlls/structuredquery/main.c create mode 100644 dlls/structuredquery/structuredquery.spec
diff --git a/configure b/configure index bf64f9b8bb9..419f2044bf8 100755 --- a/configure +++ b/configure @@ -1434,6 +1434,7 @@ enable_stdole2_tlb enable_stdole32_tlb enable_sti enable_strmdll +enable_structuredquery enable_svrapi enable_sxs enable_t2embed @@ -22525,6 +22526,8 @@ wine_fn_config_makefile dlls/sti/tests enable_tests wine_fn_config_makefile dlls/storage.dll16 enable_win16 wine_fn_config_makefile dlls/stress.dll16 enable_win16 wine_fn_config_makefile dlls/strmdll enable_strmdll +wine_fn_config_makefile dlls/structuredquery enable_structuredquery +wine_fn_config_makefile dlls/structuredquery/tests enable_tests wine_fn_config_makefile dlls/svrapi enable_svrapi wine_fn_config_makefile dlls/sxs enable_sxs wine_fn_config_makefile dlls/sxs/tests enable_tests diff --git a/configure.ac b/configure.ac index 8edfce44d6e..e5ba9dc1503 100644 --- a/configure.ac +++ b/configure.ac @@ -3102,6 +3102,8 @@ WINE_CONFIG_MAKEFILE(dlls/sti/tests) WINE_CONFIG_MAKEFILE(dlls/storage.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/stress.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/strmdll) +WINE_CONFIG_MAKEFILE(dlls/structuredquery) +WINE_CONFIG_MAKEFILE(dlls/structuredquery/tests) WINE_CONFIG_MAKEFILE(dlls/svrapi) WINE_CONFIG_MAKEFILE(dlls/sxs) WINE_CONFIG_MAKEFILE(dlls/sxs/tests) diff --git a/dlls/structuredquery/Makefile.in b/dlls/structuredquery/Makefile.in new file mode 100644 index 00000000000..747309707a3 --- /dev/null +++ b/dlls/structuredquery/Makefile.in @@ -0,0 +1,8 @@ +MODULE = structuredquery.dll +IMPORTLIB = structuredquery +IMPORTS = ole32 oleaut32 uuid + +EXTRADLLFLAGS = -Wb,--prefer-native +SOURCES = \ + classes.idl \ + main.c \ diff --git a/dlls/structuredquery/classes.idl b/dlls/structuredquery/classes.idl new file mode 100644 index 00000000000..d5cf17fd37c --- /dev/null +++ b/dlls/structuredquery/classes.idl @@ -0,0 +1,28 @@ +/* + * 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 + */ + +#pragma makedep register + +[ + uuid(b72f8fd8-0fab-4dd9-bdbf-245a6ce1485b), + threading(both) +] +coclass QueryParser +{ + interface IQueryParser; +} diff --git a/dlls/structuredquery/main.c b/dlls/structuredquery/main.c new file mode 100644 index 00000000000..81b24c3873d --- /dev/null +++ b/dlls/structuredquery/main.c @@ -0,0 +1,130 @@ +/* + * 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 <initguid.h> +#include <structuredquery.h> + +#include <wine/debug.h> + +WINE_DEFAULT_DEBUG_CHANNEL( structquery ); + +struct class_factory +{ + IClassFactory iface; + LONG ref; +}; + +static inline struct class_factory *impl_from_IClassFactory( IClassFactory *iface ) +{ + return CONTAINING_RECORD( iface, struct class_factory, iface ); +} + +static HRESULT WINAPI factory_QueryInterface( IClassFactory *iface, REFIID iid, void **out ) +{ + TRACE( "(%p, %s, %p)\n", iface, debugstr_guid( iid ), out ); + *out = NULL; + + if (IsEqualGUID( &IID_IUnknown, iid ) || + IsEqualGUID( &IID_IClassFactory, iid )) + { + *out = iface; + IClassFactory_AddRef( iface ); + return S_OK; + } + + FIXME( "Interface not implemented, returning E_NOINTERFACE.\n" ); + return E_NOINTERFACE; +} + +static ULONG WINAPI factory_AddRef( IClassFactory *iface ) +{ + struct class_factory *impl = impl_from_IClassFactory( iface ); + TRACE( "(%p)\n", iface ); + return InterlockedIncrement( &impl->ref ); +} + +static ULONG WINAPI factory_Release( IClassFactory *iface ) +{ + struct class_factory *impl = impl_from_IClassFactory( iface ); + ULONG ref; + + TRACE( "(%p)\n", iface ); + ref = InterlockedDecrement( &impl->ref ); + if (!ref) + free( impl ); + return ref; +} + +static HRESULT WINAPI factory_CreateInstance( IClassFactory *iface, IUnknown *outer, REFIID iid, + void **out ) +{ + FIXME( "(%p, %p, %s, %p) stub!\n", iface, outer, debugstr_guid( iid ), out ); + return E_NOTIMPL; +} + +static HRESULT WINAPI factory_LockServer( IClassFactory *iface, BOOL lock ) +{ + TRACE( "(%p, %d\n)", iface, lock ); + return S_OK; +} + +const static IClassFactoryVtbl factory_vtbl = +{ + /* IUnknown */ + factory_QueryInterface, + factory_AddRef, + factory_Release, + /* IClassFactory */ + factory_CreateInstance, + factory_LockServer +}; + +static HRESULT factory_create( REFIID iid, void **obj ) +{ + HRESULT hr; + struct class_factory *impl; + + + impl = calloc( 1, sizeof( *impl ) ); + if (!impl) + return E_OUTOFMEMORY; + impl->iface.lpVtbl = &factory_vtbl; + impl->ref = 1; + + hr = IClassFactory_QueryInterface( &impl->iface, iid, obj ); + IClassFactory_Release( &impl->iface ); + + return hr; +} + +HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID iid, void **out ) +{ + TRACE( "(%s, %s, %p)\n", debugstr_guid( clsid ), debugstr_guid( iid ), out ); + + if (!clsid || !iid || !out) + return E_INVALIDARG; + + *out = NULL; + + if (IsEqualCLSID( clsid, &CLSID_QueryParser )) + return factory_create( iid, out ); + + FIXME("Class not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n"); + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dlls/structuredquery/structuredquery.spec b/dlls/structuredquery/structuredquery.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/dlls/structuredquery/structuredquery.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer()