RE: "Win32::API::Callback::IATPatch" name for DLL/SO hooker for Win32::API

[email protected] ("Steve Hay")
Newsgroups perl.libwin32
Message-ID <[email protected]>
bulk 88 wrote on 2012-10-14:
> 
> 
> 
> ----------------------------------------
>> To: [email protected]
>> CC: [email protected]; [email protected]
>> Subject: Re: "Win32::API::Callback::IATPatch" name for DLL/SO hooker
>> for Win32::API
>> Date: Sun, 14 Oct 2012 21:25:31 +0200
>> From: [email protected]
>> 
>> On Sun, 14 Oct 2012 21:12:50 +0200, Cosimo Streppone
>> <[email protected]>
>> wrote:
>> 
>>> I'll have a look at your pull request and reply within 24 hours.
>> 
>> Your pull request is now fully merged.
>> I have looked at the commits and it's clear that this is way over my
>> head now.
>> 
>> I think it makes sense to give you co-maint of Win32::API.
>> Your CPAN id is BULKDD, right?
>> 
>> In the meantime, I pushed 0.71 to CPAN.
>> 
>> --
>> Cosimo
> 
> My CPAN ID is BULKDD see http://search.cpan.org/~bulkdd/ . It is a
> derivative of my online username bulk88. There is an unauthorized
> release of Win32::API there so that account is me. Also the unauth
> release did get a PASS cpantesters report,
> http://www.cpantesters.org/cpan/report/f87f09c0-3a6b-1015-863c-
> 2ca505085451 . My plans in the near future once I get the pause
> permission is to close the fixed tickets on CPAN RT if that is ok.
Thank
> you for the CPAN release. My goal is to get feedback or bug reports
for
> all my changes to Win32::API from the public.
>

Great to see this released to CPAN, but a small patch of mine for
skipping tests when fork() is not available was missed.

I produced it in the course of testing [perl #33096], and the patch was
attached there. I've attached it here too for convenience. Would you
like me to log a CPAN ticket for this, or will you take it from here?

PS. Purely out of curiosity, what is the reason for your online username
'bulk88'?!
nofork.patch (application/octet-stream, 2.3 KB)
diff -ruN bulk88-perl5-win32-api-70da72a.orig/Callback/t/iat.t bulk88-perl5-win32-api-70da72a/Callback/t/iat.t
--- bulk88-perl5-win32-api-70da72a.orig/Callback/t/iat.t	2012-09-03 01:32:52.000000000 +0100
+++ bulk88-perl5-win32-api-70da72a/Callback/t/iat.t	2012-09-14 09:09:54.494412500 +0100
@@ -86,6 +86,10 @@
    Win32::GetProcAddress(Win32::LoadLibrary("kernel32.dll"), 'QueryPerformanceCounter'),
    "GetOriginalFunctionPtr returns real QPC");
 
+my $can_fork = $Config{d_fork} || $Config{d_pseudofork} ||
+		(($^O eq 'MSWin32' || $^O eq 'NetWare') and
+		$Config{useithreads} and $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
+
 SKIP: {
     Win32::API::Type->typedef('PRTL_PROCESS_MODULES', 'char *');
     my $LdrQueryProcessModuleInformation =
@@ -93,8 +97,8 @@
     "NTSTATUS NTAPI  LdrQueryProcessModuleInformation(".
     "PRTL_PROCESS_MODULES ModuleInformation,
     ULONG Size, PULONG ReturnedSize)");
-    skip("This Perl doesn't have ithreads and/or this Windows OS doesn't have "
-         ."LdrQueryProcessModuleInformation", 6) if ! $Config{'useithreads'}
+    skip("This Perl doesn't have fork and/or this Windows OS doesn't have "
+         ."LdrQueryProcessModuleInformation", 6) if ! $can_fork
     || ! $LdrQueryProcessModuleInformation; #Native API changed, thats ok
     is(GetAPITestDLLLoadCount($LdrQueryProcessModuleInformation), 1,
        "DLL load count is 1 before fork");
@@ -213,4 +217,4 @@
             return $_->{LoadCount};
         }
     }
-}
\ No newline at end of file
+}
diff -ruN bulk88-perl5-win32-api-70da72a.orig/Callback/t/ithreads.t bulk88-perl5-win32-api-70da72a/Callback/t/ithreads.t
--- bulk88-perl5-win32-api-70da72a.orig/Callback/t/ithreads.t	2012-09-03 01:32:52.000000000 +0100
+++ bulk88-perl5-win32-api-70da72a/Callback/t/ithreads.t	2012-09-14 09:10:33.786912500 +0100
@@ -13,8 +13,12 @@
 
 #HeapBlock class is not public API
 
+my $can_fork = $Config{d_fork} || $Config{d_pseudofork} ||
+		(($^O eq 'MSWin32' || $^O eq 'NetWare') and
+		$Config{useithreads} and $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/);
+
 SKIP: {
-    skip("This Perl doesn't have ithreads", 1) if ! $Config{'useithreads'};
+    skip("This Perl doesn't have fork", 1) if ! $can_fork;
     #50 megs should be enough to force a VirtualAlloc and a VirtualFree
     my $ptrobj = new Win32::API::Callback::HeapBlock 5000000;
     my $pid = fork();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.