G'day.
I've just stepped into the, erm, wonderful world of Win32 programming. I have a dll which is needed to translate a password in an application we use. I've been given the specs of the dll as follows:

Function: bgfnTextDecrypt Description: Export Ordinal: 0 Returns Boolean: BOOL Parameters String: LPSTR Receive String: LPSTR
I'm trying to translate this into either a Win32::API or Win32::API::Prototype programme.
I have tried the following pieces of code:
#!perl use strict; use Win32::API; my $bgfnTextDecrypt = new Win32::API('eq_handy', 'bgfnTextDecrypt','PP +','P'); if(not defined $bgfnTextDecrypt) { die "Can't import API bgfnTextDecrypt: $!\n"; } print "Eerk\n"; my $lpBuffer = " " x 80; print "Eerk2\n"; my $return = $bgfnTextDecrypt->Call('password-crypt', $lpBuffer); print "Eerk3\n"; my $decrypt = substr($lpBuffer, 0, $return); print "$decrypt\n";
and
#!perl use strict; use Win32::API::Prototype; ApiLink( 'eq_handy.dll', 'BOOL bgfnTextDecrypt( LPSTRING lpString, LP +STRING, lpBuffer )' ) || die; my $lpString="password-crypt"; my $lpBuffer = pack( "L*", $lpString); bgfnTextDecrypt($lpString); my $pass = unpack( "L*", $lpBuffer ); print( "The pass is: $pass\n";
As I have never coded in Win32 before, I'm a little lost.
Is there anyone who can point me in the right direction? Even a similar MS dll as an example would be wonderful.

Thanks.
Neil

EDIT: Changed the dll name in the second example.


In reply to Win32::API and ::Prototype assistance by neilh

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.