2011-10-25 70 views
1

我試圖從WinIO在64位Windows 7操作系統上編譯示例「DumbPort」,但是當我運行該程序時,我總是得到此錯誤的用戶權限不足。我已經將winIO64.dll和winIO64.sys放入了像DumbPort這樣的目錄。在示例的源代碼中,錯誤消息不是非常有用,因爲它意味着找到了WinIo庫,但它不能被初始化。我正在使用Visual Studio 8,但我不確定如何調試。下面是代碼:訪問Windows下的風扇7

private void Form1_Load(object sender, EventArgs e) 
    { 
     // Check if this is a 32 bit or 64 bit system 
     if (IntPtr.Size == 4) 
     { 
      hMod = LoadLibrary("WinIo32.dll"); 

     } 
     else if (IntPtr.Size == 8) 
     { 
      hMod = LoadLibrary("WinIo64.dll"); 
     } 

     if (hMod == IntPtr.Zero) 
     { 
      MessageBox.Show("Can't find WinIo dll.\nMake sure the WinIo library files are located in the same directory as your executable file.", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error); 
      this.Close(); 
     } 

     IntPtr pFunc = GetProcAddress(hMod, "InitializeWinIo"); 

     if (pFunc != IntPtr.Zero) 
     { 
      InitializeWinIoType InitializeWinIo = (InitializeWinIoType)Marshal.GetDelegateForFunctionPointer(pFunc, typeof(InitializeWinIoType)); 
      bool Result = InitializeWinIo(); 

      if (!Result) 
      { 
       MessageBox.Show("Error returned from InitializeWinIo.\nMake sure you are running with administrative privileges and that the WinIo library files are located in the same directory as your executable file.", "DumpPort", MessageBoxButtons.OK, MessageBoxIcon.Error); 
       FreeLibrary(hMod); 
       this.Close(); 
      } 
     } 
+0

您正在提升的權限下運行? – leppie

+0

是的。我使用Windows Home 7. – Bytemain

+0

在過去,我只用WinRing0取得了巨大的成功。這一切都取決於主板上的芯片,你可以做什麼。可能就像我的情況,很多逆向工程。 – leppie

回答