本文整理汇总了C++中MsiCloseHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ MsiCloseHandle函数的具体用法?C++ MsiCloseHandle怎么用?C++ MsiCloseHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MsiCloseHandle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetMsiProperty
void GetMsiProperty (MSIHANDLE hModule, char* propertyValue, char* propertyName) {
if(!propertyName)
return;
MSIHANDLE hRecord, hView, hDatabase;
// get hView & hDatabase
hDatabase = MsiGetActiveDatabase(hModule);
char pSelectSql[256] = {0};
sprintf(pSelectSql, "select * from Property where `Property`='%s'", propertyName);
MsiDatabaseOpenView(hDatabase, pSelectSql, &hView);
MsiViewExecute(hView, NULL);
DWORD dwLength = 256;
if (MsiViewFetch(hView, &hRecord) != ERROR_SUCCESS)
return;
MsiRecordGetString(hRecord, 2, propertyValue, &dwLength);
// close all handles
MsiCloseHandle(hRecord);
MsiViewClose(hView);
MsiCloseHandle(hView);
MsiCloseHandle(hDatabase);
}
开发者ID:M6C,项目名称:com-parzing-ui-swing,代码行数:25,代码来源:MsiActions.cpp
示例2: MsiCloseHandle
/////////////////////////////////////////////////////////////////////
//
// Function: BOINCCABase::~BOINCCABase
//
// Description: Cleanup up allocation resources.
//
/////////////////////////////////////////////////////////////////////
BOINCCABase::~BOINCCABase()
{
if (m_phActionStartRec)
{
MsiCloseHandle(m_phActionStartRec);
m_phActionStartRec = NULL;
}
if (m_phActionDataRec)
{
MsiCloseHandle(m_phActionDataRec);
m_phActionDataRec = NULL;
}
if (m_phProgressRec)
{
MsiCloseHandle(m_phProgressRec);
m_phProgressRec = NULL;
}
if (m_phLogInfoRec)
{
MsiCloseHandle(m_phLogInfoRec);
m_phLogInfoRec = NULL;
}
m_strActionName.clear();
m_strProgressTitle.clear();
}
开发者ID:Ashod,项目名称:Boinc,代码行数:38,代码来源:boinccas.cpp
示例3: FillListbox
UINT __stdcall FillListbox(MSIHANDLE hInstall)
{
HRESULT hr = S_OK;
UINT er = ERROR_SUCCESS;
hr = WcaInitialize(hInstall, "FillListbox");
ExitOnFailure(hr, "Failed to initialize");
WcaLog(LOGMSG_STANDARD, "Initialized.");
// TODO: Add your custom action code here.
MSIHANDLE hTable = NULL;
MSIHANDLE hColumns = NULL;
MSIDBERROR dbErr = MSIDBERROR_NOERROR;
WcaLog(LOGMSG_STANDARD, "AddingTempRecord %d hTable = %x hColumns = %x dbErr = %d.", 0, hTable, hColumns, dbErr);
hr = WcaAddTempRecord (&hTable, &hColumns, L"ListBox", &dbErr, 0, 3, L"LISTBOXVALUES", 1, L"Item 1");
WcaLog(LOGMSG_STANDARD, "AddingTempRecord %d hTable = %x hColumns = %x dbErr = %d.", 1, hTable, hColumns, dbErr);
hr = WcaAddTempRecord (&hTable, &hColumns, L"ListBox", &dbErr, 0, 3, L"LISTBOXVALUES", 2, L"Item 2");
WcaLog(LOGMSG_STANDARD, "AddingTempRecord %d hTable = %x hColumns = %x dbErr = %d.", 2, hTable, hColumns, dbErr);
hr = WcaAddTempRecord (&hTable, &hColumns, L"ListBox", &dbErr, 0, 3, L"LISTBOXVALUES", 3, L"Item 3");
WcaLog(LOGMSG_STANDARD, "AddingTempRecord %d hTable = %x hColumns = %x dbErr = %d.", 3, hTable, hColumns, dbErr);
if (hTable)
MsiCloseHandle (hTable);
if (hColumns)
MsiCloseHandle (hColumns);
LExit:
er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
return WcaFinalize(er);
}
开发者ID:softark,项目名称:wix-j,代码行数:32,代码来源:CustomAction.cpp
示例4: msidbExportStream
/***********************************************************************
* msidbExportStream
*
* Exports a stream to a file with an .idb extension.
*
* Examples (note wildcard escape for *nix/bash):
* msidb -d <pathtomsi>.msi -f <workdir> -x <streamname>
* msidb -d <pathtomsi>.msi -f <workdir> -x data.cab
**********************************************************************/
static BOOL msidbExportStream(LPCWSTR dbfile, LPCWSTR wdir, LPCWSTR streamName)
{
static const char ext[] = {'.', 'i', 'd', 'b', 0};
UINT r, len;
MSIHANDLE dbhandle, streamListView, rec;
char queryBuffer[100];
FILE *fp = 0;
char *streamNameA = strdupWtoA(CP_ACP, streamName);
char *wdirA = strdupWtoA(CP_ACP, wdir);
char *streamFileA = 0;
char streamPath[MAX_PATH];
char *dataBuffer;
DWORD dataLen = 0;
r = MsiOpenDatabaseW(dbfile, (LPCWSTR) MSIDBOPEN_READONLY, &dbhandle);
if (r != ERROR_SUCCESS) return FALSE;
sprintf(queryBuffer, "SELECT * FROM _Streams WHERE Name = '%s'", streamNameA);
MsiDatabaseOpenView(dbhandle, queryBuffer, &streamListView);
MsiViewExecute(streamListView, 0);
r = MsiViewFetch(streamListView, &rec);
if (r != ERROR_SUCCESS) return FALSE;
if (MsiRecordReadStream(rec, 2, 0, &dataLen) != ERROR_SUCCESS)
return FALSE;
dataBuffer = malloc(dataLen);
if (!dataBuffer) return FALSE;
if (MsiRecordReadStream(rec, 2, dataBuffer, &dataLen) != ERROR_SUCCESS)
return FALSE;
len = strlen(streamNameA) + 5;
streamFileA = malloc(len);
if (streamFileA == NULL) return FALSE;
strcpy(streamFileA, streamNameA);
strcat(streamFileA, ext);
strcpy(streamPath, wdirA);
strcat(streamPath, PATH_DELIMITER);
strcat(streamPath, streamFileA);
fp = fopen(streamPath , "wb");
if (fp != NULL)
{
fwrite(dataBuffer, 1, dataLen, fp);
fclose(fp);
}
free(streamFileA);
MsiCloseHandle(rec);
MsiViewClose(streamListView);
MsiCloseHandle(streamListView);
MsiCloseHandle(dbhandle);
free(wdirA);
free(streamNameA);
return TRUE;
}
开发者ID:CaoMomo,项目名称:core,代码行数:67,代码来源:msidb.c
示例5: msierror
static PyObject*
msierror(int status)
{
int code;
char buf[2000];
char *res = buf;
DWORD size = sizeof(buf);
MSIHANDLE err = MsiGetLastErrorRecord();
if (err == 0) {
switch(status) {
case ERROR_ACCESS_DENIED:
PyErr_SetString(MSIError, "access denied");
return NULL;
case ERROR_FUNCTION_FAILED:
PyErr_SetString(MSIError, "function failed");
return NULL;
case ERROR_INVALID_DATA:
PyErr_SetString(MSIError, "invalid data");
return NULL;
case ERROR_INVALID_HANDLE:
PyErr_SetString(MSIError, "invalid handle");
return NULL;
case ERROR_INVALID_STATE:
PyErr_SetString(MSIError, "invalid state");
return NULL;
case ERROR_INVALID_PARAMETER:
PyErr_SetString(MSIError, "invalid parameter");
return NULL;
case ERROR_OPEN_FAILED:
PyErr_SetString(MSIError, "open failed");
return NULL;
case ERROR_CREATE_FAILED:
PyErr_SetString(MSIError, "create failed");
return NULL;
default:
PyErr_Format(MSIError, "unknown error %x", status);
return NULL;
}
}
code = MsiRecordGetInteger(err, 1); /* XXX code */
if (MsiFormatRecord(0, err, res, &size) == ERROR_MORE_DATA) {
res = malloc(size+1);
if (res == NULL) {
MsiCloseHandle(err);
return PyErr_NoMemory();
}
MsiFormatRecord(0, err, res, &size);
res[size]='\0';
}
MsiCloseHandle(err);
PyErr_SetString(MSIError, res);
if (res != buf)
free(res);
return NULL;
}
开发者ID:Victor-Savu,项目名称:cpython,代码行数:57,代码来源:_msi.c
示例6: test_summary_binary
static void test_summary_binary(void)
{
const char *msifile = "winetest.msi";
MSIHANDLE hdb = 0, hsuminfo = 0;
UINT r, type, count;
INT ival;
DWORD sz;
char sval[20];
DeleteFile( msifile );
test_create_database_binary();
ok( INVALID_FILE_ATTRIBUTES != GetFileAttributes(msifile), "file doesn't exist!\n");
/* just MsiOpenDatabase should not create a file */
r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb);
ok(r == ERROR_SUCCESS, "MsiOpenDatabase failed\n");
r = MsiGetSummaryInformation(hdb, NULL, 0, &hsuminfo);
ok(r == ERROR_SUCCESS, "MsiGetSummaryInformation failed\n");
/*
* Check what reading PID_LASTPRINTED does...
* The string value is written to the msi file
* but it appears that we're not allowed to read it back again.
* We can still read its type though...?
*/
sz = sizeof sval;
sval[0] = 0;
type = 0;
r = MsiSummaryInfoGetProperty(hsuminfo, PID_LASTPRINTED, &type, NULL, NULL, sval, &sz);
ok(r == ERROR_SUCCESS, "MsiSummaryInfoGetProperty failed\n");
ok(!lstrcmpA(sval, "") || !lstrcmpA(sval, "7"),
"Expected empty string or \"7\", got \"%s\"\n", sval);
todo_wine {
ok(type == VT_LPSTR, "Expected VT_LPSTR, got %d\n", type);
ok(sz == 0 || sz == 1, "Expected 0 or 1, got %d\n", sz);
}
ival = -1;
r = MsiSummaryInfoGetProperty(hsuminfo, PID_WORDCOUNT, &type, &ival, NULL, NULL, NULL);
ok(r == ERROR_SUCCESS, "MsiSummaryInfoGetProperty failed\n");
todo_wine ok( ival == 0, "value incorrect\n");
/* looks like msi adds some of its own values in here */
count = 0;
r = MsiSummaryInfoGetPropertyCount( hsuminfo, &count );
ok(r == ERROR_SUCCESS, "getpropcount failed\n");
todo_wine ok(count == 10, "prop count incorrect\n");
MsiCloseHandle( hsuminfo );
MsiCloseHandle( hdb );
DeleteFile( msifile );
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:56,代码来源:suminfo.c
示例7: msidbExportStorage
static BOOL msidbExportStorage(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageName)
{
UINT r, len;
MSIHANDLE dbhandle, view, rec;
char queryBuffer[100];
char *storageNameA = strdupWtoA(CP_ACP, storageName);
char *wdirA = strdupWtoA(CP_ACP, wdir);
char *storagePath = NULL;
char *dataBuffer;
DWORD dataLen = 0;
FILE *fp = NULL;
sprintf(queryBuffer, "SELECT * FROM _Storages WHERE Name = '%s'", storageNameA);
r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_READONLY, &dbhandle);
if (r != ERROR_SUCCESS) return FALSE;
MsiDatabaseOpenView(dbhandle, queryBuffer, &view);
MsiViewExecute(view, 0);
r = MsiViewFetch(view, &rec);
if (r != ERROR_SUCCESS) return FALSE;
if ((r = MsiRecordReadStream(rec, 2, 0, &dataLen)) != ERROR_SUCCESS)
{
return FALSE;
}
if ((dataBuffer = malloc(dataLen)) == NULL) return FALSE;
if (MsiRecordReadStream(rec, 2, dataBuffer, &dataLen) != ERROR_SUCCESS) return FALSE;
len = strlen(wdirA) + strlen(storageNameA) + 2;
storagePath = malloc(len * sizeof(WCHAR));
if (storagePath == NULL) return FALSE;
strcpy(storagePath, wdirA);
strcat(storagePath, "/");
strcat(storagePath, storageNameA);
fp = fopen(storagePath , "wb");
if (fp != NULL)
{
fwrite(dataBuffer, 1, dataLen, fp);
fclose(fp);
}
free(storagePath);
MsiCloseHandle(rec);
MsiViewClose(view);
MsiCloseHandle(view);
MsiCloseHandle(dbhandle);
free(storageNameA);
free(wdirA);
return TRUE;
}
开发者ID:CaoMomo,项目名称:core,代码行数:54,代码来源:msidb.c
示例8: msidbImportStorages
static BOOL msidbImportStorages(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR storageNames[])
{
static const WCHAR delim[] = {'/', 0};
UINT r, len, i;
MSIHANDLE dbhandle, view, rec;
WCHAR *storagePath = 0;
char *query = "INSERT INTO _Storages (Name, Data) VALUES(?, ?)";
r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_TRANSACT, &dbhandle);
if (r != ERROR_SUCCESS) return FALSE;
r = MsiDatabaseOpenView(dbhandle, query, &view);
if (r != ERROR_SUCCESS) return FALSE;
MsiViewExecute(view, 0);
r = MsiViewFetch(view, &rec);
if (r != ERROR_SUCCESS) return FALSE;
for (i = 0; i < MAX_STORAGES && storageNames[i] != 0; ++i)
{
len = lstrlenW(wdir) + lstrlenW(storageNames[i]) + 2;
storagePath = malloc(len * sizeof(WCHAR));
if (storagePath == NULL) return FALSE;
lstrcpyW(storagePath, wdir);
lstrcatW(storagePath, delim);
lstrcatW(storagePath, storageNames[i]);
rec = MsiCreateRecord(2);
MsiRecordSetStringW(rec, 1, storageNames[i]);
r = MsiRecordSetStreamW(rec, 2, storagePath);
if (r != ERROR_SUCCESS)
{
return FALSE;
}
r = MsiViewExecute(view, rec);
if (r != ERROR_SUCCESS)
{
return FALSE;
}
MsiCloseHandle(rec);
}
MsiViewClose(view);
MsiCloseHandle(view);
MsiDatabaseCommit(dbhandle);
MsiCloseHandle(dbhandle);
return TRUE;
}
开发者ID:CaoMomo,项目名称:core,代码行数:50,代码来源:msidb.c
示例9: msiobj_dealloc
static void
msiobj_dealloc(msiobj* msidb)
{
MsiCloseHandle(msidb->h);
msidb->h = 0;
PyObject_Del(msidb);
}
开发者ID:Victor-Savu,项目名称:cpython,代码行数:7,代码来源:_msi.c
示例10: create_database
static void create_database(const CHAR *name, const msi_table *tables, int num_tables)
{
MSIHANDLE db;
UINT r;
int j;
r = MsiOpenDatabaseA(name, MSIDBOPEN_CREATE, &db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
/* import the tables into the database */
for (j = 0; j < num_tables; j++)
{
const msi_table *table = &tables[j];
write_file(table->filename, table->data, (table->size - 1) * sizeof(char));
r = MsiDatabaseImportA(db, CURR_DIR, table->filename);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
}
DeleteFileA(table->filename);
}
write_msi_summary_info(db);
r = MsiDatabaseCommit(db);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle(db);
}
开发者ID:howard5888,项目名称:wineT,代码行数:32,代码来源:install.c
示例11: test_MsiSetComponentState
static void test_MsiSetComponentState(void)
{
MSIHANDLE package;
char path[MAX_PATH];
UINT r;
CoInitialize(NULL);
lstrcpy(path, CURR_DIR);
lstrcat(path, "\\");
lstrcat(path, msifile);
r = MsiOpenPackage(path, &package);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiDoAction(package, "CostInitialize");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiDoAction(package, "FileCost");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiDoAction(package, "CostFinalize");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiSetComponentState(package, "dangler", INSTALLSTATE_SOURCE);
todo_wine
{
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
}
MsiCloseHandle(package);
CoUninitialize();
}
开发者ID:howard5888,项目名称:wineT,代码行数:33,代码来源:install.c
示例12: test_MsiRecordGetString
static void test_MsiRecordGetString(void)
{
MSIHANDLE rec;
CHAR buf[MAX_PATH];
DWORD sz;
UINT r;
rec = MsiCreateRecord(2);
ok(rec != 0, "Expected a valid handle\n");
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 1, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
sz = MAX_PATH;
lstrcpyA(buf, "apple");
r = MsiRecordGetString(rec, 10, buf, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(buf, ""), "Expected \"\", got \"%s\"\n", buf);
ok(sz == 0, "Expected 0, got %d\n", sz);
MsiCloseHandle(rec);
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:26,代码来源:record.c
示例13: MsiCloseHandle
Record::~Record()
{
if ( _handle != 0 )
{
MsiCloseHandle( _handle ) ;
}
}
开发者ID:chriswijones,项目名称:adblockplusie,代码行数:7,代码来源:record.cpp
示例14: getMsiProductCode
String getMsiProductCode() {
String productGuid = kEmptyString;
// Copy msi file from resources to the temp folder
prepareMsiData(kEnglishLocalId);
MSIHANDLE msiHandle;
String path = getTmpPath() + kMsiFileName;
// Open msi file
UINT result = MsiOpenPackageEx(path.c_str(),
MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE, &msiHandle);
if (result != ERROR_SUCCESS) {
return productGuid;
}
// Get Product code property string length
DWORD length = 0;
result = MsiGetProperty(msiHandle, _T("ProductCode"), _T(""), &length);
if (ERROR_MORE_DATA != result) {
return productGuid;
}
// Get Product code property
// increment length for termination character
Char* productCode = new Char[++length];
MsiGetProperty(msiHandle, _T("ProductCode"), productCode, &length);
productGuid = productCode;
delete[] productCode;
// Delete msi file from temp folder, close handles
MsiCloseHandle(msiHandle);
DeleteFile(path.c_str());
return productGuid;
}
开发者ID:Inzaghi2012,项目名称:ie-toolbar,代码行数:33,代码来源:MsiUtils.cpp
示例15: msiPack
msiPack(std::wstring file) : hProduct(NULL),m_msiFile(file) {
MsiOpenPackage(m_msiFile.c_str(),&hProduct);
DWORD sz = sizeof(prodCode);
MsiGetProductProperty(hProduct,L"ProductCode",prodCode,&sz);
MsiCloseHandle(hProduct);
hProduct = NULL;
}
开发者ID:tixsys,项目名称:esteid,代码行数:7,代码来源:InstallChecker.cpp
示例16: test_MsiRecordGetInteger
static void test_MsiRecordGetInteger(void)
{
MSIHANDLE rec;
INT val;
UINT r;
rec = MsiCreateRecord(1);
ok(rec != 0, "Expected a valid handle\n");
r = MsiRecordSetString(rec, 1, "5");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == 5, "Expected 5, got %d\n", val);
r = MsiRecordSetString(rec, 1, "-5");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == -5, "Expected -5, got %d\n", val);
r = MsiRecordSetString(rec, 1, "5apple");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
val = MsiRecordGetInteger(rec, 1);
ok(val == MSI_NULL_INTEGER, "Expected MSI_NULL_INTEGER, got %d\n", val);
MsiCloseHandle(rec);
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:29,代码来源:record.c
示例17: create_database
static void create_database( const char *filename, const struct msi_table *tables, UINT num_tables )
{
MSIHANDLE hdb;
UINT r, i;
r = MsiOpenDatabaseA( filename, MSIDBOPEN_CREATE, &hdb );
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
/* import the tables into the database */
for (i = 0; i < num_tables; i++)
{
const struct msi_table *table = &tables[i];
write_file( table->filename, table->data, (table->size - 1) * sizeof(char) );
r = MsiDatabaseImportA( hdb, CURR_DIR, table->filename );
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
DeleteFileA( table->filename );
}
r = MsiDatabaseCommit( hdb );
ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle( hdb );
set_suminfo( filename );
}
开发者ID:pstrealer,项目名称:wine,代码行数:27,代码来源:patch.c
示例18: write_msi_summary_info
static void write_msi_summary_info(MSIHANDLE db)
{
MSIHANDLE summary;
UINT r;
r = MsiGetSummaryInformationA(db, NULL, 4, &summary);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, ";1033");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL,
"{004757CA-5092-49c2-AD20-28E1CE0DF5F2}");
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, 100, NULL, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
r = MsiSummaryInfoSetPropertyA(summary, PID_WORDCOUNT, VT_I4, 0, NULL, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
/* write the summary changes back to the stream */
r = MsiSummaryInfoPersist(summary);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
MsiCloseHandle(summary);
}
开发者ID:howard5888,项目名称:wineT,代码行数:27,代码来源:install.c
示例19: AbortMsiImmediate
/* Abort the installation (called as an immediate custom action) */
MSIDLLEXPORT AbortMsiImmediate( MSIHANDLE hInstall ) {
DWORD rv;
DWORD dwSize = 0;
LPTSTR sReason = NULL;
LPTSTR sFormatted = NULL;
MSIHANDLE hRecord = NULL;
LPTSTR cAbortReason = _T("ABORTREASON");
rv = MsiGetProperty( hInstall, cAbortReason, _T(""), &dwSize );
if(rv != ERROR_MORE_DATA) goto _cleanup;
sReason = new TCHAR[ ++dwSize ];
rv = MsiGetProperty( hInstall, cAbortReason, sReason, &dwSize );
if(rv != ERROR_SUCCESS) goto _cleanup;
hRecord = MsiCreateRecord(3);
MsiRecordClearData(hRecord);
MsiRecordSetString(hRecord, 0, sReason);
dwSize = 0;
rv = MsiFormatRecord(hInstall, hRecord, "", &dwSize);
if(rv != ERROR_MORE_DATA) goto _cleanup;
sFormatted = new TCHAR[ ++dwSize ];
rv = MsiFormatRecord(hInstall, hRecord, sFormatted, &dwSize);
if(rv != ERROR_SUCCESS) goto _cleanup;
MsiCloseHandle(hRecord);
hRecord = MsiCreateRecord(3);
MsiRecordClearData(hRecord);
MsiRecordSetInteger(hRecord, 1, ERR_ABORT);
MsiRecordSetString(hRecord,2, sFormatted);
MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecord);
_cleanup:
if(sFormatted) delete[] sFormatted;
if(hRecord) MsiCloseHandle( hRecord );
if(sReason) delete[] sReason;
return ~ERROR_SUCCESS;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:48,代码来源:afscustom.cpp
示例20: msidbImportStreams
static BOOL msidbImportStreams(LPCWSTR dbfile, LPCWSTR wdir, LPWSTR streamNames[])
{
UINT r, len;
MSIHANDLE dbhandle, view, rec;
int i = 0;
WCHAR *streamPath = 0;
char *query = "INSERT INTO _Streams (Name, Data) VALUES(?, ?)";
r = MsiOpenDatabaseW(dbfile, (LPWSTR) MSIDBOPEN_TRANSACT, &dbhandle);
if (r != ERROR_SUCCESS) return FALSE;
r = MsiDatabaseOpenView(dbhandle, query, &view);
if (r != ERROR_SUCCESS) return FALSE;
for (i = 0; i < MAX_STREAMS && streamNames[i] != NULL; i++)
{
len = lstrlenW(wdir) + lstrlenW(streamNames[i]) + 2;
streamPath = malloc(len * sizeof(WCHAR));
if (streamPath == NULL) return FALSE;
lstrcpyW(streamPath, wdir);
lstrcatW(streamPath, PATH_DELIMITERW);
lstrcatW(streamPath, streamNames[i]);
rec = MsiCreateRecord(2);
MsiRecordSetStringW(rec, 1, streamNames[i]);
r = MsiRecordSetStreamW(rec, 2, streamPath);
if (r != ERROR_SUCCESS)
{
return FALSE;
}
r = MsiViewExecute(view, rec);
if (r != ERROR_SUCCESS)
{
return FALSE;
}
MsiCloseHandle(rec);
}
MsiViewClose(view);
MsiCloseHandle(view);
MsiDatabaseCommit(dbhandle);
MsiCloseHandle(dbhandle);
return TRUE;
}
开发者ID:CaoMomo,项目名称:core,代码行数:47,代码来源:msidb.c
注:本文中的MsiCloseHandle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论