in reply to Re: Print Buffer
in thread Print Buffer

Sry ... IŽll try it more precisely.

Yes I am using win32::api an the definition of the function is:

When the function returns, this value contains the address of an allocated buffer, containing the information.
I defined my buffer like this

my $lpBuffer = " " x 1024;

And there is also something in $lpBuffer it should be a address =).

How can i get the information of the buffer with this address?

See in my first post the information i recieve.

I am not sure if i need to use unpack no.
thanks

Replies are listed 'Best First'.
Re^3: Print Buffer
by dHarry (Abbot) on Aug 11, 2008 at 15:21 UTC

    When the function returns, this value contains the address of an allocated buffer, containing the information. I defined my buffer like this...

    Does this function have a name and a return type? :--)

    In general: sometimes you get back the true length of the buffer $lpBuffer which you can use to decode the actual value. Sometimes $lpBuffer contains a \0, the C string terminator/delimiter so you have to trim the value.

      In C its handled with

      PtrToStringUni

      Is there anything like PtrToStringUni in Perl

      Here the C code
      iReturn = Api.GetInformation(hWIM,ref XMLInfo, ref iLength); String XMLStr = Marshal.PtrToStringUni(XMLInfo);
Re^3: Print Buffer
by Anonymous Monk on Aug 11, 2008 at 15:10 UTC
    We need more context. What you provided is insufficient and confusing. $lpBuffer is intended to contain the packed structure, example
    use strict; use warnings; use Win32::API; my $GetTempPath = new Win32::API( 'kernel32', 'GetTempPath', 'NP', 'N'); my $lpBuffer = " " x 80; my $return = $GetTempPath->Call(80, $lpBuffer); my $TempPath = substr($lpBuffer, 0, $return); print $TempPath,$/;
    Get it?
      ok ... here my code
      my $lpBuffer = " " x 60; my $lpSize = '60'; my $api = new Win32::API($wimdll, "GetInformation", ['N','P','P'], 'N' +); $api->Call($fiehandle,$lpBuffer,$lpSize)or die "$^E";
      Thanks