本文整理匯總了C++中GetPrivateProfileStringA函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetPrivateProfileStringA函數的具體用法?C++ GetPrivateProfileStringA怎麽用?C++ GetPrivateProfileStringA使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetPrivateProfileStringA函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: mir_strcpy
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;
}
}
}
示例2: MAIN_CreateGroups
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' */
}
示例3: strcpy_s
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");
}
}
示例4: ReadSettings
// 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;
}
示例5: getUserKey
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;
}
示例6: Load_Config
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;
}
示例7: memset
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);
}
示例8: GetPrivateProfileStringA
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);
}
}
示例9: OpenDriver16
/**************************************************************************
* 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;
}
示例10: gServerConnectionFix
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);
}
示例11: ReputationsInit
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);
}
}
示例12: config_load_a
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;
}
示例13: GetPrivateProfileStringA
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);
}
示例14: memset
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;
}
示例15: GetModuleFileNameA
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;
}