| OLD | NEW | 
|---|
| 1 /** | 1 /** | 
| 2 * \file session.h The "install session" is the context for all custom installati
     on behavior. | 2 * \file session.h The "install session" is the context for all custom installati
     on behavior. | 
| 3 */ | 3 */ | 
| 4 | 4 | 
| 5 #ifndef SESSION_H | 5 #ifndef SESSION_H | 
| 6 #define SESSION_H | 6 #define SESSION_H | 
| 7 | 7 | 
| 8 #include "property.h" | 8 #include "property.h" | 
| 9 #include "record.h" | 9 #include "record.h" | 
| 10 | 10 | 
| 11 #include <string> | 11 #include <string> | 
| 12 #include "windows.h" | 12 #include "windows.h" | 
| 13 #include "msi.h" | 13 #include "msi.h" | 
| 14 | 14 | 
| 15 //------------------------------------------------------------------------------
     ----------- | 15 //------------------------------------------------------------------------------
     ----------- | 
| 16 // Message | 16 // Message | 
| 17 //------------------------------------------------------------------------------
     ----------- | 17 //------------------------------------------------------------------------------
     ----------- | 
| 18 /** | 18 /** | 
| 19 * Wrapper class for arguments to MsiProcessMessage. | 19  * Wrapper class for arguments to MsiProcessMessage. | 
| 20 * | 20  * | 
| 21 * The "user interface" for custom actions includes both interactive dialog boxes
      as well as the installation log. | 21  * The "user interface" for custom actions includes both interactive dialog boxe
     s as well as the installation log. | 
| 22 * All of them use the same call, MsiProcessMessage. | 22  * All of them use the same call, MsiProcessMessage. | 
| 23 * This class encapsulates its arguments. | 23  * This class encapsulates its arguments. | 
| 24 * | 24  * | 
| 25 * \sa | 25  * \sa | 
| 26 *    * MSDN [MsiProcessMessage function](http://msdn.microsoft.com/en-us/library
     /windows/desktop/aa370354%28v=vs.85%29.aspx) | 26  *    * MSDN [MsiProcessMessage function](http://msdn.microsoft.com/en-us/librar
     y/windows/desktop/aa370354%28v=vs.85%29.aspx) | 
| 27 *    * MSDN [Sending Messages to Windows Installer Using MsiProcessMessage](http
     ://msdn.microsoft.com/en-us/library/windows/desktop/aa371614%28v=vs.85%29.aspx) | 27  *    * MSDN [Sending Messages to Windows Installer Using MsiProcessMessage](htt
     p://msdn.microsoft.com/en-us/library/windows/desktop/aa371614%28v=vs.85%29.aspx) | 
| 28 */ | 28  */ | 
| 29 class Message | 29 class Message | 
| 30 { | 30 { | 
| 31 protected: | 31 protected: | 
| 32   /** | 32   /** | 
| 33   * The flags used by MsiProcessMessage as the box type. | 33   * The flags used by MsiProcessMessage as the box type. | 
| 34   */ | 34   */ | 
| 35   INSTALLMESSAGE message_type ; | 35   INSTALLMESSAGE MessageTypeCode ; | 
| 36 | 36 | 
| 37   /** | 37   /** | 
| 38   * The record argument to MsiProcessMessage | 38   * The record argument to MsiProcessMessage | 
| 39   */ | 39   */ | 
| 40   Record r ; | 40   Record r ; | 
| 41 | 41 | 
| 42   Message( std::string message, INSTALLMESSAGE message_type ) ; | 42   Message( std::string message, INSTALLMESSAGE MessageTypeCode ) ; | 
| 43 | 43 | 
| 44   Message( std::wstring message, INSTALLMESSAGE message_type ) ; | 44   Message( std::wstring message, INSTALLMESSAGE MessageTypeCode ) ; | 
| 45 | 45 | 
| 46   /** | 46   /** | 
| 47   * This class is a helper for Session, mustering all the arguments for MsiProce
     ssMessage except for the session handle. | 47   * This class is a helper for Session, mustering all the arguments for MsiProce
     ssMessage except for the session handle. | 
| 48   */ | 48   */ | 
| 49   friend Session ; | 49   friend Session ; | 
| 50 } ; | 50 } ; | 
| 51 | 51 | 
| 52 //------------------------------------------------------------------------------
     ----------- | 52 //------------------------------------------------------------------------------
     ----------- | 
| 53 // Session | 53 // Session | 
| 54 //------------------------------------------------------------------------------
     ----------- | 54 //------------------------------------------------------------------------------
     ----------- | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 122   * The life cycle of the session handle is not the responsibility of the base c
     lass. | 122   * The life cycle of the session handle is not the responsibility of the base c
     lass. | 
| 123   * In an interactive session, the handle is provided as an argument to the cust
     om action entry point, and we do not manage its life cycle. | 123   * In an interactive session, the handle is provided as an argument to the cust
     om action entry point, and we do not manage its life cycle. | 
| 124   * In an offline session, the handle is created in the (subclass) constructor. | 124   * In an offline session, the handle is created in the (subclass) constructor. | 
| 125   */ | 125   */ | 
| 126   MSIHANDLE handle ; | 126   MSIHANDLE handle ; | 
| 127 | 127 | 
| 128 private: | 128 private: | 
| 129   /** | 129   /** | 
| 130   * Prefix for log messages, regular string. Contains the name of the custom act
     ion. | 130   * Prefix for log messages, regular string. Contains the name of the custom act
     ion. | 
| 131   */ | 131   */ | 
| 132   std::string log_prefix ; | 132   std::string logPrefix ; | 
| 133 | 133 | 
| 134   /** | 134   /** | 
| 135   * Prefix for log messages, wide string. Contains the name of the custom action
     . | 135   * Prefix for log messages, wide string. Contains the name of the custom action
     . | 
| 136   */ | 136   */ | 
| 137   std::wstring log_prefix_w ; | 137   std::wstring logPrefixW ; | 
| 138 | 138 | 
| 139   /** | 139   /** | 
| 140   * Private copy constructor is declared but not defined. | 140   * Private copy constructor is declared but not defined. | 
| 141   * | 141   * | 
| 142   * C++11: declare with <b>= delete</b>. | 142   * C++11: declare with <b>= delete</b>. | 
| 143   */ | 143   */ | 
| 144   Session( const Session & ) ; | 144   Session( const Session & ) ; | 
| 145 | 145 | 
| 146   /** | 146   /** | 
| 147   * Write a message with MsiProcessMessage and throw no exceptions. | 147   * Write a message with MsiProcessMessage and throw no exceptions. | 
| 148   * | 148   * | 
| 149   * This is declared private because there are very few cases in which no-except
     ion behavior is required. | 149   * This is declared private because there are very few cases in which no-except
     ion behavior is required. | 
| 150   * | 150   * | 
| 151   * C++11: declare with **noexcept**. | 151   * C++11: declare with **noexcept**. | 
| 152   */ | 152   */ | 
| 153   int write_message_noexcept( Message & m ) ; | 153   int WriteMessageNoexcept( Message & m ) ; | 
| 154 | 154 | 
| 155   /** | 155   /** | 
| 156   * Private assignment operator is declared but not defined. | 156   * Private assignment operator is declared but not defined. | 
| 157   * | 157   * | 
| 158   * C++11: declare with <b>= delete</b>. | 158   * C++11: declare with <b>= delete</b>. | 
| 159   */ | 159   */ | 
| 160   Session & operator=( const Session & ) ; | 160   Session & operator=( const Session & ) ; | 
| 161 | 161 | 
| 162   /** | 162   /** | 
| 163   * The Property class requires access to the session handle. | 163   * The Property class requires access to the session handle. | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 183   *    Handle for the Windows Installer session provided as an argument to a cus
     tom action. | 183   *    Handle for the Windows Installer session provided as an argument to a cus
     tom action. | 
| 184   * \param[in] name | 184   * \param[in] name | 
| 185   *    The name of the custom action, used for logging. | 185   *    The name of the custom action, used for logging. | 
| 186   * | 186   * | 
| 187   * **noexcept** declaration to be added for C++11. | 187   * **noexcept** declaration to be added for C++11. | 
| 188   */ | 188   */ | 
| 189   ImmediateSession( MSIHANDLE handle, std::string name ) ; | 189   ImmediateSession( MSIHANDLE handle, std::string name ) ; | 
| 190 | 190 | 
| 191 private: | 191 private: | 
| 192   /* | 192   /* | 
| 193   * Allow helper function for Installation_Database constructor to have access t
     o the handle. | 193   * Allow helper function for InstallationDatabase constructor to have access to
      the handle. | 
| 194   */ | 194   */ | 
| 195   friend msi_handle get_active_database( ImmediateSession & session ) ; | 195   friend MsiHandle GetActiveDatabase( ImmediateSession & session ) ; | 
| 196 }; | 196 }; | 
| 197 | 197 | 
| 198 | 198 | 
| 199 //------------------------------------------------------------------------------
     ----------- | 199 //------------------------------------------------------------------------------
     ----------- | 
| 200 // Deferred_Session | 200 // DeferredSession | 
| 201 //------------------------------------------------------------------------------
     ----------- | 201 //------------------------------------------------------------------------------
     ----------- | 
| 202 /** | 202 /** | 
| 203 * Session for deferred custom actions. | 203 * Session for deferred custom actions. | 
| 204 * | 204 * | 
| 205 * There's much less context information easily available from a deferred custom 
     action. | 205 * There's much less context information easily available from a deferred custom 
     action. | 
| 206 * | 206 * | 
| 207 * /sa MDSN "Deferred Execution Custom Actions" | 207 * /sa MDSN "Deferred Execution Custom Actions" | 
| 208 *     http://msdn.microsoft.com/en-us/library/windows/desktop/aa368268%28v=vs.85
     %29.aspx | 208 *     http://msdn.microsoft.com/en-us/library/windows/desktop/aa368268%28v=vs.85
     %29.aspx | 
| 209 *     for general information. | 209 *     for general information. | 
| 210 * | 210 * | 
| 211 * /sa MSDN "Obtaining Context Information for Deferred Execution Custom Actions" | 211 * /sa MSDN "Obtaining Context Information for Deferred Execution Custom Actions" | 
| 212 *     http://msdn.microsoft.com/en-us/library/windows/desktop/aa370543%28v=vs.85
     %29.aspx | 212 *     http://msdn.microsoft.com/en-us/library/windows/desktop/aa370543%28v=vs.85
     %29.aspx | 
| 213 *     lists the API calls available. | 213 *     lists the API calls available. | 
| 214 */ | 214 */ | 
| 215 class Deferred_Session : public Session | 215 class DeferredSession : public Session | 
| 216 { | 216 { | 
| 217 public: | 217 public: | 
| 218   /** | 218   /** | 
| 219   * Ordinary constructor. | 219   * Ordinary constructor. | 
| 220   * | 220   * | 
| 221   * \param[in] handle | 221   * \param[in] handle | 
| 222   *    Handle for the Windows Installer session provided as an argument to a cus
     tom action. | 222   *    Handle for the Windows Installer session provided as an argument to a cus
     tom action. | 
| 223   * \param[in] name | 223   * \param[in] name | 
| 224   *    The name of the custom action, used for logging. | 224   *    The name of the custom action, used for logging. | 
| 225   */ | 225   */ | 
| 226   Deferred_Session( MSIHANDLE handle, std::wstring name ) ; | 226   DeferredSession( MSIHANDLE handle, std::wstring name ) ; | 
| 227 }; | 227 }; | 
| 228 | 228 | 
| 229 | 229 | 
| 230 //------------------------------------------------------------------------------
     ----------- | 230 //------------------------------------------------------------------------------
     ----------- | 
| 231 // Commit_Session | 231 // CommitSession | 
| 232 //------------------------------------------------------------------------------
     ----------- | 232 //------------------------------------------------------------------------------
     ----------- | 
| 233 /** | 233 /** | 
| 234 * The session for a commit custom action. NOT IMPLEMENTED. | 234 * The session for a commit custom action. NOT IMPLEMENTED. | 
| 235 * | 235 * | 
| 236 * \sa MSDN "Commit Custom Actions" http://msdn.microsoft.com/en-us/library/windo
     ws/desktop/aa367991%28v=vs.85%29.aspx | 236 * \sa MSDN "Commit Custom Actions" http://msdn.microsoft.com/en-us/library/windo
     ws/desktop/aa367991%28v=vs.85%29.aspx | 
| 237 */ | 237 */ | 
| 238 class Commit_Session | 238 class CommitSession | 
| 239 { | 239 { | 
| 240 }; | 240 }; | 
| 241 | 241 | 
| 242 //------------------------------------------------------------------------------
     ----------- | 242 //------------------------------------------------------------------------------
     ----------- | 
| 243 // Rollback_Session | 243 // RollbackSession | 
| 244 //------------------------------------------------------------------------------
     ----------- | 244 //------------------------------------------------------------------------------
     ----------- | 
| 245 /** | 245 /** | 
| 246 * The session for a rollback custom action. NOT IMPLEMENTED. | 246 * The session for a rollback custom action. NOT IMPLEMENTED. | 
| 247 * | 247 * | 
| 248 * \sa MSDN "Rollback Custom Actions" http://msdn.microsoft.com/en-us/library/win
     dows/desktop/aa371369%28v=vs.85%29.aspx | 248 * \sa MSDN "Rollback Custom Actions" http://msdn.microsoft.com/en-us/library/win
     dows/desktop/aa371369%28v=vs.85%29.aspx | 
| 249 */ | 249 */ | 
| 250 class Rollback_Session | 250 class RollbackSession | 
| 251 { | 251 { | 
| 252 }; | 252 }; | 
| 253 | 253 | 
| 254 #endif | 254 #endif | 
| OLD | NEW | 
|---|