안재욱 님이 쓰신 글 :
: cfgmgr32.h 헤더 파일을 사용할려고 했더니 에러가 나서 검색해 봤습니다.
: DDK를 설치하라고 하시는 글을 봤는데요.
: DDK는 어디서 다운받고 어떻게 설치해야 하는지 궁금해서 문의 드립니다.
:
: 구글에서 cfg.h cfgmgr32.h guiddef.h 파일을 다운받아서
: include 폴더에 복사했더니 컴파일 에러가 나네요.
//---------------------------------------------------------------------------
// Description : Do the require the next available proper device in the system at this time.
// Parameter
// - pGuid : ptr to GUID registered by the driver itself
// - outNameBuf : the generated name for this device
// Return : return HANDLE if the open and initialization was successful, else INVLAID_HANDLE_VALUE.
//---------------------------------------------------------------------------
HANDLE __fastcall Tfmain::USB_GetDeviceLists(void)
{
HANDLE hHandleValue = INVALID_HANDLE_VALUE;
GUID gDeviceGUID = StringToGUID(TEXT("{36FC9E60-C465-11CF-8056-444553540000}"));
String sClassGUID = "";
String sDeviceGUID = "";
GUID gInterfaceClassGuid = {0x36FC9E60,0xC465,0x11CF,0x80,0x56,0x44,0x45,0x53,0x54,0x00,0x00};
DWORD nDeviceInfoIndex = 0;
bool bResultInfo = true;
bool bResultInterface = true;
DWORD nDeviceInterfaceIndex = 0;
bool bNoMoreInterface = false;
HDEVINFO hdDeviceInfoSet;
SP_DEVINFO_DATA spDeviceInfoData;
SP_DEVICE_INTERFACE_DATA spDeviceInterfaceData;
SP_DEVICE_INTERFACE_DETAIL_DATA spDeviceInterfaceDetailedData;
sClassGUID = GUIDToString(gInterfaceClassGuid);
//
// Open a handle to the plug and play dev node.
// SetupDiGetClassDevs() returns a device information set that contains info on all
// installed devices of a specified class.
//
hdDeviceInfoSet = SetupDiGetClassDevs(&gInterfaceClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
//hdDeviceInfoSet = SetupDiGetClassDevs(NULL, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE | DIGCF_ALLCLASSES);
if (hdDeviceInfoSet != INVALID_HANDLE_VALUE)
{
bResultInfo = true;
nDeviceInfoIndex = 0;
spDeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
while(bResultInfo)
{
bResultInfo = SetupDiEnumDeviceInfo(hdDeviceInfoSet, nDeviceInfoIndex, &spDeviceInfoData);
if (bResultInfo)
{
sDeviceGUID = GUIDToString(spDeviceInfoData.ClassGuid);
bResultInterface = true;
nDeviceInterfaceIndex = 0;
bNoMoreInterface = false;
HDEVINFO hdDeviceInterfaceSet = SetupDiGetClassDevs(&spDeviceInfoData.ClassGuid, NULL, NULL, DIGCF_ALLCLASSES);
spDeviceInterfaceData.cbSize = sizeof(hdDeviceInterfaceSet);
while(bResultInterface)
{
bResultInterface = SetupDiEnumDeviceInterfaces(hdDeviceInterfaceSet, NULL, &spDeviceInterfaceData.InterfaceClassGuid, nDeviceInterfaceIndex, &spDeviceInterfaceData);
if (bResultInterface)
{
GuidListsCombo->Items->Add(sDeviceGUID);
}
else
{
if (GetLastError() == ERROR_NO_MORE_ITEMS)
{
bNoMoreInterface = true;
break;
}
else
{
break;
}
}
nDeviceInterfaceIndex++;
}
}
nDeviceInfoIndex++;
}
}
SetupDiDestroyDeviceInfoList(hdDeviceInfoSet);
return hHandleValue;
}
위와 같이 코딩했는데요.
SetupDiEnumDeviceInterfaces()에서 응답이 무조건 false이고 에러값이 항상 ERROR_NO_MORE_ITEMS 이네요.
뭐가 문제일까요?
C++ Builder 6.0이고 window10입니다.
실행파일과 컴파일러 모두 관리자 권한을 주었습니다.
|