Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
CPallini23-May-11 1:00
mveCPallini23-May-11 1:00 
GeneralRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
Maxwell Chen23-May-11 1:01
Maxwell Chen23-May-11 1:01 
QuestionRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
CPallini23-May-11 1:28
mveCPallini23-May-11 1:28 
AnswerRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
Maxwell Chen23-May-11 4:08
Maxwell Chen23-May-11 4:08 
GeneralRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
CPallini23-May-11 4:12
mveCPallini23-May-11 4:12 
GeneralRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
Maxwell Chen23-May-11 4:29
Maxwell Chen23-May-11 4:29 
QuestionRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
CPallini23-May-11 4:32
mveCPallini23-May-11 4:32 
AnswerRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
Maxwell Chen23-May-11 4:47
Maxwell Chen23-May-11 4:47 
CPallini wrote:
Anyway, are you sure you didn't make any other API call before calling GetLastError?

No.

Here is the latest code for testing.
bool SetupDi::EnumDevInfo(DWORD dwIndex, SP_DEVINFO_DATA* pDeviceInfoData)
{
	if(!m_hDevInfo) {
		TRACE(_T("SetupDi::EnumDevInfo, m_hDevInfo is NULL. \n"));
		return false;
	}
	if(!pDeviceInfoData) {
		TRACE(_T("SetupDi::EnumDevInfo, pDeviceInfoData is NULL. \n"));
		return false;
	}
	m_dwErrCode = 0;
	memset(pDeviceInfoData, 0, sizeof(SP_DEVINFO_DATA));
	pDeviceInfoData->cbSize = sizeof(SP_DEVINFO_DATA);
	BOOL bRet = SetupDiEnumDeviceInfo(m_hDevInfo, dwIndex, pDeviceInfoData);
	if(!bRet) {
		TRACE(_T("SetupDi::EnumDevInfo, SetupDiEnumDeviceInfo(index: %d) failed (0x%08X). \n"),
			dwIndex, m_dwErrCode = GetLastError());
		AfxMessageBox("SetupDiEnumDeviceInfo");

		// BEGIN: We just need this to make it work under x64. Memory alignment issue.
//		CString s;
//		s.Format(_T("SetupDi::EnumDevInfo, SetupDiEnumDeviceInfo(index: %d) failed (0x%08X). \n"),
//			dwIndex, GetLastError());
		// END: We just need this to make it work under x64. Memory alignment issue.

		//AfxMessageBox(s);
	}
	return (TRUE == bRet);
}

bool CPccCfgApp::FindSMBusHost()
{
	SetupDi	DevInfo;

	// SMBus host controller should fall under the "System" devices category.
	if(!DevInfo.GetClassDevs(SetupDi::eDC_System, _T("PCI"), true, true, true, false, false)) {
		TRACE(_T("CFindDeviceDlg::FindDevice, GetClassDevs failed. \n"));
//		AfxMessageBox(_T("CFindDeviceDlg::FindDevice, GetClassDevs failed."));
		return false;
	}

	DWORD dwIndex = 0;
	SP_DEVINFO_DATA spDevInfoData;
	while(1) {
		if(!DevInfo.EnumDevInfo(dwIndex, &spDevInfoData)) {
			TRACE(_T("CFindDeviceDlg::FindDevice, EnumDevInfo failed. \n"));
			AfxMessageBox(_T("CFindDeviceDlg::FindDevice, EnumDevInfo failed."));
			CString s;
			s.Format(_T("Error = 0x%08X"), DevInfo.m_dwErrCode);
			AfxMessageBox(s);
			break;
		}

		// Hardware ID...
	// ...
}

  Maxwell Chen

GeneralRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
CPallini23-May-11 6:03
mveCPallini23-May-11 6:03 
GeneralRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
Maxwell Chen23-May-11 6:07
Maxwell Chen23-May-11 6:07 
GeneralRe: 64-bit strange issue, SetupDiEnumDeviceInfo Pin
Maxwell Chen25-May-11 1:33
Maxwell Chen25-May-11 1:33 
AnswerRe: 64-bit strange issue, SetupDiEnumDeviceInfo [Resolved] Pin
Maxwell Chen25-May-11 1:31
Maxwell Chen25-May-11 1:31 
GeneralRe: 64-bit strange issue, SetupDiEnumDeviceInfo [Resolved] Pin
CPallini25-May-11 1:45
mveCPallini25-May-11 1:45 
QuestionNetServerEnum Function in Windows 2008 domains Pin
CADITC_CODER22-May-11 14:21
CADITC_CODER22-May-11 14:21 
AnswerRe: NetServerEnum Function in Windows 2008 domains Pin
barneyman22-May-11 19:05
barneyman22-May-11 19:05 
QuestionMake client area of dialog transparent, so i can see what is behind the window Pin
manchukuo22-May-11 10:20
manchukuo22-May-11 10:20 
AnswerRe: Make client area of dialog transparent, so i can see what is behind the window Pin
Albert Holguin22-May-11 11:02
professionalAlbert Holguin22-May-11 11:02 
GeneralRe: Make client area of dialog transparent, so i can see what is behind the window Pin
manchukuo22-May-11 11:33
manchukuo22-May-11 11:33 
GeneralRe: Make client area of dialog transparent, so i can see what is behind the window Pin
Albert Holguin22-May-11 11:45
professionalAlbert Holguin22-May-11 11:45 
AnswerRe: Make client area of dialog transparent, so i can see what is behind the window Pin
Mark Salsbery22-May-11 12:48
Mark Salsbery22-May-11 12:48 
AnswerRe: Make client area of dialog transparent, so i can see what is behind the window Pin
abhishek.biradar22-May-11 21:53
abhishek.biradar22-May-11 21:53 
AnswerRe: Make client area of dialog transparent, so i can see what is behind the window Pin
Iain Clarke, Warrior Programmer23-May-11 7:00
Iain Clarke, Warrior Programmer23-May-11 7:00 
GeneralRe: Make client area of dialog transparent, so i can see what is behind the window Pin
manchukuo23-May-11 7:11
manchukuo23-May-11 7:11 
GeneralRe: Make client area of dialog transparent, so i can see what is behind the window Pin
Iain Clarke, Warrior Programmer23-May-11 8:02
Iain Clarke, Warrior Programmer23-May-11 8:02 
QuestionKERNELBASE Exception Pin
Joschwenk66622-May-11 9:20
Joschwenk66622-May-11 9:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.