Commit 18c16a80 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

rpcrt4: Add a test for the pointers in [in,out] pointer structs not changing…

rpcrt4: Add a test for the pointers in [in,out] pointer structs not changing when the pointers aren't NULL.
parent 55aeb80a
......@@ -472,6 +472,16 @@ s_hash_bstr(bstr_t b)
}
void
s_get_name(name_t *name)
{
const char bossman[] = "Jeremy White";
memcpy(name->name, bossman, min(name->size, sizeof(bossman)));
/* ensure nul-termination */
if (name->size < sizeof(bossman))
name->name[name->size - 1] = 0;
}
void
s_stop(void)
{
ok(RPC_S_OK == RpcMgmtStopServerListening(NULL), "RpcMgmtStopServerListening\n");
......@@ -800,6 +810,8 @@ pointer_tests(void)
cpuints_t cpus;
short bstr_data[] = { 5, 'H', 'e', 'l', 'l', 'o' };
bstr_t bstr = &bstr_data[1];
name_t name;
void *buffer;
ok(test_list_length(list) == 3, "RPC test_list_length\n");
ok(square_puint(p1) == 121, "RPC square_puint\n");
......@@ -843,6 +855,13 @@ pointer_tests(void)
ok(hash_bstr(bstr) == s_hash_bstr(bstr), "RPC hash_bstr_data\n");
free_list(list);
name.size = 10;
name.name = buffer = HeapAlloc(GetProcessHeap(), 0, name.size);
get_name(&name);
todo_wine
ok(name.name == buffer, "[in,out] pointer should have stayed as %p but instead changed to %p\n", name.name, buffer);
HeapFree(GetProcessHeap(), 0, name.name);
}
static int
......
......@@ -290,5 +290,12 @@ cpp_quote("#endif")
typedef [wire_marshal(wire_bstr_t)] short *bstr_t;
unsigned hash_bstr(bstr_t s);
typedef struct
{
[string, size_is(size)] char *name;
unsigned int size;
} name_t;
void get_name([in,out] name_t *name);
void stop(void);
}
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