Commit 5102d4df authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

rpcrt4/tests: Add a test for marshalling a pointer to a user type, where the…

rpcrt4/tests: Add a test for marshalling a pointer to a user type, where the user type is itself a pointer.
parent d10a4dce
......@@ -562,6 +562,16 @@ s_hash_bstr(bstr_t b)
}
void
s_get_a_bstr(bstr_t *b)
{
bstr_t bstr;
short str[] = {5, 'W', 'i', 'n', 'e', 0};
bstr = HeapAlloc(GetProcessHeap(), 0, sizeof(str));
memcpy(bstr, str, sizeof(str));
*b = bstr + 1;
}
void
s_get_name(name_t *name)
{
const char bossman[] = "Jeremy White";
......@@ -1119,7 +1129,7 @@ pointer_tests(void)
puints_t pus;
cpuints_t cpus;
short bstr_data[] = { 5, 'H', 'e', 'l', 'l', 'o' };
bstr_t bstr = &bstr_data[1];
bstr_t bstr = &bstr_data[1], bstr2;
name_t name;
void *buffer;
int *pa2;
......@@ -1167,6 +1177,12 @@ pointer_tests(void)
ok(hash_bstr(bstr) == s_hash_bstr(bstr), "RPC hash_bstr_data\n");
get_a_bstr(&bstr);
s_get_a_bstr(&bstr2);
ok(!lstrcmpW((LPCWSTR)bstr, (LPCWSTR)bstr2), "bstr mismatch\n");
HeapFree(GetProcessHeap(), 0, bstr - 1);
HeapFree(GetProcessHeap(), 0, bstr2 - 1);
free_list(list);
if (!old_windows_version)
......
......@@ -311,7 +311,7 @@ cpp_quote("#endif")
typedef [unique] user_bstr_t *wire_bstr_t;
typedef [wire_marshal(wire_bstr_t)] short *bstr_t;
unsigned hash_bstr(bstr_t s);
void get_a_bstr([out]bstr_t *s);
typedef struct
{
[string, size_is(size)] char *name;
......
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