mfc >> IO / IRQ resorces

by [Joe] » Sun, 30 Nov 2003 20:52:50 GMT

some one can help for how to get an avilable IRQ and IO
resorces .
I want to get the numbers of IRQ or list of IRQ's
avilable in my local machine. and also I want to get the
IO resorces or list of IO used by the OS.




mfc >> IO / IRQ resorces

by David A. Mair » Mon, 01 Dec 2003 02:51:43 GMT


[Joe]" < XXXX@XXXXX.COM > wrote in message
news:057a01c3b740$dcdbfb20$ XXXX@XXXXX.COM ...

I found a sample via Google:
http://groups.google.com/groups?q=IWbemServices+%22C%2B%2B%22&hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&selm=e0veO%23%24BCHA.2696%40cpmsftngxa08&rnum=3

I used it to develop the following example for IRQs (you can read the docs
to do I/O. Note that this is just an extract of the button handler that
populates a listbox:

IWbemServices* ConnectToWMINamespace(BSTR bstrNamespace)
{
HRESULT hres;
hres = CoInitializeEx(0, COINIT_MULTITHREADED); // Initialize COM.
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize COM library."));
return NULL; // Program has failed.
}

hres = CoInitializeSecurity( NULL,
-1,
NULL,
NULL,
RPC_C_AUTHN_LEVEL_CONNECT,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE,
0);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to initialize security."));
CoUninitialize();
return NULL; // Program has failed.
}
IWbemLocator *pLoc = 0;
hres = CoCreateInstance(CLSID_WbemLocator, 0,
CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID *) &pLoc);
if (FAILED(hres))
{
AfxMessageBox(_T("Failed to create IWbemLocator object."));
CoUninitialize();
return NULL; // Program has failed.
}

IWbemServices *pSvc = 0;
// Connect to the root\default namespace with the current user.
hres = pLoc->ConnectServer( bstrNamespace,
NULL,
NULL,
0,
NULL,
0,
0,
&pSvc);
if (FAILED(hres))
{
AfxMessageBox(_T("Could not connect."));
CoUninitialize();
return NULL; // Program has failed.
}
// Set the proxy so that impersonation of the client occurs.
// if you allow impersonation in the CoInitializeSecurity call
// then you could omit this step.
hres = CoSetProxyBlanket(pSvc,
RPC_C_AUTHN_WINNT,
RPC_C_AUTHZ_NONE,
NULL,
RPC_C_AUTHN_LEVEL_CALL,
RPC_C_IMP_LEVEL_IMPERSONATE,
NULL,
EOAC_NONE);
if (FAILED(hres))
{
AfxMessageBox(_T("Could not set proxy blanket."));
pSvc->Release();
pLoc->Release();
CoUninitialize();
return NULL; // Program has failed.
}

// Cleanup
// ========
pLoc->Release();
return pSvc; // Program successfully completed.
}

void CWMIIRQDlg::OnBnClickedGo()
{
HRESULT hr;
IEnumWbemClassObject *pEnum = NULL;
IWbemClassObject *pObj = NULL;
CListBox *irqList = (CListBox *)GetDlgItem(IDC_IRQS);
_bstr_t bstrNamespace(L"\\\\.\\root\\cimv2");
_bstr_t bstrWQL(L"WQL");
_bstr_t bstrQuery;
CString line;
ULONG count;
/* Lets connect to the cimv2 namespace in WMI */
IWbemServices* pWMIServices = ConnectToWMINamespace(bstrNamespace);
if (pWMIServices == NULL)
{
AfxMessageBox(_T("Failed to connect to WMI"));
return;
}
bstrQuery = L"SELECT * FROM Win32_IRQResource";
hr = pWMIServices->ExecQuery(bstrWQL, bstrQuery,
WBEM_FLAG_FORWARD_ONLY, NULL, &pEnum);
if (FAILED(hr))
{
AfxMessageBox(_T("Failed to execute WMI query"));
pWMIServices->Release();
return;
}
// Enumerate the r


mfc >> IO / IRQ resorces

by [Joe] » Mon, 01 Dec 2003 16:18:08 GMT

'm sorry, Can you pleas send me a ZIP file include the
workspace (code), I really aprichyate your help.
My Email : " XXXX@XXXXX.COM "
Best Regards,
Joe

2B%22&hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&selm=e0veO%23%
24BCHA.2696%40cpmsftngxa08&rnum=3
can read the docs
button handler that
Initialize COM.
library."));
security."));
*) &pLoc);
object."));
current user.
occurs.
CoInitializeSecurity call
(bstrNamespace);
1, &pObj, &count))
NULL, NULL);
NULL);


Similar Threads

1. IRQ / IO

some one can help for how to get a free IRQ and free IO .
I want to get the number of free IRQ or list of IRQ's 
avilable (not using). and also I want to get the free IO 
or list of avilable IO (not using).