Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Win32::API: deciphering a returned pointer to a struct

by Util (Priest)
on Aug 21, 2009 at 18:57 UTC ( [id://790441]=note: print w/replies, xml ) Need Help??


in reply to Win32::API: deciphering a returned pointer to a struct

  1. Always turn on double quotes before using Data::Dumper on data with possible unprintable data;
    otherwise, you cannot tell what your data really is:
    local $Data::Dumper::Useqq = 1;
  2. Ignore the keys typedef and buffer_recipients in the Dumper output. This will leave you with just the expected fields in DOMAIN_CONTROLLER_INFO, and an extra buffer field which contains the raw bytes of the structure.
  3. What happens if you declare the DsGetDcName API using the `prototype` style, instead of the older `parameter list` style you are using? Does that resolve the problem, or at least change the behavior? i.e. change:
    my $DsGetDcName = Win32::API->new('Netapi32', 'DsGetDcName', 'PPSPNS', + 'N') or die Win32::FormatMessage(Win32::GetLastError);
    to:
    my $DsGetDcName_declare = <<'END_OF_DECLARE'; DWORD DsGetDcName( LPCTSTR ComputerName, LPCTSTR DomainName, LPGUID DomainGuid, LPCTSTR SiteName, ULONG Flags, LPDOMAIN_CONTROLLER_INFO DomainControllerInfo ); END_OF_DECLARE my $DsGetDcName = Win32::API->new( Netapi32 => $DsGetDcName_declare ) or die Win32::FormatMessage(Win32::GetLastError);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://790441]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-29 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found