Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "usb" in [All]

winusb

.

    [DllImport("winusb.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

    public static extern bool WinUsb_Free(IntPtr InterfaceHandle);

.
Documentation
[WinUsb_Free] on MSDN
.

    [DllImport("winusb.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

    public static extern bool WinUsb_GetAssociatedInterface(IntPtr InterfaceHandle,byte AssociatedInterfaceIndex,out IntPtr AssociatedInterfaceHandle);

.
Summary
The WinUsb routine retrieves a handle for the interface that is associated with the indicated device.
.

    [DllImport("winusb.dll", SetLastError = true, CharSet = CharSet.Auto)]

.

    public static extern int WinUsb_Initialize(IntPtr DeviceHandle, out IntPtr InterfaceHandle);

.
Namespace
winusb
.
Description
winusb.dll
.
Title
winusb.dll

user32

.
Summary
This Windows API function can be used to request to be informed when a device (USB) is attacted or removed.
.

    public class StatusBar

.

    public StatusBar(IntPtr hWnd)

.

        hProcess = StatusBar.OpenProcess(ProcessAccessTypes.PROCESS_ALL_ACCESS, false, this.OwningPID);

.

            allocated = StatusBar.VirtualAllocEx(hProcess, IntPtr.Zero, length, (VirtualAllocExTypes.MEM_COMMIT_OR_RESERVE), AccessProtectionFlags.PAGE_READWRITE);

.

            StatusBar.SendMessage(this._handle, SB_GETTEXT, (IntPtr)index, allocated);

.

            bool success = StatusBar.ReadProcessMemory(hProcess, allocated, buffer, length, out bytesRead);

.

            StatusBar.VirtualFreeEx(hProcess, allocated, 0, VirtualAllocExTypes.MEM_RELEASE);

.

            StatusBar.CloseHandle(hProcess);

.

        StatusBar.GetWindowThreadProcessId(this._handle, out pid);

ntdll

.

IO_STATUS_BLOCK ioStatusBlock = new IO_STATUS_BLOCK();

.

                ref ioStatusBlock,

.

[DllImport("ntdll.dll", SetLastError=true)] static extern IntPtr NtQueryInformationFile(IntPtr fileHandle, ref IO_STATUS_BLOCK IoStatusBlock, IntPtr pInfoBlock, uint length, FILE_INFORMATION_CLASS fileInformation);

.

Declare Function NtQueryInformationFile Lib "ntdll.dll" (ByVal fileHandle As IntPtr, ByRef IoStatusBlock As IO_STATUS_BLOCK, ByVal pInfoBlock As IntPtr, ByVal length As UInteger, ByVal fileInformation As FILE_INFORMATION_CLASS) As IntPtr

.

    static extern IntPtr NtQueryInformationFile(SafeFileHandle fileHandle, ref IO_STATUS_BLOCK IoStatusBlock, IntPtr pInfoBlock, uint length, FILE_INFORMATION_CLASS fileInformation);

icmp

.

|ªàô>¶S¦ÂŽÐmÊKþE&JYZ-L;=.;e‰ž¶'s†ùd¦áo GŸ/ ,f(Á±ö"s‘”9ÀƙE?ŽÙSz”¾ÖýJêÅeý¦rÒ§¢à}ö+ßQoþ6¢É^ŠcEʏ¶Ò:¯'WqsWS•SUSB¬–…™ïè煶"‡ŸOhAdÇ6j6÷§ôA·E}-°¸Žš9p^ DÀõ4÷Ï“FR;äA-ÆtTQQe!±$[v»n쵍%¼¡ r³µ¼jê4ÖN©–L#é_º r2)‘ûŽQ¯z¼Œ1a¹ÎYSï䇷?PEå-5\=÷éâúɔ¥ËùjN²ˆ#v›ˆYx ðަC)oëe¯þi[m6] ¯Ó$jwdêˆé™J¤”,§[þ:}èqIv78$ØG±€{¢—‚Eü‹âЄûçáb¶‚ûm”9Ƭ|ˆÕNĦ’©LVí¸ÿ¤u;œŽ¢7mËh€ÚX·O-@²Î™£kŒ>‹¦k%ôGÞ€`„ٗÈV·rœÛM/7ñl®éa¦„1“X²v67œgbÁ£}&U;ê.Œ’€T"Ã=ÂùíÂ×pxÇØüÉi3œÅû¸ú B±V§ 4 y|V;]¤<é»í‰ë]]¥\ öö‘¤#8žª3Z½€ö-ºš¥»rñh1M5/ñ¤ˆÛœR3oqs=°òh¾YC!¸ÁÖ§s/«w,ØlWvsEÁÒâ‘H™:±qÆ}!_ý•sä}›Ùz#õ‹hßⲄH)“¥-èÓ””Xz˜;Ï,Þߋ¬Žì

.

›$™B$ùKú/Ú,,BÓI2“;Æ1ͧE᱕ý𦠎eN/jþê¬êéÌ\¶¬Í cŒ‚ɏ;‹Å«J¡ÌÈJ›kv{²F`fIn™-£p’z¥(5lK}?é‹𶨋lû·È;¶ÿxgd»ùô#FÙ+Œ›ÔK9›p8_0çùðfÏg˜:½@oKa©ûxSLÈý[¾åWNGt}soö²­Èj0w‰6¨ëÖ$ÇÜX3ÊRãÇQ6ZÄ7®œÚ<ØÎ/çâ#”úîôåø^'ûJ§ÝɆ:!û-"Óëñj¦ž‰;íÄ,8ÿb®R»»ŠóA>:¼¼FYæéÁS¬ÍÁòÆøyîUôcÓ£JEs'Êðµ“߁y™`€\œ¢ÓÎéVˆŸ%`Îrªpôަþ»”ú7ô! AoŸî«í LÎÜJÞߞ‹»R6Ù¦ØHì;5?ç*`³S,Ðc>9&O˜) ›ås|¢oèéûÁÐ-þjìq€Þ$(íÎ~èËçK´öY¯ÕÓ¤¤Ûô[±0 ˆYû~!e8z9hŽ[GaßR™ëªœùo­êÓÒvF›ñV[à]"ŒðÆâõõ°4­™œÉ'sUsb§_gÞ6‰óYÅì>úý„Ðp Ë3…´mÎÁÅ$Nh¯Æš¤XÕ„ýkçú(Bìàá4—Y>8Üì„Ûd4"߬}í¸r ܬ·¯ÎiúMՈC-‘Ë®½çt]×4‹9]ڃ{WÈÂØ®µO¿"¾%ònÆq'BªÄVå½äHœuM텸zc•Zóu©q¤a*FõÕ&e hø=®

Constants

.

    public static readonly Guid GUID_DEVCLASS_USB = new Guid("{0x36fc9e60, 0xc465, 0x11cf, {0x80, 0x56, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}}");

.

    public static readonly Guid GUID_DEVCLASS_WCEUSBS = new Guid("{0x25dbce51, 0x6c8f, 0x4a72, {0x8a, 0x6d, 0xb5, 0x4c, 0x2b, 0x4f, 0xc8, 0x35}}");

.

    public static readonly Guid GUID_DEVCLASS_FSFILTER_CONTINUOUSBACKUP = new Guid("{0x71aa14f8, 0x6fad, 0x4622, {0xad, 0x77, 0x92, 0xbb, 0x9d, 0x7e, 0x69, 0x47}}");

.

    public static Guid GUID_DEVINTERFACE_USB_DEVICE = new Guid("A5DCBF10-6530-11D2-901F-00C04FB951ED");

.

    public static Guid GUID_DEVINTERFACE_USB_HOST_CONTROLLER = new Guid("3ABF6F2D-71C4-462A-8A92-1E6861E6AF27");

.

    public static Guid GUID_DEVINTERFACE_USB_HUB = new Guid("F18A0E88-C30C-11D0-8815-00A0C906BED8");

.
Summary
The Globally Unique Identifier (GUID) for the "Interface" for a USB Host Controller
.
Summary
Used with DeviceIoControl and USB_HCD_DRIVERKEY_NAME to get the "Driver Key Name" of a USB Hub Controller
.
Summary
.

const int IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION = 0x220410;

.
Summary
Used with DeviceIoControl and USB_NODE_CONNECTION_DRIVERKEY_NAME to get the "Driver Key Name" from a device on a USB Hub
.

const int IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME = 0x220420;

.
Summary
Used with DeviceIoControl and USB_NODE_CONNECTION_INFORMATION to get information from a port on a USB Hub
.

const int IOCTL_USB_GET_NODE_CONNECTION_INFORMATION = 0x22040C;

.
Summary
Used with DeviceIoControl and USB_NODE_CONNECTION_INFORMATION_EX to get information from a port on a USB Hub
.

const int IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX = 0x220448;

.
Summary
Used with DeviceIoControl and USB_NODE_CONNECTION_NAME to get the Device Path of a device on a USB Hub
.

const int IOCTL_USB_GET_NODE_CONNECTION_NAME = 0x220414;

.
Summary
Used with DeviceIoControl and USB_NODE_INFORMATION to get information about ports on a USB Hub
.

const int IOCTL_USB_GET_NODE_INFORMATION = 0x220408;

.
Summary
Used with DeviceIoControl and USB_ROOT_HUB_NAME to get the Device Path to the USB Root Hub on a USB Controller
.

const int IOCTL_USB_GET_ROOT_HUB_NAME = 0x220408;

userenv

.
Import
credui,advapi32,gdi32,kernel32,ole32,shell32,user32,glossary,coredll,rasapi32,mpr,netapi32,uxtheme,avifil32,aygshell,winscard,crypt32,secur32,wtsapi32,shlwapi,winspool,oleacc,rapi,oleaut32,winfax,odbc32,msi,cards,powrprof,urlmon,xolehlp,comctl32,cfgmgr32,hlink,ipaqutil,quickusb,Constants,Delegates,Enums,Interfaces,Structures

difxapi

.

ŠÊyN#usbö‰wB¢,¸3F>¥”¬}‡Y‚<Ó²ú˓XÙ,ÕÿãašÎCljf—¯9S£:Þ‰Š÷C]ÿz³¨Ý)[å™a±ÊÁÃyXŸ/ç{]FõcæûÕ^Y&p-iÙø¸êefn®ùñ.¶ŒIîèbQ4lÌÄÔ{ÄíË[šxã°ÓÄHíp`C#„û¶"£H3œóîßõg_š•±/Ÿ_«½²-F#£`ª)­“…Räæ—’~Ädw·CyOìg]f#-%”m|a¥™SDG«¼|œä

dnsapi

24: hi
.

ÂJíùûS܊Lî´?ä6µX¾nòZTèiba^´J™:«G[aSø]‡"gÄÓ?)ނG9`ç󕠞aÜW­yéÞR§ˆ¬ÇDpLçZ™F‡xdk®|ªeúc¦õZ½“ïÿÛ;ò²™žm/ÅñÚö␊Usb4–ÖJöN¡Ê”ÁB¯‹Âû¤·qò%oâT§ôÜ?]9°©þîJåïEۘ)¶‹»Ñf» rFû»ý&œ”rµò¹e»gß²Œ”˺”â{jQnIòW°¼¾Rh'IÈ8=…d§o

quickusb

26: Close
.

QuickUSB is small USB port you can implement into any hardware project of yours. It comes with an unmanaged wrapper library encapsulating many of the USB's functions. The following pages are wrapper documentation form managed perspective. You can order one at http://www.bitwisesys.com

.

Also, see the Managed wrapper class CsQuickUSB http://code.google.com/p/csquickusb/

.

QuickUsb.dll is not unicode friendly, make sure you use ANSI encodings on your pinvoke calls!

.
Summary
Bulk USB write to device
.

[DllImport("quickusb.dll", CharSet = CharSet.Ansi)]

.

static extern int QuickUsbWriteData(IntPtr Handle, byte[] outData, int length);

.

    /// Write a block to QuckUSB module

.

        int result = QuickUsbWriteData(handle, data, data.Length);

.

            LastError =  "QUSB returned 0";

.

        LastError = "USB connection not open, please open";

.

[DllImport("quickusb.dll", CharSet = CharSet.Ansi)]

.

private static extern int QuickUsbClose(IntPtr handle);

.

Declare Function QuickUsbClose Lib "quickusb.dll" (TODO) As TODO

.

int result = QuickUsbClose(handle);

.
Documentation
[QuickUsbClose] on MSDN
.
Summary
Retrieves all attached quickUsb devices
.

[DllImport("quickusb.dll", CharSet = CharSet.Ansi)]

.

private static extern int QuickUsbFindModules(StringBuilder nameList, int bufferLength);

.

This function will return a null delimited "\0" list of attached devices. For example, after executing this function with one module connected, nameList will contain "QUSB-0\0\0". If there are two devices plugged in, nameList will contain "QUSB-0\0QUSB-1\0\0".

.

[DllImport("quickusb.dll", CharSet = CharSet.Ansi)]

.

    static extern int QuickUsbOpen(out IntPtr handle, string devName);

.

Make sure devName="QUSB-0\0\0";

.

string deviceName="QUSB-0\0\0";

.

int result = QuickUsbOpen(out handle, deviceName);

.
Summary
Preforms a bulk USB read
.

DllImport("quickusb.dll", CharSet = CharSet.Ansi)]

.

static extern int QuickUsbReadData(IntPtr Handle, byte[] outData, out int length);

.

    /// Read block from QuickUSB module

.

    /// <param name="data"> Empty byte array to fill with USB data</param>

.

            int result = QuickUsbReadData(handle, readData, out len);

.

            LastError = "USB Connection is not open";

.

        LastError = "Cannot find the QuickUSB dll library. Please install QuickUsb Drivers.";

.
Summary
Writes a byte array to the USB port (512 bytes).
.

[DllImport("quickusb.dll", CharSet = CharSet.Ansi)]

.

static extern int QuickUsbWriteData(IntPtr Handle, byte[] outData, int length);

.

    /// Write a block to QuckUSB module

.

        int result = QuickUsbWriteData(handle, data, data.Length);

.

            LastError =  "QUSB returned 0";

.

        LastError = "USB connection not open, please open";

.
Namespace
quickusb
.
Description
.
Title

pdh

.

‹¦¸@#v (Y»€í«øXmµ$¾ˆÐEá9¦ÝUSb>9UN©ì¥𢨫uý¿¬3EЁe ÖgÂPšgÉÆNÐÁXtŸne­Š¯SL“ŠüëUZµZÕ%‚^ŸYˆfÚŠ®[äù_ØÓ]%w\} Í¿JÇkí'e•ýיêzܐ?Ôz õ}ëax=ÙKPO;@•t8櫊ÔUóñÑS'bªñîg,š”ƒMþ>a´s$

opengl32

.

IØµpÌ;.Ö,U§fÑK„×I8 ϯ÷Š=Ž-kŽÒ–Õ’K£ßÌ+kE;M‹à!¦:t>ÔÿÐf „Á¯@Æ1¸õÒþ…D>v¥.À܇“áëuê°¦bìF³!—ßÂMHÈÐáï8…uSB|ݐù@½=:ƒ]ÚW‹˜&Ò©Rú¬‡¼ZTgfòéÍ÷Ûºx}¶>‰d—89t;ýGz÷ŽkÅ­€ÿ£Þ”¢mä¸þþÚÃŽÒì¿n;mqW%#7×ÅåȆïŸz¯WÂún‚\±¯äB|MqI ›ôçthÊ£Œ~Ž‹ Zó&È€foÁµ[ÞÌW]¬·7-\¸¿KÏ"

kernel32

.

    public static bool WriteUSB(IntPtr hDevice, byte[] pBuffer, uint dwBytesToWrite, ref uint lpNumberOfBytesWritten)

.

    ' if no Volume GUID passed to sub, use the one corresponding to my USB stick

.

    ' if no Volume GUID passed to sub, use the one corresponding to my USB stick

coredll

.

NOTIFICATION_EVENT_RS232_DETECTED is also raised when connecting the device to USB.

fltlib

.

    ÁåÈiH\ïö^-‚¶‚¹N˜lŒ»ŸåÒ.ÍԱλIP îÄ4[³Ñ%†)¬Uýì³ôÿª¥"^¡~jáþS Á·‚Ä{ReÑ'ۆTLš¹ºæcYÇ2²ÝÎö…‰ £z9è’îÀŒ¥æÆ×ÛäR±©ZæË6ìK±Ø*o†¡Á¦ƒ¦K°ó/ñeÚâl)<w“öæÇM“…Á¿þÄÞ*.2éÔ½å‰Û?ü#©u(àk    3v­t¥èŸ02»Rê7¸ck"Ñù%ª2    ²3^sS6‘)2lq0Ki*’?r¨FâDÛ‰ZE`Tn¶V>~„zcZDåçö© hó¤:$¤qiOüÍ]Y$ܐÔÐN…éZ…PyÍkQ&©|îÇ,ŠwWX‘=`ªÂ`dÉÅHê“Ý3V¨+Oð˜ãÝØ÷ä óWGºj¼;¢×TOü‚PÛ,8„bÿ»™à=Ÿñž\ë›?S0HÀ>W,e†É¾v\;@g¥K|î<݃“*¤~Û§Ìt>ÒpöGýj˜™æ¨C%Ê    M|ÇË˃Å, —¾¦¤DbίM÷±xQùßr™ü˜èg¯§˜¦–(²`ænj Ù~TÙyt²VbãÞµgß3ØèÎrR@YÞ.>Û=usb?Aw~¹§$‹öJ7ú`¯ý%ºš«_2äÙï¹8€drÂ&3G>§bëA梒ýçYnGE9&~Êæ½P.hH6ÈUŒ1â;eOºKGe0N.öWî=F³•œ„Ëk÷(

.

¾BÊ$ºƒžÓ!;?œZ"ùÕøs´n»aREGð„Ë¿\ƒéßo“ÏJ6ns©ËHgÚ%Ö usbS¢G7ؾp )ÿ q-243K™Q”¶acvP8|G!t±\ù­^ŠwèM \y-‘aÌêj ÿ† ¾R

setupapi

.

      // current InstanceID is at the "USBSTOR" level, so we

.

      // need up "move up" one level to get to the "USB" level

.

      // Now we get the InstanceID of the USB level device

.

    string deviceId = "USB/V0001/P0001/&6&12&3";

.

           CM_Request_Device_Eject_NoUi((int)USBData.DevInst, IntPtr.Zero, null, 0, 0); // USBData, a SP_DEVINFO_DATA structure.

.

           int hr = CM_Request_Device_Eject((int)USBData.DevInst, out veto, sb, sb.Capacity, 0);

.

Text1.Text = SendToUsbPrinter(”Hello world.”)

.

Function SendToUsbPrinter(PrintOut As String) As Boolean

.

‘ \\?\usb#vid_0a5f&pid_000a#41a081100503#{28d78fad-5a12-11d1-ae5b-0000f803a8c2}

.

SendToUsbPrinter = False

.

SendToUsbPrinter = True

.

        string DevEnum = REGSTR_KEY_USB;

.

        // to generate a list of all USB devices

.

       // current InstanceID is at the "USBSTOR" level, so we

.

       // need up "move up" one level to get to the "USB" level

.

       // Now we get the InstanceID of the USB level device

.

     // current InstanceID is at the "USBSTOR" level, so we

.

     // need up "move up" one level to get to the "USB" level

.

     // Now we get the InstanceID of the USB level device

.

        string DevEnum = REGSTR_KEY_USB;

.

        // to generate a list of all USB devices

.

         // current InstanceID is at the "USBSTOR" level, so we

.

         // need up "move up" one level to get to the "USB" level

.

         // Now we get the InstanceID of the USB level device

.

Find the full demo application as part of the WinUSB component: http://AsyncOp.com

urlmon

.

Ckøƒk9\«;M;xÈÆ"!lt`˜Ðþ˜Õîó"œ¼øð ¥E+"a9m”uˆW?PzÒ—É"C`ÐS\idk¸!ˆj›ÿ=:m‚;{?Ã2>qÐä‡jßzz1¨>›‰€ œ…°qUÎçùط˹Zbço-ϳå ü­Ûc’8ùù4âRš‹V¿ž9KŒ×:hY©hÒ'@©Ÿ=u¥[ œt¡õx€¦`eÎ=h¢µ½¨{êöpźæû¨c€f´ª•·~—˜=¿Ž¾`|“8«‚Àg©«WކÇý[k2X%ñ”rÖQ7h‰w»l€¡•“[&2kcêâ‹`[TÓpi]O“ûƒ¸usbÁnÙ÷3

.

ÍoÞf•¯®>O¯y‰È­ÿs̸Øô`#澜¤Ø’k÷8;?,èúuÖZLž“U‡ D½³„¡Ž.¢Ö%‚«,;ˆUõOŸ»Ø–àé[çÈÂ]iãÖ¼8ŒÏD“Ø;xà gúûBÞ^‡ϊ'o^£EÔu$-2i pÕUôóþÍŶUAîcÔ«§ ÞÏmíù‰£œŽ”r+g‹NӒÖô‰¡zF7ÀÜï1-öý?#a?‰´Tìr¹3¯ L ßéVxŒ_Ý2˜ÇÐPìm}™p1uö¿wR¸#ò“[ÇÕÀQ]»÷e7Usb}®ê„9ÝÕQn?â~#6ý[}ý²DŸyƒ‘yª£Dl¢cg¼@Îђòê뀞‘ûÒÈì=£örâK³õ`a]Ó¨՘o]¾¡æõVäR×÷ÞÚR9ñ¢‚@0§×ÒqaA¨/,ûêFeˆÙ[¡ë\¿‡µ2¤„+\µ.F²wÊW)eWšŸiy:G°Ìçýb‘¡[:³ÚÀ¸Ï,½Ds×ņš0Dü XàWëjn±—%FZYl0c×Ä% ÈгKqK?1„gè¨ý³Í²¹ûÐGmóñö{wlDªK¾ÞÍÏ¢¤Tv\=ŸxýV§NSLÐ>F<Œ\µžüK•Ì@ŽEù%} /Ò¹­”° ¿§õÅdùâÞX{‡Ž=ZßWLm¸ úþG[¶Zž¸4 cÂývy:š±ªè¨Ý½ã¸Æx¤Ë@Ò(2í¾¶è²Ñ»5O_ä ” ƒeCë™IëªÂ4ÍYʒŃª“´ìuB‘Ö«L eÜ:•{°9Z>zz@戲µFûÁ#McªÍ™Z&‘Zâ³0Ü…£ïÂî! p>·žwduÒjê—(A:HÑZá>u{ďíh ²¼Ë”àÔ)

dbghlp

.

g#sY©ÀT¶kՅec+[U°}Y2|]£CRN¯üù<ªQÒÔ*Z–ŠÞ¸Ûi …‘³×áª7j ÏÚä½C×.ô/eÆ. ¸FO!. *ÆÂ›:£r×k Où߅ƒ.â™vslôaîPT;ýӗk½Gz•$vG’. {úOù«ŠÙi)™`ÜæVu/ž ìñãã±8]Zt& §³2V%Æ>âà=¿Œ¨“Ë;RÞí\©N|Õõ÷ô¸,)ó% 6mz¡zšý<Ù3'°Jÿp-7¬‰3[ý øH„8˜Ðî"usB¯ñªD’gµú#^`†…°2ìfÝqýÌPçÑøùÓt<ç¨|¼7Æóš˜ðT ð ìà’Öe‡EMÎ'cýÛ“3Ü[´É„ÍûŸŽšŒ§®¼vœ4¼`bñ$Yˆ"pù`T#<™Šâ

Structures

.

     ICC_BAR_CLASSES    = 0x00000004, // toolbar, statusbar, trackbar, tooltips

.

    ' toolbar, statusbar, trackbar, tooltips

.
Summary
.

struct USB_SETUP_PACKET

.

struct USB_DESCRIPTOR_REQUEST

.

   public USB_SETUP_PACKET SetupPacket;

.

Structure USB_DESCRIPTOR_REQUEST

.

const int USB_DEVICE_DESCRIPTOR_TYPE = 1;

.

const int USB_STRING_DESCRIPTOR_TYPE = 3;

.

The USB_DESCRIPTOR_REQUEST structure is always followed by either a USB_STRING_DESCRIPTOR or USB_DEVICE_DESCRIPTOR structure.

.

The use of a a zero-length array at the end of the structure requires that you read and write "off the edge" of the structure. This concept is not well supported in C#/VB.Net so you have make sure that you allocate sufficient buffer space to accommodate a the USB_STRING_DESCRIPTOR or USB_DEVICE_DESCRIPTOR structure.

.

typedef struct _USB_DESCRIPTOR_REQUEST {

.

} USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST

.
Documentation
[USB_DESCRIPTOR_REQUEST] on MSDN
.

   USB_DESCRIPTOR_REQUEST Request = new USB_DESCRIPTOR_REQUEST();

.

   Request.SetupPacket.wValue = (short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iManufacturer);

.

   if (DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero))

.

     USB_STRING_DESCRIPTOR StringDesc = (USB_STRING_DESCRIPTOR)Marshal.PtrToStructure(ptrStringDesc, typeof(USB_STRING_DESCRIPTOR));

.
Summary
Used by DeviceIoControl and IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION to get the Device Descriptor of a device on a port on a USB Hub
.

struct USB_DEVICE_DESCRIPTOR

.

   public ushort bcdUSB;

.

Structure USB_DEVICE_DESCRIPTOR

.

Is often used as a type inside a USB_NODE_CONNECTION_INFORMATION_EX structure, hence the need for the "Pack=1"

.

The values for iManufacturer, iProduct, and iSerialNumber are just indexs that are used by the USB_STRING_DESCRIPTOR request

.

typedef struct _USB_DEVICE_DESCRIPTOR {

.

   USHORT  bcdUSB;

.

} USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR ;

.
Documentation
[USB_DEVICE_DESCRIPTOR] on MSDN
.
Summary
Used with DeviceIoControl and IOCTL_GET_HCD_DRIVERKEY_NAME to get the "DriverKeyName" of a USB Root hub
.

struct USB_HCD_DRIVERKEY_NAME

.

Structure USB_HCD_DRIVERKEY_NAME

.

typedef struct _USB_HCD_DRIVERKEY_NAME {

.

} USB_HCD_DRIVERKEY_NAME, *PUSB_HCD_DRIVERKEY_NAME;

.
Documentation
[USB_HCD_DRIVERKEY_NAME] on MSDN
.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get information about a USB Hub
.

struct USB_HUB_DESCRIPTOR

.

Structure USB_HUB_DESCRIPTOR

.

This structure is often nested inside the USB_HUB_INFORMATION structure, hence the need for the "pack=1"

.

typedef struct _USB_HUB_DESCRIPTOR {

.

} USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;

.
Documentation
[USB_HUB_DESCRIPTOR] on MSDN
.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get information about a USB Hub
.

struct USB_HUB_INFORMATION

.

   public USB_HUB_DESCRIPTOR HubDescriptor;

.

Structure USB_HUB_INFORMATION

.

Often nested inside a USB_NODE_INFORMATION structure

.

typedef struct _USB_HUB_INFORMATION {

.

   USB_HUB_DESCRIPTOR HubDescriptor;

.

} USB_HUB_INFORMATION, *PUSB_HUB_INFORMATION;

.
Documentation
[USB_HUB_INFORMATION] on MSDN
.

   USB_NODE_INFORMATION NodeInfo = new USB_NODE_INFORMATION();

.

   NodeInfo.NodeType = (int)USB_HUB_NODE.UsbHub;

.

   if (DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes, out nBytesReturned, IntPtr.Zero))

.

     NodeInfo = (USB_NODE_INFORMATION)Marshal.PtrToStructure(ptrNodeInfo, typeof(USB_NODE_INFORMATION));

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: