Minor fixes and additions.

diff --git a/tools/winapi_check/win16/display.api b/tools/winapi_check/win16/display.api
index e184c7e..3b0bf51 100644
--- a/tools/winapi_check/win16/display.api
+++ b/tools/winapi_check/win16/display.api
@@ -1,3 +1,3 @@
-%word
+%ptr
 
-HDC16
+LPCURSORINFO
diff --git a/tools/winapi_check/win16api.dat b/tools/winapi_check/win16api.dat
index f946ee6..07a503ed 100644
--- a/tools/winapi_check/win16api.dat
+++ b/tools/winapi_check/win16api.dat
@@ -38,6 +38,7 @@
 BITMAPINFOHEADER *
 BOOL16 *
 BSTR16 *
+BYTE *
 CLASSENTRY *
 CLSID *
 COLORREF *
@@ -104,7 +105,6 @@
 LPCOMSTAT16
 LPCONVCONTEXT16
 LPCONVINFO16
-LPCURSORINFO
 LPCVOID
 LPDCB16
 LPDEVMODEA
diff --git a/tools/winapi_check/win32api.dat b/tools/winapi_check/win32api.dat
index 6ee65d0..5016f1a 100644
--- a/tools/winapi_check/win32api.dat
+++ b/tools/winapi_check/win32api.dat
@@ -62,6 +62,7 @@
 HWAVEOUT
 HWINSTA
 INT
+IPAddr
 KEY_INFORMATION_CLASS
 KEY_VALUE_INFORMATION_CLASS
 LANGID
@@ -83,6 +84,7 @@
 PHANDLE
 PHPROVIDER
 PIO_APC_ROUTINE
+PIP_OPTION_INFORMATION
 PLSA_HANDLE
 PLSA_OBJECT_ATTRIBUTES
 PLSA_UNICODE_STRING
@@ -139,8 +141,8 @@
 CODEPAGE_ENUMPROCA
 CODEPAGE_ENUMPROCW
 COLORADJUSTMENT *
-CONST
 CONTEXT *
+CONTEXT86 *
 COSERVERINFO *
 CRITICAL_SECTION *
 CRTDLL_FILE *
@@ -167,6 +169,7 @@
 ENUMRESNAMEPROCW
 ENUMRESTYPEPROCA
 ENUMRESTYPEPROCW
+ENUMPASSWORDPROC
 EXCEPTION_RECORD *
 FARPROC
 FARPROC *
@@ -197,7 +200,6 @@
 HMIDIOUT *
 HMIDISTRM *
 HMODULE *
-HMRU
 HOOKPROC
 HPCSTR
 HPSTR
@@ -210,6 +212,7 @@
 IDataObject **
 IDropSource *
 IDropTarget *
+IErrorInfo *
 ILockBytes *
 IMAGEINFO *
 IMAGELISTDRAWPARAMS *
@@ -225,6 +228,7 @@
 ITypeLib *
 ITypeLib **
 IUnknown *
+LARGE_INTEGER *
 LHCLIENTDOC *
 LHSERVER *
 LHSERVERDOC *
@@ -279,6 +283,7 @@
 LPCPROPSHEETHEADERW
 LPCPROPSHEETPAGEA
 LPCPROPSHEETPAGEW
+LPCREATEMRULIST
 LPCSTR *
 LPCTBBUTTON
 LPCVOID
@@ -310,6 +315,7 @@
 LPDROPTARGET
 LPDSENUMCALLBACKA
 LPDWORD
+LPDWORD *
 LPENHMETAHEADER
 LPENUMFORMATETC *
 LPENUMOLEVERB *
@@ -401,7 +407,6 @@
 LPMONIKER
 LPMONIKER *
 LPMONITORINFO
-LPMRUINFO
 LPMSG
 LPMSGBOXPARAMSA
 LPMSGBOXPARAMSW
@@ -501,6 +506,7 @@
 LPSYSTEM_INFO
 LPSYSTEM_POWER_STATUS
 LPTHREAD_START_ROUTINE
+LPTHREADENTRY
 LPTIMECALLBACK
 LPTIMECAPS
 LPTIME_ZONE_INFORMATION
@@ -525,6 +531,7 @@
 MAT2 *
 MENUITEMINFOA *
 MENUITEMINFOW *
+METAFILEPICT *
 METARECORD *
 MFENUMPROC
 MIDIHDR *
@@ -635,6 +642,7 @@
 SECURITY_ATTRIBUTES *
 SECURITY_DESCRIPTOR *
 SECURITY_INFORMATION *
+SECURITY_QUALITY_OF_SERVICE *
 SHFILEINFOA *
 SHFILEINFOW *
 SNB
diff --git a/tools/winapi_check/winapi.pm b/tools/winapi_check/winapi.pm
index 192aa69..8512714 100644
--- a/tools/winapi_check/winapi.pm
+++ b/tools/winapi_check/winapi.pm
@@ -170,6 +170,7 @@
 
 	if($header)  {
 	    if(/^name\s*(\S*)/) { $module = $1; }
+	    if(/^type\s*(\w+)/) { $type = $1; }
 	    if(/^\d+/) { $header = 0 };
 	    next;
 	} 
@@ -186,14 +187,30 @@
 	    # FIXME: Internal name existing more than once not handled properly
 	    $$function_arguments{$internal_name} = $arguments;
 	    $$function_calling_convention{$internal_name} = $calling_convention;
-	    $$function_module{$internal_name} = "$module";
+	    if(!$$function_module{$internal_name}) {
+		$$function_module{$internal_name} = "$module";
+	    } elsif($$function_module{$internal_name} !~ /$module/) {
+		$$function_module{$internal_name} .= " & $module";
+	    }
 	} elsif(/^(\d+)\s+stub\s+(\S+)$/) {
 	    my $external_name = $2;
 
 	    $ordinal = $1;
 
-	    $$function_stub{$external_name} = 1;
-	    $$function_module{$external_name} = $module;
+	    my $internal_name;
+	    if($type eq "win16") {
+		$internal_name = $external_name . "16";
+	    } else {
+		$internal_name = $external_name;
+	    }
+
+	    # FIXME: Internal name existing more than once not handled properly
+	    $$function_stub{$internal_name} = 1;
+	    if(!$$function_module{$internal_name}) {
+		$$function_module{$internal_name} = "$module";
+	    } elsif($$function_module{$internal_name} !~ /$module/) {
+		$$function_module{$internal_name} .= " & $module";
+	    }
 	} elsif(/^\d+\s+(equate|long|word|extern|forward)/) {
 	    # ignore
 	} else {
diff --git a/tools/winapi_check/winapi_check b/tools/winapi_check/winapi_check
index 87e6ec0..a8d3cd5 100755
--- a/tools/winapi_check/winapi_check
+++ b/tools/winapi_check/winapi_check
@@ -101,8 +101,8 @@
 	close(IN);
     }
 
-    my @files2 = ("acconfig.h", "poppack.h", "pshpack1.h", "pshpack2.h", "pshpack4.h", "pshpack8.h");
-
+    my @files2 = ("acconfig.h", "poppack.h", "pshpack1.h", "pshpack2.h", "pshpack4.h", "pshpack8.h",
+                  "storage.h", "ver.h");
     foreach my $file2 (@files2) {
 	$includes{"include/$file2"}{used}++;
     }    
@@ -264,7 +264,7 @@
     my $conditional = 0;
     my $found_include = sub {
 	local $_ = shift;
-	if(/^\"(config\.h|native\.h)\"/) {
+	if(/^\"config\.h\"/) {
 	    $config++;
 	}
     };
diff --git a/tools/winapi_check/winapi_local.pm b/tools/winapi_check/winapi_local.pm
index 47f8b18..f73b231 100644
--- a/tools/winapi_check/winapi_local.pm
+++ b/tools/winapi_check/winapi_local.pm
@@ -13,10 +13,10 @@
     my $winapi = shift;
 
     my $module = $winapi->function_module($name);
-
+       
     if($winapi->name eq "win16") {
 	my $name16 = $name;
-	$name16 =~ s/16$//;   
+	$name16 =~ s/16$//;
 	if($name16 ne $name && $winapi->function_stub($name16)) {
 	    if($options->implemented) {
 		&$output("function implemented but declared as stub in .spec file");
@@ -106,7 +106,13 @@
     } elsif($#argument_types != -1 && $argument_types[$#argument_types] eq "...") {
 	&$output("function not declared as vararg");
     }
-	
+
+    if($#argument_types != -1 && $argument_types[$#argument_types] eq "CONTEXT *" &&
+       $name !~ /^(Get|Set)ThreadContext$/)
+    {
+	$#argument_types--;
+    }
+    
     if($name =~ /^CRTDLL__ftol|CRTDLL__CIpow$/) {
 	# ignore
     } else {
diff --git a/tools/winapi_check/winapi_parser.pm b/tools/winapi_check/winapi_parser.pm
index 802b648..bb8d198 100644
--- a/tools/winapi_check/winapi_parser.pm
+++ b/tools/winapi_check/winapi_parser.pm
@@ -31,6 +31,7 @@
 	$function = "";
     };
 
+    my %regs_entrypoints;
     my @comments = ();
     my $level = 0;
     my $again = 0;
@@ -146,7 +147,9 @@
 	    $return_type =~ s/\s*\*\s*/*/g;
 	    $return_type =~ s/(\*+)/ $1/g;
 
-	    $name =~ s/^REGS_FUNC\((.*?)\)/$1/;
+	    if($regs_entrypoints{$name}) {
+		$name = $regs_entrypoints{$name};
+	    } 
 
 	    $arguments =~ y/\t\n/  /;
 	    $arguments =~ s/^\s*(.*?)\s*$/$1/;
@@ -158,7 +161,7 @@
 		$argument =~ s/^\s*(.*?)\s*$/$1/;
 		#print "  " . ($n + 1) . ": '$argument'\n";
 		$argument =~ s/^(IN OUT(?=\s)|IN(?=\s)|OUT(?=\s)|\s*)\s*//;
-		$argument =~ s/^(const(?=\s)|\s*)\s*//;
+		$argument =~ s/^(const(?=\s)|CONST(?=\s)|\s*)\s*//;
 		if($argument =~ /^...$/) {
 		    $argument = "...";
 		} elsif($argument =~ /^((struct\s+|union\s+|enum\s+)?\w+)\s*((\*\s*?)*)\s*/) {
@@ -238,6 +241,9 @@
 		&$function_begin($documentation,"UINT", "WINAPI", "waveOut" . $2, \@arguments32);
 		&$function_end;
 	    }
+        } elsif(/DEFINE_REGS_ENTRYPOINT_\d+\(\s*(\S*)\s*,\s*([^\s,\)]*).*?\)/s) {
+	    $_ = $'; $again = 1;
+	    $regs_entrypoints{$2} = $1;
 	} elsif(/;/s) {
 	    $_ = $'; $again = 1;
 	} elsif(/\{/s) {