Jump to content

DllCall ("file descriptor" / *FILE fd) parameter how to use it


Recommended Posts

The dll I'm working with is here (librhash-1.2.9-win.zip: http://sourceforge.net/projects/rhash/files/rhash/1.2.9/ )

The API is defined as:

RHASH_API int rhash_file_update(rhash ctx, FILE* fd);

The way I understand it, the parameter "fd" is a file descriptor. so.. how I do I pass a "file descriptor" from autoit to the dll via DllCall?

_WinAPI_CreateFile is a no go... Autoit just freezes

Func _RHash_FileUpdate($Context, $sFilename)
Local $hFile = _WinAPI_CreateFile($sFilename, 2, 2, 4, 0)
If (Not $hFile) Then Return SetError(2, 0, 0)
Local $Ret = DllCall($RHash_DLL, "int:cdecl", "rhash_file_update", "ptr", $Context, "ptr", $hFile)
If @error Or ($Ret[0] < 0) Then Return SetError(1, @error, (_WinAPI_CloseHandle($hFile)*0))
_WinAPI_CloseHandle($hFile)
Return $Ret[0]
EndFunc
Link to comment
Share on other sites

Not so good with this, but I think the two params are struct and wchar respectively. I checked its source code online and judging by the basic looks, it appears to be written for Linux (primarily) and ported to Win32/64

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

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...