本文整理汇总了C++中GetPrivateProfileString函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPrivateProfileString函数的具体用法?C++ GetPrivateProfileString怎么用?C++ GetPrivateProfileString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPrivateProfileString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindClose
BOOL CMcCurveData::ReadCurveData()
{
WIN32_FIND_DATA fd;
HANDLE handle=FindFirstFile(strfilepath,&fd);
if (handle==INVALID_HANDLE_VALUE)
{
return FALSE;
}
FindClose(handle);
//stroldsection.Format("mc_n%02dl%03du%03d",nNode,nLine,nRtu);
stroldsection=strMcename;
char szsection[20];
ZeroMemory(szsection,20);
GetPrivateProfileSection(stroldsection,szsection,20,strfilepath);
if (strlen(szsection)==0)
{
return FALSE;
}
gtIcurvearray.RemoveAll();
gtVcurvearray.RemoveAll();
zbIcurvearray.RemoveAll();
zbVcurvearray.RemoveAll();
char szrec[80];
char sz0[20];
char sz1[20];
char sz2[20];
char sz3[20];
char sz4[20];
char sz5[20];
char sz6[20];
char sz7[20];
char sz8[20];
char nUpName[33];
char nDownName[33];
strcpy(nUpName,"");
strcpy(nDownName,"");
nIprecision=GetPrivateProfileInt(stroldsection,"Iprecision",0,strfilepath);
nVprecision=GetPrivateProfileInt(stroldsection,"Vprecision",0,strfilepath);
//fImin=GetPrivateProfileInt(stroldsection,"Imin",0,strfilepath);
GetPrivateProfileString(stroldsection,"Imin",0,szrec,80,strfilepath);
fImin=atof(szrec);
//fImax=GetPrivateProfileInt(stroldsection,"Imax",30,strfilepath);
GetPrivateProfileString(stroldsection,"Imax",0,szrec,80,strfilepath);
fImax=atof(szrec);
//fVmin=GetPrivateProfileInt(stroldsection,"Vmin",0,strfilepath);
GetPrivateProfileString(stroldsection,"Vmin",0,szrec,80,strfilepath);
fVmin=atof(szrec);
//fVmax=GetPrivateProfileInt(stroldsection,"Vmax",300,strfilepath);
GetPrivateProfileString(stroldsection,"Vmax",0,szrec,80,strfilepath);
fVmax=atof(szrec);
bgtmode=GetPrivateProfileInt(stroldsection,"gtmode",1,strfilepath);
bonlyrealline=GetPrivateProfileInt(stroldsection,"onlyrealline",0,strfilepath);
m_realtime_style=GetPrivateProfileInt(stroldsection,"realtime_style",0,strfilepath);
nNode=GetPrivateProfileInt(stroldsection,"node",0,strfilepath);
nLine=GetPrivateProfileInt(stroldsection,"line",0,strfilepath);
nRtu=GetPrivateProfileInt(stroldsection,"rtu",0,strfilepath);
GetPrivateProfileString(stroldsection,"UpName","",nUpName,sizeof(char)*32,strfilepath);
GetPrivateProfileString(stroldsection,"DownName","",nDownName,sizeof(char)*32,strfilepath);
UpName=nUpName;
DownName=nDownName;
TCurve addTcurve;
CString singlecurvekey;
int curvecount=GetPrivateProfileInt(stroldsection,"gtIlinecount",0,strfilepath);
for (int i=0; i<curvecount; i++)
{
singlecurvekey.Format("gtIline%d",i);
GetPrivateProfileString(stroldsection,singlecurvekey,0,szrec,79,strfilepath);
extractstring(szrec,sz0,sz1,sz2,sz3,sz4,sz5,sz6,sz7,sz8);
memset(&addTcurve,0,sizeof(TCurve));
addTcurve.ncurvecolor=atoi(sz0);
addTcurve.BcurvechannelNO=atoi(sz1);
addTcurve.nlinenode=atoi(sz2);
addTcurve.nlineline=atoi(sz3);
addTcurve.nlinertu=atoi(sz4);
addTcurve.Bdot=atoi(sz5);
addTcurve.fcurveratio=atof(sz6);
addTcurve.Bprecision=atoi(sz7);
if (strlen(sz8)>0)
strcpy(addTcurve.unit,sz8);
gtIcurvearray.Add(addTcurve);
}
curvecount=GetPrivateProfileInt(stroldsection,"gtVlinecount",0,strfilepath);
for (int i=0; i<curvecount; i++)
{
singlecurvekey.Format("gtVline%d",i);
GetPrivateProfileString(stroldsection,singlecurvekey,0,szrec,79,strfilepath);
extractstring(szrec,sz0,sz1,sz2,sz3,sz4,sz5,sz6,sz7,sz8);
memset(&addTcurve,0,sizeof(TCurve));
//.........这里部分代码省略.........
示例2: GeneralPageDialogProc
INT_PTR CALLBACK GeneralPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
int updatestrings = 0;
if (msg == WM_INITDIALOG) {
wchar_t txt[20];
GetPrivateProfileString(L"General", L"AutoFocus", L"0", txt, ARRAY_SIZE(txt), inipath);
Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOFOCUS), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);
GetPrivateProfileString(L"General", L"Aero", L"2", txt, ARRAY_SIZE(txt), inipath);
Button_SetCheck(GetDlgItem(hwnd,IDC_AERO), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);
GetPrivateProfileString(L"General", L"InactiveScroll", L"1", txt, ARRAY_SIZE(txt), inipath);
Button_SetCheck(GetDlgItem(hwnd,IDC_INACTIVESCROLL), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);
GetPrivateProfileString(L"General", L"MDI", L"0", txt, ARRAY_SIZE(txt), inipath);
Button_SetCheck(GetDlgItem(hwnd,IDC_MDI), _wtoi(txt)?BST_CHECKED:BST_UNCHECKED);
HWND control = GetDlgItem(hwnd, IDC_LANGUAGE);
ComboBox_ResetContent(control);
if (l10n == &l10n_ini) {
ComboBox_AddString(control, l10n->lang);
ComboBox_SetCurSel(control, 0);
ComboBox_Enable(control, FALSE);
}
else {
ComboBox_Enable(control, TRUE);
int i;
for (i=0; i < ARRAY_SIZE(languages); i++) {
ComboBox_AddString(control, languages[i]->lang);
if (l10n == languages[i]) {
ComboBox_SetCurSel(control, i);
}
}
}
Button_Enable(GetDlgItem(hwnd,IDC_ELEVATE), vista && !elevated);
}
else if (msg == WM_COMMAND) {
int id = LOWORD(wParam);
int event = HIWORD(wParam);
HWND control = GetDlgItem(hwnd, id);
int val = Button_GetCheck(control);
wchar_t txt[10];
if (id == IDC_AUTOFOCUS) {
WritePrivateProfileString(L"General", L"AutoFocus", _itow(val,txt,10), inipath);
}
else if (id == IDC_AUTOSNAP && event == CBN_SELCHANGE) {
val = ComboBox_GetCurSel(control);
WritePrivateProfileString(L"General", L"AutoSnap", _itow(val,txt,10), inipath);
}
else if (id == IDC_AERO) {
WritePrivateProfileString(L"General", L"Aero", _itow(val,txt,10), inipath);
}
else if (id == IDC_INACTIVESCROLL) {
WritePrivateProfileString(L"General", L"InactiveScroll", _itow(val,txt,10), inipath);
}
else if (id == IDC_MDI) {
WritePrivateProfileString(L"General", L"MDI", _itow(val,txt,10), inipath);
}
else if (id == IDC_LANGUAGE && event == CBN_SELCHANGE) {
int i = ComboBox_GetCurSel(control);
if (i == ARRAY_SIZE(languages)) {
OpenUrl(L"https://stefansundin.github.io/altdrag/doc/translate.html");
for (i=0; l10n != languages[i]; i++) {}
ComboBox_SetCurSel(control, i);
}
else {
l10n = languages[i];
WritePrivateProfileString(L"General", L"Language", l10n->code, inipath);
updatestrings = 1;
UpdateStrings();
}
}
else if (id == IDC_AUTOSTART) {
SetAutostart(val, 0, 0);
Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), val);
Button_Enable(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), val && vista);
if (!val) {
Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE), BST_UNCHECKED);
Button_SetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE), BST_UNCHECKED);
}
}
else if (id == IDC_AUTOSTART_HIDE) {
int elevate = Button_GetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_ELEVATE));
SetAutostart(1, val, elevate);
}
else if (id == IDC_AUTOSTART_ELEVATE) {
int hide = Button_GetCheck(GetDlgItem(hwnd,IDC_AUTOSTART_HIDE));
SetAutostart(1, hide, val);
if (val) {
// Don't nag if UAC is disabled, only check if elevated
DWORD uac_enabled = 1;
if (elevated) {
DWORD len = sizeof(uac_enabled);
HKEY key;
RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", 0, KEY_QUERY_VALUE, &key);
RegQueryValueEx(key, L"EnableLUA", NULL, NULL, (LPBYTE)&uac_enabled, &len);
RegCloseKey(key);
}
if (uac_enabled) {
//.........这里部分代码省略.........
示例3: BlacklistPageDialogProc
INT_PTR CALLBACK BlacklistPageDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
if (msg == WM_INITDIALOG) {
wchar_t txt[1000];
GetPrivateProfileString(L"Blacklist", L"ProcessBlacklist", L"", txt, ARRAY_SIZE(txt), inipath);
SetDlgItemText(hwnd, IDC_PROCESSBLACKLIST, txt);
GetPrivateProfileString(L"Blacklist", L"Blacklist", L"", txt, ARRAY_SIZE(txt), inipath);
SetDlgItemText(hwnd, IDC_BLACKLIST, txt);
GetPrivateProfileString(L"Blacklist", L"Snaplist", L"", txt, ARRAY_SIZE(txt), inipath);
SetDlgItemText(hwnd, IDC_SNAPLIST, txt);
}
else if (msg == WM_COMMAND) {
wchar_t txt[1000];
int control = LOWORD(wParam);
if (HIWORD(wParam) == EN_KILLFOCUS) {
Edit_GetText(GetDlgItem(hwnd,control), txt, ARRAY_SIZE(txt));
if (control == IDC_PROCESSBLACKLIST) {
WritePrivateProfileString(L"Blacklist", L"ProcessBlacklist", txt, inipath);
}
else if (control == IDC_BLACKLIST) {
WritePrivateProfileString(L"Blacklist", L"Blacklist", txt, inipath);
}
else if (control == IDC_SNAPLIST) {
WritePrivateProfileString(L"Blacklist", L"Snaplist", txt, inipath);
}
UpdateSettings();
}
else if (HIWORD(wParam) == STN_CLICKED && control == IDC_FINDWINDOW) {
// Get size of workspace
int left = GetSystemMetrics(SM_XVIRTUALSCREEN);
int top = GetSystemMetrics(SM_YVIRTUALSCREEN);
int width = GetSystemMetrics(SM_CXVIRTUALSCREEN);
int height = GetSystemMetrics(SM_CYVIRTUALSCREEN);
// Create window
WNDCLASSEX wnd = { sizeof(WNDCLASSEX), 0, CursorProc, 0, 0, g_hinst, NULL, NULL, (HBRUSH)(COLOR_WINDOW+1), NULL, APP_NAME"-find", NULL };
wnd.hCursor = LoadImage(g_hinst, MAKEINTRESOURCE(IDI_FIND), IMAGE_CURSOR, 0, 0, LR_DEFAULTCOLOR);
RegisterClassEx(&wnd);
HWND findhwnd = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST|WS_EX_LAYERED, wnd.lpszClassName, NULL, WS_POPUP, left, top, width, height, NULL, NULL, g_hinst, NULL);
SetLayeredWindowAttributes(findhwnd, 0, 1, LWA_ALPHA); // Almost transparent
ShowWindowAsync(findhwnd, SW_SHOWNA);
// Hide icon
ShowWindowAsync(GetDlgItem(hwnd,IDC_FINDWINDOW), SW_HIDE);
}
}
else if (msg == WM_NOTIFY) {
LPNMHDR pnmh = (LPNMHDR)lParam;
if (pnmh->code == PSN_SETACTIVE) {
// Update text
SetDlgItemText(hwnd, IDC_BLACKLIST_BOX, l10n->blacklist_box);
SetDlgItemText(hwnd, IDC_PROCESSBLACKLIST_HEADER, l10n->blacklist_processblacklist);
SetDlgItemText(hwnd, IDC_BLACKLIST_HEADER, l10n->blacklist_blacklist);
SetDlgItemText(hwnd, IDC_SNAPLIST_HEADER, l10n->blacklist_snaplist);
SetDlgItemText(hwnd, IDC_BLACKLIST_EXPLANATION, l10n->blacklist_explanation);
SetDlgItemText(hwnd, IDC_FINDWINDOW_BOX, l10n->blacklist_findwindow_box);
SetDlgItemText(hwnd, IDC_FINDWINDOW_EXPLANATION, l10n->blacklist_findwindow_explanation);
}
}
LinkProc(hwnd, msg, wParam, lParam);
return FALSE;
}
示例4: LogAddTD
//004c69a0 -> 100%
int CSkillAdditionInfo::Load(LPSTR lpszFileName)
{
if( lpszFileName == NULL || strcmp(lpszFileName, "") == 0 )
{
LogAddTD("[Skill Addition Info] - File load error : File Name Error");
return false;
}
// ----
#ifdef __CUSTOMS__
int Token;
this->Init();
// ----
SMDFile = fopen(gDirPath.GetNewPath(lpszFileName), "r");
// ----
if( SMDFile == 0 )
{
MsgBox(lMsg.Get(MSGGET(0, 112)), lpszFileName);
return false;
}
// ----
while(true)
{
Token = GetToken();
// ----
if( Token == END || !strcmp(TokenString, "end") )
{
break;
}
else
{
int SkillID = TokenNumber;
Token = GetToken();
int Level = TokenNumber;
// ----
if( Level < 1 )
{
Level = 1;
}
// ----
this->m_SkillUseReqLevel[SkillID] = Level;
}
}
// ----
fclose(SMDFile);
// ----
char szFloat[256];
// ----
this->m_SoulBarrierDefenseStart = GetPrivateProfileInt("SkillInfo", "SoulBarrierDefenseStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SoulBarrierDefenseDiv1 = GetPrivateProfileInt("SkillInfo", "SoulBarrierDefenseDiv1", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SoulBarrierDefenseDiv2 = GetPrivateProfileInt("SkillInfo", "SoulBarrierDefenseDiv2", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SoulBarrierDefenseMax = GetPrivateProfileInt("SkillInfo", "SoulBarrierDefenseMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SoulBarrierTimeStart = GetPrivateProfileInt("SkillInfo", "SoulBarrierTimeStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SoulBarrierTimeDiv = GetPrivateProfileInt("SkillInfo", "SoulBarrierTimeDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SoulBarrierTimeMax = GetPrivateProfileInt("SkillInfo", "SoulBarrierTimeMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_WizardryEnchantDamageDiv = GetPrivateProfileInt("SkillInfo", "WizardryEnchantDamageDiv", 600, gDirPath.GetNewPath(lpszFileName));
GetPrivateProfileString("SkillInfo", "WizardryEnchantDamageFact", "10", szFloat, 5, gDirPath.GetNewPath(lpszFileName));
sscanf(szFloat, "%f", &this->m_WizardryEnchantDamageFact);
this->m_WizardryEnchantDamageMax = GetPrivateProfileInt("SkillInfo", "WizardryEnchantDamageMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_WizardryEnchantTime = GetPrivateProfileInt("SkillInfo", "WizardryEnchantTime", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SwellLifeEffectStart = GetPrivateProfileInt("SkillInfo", "SwellLifeEffectStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SwellLifeEffectDiv1 = GetPrivateProfileInt("SkillInfo", "SwellLifeEffectDiv1", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SwellLifeEffectDiv2 = GetPrivateProfileInt("SkillInfo", "SwellLifeEffectDiv2", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SwellLifeEffectMax = GetPrivateProfileInt("SkillInfo", "SwellLifeEffectMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SwellLifeTimeStart = GetPrivateProfileInt("SkillInfo", "SwellLifeTimeStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SwellLifeTimeDiv = GetPrivateProfileInt("SkillInfo", "SwellLifeTimeDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_SwellLifeTimeMax = GetPrivateProfileInt("SkillInfo", "SwellLifeTimeMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ElfDefenseEffectFact = GetPrivateProfileInt("SkillInfo", "ElfDefenseEffectFact", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ElfDefenseEffectDiv = GetPrivateProfileInt("SkillInfo", "ElfDefenseEffectDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ElfDefenseEffectMax = GetPrivateProfileInt("SkillInfo", "ElfDefenseEffectMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ElfDefenseTime = GetPrivateProfileInt("SkillInfo", "ElfDefenseTime", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ElfAttackEffectFact = GetPrivateProfileInt("SkillInfo", "ElfAttackEffectFact", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ElfAttackEffectDiv = GetPrivateProfileInt("SkillInfo", "ElfAttackEffectDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ElfAttackEffectMax = GetPrivateProfileInt("SkillInfo", "ElfAttackEffectMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ElfAttackTime = GetPrivateProfileInt("SkillInfo", "ElfAttackTime", 600, gDirPath.GetNewPath(lpszFileName));
this->m_CriticalDamageEffectDiv1 = GetPrivateProfileInt("SkillInfo", "CriticalDamageEffectDiv1", 600, gDirPath.GetNewPath(lpszFileName));
this->m_CriticalDamageEffectDiv2 = GetPrivateProfileInt("SkillInfo", "CriticalDamageEffectDiv2", 600, gDirPath.GetNewPath(lpszFileName));
this->m_CriticalDamageEffectMax = GetPrivateProfileInt("SkillInfo", "CriticalDamageEffectMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_CriticalDamageTimeStart = GetPrivateProfileInt("SkillInfo", "CriticalDamageTimeStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_CriticalDamageTimeDiv = GetPrivateProfileInt("SkillInfo", "CriticalDamageTimeDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_CriticalDamageTimeMax = GetPrivateProfileInt("SkillInfo", "CriticalDamageTimeMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_BerserkerManaIncDiv = GetPrivateProfileInt("SkillInfo", "BerserkerManaIncDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_BerserkerLifeDecDiv = GetPrivateProfileInt("SkillInfo", "BerserkerLifeDecDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_BerserkerTimeStart = GetPrivateProfileInt("SkillInfo", "BerserkerTimeStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_BerserkerTimeDiv = GetPrivateProfileInt("SkillInfo", "BerserkerTimeDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_BerserkerTimeMax = GetPrivateProfileInt("SkillInfo", "BerserkerTimeMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ReflectEffectStart = GetPrivateProfileInt("SkillInfo", "ReflectEffectStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ReflectEffectDiv = GetPrivateProfileInt("SkillInfo", "ReflectEffectDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ReflectEffectMax = GetPrivateProfileInt("SkillInfo", "ReflectEffectMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ReflectTimeStart = GetPrivateProfileInt("SkillInfo", "ReflectTimeStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ReflectTimeDiv = GetPrivateProfileInt("SkillInfo", "ReflectTimeDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_ReflectTimeMax = GetPrivateProfileInt("SkillInfo", "ReflectTimeMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_IgnoreDefenseEffectStart = GetPrivateProfileInt("SkillInfo", "IgnoreDefenseEffectStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_IgnoreDefenseEffectSub = GetPrivateProfileInt("SkillInfo", "IgnoreDefenseEffectSub", 600, gDirPath.GetNewPath(lpszFileName));
this->m_IgnoreDefenseEffectDiv = GetPrivateProfileInt("SkillInfo", "IgnoreDefenseEffectDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_IgnoreDefenseEffectMax = GetPrivateProfileInt("SkillInfo", "IgnoreDefenseEffectMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_IgnoreDefenseTimeStart = GetPrivateProfileInt("SkillInfo", "IgnoreDefenseTimeStart", 600, gDirPath.GetNewPath(lpszFileName));
this->m_IgnoreDefenseTimeDiv = GetPrivateProfileInt("SkillInfo", "IgnoreDefenseTimeDiv", 600, gDirPath.GetNewPath(lpszFileName));
this->m_IgnoreDefenseTimeMax = GetPrivateProfileInt("SkillInfo", "IgnoreDefenseTimeMax", 600, gDirPath.GetNewPath(lpszFileName));
this->m_IncreaseHealthEffectStart = GetPrivateProfileInt("SkillInfo", "IncreaseHealthEffectStart", 600, gDirPath.GetNewPath(lpszFileName));
//.........这里部分代码省略.........
示例5: sprintf
void VNCOptions::Load(char *fname)
{
for (int i = rfbEncodingRaw; i<= LASTENCODING; i++) {
char buf[128];
sprintf(buf, "use_encoding_%d", i);
m_UseEnc[i] = readInt(buf, m_UseEnc[i], fname) != 0;
}
m_PreferredEncoding = readInt("preferred_encoding", m_PreferredEncoding, fname);
m_restricted = readInt("restricted", m_restricted, fname) != 0 ;
m_ViewOnly = readInt("viewonly", m_ViewOnly, fname) != 0;
m_NoStatus = readInt("nostatus", m_NoStatus, fname) != 0;
m_NoHotKeys = readInt("nohotkeys", m_NoHotKeys, fname) != 0;
m_ShowToolbar = readInt("showtoolbar", m_ShowToolbar, fname) != 0;
m_fAutoScaling = readInt("AutoScaling", m_fAutoScaling, fname) != 0;
m_FullScreen = readInt("fullscreen", m_FullScreen, fname) != 0;
autoDetect = readInt("autoDetect", autoDetect, fname) != 0;
m_Use8Bit = readInt("8bit", m_Use8Bit, fname);
m_Shared = readInt("shared", m_Shared, fname) != 0;
m_SwapMouse = readInt("swapmouse", m_SwapMouse, fname) != 0;
m_DeiconifyOnBell = readInt("belldeiconify", m_DeiconifyOnBell, fname) != 0;
m_Emul3Buttons = readInt("emulate3", m_Emul3Buttons, fname) != 0;
m_JapKeyboard = readInt("JapKeyboard", m_JapKeyboard, fname) != 0;
m_Emul3Timeout = readInt("emulate3timeout", m_Emul3Timeout, fname);
m_Emul3Fuzz = readInt("emulate3fuzz", m_Emul3Fuzz, fname);
m_DisableClipboard = readInt("disableclipboard", m_DisableClipboard, fname) != 0;
m_localCursor = readInt("localcursor", m_localCursor, fname);
m_scaling = readInt("Scaling", m_scaling, fname) != 0;
m_fAutoScaling = readInt("AutoScaling", m_fAutoScaling, fname) != 0;
m_scale_num = readInt("scale_num", m_scale_num, fname);
m_scale_den = readInt("scale_den", m_scale_den, fname);
// Tight specific
m_requestShapeUpdates = readInt("cursorshape", m_requestShapeUpdates, fname) != 0;
m_ignoreShapeUpdates = readInt("noremotecursor", m_ignoreShapeUpdates, fname) != 0;
int level = readInt("compresslevel", -1, fname);
if (level != -1) {
m_useCompressLevel = true;
m_compressLevel = level;
}
level = readInt("quality", -1, fname);
if (level != -1) {
m_enableJpegCompression = true;
m_jpegQualityLevel = level;
}
// Modif [email protected]
m_nServerScale = readInt("ServerScale", m_nServerScale, fname);
m_reconnectcounter = readInt("Reconnect", m_reconnectcounter, fname);
m_fEnableCache = readInt("EnableCache", m_fEnableCache, fname) != 0;
m_quickoption = readInt("QuickOption", m_quickoption, fname);
m_fUseDSMPlugin = readInt("UseDSMPlugin", m_fUseDSMPlugin, fname) != 0;
m_fUseProxy = readInt("UseProxy", m_fUseProxy, fname) != 0;
GetPrivateProfileString("options", "DSMPlugin", "NoPlugin", m_szDSMPluginFilename, MAX_PATH, fname);
if (!g_disable_sponsor) g_disable_sponsor=readInt("sponsor", g_disable_sponsor, fname) != 0;
if (!g_disable_sponsor)
{
HKEY hRegKey;
DWORD sponsor = 0;
if ( RegCreateKey(HKEY_CURRENT_USER, SETTINGS_KEY_NAME, &hRegKey) != ERROR_SUCCESS ) {
hRegKey = NULL;
} else {
DWORD sponsorsize = sizeof(sponsor);
DWORD valtype=REG_DWORD;
if ( RegQueryValueEx( hRegKey, "sponsor", NULL, &valtype,
(LPBYTE) &sponsor, &sponsorsize) == ERROR_SUCCESS) {
g_disable_sponsor=sponsor ? true : false;
}
RegCloseKey(hRegKey);
}
}
//m_autoReconnect = readInt("AutoReconnect", m_autoReconnect, fname) != 0;
m_fExitCheck = readInt("ExitCheck", m_fExitCheck, fname) != 0; //PGM @ Advantig
m_FTTimeout = readInt("FileTransferTimeout", m_FTTimeout, fname);
if (m_FTTimeout > 60)
m_FTTimeout = 60; // cap at 1 minute
m_keepAliveInterval = readInt("KeepAliveInterval", m_keepAliveInterval, fname);
if (m_keepAliveInterval >= (m_FTTimeout - KEEPALIVE_HEADROOM))
m_keepAliveInterval = (m_FTTimeout - KEEPALIVE_HEADROOM);
}
示例6: ini_read
/**
* 設定読み出し
* @param[in] lpPath パス
* @param[in] lpTitle タイトル
* @param[in] lpTable 設定テーブル
* @param[in] nCount 設定テーブル アイテム数
*/
void ini_read(LPCTSTR lpPath, LPCTSTR lpTitle, const PFTBL* lpTable, UINT nCount)
{
const PFTBL* p = lpTable;
const PFTBL* pTerminate = p + nCount;
while (p < pTerminate)
{
TCHAR szWork[512];
UINT32 val;
switch (p->itemtype & PFTYPE_MASK)
{
case PFTYPE_STR:
GetPrivateProfileString(lpTitle, p->item, static_cast<LPCTSTR>(p->value), static_cast<LPTSTR>(p->value), p->arg, lpPath);
break;
case PFTYPE_BOOL:
GetPrivateProfileString(lpTitle, p->item,
(*(static_cast<const UINT8*>(p->value))) ? str_true : str_false,
szWork, NELEMENTS(szWork), lpPath);
*(static_cast<UINT8*>(p->value)) = (!milstr_cmp(szWork, str_true)) ? 1 : 0;
break;
case PFTYPE_BITMAP:
GetPrivateProfileString(lpTitle, p->item,
(bitmapget(p->value, p->arg)) ? str_true : str_false,
szWork, _countof(szWork), lpPath);
bitmapset(p->value, p->arg, (milstr_cmp(szWork, str_true) == 0));
break;
case PFTYPE_BIN:
GetPrivateProfileString(lpTitle, p->item, str_null, szWork, _countof(szWork), lpPath);
binset(p->value, p->arg, szWork);
break;
case PFTYPE_SINT8:
case PFTYPE_UINT8:
val = GetPrivateProfileInt(lpTitle, p->item, *(static_cast<const UINT8*>(p->value)), lpPath);
*(static_cast<UINT8*>(p->value)) = static_cast<UINT8>(val);
break;
case PFTYPE_SINT16:
case PFTYPE_UINT16:
val = GetPrivateProfileInt(lpTitle, p->item, *(static_cast<const UINT16*>(p->value)), lpPath);
*(static_cast<UINT16*>(p->value)) = static_cast<UINT16>(val);
break;
case PFTYPE_SINT32:
case PFTYPE_UINT32:
val = GetPrivateProfileInt(lpTitle, p->item, *(static_cast<const UINT32*>(p->value)), lpPath);
*(static_cast<UINT32*>(p->value)) = static_cast<UINT32>(val);
break;
case PFTYPE_HEX8:
wsprintf(szWork, str_x, *(static_cast<const UINT8*>(p->value)));
GetPrivateProfileString(lpTitle, p->item, szWork, szWork, _countof(szWork), lpPath);
*(static_cast<UINT8*>(p->value)) = static_cast<UINT8>(milstr_solveHEX(szWork));
break;
case PFTYPE_HEX16:
wsprintf(szWork, str_x, *(static_cast<const UINT16*>(p->value)));
GetPrivateProfileString(lpTitle, p->item, szWork, szWork, _countof(szWork), lpPath);
*(static_cast<UINT16*>(p->value)) = static_cast<UINT16>(milstr_solveHEX(szWork));
break;
case PFTYPE_HEX32:
wsprintf(szWork, str_x, *(static_cast<const UINT32*>(p->value)));
GetPrivateProfileString(lpTitle, p->item, szWork, szWork, _countof(szWork), lpPath);
*(static_cast<UINT32*>(p->value)) = static_cast<UINT32>(milstr_solveHEX(szWork));
break;
case PFTYPE_ARGS16:
GetPrivateProfileString(lpTitle, p->item, str_null, szWork, _countof(szWork), lpPath);
inirdargs16(szWork, p);
break;
case PFTYPE_BYTE3:
GetPrivateProfileString(lpTitle, p->item, str_null, szWork, _countof(szWork), lpPath);
inirdbyte3(szWork, p);
break;
case PFTYPE_KB:
GetPrivateProfileString(lpTitle, p->item, str_null, szWork, _countof(szWork), lpPath);
inirdkb(szWork, p);
break;
}
p++;
}
}
示例7: ofnInit
// returns zero if successful
int ClientConnection::LoadConnection(char *fname, bool fFromDialog,bool default_file)
{
// The Connection Profile ".vnc" has been required from Connection Session Dialog Box
if (fFromDialog)
{
char tname[_MAX_FNAME + _MAX_EXT];
ofnInit();
ofn.hwndOwner = m_hSessionDialog;
ofn.lpstrFile = fname;
ofn.lpstrFileTitle = tname;
ofn.Flags = OFN_HIDEREADONLY;
// Open the FileSelection Dialog boxq
if (GetOpenFileName(&ofn) == 0)
return -1;
}
if (GetPrivateProfileString("connection", "host", "", m_host, MAX_HOST_NAME_LEN, fname) == 0) {
//AaronP
// MessageBox(m_hwnd, sz_K5, sz_K6, MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
// return -1;
//EndAaronP
}
if ( (m_port = GetPrivateProfileInt("connection", "port", 0, fname)) == 0)
{
//
//MessageBox(m_hwnd, sz_K7, sz_K6, MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
// in case options.vnc does not exist return to normal menu
return -1;
}
GetPrivateProfileString("connection", "proxyhost", "", m_proxyhost, MAX_HOST_NAME_LEN, fname);
m_proxyport = GetPrivateProfileInt("connection", "proxyport", 0, fname);
m_fUseProxy = GetPrivateProfileInt("options", "UseProxy", 0, fname);
char buf[32];
m_encPasswd[0] = '\0';
if (GetPrivateProfileString("connection", "password", "", buf, 32, fname) > 0) {
for (int i = 0; i < MAXPWLEN; i++) {
int x = 0;
sscanf(buf+i*2, "%2x", &x);
m_encPasswd[i] = (unsigned char) x;
}
}
// The Connection Profile ".vnc" has been required from Connection Session Dialog Box
// Load the rest of params
char optionfile[MAX_PATH];
char *tempvar=NULL;
tempvar = getenv( "TEMP" );
if (tempvar) strcpy(optionfile,tempvar);
else strcpy(optionfile,"");
strcat(optionfile,"\\options.vnc");
// if (fFromDialog)
{
m_opts.Load(fname);
m_opts.Register();
}
//AaronP
//else
if (strcmp(m_host, "") == 0 ||
strcmp(fname,optionfile)==0)
{
// Load the rest of params
strcpy(m_opts.m_proxyhost,m_proxyhost);
m_opts.m_proxyport=m_proxyport;
m_opts.m_fUseProxy=m_fUseProxy;
m_opts.Load(fname);
m_opts.Register();
// Then display the session dialog to get missing params again
SessionDialog sessdlg(&m_opts, this, m_pDSMPlugin); //[email protected]
if (!sessdlg.DoDialog())
{
throw QuietException("");
}
_tcsncpy(m_host, sessdlg.m_host_dialog, MAX_HOST_NAME_LEN);
m_port = sessdlg.m_port;
_tcsncpy(m_proxyhost, sessdlg.m_proxyhost, MAX_HOST_NAME_LEN);
m_proxyport = sessdlg.m_proxyport;
m_fUseProxy = sessdlg.m_fUseProxy;
};
//EndAaronP
return 0;
}
示例8: GetPrivateProfileString
void
IniFile::ReadString(char *key1, char *key2,char *value,int valuesize)
{
//vnclog.Print(LL_INTERR, VNCLOG("%s \n"),myInifile);
GetPrivateProfileString(key1,key2, "",value,valuesize,myInifile);
}
示例9: main
int main(int argc, char *argv[])
{
HANDLE hCommPort;
const char* config_file = ".\\serie.ini";
unsigned int baud_rate = GetPrivateProfileInt("Configuracion",
"Velocidad",
9600,
config_file);
unsigned int data_bits = GetPrivateProfileInt("Configuracion",
"BitsDatos",
8,
config_file);
unsigned int stop_bits = GetPrivateProfileInt("Configuracion",
"BitsParada",
2,
config_file);
char port_name[30];
unsigned int _len = GetPrivateProfileString("Configuracion",
"Puerto",
"COM1",
port_name,
sizeof(port_name),
config_file);
char parity[20];
unsigned int _parity_len = GetPrivateProfileString("Configuracion",
"Paridad",
"Sin paridad",
parity,
sizeof(parity),
config_file);
printf("Datos: %d %d %d %s %s\n", baud_rate, data_bits, stop_bits, port_name, parity);
//-- Abre el puerto serie
hCommPort = serie_abrir(port_name, baud_rate, data_bits, stop_bits, parity);
if (hCommPort == INVALID_HANDLE_VALUE)
{
perror("ERROR: No se puede acceder al puerto serie.");
exit(2);
}
DWORD mask;
if (!GetCommMask(hCommPort, &mask)) {
perror("GetCommMask");
exit(3);
}
if (!SetCommMask(hCommPort, mask | EV_ERR)) {
perror("SetCommMask");
exit(4);
}
printf("Pulse la tecla ESC para empezar a leer\n");
while ( _getch() != ESC ) { /* Do nothing */ }
//-- Crea el hilo encargado de la lectura de datos del puerto serie
HANDLE hHiloLectura;
DWORD idHiloLectura;
hHiloLectura = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)HiloLectura, &hCommPort, 0, &idHiloLectura);
if (hHiloLectura == NULL)
{
perror("ERROR: No se puede crear el hilo de lectura");
exit(5);
}
printf("Pulse la tecla ESC para salir\n");
//-- Bucle principal de escritura por el puerto serie
char c;
do
{
c = _getch();
if (c != ESC) {
serie_escribir(hCommPort, &c, sizeof(c));
}
} while (c != ESC);
//-- Termina el hilo de lectura
TerminateThread(hHiloLectura, 0);
CloseHandle(hHiloLectura);
//-- Cierra el puerto serie
serie_cerrar(hCommPort);
system("PAUSE");
return 0;
}
示例10: GetPrivateProfileString
void cConfigs::LoadConfigsInGS()
{
#ifdef _GS
DWORD *LoreGuard = (DWORD*)GUARD_SAY;
char Lore[25];
GetPrivateProfileString("Connect","GuardSay","Don't waste my time!",Lore,25,GreatDevelopGS);
memset(&LoreGuard[0],0,25);
memcpy(&LoreGuard[0],Lore,strlen(Lore));
#endif
DWORD dword;
BYTE byte;
dword = GetInt(300, 1000, 400,"LevelSettings", "MaxLevel", GreatDevelopCommon);
*(unsigned int*) GS_MAX_LEVEL1 = dword;
*(unsigned int*) GS_MAX_LEVEL2 = dword;
*(unsigned int*) GS_MAX_LEVEL3 = dword;
*(unsigned int*) GS_MAX_LEVEL4 = dword;
*(unsigned int*) GS_MAX_LEVEL5 = dword;
*(unsigned int*) GS_NOEXP_LEVEL = GetInt(401, 1001, 401,"LevelSettings", "MaxXPLevel", GreatDevelopCommon);
*(unsigned int*) GS_MAX_MASTERLEVEL = GetInt(1, 400, 200,"LevelSettings", "MaxMasterLevel", GreatDevelopCommon);
dword = GetInt(0, 360, 120,"ItemDropRates", "LootingTime", GreatDevelopItems);
*(unsigned int*) GS_ITEM_TIME1 = 1000 * dword;
*(unsigned int*) GS_ITEM_TIME2 = 1000 * dword;
*(unsigned int*) GS_TRANSFORMATIONRING1 = GetInt(0, 600, 2,"TransformationRings","TransformRing1",GreatDevelopItems);
*(unsigned int*) GS_TRANSFORMATIONRING2 = GetInt(0, 600, 7,"TransformationRings","TransformRing2",GreatDevelopItems);
*(unsigned int*) GS_TRANSFORMATIONRING3 = GetInt(0, 600, 14,"TransformationRings","TransformRing3",GreatDevelopItems);
*(unsigned int*) GS_TRANSFORMATIONRING4 = GetInt(0, 600, 8,"TransformationRings","TransformRing4",GreatDevelopItems);
*(unsigned int*) GS_TRANSFORMATIONRING5 = GetInt(0, 600, 9,"TransformationRings","TransformRing5",GreatDevelopItems);
*(unsigned int*) GS_TRANSFORMATIONRING6 = GetInt(0, 600, 41,"TransformationRings","TransformRing6",GreatDevelopItems);
*(unsigned char*) GS_SUMMONORB1 = GetChar(0, 600, 26,"SummonOrbs","OrbSummon1",GreatDevelopItems);
*(unsigned char*) GS_SUMMONORB2 = GetChar(0, 600, 32,"SummonOrbs","OrbSummon2",GreatDevelopItems);
*(unsigned char*) GS_SUMMONORB3 = GetChar(0, 600, 21,"SummonOrbs","OrbSummon3",GreatDevelopItems);
*(unsigned char*) GS_SUMMONORB4 = GetChar(0, 600, 20,"SummonOrbs","OrbSummon4",GreatDevelopItems);
*(unsigned char*) GS_SUMMONORB5 = GetChar(0, 600, 10,"SummonOrbs","OrbSummon5",GreatDevelopItems);
*(unsigned char*) GS_SUMMONORB6 = GetChar(0, 600, 150,"SummonOrbs","OrbSummon6",GreatDevelopItems);
*(unsigned char*) GS_SUMMONORB7 = GetChar(0, 600, 151,"SummonOrbs","OrbSummon7",GreatDevelopItems);
*(unsigned int*) GS_BLESS_PRICE = GetInt(0, 2000000000, 6000000,"JewelPrices","JewelOfBlessPrice",GreatDevelopItems);
*(unsigned int*) GS_SOUL_PRICE = GetInt(0, 2000000000, 9000000,"JewelPrices","JewelOfSoulPrice",GreatDevelopItems);
*(unsigned int*) GS_CHAOS_PRICE = GetInt(0, 2000000000, 810000,"JewelPrices","JewelOfChaosPrice",GreatDevelopItems);
*(unsigned int*) GS_LIFE_PRICE = GetInt(0, 2000000000, 45000000,"JewelPrices","JewelOfLifePrice",GreatDevelopItems);
*(unsigned int*) GS_CREATION_PRICE = GetInt(0, 2000000000, 36000000,"JewelPrices","JewelOfCreationPrice",GreatDevelopItems);
*(unsigned int*) GS_GUARDIAN_PRICE = GetInt(0, 2000000000, 60000000,"JewelPrices","JewelOfGuardianPrice",GreatDevelopItems);
*(unsigned int*) GS_FRUITS_PRICE = GetInt(0, 2000000000, 33000000,"JewelPrices","FruitPrice",GreatDevelopItems);
*(unsigned int*) GS_MONARCH_PRICE = GetInt(0, 2000000000, 750000,"JewelPrices","CrestOfMonarchPrice",GreatDevelopItems);
*(unsigned int*) GS_FEATHER_PRICE = GetInt(0, 2000000000, 180000,"JewelPrices","LochsFeatherPrice",GreatDevelopItems);
*(unsigned int*) GS_BLESSPOT_PRICE = GetInt(0, 2000000000, 900000,"JewelPrices","PotionOfBlessPrice",GreatDevelopItems);
*(unsigned int*) GS_SOULPOT_PRICE = GetInt(0, 2000000000, 450000,"JewelPrices","PotionOfSoulPrice",GreatDevelopItems);
#ifdef _GS
*(unsigned int*) GS_KUNDUN_ANC_PERCT = GetInt(0,10000,25,"Kundun","KundunDropAncRate",GreatDevelopItems);
*(unsigned char*) GS_KUNDUN_ITEM_NUMB = GetChar(0,20,3,"Kundun","KundunDropItemCount",GreatDevelopItems);
*(unsigned char*) GS_CCPLAYER = GetChar(0,20,2,"ChaosCastle","ChaosCastleMinPlayers",GreatDevelopEvents);
*(unsigned char*) GS_ITPLAYER = GetChar(0,20,4,"IllusionTemple","ItMinPlayers",GreatDevelopEvents);
/*
*(unsigned char*) GS_CCREWARD1 = GetChar(0,15,14,"ChaosCastle","ChaosCastleRewardType1GroupID",GreatDevelopEvents) * 512 + GetChar(0,255,16,"ChaosCastle","ChaosCastleRewardType1IndexID",GreatDevelopEvents);
*(unsigned char*) GS_CCREWARD2 = GetChar(0,15,14,"ChaosCastle","ChaosCastleRewardType2GroupID",GreatDevelopEvents) * 512 + GetChar(0,255,13,"ChaosCastle","ChaosCastleRewardType2IndexID",GreatDevelopEvents);
*(unsigned char*) GS_CCREWARD3 = GetChar(0,15,14,"ChaosCastle","ChaosCastleRewardType3GroupID",GreatDevelopEvents) * 512 + GetChar(0,255,22,"ChaosCastle","ChaosCastleRewardType3IndexID",GreatDevelopEvents);
*(unsigned char*) GS_CCREWARD4 = GetChar(0,15,14,"ChaosCastle","ChaosCastleRewardType4GroupID",GreatDevelopEvents) * 512 + GetChar(0,255,14,"ChaosCastle","ChaosCastleRewardType4IndexID",GreatDevelopEvents);
*(unsigned char*) GS_IT_GROUP_ID = GetChar(0,15,15,"IllusionTemple","ItDropGroup",GreatDevelopEvents);
*(unsigned char*) GS_IT_DROP_ID = GetChar(0,255,12,"IllusionTemple","ItDropID",GreatDevelopEvents);
*(unsigned char*) GS_IT_ITEM_LVL = GetChar(0,15,0,"IllusionTemple","ItDropLevel",GreatDevelopEvents);
*(unsigned char*) GS_IT_ITEM_SKL = GetChar(0,1,0,"IllusionTemple","ItDropWithSkill",GreatDevelopEvents);
*(unsigned char*) GS_IT_ITEM_LCK = GetChar(0,1,0,"IllusionTemple","ItDropWithLuck",GreatDevelopEvents);
*(unsigned char*) GS_IT_ITEM_LIF = GetChar(0,7,0,"IllusionTemple","ItDropLifeAdd",GreatDevelopEvents);
*(unsigned char*) GS_IT_ITEM_EXC = GetChar(0,63,0,"IllusionTemple","ItDropExcOpt",GreatDevelopEvents);
*(unsigned char*) GS_IT_ITEM_ANC = GetChar(0,255,0,"IllusionTemple","ItDropAncOpt",GreatDevelopEvents);
*(unsigned char *) GS_BC_DROP_GROUP = GetChar(0,15,15,"BloodCastle","BcDropGroup",GreatDevelopEvents);
*(unsigned char *) GS_BC_DROP_ID = GetChar(0,255,12,"BloodCastle","BcDropID",GreatDevelopEvents);
*(unsigned char *) GS_BC_ITEM_LVL = GetChar(0,15,0,"BloodCastle","BcDropLevel",GreatDevelopEvents);
*(unsigned char *) GS_BC_ITEM_SKL = GetChar(0,1,0,"BloodCastle","BcDropWithSkill",GreatDevelopEvents);
*(unsigned char *) GS_BC_ITEM_LCK = GetChar(0,1,0,"BloodCastle","BcDropWithLuck",GreatDevelopEvents);
*(unsigned char *) GS_BC_ITEM_LIF = GetChar(0,7,0,"BloodCastle","BcDropLifeAdd",GreatDevelopEvents);
*(unsigned char *) GS_BC_ITEM_EXC = GetChar(0,63,0,"BloodCastle","BcDropExcOpt",GreatDevelopEvents);
*(unsigned char *) GS_BC_ITEM_ANC = GetChar(0,255,0,"BloodCastle","BcDropAncOpt",GreatDevelopEvents);
*(unsigned char *) GS_WW_GROUP_ID = GetChar(0,15,13,"WhiteWizard","WizardDropGroup",GreatDevelopEvents);
*(unsigned char *) GS_WW_DROP_ID = GetChar(0,255,20,"WhiteWizard","WizardDropItemID",GreatDevelopEvents);
*(unsigned char *) GS_WW_ITEM_LVL = GetChar(0,15,0,"WhiteWizard","WizardDropLevel",GreatDevelopEvents);
*(unsigned char *) GS_WW_ITEM_SKL = GetChar(0,1,0,"WhiteWizard","WizardDropWithSkill",GreatDevelopEvents);
*(unsigned char *) GS_WW_ITEM_LCK = GetChar(0,1,0,"WhiteWizard","WizardDropWithLuck",GreatDevelopEvents);
*(unsigned char *) GS_WW_ITEM_LIF = GetChar(0,7,0,"WhiteWizard","WizardDropLifeAdd",GreatDevelopEvents);
*(unsigned char *) GS_WW_ITEM_EXC = GetChar(0,63,0,"WhiteWizard","WizardDropExcOpt",GreatDevelopEvents);
*(unsigned char *) GS_WW_ITEM_ANC = GetChar(0,255,0,"WhiteWizard","WizardDropAncOpt",GreatDevelopEvents);
*/
#endif
*(unsigned char*) GS_GUILDALLIANCE = GetChar(0,50,20,"Guild","GuildAllianceMinPlayers",GreatDevelopCommon);
*(unsigned char*) GS_PKBugLimitFix1 = GetChar(0, 1000, 20,"PKOptions", "PKKillLimit", GreatDevelopCommon);
*(unsigned char*) GS_PKBugLimitFix2 = GetChar(0, 1000, 20,"PKOptions", "PKKillLimit", GreatDevelopCommon);
*(unsigned char*) GS_PKBugLimitFix3 = GetChar(0, 1000, 20,"PKOptions", "PKKillLimit", GreatDevelopCommon);
//.........这里部分代码省略.........
示例11: GetHackProfileStringEx
LPSTR EXPORT GetHackProfileStringEx(LPCSTR lpHackName, LPCSTR lpSectionName, LPCSTR lpKeyName, DWORD& cSize)
{
bool bFileFound = false;
LPSTR lpFileName = new char[MAX_PATH];
LPCSTR lpDefault="";
LPSTR lpReturnedString = NULL;
LinkedItem* li;
CLIENTINFOSTRUCT* cds;
sprintf( lpFileName, "%s\\%s.ini", si->PluginDirectory, lpHackName );
// Check if the file exists
if( _access(lpFileName, 0) )
{
// Check in the dir of the loaded modules
li=ClientList.GetFirstItem();
for( int i=0; i<ClientList.GetItemCount(); i++ )
{
cds=(CLIENTINFOSTRUCT*)li->lpData;
sprintf( lpFileName, "%s\\%s.ini", cds->pDir, lpHackName );
if ( !_access(lpFileName, 0) )
{
bFileFound = true;
break;
}
li=ClientList.GetNextItem(li);
}
if( !bFileFound )
{
char t[1024];
sprintf(t, "Unable to open ini-file: ÿc4%s", lpFileName);
fep->GamePrintError(t);
delete lpFileName;
return NULL;
}
}
// Try getting the data in 1024-byte increments
DWORD alloc=0;
DWORD allocStep = 1024;
int SizeOffset;
cSize = 0;
if( !lpSectionName || !lpKeyName )
SizeOffset = 2;
else
SizeOffset = 1;
while (TRUE)
{
alloc+=allocStep;
lpReturnedString = new char[alloc];
if ( (cSize = GetPrivateProfileString(lpSectionName, lpKeyName, lpDefault, lpReturnedString, alloc, lpFileName)) < (alloc - SizeOffset) )
break;
delete lpReturnedString;
}
delete lpFileName;
szBufferList.AddItem( lpReturnedString ); // Buffer used to delete this string
// when Server exits
return lpReturnedString;
}
示例12: GetInt
void cConfigs::LoadNotice()
{
ConnectInfo = GetInt(0, 1, 1, "Connect", "ConnectInfo", GreatDevelopGS);
GetPrivateProfileString("Connect","ConnectNotice","Powered by GreatDevelop 1.0.2",ConnectNotice,sizeof(ConnectNotice),GreatDevelopGS);
Log.CheckProcent(ConnectNotice);
}
示例13: InitSettings
void InitSettings(void)
{
char fname[_MAX_FNAME+MAX_PATH], scriptPath[_MAX_PATH], defaultStarter[_MAX_FNAME], defaultGame[_MAX_FNAME],
debug[6], quitOnHostile[6], quitOnError[6], maxGameTime[6], gameTimeout[6],
startAtMenu[6], disableCache[6], memUsage[6], gamePrint[6], useProfilePath[6], logConsole[6];
sprintf_s(fname, sizeof(fname), "%sd2bs.ini", Vars.szPath);
GetPrivateProfileString("settings", "ScriptPath", "scripts", scriptPath, _MAX_PATH, fname);
GetPrivateProfileString("settings", "DefaultGameScript", "default.dbj", defaultGame, _MAX_FNAME, fname);
GetPrivateProfileString("settings", "DefaultStarterScript", "starter.dbj", defaultStarter, _MAX_FNAME, fname);
GetPrivateProfileString("settings", "MaxGameTime", "0", maxGameTime, 6, fname);
GetPrivateProfileString("settings", "Debug", "false", debug, 6, fname);
GetPrivateProfileString("settings", "QuitOnHostile", "false", quitOnHostile, 6, fname);
GetPrivateProfileString("settings", "QuitOnError", "false", quitOnError, 6, fname);
GetPrivateProfileString("settings", "StartAtMenu", "true", startAtMenu, 6, fname);
GetPrivateProfileString("settings", "DisableCache", "true", disableCache, 6, fname);
GetPrivateProfileString("settings", "MemoryLimit", "50", memUsage, 6, fname);
GetPrivateProfileString("settings", "UseGamePrint", "false", gamePrint, 6, fname);
GetPrivateProfileString("settings", "GameReadyTimeout", "5", gameTimeout, 6, fname);
GetPrivateProfileString("settings", "UseProfileScript", "false", useProfilePath, 6, fname);
GetPrivateProfileString("settings", "LogConsoleOutput", "false", logConsole, 6, fname);
sprintf_s(Vars.szScriptPath, _MAX_PATH, "%s%s", Vars.szPath, scriptPath);
strcpy_s(Vars.szStarter, _MAX_FNAME, defaultStarter);
strcpy_s(Vars.szDefault, _MAX_FNAME, defaultGame);
Vars.dwGameTime = GetTickCount();
Vars.dwMaxGameTime = abs(atoi(maxGameTime) * 1000);
Vars.dwGameTimeout = abs(atoi(gameTimeout) * 1000);
Vars.bQuitOnHostile = StringToBool(quitOnHostile);
Vars.bQuitOnError = StringToBool(quitOnError);
Vars.bStartAtMenu = StringToBool(startAtMenu);
Vars.bDisableCache = StringToBool(disableCache);
Vars.bUseGamePrint = StringToBool(gamePrint);
Vars.bUseProfileScript = StringToBool(useProfilePath);
Vars.bLogConsole = StringToBool(logConsole);
Vars.dwMemUsage = abs(atoi(memUsage));
if(Vars.dwMemUsage < 1)
Vars.dwMemUsage = 50;
Vars.dwMemUsage *= 1024*1024;
Vars.oldWNDPROC = NULL;
}
示例14: uploadFile
// Uploads the PNG file to Gyazo
BOOL uploadFile(HWND hwnd, LPCTSTR fileName, BOOL isPng)
{
const int nSize = 256;
LPCTSTR DEFAULT_UPLOAD_SERVER = _T("upload.gyazo.com");
LPCTSTR DEFAULT_UPLOAD_PATH = _T("/upload.cgi");
LPCTSTR DEFAULT_UPLOAD_TOKEN = _T("");
//LPCTSTR DEFAULT_USER_AGENT = _T("User-Agent: Gyazowin/1.0\r\n");
const int DEFAULT_UPLOAD_SERVER_PORT = INTERNET_DEFAULT_HTTP_PORT;
TCHAR upload_server[nSize];
TCHAR upload_path[nSize];
TCHAR upload_token[nSize];
//TCHAR ua[nSize];
lstrcpy(upload_server, DEFAULT_UPLOAD_SERVER);
lstrcpy(upload_path, DEFAULT_UPLOAD_PATH);
lstrcpy(upload_token, DEFAULT_UPLOAD_TOKEN);
//lstrcpy(ua, DEFAULT_USER_AGENT);
int upload_server_port = DEFAULT_UPLOAD_SERVER_PORT;
TCHAR runtime_path[MAX_PATH+1];
TCHAR runtime_dirname[MAX_PATH+1];
TCHAR config_file[MAX_PATH+1];
if (0 != ::GetModuleFileName(NULL, runtime_path, MAX_PATH)) {
TCHAR tmp[MAX_PATH+1];
_tsplitpath_s(runtime_path, tmp, runtime_dirname, tmp, tmp);
}
lstrcpy(config_file, runtime_dirname);
lstrcat(config_file, _T("\\gyazo.ini"));
if (PathFileExists(config_file)) {
LPCTSTR SECTION_NAME = _T("gyazo");
GetPrivateProfileString(SECTION_NAME, _T("server"), DEFAULT_UPLOAD_SERVER, upload_server, sizeof(upload_server), config_file);
GetPrivateProfileString(SECTION_NAME, _T("path"), DEFAULT_UPLOAD_PATH, upload_path, sizeof(upload_path), config_file);
GetPrivateProfileString(SECTION_NAME, _T("token"), DEFAULT_UPLOAD_TOKEN, upload_token, sizeof(upload_token), config_file);
//GetPrivateProfileString(SECTION_NAME, _T("user_agent"), DEFAULT_USER_AGENT, ua, sizeof(ua), config_file);
upload_server_port = GetPrivateProfileInt(SECTION_NAME, _T("port"), DEFAULT_UPLOAD_SERVER_PORT, config_file);
}
const char* sBoundary = "----BOUNDARYBOUNDARY----"; // boundary
const char sCrLf[] = { 0xd, 0xa, 0x0 }; // 改行(CR+LF)
TCHAR szHeader[200];
StringCchPrintf(szHeader, 200, TEXT("Auth-Token: %s\r\nContent-type: multipart/form-data; boundary=----BOUNDARYBOUNDARY----"), upload_token);
std::ostringstream buf; // 送信メッセージ
wchar_t fname[_MAX_FNAME];
wchar_t ext[_MAX_EXT];
_wsplitpath(fileName, NULL, NULL, fname, ext );
std::string data = (isPng) ? "imagedata" : "data";
LPCTSTR file = (isPng) ? _T("gyazo") : wcsncat(fname, ext, _MAX_FNAME);
size_t size = wcstombs(NULL, file, 0);
char* CharStr = new char[size + 1];
wcstombs(CharStr, file, size + 1);
// -- "imagedata" part
buf << "--";
buf << sBoundary;
buf << sCrLf;
buf << "content-disposition: form-data; name=\"";
buf << data;
buf << "\"; filename=\"";
buf << CharStr;
buf << "\"";
buf << sCrLf;
//buf << "Content-type: image/png"; // 一応
//buf << sCrLf;
buf << sCrLf;
// 本文: PNG ファイルを読み込む
std::ifstream png;
png.open(fileName, std::ios::binary);
if (png.fail()) {
MessageBox(hwnd, _T("PNG open failed"), szTitle, MB_ICONERROR | MB_OK);
png.close();
return FALSE;
}
buf << png.rdbuf(); // read all & append to buffer
png.close();
// 最後
buf << sCrLf;
buf << "--";
buf << sBoundary;
buf << "--";
buf << sCrLf;
// メッセージ完成
std::string oMsg(buf.str());
// WinInet を準備 (proxy は 規定の設定を利用)
HINTERNET hSession = InternetOpen(_T("Gyazowin/1.0"),
INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if(NULL == hSession) {
LastErrorMessageBox(hwnd, _T("Cannot configure wininet."));
return FALSE;
}
// 接続先
HINTERNET hConnection = InternetConnect(hSession,
//.........这里部分代码省略.........
示例15: read_saved
/*+*************************************************************************
**
** read_saved
**
** Reads all the hosts listed in the INI file.
**
***************************************************************************/
static void
read_saved (void) {
int i; /* Index */
char buff[32];
for (i = 0; MAX_SAVED; ++i) { /* Read this many entries */
wsprintf (buff, INI_HOST "%d", i);
GetPrivateProfileString(INI_HOSTS, buff, "", hosts[i], 256, GSSAPI_INI);
if (*hosts[i] == '\0') /* No more entries??? */
break;
}
for (i = 0; MAX_SAVED; ++i) { /* Read this many entries */
wsprintf (buff, INI_SVC "%d", i);
GetPrivateProfileString(INI_SVCS, buff, "", svcs[i], 256, GSSAPI_INI);
if (*svcs[i] == '\0') /* No more entries??? */
break;
}
for (i = 0; MAX_SAVED; ++i) { /* Read this many entries */
wsprintf (buff, INI_MSG "%d", i);
GetPrivateProfileString(INI_MSGS, buff, "", msgs[i], 256, GSSAPI_INI);
if (*msgs[i] == '\0') /* No more entries??? */
break;
}
for (i = 0; MAX_SAVED; ++i) { /* Read this many entries */
wsprintf (buff, INI_MECH "%d", i);
GetPrivateProfileString(INI_MECHS, buff, "", mechs[i], 256, GSSAPI_INI);
if (*mechs[i] == '\0') /* No more entries??? */
break;
}
GetPrivateProfileString(INI_LAST, INI_LAST_HOST, "", szHost, 256, GSSAPI_INI);
GetPrivateProfileString(INI_LAST, INI_LAST_PORT, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
port = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_SVC, "", szService, 256, GSSAPI_INI);
GetPrivateProfileString(INI_LAST, INI_LAST_MSG, "", szMessage, 256, GSSAPI_INI);
GetPrivateProfileString(INI_LAST, INI_LAST_MECH, "", szMech, 256, GSSAPI_INI);
GetPrivateProfileString(INI_LAST, INI_LAST_CCACHE, "", szCCache, 256, GSSAPI_INI);
GetPrivateProfileString(INI_LAST, INI_LAST_DELEGATE, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
delegate = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_MUTUAL, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
mutual = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_REPLAY, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
replay = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_SEQUENCE, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
sequence = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_VERBOSE, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
verbose = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_CCOUNT, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
ccount = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_MCOUNT, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
mcount = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_VER1, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
gssv1 = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_NOAUTH, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
noauth = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_NOWRAP, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
nowrap = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_NOCRYPT, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
nocrypt = atoi(buff);
GetPrivateProfileString(INI_LAST, INI_LAST_NOMIC, "", buff, 32, GSSAPI_INI);
if ( buff[0] )
nomic = atoi(buff);
}