Jump to content

DLL CALL NULL PARAMATERS


Recommended Posts

*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!

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Administrators

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.

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