Ejemplo n.º 1
0
bool CFYSPrintDoc::CreateSendFile()
{
	CString strSendFile = m_strFYSTempPath + FORYOURSOUL_TXT;
	FILE* output = NULL;
	errno_t err = fopen_s(&output, strSendFile, "wb");
	if (!output || err != 0)
	{
		SetError(String("Failed to open %s.", strSendFile));
		return false;
	}
	
	DWORD dwchkSum = 0;
	CString strSep("\\");
	CString strInputFile;
	CString strMiniHdr;

	// mini header for StreamHeader
	CString strPath = m_strFYSTempPath + XML_PATH + strSep;
	strInputFile = strPath + STREAMHDR_XML;
	int nSize = FileSize(strInputFile);
	CCRC32::FileCrc32Assembly(strInputFile, dwchkSum);
	strMiniHdr.Format("[%ld,%X]", nSize, dwchkSum);
	fwrite((VOID*)(LPCSTR)strMiniHdr, sizeof(char), strMiniHdr.GetLength(), output);

	// stream Header
	if (!CopyFiles(strInputFile, output))
		return false;

	// create and print xml
	strInputFile = strPath + CREATEPRINT_XML;
	if (!CopyFiles(strInputFile, output))
		return false;

	// resources
	for (int i=0; i<m_arFileSpecs.m_nSize; i++)
	{
		if (m_arFileSpecs[i]->Type == "Image")
			strInputFile = m_strFYSTempPath + IMAGES_PATH + strSep;

		if (m_arFileSpecs[i]->Type == "Font")
			strInputFile = m_strFYSTempPath + FONTS_PATH + strSep;

		strInputFile += m_arFileSpecs[i]->FileName;
		if (!CopyFiles(strInputFile, output))
			return false;
	}
	fclose(output);

	return true;
}
Ejemplo n.º 2
0
void ModEditWindow::CoreModListCtrl::PasteMod()
{
	wxFileDataObject data;

	// Get data from the clipboard.
	if (wxTheClipboard->Open())
	{
		if (wxTheClipboard->IsSupported(wxDF_FILENAME))
		{
			wxTheClipboard->GetData(data);
		}
		else
		{
			wxTheClipboard->Close();
			return;
		}
		wxTheClipboard->Close();
	}
	// Add the given mods.
	wxArrayString filenames = data.GetFilenames();
	CopyFiles(filenames,m_inst->GetCoreModsDir().GetFullPath());
	//FIXME: this looks like lazy code. it can be done better.
	auto mllist = m_inst->GetCoreModList();
	mllist->UpdateModList();
	UpdateItems();
}
Ejemplo n.º 3
0
void bearlib::CopyFiles( const boost::filesystem::path& from, const boost::filesystem::path& to )
{
	++g_iHierarchy;

	if( !boost::filesystem::exists(to) )
	{
		boost::filesystem::create_directories( to );
	}    

	boost::filesystem::directory_iterator end;

	for( boost::filesystem::directory_iterator it(from); it != end; ++it )
	{
		boost::filesystem::path newFrom = from;		
		newFrom /= it->path().filename();	
		boost::filesystem::path newTo = to;
		newTo /= it->path().filename();	

		if( boost::filesystem::is_directory( newFrom ) )
		{
			AppendSpace();
		//	cout<<"Copy Directory [" << newFrom.filename() <<"] to ["<< newTo.filename() <<"]" << endl;
			CopyFiles( newFrom, newTo );
		}
		else if( boost::filesystem::is_regular( newFrom ) )
		{
			AppendSpace();
		//	cout<<"Copy File ["<< newFrom.filename() <<"] to ["<< newTo.filename() << "]" << endl;
			boost::filesystem::copy_file( newFrom, newTo, boost::filesystem::copy_option::overwrite_if_exists );
		}
	}

	--g_iHierarchy;
}
Ejemplo n.º 4
0
/**
Test case for DEF087773: ECOM ValidateRegistry checks for existence of RSC file only

@SYMTestCaseID			SYSLIB-ECOM-CT-0655
@SYMTestCaseDesc		Checks for existence of resource files for different downgrade paths
@SYMTestPriority			high
@SYMTestActions			Data driven tests.
						Create different sets of language dependant resource file on "C"
						Drive and verify the ECom discovery process
@SYMTestExpectedResults The test must not fail.
@SYMDEF					DEF087773
*/
void REComLanguagePluginTest::StaticRunTestsL()
	{
	TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0655 "));
	TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry);

	TUid ifUid={0x10009DB9};
	for(TInt i = 0; i < numberOfElements; i++)
		{
		// kill ecom server so that language downgrade changes are picked up
		ECOMTU_KILL_SERVER_L(TEST);

		// Prepare test
        #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
		SetLanguage(*(LangTestData[i].localeFile), LangTestData[i].downgradePathSetup);
        #else
		SetLanguage(*(LangTestData[i].lang),*(LangTestData[i].region),*(LangTestData[i].collation),LangTestData[i].downgradePathSetup);
        #endif
		
		CopyFiles(i);

		// 1st boot
		TEST.Printf(_L("\tLanguage Plugin Test %d - 1st boot \n"), i);
		DoCheckL(i,ifUid, EDriveC );

		// kill ecom server for second boot
		ECOMTU_KILL_SERVER_L(TEST);

		// 2nd boot
		TEST.Printf(_L("\tLanguage Plugin Test %d - 2nd boot \n"), i);
		DoCheckL(i, ifUid, EDriveC);

		DeleteFiles(i);
		WAIT_FOR3s;
		}
	}
static void M_Win_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT CodeNotify)
{
   switch(id)
   {  case IDC_COPY:     CopyFiles();                        //Выполнение копирования
                         break;
      case IDC_CLEAR:    ClearSelect();                      //Снятие всех выделений
                         break;
      case IDC_CONFIG:   NewConfig();                        //Изменение конфигурации
                         break;
      case IDCANCEL:     SendMessage(hwnd, WM_DESTROY, 0, 0);//Завершение программы и закрытие окон
                         break;
      case IDC_SIZE_HDD: View_Map_HDD();                     //Карта занятости HDD
                         break;
      case IDC_ABOUT:    About();                            //Вывод информации
                         break;
      case IDC_TO_TXT:   OutTxt();                           //Запись дерева в текстовый файл
                         break;
#if defined WRITE_YES                                        //Режим записи разрешен
      case IDC_WRITE_FI: WriteFileToHDD(0);  break;          //Запись файлов на диск
      case IDC_WRITE_FO: WriteFileToHDD(1);  break;          //Запись файлов на диск
      case IDC_NEW_FO:   WriteFileToHDD(2);  break;          //Запись файлов на диск
      case IDC_REN_FI:   WriteFileToHDD(3);  break;          //Переименование
      case IDC_DEL_FI:   WriteFileToHDD(4);  break;          //Удаление
      case IDC_CORR67:   Correct67Sec();     break;          //Коррекция содержимого 67 сектора
#endif
   }
}
Ejemplo n.º 6
0
BOOL CDiskObject::CopyDirectories( const CString& sourceDirectory,const CString& destDirectory )
/* ============================================================
	Function :		CDiskObject::CopyDirectories
	Description :	Copies all the files and subdirectories 
					from "sourceDirectory" to "destDirectory", 
					keeping the directory structure. Existing 
					files will be overwritten. "destDirectory" 
					and subdirectories will be created if 
					necessary.
	Access :		Public

					
	Return :		BOOL					-	"TRUE" if OK. 
												"GetErrorMessage" 
												will get an 
												error string 
												if "FALSE"
	Parameters :	CString sourceDirectory	-	copy from.
					CString destDirectory	-	copy to.

	Usage :			Call to copy a directory tree to a new 
					directory tree.

   ============================================================*/
{
	ClearError( );

	CString source( sourceDirectory );
	CString dest( destDirectory );
	QualifyPath( source );
	QualifyPath( dest );

	// Enumerate all directories and files below sourceDirectory
	CStringArray directories;
	directories.Add( source );

	BOOL result = EnumAllDirectories( source, directories );
	if( result )
	{
		// Create and copy directories
		INT_PTR max = directories.GetSize( );
		for( INT_PTR t = 0 ; t < max ; t++ )
		{
			// Create names and copy
			CString from = directories[ t ];
			CString part = from.Right( from.GetLength( ) - source.GetLength( ) );
			CString to = dest + part;

			if( !( result = CopyFiles( from, to ) ) )
				t = max;
		}
	}

	return result;
}
Ejemplo n.º 7
0
void Explorerplusplus::OnTreeViewCopy(BOOL bCopy)
{
	IDataObject		*pClipboardDataObject = NULL;
	HTREEITEM		hItem;
	TVITEM			tvItem;
	HRESULT			hr;

	hItem = TreeView_GetSelection(m_hTreeView);

	if(hItem != NULL)
	{
		LPITEMIDLIST pidl = m_pMyTreeView->BuildPath(hItem);

		std::list<std::wstring> FileNameList;
		TCHAR szFullFileName[MAX_PATH];

		GetDisplayName(pidl,szFullFileName,SIZEOF_ARRAY(szFullFileName),SHGDN_FORPARSING);

		std::wstring stringFileName(szFullFileName);
		FileNameList.push_back(stringFileName);

		if(bCopy)
		{
			hr = CopyFiles(FileNameList,&pClipboardDataObject);
		}
		else
		{
			hr = CutFiles(FileNameList,&pClipboardDataObject);

			if(SUCCEEDED(hr))
			{
				m_hCutTreeViewItem = hItem;
				m_iCutTabInternal = m_iObjectIndex;

				tvItem.mask			= TVIF_HANDLE|TVIF_STATE;
				tvItem.hItem		= hItem;
				tvItem.state		= TVIS_CUT;
				tvItem.stateMask	= TVIS_CUT;
				TreeView_SetItem(m_hTreeView,&tvItem);
			}
		}

		if(SUCCEEDED(hr))
		{
			m_pClipboardDataObject = pClipboardDataObject;
		}

		CoTaskMemFree(pidl);
	}
}
Ejemplo n.º 8
0
void ModEditWindow::OnAddCoreMod(wxCommandEvent &event)
{
	wxFileDialog addTPDialog (this, "Choose a file to add.",
		settings->GetModsDir().GetFullPath(), wxEmptyString,
		wxFileSelectorDefaultWildcardStr,wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_MULTIPLE
	);
	if (addTPDialog.ShowModal() == wxID_OK)
	{
		wxArrayString allfiles;
		addTPDialog.GetPaths(allfiles);
		CopyFiles(allfiles, m_inst->GetCoreModsDir().GetFullPath());
		auto corelist = m_inst->GetCoreModList();
		corelist->UpdateModList();
		coreModList->UpdateItems();
	}
}
Ejemplo n.º 9
0
void SFileWorker::Paste(const SFile *folder)
{
	if(iFileList->CountItems()==0)
		return;

	if(iFileOp==P_OP_CUT)
		MoveFiles(iFileList,folder);
	else
		CopyFiles(iFileList,folder);

	// clear old list
	for (int32 i=0; i < iFileList->CountItems(); i++)
	{
		SFile *file=(SFile *) iFileList->ItemAt(i);
		delete file;
	}
	iFileList->MakeEmpty();
}
Ejemplo n.º 10
0
bool CFYSPrintDoc::WriteCreatePrintXml(LPCSTR strDocFileName, CString& strXmlPath)
{
	CString strCnPXmlFile = strXmlPath + CREATEPRINT_XML;
	FILE* output = NULL;
	errno_t err = fopen_s(&output, strCnPXmlFile, "wb");
	if (!output || err != 0)
	{
		SetError(String("Failed to open %s", strCnPXmlFile));
		return false;
	}

	fprintf(output, "<?xml version='1.0' encoding='ISO-8859-1'?>\r\n");
	fprintf(output, "<!-- Confidential and Proprietory Information of 4YourSoul.com Inc..-->\r\n");
	fprintf(output, "<FYS_DataEnvelope xmlns='http://www.4yoursoul.com/Schema/2003/ClientIntegration/DataInputForPrint' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' ");
	fprintf(output, "EnvelopeVersion='2'>\r\n");

	//write the Configuration element
	HANDLE hHeap = ::GetProcessHeap();
	int nLen = ::HeapSize(hHeap, 0, m_pConfig);
	fwrite(m_pConfig, sizeof(BYTE), nLen, output);

	//write the Resources element
	nLen = ::HeapSize(hHeap, 0, m_pRes);
	fwrite(m_pRes, sizeof(BYTE), nLen, output);

	::HeapFree(hHeap, 0, m_pConfig);
	::HeapFree(hHeap, 0, m_pRes);
	m_pConfig = NULL;
	m_pRes = NULL;

	//write the Documents element
	if (!CopyFiles(strDocFileName, output))
	{
		::DeleteFile(strDocFileName);
		return false;
	}

	fprintf(output, "</FYS_DataEnvelope>\r\n");
	fclose(output);

	::DeleteFile(strDocFileName);

	return true;
}
Ejemplo n.º 11
0
LRESULT CCopyDlg::OnWizardNext() 
{
    if (!CopyFiles()) {
        // select entire directory
        m_TargetEdit.SetSel(0, -1);
        m_TargetEdit.SetFocus();
        // return to this same wizard page
        // (we assume problem is with target dir)
        return -1;
    }

    // need to communicate install dir to later pages
    // use parent Sheet
    CWizardSheet* pSheet = (CWizardSheet*)GetParent();
    // add the DynamoRIO on
    pSheet->m_InstallDir.Format(_T("%s\\DynamoRIO"), m_Target);

    return CPropertyPage::OnWizardNext();
}
Ejemplo n.º 12
0
/**
Test case for CR0209: Enable Dynamic Language Switching in ECOM

@SYMTestCaseID			SYSLIB-ECOM-CT-3169
@SYMTestCaseDesc		Checks for picking up correct resource files for different downgrade paths in running time
@SYMTestPriority		high
@SYMTestActions			Data driven tests.
						Start up Ecom server
						Create different sets of language dependant resource file on "C" on running time.
						Drive and verify the ECom discovery process
@SYMTestExpectedResults The test must not fail.
@SYMDEF					CR0209
*/
void REComLanguagePluginTest::DynamicRunTestsOnCL()
	{
	TEST.Next(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-3169 "));
	TInt numberOfElements = sizeof(LangTestData)/sizeof(TLangTestEntry);

	RImplInfoPtrArray implArray;
	TUid ifUid={0x10009DB9};

	//start up ecom server
	REComSession::ListImplementationsL(ifUid, implArray);

	for(TInt i = 0; i < numberOfElements; i++)
		{

		// Prepare test
		CopyFiles(i);

        #ifndef SYMBIAN_DISTINCT_LOCALE_MODEL
        SetLanguage(*(LangTestData[i].localeFile), LangTestData[i].downgradePathSetup);
        #else
        SetLanguage(*(LangTestData[i].lang),*(LangTestData[i].region),*(LangTestData[i].collation),LangTestData[i].downgradePathSetup);
        #endif
		WAIT_FOR3s;

		TEST.Printf(_L("\tLanguage Plugin Test %d - Dynamic switch on C \n"), i);
		DoCheckL(i,ifUid, EDriveC);

		DeleteFiles(i);
		WAIT_FOR3s;
		implArray.ResetAndDestroy();

		}

	// Post test clean up
	REComSession::FinalClose();
	implArray.ResetAndDestroy();

	//kill ecomserver after finishing test
	ECOMTU_KILL_SERVER_L(TEST);

	}
Ejemplo n.º 13
0
/**************************************************************************
 * function CopyOPMLFromTo
 *
 * written by moonknit
 *
 * @history
 * created 2006-02-22
  *
 * @Description
 * OPML 파일과 XML 파일을 복사한다.
 *
 * @Parameters
 * (in CString) from - 소스가 되는 디렉토리
 * (in CString) to - 대상이 되는 디렉토리
 * (in BOOL) bmove - 파일을 옮긴다.
 **************************************************************************/
BOOL CopyOPMLFromTo(CString from, CString to, BOOL bmove)
{
	// create directory
	CString xmlfrom, xmlto;
	xmlto = to + DEFAULT_POSTPATH;
	makedir(xmlto);

	CFileFind f;
	CString opml, opdest;
	opml.Format(_T("%s%s"), from, S_DEFAULT_LOCALOPML);
	opdest.Format(_T("%s%s"), to, S_DEFAULT_LOCALOPML);
	if(!f.FindFile(opml))
	{
//		AfxMessageBox(STR_ERR_LP_COPYOPML);
        FishMessageBox(STR_ERR_LP_COPYOPML);
		return FALSE;
	}

	if(!bmove)
	{
		if(!CopyFile(opml, opdest, FALSE)) return FALSE;
	}
	else
	{
		if(!MoveFile(opml, opdest)) return FALSE;
	}

//	TRACE(_T("OPML from : %s, to : %s\r\n"), opml, opdest);

	f.Close();

	xmlfrom.Format(_T("%s%s*.xml"), from, DEFAULT_POSTPATH);
	CopyFiles(xmlfrom, xmlto, bmove);

	TRACE(_T("xml from : %s, to : %s\r\n"), xmlfrom, xmlto);

	// XML 파일에 적용한다.
	theApp.m_spRD->IChannelSetPath(xmlto);

	return TRUE;
}
Ejemplo n.º 14
0
BOOL CDiskObject::CopyDirectory( const CString& sourceDirectory,const CString& destDirectory )
/* ============================================================
	Function :		CDiskObject::CopyDirectory
	Description :	Copies all the files from "sourceDirectory" 
					to "destDirectory". Existing files will be
					overwritten. "destDirectory" will be created
					if necessary. Subdirectories will not be
					copied.
	Access :		Public
					
	Return :		BOOL					-	"TRUE" if OK. 
												"GetErrorMessage" 
												will get an error 
												string if "FALSE"
	Parameters :	CString sourceDirectory	-	copy from.
					CString destDirectory	-	copy to.

	Usage :			Call to copy a directory to another 
					directory.

   ============================================================*/
{
	ClearError( );
	CString source( sourceDirectory );
	CString dest( destDirectory );
	QualifyPath( source );
	QualifyPath( dest );

	Trigger( dest );

	// We don't care if this fails - CopyFiles will 
	// return an error in that case.
	::CreateDirectory( dest, NULL );

	return CopyFiles( source, dest );

}
/*
 * User pressed the install button.  Make it go.
 */
void CBINDInstallDlg::OnInstall() {
	BOOL success = FALSE;
	int oldlen;

	if (CheckBINDService())
		StopBINDService();

	InstallTags();

	UpdateData();

	/*
	 * Check that the Passwords entered match.
	 */ 
	if (m_accountPassword != m_accountPasswordConfirm) {
		MsgBox(IDS_ERR_PASSWORD);
		return;
	}

	/*
	 * Check that there is not leading / trailing whitespace.
	 * This is for compatability with the standard password dialog.
	 * Passwords really should be treated as opaque blobs.
	 */
	oldlen = m_accountPassword.GetLength();
	m_accountPassword.TrimLeft();
	m_accountPassword.TrimRight();
	if (m_accountPassword.GetLength() != oldlen) {
		MsgBox(IDS_ERR_WHITESPACE);
		return;
	}
	
	/*
	 * Check the entered account name.
	 */
	if (ValidateServiceAccount() == FALSE)
		return;

	/*
	 * For Registration we need to know if account was changed.
	 */
	if (m_accountName != m_currentAccount)
		m_accountUsed = FALSE;

	if (m_accountUsed == FALSE && m_serviceExists == FALSE)
	{
	/*
	 * Check that the Password is not null.
	 */
		if (m_accountPassword.GetLength() == 0) {
			MsgBox(IDS_ERR_NULLPASSWORD);
			return;
		}
	}

	/* Directories */
	m_etcDir = m_targetDir + "\\etc";
	m_binDir = m_targetDir + "\\bin";

	if (m_defaultDir != m_targetDir) {
		if (GetFileAttributes(m_targetDir) != 0xFFFFFFFF)
		{
			int install = MsgBox(IDS_DIREXIST,
					MB_YESNO | MB_ICONQUESTION, m_targetDir);
			if (install == IDNO)
				return;
		}
		else {
			int createDir = MsgBox(IDS_CREATEDIR,
					MB_YESNO | MB_ICONQUESTION, m_targetDir);
			if (createDir == IDNO)
				return;
		}
	}

	if (m_accountExists == FALSE) {
		success = CreateServiceAccount(m_accountName.GetBuffer(30),
						m_accountPassword.GetBuffer(30));
		if (success == FALSE) {
			MsgBox(IDS_CREATEACCOUNT_FAILED);
			return;
		}
		m_accountExists = TRUE;
	}

	ProgramGroup(FALSE);

	try {
		CreateDirs();
 		CopyFiles();
		RegisterService();
		RegisterMessages();

		HKEY hKey;

		/* Create a new key for named */
		SetCurrent(IDS_CREATE_KEY);
		if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_SUBKEY,
			&hKey) == ERROR_SUCCESS) {
			// Get the install directory
			RegSetValueEx(hKey, "InstallDir", 0, REG_SZ,
					(LPBYTE)(LPCTSTR)m_targetDir,
					m_targetDir.GetLength());
			RegCloseKey(hKey);
		}

		
		SetCurrent(IDS_ADD_REMOVE);
		if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY,
				 &hKey) == ERROR_SUCCESS) {
			CString buf(BIND_DISPLAY_NAME);

			RegSetValueEx(hKey, "DisplayName", 0, REG_SZ,
					(LPBYTE)(LPCTSTR)buf, buf.GetLength());

			buf.Format("%s\\BINDInstall.exe", m_binDir);
			RegSetValueEx(hKey, "UninstallString", 0, REG_SZ,
					(LPBYTE)(LPCTSTR)buf, buf.GetLength());
			RegCloseKey(hKey);
		}
	
		ProgramGroup(FALSE);
		
		if (m_startOnInstall)
			StartBINDService();
	}
	catch(Exception e) {
		MessageBox(e.resString);
		SetCurrent(IDS_CLEANUP);
		FailedInstall();
		MsgBox(IDS_FAIL);
		return;
	}
	catch(DWORD dw)	{
		CString msg;
		msg.Format("A fatal error occured\n(%s)", GetErrMessage(dw));
		MessageBox(msg);
		SetCurrent(IDS_CLEANUP);
		FailedInstall();
		MsgBox(IDS_FAIL);
		return;
	}

	SetCurrent(IDS_INSTALL_DONE);
	MsgBox(IDS_SUCCESS);
}
Ejemplo n.º 16
0
/**************************************************************************************************
	This function handles events.
**************************************************************************************************/
void CGroup::HandleEvent(UINT uEvent)
{
	if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_NONE) == 0)
	{
		return;
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_RENAME) == 0)
	{
		ListView_EditLabel(m_hwndListView, ListView_GetNextItem(m_hwndListView, -1, LVNI_FOCUSED));
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_EXECUTE) == 0)
	{
		if (ListView_GetSelectedCount(m_hwndListView) == 1)
		{
			int iItem = ListView_GetNextItem(m_hwndListView, -1, LVNI_SELECTED);
			char szFileName[MAX_PATH];
			if (GetNameFromId(iItem, szFileName, sizeof(szFileName)))
			{
				if (utils::Is_Directory(szFileName))
				{
					if (m_bInlineBrowsing)
					{
						return ChangeDir(".selected");
					}
					else if (m_bExplicitCalls)
					{
						LSExecuteEx(NULL, "open", "explorer.exe", szFileName, NULL, SW_SHOWNORMAL);
						return;
					}
				}
			}
		}
		CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_RETURN, NULL);
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_DELETE) == 0)
	{
		DeleteFiles();
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_PASTE) == 0)
	{
		DoPaste();
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_UNDO) == 0)
	{
		// TODO::Add support for this
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_COPY) == 0)
	{
		CopyFiles(false);
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_CUT) == 0)
	{
		CopyFiles(true);
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_SELECTALL) == 0)
	{
		ListView_SetItemState(m_hwndListView, -1, LVIS_SELECTED, LVIS_SELECTED);
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_REFRESH) == 0)
	{
		SaveState();
		m_pView2->Refresh();
		RestoreState();
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_UP) == 0)
	{
		ChangeDir(".up");
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_CHANGEDIR) == 0)
	{
		ChangeDir(".selected");
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_DOWNKEY) == 0)
	{
		CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_DOWN, NULL);
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_UPKEY) == 0)
	{
		CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_UP, NULL);
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_LEFTKEY) == 0)
	{
		CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_LEFT, NULL);
	}
	else if (_stricmp(m_szEventCommand[uEvent], EVENT_ACTION_RIGHTKEY) == 0)
	{
		CallWindowProc(m_wpOrigListViewProc, m_hwndListView, WM_KEYDOWN, VK_RIGHT, NULL);
	}
	else
	{
		LSExecute(m_hwndListView, m_szEventCommand[uEvent], SW_SHOWNORMAL);
	}
}
Ejemplo n.º 17
0
bool DialogInstall::InstallPackage()
{
	if ((!m_MergeSkins && m_BackupSkins) || m_BackupPackage)
	{
		// Move skins into backup folder
		for (auto iter = m_PackageSkins.cbegin(); iter != m_PackageSkins.cend(); ++iter)
		{
			std::wstring from = g_Data.skinsPath + *iter;
			if (_waccess(from.c_str(), 0) == -1)
			{
				continue;
			}

			SHFILEOPSTRUCT fo =
			{
				nullptr,
				FO_DELETE,
				nullptr,
				nullptr,
				FOF_NO_UI | FOF_NOCONFIRMATION | FOF_ALLOWUNDO
			};

			if (m_BackupPackage)
			{
				// Remove current skin
				from += L'\0';
				fo.pFrom = from.c_str();
				SHFileOperation(&fo);
			}
			else
			{
				std::wstring to = g_Data.skinsPath + L"@Backup\\";
				CreateDirectory(to.c_str(), nullptr);

				// Delete current backup
				to += *iter;
				to += L'\0';
				fo.pFrom = to.c_str();
				SHFileOperation(&fo);

				if (!CopyFiles(from, to, true))
				{
					m_ErrorMessage = L"Unable to move to:\n";
					m_ErrorMessage += to;
					return false;
				}
			}
		}
	}

	WCHAR buffer[MAX_PATH];

	// Helper to sets buffer with current file name
	auto getFileInfo = [&]()->bool
	{
		char cBuffer[MAX_PATH * 3];
		unz_file_info ufi;
		if (unzGetCurrentFileInfo(
				m_PackageUnzFile, &ufi, cBuffer, _countof(cBuffer), nullptr, 0, nullptr, 0) == UNZ_OK)
		{
			const uLong ZIP_UTF8_FLAG = 1 << 11;
			const DWORD codePage = (ufi.flag & ZIP_UTF8_FLAG) ? CP_UTF8 : CP_ACP;
			MultiByteToWideChar(codePage, 0, cBuffer, strlen(cBuffer) + 1, buffer, MAX_PATH);
			while (WCHAR* pos = wcschr(buffer, L'/')) *pos = L'\\';
			return true;
		}

		return false;
	};

	unzGoToFirstFile(m_PackageUnzFile);
	const WCHAR* root = m_PackageRoot.c_str();
	do
	{
		if (!getFileInfo())
		{
			m_ErrorMessage = L"Error retrieving file info.";
			return false;
		}

		if (wcsncmp(buffer, root, m_PackageRoot.length()) != 0)
		{
			// Ignore everything that isn't in the root directory
			continue;
		}

		WCHAR* component = buffer + m_PackageRoot.length();
		WCHAR* path = wcschr(component, L'\\');
		if (path)
		{
			*path = L'\0';
			++path;
		}
		else
		{
			continue;
		}

		bool error = false;
		std::wstring targetPath;

		WCHAR* pos = wcschr(path, L'\\');
		WCHAR* extension = PathFindExtension(pos ? pos : path);
		if (pos)
		{
			const std::wstring item(path, pos - path);

			if (_wcsicmp(component, L"Skins") == 0 &&
				m_PackageSkins.find(item) != m_PackageSkins.end())
			{
				targetPath = g_Data.skinsPath;
			}
			else if (_wcsicmp(component, L"Addons") == 0 &&
				m_PackageFormat == PackageFormat::Old &&
				m_PackageAddons.find(item) != m_PackageAddons.end())
			{
				targetPath = g_Data.settingsPath;
				targetPath += L"Addons\\";
			}
			else if (_wcsicmp(component, L"Plugins") == 0 &&
				_wcsnicmp(path, IsWin32Build() ? L"32bit" : L"64bit", pos - path) == 0 &&
				_wcsicmp(extension, L".dll") == 0 &&
				!wcschr(pos + 1, L'\\'))
			{
				const std::wstring plugin(pos + 1);
				if (m_PackagePlugins.find(plugin) != m_PackagePlugins.end())
				{
					path = pos + 1;
					targetPath = g_Data.settingsPath;
					targetPath += L"Plugins\\";
				}
			}

			if (!targetPath.empty())
			{
				targetPath += path;
				error = !ExtractCurrentFile(targetPath);
			}
			else if (_wcsicmp(component, m_PackageFormat == PackageFormat::New ? L"Layouts" : L"Themes") == 0 &&
				_wcsicmp(extension, m_PackageFormat == PackageFormat::New ? L".ini" : L".thm") == 0 &&
				m_PackageLayouts.find(item) != m_PackageLayouts.end())
			{
				if (m_PackageFormat == PackageFormat::Old)
				{
					wcscpy_s(extension, 5, L".ini");
				}

				targetPath = g_Data.settingsPath;
				targetPath += L"Layouts\\";
				targetPath += path;
				error = !ExtractCurrentFile(targetPath);
				if (!error)
				{
					CleanLayoutFile(targetPath.c_str());
				}
			}
		}
		else
		{
			if (_wcsicmp(component, L"Fonts") == 0 &&
				m_PackageFormat == PackageFormat::Old &&
				_wcsicmp(extension, L".ttf") == 0)
			{
				for (auto iter = m_PackageSkins.cbegin(); iter != m_PackageSkins.cend(); ++iter)
				{
					targetPath = g_Data.skinsPath;
					targetPath += *iter;
					targetPath += L"\\@Resources\\Fonts\\";
					targetPath += path;
					error = !ExtractCurrentFile(targetPath);
					if (error)
					{
						break;
					}
				}
			}
		}

		if (error)
		{
			m_ErrorMessage = L"Unable to create file:\n";
			m_ErrorMessage += targetPath;
			m_ErrorMessage += L"\n\nSkin Installer will now quit.";
			return false;
		}
	}
	while (unzGoToNextFile(m_PackageUnzFile) == UNZ_OK);

	if (!m_MergeSkins && m_BackupSkins)
	{
		KeepVariables();
	}

	return true;
}
Ejemplo n.º 18
0
void MainUI::OpenDirs(QStringList dirs){
  //Now open the dirs
  if(dirs.isEmpty()){ dirs << QDir::homePath(); }
  QStringList invalid;
  for(int i=0; i<dirs.length(); i++){
    if(dirs[i].simplified().isEmpty()){ continue; }
    //Open this directory in a viewer
    if(dirs[i].endsWith("/")){ dirs[i].chop(1); }
    if(!QFile::exists(dirs[i])){ invalid << dirs[i]; continue; }
    if(DEBUG){ qDebug() << "Open Directory:" << dirs[i]; }
    ///Get a new Unique ID
    int id = 0;
    for(int j=0; j<DWLIST.length(); j++){ 
      if(DWLIST[j]->id().section("-",1,1).toInt() >= id){ id = DWLIST[j]->id().section("-",1,1).toInt()+1; }
    }
    //Create the new DirWidget
    DirWidget *DW = new DirWidget("DW-"+QString::number(id), this);
    DW->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    ui->BrowserLayout->addWidget(DW);
    DWLIST << DW;
    //Connect the signals/slots for it
    connect(DW, SIGNAL(OpenDirectories(QStringList)), this, SLOT(OpenDirs(QStringList)) );
    connect(DW, SIGNAL(LoadDirectory(QString, QString)), worker, SLOT(GetDirData(QString, QString)) );
    connect(DW, SIGNAL(findSnaps(QString, QString)), worker, SLOT(GetSnapshotData(QString, QString)) );
    connect(DW, SIGNAL(PlayFiles(LFileInfoList)), this, SLOT(OpenPlayer(LFileInfoList)) );
    connect(DW, SIGNAL(ViewFiles(LFileInfoList)), this, SLOT(OpenImages(LFileInfoList)) );
    connect(DW, SIGNAL(LaunchTerminal(QString)), this, SLOT(OpenTerminal(QString)) );
    connect(DW, SIGNAL(CutFiles(QStringList)), this, SLOT(CutFiles(QStringList)) );
    connect(DW, SIGNAL(CopyFiles(QStringList)), this, SLOT(CopyFiles(QStringList)) );
    connect(DW, SIGNAL(FavoriteFiles(QStringList)), this, SLOT(FavoriteFiles(QStringList)) );
    connect(DW, SIGNAL(RenameFiles(QStringList)), this, SLOT(RenameFiles(QStringList)) );
    connect(DW, SIGNAL(RemoveFiles(QStringList)), this, SLOT(RemoveFiles(QStringList)) );
    connect(DW, SIGNAL(PasteFiles(QString,QStringList)), this, SLOT(PasteFiles(QString, QStringList)) );
    connect(DW, SIGNAL(CloseBrowser(QString)), this, SLOT(CloseBrowser(QString)) );
    //Now create the tab for this 
    if(radio_view_tabs->isChecked()){
      int index = tabBar->addTab( LXDG::findIcon("folder-open",""), dirs[i].section("/",-1) );
      tabBar->setTabWhatsThis( index, "DW-"+QString::number(id) );
      tabBar->setCurrentIndex(index);
    }else{
      //Just make sure the browser tab is visible
      bool found = false;
      for(int i=0; i<tabBar->count() && !found; i++){
        if(tabBar->tabWhatsThis(i)=="browser"){ tabBar->setCurrentIndex(i); found=true; }
      }
      if(!found){
        //Need to create the generic Browser tab
        int index = tabBar->addTab( LXDG::findIcon("folder-open",""), "Browser" );
        tabBar->setTabWhatsThis( index, "browser" );
        tabBar->setCurrentIndex(index);
      }
    }
    
    //Initialize the widget with the proper settings
    DW->setShowDetails(radio_view_details->isChecked());
    DW->setShowSidebar(ui->actionShow_Action_Buttons->isChecked());
    QList<DirWidget::DETAILTYPES> details; details <<DirWidget::NAME << DirWidget::SIZE << DirWidget::TYPE << DirWidget::DATEMOD;
    DW->setDetails(details); //Which details to show and in which order (L->R)
    DW->setShowThumbnails(ui->actionShow_Thumbnails->isChecked());
    DW->setThumbnailSize(settings->value("iconsize", 32).toInt());
    DW->setDirCompleter(dirCompleter);
    DW->setShowCloseButton(!radio_view_tabs->isChecked());
    //Now load the directory
    DW->ChangeDir(dirs[i]); //kick off loading the directory info
  }
  //Update visibilities
  tabChanged(tabBar->currentIndex());
  tabBar->setVisible( tabBar->count() > 1 );
  if(!invalid.isEmpty()){
    QMessageBox::warning(this, tr("Invalid Directories"), tr("The following directories are invalid and could not be opened:")+"\n"+invalid.join(", ") );
  }
  //Double check that there is at least 1 dir loaded
  //qDebug() << "OpenDirs:" << DWLIST.length() << dirs << invalid << tabBar->currentIndex();
  if(DWLIST.isEmpty()){ OpenDirs(QStringList()); }
  
}
Ejemplo n.º 19
0
int CFileManager::CopyFiles( FileOPFunc function, const char * fileFilter, const char * destination, int failIfExists, int nRecursive, int * failed ){

	char Source[MAX_PATH];
	char Dest[MAX_PATH];
	char SubSource[MAX_PATH];
	char * subFilter;
	strcpy( Source, fileFilter );
	strcpy( Dest, destination );

	if( !FormatPath( Source ) || !FormatPath( Dest ) )
		return 0;	

	EnsureFolderExistance( Dest, true );

	DWORD Attrib = GetFileAttributes( Dest );
	DWORD DestLen = strlen( Dest );
	DWORD SourceLen = strlen( Source );
	DWORD SubLen;
	int nFuncRet = 0;
	int nReturn = 0;
	
	HANDLE hFile = FindFirstFile( Source, &LAST_FILE_DATA );
	bool Success = hFile != INVALID_HANDLE_VALUE;
	if( !Success )
		return 0;

	for( unsigned int n=0;n<SourceLen;n++ ){

		if( Source[n]=='\\' ){
			nFuncRet=n;
		}
	}

	Source[nFuncRet]='\0';
	subFilter = &Source[nFuncRet+1];

	SourceLen=(nFuncRet-1);

	for( unsigned int n=0;n<DestLen;n++ ){

		if( Dest[n]=='\\' ){
			nFuncRet=n;
		}
	}

	if( (DestLen-1)==nFuncRet ){
		Dest[nFuncRet]='\0';
		DestLen--;
	}
	if( (Attrib & (1 << 4 )) <= 0 || Attrib == INVALID_FILE_ATTRIBUTES ){
		return 0;
	}

	while( Success ){

		if( !( LAST_FILE_DATA.cFileName[0]=='.' && LAST_FILE_DATA.cFileName[1]=='\0' ) &&
			!( LAST_FILE_DATA.cFileName[0]=='.' && LAST_FILE_DATA.cFileName[1]=='.' && LAST_FILE_DATA.cFileName[2]=='\0' ) ){	

			SubLen=strlen( LAST_FILE_DATA.cFileName );

			if( DestLen+SubLen+1 >= MAX_PATH ) 
				sprintf( SubDestination, "%s\\%s", Dest, LAST_FILE_DATA.cAlternateFileName );
			else
				sprintf( SubDestination, "%s\\%s", Dest, LAST_FILE_DATA.cFileName );

			if( DestLen+SubLen+1 >= MAX_PATH ) 
				sprintf( SubSource, "%s\\%s", Source, LAST_FILE_DATA.cAlternateFileName );
			else
				sprintf( SubSource, "%s\\%s", Source, LAST_FILE_DATA.cFileName );

			if( function )
				nFuncRet = function( this, SubSource );
			if( nFuncRet <= 1 ){

				if( ((LAST_FILE_DATA.dwFileAttributes & (1 << 4 )) > 0) && nRecursive>0 ){
										
					strcat( SubSource, "\\" );
					strcat( SubSource, subFilter );	
					nReturn+=CopyFiles( function, SubSource, SubDestination, failIfExists, nRecursive, failed );		
					
				}
				else if( nFuncRet<= 0 ){

					if( CopyFile( SubSource, SubDestination, failIfExists ) ){
						nReturn++;
					}
					else if( failed != 0 ){
						*failed+=1;
					}
				}
					
			}
			else if( nFuncRet >= 2 ){
				FindClose( hFile );
				return nReturn;
			}		
		}

		Success = FindNextFile( hFile, &LAST_FILE_DATA )>0;
	}

	FindClose( hFile );

	return nReturn+1;
}
Ejemplo n.º 20
0
void DirWidget::on_tool_act_copy_clicked(){
  QStringList sel = currentSelection();
  if(sel.isEmpty()){ return; }
  qDebug() << "Copying Items to clipboard:" << sel;
  emit CopyFiles(sel);	
}
Ejemplo n.º 21
0
/*
 * User pressed the install button.  Make it go.
 */
void CBINDInstallDlg::OnInstall() {
#if _MSC_VER >= 1400
	char Vcredist_x86[MAX_PATH];
#endif
	BOOL success = FALSE;
	int oldlen;

	if (CheckBINDService())
		StopBINDService();

	InstallTags();

	UpdateData();

	if (!m_toolsOnly && m_accountName != LOCAL_SERVICE) {
		/*
		 * Check that the Passwords entered match.
		 */
		if (m_accountPassword != m_accountPasswordConfirm) {
			MsgBox(IDS_ERR_PASSWORD);
			return;
		}

		/*
		 * Check that there is not leading / trailing whitespace.
		 * This is for compatibility with the standard password dialog.
		 * Passwords really should be treated as opaque blobs.
		 */
		oldlen = m_accountPassword.GetLength();
		m_accountPassword.TrimLeft();
		m_accountPassword.TrimRight();
		if (m_accountPassword.GetLength() != oldlen) {
			MsgBox(IDS_ERR_WHITESPACE);
			return;
		}

		/*
		 * Check the entered account name.
		 */
		if (ValidateServiceAccount() == FALSE)
			return;

		/*
		 * For Registration we need to know if account was changed.
		 */
		if (m_accountName != m_currentAccount)
			m_accountUsed = FALSE;

		if (m_accountUsed == FALSE && m_serviceExists == FALSE)
		{
		/*
		 * Check that the Password is not null.
		 */
			if (m_accountPassword.GetLength() == 0) {
				MsgBox(IDS_ERR_NULLPASSWORD);
				return;
			}
		}
	} else if (m_accountName == LOCAL_SERVICE) {
		/* The LocalService always exists. */
		m_accountExists = TRUE;
		if (m_accountName != m_currentAccount)
			m_accountUsed = FALSE;
	}

	/* Directories */
	m_etcDir = m_targetDir + "\\etc";
	m_binDir = m_targetDir + "\\bin";

	if (m_defaultDir != m_targetDir) {
		if (GetFileAttributes(m_targetDir) != 0xFFFFFFFF)
		{
			int install = MsgBox(IDS_DIREXIST,
					MB_YESNO | MB_ICONQUESTION, m_targetDir);
			if (install == IDNO)
				return;
		}
		else {
			int createDir = MsgBox(IDS_CREATEDIR,
					MB_YESNO | MB_ICONQUESTION, m_targetDir);
			if (createDir == IDNO)
				return;
		}
	}

	if (!m_toolsOnly) {
		if (m_accountExists == FALSE) {
			success = CreateServiceAccount(m_accountName.GetBuffer(30),
							m_accountPassword.GetBuffer(30));
			if (success == FALSE) {
				MsgBox(IDS_CREATEACCOUNT_FAILED);
				return;
			}
			m_accountExists = TRUE;
		}
	}

	ProgramGroup(FALSE);

#if _MSC_VER >= 1400
	/*
	 * Install Visual Studio libraries.  As per:
	 * http://blogs.msdn.com/astebner/archive/2006/08/23/715755.aspx
	 *
	 * Vcredist_x86.exe /q:a /c:"msiexec /i vcredist.msi /qn /l*v %temp%\vcredist_x86.log"
	 */
	/*system(".\\Vcredist_x86.exe /q:a /c:\"msiexec /i vcredist.msi /qn /l*v %temp%\vcredist_x86.log\"");*/

	/*
	 * Enclose full path to Vcredist_x86.exe in quotes as
	 * m_currentDir may contain spaces.
	 */
	sprintf(Vcredist_x86, "\"%s\\Vcredist_x86.exe\"",
		(LPCTSTR) m_currentDir);
	system(Vcredist_x86);
#endif
	try {
		CreateDirs();
		CopyFiles();
		if (!m_toolsOnly)
			RegisterService();
		RegisterMessages();

		HKEY hKey;

		/* Create a new key for named */
		SetCurrent(IDS_CREATE_KEY);
		if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_SUBKEY,
			&hKey) == ERROR_SUCCESS) {
			// Get the install directory
			RegSetValueEx(hKey, "InstallDir", 0, REG_SZ,
					(LPBYTE)(LPCTSTR)m_targetDir,
					m_targetDir.GetLength());
			RegCloseKey(hKey);
		}


		SetCurrent(IDS_ADD_REMOVE);
		if (RegCreateKey(HKEY_LOCAL_MACHINE, BIND_UNINSTALL_SUBKEY,
				 &hKey) == ERROR_SUCCESS) {
			CString buf(BIND_DISPLAY_NAME);

			RegSetValueEx(hKey, "DisplayName", 0, REG_SZ,
					(LPBYTE)(LPCTSTR)buf, buf.GetLength());

			buf.Format("%s\\BINDInstall.exe", m_binDir);
			RegSetValueEx(hKey, "UninstallString", 0, REG_SZ,
					(LPBYTE)(LPCTSTR)buf, buf.GetLength());
			RegCloseKey(hKey);
		}

		ProgramGroup(FALSE);

		if (m_startOnInstall)
			StartBINDService();
	}
	catch(Exception e) {
		MessageBox(e.resString);
		SetCurrent(IDS_CLEANUP);
		FailedInstall();
		MsgBox(IDS_FAIL);
		return;
	}
	catch(DWORD dw)	{
		CString msg;
		msg.Format("A fatal error occured\n(%s)", GetErrMessage(dw));
		MessageBox(msg);
		SetCurrent(IDS_CLEANUP);
		FailedInstall();
		MsgBox(IDS_FAIL);
		return;
	}

	SetCurrent(IDS_INSTALL_DONE);
	MsgBox(IDS_SUCCESS);
}
Ejemplo n.º 22
0
int main (void)
{

SHORT ix, iy;
SHORT iwidth, idepth;
SWP   swp;
ULONG ulResult;
int iRes;

static CHAR szClientClass[]="ZIN";
static ULONG flFrameFlags= FCF_TITLEBAR | FCF_SYSMENU |
                               FCF_TASKLIST | FCF_ICON | FCF_SHELLPOSITION|
                                FCF_BORDER | FCF_NOBYTEALIGN;

   
hab=WinInitialize(0);
hmq=WinCreateMsgQueue(hab, 0);

//Register processing class
WinRegisterClass(
            hab,
            szClientClass,
            ClientWndProc,
            CS_SIZEREDRAW,
            0);

//Create Window
hwndFrame=WinCreateStdWindow(
            HWND_DESKTOP,
            WS_VISIBLE,
            &flFrameFlags,
            szClientClass,
            NULL,
            0L,
            0,        //Module handle for resources
            ID_RESOURCE,        //ID of resources
            &hwndClient);


//Size window
WinSetWindowPos( hwndFrame, HWND_TOP, 0, 0, 640, 480, SWP_SIZE );            

//Center window
iwidth = WinQuerySysValue( HWND_DESKTOP, SV_CXSCREEN );
idepth = WinQuerySysValue( HWND_DESKTOP, SV_CYSCREEN );
WinQueryWindowPos( hwndFrame, (PSWP)&swp );
ix = (SHORT)(( iwidth  - swp.cx ) / 2);
iy = (SHORT)(( idepth  - swp.cy ) / 2);
WinSetWindowPos( hwndFrame, HWND_TOP, ix, iy, 0, 0, SWP_MOVE );            

//Set focus to edit window.
WinSetFocus(HWND_DESKTOP,hwndClient);

//Load application title
WinLoadString(hab, 0, ID_APPNAME, LITTLEBUF, (PSZ) szAppName);

//Set title of frame.
WinSetWindowText(hwndFrame, (PSZ) szAppName);
 
  
//Show the window
WinShowWindow(hwndFrame,TRUE);

//Get source directory.
GetCurrentDirectory(szSourceDir);


//Load first message
FIRSTMSG:
usResponse=MsgBox(ID_FIRSTMSG, ID_APPNAME, MB_OKCANCEL);
WinUpdateWindow(hwndClient);

if (usResponse==MBID_OK)
    {

    //Show readme.txt file
    ulResult=WinDlgBox(HWND_DESKTOP, hwndClient, ReadmeDlgProc,
                NULLHANDLE, IDD_README, NULL);

    if (ulResult==FALSE) 
        {
        //The installation has been cancelled.
        usResponse=MsgBox(ID_CANCELINSTALL, ID_APPNAME, MB_OK);    
        goto END_INSTALL;
        }


    ulResult=WinDlgBox(HWND_DESKTOP, hwndClient, GetDirDlgProc,
                NULLHANDLE, IDD_GETDIR, NULL);
    
    if (ulResult==FALSE) goto FIRSTMSG;

    //Update the window
    WinUpdateWindow(hwndClient);

    //Load status dialog
    LoadStatusDlg();

    //Make sure all files exist
    iRes=CheckFiles(szSourceDir);
    if (iRes!=0)
        {
        DestroyStatusDlg();
        usResponse=MsgBox(ID_FILENOTFOUND, ID_APPNAME, MB_OK);
        goto END_INSTALL;
        }

    //Copy the files
    iRes=CopyFiles(szSourceDir, szInstallDir);
    if (iRes!=0)
        {
        DestroyStatusDlg();
        usResponse=MsgBox(ID_FILESNOTCOPIED, ID_APPNAME, MB_OK);
        goto END_INSTALL;
        }

    iRes=PatchZed(szInstallDir);
    if (iRes!=0)
        {
        DestroyStatusDlg();
        usResponse=MsgBox(ID_PATCHFAILED, ID_APPNAME, MB_OK);
        goto END_INSTALL;
        }

    
    iRes=CreateObject(szInstallDir);
    if (iRes!=0) usResponse=MsgBox(ID_CANTCREATEOBJECT, ID_APPNAME, MB_OK);

    //unload status window
    DestroyStatusDlg();

    //Update the window
    WinUpdateWindow(hwndClient);

    //Success
    usResponse=MsgBox(ID_SUCCESS, ID_APPNAME, MB_OK);
    goto END_INSTALL;
    
    //Main message loop
    while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
        WinDispatchMsg(hab, &qmsg);

    }


if (usResponse==MBID_CANCEL)
    {
    //The installation has been cancelled.
    usResponse=MsgBox(ID_CANCELINSTALL, ID_APPNAME, MB_OK);    
    }

END_INSTALL:
//Cleanup
WinDestroyWindow(hwndFrame);
WinDestroyMsgQueue(hmq);
WinTerminate(hab);

//End
return 0;
}