ReactOS  0.4.14-dev-599-g2d4d3f5
drop.c
Go to the documentation of this file.
1 /*
2  * Implementation of the Microsoft Installer (msi.dll)
3  *
4  * Copyright 2008 James Hawkins
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20 
21 #include <stdarg.h>
22 
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winerror.h"
26 #include "wine/debug.h"
27 #include "msi.h"
28 #include "msiquery.h"
29 #include "objbase.h"
30 #include "objidl.h"
31 #include "msipriv.h"
32 
33 #include "query.h"
34 
36 
37 typedef struct tagMSIDROPVIEW
38 {
44 } MSIDROPVIEW;
45 
47 {
49  UINT r;
50 
51  TRACE("%p %p\n", dv, record);
52 
53  if( !dv->table )
54  return ERROR_FUNCTION_FAILED;
55 
56  r = dv->table->ops->execute(dv->table, record);
57  if (r != ERROR_SUCCESS)
58  return r;
59 
60  return dv->table->ops->drop(dv->table);
61 }
62 
63 static UINT DROP_close(struct tagMSIVIEW *view)
64 {
66 
67  TRACE("%p\n", dv);
68 
69  return ERROR_SUCCESS;
70 }
71 
72 static UINT DROP_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
73 {
75 
76  TRACE("%p %p %p\n", dv, rows, cols);
77 
78  return ERROR_FUNCTION_FAILED;
79 }
80 
81 static UINT DROP_delete( struct tagMSIVIEW *view )
82 {
84 
85  TRACE("%p\n", dv );
86 
87  if( dv->table )
88  dv->table->ops->delete( dv->table );
89 
90  msi_free( dv );
91 
92  return ERROR_SUCCESS;
93 }
94 
95 static const MSIVIEWOPS drop_ops =
96 {
97  NULL,
98  NULL,
99  NULL,
100  NULL,
101  NULL,
102  NULL,
103  DROP_execute,
104  DROP_close,
106  NULL,
107  NULL,
108  DROP_delete,
109  NULL,
110  NULL,
111  NULL,
112  NULL,
113  NULL,
114  NULL,
115  NULL,
116 };
117 
119 {
120  MSIDROPVIEW *dv;
121  UINT r;
122 
123  TRACE("%p %s\n", view, debugstr_w(name));
124 
125  dv = msi_alloc_zero(sizeof *dv);
126  if(!dv)
127  return ERROR_FUNCTION_FAILED;
128 
129  r = TABLE_CreateView(db, name, &dv->table);
130  if (r != ERROR_SUCCESS)
131  {
132  msi_free( dv );
133  return r;
134  }
135 
136  dv->view.ops = &drop_ops;
137  dv->db = db;
138 
139  *view = (MSIVIEW *)dv;
140 
141  return ERROR_SUCCESS;
142 }
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
UINT TABLE_CreateView(MSIDATABASE *db, LPCWSTR name, MSIVIEW **view) DECLSPEC_HIDDEN
Definition: table.c:2162
MSIVIEW view
Definition: drop.c:39
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const MSIVIEWOPS drop_ops
Definition: drop.c:95
static UINT DROP_close(struct tagMSIVIEW *view)
Definition: drop.c:63
static UINT DROP_get_dimensions(struct tagMSIVIEW *view, UINT *rows, UINT *cols)
Definition: drop.c:72
static UINT DROP_delete(struct tagMSIVIEW *view)
Definition: drop.c:81
static UINT DROP_execute(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: drop.c:46
UINT(* execute)(struct tagMSIVIEW *view, MSIRECORD *record)
Definition: msipriv.h:268
int32_t INT
Definition: typedefs.h:56
static void * msi_alloc_zero(size_t len) __WINE_ALLOC_SIZE(1)
Definition: msipriv.h:1210
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:985
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
const MSIVIEWOPS * ops
Definition: msipriv.h:348
WINE_DEFAULT_DEBUG_CHANNEL(msidb)
UINT(* delete)(struct tagMSIVIEW *)
Definition: msipriv.h:299
MSIVIEW * table
Definition: drop.c:41
INT hold
Definition: drop.c:43
unsigned int UINT
Definition: ndis.h:50
static BOOL msi_free(void *mem)
Definition: msipriv.h:1227
Definition: name.c:38
UINT DROP_CreateView(MSIDATABASE *db, MSIVIEW **view, LPCWSTR name)
Definition: drop.c:118
UINT(* drop)(struct tagMSIVIEW *view)
Definition: msipriv.h:342
struct tagMSIDROPVIEW MSIDROPVIEW
column_info * colinfo
Definition: drop.c:42
MSIDATABASE * db
Definition: drop.c:40