📄 usbdevicedriverinstaller.cpp
字号:
// USBDeviceDriverInstaller.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "newdev.h"
#include "setupapi.h"
#define HARDWARE_ID "USB\\VID_0A12&PID_0001"
#define INF_FILE_NAME "CSRBlueCoreUSB.inf"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// Get the install directory from the command line
char full_inf_file_path[256];
strcpy(full_inf_file_path, lpCmdLine);
strcat(full_inf_file_path, INF_FILE_NAME);
// Uodate any exisiting devices
BOOL success = UpdateDriverForPlugAndPlayDevices(
NULL,
HARDWARE_ID,/*LPCTSTR HardwareId*/
full_inf_file_path,
0,
NULL
);
// Install the driver ready for any new devices
if(!SetupCopyOEMInf(full_inf_file_path, NULL, SPOST_PATH, 0, NULL,
0, NULL, NULL))
{
// tell the user there is a problem
MessageBox(NULL, "Failed to install CSR USB Driver!", "Error!", MB_OK);
// return the last error
return GetLastError();
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -