I have a C# Project which Invoke a C++ dll And before returning the value in the C++ dll, I would like to check the name of the C# exe which invoke my method. Can you advice me please?
I Load the c++ dll like this:
[DllImport("MindSystem.dll",
EntryPoint = "MindSystemPlusPlus",
CharSet = CharSet.Ansi,
CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)]
public static extern IntPtr MindSystemPlusPlus(int value);
And when I load it, I want that the c++ dll check the name of the exe which invoke it
Edit: I tried this code, but the output in c# is in strange characters :
char fileName[MAX_PATH + 1];
GetModuleFileNameA(NULL, fileName, MAX_PATH + 1);
return fileName;