diff --git a/tools/winapi/winapi.pm b/tools/winapi/winapi.pm index e5ed445d8e8..eb85d08219a 100644 --- a/tools/winapi/winapi.pm +++ b/tools/winapi/winapi.pm @@ -293,7 +293,10 @@ sub parse_spec_file($$) { $flags =~ s/\s+/ /g; - $internal_name = $external_name if !$internal_name; + if (!$internal_name) + { + $internal_name = ($flags =~ /-register/ ? "__regs_" : "") . $external_name; + } if($flags =~ /-noname/) { # $external_name = "@"; @@ -304,6 +307,9 @@ sub parse_spec_file($$) { $arguments .= "ptr"; $calling_convention .= " -register"; } + if($flags =~ /(?:-i386)/) { + $calling_convention .= " -i386"; + } if ($internal_name =~ /^(.*?)\.(.*?)$/) { my $forward_module = lc($1); diff --git a/tools/winapi/winapi_local.pm b/tools/winapi/winapi_local.pm index 01c8ab96230..f46d1ecd101 100644 --- a/tools/winapi/winapi_local.pm +++ b/tools/winapi/winapi_local.pm @@ -117,11 +117,9 @@ sub _check_function($$$$$$) { my $declared_calling_convention = $winapi->function_internal_calling_convention($internal_name) || ""; my @declared_argument_kinds = split(/\s+/, $winapi->function_internal_arguments($internal_name)); - my $declared_register = 0; - if ($declared_calling_convention =~ /^(\w+) -register$/) { - $declared_register = 1; - $declared_calling_convention = $1; - } + my $declared_register = ($declared_calling_convention =~ / -register\b/); + my $declared_i386 = ($declared_calling_convention =~ /(?:^pascal| -i386)\b/); + $declared_calling_convention =~ s/ .*$//; if(!$declared_register && $implemented_calling_convention ne $declared_calling_convention && @@ -158,12 +156,6 @@ sub _check_function($$$$$$) { } } - if($#argument_types != -1 && $argument_types[$#argument_types] eq "CONTEXT *" && - $internal_name =~ /^(?:RtlRaiseException|RtlUnwind|NtRaiseException)$/) # FIXME: Kludge - { - $#argument_types--; - } - if($internal_name =~ /^(?:NTDLL__ftol|NTDLL__CIpow)$/) { # FIXME: Kludge # ignore } else { @@ -172,7 +164,9 @@ sub _check_function($$$$$$) { my $type = $_; my $kind = "unknown"; $winapi->type_used_in_module($type,$module); - if($type eq "CONTEXT86 *") { + if($type eq "CONTEXT *") { + $kind = "context"; + } elsif($type eq "CONTEXT86 *") { $kind = "context86"; } elsif(!defined($kind = $winapi->translate_argument($type))) { $winapi->declare_argument($type, "unknown"); @@ -200,8 +194,15 @@ sub _check_function($$$$$$) { } } @argument_types; - if ($declared_register && $argument_kinds[$#argument_kinds] ne "context86") { - $output->write("function declared as register, but CONTEXT86 * is not last argument\n"); + if ($declared_register) + { + if (!$declared_i386 && + $argument_kinds[$#argument_kinds] ne "context") { + $output->write("function declared as register, but CONTEXT * is not last argument\n"); + } elsif ($declared_i386 && + $argument_kinds[$#argument_kinds] ne "context86") { + $output->write("function declared as register, but CONTEXT86 * is not last argument\n"); + } } for my $n (0..$#argument_kinds) { @@ -218,7 +219,7 @@ sub _check_function($$$$$$) { $argument_types[$n] = ""; } - if($argument_kinds[$n] eq "context86") { + if($argument_kinds[$n] =~ /^context(?:86)?$/) { # Nothing } elsif(!$winapi->is_allowed_kind($argument_kinds[$n]) || !$winapi->is_allowed_type_in_module($argument_types[$n], $module))