mirror of
https://github.com/solemnwarning/ipxwrapper
synced 2024-12-30 16:45:37 +01:00
Reinstate stub function logging hooks.
This commit is contained in:
parent
30c7556ef1
commit
09b235024d
22
mkstubs.pl
22
mkstubs.pl
@ -1,5 +1,5 @@
|
|||||||
# IPXWrapper - Generate assembly stub functions
|
# IPXWrapper - Generate assembly stub functions
|
||||||
# Copyright (C) 2008-2019 Daniel Collins <solemnwarning@solemnwarning.net>
|
# Copyright (C) 2008-2023 Daniel Collins <solemnwarning@solemnwarning.net>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify it
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License version 2 as published by
|
# under the terms of the GNU General Public License version 2 as published by
|
||||||
@ -30,10 +30,14 @@ my %DLL_INDICES = (
|
|||||||
"dpwsockx.dll" => 3,
|
"dpwsockx.dll" => 3,
|
||||||
"ws2_32.dll" => 4,
|
"ws2_32.dll" => 4,
|
||||||
"wpcap.dll" => 5,
|
"wpcap.dll" => 5,
|
||||||
|
"ipxconfig.exe" => 6,
|
||||||
);
|
);
|
||||||
|
|
||||||
my ($stub_file, $asm_file, $dll_name) = @ARGV;
|
my ($stub_file, $asm_file, $dll_name) = @ARGV;
|
||||||
|
|
||||||
|
my $dll_index = $DLL_INDICES{$dll_name}
|
||||||
|
// die "Unknown DLL name: $dll_name";
|
||||||
|
|
||||||
open(STUBS, "<$stub_file") or die("Cannot open $stub_file: $!");
|
open(STUBS, "<$stub_file") or die("Cannot open $stub_file: $!");
|
||||||
open(CODE, ">$asm_file") or die("Cannot open $asm_file: $!");
|
open(CODE, ">$asm_file") or die("Cannot open $asm_file: $!");
|
||||||
|
|
||||||
@ -145,6 +149,12 @@ foreach my $func(@stubs)
|
|||||||
print CODE <<"END";
|
print CODE <<"END";
|
||||||
global _$func->{name}
|
global _$func->{name}
|
||||||
_$func->{name}:
|
_$func->{name}:
|
||||||
|
; Log the call
|
||||||
|
push dword $func->{target_dll_index}
|
||||||
|
push $func->{name}_target_func
|
||||||
|
push dword $dll_index
|
||||||
|
call _log_call
|
||||||
|
|
||||||
; Check if we have address cached
|
; Check if we have address cached
|
||||||
cmp dword [$func->{name}_addr], 0
|
cmp dword [$func->{name}_addr], 0
|
||||||
jne $func->{name}_go
|
jne $func->{name}_go
|
||||||
@ -209,11 +219,11 @@ END
|
|||||||
push dword ebp
|
push dword ebp
|
||||||
sub dword [esp], 20
|
sub dword [esp], 20
|
||||||
|
|
||||||
; Start tick parameter to _fprof_record_untimed
|
; Start tick parameter to _fprof_record_timed
|
||||||
push dword ebp
|
push dword ebp
|
||||||
sub dword [esp], 8
|
sub dword [esp], 8
|
||||||
|
|
||||||
; FuncStats parameter to _fprof_record_untimed
|
; FuncStats parameter to _fprof_record_timed
|
||||||
push dword $func->{name}_fstats
|
push dword $func->{name}_fstats
|
||||||
|
|
||||||
; Record profiling data
|
; Record profiling data
|
||||||
@ -232,6 +242,12 @@ END
|
|||||||
print CODE <<"END";
|
print CODE <<"END";
|
||||||
global _$func->{name}
|
global _$func->{name}
|
||||||
_$func->{name}:
|
_$func->{name}:
|
||||||
|
; Log the call
|
||||||
|
push dword $func->{target_dll_index}
|
||||||
|
push $func->{name}_target_func
|
||||||
|
push dword $dll_index
|
||||||
|
call _log_call
|
||||||
|
|
||||||
; Check if we have address cached
|
; Check if we have address cached
|
||||||
cmp dword [$func->{name}_addr], 0
|
cmp dword [$func->{name}_addr], 0
|
||||||
jne $func->{name}_go
|
jne $func->{name}_go
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* IPXWrapper - Common functions
|
/* IPXWrapper - Common functions
|
||||||
* Copyright (C) 2011-2021 Daniel Collins <solemnwarning@solemnwarning.net>
|
* Copyright (C) 2011-2023 Daniel Collins <solemnwarning@solemnwarning.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms of the GNU General Public License version 2 as published by
|
* under the terms of the GNU General Public License version 2 as published by
|
||||||
@ -31,6 +31,7 @@ static const char *dll_names[] = {
|
|||||||
"dpwsockx.dll",
|
"dpwsockx.dll",
|
||||||
"ws2_32.dll",
|
"ws2_32.dll",
|
||||||
"wpcap.dll",
|
"wpcap.dll",
|
||||||
|
"ipxconfig.exe",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user