Jump to content

DLLCall


Shyke
 Share

Recommended Posts

Alright, welcome to another one of my ignorance related problems!!

We start with needed to call the windows "crypt32.dll" function "CryptProtectData". I start with:

DllCall("crypt32.dll", "int", "CryptProtectData")

Knowing that the shown code isn't gonna do crap all but unsure how to progress on it. I do a little bit of searching into this function and find this site with data on it although in Perl. I'm unsure of how to use this in AutoIt and come to you guys for help.

Link to comment
Share on other sites

  • Moderators

The first step is knowing the parameters and what to substitute the MSDN params with:

http://msdn.microsoft.com/library/default....protectdata.asp

http://www.autoitscript.com/forum/index.php?showtopic=7072

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

have you viewed the DllCall entry in the helpfile? It provides some excellent examples.

DllCall ( "dll", "return type", "function" [, "type1", param1 [, "type n", param n]] )

Type1 = type of parameter

param1 = first parameter

Link to comment
Share on other sites

Dim $data = "data", $desc = "description of data", $pass = "pass", $out = ""
$return = DllCall("crypt32.dll", "int", "CryptProtectData", "ptr", $data, "str", $desc, "ptr", $pass, "none", "", "none", "", "dword", "CRYPTPROTECT_LOCAL_MACHINE", "ptr", $out)

Alright, between AutoItSmith and I.. we got that. Of course it doesn't work how I want it to. It returns a 0... which was pretty much expected knowing my luck. Would anyone have any idea why?

Link to comment
Share on other sites

I'm only currently working with:

Dim $data = "data", $desc = "description of data", $pass = "pass", $out = ""
$return = DllCall("crypt32.dll", "int", "CryptProtectData", "str", $data, "str", $desc, "ptr", $pass, "none", "", "none", "", "dword", "CRYPTPROTECT_LOCAL_MACHINE", "ptr", $out)

The MSDN thingy and the AutoIt DLLCall topic...

Edited by Shyke
Link to comment
Share on other sites

I'm only currently working with:

Dim $data = "data", $desc = "description of data", $pass = "pass", $out = ""
$return = DllCall("crypt32.dll", "int", "CryptProtectData", "str", $data, "str", $desc, "ptr", $pass, "none", "", "none", "", "dword", "CRYPTPROTECT_LOCAL_MACHINE", "ptr", $out)oÝ÷ Ù8^º¹

Dunno why I chose 1 and 0 but that link says they are ints.

Dunno how it wants you to get the size for the BLOB_DATA's, but in the example in that first link it calls the DLL with pointers set to 0 in order to get $prompt size, then it calls the DLL again with the correct structs. Not sure if you just set that one pointer to 0, or all of them.

Sorry if this doesn't help! :P

Link to comment
Share on other sites

What are the use of the "DllStructCreate()" calls in this???

3 parameters require a struct. So you use that to create a struct, give it the data it needs, then get the pointer of that struct for the parameter. Look at the links.

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
 Share

  • Recently Browsing   0 members

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