📄 scanusbdlg.cpp
字号:
{0x051C, "Shuttle Inc."},
{0x04E6, "Shuttle Technology"},
{0x044D, "Siemens Nixdorf AG"},
{0x0681, "Siemens Private Communication Systems"},
{0x058B, "Siemens Semiconductor"},
{0x05FA, "Siemens Telecommunications Systems Limited"},
{0x0636, "Sierra Imaging, Inc."},
{0x0658, "Sigma Designs, Inc."},
{0x05CD, "Silicom LTD."},
{0x053D, "Silicon Architect"},
{0x065E, "Silicon Graphics"},
{0x0457, "Silicon Integrated Systems Corp."},
{0x047B, "Silitek Corp."},
{0x062F, "Sin Sheng Terminal & Machine Inc."},
{0x076A, "Smart Technology Enablers, Inc."},
{0x0497, "Smile International, Inc."},
{0x06BA, "Smooth Cord & Connector Co., Ltd."},
{0x0524, "Sola Electronics"},
{0x054C, "Sony Corporation"},
{0x0655, "Space Shuttle Hi-Fi Wire & Cable Industry Co, Ltd."},
{0x05A8, "Spacetec IMC Corporation"},
{0x0424, "Standard Microsystems Corp.(2)"},
{0x0652, "Stargate Solutions, Inc."},
{0x0748, "Strong Man Enterprise Co., Ltd."},
{0x0472, "Sun Microsystems"},
{0x073B, "Suncom Technologies"},
{0x05CF, "Sung Forn Co. LTD."},
{0x0701, "Supercomal Wire & Cable SDN. BHD."},
{0x0769, "Surecom Technology Corp."},
{0x064E, "Suyin Corporation"},
{0x0754, "SyQuest Technology"},
{0x0417, "Symbios, Inc."},
{0x05E0, "Symbol Technologies"},
{0x06CB, "Synaptics Inc."},
{0x0745, "Syntech Information Co., Ltd."},
{0x05E1, "Syntek Design Technology Inc."},
{0x06AA, "Sysgration Ltd."},
{0x0532, "Systech Corporation"},
{0x06F0, "T.N.C Industrial Co., Ltd."},
{0x04BF, "TDK Corporation"},
{0x0644, "TEAC Corporation"},
{0x0475, "TECO Infor-ion System"},
{0x0660, "TSAY-E International Inc."},
{0x062D, "Taiwan Tai-Hao Enterprise Co., Ltd."},
{0x0628, "Tasking Software Inc."},
{0x04CD, "Tatung Co. Of America"},
{0x063B, "Taugagreining HF"},
{0x06C9, "Taxan (Europe) Ltd."},
{0x06D8, "Technical Marketing Research, Inc."},
{0x063A, "Techwin Corporation"},
{0x0657, "Tekcon American Corp."},
{0x052B, "Tekom Technologies, Inc"},
{0x0699, "Tektronix, Inc."},
{0x0676, "Teles AG"},
{0x0562, "Telex Communications Inc."},
{0x06CC, "Terayon Communication Systems"},
{0x0451, "Texas Instruments"},
{0x03E9, "Thesys Microelectronics"},
{0x05D7, "Thomas & Betts"},
{0x069B, "Thomson Consumer Electronics"},
{0x044F, "ThrustMaster, Inc."},
{0x0625, "TiMedia Technology Co., Ltd."},
{0x06E6, "Tiger Jet Network, Inc."},
{0x0767, "TokheimCorporation"},
{0x04EC, "Tokyo Electron Limited"},
{0x0663, "Topmax Electronic Co., Ltd."},
{0x06A2, "Topro Technology Inc."},
{0x06D5, "Toshiba America Electronic Components, Inc."},
{0x046C, "Toshiba"},
{0x066A, "Total Technologies, Ltd."},
{0x0611, "Totoku Electric Co., LTD."},
{0x065B, "Tracewell Systems"},
{0x0782, "Trackerball"},
{0x060E, "Transmonde Technologies, Inc."},
{0x06D0, "Traveling Software, Inc."},
{0x064D, "TriTech Microelectronics Ltd"},
{0x058E, "Tripath Technology Inc."},
{0x047A, "USAR Systems Incorporated"},
{0x05A1, "USC Corporation"},
{0x05D8, "Ultima Electronics Corp."},
{0x0646, "Umax Data Systems, Inc."},
{0x0540, "UniAccess AB"},
{0x05F5, "Unixtar Technology Inc."},
{0x076B, "Utimaco Safeware AG"},
{0x05A3, "VAutomation Inc."},
{0x0642, "VIA Medical Corporation"},
{0x040D, "VIA Technologies, Inc."},
{0x0553, "VLSI Vision Ltd."},
{0x0726, "Vanguard International Semiconductor-America"},
{0x04F1, "Victor Company of Japan, Limited"},
{0x0589, "Victron"},
{0x0733, "ViewQuest Technologies, Inc."},
{0x0543, "ViewSonic Corporation"},
{0x067F, "Virata Ltd."},
{0x0602, "Vista Imaging Inc."},
{0x0454, "Vobis Microcomputer AGO"},
{0x0778, "Volex, Inc."},
{0x056A, "WACOM Co., Ltd."},
{0x064F, "WIBU-Systems AG"},
{0x0531, "Wacom Technology Corp."},
{0x05D2, "Wave Systems Corp."},
{0x069E, "Welcat Inc."},
{0x0536, "Welch Allyn Inc."},
{0x0649, "Weli Science Co., Ltd"},
{0x077F, "Well Excellent & Most Corp."},
{0x040B, "Weltrend Semiconductor"},
{0x06A9, "Westell"},
{0x064B, "White Mountain DSP, Inc."},
{0x0645, "Who? Vision Systems, Inc."},
{0x0416, "Winbond Electronics Corp."},
{0x06F6, "Wintrend Technology Co., Ltd."},
{0x0641, "Woods Industries, Inc."},
{0x0668, "WordWand"},
{0x060A, "Worthington Data Solutions, Inc."},
{0x0765, "X-Rite Incorporated"},
{0x071C, "Xionics Document Technologies, Inc."},
{0x0545, "Xirlink, Inc."},
{0x057B, "Y-E Data, Inc."},
{0x05AD, "Y.C.Cable U.S.A., Inc"},
{0x0499, "Yamaha Corporation"},
{0x063C, "Yamaichi Electronics Co., Ltd. (Sakura)"},
{0x0717, "ZNK Corporation"},
{0x0629, "Zida Technologies Limited"},
{0x0595, "Zoran Microelectronics Ltd."},
{ 0x00, "End"}
};
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CScanUsbDlg dialog
CScanUsbDlg::CScanUsbDlg(CWnd* pParent /*=NULL*/)
: CDialog(CScanUsbDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CScanUsbDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CScanUsbDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CScanUsbDlg)
DDX_Control(pDX, IDC_EDIT, m_editShow);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CScanUsbDlg, CDialog)
//{{AFX_MSG_MAP(CScanUsbDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CScanUsbDlg message handlers
BOOL CScanUsbDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
HFONT hFont;
hFont = CreateFont(13,8,0,0,400,0,0,0,0,1,2,1,49,TEXT("Courier"));
m_editShow.SetFont(CFont::FromHandle(hFont));
m_editShow.SetWindowText("");
strShow="";
Refresh();
return TRUE; // return TRUE unless you set the focus to a control
}
void CScanUsbDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CScanUsbDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CScanUsbDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
BOOL CScanUsbDlg::AreThereStringDescriptors(PUSB_DEVICE_DESCRIPTOR DeviceDesc, PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc)
{
PUCHAR descEnd;
PUSB_COMMON_DESCRIPTOR commonDesc;
//
// Check Device Descriptor strings
//
if (DeviceDesc->iManufacturer || DeviceDesc->iProduct || DeviceDesc->iSerialNumber)
{
return TRUE;
}
//
// Check the Configuration and Interface Descriptor strings
//
descEnd = (PUCHAR)ConfigDesc + ConfigDesc->wTotalLength;
commonDesc = (PUSB_COMMON_DESCRIPTOR)ConfigDesc;
while (
(PUCHAR)commonDesc + sizeof(USB_COMMON_DESCRIPTOR) < descEnd
&& (PUCHAR)commonDesc + commonDesc->bLength <= descEnd
)
{
switch (commonDesc->bDescriptorType)
{
case USB_CONFIGURATION_DESCRIPTOR_TYPE:
if (commonDesc->bLength != sizeof(USB_CONFIGURATION_DESCRIPTOR))
{
break;
}
if (((PUSB_CONFIGURATION_DESCRIPTOR)commonDesc)->iConfiguration)
{
return TRUE;
}
//gordon@kinpobj.com.cn
commonDesc =(PUSB_COMMON_DESCRIPTOR)(commonDesc + commonDesc->bLength);
continue;
case USB_INTERFACE_DESCRIPTOR_TYPE:
if (commonDesc->bLength != sizeof(USB_INTERFACE_DESCRIPTOR)
&& commonDesc->bLength != sizeof(USB_INTERFACE_DESCRIPTOR2)
)
{
break;
}
if (((PUSB_INTERFACE_DESCRIPTOR)commonDesc)->iInterface)
{
return TRUE;
}
//gordon@kinpobj.com.cn
commonDesc =(PUSB_COMMON_DESCRIPTOR)(commonDesc + commonDesc->bLength);
continue;
default:
//gordon@kinpobj.com.cn
commonDesc =(PUSB_COMMON_DESCRIPTOR)(commonDesc + commonDesc->bLength);
continue;
}
break;
}
return FALSE;
}
PSTRING_DESCRIPTOR_NODE CScanUsbDlg::GetAllStringDescriptors(HANDLE hHubDevice, ULONG ConnectionIndex, PUSB_DEVICE_DESCRIPTOR DeviceDesc, PUSB_CONFIGURATION_DESCRIPTOR ConfigDesc)
{
PSTRING_DESCRIPTOR_NODE supportedLanguagesString;
PSTRING_DESCRIPTOR_NODE stringDescNodeTail;
ULONG numLanguageIDs;
USHORT *languageIDs;
PUCHAR descEnd;
PUSB_COMMON_DESCRIPTOR commonDesc;
//
// Get the array of supported Language IDs, which is returned
// in String Descriptor 0
//
supportedLanguagesString = GetStringDescriptor(hHubDevice,
ConnectionIndex,
0,
0);
if (supportedLanguagesString == NULL)
{
return NULL;
}
numLanguageIDs = (supportedLanguagesString->StringDescriptor->bLength - 2) / 2;
languageIDs = &supportedLanguagesString->StringDescriptor->bString[0];
stringDescNodeTail = supportedLanguagesString;
//
// Get the Device Descriptor strings
//
if (DeviceDesc->iManufacturer)
{
stringDescNodeTail = GetStringDescriptors(hHubDevice,
ConnectionIndex,
DeviceDesc->iManufacturer,
numLanguageIDs,
languageIDs,
stringDescNodeTail);
}
if (DeviceDesc->iProduct)
{
stringDescNodeTail = GetStringDescriptors(hHubDevice,
ConnectionIndex,
DeviceDesc->iProduct,
numLanguageIDs,
languageIDs,
stringDescNodeTail);
}
if (DeviceDesc->iSerialNumber)
{
stringDescNodeTail = GetStringDescriptors(hHubDevice,
ConnectionIndex,
DeviceDesc->iSerialNumber,
numLanguageIDs,
languageIDs,
stringDescNodeTail);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -