Sign in to follow this  
Followers 0
myredeemerlives

DLL CALL NULL PARAMATERS

10 posts in this topic

*sigh*

I am trying to pass a null paramater to a DLL function with DLL call and I don't know how to do it. ARG!!!!!! If I use LONG, and 0. Then I just get a THIS PROGRAM HAS CAUSED AN ILLEGAL OPERATION.

What I am trying to do is write a Win32 Console Script using the pure WinAPI.

Some HELP!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

please show a script example.... please.... pretty please...

Lar.

<{POST_SNAPBACK}>

$STD_OUTPUT = -Dec("11")

$Yo = DLLOpen("C:\Windows\System\Kernel32.dll")
DLLCall($Yo,"LONG","AllocConsole")
$hOutput = DLLCall($Yo,"LONG","GetStdHandle","LONG",$STD_OUTPUT)
DLLCall($Yo, "LONG","WriteConsole","LONG",$hOutput,"STRING","Hello","LONG",StringLen("Hello"),"","","","")
MsgBox(0,"HMM","WRITE SOMETHING TO THE CONSOLE WINDOW DARN IT!!!!")
DLLCALL($Yo,"LONG","FreeConsole")
DLLClose($Yo)
Edited by myredeemerlives

Share this post


Link to post
Share on other sites

Just as a guess, but perhaps you need to do it like

DllCall($Yo, 'Long', 'FreeConsole', 'void', 0) ?? Have you tried that?

Share this post


Link to post
Share on other sites

Just as a guess, but perhaps you need to do it like

DllCall($Yo, 'Long', 'FreeConsole', 'void', 0) ?? Have you tried that?

<{POST_SNAPBACK}>

FreeConsole has no paramaters Im talking about WriteConsole.

Share this post


Link to post
Share on other sites

DLLCall($Yo, "LONG","WriteConsole","LONG",$hOutput,"STRING","Hello","LONG",StringLen("Hello"),"","","","")

i am sure the above is incorrect as it does not describe the last four pams... "","","","" cannot be correct.

Lar.

<{POST_SNAPBACK}>

I already tried using all the possible param types for the last 4 and 0 as the paramaters but it didn't work.

The function either fails, or it suceeds and causes and illegal operation.

I was doing this type of thing in VB6 just before so I know what Im doing with these functions it is just that I need AutoIt to be able to pass null paramaters.

Share this post


Link to post
Share on other sites

BOOL AllocConsole(void);

AllocConsole returns a boolean, not a console handle...

maybe you need...

HANDLE GetStdHandle(DWORD nStdHandle);

<{POST_SNAPBACK}>

I thought that GetStdHandle returns a long no?

What the.....?

Well, I will try it.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I thought that GetStdHandle returns a long no?

What the.....?

Well, I will try it.

<{POST_SNAPBACK}>

The functions didn't work at all, and I mean at all, when I changed the types.

AllocConsole returns a long, according to my WinAPI viewer.

When I used bool, it wouldn't even open a console window.

hmmm. This is weird.

Edit: The function refuses to work under any circumstances.

Edited by myredeemerlives

Share this post


Link to post
Share on other sites

So I guess nobody knows the answer?

Share this post


Link to post
Share on other sites

Gee, some support forum.

Share this post


Link to post
Share on other sites

From the Sticky post in the Dev forum:

Windows Datatype = DllCall Type

BOOL = "int"

COLORREF = "int"

DWORD = "int"

HANDLE = "ptr"

HDC = "ptr"

HFILE = "int"

HFONT = "ptr"

HICON = "ptr"

HINSTANCE = "ptr"

HKEY = "ptr"

HMENU = "ptr"

HMODILE = "ptr"

HWND = "hwnd"

INT = "int"

LONG = "long"

LPARAM = "long"

LPCTSTR = "str" ("wstr" if a UNICODE function)

LPINT = "int_ptr"

LPLONG = "long_ptr"

UINT = "int"

ULONG = "long"

WPARAM = "int"

HANDLE and BOOL are listed. Try that.

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