OSDN Git Service

Recompile executable files.
[ffftp/ffftp.git] / main.c
diff --git a/main.c b/main.c
index 1a1e895..c731384 100644 (file)
--- a/main.c
+++ b/main.c
@@ -407,6 +407,8 @@ static int InitApp(LPSTR lpszCmdLine, int cmdShow)
        char PwdBuf[FMAX_PATH+1];\r
        int useDefautPassword = 0; /* 警告文表示用 */\r
        int masterpass;\r
+       // ポータブル版判定\r
+       int ImportPortable;\r
 \r
        sts = FFFTP_FAIL;\r
 \r
@@ -448,10 +450,20 @@ static int InitApp(LPSTR lpszCmdLine, int cmdShow)
                GetModuleFileName(NULL, PortableFilePath, FMAX_PATH);\r
                strcpy(GetFileName(PortableFilePath), "portable");\r
                CheckPortableVersion();\r
+               ImportPortable = NO;\r
                if(PortableVersion == YES)\r
                {\r
                        ForceIni = YES;\r
                        RegType = REGTYPE_INI;\r
+                       if(IsRegAvailable() == YES && IsIniAvailable() == NO)\r
+                       {\r
+                               if(DialogBox(GetFtpInst(), MAKEINTRESOURCE(ini_from_reg_dlg), GetMainHwnd(), ExeEscDialogProc) == YES)\r
+                               {\r
+                                       ImportPortable = YES;\r
+                                       ForceIni = NO;\r
+                                       RegType = REGTYPE_REG;\r
+                               }\r
+                       }\r
                }\r
 \r
 //             AllocConsole();\r
@@ -506,6 +518,13 @@ static int InitApp(LPSTR lpszCmdLine, int cmdShow)
                {\r
                        LoadRegistry();\r
 \r
+                       // ポータブル版判定\r
+                       if(ImportPortable == YES)\r
+                       {\r
+                               ForceIni = YES;\r
+                               RegType = REGTYPE_INI;\r
+                       }\r
+\r
                        // 暗号化通信対応\r
                        SetSSLTimeoutCallback(TimeOut * 1000, SSLTimeoutCallback);\r
                        SetSSLConfirmCallback(SSLConfirmCallback);\r
@@ -1387,6 +1406,8 @@ static LRESULT CALLBACK FtpWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
                                        if(DialogBox(hInstFtp, MAKEINTRESOURCE(reginit_dlg), hWnd, ExeEscDialogProc) == YES)\r
                                        {\r
                                                ClearRegistry();\r
+                                               // ポータブル版判定\r
+                                               ClearIni();\r
                                                SaveExit = NO;\r
                                                PostMessage(hWnd, WM_CLOSE, 0, 0L);\r
                                        }\r
@@ -2094,6 +2115,9 @@ static void ExitProc(HWND hWnd)
        {\r
                GetListTabWidth();\r
                SaveRegistry();\r
+               // ポータブル版判定\r
+               if(RegType == REGTYPE_REG)\r
+                       ClearIni();\r
 \r
                if((CacheEntry > 0) && (CacheSave == YES))\r
                        SaveCache();\r