OSDN Git Service

Change the character code of windows into UTF-16 completely.
[ffftp/ffftp.git] / mbswrapper.c
index d44d1ef..62b2112 100644 (file)
@@ -7,6 +7,7 @@
 #define UNICODE\r
 #define _UNICODE\r
 \r
+#include <stdio.h>\r
 #include <tchar.h>\r
 #include <direct.h>\r
 #include <windows.h>\r
@@ -722,7 +723,7 @@ END_ROUTINE
 \r
 LONG GetWindowLongM(HWND hWnd, int nIndex)\r
 {\r
-       LRESULT r = 0;\r
+       LONG r = 0;\r
 START_ROUTINE\r
        // WNDPROCがShift_JIS用であるため\r
        if(IsWindowUnicode(hWnd))\r
@@ -735,7 +736,7 @@ END_ROUTINE
 \r
 LONG SetWindowLongM(HWND hWnd, int nIndex, LONG dwNewLong)\r
 {\r
-       LRESULT r = 0;\r
+       LONG r = 0;\r
 START_ROUTINE\r
        // WNDPROCがShift_JIS用であるため\r
        if(IsWindowUnicode(hWnd))\r
@@ -746,6 +747,32 @@ END_ROUTINE
        return r;\r
 }\r
 \r
+LONG_PTR GetWindowLongPtrM(HWND hWnd, int nIndex)\r
+{\r
+       LONG_PTR r = 0;\r
+START_ROUTINE\r
+       // WNDPROCがShift_JIS用であるため\r
+       if(IsWindowUnicode(hWnd))\r
+               r = GetWindowLongPtrW(hWnd, nIndex);\r
+       else\r
+               r = GetWindowLongPtrA(hWnd, nIndex);\r
+END_ROUTINE\r
+       return r;\r
+}\r
+\r
+LONG_PTR SetWindowLongPtrM(HWND hWnd, int nIndex, LONG_PTR dwNewLong)\r
+{\r
+       LONG_PTR r = 0;\r
+START_ROUTINE\r
+       // WNDPROCがShift_JIS用であるため\r
+       if(IsWindowUnicode(hWnd))\r
+               r = SetWindowLongPtrW(hWnd, nIndex, dwNewLong);\r
+       else\r
+               r = SetWindowLongPtrA(hWnd, nIndex, dwNewLong);\r
+END_ROUTINE\r
+       return r;\r
+}\r
+\r
 LRESULT DefWindowProcM(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)\r
 {\r
        LRESULT r = 0;\r
@@ -2149,12 +2176,11 @@ START_ROUTINE
        while((c = GetNextCharM(_Str, &p)) > 0)\r
        {\r
                if(c == _Ch)\r
-               {\r
-                       r = (unsigned char*)_Str;\r
                        break;\r
-               }\r
                _Str = p;\r
        }\r
+       if(c == _Ch)\r
+               r = (unsigned char*)_Str;\r
 END_ROUTINE\r
        return r;\r
 }\r
@@ -2171,6 +2197,8 @@ START_ROUTINE
                        r = (unsigned char*)_Str;\r
                _Str = p;\r
        }\r
+       if(c == _Ch)\r
+               r = (unsigned char*)_Str;\r
 END_ROUTINE\r
        return r;\r
 }\r