Jump to content

Complex Dll Call?


Recommended Posts

...

A simple call in my point of view

$auth = DLLStructCreate("int;char[100];char[100]")
$alldevs = DLLStructCreate("ptr", DLLStructGetPtr(DLLStructCreate("ptr;char[100];char[100];ptr;uint")))
DLLCall("name_of_dll", "int", "pcap_findalldevs_ex", "str", $source, "ptr", DLLStructGetPtr($auth), "ptr", DLLStructGetPtr($alldevs), "str", $errorbuff )

#)

Link to comment
Share on other sites

...

A simple call in my point of view

$auth = DLLStructCreate("int;char[100];char[100]")
$alldevs = DLLStructCreate("ptr", DLLStructGetPtr(DLLStructCreate("ptr;char[100];char[100];ptr;uint")))
DLLCall("name_of_dll", "int", "pcap_findalldevs_ex", "str", $source, "ptr", DLLStructGetPtr($auth), "ptr", DLLStructGetPtr($alldevs), "str", $errorbuff )

#)

im using the new beta..

C:\Dokumente und Einstellungen\FFS\Desktop\AU3scripts\pcap.au3(3,50) : ERROR: DLLStructCreate(): undefined function.

$auth = DLLStructCreate("int;char[100];char[100]")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Dokumente und Einstellungen\FFS\Desktop\AU3scripts\pcap.au3(4,102) : ERROR: DLLStructGetPtr(): undefined function.

$alldevs = DLLStructCreate("ptr", DLLStructGetPtr(DLLStructCreate("ptr;char[100];char[100];ptr;uint"))

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~^

C:\Dokumente und Einstellungen\FFS\Desktop\AU3scripts\pcap.au3 - 2 error(s), 0 warning(s)

Link to comment
Share on other sites

  • Moderators

Doesn't look like your using Beta... make sure if your using SciTe your using Alt+F5 to run it.

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

Doesn't look like your using Beta... make sure if your using SciTe your using Alt+F5 to run it.

thx, that works now .. but when i create a struct like this

DLLStructCreate("ptr", DLLStructGetPtr(DLLStructCreate("ptr;char[100];char[100];ptr;uint")))

how do i access the "ptr;char[100];char[100];ptr;uint" stuff?

so how do i get the data of the object referenced by the pointer?

this does not work :

$source = "rpcap://";
$err = "";
$auth = DLLStructCreate("int;char[100];char[100]")
$devs = DLLStructCreate("ptr;char[100];char[100];ptr;uint")
$alldevs = DLLStructCreate("ptr", DLLStructGetPtr($devs))
DLLCall("wpcap.dll", "int", "pcap_findalldevs_ex", "str", $source, "ptr", DLLStructGetPtr($auth), "ptr", DLLStructGetPtr($alldevs), "str", $err )
MsgBox(0,$err, DllStructGetData ( $devs, 3))
Edited by pixartist
Link to comment
Share on other sites

$source = "rpcap://";
$err = "";
$auth = DLLStructCreate("int;char[100];char[100]")
$devs = DLLStructCreate("ptr;char[100];char[100];ptr;uint")
$alldevs = DLLStructCreate("ptr", DLLStructGetPtr($devs))
DLLCall("wpcap.dll", "int", "pcap_findalldevs_ex", "str", $source, "ptr", DLLStructGetPtr($auth), "ptr", DLLStructGetPtr($alldevs), "str", $err )
$name = DllStructGetData ( $devs, 3)
MsgBox(0,$err, $name)

well, as DllStructGetData ( $devs, 3) is a char[100] it should return as a string...but the message box just displays nothing!

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