This is my C# code:
[DllImport("Tomb.dll")]
public static extern unsafe uint InjectManualMap(ulong pId, [MarshalAs(UnmanagedType.LPCStr)]string dllPath);
and for whatever reason when I attempt to use my C++ code:
extern "C" DllExport unsigned int StdCall InjectManualMap(unsigned long pid, const char* dllPath) {
ManualMapInjector* mmp = new ManualMapInjector;
std::string dll(dllPath);
unsigned int kk = mmp->Inject(pid, dll);
delete mmp;
return kk;
}
the const char* dllPath is always a bad pointer (0x000000000). I'm not sure what's happening here, because all other solutions point to using either a StringBuilder (tested it, did the same thing), or using MarshalAs which is something the current code I have posted does.