Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Neuer Eintrag in eine MSI Table

Empfohlene Antworten

Veröffentlicht

Hallo Leutz,

ich versuche in ein bestehendes MSI Paket und in einer bestehenden Table, einen neuen Eintrag einzufügen. Leider bekomme ich immer wieder den Fehler 1627

(ERROR_FUNCTION_FAILED 1627L // Function failed during execution.) bei der Methode MsiViewModify. Warum? Was habe ich vergessen oder was mach ich falsch?

//-----------------------------------------

HRESULT hr = CoInitializeEx( NULL, 0 );

UINT result;

LPCTSTR szPackagePath = _T("D:\\Pakete\\Adobe Reader 6.0 Deutsch\\Adobe Reader 6.0 Deutsch neu\\Adobe Reader 6.0 - Deutsch.msi");

PMSIHANDLE hDatabase = 0;

PMSIHANDLE hRecord = 0;

PMSIHANDLE hView = 0;

if (ERROR_SUCCESS == MsiOpenDatabase(szPackagePath, MSIDBOPEN_TRANSACT, &hDatabase))

{

LPCSTR szSQL = _T("INSERT INTO `Registry` (`Registry`,`Root`,`Key`,`Name`,`Value`,`Component_`) VALUES (?,?,?,?,?,?)");

result = MsiDatabaseOpenView(hDatabase, szSQL,&hView);

if(result == ERROR_BAD_QUERY_SYNTAX){AfxMessageBox(_T("****** SQL!!!"));}

if(result == ERROR_INVALID_HANDLE){AfxMessageBox(_T("Zugriff auf Installer verweigert!!!"));}

if(result == ERROR_SUCCESS)

{

hRecord = MsiCreateRecord(6);

if(hRecord)

{

result = MsiRecordSetString(hRecord, 1, _T("Test1"));

result = MsiRecordSetString(hRecord, 2, _T("Test2"));

result = MsiRecordSetInteger(hRecord, 3, 3);

result = MsiRecordSetString(hRecord, 4, _T("Test4"));

result = MsiRecordSetString(hRecord, 5, _T("Test5"));

result = MsiRecordSetString(hRecord, 6, _T("Test6"));

if(!result)

result = MsiViewModify(hView,MSIMODIFY_INSERT, hRecord);

if(!result)

result = MsiViewClose(hView);

if(!result)

result = MsiDatabaseCommit(hDatabase);

}

}

}

if (hRecord)

result = MsiCloseHandle(hRecord);

if (hDatabase)

result = MsiCloseHandle(hDatabase);

CoUninitialize();

//-----------------------------------------

Ok habs alles stimmt, habe einen kleinen Dreher in der Zeile

LPCSTR szSQL = _T("INSERT INTO `Registry` (`Registry`,`Root`,`Key`,`Name`,`Value`,`Component

_`) VALUES (?,?,?,?,?,?)");

...

//falsch

result = MsiRecordSetString(hRecord, 1, _T("Test1"));

result = MsiRecordSetString(hRecord, 2, _T("Test2"));

result = MsiRecordSetInteger(hRecord, 3, 3);

...

...

//richtig

result = MsiRecordSetString(hRecord, 1, _T("Test1"));

result = MsiRecordSetInteger(hRecord, 2, 3);

result = MsiRecordSetString(hRecord, 3, _T("Test2"));

...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.