OSDN Git Service

Add support for MLSD responses from some broken hosts.
[ffftp/ffftp.git] / lvtips.c
index 5644f55..dcda9fb 100644 (file)
--- a/lvtips.c
+++ b/lvtips.c
@@ -1,6 +1,6 @@
-/*=============================================================================\r
+/*=============================================================================\r
 *\r
-*                                                      \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\r
+*                                                      リストビューティップス\r
 *\r
 ===============================================================================\r
 / Copyright (C) 1997-2007 Sota. All rights reserved.\r
 / THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
 /============================================================================*/\r
 \r
-/* \82±\82Ì\83\\81[\83X\82Í MFC Programmer's SourceBook (http://www.codeguru.com/)\82ð\8eQ\8dl\82É\82µ\82Ü\82µ\82½ */\r
+/* このソースは MFC Programmer's SourceBook (http://www.codeguru.com/)を参考にしました */\r
 \r
 #define  STRICT\r
+// IPv6対応\r
+#include <winsock2.h>\r
 #include <windows.h>\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include "resource.h"\r
 \r
 \r
-/*===== \83v\83\8d\83g\83^\83C\83v =====*/\r
+/*===== プロトタイプ =====*/\r
 \r
 static void TipsShow(HWND hWnd, RECT rectTitle, LPCTSTR lpszTitleText, int xoffset, int xoffset2, int InRect);\r
 static int CellRectFromPoint(HWND hWnd, POINT  point, RECT *cellrect, int *col);\r
 static LRESULT CALLBACK TitleTipWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
 \r
-/*===== \83\8d\81[\83J\83\8b\82È\83\8f\81[\83N =====*/\r
+/*===== ローカルなワーク =====*/\r
 \r
-static HWND hWndTips;  /* tips\82Ì\83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b */\r
+static HWND hWndTips;  /* tipsのウインドウハンドル */\r
 \r
 \r
 \r
-/*----- \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\82Ì\83E\83C\83\93\83h\83E\82ð\8dì\90¬ ------------------------------\r
+/*----- リストビューティップスのウインドウを作成 ------------------------------\r
 *\r
 *      Parameter\r
-*              HWND hWnd : \90e\83E\83C\83\93\83h\83E\82Ì\83n\83\93\83h\83\8b\r
-*              HINSTANCE hInst : \83C\83\93\83X\83^\83\93\83X\83n\83\93\83h\83\8b\r
+*              HWND hWnd : 親ウインドウのハンドル\r
+*              HINSTANCE hInst : インスタンスハンドル\r
 *\r
 *      Return Value\r
-*              int \83X\83e\81[\83^\83X\r
-*                      SUCCESS/FAIL\r
+*              int ステータス\r
+*                      FFFTP_SUCCESS/FFFTP_FAIL\r
 *----------------------------------------------------------------------------*/\r
 \r
 int InitListViewTips(HWND hWnd, HINSTANCE hInst)\r
@@ -69,7 +71,7 @@ int InitListViewTips(HWND hWnd, HINSTANCE hInst)
        WNDCLASSEX wClass;\r
        int Ret;\r
 \r
-       Ret = FAIL;\r
+       Ret = FFFTP_FAIL;\r
 \r
        wClass.cbSize = sizeof(WNDCLASSEX);\r
        wClass.style         = 0;\r
@@ -92,19 +94,19 @@ int InitListViewTips(HWND hWnd, HINSTANCE hInst)
                                hWnd, NULL, hInst, NULL);\r
 \r
        if(hWndTips != NULL)\r
-               Ret = SUCCESS;\r
+               Ret = FFFTP_SUCCESS;\r
 \r
        return(Ret);\r
 }\r
 \r
 \r
-/*----- \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\82Ì\83E\83C\83\93\83h\83E\82ð\8dí\8f\9c ------------------------------\r
+/*----- リストビューティップスのウインドウを削除 ------------------------------\r
 *\r
 *      Parameter\r
-*              \82È\82µ\r
+*              なし\r
 *\r
 *      Return Value\r
-*              \82È\82µ\r
+*              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
 void DeleteListViewTips(void)\r
@@ -115,13 +117,13 @@ void DeleteListViewTips(void)
 }\r
 \r
 \r
-/*----- \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\82Ì\83E\83C\83\93\83h\83E\82ð\8fÁ\8b\8e ------------------------------\r
+/*----- リストビューティップスのウインドウを消去 ------------------------------\r
 *\r
 *      Parameter\r
-*              \82È\82µ\r
+*              なし\r
 *\r
 *      Return Value\r
-*              \82È\82µ\r
+*              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
 void EraseListViewTips(void)\r
@@ -132,13 +134,13 @@ void EraseListViewTips(void)
 }\r
 \r
 \r
-/*----- \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\82Ì\83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\82ð\95Ô\82· ----------------------\r
+/*----- リストビューティップスのウインドウハンドルを返す ----------------------\r
 *\r
 *      Parameter\r
-*              \82È\82µ\r
+*              なし\r
 *\r
 *      Return Value\r
-*              HWND \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
+*              HWND ウインドウハンドル\r
 *----------------------------------------------------------------------------*/\r
 \r
 HWND GetListViewTipsHwnd(void)\r
@@ -147,14 +149,14 @@ HWND GetListViewTipsHwnd(void)
 }\r
 \r
 \r
-/*----- \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\82Ì\95\\8e¦\83`\83F\83b\83N ----------------------------------\r
+/*----- リストビューティップスの表示チェック ----------------------------------\r
 *\r
 *      Parameter\r
-*              HWND hWnd : ListView\82Ì\83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
-*              LPARAM lParam : WM_MOUSEMOVE\82ÌLPARAM\92l\r
+*              HWND hWnd : ListViewのウインドウハンドル\r
+*              LPARAM lParam : WM_MOUSEMOVEのLPARAM値\r
 *\r
 *      Return Value\r
-*              \82È\82µ\r
+*              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
 void CheckTipsDisplay(HWND hWnd, LPARAM lParam)\r
@@ -205,18 +207,18 @@ void CheckTipsDisplay(HWND hWnd, LPARAM lParam)
 }\r
 \r
 \r
-/*----- \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\82ð\95\\8e¦ ------------------------------------------\r
+/*----- リストビューティップスを表示 ------------------------------------------\r
 *\r
 *      Parameter\r
-*              HWND hWnd : ListView\82Ì\83E\83C\83\93\83h\83E\82Ì\83n\83\93\83h\83\8b\r
-*              RECT rectTitle : ListView\83R\83\93\83g\83\8b\81[\83\8b\82Ì\83A\83C\83e\83\80\82Ì\8bé\8c`\r
-*              LPCTSTR lpszTitleText : \95\8e\9a\97ñ\r
-*              int xoffset : \83I\83t\83Z\83b\83g\r
-*              int xoffset2 : \83I\83t\83Z\83b\83g\82Q\r
-*              int InRect : \95\\8e¦\82·\82é\82©\82Ç\82¤\82©\r
+*              HWND hWnd : ListViewのウインドウのハンドル\r
+*              RECT rectTitle : ListViewコントルールのアイテムの矩形\r
+*              LPCTSTR lpszTitleText : 文字列\r
+*              int xoffset : オフセット\r
+*              int xoffset2 : オフセット2\r
+*              int InRect : 表示するかどうか\r
 *\r
 *      Return Value\r
-*              \82È\82µ\r
+*              なし\r
 *----------------------------------------------------------------------------*/\r
 \r
 static void TipsShow(HWND hWnd, RECT rectTitle, LPCTSTR lpszTitleText, int xoffset, int xoffset2, int InRect)\r
@@ -233,7 +235,7 @@ static void TipsShow(HWND hWnd, RECT rectTitle, LPCTSTR lpszTitleText, int xoffs
                {\r
                        RectClientToScreen(hWnd, &rectTitle);\r
 \r
-                       /* ListView\83E\83C\83\93\83h\83E\82Ì\83t\83H\83\93\83g\82ð\93¾\82é */\r
+                       /* ListViewウインドウのフォントを得る */\r
                        dc = GetDC(hWnd);\r
                        pFont = (HFONT)SendMessage(hWnd, WM_GETFONT, 0, 0);\r
                        ReleaseDC(hWnd, dc);\r
@@ -272,17 +274,17 @@ static void TipsShow(HWND hWnd, RECT rectTitle, LPCTSTR lpszTitleText, int xoffs
 }\r
 \r
 \r
-/*----- \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\82ð\95\\8e¦\82·\82é\88Ê\92u\82ð\95Ô\82· ----------------------------\r
+/*----- リストビューティップスを表示する位置を返す ----------------------------\r
 *\r
 *      Parameter\r
-*              HWND hWnd : ListView\82Ì\83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
-*              POINT point : \83J\81[\83\\83\8b\82Ì\88Ê\92u\r
-*              RECT *cellrect : \83A\83C\83e\83\80\82Ì\8bé\8c`\82ð\95Ô\82·\83\8f\81[\83N\r
-*              int *col : \8c\85\94Ô\8d\86\82ð\95Ô\82·\83\8f\81[\83N\r
+*              HWND hWnd : ListViewのウインドウハンドル\r
+*              POINT point : カーソルの位置\r
+*              RECT *cellrect : アイテムの矩形を返すワーク\r
+*              int *col : 桁番号を返すワーク\r
 *\r
 *      Return Value\r
-*              int \8ds\94Ô\8d\86\r
-*                      -1=\8aY\93\96\82È\82µ\r
+*              int 行番号\r
+*                      -1=該当なし\r
 *----------------------------------------------------------------------------*/\r
 \r
 static int CellRectFromPoint(HWND hWnd, POINT point, RECT *cellrect, int *col)\r
@@ -297,7 +299,9 @@ static int CellRectFromPoint(HWND hWnd, POINT point, RECT *cellrect, int *col)
        int Ret;\r
 \r
        Ret = -1;\r
-       if((GetWindowLong(hWnd, GWL_STYLE) & LVS_TYPEMASK) == LVS_REPORT )\r
+       // 64ビット対応\r
+//     if((GetWindowLong(hWnd, GWL_STYLE) & LVS_TYPEMASK) == LVS_REPORT )\r
+       if((GetWindowLongPtr(hWnd, GWL_STYLE) & LVS_TYPEMASK) == LVS_REPORT )\r
        {\r
                row = ListView_GetTopIndex(hWnd);\r
                bottom = row + ListView_GetCountPerPage(hWnd);\r
@@ -339,16 +343,16 @@ static int CellRectFromPoint(HWND hWnd, POINT point, RECT *cellrect, int *col)
 }\r
 \r
 \r
-/*----- \83\8a\83X\83g\83r\83\85\81[\83e\83B\83b\83v\83X\83E\83C\83\93\83h\83E\82Ì\83R\81[\83\8b\83o\83b\83N ------------------------\r
+/*----- リストビューティップスウインドウのコールバック ------------------------\r
 *\r
 *      Parameter\r
-*              HWND hWnd : \83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
-*              UINT message  : \83\81\83b\83Z\81[\83W\94Ô\8d\86\r
-*              WPARAM wParam : \83\81\83b\83Z\81[\83W\82Ì WPARAM \88ø\90\94\r
-*              LPARAM lParam : \83\81\83b\83Z\81[\83W\82Ì LPARAM \88ø\90\94\r
+*              HWND hWnd : ウインドウハンドル\r
+*              UINT message  : メッセージ番号\r
+*              WPARAM wParam : メッセージの WPARAM 引数\r
+*              LPARAM lParam : メッセージの LPARAM 引数\r
 *\r
 *      Return Value\r
-*              \83\81\83b\83Z\81[\83W\82É\91Î\89\9e\82·\82é\96ß\82è\92l\r
+*              メッセージに対応する戻り値\r
 *----------------------------------------------------------------------------*/\r
 \r
 static LRESULT CALLBACK TitleTipWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)\r