1
當試圖調用(DLLImport)從.net應用程序具有清單文件與requireAdministrator的外部c + + dll,我得到此錯誤試圖從C++ dll調用函數在啓用了UAC的Windows 7中。DLLImport錯誤:System.AccessViolationException與清單文件和c#
方法,我呼籲:加密
System.AccessViolationException:嘗試讀取或寫入受保護的內存。這通常表明其他內存已損壞。
公共類河豚 { [的DllImport( 「BlowfishTool.dll」,字符集= CharSet.Auto)] 公共靜態外部加密字符串(字符串strData是,字符串strPassword);
[DllImport("BlowfishTool.dll", CharSet = CharSet.Auto)]
public static extern String EnCrypt(String strData, String strPassword, bool doNotUsePassChecking);
[DllImport("BlowfishTool.dll", CharSet = CharSet.Auto)]
public static extern String DeCrypt(String strData, String strPassword, bool doNotUsePassChecking);
[DllImport("BlowfishTool.dll", CharSet = CharSet.Auto)]
public static extern String DeCrypt(String strData, String strPassword);
public static String EnCrypts(String strData, String strPassword)
{
return EnCrypt(strData, strPassword, true);
}
}
}