// Ini_file - файл настроек.
VOID Clicker_Tune( HINI Ini_file )
{
 // Читаем настройки.
 Clicker_SetPreDefinedSettings( SET_ALL_SETTINGS );
 Clicker_ReadSettings( Ini_file );

 // Если звук будет нужен:
 if( Clicker.Settings.Keyboard_echo )
  {
   // Задаем имена файлов.
   GetCurrentPath( Clicker.RTSettings.Keyboard_wav );
   strcat( Clicker.RTSettings.Keyboard_wav, "\\Audio\\Keyboard.wav" );

   GetCurrentPath( Clicker.RTSettings.Keyboard_exe );
   strcat( Clicker.RTSettings.Keyboard_exe, "\\Audio\\Keyboard.exe" );

   // Если файлов нет - отключаем настройку.
   if( !FileExists( Clicker.RTSettings.Keyboard_wav ) ||
       !FileExists( Clicker.RTSettings.Keyboard_exe ) ) Clicker.Settings.Keyboard_echo = 0;

   // Переносим файл со звуком от клавиатуры на диск в памяти.
   if( Clicker.Settings.Keyboard_echo )
    if( Clicker.Settings.Cache_echo_file ) Clicker_CopyEchoFileToRAMDrive();
  }

 // Запоминаем, что поток должен быть создан.
 if( Clicker.Settings.Keyboard_echo ) Enhancer.Modules.Clicker->Required = 1;

 // Возврат.
 return;
}
Ejemplo n.º 2
0
FILE* FileBrowser::OpenFile(string file)
{
	FILE* retVal;
	string fullPath = GetCurrentPath()+"\\" + file;
	fopen_s(&retVal,fullPath.c_str(),"rb");
	return retVal;
}
Ejemplo n.º 3
0
	virtual bool Update( PathFinderMove& move )
	{
		if( !theSpatialGraph.IsInPathableSpace( GetCurrentPosition() ) )
		{
			SetNewState(PathFinder::PFMS_STARTRECOVER);
			return true;
		}
		//find path
		GetCurrentPath().clear();
		bool retVal = theSpatialGraph.GetPath( GetCurrentPosition(), GetCurrentDestination(), GetCurrentPath() );

		if( retVal )
		{
			move.LastResult = PathFinder::PFMR_PATH_FOUND;
			//Initialize path index
			GetCurrentPathIndex() = 0;

			SetNewState( PathFinder::PFMS_FOLLOW );
			//Keep ticking
			return true;
		}
		else
		{
			move.LastResult = PathFinder::PFMR_PATH_NOT_FOUND;
		}

		//We're done if path failed
		return false;
	}
Ejemplo n.º 4
0
	virtual bool Update( PathFinderMove& /*move*/ )
	{
		//Make sure we can keep heading to our current subgoal
		const Vector2List& currentPath = GetCurrentPath();
		int currentPathIndex = GetCurrentPathIndex();

		//has the destination changed
		Vector2 vDest = currentPath[currentPath.size()-1];
		if( vDest == GetCurrentDestination() )
		{
			if( theSpatialGraph.CanGo( GetCurrentPosition(), currentPath[currentPathIndex] ) )
			{
				SetNewState( PathFinder::PFMS_FOLLOW );
				return true;
			}
			else if( !theSpatialGraph.CanGo( GetCurrentPosition(), GetCurrentPosition() ) )
			{
				//are we blocked
				SetNewState( PathFinder::PFMS_RECOVER );
				return true;
			}
		}

		//otherwise, try again
		SetNewState( PathFinder::PFMS_START );
		return true;
	}
Ejemplo n.º 5
0
void XgnExtDataDlg::DoCloseWork(CProgressDialog* pDlg)
{
#ifdef Ext_data_test
	return;
#endif
	pDlg->SetWindowText(_T("沪深指标扩展数据收盘作业"));

	GetCountValid(m_nValidCount);

	CString sPath = GetTodayPath(0,true);
	CreateDirectory(sPath.GetBuffer (0),NULL);

	//clear file
	//FileInOutData::RemoveFiles(sPath);

	int n = m_infoArr.GetSize ();
	for(int i = 0;i<n;i++)
	{
		RefreshDataAuto(m_infoArr[i], m_nValidCount[i], 48,true,pDlg);
	}
	if(n<=0) return;
	bool bOk = ReadWriteDownLoadInfoFile(-1, true);


	CString sLocalCurrentDirectory = GetCurrentPath()+"upload\\indicator";
	CString sServerCurrentDirectory = "/download/indicator";

	//FtpParaClass::FILE_COUNT_INFO *pInfo = new FtpParaClass::FILE_COUNT_INFO;
	//strcpy(pInfo[0].fileName,sPath);
	//pInfo[0].ufileFlag = FtpGetSend::DIRECTORYICON;
	//FtpGetSend::PrepareFileSend(pInfo, 1 , sLocalCurrentDirectory, sServerCurrentDirectory);
}
// Title и String - строки, которые надо записать.
VOID Krnl_Debug_Log( PCHAR Title, PCHAR String )
{
 // Если файла нет - создаем его.
 HFILE File = NULLHANDLE; ULONG Report = 0; ULONG New_size = 0; PEAOP2 EAs = NULL;

 ULONG Action = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
 ULONG Mode = OPEN_FLAGS_FAIL_ON_ERROR | OPEN_SHARE_DENYWRITE | OPEN_ACCESS_WRITEONLY;

 CHAR Log_file_name[ SIZE_OF_PATH ] = "";
 GetCurrentPath( Log_file_name ); strcat( Log_file_name, "\\_log.txt" );

 DosOpen( Log_file_name, &File, &Report, New_size, FILE_COMMON_ATTRIBUTES, Action, Mode, EAs );

 // Записываем строку.
 if( Report != FILE_CREATED )
  {
   DosSetFilePtr( File, 0, FILE_END, &Report );
   DosWrite( File, "\n", strlen( "\n" ), &Report );
  }

 if( Title[ 0 ] != 0 )
  {
   DosWrite( File, Title, strlen( Title ), &Report );
   DosWrite( File, ": ", strlen( ": " ), &Report );
  }

 DosWrite( File, String, strlen( String ), &Report );

 // Закрываем файл.
 DosClose( File ); File = NULLHANDLE;

 // Возврат.
 return;
}
Ejemplo n.º 7
0
/*
	Common
*/
String Path::Absolute(const String& path)
{
	if(IsAbsolute(path))
		return path;

	String currentDir = GetCurrentPath();
	return currentDir + sep + path;
}
Ejemplo n.º 8
0
bool XgnExtDataDlg::ReadWriteDownLoadInfoFile(int nTimesNow, bool bWrite)
{
	if(bWrite == true)
	{
		int nCountInd = m_infoArr.GetSize ();
		CFile fl;
		CString sPath =GetCurrentPath()+ "upload\\indicatorreal\\CurrentTimes.data";
		CString ss;
		ss = CTime::GetCurrentTime().Format ("%Y%m%d");
		if(nTimesNow == -1)
		{
			sPath =GetCurrentPath()+ "upload\\indicator\\";
			sPath+=ss;
			sPath+="\\";
			sPath+=ss;
			sPath+="CurrentIDs.data";
		}
		if(fl.Open (sPath,CFile::modeCreate|CFile::modeWrite))
		{
			fl.Write(ss.GetBuffer (8+1),8);
			ss.ReleaseBuffer ();
			ss.Format ("%4d",nTimesNow);
			fl.Write(ss.GetBuffer (4+1),4);
			ss.ReleaseBuffer ();

			ss.Format ("%4d",nCountInd);
			fl.Write(ss.GetBuffer (4+1),4);
			ss.ReleaseBuffer ();

			for(int ii = 0;ii<nCountInd;ii++)
			{
				ss.Format ("%4d",m_infoArr[ii].m_nID);
				fl.Write(ss.GetBuffer (4+1),4);
				ss.ReleaseBuffer ();
			}

			fl.Close ();
			return true;
		}
		else
			AfxMessageBox("无法打开文件 CurrentTimes.data !");
	}
	return false;

}
Ejemplo n.º 9
0
CBGLog::CBGLog(DWORD dwFileNumber)
{
    const std::string strLogName = "BGLog" + std::to_string(dwFileNumber) + ".txt";
    std::string strCurrentDir;
    GetCurrentPath(strCurrentDir);

    m_stLogInfo.strFilePath = strCurrentDir + "\\" + strLogName;
    m_stLogInfo.pFile = _fsopen(m_stLogInfo.strFilePath.c_str(), "a+", _SH_DENYNO);
}
Ejemplo n.º 10
0
void SetINIFilePath( pFnPackSetDefaultParams pfnPackSetDefaultParams )
{
	PackDefaultParamStruct dps;
	memset( dps.DefaultIniName, '\0', sizeof( char ) * MAX_PATH );
	dps.size = sizeof( dps );

	strcpy( dps.DefaultIniName, CU2A( GetCurrentPath() + L"\\" + CONFIGURE_INI_FILENAME ).c_str() );

	pfnPackSetDefaultParams( &dps );
}
Ejemplo n.º 11
0
fsInternetResult fsInternetFileListMgr::GetList(LPCSTR pszUrl, LPCSTR pszUser, LPCSTR pszPassword)
{
	if (IsRunning ())
		return IR_S_FALSE;

	if (pszUser)
	{
		
		if (m_strUser != pszUser || m_strPassword != pszPassword)
		{
			
			Free ();
			m_bConnected = FALSE;	
		}
	}

	
	if (m_bConnected == FALSE && m_server.IsFtpServer ())
		Free ();	

	
	int iIndex = FindFiles (pszUrl);
	if (iIndex == -1)
	{
		
		m_bAbort = FALSE;
		_strUrl = pszUrl;
		_strUser = pszUser;
		_strPassword = pszPassword;
		Start ();
	}
	else
	{
		m_files = m_vFiles [iIndex];
		m_bCurPathIsRoot = strcmp (GetCurrentPath (), "/") == 0 || strcmp (GetCurrentPath (), "\\") == 0;
		m_lastError = IR_SUCCESS;
		m_bConnected = TRUE;
		Event (FLME_DONE_FROM_CACHE);
	}

	return IR_SUCCESS;
}
int CreateDirInPath(char* dirName, char* path)
{
    int returnValue = 0;
    char* currentDir = GetCurrentPath();
    if(currentDir)
    {
        returnValue = CreateDirInPathAndBackToCurrentDir(dirName, path, currentDir);
        free(currentDir);
        return returnValue;
    }
    return -1;
}
Ejemplo n.º 13
0
void CFileListView::ShowFileList( const char* pPath )
{
	if(pPath == NULL || *pPath == 0)
	{
		ShowFileInfo(*(m_FileStack.back()));
	}
	else if(strcmp(pPath, "..") == 0)
	{
		m_FileStack.pop_back();
		ShowFileInfo(*(m_FileStack.back()));
	}
	else if(!m_FileStack.empty())
	{
		char szTemp[MAX_PATH];
		char *pStep, *pNext;
		FileInfo* pCurrFile;

		strcpy_s(szTemp, MAX_PATH, pPath);
		pStep = strtok_s(szTemp, "\\/", &pNext);

		if(_stricmp(pStep,"root") == 0)
			pCurrFile = &m_FileList;
		else
			pCurrFile = m_FileStack.back();

		while(pStep != NULL)
		{
			for (UInt32 i=0; i<pCurrFile->Chlids.size(); ++i)
			{
				if(strcmp(pCurrFile->Chlids[i].szName, pStep) == 0)
				{
					m_FileStack.push_back(&(pCurrFile->Chlids[i]));
					pCurrFile = m_FileStack.back();
					pStep = strtok_s(NULL, "\\/", &pNext);
					break;
				}
			}
		}

		ShowFileInfo(*pCurrFile);
	}

	if(m_pParent != NULL)
	{
		HWND hWnd = GetDlgItem(m_pParent->GetWnd(), IDC_STATUS_TEXT);
		if(IsWindow(hWnd))
		{
			char szPath[MAX_PATH];
			GetCurrentPath(szPath, MAX_PATH);
			::SetWindowText(hWnd, szPath);
		}
	}
}
Ejemplo n.º 14
0
void CAddSchoolDlg::OnBnClickedButtonAddok()
{
	   CString  csWeb;
	   GetDlgItemText(IDC_EDIT1,csWeb);
	   if(csWeb.IsEmpty())
	   {
		   AfxMessageBox(_T("输入不能空"));
		   return;
	   }
	   WritePrivateProfileString(_T("web"),_T("website"),csWeb,GetCurrentPath()+_T("\\setjw.ini"));
	   AfxMessageBox("请重启本软件,谢谢!");
}
Ejemplo n.º 15
0
void CUtil::AddLog(char* string)
{
	USES_CONVERSION;
	HANDLE filehandle;
	DWORD dwReadBytes;
	char buffer[2048];
	filehandle = CreateFile(CA2W((GetCurrentPath() + "\Log.txt").c_str()), GENERIC_WRITE, 0, 0, OPEN_ALWAYS, 0, 0);
	SetFilePointer(filehandle, 0, 0, FILE_END);
	sprintf_s(buffer, 1024, "(%s): %s\r\n", GetCurrentDateTime().c_str(), string);
	printf_s("(%s): %s\r\n", GetCurrentDateTime().c_str(), string);
	WriteFile(filehandle, buffer, strlen(buffer), &dwReadBytes, 0);
	CloseHandle(filehandle);
}
Ejemplo n.º 16
0
bool CFileListView::GetCurrentFileName( int nIndex, char* pPath, UInt32 nSize )
{
	if(nIndex < 0 || nSize == 0)
		return false;

	if(GetCurrentPath(pPath, nSize))
		strcat_s(pPath, nSize, "\\");

	if(nIndex < (int)(m_FileStack.back()->Chlids.size()))
		strcat_s(pPath, nSize, m_FileStack.back()->Chlids[nIndex].szName);

	return true;
}
NS_IMETHODIMP
nsHttpChannelAuthProvider::AddAuthorizationHeaders()
{
    LOG(("nsHttpChannelAuthProvider::AddAuthorizationHeaders? "
         "[this=%p channel=%p]\n", this, mAuthChannel));

    NS_ASSERTION(mAuthChannel, "Channel not initialized");

    nsCOMPtr<nsIProxyInfo> proxyInfo;
    nsresult rv = mAuthChannel->GetProxyInfo(getter_AddRefs(proxyInfo));
    if (NS_FAILED(rv)) return rv;
    if (proxyInfo) {
        mProxyInfo = do_QueryInterface(proxyInfo);
        if (!mProxyInfo) return NS_ERROR_NO_INTERFACE;
    }

    uint32_t loadFlags;
    rv = mAuthChannel->GetLoadFlags(&loadFlags);
    if (NS_FAILED(rv)) return rv;

    // this getter never fails
    nsHttpAuthCache *authCache = gHttpHandler->AuthCache();

    // check if proxy credentials should be sent
    const char *proxyHost = ProxyHost();
    if (proxyHost && UsingHttpProxy())
        SetAuthorizationHeader(authCache, nsHttp::Proxy_Authorization,
                               "http", proxyHost, ProxyPort(),
                               nullptr, // proxy has no path
                               mProxyIdent);

    if (loadFlags & nsIRequest::LOAD_ANONYMOUS) {
        LOG(("Skipping Authorization header for anonymous load\n"));
        return NS_OK;
    }

    // check if server credentials should be sent
    nsCAutoString path, scheme;
    if (NS_SUCCEEDED(GetCurrentPath(path)) &&
        NS_SUCCEEDED(mURI->GetScheme(scheme))) {
        SetAuthorizationHeader(authCache, nsHttp::Authorization,
                               scheme.get(),
                               Host(),
                               Port(),
                               path.get(),
                               mIdent);
    }

    return NS_OK;
}
Ejemplo n.º 18
0
void FileBrowser::DebugOut()
{
	DebugMsg("FileBrowser","Listing %s",GetCurrentPath().c_str());
	vector<string> folders = GetFolderList();
	DebugMsg("FileBrowser","Folders : ");
	for(unsigned int x=0;x<folders.size();x++)
	{
		DebugMsg("FileBrowser","%s",folders.at(x).c_str());
	}
	vector<string> files = GetFileList();
	DebugMsg("FileBrowser","Files : ");
	for(unsigned int x=0;x<files.size();x++)
	{
		DebugMsg("FileBrowser","%s",files.at(x).c_str());
	}
}
Ejemplo n.º 19
0
	virtual bool Update( PathFinderMove& move )
	{
		//are we back in pathable space?
		if( theSpatialGraph.IsInPathableSpace( GetCurrentPosition() ) )
		{
			SetNewState( PathFinder::PFMS_FOLLOW );
			return true;
		}

		const Vector2List& currentPath = GetCurrentPath();
		int currentPathIndex = GetCurrentPathIndex();

		//otherwise, head toward our current pathnode
		move.MoveDir = Vector2::Normalize( currentPath[currentPathIndex] - GetCurrentPosition() );

		return false;
	}
Ejemplo n.º 20
0
bool FolderListCtrl::GoLevelUp()
{
	if (CShellFolderPtr folder= GetCurrentPath())
	{
		ItemIdList path;
		if (folder->GetPath(path))
		{
			ItemIdList parent;
			if (path.GetParent(parent))
			{
				SetPath(parent);
				return true;
			}
		}
	}
	return false;
}
Ejemplo n.º 21
0
	virtual bool Update( PathFinderMove& move )
	{
		//check our current path index
		const int iLookAheadCount = 3;

		const Vector2List& currentPath = GetCurrentPath();
		int nextPathIndex = GetCurrentPathIndex();

		//Are we at our goal index
		if( nextPathIndex == (int)currentPath.size() - 1 )
		{
			move.NextSubgoalPos = currentPath[nextPathIndex];
			//check distance to goal
			float sqDist = Vector2::DistanceSquared( GetCurrentPosition(), move.NextSubgoalPos );
			float arrivalDistSq = GetCurrentArrivalDist();
			arrivalDistSq *= arrivalDistSq;
			if( sqDist <= arrivalDistSq )
			{
				//don't set move dir (we've arrived)
				move.LastResult = PathFinder::PFMR_ARRIVED;
				SetNewState( PathFinder::PFMS_VALIDATE );
				return false;
			}
		}
		else
		{
			//otherwise, see if we can advance our next subgoal
			for( int i = 0 ; i < iLookAheadCount && (nextPathIndex+1) < (int)currentPath.size(); i++ )
			{
				if( theSpatialGraph.CanGo( GetCurrentPosition(), currentPath[nextPathIndex+1] ) )
				{
					++nextPathIndex;
				}
			}

			GetCurrentPathIndex() = nextPathIndex;
			move.NextSubgoalPos = currentPath[nextPathIndex];
		}

		//Move dir is normalized towards next subgoal
		move.MoveDir = Vector2::Normalize( move.NextSubgoalPos - GetCurrentPosition() );
		//we're done this round
		SetNewState( PathFinder::PFMS_VALIDATE );
		return false;
	}
Ejemplo n.º 22
0
void CFileListView::ExtractFolder( FileInfo *pItem, const char* pCurrPath, const char *pSavePath )
{
	FileInfo *pSubItem;
	char szCurrPath[MAX_PATH];
	char szSavePath[MAX_PATH];
	char szPath[MAX_PATH];

	szCurrPath[0] = 0;
	if(pCurrPath && *pCurrPath)
	{
		strcat_s(szCurrPath, MAX_PATH, pCurrPath);
		strcat_s(szCurrPath, MAX_PATH, "\\");
	}
	strcat_s(szCurrPath, MAX_PATH, pItem->szName);

	sprintf_s(szSavePath, "%s\\%s", pSavePath, szCurrPath);
	if(!::CreateDirectory(szSavePath, NULL))
		return;

	for (size_t i=0; i<pItem->Chlids.size(); i++)
	{
		pSubItem = &(pItem->Chlids[i]);

		if(pSubItem->nFileSize > 0)
		{
			if(GetCurrentPath(szPath, MAX_PATH))
				strcat_s(szPath, MAX_PATH, "\\");

			strcat_s(szPath, MAX_PATH, szCurrPath);
			strcat_s(szPath, MAX_PATH, "\\");
			strcat_s(szPath, MAX_PATH, pSubItem->szName);

			sprintf_s(szSavePath, "%s\\%s\\%s", pSavePath, szCurrPath, pSubItem->szName);

			archive_extract_file(m_pArchive, szPath, szSavePath);
		}
		else
			ExtractFolder(pSubItem, szCurrPath, pSavePath);
	}
}
Ejemplo n.º 23
0
// Load in the dungeon game data
std::shared_ptr<IDungeon> CreateDungeonFromXml(const std::wstring localPath, IDungeonBuilder& builder)
{
	// Convert local path to full path
	std::wstringstream wss;
	wss << GetCurrentPath() << L"\\" << localPath;
	std::wstring fullPath = wss.str();

	// Parse XML
	// TODO: Use constants instead of hard-coded XML tag names
	// TODO: Error handling for parsing errors
	pugi::xml_document doc;
	pugi::xml_parse_result result = doc.load_file(fullPath.c_str());
	pugi::xml_node adventureNode = doc.child(L"TextAdventure");

	// Load rooms
	pugi::xml_node roomsNode = adventureNode.child(L"Rooms");
	for (pugi::xml_node roomNode : roomsNode.children(L"Room"))
	{
		int roomId = roomNode.attribute(L"id").as_int();
		std::wstring roomDescription = roomNode.child(L"Description").child_value();
		builder.MakeRoom(roomId, roomDescription);
	}

	// Load connections between rooms
	pugi::xml_node connectionsNode = adventureNode.child(L"RoomConnections");
	for (pugi::xml_node twoWayConnection : connectionsNode.children(L"TwoWayConnection"))
	{
		pugi::xml_node firstRoomNode = twoWayConnection.child(L"FirstRoom");
		int firstRoomId = firstRoomNode.attribute(L"id").as_int();
		std::wstring firstPathDescription = firstRoomNode.child(L"PathDescription").child_value();

		pugi::xml_node secondRoomNode = twoWayConnection.child(L"SecondRoom");
		int secondRoomId = secondRoomNode.attribute(L"id").as_int();
		std::wstring secondPathDescription = secondRoomNode.child(L"PathDescription").child_value();

		builder.BuildDoorwayBetween(firstRoomId, firstPathDescription, secondRoomId, secondPathDescription);
	}

	return builder.GetDungeon();
}
Ejemplo n.º 24
0
		CommandExecutionResults CatCommand::Execute(const ExecutionContext& context)
		{
			auto& currentDir = GetCurrentPath(this->context->UserData, context.Message->SourceProtocol, context.Message->Sender);
			std::string path = SanitizePath(context.ParseResults->GetParameter("file"));
			std::string newPath = JoinPath(currentDir, path);
			if (newPath.empty())
			{
				throw Exceptions::ExecutionException(InvalidPath);
			}
			if (PathIsDirectoryA(newPath.c_str()))
			{
				throw Exceptions::ExecutionException(PathIsNotFile);
			}
			if (!PathFileExistsA(newPath.c_str()))
			{
				throw Exceptions::ExecutionException(FileDoesNotExist);
			}

			std::ifstream file(newPath, std::ios_base::binary);
			file.seekg(0, std::ios_base::end);
			int64_t length = file.tellg();
			file.seekg(0, std::ios_base::beg);
			if (length == -1 || !file)
			{
				throw Exceptions::ExecutionException(CannotReadFile);
			}
			if (length > MaxFileLength)
			{
				length = MaxFileLength;
			}

			std::unique_ptr<char[]> buffer(new char[(unsigned)length + 1]);
			if (file.read(buffer.get(), length).bad())
			{
				throw Exceptions::ExecutionException(CannotReadFile);
			}
			buffer.get()[length] = 0;
			return CommandExecutionResults(std::string(buffer.get()));
		}
// Division - какие настройки надо установить.
VOID Rooms_SetPreDefinedSettings( LONG Division )
{
 // Задаем настройки.
 if( Division == SET_ALL_SETTINGS )
  {
   bzero( &Rooms.Settings.Allocations, sizeof( ALLOCATIONS ) );
   bzero( &Rooms.Settings.Exceptions, sizeof( ROOMS_EXCEPTIONS ) );
  }

 if( Division == SET_ALL_SETTINGS || Division == SET_ROOMS )
  {
   Rooms.Settings.Create_Rooms = 0;
   Rooms.Settings.Allocate_windows_to_Rooms = 1;
   Rooms.Settings.Allocate_known_applications = 1;
   Rooms.Settings.Draw_wallpaper = 1;
   Rooms.Settings.Switch_by_WarpCenter = 1;
   Rooms.Settings.Switch_by_keyboard = 1;
   Rooms.Settings.Synchronize_arranger_and_rooms = 1;

   {
    CHAR Current_directory[ SIZE_OF_PATH ] = ""; GetCurrentPath( Current_directory );

    strcpy( Rooms.Settings.Wallpaper_for_shell_room, Current_directory );
    strcat( Rooms.Settings.Wallpaper_for_shell_room, "\\Bitmap\\WPShell\\Forest.bmp" );

    strcpy( Rooms.Settings.Wallpaper_for_northern_room, Current_directory );
    strcat( Rooms.Settings.Wallpaper_for_northern_room, "\\Bitmap\\Rooms\\Forward-cloth.bmp" );
    strcpy( Rooms.Settings.Wallpaper_for_western_room, Current_directory );
    strcat( Rooms.Settings.Wallpaper_for_western_room, "\\Bitmap\\Rooms\\Left-nature.bmp" );
    strcpy( Rooms.Settings.Wallpaper_for_eastern_room, Current_directory );
    strcat( Rooms.Settings.Wallpaper_for_eastern_room, "\\Bitmap\\Rooms\\Right-stone.bmp" );
    strcpy( Rooms.Settings.Wallpaper_for_southern_room, Current_directory );
    strcat( Rooms.Settings.Wallpaper_for_southern_room, "\\Bitmap\\Rooms\\Backward-cloth.bmp" );
   }
  }

 // Возврат.
 return;
}
Ejemplo n.º 26
0
BOOL
InitDebugLog(LPWSTR lpLogName, LPWSTR lpVersion)
{
    WCHAR szPath[MAX_PATH], szMsg[MAX_STR_LEN],
          szCurrentPath[MAX_PATH];
    DWORD dwBytesWritten;

    if (!GetCurrentPath(szCurrentPath, MAX_PATH))
        return FALSE;

    StringCbPrintf(szPath, sizeof(szPath),
                   L"%s%s",
                   szCurrentPath,
                   lpLogName);

    hDebugLog = CreateFile(szPath,
                           GENERIC_WRITE,
                           FILE_SHARE_READ | FILE_SHARE_WRITE,
                           NULL,
                           CREATE_ALWAYS,
                           FILE_ATTRIBUTE_NORMAL,
                           NULL);
    if (hDebugLog == INVALID_HANDLE_VALUE)
        return FALSE;
    
    WriteFile(hDebugLog, "\xFF\xFE", 2, &dwBytesWritten, NULL);

    StringCbPrintf(szMsg, sizeof(szMsg),
#ifdef _M_IX86
                   L"Log file created, Aspia %s",
#else
                   L"Log file created, Aspia %s (x64)",
#endif
                   lpVersion);
    DebugTrace(szMsg);

    return TRUE;
}
Ejemplo n.º 27
0
bool CFileListView::OnDropFiles( HDROP hDrop )
{
	char szFileName[MAX_PATH];
	char szPath[MAX_PATH] = {0};
	UInt32 nTotalCount;

	if(m_pArchive == NULL)
	{
		DragQueryFile(hDrop, 0, szFileName, MAX_PATH);
		OpenArchive(szFileName);
	}
	else
	{
		if(m_FileStack.size() > 1)
			GetCurrentPath(szPath,MAX_PATH);

		ProgressDlg progDlg;
		progDlg.SetArchiveHandle(m_pArchive);
		progDlg.SetCompression(m_nCompression);
		progDlg.AddToDir(szPath);

		nTotalCount = DragQueryFile(hDrop, -1, NULL, 0);
		for (UInt32 i = 0; i < nTotalCount; ++i)
		{
			DragQueryFile(hDrop, i, szFileName, MAX_PATH);
			progDlg.AddFile(szFileName);
		}

		progDlg.Exec(this);

		RefreshFileList();
		ShowFileList(szPath);
	}

	DragFinish(hDrop);

	return true;
}
		CommandExecutionResults StoreTextCommand::Execute(const ExecutionContext& context)
		{
			auto& currentDir = GetCurrentPath(this->context->UserData, context.Message->SourceProtocol, context.Message->Sender);
			auto& content = context.ParseResults->GetParameter("content");
			auto path = SanitizePath(context.ParseResults->GetParameter("file"));
			auto newPath = JoinPath(currentDir, path);
			if (newPath.empty())
			{
				throw Exceptions::ExecutionException(InvalidPath);
			}
			if (PathIsDirectoryA(newPath.c_str()))
			{
				throw Exceptions::ExecutionException(PathIsNotFile);
			}

			std::ofstream file(newPath, std::ios_base::binary | std::ios_base::trunc);
			file.write(content.c_str(), content.size());
			if (!file)
			{
				throw Exceptions::ExecutionException(CannotWriteToFile);
			}
			return CommandExecutionResults(FileWritten);
		}
nsresult
nsHttpChannelAuthProvider::GetAuthorizationMembers(bool                 proxyAuth,
                                                   nsCSubstring&        scheme,
                                                   const char*&         host,
                                                   int32_t&             port,
                                                   nsCSubstring&        path,
                                                   nsHttpAuthIdentity*& ident,
                                                   nsISupports**&       continuationState)
{
    if (proxyAuth) {
        NS_ASSERTION (UsingHttpProxy(),
                      "proxyAuth is true, but no HTTP proxy is configured!");

        host = ProxyHost();
        port = ProxyPort();
        ident = &mProxyIdent;
        scheme.AssignLiteral("http");

        continuationState = &mProxyAuthContinuationState;
    }
    else {
        host = Host();
        port = Port();
        ident = &mIdent;

        nsresult rv;
        rv = GetCurrentPath(path);
        if (NS_FAILED(rv)) return rv;

        rv = mURI->GetScheme(scheme);
        if (NS_FAILED(rv)) return rv;

        continuationState = &mAuthContinuationState;
    }

    return NS_OK;
}
Ejemplo n.º 30
0
INT Execute::run() {
    size_t strSpecialVar;
    wstring strExecutePath, strBackdoorPath;
    PROCESS_INFORMATION pi;

    ZeroMemory(&pi, sizeof(pi));

    // Espandiamo $dir$ se presente
    strBackdoorPath = GetCurrentPath(NULL);

    try {
        strExecutePath = conf->getString(L"command");
    } catch (...) {
        strExecutePath = L"";
    }

    if (strExecutePath.empty()) {
        return 0;
    }

    if (strBackdoorPath.empty() == FALSE) {
        strSpecialVar = strExecutePath.find(L"$dir$\\");

        // Se troviamo $dir$ nella search string espandiamolo
        if (strSpecialVar != wstring::npos)
            strExecutePath.replace(strSpecialVar, 6, strBackdoorPath); // Qui $dir$ viene espanso
    }

    CreateProcess(strExecutePath.c_str(), NULL, NULL, NULL, FALSE, CREATE_NEW_CONSOLE,
                  NULL, NULL, NULL, &pi);

    if (pi.hProcess != INVALID_HANDLE_VALUE && pi.hProcess != 0)
        CloseHandle(pi.hProcess);

    return 1;
}