pbsds Posted November 14, 2009 Share Posted November 14, 2009 Hi, this is my first post here and im glad i registered! I need a function that does the same a htonl() does in C. Can anybody tell me where to get/find this or make an UDF for me? I need it to make a IMET Header. Thanks. Fuck 'em if they can't take a joke. Link to comment Share on other sites More sharing options...
hunt Posted November 14, 2009 Share Posted November 14, 2009 (edited) Try this:Func htonl($hostlong) DllCall("Ws2_32.dll","ulong","htonl","ulong",$hostlong) EndFuncYou can make a function with DllCall and msdn Edited November 14, 2009 by hunt Link to comment Share on other sites More sharing options...
pbsds Posted November 14, 2009 Author Share Posted November 14, 2009 it didn't work. I tried to make some changes and even download the dll and put it in the scripts directory: Func htonl($hostlong) return DllCall(@ScriptDir & "\WS2_32.dll","htonl",$hostlong) EndFunc got an another idea? Fuck 'em if they can't take a joke. Link to comment Share on other sites More sharing options...
hunt Posted November 14, 2009 Share Posted November 14, 2009 $hostlong=123456 MsgBox(0,"",htonl($hostlong)) Func htonl($hostlong) Local $iResult = DllCall("Ws2_32.dll","ulong","htonl","ulong",$hostlong) If @error Then Return SetError(@error, @extended, -1) Return $iResult[0] EndFunc Link to comment Share on other sites More sharing options...
martin Posted November 14, 2009 Share Posted November 14, 2009 (edited) it didn't work. I tried to make some changes and even download the dll and put it in the scripts directory: Func htonl($hostlong) return DllCall(@ScriptDir & "\WS2_32.dll","htonl",$hostlong) EndFunc got an another idea? YES!. Things often don't work and it is usually because of an error in the script or in your understanding. So the first thing you do is to study the help file to check that you are using the functions etc correctly. Then you examine any errors that occur becuause they tell you what, if anything, went wrong. So the next thing to do is to add error checking to see if something went wrong, and make sure that you can react to the error, and to make sure that the result you are getting is being dealt with correctly. Maybe you are expecting a ulong return from the function when that's not what it returns, maybe the DllCall fails and therre is nothing there to tell you that. I think that it would be better for your programming development and understanding if you spent a bit of time on what is not working and then, if you can't solve it then post again with information that would enable us to give some helpful suggestions. EDIT: Well I see that hunt has scuppered my enforced eduction policy. Edited November 14, 2009 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now