Sign in to follow this  
Followers 0
Roswellr

CreateFileW API

3 posts in this topic

Can anyone give me a little help, im trying to use CreateFileW api from the kernel32.dll

heres what i use:

$s = DllCall("kernel32.dll", "dword", "CreateFileW", "wstr", $sFilename, "dword", $access, "dword", $sharing, "dword", $sa, "dword", $creation, "dword", $attributes, "dword", $template)

Where $sFilename = "C:\sometext.txt"

$access = $FILE_ACCESS_STDRIGHTSALL = 0x1F0000

$sharing = $FILE_SHARE_READWRITE = 3

$sa = 0

$creation = $FILE_MODE_OPENEXISTING = 3

$attributes = BitOR($FILE_FLAGS_BACKUPSEMANTICS, $FILE_FLAGS_SEQUENTIALSCAN) = 0x2000000 | 0x8000000

$template = 0

I cant seem to get any numerical value returned by $s

Any help appreciated, I just cant quiet grasp the whole DLLCall feature and why its not working.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

DllCall returns an array.

So to access CreateFileW return value use $s[0]

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

Thanks a bunch, missed the section below the Data Types in the help file.

Share this post


Link to post
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
Sign in to follow this  
Followers 0