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

Side by Side Diff: installer/src/installer-lib/database.h

Issue 6197445574787072: Cleaned up CA exceptions. Integrated free-standing handle class. (Closed)
Patch Set: Created March 30, 2014, 7:43 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * \file database.h MSI database 2 * \file database.h MSI database
3 */ 3 */
4 4
5 #ifndef DATABASE_H 5 #ifndef DATABASE_H
6 #define DATABASE_H 6 #define DATABASE_H
7 7
8 #include <string> 8 #include <string>
9 #include <memory> 9 #include <memory>
10 10
11 #include <Windows.h> 11 #include <Windows.h>
12 #include <Msi.h> 12 #include <Msi.h>
13 #include <MsiQuery.h> 13 #include <MsiQuery.h>
14 14
15 #include "installer-lib.h"
15 #include "handle.h" 16 #include "handle.h"
16 #include "session.h" 17 #include "session.h"
17 18
18 // Forward declarations 19 // Forward declarations
19 class View ; 20 class View ;
20 21
21 //------------------------------------------------------- 22 //-------------------------------------------------------
22 // Database 23 // Database
23 //------------------------------------------------------- 24 //-------------------------------------------------------
24 /** 25 /**
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 * 110 *
110 * \sa 111 * \sa
111 * - MSDN [MsiOpenDatabase function](http://msdn.microsoft.com/en-us/library /aa370338%28v=vs.85%29.aspx) 112 * - MSDN [MsiOpenDatabase function](http://msdn.microsoft.com/en-us/library /aa370338%28v=vs.85%29.aspx)
112 */ 113 */
113 msi_handle handle_from_pathname( const wchar_t * pathname ) 114 msi_handle handle_from_pathname( const wchar_t * pathname )
114 { 115 {
115 MSIHANDLE handle ; 116 MSIHANDLE handle ;
116 UINT x = MsiOpenDatabaseW( pathname, MSIDBOPEN_READONLY, & handle ) ; 117 UINT x = MsiOpenDatabaseW( pathname, MSIDBOPEN_READONLY, & handle ) ;
117 if ( x != ERROR_SUCCESS ) 118 if ( x != ERROR_SUCCESS )
118 { 119 {
119 throw std::runtime_error( "Open database from file system failed" ) ; 120 throw windows_api_error( "MsiOpenDatabaseW", x, "MSI database on file syst em" ) ;
120 } 121 }
121 return msi_handle( handle ) ; 122 return msi_handle( handle ) ;
122 } 123 }
123 124
124 public: 125 public:
125 File_System_Database( const wchar_t * pathname ) 126 File_System_Database( const wchar_t * pathname )
126 : Database( handle_from_pathname( pathname ) ) 127 : Database( handle_from_pathname( pathname ) )
127 {} 128 {}
128 } ; 129 } ;
129 130
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 * End marker 195 * End marker
195 */ 196 */
196 inline Record end() 197 inline Record end()
197 { 198 {
198 return Record( Record::null_t() ) ; 199 return Record( Record::null_t() ) ;
199 } 200 }
200 } ; 201 } ;
201 202
202 203
203 #endif 204 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld