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.

106 lines
3.8 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. UpdateDatabaseFromIID(
  16. MESSAGE * pMessage )
  17. {
  18. BasicRegistry * pHKCR = new BasicRegistry( pMessage->hRoot ); // HKCR
  19. BasicRegistry * pInterfaceRoot;
  20. IIDICT * pIIDict = pMessage->pIIDict;
  21. BOOL fFinish = 0;
  22. int Index;
  23. LONG Error;
  24. //
  25. // Get the first IID key under HKCR
  26. //
  27. Error = pHKCR->Find( "Interface", &pInterfaceRoot );
  28. if( Error == ERROR_NO_MORE_ITEMS )
  29. return ERROR_SUCCESS;
  30. //
  31. // Go thru all the subkeys under Interface and get the details under the keys.
  32. //
  33. pInterfaceRoot->InitForEnumeration( 0 );
  34. for( Index = 0;
  35. fFinish != 1;
  36. ++Index )
  37. {
  38. BasicRegistry * pKey;
  39. char InterfaceKeyBuffer[ 256 ];
  40. DWORD SizeOfInterfaceKeyBuffer = 256;
  41. Error = pInterfaceRoot->NextKey(
  42. &InterfaceKeyBuffer[0],
  43. &SizeOfInterfaceKeyBuffer,
  44. &pKey,
  45. pMessage->ftLow,
  46. pMessage->ftHigh );
  47. if( Error != ERROR_NO_MORE_ITEMS )
  48. {
  49. BasicRegistry * pProxyClsidKey;
  50. // get the proxystubclsid key under this.
  51. Error = pKey->Find("ProxyStubclsid32", &pProxyClsidKey );
  52. if( Error != ERROR_NO_MORE_ITEMS )
  53. {
  54. char PSBuffer[ 256 ];
  55. DWORD SizeofPSBuffer = 256;
  56. // Get the unnamed value. That is the clsid value.i
  57. // Enter that into the iidict.
  58. Error = pProxyClsidKey->QueryValue(
  59. "",
  60. &PSBuffer[0],
  61. &SizeofPSBuffer );
  62. if( Error != ERROR_NO_MORE_ITEMS )
  63. {
  64. ITF_ENTRY * pITFEntry = pMessage->pIIDict->Search(
  65. &InterfaceKeyBuffer[0] );
  66. if( !pITFEntry )
  67. {
  68. pITFEntry = new ITF_ENTRY;
  69. pITFEntry->SetIIDString( &InterfaceKeyBuffer[0] );
  70. pMessage->pIIDict->Insert( pITFEntry );
  71. }
  72. pITFEntry->SetClsid( &PSBuffer[0] );
  73. }
  74. delete pProxyClsidKey;
  75. }
  76. delete pKey;
  77. }
  78. else
  79. fFinish = 1;
  80. }
  81. return ERROR_SUCCESS;
  82. }