Attempted to read or write protected memory. This is often an indication that other memory is corrupt. public static extern String hdGetErrorString(uint errorCode); The C/C++ Equivalent is the following: HDAPI char * HDAPIENTRY hdGetErrorString(unsigned int errorCode); I run it by saying this: System.Windows.Forms.MessageBox.Show(HDDevice.hdGetErrorString(515));