Image MakeDragImage(const Image& arrow, const Image& arrow98, Image sample) { #ifdef PLATFORM_WIN32 if(IsWin2K()) return MakeDragImage(arrow, sample); else #endif return arrow98; }
/* WinMain */ int WINAPI WinMain(HINSTANCE hI, HINSTANCE, LPSTR cmdLine, int nCmdShow) { if (!IsWin2K()) { MessageBox(0, "Please use old version (v2.06 or earlier)", "Win95/98/Me/NT4.0 is not support", MB_OK); ::ExitProcess(0xffffffff); return 0; } TInstApp app(hI, cmdLine, nCmdShow); return app.Run(); }
void CWinAppEx::UpdateSystemParameters() { m_info.cbSize = sizeof( NONCLIENTMETRICS ); VERIFY( ::SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof( m_info ), &m_info, 0 ) ); if ( IsWin50() ) { VERIFY( ::SystemParametersInfo( SPI_GETMENUANIMATION, 0, &m_bMenuAnimation, 0 ) ); if ( IsWin2K() ) { VERIFY( ::SystemParametersInfo( SPI_GETMENUUNDERLINES, 0, &m_bMenuUnderlines, 0 ) ); VERIFY( ::SystemParametersInfo( SPI_GETUIEFFECTS, 0, &m_bUIEffects, 0 ) ); VERIFY( ::SystemParametersInfo( SPI_GETMENUFADE, 0, &m_bMenuFade, 0 ) ); if ( IsWinXP() ) { VERIFY( ::SystemParametersInfo( SPI_GETFLATMENU, 0, &m_bFlatMenu, 0 ) ); } } } }
bool CWinAppEx::GetMenuFade() const { ASSERT( IsWin2K() ); return ( m_bUIEffects && m_bMenuFade ); }
bool CWinAppEx::GetMenuUnderlines() const { ASSERT( IsWin2K() ); return ( m_bUIEffects && m_bMenuUnderlines ); }
bool CWinAppEx::GetMenuAnimation() const { ASSERT( IsWin50() ); return ( ( !IsWin2K() || m_bUIEffects ) && m_bMenuAnimation ); }
BOOL Cfg::ReadRegistry(void) { char buf[MAX_BUF], val[MAX_BUF]; int i; GetRegName(buf, nicAddr, portNo); TRegistry reg(HS_TOOLS, buf); if (!reg.GetInt(NOPOPUPCHECK_STR, &NoPopupCheck)) { GetRegName(buf, 0, portNo); reg.ChangeApp(HS_TOOLS, buf); if (!reg.GetInt(NOPOPUPCHECK_STR, &NoPopupCheck)) reg.ChangeApp(HS_TOOLS, GetLoadStr(IDS_IPMSG)); } lcid = -1; NoBeep = FALSE; NoTcp = FALSE; ListGet = FALSE; HotKeyCheck = TRUE; HotKeyModify = MOD_ALT|MOD_CONTROL; HotKeySend = 'S'; HotKeyRecv = 'R'; HotKeyMisc = 'D'; ListGetMSec = IPMSG_DEFAULT_LISTGETMSEC; RetryMSec = IPMSG_DEFAULT_RETRYMSEC; RetryMax = IPMSG_DEFAULT_RETRYMAX; RecvMax = IsWinNT() ? IPMSG_DEFAULT_RECVMAX_NT : IPMSG_DEFAULT_RECVMAX_95; NoErase = FALSE; Debug = FALSE; NoPopupCheck = TRUE; OpenCheck = 1; AbsenceSave = FALSE; AbsenceCheck = FALSE; AbsenceMax = IPMSG_DEFAULT_ABSENCEMAX; AbsenceChoice = 0; FindMax = IPMSG_DEFAULT_FINDMAX; FindAll = TRUE; DelayTime = IPMSG_DEFAULT_DELAY; QuoteCheck = TRUE; SecretCheck = TRUE; LogonLog = TRUE; RecvLogonDisp = FALSE; IPAddrCheck = TRUE; RecvIPAddr = TRUE; OneClickPopup = FALSE; BalloonNotify = TRUE; TrayIcon = TRUE; AbnormalButton = FALSE; DialUpCheck = FALSE; *NickNameStr = 0; *GroupNameStr = 0; AbsenceNonPopup = TRUE; Sort = IPMSG_NAMESORT; UpdateTime = IPMSG_DEFAULT_UPDATETIME; KeepHostTime = IPMSG_DEFAULT_KEEPHOSTTIME; DefaultUrl = TRUE; ShellExec = FALSE; ExtendEntry = TRUE; ExtendBroadcast = 1; MulticastMode = 0; ControlIME = 1; GridLineCheck = TRUE; PriorityMax = DEFAULT_PRIORITYMAX; PriorityReject = 0; AllowSendList = TRUE; fileTransOpt = 0; ResolveOpt = 0; LetterKey = IsLang(LANG_JAPANESE) ? FALSE : TRUE; RemoteGraceSec = IPMSG_DEFAULT_REMOTEGRACE; RemoteRebootMode = 0; *RemoteReboot = 0; RemoteExitMode = 0; *RemoteExit = 0; ClipMode = IPMSG_DEFAULT_CLIPMODE; ClipMax = IPMSG_DEFAULT_CLIPMAX; CaptureDelay = 300; CaptureDelayEx = 500; CaptureMinimize = TRUE; CaptureClip = TRUE; CaptureSave = FALSE; OpenMsgTime = IPMSG_DEFAULT_OPENMSGTIME; RecvMsgTime = IPMSG_DEFAULT_RECVMSGTIME; BalloonNoInfo = FALSE; TaskbarUI = /*IsWin7() ? TRUE :*/ FALSE; MarkerThick = IPMSG_DEFAULT_MARKER_THICK; IPv6Mode = IPv6ModeNext = 0; strcpy(IPv6Multicast, IPMSG_DEFAULT_MULTICAST_ADDR6); // in ipmsg.h ViewMax = IPMSG_DEFAULT_VIEWMAX; TransMax = IPMSG_DEFAULT_TRANSMAX; TcpbufMax = IPMSG_DEFAULT_TCPBUFMAX; IoBufMax = IPMSG_DEFAULT_IOBUFMAX; LumpCheck = FALSE; EncTransCheck = TRUE; lruUserMax = IPMSG_DEFAULT_LRUUSERMAX; // CryptProtectData is available only Win2K/XP for (i=0; i < MAX_KEY; i++) { priv[i].encryptType = IsWin2K() ? PRIV_BLOB_DPAPI : PRIV_BLOB_RAW; } strncpyz(QuoteStr, IPMSG_DEFAULT_QUOTE, sizeof(QuoteStr)); SendWidth[SW_NICKNAME] = IPMSG_DEFAULT_NICKNAMEWIDTH; SendWidth[SW_ABSENCE] = IPMSG_DEFAULT_ABSENCEWIDTH; SendWidth[SW_GROUP] = IPMSG_DEFAULT_GROUPWIDTH; SendWidth[SW_HOST] = IPMSG_DEFAULT_HOSTWIDTH; SendWidth[SW_IPADDR] = IPMSG_DEFAULT_IPADDRWIDTH; SendWidth[SW_USER] = IPMSG_DEFAULT_USERWIDTH; SendWidth[SW_PRIORITY] = IPMSG_DEFAULT_PRIORITYWIDTH; ColumnItems = 0; SetItem(&ColumnItems, SW_NICKNAME, TRUE); SetItem(&ColumnItems, SW_GROUP, TRUE); SetItem(&ColumnItems, SW_HOST, TRUE); for (i=0; i < MAX_SENDWIDTH; i++) SendOrder[i] = i; SendXdiff = 0; SendYdiff = 0; SendMidYdiff = 0; SendSavePos = 0; SendXpos = 0; SendYpos = 0; RecvXdiff = 0; RecvYdiff = 0; RecvSavePos = 0; RecvXpos = 0; RecvYpos = 0; HistWidth[HW_USER] = IPMSG_DEFAULT_HWUSER_WIDTH; HistWidth[HW_ODATE] = IPMSG_DEFAULT_HWODATE_WIDTH; HistWidth[HW_SDATE] = IPMSG_DEFAULT_HWSDATE_WIDTH; HistWidth[HW_ID] = IPMSG_DEFAULT_HWID_WIDTH; HistXdiff = 0; HistYdiff = 0; LogCheck = TRUE; LogUTF8 = TRUE; PasswdLogCheck = FALSE; *SoundFile = 0; *IconFile = 0; *RevIconFile = 0; *lastSaveDir = *lastOpenDir = 0; *autoSaveDir = 0; autoSaveTout = IPMSG_DEFAULT_AUTOSAVE_TOUT; autoSaveLevel = 0; autoSaveFlags = 0; autoSaveMax = IPMSG_DEFAULT_AUTOSAVE_MAX; memset(&SendEditFont, 0, sizeof(SendEditFont)); memset(&SendListFont, 0, sizeof(SendListFont)); memset(&RecvHeadFont, 0, sizeof(RecvHeadFont)); memset(&RecvEditFont, 0, sizeof(RecvEditFont)); memset(&LogViewFont, 0, sizeof(LogViewFont)); reg.GetInt(LCID_KEY, &lcid); reg.GetInt(NOBEEP_STR, &NoBeep); reg.GetInt(NOTCP_STR, &NoTcp); reg.GetInt(LISTGET_STR, &ListGet); reg.GetInt(LISTGETMSEC_STR, (int *)&ListGetMSec); reg.GetInt(RETRYMSEC_STR, (int *)&RetryMSec); reg.GetInt(RETRYMAX_STR, (int *)&RetryMax); reg.GetInt(IsWinNT() ? RECVMAXNT_STR : RECVMAX95_STR, (int *)&RecvMax); reg.GetInt(NOERASE_STR, &NoErase); reg.GetInt(DEBUG_STR, &Debug); reg.GetInt(NOPOPUPCHECK_STR, &NoPopupCheck); reg.GetInt(OPENCHECK_STR, &OpenCheck); reg.GetInt(ABSENCESAVE_STR, &AbsenceSave); if (AbsenceSave) reg.GetInt(ABSENCECHECK_STR, &AbsenceCheck); reg.GetInt(ABSENCEMAX_STR, &AbsenceMax); reg.GetInt(ALLOWSENDLIST_STR, &AllowSendList); reg.GetInt(FILETRANSOPT_STR, &fileTransOpt); reg.GetInt(RESOLVEOPT_STR, &ResolveOpt); reg.GetInt(LETTERKEY_STR, &LetterKey); reg.GetInt(REMOTEGRACE_STR, &RemoteGraceSec); reg.GetStr(REBOOT_STR, RemoteReboot, sizeof(RemoteReboot)); reg.GetInt(REBOOTMODE_STR, &RemoteRebootMode); reg.GetStr(EXIT_STR, RemoteExit, sizeof(RemoteExit)); reg.GetInt(EXITMODE_STR, &RemoteExitMode); reg.GetInt(CLIPMODE_STR, &ClipMode); ClipMode |= CLIP_ENABLE; reg.GetInt(CLIPMAX_STR, &ClipMax); reg.GetInt(CAPTUREDELAY_STR, &CaptureDelay); reg.GetInt(CAPTUREDELAYEX_STR, &CaptureDelayEx); reg.GetInt(CAPTUREMINIMIZE_STR, &CaptureMinimize); reg.GetInt(CAPTURECLIP_STR, &CaptureClip); reg.GetInt(CAPTURESAVE_STR, &CaptureSave); reg.GetInt(OPENMSGTIME_STR, &OpenMsgTime); reg.GetInt(RECVMSGTIME_STR, &RecvMsgTime); reg.GetInt(BALLOONNOINFO_STR, &BalloonNoInfo); reg.GetInt(TASKBARUI_STR, &TaskbarUI); reg.GetInt(MARKERTHICK_STR, &MarkerThick); reg.GetStr(IPV6MULITCAST, IPv6Multicast, sizeof(IPv6Multicast)); if (IsWinVista()) { reg.GetInt(IPV6MODE_STR, &IPv6Mode); if (nicAddr.size == 16 && !IPv6Mode) IPv6Mode = 2; reg.GetStr(IPV6MULITCAST, IPv6Multicast, sizeof(IPv6Multicast)); if (!*IPv6Multicast) { strcpy(IPv6Multicast, IPMSG_DEFAULT_MULTICAST_ADDR6); // in ipmsg.h } } IPv6ModeNext = IPv6Mode; // for File Transfer reg.GetInt(VIEWMAX_STR, &ViewMax); if (ViewMax < 1024 * 1024) // 1MB 以下の MapFileOfView は認めない ViewMax = IPMSG_DEFAULT_VIEWMAX; reg.GetInt(TRANSMAX_STR, &TransMax); if (TransMax < 8 * 1024) // 8KB 以下の file transfer buf は認めない TransMax = IPMSG_DEFAULT_TRANSMAX; reg.GetInt(TCPBUFMAX_STR, &TcpbufMax); if (TcpbufMax < 8 * 1024) // 8KB 以下の sockbuf は認めない TcpbufMax = IPMSG_DEFAULT_TCPBUFMAX; reg.GetInt(IOBUFMAX_STR, &IoBufMax); if (IoBufMax < TransMax) // transmax 以下の IO/Buf は認めない IoBufMax = TransMax; reg.GetInt(LUMPCHECK_STR, &LumpCheck); reg.GetInt(ENCTRANSCHECK_STR, &EncTransCheck); // for Absence Message typedef char MaxBuf[MAX_PATH_U8]; AbsenceStr = new MaxBuf[AbsenceMax]; memset(AbsenceStr, 0, MAX_PATH_U8 * AbsenceMax); reg.GetStr(ABSENCESTR_STR, AbsenceStr[0], sizeof(AbsenceStr[0])); typedef char MaxHead[MAX_NAMEBUF]; AbsenceHead = new MaxHead[AbsenceMax]; memset(AbsenceHead, 0, MAX_NAMEBUF * AbsenceMax); if (reg.CreateKey(ABSENCESTR_STR)) { for (i=0; i < AbsenceMax; i++) { char key[MAX_PATH_U8]; sprintf(key, "%s%d", ABSENCESTR_STR, i); if (!reg.GetStr(key, AbsenceStr[i], sizeof(AbsenceStr[i]))) strncpyz(AbsenceStr[i], DefaultAbsence[i < IPMSG_DEFAULT_ABSENCEMAX ? i : 0], MAX_PATH_U8); sprintf(key, "%s%d", ABSENCEHEAD_STR, i); if (!reg.GetStr(key, AbsenceHead[i], sizeof(AbsenceHead[i]))) strcpy(AbsenceHead[i], DefaultAbsenceHead[i < IPMSG_DEFAULT_ABSENCEMAX ? i : 0]); } reg.CloseKey(); } // Find User typedef char MaxFind[MAX_NAMEBUF]; if (reg.CreateKey(FINDSTR_STR)) { reg.GetInt(FINDMAX_STR, &FindMax); reg.GetInt(FINDALL_STR, &FindAll); FindStr = new MaxFind[FindMax]; for (i=0; i < FindMax; i++) { char key[MAX_PATH_U8]; sprintf(key, "%d", i); if (!reg.GetStr(key, FindStr[i], sizeof(FindStr[i]))) FindStr[i][0] = '\0'; } reg.CloseKey(); } else { FindStr = new MaxFind[FindMax]; memset(FindStr, 0, MAX_NAMEBUF * FindMax); } reg.GetInt(LRUUSERMAX_STR, &lruUserMax); if (reg.OpenKey(LRUUSERKEY_STR)) { for (i=0; ; i++) { sprintf(buf, "%d", i); if (!reg.OpenKey(buf)) break; UsersObj *obj = new UsersObj; for (int j=0; ; j++) { sprintf(buf, "%d", j); if (!reg.OpenKey(buf)) break; UserObj *u = new UserObj; if (reg.GetStr(USERNAME_STR, u->hostSub.userName, sizeof(u->hostSub.userName)) && reg.GetStr(HOSTNAME_STR, u->hostSub.hostName, sizeof(u->hostSub.userName))) { obj->users.AddObj(u); } reg.CloseKey(); } reg.CloseKey(); lruUserList.AddObj(obj); } reg.CloseKey(); } *PasswordStr = 0; reg.GetStr(PASSWORD_STR, PasswordStr, sizeof(PasswordStr)); reg.GetInt(PASSWDLOGCHECK_STR, &PasswdLogCheck); reg.GetInt(DELAYTIME_STR, &DelayTime); reg.GetInt(QUOTECHECK_STR, &QuoteCheck); reg.GetInt(SECRETCHECK_STR, &SecretCheck); reg.GetInt(LOGONLOG_STR, &LogonLog); reg.GetInt(RECVLOGONDISP_STR, &RecvLogonDisp); reg.GetInt(IPADDRCHECK_STR, &IPAddrCheck); reg.GetInt(RECVIPADDRCHECK_STR, &RecvIPAddr); reg.GetInt(ONECLICKPOPUP_STR, &OneClickPopup); reg.GetInt(BALLOONNOTIFY_STR, &BalloonNotify); reg.GetInt(TRAYICON_STR, &TrayIcon); reg.GetInt(ABNORMALBTN_STR, &AbnormalButton); reg.GetInt(DIALUPCHECK_STR, &DialUpCheck); reg.GetInt(ABSENCENONPOPUP_STR, &AbsenceNonPopup); reg.GetStr(NICKNAMESTR_STR, NickNameStr, sizeof(NickNameStr)); StrictUTF8(NickNameStr); reg.GetStr(GROUPNAMESTR_STR, GroupNameStr, sizeof(GroupNameStr)); StrictUTF8(GroupNameStr); reg.GetLong(SORT_STR, (long *)&Sort); // reg.GetInt(UPDATETIME_STR, &UpdateTime); reg.GetInt(KEEPHOSTTIME_STR, &KeepHostTime); reg.GetInt(DEFAULTURL_STR, &DefaultUrl); reg.GetInt(SHELLEXEC_STR, &ShellExec); reg.GetInt(EXTENDENTRY_STR, &ExtendEntry); reg.GetInt(EXTENDBROADCAST_STR, &ExtendBroadcast); reg.GetInt(MULTICASTMODE_STR, &MulticastMode); reg.GetInt(CONTROLIME_STR, &ControlIME); reg.GetInt(GRIDLINE_STR, &GridLineCheck); reg.GetInt(COLUMNITEMS_STR, (int *)&ColumnItems); reg.GetStr(QUOTESTR_STR, QuoteStr, sizeof(QuoteStr)); if (reg.CreateKey(HOTKEY_STR)) { reg.GetInt(HOTKEYCHECK_STR, &HotKeyCheck); reg.GetInt(HOTKEYMODIFY_STR, &HotKeyModify); reg.GetInt(HOTKEYSEND_STR, &HotKeySend); reg.GetInt(HOTKEYRECV_STR, &HotKeyRecv); reg.GetInt(HOTKEYMISC_STR, &HotKeyMisc); reg.CloseKey(); } reg.GetInt(LOGCHECK_STR, &LogCheck); reg.GetInt(LOGUTF8_STR, &LogUTF8); if (!reg.GetStr(LOGFILE_STR, LogFile, sizeof(LogFile)) || !*LogFile) strncpyz(LogFile, "ipmsg.log", sizeof(LogFile)); LogMng::StrictLogFile(LogFile); reg.GetStr(SOUNDFILE_STR, SoundFile, sizeof(SoundFile)); reg.GetStr(ICON_STR, IconFile, sizeof(IconFile)); reg.GetStr(REVICON_STR, RevIconFile, sizeof(RevIconFile)); reg.GetStr(LASTOPEN_STR, lastOpenDir, sizeof(lastOpenDir)); reg.GetStr(LASTSAVE_STR, lastSaveDir, sizeof(lastSaveDir)); reg.GetStr(AUTOSAVEDIR_STR, autoSaveDir, sizeof(autoSaveDir)); reg.GetInt(AUTOSAVETOUT_STR, &autoSaveTout); reg.GetInt(AUTOSAVEMAX_STR, &autoSaveMax); reg.GetInt(AUTOSAVEFLAGS_STR, &autoSaveFlags); reg.GetInt(AUTOSAVELEVEL_STR, &autoSaveLevel); // Send/Recv Window Location if (reg.CreateKey(WINSIZE_STR)) { reg.GetInt(SENDNICKNAME_STR, &SendWidth[SW_NICKNAME]); reg.GetInt(SENDUSERNAME_STR, &SendWidth[SW_USER]); reg.GetInt(SENDABSENCE_STR, &SendWidth[SW_ABSENCE]); reg.GetInt(SENDPRIORITY_STR, &SendWidth[SW_PRIORITY]); reg.GetInt(SENDGROUPNAME_STR, &SendWidth[SW_GROUP]); reg.GetInt(SENDHOSTNAME_STR, &SendWidth[SW_HOST]); reg.GetInt(SENDIPADDR_STR, &SendWidth[SW_IPADDR]); if (reg.CreateKey(SENDORDER_STR)) { for (i=0; i < MAX_SENDWIDTH; i++) { sprintf(buf, "%d", i); reg.GetInt(buf, &SendOrder[i]); } reg.CloseKey(); } for (i=0; i < MAX_SENDWIDTH; i++) { if (SendOrder[i] >= MAX_SENDWIDTH || SendOrder[i] < 0) break; int i2; for (i2=i+1; i2 < MAX_SENDWIDTH; i2++) if (SendOrder[i] == SendOrder[i2]) break; if (i2 != MAX_SENDWIDTH) break; } if (i != MAX_SENDWIDTH) for (i=0; i < MAX_SENDWIDTH; i++) SendOrder[i] = i; reg.GetInt(SENDXDIFF_STR, &SendXdiff); reg.GetInt(SENDYDIFF_STR, &SendYdiff); reg.GetInt(SENDMIDYDIFF_STR, &SendMidYdiff); reg.GetInt(SENDSAVEPOS_STR, &SendSavePos); reg.GetInt(SENDXPOS_STR, &SendXpos); reg.GetInt(SENDYPOS_STR, &SendYpos); reg.GetInt(RECVXDIFF_STR, &RecvXdiff); reg.GetInt(RECVYDIFF_STR, &RecvYdiff); reg.GetInt(RECVSAVEPOS_STR, &RecvSavePos); reg.GetInt(RECVXPOS_STR, &RecvXpos); reg.GetInt(RECVYPOS_STR, &RecvYpos); reg.GetInt(HISTXDIFF_STR, &HistXdiff); reg.GetInt(HISTYDIFF_STR, &HistYdiff); reg.GetInt(HISTUSER_STR, &HistWidth[HW_USER]); reg.GetInt(HISTODATE_STR, &HistWidth[HW_ODATE]); reg.GetInt(HISTSDATE_STR, &HistWidth[HW_SDATE]); reg.GetInt(HISTID_STR, &HistWidth[HW_ID]); reg.CloseKey(); } // Send/Recv Window Font if (reg.CreateKey(FONT_STR)) { ReadFontRegistry(®, SENDEDITFONT_STR, &SendEditFont); ReadFontRegistry(®, SENDLISTFONT_STR, &SendListFont); ReadFontRegistry(®, RECVHEADFONT_STR, &RecvHeadFont); ReadFontRegistry(®, RECVEDITFONT_STR, &RecvEditFont); ReadFontRegistry(®, LOGVIEWFONT_STR, &LogViewFont); reg.CloseKey(); } // Broadcast Data if (reg.CreateKey(BROADCAST_STR)) { i = 0; while (1) { sprintf(buf, "%d", i++); if (!reg.GetStr(buf, val, sizeof(val))) break; brList.SetHostRaw(val, (ResolveOpt & RS_REALTIME) ? 0 : ResolveAddr(val)); } reg.CloseKey(); } // Clickable URL for (i=0; DefaultUrlProtocol[i]; i++) { UrlObj *obj = new UrlObj; strncpyz(obj->protocol, DefaultUrlProtocol[i], sizeof(obj->protocol)); *obj->program = 0; urlList.AddObj(obj); } if (reg.CreateKey(CLICKABLEURL_STR)) { for (i = 0; reg.EnumValue(i, buf, sizeof(buf)) || reg.EnumKey(i, buf, sizeof(buf)); i++) { UrlObj *obj; for (obj = urlList.TopObj(); obj; obj = urlList.NextObj(obj)) if (stricmp(obj->protocol, buf) == 0) break; if (obj == NULL) { obj = new UrlObj; urlList.AddObj(obj); } strncpyz(obj->protocol, buf, sizeof(obj->protocol)); reg.GetStr(buf, obj->program, sizeof(obj->program)); } reg.CloseKey(); } // User Sort Priority if (reg.CreateKey(PRIORITY_STR)) { reg.GetInt(PRIORITYMAX_STR, &PriorityMax); reg.GetInt(PRIORITYREJECT_STR, &PriorityReject); #if 0 PrioritySound = new char *[PriorityMax]; for (int i=0; i < PriorityMax; i++) { sprintf(buf, "%d", i); if (reg.CreateKey(buf)) { if (reg.GetStr(PRIORITYSOUND_STR, buf, sizeof(buf)) && *buf != '\0') PrioritySound[i] = strdup(buf); reg.CloseKey(); } } #endif reg.CloseKey(); } if (reg.CreateKey(HOSTINFO_STR)) { int i = 0, priority = DEFAULT_PRIORITY; Host *host; Time_t default_time = Time() - KeepHostTime / 2; // 90 日 BOOL rewriteFlg = FALSE; priorityHosts.Enable(THosts::NAME, TRUE); fileHosts.Enable(THosts::NAME_ADDR, TRUE); for (i = 0; reg.EnumValue(i, buf, sizeof(buf)) || reg.EnumKey(i, buf, sizeof(buf)); i++) { if (!reg.OpenKey(buf)) break; BYTE pubkey[512]; int pubkeySize = sizeof(pubkey); if (!reg.GetByte(PUBLICKEY_STR, pubkey, &pubkeySize)) pubkeySize = 0; if ((!reg.GetInt(PRIORITY_STR, &priority) || priority == DEFAULT_PRIORITY) && pubkeySize == 0) { rewriteFlg = TRUE; } else { host = new Host; host->priority = priority; reg.GetStr(USERNAME_STR, host->hostSub.userName, MAX_NAMEBUF); reg.GetStr(HOSTNAME_STR, host->hostSub.hostName, MAX_NAMEBUF); reg.GetLong(IPADDR_STR, (long *)&host->hostSub.addr); reg.GetInt(PORTNO_STR, &host->hostSub.portNo); reg.GetStr(NICKNAME_STR, host->nickName, MAX_NAMEBUF); reg.GetStr(GROUPNAME_STR, host->groupName, MAX_NAMEBUF); reg.GetStr(ALTERNAME_STR, host->alterName, MAX_NAMEBUF); if (!reg.GetLong(UPDATETIME_STR, (long *)&host->updateTime)) { host->updateTime = default_time; } if (pubkeySize) { host->pubKey.UnSerialize(pubkey, pubkeySize); // 古いエントリを削除にする処理は、一旦、様子見 // char *p = (char *)GetUserNameDigestField(host->hostSub.userName); // if (p) { // *p = 0; // Host *tmpHost = priorityHosts.GetHostByName(&host->hostSub); // if (tmpHost) { // priorityHosts.DelHost(tmpHost); // if (tmpHost->RefCnt() == 0) delete tmpHost; // } // *p = '-'; // } } priorityHosts.AddHost(host); } reg.CloseKey(); } reg.CloseKey(); if (rewriteFlg) WriteRegistry(CFG_HOSTINFO|CFG_DELHOST); } // Self private/public key (1024/2048) for (i=KEY_1024; i <= KEY_2048; i++) { const char *key = (i == KEY_1024) ? CRYPT_STR : CRYPT2_STR; int need_blob_size = ((i == KEY_1024) ? 1024 : 2048) / 8 * 4; if (reg.CreateKey(key)) { BYTE key[MAX_BUF_EX]; int blen = sizeof(key); int slen = sizeof(key); if (reg.GetByte(PRIVBLOB_STR, key, &blen) && blen > need_blob_size) { priv[i].SetBlob(key, blen); } if (reg.GetByte(PRIVSEED_STR, key, &slen)) { priv[i].SetSeed(key, slen); } reg.GetInt(PRIVTYPE_STR, &priv[i].encryptType); reg.CloseKey(); } } if (reg.OpenKey(DEBUG_STR)) // 旧バージョンレジストリ削除 { reg.CloseKey(); reg.DeleteChildTree(); } if (!reg.GetStr(NULL, buf, sizeof(buf)) || strcmp(buf, GetVersionStr())) { reg.CloseKey(); // close top appreg WriteRegistry(); } return TRUE; }