in reply to Print Buffer

Proably not what you want, but you could try http://search.cpan.org/~mjd/PeekPoke-0.01/PeekPoke.pm

Replies are listed 'Best First'.
Re^2: Print Buffer
by iea (Beadle) on Aug 11, 2008 at 14:52 UTC
    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

      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);
      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