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

Huw Davies huw at codeweavers.com
Mon Mar 19 05:34:08 CDT 2018


On Thu, Mar 15, 2018 at 09:44:34PM +0000, Owen Rudge wrote:
> diff --git a/dlls/wsdapi/soap.c b/dlls/wsdapi/soap.c
> new file mode 100644
> index 0000000000..efc063ca05
> --- /dev/null
> +++ b/dlls/wsdapi/soap.c
> @@ -0,0 +1,65 @@
> +/*
> + * 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"
> +#include "wine/heap.h"
> +
> +#define APP_MAX_DELAY                       500
> +
> +static HRESULT write_and_send_message(IWSDiscoveryPublisherImpl *impl, WSD_SOAP_HEADER *header, WSDXML_ELEMENT *body_element,
> +    struct list *discovered_namespaces, IWSDUdpAddress *remote_address, int max_initial_delay)
> +{
> +    static const char xml_header[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
> +    char *full_xml;
> +
> +    /* TODO: Create SOAP envelope */
> +
> +    /* Prefix the XML header */
> +    full_xml = heap_alloc(sizeof(xml_header) + 1);

This is off-by-one, though it gets fixed in a later patch.
Perhaps it would be better to introduce xml_header_len here
set to sizeof(xml_header) - 1?

> +    if (full_xml == NULL)
> +        return E_OUTOFMEMORY;
> +
> +    memcpy(full_xml, xml_header, sizeof(xml_header));
> +    full_xml[sizeof(xml_header)] = 0;
> +
> +    /* TODO: Send the message */
> +
> +    heap_free(full_xml);
> +
> +    return S_OK;
> +}
> +



More information about the wine-devel mailing list