Commit 9b791e09 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

rpcrt4: Allocate RpcServerProtseq in a single place.

parent e56f6a38
...@@ -725,21 +725,34 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpW( LPWSTR Protseq, UINT MaxCalls, LPWSTR ...@@ -725,21 +725,34 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpW( LPWSTR Protseq, UINT MaxCalls, LPWSTR
} }
/*********************************************************************** /***********************************************************************
* alloc_serverprotoseq (internal)
*/
static RpcServerProtseq *alloc_serverprotoseq(UINT MaxCalls, char *Protseq, char *Endpoint)
{
RpcServerProtseq* ps;
ps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcServerProtseq));
ps->MaxCalls = MaxCalls;
ps->Protseq = Protseq;
ps->Endpoint = Endpoint;
return ps;
}
/***********************************************************************
* RpcServerUseProtseqEpExA (RPCRT4.@) * RpcServerUseProtseqEpExA (RPCRT4.@)
*/ */
RPC_STATUS WINAPI RpcServerUseProtseqEpExA( unsigned char *Protseq, UINT MaxCalls, unsigned char *Endpoint, LPVOID SecurityDescriptor, RPC_STATUS WINAPI RpcServerUseProtseqEpExA( unsigned char *Protseq, UINT MaxCalls, unsigned char *Endpoint, LPVOID SecurityDescriptor,
PRPC_POLICY lpPolicy ) PRPC_POLICY lpPolicy )
{ {
char *szps = (char*)Protseq, *szep = (char*)Endpoint;
RpcServerProtseq* ps; RpcServerProtseq* ps;
TRACE("(%s,%u,%s,%p,{%u,%lu,%lu})\n", debugstr_a( (char*)Protseq ), MaxCalls, TRACE("(%s,%u,%s,%p,{%u,%lu,%lu})\n", debugstr_a(szps), MaxCalls,
debugstr_a( (char*)Endpoint ), SecurityDescriptor, debugstr_a(szep), SecurityDescriptor,
lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags ); lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
ps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcServerProtseq)); ps = alloc_serverprotoseq(MaxCalls, RPCRT4_strdupA(szps), RPCRT4_strdupA(szep));
ps->MaxCalls = MaxCalls;
ps->Protseq = RPCRT4_strdupA((char*)Protseq);
ps->Endpoint = RPCRT4_strdupA((char*)Endpoint);
return RPCRT4_use_protseq(ps); return RPCRT4_use_protseq(ps);
} }
...@@ -756,10 +769,8 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( LPWSTR Protseq, UINT MaxCalls, LPWST ...@@ -756,10 +769,8 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( LPWSTR Protseq, UINT MaxCalls, LPWST
debugstr_w( Endpoint ), SecurityDescriptor, debugstr_w( Endpoint ), SecurityDescriptor,
lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags ); lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
ps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcServerProtseq)); ps = alloc_serverprotoseq(MaxCalls, RPCRT4_strdupWtoA(Protseq),
ps->MaxCalls = MaxCalls; RPCRT4_strdupWtoA(Endpoint));
ps->Protseq = RPCRT4_strdupWtoA(Protseq);
ps->Endpoint = RPCRT4_strdupWtoA(Endpoint);
return RPCRT4_use_protseq(ps); return RPCRT4_use_protseq(ps);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment