Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: installer/src/installer-lib/session.cpp

Issue 5219280069066752: Issue #1186 - Change names that appear in the custom action (Closed)
Left Patch Set: Created Oct. 2, 2014, 6:51 p.m.
Right Patch Set: Created Jan. 4, 2015, 7 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 /** 1 /**
2 * \file session.cpp Implementation of Session class. 2 * \file session.cpp Implementation of Session class.
3 */ 3 */
4 4
5 #include "installer-lib.h" 5 #include "installer-lib.h"
6 #include "session.h" 6 #include "session.h"
7 #include "property.h" 7 #include "property.h"
8 #include "msiquery.h" 8 #include "msiquery.h"
9 9
10 //------------------------------------------------------------------------------ ----------- 10 //------------------------------------------------------------------------------ -----------
11 // Message 11 // Message
12 //------------------------------------------------------------------------------ ----------- 12 //------------------------------------------------------------------------------ -----------
13 Message::Message( std::string message, INSTALLMESSAGE message_type ) 13 Message::Message( std::string message, INSTALLMESSAGE message_type )
14 : r( 1 ), message_type( message_type ) 14 : r( 1 ), message_type( message_type )
15 { 15 {
16 r.assign_string( 0, message ) ; 16 r.assign_string( 0, message ) ;
17 } 17 }
18 18
19 Message::Message( std::wstring message, INSTALLMESSAGE message_type ) 19 Message::Message( std::wstring message, INSTALLMESSAGE message_type )
20 : r( 1 ), message_type( message_type ) 20 : r( 1 ), message_type( message_type )
21 { 21 {
22 r.assign_string( 0, message ) ; 22 r.assign_string( 0, message ) ;
23 } 23 }
24 24
25 //------------------------------------------------------------------------------ ----------- 25 //------------------------------------------------------------------------------ -----------
26 // Session 26 // Session
27 //------------------------------------------------------------------------------ ----------- 27 //------------------------------------------------------------------------------ -----------
28 Session::Session( MSIHANDLE handle, std::string name ) 28 Session::Session( MSIHANDLE handle, std::string name )
29 : handle( handle ), 29 : handle( handle ),
30 log_prefix( name + ": " ) 30 log_prefix( name + ": " )
Oleksandr 2014/10/06 20:44:12 logPrefix?
Eric 2014/10/14 17:42:49 Next round, as also with the two below. See review
31 { 31 {
32 log_prefix_w.assign( name.begin(), name.end() ) ; 32 log_prefix_w.assign( name.begin(), name.end() ) ;
33 log_prefix_w += L": " ; 33 log_prefix_w += L": " ;
34 LogNoexcept( "Entering custom action" ) ; 34 LogNoexcept( "Entering custom action" ) ;
35 } 35 }
36 36
37 Session::~Session() 37 Session::~Session()
38 { 38 {
39 LogNoexcept( "Exiting custom action" ) ; 39 LogNoexcept( "Exiting custom action" ) ;
40 } 40 }
41 41
42 /** 42 /**
43 * A message for the installation log. 43 * A message for the installation log.
44 * 44 *
45 * Writing to the installation log uses MsiProcessMessage just like interactive d ialog boxes do. 45 * Writing to the installation log uses MsiProcessMessage just like interactive d ialog boxes do.
46 * 46 *
47 * This class is not exposed outside this compilation unit because everything it can do is already exposed by the log functions. 47 * This class is not exposed outside this compilation unit because everything it can do is already exposed by the log functions.
48 */ 48 */
49 struct Log_Message 49 struct Log_Message
Oleksandr 2014/10/06 20:44:12 LogMessage here?
50 : public Message 50 : public Message
51 { 51 {
52 Log_Message ( std::wstring message ) 52 Log_Message ( std::wstring message )
53 : Message( message, INSTALLMESSAGE_INFO ) 53 : Message( message, INSTALLMESSAGE_INFO )
54 {} 54 {}
55 55
56 Log_Message ( std::string message ) 56 Log_Message ( std::string message )
57 : Message( message, INSTALLMESSAGE_INFO ) 57 : Message( message, INSTALLMESSAGE_INFO )
58 {} 58 {}
59 } ; 59 } ;
60 60
61 void Session::log( std::string message ) 61 void Session::Log( std::string message )
62 { 62 {
63 WriteMessage( Log_Message( log_prefix + message ) ) ; 63 WriteMessage( Log_Message( log_prefix + message ) ) ;
64 } 64 }
65 65
66 void Session::log( std::wstring message ) 66 void Session::Log( std::wstring message )
67 { 67 {
68 WriteMessage( Log_Message( log_prefix_w + message ) ) ; 68 WriteMessage( Log_Message( log_prefix_w + message ) ) ;
69 } 69 }
70 70
71 void Session::LogNoexcept( std::string message ) 71 void Session::LogNoexcept( std::string message )
72 { 72 {
73 write_message_noexcept( Log_Message( log_prefix + message ) ) ; 73 write_message_noexcept( Log_Message( log_prefix + message ) ) ;
Oleksandr 2014/10/06 20:44:12 WriteMessageNoexcept
74 } 74 }
75 75
76 int Session::WriteMessage( Message & m ) 76 int Session::WriteMessage( Message & m )
77 { 77 {
78 int x = write_message_noexcept( m ) ; 78 int x = write_message_noexcept( m ) ;
79 if ( x == -1 ) 79 if ( x == -1 )
80 { 80 {
81 throw windows_api_error( "MsiProcessMessage", x, "attempt to write to log fi le" ) ; 81 throw windows_api_error( "MsiProcessMessage", x, "attempt to write to log fi le" ) ;
82 } 82 }
83 return x ; 83 return x ;
84 } 84 }
85 85
86 int Session::write_message_noexcept( Message & m ) 86 int Session::write_message_noexcept( Message & m )
87 { 87 {
88 return MsiProcessMessage( handle, m.message_type, m.r.handle() ) ; 88 return MsiProcessMessage( handle, m.message_type, m.r.handle() ) ;
89 } 89 }
90 90
91 //------------------------------------------------------------------------------ ----------- 91 //------------------------------------------------------------------------------ -----------
92 // ImmediateSession 92 // ImmediateSession
93 //------------------------------------------------------------------------------ ----------- 93 //------------------------------------------------------------------------------ -----------
94 ImmediateSession::ImmediateSession( MSIHANDLE handle, std::string name ) 94 ImmediateSession::ImmediateSession( MSIHANDLE handle, std::string name )
95 : Session( handle, name ) 95 : Session( handle, name )
96 {} 96 {}
LEFTRIGHT

Powered by Google App Engine
This is Rietveld