static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATURE *sig) { static const WCHAR query[] = { 's','e','l','e','c','t',' ','*',' ', 'f','r','o','m',' ', 'D','r','L','o','c','a','t','o','r',' ', 'w','h','e','r','e',' ', 'S','i','g','n','a','t','u','r','e','_',' ','=',' ', '\'','%','s','\'',0}; LPWSTR parent = NULL; LPCWSTR parentName; WCHAR path[MAX_PATH]; WCHAR expanded[MAX_PATH]; MSIRECORD *row; int depth; DWORD sz, attr; UINT rc; TRACE("%s\n", debugstr_w(sig->Name)); *appValue = NULL; row = MSI_QueryGetRecord( package->db, query, sig->Name ); if (!row) { TRACE("failed to query DrLocator for %s\n", debugstr_w(sig->Name)); return ERROR_SUCCESS; } /* check whether parent is set */ parentName = MSI_RecordGetString(row, 2); if (parentName) { MSISIGNATURE parentSig; rc = ACTION_AppSearchSigName(package, parentName, &parentSig, &parent); ACTION_FreeSignature(&parentSig); if (!parent) { msiobj_release(&row->hdr); return ERROR_SUCCESS; } } sz = MAX_PATH; MSI_RecordGetStringW(row, 3, path, &sz); if (MSI_RecordIsNull(row,4)) depth = 0; else depth = MSI_RecordGetInteger(row,4); if (sz) ACTION_ExpandAnyPath(package, path, expanded, MAX_PATH); else strcpyW(expanded, path); if (parent) { attr = GetFileAttributesW(parent); if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY)) { PathRemoveFileSpecW(parent); PathAddBackslashW(parent); } strcpyW(path, parent); strcatW(path, expanded); } else if (sz) strcpyW(path, expanded); PathAddBackslashW(path); rc = ACTION_SearchDirectory(package, sig, path, depth, appValue); msi_free(parent); msiobj_release(&row->hdr); TRACE("returning %d\n", rc); return rc; }
static UINT ACTION_AppSearchDr(MSIPACKAGE *package, LPWSTR *appValue, MSISIGNATURE *sig) { static const WCHAR query[] = { 's','e','l','e','c','t',' ','*',' ', 'f','r','o','m',' ', 'D','r','L','o','c','a','t','o','r',' ', 'w','h','e','r','e',' ', 'S','i','g','n','a','t','u','r','e','_',' ','=',' ', '\'','%','s','\'',0}; LPWSTR parentName = NULL, path = NULL, parent = NULL; WCHAR expanded[MAX_PATH]; MSIRECORD *row; int depth; UINT rc; TRACE("%s\n", debugstr_w(sig->Name)); msi_free(sig->File); sig->File = NULL; *appValue = NULL; row = MSI_QueryGetRecord( package->db, query, sig->Name ); if (!row) { TRACE("failed to query DrLocator for %s\n", debugstr_w(sig->Name)); return ERROR_SUCCESS; } /* check whether parent is set */ parentName = msi_dup_record_field(row,2); if (parentName) { MSISIGNATURE parentSig; rc = ACTION_AppSearchSigName(package, parentName, &parentSig, &parent); ACTION_FreeSignature(&parentSig); msi_free(parentName); } /* now look for path */ path = msi_dup_record_field(row,3); if (MSI_RecordIsNull(row,4)) depth = 0; else depth = MSI_RecordGetInteger(row,4); ACTION_ExpandAnyPath(package, path, expanded, MAX_PATH); msi_free(path); if (parent) { path = msi_alloc((strlenW(parent) + strlenW(expanded) + 1) * sizeof(WCHAR)); if (!path) { rc = ERROR_OUTOFMEMORY; goto end; } strcpyW(path, parent); strcatW(path, expanded); } else path = expanded; rc = ACTION_SearchDirectory(package, sig, path, depth, appValue); end: if (path != expanded) msi_free(path); msi_free(parent); msiobj_release(&row->hdr); TRACE("returning %d\n", rc); return rc; }