[PATCH 2/7] wsdapi: Add stub implementation of IWSDiscoveryPublisher_PublishEx.

Huw Davies huw at codeweavers.com
Mon Mar 12 05:23:25 CDT 2018


On Wed, Mar 07, 2018 at 10:51:43PM +0000, Owen Rudge wrote:
> Signed-off-by: Owen Rudge <orudge at codeweavers.com>
> ---
>   dlls/wsdapi/Makefile.in       |  1 +
>   dlls/wsdapi/discovery.c       | 64 
> ++++++++++++++++++-------------------------
>   dlls/wsdapi/soap.c            | 38 +++++++++++++++++++++++++
>   dlls/wsdapi/wsdapi_internal.h | 24 ++++++++++++++++
>   4 files changed, 89 insertions(+), 38 deletions(-)
>   create mode 100644 dlls/wsdapi/soap.c
> 
> diff --git a/dlls/wsdapi/Makefile.in b/dlls/wsdapi/Makefile.in
> index 5c953515e2..155d004f4a 100644
> --- a/dlls/wsdapi/Makefile.in
> +++ b/dlls/wsdapi/Makefile.in
> @@ -8,4 +8,5 @@ C_SRCS = \
>  	main.c \
>  	memory.c \
>  	msgparams.c \
> +	soap.c \
>  	xml.c
> diff --git a/dlls/wsdapi/discovery.c b/dlls/wsdapi/discovery.c
> index 82a1ca0a5a..41cb25a6fd 100644
> --- a/dlls/wsdapi/discovery.c
> +++ b/dlls/wsdapi/discovery.c
> @@ -23,30 +23,12 @@
>  #define COBJMACROS
>  #define INITGUID
>  
> -#include "windef.h"
> -#include "winbase.h"
> +#include "wsdapi_internal.h"
>  #include "wine/debug.h"
> -#include "wine/list.h"
> -#include "objbase.h"
>  #include "guiddef.h"
> -#include "wsdapi.h"
>  
>  WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
>  
> -struct notificationSink
> -{
> -    struct list entry;
> -    IWSDiscoveryPublisherNotify *notificationSink;
> -};
> -
> -typedef struct IWSDiscoveryPublisherImpl {
> -    IWSDiscoveryPublisher IWSDiscoveryPublisher_iface;
> -    LONG                  ref;
> -    IWSDXMLContext        *xmlContext;
> -    DWORD                 addressFamily;
> -    struct list           notificationSinks;
> -} IWSDiscoveryPublisherImpl;
> -
>  static inline IWSDiscoveryPublisherImpl *impl_from_IWSDiscoveryPublisher(IWSDiscoveryPublisher *iface)
>  {
>      return CONTAINING_RECORD(iface, IWSDiscoveryPublisherImpl, IWSDiscoveryPublisher_iface);
> @@ -196,14 +178,35 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnRegisterNotificationSink(IWSDi
>      return E_FAIL;
>  }
>  
> +static HRESULT WINAPI IWSDiscoveryPublisherImpl_PublishEx(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
> +                                                          ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
> +                                                          const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
> +                                                          const WSD_URI_LIST *pXAddrsList, const WSDXML_ELEMENT *pHeaderAny,
> +                                                          const WSDXML_ELEMENT *pReferenceParameterAny, const WSDXML_ELEMENT *pPolicyAny,
> +                                                          const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny)
> +{
> +    IWSDiscoveryPublisherImpl *impl = impl_from_IWSDiscoveryPublisher(This);
> +
> +    TRACE("(%p, %s, %s, %s, %s, %s, %p, %p, %p, %p, %p, %p, %p, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullMetadataVersion),
> +        wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), pTypesList, pScopesList, pXAddrsList,
> +        pHeaderAny, pReferenceParameterAny, pPolicyAny, pEndpointReferenceAny, pAny);
> +
> +    if ((!impl->publisherStarted) || (pszId == NULL) || (lstrlenW(pszId) > WSD_MAX_TEXT_LENGTH) ||
> +        ((pszSessionId != NULL) && (lstrlenW(pszSessionId) > WSD_MAX_TEXT_LENGTH)))
> +    {
> +        return E_INVALIDARG;
> +    }
> +
> +    return send_hello_message(impl, pszId, ullMetadataVersion, ullInstanceId, ullMessageNumber, pszSessionId, pTypesList, pScopesList,
> +        pXAddrsList, pHeaderAny, pReferenceParameterAny, pEndpointReferenceAny, pAny);
> +}
> +
>  static HRESULT WINAPI IWSDiscoveryPublisherImpl_Publish(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullMetadataVersion, ULONGLONG ullInstanceId,
>                                                          ULONGLONG ullMessageNumber, LPCWSTR pszSessionId, const WSD_NAME_LIST *pTypesList,
>                                                          const WSD_URI_LIST *pScopesList, const WSD_URI_LIST *pXAddrsList)
>  {
> -    FIXME("(%p, %s, %s, %s, %s, %s, %p, %p, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullMetadataVersion), wine_dbgstr_longlong(ullInstanceId),
> -        wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), pTypesList, pScopesList, pXAddrsList);
> -
> -    return E_NOTIMPL;
> +    return IWSDiscoveryPublisherImpl_PublishEx(This, pszId, ullMetadataVersion, ullInstanceId, ullMessageNumber, pszSessionId, pTypesList, pScopesList,
> +        pXAddrsList, NULL, NULL, NULL, NULL, NULL);
>  }

You should call PublishEx through the COM macro
IWSDiscoveryPublish_PublishEx() than the directly through the function
name.  That way you wouldn't need to re-order the functions.

There are lots of uses of CamelCase variables in this series which
we generally dislike.

Also, you're pushing the limits on line length in places.

>  
>  static HRESULT WINAPI IWSDiscoveryPublisherImpl_UnPublish(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber,
> @@ -241,21 +244,6 @@ static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchResolve(IWSDiscoveryPublish
>      return E_NOTIMPL;
>  }
>  
> -static HRESULT WINAPI IWSDiscoveryPublisherImpl_PublishEx(IWSDiscoveryPublisher *This, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
> -                                                          ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
> -                                                          const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
> -                                                          const WSD_URI_LIST *pXAddrsList, const WSDXML_ELEMENT *pHeaderAny,
> -                                                          const WSDXML_ELEMENT *pReferenceParameterAny, const WSDXML_ELEMENT *pPolicyAny,
> -                                                          const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny)
> -{
> -    FIXME("(%p, %s, %s, %s, %s, %s, %p, %p, %p, %p, %p, %p, %p, %p)\n", This, debugstr_w(pszId), wine_dbgstr_longlong(ullMetadataVersion),
> -        wine_dbgstr_longlong(ullInstanceId), wine_dbgstr_longlong(ullMessageNumber), debugstr_w(pszSessionId), pTypesList, pScopesList, pXAddrsList,
> -        pHeaderAny, pReferenceParameterAny, pPolicyAny, pEndpointReferenceAny, pAny);
> -
> -    return E_NOTIMPL;
> -}
> -
> -
>  static HRESULT WINAPI IWSDiscoveryPublisherImpl_MatchProbeEx(IWSDiscoveryPublisher *This, const WSD_SOAP_MESSAGE *pProbeMessage,
>                                                               IWSDMessageParameters *pMessageParameters, LPCWSTR pszId, ULONGLONG ullMetadataVersion,
>                                                               ULONGLONG ullInstanceId, ULONGLONG ullMessageNumber, LPCWSTR pszSessionId,
> diff --git a/dlls/wsdapi/soap.c b/dlls/wsdapi/soap.c
> new file mode 100644
> index 0000000000..4d9c4e7f14
> --- /dev/null
> +++ b/dlls/wsdapi/soap.c
> @@ -0,0 +1,38 @@
> +/*
> + * Web Services on Devices
> + *
> + * Copyright 2017-2018 Owen Rudge for CodeWeavers
> + *
> + * 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
> + */
> +
> +#include <stdarg.h>
> +#include <limits.h>
> +
> +#define COBJMACROS
> +
> +#include "wsdapi_internal.h"
> +#include "wine/debug.h"
> +
> +WINE_DEFAULT_DEBUG_CHANNEL(wsdapi);
> +
> +HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR pszId, ULONGLONG ullMetadataVersion, ULONGLONG ullInstanceId,
> +    ULONGLONG ullMessageNumber, LPCWSTR pszSessionId, const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
> +    const WSD_URI_LIST *pXAddrsList, const WSDXML_ELEMENT *pHeaderAny, const WSDXML_ELEMENT *pReferenceParameterAny,
> +    const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny)
> +{
> +    FIXME("stub\n");
> +    return E_NOTIMPL;
> +}
> diff --git a/dlls/wsdapi/wsdapi_internal.h b/dlls/wsdapi/wsdapi_internal.h
> index 22de4a842a..4f8ce91d36 100644
> --- a/dlls/wsdapi/wsdapi_internal.h
> +++ b/dlls/wsdapi/wsdapi_internal.h
> @@ -32,4 +32,28 @@
>  
>  #define WSD_MAX_TEXT_LENGTH    8192
>  
> +/* discovery.c */
> +
> +struct notificationSink
> +{
> +    struct list entry;
> +    IWSDiscoveryPublisherNotify *notificationSink;
> +};
> +
> +typedef struct IWSDiscoveryPublisherImpl {
> +    IWSDiscoveryPublisher IWSDiscoveryPublisher_iface;
> +    LONG                  ref;
> +    IWSDXMLContext        *xmlContext;
> +    DWORD                 addressFamily;
> +    struct list           notificationSinks;
> +    BOOL                  publisherStarted;
> +} IWSDiscoveryPublisherImpl;
> +
> +/* soap.c */
> +
> +HRESULT send_hello_message(IWSDiscoveryPublisherImpl *impl, LPCWSTR pszId, ULONGLONG ullMetadataVersion, ULONGLONG ullInstanceId,
> +    ULONGLONG ullMessageNumber, LPCWSTR pszSessionId, const WSD_NAME_LIST *pTypesList, const WSD_URI_LIST *pScopesList,
> +    const WSD_URI_LIST *pXAddrsList, const WSDXML_ELEMENT *pHeaderAny, const WSDXML_ELEMENT *pReferenceParameterAny,
> +    const WSDXML_ELEMENT *pEndpointReferenceAny, const WSDXML_ELEMENT *pAny);
> +
>  #endif



More information about the wine-devel mailing list