lkd> !error -0n2147024637
Error code: (HRESULT) 0x80070103 (2147942659) - No more data is available.
On 8/27/11, xxxxx@jmr.com wrote:
> I thought that OSR was founded by Mark Rassinovich, who owned / was involved
> with SysInternals, which Microsoft bought not too long ago. I might have
> his last name mispelled. I took a class with him a few years back.
>
> Back to topic.
>
> 1. I rebooted my computer and unplugged the expander across the reboot.
>
> 2. I rewrote / restructured the code thanks to the help here.
>
> What I found out is that eliminating the SetupDiCreateInterface() call,
> rebooting, and reworking the code yields the following facts.
>
> * I am now able to get a single Device Path from the ATTO HBA controller and
> that path is the right one, which is CreateFile() friendly.
>
> * I found out that there is no interface for my expander, which means that I
> need to create a driver for it or find some other solution.
>
> Code Changes Made:
>
> // We start at the “root” of the device tree and look for all
> // devices that match the interface GUID of a disk
> DiGetClassFlags iFlags = DiGetClassFlags.DIGCF_PRESENT |
> DiGetClassFlags.DIGCF_ALLCLASSES | DiGetClassFlags.DIGCF_PROFILE |
> DiGetClassFlags.DIGCF_DEVICEINTERFACE;
> int iArgFlags = (int)iFlags;
> hDevInfo = SetupDiGetClassDevs(IntPtr.Zero, IntPtr.Zero, IntPtr.Zero,
> iArgFlags);
> if (INVALID_HANDLE_VALUE == hDevInfo.ToInt32())
> {
> Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error());
> return false;
> }
>
> // Boolean bResult;
> bool bSuccess = true;
> int iDevice = 0;
> while (bSuccess)
> {
> String strDevDevicePath, strDevClassName, strDevDriver,
> strDevDescription, strDevName, strDevInstanceId;
> Guid guidDevInterfaceLocal;
>
>
> // Initialize the required variables.
> strDevDevicePath = “”;
> guidDevInterfaceLocal = new Guid(0x0, 0x0000, 0x0000, 0x00, 0x00, 0x00,
> 0x00, 0x00, 0x00, 0x00, 0x00);
>
> // Create a Device Interface Data structure.
> SP_DEVINFO_DATA sDevInfoData = new SP_DEVINFO_DATA();
> sDevInfoData.cbSize = (uint)Marshal.SizeOf(sDevInfoData);
>
> // Enumerate the next devices or the first device, if the first pass.
> bSuccess = SetupDiEnumDeviceInfo(hDevInfo, (UInt32)iDevice,
> sDevInfoData);
> if (false == bSuccess)
> {
> iErrorCode = Marshal.GetHRForLastWin32Error();
> Marshal.ThrowExceptionForHR(iErrorCode);
> }
>
> // Get Device: Name
> strDevName = GetDeviceName(hDevInfo, ref sDevInfoData);
>
> // See if we have the board in question.
> if (strDevName == strDevNameToFind)
> {
> // Get Device: Interface Class GUID
> GetDeviceInterface(hDevInfo, ref sDevInfoData, ref
> guidDevInterfaceLocal, ref strDevDevicePath);
> break;
> }
>
> // Increment the device enumeration index.
> iDevice++;
> }
> }
>
> catch (Exception ex)
> {
> MessageBox.Show(ex.ToString(), Application.ProductName,
> MessageBoxButtons.OK);
> }
>
> finally
> {
> SetupDiDestroyDeviceInfoList(hDevInfo);
> }
>
> return true;
>
> The call to GetDeviceInterface() uses hDevInfo and sDevInfoData in the call
> to SetupDiEnumDeviceInterfaces(). That yields one entry and returns a
> SP_DEVICE_INTERFACE_DATA, which I can then pass to
> SetupDiGetDeviceInterfaceDetail, which gives the right path name.
>
> When calling this new code, I do not even see the expander, even though it
> shows nicely in the Windows Device Manager. I can plug in and unplug the
> expander and see the entry in Device Manager disappear and appear depending
> on if I plug the expander in or not, but no hit on the expander, hence I
> need another solution or just write a device driver.
>
> QUESTION:
> When completes and has no more matches, I get an error code of, -2147024637.
> The size of the container variable is an ‘int’, which is the size
> requested. According to
>
> http://msdn.microsoft.com/en-us/library/ms681382(v=VS.85).aspx
>
> there is no code that low / high. Is there a nice C/C++ define for this
> value? Should I be casting to something?
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
–
thanks and regards
raj_r