home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n08 / oleq0895.exe / GSI.CPP < prev    next >
Text File  |  1995-08-01  |  823b  |  30 lines

  1. DWORD GetSupportedInterfaces(IUnknown *punk,
  2.                  IID *iids,
  3.                  DWORD nArraySize)
  4. {
  5.   DWORD result = 0;
  6.   HKEY hkey;
  7.  
  8. // open the Interface (IID) key
  9.   LONG r = RegOpenKeyEx( HKEY_CLASSES_ROOT,__TEXT("Interface"),
  10.              0, KEY_QUERY_VALUE, &hkey);
  11.  
  12.   if (r == ERROR_SUCCESS) 
  13.     { DWORD index = 0;
  14.       TCHAR szGuid[128];
  15.       // get each subkey
  16.       while (ERROR_SUCCESS == RegEnumKey(hkey, index, szGuid, sizeof(szGuid)))
  17.      {
  18.      // convert key name to GUID (note: IIDFromString is not const-correct)
  19.      IID iid;
  20.      IIDFromString(LPOLESTR(LPCOLESTR(OLESTRCVAR(szGuid))), &iid);
  21.  
  22.      // test the IID and append to array if supported
  23.      if (IsInterfaceSupported(punk, iid) && result < nArraySize)
  24.         iids[result++] = iid;
  25.      index++;   }
  26.       RegCloseKey(hkey);
  27.     }
  28.     return result;
  29. }
  30.