[PATCH 3/3] Allow Annotation to be NULL

Juan Lang juan.lang at gmail.com
Wed Aug 19 16:27:20 CDT 2009


---

 dlls/rpcrt4/rpc_epmap.c         |    5 +++--
 dlls/rpcrt4/tests/rpc_protseq.c |    3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/rpcrt4/rpc_epmap.c b/dlls/rpcrt4/rpc_epmap.c
index 2a03484..60c4255 100644
--- a/dlls/rpcrt4/rpc_epmap.c
+++ b/dlls/rpcrt4/rpc_epmap.c
@@ -225,7 +225,6 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind
       RpcBinding* bind = BindingVector->BindingH[i];
       for (j = 0; j < (UuidVector ? UuidVector->Count : 1); j++)
       {
-          int len = strlen((char *)Annotation);
           status = TowerConstruct(&If->InterfaceId, &If->TransferSyntax,
                                   bind->Protseq, bind->Endpoint,
                                   bind->NetworkAddr,
@@ -236,7 +235,9 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind
               memcpy(&entries[i * UuidVector->Count].object, &UuidVector->Uuid[j], sizeof(GUID));
           else
               memset(&entries[i].object, 0, sizeof(entries[i].object));
-          memcpy(entries[i].annotation, Annotation, min(len + 1, ept_max_annotation_size));
+          if (Annotation)
+              memcpy(entries[i].annotation, Annotation,
+                     min(strlen((char *)Annotation) + 1, ept_max_annotation_size));
       }
   }
 
diff --git a/dlls/rpcrt4/tests/rpc_protseq.c b/dlls/rpcrt4/tests/rpc_protseq.c
index 4837f6a..3acc38b 100644
--- a/dlls/rpcrt4/tests/rpc_protseq.c
+++ b/dlls/rpcrt4/tests/rpc_protseq.c
@@ -157,6 +157,9 @@ static void test_endpoint_mapper(RPC_CSTR protseq, RPC_CSTR address)
     /* register endpoints created in test_RpcServerUseProtseq */
     status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, annotation);
     ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
+    /* reregister the same endpoint with no annotation */
+    status = RpcEpRegisterA(IFoo_v0_0_s_ifspec, binding_vector, NULL, NULL);
+    ok(status == RPC_S_OK, "%s: RpcEpRegisterA failed with error %u\n", protseq, status);
 
     status = RpcStringBindingCompose(NULL, protseq, address,
                                      NULL, NULL, &binding);




More information about the wine-cvs mailing list