Jump to content

Need help on DllCallAddress


Recommended Posts

First, I really want to know what API is DllCallAddress used?

Second, I have this code

#include <Winapi.au3>

$SOCKETID = _GetSocketId()
$hModule = _WinAPI_GetModuleHandle("Ws2_32.dll")
$pProc = _WinAPI_GetProcAddress($hModule, "send")

$pBuffer = DllStructCreate("byte[5]")
DllStructSetData($pBuffer, 1, Binary("0x2EE96B457B"))

$ret = DllCallAddress("int", $pProc, "dword", $SOCKETID, "ptr", DllStructGetPtr($pBuffer), "int", DllStructGetSize($pBuffer), "int", Null)

Then, I get @error = 1 (not have in help document) and $ret = ""

So, anybody help me about this problem, I'll thks that person

Edited by HoangTieuBao
Link to comment
Share on other sites

@error  is set to non zero if the call fails and 1 is non zero so I think the help covers it.

Have you checked that GetModuleHandle and GetProcAddress are returning sensible answers?

Have you tried using DllCall?

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

@error  is set to non zero if the call fails and 1 is non zero so I think the help covers it.

Have you checked that GetModuleHandle and GetProcAddress are returning sensible answers?

Have you tried using DllCall?

 

I know @error is set to non zero if the call fails, but @error = 1 isn't had in the help

This is in the help

 

Success: an array. See remarks. Failure: sets the @error flag to non-zero. @error: 2 = unknown "return type",

4 = bad number of parameters,

5 = bad parameter

 

Don't have @error = 1

And GetModuleHandle and GetProcAddress are returning successful, (exactly value)

But DllCallAddress still fails.

I tried DllCall, it isn't what i need, it fails too

Link to comment
Share on other sites

The code from the first post can't succeed for sure. You see, you got the dll name wrong (superfluous space character).

 

I'm sure about the first post. The dll name is exactly.

This is link about function: http://msdn.microsoft.com/en-us/library/windows/desktop/ms740149%28v=vs.85%29.aspx

And one more thing, I tested code, it works ok, no problem about ProcAddress and ModuleHandle

Link to comment
Share on other sites

She's telling you there's a space after the file name in your first post.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

She's telling you there's a space after the file name in your first post.

 

oh, right :v Because I write the code by manual when post.. Sr !!!

But in the real code, I tested it. DllCallAddress set @error = 1, this is reason that I don't understand

Edited by HoangTieuBao
Link to comment
Share on other sites

Well, one thing I see is that you're using "$SOCKETID = _GetSocketId(") but then using "$ret = DllCallAddress("int", $pProc, "dword", $SOCKET, "ptr", DllStructGetPtr($pBuffer), "int", DllStructGetSize($pBuffer), "int", Null)". Perhaps that is part of your problem, wrong variable name?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Well, one thing I see is that you're using "$SOCKETID = _GetSocketId(") but then using "$ret = DllCallAddress("int", $pProc, "dword", $SOCKET, "ptr", DllStructGetPtr($pBuffer), "int", DllStructGetSize($pBuffer), "int", Null)". Perhaps that is part of your problem, wrong variable name?

 

Oh, tks for remind.

And then, I check my code again.

But it still fails ^^~

I think DllCallAddress function which still is not performance to use

Edited by HoangTieuBao
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...