[tools 1/2] c2man: Recognize file extensions in forward specifications.

Jinoh Kang jinoh.kang.kr at gmail.com
Thu Apr 7 11:04:52 CDT 2022


Today, c2man assumes that there is no file extension in the DLL name
part of a forward specification.  This causes forwarded exports to
krnl386.exe16 from kernel32 to be recognized incorrectly.
For example, the spec index file for kernel32 contains the following
incorrect entry:

    VxDCall0() (forwarded to exe16.VxDCall0() in krnl386())

Fix this by correctly handling DLL names with file extensions in forward
specifications.  We omit the extension in the link destination, but not
the link text itself.  The line above is now changed into:

    VxDCall0() (forwarded to VxDCall0() in {{krnl386.exe16}}{{krnl386}})

We switch to the double-brace syntax for the DLL hyperlink, since the
"<id>()" syntax cannot accept strings with dots in them.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 c2man.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/c2man.pl b/c2man.pl
index 0fe9e78..883a888 100755
--- a/c2man.pl
+++ b/c2man.pl
@@ -1229,9 +1229,9 @@ sub output_spec($)
       # @$_ => ordinal, call convention, exported name, implementation name, flags;
       if (@$_[$EXPORT_CALL] eq "forward")
       {
-        my $forward_dll = @$_[$EXPORT_IMPNAME];
-        $forward_dll =~ s/\.(.*)//;
-        $line = @$_[$EXPORT_EXPNAME]." (forward to ".$1."() in ".$forward_dll."())";
+        if (@$_[$EXPORT_IMPNAME] =~ /^(?:([^.]*)((?:\..*)?)\.)?([^.]*)$/) {
+          $line = @$_[$EXPORT_EXPNAME]." (forward to ".$3."() in {{".$1.$2."}}{{".$1."}})";
+        }
       }
       elsif (@$_[$EXPORT_CALL] eq "extern")
       {
-- 
2.34.1




More information about the wine-devel mailing list