Hi Torge, Please try to expand the tests. On 4/20/22 16:33, Torge Matthies wrote:
+typedef struct UnrealizedChore +{ + void *unk1; + void (__cdecl *callback)(struct UnrealizedChore *_this, void *unk); + void *unk2; + void *unk3; + void *unk4; + void *unk5; + void *unk6; + void *unk7; + void *unk8; + void *unk9; +} UnrealizedChore; It should look as follows: const void *vtable; void (__cdecl *chore_proc)(_UnrealizedChore*); _StructuredTaskCollection *task_collection; void (__cdecl *chore_wrapper)(_UnrealizedChore*); void unk[6];
where vtable contains only destructor, task_collection is set in _Schedule call, unk[6] is to preserve the size you have found. The chore_wrapper is interesting. It deserves some tests. It's set when _Schedule is called. When called it invokes chore_proc. I guess it guards against exceptions. It works only if task_collection is non null.
+static StructuredTaskCollection* (__stdcall *p__StructuredTaskCollection_ctor)(StructuredTaskCollection*, void*); This is a thiscall function.
+static void (__thiscall *p__StructuredTaskCollection_dtor)(StructuredTaskCollection*); +static void (__thiscall *p__StructuredTaskCollection__Schedule)(StructuredTaskCollection*, UnrealizedChore*); +static int (__thiscall *p__StructuredTaskCollection__RunAndWait)(StructuredTaskCollection*, UnrealizedChore*); This is a stdcall function.
+static void setup_chore(UnrealizedChore *chore, void (__cdecl *callback)(struct UnrealizedChore *_this, void *unk)) Please rename the function to _UnrealizedChore_ctor. As far as I can see callback takes only 1 argument (_UnrealizedChore*).
+static void test_StructuredTaskCollection(void) +{ + StructuredTaskCollection task_coll; + UnrealizedChore chore1, chore2; + int status; + + chore_evt1 = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(chore_evt1 != NULL, "CreateEvent failed\n"); + chore_evt2 = CreateEventW(NULL, FALSE, FALSE, NULL); + ok(chore_evt2 != NULL, "CreateEvent failed\n"); + + call_func2(p__StructuredTaskCollection_ctor, &task_coll, NULL); + + /* test that all chores are run in parallel */ + setup_chore(&chore1, chore1_cb); + setup_chore(&chore2, chore2_cb); + call_func2(p__StructuredTaskCollection__Schedule, &task_coll, &chore1); Please test chore structure fields after the call. The tests also missed that the chore is already executed when _Schedule is called.
+ call_func2(p__StructuredTaskCollection__Schedule, &task_coll, &chore2); + status = call_func2(p__StructuredTaskCollection__RunAndWait, &task_coll, NULL);status = p__StructuredTaskCollection__RunAndWait(&task_coll, NULL);
Thanks, Piotr