dll/shell32/shlfileop.c cleanup questions

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Fri Feb 18 12:09:34 CST 2005

Joris Huizer <jorishuizer at planet.nl> wrote:

>I'm looking at the dll/shell32/shlfileop.c file; the function 
>SHFileOperationW is still huge but in order to split off sections (some

>are clear to see but difficult to seperate from the rest)
>I'd either have to use huge parameter lists, or put parts together in 
>structs (some vars are used everywhere in combination) What is your 
>opinion about this?
>Also, I found something weird, the line at the top of the while loop:
>   nFileOp.wFunc =  ((level + 1) << 4) + FuncSwitch;
>seems to be equivalent to
>   nFileOp.wFunc = (((lpFileOp->wFunc >> 4) + 1) << 4) + 
>(lpFileOp->wFunc & FO_MASK);
>   nFileOp.wFunc = (((lpFileOp->wFunc >> 4) + 1) << 4) + 
>(lpFileOp->wFunc & 0xF);
>   nFileOp.wFunc = (lpFileOp->wFunc & (~(0xF))) + (1 << 4) + 
>(lpFileOp->wFunc & 0xF);
>   nFileOp.wFunc = (lpFileOp->wFunc & (~(0xF))) + (0x10) + 
>(lpFileOp->wFunc & 0xF);
>   nFileOp.wFunc = lpFileOp->wFunc + 0x10; /* what's this 0x10? */

Well, Dietrich Teickner from whom I got that code implemented in this
a method to detect the nesting level of SHFileOperation calls as they
get called recursively.

I have currently a version of the SHFileOperation lying around here
is still huge but I did start to place some parts in separate functions
already. It is a considerably extended version of SHFileOperation than
what is in CVS at the moment. It implements a few more features and also
fixes some not so common cases where the current function can go havok
with certain parameter combinations.
But it was rejected for its sheer size, which I wasn't happy myself with
but I inherited most of that and hadn't time until now to finish the
and won't be able to do that in a short term either.

My next step was to actually create a custom structure with some more
parameters and implement a core file_operation() function which is
called recursively when necessary. The current SHFileOperation then will
some parameter checks and then prepare the new structure and call that
file_operation(). When I get home, I will send the current code in an
to you together with a tool I wrote to make a very thorough test of
thousend parameter combinations. The way I implemented that test tool
was to
simply dump the results of all those tests into a file to be able to
make a
diff with a known log from W2K. As it is at the moment it would not be
to include in the test framework because of the necessary comparison to
a good
log file and also because it takes about 90 seconds alone to run on my
(Well on Windows it takes actually at least double that but there the
also does Undo/Recycle Bin which I guess will take some time to do).

Rolf Kalbermatter

More information about the wine-devel mailing list