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.

92 lines
2.3 KiB

  1. #include "precomp.hxx"
  2. #include <msi.h>
  3. #include "process.h"
  4. HRESULT
  5. DARWIN_PACKAGE::InstallIntoRegistry( HKEY * RegistryKey)
  6. {
  7. HRESULT hr;
  8. int MsiStatus;
  9. // We will need to code scipt generation here.
  10. // process the advertise script.
  11. MsiStatus = MsiProcessAdvertiseScript(
  12. GetScriptFileName(), // script file path
  13. 0, // optional icon folder,
  14. *RegistryKey, // optional reg key
  15. FALSE, // output shortcuts to special folder
  16. FALSE // remove stuff from prev invocation
  17. );
  18. return HRESULT_FROM_WIN32( (long)MsiStatus );
  19. }
  20. HRESULT
  21. DARWIN_PACKAGE::InitRegistryKeyToInstallInto(
  22. HKEY * phKey )
  23. {
  24. DWORD Disposition;
  25. LONG Error;
  26. Error = RegCreateKeyEx(
  27. HKEY_CLASSES_ROOT,
  28. TEMP_KEY,
  29. 0,
  30. "REG_SZ",
  31. REG_OPTION_NON_VOLATILE,
  32. KEY_ALL_ACCESS,
  33. 0,
  34. phKey,
  35. &Disposition );
  36. return HRESULT_FROM_WIN32( Error );
  37. }
  38. HRESULT
  39. DARWIN_PACKAGE::RestoreRegistryKey( HKEY *hKey)
  40. {
  41. return S_OK;
  42. }
  43. HRESULT
  44. DARWIN_PACKAGE::DeleteTempKey(HKEY hKey, FILETIME ftLow, FILETIME ftHigh)
  45. {
  46. return HRESULT_FROM_WIN32( RegDeleteTree( HKEY_CLASSES_ROOT, TEMP_KEY ));
  47. }
  48. char *
  49. DARWIN_PACKAGE::GenerateScriptFileName(
  50. char * pPackageName )
  51. {
  52. char Drive [_MAX_DRIVE];
  53. char Dir [_MAX_DIR];
  54. char Name [_MAX_FNAME];
  55. char Ext [_MAX_EXT];
  56. char * ScriptNameAndPath = new char [_MAX_PATH ];
  57. _splitpath( pPackageName, Drive, Dir, Name, Ext );
  58. strcpy( ScriptNameAndPath, Drive );
  59. strcat( ScriptNameAndPath, Dir );
  60. strcat( ScriptNameAndPath, Name );
  61. strcat( ScriptNameAndPath, ".aas" );
  62. return ScriptNameAndPath;
  63. }
  64. HRESULT
  65. DARWIN_PACKAGE::InstallIntoGPT(
  66. MESSAGE * pMessage,
  67. BOOL fAssignOrPublish,
  68. char * pScriptBasePath )
  69. {
  70. int MsiStatus;
  71. MsiStatus = MsiAdvertiseProduct(
  72. GetPackageName(), GetScriptFileName(), 0,
  73. LANGIDFROMLCID(GetUserDefaultLCID()));
  74. return HRESULT_FROM_WIN32( (long)MsiStatus );
  75. }