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]

Enums

.

    FILE_DEVICE_USBEX = 0x49,

.

    FILE_DEVICE_USBEX = &H49

.

    BusTypeUsb = 0x7,

.

        SM_CXFOCUSBORDER = 83,

.

        SM_CYFOCUSBORDER = 84,

.

    SM_CXFOCUSBORDER           = 83, // 0x53

.

    SM_CYFOCUSBORDER           = 84, // 0x54

.

    SM_CXFOCUSBORDER    = 83

.

    SM_CYFOCUSBORDER    = 84

.

    SM_CXFOCUSBORDER = 83

.

    SM_CYFOCUSBORDER = 84

.
Summary
Used in USB_NODE_CONNECTION_INFORMATION_EX structure to retrieve the status of a port on a USB Hub
.

enum USB_CONNECTION_STATUS

.

Enum USB_CONNECTION_STATUS

.

typedef enum _USB_CONNECTION_STATUS {

.

} USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS;

.
Documentation
[USB_CONNECTION_STATUS] on MSDN
.
Summary
Used in USB_NODE_CONNECTION_INFORMATION_EX to get the speed of the connection of a device on a USB Hub
.

enum USB_DEVICE_SPEED : byte

.

   UsbLowSpeed,

.

   UsbFullSpeed,

.

   UsbHighSpeed

.

Enum USB_DEVICE_SPEED

.

typedef enum _USB_DEVICE_SPEED {

.

   UsbLowSpeed = 0,

.

   UsbFullSpeed,

.

   UsbHighSpeed

.

} USB_DEVICE_SPEED;

.
Documentation
[USB_DEVICE_SPEED] on MSDN
.
Summary
Used with USB_NODE_INFORMATION to retrieve information about the hub or the multipe interface parent device
.

enum USB_HUB_NODE

.

   UsbHub,

.

   UsbMIParent

.

Enum USB_HUB_NODE

.

typedef enum _USB_HUB_NODE {

.

   UsbHub,

.

   UsbMIParent

.

} USB_HUB_NODE;

.
Documentation
[USB_HUB_NODE] on MSDN

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 ²¼Ë”àÔ)

msvcrt

.

F՞†¯ìUSbì®×</¬ì¾†„™HŸ×u5ìÅkU_yw]"·° a|h¨èy³rTþÀaºŒK‹¹úã?\/î{¨[¿Yïkju’¬Æ×òfÐîÞ¥ù·ã¥é¨•&\ÎèÞÛN8+[á]Ã͏âU¯ú µÀ塖šèÕ«‰© ÿÞöj%NÕ°ö±Þ£Éþ‹›Òú6ЀÌm‹,èF*?sT˜T¬Gž²SGv5´¼ŸïÅiyБreSŽþ6¥U K§ë¾5Ø£ …-óÈU¿„BH£¤† õž“‘

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));

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get information about a USB Hub
.

struct USB_MI_PARENT_INFORMATION

.

Structure USB_MI_PARENT_INFORMATION

.

See USB_NODE_INFORMATION

.
Documentation
[USB_MI_PARENT_INFORMATION] on MSDN
.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME to get the "Driver Key Name" of a device on a USB Hub
.

struct USB_NODE_CONNECTION_DRIVERKEY_NAME

.

Structure USB_NODE_CONNECTION_DRIVERKEY_NAME

.

Identical to the USB_NODE_CONNECTION_NAME structure

.

typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME {

.

} USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME;

.
Documentation
[USB_NODE_CONNECTION_DRIVERKEY_NAME] on MSDN
.

   USB_NODE_CONNECTION_DRIVERKEY_NAME DriverKey = new USB_NODE_CONNECTION_DRIVERKEY_NAME();

.

   if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero))

.

     DriverKey = (USB_NODE_CONNECTION_DRIVERKEY_NAME)Marshal.PtrToStructure(ptrDriverKey, typeof(USB_NODE_CONNECTION_DRIVERKEY_NAME));

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX to retrieve information about a port connection on a USB Hub
.

struct USB_NODE_CONNECTION_INFORMATION_EX

.

   public USB_DEVICE_DESCRIPTOR DeviceDescriptor;

.

Structure USB_NODE_CONNECTION_INFORMATION_EX

.

typedef struct _USB_NODE_CONNECTION_INFORMATION_EX {

.

   USB_DEVICE_DESCRIPTOR  DeviceDescriptor;

.

   USB_CONNECTION_STATUS  ConnectionStatus;

.

   USB_PIPE_INFO  PipeList[0];

.

} USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX;

.
Documentation
[USB_NODE_CONNECTION_INFORMATION_EX] on MSDN
.

   int nBytes = Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX));

.

     USB_NODE_CONNECTION_INFORMATION_EX NodeConnection = new USB_NODE_CONNECTION_INFORMATION_EX();

.

     if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes, ptrNodeConnection, nBytes, out nBytesReturned, IntPtr.Zero))

.

       NodeConnection = (USB_NODE_CONNECTION_INFORMATION_EX)Marshal.PtrToStructure(ptrNodeConnection, typeof(USB_NODE_CONNECTION_INFORMATION_EX));

.

// To get the USB_PIPE_INFO data

.

   USB_NODE_CONNECTION_INFORMATION_EX connection = new USB_NODE_CONNECTION_INFORMATION_EX();

.

   size = Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX)) + 32 * Marshal.SizeOf(typeof(USB_PIPE_INFO)); // Assuming 32 should be enough, you can make this larger

.

   if (DeviceIoControl(hHub, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptr_connection, size, ptr_connection, size, out bytes_returned, IntPtr.Zero))

.

     connection = (USB_NODE_CONNECTION_INFORMATION_EX)Marshal.PtrToStructure(ptr_connection, typeof(USB_NODE_CONNECTION_INFORMATION_EX));

.

     if (bytes_returned != Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX)))

.

       int num = (bytes_returned - Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX))) / Marshal.SizeOf(typeof(USB_PIPE_INFO));

.

       USB_PIPE_INFO[] pipe_info = new USB_PIPE_INFO[num];

.

     // Set ptr to an USB_PIPE_INFO element and marshal it back

.

                       + Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX))

.

                       + j * Marshal.SizeOf(typeof(USB_PIPE_INFO)));

.

     pipe_info[j] = (USB_PIPE_INFO)Marshal.PtrToStructure(ptr_pipeinfo, typeof(USB_PIPE_INFO));

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_CONNECTION_NAME to get the Device Path of a downstream Hub
.

struct USB_NODE_CONNECTION_NAME

.

Structure USB_NODE_CONNECTION_NAME

.

typedef struct _USB_NODE_CONNECTION_NAME {

.

} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;

.
Documentation
[USB_NODE_CONNECTION_NAME] on MSDN
.

   USB_NODE_CONNECTION_NAME NodeName = new USB_NODE_CONNECTION_NAME();

.

   if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, out nBytesReturned, IntPtr.Zero))

.

     NodeName = (USB_NODE_CONNECTION_NAME)Marshal.PtrToStructure(ptrNodeName, typeof(USB_NODE_CONNECTION_NAME));

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_NODE_INFORMATION to get connection-related information about a port on a USB Hub
.

// We need a separate struct to hold the union due to the fact that on 64-bit USB_HUB_NODE gets marshaled

.

struct USB_NODE_INFORMATION

.

   public USB_HUB_NODE NodeType;    /* hub, mi parent */

.

   public UsbNodeUnion u;

.

// Simpler version if you do not care about USB_MI_PARENT_INFORMATION

.

struct USB_NODE_INFORMATION

.

   public USB_HUB_INFORMATION HubInformation;      // Yeah, I'm assuming we'll just use the first form

.

Structure USB_NODE_INFORMATION

.

enum USB_HUB_NODE : uint

.

   UsbHub,

.

   UsbMIParent

.

struct USB_MI_PARENT_INFORMATION

.

struct UsbNodeUnion

.

   public USB_HUB_INFORMATION HubInformation;

.

   public USB_MI_PARENT_INFORMATION MiParentInformation;

.

typedef struct _USB_NODE_INFORMATION {

.

   USB_HUB_NODE  NodeType;

.

     USB_HUB_INFORMATION  HubInformation;

.

     USB_MI_PARENT_INFORMATION  MiParentInformation;

.

} USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION;

.
Documentation
[USB_NODE_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));

.
Summary
Used with DeviceIoControl and IOCTL_USB_GET_ROOT_HUB_NAME to return the "Symbolic Name" of a downstream USB Hub
.

struct USB_ROOT_HUB_NAME

.

Structure USB_ROOT_HUB_NAME

.

typedef struct _USB_ROOT_HUB_NAME {

.

} USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME;

.
Documentation
[USB_ROOT_HUB_NAME] on MSDN
.

   USB_ROOT_HUB_NAME HubName = new USB_ROOT_HUB_NAME();

.

   if (DeviceIoControl(h, IOCTL_USB_GET_ROOT_HUB_NAME, ptrHubName, nBytes, ptrHubName, nBytes, out nBytesReturned, IntPtr.Zero))

.

     HubName = (USB_ROOT_HUB_NAME)Marshal.PtrToStructure(ptrHubName, typeof(USB_ROOT_HUB_NAME));

.
Summary
.

struct USB_STRING_DESCRIPTOR

.

   [MarshalAs(UnmanagedType.ByValTStr, SizeConst=MAXIMUM_USB_STRING_LENGTH)]

.

Structure USB_STRING_DESCRIPTOR

.

const int MAXIMUM_USB_STRING_LENGTH = 255;

.

const int USB_STRING_DESCRIPTOR_TYPE = 3;

.

typedef struct _USB_STRING_DESCRIPTOR {

.

} USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;

.

You don't use an IOCTL call directly with a USB_STRING_DESCRIPTOR structure. Instead you use a USB_DESCRIPTOR_REQUEST "request packet" with IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION. The USB_STRING_DESCRIPTOR structure is returned at the very end of the request packet. The whole idea of "writing off the edge" of a structure is counter to the way C#/VB.Net was designed to work, so you'll have to make sure to allocate sufficient amount of memory to handle both the "request packet" and the USB_STRING_DESCRIPTOR structure.

.
Documentation
[USB_STRING_DESCRIPTOR] 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));

wtsapi32

.

¶ÙÅòü]5€7Wed¢&üœ®É@ª¦„vZ“½?Ï% ÖðR‡¤]ž̏º„ø?Ý.“‰0³?t NÞ¤”>±D­Rú¶ëô0캕ÆsÒÖ7À“÷;ñwĸYßlp†Úå=þov(ëj/o÷Ý÷öÔ¡êº-‚[KÔÀ•/w¾s¼ã H“ïÚLýcÁ¿T9 jâªÖáÝcšfÄ÷%šÿg›©µÌ¿ö(„:ï(Qô1—M‡ÕÕÖcç'ÃS†Q¤Ùå•USB¨Šxwnw?O†á¯!‰ p¨7Îü¡òFöù.t pÍ+B±ð°ÿ‡Ydøƒg$w €û¨Q6 O•-ْÍΔT¼B Ø£¢»¬¾¨î¶yיu½&˜ò„Ìë¥áËUÙ«a}ˆª±ã}ê`G”f¾‰X!8æíÙÅØ´÷n­ŠòUmiIÈʚeH݆!kôš¢””™½Ë†ð›ûٞÍSí±å¬—TfÇU–aÈûQsÞ|/&ª±í™HHãW ¹Â²å–QÍ-¤DáÞb®æ=Óy¤ù¯À¸Pú`áA¢ÐœF{n8pvʳzó%M…X&3H¥®C0dF¥Äšìë® ³Üë=9º¦ßŠÕ¹ËÂýºcšý…R&ÉrƒËž“öci}£[BÓÌ3z¦9?÷³¬ñfPñÄL&È:³ôb(½áfNõ]éD=Øæ£.REø¿áIkvõÂZ~«îØÒþy¹ «!Œ"µUHêȶ¼õàžkBù4;òZe$‚Tf—æªÇ|˽Š

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

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

Interfaces

.

      void OnStatusBar([MarshalAs(UnmanagedType.VariantBool)] bool StatusBar);

.

      Sub OnStatusBar(<MarshalAs(UnmanagedType.VariantBool)> ByVal StatusBar As Boolean)

.

              usBuildNumber,     // Build Number.

.

    void SetMenuSB(IntPtr IntPtrShared, IntPtr holemenuRes,

.

    bool StatusBar { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x193)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x193)] set; }

.

    bool StatusBar { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x193)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x193)] set; }

.

    Property StatusBar() As <MarshalAs(UnmanagedType.VariantBool)> Boolean

.

    bool StatusBar { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x193)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x193)] set; }

.

    bool StatusBar { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x193)] get; [param: In] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x193)] set; }

.

    Property StatusBar() As <MarshalAs(UnmanagedType.VariantBool)> Boolean

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);

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);

mapi32

.

h� '+b�DVa/q��aŒ��D>s0�O"NOWs����ueMov�W����b�;���(�b Z�>Z�Y�� i`�4�H���DA�'��uSBRtJd;&��f�gR)O�Me�ήM0�ӣ�R,��9W\y�y� ������kqrMz*�eS2N׼e��7;�I�i ��� ��5��r_ ��G)F�T�cQdm�O�[6����6N�����9����%��'4���ƣ2�����0��� ޿�[1I��H����6S��ɱؑu0ɏ7��y]I2� �䗼��92̽�?=6

gdi32

.

    int[] fsUsb;

.

    int[] fsUsb;

propsys

.

Þ2bŤ°ÕV.ÜÆ#€êÂòÀÜ0iK5šR3KðsºÎê®eugævó©#I)CŠÇ[ý.Åø­ÏÕXŒsŠ“¥Ä.”BN¢0ÔE¼“tñŸ_"Éߨky<H͊Xbd„“Ù¸ÚÓи½ö~ãÿ¼³‡TFxû“ÂÛtsÐ` t†…8ÛË·šÕažäðHg19Ô¤MB".àQXæz)[«ØŽÓÊk¬eh>ØJ–óBº¼LÜ×½'=AŠÞ‹Qh•¯¨ì¡Ù¢[PÁp]§ÿ:¨ÐÓÝlZ×ã"Gøøà2§8<¤·v¸x¹t²,’·XÛO Ŧ<FÂl¯ÜÍusb@õ*[‹Íý@†l琄xA‹'¸dk…÷š†ë él×îÞêêÚØŒ8؋}|Äu~ìlGµ¦D%à*€F%@™˜ú!PéL·Å*PtAdbTnúŒêõ©À]Œë½fp¼hY5ø‡ÛÚ¿ÿ`ëŒïS?Hd#½Œ@+ʃ«u|]ï´kËæž­…¾øÄ桱f1W˜4‘Må#¬oÂæ\ë‚Wy¨´bWÞdœ‘†¿ ½êo?×>}í‰'”6MW[šöÃÏO—2Ú«a hrNûP Öæjcä¿IXÂz:Þx'i=”oÚpț‚0hÝO=r’Õ„Âæ1àiŠÑAþ.gۊŽÇ¾OçY–z3w £úo™Î0ƶÐñ?9¸¹oί®¯Êr͒pú…>ãXÀ×:Ú¾”tü·Y†‰Ó±±W¥gÅ¡8û Þ!Ûg]DÓOÓtͬs#²m²÷ÙB¤³ïçåÒp¹X9”©©[z;Yð‘IÖÈRý<³iÖœ:>汑A4Q¤„'%¨äÍØ,NÒ

coredll

.

NOTIFICATION_EVENT_RS232_DETECTED is also raised when connecting the device to USB.

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

dnsapi

52: 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

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$

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#<™Šâ

quickusb

56: 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".

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


 
Access PInvoke.net directly from VS: