I never could get the "C type parser" of Win32::API to work. I always had more luck manually constructing the parameter string using the P and I chars, and then using unpack for strings passed in and out.
In your case, maybe the following construct works:
$function = Win32::API->new('NSLClientLibrary', 'XYZDecrypt', 'PPP', ' +I'); 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; $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: calling a function from a dll
by Corion
in thread calling a function from a dll
by nmeijer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |