I am trying to use Win32::API to access advapi32.dll CredRead API, I have little experience with how to interact with Windows DLL’s, pointers, etc and way out of my depth here.
The error I am getting is “Win32::API a function was called with the wrong prototype and caused a C stack inconsistency”, code is below.
The CredRead is used to access the Windows version of Keepass, it is the Windows Credentials Manager.
Here is the code I have, can someone please assist me. Thank You
use strict;
use Win32;
use Win32::API;
# public enum CRED_TYPE : int
# {
# GENERIC = 1,
# DOMAIN_PASSWORD = 2,
# DOMAIN_CERTIFICATE = 3,
# DOMAIN_VISIBLE_PASSWORD = 4,
# MAXIMUM = 5
# }
my $CredRead = new Win32::API('advapi32.dll', 'CredRead', [qw(P P)],
'N') or die "Find CredRead: $^E";
my $strTarget = "testUser";
#I created user testUser via Control Panel > Credential Manager
$CredRead->Call($strTarget,1) or die "CredRead->Call: $^E";
Reference URL's:-
https://msdn.microsoft.com/en-us/library/windows/desktop/aa374804(v=vs.85).aspx
http://www.pinvoke.net/default.aspx/advapi32/CredRead%20.html
http://stackoverflow.com/questions/32548714/how-to-store-and-retrieve-credentials-on-windows-using-c-sharp?rq=1