public override string GetExecutableDirectoryPath() { string directoryName; try { string fileName = Process.GetCurrentProcess().MainModule.FileName; directoryName = Path.GetDirectoryName(fileName); } catch { Module m = Assembly.GetExecutingAssembly().GetModules()[0]; IntPtr intPtr = Marshal.GetHINSTANCE(m); if (intPtr == new IntPtr(-1)) { intPtr = IntPtr.Zero; } StringBuilder stringBuilder = new StringBuilder(260); WindowsPlatformNative.A(intPtr, stringBuilder, stringBuilder.Capacity); directoryName = Path.GetDirectoryName(Path.GetFullPath(stringBuilder.ToString())); } return(directoryName); }
public override IntPtr LoadLibrary(string path) { return(WindowsPlatformNative.A(path)); }