Moving To Discord: https://discord.gg/UmXNvjq

Hello everyone, due to bugs with the forum software that I do not have time to care about, I am going to be shutting down these forums and moving my discussions to Discord instead. I will eventually keep releases here on the site but the forums will be removed sooner or later. I encourage people to join my personal Discord if you have questions, if you are looking for any of my projects, etc.




Registration Code (Part 1): w%kQ6
Registration Code (Part 2): b<#$1[*(cw~
In order to register on this forum, you must use the codes above. Combine them into one code (copy paste).

[SOURCE] Nostale Multiclient Information (via injection)

Topics regarding the online game Nostale.
Locked
User avatar
atom0s
Site Admin
Posts: 449
Joined: Sun Jan 04, 2015 11:23 pm
Location: 127.0.0.1
Contact:

[SOURCE] Nostale Multiclient Information (via injection)

Post by atom0s » Mon Nov 14, 2016 10:44 am

Straight to the point, if you are injecting your own DLLs into Nostale and want to allow multiple clients easily, you can use a hooking library such as Detours to accomplish this by hooking CreateMutexA.
  1. /**
  2.  * Detour Prototypes
  3.  */
  4. extern "C"
  5. {
  6.     HANDLE      /**/(WINAPI *Real_CreateMutexA)(LPSECURITY_ATTRIBUTES, BOOL, LPCSTR) = CreateMutexA;
  7. };
  8.  
  9.  
  10. /**
  11.  * user32!CreateMutexA Detour Callback
  12.  */
  13. HANDLE __stdcall Mine_CreateMutexA(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName)
  14. {
  15.     // Look specifically for the client mutex..
  16.     if (lpName != nullptr && ((DWORD)lpName & 0xFFFF0000) && strcmp(lpName, "EntwellNostaleClient") == 0)
  17.     {
  18.         // Create a unique mutex instead..
  19.         char buffer[2048] = { 0 };
  20.         sprintf_s(buffer, 2048, "%s_%d", lpName, ::GetCurrentProcessId());
  21.         return Real_CreateMutexA(lpMutexAttributes, bInitialOwner, buffer);
  22.     }
  23.    
  24.     return Real_CreateMutexA(lpMutexAttributes, bInitialOwner, lpName);
  25. }
  26.  
  27. // Apply the mutex detour:
  28. ::DetourTransactionBegin();
  29. ::DetourUpdateThread(::GetCurrentThread());
  30. ::DetourAttach(&(PVOID&)Real_CreateMutexA, Mine_CreateMutexA);
  31. ::DetourTransactionCommit();
For doing things proper, you should hook the other mutex functions and ensure the game makes use of the proper mutex handle when attempting to use the hooked mutex. But it is not required in Nostale to allow it to run properly and allow multiple clients.
Derp~
Need a great web host? Check out: AnHonestHost.com


Donations can be made via Paypal:
https://www.paypal.me/atom0s
Locked

Who is online

Users browsing this forum: No registered users and 1 guest