[v2 06/10] webservices: Implement WsInitializeMessage.

Hans Leidekker hans at codeweavers.com
Fri Jul 8 03:20:35 CDT 2016


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/webservices/msg.c            | 25 ++++++++++++++++++
 dlls/webservices/tests/msg.c      | 54 +++++++++++++++++++++++++++++++++++++++
 dlls/webservices/webservices.spec |  2 +-
 3 files changed, 80 insertions(+), 1 deletion(-)

diff --git a/dlls/webservices/msg.c b/dlls/webservices/msg.c
index 82c8106..b3444e0 100644
--- a/dlls/webservices/msg.c
+++ b/dlls/webservices/msg.c
@@ -44,6 +44,7 @@ static const struct prop_desc msg_props[] =
 
 struct msg
 {
+    WS_MESSAGE_INITIALIZATION init;
     WS_MESSAGE_STATE          state;
     WS_ENVELOPE_VERSION       version_env;
     WS_ADDRESSING_VERSION     version_addr;
@@ -144,6 +145,30 @@ HRESULT WINAPI WsCreateMessageForChannel( WS_CHANNEL *channel_handle, const WS_M
 }
 
 /**************************************************************************
+ *          WsInitializeMessage		[webservices.@]
+ */
+HRESULT WINAPI WsInitializeMessage( WS_MESSAGE *handle, WS_MESSAGE_INITIALIZATION init,
+                                    WS_MESSAGE *src_handle, WS_ERROR *error )
+{
+    struct msg *msg = (struct msg *)handle;
+
+    TRACE( "%p %u %p %p\n", handle, init, src_handle, error );
+    if (error) FIXME( "ignoring error parameter\n" );
+    if (src_handle)
+    {
+        FIXME( "src message not supported\n" );
+        return E_NOTIMPL;
+    }
+
+    if (!handle || init > WS_FAULT_MESSAGE) return E_INVALIDARG;
+    if (msg->state >= WS_MESSAGE_STATE_INITIALIZED) return WS_E_INVALID_OPERATION;
+
+    msg->init  = init;
+    msg->state = WS_MESSAGE_STATE_INITIALIZED;
+    return S_OK;
+}
+
+/**************************************************************************
  *          WsFreeMessage		[webservices.@]
  */
 void WINAPI WsFreeMessage( WS_MESSAGE *handle )
diff --git a/dlls/webservices/tests/msg.c b/dlls/webservices/tests/msg.c
index 957a64e..e7b91d0 100644
--- a/dlls/webservices/tests/msg.c
+++ b/dlls/webservices/tests/msg.c
@@ -156,8 +156,62 @@ static void test_WsCreateMessageForChannel(void)
     WsFreeMessage( msg );
 }
 
+static void test_WsInitializeMessage(void)
+{
+    HRESULT hr;
+    WS_MESSAGE *msg;
+    WS_MESSAGE_STATE state;
+    WS_ENVELOPE_VERSION env_version;
+    WS_ADDRESSING_VERSION addr_version;
+    BOOL addressed;
+
+    return;
+    hr = WsInitializeMessage( NULL, WS_REQUEST_MESSAGE, NULL, NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsCreateMessage( WS_ADDRESSING_VERSION_0_9, WS_ENVELOPE_VERSION_SOAP_1_1, NULL,
+                          0, &msg, NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    hr = WsInitializeMessage( msg, 0xdeadbeef, NULL, NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
+    ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
+
+    state = 0xdeadbeef;
+    hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+    ok( state == WS_MESSAGE_STATE_INITIALIZED, "got %u\n", state );
+
+    addressed = -1;
+    hr = WsGetMessageProperty( msg, WS_MESSAGE_PROPERTY_IS_ADDRESSED, &addressed, sizeof(addressed),
+                               NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+    ok( !addressed, "unexpected value %d\n", addressed );
+
+    state = WS_MESSAGE_STATE_EMPTY;
+    hr = WsSetMessageProperty( msg, WS_MESSAGE_PROPERTY_STATE, &state, sizeof(state), NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    env_version = WS_ENVELOPE_VERSION_SOAP_1_1;
+    hr = WsSetMessageProperty( msg, WS_MESSAGE_PROPERTY_ENVELOPE_VERSION, &env_version,
+                               sizeof(env_version), NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    addr_version = WS_ADDRESSING_VERSION_0_9;
+    hr = WsSetMessageProperty( msg, WS_MESSAGE_PROPERTY_ADDRESSING_VERSION, &addr_version,
+                               sizeof(addr_version), NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+    WsFreeMessage( msg );
+}
+
 START_TEST(msg)
 {
     test_WsCreateMessage();
     test_WsCreateMessageForChannel();
+    test_WsInitializeMessage();
 }
diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec
index 8c9c8ee..6a3fbd4 100644
--- a/dlls/webservices/webservices.spec
+++ b/dlls/webservices/webservices.spec
@@ -90,7 +90,7 @@
 @ stdcall WsGetWriterPosition(ptr ptr ptr)
 @ stdcall WsGetWriterProperty(ptr long ptr long ptr)
 @ stdcall WsGetXmlAttribute(ptr ptr ptr ptr ptr ptr)
-@ stub WsInitializeMessage
+@ stdcall WsInitializeMessage(ptr long ptr ptr)
 @ stub WsMarkHeaderAsUnderstood
 @ stub WsMatchPolicyAlternative
 @ stdcall WsMoveReader(ptr long ptr ptr)
-- 
2.1.4




More information about the wine-patches mailing list