HelpC++ memory editing + C# Windows Form

Posts 1–5 of 5 · Page 1 of 1
C++ memory editing + C# Windows Form
I am a C++ primary coder. Recently, I have been playing around with C# and found a very nice GUI for a windows form, which I want to use for one of my hack programs for CS:GO. The hack is written in C++ and only uses console as a UI. I have been wanting to add a windows form, but C++ forms confuse me. So, is there a way to combine the two, C++ coding and C# Windows form? I have been trying to find something on this but I feel a hacking forum may have a more specific answer.
C# supports marshalling. You can create a C++ native .dll and export all important functions and call them from your C# program.
Read about DllImport

You could also use C++/CLI and MFC (but I guess this is what you meant by c++ forms)
Quote Originally Posted by Biesi View Post
C# supports marshalling. You can create a C++ native .dll and export all important functions and call them from your C# program.
Read about DllImport

You could also use C++/CLI and MFC (but I guess this is what you meant by c++ forms)
I see. I saw something about that but it looked weird. And yes, I use DllImport in my code for reading and writing functions:

Code:
        //OpenProceess
        [DllImport("kernel32.dll")]
        public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);

        //RPM
        [DllImport("kernel32.dll")]
        public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesRead);

        //WPM
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool WriteProcessMemory(int hProcess, int lpBaseAddress, byte[] lpBuffer, int dwSize, ref int lpNumberOfBytesWritten);
So I make a C++ library with my functions, add a reference in my c# form, and I can use them? That sounds basic enough.
Quote Originally Posted by KappaMang View Post
So I make a C++ library with my functions, add a reference in my c# form, and I can use them? That sounds basic enough.
No, you make a C++ library with your functions, then make a dll wrapper in managed C++ (which needs to expose your unmanaged .lib's methods as managed), then you can reference to your C# project the dll wrapper.
Quote Originally Posted by KappaMang View Post
So I make a C++ library with my functions, add a reference in my c# form, and I can use them? That sounds basic enough.
You cannot add a reference if your library is native. If you want to add a reference you'll have to use C++/CLI to create a wrapper class for your c++ code. You'd have to "DllImport" your library using the exported function. If you have problems or want me to help you feel free to message me
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us