todo_wine under the hood

Jonathan Vollebregt jnvsor at gmail.com
Thu Oct 16 16:59:45 CDT 2014


I was looking at verify_reg_() in programs/reg/tests/reg.c:61 and 
noticed some simple if statements:

>     if (todo & TODO_REG_TYPE)
>         todo_wine lok(type == exp_type, "got wrong type %d, expected %d\n", type, exp_type);
>     else
>         lok(type == exp_type, "got wrong type %d, expected %d\n", type, exp_type);
>     if (todo & TODO_REG_SIZE)
>         todo_wine lok(size == exp_size, "got wrong size %d, expected %d\n", size, exp_size);
>     else
>         lok(size == exp_size, "got wrong size %d, expected %d\n", size, exp_size);
>     if (todo & TODO_REG_DATA)
>         todo_wine lok(memcmp(data, exp_data, size) == 0, "got wrong data\n");
>     else
>         lok(memcmp(data, exp_data, size) == 0, "got wrong data\n");

Simple enough, except if I pass TODO_REG_TYPE to this function it never 
even tries the size or data blocks. While this makes sense to implement 
(You can't test the data if you don't know it's size) I have no idea 
*how* it does it.

I've tried the obvious - the mask values don't overlap in a way that 
would cause it to fallthrough. The lok and todo_wine macros don't have 
anything in them that returns.

In fact the todo_wine macro appears to start a loop for some reason and 
all in all I'm very confused as to how exactly it's doing this.

I'm curious as to how this works under the hood.

I also need to stick a broken() in there somewhere but every time I do 
it falls through, and I don't want to rewrite the entire verify_reg_() 
function for a single exception.

(If you're interested, reg add a REG_BINARY with an odd number of 
characters prefixes a 0 nibble, but suffixes it in XP)



More information about the wine-devel mailing list