From 4742dfba9898844d7e4cfa143477d921f27a9432 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Thu, 11 Feb 2010 13:12:55 +0100 Subject: [PATCH] msi: The File_Setup field in the ODBCDriver and ODBCTranslator tables is optional. --- dlls/msi/action.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 76910f366d8..f9d4965f416 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -4893,15 +4893,17 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) driver_file = msi_find_file(package, MSI_RecordGetString(rec, 4)); setup_file = msi_find_file(package, MSI_RecordGetString(rec, 5)); - if (!driver_file || !setup_file) + if (!driver_file) { ERR("ODBC Driver entry not found!\n"); return ERROR_FUNCTION_FAILED; } - len = lstrlenW(desc) + lstrlenW(driver_fmt) + lstrlenW(driver_file->FileName) + - lstrlenW(setup_fmt) + lstrlenW(setup_file->FileName) + - lstrlenW(usage_fmt) + 1; + len = lstrlenW(desc) + lstrlenW(driver_fmt) + lstrlenW(driver_file->FileName); + if (setup_file) + len += lstrlenW(setup_fmt) + lstrlenW(setup_file->FileName); + len += lstrlenW(usage_fmt) + 1; + driver = msi_alloc(len * sizeof(WCHAR)); if (!driver) return ERROR_OUTOFMEMORY; @@ -4913,8 +4915,11 @@ static UINT ITERATE_InstallODBCDriver( MSIRECORD *rec, LPVOID param ) sprintfW(ptr, driver_fmt, driver_file->FileName); ptr += lstrlenW(ptr) + 1; - sprintfW(ptr, setup_fmt, setup_file->FileName); - ptr += lstrlenW(ptr) + 1; + if (setup_file) + { + sprintfW(ptr, setup_fmt, setup_file->FileName); + ptr += lstrlenW(ptr) + 1; + } lstrcpyW(ptr, usage_fmt); ptr += lstrlenW(ptr) + 1; @@ -4957,14 +4962,16 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) translator_file = msi_find_file(package, MSI_RecordGetString(rec, 4)); setup_file = msi_find_file(package, MSI_RecordGetString(rec, 5)); - if (!translator_file || !setup_file) + if (!translator_file) { ERR("ODBC Translator entry not found!\n"); return ERROR_FUNCTION_FAILED; } - len = lstrlenW(desc) + lstrlenW(translator_fmt) + lstrlenW(translator_file->FileName) + - lstrlenW(setup_fmt) + lstrlenW(setup_file->FileName) + 1; + len = lstrlenW(desc) + lstrlenW(translator_fmt) + lstrlenW(translator_file->FileName) + 1; + if (setup_file) + len += lstrlenW(setup_fmt) + lstrlenW(setup_file->FileName); + translator = msi_alloc(len * sizeof(WCHAR)); if (!translator) return ERROR_OUTOFMEMORY; @@ -4976,8 +4983,11 @@ static UINT ITERATE_InstallODBCTranslator( MSIRECORD *rec, LPVOID param ) sprintfW(ptr, translator_fmt, translator_file->FileName); ptr += lstrlenW(ptr) + 1; - sprintfW(ptr, setup_fmt, setup_file->FileName); - ptr += lstrlenW(ptr) + 1; + if (setup_file) + { + sprintfW(ptr, setup_fmt, setup_file->FileName); + ptr += lstrlenW(ptr) + 1; + } *ptr = '\0'; translator_path = strdupW(translator_file->TargetPath); -- 2.11.4.GIT