c# - SetupDiGetDeviceInterfaceDetail unexplainable error -


I have an error at this time for which I am trying again to see why this is present. Although the error can be ignored, but I want to know why it exists at 1 position.

  Result = SetupDetSetSyncInterfaceDebate (deviceInfosite, referee interface, INTERPTR.zoro, 0, ref Buffers, Interpet .Zero); If (! Result) {int errCode = Marshal.GetLastWin32Error (); Error Message = New Win32Exception (Marshal.GetLastWin32Error ()). message; StatusLabel.Text + = "\ n (1) SetupDiGetDeviceInterfaceDetail error:" + errCode + "=> + Error message + "."; "; // breakdown;}  

This is the first call on this function for the purpose of setting the buffersize variable for the second call of the function. Received print error message: 122 => The data area provided to call the system is too short Looking at the error message, I thought it was the second parameter (referee interface) Something must be done with and I can ignore it for the other pass which is proved right But the error is still present and I would like to know why before it comes back to bite me in the 'back' place? The parameter of the question is declared and defined:

  [Layout Layout (LayoutCind.Security)) // Public Definition defined here SP_DEVICE_INTERFACE_DATA {Public UIT CBSIA; Public Guide Interface Classgide; Public UIT Flags; Public INPT R reserve;} Antrfes = new SP_DEVICE_INTERFACE_DATA (); // here declare an interface cbSize = (UIT) Marshal.SizeOf (an interface); AnInterface.InterfaceClassGuid = Guid.Empty; An interface. Reserved = IntPtr.Zero; AnInterface.Flags = 0;  

I have selected MSDN articles separately and as far as I can tell there is nothing wrong with the code.

It is considered by design if you see in the comment section:

This function is generally a two-step process to get details about the interface:

1) Get the required buffer size. Call SetupDiGetDeviceInterfaceDetail one tap DeviceInterfaceDetailData pointer, with a DeviceInterfaceDetailDataSize of zero, and with a valid RequiredSize variable. In response to this type of call, this function returns the necessary buffer size on the required size and returning GetLastError fails with the error infuserif buffer.
2) Allocate a proper size buffer and call the function again to get the interface details.

If you see an incorrect buffer below, you will see that this decimal value is 122.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -