rpcrt4: Implement MesBufferHandleReset().

This commit is contained in:
Nikolay Sivov 2015-03-03 22:49:07 +03:00 committed by Alexandre Julliard
parent cc95915a3c
commit d240fdff18
4 changed files with 59 additions and 2 deletions

View File

@ -123,6 +123,40 @@ RPC_STATUS WINAPI MesIncrementalHandleReset(
return RPC_S_OK; return RPC_S_OK;
} }
/***********************************************************************
* MesBufferHandleReset [RPCRT4.@]
*/
RPC_STATUS WINAPI MesBufferHandleReset(handle_t Handle, ULONG HandleStyle,
MIDL_ES_CODE Operation, char **Buffer, ULONG BufferSize, ULONG *EncodedSize)
{
MIDL_ES_MESSAGE *pEsMsg = (MIDL_ES_MESSAGE *)Handle;
TRACE("(%p, %u, %d, %p, %u, %p)\n", Handle, HandleStyle, Operation, Buffer,
BufferSize, EncodedSize);
if (!Handle || !Buffer || !EncodedSize)
return RPC_S_INVALID_ARG;
if (Operation != MES_ENCODE && Operation != MES_DECODE && Operation != MES_ENCODE_NDR64)
return RPC_S_INVALID_ARG;
if (HandleStyle != MES_FIXED_BUFFER_HANDLE && HandleStyle != MES_DYNAMIC_BUFFER_HANDLE)
return RPC_S_INVALID_ARG;
init_MIDL_ES_MESSAGE(pEsMsg);
pEsMsg->Operation = Operation;
pEsMsg->HandleStyle = HandleStyle;
if (HandleStyle == MES_FIXED_BUFFER_HANDLE)
pEsMsg->Buffer = (unsigned char*)*Buffer;
else
pEsMsg->pDynBuffer = (unsigned char**)Buffer;
pEsMsg->BufferSize = BufferSize;
pEsMsg->pEncodedSize = EncodedSize;
return RPC_S_OK;
}
/*********************************************************************** /***********************************************************************
* MesHandleFree [RPCRT4.@] * MesHandleFree [RPCRT4.@]
*/ */

View File

@ -96,7 +96,7 @@
@ stub I_UuidCreate @ stub I_UuidCreate
@ stub MIDL_wchar_strcpy @ stub MIDL_wchar_strcpy
@ stub MIDL_wchar_strlen @ stub MIDL_wchar_strlen
@ stub MesBufferHandleReset @ stdcall MesBufferHandleReset(ptr long long ptr long ptr)
@ stdcall MesDecodeBufferHandleCreate(ptr long ptr) @ stdcall MesDecodeBufferHandleCreate(ptr long ptr)
@ stdcall MesDecodeIncrementalHandleCreate(ptr ptr ptr) @ stdcall MesDecodeIncrementalHandleCreate(ptr ptr ptr)
@ stdcall MesEncodeDynBufferHandleCreate(ptr ptr ptr) @ stdcall MesEncodeDynBufferHandleCreate(ptr ptr ptr)

View File

@ -2437,6 +2437,28 @@ if (status == RPC_S_OK)
status = MesEncodeFixedBufferHandleCreate(buffer, 32, &encoded_size, &handle); status = MesEncodeFixedBufferHandleCreate(buffer, 32, &encoded_size, &handle);
ok(status == RPC_S_OK, "got %d\n", status); ok(status == RPC_S_OK, "got %d\n", status);
status = MesBufferHandleReset(NULL, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
&buffer, 32, &encoded_size);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
/* convert to dynamic buffer handle */
status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
&buffer, 32, &encoded_size);
ok(status == RPC_S_OK, "got %d\n", status);
status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
NULL, 32, &encoded_size);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE, MES_ENCODE,
&buffer, 32, NULL);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
/* invalid handle type */
status = MesBufferHandleReset(handle, MES_DYNAMIC_BUFFER_HANDLE+1, MES_ENCODE,
&buffer, 32, &encoded_size);
ok(status == RPC_S_INVALID_ARG, "got %d\n", status);
status = MesHandleFree(handle); status = MesHandleFree(handle);
ok(status == RPC_S_OK, "got %d\n", status); ok(status == RPC_S_OK, "got %d\n", status);
} }

View File

@ -30,7 +30,8 @@ extern "C" {
typedef enum typedef enum
{ {
MES_ENCODE, MES_ENCODE,
MES_DECODE MES_DECODE,
MES_ENCODE_NDR64
} MIDL_ES_CODE; } MIDL_ES_CODE;
typedef enum typedef enum