Jump to content
Sign in to follow this  
stormbreaker

WSASetService help

Recommended Posts

stormbreaker

:bye: Hello everyone, recently (you could call it a day before yesterday), I made a robot (connected to my PC) which I could control using WinSock. This is fairly easy in C++, but could anyone please guide me how to write the function WSASetService (an example is greatly appreciated) in AU3. All I have done so far is this:

Func _WSASetService()
$WSAQUERYSET = DllStructCreate("dword;wstr;word") ;incomplete structure
$RESULT = DllCall($hWs2_32, "int", "WSASetServiceW", "struct", $WSAQUERYSET, "int", 0, "Dword", 0)
EndFunc

I have no idea for typedefs really. By the way, could anyone tell me how do I search for proper typedefs in the header files of Windows SDK.

Thanks...

MKISH

Edited by MKISH

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites
stormbreaker
JohnOne, I am just asking for a translation of WSASetServiceW (Winsock) function and WSAQUERYSET structure from C++ to AU3. I don't suppose, you will need C++ code for that.

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites
SmOke_N

John, why do you need the code, it's windows API, and he gave you the function and typedef he needed.

Anyway, @OP, I'm confused on why you didn't google it, msdn has what yo need:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms742211%28v=vs.85%29.aspx

http://msdn.microsoft.com/en-us/library/windows/desktop/ms741679%28v=vs.85%29.aspx

DllCall and DllStructCreate in the help file have your autoit types.

Just curious on why you're not using the original method if it works still. ( round | wheel )


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
stormbreaker

Dear Smoke_N,

I had already googled it and thats how I implemented it in C++, but I was not able to translate the types (such as LPGUID, LPWSAVERSION and many others...) to AutoIt. Thats okay in C++ as all I had to do was include Winsock2 header file and everything was done.

The reason for choosing AU3 was that it provides me simplicity (makes the process understandable). One way of doing this would of course be making a DLL with C++ and then calling it via DllCall(), but I rejected it, to make the process understandable.

Regards


----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites
stormbreaker

Anyone???


----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites
stormbreaker
DllCall is not much of a problem here. The real problem is WSAQUERYSET structure.

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

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  

  • Similar Content

    • tarretarretarre
      By tarretarretarre
      AutoIt-SocketIo
      Yep yep, this is pretty much an attempt to port the existing project's concept https://socket.io/ to AutoIt's Codebase. So i will not go in to so much detail.
      This is how the communication is done http://i.imgur.com/0mMfsBD.png Each client is isolated to the server http://i.imgur.com/rVO2LFb.png Features
      Easy API VarType Translation (Example: If the server sends an int, the client will receive an int and vice versa) Fully featured examples Data encryption (Using Autoit's UDF Crypt.au3) Limitations / Drawbacks
      It is not possible to Broadcast/Emit objects Only 1D-arrays are allowed to be Broadcasted/Emitted (2D arrays will probably never be supported) Changelog
      Version 1.5.0 (This update DOES NOT break scripts)
      Added AutoIt like docs under Docs\. The docs are generated so its a 1 to 1 reflection of the UDF headers. Print of documentation Added a production ready server example. Added a new method: _Io_DevDebug which will display useful information when debugging. Added a new method: _Io_SetMaxRecvPackageSize which defaults to whatever _Io_setRecvPackageSize is set to. Added a new method: _Io_setOnPrefix which defaults to _On_ Added a new default client & server event called flood. Flood occurs when exceeding the $__g_io_nMaxPacketSize. $__g_io_nMaxPacketSize is set by _Io_SetMaxRecvPackageSize Fixed the 16 parameter limit when sending data with _Io_Emit, _Io_Broadcast, _Io_BroadcastToAll and _Io_BroadcastToRoom. This works on the same premise that AutoIt's Call Does Fixed a TRUNCATION problem when receiving packages which could cause crashes! Fixed a programming error which caused $__g_ionPacketSize to reset to default 4096 if _Io_Connect or _Io_listenwere called after _Io_setRecvPackageSize Fixed _Io_setEventPreScript and _Io_setEventPostScript They didnt work. Lol. Changed how events are fired so the client cannot crash the server by sending the wrong number of parameters (This also allows for optional parameters on callbacks) Changed _Io_On. The second parameter $fCallback can now be set to null. Doing this, the function assumes that the callback is: _On_<eventName>.  
      Changelog History
      Api methods
      Please see the docs provided
      Default events
      Server events
      connection Client events
      banned Server and Client events
      disconnect flood View source on github
       
      Autoit-Socket-IO-1.0.0.zip (OLD!)
      Autoit-Socket-IO-1.1.0.zip (OLD)
      Autoit-Socket-IO-1.3.0.zip (OLD)
      Autoit-Socket-IO-1.4.0.zip (OLD)
      Autoit-Socket-IO-1.5.0.zip (NEWEST 2017-12-20)
    • lavascript
      By lavascript
      So here's what I'm trying to accomplish:

      I need the ability to restart an application on my desktop PC from within my home network. Obviously, writing a script to do that locally would take all of ten seconds. The trick is that I want to do it remotely. I still feel like it wouldn't be difficult to accomplish with a server/client script.

      But of course, that's not good enough. I want to do it from my iPhone. And the easiest way I can see to accomplish that would be through the browser.

      So in my mind, I'm thinking that, on the server side, I can listen for connections on, let's say port 8080. I can watch for a "GET / HTTP/1.1" (or whatever it is...) and respond with a simple webpage that reports a status and has a reset button.

      On my phone, I type, say 192.168.1.150:8080 and get that simple page. When I click the reset button, it sends a "GET /?reset=true" or something and that will trigger a function in the server script to reset the app.

      So in essence, this would be a very simple web server, one that only serves a single, hardcoded page. But this seems too simple. Is it? Or is it actually way more complicated than that?
×