nbulp's picture

Crash in OpenTK.Platform.Windows.WinRawKeyboard.GetRegistryKey

Project:The Open Toolkit library
Version:1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:open
Description

One of the input devices, on my computer, is simply called "VIRTUAL_DIGITIZER" (it would seem). The GetRegistryKey-function in WinRawKeyboard attempts to split that string, using "#" as the separator character. In this case, it will not split into the three strings that GetRegistryKey expects, which causes it to raise an IndexOutOfBoundsExecption, when accessing the non-existent second string.

The code looks like this:

            string[] split = name.Split('#');
 
            string id_01 = split[0];    // ACPI (Class code)
            string id_02 = split[1];    // PNP0303 (SubClass code)
            string id_03 = split[2];    // 3&13c0b0c5&0 (Protocol code)

So, my "VIRTUAL_DIGITIZER"-device does not contain a "subclass code" nor a "protocol code".

Raw exception info:

System.IndexOutOfRangeException was unhandled
  HResult=-2146233080
  Message=Index was outside the bounds of the array.
  Source=OpenTK
  StackTrace:
       at OpenTK.Platform.Windows.WinRawKeyboard.GetRegistryKey(String name)
       at OpenTK.Platform.Windows.WinRawKeyboard.RefreshDevices()
       at OpenTK.Platform.Windows.WinRawKeyboard..ctor(IntPtr windowHandle)
       at OpenTK.Platform.Windows.WinRawInput.CreateDrivers()
       at OpenTK.Platform.Windows.WinInputBase.ProcessEvents()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Cheers!
// Matko


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nbulp's picture

#1

P.S.: Same issue with WinRawMouse (and possibly in other places).

nbulp's picture

#2

Ah, just discovered that this bug is already in the process of being fixed, for Windows 8: http://www.opentk.com/node/3198

AndyKorth's picture

#3

Hey nbulp,

That fix was commit a while ago, so if you'd like, you can let me know if it's working in this branch:
https://github.com/andykorth/opentk/

There's been a handful of other fixes, including other Window input fixes on that branch as well.