OSDN Git Service

delete Win9x/NT support code
authorU-i7\gimy <gimy@users.sourceforge.jp>
Wed, 1 Jul 2009 23:03:48 +0000 (08:03 +0900)
committerU-i7\gimy <gimy@users.sourceforge.jp>
Wed, 1 Jul 2009 23:03:48 +0000 (08:03 +0900)
driver.h
engine.cpp
engine.h
function.cpp
hook.cpp
vkeytable.cpp

index 965981e..9318cc5 100644 (file)
--- a/driver.h
+++ b/driver.h
@@ -8,20 +8,11 @@
 #  include <winioctl.h>
 
 
-#  if defined(_WINNT)
-
 /// mayu device file name
 #    define MAYU_DEVICE_FILE_NAME _T("\\\\.\\MayuDetour1")
 ///
 #    define MAYU_DRIVER_NAME _T("mayud")
 
-#  elif defined(_WIN95)
-
-///
-#    define MAYU_DEVICE_FILE_NAME _T("\\\\.\\mayud.vxd")
-
-#  endif
-
 /// Ioctl value
 #include "d/ioctl.h"
 
index 92afe98..9f14b39 100644 (file)
@@ -313,7 +313,6 @@ void Engine::generateKeyEvent(Key *i_key, bool i_doPress, bool i_isByAssign)
        kid.Flags = sc[i].m_flags;
        if (!i_doPress)
          kid.Flags |= KEYBOARD_INPUT_DATA::BREAK;
-#if defined(_WINNT)
 #ifdef NO_DRIVER
        injectInput(&kid, NULL);
 #else // !NO_DRIVER
@@ -321,11 +320,6 @@ void Engine::generateKeyEvent(Key *i_key, bool i_doPress, bool i_isByAssign)
        WriteFile(m_device, &kid, sizeof(kid), &len, &m_ol);
        CHECK_TRUE( GetOverlappedResult(m_device, &m_ol, &len, TRUE) );
 #endif // !NO_DRIVER
-#elif defined(_WIN95)
-       DeviceIoControl(m_device, 2, &kid, sizeof(kid), NULL, 0, &len, NULL);
-#else
-#  error
-#endif
       }
       
       m_lastGeneratedKey = i_doPress ? i_key : NULL;
@@ -764,7 +758,6 @@ void Engine::keyboardHandler()
 #ifndef NO_DRIVER
     DWORD len;
 #endif // !NO_DRIVER
-#if defined(_WINNT)
     {
       Acquire a(&m_log, 1);
       m_log << _T("begin ReadFile();") << std::endl;
@@ -881,14 +874,6 @@ void Engine::keyboardHandler()
       Acquire a(&m_log, 1);
       m_log << _T("end ReadFile();") << std::endl;
     }
-#elif defined(_WIN95)
-    if (!DeviceIoControl(m_device, 1, NULL, 0, &kid, sizeof(kid), &len, NULL))
-    {
-      continue; // TODO
-    }
-#else
-#  error
-#endif
 
     checkFocusWindow();
 
@@ -903,18 +888,12 @@ void Engine::keyboardHandler()
       }
       else
       {
-#if defined(_WINNT)
 #ifdef NO_DRIVER
        injectInput(&kid, NULL);
 #else // !NO_DRIVER
        WriteFile(m_device, &kid, sizeof(kid), &len, &m_ol);
        GetOverlappedResult(m_device, &m_ol, &len, TRUE);
 #endif // !NO_DRIVER
-#elif defined(_WIN95)
-       DeviceIoControl(m_device, 2, &kid, sizeof(kid), NULL, 0, &len, NULL);
-#else
-#  error
-#endif
       }
       updateLastPressedKey(NULL);
       continue;
@@ -925,16 +904,10 @@ void Engine::keyboardHandler()
     if (!m_currentFocusOfThread ||
        !m_currentKeymap)
     {
-#if defined(_WINNT)
 #ifndef NO_DRIVER
       WriteFile(m_device, &kid, sizeof(kid), &len, &m_ol);
       GetOverlappedResult(m_device, &m_ol, &len, TRUE);
 #endif // !NO_DRIVER
-#elif defined(_WIN95)
-      DeviceIoControl(m_device, 2, &kid, sizeof(kid), NULL, 0, &len, NULL);
-#else
-#  error
-#endif
       Acquire a(&m_log, 0);
       if (!m_currentFocusOfThread)
        m_log << _T("internal error: m_currentFocusOfThread == NULL")
@@ -1078,9 +1051,7 @@ void Engine::keyboardHandler()
     key.initialize();
     updateLastPressedKey(isPhysicallyPressed ? c.m_mkey.m_key : NULL);
   }
-#if defined(_WINNT)
   break_while:
-#endif
   CHECK_TRUE( SetEvent(m_threadEvent) );
 }
   
@@ -1092,12 +1063,10 @@ Engine::Engine(tomsgstream &i_log)
     m_didMayuStartDevice(false),
     m_threadEvent(NULL),
     m_mayudVersion(_T("unknown")),
-#if defined(_WINNT)
     m_readEvent(NULL),
     m_interruptThreadEvent(NULL),
     m_sts4mayu(NULL),
     m_cts4mayu(NULL),
-#endif // _WINNT
     m_doForceTerminate(false),
     m_isLogMode(false),
     m_isEnabled(true),
@@ -1145,13 +1114,11 @@ Engine::Engine(tomsgstream &i_log)
 #endif // !NO_DRIVER
   // create event for sync
   CHECK_TRUE( m_eSync = CreateEvent(NULL, FALSE, FALSE, NULL) );
-#if defined(_WINNT)
   // create named pipe for &SetImeString
   m_hookPipe = CreateNamedPipe(addSessionId(HOOK_PIPE_NAME).c_str(),
                               PIPE_ACCESS_OUTBOUND,
                               PIPE_TYPE_BYTE, 1,
                               0, 0, 0, NULL);
-#endif // _WINNT
   StrExprArg::setEngine(this);
 }
 
@@ -1160,24 +1127,16 @@ Engine::Engine(tomsgstream &i_log)
 bool Engine::open()
 {
   // open mayu m_device
-#if defined(_WINNT)
 #ifndef NO_DRIVER
   m_device = CreateFile(MAYU_DEVICE_FILE_NAME, GENERIC_READ | GENERIC_WRITE,
                        0, NULL, OPEN_EXISTING,
                        FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
 #endif // !NO_DRIVER
-#elif defined(_WIN95)
-  m_device = CreateFile(MAYU_DEVICE_FILE_NAME, 0,
-                       0, NULL, CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, NULL);
-#else
-#  error
-#endif
 
   if (m_device != INVALID_HANDLE_VALUE) {
     return true;
   }
 
-#if defined(_WINNT)
 #ifndef NO_DRIVER
   // start mayud
   SC_HANDLE hscm = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
@@ -1198,7 +1157,6 @@ bool Engine::open()
                        0, NULL, OPEN_EXISTING,
                        FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
 #endif // !NO_DRIVER
-#endif // _WINNT
   return (m_device != INVALID_HANDLE_VALUE);
 }
 
@@ -1220,13 +1178,11 @@ void Engine::start()
 {
   CHECK_TRUE( m_threadEvent = CreateEvent(NULL, FALSE, FALSE, NULL) );
   
-#if defined(_WINNT)
   CHECK_TRUE( m_readEvent = CreateEvent(NULL, FALSE, FALSE, NULL) );
   CHECK_TRUE( m_interruptThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL) );
   m_ol.Offset = 0;
   m_ol.OffsetHigh = 0;
   m_ol.hEvent = m_readEvent;
-#endif // _WINNT
   
   CHECK_TRUE( m_threadHandle = (HANDLE)_beginthreadex(NULL, 0, keyboardHandler, this, 0, &m_threadId) );
   CHECK( WAIT_OBJECT_0 ==, WaitForSingleObject(m_threadEvent, INFINITE) );
@@ -1241,12 +1197,8 @@ void Engine::stop()
     m_doForceTerminate = true;
     do
     {
-#if defined(_WINNT)
       m_interruptThreadReason = InterruptThreadReason_Terminate;
       SetEvent(m_interruptThreadEvent);
-#elif defined(_WIN95)
-      DeviceIoControl(m_device, 3, NULL, 0, NULL, 0, NULL, NULL);
-#endif
       //DWORD buf;
       //M_DeviceIoControl(m_device, IOCTL_MAYU_DETOUR_CANCEL,
       //                &buf, sizeof(buf), &buf, sizeof(buf), &buf, NULL);
@@ -1259,7 +1211,6 @@ void Engine::stop()
     CHECK_TRUE( CloseHandle(m_threadHandle) );
     m_threadHandle = NULL;
 
-#if defined(_WINNT)
     // stop mayud
     if (m_didMayuStartDevice)
     {
@@ -1281,13 +1232,11 @@ void Engine::stop()
     m_readEvent = NULL;
     CHECK_TRUE( CloseHandle(m_interruptThreadEvent) );
     m_interruptThreadEvent = NULL;
-#endif // _WINNT
   }
 }
 
 bool Engine::pause()
 {
-#if defined(_WINNT)
   if (m_device != INVALID_HANDLE_VALUE) {
     do {
       m_interruptThreadReason = InterruptThreadReason_Pause;
@@ -1297,14 +1246,12 @@ bool Engine::pause()
     close();
 #endif // !NO_DRIVER
   }
-#endif // _WINNT
   return true;
 }
 
 
 bool Engine::resume()
 {
-#if defined(_WINNT)
   if (m_device == INVALID_HANDLE_VALUE) {
 #ifndef NO_DRIVER
     if (!open()) {
@@ -1316,7 +1263,6 @@ bool Engine::resume()
       SetEvent(m_interruptThreadEvent);
     } while (WaitForSingleObject(m_threadEvent, 100) != WAIT_OBJECT_0);
   }
-#endif // _WINNT
   return true;
 }
 
@@ -1341,14 +1287,12 @@ Engine::~Engine()
 #ifndef NO_DRIVER
   close();
 #endif // !NO_DRIVER
-#if defined(_WINNT)
   // destroy named pipe for &SetImeString
   if (m_hookPipe && m_hookPipe != INVALID_HANDLE_VALUE)
   {
     DisconnectNamedPipe(m_hookPipe);
     CHECK_TRUE( CloseHandle(m_hookPipe) );
   }
-#endif // _WINNT
 }
 
 
index 0f992fa..ba39881 100644 (file)
--- a/engine.h
+++ b/engine.h
@@ -163,7 +163,6 @@ private:
   HANDLE m_threadHandle;
   unsigned m_threadId;
   tstring m_mayudVersion;                      /// version of mayud.sys
-#if defined(_WINNT)
 #ifdef NO_DRIVER
   std::deque<KEYBOARD_INPUT_DATA> m_kidq;
   CriticalSection m_cskidq;
@@ -178,7 +177,6 @@ private:
   HANDLE m_hookPipe;                           /// named pipe for &SetImeString
   HMODULE m_sts4mayu;                          /// DLL module for ThumbSense
   HMODULE m_cts4mayu;                          /// DLL module for ThumbSense
-#endif // _WINNT
   bool volatile m_doForceTerminate;            /// terminate engine thread
   bool volatile m_isLogMode;                   /// is logging mode ?
   bool volatile m_isEnabled;                   /// is enabled  ?
index 24dd0fe..4c40f54 100644 (file)
@@ -867,13 +867,7 @@ void Engine::funcSync(FunctionParam *i_param)
   g_hookData->m_syncKey = sc->m_scan;
   g_hookData->m_syncKeyIsExtended = !!(sc->m_flags & ScanCode::E0E1);
   m_isSynchronizing = true;
-#if defined(_WINNT)
   generateKeyEvent(sync, false, false);
-#elif defined(_WIN95)
-  generateKeyEvent(sync, true, false);
-#else
-#  error
-#endif
   
   m_cs.release();
   DWORD r = WaitForSingleObject(m_eSync, 5000);
@@ -1201,7 +1195,6 @@ void Engine::funcVK(FunctionParam *i_param, VKey i_vkey)
     mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
   else if (vkey == VK_RBUTTON && isUp)
     mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
-#if(_WIN32_WINNT >= 0x0500)
   else if (vkey == VK_XBUTTON1 && isDown)
     mouse_event(MOUSEEVENTF_XDOWN, 0, 0, XBUTTON1, 0);
   else if (vkey == VK_XBUTTON1 && isUp)
@@ -1210,7 +1203,6 @@ void Engine::funcVK(FunctionParam *i_param, VKey i_vkey)
     mouse_event(MOUSEEVENTF_XDOWN, 0, 0, XBUTTON2, 0);
   else if (vkey == VK_XBUTTON2 && isUp)
     mouse_event(MOUSEEVENTF_XUP, 0, 0, XBUTTON2, 0);
-#endif /* _WIN32_WINNT >= 0x0500 */
   else if (isUp || isDown)
     keybd_event(vkey,
                static_cast<BYTE>(MapVirtualKey(vkey, 0)),
@@ -1705,7 +1697,6 @@ void Engine::funcWindowIdentify(FunctionParam *i_param)
 // set alpha blending parameter to the window
 void Engine::funcWindowSetAlpha(FunctionParam *i_param, int i_alpha)
 {
-#if defined(_WINNT)
   HWND hwnd;
   if (!getSuitableWindow(i_param, &hwnd))
     return;
@@ -1772,7 +1763,6 @@ void Engine::funcWindowSetAlpha(FunctionParam *i_param, int i_alpha)
     RedrawWindow(hwnd, NULL, NULL,
                 RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
   }
-#endif // _WINNT
 }
 
 
@@ -1973,7 +1963,6 @@ void Engine::funcSetImeStatus(FunctionParam *i_param, ToggleType i_toggle)
 // set IME open status
 void Engine::funcSetImeString(FunctionParam *i_param, const StrExprArg &i_data)
 {
-#if defined(_WINNT)
   if (!i_param->m_isPressed)
     return;
   if (m_hwndFocus)
@@ -1992,10 +1981,6 @@ void Engine::funcSetImeString(FunctionParam *i_param, const StrExprArg &i_data)
 
     //FlushFileBuffers(m_hookPipe);
   }
-#else
-  Acquire a(&m_log);
-  m_log << _T("supported on only Windows NT/2000/XP") << std::endl;
-#endif
 }
 
 // Direct SSTP Server
index 5e55bc9..f4d0b60 100644 (file)
--- a/hook.cpp
+++ b/hook.cpp
@@ -520,7 +520,6 @@ static void funcSetImeStatus(HWND i_hwnd, int i_status)
 // &SetImeString
 static void funcSetImeString(HWND i_hwnd, int i_size)
 {
-#if defined(_WINNT)
   _TCHAR *buf = new _TCHAR(i_size);
   DWORD len = 0;
   _TCHAR ImeDesc[GANA_MAX_ATOM_LENGTH];
@@ -550,7 +549,6 @@ static void funcSetImeString(HWND i_hwnd, int i_size)
   if (!status)
     ImmSetOpenStatus(hIMC, status);
   ImmReleaseContext(i_hwnd, hIMC);
-#endif // _WINNT
 }
 
 /// notify lock state
index d23b566..dec3257 100644 (file)
@@ -20,10 +20,8 @@ const VKeyTable g_vkeyTable[] =
   VK(CANCEL),          // 0x03
   VK(MBUTTON),         // 0x04    /* NOT contiguous with L & RBUTTON */
 
-#if(_WIN32_WINNT >= 0x0500)
   VK(XBUTTON1),                // 0x05    /* NOT contiguous with L & RBUTTON */
   VK(XBUTTON2),                // 0x06    /* NOT contiguous with L & RBUTTON */
-#endif /* _WIN32_WINNT >= 0x0500 */
 
 /*
  * 0x07 : unassigned
@@ -209,7 +207,6 @@ const VKeyTable g_vkeyTable[] =
   VK(LMENU),           // 0xA4
   VK(RMENU),           // 0xA5
 
-#if(_WIN32_WINNT >= 0x0500)
   VK(BROWSER_BACK),    // 0xA6
   VK(BROWSER_FORWARD), // 0xA7
   VK(BROWSER_REFRESH), // 0xA8
@@ -230,8 +227,6 @@ const VKeyTable g_vkeyTable[] =
   VK(LAUNCH_APP1),      // 0xB6
   VK(LAUNCH_APP2),      // 0xB7
 
-#endif /* _WIN32_WINNT >= 0x0500 */
-
 /*
  * 0xB8 - 0xB9 : reserved
  */
@@ -270,15 +265,11 @@ const VKeyTable g_vkeyTable[] =
   VK(ICO_HELP),                // 0xE3 //  Help key on ICO
   VK(ICO_00),          // 0xE4 //  00 key on ICO
 
-#if(WINVER >= 0x0400)
   VK(PROCESSKEY),      // 0xE5
-#endif /* WINVER >= 0x0400 */
 
   VK(ICO_CLEAR),       // 0xE6
 
-#if(_WIN32_WINNT >= 0x0500)
   VK(PACKET),          // 0xE7
-#endif /* _WIN32_WINNT >= 0x0500 */
 
 /*
  * 0xE8 : unassigned