in reply to calling a function from a dll
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 };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: calling a function from a dll
by BrowserUk (Patriarch) on Dec 31, 2012 at 20:02 UTC | |
by nikosv (Deacon) on Jan 04, 2013 at 06:28 UTC | |
|
Re^2: calling a function from a dll
by nmeijer (Initiate) on Dec 31, 2012 at 19:03 UTC | |
by roboticus (Chancellor) on Dec 31, 2012 at 19:26 UTC |