I tried to compile the sample “DumbPort” from WinIO on a 64-Bit Windows 7 OS but when I run the program I always get this error insufficient user rights. I’ve put the winIO64.dll and winIO64.sys in the same directory like DumbPort. In the source code of the sample the error message is not very helpful because it means that the WinIo library is found but it cannot be initialized. I’m using Visual Studio 8 and I’m not sure how I can debug this. Here is the code:
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();
}
}
So far I’ve solved my problem with winring0: http://www.chihoang.de/code-schnipsel/amilo-xa-3530/fsc-xa-3530-fan-control-v01-windows.html. Currently I’m trying to write a kernel driver and a systray program to control it.