示例#1
0
DWORD UpdateService(char *NewName) {
    SC_HANDLE schService;
    DWORD res = ERROR_SUCCESS,
	  count = 0,
	  loop = 0,
	  lastCheck;
    SERVICE_STATUS status;
    res =  GetServiceHandle(&schService);
    if(res != ERROR_SUCCESS) return res;
  
    // Stop the actually running service
    if(!ControlService(schService,SERVICE_CONTROL_STOP,&status)) {
	res = GetLastError();
	CloseServiceHandle(schService);
	fprintf(stderr,"ControlService(SERVICE_CONTROL_STOP) failed (%d)\n",res);
	fflush(stderr);
	return res;
    }
    res = MoveFiles(NewName);
    QueryServiceStatus(schService,&status);
    lastCheck = status.dwCheckPoint;
    do {
	switch(status.dwCurrentState) {
	case SERVICE_STOPPED: break;
	case SERVICE_STOP_PENDING: Sleep(status.dwWaitHint); 
	                           // Fall through
	default: 
	    if(!QueryServiceStatus(schService,&status)) {
		res = GetLastError();
		status.dwCurrentState = SERVICE_STOPPED;
	    }
	    if(status.dwCurrentState != SERVICE_STOPPED && lastCheck == status.dwCheckPoint) {
	        ++loop;
	        Sleep(2000);
	    } else {
		loop = 0;
		lastCheck = status.dwCheckPoint;
	    }
	    break;
	}	
    } while(loop <=5 && status.dwCurrentState != SERVICE_STOPPED);
    
    
    if(!StartService(schService,0,NULL)) {
	res = GetLastError();
	fprintf(stderr,"StartService failed (%d)\n",res);
	fflush(stderr);
    }
    
    CloseServiceHandle(schService);

    return res;
}
示例#2
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();
}
示例#3
0
void CheckForUpdatesWorker(void *param)
{
	if (checking) return;
	/*
	// this check doesn't work on some systems - not sure which or why
	if(!(GetSystemMetrics(SM_NETWORK) & 1)) {
		ShowError(TranslateT("No network - aborting update check"));
		NLog("worker thread aborting - no network");
		return 1; // no network
	}
	*/

	NLog("CheckForUpdatesWorker thread starting");

	checking = true;

	WriteLastCheckTime();

	bool confirm = !(((DWORD)param & 1) == 1);
	bool restart = !(((DWORD)param & 2) == 2); // if restart is false, then we're doing an 'update and shutdown'

	if(hwndOptions) PostMessage(hwndOptions, WMU_CHECKING, 0, 0);

	bool use_popup = options.popup_notify && ArePopupsEnabled();
	
	FilenameMap fn_map(5, CompareFileNameStruct);
	
	if (use_popup) 
	{
		ShowPopup(0, TranslateT("Checking for Updates"), _T(""), POPFLAG_SAVEHWND, -1);
	} 
	else 
	{
		CreateProgressWindow();

		SendMessage(hwndProgress, WM_SETTEXT, 0, (LPARAM)TranslateT("Progress - Checking for updates..."));
		if (options.use_xml_backend) SendMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Downloading XML data"), 0);
		else SendMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Checking for updates"), 0);

	}
	
	EnterCriticalSection(&list_cs);

	if (options.use_xml_backend)	
    {
		if (UpdateXMLData(MC_PLUGINS)) // prevent double error messages (in some cases)
		{
			// iterate through the registered plugins
			if (!use_popup) SendMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Scanning plugins folder"), 0);
			ScanPlugins(&fn_map, &update_list);

			if (UpdateXMLData(MC_LOCALIZATION)) 
			{
				if (!use_popup) SendMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Scanning language packs"), 0);
				ScanLangpacks(&fn_map, &update_list);
			}

			if(!use_popup) SendMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Updating component file listing ids"), 0);
			UpdateFLIDs(update_list);
		}

		if (!use_popup) SendMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)TranslateT("Checking for updates"), 0);
	}

	UpdateList update_list2(update_list);
	LeaveCriticalSection(&list_cs);

	int count = update_list2.getCount(), index = 0;
	TCHAR msg[512];
	TCHAR *temp_str;

	UpdateList todo;

	for(index = 0; index < count; index++) 
	{
		if(update_list2[index].update_options.enabled) 
		{
			mir_sntprintf(msg, SIZEOF(msg), TranslateT("Checking plugin: %s"), (temp_str = GetTString(update_list2[index].update.szComponentName)));
			mir_free(temp_str);
		} 
		else 
		{
			mir_sntprintf(msg, SIZEOF(msg), TranslateT("Skipping plugin: %s"), (temp_str = GetTString(update_list2[index].update.szComponentName)));
			mir_free(temp_str);
		}

		if(!use_popup) {
			SendMessage(hwndProgress, WMU_SETMESSAGE, (WPARAM)msg, 0);
			SendMessage(hwndProgress, WMU_SETPROGRESS, (WPARAM)(int)(index * 100.0 / count), 0);
		} //else if(hwndPop) // disabled - just annoying
			//ChangePopupText(hwndPop, msg);

		if (update_list2[index].update_options.enabled) 
		{
			char *nv;
			bool beta;
			if (nv =  UpdateRequired(update_list2[index], &beta)) 
			{
				todo.insert(new UpdateInternal(update_list2[index]));			
				todo[todo.getCount()-1].newVersion = nv;
				todo[todo.getCount()-1].update_options.use_beta = beta;
			}
		}
		if (!use_popup && hwndProgress == NULL) 
		{
			RemoveFolder(options.temp_folder);
			break; // user closed progress window - cancel
		}
	}

	ProgressWindowDone();
	if (hwndPop) PostMessage(hwndPop, WMU_CLOSEPOP, 0 , 0);
	
	if(options.use_xml_backend) {
		FreeXMLData(MC_PLUGINS);
		FreeXMLData(MC_LOCALIZATION);
	}

	bool restore_status = true;

	if (todo.getCount()) 
	{
		int cd_ret = CD_OK;
		if (confirm) 
		{
			if (use_popup) 
			{
				ShowPopup(0, TranslateT("Updates Available"), TranslateT("Updated Miranda components detected.\nClick here to install."), POPFLAG_SAVEHWND, -1);
				DWORD ret;
				while ((ret = WaitForSingleObject(hEventPop, 200)) == WAIT_TIMEOUT && !Miranda_Terminated());

				if (!pop_cancelled && ret == WAIT_OBJECT_0 && !Miranda_Terminated()) 
				{
					cd_ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMUPDATES), GetDesktopWindow(), DlgProcConfirm, (LPARAM)&todo);
				} 
				else 
				{
					if(hwndOptions) PostMessage(hwndOptions, WMU_DONECHECKING, 0, 0);
					RestoreStatus();
					for(int i=0; i<todo.getCount(); ++i)
						free(todo[i].newVersion);
					checking = false;
					Netlib_CloseHandle(hNetlibHttp);
					hNetlibHttp = NULL;
					return;
				}
			} 
			else
				cd_ret = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMUPDATES), GetDesktopWindow(), DlgProcConfirm, (LPARAM)&todo);
		}



		if (!confirm || cd_ret == CD_CONFALL || cd_ret == CD_NOINSTALL || cd_ret == CD_OK) 
		{	
			bool conf_all = (cd_ret == CD_CONFALL), no_install = (cd_ret == CD_NOINSTALL);

			// ensure the backup folder exists (either create it or return non-zero signifying error)
			if (options.backup && !CreatePath(options.backup_folder)) 
			{
				//MessageBox(0, Translate("Could not create backup folder"), Translate("Error"), MB_OK | MB_ICONERROR);
				ShowError(TranslateT("Could not create backup folder"));
				if (hwndOptions) PostMessage(hwndOptions, WMU_DONECHECKING, 0, 0);
				RestoreStatus();
				for (int i=0; i<todo.getCount(); ++i)
					free(todo[i].newVersion);
				checking = false;
				Netlib_CloseHandle(hNetlibHttp);
				hNetlibHttp = NULL;
				return;
			}

			bool dll_enabled_or_langpack = DownloadUpdates(todo, &fn_map, confirm ? false : options.auto_dll_only);
			if (todo.getCount() && !no_install) 
			{
				if (!conf_all || DialogBox(hInst, MAKEINTRESOURCE(IDD_CONFIRMCOMPONENTS), GetDesktopWindow(), DlgProcConfirmComponents) == IDOK) 
				{
					if (!dll_enabled_or_langpack && restart)
					{ 
						// we're not doing an 'update and shutdown', and we're not updating any active dlls...so just install

						// get folders
						TCHAR root_folder[MAX_PATH], plugins_folder[MAX_PATH];

						GetRootDir(root_folder);

						_tcscpy(plugins_folder, root_folder);
						_tcscat(plugins_folder, _T("\\Plugins"));

						// move files
						MoveFiles(0, options.temp_folder, plugins_folder, options.backup_folder, root_folder);
						
						// rescan to get correct version numbers
						ScanPlugins(0, 0);	
					} 
					else 
					{
						if (ExternProcess(restart) == 0) // if restarting, don't restore status
							restore_status = false;
					}
				}
			}
		}

		for (int i=0; i<todo.getCount(); ++i)
			free(todo[i].newVersion);

	} 
	else if (!restart) 
	{
		PostMessage((HWND)CallService(MS_CLUI_GETHWND, 0, 0), WM_COMMAND, ID_ICQ_EXIT, 0);
	}	

	if (restore_status && restart) // restore status if we're not doing an 'update and shutdown', and the update was unsuccessful (or there was nothing to update, or no need to shutdown)
	{
		checking = false;
		if (hwndOptions) PostMessage(hwndOptions, WMU_DONECHECKING, 0, 0);
		RestoreStatus();
	}
	Netlib_CloseHandle(hNetlibHttp);
	hNetlibHttp = NULL;
}
示例#4
0
void InterpretCommand(MenuInstanceData * pMenuData, const char *pszScript) {
  char szCmd[31], szParam1[51], szParam2[51];
  char szTempScript[ 255 ];
  memset(szTempScript, 0, sizeof(szTempScript));
  strncpy(szTempScript, pszScript, 250);

  if (pszScript[0] == 0) {
    return;
  }

  char* pszScriptPointer = szTempScript;
  while (pszScriptPointer && !hangup) {
    pszScriptPointer = MenuParseLine(pszScriptPointer, szCmd, szParam1, szParam2);

    if (szCmd[0] == 0) {    // || !pszScriptPointer || !*pszScriptPointer
      break;
    }

    // -------------------------
    // Run a new menu instance

    int nCmdID = GetMenuIndex(szCmd);
    switch (nCmdID) {
    case 0: {
      // "MENU"
      // Spawn a new menu
      MenuInstanceData *pNewMenuData = static_cast<MenuInstanceData *>(malloc(sizeof(MenuInstanceData)));

      memset(pNewMenuData, 0, sizeof(MenuInstanceData));
      pNewMenuData->nFinished = 0;
      pNewMenuData->nReload = 0;

      Menus(pNewMenuData, pMenuData->szPath, szParam1);
      free(pNewMenuData);
    }
    break;
    case 1: {
      // -------------------------
      // Exit out of this instance
      // of the menu
      // -------------------------
      // "ReturnFromMenu"
      InterpretCommand(pMenuData, pMenuData->header.szExitScript);
      pMenuData->nFinished = 1;
    }
    break;
    case 2: {
      // "EditMenuSet"
      EditMenus();           // flag if we are editing this menu
      pMenuData->nFinished = 1;
      pMenuData->nReload = 1;
    }
    break;
    case 3: {
      // "DLFreeFile"
      align(szParam2);
      MenuDownload(szParam1, szParam2, true, true);
    }
    break;
    case 4: {
      // "DLFile"
      align(szParam2);
      MenuDownload(szParam1, szParam2, false, true);
    }
    break;
    case 5: {
      // "RunDoor"
      MenuRunDoorName(szParam1, false);
    }
    break;
    case 6: {
      // "RunDoorFree"
      MenuRunDoorName(szParam1, true);
    }
    break;
    case 7: {
      // "RunDoorNumber"
      int nTemp = atoi(szParam1);
      MenuRunDoorNumber(nTemp, false);
    }
    break;
    case 8: {
      // "RunDoorNumberFree"
      int nTemp = atoi(szParam1);
      MenuRunDoorNumber(nTemp, true);
    }
    break;
    case 9: {
      // "PrintFile"
      printfile(szParam1, true);
    }
    break;
    case 10: {
      // "PrintFileNA"
      printfile(szParam1, false);
    }
    break;
    case 11: {
      // "SetSubNumber"
      SetSubNumber(szParam1);
    }
    break;
    case 12: {
      // "SetDirNumber"
      SetDirNumber(szParam1);
    }
    break;
    case 13: {
      // "SetMsgConf"
      SetMsgConf(szParam1[0]);
    }
    break;
    case 14: {
      // "SetDirConf"
      SetDirConf(szParam1[0]);
    }
    break;
    case 15: {
      // "EnableConf"
      EnableConf();
    }
    break;
    case 16: {
      // "DisableConf"
      DisableConf();
    }
    break;
    case 17: {
      // "Pause"
      pausescr();
    }
    break;
    case 18: {
      // "ConfigUserMenuSet"
      ConfigUserMenuSet();
      pMenuData->nFinished = 1;
      pMenuData->nReload = 1;
    }
    break;
    case 19: {
      // "DisplayHelp"
      if (GetSession()->GetCurrentUser()->IsExpert()) {
        AMDisplayHelp(pMenuData);
      }
    }
    break;
    case 20: {
      // "SelectSub"
      ChangeSubNumber();
    }
    break;
    case 21: {
      // "SelectDir"
      ChangeDirNumber();
    }
    break;
    case 22: {
      // "SubList"
      SubList();
    }
    break;
    case 23: {
      // "UpSubConf"
      UpSubConf();
    }
    break;
    case 24: {
      // "DownSubConf"
      DownSubConf();
    }
    break;
    case 25: {
      // "UpSub"
      UpSub();
    }
    break;
    case 26: {
      // "DownSub"
      DownSub();
    }
    break;
    case 27: {
      // "ValidateUser"
      ValidateUser();
    }
    break;
    case 28: {
      // "Doors"
      Chains();
    }
    break;
    case 29: {
      // "TimeBank"
      TimeBank();
    }
    break;
    case 30: {
      // "AutoMessage"
      AutoMessage();
    }
    break;
    case 31: {
      // "BBSList"
      BBSList();
    }
    break;
    case 32: {
      // "RequestChat"
      RequestChat();
    }
    break;
    case 33: {
      // "Defaults"
      Defaults(pMenuData);
    }
    break;
    case 34: {
      // "SendEMail"
      SendEMail();
    }
    break;
    case 35: {
      // "Feedback"
      FeedBack();
    }
    break;
    case 36: {
      // "Bulletins"
      Bulletins();
    }
    break;
    case 37: {
      // "HopSub"
      HopSub();
    }
    break;
    case 38: {
      // "SystemInfo"
      SystemInfo();
    }
    break;
    case 39: {
      // "JumpSubConf"
      JumpSubConf();
    }
    break;
    case 40: {
      // "KillEMail"
      KillEMail();
    }
    break;
    case 41: {
      // "LastCallers"
      LastCallers();
    }
    break;
    case 42: {
      // "ReadEMail"
      ReadEMail();
    }
    break;
    case 43: {
      // "NewMessageScan"
      NewMessageScan();
    }
    break;
    case 44: {
      // "Goodbye"
      GoodBye();
    }
    break;
    case 45: {
      // "PostMessage"
      WWIV_PostMessage();
    }
    break;
    case 46: {
      // "NewMsgScanCurSub"
      ScanSub();
    }
    break;
    case 47: {
      // "RemovePost"
      RemovePost();
    }
    break;
    case 48: {
      // "TitleScan"
      TitleScan();
    }
    break;
    case 49: {
      // "ListUsers"
      ListUsers();
    }
    break;
    case 50: {
      // "Vote"
      Vote();
    }
    break;
    case 51: {
      // "ToggleExpert"
      ToggleExpert();
    }
    break;
    case 52: {
      // "YourInfo"
      YourInfo();
    }
    break;
    case 53: {
      // "ExpressScan"
      ExpressScan();
    }
    break;
    case 54: {
      // "WWIVVer"
      WWIVVersion();
    }
    break;
    case 55: {
      // "InstanceEdit"
      InstanceEdit();
    }
    break;
    case 56: {
      // "ConferenceEdit"
      JumpEdit();
    }
    break;
    case 57: {
      // "SubEdit"
      BoardEdit();
    }
    break;
    case 58: {
      // "ChainEdit"
      ChainEdit();
    }
    break;
    case 59: {
      // "ToggleAvailable"
      ToggleChat();
    }
    break;
    case 60: {
      // "ChangeUser"
      ChangeUser();
    }
    break;
    case 61: {
      // "CLOUT"
      CallOut();
    }
    break;
    case 62: {
      // "Debug"
      Debug();
    }
    break;
    case 63: {
      // "DirEdit"
      DirEdit();
    }
    break;
    case 65: {
      // "Edit"
      EditText();
    }
    break;
    case 66: {
      // "BulletinEdit"
      EditBulletins();
    }
    break;
    case 67: {
      // "LoadText"
      // LoadText and LoadTextFile are the same, so they are now merged.
      LoadTextFile();
    }
    break;
    case 68: {
      // "ReadAllMail"
      ReadAllMail();
    }
    break;
    case 69: {
      // "Reboot"
      RebootComputer();
    }
    break;
    case 70: {
      // "ReloadMenus"
      ReloadMenus();
    }
    break;
    case 71: {
      // "ResetUserIndex"
      ResetFiles();
    }
    break;
    case 72: {
      // "ResetQScan"
      ResetQscan();
    }
    break;
    case 73: {
      // "MemStat"
      MemoryStatus();
    }
    break;
    case 74: {
      // "PackMsgs"
      PackMessages();
    }
    break;
    case 75: {
      // "VoteEdit"
      InitVotes();
    }
    break;
    case 76: {
      // "Log"
      ReadLog();
    }
    break;
    case 77: {
      // "NetLog"
      ReadNetLog();
    }
    break;
    case 78: {
      // "Pending"
      PrintPending();
    }
    break;
    case 79: {
      // "Status"
      PrintStatus();
    }
    break;
    case 80: {
      // "TextEdit"
      TextEdit();
    }
    break;
    case 81: {
      // "UserEdit"
      UserEdit();
    }
    break;
    case 82: {
      // "VotePrint"
      VotePrint();
    }
    break;
    case 83: {
      // "YLog"
      YesturdaysLog();
    }
    break;
    case 84: {
      // "ZLog"
      ZLog();
    }
    break;
    case 85: {
      // "ViewNetDataLog"
      ViewNetDataLog();
    }
    break;
    case 86: {
      // "UploadPost"
      UploadPost();
    }
    break;
    case 87: {
      // "ClearScreen"
      GetSession()->bout.ClearScreen();
    }
    break;
    case 88: {
      // "NetListing"
      NetListing();
    }
    break;
    case 89: {
      // "WHO"
      WhoIsOnline();
    }
    break;
    case 90: {
      // /A "NewMsgsAllConfs"
      NewMsgsAllConfs();
    }
    break;
    case 91: {
      // /E "MultiEMail"
      MultiEmail();
    }
    break;
    case 92: {
      // "NewMsgScanFromHere"
      NewMsgScanFromHere();
    }
    break;
    case 93: {
      // "ValidatePosts"
      ValidateScan();
    }
    break;
    case 94: {
      // "ChatRoom"
      ChatRoom();
    }
    break;
    case 95: {
      // "DownloadPosts"
      DownloadPosts();
    }
    break;
    case 96: {
      // "DownloadFileList"
      DownloadFileList();
    }
    break;
    case 97: {
      // "ClearQScan"
      ClearQScan();
    }
    break;
    case 98: {
      // "FastGoodBye"
      FastGoodBye();
    }
    break;
    case 99: {
      // "NewFilesAllConfs"
      NewFilesAllConfs();
    }
    break;
    case 100: {
      // "ReadIDZ"
      ReadIDZ();
    }
    break;
    case 101: {
      // "UploadAllDirs"
      UploadAllDirs();
    }
    break;
    case 102: {
      // "UploadCurDir"
      UploadCurDir();
    }
    break;
    case 103: {
      // "RenameFiles"
      RenameFiles();
    }
    break;
    case 104: {
      // "MoveFiles"
      MoveFiles();
    }
    break;
    case 105: {
      // "SortDirs"
      SortDirs();
    }
    break;
    case 106: {
      // "ReverseSortDirs"
      ReverseSort();
    }
    break;
    case 107: {
      // "AllowEdit"
      AllowEdit();
    }
    break;
    case 109: {
      // "UploadFilesBBS"
      UploadFilesBBS();
    }
    break;
    case 110: {
      // "DirList"
      DirList();
    }
    break;
    case 111: {
      // "UpDirConf"
      UpDirConf();
    }
    break;
    case 112: {
      // "UpDir"
      UpDir();
    }
    break;
    case 113: {
      // "DownDirConf"
      DownDirConf();
    }
    break;
    case 114: {
      // "DownDir"
      DownDir();
    }
    break;
    case 115: {
      // "ListUsersDL"
      ListUsersDL();
    }
    break;
    case 116: {
      // "PrintDSZLog"
      PrintDSZLog();
    }
    break;
    case 117: {
      // "PrintDevices"
      PrintDevices();
    }
    break;
    case 118: {
      // "ViewArchive"
      ViewArchive();
    }
    break;
    case 119: {
      // "BatchMenu"
      BatchMenu();
    }
    break;
    case 120: {
      // "Download"
      Download();
    }
    break;
    case 121: {
      // "TempExtract"
      TempExtract();
    }
    break;
    case 122: {
      // "FindDescription"
      FindDescription();
    }
    break;
    case 123: {
      // "ArchiveMenu"
      TemporaryStuff();
    }
    break;
    case 124: {
      // "HopDir"
      HopDir();
    }
    break;
    case 125: {
      // "JumpDirConf"
      JumpDirConf();
    }
    break;
    case 126: {
      // "ListFiles"
      ListFiles();
    }
    break;
    case 127: {
      // "NewFileScan"
      NewFileScan();
    }
    break;
    case 128: {
      // "SetNewFileScanDate"
      SetNewFileScanDate();
    }
    break;
    case 129: {
      // "RemoveFiles"
      RemoveFiles();
    }
    break;
    case 130: {
      // "SearchAllFiles"
      SearchAllFiles();
    }
    break;
    case 131: {
      // "XferDefaults"
      XferDefaults();
    }
    break;
    case 132: {
      // "Upload"
      Upload();
    }
    break;
    case 133: {
      // "YourInfoDL"
      YourInfoDL();
    }
    break;
    case 134: {
      // "UploadToSysop"
      UploadToSysop();
    }
    break;
    case 135: {
      // "ReadAutoMessage"
      ReadAutoMessage();
    }
    break;
    case 136: {
      // "SetNewScanMsg"
      SetNewScanMsg();
    }
    break;
    case 137: {
      // "ReadMessages"
      ReadMessages();
    }
    break;
    /*
    case 138:
    { // "RUN"
    ExecuteBasic(szParam1);
    } break;
    */
    case 139: {
      // "EventEdit"
      EventEdit();
    }
    break;
    case 140: {
      // "LoadTextFile"
      LoadTextFile();
    }
    break;
    case 141: {
      // "GuestApply"
      GuestApply();
    }
    break;
    case 142: {
      // "ConfigFileList"
      ConfigFileList();
    }
    break;
    case 143: {
      // "ListAllColors"
      ListAllColors();
    }
    break;
#ifdef QUESTIONS
    case 144: {
      // "EditQuestions"
      EditQuestions();
    }
    break;
    case 145: {
      // "Questions"
      Questions();
    }
    break;
#endif
    case 146: {
      // "RemoveNotThere"
      RemoveNotThere();
    }
    break;
    case 147: {
      // "AttachFile"
      AttachFile();
    }
    break;
    case 148: {
      // "InternetEmail"
      InternetEmail();
    }
    break;
    case 149: {
      // "UnQScan"
      UnQScan();
    }
    break;
    // ppMenuStringsIndex[150] thru ppMenuStringsIndex[153] not used.....
    case 154: {
      // "Packers"
      Packers();
    }
    break;
    case 155: {
      // Color_Config
      color_config();
    }
    break;
    //------------------------------------------------------------------
    //  ppMenuStringsIndex[156] and [157] are reserved for SDS Systems and systems
    //  that distribute modifications.  DO NOT reuse these strings for
    //  other menu options.
    //------------------------------------------------------------------
    //    case 156:
    //    { // ModAccess
    //        ModsAccess();
    //    } break;
    //    case 157:
    //    { // SDSAccess
    //        SDSAccess();
    //      } break;
    //------------------------------------------------------------------
    case 158: {
      // InitVotes
      InitVotes();
    }
    break;
    case 161: {
      // TurnMCIOn
      TurnMCIOn();
    }
    break;
    case 162: {
      // TurnMCIOff
      TurnMCIOff();
    }
    break;
    default: {
      MenuSysopLog("The following command was not recognized");
      MenuSysopLog(szCmd);
    }
    break;
    }
  }
}
/////////////////////////////////////////////////////////////////////
// 
// Function:    
//
// Description: 
//
/////////////////////////////////////////////////////////////////////
BOOL CAMigrateBOINCData::MoveFiles( tstring strSourceDirectory, tstring strDestinationDirectory, ULONGLONG& ullBytesTransfered )
{
    BOOL bRet = TRUE;
    WIN32_FIND_DATA ffData;
    HANDLE hFind;
    tstring csPathMask;
    tstring csFullPath;
    tstring csNewFullPath;
    tstring strMessage;

    strMessage  = _T("CAMigrateBOINCData::MoveFiles -- Directory: '");
    strMessage += strSourceDirectory;
    strMessage += _T("'");

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        strMessage.c_str()
    );

    // Create the destination cirectory if needed.
    //
    CreateDirectory(strDestinationDirectory.c_str(), NULL);
    
    if ( _T("\\") != strSourceDirectory.substr(strSourceDirectory.length() - 1, 1) )
    {
        strSourceDirectory       += _T("\\");
    }
    if ( _T("\\") != strDestinationDirectory.substr(strDestinationDirectory.length() - 1, 1) )
    {
        strDestinationDirectory  += _T("\\");
    }
    csPathMask                = strSourceDirectory + _T("*.*");
        
    hFind = FindFirstFile(csPathMask.c_str(), &ffData);

    if (hFind == INVALID_HANDLE_VALUE){
        LogMessage(
            INSTALLMESSAGE_INFO,
            NULL, 
            NULL,
            NULL,
            NULL,
            _T("CAMigrateBOINCData::MoveFiles -- Invalid handle")
        );
        return FALSE;
    }
    

    // Copying all the files
    while (hFind && FindNextFile(hFind, &ffData)) 
    {
        csFullPath    = strSourceDirectory      + ffData.cFileName;
        csNewFullPath = strDestinationDirectory + ffData.cFileName;

        RemoveReadOnly(csFullPath);
        RemoveReadOnly(csNewFullPath);

        if( !(ffData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) 
        {
            strMessage  = _T("CAMigrateBOINCData::MoveFiles -- Copy File: '");
            strMessage += csFullPath.c_str();
            strMessage += _T("' to '");
            strMessage += csNewFullPath.c_str();
            strMessage += _T("'");

            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                strMessage.c_str()
            );

            if( !CopyFile(csFullPath.c_str(), csNewFullPath.c_str(), FALSE) ) 
            {
                LogMessage(
                    INSTALLMESSAGE_INFO,
                    NULL, 
                    NULL,
                    NULL,
                    GetLastError(),
                    _T("CAMigrateBOINCData::MoveFiles -- Failed to copy original file")
                );
                bRet = FALSE;
            }
            else
            {
                ullBytesTransfered += ((ffData.nFileSizeHigh * MAXDWORD) + ffData.nFileSizeLow);

                // Specify that an update of the progress bar's position in
                //   this case means to move it forward by one increment.
                MsiRecordSetInteger(m_phProgressRec, 1, 2);
                MsiRecordSetInteger(m_phProgressRec, 2, (INT)((ullBytesTransfered/1024)/1024));
                MsiRecordSetInteger(m_phProgressRec, 3, 0);
                MsiProcessMessage(m_hMSIHandle, INSTALLMESSAGE_PROGRESS, m_phProgressRec);
                Sleep(0);

                // Delete the original file when it has been successfully
                //   copied
                if( !DeleteFile(csFullPath.c_str()) ) 
                {
                    LogMessage(
                        INSTALLMESSAGE_INFO,
                        NULL, 
                        NULL,
                        NULL,
                        GetLastError(),
                        _T("CAMigrateBOINCData::MoveFiles -- Failed to delete original file")
                    );
                }
            }
        }
        else // it is a directory -> Copying recursivly
        { 
            if( (_tcscmp(ffData.cFileName, _T(".")) != 0) &&
                (_tcscmp(ffData.cFileName, _T("..")) != 0) && 
                (!IsDirectoryExcluded(tstring(ffData.cFileName)))) 
            {
                if( !MoveFiles(csFullPath, csNewFullPath, ullBytesTransfered) )
                {
                    LogMessage(
                        INSTALLMESSAGE_INFO,
                        NULL, 
                        NULL,
                        NULL,
                        NULL,
                        _T("CAMigrateBOINCData::MoveFiles -- Failed to copy drectory")
                    );
                    LogMessage(
                        INSTALLMESSAGE_INFO,
                        NULL, 
                        NULL,
                        NULL,
                        NULL,
                        csNewFullPath.c_str()
                    );
                    bRet = FALSE;
                }
            }
        }
    }

    FindClose(hFind);

    RemoveReadOnly(strSourceDirectory);
	RemoveDirectory(strSourceDirectory.c_str());

    return bRet;
}
/////////////////////////////////////////////////////////////////////
// 
// Function:    
//
// Description: 
//
/////////////////////////////////////////////////////////////////////
UINT CAMigrateBOINCData::OnInstall()
{
    tstring     strCustomActionData;
    tstring     strMigratingDirectory;
    tstring     strInstallDirectory;
    tstring     strDataDirectory;
    tstring     strMessage;
    ULONGLONG   ullFileSize = 0;
    ULONGLONG   ullDirectorySize = 0;
    ULONGLONG   ullBytesTransfered = 0;
    UINT        uiReturnValue = -1;

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        _T("CAMigrateBOINCData::OnInstall -- Function Begin")
    );

    // CustomActionData is a pipe seperated string which contains whether
    //   this interation of the installer is migrating the BOINC data, the
    //   installer directory, and the data directory.
    //
    // Ex: <MigrationStatus>|<InstallDirectory>|<DataDrectory>
    //
    uiReturnValue = GetProperty( _T("CustomActionData"), strCustomActionData );
    if ( uiReturnValue ) return uiReturnValue;

    strMigratingDirectory = 
        strCustomActionData.substr(0, strCustomActionData.find(_T("|")));

    strMessage = _T("CAMigrateBOINCData::OnInstall -- strMigratingDirectory: '");
    strMessage += strMigratingDirectory;
    strMessage += _T("'");

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        strMessage.c_str()
    );

    strInstallDirectory = 
        strCustomActionData.substr(
            strCustomActionData.find(_T("|")) + 1,
            strCustomActionData.find(_T("|"), (strCustomActionData.find(_T("|")) + 1)) - 5
        );

    strMessage = _T("CAMigrateBOINCData::OnInstall -- strInstallDirectory: '");
    strMessage += strInstallDirectory;
    strMessage += _T("'");

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        strMessage.c_str()
    );

    strDataDirectory = 
        strCustomActionData.substr(strCustomActionData.rfind(_T("|")) + 1, strCustomActionData.length() - strCustomActionData.rfind(_T("|")) - 1);

    strMessage = _T("CAMigrateBOINCData::OnInstall -- strDataDirectory: '");
    strMessage += strDataDirectory;
    strMessage += _T("'");

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        strMessage.c_str()
    );


    // Are we migrating data?
    if ( _T("TRUE") == strMigratingDirectory )
    {
        // Determine how we should setup the progress bar.
        GetFileDirectorySizes( strInstallDirectory, ullFileSize, ullDirectorySize );

        // Reset the progress bar
        MsiRecordSetInteger(m_phProgressRec, 1, 0);
        MsiRecordSetInteger(m_phProgressRec, 2, (INT)((ullDirectorySize/1024)/1024));
        MsiRecordSetInteger(m_phProgressRec, 3, 0);
        MsiProcessMessage(m_hMSIHandle, INSTALLMESSAGE_PROGRESS, m_phProgressRec);

        // Tell the installer to use explicit progress messages.
        MsiRecordSetInteger(m_phProgressRec, 1, 1);
        MsiRecordSetInteger(m_phProgressRec, 2, 1);
        MsiRecordSetInteger(m_phProgressRec, 3, 0);
        MsiProcessMessage(m_hMSIHandle, INSTALLMESSAGE_PROGRESS, m_phProgressRec);

        // Migrate the data files
        if (!MoveFiles( strInstallDirectory, strDataDirectory, ullBytesTransfered ))
        {
            LogMessage(
                INSTALLMESSAGE_FATALEXIT,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Failed to migrate BOINC data files to the data directory.")
                );
            return ERROR_INSTALL_FAILURE;
        }
    }

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        _T("CAMigrateBOINCData::OnInstall -- Function End")
    );

    return ERROR_SUCCESS;
}