in reply to Windows Non-Paged Pool Memory Allocation

Are you (attempting to) writing a device driver in Perl?

If so, you're probably into a world of grief

If not, why do you want to use non-paged memory from an application?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Windows Non-Paged Pool Memory Allocation

Replies are listed 'Best First'.
Re^2: Windows Non-Paged Pool Memory Allocation
by Anonymous Monk on Oct 31, 2006 at 13:09 UTC
    This is meant to test the allocation. We have a few kernal leaks and want to detect the problem via an SNMP trap. I need to test that the trap will fire. So I need to run a program that will eat up a ton of non-paged windows memory to force the trap. I would rather not purchase a C compiler to run the test ... so I want to see if a perl module has already incorporated this OS specific function. Make sense?

      Okay, but you are going to be out of luck. According to the docs, both those apis need to be called from code running at an IRQ level:

      Callers of ExAllocatePoolWithQuotaTag must be running at IRQL <= APC_L +EVEL. Callers of AllocateCommonBuffer must be running at IRQL = PASSIVE_LEVE +L.

      If you knew (or search) to locate the dll they are exported from, the you could attempt to call them using Win32::API, but unless you know a way to cause your Perl script to be called by the kernel as an IRQ handler, it isn't going to to work.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Actually, it isn't that difficult. For example the code here will consume from the NP Pool until it faults for ($i=1; $i<=7000; $i++) { for ($k=1; $k<=1000; $k++) { $hash->{$k}->{"a $i b $j"}="$j fish $i"; } print "$j $i $k\n"; } I just want to see if there is a way to do it directly instead of indirectly
      Umm, you can download many C or C++ compilers gratis.

      Even MS its self makes a free version of Visual C++ 2005 (which will compile C code also) though obviously you would not be getting source code there
        More specifically, MSFT makes the Windows Driver Kit available. Since the description claims it's a full build environment, I'm assuming that means it has the C compiler you'd need to write your deliberately anti-social driver.

        I haven't downloaded it to check, though :)


        Mike