|laziness, impatience, and hubris|
Re: Re: Win32::API (finally)by neauva (Initiate)
|on Aug 19, 2003 at 22:01 UTC||Need Help??|
Very nice and Very handy package.
I'm having a problem, however... :-)
In short, I'm trying to use Win32::API to call CreateProcess.
All is well except for the LPSTARTUPINFO and LPPROCESS_INFORMATION parms I pass into the call. If I create these using pack(...) for the correct number of bytes, it works fine and I can get the PID back out of the PROCESS_INFORMATION object (my ultimate goal).
If, however, I create these parms using the Win32::API::Struct->new( 'STARTUPINFO' ) approach, the call fails. I'm even setting the .cb field to the size of the structure. The error I get back (using Win32::GetLastError()) is "Invalid access to memory location". Here's the function call I'm making (same in both cases):
Should CreateProcess be called the same way in both cases? When a ->new('STARTUPINFO') is called, is the memory zeroed-out upon creation? Any idea why the pack version succeeds and the Struct verion fails?