通過一些傳統的模擬邏輯去的時候,我發現了以下異常:無法找到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