Esempio n. 1
0
DWORD WINAPI PersistentPatch(LPVOID)
{
  for ever
  {
    Sleep(300);

    // If version is correct
    if ( isCorrectVersion )
    {
      // dialog/menu layer
      if ( BW::BWDATA_ScreenLayers[2].pUpdate != DrawDialogHook && 
           BW::BWDATA_ScreenLayers[2].pUpdate != NULL )
      {
        BW::pOldDrawDialogProc = BW::BWDATA_ScreenLayers[2].pUpdate;
        BW::BWDATA_ScreenLayers[2].pUpdate = DrawDialogHook;
      }

      // game layer
      if ( BW::BWDATA_ScreenLayers[5].pUpdate != DrawHook && BW::BWDATA_ScreenLayers[5].pUpdate != NULL )
      {
        BW::pOldDrawGameProc = BW::BWDATA_ScreenLayers[5].pUpdate;
        BW::BWDATA_ScreenLayers[5].pUpdate = DrawHook;
      }
    }

    // Only grab this info if we are not currently detouring the CreateWindowEx procedure
    if ( !detourCreateWindow )
    {
      if ( !ghMainWnd )
        ghMainWnd = SDrawGetFrameWindow();

      if ( ghMainWnd )
      {
        WNDPROC thisProc = (WNDPROC)GetWindowLong(ghMainWnd, GWLP_WNDPROC);
        if ( thisProc != &WindowProc )
        {
          wOriginalProc = thisProc;
          SetWindowLong(ghMainWnd, GWLP_WNDPROC, (LONG)&WindowProc);
        }
      }
    }
  } //loop
}
Esempio n. 2
0
 void GameImpl::mouseUp(int x, int y)
 {
   // Release the left mouse button
   PostMessage(SDrawGetFrameWindow(), WM_LBUTTONUP, NULL, (LPARAM)MAKELONG(x,y));
 }