NdrClientCall() should only be used in 32-bit mode when Oi or Oic stub optimizations are used. Currently our interpreted mode targets Oicf mode and other levels are not supported.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
-- v2: include: Add errlup.idl. widl: Do not write "const" modifiers for _PARAM_STRUCT fields.
From: Nikolay Sivov nsivov@codeweavers.com
NdrClientCall() should only be used in 32-bit mode when Oi or Oic stub optimizations are used. Currently our interpreted mode targets Oicf mode and other levels are not supported.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- tools/widl/typegen.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 9567b2d5e4e..1db6ee5093b 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -5239,9 +5239,7 @@ void write_client_call_routine( FILE *file, const type_t *iface, const var_t *fu } else if (has_ret) print_file( file, 1, "%s", "CLIENT_CALL_RETURN _RetVal;\n\n" );
- len = fprintf( file, " %s%s( ", - has_ret ? "_RetVal = " : "", - interpreted_mode ? "NdrClientCall2" : "NdrClientCall" ); + len = fprintf( file, " %sNdrClientCall2( ", has_ret ? "_RetVal = " : "" ); fprintf( file, "&%s_StubDesc,", prefix ); fprintf( file, "\n%*s&__MIDL_ProcFormatString.Format[%u]", len, "", proc_offset ); if (needs_params)
From: Nikolay Sivov nsivov@codeweavers.com
The issue comes from per-field structure copy that we generate on 32-bit. For non-pointer fields like "const int" this breaks compilation when assigning to a const field. The best solution would be to remove local struct variable completely and pass first argument address as a stack address. This is what midl does. My understanding is that doing it midl way used to break on some compilers, and we have to keep the copy. Once we encounter pointer type that needs such copy, we'll have to patch it more to cast the const away for example.
Such type modification matches what midl does for structures in _Thunk's, so the fix itself is correct.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- tools/widl/typegen.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 1db6ee5093b..6d7ccd30814 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -5031,12 +5031,20 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char fprintf(file, "\n"); }
+static void init_param_struct_declspec( decl_spec_t *dst, const decl_spec_t *src ) +{ + *dst = *src; + + if (!is_ptr( dst->type ) || type_is_alias( dst->type )) + dst->qualifier = 0; +}
void write_func_param_struct( FILE *file, const type_t *iface, const type_t *func, const char *var_decl, int add_retval ) { var_t *retval = type_function_get_retval( func ); const var_list_t *args = type_function_get_args( func ); + decl_spec_t declspec; const var_t *arg; int needs_packing; unsigned int align = 0; @@ -5055,7 +5063,8 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) { print_file(file, 2, "%s", ""); - write_type_left( file, &arg->declspec, NAME_DEFAULT, false, TRUE ); + init_param_struct_declspec( &declspec, &arg->declspec ); + write_type_left( file, &declspec, NAME_DEFAULT, false, TRUE ); if (needs_space_after( arg->declspec.type )) fputc( ' ', file ); if (is_array( arg->declspec.type ) && !type_array_is_decl_as_ptr( arg->declspec.type )) fputc( '*', file );
@@ -5071,7 +5080,8 @@ void write_func_param_struct( FILE *file, const type_t *iface, const type_t *fun if (add_retval && !is_void( retval->declspec.type )) { print_file(file, 2, "%s", ""); - write_type_left( file, &retval->declspec, NAME_DEFAULT, false, TRUE ); + init_param_struct_declspec( &declspec, &retval->declspec ); + write_type_left( file, &declspec, NAME_DEFAULT, false, TRUE ); if (needs_space_after( retval->declspec.type )) fputc( ' ', file ); if (!is_array( retval->declspec.type ) && !is_ptr( retval->declspec.type ) && type_memsize( retval->declspec.type ) != pointer_size)
From: Piotr Caban piotr@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msdaps/usrmarshal.c | 45 ++++++++++++++++++++++++ include/Makefile.in | 1 + include/errlup.idl | 74 ++++++++++++++++++++++++++++++++++++++++ include/oledb.idl | 1 + 4 files changed, 121 insertions(+) create mode 100644 include/errlup.idl
diff --git a/dlls/msdaps/usrmarshal.c b/dlls/msdaps/usrmarshal.c index 476008b53f9..80ae1305872 100644 --- a/dlls/msdaps/usrmarshal.c +++ b/dlls/msdaps/usrmarshal.c @@ -1856,3 +1856,48 @@ HRESULT __RPC_STUB IDBSchemaRowset_GetSchemas_Stub(IDBSchemaRowset* This, ULONG FIXME("(%p)->(%p, %p, %p, %p): stub\n", This, pcSchemas, prgSchemas, prgRestrictionSupport, ppErrorInfoRem); return E_NOTIMPL; } + +HRESULT CALLBACK IErrorLookup_GetErrorDescription_Proxy(IErrorLookup* This, HRESULT hrError, DWORD dwLookupID, + DISPPARAMS *pdispparams, LCID lcid, BSTR *pbstrSource, BSTR *pbstrDescription) +{ + FIXME("(%p)->(%#lx, %#lx, %p, %#lx, %p, %p): stub\n", This, hrError, dwLookupID, pdispparams, lcid, + pbstrSource, pbstrDescription); + return E_NOTIMPL; +} + +HRESULT __RPC_STUB IErrorLookup_GetErrorDescription_Stub(IErrorLookup* This, HRESULT hrError, DWORD dwLookupID, + DISPPARAMS *pdispparams, LCID lcid, BSTR *pbstrSource, BSTR *pbstrDescription, IErrorInfo **ppErrorInfoRem) +{ + FIXME("(%p)->(%#lx, %#lx, %p, %#lx, %p, %p, %p): stub\n", This, hrError, dwLookupID, pdispparams, lcid, + pbstrSource, pbstrDescription, ppErrorInfoRem); + return E_NOTIMPL; +} + +HRESULT CALLBACK IErrorLookup_GetHelpInfo_Proxy(IErrorLookup* This, HRESULT hrError, + DWORD dwLookupID, LCID lcid, BSTR *pbstrHelpFile, DWORD *pdwHelpContext) +{ + FIXME("(%p)->(%#lx, %#lx, %#lx, %p, %p): stub\n", This, hrError, dwLookupID, lcid, + pbstrHelpFile, pdwHelpContext); + return E_NOTIMPL; +} + +HRESULT __RPC_STUB IErrorLookup_GetHelpInfo_Stub(IErrorLookup* This, HRESULT hrError, DWORD dwLookupID, + LCID lcid, BSTR *pbstrHelpFile, DWORD *pdwHelpContext, IErrorInfo **ppErrorInfoRem) +{ + FIXME("(%p)->(%#lx, %#lx, %#lx, %p, %p, %p): stub\n", This, hrError, dwLookupID, lcid, + pbstrHelpFile, pdwHelpContext, ppErrorInfoRem); + return E_NOTIMPL; +} + +HRESULT CALLBACK IErrorLookup_ReleaseErrors_Proxy(IErrorLookup* This, const DWORD dwDynamicErrorID) +{ + FIXME("(%p)->(%#lx): stub\n", This, dwDynamicErrorID); + return E_NOTIMPL; +} + +HRESULT __RPC_STUB IErrorLookup_ReleaseErrors_Stub(IErrorLookup* This, + const DWORD dwDynamicErrorID, IErrorInfo **ppErrorInfoRem) +{ + FIXME("(%p)->(%#lx, %p): stub\n", This, dwDynamicErrorID, ppErrorInfoRem); + return E_NOTIMPL; +} diff --git a/include/Makefile.in b/include/Makefile.in index ab4957969d3..d40654f1936 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -311,6 +311,7 @@ SOURCES = \ dxvahd.idl \ dyngraph.idl \ endpointvolume.idl \ + errlup.idl \ errorrep.h \ errors.h \ errrec.idl \ diff --git a/include/errlup.idl b/include/errlup.idl new file mode 100644 index 00000000000..f1fca5b27bc --- /dev/null +++ b/include/errlup.idl @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2025 Piotr Caban + * + * 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 + */ + +#if 0 +#pragma makedep install +#endif + +[ + object, + uuid(0c733a66-2a1c-11ce-ade5-00aa0044773d), + pointer_default(unique) +] +interface IErrorLookup : IUnknown { + [local] + HRESULT GetErrorDescription( + [in] HRESULT hrError, + [in] DWORD dwLookupID, + [in] DISPPARAMS *pdispparams, + [in] LCID lcid, + [out] BSTR *pbstrSource, + [out] BSTR *pbstrDescription); + + [call_as(GetErrorDescription)] + HRESULT RemoteGetErrorDescription( + [in] HRESULT hrError, + [in] DWORD dwLookupID, + [in] DISPPARAMS *pdispparams, + [in] LCID lcid, + [out] BSTR *pbstrSource, + [out] BSTR *pbstrDescription, + [out] IErrorInfo **ppErrorInfoRem); + + [local] + HRESULT GetHelpInfo( + [in] HRESULT hrError, + [in] DWORD dwLookupID, + [in] LCID lcid, + [out] BSTR *pbstrHelpFile, + [out] DWORD *pdwHelpContext); + + [call_as(GetHelpInfo)] + HRESULT RemoteGetHelpInfo( + [in] HRESULT hrError, + [in] DWORD dwLookupID, + [in] LCID lcid, + [out] BSTR *pbstrHelpFile, + [out] DWORD *pdwHelpContext, + [out] IErrorInfo **ppErrorInfoRem); + + [local] + HRESULT ReleaseErrors( + [in] const DWORD dwDynamicErrorID); + + [call_as(ReleaseErrors)] + HRESULT RemoteReleaseErrors( + [in] const DWORD dwDynamicErrorID, + [out] IErrorInfo **ppErrorInfoRem); + +} diff --git a/include/oledb.idl b/include/oledb.idl index 4677e3055a8..54fe572f2dc 100644 --- a/include/oledb.idl +++ b/include/oledb.idl @@ -75,6 +75,7 @@ typedef LONG_PTR DB_LRESERVE; #include "binres.idl" #include "crtrow.idl" #include "errrec.idl" +#include "errlup.idl" #include "getdts.idl" #include "cmdstrm.idl" #include "cmdprp.idl"
On Tue Jun 3 16:28:33 2025 +0000, Nikolay Sivov wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/8195/diffs?diff_id=182432&start_sha=63056b2bd991d3804ea97bd0eb08407c437911e7#afeee35cd46e0a971cdc24a8802ea5f1bf712357_5058_5066)
Ok, did something like that, I think.
Looks okay but I don't know anything about RPC.
This merge request was approved by Rémi Bernon.