Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
3.0 KiB

  1. /******************************************************************************
  2. * Temp conversion utility to take registry entries and populate the class store with those entries.
  3. *****************************************************************************/
  4. /******************************************************************************
  5. includes
  6. ******************************************************************************/
  7. #include "precomp.hxx"
  8. /******************************************************************************
  9. defines and prototypes
  10. ******************************************************************************/
  11. extern CLSID CLSID_ClassStore;
  12. extern const IID IID_IClassStore;
  13. extern const IID IID_IClassAdmin;
  14. LONG
  15. UpdateDatabaseFromProgID(
  16. MESSAGE * pMessage )
  17. {
  18. BasicRegistry * pHKCR = new BasicRegistry( pMessage->hRoot );
  19. BasicRegistry * pProgIDKey;
  20. LONG Error = ERROR_SUCCESS;
  21. int Index;
  22. //
  23. // Get the progid entries one by one. A progID is one who has a CLSID subkey
  24. // underneath it. Assume that the class dictionary has been populated.
  25. //
  26. pHKCR->InitForEnumeration(0);
  27. for ( Index = 0;Error != ERROR_NO_MORE_ITEMS;++Index )
  28. {
  29. char ProgIDBuffer[ 256 ];
  30. DWORD SizeOfProgIDBuffer = 256;
  31. Error = pHKCR->NextKey( ProgIDBuffer,
  32. &SizeOfProgIDBuffer,
  33. &pProgIDKey,
  34. pMessage->ftLow, pMessage->ftHigh );
  35. if ( Error == ERROR_SUCCESS )
  36. {
  37. //
  38. // The CLSID key under HKCR also has a CLSID under it. If so, skip it.
  39. //
  40. if (_stricmp( ProgIDBuffer, "CLSID" ) == 0 )
  41. {
  42. delete pProgIDKey;
  43. continue;
  44. }
  45. // if the key has a clsid key underneath, then this is a progid key
  46. // else it is not.
  47. BasicRegistry * pClsidKey;
  48. LONG Error2;
  49. char Buffer[256];
  50. DWORD SizeofBuffer = 256;
  51. Error2 = pProgIDKey->Find( "CLSID", &pClsidKey ) ;
  52. if ( Error2 != ERROR_NO_MORE_ITEMS )
  53. {
  54. CLASS_ENTRY * pClsEntry;
  55. CLSDICT * pClsDict;
  56. // we found a real progid key. Enter this into the clsid
  57. // dictionary.
  58. pClsidKey->QueryValue( "", &Buffer[0], &SizeofBuffer );
  59. pClsDict = pMessage->pClsDict;
  60. if ( pClsEntry = pClsDict->Search( &Buffer[0] ) )
  61. {
  62. char * p = new char [strlen( ProgIDBuffer ) + 1];
  63. strcpy( p, ProgIDBuffer );
  64. // enter into class dictionary.
  65. pClsEntry->OtherProgIDs.Add( p );
  66. }
  67. delete pClsidKey;
  68. }
  69. delete pProgIDKey;
  70. }
  71. }
  72. return ERROR_SUCCESS;
  73. }