getHidGUId API call error

I try to call the function HidD_GetHidGuid from hid.dll, but it gives me an error, can someone explain y thanks

my piece of code is :

public partial class Form1 : Form

{

[DllImport("hid.dll")]

private static extern void HidD_GetHidGuid(Guid GUID);

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

Guid HidGuid = new Guid();

HidD_GetHidGuid(HidGuid);

textBox1.Text = HidGuid.ToString();

}

}

the error (when i click the button) is :

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

thank u




Answer this question

getHidGUId API call error

  • Xaid

    The Guid you pass in must be a ref parameter. How else would the function be able to modify it



  • pat_seo

    Thank you



  • getHidGUId API call error