Am I perhaps calling the function wrong or something? as I get a
Not a CODE reference at xx.pl line 14
which is where the $function is called in the sub routine

#!/usr/bin/perl use Win32::API; my $function = Win32::API->new('C:\XYZClientLibrary\x86\XYZClientLibra +ry.dll', 'XYZDecrypt', 'PPP', 'I'); print call_function('9','8B3A06617FEC4276A5711FBA4861B467', '[000001]C +0808FC9B3062D91E7B9B1D9A7B79216'); sub call_function { my ($value, $key, $encrypted) = @_; # Here we pad $value to the expected length, to avoid a buffer ove +rrun # I guess that the result is at most as long as the encrypted stri +ng $value = ' ' x length($encrypted); print (" $value, $key, $encrypted\n"); $value = $function->( $value, $key, $encrypted ); $value =~ s!\0.*!!; # we assume that the first \0 returned indicat +es end of the string return $value };

In reply to Re^2: calling a function from a dll by nmeijer
in thread calling a function from a dll by nmeijer

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.