Jump to content

Dll did I convert void* and wchar_t correctly?


Recommended Posts

ConsoleWrite("starting" & @CRLF)

$hDLL = DllOpen("CredCreator.dll")
;~ ConsoleWrite("Error" & $hDLL & @error)

$Cred_Create = DllCall($hDLL,"ptr","cred_create","wstr","KEYTEST")
ConsoleWrite("$Cred_Create=" & $Cred_Create & " error=" & @error & @CRLF)

$Cred_Register = DllCall($hDLL,"int","cred_register","ptr", "mgr", "wstr","USERNAME", "wstr", "PASSWORD")
ConsoleWrite("$Cred_Register=" & $Cred_Register & " error=" & @error & @CRLF)

$cred_free = DllCall($hDLL,"none","cred_free","ptr", "mgr")
ConsoleWrite("cred_free=" & $Cred_Register & " error=" & @error & @CRLF)



I got this from a C file

;~ DLLEXPORT(void*) cred_create(wchar_t* AppName);

;~ DLLEXPORT(int) cred_register(void* mgr, wchar_t* username, wchar_t* password);

;~ DLLEXPORT(void) cred_free(void* mgr);


Did I "translate" it correctly in the DllCall ... so

void* = ptr and wchar_t* = wstr

int = int etc or could I use wchar_t .. I saw some examples here that used it but I get an error 2 (unknown return type)

Edited by pdvos
Link to comment
Share on other sites

Ah seemed that I translated it correctly but it went wrong on the part were the dll returned pointers (and seemingly this didn't work) I asked the dll guy to return an int an now it's working...

$Cred_Register = DllCall($hDLL,"int","cred_register","wstr", "AppName" , "wstr","User", "wstr", Password")


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...