Hi again,
again, thanks to you both for your suggestions, I tried a good few variations on the buffer size, but without success. The same error message appeared...
I also tried using windows style file paths, and included the change of
my ($final) = $string =~/(.*?)\x00/;. But this also had no effect. The code now appears like this:
#!usr/bin/perl
use Win32::API;
my $filename="C:\\Program Files\\America Online 9.0g\\aol.exe";
my $apiobject = new Win32::API("C:\\Documents and Settings\\Mdaviesie\
+\Desktop\\dver_1.3\\fileversion.dll", "GetFileVersionTxt", 'PP','I')
+or die "Failed to acquire API: $^E";
#Set some memory aside for the returned value
my $string="\x00" x 1024;
#Call the function in the dll
$apiobject->Call($filename,$string)| die "died at line 16";
#Remove the unused padding in the string
my ($final) = $string =~/(.*?)\x00/;
print "\$final - $final";
I'm still no closer to figuring this one out, so if anybody out there could help me it would be greatly appreciated.
Thanks in advance,
Jonathan
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.