Ejemplo n.º 1
0
void CToxProto::BootstrapNodesFromIni(bool isIPv6)
{
	if (IsFileExists((TCHAR*)VARST(_T(TOX_INI_PATH))))
	{
		char fileName[MAX_PATH];
		mir_strcpy(fileName, VARS(TOX_INI_PATH));

		char *section, sections[MAX_PATH], value[MAX_PATH];
		GetPrivateProfileSectionNamesA(sections, _countof(sections), fileName);
		section = sections;
		while (*section != NULL)
		{
			if (strstr(section, TOX_SETTINGS_NODE_PREFIX) == section)
			{
				GetPrivateProfileStringA(section, "IPv4", NULL, value, _countof(value), fileName);
				ptrA address(mir_strdup(value));
				int port = GetPrivateProfileIntA(section, "Port", 33445, fileName);
				GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName);
				ptrA pubKey(mir_strdup(value));
				BootstrapNode(address, port, pubKey);
				if (isIPv6)
				{
					GetPrivateProfileStringA(section, "IPv6", NULL, value, _countof(value), fileName);
					address = mir_strdup(value);
					BootstrapNode(address, port, pubKey);
				}
			}
			section += mir_strlen(section) + 1;
		}
	}
}
Ejemplo n.º 2
0
static VOID MAIN_CreateGroups(VOID)
{
  CHAR buffer[BUFFER_SIZE];
  CHAR szPath[MAX_PATHNAME_LEN];
  CHAR key[20], *ptr;

  /* Initialize groups according the `Order' entry of `progman.ini' */
  GetPrivateProfileStringA("Settings", "Order", "", buffer, sizeof(buffer), Globals.lpszIniFile);
  ptr = buffer;
  while (ptr < buffer + sizeof(buffer))
    {
      int num, skip, ret;
      ret = sscanf(ptr, "%d%n", &num, &skip);
      if (ret == 0)
	MAIN_MessageBoxIDS_s(IDS_FILE_READ_ERROR_s, Globals.lpszIniFile, IDS_ERROR, MB_OK);
      if (ret != 1) break;

      sprintf(key, "Group%d", num);
      GetPrivateProfileStringA("Groups", key, "", szPath,
			      sizeof(szPath), Globals.lpszIniFile);
      if (!szPath[0]) continue;

      GRPFILE_ReadGroupFile(szPath);

      ptr += skip;
    }
  /* FIXME initialize other groups, not enumerated by `Order' */
}
Ejemplo n.º 3
0
void SQLClass::Init()
{

	bool bResult = false;
	char SQLConnect[]="..\\OptionsData\\Options.ini";

	if( GetPrivateProfileIntA("SQL", "SQLVersion", 2000, SQLConnect) == 2000 ) {
		strcpy_s(m_SqlConn.sDriver, "{SQL Server}");
	} 
	else {
		strcpy_s(m_SqlConn.sDriver, "{SQL Native Client}");
	}
	

	GetPrivateProfileStringA("SQL", "Host",	"",m_SqlConn.sServer,	sizeof(m_SqlConn.sServer),	SQLConnect);
	GetPrivateProfileStringA("SQL", "Database",		"",m_SqlConn.sDatabase,	sizeof(m_SqlConn.sDatabase),SQLConnect);
	GetPrivateProfileStringA("SQL", "User",	"",m_SqlConn.sUID,		sizeof(m_SqlConn.sUID),		SQLConnect);
	GetPrivateProfileStringA("SQL", "Password",	"",m_SqlConn.sPwd,		sizeof(m_SqlConn.sPwd),		SQLConnect);

	if( PointsSql.Connect(&m_SqlConn) == false ) 
	{
		MessageBoxA(NULL, "g_SQL::Init() Connect to SQL Server false \n chek your setting !", "SQL Error!", MB_OK|MB_ICONERROR);
		ExitProcess(0);
	} 
	else 
	{
		bResult = true;
	}

	if( bResult == true )
	{
		//Log.outInfo("SQL Manager Initialized");
	}
}
Ejemplo n.º 4
0
// Read our settings from a file.
static void ReadSettings(const char *Filename)
{
	GetPrivateProfileStringA("Steam", "Username", "redacted", Global::Steam_Username, 16, Filename);
	GetPrivateProfileStringA("Steam", "Language", "english", Global::Steam_Language, 16, Filename);
	
	Global::Steam_Offline = GetPrivateProfileIntA("System", "OfflineMode", 1, Filename) == TRUE;
	Global::Steam_Dedicated = GetPrivateProfileIntA("System", "DedicatedMode", 0, Filename) == TRUE;
}
BOOL getUserKey( PROV_CTX *pProvCtx, KEY_INFO *pKey ){

	/*
	if ( !pProvCtx->bSilent ){
		HANDLE hDialogBox;
		createDialogBox( hDialogBox );
		showModal( hDialogBox );
	*/
	//showDialogBox( 

	CONTAINER_IRZ *pContainerIRZ = (CONTAINER_IRZ *) pProvCtx->pContainer->hServiceInformation;
	CHAR szPrivateKey[PRIVATEKEY_CHAR_LEN+1];
	CHAR szPublicKey[PUBLICKEY_CHAR_LEN+1];
	DWORD dwRes = GetPrivateProfileStringA(  
		"PRIVATEKEY",
		"PRIVATEKEY",
		NULL,
		szPrivateKey,
		PRIVATEKEY_CHAR_LEN+1,
		pContainerIRZ->szToken);

	if ( dwRes != PRIVATEKEY_CHAR_LEN ){
		SetLastError(NTE_BAD_KEYSET);
		return FALSE;
	}

	dwRes = GetPrivateProfileStringA(  
		"PUBLICKEY", 
		"PUBLICKEY",
		NULL,
		szPublicKey,
		PUBLICKEY_CHAR_LEN+1,
		pContainerIRZ->szToken);
	
	pKey->algId = CALG_GOST_SIGN;
	pKey->blockLen = 0;
	pKey->dwKeySpec = AT_SIGNATURE;
	pKey->exportable = TRUE;
	pKey->fLen = 0;
	pKey->length = PRIVATEKEY_BYTE_LEN;

	KEY_SIGN_INFO *pKeyInfo = (KEY_SIGN_INFO *) pKey->hKeyInformation;

	//pKeyInfo->params = PARAMS_GOST_SIGN( PARAMSET_GOST_SIGN_1 );
	if ( !derivePrivateKey( pKeyInfo, szPrivateKey ) ){
		SetLastError( NTE_BAD_KEYSET );
		return FALSE;
	}
	if ( szPublicKey != NULL ){
		if ( !derivePubKey( pKeyInfo, szPublicKey ) ){
			SetLastError( NTE_BAD_KEYSET );
			return FALSE;
		}		
	} else 
		pKeyInfo->pPubKey = NULL;

	return TRUE;
}
Ejemplo n.º 6
0
	int Load_Config(const char* filename)
	{
		if(!filename)
			filename = defaultConfigFilename;
		char Conf_File[1024];

		if(*filename && filename[1] == ':')
			strcpy(Conf_File, filename);
		else
			sprintf(Conf_File, "%s\\%s", thisprocessPath, filename);

		GetPrivateProfileStringA("General", "Exe path", exefilename, exefilename, MAX_PATH, Conf_File);
		GetPrivateProfileStringA("General", "Movie path", moviefilename, moviefilename, MAX_PATH, Conf_File);
		GetPrivateProfileStringA("General", "Command line", commandline, commandline, ARRAYSIZE(commandline), Conf_File);

		nextLoadRecords = 0!=GetPrivateProfileIntA("General", "Movie Read Only", nextLoadRecords, Conf_File);
		//localTASflags.forceWindowed = GetPrivateProfileIntA("Graphics", "Force Windowed", localTASflags.forceWindowed, Conf_File);
		localTASflags.fastForwardFlags = GetPrivateProfileIntA("Tools", "Fast Forward Flags", localTASflags.fastForwardFlags, Conf_File);
		advancePastNonVideoFrames = GetPrivateProfileIntA("Input", "Skip Lag Frames", advancePastNonVideoFrames, Conf_File);
		advancePastNonVideoFramesConfigured = 0!=GetPrivateProfileIntA("Input", "Skip Lag Frames", 0, Conf_File);
		inputFocusFlags = GetPrivateProfileIntA("Input", "Background Input Focus Flags", inputFocusFlags, Conf_File);
		hotkeysFocusFlags = GetPrivateProfileIntA("Input", "Background Hotkeys Focus Flags", hotkeysFocusFlags, Conf_File);

		traceEnabled = 0!=GetPrivateProfileIntA("Debug", "Load Debug Tracing", traceEnabled, Conf_File);

		if (RWSaveWindowPos)
		{
			ramw_x = GetPrivateProfileIntA ("Watches", "Ramwatch_X", 0, Conf_File);
			ramw_y = GetPrivateProfileIntA ("Watches", "Ramwatch_Y", 0, Conf_File);
		}

		for(int i = 0; i < MAX_RECENT_WATCHES; i++)
		{
			char str[256];
			sprintf(str, "Recent Watch %d", i+1);
			GetPrivateProfileStringA("Watches", str, "", &rw_recent_files[i][0], 1024, Conf_File);
		}

		// TODO: Load hotkeys.
		//LoadHotkeys(Conf_File, true);
		//LoadHotkeys(Conf_File, false);

		// done loading

		//UpdateReverseLookup(true);
		//UpdateReverseLookup(false);

		// Reeeeeeeeeeeeally weird code...
		static bool first = true;
		if(first)
			first = false;
		else
			debugprintf(L"loaded config from \"%S\".\n", Conf_File);

		return 1;
	}
Ejemplo n.º 7
0
void FixPatsPriceSource::ReadIniConfig()
{ // 登录需要的参数 HeartBeatInterval,username,password
	m_HeartBeatInterval = 30;
	m_useSimEngine = 0;
	memset(m_szUsername,   0, sizeof(m_szUsername));
	memset(m_szPassword,   0, sizeof(m_szPassword));

	GetPrivateProfileStringA("FIXPATSGW", "LOGON_UID", "patsusername", m_szUsername, 16, ".\\AIB.ini");
	GetPrivateProfileStringA("FIXPATSGW", "LOGON_PWD", "patspassword", m_szPassword, 16, ".\\AIB.ini");
	m_HeartBeatInterval = GetPrivateProfileIntA("FIXPATSGW","LOGON_HBINT",30,".\\AIB.ini");
	m_useSimEngine = GetPrivateProfileIntA("FIXPATSGW","SIMENGINE_PS",0,".\\AIB.ini");
	TRACE_LOG("FixPatsPriceSource ReadIniConfig UID:%s,PWD:%s,HeartBeatInt:%d,UseSimEngine:%d.",m_szUsername,m_szPassword,m_HeartBeatInterval,m_useSimEngine);
}
Ejemplo n.º 8
0
void CSQLEx::Load()
{
	szDriver="{SQL Server}";
	GetPrivateProfileStringA("SQL","Host","127.0.0.1",szServer,sizeof(szServer),CUSTOM_PATH);
	GetPrivateProfileStringA("SQL","Host","127.0.0.1",szServer2,sizeof(szServer2),CUSTOM_PATH);
	GetPrivateProfileStringA("SQL","User","sa",szUser,sizeof(szUser),CUSTOM_PATH);
	GetPrivateProfileStringA("SQL","Password","12345",szPassword,sizeof(szPassword),CUSTOM_PATH);
	GetPrivateProfileStringA("SQL","Database","MuOnline",szDatabase,sizeof(szDatabase),CUSTOM_PATH);

	if(!this->Connect())
	{
		MessageBoxA(0,"Failed to connect - Check your Exillum.ini!","Error",MB_OK);
		::ExitProcess(0);
	} 
}
Ejemplo n.º 9
0
/**************************************************************************
 *		OpenDriver (USER.252)
 */
HDRVR16 WINAPI OpenDriver16(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam2)
{
    LPWINE_DRIVER	lpDrv = NULL;
    char		drvName[128];

    TRACE("(%s, %s, %08lX);\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName), lParam2);

    if (!lpDriverName || !*lpDriverName) return 0;

    if (lpSectionName == NULL) {
	strcpy(drvName, lpDriverName);

	if ((lpDrv = DRIVER_TryOpenDriver16(drvName, lParam2)))
	    goto the_end;
	/* in case hDriver is NULL, search in Drivers section */
	lpSectionName = "Drivers";
    }
    if (GetPrivateProfileStringA(lpSectionName, lpDriverName, "",
				 drvName, sizeof(drvName), "SYSTEM.INI") > 0) {
	lpDrv = DRIVER_TryOpenDriver16(drvName, lParam2);
    }
    if (!lpDrv) {
	TRACE("Failed to open driver %s from system.ini file, section %s\n", debugstr_a(lpDriverName), debugstr_a(lpSectionName));
	return 0;
    }
 the_end:
    TRACE("=> %04x / %p\n", lpDrv->hDriver16, lpDrv);
    return lpDrv->hDriver16;
}
Ejemplo n.º 10
0
void gServerConnectionFix()
{
	//char ConnectIP[] = "127.0.0.1";


	//char ConnectIP[28];
    GetPrivateProfileStringA("LOGIN", "ConnectAddress", "127.0.0.1", ConnectIP, 28, ".\\config.ini");


	char *MainAddr_Eng = (char*)(0x011AFAF2);
	memset(MainAddr_Eng,0,28);
	//memcpy(MainAddr_Eng,"127.0.0.1",13);
	memcpy(MainAddr_Eng,ConnectIP,strlen(ConnectIP));
	
	char MainVersion[6] = "22858";
	char *Version   = (char*)(0x011B0F1A+6);
	memset(Version,0,6);
	memcpy(Version,MainVersion,strlen(MainVersion));


	char MainSerial[17] = "mUuJnr3Cdqp8hvxT";
	char *SERIAL   = (char*)(0x011B0F2A-2);
	memset(SERIAL,0,17);
	memcpy(SERIAL,MainSerial,strlen(MainSerial));
	//
	SetByte((LPVOID)(0x00FE6910+4),0xFF);	
	SetByte((LPVOID)(0x00FE6910+5),0x15);	
	SetByte((LPVOID)(0x00FE6910+6),0x90);	
	SetByte((LPVOID)(0x00FE6910+7),0x92);	
	SetByte((LPVOID)(0x00FE6910+8),0x01);	
	SetByte((LPVOID)(0x00FE6910+8),0x01);	

}
Ejemplo n.º 11
0
void ReputationsInit() {
	int count;
	if(count=GetPrivateProfileIntA("Misc", "CityRepsCount", 0, ini)) {
		repList=new CityRep[count];
		char buf[512];
		GetPrivateProfileStringA("Misc", "CityRepsList", "", buf, 512, ini);
		char* end;
		char* start=buf;
		for(int i=0;i<count;i++) {
			end=strchr(start,':');
			*end='\0';
			repList[i].cityID=atoi(start);
			start=end+1;
			if(i==count-1) {
				repList[i].globalID=atoi(start);
			} else {
				end=strchr(start,',');
				*end='\0';
				repList[i].globalID=atoi(start);
				start=end+1;
			}
		}

		SafeWrite32(0x43BEA5, (DWORD)&repList[0].cityID);
		SafeWrite32(0x43BF3C, (DWORD)&repList[0].cityID);
		SafeWrite32(0x43BF4C, (DWORD)&repList[0].globalID);
		SafeWrite32(0x43C03E, count*8);
	}
}
BOOL config_load_a(HMODULE module,CONFIG_BINDING_A* binding){
	char path[MAX_PATH];
	GetModuleFileNameA(module,path,MAX_PATH);
	for(int i=strlen(path)-1;i>=0;i--){
		if(path[i]=='\\'){
			path[i]='\0';
			break;
		}
	}
	strcat(path,"\\config.ini");
	PCONFIG_BINDING_A b;
	int i=0;
	char buffer[32767];
	int l;
	while((b=binding+(i++))->section){
		switch(b->type){
			case CONFIG_TYPE_STRING:
				l = GetPrivateProfileStringA(b->section,b->key,b->def.asString,buffer,32767,path);
				if(buffer[0]==0&&b->def.asString==NULL){
					*(b->val.asString)=NULL;
				}else{
					*(b->val.asString)=(char*)malloc(sizeof(char)*(strlen(buffer)+1));
					strcpy(*(b->val.asString),buffer);
				}
				break;
			case CONFIG_TYPE_INT:
				*(b->val.asInt) = GetPrivateProfileIntA(b->section,b->key,b->def.asInt,path);
				break;
		}
	}
	return TRUE;
}
Ejemplo n.º 13
0
std::string MiscUtil::getINIString( const char * key, const char *app_name){
        
    char buffer[512];
    GetPrivateProfileStringA( app_name, key, "", buffer, 512,".\\settings.ini");

    return std::string(buffer);
}
Ejemplo n.º 14
0
HRESULT CShellExt::Initialize(LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hProgID)
{
	memset(_vc_path, 0, MAX_PATH*2);
	char inifile[MAX_PATH] = {0};
	char drive[_MAX_DRIVE*2] = {0};
	char dir[_MAX_DIR*2] = {0};


	GetModuleFileNameA(g_hInstance, inifile, MAX_PATH);
	//MessageBoxA(NULL, inifile, "", MB_OK);

	errno_t err;
	err = _splitpath_s(inifile, 
		drive,
		_MAX_DRIVE,
		dir,
		_MAX_DIR,
		NULL, 0, 
		NULL, 0);
	err = _makepath_s(inifile, _MAX_PATH, drive, dir, "zShellExt", "ini");

	GetPrivateProfileStringA("VS2008", "path", "", _vc_path, MAX_PATH*2, inifile);
	//MessageBoxA(NULL, _vc_path, "", MB_OK);
	return S_OK;
}
Ejemplo n.º 15
0
void CVideoEyeApp::LoadLaguage()
{
	//配置文件路径
	char conf_path[300]={0};
	//获得exe绝对路径
	GetModuleFileNameA(NULL,(LPSTR)conf_path,300);//
	//获得exe文家夹路径
	strrchr( conf_path, '\\')[0]= '\0';//
	strcat(conf_path,"\\configure.ini");
	//存储属性的字符串
	char conf_val[300]={0};

	if((_access(conf_path, 0 )) == -1 ){  
		//配置文件不存在,直接返回
	}else{
		GetPrivateProfileStringA("Settings","language",NULL,conf_val,300,conf_path);
		if(strcmp(conf_val,"Chinese")==0){
			SetThreadUILanguage(MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT));
		}else if(strcmp(conf_val,"English")==0){
			SetThreadUILanguage(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
		}
		
	}
	return;
}
Ejemplo n.º 16
0
string Options::getParameter(string section, string parameter, string defaultValue) {
    char param[256];
    
    GetPrivateProfileStringA(section.c_str(), parameter.c_str(), defaultValue.c_str(), param, 100, configPath.c_str());
    
    return param;
}
Ejemplo n.º 17
0
bool getIniValue(string filename,string section,string key,string defultValue,string& value){
	

	char lpBuffer[PATH_BUFFER_LENGTH];
	ZeroMemory(lpBuffer,PATH_BUFFER_LENGTH);

	DWORD nBufferLength = GetCurrentDirectoryA(
									PATH_BUFFER_LENGTH,
									lpBuffer
								);
	string path = ""; 
	if (!nBufferLength) return false;

	path=lpBuffer;
	path+="\\";
	path+=filename;
	

	ZeroMemory(lpBuffer,PATH_BUFFER_LENGTH);

	nBufferLength=  GetPrivateProfileStringA(						  
						  section.c_str(),
						  key.c_str(),
						  defultValue.c_str(),
						  lpBuffer,
						  PATH_BUFFER_LENGTH,
						  path.c_str()
						);

	if (!nBufferLength) return false;

	value = lpBuffer;
	return true;

}
Ejemplo n.º 18
0
bool tNetworkServer::Init(boost::intrusive_ptr<tINetworkServer> s){

	LOG_DEBUG << "tNetworkServer::Init()";

	this->_storage=s;
	char cc[100];
	::GetCurrentDirectoryA(100,cc);
	strcat(cc,"\\config.ini");
	DWORD res=GetPrivateProfileStringA("Network", "interfaceServer", "127.0.0.1", _interface, 100, cc);
	LOG_DEBUG << cc << _interface;
//	if (memcmp(cInterface,"auto",4)==0)	GetDefaultIP(cInterface);
//	printf("\nSelected Network interface:%s\n",cInterface);

// шаг 1 - подключение библиотеки 
	WSADATA wsaData;
    if (WSAStartup(MAKEWORD(2,2), &wsaData)){
		LOG_ERROR << "WSAStartup error: " << WSAGetLastError();
		return false;
    }
	LOG_DEBUG << "WSAStartup() - OK";
	for (int i=0;i<5;i++){
		this->_clients[i].used=false;
		ZeroMemory(&this->_clients[i].clientAddrForRecv,sizeof(sockaddr)) ;
		ZeroMemory(&this->_clients[i].mInfo,sizeof(tNetInfo));
	}
	return true;
}
Ejemplo n.º 19
0
void PatsApiDealer::ReadIniConfig()
{ // 登录需要的参数
	m_useSimEngine = 0;
	memset(m_szTraderAccount,   0, sizeof(m_szTraderAccount));
	m_useSimEngine = GetPrivateProfileIntA("PATSAPIDEALER","SIMENGINE_DEALER",0,".\\AIB.ini");
	GetPrivateProfileStringA("PATSAPIDEALER", "TRADER_ACCOUNT", "", m_szTraderAccount, 21, ".\\AIB.ini");
	TRACE_LOG("PatsApiDealer ReadIniConfig UseSimEngine:%d, TraderAccount:%s.",m_useSimEngine,m_szTraderAccount);
}
Ejemplo n.º 20
0
BOOL CLLKCLIApp::InitInstance()
{

	AfxSocketInit();

	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	GetPrivateProfileStringA("SERVER_INFO","IP","127.0.0.1",ip,sizeof(ip),"./set.ini");
	char strPort[5];
	GetPrivateProfileStringA("SERVER_INFO","PORT","5601",strPort,sizeof(strPort),"./set.ini");
	port = atoi(strPort);
	m_pSockThd = new CSockThd;
	m_pSockThd->CreateThread();

	CLLKCLIDlg login;
	int nResponse = login.DoModal();

	if(nResponse == IDCANCEL)
		return FALSE;

	CLLKHome home;
	home.m_uid=userInfo.id;
	home.m_nick=userInfo.nick;
	home.m_score=userInfo.type;
	if(userInfo.sex==0){
		home.m_sex="Å®";
	}
	else{
		home.m_sex="ÄÐ";
	}
	m_pMainWnd = &home;
	home.DoModal();

	return FALSE;
}
Ejemplo n.º 21
0
char* CIniReader::ReadString(char* szSection, char* szKey, const char* szDefaultValue)
{
 char* szResult = new char[255];
 memset(szResult, 0x00, 255);
 GetPrivateProfileStringA(szSection,  szKey, 
		szDefaultValue, szResult, 255, m_szFileName); 
 return szResult;
}
Ejemplo n.º 22
0
std::string LanguageSetting::GetLanguageA(char *key, char *name) {
	char str[255];
	GetPrivateProfileStringA(key, name, "", str, 255, ".\\lang.ini");
	if (strlen(str) == 0) {
		sprintf(str, "Error: No Language keyname \"%s\" in Key \"%s\".", key, name);
	}
	return replaceAll(std::string(str), "\\n", "\n");
}
Ejemplo n.º 23
0
BOOL GetSettingBool(const char *section, const char *key, BOOL defaultValue)
{
	char tmp[16];
	if (GetPrivateProfileStringA(section, key, defaultValue ? "true" : "false", tmp, sizeof(tmp), gIniFile) == 0)
		return defaultValue;

	return mir_strcmpi(tmp, "true") == 0;
}
Ejemplo n.º 24
0
void ConfigManager::getFloat(const char* section, const char* key, float& value)
{
	char result[255];
	char buffer[255];

	sprintf(buffer, "%f", value);
	GetPrivateProfileStringA(section, key, buffer, result, 255, directory);
	value = (float)atof(result);
}
Ejemplo n.º 25
0
bool LoadConfig( const char file[], Config *cfg )
{
	bool succ = true;

	if( GetPrivateProfileStringA( kMainSec, kAdapterKey, kDefAdapter, cfg->adapter, sizeof( cfg->adapter ), file ) == 0
		|| !TestAdapterName( cfg->adapter ) )
		{
		cfg->adapter[0] = '\0';
		succ = false;
		}//end if
	cfg->dst_port = GetPrivateProfileIntA( kMainSec, kPortKey, kDefPort, file );
	cfg->filter = GetPrivateProfileIntA( kMainSec, kFilterKey, kDefFilter, file );
	GetPrivateProfileStringA( kMainSec, kFilterWordsKey, kDefFilterWords, cfg->filterwords, sizeof( cfg->filterwords ), file );
	cfg->filteridurl = GetPrivateProfileIntA( kMainSec, kFilterIdURLKey, kDefFilterIdURL, file );
	cfg->checkupdate = GetPrivateProfileIntA( kMainSec, kCheckUpdateKey, kDefCheckUpdate, file );

	return succ;
}//end LoadConfig
Ejemplo n.º 26
0
float CIniReader::ReadFloat(char* szSection, char* szKey, float fltDefaultValue)
{
 char szResult[255];
 char szDefault[255];
 float fltResult;
 sprintf(szDefault, "%f",fltDefaultValue);
 GetPrivateProfileStringA(szSection,  szKey, szDefault, szResult, 255, m_szFileName); 
 fltResult =  atof(szResult);
 return fltResult;
}
Ejemplo n.º 27
0
bool SFUDPNetwork::Start()
{
	GetPrivateProfileStringA("UDPInfo", "IP", NULL, m_IP, 20, "./Connection.ini");
	m_Port = GetPrivateProfileIntA("UDPInfo", "PORT", 0, "./Connection.ini");

	if(m_P2PModule)
		m_P2PModule->RunP2P(m_IP, m_Port);

	return true;
}
Ejemplo n.º 28
0
int ls_iniGetStr(struct ls_Ini* self, char* app, char* key, int outLen, char* outValue)
{
  if (NULL != self && NULL != app && NULL != key && NULL != outValue && outLen > 0)
  {
    if (GetPrivateProfileStringA(app, key, NULL, outValue, outLen, self->file) >= (unsigned long)outLen)
      return LS_Failed;
    return LS_Success;
  }
  return LS_Failed_InvalidParameters;
}
Ejemplo n.º 29
0
static char* getChildString(const char* sect, const char* key)
{
    char        buf[1024];
    char*       ret;

    GetPrivateProfileStringA(sect, key, "-", buf, sizeof(buf), child_file);
    if (buf[0] == '\0' || (buf[0] == '-' && buf[1] == '\0')) return NULL;
    assert(!(strlen(buf) & 1));
    ret = decodeA(buf);
    return ret;
}
Ejemplo n.º 30
0
BOOL CheckIniFile(PCHAR OriginalExeName, PCHAR DllName)
{
    CHAR CurrentPath[MAX_PATH];
    CHAR FilePath[MAX_PATH];

    if (!GetCurrentDirectory(sizeof(CurrentPath) - 1, CurrentPath)) {
        printf("[-] CheckIniFile - GetCurrentDirectory failed : %lu\n", GetLastError());
        return FALSE;
    }
    sprintf_s(FilePath, sizeof (FilePath) - 1, "%s\\injector.ini", CurrentPath);
    if (GetPrivateProfileStringA("injector", "original_executable_name", NULL, OriginalExeName, MAX_PATH, FilePath) == 0) {
        printf("[-] CheckIniFile - GetPrivateProfileString failed : %lu\n", GetLastError());
        return FALSE;
    }
    if (GetPrivateProfileStringA("injector", "dll_name", NULL, DllName, MAX_PATH, FilePath) == 0) {
        printf("[-] CheckIniFile - GetPrivateProfileString failed : %lu\n", GetLastError());
        return FALSE;
    }
    return TRUE;
}