1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
#include "precomp.h"
// sql queries
LPCWSTR vcsSqlDatabaseQuery = L"SELECT `SqlDb`, `Server`, `Instance`, `Database`, "
L"`Component_`, `User_`, `FileSpec_`, `FileSpec_Log`, `Attributes` "
L"FROM `Wix4SqlDatabase`";
enum eSqlDatabaseQuery { sdqSqlDb = 1, sdqServer, sdqInstance, sdqDatabase,
sdqComponent, sdqUser, sdqDbFileSpec, sdqLogFileSpec, sdqAttributes };
LPCWSTR vcsSqlFileSpecQuery = L"SELECT `FileSpec`, `Name`, `Filename`, `Size`, "
L"`MaxSize`, `GrowthSize` FROM `Wix4SqlFileSpec` WHERE `FileSpec`=?";
enum eSqlFileSpecQuery { sfsqFileSpec = 1, sfsqName, sfsqFilename, sfsqSize,
sfsqMaxSize, sfsqGrowth };
// prototypes for private helper functions
static HRESULT NewDb(
__out SCA_DB** ppsd
);
static SCA_DB* AddDbToList(
__in SCA_DB* psdList,
__in SCA_DB* psd
);
static HRESULT SchedCreateDatabase(
__in SCA_DB* psd
);
static HRESULT SchedDropDatabase(
__in LPCWSTR wzKey, LPCWSTR wzServer,
__in LPCWSTR wzInstance,
__in LPCWSTR wzDatabase,
__in int iAttributes,
__in BOOL fIntegratedAuth,
__in LPCWSTR wzUser,
__in LPCWSTR wzPassword
);
static HRESULT GetFileSpec(
__in MSIHANDLE hViewFileSpec,
__in LPCWSTR wzKey,
__in SQL_FILESPEC* psf
);
HRESULT ScaDbsRead(
__inout SCA_DB** ppsdList,
__in SCA_ACTION saAction
)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
PMSIHANDLE hView;
PMSIHANDLE hRec;
PMSIHANDLE hViewFileSpec = NULL;
LPWSTR pwzData = NULL;
LPWSTR pwzId = NULL;
LPWSTR pwzComponent = NULL;
SCA_DB* psd = NULL;
if (S_OK != WcaTableExists(L"Wix4SqlDatabase"))
{
WcaLog(LOGMSG_VERBOSE, "Skipping ScaCreateDatabase() - Wix4SqlDatabase table not present");
ExitFunction1(hr = S_FALSE);
}
if (S_OK == WcaTableExists(L"Wix4SqlFileSpec"))
{
hr = WcaOpenView(vcsSqlFileSpecQuery, &hViewFileSpec);
ExitOnFailure(hr, "failed to open view on Wix4SqlFileSpec table");
}
// loop through all the sql databases
hr = WcaOpenExecuteView(vcsSqlDatabaseQuery, &hView);
ExitOnFailure(hr, "Failed to open view on Wix4SqlDatabase table");
while (S_OK == (hr = WcaFetchRecord(hView, &hRec)))
{
BOOL fHasComponent = FALSE;
INSTALLSTATE isInstalled = INSTALLSTATE_UNKNOWN;
INSTALLSTATE isAction = INSTALLSTATE_UNKNOWN;
hr = WcaGetRecordString(hRec, sdqSqlDb, &pwzId);
ExitOnFailure(hr, "Failed to get Wix4SqlDatabase.SqlDb");
hr = WcaGetRecordString(hRec, sdqComponent, &pwzComponent);
ExitOnFailure(hr, "Failed to get Component for database: '%ls'", psd->wzKey);
if (pwzComponent && *pwzComponent)
{
fHasComponent = TRUE;
er = ::MsiGetComponentStateW(WcaGetInstallHandle(), pwzComponent, &isInstalled, &isAction);
hr = HRESULT_FROM_WIN32(er);
ExitOnFailure(hr, "Failed to get state for component: %ls", pwzComponent);
// If we're doing install but the Component is not being installed or we're doing
// uninstall but the Component is not being uninstalled, skip it.
if ((WcaIsInstalling(isInstalled, isAction) && SCA_ACTION_INSTALL != saAction) ||
(WcaIsUninstalling(isInstalled, isAction) && SCA_ACTION_UNINSTALL != saAction))
{
continue;
}
}
hr = NewDb(&psd);
ExitOnFailure(hr, "Failed to allocate memory for new database: %D", pwzId);
hr = ::StringCchCopyW(psd->wzKey, countof(psd->wzKey), pwzId);
ExitOnFailure(hr, "Failed to copy Wix4SqlDatabase.SqlDbL: %ls", pwzId);
hr = ::StringCchCopyW(psd->wzComponent, countof(psd->wzComponent), pwzComponent);
ExitOnFailure(hr, "Failed to copy Wix4SqlDatabase.Component_: %ls", pwzComponent);
psd->fHasComponent = fHasComponent;
psd->isInstalled = isInstalled;
psd->isAction = isAction;
hr = WcaGetRecordFormattedString(hRec, sdqServer, &pwzData);
ExitOnFailure(hr, "Failed to get Server for database: '%ls'", psd->wzKey);
hr = ::StringCchCopyW(psd->wzServer, countof(psd->wzServer), pwzData);
ExitOnFailure(hr, "Failed to copy server string to database object:%ls", pwzData);
hr = WcaGetRecordFormattedString(hRec, sdqInstance, &pwzData);
ExitOnFailure(hr, "Failed to get Instance for database: '%ls'", psd->wzKey);
hr = ::StringCchCopyW(psd->wzInstance, countof(psd->wzInstance), pwzData);
ExitOnFailure(hr, "Failed to copy instance string to database object:%ls", pwzData);
hr = WcaGetRecordFormattedString(hRec, sdqDatabase, &pwzData);
ExitOnFailure(hr, "Failed to get Database for database: '%ls'", psd->wzKey);
hr = ::StringCchCopyW(psd->wzDatabase, countof(psd->wzDatabase), pwzData);
ExitOnFailure(hr, "Failed to copy database string to database object:%ls", pwzData);
hr = WcaGetRecordInteger(hRec, sdqAttributes, &psd->iAttributes);
ExitOnFailure(hr, "Failed to get Wix4SqlDatabase.Attributes");
hr = WcaGetRecordFormattedString(hRec, sdqUser, &pwzData);
ExitOnFailure(hr, "Failed to get User record for database: '%ls'", psd->wzKey);
// if a user was specified
if (*pwzData)
{
psd->fUseIntegratedAuth = FALSE;
hr = ScaGetUser(pwzData, &psd->scau);
ExitOnFailure(hr, "Failed to get user information for database: '%ls'", psd->wzKey);
}
else
{
psd->fUseIntegratedAuth = TRUE;
// integrated authorization doesn't have a User record
}
hr = WcaGetRecordString(hRec, sdqDbFileSpec, &pwzData);
ExitOnFailure(hr, "Failed to get Database FileSpec for database: '%ls'", psd->wzKey);
// if a database filespec was specified
if (*pwzData)
{
hr = GetFileSpec(hViewFileSpec, pwzData, &psd->sfDb);
ExitOnFailure(hr, "failed to get FileSpec for: %ls", pwzData);
if (S_OK == hr)
{
psd->fHasDbSpec = TRUE;
}
}
hr = WcaGetRecordString(hRec, sdqLogFileSpec, &pwzData);
ExitOnFailure(hr, "Failed to get Log FileSpec for database: '%ls'", psd->wzKey);
// if a log filespec was specified
if (*pwzData)
{
hr = GetFileSpec(hViewFileSpec, pwzData, &psd->sfLog);
ExitOnFailure(hr, "failed to get FileSpec for: %ls", pwzData);
if (S_OK == hr)
{
psd->fHasLogSpec = TRUE;
}
}
*ppsdList = AddDbToList(*ppsdList, psd);
psd = NULL; // set the db NULL so it doesn't accidentally get freed below
}
if (E_NOMOREITEMS == hr)
{
hr = S_OK;
}
ExitOnFailure(hr, "Failure occured while processing Wix4SqlDatabase table");
LExit:
if (psd)
{
ScaDbsFreeList(psd);
}
ReleaseStr(pwzComponent);
ReleaseStr(pwzId);
ReleaseStr(pwzData);
return hr;
}
SCA_DB* ScaDbsFindDatabase(
__in LPCWSTR wzSqlDb,
__in SCA_DB* psdList
)
{
SCA_DB* psd = NULL;
for (psd = psdList; psd; psd = psd->psdNext)
{
if (0 == lstrcmpW(wzSqlDb, psd->wzKey))
{
break;
}
}
return psd;
}
HRESULT ScaDbsInstall(
__in SCA_DB* psdList
)
{
HRESULT hr = S_FALSE; // assume nothing will be done
SCA_DB* psd = NULL;
for (psd = psdList; psd; psd = psd->psdNext)
{
if (psd->fHasComponent)
{
// if we need to drop, do that first
if (((psd->iAttributes & SCADB_DROP_ON_INSTALL) && WcaIsInstalling(psd->isInstalled, psd->isAction) && !WcaIsReInstalling(psd->isInstalled, psd->isAction)) ||
((psd->iAttributes & SCADB_DROP_ON_REINSTALL) && WcaIsReInstalling(psd->isInstalled, psd->isAction)))
{
hr = SchedDropDatabase(psd->wzKey, psd->wzServer, psd->wzInstance, psd->wzDatabase, psd->iAttributes, psd->fUseIntegratedAuth, psd->scau.wzName, psd->scau.wzPassword);
ExitOnFailure(hr, "Failed to drop database %ls", psd->wzKey);
}
// if installing this component
if (((psd->iAttributes & SCADB_CREATE_ON_INSTALL) && WcaIsInstalling(psd->isInstalled, psd->isAction) && !WcaIsReInstalling(psd->isInstalled, psd->isAction)) ||
((psd->iAttributes & SCADB_CREATE_ON_REINSTALL) && WcaIsReInstalling(psd->isInstalled, psd->isAction)))
{
hr = SchedCreateDatabase(psd);
ExitOnFailure(hr, "Failed to ensure database %ls exists", psd->wzKey);
}
}
}
LExit:
return hr;
}
HRESULT ScaDbsUninstall(
__in SCA_DB* psdList
)
{
HRESULT hr = S_FALSE; // assume nothing will be done
SCA_DB* psd = NULL;
for (psd = psdList; psd; psd = psd->psdNext)
{
if (psd->fHasComponent)
{
// if we need to drop do that first
if ((psd->iAttributes & SCADB_DROP_ON_UNINSTALL) && WcaIsUninstalling(psd->isInstalled, psd->isAction))
{
hr = SchedDropDatabase(psd->wzKey, psd->wzServer, psd->wzInstance, psd->wzDatabase, psd->iAttributes, psd->fUseIntegratedAuth, psd->scau.wzName, psd->scau.wzPassword);
ExitOnFailure(hr, "Failed to drop database %ls", psd->wzKey);
}
// install the db
if ((psd->iAttributes & SCADB_CREATE_ON_UNINSTALL) && WcaIsUninstalling(psd->isInstalled, psd->isAction))
{
hr = SchedCreateDatabase(psd);
ExitOnFailure(hr, "Failed to ensure database %ls exists", psd->wzKey);
}
}
}
LExit:
return hr;
}
void ScaDbsFreeList(
__in SCA_DB* psdList
)
{
SCA_DB* psdDelete = psdList;
while (psdList)
{
psdDelete = psdList;
psdList = psdList->psdNext;
MemFree(psdDelete);
}
}
// private helper functions
static HRESULT NewDb(
__out SCA_DB** ppsd
)
{
HRESULT hr = S_OK;
SCA_DB* psd = static_cast<SCA_DB*>(MemAlloc(sizeof(SCA_DB), TRUE));
ExitOnNull(psd, hr, E_OUTOFMEMORY, "failed to allocate memory for new database element");
*ppsd = psd;
LExit:
return hr;
}
static SCA_DB* AddDbToList(
__in SCA_DB* psdList,
__in SCA_DB* psd
)
{
if (psdList)
{
SCA_DB* psdT = psdList;
while (psdT->psdNext)
{
psdT = psdT->psdNext;
}
psdT->psdNext = psd;
}
else
{
psdList = psd;
}
return psdList;
}
static HRESULT SchedCreateDatabase(
__in SCA_DB* psd
)
{
HRESULT hr = S_OK;
WCHAR* pwzCustomActionData = NULL;
hr = WcaWriteStringToCaData(psd->wzKey, &pwzCustomActionData);
ExitOnFailure(hr, "failed to add DBKey to CustomActionData");
hr = WcaWriteStringToCaData(psd->wzServer, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add server name to CustomActionData");
hr = WcaWriteStringToCaData(psd->wzInstance, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add server instance to CustomActionData");
hr = WcaWriteStringToCaData(psd->wzDatabase, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add database name to CustomActionData");
hr = WcaWriteIntegerToCaData(psd->iAttributes, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add Sql attributes to CustomActionData");
hr = WcaWriteStringToCaData(psd->fUseIntegratedAuth ? L"1" : L"0", &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add if integrated connection to CustomActionData");
hr = WcaWriteStringToCaData(psd->scau.wzName, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add server user to CustomActionData");
hr = WcaWriteStringToCaData(psd->scau.wzPassword, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add user password to CustomActionData");
// Check to see if the database exists, if it does not then schedule a rollback
// so we clean up after ourselves if the creation of the database fails or is
// aborted. It is interesting to note that we can do this check here because the
// deferred CustomActions are Impersonated. That means this scheduling action and
// the execution actions all run with the same user context, so it is safe to
// to do the check.
hr = SqlDatabaseExists(psd->wzServer, psd->wzInstance, psd->wzDatabase, psd->fUseIntegratedAuth, psd->scau.wzName, psd->scau.wzPassword, NULL);
if (S_FALSE == hr)
{
hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackCreateDatabase"), pwzCustomActionData, COST_SQL_CREATEDB);
ExitOnFailure(hr, "Failed to schedule RollbackCreateDatabase action");
}
// database filespec
if (psd->fHasDbSpec)
{
hr = WcaWriteStringToCaData(L"1", &pwzCustomActionData);
ExitOnFailure(hr, "failed to specify that do have db.filespec to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfDb.wzName, &pwzCustomActionData);
ExitOnFailure(hr, "failed to add FileSpec.Name to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfDb.wzFilename, &pwzCustomActionData);
ExitOnFailure(hr, "failed to add FileSpec.Filename to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfDb.wzSize, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add FileSpec.Size to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfDb.wzMaxSize, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add FileSpec.MaxSize to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfDb.wzGrow, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add FileSpec.GrowthSize to CustomActionData");
}
else
{
hr = WcaWriteStringToCaData(L"0", &pwzCustomActionData);
ExitOnFailure(hr, "failed to specify that do not have db.filespec to CustomActionData");
}
// log filespec
if (psd->fHasLogSpec)
{
hr = WcaWriteStringToCaData(L"1", &pwzCustomActionData);
ExitOnFailure(hr, "failed to specify that do have log.filespec to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfLog.wzName, &pwzCustomActionData);
ExitOnFailure(hr, "failed to add FileSpec.Name to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfLog.wzFilename, &pwzCustomActionData);
ExitOnFailure(hr, "failed to add FileSpec.Filename to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfLog.wzSize, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add FileSpec.Size to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfLog.wzMaxSize, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add FileSpec.MaxSize to CustomActionData");
hr = WcaWriteStringToCaData(psd->sfLog.wzGrow, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add FileSpec.GrowthSize to CustomActionData");
}
else
{
hr = WcaWriteStringToCaData(L"0", &pwzCustomActionData);
ExitOnFailure(hr, "failed to specify that do not have log.filespec to CustomActionData");
}
// schedule the CreateDatabase action
hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"CreateDatabase"), pwzCustomActionData, COST_SQL_CREATEDB);
ExitOnFailure(hr, "Failed to schedule CreateDatabase action");
LExit:
ReleaseStr(pwzCustomActionData);
return hr;
}
HRESULT SchedDropDatabase(
__in LPCWSTR wzKey,
__in LPCWSTR wzServer,
__in LPCWSTR wzInstance,
__in LPCWSTR wzDatabase,
__in int iAttributes,
__in BOOL fIntegratedAuth,
__in LPCWSTR wzUser,
__in LPCWSTR wzPassword
)
{
HRESULT hr = S_OK;
WCHAR* pwzCustomActionData = NULL;
hr = WcaWriteStringToCaData(wzKey, &pwzCustomActionData);
ExitOnFailure(hr, "failed to add DBKey to CustomActionData");
hr = WcaWriteStringToCaData(wzServer, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add server name to CustomActionData");
hr = WcaWriteStringToCaData(wzInstance, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add server instance to CustomActionData");
hr = WcaWriteStringToCaData(wzDatabase, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add database name to CustomActionData");
hr = WcaWriteIntegerToCaData(iAttributes, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add server name to CustomActionData");
hr = WcaWriteStringToCaData(fIntegratedAuth ? L"1" : L"0", &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add server name to CustomActionData");
hr = WcaWriteStringToCaData(wzUser, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add server user to CustomActionData");
hr = WcaWriteStringToCaData(wzPassword, &pwzCustomActionData);
ExitOnFailure(hr, "Failed to add user password to CustomActionData");
hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"DropDatabase"), pwzCustomActionData, COST_SQL_DROPDB);
ExitOnFailure(hr, "Failed to schedule DropDatabase action");
LExit:
ReleaseStr(pwzCustomActionData);
return hr;
}
HRESULT GetFileSpec(
__in MSIHANDLE hViewFileSpec,
__in LPCWSTR wzKey,
__in SQL_FILESPEC* psf
)
{
HRESULT hr = S_OK;
PMSIHANDLE hRecFileSpec, hRec;
LPWSTR pwzData = NULL;
// create a record to do the fetch
hRecFileSpec = ::MsiCreateRecord(1);
if (!hRecFileSpec)
{
ExitOnFailure(hr = E_UNEXPECTED, "failed to create record for filespec: %ls", wzKey);
}
hr = WcaSetRecordString(hRecFileSpec, 1, wzKey);
ExitOnFailure(hr, "failed to set record string for filespec: %ls", wzKey);
// get the FileSpec record
hr = WcaExecuteView(hViewFileSpec, hRecFileSpec);
ExitOnFailure(hr, "failed to execute view on Wix4SqlFileSpec table for filespec: %ls", wzKey);
hr = WcaFetchSingleRecord(hViewFileSpec, &hRec);
ExitOnFailure(hr, "failed to get record for filespec: %ls", wzKey);
// read the data out of the filespec record
hr = WcaGetRecordFormattedString(hRec, sfsqName, &pwzData);
ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Name for filespec: %ls", wzKey);
hr = ::StringCchCopyW(psf->wzName, countof(psf->wzName), pwzData);
ExitOnFailure(hr, "Failed to copy Wix4SqlFileSpec.Name string: %ls", pwzData);
hr = WcaGetRecordFormattedString(hRec, sfsqFilename, &pwzData);
ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Filename for filespec: %ls", wzKey);
if (*pwzData)
{
hr = ::StringCchCopyW(psf->wzFilename, countof(psf->wzFilename), pwzData);
ExitOnFailure(hr, "Failed to copy filename to filespec object: %ls", pwzData);
}
else // if there is no file, skip this FILESPEC
{
WcaLog(LOGMSG_VERBOSE, "No filename specified, skipping FileSpec: %ls", psf->wzName);
ExitFunction1(hr = S_FALSE);
}
hr = WcaGetRecordFormattedString(hRec, sfsqSize, &pwzData);
ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.Size for filespec: %ls", wzKey);
if (*pwzData)
{
hr = ::StringCchCopyW(psf->wzSize, countof(psf->wzSize), pwzData);
ExitOnFailure(hr, "Failed to copy size to filespec object: %ls", pwzData);
}
else
{
psf->wzSize[0] = 0;
}
hr = WcaGetRecordFormattedString(hRec, sfsqMaxSize, &pwzData);
ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.MaxSize for filespec: %ls", wzKey);
if (*pwzData)
{
hr = ::StringCchCopyW(psf->wzMaxSize, countof(psf->wzMaxSize), pwzData);
ExitOnFailure(hr, "Failed to copy max size to filespec object: %ls", pwzData);
}
else
{
psf->wzMaxSize[0] = 0;
}
hr = WcaGetRecordFormattedString(hRec, sfsqGrowth, &pwzData);
ExitOnFailure(hr, "Failed to get Wix4SqlFileSpec.GrowthSize for filespec: %ls", wzKey);
if (*pwzData)
{
hr = ::StringCchCopyW(psf->wzGrow, countof(psf->wzGrow), pwzData);
ExitOnFailure(hr, "Failed to copy growth size to filespec object: %ls", pwzData);
}
else
{
psf->wzGrow[0] = 0;
}
hr = S_OK;
LExit:
ReleaseStr(pwzData);
return hr;
}
|