Launch External Process then Inject dll to it - code-injection

I have a game, the client of a game online, that game is wrote by another man, not me.
I want to inject a dll to this game for anti-hack from player!
I renamed the game.exe to Loader.dat
I want to write a game.exe (fake) call loader.dat to run then inject my dll in its process (loader.dat process)
How can i do it?
I have read some suggestion about run ext program, and inject dll to another process!
But it is 2 different project, I tried to join into one project! I false much time before i ask this question in here!

You can't do this. Even if you could "inject" some DLL into the game, since the game knows nothing about the DLL, the DLL will never be invoked.

Related

Kafka Consumption in Unity

I'd like to visualize a Kafka stream using Unity3D. What's the best way to get access to the data stream in Unity?
I have written basic consumers in Node and C#, but I'm not sure how to incorporate them into Unity. Any help appreciated!
I dont come with a complete solution, because I'am working on the problem currently. The main problem I encountered with unity3D is to execute things in a separate thread, separate from the game loop which is a thread itself. I you succeed to execute code outside of the game loop and then pass data between your thread and the main loop you are done. and You then should use https://github.com/confluentinc/confluent-kafka-dotnet
There is another problem, unity want manage every thing with the lib and it conflict with visual studio lib versions and with nugget. So you have to find a workflow to counter that. If you go full visual studio you will loose the unity interface simplicity. In general you import your lib and then unity mess it.

TypeLoadException after loading .NET 4.5 C# DLL into Unity 2018.2.5

I want to be able to feed the camera frames from a webcam into Unity. I made a .NET 4.5 C# DLL using MediaFrameReader and event listeners. Here is some other user's implementation for accessing the Hololens camera frames: Hololens - Access Camera Frames.
When I import the DLL into my 2018.2.5 Unity project, it gives me the following error:
Unloading broken assembly "....", this assembly can cause crashes in the runtime
TypeLoadException: Could not find method due to a type load error
The C# plugin built successfully many times on Visual Studio. Also, I have properly set the Api Compatibility Level (in player settings) to .NET 4.x. What could be the fix to this?
All the other SO answers related to this I have already taken a look, but does not seem to help the problem. Thanks for all the help.
EDIT: https://issuetracker.unity3d.com/issues/unity-fails-to-load-net-4-dot-6-assemblies-with-typeloadexception is the most relatable post, but had no solution.
I have few possible solutions for you to explore.
DLLs issues:
Workaround:
Comment your UWP code (the part that uses the DLL), then build it in UNITY without the DLL. In the generated UWP solution, install the package from nuget or manually import the dll, then uncomment your code and finish your development. This is a short-term solution.It is going to be annoying as you re-build your solution many times and have to comment/uncomment then re-add dlls and so on.
Other possible solutions:
Failed to run reference rewriter with command error with unity error when adding a DLL to the assets folder
Your exact need
From your description, you really do not need everything in the link you referenced (Hololens - Access Camera Frames). You need much simpler version. I recently created MediaCapture solution for HoloLens as a workaround because PhotoCapture in Unity is not working in the HoloLens and everything is working without any additional DLLs. I will post for you few links to see if it may help you:
MediaCapture Unity & HoloLens: https://github.com/MSAlshair/HoloLensMediaCapture
This maybe a good start for you. You can combine it with your original reference. Use this project as starting point to make sure your project is building correct, then use the necessary code from the other resource that you posted to accomplish the task that you desire. You may need to download Unity 2018.2.12f1 because I didn't test it in 2018.2.5
MediaCapture & PhotoCapture: Hololens font camera
Good Luck!

Namespacing My Unity Project Scripts

I create tools for the Unity Asset Store and one of my tools is in conflict with other assets people bought from the store which is resulting in unwanted errors. From talking this over with people they said that I should just "namespace TrollBridge{}" EVERY script. Would this be a way of doing it or do I only need to do certain scripts? Even data structure scripts? If it is just certain scripts what exactly am I looking for about these scripts to throw the "namespace TrollBridge {}" on it? I think I understand the whole encapsulation concept with this but maybe I am missing something when it comes to selling tools for other people? Thanks in advance.
Would this be a way of doing it
Yes.
or do I only need to do certain scripts?
Do it for all your scripts.
Even data structure scripts?
Yes, even that. All your classes for this should be in a namespace.
To make this answer short, put all your scripts in a namespace. The reason for this is that you will be distributing this with thousands of people or even hundreds of thousands.
Let's say that someone is using another plugin called Lighting and that plugin has a class called Lighting. Ask yourself what happens when you release your own plugin with a class called Lighting?
I have seen this happen before between two plugins which led to many complains. The publisher had to add namespace to all their script which broke many old projects.
Do it right now so that you won't have this problem in the future. Name your namespace a name you think does not exist in the Asset Store and resonates with the function of your plugin.

Why can't I debug into UnityEngine.UI code?

I add the UnityEngine.UI.dll and UnityEditor.UI.dll to my assets folder with their mdb files . also i add the both project to my current project. i am sure all the unity engine ugui code build success, because i debug log in the event system, and it print message. when i want to step into the event system class, i always failed . I find unity will load the code from a build path ,rather than i original code. Why does it do this ? if i want to debug unity engine ugui code, what should i do ?
To debug code, you need two things:
Symbols, the list of all functions, classes, variables used throughout the module. When using C++ symbols are stored in special .pdb files on Windows (and you obviously are using Windows since you are talking about dlls). Symbols in C# (.NET in general) are stored in the .dll itself. Having symbols will let you see the name of functions on the call stack and possibly some variables but nothing more.
Source code of the module.
U3D's source code is proprietary - you need to spend a good amount of money to receive it. And if I am guess to - UnityEngine.UI.dll is a C++ module with stripped (removed) symbols removed.
Thus you have neither, so you can't debug U3D's code at all.
Why would you need to that anyway? If you want to see how the internals of a big game engine work, there are plenty of other options (for example UE4 and Lumberyard). If you are struggling with a problem and you'd like to be able to solve it through debugging...well though luck. Your best bet would be to ask in unity community.

Is it possible to use Unity3D NavMesh in a server application?

Unity3D contains a core dll that called UnityEngine.dll. That library contains all logic for the engine, like NavMesh.
Is it possible to use that dll in other applications, for example console applications, feed NavMesh with baked NavMesh from scene and perform navigation?
In other words, I want to create a game server that will navigate all agents and send to clients new positions of them.
No it is not possible.
This question was asked by a Unity user few years ago and he got the no answer from a Unity engineer. He tried that and failed. Unfortunate I am not able to find that question again but the answer the user got made sense.
According to the post as I remember, he said that all the UnityEngine.dll file contains all the classes you see while programming and those are for reference and complier only. He also said that the UnityEngine.dll file does not include the run-time file required to make it work alone in other application.
The Unity compiler generates the required dlls or files needed to run a Unity game.