From: Jos Backus Date: 2004-07-14T03:03:39+09:00 Subject: Re: win32api: how to access NetFileEnum results? Hi daz, On Tue, Jul 13, 2004 at 04:32:23PM +0900, daz wrote: [snip] > However bufptr (from NetFileEnum) is a POINTER_to_address (POINTER_POINTER), > so Win32API is *not* required to convert this parameter into a POINTER. > Passed as a L(ONG), it fulfils the requirement that it's a POINTER already. > > What this often leads to is multiple definitions such as: > > Pmemcpy1 = Win32API.new('msvcrt', 'memcpy', 'PLL'], 'L') > Pmemcpy2 = Win32API.new('msvcrt', 'memcpy', 'LPL'], 'L') > > for use in cases such as yours. > > Call with: > > Pmemcpy1.call(dest ruby string, src POINTER_POINTER, length) > Pmemcpy2.call(dest POINTER_POINTER, src ruby string, length) > > > Hope that's OK. Haven't tried ... (I'm not NT) Thanks for the info. I did indeed overlook the `*' after the LPBYTE typename. Next question is: using Pmemcpy1, how do I initialize the src POINTER_POINTER argument (i.e. bufptr)? Setting it to 0 causes ruby to segfault (both 1.8.1 and today's 1.8.2 snapshot installed using the one-click installer) and setting it to "\0" * 4 causes a TypeError as the template specifies a Long and I'm supplying a String. Thanks, -- Jos Backus _/ _/_/_/ Sunnyvale, CA _/ _/ _/ _/ _/_/_/ _/ _/ _/ _/ jos at catnook.com _/_/ _/_/_/ require 'std/disclaimer'