export prototype Rollback(HWND); function Rollback(hMSI) #include "Ifx.h" STRING backup_dir, svValue, filetype, svRegKey, svbackup_path, file, svResult, other; NUMBER nvType, nvSize, nvResult, find; begin RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); RegDBGetKeyValueEx("SOFTWARE\\DecisionMetrics\\Backups", IFX_PRODUCT_VERSION, nvType, svValue, nvSize); MessageBox("Information is " + IFX_PRODUCT_VERSION + svValue, INFORMATION); //Set the backed up files as svbackup_path svbackup_path = INSTALLDIR ^ "Backups" ^ IFX_PRODUCT_VERSION; //Display the path of backed up files MessageBox ("svbackup_Path is" + svbackup_path, INFORMATION); //Find all the files in the backup path find = FindAllFiles (svbackup_path, "*.*", file, RESET); while(find = 0) //Get the files attributes, read only ect GetFileInfo( file, FILE_ATTRIBUTE, nvResult, svResult ); //If the file attributes are read-only or archived, change to normal if( nvResult & FILE_ATTR_READONLY ) then if( SetFileInfo( file, FILE_ATTRIBUTE, FILE_ATTR_NORMAL, "" ) <0 ) then MessageBox ("can't change the file", SEVERE); else MessageBox ("file attribute changed",INFORMATION); if (SetFileInfo (svbackup_path, FILE_ATTRIBUTE, FILE_ATTR_ARCHIVED, "") <0) then MessageBox ("can't change the file", SEVERE); else MessageBox ("file attribute changed",INFORMATION); endif; endif; endif; find = FindAllFiles( svbackup_path, "*.*", file, CONTINUE ); endwhile; //copy the files from the backup location to the installdir MessageBox ("installdir is" + INSTALLDIR, SEVERE); other = "C:\\test\\"; filetype = "*.*"; // Copy all text files in the source directory // into the target directory. if (XCopyFile (svbackup_path ^ filetype, INSTALLDIR ^ "*.*", INCLUDE_SUBDIR) < 0) then MessageBox ("Rollback failed", SEVERE); else MessageBox ("Rollback successfully completed.", INFORMATION); endif; ChangeDirectory("C:\\"); if (DeleteDir (svbackup_path, ALLCONTENTS) = 0) then MessageBox (svbackup_path + "deleted", INFORMATION); else MessageBox ("Cant delete " + svbackup_path, SEVERE); endif; svRegKey = "SOFTWARE\\DecisionMetrics\\Backups"; RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE); RegDBDeleteValue (svRegKey, IFX_PRODUCT_VERSION); end;