Hi,
As a result of the "Wine FIXME Report 2009 Aug - Dec" thread, I created the following to hunt for DllCanUnloadNow calls that were marked as being FIXME stubs:
cat > DllCanUnloadNow.pl < EOF #!/usr/local/bin/perl # Based on http://www.unix.com/unix-dummies-questions-answers/56703-multiline-grep.html
use strict;
my $filename = shift;
open (FILE, "<", $filename) or die "Failed to read file $filename : $! \n"; my $whole_file; { local $/; $whole_file = <FILE>; } close(FILE);
if ($whole_file =~ m#HRESULT WINAPI DllCanUnloadNow ?( ?(void|VOID) ?)[\n ]{\n\s+FIXME#sg) { print $filename . "\n"; } EOF
and used it with the following:
$ grep -F DllCanUnloadNow -r dlls | grep -F HRESULT | sed -e 's/:.*//' | while read line ; do perl DllCanUnloadNow.pl $line ; done | sort | tee results.log
This gives the following results: ----- 8< ----- dlls/ddrawex/main.c dlls/dinput/dinput_main.c dlls/dpnhpast/main.c dlls/dsound/dsound_main.c dlls/hlink/hlink_main.c dlls/hnetcfg/hnetcfg.c dlls/inetcomm/inetcomm_main.c dlls/infosoft/infosoft_main.c dlls/inseng/inseng_main.c dlls/itircl/itircl_main.c dlls/mmdevapi/main.c dlls/mpr/mpr_main.c dlls/mscoree/mscoree_main.c dlls/msimtf/main.c dlls/msxml3/main.c dlls/oledb32/main.c dlls/olepro32/olepro32stubs.c dlls/pstorec/pstorec.c dlls/query/query_main.c dlls/shell32/shell32_main.c dlls/sti/sti_main.c dlls/wbemprox/main.c dlls/winhttp/main.c dlls/wmiutils/main.c dlls/wuapi/main.c ----- >8 -----
I am currently going through the results and removing the FIXME stubs for the DllCanUnloadNow calls, as returning S_FALSE is a perfectly valid implementation (see the "Wine FIXME Report 2009 Aug - Dec" discussion).
While doing this, I noticed that some implementations of DllGetClassObject, DllRegisterServer and DllUnregisterServer also have FIXMEs. This is because the DLLs implement COM objects, but the wine versions are incomplete.
For the DllRegister/UnregisterServer calls, the FIXMEs should be removed -- the FIXMEs do not add any value, and are only likely to appear during install or when calling regsvr32.
For DllGetClassObject, the FIXME should output the GUID of the object that is trying to be created.
NOTE: I have also seen some implementations of DllCanUnloadNow that always return S_OK (e.g. dlls/hlink/hlink_main.c, even though it is implementing COM objects). I will keep a note of these and look to see whether they implement COM objects or not. I will sent a separate patch to address this issue.
- Reece
Reece Dunn wrote:
Hi,
As a result of the "Wine FIXME Report 2009 Aug - Dec" thread, I created the following to hunt for DllCanUnloadNow calls that were marked as being FIXME stubs:
Thank you for the patch, Reece.
James McKenzie
Hello Reece,
Reece Dunn wrote:
As a result of the "Wine FIXME Report 2009 Aug - Dec" thread, I
thanks for the patch. It is good to see that the FIXME report is useful and generated some Wine commits.
created the following to hunt for DllCanUnloadNow calls that were marked as being FIXME stubs:
cat > DllCanUnloadNow.pl < EOF #!/usr/local/bin/perl # Based on http://www.unix.com/unix-dummies-questions-answers/56703-multiline-grep.html
use strict;
my $filename = shift;
open (FILE, "<", $filename) or die "Failed to read file $filename : $! \n"; my $whole_file; { local $/; $whole_file = <FILE>; } close(FILE);
if ($whole_file =~ m#HRESULT WINAPI DllCanUnloadNow ?( ?(void|VOID) ?)[\n ]{\n\s+FIXME#sg) { print $filename . "\n"; } EOF
and used it with the following:
$ grep -F DllCanUnloadNow -r dlls | grep -F HRESULT | sed -e
's/:.*//' | while read line ; do perl DllCanUnloadNow.pl $line ; done | sort | tee results.log
This gives the following results:
Impressive script. Not sure if you have heard of coccinelle (semantic patcher, http://coccinelle.lip6.fr/); it sees some usage in the Linux Kernel project. As I would like to see it used on Wine too I've have added the corresponding cocci file for this task. This task is a prime example of coccinelle's intended usage.
------Snip DllCanUnloadNow.cocci------ @@ @@ DllCanUnloadNow( ... ) { ... - FIXME( ... ); ... } ------Snip DllCanUnloadNow.cocci------
Run it with: spatch -sp_file DllCanUnloadNow.cocci -patch $winesrcdir $winesrcdir/dlls
And you'll get a patch in git diff file format.
bye michael
2010/1/7 Michael Stefaniuc mstefani@redhat.com:
Hello Reece, Impressive script. Not sure if you have heard of coccinelle (semantic patcher, http://coccinelle.lip6.fr/); it sees some usage in the Linux Kernel project. As I would like to see it used on Wine too I've have added the corresponding cocci file for this task. This task is a prime example of coccinelle's intended usage.
------Snip DllCanUnloadNow.cocci------ @@ @@ DllCanUnloadNow( ... ) { ...
- FIXME( ... );
... } ------Snip DllCanUnloadNow.cocci------
Run it with: spatch -sp_file DllCanUnloadNow.cocci -patch $winesrcdir $winesrcdir/dlls
And you'll get a patch in git diff file format.
This also looks similar to what Mozilla are investigating with the Elsa/Oink/Pork analysis and refactoring tools (https://developer.mozilla.org/en/Pork).
- Reece