通过一些传统的模拟逻辑去的时候,我发现了以下异常:无法找到DLL“ADVAPI32.DLL”假冒例外名为“LogonUser的”切入点
无法找到名为“切入点的LogonUser 'in DLL'advapi32.dll'
我知道这个错误意味着我的应用程序无法在advapi32.dll中找到LogonUser方法。
的代码看起来是这样的:
[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
private static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
if(LogonUser(_username, _domainname, _password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ref _tokenHandle))
{
//do stuff...
}
任何人都有类似的错误 - 如何解决它或它为什么发生什么建议吗?除了使用advapi32.dll(它的.net 3.5解决方案,但有很多遗留类),还有更好的方法吗?
看起来可能是原因,因为这是我的榜样和之间的唯一区别一个在pinvoke.net - 虐待测试,只要我有机会 – woggles