我有CDC设备。我为他开发了驱动程序。 ini档案的一部分:
[ClassInstall32]
CopyFiles=ClassInstall.CopyFiles
AddReg=ClassInstall.AddReg
[ClassInstall.CopyFiles]
My_USBDriver.dll,,,0x2000
[ClassInstall.AddReg]
HKR,,,,%DEVICEMANAGERCATEGORY%
HKR,,Icon,,"102"
HKR,,Installer32,,"My_USBDriver.dll,MyUSBPortsClassInstaller"
HKR,,NoInstallClass,,1
[DriverInstall]
include=mdmcpq.inf
CopyFiles=DriverInstall.CopyFiles
AddReg=DriverInstall.AddReg
[DriverInstall.CopyFiles]
usbser.sys,,,0x2000
[DriverInstall.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
[DriverInstall.Services]
AddService=usbser, 0x00000002, DriverService
[DriverService]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
安装程序功能有代码:
c->ConnectionIndex = iPort;
c->SetupPacket.bmRequest = 0x80;
c->SetupPacket.wValue = (USB_STRING_DESCRIPTOR_TYPE<<8)|descriptorNum;
c->SetupPacket.wLength = n;
Success = DeviceIoControl(
hRoot,
IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION,
c, n,
c, n,
&returnBytes,
NULL);
///Sometime GetLastError == 31 // Device not working
此代码在desctop(PC)上始终正常工作,但在安装设备期间只能在笔记本电脑(笔记本电脑)上工作(系统调用安装功能)。这些mashines的操作系统是Windows7。 但是如果我从我的progrm调用安装函数(为debuggin创建),这段代码总能正常工作(在笔记本电脑和电脑上)。 有没有人对这个问题有什么想法?
答案 0 :(得分:0)
你说桌面和笔记本电脑,但我不认为计算机的形状很重要。是一个32位操作系统,另一个是64位?我没有看到64位INF部分。