home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Troubleshooting Netware Systems
/
CSTRIAL0196.BIN
/
attach
/
msj
/
v10n08
/
oleq0895.exe
/
GSI.CPP
< prev
next >
Wrap
Text File
|
1995-08-01
|
823b
|
30 lines
DWORD GetSupportedInterfaces(IUnknown *punk,
IID *iids,
DWORD nArraySize)
{
DWORD result = 0;
HKEY hkey;
// open the Interface (IID) key
LONG r = RegOpenKeyEx( HKEY_CLASSES_ROOT,__TEXT("Interface"),
0, KEY_QUERY_VALUE, &hkey);
if (r == ERROR_SUCCESS)
{ DWORD index = 0;
TCHAR szGuid[128];
// get each subkey
while (ERROR_SUCCESS == RegEnumKey(hkey, index, szGuid, sizeof(szGuid)))
{
// convert key name to GUID (note: IIDFromString is not const-correct)
IID iid;
IIDFromString(LPOLESTR(LPCOLESTR(OLESTRCVAR(szGuid))), &iid);
// test the IID and append to array if supported
if (IsInterfaceSupported(punk, iid) && result < nArraySize)
iids[result++] = iid;
index++; }
RegCloseKey(hkey);
}
return result;
}