Jump to content

Pls help with PULONG


CHAFF
 Share

Recommended Posts

Hello everyone,

I've searched for this issue but can only come up with that Autoit Can't support PULONG types. I'm trying to rewrite the following line in Autoit.

Does anyone have any ideas?

Original:

Function CH341GetInput(iIndex:cardinal; iStatus:PULONG ):boolean;Stdcall; external'CH341DLL.DLL';

Autoit:

$dll = DllOpen("C:\Windows\system32\CH341DLL.DLL")

DllCall($dll, "none", "CH341SetOutput","ULONG", 0, "??????",?????)

many thanks in advance.

Link to comment
Share on other sites

Hello everyone,

I've searched for this issue but can only come up with that Autoit Can't support PULONG types. I'm trying to rewrite the following line in Autoit.

Does anyone have any ideas?

Original:

Function CH341GetInput(iIndex:cardinal; iStatus:PULONG ):boolean;Stdcall; external'CH341DLL.DLL';

Autoit:

$dll = DllOpen("C:\Windows\system32\CH341DLL.DLL")

DllCall($dll, "none", "CH341SetOutput","ULONG", 0, "??????",?????)

many thanks in advance.

That's a pointer to a ULONG, and the return type looks like "boolean" to me, so try:
$tULong = DllStructCreate("ulong")
$pULong = DllStructGetPtr($tULong)
$avRET = DllCall($dll, "int", "CH341SetOutput","ULONG", 0, "ptr", $pULong)

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

hmmm, this is what I get with with this and SciTE4AutoIt3 Version 1.71:

autoit3.exe

Error signature

AppName: autoit3.exe AppVer: 3.2.10.0 ModName: unknown

ModVer: 0.0.0.0 Offset: 00000000

Well, in the OP you gave the definition for "CH341GetInput", but in the code I copied you put "CH341SetOutput". Which is it? Where are the function definitions coming from?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hi PsaltyDS

Sorry about that, yes you are right, it does run clean now but I'm expecting some type of result from this function and I don't seem to get anything out. Is there any chance that this original code should pass anything back?

Function CH341GetInput(iIndex:cardinal; iStatus:PULONG ):boolean;Stdcall; external'CH341DLL.DLL';

This code now seems to run clean:

$dll = DllOpen("C:\Windows\system32\CH341DLL.DLL")

$tULong = DllStructCreate("ulong")

$pULong = DllStructGetPtr($tULong)

$result = DllCall($dll, "", "CH341GetInput","ULONG", 0, "ptr", $pULong)

MsgBox(0,"",$result)

Well, in the OP you gave the definition for "CH341GetInput", but in the code I copied you put "CH341SetOutput". Which is it? Where are the function definitions coming from?

:)

Link to comment
Share on other sites

Hi PsaltyDS

Sorry about that, yes you are right, it does run clean now but I'm expecting some type of result from this function and I don't seem to get anything out. Is there any chance that this original code should pass anything back?

Function CH341GetInput(iIndex:cardinal; iStatus:PULONG ):boolean;Stdcall; external'CH341DLL.DLL';

This code now seems to run clean:

$dll = DllOpen("C:\Windows\system32\CH341DLL.DLL")

$tULong = DllStructCreate("ulong")

$pULong = DllStructGetPtr($tULong)

$result = DllCall($dll, "", "CH341GetInput","ULONG", 0, "ptr", $pULong)

MsgBox(0,"",$result)

The $result is an array. So the boolean is in $result[0]. The "GetInput" you wanted is probably in the struct $tULong that you passed the pointer to.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You betcha it was right in $tULong[0][0]

Awesome, thanks very much for your help. I'll be posting my code soon when its done.

thx

-L

Code to what? What is this CH341DLL.DLL?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 2 weeks later...

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