- Check for missing modules in modules.dat.
- Minor bug fixes

diff --git a/tools/winapi_check/modules.dat b/tools/winapi_check/modules.dat
index 5114982..5a48448 100644
--- a/tools/winapi_check/modules.dat
+++ b/tools/winapi_check/modules.dat
@@ -201,6 +201,10 @@
 
 dlls/rasapi32
 
+% dlls/richedit/riched32.spec
+
+dlls/richedit
+
 % dlls/setupx/setupx.spec
 
 dlls/setupx
diff --git a/tools/winapi_check/modules.pm b/tools/winapi_check/modules.pm
index f2a4f33..2018533 100644
--- a/tools/winapi_check/modules.pm
+++ b/tools/winapi_check/modules.pm
@@ -17,10 +17,25 @@
     $$output = shift;
     my $wine_dir = shift;
     my $current_dir = shift;
+    my $file_type = shift;
     my $module_file = shift;
 
     $module_file =~ s/^\.\///;
 
+    my @all_spec_files = map {
+	s/^.\/(.*)$/$1/;
+	if(&$file_type($_) eq "library") {
+	    $_;
+	} else {
+	    ();
+	}
+    } split(/\n/, `find $wine_dir -name \\*.spec`);
+
+    my %all_spec_files;
+    foreach my $file (@all_spec_files) {
+	$all_spec_files{$file}++ ;
+    }
+
     if($$options->progress) {
 	$$output->progress("$module_file");
     }
@@ -37,6 +52,12 @@
 
 	if(/^%\s+(.*?)$/) {
 	    $spec_file = $1;
+	    if($wine_dir eq ".") {
+		$all_spec_files{$spec_file}--;
+	    } else {
+		$all_spec_files{"$wine_dir/$spec_file"}--;
+	    }
+	    $$spec_files{""}{$spec_file}++; # FIXME: Kludge
 	    next;
 	} else {
 	    $allowed_dir = $1;
@@ -49,6 +70,12 @@
     }
     close(IN);
 
+    foreach my $spec_file (sort(keys(%all_spec_files))) {
+	if($all_spec_files{$spec_file} > 0) {
+	    $$output->write("$module_file: $spec_file: exists but is not specified\n");
+	}
+    }
+
     return $self;
 }
 
diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check
index 5a37036..389b78a 100755
--- a/tools/winapi_check/winapi_check
+++ b/tools/winapi_check/winapi_check
@@ -66,11 +66,6 @@
     exit;
 }
 
-my $modules = 'modules'->new($options, $output, $wine_dir, $current_dir, "$winapi_check_dir/modules.dat");
-
-my $win16api = 'winapi'->new($options, $output, "win16", "$winapi_check_dir/win16");
-my $win32api = 'winapi'->new($options, $output, "win32", "$winapi_check_dir/win32");
-
 sub file_type {
     my $file = shift;
 
@@ -93,6 +88,11 @@
     }
 }
 
+my $modules = 'modules'->new($options, $output, $wine_dir, $current_dir, \&file_type, "$winapi_check_dir/modules.dat");
+
+my $win16api = 'winapi'->new($options, $output, "win16", "$winapi_check_dir/win16");
+my $win32api = 'winapi'->new($options, $output, "win32", "$winapi_check_dir/win32");
+
 if($options->global) {
     'winapi'->read_all_spec_files($modules, $wine_dir, $current_dir, \&file_type, $win16api, $win32api);
 } else {