Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 68 participants
- 1149 messages
Re: [PATCH 1/3] msi: Only delete empty registry keys in delete_key().
by Hans Leidekker
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
June 5, 2018
Re: [PATCH v2 2/2] widl: Generate correct size and alignment for all types.
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
June 5, 2018
Re: [PATCH v2 1/2] stdole2.idl: Use more accurate sizes for Automation types.
by Huw Davies
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
June 5, 2018
Re: [PATCH] msvcp120: Add tests for concurrent_vector_Internal_push_back and capacity.
by Zhiyi Zhang
On Tue 6 5 14:39, Hua Meng wrote:
> Signed-off-by: Hua meng <161220092(a)smail.nju.edu.cn>
> ---
> dlls/msvcp120/tests/msvcp120.c | 120 +++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 117 insertions(+), 3 deletions(-)
> mode change 100644 => 100755 dlls/msvcp120/tests/msvcp120.c
Hi,
I don't think you need to change the file permission from 644 to 755.
And there are some style inconsistencies.
Thanks,
Zhiyi Zhang
>
> diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
> old mode 100644
> new mode 100755
> index dfd2d06..84e20bd
> --- a/dlls/msvcp120/tests/msvcp120.c
> +++ b/dlls/msvcp120/tests/msvcp120.c
> @@ -35,6 +35,7 @@ struct expect_struct {
> DEFINE_EXPECT(queue_char__Move_item);
> DEFINE_EXPECT(queue_char__Copy_item);
> DEFINE_EXPECT(queue_char__Assign_and_destroy_item);
> + DEFINE_EXPECT(concurrent_vector_int_alloc);
> };
>
> #define SET_EXPECT(func) \
> @@ -105,6 +106,8 @@ struct thiscall_thunk
>
> static void * (WINAPI *call_thiscall_func1)( void *func, void *this );
> static void * (WINAPI *call_thiscall_func2)( void *func, void *this, const void *a );
> +static void * (WINAPI *call_thiscall_func3)( void *func, void *this, const void *a,
> + const void *b );
>
> static void init_thiscall_thunk(void)
> {
> @@ -117,17 +120,19 @@ static void init_thiscall_thunk(void)
> thunk->jmp_edx = 0xe2ff; /* jmp *%edx */
> call_thiscall_func1 = (void *)thunk;
> call_thiscall_func2 = (void *)thunk;
> + call_thiscall_func3 = (void *)thunk;
> }
>
> #define call_func1(func,_this) call_thiscall_func1(func,_this)
> #define call_func2(func,_this,a) call_thiscall_func2(func,_this,(const void*)(a))
> -
> +#define call_func3(func,_this,a,b) call_thiscall_func3(func,_this,(const void*)(a),\
> + (const void*)(b))
> #else
>
> #define init_thiscall_thunk()
> #define call_func1(func,_this) func(_this)
> #define call_func2(func,_this,a) func(_this,a)
> -
> +#define call_func3(func,_this,a,b) func(_this,a,b)
> #endif /* __i386__ */
>
> static inline float __port_infinity(void)
> @@ -360,6 +365,19 @@ static void (__thiscall *p_queue_base_v4__Internal_move_push)(queue_base_v4*, vo
> static MSVCP_bool (__thiscall *p_queue_base_v4__Internal_pop_if_present)(queue_base_v4*, void*);
> static void (__thiscall *p_queue_base_v4__Internal_finish_clear)(queue_base_v4*);
>
> +typedef struct vector_base_v4
> +{
> + void* (__cdecl *allocator)(struct vector_base_v4 *, size_t);
> + void *storage[3];
> + size_t first_block;
> + size_t early_size;
> + void **segment;
> +} vector_base_v4;
> +
> +static void (__thiscall *p_vector_base_v4_dtor)(vector_base_v4*);
> +static size_t (__thiscall *p_vector_base_v4__Internal_capacity)(vector_base_v4*);
> +static void* (__thiscall *p_vector_base_v4__Internal_push_back)(vector_base_v4*, size_t, size_t*);
> +
> static HMODULE msvcp;
> #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
> #define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
> @@ -493,7 +511,13 @@ static BOOL init(void)
> "?_Internal_pop_if_present(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IEAA_NPEAX(a)Z");
> SET(p_queue_base_v4__Internal_finish_clear,
> "?_Internal_finish_clear(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IEAAXXZ");
> - } else {
> + SET(p_vector_base_v4_dtor,
> + "??1_Concurrent_vector_base_v4(a)details@Concurrency@@IEAA(a)XZ");
> + SET(p_vector_base_v4__Internal_capacity,
> + "?_Internal_capacity(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEBA_KXZ");
> + SET(p_vector_base_v4__Internal_push_back,
> + "?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAPEAX_KAEA_K(a)Z");
> +} else {
> SET(p_tr2_sys__File_size,
> "?_File_size(a)sys@tr2(a)std@@YA_KPBD(a)Z");
> SET(p_tr2_sys__File_size_wchar,
> @@ -596,6 +620,12 @@ static BOOL init(void)
> "?_Internal_pop_if_present(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IAE_NPAX(a)Z");
> SET(p_queue_base_v4__Internal_finish_clear,
> "?_Internal_finish_clear(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IAEXXZ");
> + SET(p_vector_base_v4_dtor,
> + "??1_Concurrent_vector_base_v4(a)details@Concurrency@@IAE(a)XZ");
> + SET(p_vector_base_v4__Internal_capacity,
> + "?_Internal_capacity(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IBEIXZ");
> + SET(p_vector_base_v4__Internal_push_back,
> + "?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEPAXIAAI(a)Z");
> #else
> SET(p__Thrd_current,
> "_Thrd_current");
> @@ -627,6 +657,12 @@ static BOOL init(void)
> "?_Internal_pop_if_present(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IAA_NPAX(a)Z");
> SET(p_queue_base_v4__Internal_finish_clear,
> "?_Internal_finish_clear(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IAAXXZ");
> + SET(p_vector_base_v4_dtor,
> + "??1_Concurrent_vector_base_v4(a)details@Concurrency@@IAA(a)XZ");
> + SET(p_vector_base_v4__Internal_capacity,
> + "?_Internal_capacity(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IBAIXZ");
> + SET(p_vector_base_v4__Internal_push_back,
> + "?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAPAXIAAI(a)Z");
> #endif
> }
> SET(p__Thrd_equal,
> @@ -2396,6 +2432,83 @@ static DWORD WINAPI queue_pop_thread(void*arg)
> return 0;
> }
>
> +static void* __cdecl concurrent_vector_int_alloc(vector_base_v4 *this, size_t n)
> +{
> + CHECK_EXPECT(concurrent_vector_int_alloc);
> + return malloc(n*sizeof(int));
> +}
> +
> +static void concurrent_vector_int_ctor(vector_base_v4 *this)
> +{
> + memset(this, 0, sizeof(*this));
> + this->allocator = concurrent_vector_int_alloc;
> + this->segment = &this->storage[0];
> +}
> +
> +static void test_vector_base_v4(void)
> +{
> + vector_base_v4 vector;
> + size_t idx;
> + size_t size;
> + int *data;
> +
> + /* test for concurrent_vector_base_v4__Internal_push_back and _Internal_capacity */
> + concurrent_vector_int_ctor(&vector);
> +
> + size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
> + todo_wine ok(size == 0, "size of vector got %ld expected %d\n", (long)size, 0);
> +
> + SET_EXPECT(concurrent_vector_int_alloc);
> + data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
> + CHECK_CALLED(concurrent_vector_int_alloc);
> + todo_wine ok(data != NULL, "_Internal_push_back returned NULL\n");
> + if(!data){
> + skip("_Internal_capacity not yet implemented\n");
> + return;
> + }
> + todo_wine ok(idx == 0, "idx got %ld expected %d\n", (long)idx, 0);
> + *data = 1;
> + todo_wine ok(data == vector.storage[0], "vector.storage[0] got %p expected %p\n", vector.storage[0], data);
> + todo_wine ok(vector.first_block == 1, "vector.first_block got %ld expected %d\n", (long)vector.first_block, 1);
> + todo_wine ok(vector.early_size == 1, "vector.early_size got %ld expected %d\n", (long)vector.early_size, 1);
> +
> + size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
> + todo_wine ok(size == 2, "size of vector got %ld expected %d\n", (long)size, 2);
> +
> + data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
> + todo_wine ok(data != NULL, "_Internal_push_back returned NULL\n");
> + todo_wine ok(idx == 1, "idx got %ld expected %d\n", (long)idx, 1);
> + *data = 2;
> + todo_wine ok(vector.first_block == 1, "vector.first_block got %ld expected %d\n", (long)vector.first_block, 1);
> + todo_wine ok(vector.early_size == 2, "vector.early_size got %ld expected %d\n", (long)vector.early_size, 2);
> +
> + size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
> + todo_wine ok(size == 2, "size of vector got %ld expected %d\n", (long)size, 2);
> +
> + SET_EXPECT(concurrent_vector_int_alloc);
> + data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
> + CHECK_CALLED(concurrent_vector_int_alloc);
> + todo_wine ok(data != NULL, "_Internal_push_back returned NULL\n");
> + todo_wine ok(idx == 2, "idx got %ld expected %d\n", (long)idx, 2);
> + *data = 3;
> + todo_wine ok(vector.first_block == 1, "vector.first_block got %ld expected %d\n", (long)vector.first_block, 1);
> + todo_wine ok(vector.early_size == 3, "vector.early_size got %ld expected %d\n", (long)vector.early_size, 3);
> +
> + size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
> + todo_wine ok(size == 4, "size of vector got %ld expected %d\n", (long)size, 4);
> +
> + data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
> + size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
> + todo_wine ok(size == 4, "size of vector got %ld expected %d\n", (long)size, 4);
> +
> + SET_EXPECT(concurrent_vector_int_alloc);
> + data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
> + CHECK_CALLED(concurrent_vector_int_alloc);
> + size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
> + todo_wine ok(size == 8, "size of vector got %ld expected %d\n", (long)size, 8);
> +
> + call_func1(p_vector_base_v4_dtor, &vector);
> +}
> static void test_queue_base_v4(void)
> {
> queue_base_v4 queue;
> @@ -2626,6 +2739,7 @@ START_TEST(msvcp120)
>
> test_vector_base_v4__Segment_index_of();
> test_queue_base_v4();
> + test_vector_base_v4();
>
> test_vbtable_size_exports();
>
>
June 5, 2018
Re: [PATCH] netapi32: NetUserGetInfo should return Admin privilege - wine users run as Administrators
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=38963
Your paranoid android.
=== wxppro (32 bit access) ===
0b40:access: unhandled exception c0000005 at 004025C6
=== w2003std (32 bit access) ===
06ac:access: unhandled exception c0000005 at 004025C6
=== wvistau64 (32 bit access) ===
073c:access: unhandled exception c0000005 at 004025C6
=== wvistau64_zh_CN (32 bit access) ===
0bbc:access: unhandled exception c0000005 at 004025C6
=== wvistau64_fr (32 bit access) ===
06a8:access: unhandled exception c0000005 at 004025C6
=== wvistau64_he (32 bit access) ===
0be8:access: unhandled exception c0000005 at 004025C6
=== w2008s64 (32 bit access) ===
086c:access: unhandled exception c0000005 at 004025C6
=== w7u (32 bit access) ===
0130:access: unhandled exception c0000005 at 004025C6
=== w7pro64 (32 bit access) ===
0adc:access: unhandled exception c0000005 at 004025C6
=== w8 (32 bit access) ===
0d30:access: unhandled exception c0000005 at 004025C6
=== w864 (32 bit access) ===
0154:access: unhandled exception c0000005 at 004025C6
=== w1064 (32 bit access) ===
0eb8:access: unhandled exception c0000005 at 004025C6
=== wvistau64 (64 bit access) ===
073c:access: unhandled exception c0000005 at 00000000004022FB
=== w2008s64 (64 bit access) ===
086c:access: unhandled exception c0000005 at 00000000004022FB
=== w7pro64 (64 bit access) ===
0a9c:access: unhandled exception c0000005 at 00000000004022FB
The previous 1 run(s) terminated abnormally
=== w864 (64 bit access) ===
0ad8:access: unhandled exception c0000005 at 00000000004022FB
=== w1064 (64 bit access) ===
0e04:access: unhandled exception c0000005 at 00000000004022FB
June 5, 2018
Re: netapi32/tests: Fix a memory leak
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=38962
Your paranoid android.
=== build (build) ===
Patch failed to apply
June 5, 2018
Re: netapi32: NetUserGetInfo should return Admin priviledge - wine users run as Administrators
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=38961
Your paranoid android.
=== wxppro (32 bit access) ===
0b40:access: unhandled exception c0000005 at 004025C6
=== w2003std (32 bit access) ===
06ac:access: unhandled exception c0000005 at 004025C6
=== wvistau64 (32 bit access) ===
072c:access: unhandled exception c0000005 at 004025C6
=== wvistau64_zh_CN (32 bit access) ===
0bbc:access: unhandled exception c0000005 at 004025C6
=== wvistau64_fr (32 bit access) ===
072c:access: unhandled exception c0000005 at 004025C6
=== wvistau64_he (32 bit access) ===
0bd8:access: unhandled exception c0000005 at 004025C6
=== w2008s64 (32 bit access) ===
086c:access: unhandled exception c0000005 at 004025C6
=== w7u (32 bit access) ===
0e48:access: unhandled exception c0000005 at 004025C6
=== w7pro64 (32 bit access) ===
0be0:access: unhandled exception c0000005 at 004025C6
=== w8 (32 bit access) ===
0d48:access: unhandled exception c0000005 at 004025C6
=== w864 (32 bit access) ===
0ad8:access: unhandled exception c0000005 at 004025C6
=== w1064 (32 bit access) ===
0784:access: unhandled exception c0000005 at 004025C6
=== wvistau64 (64 bit access) ===
073c:access: unhandled exception c0000005 at 00000000004022FB
=== w2008s64 (64 bit access) ===
086c:access: unhandled exception c0000005 at 00000000004022FB
=== w7pro64 (64 bit access) ===
0ab4:access: unhandled exception c0000005 at 00000000004022FB
The previous 1 run(s) terminated abnormally
=== w864 (64 bit access) ===
0264:access: unhandled exception c0000005 at 00000000004022FB
=== w1064 (64 bit access) ===
0138:access: unhandled exception c0000005 at 00000000004022FB
June 5, 2018
Re: [PATCH] msvcp120: Add tests for concurrent_vector_Internal_push_back and capacity.
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=38960
Your paranoid android.
=== wvistau64_zh_CN (32 bit msvcp120) ===
msvcp120.c:846: Test failed: cvtvec.isleadbyte[16] = fe
msvcp120.c:846: Test failed: cvtvec.isleadbyte[17] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[18] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[19] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[20] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[21] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[22] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[23] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[24] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[25] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[26] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[27] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[28] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[29] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[30] = ff
msvcp120.c:846: Test failed: cvtvec.isleadbyte[31] = 7f
June 5, 2018
[PATCH] msvcp120: Add tests for concurrent_vector_Internal_push_back and capacity.
by Hua Meng
Signed-off-by: Hua meng <161220092(a)smail.nju.edu.cn>
---
dlls/msvcp120/tests/msvcp120.c | 120 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 117 insertions(+), 3 deletions(-)
mode change 100644 => 100755 dlls/msvcp120/tests/msvcp120.c
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
old mode 100644
new mode 100755
index dfd2d06..84e20bd
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -35,6 +35,7 @@ struct expect_struct {
DEFINE_EXPECT(queue_char__Move_item);
DEFINE_EXPECT(queue_char__Copy_item);
DEFINE_EXPECT(queue_char__Assign_and_destroy_item);
+ DEFINE_EXPECT(concurrent_vector_int_alloc);
};
#define SET_EXPECT(func) \
@@ -105,6 +106,8 @@ struct thiscall_thunk
static void * (WINAPI *call_thiscall_func1)( void *func, void *this );
static void * (WINAPI *call_thiscall_func2)( void *func, void *this, const void *a );
+static void * (WINAPI *call_thiscall_func3)( void *func, void *this, const void *a,
+ const void *b );
static void init_thiscall_thunk(void)
{
@@ -117,17 +120,19 @@ static void init_thiscall_thunk(void)
thunk->jmp_edx = 0xe2ff; /* jmp *%edx */
call_thiscall_func1 = (void *)thunk;
call_thiscall_func2 = (void *)thunk;
+ call_thiscall_func3 = (void *)thunk;
}
#define call_func1(func,_this) call_thiscall_func1(func,_this)
#define call_func2(func,_this,a) call_thiscall_func2(func,_this,(const void*)(a))
-
+#define call_func3(func,_this,a,b) call_thiscall_func3(func,_this,(const void*)(a),\
+ (const void*)(b))
#else
#define init_thiscall_thunk()
#define call_func1(func,_this) func(_this)
#define call_func2(func,_this,a) func(_this,a)
-
+#define call_func3(func,_this,a,b) func(_this,a,b)
#endif /* __i386__ */
static inline float __port_infinity(void)
@@ -360,6 +365,19 @@ static void (__thiscall *p_queue_base_v4__Internal_move_push)(queue_base_v4*, vo
static MSVCP_bool (__thiscall *p_queue_base_v4__Internal_pop_if_present)(queue_base_v4*, void*);
static void (__thiscall *p_queue_base_v4__Internal_finish_clear)(queue_base_v4*);
+typedef struct vector_base_v4
+{
+ void* (__cdecl *allocator)(struct vector_base_v4 *, size_t);
+ void *storage[3];
+ size_t first_block;
+ size_t early_size;
+ void **segment;
+} vector_base_v4;
+
+static void (__thiscall *p_vector_base_v4_dtor)(vector_base_v4*);
+static size_t (__thiscall *p_vector_base_v4__Internal_capacity)(vector_base_v4*);
+static void* (__thiscall *p_vector_base_v4__Internal_push_back)(vector_base_v4*, size_t, size_t*);
+
static HMODULE msvcp;
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y)
#define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
@@ -493,7 +511,13 @@ static BOOL init(void)
"?_Internal_pop_if_present(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IEAA_NPEAX(a)Z");
SET(p_queue_base_v4__Internal_finish_clear,
"?_Internal_finish_clear(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IEAAXXZ");
- } else {
+ SET(p_vector_base_v4_dtor,
+ "??1_Concurrent_vector_base_v4(a)details@Concurrency@@IEAA(a)XZ");
+ SET(p_vector_base_v4__Internal_capacity,
+ "?_Internal_capacity(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEBA_KXZ");
+ SET(p_vector_base_v4__Internal_push_back,
+ "?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAPEAX_KAEA_K(a)Z");
+} else {
SET(p_tr2_sys__File_size,
"?_File_size(a)sys@tr2(a)std@@YA_KPBD(a)Z");
SET(p_tr2_sys__File_size_wchar,
@@ -596,6 +620,12 @@ static BOOL init(void)
"?_Internal_pop_if_present(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IAE_NPAX(a)Z");
SET(p_queue_base_v4__Internal_finish_clear,
"?_Internal_finish_clear(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IAEXXZ");
+ SET(p_vector_base_v4_dtor,
+ "??1_Concurrent_vector_base_v4(a)details@Concurrency@@IAE(a)XZ");
+ SET(p_vector_base_v4__Internal_capacity,
+ "?_Internal_capacity(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IBEIXZ");
+ SET(p_vector_base_v4__Internal_push_back,
+ "?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEPAXIAAI(a)Z");
#else
SET(p__Thrd_current,
"_Thrd_current");
@@ -627,6 +657,12 @@ static BOOL init(void)
"?_Internal_pop_if_present(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IAA_NPAX(a)Z");
SET(p_queue_base_v4__Internal_finish_clear,
"?_Internal_finish_clear(a)_Concurrent_queue_base_v4@details(a)Concurrency@@IAAXXZ");
+ SET(p_vector_base_v4_dtor,
+ "??1_Concurrent_vector_base_v4(a)details@Concurrency@@IAA(a)XZ");
+ SET(p_vector_base_v4__Internal_capacity,
+ "?_Internal_capacity(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IBAIXZ");
+ SET(p_vector_base_v4__Internal_push_back,
+ "?_Internal_push_back(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAPAXIAAI(a)Z");
#endif
}
SET(p__Thrd_equal,
@@ -2396,6 +2432,83 @@ static DWORD WINAPI queue_pop_thread(void*arg)
return 0;
}
+static void* __cdecl concurrent_vector_int_alloc(vector_base_v4 *this, size_t n)
+{
+ CHECK_EXPECT(concurrent_vector_int_alloc);
+ return malloc(n*sizeof(int));
+}
+
+static void concurrent_vector_int_ctor(vector_base_v4 *this)
+{
+ memset(this, 0, sizeof(*this));
+ this->allocator = concurrent_vector_int_alloc;
+ this->segment = &this->storage[0];
+}
+
+static void test_vector_base_v4(void)
+{
+ vector_base_v4 vector;
+ size_t idx;
+ size_t size;
+ int *data;
+
+ /* test for concurrent_vector_base_v4__Internal_push_back and _Internal_capacity */
+ concurrent_vector_int_ctor(&vector);
+
+ size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
+ todo_wine ok(size == 0, "size of vector got %ld expected %d\n", (long)size, 0);
+
+ SET_EXPECT(concurrent_vector_int_alloc);
+ data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ todo_wine ok(data != NULL, "_Internal_push_back returned NULL\n");
+ if(!data){
+ skip("_Internal_capacity not yet implemented\n");
+ return;
+ }
+ todo_wine ok(idx == 0, "idx got %ld expected %d\n", (long)idx, 0);
+ *data = 1;
+ todo_wine ok(data == vector.storage[0], "vector.storage[0] got %p expected %p\n", vector.storage[0], data);
+ todo_wine ok(vector.first_block == 1, "vector.first_block got %ld expected %d\n", (long)vector.first_block, 1);
+ todo_wine ok(vector.early_size == 1, "vector.early_size got %ld expected %d\n", (long)vector.early_size, 1);
+
+ size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
+ todo_wine ok(size == 2, "size of vector got %ld expected %d\n", (long)size, 2);
+
+ data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
+ todo_wine ok(data != NULL, "_Internal_push_back returned NULL\n");
+ todo_wine ok(idx == 1, "idx got %ld expected %d\n", (long)idx, 1);
+ *data = 2;
+ todo_wine ok(vector.first_block == 1, "vector.first_block got %ld expected %d\n", (long)vector.first_block, 1);
+ todo_wine ok(vector.early_size == 2, "vector.early_size got %ld expected %d\n", (long)vector.early_size, 2);
+
+ size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
+ todo_wine ok(size == 2, "size of vector got %ld expected %d\n", (long)size, 2);
+
+ SET_EXPECT(concurrent_vector_int_alloc);
+ data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ todo_wine ok(data != NULL, "_Internal_push_back returned NULL\n");
+ todo_wine ok(idx == 2, "idx got %ld expected %d\n", (long)idx, 2);
+ *data = 3;
+ todo_wine ok(vector.first_block == 1, "vector.first_block got %ld expected %d\n", (long)vector.first_block, 1);
+ todo_wine ok(vector.early_size == 3, "vector.early_size got %ld expected %d\n", (long)vector.early_size, 3);
+
+ size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
+ todo_wine ok(size == 4, "size of vector got %ld expected %d\n", (long)size, 4);
+
+ data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
+ size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
+ todo_wine ok(size == 4, "size of vector got %ld expected %d\n", (long)size, 4);
+
+ SET_EXPECT(concurrent_vector_int_alloc);
+ data = call_func3(p_vector_base_v4__Internal_push_back, &vector, sizeof(int), &idx);
+ CHECK_CALLED(concurrent_vector_int_alloc);
+ size = (size_t)call_func1(p_vector_base_v4__Internal_capacity, &vector);
+ todo_wine ok(size == 8, "size of vector got %ld expected %d\n", (long)size, 8);
+
+ call_func1(p_vector_base_v4_dtor, &vector);
+}
static void test_queue_base_v4(void)
{
queue_base_v4 queue;
@@ -2626,6 +2739,7 @@ START_TEST(msvcp120)
test_vector_base_v4__Segment_index_of();
test_queue_base_v4();
+ test_vector_base_v4();
test_vbtable_size_exports();
--
2.11.0
June 5, 2018
[PATCH 2/2] wbemdisp/tests: Add ISWbemSecurity tests
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/wbemdisp/tests/wbemdisp.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/dlls/wbemdisp/tests/wbemdisp.c b/dlls/wbemdisp/tests/wbemdisp.c
index 171a91e..b8cd5c8 100644
--- a/dlls/wbemdisp/tests/wbemdisp.c
+++ b/dlls/wbemdisp/tests/wbemdisp.c
@@ -265,7 +265,10 @@ static void test_locator(void)
ISWbemObject *object;
ISWbemPropertySet *prop_set;
ISWbemProperty *prop;
+ ISWbemSecurity *security;
VARIANT var;
+ WbemImpersonationLevelEnum level;
+ WbemAuthenticationLevelEnum authenication;
hr = CoCreateInstance( &CLSID_SWbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_ISWbemLocator, (void **)&locator );
ok( hr == S_OK, "got %x\n", hr );
@@ -284,6 +287,21 @@ static void test_locator(void)
SysFreeString( lang_bstr );
SysFreeString( query_bstr );
+ hr = ISWbemLocator_get_Security_( locator, &security );
+ ok( hr == S_OK, "got %x\n", hr );
+ hr = ISWbemSecurity_put_ImpersonationLevel( security, wbemImpersonationLevelImpersonate );
+ ok( hr == S_OK, "got %x\n", hr );
+ hr = ISWbemSecurity_get_ImpersonationLevel( security, &level );
+ ok( hr == S_OK, "got %x\n", hr );
+ ok( level == wbemImpersonationLevelImpersonate, "got %d\n", level );
+ hr = ISWbemSecurity_put_AuthenticationLevel( security, wbemAuthenticationLevelPktPrivacy );
+ ok( hr == S_OK, "got %x\n", hr );
+ hr = ISWbemSecurity_get_AuthenticationLevel( security, &authenication );
+ ok( hr == S_OK, "got %x\n", hr );
+ ok( authenication == wbemAuthenticationLevelPktPrivacy, "got %d\n", authenication );
+ ISWbemSecurity_Release( security );
+ security = NULL;
+
hr = ISWbemObjectSet_get__NewEnum( object_set, (IUnknown**)&enum_var );
ok( hr == S_OK, "got %x\n", hr );
@@ -318,6 +336,16 @@ static void test_locator(void)
ok( V_VT(&var) == VT_BSTR, "got %x\n", V_VT(&var) );
VariantClear( &var );
+ hr = ISWbemServices_get_Security_( services, &security );
+ ok( hr == S_OK, "got %x\n", hr );
+ hr = ISWbemSecurity_get_ImpersonationLevel( security, &level );
+ ok( hr == S_OK, "got %x\n", hr );
+ ok( level == wbemImpersonationLevelImpersonate, "got %d\n", level );
+ hr = ISWbemSecurity_get_AuthenticationLevel( security, &authenication );
+ ok( hr == S_OK, "got %x\n", hr );
+ ok( authenication == wbemAuthenticationLevelPktPrivacy, "got %d\n", authenication );
+
+ ISWbemSecurity_Release(security);
ISWbemProperty_Release( prop );
ISWbemPropertySet_Release( prop_set );
ISWbemObject_Release( object );
--
1.9.1
June 5, 2018
[PATCH 1/2] wbemdisp: Add ISWbemSecurity stub interface.
by Alistair Leslie-Hughes
From: Michael Müller <michael(a)fds-team.de>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/wbemdisp/locator.c | 249 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 244 insertions(+), 5 deletions(-)
diff --git a/dlls/wbemdisp/locator.c b/dlls/wbemdisp/locator.c
index e782d1f..cdc0ab4 100644
--- a/dlls/wbemdisp/locator.c
+++ b/dlls/wbemdisp/locator.c
@@ -38,6 +38,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(wbemdisp);
static HRESULT EnumVARIANT_create( IEnumWbemClassObject *, IEnumVARIANT ** );
+static HRESULT ISWbemSecurity_create( ISWbemSecurity ** );
enum type_id
{
@@ -47,6 +48,7 @@ enum type_id
ISWbemProperty_tid,
ISWbemPropertySet_tid,
ISWbemServices_tid,
+ ISWbemSecurity_tid,
last_tid
};
@@ -60,7 +62,8 @@ static REFIID wbemdisp_tid_id[] =
&IID_ISWbemObjectSet,
&IID_ISWbemProperty,
&IID_ISWbemPropertySet,
- &IID_ISWbemServices
+ &IID_ISWbemServices,
+ &IID_ISWbemSecurity
};
static HRESULT get_typeinfo( enum type_id tid, ITypeInfo **ret )
@@ -1873,8 +1876,12 @@ static HRESULT WINAPI services_get_Security_(
ISWbemServices *iface,
ISWbemSecurity **objWbemSecurity )
{
- FIXME( "\n" );
- return E_NOTIMPL;
+ TRACE( "%p, %p\n", iface, objWbemSecurity );
+
+ if (!objWbemSecurity)
+ return E_INVALIDARG;
+
+ return ISWbemSecurity_create( objWbemSecurity );
}
static const ISWbemServicesVtbl services_vtbl =
@@ -2128,8 +2135,12 @@ static HRESULT WINAPI locator_get_Security_(
ISWbemLocator *iface,
ISWbemSecurity **objWbemSecurity )
{
- FIXME( "%p, %p\n", iface, objWbemSecurity );
- return E_NOTIMPL;
+ TRACE( "%p, %p\n", iface, objWbemSecurity );
+
+ if (!objWbemSecurity)
+ return E_INVALIDARG;
+
+ return ISWbemSecurity_create( objWbemSecurity );
}
static const ISWbemLocatorVtbl locator_vtbl =
@@ -2160,3 +2171,231 @@ HRESULT SWbemLocator_create( void **obj )
TRACE( "returning iface %p\n", *obj );
return S_OK;
}
+
+struct security
+{
+ ISWbemSecurity ISWbemSecurity_iface;
+ LONG refs;
+ WbemImpersonationLevelEnum implevel;
+ WbemAuthenticationLevelEnum authlevel;
+};
+
+static inline struct security *impl_from_ISWbemSecurity( ISWbemSecurity *iface )
+{
+ return CONTAINING_RECORD( iface, struct security, ISWbemSecurity_iface );
+}
+
+static ULONG WINAPI security_AddRef(
+ ISWbemSecurity *iface )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ return InterlockedIncrement( &security->refs );
+}
+
+static ULONG WINAPI security_Release(
+ ISWbemSecurity *iface )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ LONG refs = InterlockedDecrement( &security->refs );
+ if (!refs)
+ {
+ TRACE( "destroying %p\n", security );
+ heap_free( security );
+ }
+ return refs;
+}
+
+static HRESULT WINAPI security_QueryInterface(
+ ISWbemSecurity *iface,
+ REFIID riid,
+ void **ppvObject )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ TRACE( "%p, %s, %p\n", security, debugstr_guid( riid ), ppvObject );
+
+ if (IsEqualGUID( riid, &IID_ISWbemSecurity ) ||
+ IsEqualGUID( riid, &IID_IDispatch ) ||
+ IsEqualGUID( riid, &IID_IUnknown ))
+ {
+ *ppvObject = iface;
+ }
+ else
+ {
+ FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
+ return E_NOINTERFACE;
+ }
+ ISWbemSecurity_AddRef( iface );
+ return S_OK;
+}
+
+static HRESULT WINAPI security_GetTypeInfoCount(
+ ISWbemSecurity *iface,
+ UINT *count )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ TRACE( "%p, %p\n", security, count );
+
+ *count = 1;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_GetTypeInfo(
+ ISWbemSecurity *iface,
+ UINT index,
+ LCID lcid,
+ ITypeInfo **info )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ TRACE( "%p, %u, %u, %p\n", security, index, lcid, info );
+
+ return get_typeinfo( ISWbemSecurity_tid, info );
+}
+
+static HRESULT WINAPI security_GetIDsOfNames(
+ ISWbemSecurity *iface,
+ REFIID riid,
+ LPOLESTR *names,
+ UINT count,
+ LCID lcid,
+ DISPID *dispid )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE( "%p, %s, %p, %u, %u, %p\n", security, debugstr_guid(riid), names, count, lcid, dispid );
+
+ if (!names || !count || !dispid) return E_INVALIDARG;
+
+ hr = get_typeinfo( ISWbemSecurity_tid, &typeinfo );
+ if (SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_GetIDsOfNames( typeinfo, names, count, dispid );
+ ITypeInfo_Release( typeinfo );
+ }
+ return hr;
+}
+
+static HRESULT WINAPI security_Invoke(
+ ISWbemSecurity *iface,
+ DISPID member,
+ REFIID riid,
+ LCID lcid,
+ WORD flags,
+ DISPPARAMS *params,
+ VARIANT *result,
+ EXCEPINFO *excep_info,
+ UINT *arg_err )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ ITypeInfo *typeinfo;
+ HRESULT hr;
+
+ TRACE( "%p, %d, %s, %d, %d, %p, %p, %p, %p\n", security, member, debugstr_guid(riid),
+ lcid, flags, params, result, excep_info, arg_err );
+
+ hr = get_typeinfo( ISWbemSecurity_tid, &typeinfo );
+ if (SUCCEEDED(hr))
+ {
+ hr = ITypeInfo_Invoke( typeinfo, &security->ISWbemSecurity_iface, member, flags,
+ params, result, excep_info, arg_err );
+ ITypeInfo_Release( typeinfo );
+ }
+ return hr;
+}
+
+static HRESULT WINAPI security_get_ImpersonationLevel(
+ ISWbemSecurity *iface,
+ WbemImpersonationLevelEnum *impersonation_level )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %p: stub\n", security, impersonation_level );
+
+ if (!impersonation_level)
+ return E_INVALIDARG;
+
+ *impersonation_level = security->implevel;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_put_ImpersonationLevel(
+ ISWbemSecurity *iface,
+ WbemImpersonationLevelEnum impersonation_level )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %d: stub\n", security, impersonation_level );
+
+ security->implevel = impersonation_level;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_get_AuthenticationLevel(
+ ISWbemSecurity *iface,
+ WbemAuthenticationLevelEnum *authentication_level )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %p: stub\n", security, authentication_level );
+
+ if (!authentication_level)
+ return E_INVALIDARG;
+
+ *authentication_level = security->authlevel;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_put_AuthenticationLevel(
+ ISWbemSecurity *iface,
+ WbemAuthenticationLevelEnum authentication_level )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %d: stub\n", security, authentication_level );
+
+ security->authlevel = authentication_level;
+ return S_OK;
+}
+
+static HRESULT WINAPI security_get_Privileges(
+ ISWbemSecurity *iface,
+ ISWbemPrivilegeSet **privilege_set )
+{
+ struct security *security = impl_from_ISWbemSecurity( iface );
+ FIXME( "%p, %p: stub\n", security, privilege_set );
+
+ if (!privilege_set)
+ return E_INVALIDARG;
+
+ return E_NOTIMPL;
+}
+
+static const ISWbemSecurityVtbl security_vtbl =
+{
+ security_QueryInterface,
+ security_AddRef,
+ security_Release,
+ security_GetTypeInfoCount,
+ security_GetTypeInfo,
+ security_GetIDsOfNames,
+ security_Invoke,
+ security_get_ImpersonationLevel,
+ security_put_ImpersonationLevel,
+ security_get_AuthenticationLevel,
+ security_put_AuthenticationLevel,
+ security_get_Privileges
+};
+
+static HRESULT ISWbemSecurity_create( ISWbemSecurity **obj )
+{
+ struct security *security;
+
+ TRACE( "%p\n", obj );
+
+ if (!(security = heap_alloc( sizeof(*security) ))) return E_OUTOFMEMORY;
+ security->ISWbemSecurity_iface.lpVtbl = &security_vtbl;
+ security->refs = 1;
+ security->implevel = wbemImpersonationLevelImpersonate;
+ security->authlevel = wbemAuthenticationLevelPktPrivacy;
+
+ *obj = &security->ISWbemSecurity_iface;
+ TRACE( "returning iface %p\n", *obj );
+ return S_OK;
+}
--
1.9.1
June 5, 2018
[PATCH v2 2/2] widl: Generate correct size and alignment for all types.
by Zebediah Figura
Using type_memsize_and_alignment() directly instead of reimplementing it.
Also fix the generated tests in oleaut32 to reflect correct sizes for 64-bit
typelibs.
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
dlls/oleaut32/tests/typelib.c | 107 ++++++++++++++++++++++++++----------------
tools/widl/typegen.c | 5 +-
tools/widl/typegen.h | 1 +
tools/widl/write_msft.c | 95 ++++++++-----------------------------
4 files changed, 89 insertions(+), 119 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index f4ad8f9..4d5314e 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -3951,8 +3951,46 @@ static char *print_size(BSTR name, TYPEATTR *attr)
sprintf(buf, "sizeof(union %s)", dump_string(name));
break;
- case TKIND_ENUM:
case TKIND_ALIAS:
+ sprintf(buf, "sizeof(%s)", dump_string(name));
+ break;
+
+ case TKIND_ENUM:
+ sprintf(buf, "4");
+ break;
+
+ default:
+ assert(0);
+ return NULL;
+ }
+
+ return buf;
+}
+
+static char *print_align(BSTR name, TYPEATTR *attr)
+{
+ static char buf[256];
+
+ switch (attr->typekind)
+ {
+ case TKIND_DISPATCH:
+ case TKIND_INTERFACE:
+ sprintf(buf, "TYPE_ALIGNMENT(%s*)", dump_string(name));
+ break;
+
+ case TKIND_RECORD:
+ sprintf(buf, "TYPE_ALIGNMENT(struct %s)", dump_string(name));
+ break;
+
+ case TKIND_UNION:
+ sprintf(buf, "TYPE_ALIGNMENT(union %s)", dump_string(name));
+ break;
+
+ case TKIND_ALIAS:
+ sprintf(buf, "TYPE_ALIGNMENT(%s)", dump_string(name));
+ break;
+
+ case TKIND_ENUM:
sprintf(buf, "4");
break;
@@ -4072,10 +4110,10 @@ static void test_dump_typelib(const char *name)
printf(" \"%s\",\n", wine_dbgstr_guid(&attr->guid));
- printf(" /*kind*/ %s, /*flags*/ %s, /*align*/ %d, /*size*/ %s,\n"
+ printf(" /*kind*/ %s, /*flags*/ %s, /*align*/ %s, /*size*/ %s,\n"
" /*helpctx*/ 0x%04x, /*version*/ 0x%08x, /*#vtbl*/ %d, /*#func*/ %d",
map_value(attr->typekind, tkind_map), dump_type_flags(attr->wTypeFlags),
- attr->cbAlignment, print_size(name, attr),
+ print_align(name, attr), print_size(name, attr),
help_ctx, MAKELONG(attr->wMinorVerNum, attr->wMajorVerNum),
attr->cbSizeVft/sizeof(void*), attr->cFuncs);
@@ -4175,13 +4213,13 @@ static const type_info info[] = {
{
"g",
"{b14b6bb5-904e-4ff9-b247-bd361f7a0001}",
- /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct g),
+ /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct g), /*size*/ sizeof(struct g),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"test_iface",
"{b14b6bb5-904e-4ff9-b247-bd361f7a0002}",
- /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(test_iface*),
+ /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(test_iface*), /*size*/ sizeof(test_iface*),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 4, /*#func*/ 1,
{
{
@@ -4203,7 +4241,7 @@ static const type_info info[] = {
{
"parent_iface",
"{b14b6bb5-904e-4ff9-b247-bd361f7aa001}",
- /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(parent_iface*),
+ /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(parent_iface*), /*size*/ sizeof(parent_iface*),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 4, /*#func*/ 1,
{
{
@@ -4225,7 +4263,7 @@ static const type_info info[] = {
{
"child_iface",
"{b14b6bb5-904e-4ff9-b247-bd361f7aa002}",
- /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(child_iface*),
+ /*kind*/ TKIND_INTERFACE, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(child_iface*), /*size*/ sizeof(child_iface*),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 5, /*#func*/ 1,
{
{
@@ -4245,43 +4283,43 @@ static const type_info info[] = {
{
"_n",
"{016fe2ec-b2c8-45f8-b23b-39e53a753903}",
- /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct _n),
+ /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct _n), /*size*/ sizeof(struct _n),
/*helpctx*/ 0x0003, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0
},
{
"n",
"{016fe2ec-b2c8-45f8-b23b-39e53a753902}",
- /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(n), /*size*/ sizeof(n),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"nn",
"{00000000-0000-0000-0000-000000000000}",
- /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(nn), /*size*/ sizeof(nn),
/*helpctx*/ 0x0003, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0
},
{
"_m",
"{016fe2ec-b2c8-45f8-b23b-39e53a753906}",
- /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct _m),
+ /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct _m), /*size*/ sizeof(struct _m),
/*helpctx*/ 0x0003, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"m",
"{016fe2ec-b2c8-45f8-b23b-39e53a753905}",
- /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(m), /*size*/ sizeof(m),
/*helpctx*/ 0x0000, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0
},
{
"mm",
"{00000000-0000-0000-0000-000000000000}",
- /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(mm), /*size*/ sizeof(mm),
/*helpctx*/ 0x0003, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"IDualIface",
"{b14b6bb5-904e-4ff9-b247-bd361f7aaedd}",
- /*kind*/ TKIND_DISPATCH, /*flags*/ TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL, /*align*/ 4, /*size*/ sizeof(IDualIface*),
+ /*kind*/ TKIND_DISPATCH, /*flags*/ TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL, /*align*/ TYPE_ALIGNMENT(IDualIface*), /*size*/ sizeof(IDualIface*),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 8,
{
{
@@ -4423,7 +4461,7 @@ static const type_info info[] = {
{
"ISimpleIface",
"{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac009}",
- /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ 4, /*size*/ sizeof(ISimpleIface*),
+ /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ TYPE_ALIGNMENT(ISimpleIface*), /*size*/ sizeof(ISimpleIface*),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1,
{
{
@@ -4443,25 +4481,25 @@ static const type_info info[] = {
{
"test_struct",
"{4029f190-ca4a-4611-aeb9-673983cb96dd}",
- /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct),
+ /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct test_struct), /*size*/ sizeof(struct test_struct),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"test_struct2",
"{4029f190-ca4a-4611-aeb9-673983cb96de}",
- /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct2),
+ /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct test_struct2), /*size*/ sizeof(struct test_struct2),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"t_INT",
"{016fe2ec-b2c8-45f8-b23b-39e53a75396a}",
- /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FRESTRICTED, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FRESTRICTED, /*align*/ TYPE_ALIGNMENT(t_INT), /*size*/ sizeof(t_INT),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"a",
"{00000000-0000-0000-0000-000000000000}",
- /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(a), /*size*/ sizeof(a),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
@@ -4491,7 +4529,7 @@ static const type_info info[] = {
{
"c",
"{016fe2ec-b2c8-45f8-b23b-39e53a75396b}",
- /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(c), /*size*/ sizeof(c),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
@@ -4509,7 +4547,7 @@ static const type_info info[] = {
{
"d",
"{016fe2ec-b2c8-45f8-b23b-39e53a75396d}",
- /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(d), /*size*/ sizeof(d),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
@@ -4527,43 +4565,43 @@ static const type_info info[] = {
{
"e",
"{016fe2ec-b2c8-45f8-b23b-39e53a753970}",
- /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(e), /*size*/ sizeof(e),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"_e",
"{00000000-0000-0000-0000-000000000000}",
- /*kind*/ TKIND_RECORD, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ sizeof(struct _e),
+ /*kind*/ TKIND_RECORD, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(struct _e), /*size*/ sizeof(struct _e),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"ee",
"{016fe2ec-b2c8-45f8-b23b-39e53a753971}",
- /*kind*/ TKIND_RECORD, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ sizeof(struct ee),
+ /*kind*/ TKIND_RECORD, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(struct ee), /*size*/ sizeof(struct ee),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"f",
"{016fe2ec-b2c8-45f8-b23b-39e53a753972}",
- /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ 4,
+ /*kind*/ TKIND_ALIAS, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(f), /*size*/ sizeof(f),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"_f",
"{00000000-0000-0000-0000-000000000000}",
- /*kind*/ TKIND_UNION, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ sizeof(union _f),
+ /*kind*/ TKIND_UNION, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(union _f), /*size*/ sizeof(union _f),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"ff",
"{016fe2ec-b2c8-45f8-b23b-39e53a753973}",
- /*kind*/ TKIND_UNION, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ 4, /*size*/ sizeof(union ff),
+ /*kind*/ TKIND_UNION, /*flags*/ TYPEFLAG_FRESTRICTED|TYPEFLAG_FHIDDEN, /*align*/ TYPE_ALIGNMENT(union ff), /*size*/ sizeof(union ff),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
},
{
"ITestIface",
"{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac00a}",
- /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ 4, /*size*/ sizeof(ITestIface*),
+ /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ TYPE_ALIGNMENT(ITestIface*), /*size*/ sizeof(ITestIface*),
/*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 13, /*#func*/ 6,
{
{
@@ -4686,21 +4724,8 @@ static void test_dump_typelib(const char *name)
ole_check(ITypeInfo_GetTypeAttr(typeinfo, &typeattr));
expect_int(typeattr->typekind, ti->type);
expect_hex(typeattr->wTypeFlags, ti->wTypeFlags);
- /* FIXME: remove once widl is fixed */
- if (typeattr->typekind == TKIND_ALIAS && typeattr->cbAlignment != ti->cbAlignment)
- {
-todo_wine /* widl generates broken typelib and typeattr just reflects that */
- ok(typeattr->cbAlignment == ti->cbAlignment || broken(typeattr->cbAlignment == 1),
- "expected %d, got %d\n", ti->cbAlignment, typeattr->cbAlignment);
-todo_wine /* widl generates broken typelib and typeattr just reflects that */
- ok(typeattr->cbSizeInstance == ti->cbSizeInstance || broken(typeattr->cbSizeInstance == 0),
- "expected %d, got %d\n", ti->cbSizeInstance, typeattr->cbSizeInstance);
- }
- else
- {
expect_int(typeattr->cbAlignment, ti->cbAlignment);
expect_int(typeattr->cbSizeInstance, ti->cbSizeInstance);
- }
expect_int(help_ctx, ti->help_ctx);
expect_int(MAKELONG(typeattr->wMinorVerNum, typeattr->wMajorVerNum), ti->version);
expect_int(typeattr->cbSizeVft, ti->cbSizeVft * sizeof(void*));
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 9f62589..38cbfa0 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -84,7 +84,6 @@ static const unsigned short IsSimpleRef = 0x0100;
static unsigned int field_memsize(const type_t *type, unsigned int *offset);
static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align);
-static unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align);
static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type,
const char *name, unsigned int *typestring_offset);
static unsigned int write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff);
@@ -1841,7 +1840,7 @@ static unsigned int union_memsize(const var_list_t *fields, unsigned int *pmaxa)
return maxs;
}
-static unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align)
+unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align)
{
unsigned int size = 0;
@@ -1910,6 +1909,7 @@ static unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *al
size = union_memsize(type_union_get_cases(t), align);
break;
case TYPE_POINTER:
+ case TYPE_INTERFACE:
assert( pointer_size );
size = pointer_size;
if (size > *align) *align = size;
@@ -1933,7 +1933,6 @@ static unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *al
if (size > *align) *align = size;
}
break;
- case TYPE_INTERFACE:
case TYPE_ALIAS:
case TYPE_VOID:
case TYPE_COCLASS:
diff --git a/tools/widl/typegen.h b/tools/widl/typegen.h
index b6540e2..95ad601 100644
--- a/tools/widl/typegen.h
+++ b/tools/widl/typegen.h
@@ -100,3 +100,4 @@ unsigned char get_basic_fc(const type_t *type);
unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int toplevel_param);
unsigned char get_struct_fc(const type_t *type);
enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *attrs, unsigned int flags);
+unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align);
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index f7e53e4..b1f467d 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -52,6 +52,7 @@
#include "hash.h"
#include "typetree.h"
#include "parser.h"
+#include "typegen.h"
enum MSFT_segment_index {
MSFT_SEG_TYPEINFO = 0, /* type information */
@@ -780,8 +781,6 @@ static int encode_type(
int vt, /* [I] vt to encode */
type_t *type, /* [I] type */
int *encoded_type, /* [O] The encoded type description. */
- int *width, /* [O] The width of the type, or NULL. */
- int *alignment, /* [O] The alignment of the type, or NULL. */
int *decoded_size) /* [O] The total size of the unencoded TYPEDESCs, including nested descs. */
{
int default_type;
@@ -794,8 +793,6 @@ static int encode_type(
chat("encode_type vt %d type %p\n", vt, type);
default_type = 0x80000000 | (vt << 16) | vt;
- if (!width) width = &scratch;
- if (!alignment) alignment = &scratch;
if (!decoded_size) decoded_size = &scratch;
*decoded_size = 0;
@@ -804,38 +801,20 @@ static int encode_type(
case VT_I1:
case VT_UI1:
*encoded_type = default_type;
- *width = 1;
- *alignment = 1;
break;
case VT_INT:
*encoded_type = 0x80000000 | (VT_I4 << 16) | VT_INT;
- if ((typelib->typelib_header.varflags & 0x0f) == SYS_WIN16) {
- *width = 2;
- *alignment = 2;
- } else {
- *width = 4;
- *alignment = 4;
- }
break;
case VT_UINT:
*encoded_type = 0x80000000 | (VT_UI4 << 16) | VT_UINT;
- if ((typelib->typelib_header.varflags & 0x0f) == SYS_WIN16) {
- *width = 2;
- *alignment = 2;
- } else {
- *width = 4;
- *alignment = 4;
- }
break;
case VT_UI2:
case VT_I2:
case VT_BOOL:
*encoded_type = default_type;
- *width = 2;
- *alignment = 2;
break;
case VT_I4:
@@ -844,56 +823,40 @@ static int encode_type(
case VT_ERROR:
case VT_HRESULT:
*encoded_type = default_type;
- *width = 4;
- *alignment = 4;
break;
case VT_R8:
case VT_I8:
case VT_UI8:
*encoded_type = default_type;
- *width = 8;
- *alignment = 8;
break;
case VT_CY:
case VT_DATE:
*encoded_type = default_type;
- *width = 8;
- *alignment = 8;
break;
case VT_DECIMAL:
*encoded_type = default_type;
- *width = 16;
- *alignment = 8;
break;
case VT_VOID:
*encoded_type = 0x80000000 | (VT_EMPTY << 16) | vt;
- *width = 0;
- *alignment = 1;
break;
case VT_UNKNOWN:
case VT_DISPATCH:
case VT_BSTR:
*encoded_type = default_type;
- *width = pointer_size;
- *alignment = 4;
break;
case VT_VARIANT:
*encoded_type = default_type;
- *width = 8 + 2 * pointer_size;
- *alignment = 8;
break;
case VT_LPSTR:
case VT_LPWSTR:
*encoded_type = 0xfffe0000 | vt;
- *width = pointer_size;
- *alignment = 4;
break;
case VT_PTR:
@@ -909,14 +872,12 @@ static int encode_type(
next_vt = VT_VOID;
encode_type(typelib, next_vt, type_pointer_get_ref(type),
- &target_type, NULL, NULL, &child_size);
+ &target_type, &child_size);
/* these types already have an implicit pointer, so we don't need to
* add another */
if(next_vt == VT_DISPATCH || next_vt == VT_UNKNOWN) {
chat("encode_type: skipping ptr\n");
*encoded_type = target_type;
- *width = pointer_size;
- *alignment = 4;
*decoded_size = child_size;
break;
}
@@ -945,8 +906,6 @@ static int encode_type(
*encoded_type = typeoffset;
- *width = pointer_size;
- *alignment = 4;
*decoded_size = 8 /*sizeof(TYPEDESC)*/ + child_size;
break;
}
@@ -956,7 +915,8 @@ static int encode_type(
type_t *element_type = type_alias_get_aliasee(type_array_get_element(type));
int next_vt = get_type_vt(element_type);
- encode_type(typelib, next_vt, type_alias_get_aliasee(type_array_get_element(type)), &target_type, NULL, NULL, &child_size);
+ encode_type(typelib, next_vt, type_alias_get_aliasee(type_array_get_element(type)),
+ &target_type, &child_size);
for (typeoffset = 0; typeoffset < typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length; typeoffset += 8) {
typedata = (void *)&typelib->typelib_segment_data[MSFT_SEG_TYPEDESC][typeoffset];
@@ -982,8 +942,6 @@ static int encode_type(
*encoded_type = typeoffset;
- *width = pointer_size;
- *alignment = 4;
*decoded_size = 8 /*sizeof(TYPEDESC)*/ + child_size;
break;
}
@@ -1053,16 +1011,12 @@ static int encode_type(
}
*encoded_type = typeoffset;
- *width = 0;
- *alignment = 1;
break;
}
default:
error("encode_type: unrecognized type %d.\n", vt);
*encoded_type = default_type;
- *width = 0;
- *alignment = 1;
break;
}
@@ -1079,8 +1033,6 @@ static int encode_var(
type_t *type, /* [I] The type description to encode. */
var_t *var, /* [I] The var to encode. */
int *encoded_type, /* [O] The encoded type description. */
- int *width, /* [O] The width of the type, or NULL. */
- int *alignment, /* [O] The alignment of the type, or NULL. */
int *decoded_size) /* [O] The total size of the unencoded TYPEDESCs, including nested descs. */
{
int typeoffset;
@@ -1090,8 +1042,6 @@ static int encode_var(
int vt;
int scratch;
- if (!width) width = &scratch;
- if (!alignment) alignment = &scratch;
if (!decoded_size) decoded_size = &scratch;
*decoded_size = 0;
@@ -1110,7 +1060,7 @@ static int encode_var(
++num_dims;
chat("array with %d dimensions\n", num_dims);
- encode_var(typelib, atype, var, &target_type, width, alignment, NULL);
+ encode_var(typelib, atype, var, &target_type, NULL);
arrayoffset = ctl2_alloc_segment(typelib, MSFT_SEG_ARRAYDESC, (2 + 2 * num_dims) * sizeof(int), 0);
arraydata = (void *)&typelib->typelib_segment_data[MSFT_SEG_ARRAYDESC][arrayoffset];
@@ -1136,7 +1086,6 @@ static int encode_var(
typedata[1] = arrayoffset;
*encoded_type = typeoffset;
- *width = *width * elements;
*decoded_size = 20 /*sizeof(ARRAYDESC)*/ + (num_dims - 1) * 8 /*sizeof(SAFEARRAYBOUND)*/;
return 0;
}
@@ -1145,15 +1094,12 @@ static int encode_var(
if (vt == VT_PTR) {
type_t *ref = is_ptr(type) ?
type_pointer_get_ref(type) : type_array_get_element(type);
- int skip_ptr = encode_var(typelib, ref, var,
- &target_type, NULL, NULL, &child_size);
+ int skip_ptr = encode_var(typelib, ref, var, &target_type, &child_size);
if(skip_ptr == 2) {
chat("encode_var: skipping ptr\n");
*encoded_type = target_type;
*decoded_size = child_size;
- *width = pointer_size;
- *alignment = 4;
return 0;
}
@@ -1184,15 +1130,13 @@ static int encode_var(
*encoded_type = typeoffset;
- *width = pointer_size;
- *alignment = 4;
*decoded_size = 8 /*sizeof(TYPEDESC)*/ + child_size;
return 0;
}
dump_type(type);
- encode_type(typelib, vt, type, encoded_type, width, alignment, decoded_size);
+ encode_type(typelib, vt, type, encoded_type, decoded_size);
/* these types already have an implicit pointer, so we don't need to
* add another */
if(vt == VT_DISPATCH || vt == VT_UNKNOWN) return 2;
@@ -1504,7 +1448,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
/* fill out the basic type information */
typedata[0] = typedata_size | (index << 16);
- encode_var(typeinfo->typelib, type_function_get_rettype(func->type), func, &typedata[1], NULL, NULL, &decoded_size);
+ encode_var(typeinfo->typelib, type_function_get_rettype(func->type), func,
+ &typedata[1], &decoded_size);
typedata[2] = funcflags;
typedata[3] = ((52 /*sizeof(FUNCDESC)*/ + decoded_size) << 16) | typeinfo->typeinfo->cbSizeVft;
typedata[4] = (next_idx << 16) | (callconv << 8) | (invokekind << 3) | funckind;
@@ -1541,7 +1486,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index)
if(defaultdata) *defaultdata = -1;
- encode_var(typeinfo->typelib, arg->type, arg, paramdata, NULL, NULL, &decoded_size);
+ encode_var(typeinfo->typelib, arg->type, arg, paramdata, &decoded_size);
if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
switch(attr->type) {
case ATTR_DEFAULTVALUE:
@@ -1667,8 +1612,7 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
int offset, id;
unsigned int typedata_size;
INT *typedata;
- int var_datawidth;
- int var_alignment;
+ unsigned int var_datawidth, var_alignment = 0;
int var_type_size, var_kind = 0 /* VAR_PERINSTANCE */;
int alignment;
int varflags = 0;
@@ -1770,8 +1714,8 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
typeinfo->var_offsets[var_num] = offset;
/* figure out type widths and whatnot */
- encode_var(typeinfo->typelib, var->type, var, &typedata[1], &var_datawidth,
- &var_alignment, &var_type_size);
+ var_datawidth = type_memsize_and_alignment(var->type, &var_alignment);
+ encode_var(typeinfo->typelib, var->type, var, &typedata[1], &var_type_size);
/* pad out starting position to data width */
typeinfo->datawidth += var_alignment - 1;
@@ -1795,7 +1739,6 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
case TKIND_DISPATCH:
var_kind = 3; /* VAR_DISPATCH */
typeinfo->datawidth = pointer_size;
- var_alignment = 4;
break;
default:
error("add_var_desc: unhandled type kind %d\n", typeinfo->typekind);
@@ -2073,7 +2016,7 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
dispinterface->attrs);
msft_typeinfo->typeinfo->size = pointer_size;
- msft_typeinfo->typeinfo->typekind |= 0x2100;
+ msft_typeinfo->typeinfo->typekind |= pointer_size << 11 | pointer_size << 6;
msft_typeinfo->typeinfo->flags |= 0x1000; /* TYPEFLAG_FDISPATCHABLE */
add_dispatch(typelib);
@@ -2162,7 +2105,8 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
interface->typelib_idx = typelib->typelib_header.nrtypeinfos;
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_INTERFACE, interface->name, interface->attrs);
msft_typeinfo->typeinfo->size = pointer_size;
- msft_typeinfo->typeinfo->typekind |= 0x2200;
+ msft_typeinfo->typeinfo->typekind |= 0x0200;
+ msft_typeinfo->typeinfo->typekind |= pointer_size << 11;
for (derived = inherit; derived; derived = type_iface_get_inherit(derived))
if (derived->name && !strcmp(derived->name, "IDispatch"))
@@ -2247,7 +2191,8 @@ static void add_union_typeinfo(msft_typelib_t *typelib, type_t *tunion)
static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
{
msft_typeinfo_t *msft_typeinfo = NULL;
- int alignment, datatype1, datatype2, size, duplicate = 0;
+ int datatype1, datatype2, duplicate = 0;
+ unsigned int size, alignment = 0;
type_t *type;
if (-1 < tdef->typelib_idx)
@@ -2263,8 +2208,8 @@ static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
else
duplicate = 1;
- encode_type(typelib, get_type_vt(type), type,
- &datatype1, &size, &alignment, &datatype2);
+ encode_type(typelib, get_type_vt(type), type, &datatype1, &datatype2);
+ size = type_memsize_and_alignment(type, &alignment);
if (msft_typeinfo)
{
--
2.7.4
June 4, 2018
[PATCH v2 1/2] stdole2.idl: Use more accurate sizes for Automation types.
by Zebediah Figura
Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com>
---
include/stdole2.idl | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/stdole2.idl b/include/stdole2.idl
index 18c402a..d372384 100644
--- a/include/stdole2.idl
+++ b/include/stdole2.idl
@@ -32,15 +32,15 @@
]
library stdole
{
- /* typedefs aren't stored in the type library.
- These type names are known by the type compiler so it
- doesn't really matter what we define them as. */
-
+ /* These typedefs need to have the same size as their real counterparts. */
typedef short VARIANT_BOOL;
- typedef long BSTR;
+ typedef void *BSTR;
typedef double CURRENCY;
typedef unsigned long HRESULT;
- typedef void *VARIANT;
+ typedef struct {
+ short word1, word2, word3, word4;
+ void *ptr1, *ptr2;
+ } VARIANT;
typedef unsigned long SCODE;
typedef struct GUID {
--
2.7.4
June 4, 2018
Re: [PATCH 1/4] oleaut32/tests: Fix alignment for generated tests on 64-bit.
by Zebediah Figura
On 04/06/18 04:02, Huw Davies wrote:
> On Sun, Jun 03, 2018 at 02:51:11PM -0500, Zebediah Figura wrote:
>> On 03/06/18 13:58, Marvin wrote:
>>> Hi,
>>>
>>> While running your changed tests on Windows, I think I found new failures.
>>> Being a bot and all I'm not very good at pattern recognition, so I might be
>>> wrong, but could you please double-check?
>>> Full results can be found at
>>> https://testbot.winehq.org/JobDetails.pl?Key=38913
>>>
>>> Your paranoid android.
>>>
>>>
>>> === wvistau64 (64 bit typelib) ===
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>> typelib.c:4733: Test failed: typeattr->cbAlignment expected 8 got 4
>>>
>> These failures are shortcomings in widl exposed by these patches; they
>> are fixed in patch 4/4.
>
> You'll probably have to merge some of the patches in this series
> to avoid test failures at intermediate stages.
>
> Huw.
>
>
Thanks; I'll resend it with the widl and oleaut32 patches merged.
June 4, 2018
[PATCH 2/2] d3dx9/tests: Use ARRAY_SIZE() in the initialization of registerset_data[]
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
The formatting of the array initialization was inconsistent.
So I've made it consitent by placing the arrays and their size on one
line. All lines are below < 120 chars in length.
Initially I've tried to just stick to a line length of 100 or 120 but that
made the data look ugly.
To verify that the diff is a no-op I have added 77 empty lines as
padding after the whole registerset_data array initialization. That
produced the exact same object file as without this patch.
dlls/d3dx9_36/tests/shader.c | 383 +++++++++++++++++--------------------------
1 file changed, 153 insertions(+), 230 deletions(-)
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index c2b41cfdc7..1086e5e9d6 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -5675,267 +5675,190 @@ static const struct
registerset_data[] =
{
/* scalar */
- {"float", "f", 0, D3DXRS_FLOAT4, registerset_blob_scalar, registerset_test_scalar_float,
- sizeof(registerset_test_scalar_float) / sizeof(*registerset_test_scalar_float),
- registerset_constants_scalar_float,
- sizeof(registerset_constants_scalar_float) / sizeof(*registerset_constants_scalar_float)},
- {"int", "n", 0, D3DXRS_INT4, registerset_blob_scalar, registerset_test_scalar_int,
- sizeof(registerset_test_scalar_int) / sizeof(*registerset_test_scalar_int),
- registerset_constants_scalar_int,
- sizeof(registerset_constants_scalar_int) / sizeof(*registerset_constants_scalar_int)},
- {"int float", "nf", 4, D3DXRS_FLOAT4, registerset_blob_scalar, registerset_test_scalar_int_float,
- sizeof(registerset_test_scalar_int_float) / sizeof(*registerset_test_scalar_int_float),
- registerset_constants_scalar_int_float,
- sizeof(registerset_constants_scalar_int_float) / sizeof(*registerset_constants_scalar_int_float)},
- {"bool float", "bf", 8, D3DXRS_FLOAT4, registerset_blob_scalar, registerset_test_scalar_bool_float,
- sizeof(registerset_test_scalar_bool_float) / sizeof(*registerset_test_scalar_bool_float),
- registerset_constants_scalar_bool_float,
- sizeof(registerset_constants_scalar_bool_float) / sizeof(*registerset_constants_scalar_bool_float)},
- {"bool", "b", 0, D3DXRS_BOOL, registerset_blob_scalar, registerset_test_scalar_bool,
- sizeof(registerset_test_scalar_bool) / sizeof(*registerset_test_scalar_bool),
- registerset_constants_scalar_bool,
- sizeof(registerset_constants_scalar_bool) / sizeof(*registerset_constants_scalar_bool)},
+ {"float", "f", 0, D3DXRS_FLOAT4, registerset_blob_scalar,
+ registerset_test_scalar_float, ARRAY_SIZE(registerset_test_scalar_float),
+ registerset_constants_scalar_float, ARRAY_SIZE(registerset_constants_scalar_float)},
+ {"int", "n", 0, D3DXRS_INT4, registerset_blob_scalar,
+ registerset_test_scalar_int, ARRAY_SIZE(registerset_test_scalar_int),
+ registerset_constants_scalar_int, ARRAY_SIZE(registerset_constants_scalar_int)},
+ {"int float", "nf", 4, D3DXRS_FLOAT4, registerset_blob_scalar,
+ registerset_test_scalar_int_float, ARRAY_SIZE(registerset_test_scalar_int_float),
+ registerset_constants_scalar_int_float, ARRAY_SIZE(registerset_constants_scalar_int_float)},
+ {"bool float", "bf", 8, D3DXRS_FLOAT4, registerset_blob_scalar,
+ registerset_test_scalar_bool_float, ARRAY_SIZE(registerset_test_scalar_bool_float),
+ registerset_constants_scalar_bool_float, ARRAY_SIZE(registerset_constants_scalar_bool_float)},
+ {"bool", "b", 0, D3DXRS_BOOL, registerset_blob_scalar,
+ registerset_test_scalar_bool, ARRAY_SIZE(registerset_test_scalar_bool),
+ registerset_constants_scalar_bool, ARRAY_SIZE(registerset_constants_scalar_bool)},
/* scalar array */
- {"float [2]", "af", 0, D3DXRS_FLOAT4, registerset_blob_scalar_array, registerset_test_scalar_array_float,
- sizeof(registerset_test_scalar_array_float) / sizeof(*registerset_test_scalar_array_float),
- registerset_constants_scalar_array_float,
- sizeof(registerset_constants_scalar_array_float) / sizeof(*registerset_constants_scalar_array_float)},
- {"int [2]", "an", 0, D3DXRS_INT4, registerset_blob_scalar_array, registerset_test_scalar_array_int,
- sizeof(registerset_test_scalar_array_int) / sizeof(*registerset_test_scalar_array_int),
- registerset_constants_scalar_array_int,
- sizeof(registerset_constants_scalar_array_int) / sizeof(*registerset_constants_scalar_array_int)},
- {"bool [2]", "ab", 0, D3DXRS_BOOL, registerset_blob_scalar_array, registerset_test_scalar_array_bool,
- sizeof(registerset_test_scalar_array_bool) / sizeof(*registerset_test_scalar_array_bool),
- registerset_constants_scalar_array_bool,
- sizeof(registerset_constants_scalar_array_bool) / sizeof(*registerset_constants_scalar_array_bool)},
+ {"float [2]", "af", 0, D3DXRS_FLOAT4, registerset_blob_scalar_array,
+ registerset_test_scalar_array_float, ARRAY_SIZE(registerset_test_scalar_array_float),
+ registerset_constants_scalar_array_float, ARRAY_SIZE(registerset_constants_scalar_array_float)},
+ {"int [2]", "an", 0, D3DXRS_INT4, registerset_blob_scalar_array,
+ registerset_test_scalar_array_int, ARRAY_SIZE(registerset_test_scalar_array_int),
+ registerset_constants_scalar_array_int, ARRAY_SIZE(registerset_constants_scalar_array_int)},
+ {"bool [2]", "ab", 0, D3DXRS_BOOL, registerset_blob_scalar_array,
+ registerset_test_scalar_array_bool, ARRAY_SIZE(registerset_test_scalar_array_bool),
+ registerset_constants_scalar_array_bool, ARRAY_SIZE(registerset_constants_scalar_array_bool)},
{"int float [2]", "anf", 8, D3DXRS_FLOAT4, registerset_blob_scalar_array,
- registerset_test_scalar_array_int_float,
- sizeof(registerset_test_scalar_array_int_float) / sizeof(*registerset_test_scalar_array_int_float),
- registerset_constants_scalar_array_int_float,
- sizeof(registerset_constants_scalar_array_int_float) / sizeof(*registerset_constants_scalar_array_int_float)},
+ registerset_test_scalar_array_int_float, ARRAY_SIZE(registerset_test_scalar_array_int_float),
+ registerset_constants_scalar_array_int_float, ARRAY_SIZE(registerset_constants_scalar_array_int_float)},
{"bool float [2]", "abf", 16, D3DXRS_FLOAT4, registerset_blob_scalar_array,
- registerset_test_scalar_array_bool_float,
- sizeof(registerset_test_scalar_array_bool_float) / sizeof(*registerset_test_scalar_array_bool_float),
- registerset_constants_scalar_array_bool_float,
- sizeof(registerset_constants_scalar_array_bool_float) / sizeof(*registerset_constants_scalar_array_bool_float)},
+ registerset_test_scalar_array_bool_float, ARRAY_SIZE(registerset_test_scalar_array_bool_float),
+ registerset_constants_scalar_array_bool_float, ARRAY_SIZE(registerset_constants_scalar_array_bool_float)},
/* vector */
- {"float 3", "vf", 0, D3DXRS_FLOAT4, registerset_blob_vector, registerset_test_vector_float,
- sizeof(registerset_test_vector_float) / sizeof(*registerset_test_vector_float),
- registerset_constants_vector_float,
- sizeof(registerset_constants_vector_float) / sizeof(*registerset_constants_vector_float)},
- {"int 3", "vn", 0, D3DXRS_INT4, registerset_blob_vector, registerset_test_vector_int,
- sizeof(registerset_test_vector_int) / sizeof(*registerset_test_vector_int),
- registerset_constants_vector_int,
- sizeof(registerset_constants_vector_int) / sizeof(*registerset_constants_vector_int)},
- {"bool 3", "vb", 0, D3DXRS_BOOL, registerset_blob_vector, registerset_test_vector_bool,
- sizeof(registerset_test_vector_bool) / sizeof(*registerset_test_vector_bool),
- registerset_constants_vector_bool,
- sizeof(registerset_constants_vector_bool) / sizeof(*registerset_constants_vector_bool)},
- {"bool float 3", "vbf", 8, D3DXRS_FLOAT4, registerset_blob_vector, registerset_test_vector_bool_float,
- sizeof(registerset_test_vector_bool_float) / sizeof(*registerset_test_vector_bool_float),
- registerset_constants_vector_bool_float,
- sizeof(registerset_constants_vector_bool_float) / sizeof(*registerset_constants_vector_bool_float)},
- {"int float 3", "vnf", 4, D3DXRS_FLOAT4, registerset_blob_vector, registerset_test_vector_int_float,
- sizeof(registerset_test_vector_int_float) / sizeof(*registerset_test_vector_int_float),
- registerset_constants_vector_int_float,
- sizeof(registerset_constants_vector_int_float) / sizeof(*registerset_constants_vector_int_float)},
+ {"float 3", "vf", 0, D3DXRS_FLOAT4, registerset_blob_vector,
+ registerset_test_vector_float, ARRAY_SIZE(registerset_test_vector_float),
+ registerset_constants_vector_float, ARRAY_SIZE(registerset_constants_vector_float)},
+ {"int 3", "vn", 0, D3DXRS_INT4, registerset_blob_vector,
+ registerset_test_vector_int, ARRAY_SIZE(registerset_test_vector_int),
+ registerset_constants_vector_int, ARRAY_SIZE(registerset_constants_vector_int)},
+ {"bool 3", "vb", 0, D3DXRS_BOOL, registerset_blob_vector,
+ registerset_test_vector_bool, ARRAY_SIZE(registerset_test_vector_bool),
+ registerset_constants_vector_bool, ARRAY_SIZE(registerset_constants_vector_bool)},
+ {"bool float 3", "vbf", 8, D3DXRS_FLOAT4, registerset_blob_vector,
+ registerset_test_vector_bool_float, ARRAY_SIZE(registerset_test_vector_bool_float),
+ registerset_constants_vector_bool_float, ARRAY_SIZE(registerset_constants_vector_bool_float)},
+ {"int float 3", "vnf", 4, D3DXRS_FLOAT4, registerset_blob_vector,
+ registerset_test_vector_int_float, ARRAY_SIZE(registerset_test_vector_int_float),
+ registerset_constants_vector_int_float, ARRAY_SIZE(registerset_constants_vector_int_float)},
/* vector array */
- {"float 3 [2]", "vaf", 0, D3DXRS_FLOAT4, registerset_blob_vector_array, registerset_test_vector_array_float,
- sizeof(registerset_test_vector_array_float) / sizeof(*registerset_test_vector_array_float),
- registerset_constants_vector_array_float,
- sizeof(registerset_constants_vector_array_float) / sizeof(*registerset_constants_vector_array_float)},
- {"int 3 [2]", "van", 0, D3DXRS_INT4, registerset_blob_vector_array, registerset_test_vector_array_int,
- sizeof(registerset_test_vector_array_int) / sizeof(*registerset_test_vector_array_int),
- registerset_constants_vector_array_int,
- sizeof(registerset_constants_vector_array_int) / sizeof(*registerset_constants_vector_array_int)},
- {"bool 3 [2]", "vab", 0, D3DXRS_BOOL, registerset_blob_vector_array, registerset_test_vector_array_bool,
- sizeof(registerset_test_vector_array_bool) / sizeof(*registerset_test_vector_array_bool),
- registerset_constants_vector_array_bool,
- sizeof(registerset_constants_vector_array_bool) / sizeof(*registerset_constants_vector_array_bool)},
+ {"float 3 [2]", "vaf", 0, D3DXRS_FLOAT4, registerset_blob_vector_array,
+ registerset_test_vector_array_float, ARRAY_SIZE(registerset_test_vector_array_float),
+ registerset_constants_vector_array_float, ARRAY_SIZE(registerset_constants_vector_array_float)},
+ {"int 3 [2]", "van", 0, D3DXRS_INT4, registerset_blob_vector_array,
+ registerset_test_vector_array_int, ARRAY_SIZE(registerset_test_vector_array_int),
+ registerset_constants_vector_array_int, ARRAY_SIZE(registerset_constants_vector_array_int)},
+ {"bool 3 [2]", "vab", 0, D3DXRS_BOOL, registerset_blob_vector_array,
+ registerset_test_vector_array_bool, ARRAY_SIZE(registerset_test_vector_array_bool),
+ registerset_constants_vector_array_bool, ARRAY_SIZE(registerset_constants_vector_array_bool)},
{"bool float 3 [2]", "vabf", 16, D3DXRS_FLOAT4, registerset_blob_vector_array,
- registerset_test_vector_array_bool_float,
- sizeof(registerset_test_vector_array_bool_float) / sizeof(*registerset_test_vector_array_bool_float),
- registerset_constants_vector_array_bool_float,
- sizeof(registerset_constants_vector_array_bool_float) / sizeof(*registerset_constants_vector_array_bool_float)},
+ registerset_test_vector_array_bool_float, ARRAY_SIZE(registerset_test_vector_array_bool_float),
+ registerset_constants_vector_array_bool_float, ARRAY_SIZE(registerset_constants_vector_array_bool_float)},
{"int float 3 [2]", "vanf", 8, D3DXRS_FLOAT4, registerset_blob_vector_array,
- registerset_test_vector_array_int_float,
- sizeof(registerset_test_vector_array_int_float) / sizeof(*registerset_test_vector_array_int_float),
- registerset_constants_vector_array_int_float,
- sizeof(registerset_constants_vector_array_int_float) / sizeof(*registerset_constants_vector_array_int_float)},
+ registerset_test_vector_array_int_float, ARRAY_SIZE(registerset_test_vector_array_int_float),
+ registerset_constants_vector_array_int_float, ARRAY_SIZE(registerset_constants_vector_array_int_float)},
/* matrix column */
- {"float c3x2", "cf", 0, D3DXRS_FLOAT4, registerset_blob_column, registerset_test_column_float,
- sizeof(registerset_test_column_float) / sizeof(*registerset_test_column_float),
- registerset_constants_column_float,
- sizeof(registerset_constants_column_float) / sizeof(*registerset_constants_column_float)},
- {"int c3x2", "cn", 0, D3DXRS_INT4, registerset_blob_column, registerset_test_column_int,
- sizeof(registerset_test_column_int) / sizeof(*registerset_test_column_int),
- registerset_constants_column_int,
- sizeof(registerset_constants_column_int) / sizeof(*registerset_constants_column_int)},
- {"bool c3x2", "cb", 0, D3DXRS_BOOL, registerset_blob_column, registerset_test_column_bool,
- sizeof(registerset_test_column_bool) / sizeof(*registerset_test_column_bool),
- registerset_constants_column_bool,
- sizeof(registerset_constants_column_bool) / sizeof(*registerset_constants_column_bool)},
+ {"float c3x2", "cf", 0, D3DXRS_FLOAT4, registerset_blob_column,
+ registerset_test_column_float, ARRAY_SIZE(registerset_test_column_float),
+ registerset_constants_column_float, ARRAY_SIZE(registerset_constants_column_float)},
+ {"int c3x2", "cn", 0, D3DXRS_INT4, registerset_blob_column,
+ registerset_test_column_int, ARRAY_SIZE(registerset_test_column_int),
+ registerset_constants_column_int, ARRAY_SIZE(registerset_constants_column_int)},
+ {"bool c3x2", "cb", 0, D3DXRS_BOOL, registerset_blob_column,
+ registerset_test_column_bool, ARRAY_SIZE(registerset_test_column_bool),
+ registerset_constants_column_bool, ARRAY_SIZE(registerset_constants_column_bool)},
{"bool float c3x2", "cbf", 8, D3DXRS_FLOAT4, registerset_blob_column,
- registerset_test_column_bool_float,
- sizeof(registerset_test_column_bool_float) / sizeof(*registerset_test_column_bool_float),
- registerset_constants_column_bool_float,
- sizeof(registerset_constants_column_bool_float) / sizeof(*registerset_constants_column_bool_float)},
+ registerset_test_column_bool_float, ARRAY_SIZE(registerset_test_column_bool_float),
+ registerset_constants_column_bool_float, ARRAY_SIZE(registerset_constants_column_bool_float)},
{"int float c3x2", "cnf", 16, D3DXRS_FLOAT4, registerset_blob_column,
- registerset_test_column_int_float,
- sizeof(registerset_test_column_int_float) / sizeof(*registerset_test_column_int_float),
- registerset_constants_column_int_float,
- sizeof(registerset_constants_column_int_float) / sizeof(*registerset_constants_column_int_float)},
+ registerset_test_column_int_float, ARRAY_SIZE(registerset_test_column_int_float),
+ registerset_constants_column_int_float, ARRAY_SIZE(registerset_constants_column_int_float)},
/* matrix column array */
- {"float c3x2 [2]", "caf", 0, D3DXRS_FLOAT4, registerset_blob_column_array, registerset_test_column_array_float,
- sizeof(registerset_test_column_array_float) / sizeof(*registerset_test_column_array_float),
- registerset_constants_column_array_float,
- sizeof(registerset_constants_column_array_float) / sizeof(*registerset_constants_column_array_float)},
- {"int c3x2 [2]", "can", 0, D3DXRS_INT4, registerset_blob_column_array, registerset_test_column_array_int,
- sizeof(registerset_test_column_array_int) / sizeof(*registerset_test_column_array_int),
- registerset_constants_column_array_int,
- sizeof(registerset_constants_column_array_int) / sizeof(*registerset_constants_column_array_int)},
- {"bool c3x2 [2]", "cab", 0, D3DXRS_BOOL, registerset_blob_column_array, registerset_test_column_array_bool,
- sizeof(registerset_test_column_array_bool) / sizeof(*registerset_test_column_array_bool),
- registerset_constants_column_array_bool,
- sizeof(registerset_constants_column_array_bool) / sizeof(*registerset_constants_column_array_bool)},
+ {"float c3x2 [2]", "caf", 0, D3DXRS_FLOAT4, registerset_blob_column_array,
+ registerset_test_column_array_float, ARRAY_SIZE(registerset_test_column_array_float),
+ registerset_constants_column_array_float, ARRAY_SIZE(registerset_constants_column_array_float)},
+ {"int c3x2 [2]", "can", 0, D3DXRS_INT4, registerset_blob_column_array,
+ registerset_test_column_array_int, ARRAY_SIZE(registerset_test_column_array_int),
+ registerset_constants_column_array_int, ARRAY_SIZE(registerset_constants_column_array_int)},
+ {"bool c3x2 [2]", "cab", 0, D3DXRS_BOOL, registerset_blob_column_array,
+ registerset_test_column_array_bool, ARRAY_SIZE(registerset_test_column_array_bool),
+ registerset_constants_column_array_bool, ARRAY_SIZE(registerset_constants_column_array_bool)},
{"bool float c3x2 [2]", "cabf", 16, D3DXRS_FLOAT4, registerset_blob_column_array,
- registerset_test_column_array_bool_float,
- sizeof(registerset_test_column_array_bool_float) / sizeof(*registerset_test_column_array_bool_float),
- registerset_constants_column_array_bool_float,
- sizeof(registerset_constants_column_array_bool_float) / sizeof(*registerset_constants_column_array_bool_float)},
+ registerset_test_column_array_bool_float, ARRAY_SIZE(registerset_test_column_array_bool_float),
+ registerset_constants_column_array_bool_float, ARRAY_SIZE(registerset_constants_column_array_bool_float)},
{"int float c3x2 [2]", "canf", 32, D3DXRS_FLOAT4, registerset_blob_column_array,
- registerset_test_column_array_int_float,
- sizeof(registerset_test_column_array_int_float) / sizeof(*registerset_test_column_array_int_float),
- registerset_constants_column_array_int_float,
- sizeof(registerset_constants_column_array_int_float) / sizeof(*registerset_constants_column_array_int_float)},
+ registerset_test_column_array_int_float, ARRAY_SIZE(registerset_test_column_array_int_float),
+ registerset_constants_column_array_int_float, ARRAY_SIZE(registerset_constants_column_array_int_float)},
/* matrix row */
- {"float r3x2", "rf", 0, D3DXRS_FLOAT4, registerset_blob_row, registerset_test_row_float,
- sizeof(registerset_test_row_float) / sizeof(*registerset_test_row_float),
- registerset_constants_row_float,
- sizeof(registerset_constants_row_float) / sizeof(*registerset_constants_row_float)},
- {"int r3x2", "rn", 0, D3DXRS_INT4, registerset_blob_row, registerset_test_row_int,
- sizeof(registerset_test_row_int) / sizeof(*registerset_test_row_int),
- registerset_constants_row_int,
- sizeof(registerset_constants_row_int) / sizeof(*registerset_constants_row_int)},
- {"bool r3x2", "rb", 0, D3DXRS_BOOL, registerset_blob_row, registerset_test_row_bool,
- sizeof(registerset_test_row_bool) / sizeof(*registerset_test_row_bool),
- registerset_constants_row_bool,
- sizeof(registerset_constants_row_bool) / sizeof(*registerset_constants_row_bool)},
+ {"float r3x2", "rf", 0, D3DXRS_FLOAT4, registerset_blob_row,
+ registerset_test_row_float, ARRAY_SIZE(registerset_test_row_float),
+ registerset_constants_row_float, ARRAY_SIZE(registerset_constants_row_float)},
+ {"int r3x2", "rn", 0, D3DXRS_INT4, registerset_blob_row,
+ registerset_test_row_int, ARRAY_SIZE(registerset_test_row_int),
+ registerset_constants_row_int, ARRAY_SIZE(registerset_constants_row_int)},
+ {"bool r3x2", "rb", 0, D3DXRS_BOOL, registerset_blob_row,
+ registerset_test_row_bool, ARRAY_SIZE(registerset_test_row_bool),
+ registerset_constants_row_bool, ARRAY_SIZE(registerset_constants_row_bool)},
{"bool float r3x2", "rbf", 12, D3DXRS_FLOAT4, registerset_blob_row,
- registerset_test_row_bool_float,
- sizeof(registerset_test_row_bool_float) / sizeof(*registerset_test_row_bool_float),
- registerset_constants_row_bool_float,
- sizeof(registerset_constants_row_bool_float) / sizeof(*registerset_constants_row_bool_float)},
+ registerset_test_row_bool_float, ARRAY_SIZE(registerset_test_row_bool_float),
+ registerset_constants_row_bool_float, ARRAY_SIZE(registerset_constants_row_bool_float)},
{"int float r3x2", "rnf", 24, D3DXRS_FLOAT4, registerset_blob_row,
- registerset_test_row_int_float,
- sizeof(registerset_test_row_int_float) / sizeof(*registerset_test_row_int_float),
- registerset_constants_row_int_float,
- sizeof(registerset_constants_row_int_float) / sizeof(*registerset_constants_row_int_float)},
+ registerset_test_row_int_float, ARRAY_SIZE(registerset_test_row_int_float),
+ registerset_constants_row_int_float, ARRAY_SIZE(registerset_constants_row_int_float)},
/* matrix row array */
- {"float 3x2 [2]", "raf", 0, D3DXRS_FLOAT4, registerset_blob_row_array, registerset_test_row_array_float,
- sizeof(registerset_test_row_array_float) / sizeof(*registerset_test_row_array_float),
- registerset_constants_row_array_float,
- sizeof(registerset_constants_row_array_float) / sizeof(*registerset_constants_row_array_float)},
- {"int 3x2 [2]", "ran", 0, D3DXRS_INT4, registerset_blob_row_array, registerset_test_row_array_int,
- sizeof(registerset_test_row_array_int) / sizeof(*registerset_test_row_array_int),
- registerset_constants_row_array_int,
- sizeof(registerset_constants_row_array_int) / sizeof(*registerset_constants_row_array_int)},
- {"bool 3x2 [2]", "rab", 0, D3DXRS_BOOL, registerset_blob_row_array, registerset_test_row_array_bool,
- sizeof(registerset_test_row_array_bool) / sizeof(*registerset_test_row_array_bool),
- registerset_constants_row_array_bool,
- sizeof(registerset_constants_row_array_bool) / sizeof(*registerset_constants_row_array_bool)},
+ {"float 3x2 [2]", "raf", 0, D3DXRS_FLOAT4, registerset_blob_row_array,
+ registerset_test_row_array_float, ARRAY_SIZE(registerset_test_row_array_float),
+ registerset_constants_row_array_float, ARRAY_SIZE(registerset_constants_row_array_float)},
+ {"int 3x2 [2]", "ran", 0, D3DXRS_INT4, registerset_blob_row_array,
+ registerset_test_row_array_int, ARRAY_SIZE(registerset_test_row_array_int),
+ registerset_constants_row_array_int, ARRAY_SIZE(registerset_constants_row_array_int)},
+ {"bool 3x2 [2]", "rab", 0, D3DXRS_BOOL, registerset_blob_row_array,
+ registerset_test_row_array_bool, ARRAY_SIZE(registerset_test_row_array_bool),
+ registerset_constants_row_array_bool, ARRAY_SIZE(registerset_constants_row_array_bool)},
{"bool float 3x2 [2]", "rabf", 24, D3DXRS_FLOAT4, registerset_blob_row_array,
- registerset_test_row_array_bool_float,
- sizeof(registerset_test_row_array_bool_float) / sizeof(*registerset_test_row_array_bool_float),
- registerset_constants_row_array_bool_float,
- sizeof(registerset_constants_row_array_bool_float) / sizeof(*registerset_constants_row_array_bool_float)},
+ registerset_test_row_array_bool_float, ARRAY_SIZE(registerset_test_row_array_bool_float),
+ registerset_constants_row_array_bool_float, ARRAY_SIZE(registerset_constants_row_array_bool_float)},
{"int float 3x2 [2]", "ranf", 48, D3DXRS_FLOAT4, registerset_blob_row_array,
- registerset_test_row_array_int_float,
- sizeof(registerset_test_row_array_int_float) / sizeof(*registerset_test_row_array_int_float),
- registerset_constants_row_array_int_float,
- sizeof(registerset_constants_row_array_int_float) / sizeof(*registerset_constants_row_array_int_float)},
+ registerset_test_row_array_int_float, ARRAY_SIZE(registerset_test_row_array_int_float),
+ registerset_constants_row_array_int_float, ARRAY_SIZE(registerset_constants_row_array_int_float)},
/* struct */
- {"struct float", "sf", 0, D3DXRS_FLOAT4, registerset_blob_struct, registerset_test_struct_float,
- sizeof(registerset_test_struct_float) / sizeof(*registerset_test_struct_float),
- registerset_constants_struct_float,
- sizeof(registerset_constants_struct_float) / sizeof(*registerset_constants_struct_float)},
- {"struct int", "sn", 0, D3DXRS_INT4, registerset_blob_struct, registerset_test_struct_int,
- sizeof(registerset_test_struct_int) / sizeof(*registerset_test_struct_int),
- registerset_constants_struct_int,
- sizeof(registerset_constants_struct_int) / sizeof(*registerset_constants_struct_int)},
- {"struct bool", "sb", 0, D3DXRS_BOOL, registerset_blob_struct, registerset_test_struct_bool,
- sizeof(registerset_test_struct_bool) / sizeof(*registerset_test_struct_bool),
- registerset_constants_struct_bool,
- sizeof(registerset_constants_struct_bool) / sizeof(*registerset_constants_struct_bool)},
+ {"struct float", "sf", 0, D3DXRS_FLOAT4, registerset_blob_struct,
+ registerset_test_struct_float, ARRAY_SIZE(registerset_test_struct_float),
+ registerset_constants_struct_float, ARRAY_SIZE(registerset_constants_struct_float)},
+ {"struct int", "sn", 0, D3DXRS_INT4, registerset_blob_struct,
+ registerset_test_struct_int, ARRAY_SIZE(registerset_test_struct_int),
+ registerset_constants_struct_int, ARRAY_SIZE(registerset_constants_struct_int)},
+ {"struct bool", "sb", 0, D3DXRS_BOOL, registerset_blob_struct,
+ registerset_test_struct_bool, ARRAY_SIZE(registerset_test_struct_bool),
+ registerset_constants_struct_bool, ARRAY_SIZE(registerset_constants_struct_bool)},
{"struct bool float", "sbf", 16, D3DXRS_FLOAT4, registerset_blob_struct,
- registerset_test_struct_bool_float,
- sizeof(registerset_test_struct_bool_float) / sizeof(*registerset_test_struct_bool_float),
- registerset_constants_struct_bool_float,
- sizeof(registerset_constants_struct_bool_float) / sizeof(*registerset_constants_struct_bool_float)},
+ registerset_test_struct_bool_float, ARRAY_SIZE(registerset_test_struct_bool_float),
+ registerset_constants_struct_bool_float, ARRAY_SIZE(registerset_constants_struct_bool_float)},
{"struct int float", "snf", 8, D3DXRS_FLOAT4, registerset_blob_struct,
- registerset_test_struct_int_float,
- sizeof(registerset_test_struct_int_float) / sizeof(*registerset_test_struct_int_float),
- registerset_constants_struct_int_float,
- sizeof(registerset_constants_struct_int_float) / sizeof(*registerset_constants_struct_int_float)},
+ registerset_test_struct_int_float, ARRAY_SIZE(registerset_test_struct_int_float),
+ registerset_constants_struct_int_float, ARRAY_SIZE(registerset_constants_struct_int_float)},
/* struct array */
- {"struct float [2]", "saf", 0, D3DXRS_FLOAT4, registerset_blob_struct_array, registerset_test_struct_array_float,
- sizeof(registerset_test_struct_array_float) / sizeof(*registerset_test_struct_array_float),
- registerset_constants_struct_array_float,
- sizeof(registerset_constants_struct_array_float) / sizeof(*registerset_constants_struct_array_float)},
- {"struct int [2]", "san", 0, D3DXRS_INT4, registerset_blob_struct_array, registerset_test_struct_array_int,
- sizeof(registerset_test_struct_array_int) / sizeof(*registerset_test_struct_array_int),
- registerset_constants_struct_array_int,
- sizeof(registerset_constants_struct_array_int) / sizeof(*registerset_constants_struct_array_int)},
- {"struct bool [2]", "sab", 0, D3DXRS_BOOL, registerset_blob_struct_array, registerset_test_struct_array_bool,
- sizeof(registerset_test_struct_array_bool) / sizeof(*registerset_test_struct_array_bool),
- registerset_constants_struct_array_bool,
- sizeof(registerset_constants_struct_array_bool) / sizeof(*registerset_constants_struct_array_bool)},
+ {"struct float [2]", "saf", 0, D3DXRS_FLOAT4, registerset_blob_struct_array,
+ registerset_test_struct_array_float, ARRAY_SIZE(registerset_test_struct_array_float),
+ registerset_constants_struct_array_float, ARRAY_SIZE(registerset_constants_struct_array_float)},
+ {"struct int [2]", "san", 0, D3DXRS_INT4, registerset_blob_struct_array,
+ registerset_test_struct_array_int, ARRAY_SIZE(registerset_test_struct_array_int),
+ registerset_constants_struct_array_int, ARRAY_SIZE(registerset_constants_struct_array_int)},
+ {"struct bool [2]", "sab", 0, D3DXRS_BOOL, registerset_blob_struct_array,
+ registerset_test_struct_array_bool, ARRAY_SIZE(registerset_test_struct_array_bool),
+ registerset_constants_struct_array_bool, ARRAY_SIZE(registerset_constants_struct_array_bool)},
{"struct bool float [2]", "sabf", 32, D3DXRS_FLOAT4, registerset_blob_struct_array,
- registerset_test_struct_array_bool_float,
- sizeof(registerset_test_struct_array_bool_float) / sizeof(*registerset_test_struct_array_bool_float),
- registerset_constants_struct_array_bool_float,
- sizeof(registerset_constants_struct_array_bool_float) / sizeof(*registerset_constants_struct_array_bool_float)},
+ registerset_test_struct_array_bool_float, ARRAY_SIZE(registerset_test_struct_array_bool_float),
+ registerset_constants_struct_array_bool_float, ARRAY_SIZE(registerset_constants_struct_array_bool_float)},
{"struct int float [2]", "sanf", 16, D3DXRS_FLOAT4, registerset_blob_struct_array,
- registerset_test_struct_array_int_float,
- sizeof(registerset_test_struct_array_int_float) / sizeof(*registerset_test_struct_array_int_float),
- registerset_constants_struct_array_int_float,
- sizeof(registerset_constants_struct_array_int_float) / sizeof(*registerset_constants_struct_array_int_float)},
+ registerset_test_struct_array_int_float, ARRAY_SIZE(registerset_test_struct_array_int_float),
+ registerset_constants_struct_array_int_float, ARRAY_SIZE(registerset_constants_struct_array_int_float)},
/* struct struct */
- {"struct struct float", "ssf", 0, D3DXRS_FLOAT4, registerset_blob_struct_struct, registerset_test_struct_struct_float,
- sizeof(registerset_test_struct_struct_float) / sizeof(*registerset_test_struct_struct_float),
- registerset_constants_struct_struct_float,
- sizeof(registerset_constants_struct_struct_float) / sizeof(*registerset_constants_struct_struct_float)},
- {"struct struct int", "ssn", 0, D3DXRS_INT4, registerset_blob_struct_struct, registerset_test_struct_struct_int,
- sizeof(registerset_test_struct_struct_int) / sizeof(*registerset_test_struct_struct_int),
- registerset_constants_struct_struct_int,
- sizeof(registerset_constants_struct_struct_int) / sizeof(*registerset_constants_struct_struct_int)},
- {"struct struct bool", "ssb", 0, D3DXRS_BOOL, registerset_blob_struct_struct, registerset_test_struct_struct_bool,
- sizeof(registerset_test_struct_struct_bool) / sizeof(*registerset_test_struct_struct_bool),
- registerset_constants_struct_struct_bool,
- sizeof(registerset_constants_struct_struct_bool) / sizeof(*registerset_constants_struct_struct_bool)},
+ {"struct struct float", "ssf", 0, D3DXRS_FLOAT4, registerset_blob_struct_struct,
+ registerset_test_struct_struct_float, ARRAY_SIZE(registerset_test_struct_struct_float),
+ registerset_constants_struct_struct_float, ARRAY_SIZE(registerset_constants_struct_struct_float)},
+ {"struct struct int", "ssn", 0, D3DXRS_INT4, registerset_blob_struct_struct,
+ registerset_test_struct_struct_int, ARRAY_SIZE(registerset_test_struct_struct_int),
+ registerset_constants_struct_struct_int, ARRAY_SIZE(registerset_constants_struct_struct_int)},
+ {"struct struct bool", "ssb", 0, D3DXRS_BOOL, registerset_blob_struct_struct,
+ registerset_test_struct_struct_bool, ARRAY_SIZE(registerset_test_struct_struct_bool),
+ registerset_constants_struct_struct_bool, ARRAY_SIZE(registerset_constants_struct_struct_bool)},
{"struct struct bool float", "ssbf", 32, D3DXRS_FLOAT4, registerset_blob_struct_struct,
- registerset_test_struct_struct_bool_float,
- sizeof(registerset_test_struct_struct_bool_float) / sizeof(*registerset_test_struct_struct_bool_float),
- registerset_constants_struct_struct_bool_float,
- sizeof(registerset_constants_struct_struct_bool_float) / sizeof(*registerset_constants_struct_struct_bool_float)},
+ registerset_test_struct_struct_bool_float, ARRAY_SIZE(registerset_test_struct_struct_bool_float),
+ registerset_constants_struct_struct_bool_float, ARRAY_SIZE(registerset_constants_struct_struct_bool_float)},
{"struct struct int float", "ssnf", 16, D3DXRS_FLOAT4, registerset_blob_struct_struct,
- registerset_test_struct_struct_int_float,
- sizeof(registerset_test_struct_struct_int_float) / sizeof(*registerset_test_struct_struct_int_float),
- registerset_constants_struct_struct_int_float,
- sizeof(registerset_constants_struct_struct_int_float) / sizeof(*registerset_constants_struct_struct_int_float)},
+ registerset_test_struct_struct_int_float, ARRAY_SIZE(registerset_test_struct_struct_int_float),
+ registerset_constants_struct_struct_int_float, ARRAY_SIZE(registerset_constants_struct_struct_int_float)},
/* special */
{"int ran", "ran", 0, D3DXRS_INT4, registerset_blob_special_int, NULL, 0,
- registerset_constants_special_int,
- sizeof(registerset_constants_special_int) / sizeof(*registerset_constants_special_int)},
- {"bigvec", "vaf", 0, D3DXRS_FLOAT4, registerset_blob_bigvec, registerset_test_bigvec_float,
- sizeof(registerset_test_bigvec_float) / sizeof(*registerset_test_bigvec_float),
- registerset_constants_bigvec_float,
- sizeof(registerset_constants_bigvec_float) / sizeof(*registerset_constants_bigvec_float)},
+ registerset_constants_special_int, ARRAY_SIZE(registerset_constants_special_int)},
+ {"bigvec", "vaf", 0, D3DXRS_FLOAT4, registerset_blob_bigvec,
+ registerset_test_bigvec_float, ARRAY_SIZE(registerset_test_bigvec_float),
+ registerset_constants_bigvec_float, ARRAY_SIZE(registerset_constants_bigvec_float)},
{"cf", "cf", 0, D3DXRS_FLOAT4, registerset_blob_matrix_column_clamp,
- registerset_test_matrix_column_clamp,
- sizeof(registerset_test_matrix_column_clamp) / sizeof(*registerset_test_matrix_column_clamp),
- registerset_constants_matrix_column_clamp,
- sizeof(registerset_constants_matrix_column_clamp) / sizeof(*registerset_constants_matrix_column_clamp)},
+ registerset_test_matrix_column_clamp, ARRAY_SIZE(registerset_test_matrix_column_clamp),
+ registerset_constants_matrix_column_clamp, ARRAY_SIZE(registerset_constants_matrix_column_clamp)},
};
static void registerset_clear(IDirect3DDevice9 *device)
--
2.14.4
June 4, 2018
[PATCH 1/2] d3dx9/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
This is the trivial in-place stuff.
The generated object files with or without this patch are identical.
dlls/d3dx9_36/tests/core.c | 8 ++++----
dlls/d3dx9_36/tests/effect.c | 2 +-
dlls/d3dx9_36/tests/shader.c | 22 +++++++++++-----------
dlls/d3dx9_36/tests/surface.c | 2 +-
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/dlls/d3dx9_36/tests/core.c b/dlls/d3dx9_36/tests/core.c
index 90b678fdf7..75d33c1e0d 100644
--- a/dlls/d3dx9_36/tests/core.c
+++ b/dlls/d3dx9_36/tests/core.c
@@ -552,7 +552,7 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
check_release((IUnknown*)font, 0);
} else skip("Failed to create a ID3DXFont object\n");
- for(i = 0; i < sizeof(texture_tests) / sizeof(texture_tests[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(texture_tests); i++) {
HDC hdc;
DWORD ret;
HRESULT hr;
@@ -617,7 +617,7 @@ static void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)
hr = D3DXCreateRenderToSurface(device, 256, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN, NULL /* out */);
ok(hr == D3DERR_INVALIDCALL, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
hr = D3DXCreateRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil,
tests[i].DepthStencilFormat, &render);
@@ -1024,7 +1024,7 @@ static void test_ID3DXRenderToSurface(IDirect3DDevice9 *device)
check_release((IUnknown *)render, 0);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
check_ID3DXRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil, tests[i].DepthStencilFormat, TRUE);
check_ID3DXRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil, tests[i].DepthStencilFormat, FALSE);
@@ -1052,7 +1052,7 @@ static void test_D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device)
{ { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN }, { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN } }
};
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
const D3DXRTE_DESC *parameters = &tests[i].parameters;
const D3DXRTE_DESC *expected = &tests[i].expected_values;
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index 4f26b63a13..d9ff11eaea 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -991,7 +991,7 @@ struct test_effect_parameter_value_result test_effect_parameter_value_result_spe
test_effect_parameter_value_blob_ ## x,\
sizeof(test_effect_parameter_value_blob_ ## x),\
test_effect_parameter_value_result_ ## x,\
- sizeof(test_effect_parameter_value_result_ ## x)/sizeof(*test_effect_parameter_value_result_ ## x),\
+ ARRAY_SIZE(test_effect_parameter_value_result_ ## x),\
}
static const struct
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index 2f01a46e42..c2b41cfdc7 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -649,17 +649,17 @@ static void test_constant_table(const char *test_name, const DWORD *ctable_fn,
static void test_constant_tables(void)
{
test_constant_table("test_basic", ctab_basic, ctab_basic_expected,
- sizeof(ctab_basic_expected)/sizeof(*ctab_basic_expected));
+ ARRAY_SIZE(ctab_basic_expected));
test_constant_table("test_matrices", ctab_matrices, ctab_matrices_expected,
- sizeof(ctab_matrices_expected)/sizeof(*ctab_matrices_expected));
+ ARRAY_SIZE(ctab_matrices_expected));
test_constant_table("test_matrices2", ctab_matrices2, ctab_matrices2_expected,
- sizeof(ctab_matrices2_expected)/sizeof(*ctab_matrices2_expected));
+ ARRAY_SIZE(ctab_matrices2_expected));
test_constant_table("test_arrays", ctab_arrays, ctab_arrays_expected,
- sizeof(ctab_arrays_expected)/sizeof(*ctab_arrays_expected));
+ ARRAY_SIZE(ctab_arrays_expected));
test_constant_table("test_default_values", ctab_with_default_values, ctab_with_default_values_expected,
- sizeof(ctab_with_default_values_expected)/sizeof(*ctab_with_default_values_expected));
+ ARRAY_SIZE(ctab_with_default_values_expected));
test_constant_table("test_samplers", ctab_samplers, ctab_samplers_expected,
- sizeof(ctab_samplers_expected)/sizeof(*ctab_samplers_expected));
+ ARRAY_SIZE(ctab_samplers_expected));
}
static void test_setting_basic_table(IDirect3DDevice9 *device)
@@ -1844,7 +1844,7 @@ static void test_get_shader_constant_variables(void)
ctab = ID3DXConstantTable_GetBufferPointer(ctable);
ok(ctab[0] == test_get_shader_constant_variables_blob[3], "ID3DXConstantTable_GetBufferPointer failed\n");
- for (i = 0; i < sizeof(test_get_shader_constant_variables_data) / sizeof(*test_get_shader_constant_variables_data); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_get_shader_constant_variables_data); ++i)
{
const char *fullname = test_get_shader_constant_variables_data[i].fullname;
const D3DXCONSTANT_DESC *expected_desc = &test_get_shader_constant_variables_data[i].desc;
@@ -6025,7 +6025,7 @@ static UINT registerset_compare_all(IDirect3DDevice9 *device, BOOL is_vs, D3DXRE
D3DXREGISTER_SET regsets[] = {D3DXRS_BOOL, D3DXRS_INT4, D3DXRS_FLOAT4};
UINT err = 0, i;
- for (i = 0; i < sizeof(regsets) / sizeof(*regsets); i++)
+ for (i = 0; i < ARRAY_SIZE(regsets); i++)
{
if (regset == regsets[i])
err += registerset_compare(device, is_vs, regset, start, in_count, expected);
@@ -6137,7 +6137,7 @@ static void test_registerset(void)
return;
}
- for (k = 0; k < sizeof(registerset_data) / sizeof(*registerset_data); ++k)
+ for (k = 0; k < ARRAY_SIZE(registerset_data); ++k)
{
const char *tablename = registerset_data[k].name;
const char *name = registerset_data[k].var;
@@ -6442,7 +6442,7 @@ static void test_registerset_defaults(void)
return;
}
- for (k = 0; k < sizeof(registerset_defaults_data) / sizeof(*registerset_defaults_data); ++k)
+ for (k = 0; k < ARRAY_SIZE(registerset_defaults_data); ++k)
{
const char *tablename = registerset_defaults_data[k].name;
ID3DXConstantTable *ctable;
@@ -6616,7 +6616,7 @@ static void test_shader_semantics(void)
hr = D3DXGetShaderInputSemantics(vs_1_1, semantics, NULL);
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(tests); ++i)
{
const DWORD *shader = tests[i].shader;
diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c
index 324e2af3eb..37c488b5ad 100644
--- a/dlls/d3dx9_36/tests/surface.c
+++ b/dlls/d3dx9_36/tests/surface.c
@@ -398,7 +398,7 @@ static void test_dds_header_handling(void)
return;
}
- for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
DWORD file_size = sizeof(dds->magic) + sizeof(dds->header) + tests[i].pixel_data_size;
assert(file_size <= sizeof(*dds));
--
2.14.4
June 4, 2018
[PATCH 5/5] msvcrt: Don't reimplement call_unwind_func().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/msvcrt/except_i386.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index 42212c9..301c169 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -59,7 +59,7 @@ typedef struct __catchblock_info
UINT flags; /* flags (see below) */
const type_info *type_info; /* C++ type caught by this block */
int offset; /* stack offset to copy exception object to */
- void (*handler)(void);/* catch block handler code */
+ int (*handler)(void);/* catch block handler code */
} catchblock_info;
#define TYPE_FLAG_CONST 1
#define TYPE_FLAG_VOLATILE 2
@@ -79,7 +79,7 @@ typedef struct __tryblock_info
typedef struct __unwind_info
{
int prev; /* prev trylevel unwind handler, to run after this one */
- void (*handler)(void);/* unwind handler */
+ int (*handler)(void);/* unwind handler */
} unwind_info;
/* descriptor of all try blocks of a given function */
@@ -137,22 +137,6 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame
const cxx_function_descr *descr,
EXCEPTION_REGISTRATION_RECORD* nested_frame, int nested_trylevel ) DECLSPEC_HIDDEN;
-/* call a function with a given ebp */
-static inline void *call_ebp_func( void *func, void *ebp )
-{
- void *ret;
- int dummy;
- __asm__ __volatile__ ("pushl %%ebx\n\t"
- "pushl %%ebp\n\t"
- "movl %4,%%ebp\n\t"
- "call *%%eax\n\t"
- "popl %%ebp\n\t"
- "popl %%ebx"
- : "=a" (ret), "=S" (dummy), "=D" (dummy)
- : "0" (func), "1" (ebp) : "ecx", "edx", "memory" );
- return ret;
-}
-
/* call a copy constructor */
extern void call_copy_ctor( void *func, void *this, void *src, int has_vbase );
@@ -326,7 +310,7 @@ static void copy_exception( void *object, cxx_exception_frame *frame,
/* unwind the local function up to a given trylevel */
static void cxx_local_unwind( cxx_exception_frame* frame, const cxx_function_descr *descr, int last_level)
{
- void (*handler)(void);
+ int (*handler)(void);
int trylevel = frame->trylevel;
while (trylevel != last_level)
@@ -341,7 +325,7 @@ static void cxx_local_unwind( cxx_exception_frame* frame, const cxx_function_des
{
TRACE( "calling unwind handler %p trylevel %d last %d ebp %p\n",
handler, trylevel, last_level, &frame->ebp );
- call_ebp_func( handler, &frame->ebp );
+ call_unwind_func( handler, &frame->ebp );
}
trylevel = descr->unwind_table[trylevel].prev;
}
@@ -478,7 +462,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, CONTEXT *context,
nested_frame.trylevel = nested_trylevel + 1;
__wine_push_frame( &nested_frame.frame );
- addr = call_ebp_func( catchblock->handler, &frame->ebp );
+ addr = (void *)call_unwind_func( catchblock->handler, &frame->ebp );
__wine_pop_frame( &nested_frame.frame );
((DWORD*)frame)[-1] = save_esp;
--
2.7.4
June 4, 2018
[PATCH 4/5] msvcrt: Avoid using inline assembly in call_unwind_func().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/msvcrt/except_i386.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index 29540cd..42212c9 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -198,24 +198,20 @@ __ASM_GLOBAL_FUNC( call_filter,
"popl %ebp\n\t"
"ret" );
-static inline int call_unwind_func( int (*func)(void), void *ebp )
-{
- int ret;
- __asm__ __volatile__ ("pushl %%ebp\n\t"
- "pushl %%ebx\n\t"
- "pushl %%esi\n\t"
- "pushl %%edi\n\t"
- "movl %2,%%ebp\n\t"
- "call *%0\n\t"
- "popl %%edi\n\t"
- "popl %%esi\n\t"
- "popl %%ebx\n\t"
- "popl %%ebp"
- : "=a" (ret)
- : "0" (func), "r" (ebp)
- : "ecx", "edx", "memory" );
- return ret;
-}
+extern int call_unwind_func( int (*func)(void), void *ebp );
+
+__ASM_GLOBAL_FUNC( call_unwind_func,
+ "pushl %ebp\n\t"
+ "pushl %ebx\n\t"
+ "pushl %esi\n\t"
+ "pushl %edi\n\t"
+ "movl 24(%esp), %ebp\n\t"
+ "call *20(%esp)\n\t"
+ "popl %edi\n\t"
+ "popl %esi\n\t"
+ "popl %ebx\n\t"
+ "popl %ebp\n\t"
+ "ret" );
static inline void dump_type( const cxx_type_info *type )
{
--
2.7.4
June 4, 2018
[PATCH 3/5] msvcrt: Avoid using inline assembly in call_filter().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/msvcrt/except_i386.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index 508e2ee..29540cd 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -187,15 +187,16 @@ __ASM_GLOBAL_FUNC( call_finally_block,
"movl 8(%esp), %ebp\n\t"
"jmp *4(%esp)" );
-static inline int call_filter( int (*func)(PEXCEPTION_POINTERS), void *arg, void *ebp )
-{
- int ret;
- __asm__ __volatile__ ("pushl %%ebp; pushl %3; movl %2,%%ebp; call *%%eax; popl %%ebp; popl %%ebp"
- : "=a" (ret)
- : "0" (func), "r" (ebp), "r" (arg)
- : "ecx", "edx", "memory" );
- return ret;
-}
+extern int call_filter( int (*func)(PEXCEPTION_POINTERS), void *arg, void *ebp );
+
+__ASM_GLOBAL_FUNC( call_filter,
+ "pushl %ebp\n\t"
+ "pushl 12(%esp)\n\t"
+ "movl 20(%esp), %ebp\n\t"
+ "call *12(%esp)\n\t"
+ "popl %ebp\n\t"
+ "popl %ebp\n\t"
+ "ret" );
static inline int call_unwind_func( int (*func)(void), void *ebp )
{
--
2.7.4
June 4, 2018
[PATCH 2/5] msvcrt: Avoid using inline assembly in call_finally_block().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/msvcrt/except_i386.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index 2c845b2..508e2ee 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -181,11 +181,11 @@ __ASM_GLOBAL_FUNC( continue_after_catch,
"leal 12(%edx), %ebp\n\t"
"jmp *%eax" );
-static inline void call_finally_block( void *code_block, void *base_ptr )
-{
- __asm__ __volatile__ ("movl %1,%%ebp; call *%%eax"
- : : "a" (code_block), "g" (base_ptr));
-}
+extern void DECLSPEC_NORETURN call_finally_block( void *code_block, void *base_ptr );
+
+__ASM_GLOBAL_FUNC( call_finally_block,
+ "movl 8(%esp), %ebp\n\t"
+ "jmp *4(%esp)" );
static inline int call_filter( int (*func)(PEXCEPTION_POINTERS), void *arg, void *ebp )
{
@@ -938,7 +938,6 @@ int CDECL _except_handler3(PEXCEPTION_RECORD rec,
frame->trylevel = pScopeTable[trylevel].previousTryLevel;
TRACE("__finally block %p\n",pScopeTable[trylevel].lpfnHandler);
call_finally_block(pScopeTable[trylevel].lpfnHandler, &frame->_ebp);
- ERR("Returned from __finally block - expect crash!\n");
}
}
trylevel = pScopeTable[trylevel].previousTryLevel;
@@ -1012,7 +1011,6 @@ int CDECL _except_handler4_common( ULONG *cookie, void (*check_cookie)(void),
frame->trylevel = scope_table->entries[trylevel].previousTryLevel;
TRACE("__finally block %p\n",scope_table->entries[trylevel].lpfnHandler);
call_finally_block(scope_table->entries[trylevel].lpfnHandler, &frame->_ebp);
- ERR("Returned from __finally block - expect crash!\n");
}
}
trylevel = scope_table->entries[trylevel].previousTryLevel;
--
2.7.4
June 4, 2018
[PATCH 1/5] msvcrt: Avoid using inline assembly in continue_after_catch().
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/msvcrt/except_i386.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcrt/except_i386.c b/dlls/msvcrt/except_i386.c
index ee12fb6..2c845b2 100644
--- a/dlls/msvcrt/except_i386.c
+++ b/dlls/msvcrt/except_i386.c
@@ -172,12 +172,14 @@ __ASM_GLOBAL_FUNC( call_copy_ctor,
"ret" );
/* continue execution to the specified address after exception is caught */
-static inline void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr )
-{
- __asm__ __volatile__("movl -4(%0),%%esp; leal 12(%0),%%ebp; jmp *%1"
- : : "r" (frame), "a" (addr) );
- for (;;) ; /* unreached */
-}
+extern void DECLSPEC_NORETURN continue_after_catch( cxx_exception_frame* frame, void *addr );
+
+__ASM_GLOBAL_FUNC( continue_after_catch,
+ "movl 4(%esp), %edx\n\t"
+ "movl 8(%esp), %eax\n\t"
+ "movl -4(%edx), %esp\n\t"
+ "leal 12(%edx), %ebp\n\t"
+ "jmp *%eax" );
static inline void call_finally_block( void *code_block, void *base_ptr )
{
--
2.7.4
June 4, 2018
[PATCH 5/5] dbghelp: Read the r_debug and link_map structs corresponding to the target's architecture.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/dbghelp/elf_module.c | 110 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 84 insertions(+), 26 deletions(-)
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index c43d108..32ce345 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -78,6 +78,15 @@ struct r_debug
};
#endif /* HAVE_STRUCT_R_DEBUG */
+struct r_debug32
+{
+ int r_version;
+ DWORD r_map;
+ Elf32_Addr r_brk;
+ int r_state;
+ Elf32_Addr r_ldbase;
+};
+
#ifndef HAVE_STRUCT_LINK_MAP
struct link_map
{
@@ -88,6 +97,14 @@ struct link_map
};
#endif /* HAVE_STRUCT_LINK_MAP */
+struct link_map32
+{
+ Elf32_Addr l_addr;
+ DWORD l_name;
+ DWORD l_ld;
+ DWORD l_next, l_prev;
+};
+
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
struct elf_info
@@ -1648,36 +1665,77 @@ static BOOL elf_enum_modules_internal(const struct process* pcs,
const WCHAR* main_name,
enum_elf_modules_cb cb, void* user)
{
- struct r_debug dbg_hdr;
- void* lm_addr;
- struct link_map lm;
- char bufstr[256];
- WCHAR bufstrW[MAX_PATH];
+ WCHAR bufstrW[MAX_PATH];
+ char bufstr[256];
+ void *lm_addr;
- if (!pcs->dbg_hdr_addr ||
- !ReadProcessMemory(pcs->handle, (void*)pcs->dbg_hdr_addr,
- &dbg_hdr, sizeof(dbg_hdr), NULL))
- return FALSE;
-
- /* Now walk the linked list. In all known ELF implementations,
- * the dynamic loader maintains this linked list for us. In some
- * cases the first entry doesn't appear with a name, in other cases it
- * does.
- */
- for (lm_addr = (void*)dbg_hdr.r_map; lm_addr; lm_addr = (void*)lm.l_next)
+ if (pcs->is_64bit)
{
- if (!ReadProcessMemory(pcs->handle, lm_addr, &lm, sizeof(lm), NULL))
- return FALSE;
+ struct r_debug dbg_hdr;
+ struct link_map lm;
- if (lm.l_prev != NULL && /* skip first entry, normally debuggee itself */
- lm.l_name != NULL &&
- ReadProcessMemory(pcs->handle, lm.l_name, bufstr, sizeof(bufstr), NULL))
+ if (!pcs->dbg_hdr_addr ||
+ !ReadProcessMemory(pcs->handle, (void*)pcs->dbg_hdr_addr,
+ &dbg_hdr, sizeof(dbg_hdr), NULL))
+ return FALSE;
+
+ /* Now walk the linked list. In all known ELF implementations,
+ * the dynamic loader maintains this linked list for us. In some
+ * cases the first entry doesn't appear with a name, in other cases it
+ * does.
+ */
+ for (lm_addr = (void*)dbg_hdr.r_map; lm_addr; lm_addr = (void*)lm.l_next)
{
- bufstr[sizeof(bufstr) - 1] = '\0';
- MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW, sizeof(bufstrW) / sizeof(WCHAR));
- if (main_name && !bufstrW[0]) strcpyW(bufstrW, main_name);
- if (!cb(bufstrW, (unsigned long)lm.l_addr, (unsigned long)lm.l_ld, FALSE, user)) break;
- }
+ if (!ReadProcessMemory(pcs->handle, lm_addr, &lm, sizeof(lm), NULL))
+ return FALSE;
+
+ if (lm.l_prev != NULL && /* skip first entry, normally debuggee itself */
+ lm.l_name != NULL &&
+ ReadProcessMemory(pcs->handle, lm.l_name, bufstr, sizeof(bufstr), NULL))
+ {
+ bufstr[sizeof(bufstr) - 1] = '\0';
+ MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW,
+ sizeof(bufstrW) / sizeof(WCHAR));
+ if (main_name && !bufstrW[0]) strcpyW(bufstrW, main_name);
+ if (!cb(bufstrW, (unsigned long)lm.l_addr, (unsigned long)lm.l_ld, FALSE, user))
+ break;
+ }
+ }
+ }
+ else
+ {
+ struct r_debug32 dbg_hdr;
+ struct link_map32 lm;
+
+ if (!pcs->dbg_hdr_addr ||
+ !ReadProcessMemory(pcs->handle, (void*)pcs->dbg_hdr_addr,
+ &dbg_hdr, sizeof(dbg_hdr), NULL))
+ return FALSE;
+
+ /* Now walk the linked list. In all known ELF implementations,
+ * the dynamic loader maintains this linked list for us. In some
+ * cases the first entry doesn't appear with a name, in other cases it
+ * does.
+ */
+ for (lm_addr = (void *)(DWORD_PTR)dbg_hdr.r_map; lm_addr;
+ lm_addr = (void *)(DWORD_PTR)lm.l_next)
+ {
+ if (!ReadProcessMemory(pcs->handle, lm_addr, &lm, sizeof(lm), NULL))
+ return FALSE;
+
+ if (lm.l_prev && /* skip first entry, normally debuggee itself */
+ lm.l_name &&
+ ReadProcessMemory(pcs->handle, (void *)(DWORD_PTR)lm.l_name,
+ bufstr, sizeof(bufstr), NULL))
+ {
+ bufstr[sizeof(bufstr) - 1] = '\0';
+ MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW,
+ sizeof(bufstrW) / sizeof(WCHAR));
+ if (main_name && !bufstrW[0]) strcpyW(bufstrW, main_name);
+ if (!cb(bufstrW, (unsigned long)lm.l_addr, (unsigned long)lm.l_ld, FALSE, user))
+ break;
+ }
+ }
}
#ifdef AT_SYSINFO_EHDR
--
2.7.4
June 4, 2018
[PATCH 4/5] dbghelp: Translate the 32-bit ELF symbol struct to the 64-bit one.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/dbghelp/elf_module.c | 87 +++++++++++++++++++++++++++-----------------
dlls/dbghelp/image_private.h | 9 +----
2 files changed, 54 insertions(+), 42 deletions(-)
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index 0cbeb98..c43d108 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -101,7 +101,7 @@ struct elf_info
struct symtab_elt
{
struct hash_table_elt ht_elt;
- const Elf_Sym* symp;
+ Elf64_Sym sym;
struct symt_compiland* compiland;
unsigned used;
};
@@ -548,13 +548,13 @@ static void elf_hash_symtab(struct module* module, struct pool* pool,
const char* symname;
struct symt_compiland* compiland = NULL;
const char* ptr;
- const Elf_Sym* symp;
struct symtab_elt* ste;
struct image_section_map ism, ism_str;
+ const char *symtab;
if (!elf_find_section(fmap, ".symtab", SHT_SYMTAB, &ism) &&
!elf_find_section(fmap, ".dynsym", SHT_DYNSYM, &ism)) return;
- if ((symp = (const Elf_Sym*)image_map_section(&ism)) == IMAGE_NO_MAP) return;
+ if ((symtab = image_map_section(&ism)) == IMAGE_NO_MAP) return;
ism_str.fmap = ism.fmap;
ism_str.sidx = fmap->u.elf.sect[ism.sidx].shdr.sh_link;
if ((strp = image_map_section(&ism_str)) == IMAGE_NO_MAP)
@@ -563,33 +563,50 @@ static void elf_hash_symtab(struct module* module, struct pool* pool,
return;
}
- nsym = image_get_map_size(&ism) / sizeof(*symp);
+ nsym = image_get_map_size(&ism) /
+ (fmap->addr_size == 32 ? sizeof(Elf32_Sym) : sizeof(Elf64_Sym));
for (j = 0; thunks[j].symname; j++)
thunks[j].rva_start = thunks[j].rva_end = 0;
- for (i = 0; i < nsym; i++, symp++)
+ for (i = 0; i < nsym; i++)
{
+ Elf64_Sym sym;
+
+ if (fmap->addr_size == 32)
+ {
+ Elf32_Sym *sym32 = &((Elf32_Sym *)symtab)[i];
+
+ sym.st_name = sym32->st_name;
+ sym.st_value = sym32->st_value;
+ sym.st_size = sym32->st_size;
+ sym.st_info = sym32->st_info;
+ sym.st_other = sym32->st_other;
+ sym.st_shndx = sym32->st_shndx;
+ }
+ else
+ sym = ((Elf64_Sym *)symtab)[i];
+
/* Ignore certain types of entries which really aren't of that much
* interest.
*/
- if ((ELF32_ST_TYPE(symp->st_info) != STT_NOTYPE &&
- ELF32_ST_TYPE(symp->st_info) != STT_FILE &&
- ELF32_ST_TYPE(symp->st_info) != STT_OBJECT &&
- ELF32_ST_TYPE(symp->st_info) != STT_FUNC) ||
- symp->st_shndx == SHN_UNDEF)
+ if ((ELF32_ST_TYPE(sym.st_info) != STT_NOTYPE &&
+ ELF32_ST_TYPE(sym.st_info) != STT_FILE &&
+ ELF32_ST_TYPE(sym.st_info) != STT_OBJECT &&
+ ELF32_ST_TYPE(sym.st_info) != STT_FUNC) ||
+ sym.st_shndx == SHN_UNDEF)
{
continue;
}
- symname = strp + symp->st_name;
+ symname = strp + sym.st_name;
/* handle some specific symtab (that we'll throw away when done) */
- switch (ELF32_ST_TYPE(symp->st_info))
+ switch (ELF32_ST_TYPE(sym.st_info))
{
case STT_FILE:
if (symname)
- compiland = symt_new_compiland(module, symp->st_value,
+ compiland = symt_new_compiland(module, sym.st_value,
source_new(module, NULL, symname));
else
compiland = NULL;
@@ -600,8 +617,8 @@ static void elf_hash_symtab(struct module* module, struct pool* pool,
{
if (!strcmp(symname, thunks[j].symname))
{
- thunks[j].rva_start = symp->st_value;
- thunks[j].rva_end = symp->st_value + symp->st_size;
+ thunks[j].rva_start = sym.st_value;
+ thunks[j].rva_end = sym.st_value + sym.st_size;
break;
}
}
@@ -635,7 +652,7 @@ static void elf_hash_symtab(struct module* module, struct pool* pool,
ste->ht_elt.name = n;
}
}
- ste->symp = symp;
+ ste->sym = sym;
ste->compiland = compiland;
ste->used = 0;
hash_table_add(ht_symtab, &ste->ht_elt);
@@ -651,7 +668,7 @@ static void elf_hash_symtab(struct module* module, struct pool* pool,
*
* lookup a symbol by name in our internal hash table for the symtab
*/
-static const Elf_Sym* elf_lookup_symtab(const struct module* module,
+static const Elf64_Sym *elf_lookup_symtab(const struct module* module,
const struct hash_table* ht_symtab,
const char* name, const struct symt* compiland)
{
@@ -698,8 +715,8 @@ static const Elf_Sym* elf_lookup_symtab(const struct module* module,
{
FIXME("Already found symbol %s (%s) in symtab %s @%08x and %s @%08x\n",
name, compiland_name,
- source_get(module, result->compiland->source), (unsigned int)result->symp->st_value,
- source_get(module, ste->compiland->source), (unsigned int)ste->symp->st_value);
+ source_get(module, result->compiland->source), (unsigned int)result->sym.st_value,
+ source_get(module, ste->compiland->source), (unsigned int)ste->sym.st_value);
}
else
{
@@ -713,7 +730,7 @@ static const Elf_Sym* elf_lookup_symtab(const struct module* module,
debugstr_w(module->module.ModuleName), name);
return NULL;
}
- return result->symp;
+ return &result->sym;
}
/******************************************************************
@@ -727,7 +744,7 @@ static void elf_finish_stabs_info(struct module* module, const struct hash_table
struct hash_table_iter hti;
void* ptr;
struct symt_ht* sym;
- const Elf_Sym* symp;
+ const Elf64_Sym* symp;
struct elf_module_info* elf_info = module->format_info[DFI_ELF]->u.elf_info;
hash_table_iter_init(&module->ht_symbols, &hti, NULL);
@@ -748,9 +765,10 @@ static void elf_finish_stabs_info(struct module* module, const struct hash_table
{
if (((struct symt_function*)sym)->address != elf_info->elf_addr &&
((struct symt_function*)sym)->address != elf_info->elf_addr + symp->st_value)
- FIXME("Changing address for %p/%s!%s from %08lx to %08lx\n",
+ FIXME("Changing address for %p/%s!%s from %08lx to %s\n",
sym, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
- ((struct symt_function*)sym)->address, elf_info->elf_addr + symp->st_value);
+ ((struct symt_function*)sym)->address,
+ wine_dbgstr_longlong(elf_info->elf_addr + symp->st_value));
if (((struct symt_function*)sym)->size && ((struct symt_function*)sym)->size != symp->st_size)
FIXME("Changing size for %p/%s!%s from %08lx to %08x\n",
sym, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
@@ -776,9 +794,10 @@ static void elf_finish_stabs_info(struct module* module, const struct hash_table
{
if (((struct symt_data*)sym)->u.var.offset != elf_info->elf_addr &&
((struct symt_data*)sym)->u.var.offset != elf_info->elf_addr + symp->st_value)
- FIXME("Changing address for %p/%s!%s from %08lx to %08lx\n",
+ FIXME("Changing address for %p/%s!%s from %08lx to %s\n",
sym, debugstr_w(module->module.ModuleName), sym->hash_elt.name,
- ((struct symt_function*)sym)->address, elf_info->elf_addr + symp->st_value);
+ ((struct symt_function*)sym)->address,
+ wine_dbgstr_longlong(elf_info->elf_addr + symp->st_value));
((struct symt_data*)sym)->u.var.offset = elf_info->elf_addr + symp->st_value;
((struct symt_data*)sym)->kind = (ELF32_ST_BIND(symp->st_info) == STB_LOCAL) ?
DataIsFileStatic : DataIsGlobal;
@@ -817,13 +836,13 @@ static int elf_new_wine_thunks(struct module* module, const struct hash_table* h
{
if (ste->used) continue;
- addr = module->reloc_delta + ste->symp->st_value;
+ addr = module->reloc_delta + ste->sym.st_value;
- j = elf_is_in_thunk_area(ste->symp->st_value, thunks);
+ j = elf_is_in_thunk_area(ste->sym.st_value, thunks);
if (j >= 0) /* thunk found */
{
symt_new_thunk(module, ste->compiland, ste->ht_elt.name, thunks[j].ordinal,
- addr, ste->symp->st_size);
+ addr, ste->sym.st_size);
}
else
{
@@ -839,19 +858,19 @@ static int elf_new_wine_thunks(struct module* module, const struct hash_table* h
* used yet (ie we have no debug information on them)
* That's the case, for example, of the .spec.c files
*/
- switch (ELF32_ST_TYPE(ste->symp->st_info))
+ switch (ELF32_ST_TYPE(ste->sym.st_info))
{
case STT_FUNC:
symt_new_function(module, ste->compiland, ste->ht_elt.name,
- addr, ste->symp->st_size, NULL);
+ addr, ste->sym.st_size, NULL);
break;
case STT_OBJECT:
loc.kind = loc_absolute;
loc.reg = 0;
loc.offset = addr;
symt_new_global_variable(module, ste->compiland, ste->ht_elt.name,
- ELF32_ST_BIND(ste->symp->st_info) == STB_LOCAL,
- loc, ste->symp->st_size, NULL);
+ ELF32_ST_BIND(ste->sym.st_info) == STB_LOCAL,
+ loc, ste->sym.st_size, NULL);
break;
default:
FIXME("Shouldn't happen\n");
@@ -891,8 +910,8 @@ static int elf_new_public_symbols(struct module* module, const struct hash_table
while ((ste = hash_table_iter_up(&hti)))
{
symt_new_public(module, ste->compiland, ste->ht_elt.name,
- module->reloc_delta + ste->symp->st_value,
- ste->symp->st_size);
+ module->reloc_delta + ste->sym.st_value,
+ ste->sym.st_size);
}
return TRUE;
}
diff --git a/dlls/dbghelp/image_private.h b/dlls/dbghelp/image_private.h
index e95d0d1..b12cacb 100644
--- a/dlls/dbghelp/image_private.h
+++ b/dlls/dbghelp/image_private.h
@@ -56,14 +56,7 @@ typedef struct section macho_section;
#define IMAGE_NO_MAP ((void*)-1)
-#ifdef __ELF__
-
-#ifdef _WIN64
-#define Elf_Sym Elf64_Sym
-#else
-#define Elf_Sym Elf32_Sym
-#endif
-#else
+#ifndef __ELF__
#ifndef SHT_NULL
#define SHT_NULL 0
#endif
--
2.7.4
June 4, 2018
[PATCH 3/5] dbghelp: Read the Elf_auxv_t struct corresponding to the target's architecture.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/dbghelp/elf_module.c | 30 ++++++++++++++++++++++++------
dlls/dbghelp/image_private.h | 2 --
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index 2b444f8..0cbeb98 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -1522,7 +1522,6 @@ static BOOL elf_search_auxv(const struct process* pcs, unsigned type, unsigned l
void* addr;
void* str;
void* str_max;
- Elf_auxv_t auxv;
si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = MAX_SYM_NAME;
@@ -1548,14 +1547,33 @@ static BOOL elf_search_auxv(const struct process* pcs, unsigned type, unsigned l
while (addr < str_max && ReadProcessMemory(pcs->handle, addr, &str, sizeof(str), NULL) && str == NULL)
addr = (void*)((DWORD_PTR)addr + sizeof(str));
- while (ReadProcessMemory(pcs->handle, addr, &auxv, sizeof(auxv), NULL) && auxv.a_type != AT_NULL)
+ if (pcs->is_64bit)
{
- if (auxv.a_type == type)
+ Elf64_auxv_t auxv;
+
+ while (ReadProcessMemory(pcs->handle, addr, &auxv, sizeof(auxv), NULL) && auxv.a_type != AT_NULL)
{
- *val = auxv.a_un.a_val;
- return TRUE;
+ if (auxv.a_type == type)
+ {
+ *val = auxv.a_un.a_val;
+ return TRUE;
+ }
+ addr = (void*)((DWORD_PTR)addr + sizeof(auxv));
+ }
+ }
+ else
+ {
+ Elf32_auxv_t auxv;
+
+ while (ReadProcessMemory(pcs->handle, addr, &auxv, sizeof(auxv), NULL) && auxv.a_type != AT_NULL)
+ {
+ if (auxv.a_type == type)
+ {
+ *val = auxv.a_un.a_val;
+ return TRUE;
+ }
+ addr = (void*)((DWORD_PTR)addr + sizeof(auxv));
}
- addr = (void*)((DWORD_PTR)addr + sizeof(auxv));
}
return FALSE;
diff --git a/dlls/dbghelp/image_private.h b/dlls/dbghelp/image_private.h
index a0df390..e95d0d1 100644
--- a/dlls/dbghelp/image_private.h
+++ b/dlls/dbghelp/image_private.h
@@ -60,10 +60,8 @@ typedef struct section macho_section;
#ifdef _WIN64
#define Elf_Sym Elf64_Sym
-#define Elf_auxv_t Elf64_auxv_t
#else
#define Elf_Sym Elf32_Sym
-#define Elf_auxv_t Elf32_auxv_t
#endif
#else
#ifndef SHT_NULL
--
2.7.4
June 4, 2018
[PATCH 2/5] dbghelp: Read the Elf_Dyn struct corresponding to the target's architecture.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/dbghelp/elf_module.c | 59 ++++++++++++++++++++++++++++++++------------
dlls/dbghelp/image_private.h | 2 --
2 files changed, 43 insertions(+), 18 deletions(-)
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index f84df83..2b444f8 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -1270,29 +1270,56 @@ static BOOL elf_load_file_from_fmap(struct process* pcs, const WCHAR* filename,
if (elf_find_section(fmap, ".dynamic", SHT_DYNAMIC, &ism))
{
- Elf_Dyn dyn;
char* ptr = (char*)(ULONG_PTR)fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
unsigned long len;
if (load_offset) ptr += load_offset - fmap->u.elf.elf_start;
- do
+ if (fmap->addr_size == 32)
{
- if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) ||
- len != sizeof(dyn))
- return ret;
- if (dyn.d_tag == DT_DEBUG)
+ Elf32_Dyn dyn;
+
+ do
{
- elf_info->dbg_hdr_addr = dyn.d_un.d_ptr;
- if (load_offset == 0 && dyn_addr == 0) /* likely the case */
- /* Assume this module (the Wine loader) has been loaded at its preferred address */
- dyn_addr = ism.fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
- break;
- }
- ptr += sizeof(dyn);
- } while (dyn.d_tag != DT_NULL);
- if (dyn.d_tag == DT_NULL) return ret;
- }
+ if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) ||
+ len != sizeof(dyn))
+ return ret;
+ if (dyn.d_tag == DT_DEBUG)
+ {
+ elf_info->dbg_hdr_addr = dyn.d_un.d_ptr;
+ if (load_offset == 0 && dyn_addr == 0) /* likely the case */
+ /* Assume this module (the Wine loader) has been
+ * loaded at its preferred address */
+ dyn_addr = ism.fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
+ break;
+ }
+ ptr += sizeof(dyn);
+ } while (dyn.d_tag != DT_NULL);
+ if (dyn.d_tag == DT_NULL) return ret;
+ }
+ else
+ {
+ Elf64_Dyn dyn;
+
+ do
+ {
+ if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) ||
+ len != sizeof(dyn))
+ return ret;
+ if (dyn.d_tag == DT_DEBUG)
+ {
+ elf_info->dbg_hdr_addr = dyn.d_un.d_ptr;
+ if (load_offset == 0 && dyn_addr == 0) /* likely the case */
+ /* Assume this module (the Wine loader) has been
+ * loaded at its preferred address */
+ dyn_addr = ism.fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
+ break;
+ }
+ ptr += sizeof(dyn);
+ } while (dyn.d_tag != DT_NULL);
+ if (dyn.d_tag == DT_NULL) return ret;
+ }
+ }
elf_end_find(fmap);
}
diff --git a/dlls/dbghelp/image_private.h b/dlls/dbghelp/image_private.h
index 3951464..a0df390 100644
--- a/dlls/dbghelp/image_private.h
+++ b/dlls/dbghelp/image_private.h
@@ -59,11 +59,9 @@ typedef struct section macho_section;
#ifdef __ELF__
#ifdef _WIN64
-#define Elf_Dyn Elf64_Dyn
#define Elf_Sym Elf64_Sym
#define Elf_auxv_t Elf64_auxv_t
#else
-#define Elf_Dyn Elf32_Dyn
#define Elf_Sym Elf32_Sym
#define Elf_auxv_t Elf32_auxv_t
#endif
--
2.7.4
June 4, 2018