RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!




Here's a little thing I've been working on... It's an "interface" to the UO client, which allows you to load your (.NET) application inside the client and intercept/filter/send packets. Basically an open-source alternative to Razor's Crypt.dll. An example how to use this is included on github - it's a basic application, that just logs all packets and shows them in console window (screenshot attached below).

How does it work:
It exposes number of functions (
1) First you have to call the Start function. It takes 5 parameters - path to client, path to assembly you wanna inject to client, then type/method name (= path to some method you wanna call after injecting the assembly - it has to have the following signature "public static int(String)") and argument which will be passed to this method.
This function launches the client, injects both UOInterface and your assembly to the process, places all the hooks and then it calls the previously mentioned method. ->
2) Here (in the function that you passed to the Start method) you have to set all your handler methods by calling SetCallbacks. The structure of callbacks has to be kept alive during the whole application life (if it gets eaten by garbage collector you're screwed) and every callback has to be assigned (even if it is just a function that does nothing). You also have to call the PatchEncryption method here, if you need the encryption removed, and SetConnectionInfo, if you wish to you different server/port that's not in login.cfg.
3) The client execution (and also the execution of the Start function) is paused until you return from this function, so after setting the callbacks and patching encryption you have to create another thread for you application and return from this function.
4) Now you are all set up.
5) If you wanna send some packets, just use SendToClient/SendToServer.

OnRecv - packets from server to client
OnSend - packets from client to server
- both callbacks has to return boolean value - true means you wish to filter the packet, false means you don't
- it should be possible to directly modify the packet
OnExitProcess - called before the client process dies -> you can save some configuration or whatever
OnDisconnect - ...
OnWindowCreated - called when the client window is created, it carries handle to this window
OnFocus/OnVisibility - called when client windows changes focus somehow -> so you can for example hide/show your GUI along with the client window
OnKeyDown - first parameter is key id, second one tells you if the key was just pressed or if you are holding it for some time (-> you can prevent spamming some hotkey by just holding it)

The send/recv functions or encryption patches are found by searching for some number of ASM instructions (some pattern) in the client exe (instead of hooking the send/recv winsock functions)
-> this means that it WILL eventually break with newer client versions if those parts gets rewritten somehow, or they decide to change the compiler or whatever... (insted of the other approach which is more universal). But this way you capture the packet before they get encrypted/compressed and after they get decrypted/decompressed, so you don't have to do it yourself, the client does it for you. (And because you don't do the same thing twice it should be probably faster somehow...)

Some of the patterns (for patches/functions) are copied another project called MasterControl (or something like that). But unfortunately I've got no idea who was the author so I could give him credit somewhere nor do I have the source code (I just saved the patterns).

The last important thing to know - this is just an alpha version, I haven't really tested it much. It should work with clients from version 4.x.x. The last one I tried so far was


  • uointerface.png
    1 MB · Views: 20