Exemple #1
0
HWND WINAPI CreateWindowExA_Hook(__in DWORD dwExStyle, __in_opt LPCSTR lpClassName,
	__in_opt LPCSTR lpWindowName, __in DWORD dwStyle, __in int X, __in int Y, __in int nWidth,
	__in int nHeight, __in_opt HWND hWndParent, __in_opt HMENU hMenu, __in_opt HINSTANCE hInstance,
	__in_opt LPVOID lpParam)
{
	if(!strcmp(lpClassName,"StartUpDlgClass") && !strcmp(lpWindowName, "MapleStory"))
	{
		DebugPrintA("Window was blocked\n");
		return NULL;
	}
	if (!strcmp(lpClassName, "NexonADBallon") && !strcmp(lpWindowName, "ad.")) 	
	{  	
		DebugPrintA("Window was blocked\n");
		return NULL;
	} 	
	if(!strcmp(lpClassName, "MapleStoryClass"))
	{
		RajanClass->hWnd = _CreateWindowExA(dwExStyle,lpClassName,lpWindowName,dwStyle,X,Y,nWidth,nHeight,hWndParent,hMenu,
			hInstance,lpParam);

		return RajanClass->hWnd;
	}

	return _CreateWindowExA(dwExStyle,lpClassName,lpWindowName,dwStyle,X,Y,nWidth,nHeight,hWndParent,hMenu,
		hInstance,lpParam);
}
Exemple #2
0
/*static*/ HIMCC CompStr::ReCreate(HIMCC hCompStr, const LogCompStr *log) {
  FOOTMARK();
  LogCompStr log_comp_str;
  if (log == NULL) {
    log = &log_comp_str;
  }
  const DWORD total = log->GetTotalSize();
  HIMCC hNewCompStr = ::ImmReSizeIMCC(hCompStr, total);
  if (hNewCompStr) {
    CompStr *lpCompStr = (CompStr *)::ImmLockIMCC(hNewCompStr);
    if (lpCompStr) {
      DWORD size = lpCompStr->Store(log);
      assert(size == total);

      ::ImmUnlockIMCC(hNewCompStr);
      hCompStr = hNewCompStr;
    } else {
      DebugPrintA("CompStr::ReCreate: failed #2");
      assert(0);
    }
  } else {
    DebugPrintA("CompStr::ReCreate: failed");
    assert(0);
  }
  return hCompStr;
} // CompStr::ReCreate
Exemple #3
0
ATOM WINAPI RegisterClassExA_Hook(__in WNDCLASSEXA *wndClass)
{
	if(!strcmp(wndClass->lpszClassName, "MapleStoryClass"))
	{
		Maple_WndProc = wndClass->lpfnWndProc;
		wndClass->lpfnWndProc = WndProcHook;
		DebugPrintA("Got WndProc\n");
	}
	return _RegisterClassExA(wndClass);
}
Exemple #4
0
LRESULT CALLBACK WndProcHook(HWND hWnd,UINT uMessage,WPARAM wParam,LPARAM lParam)
{
	if(uMessage == WM_COPYDATA)
	{
		RajanClass->HandleMessage(reinterpret_cast<PCOPYDATASTRUCT>(lParam));
		return TRUE;
	}

	else if(uMessage == WM_CREATE)
		DebugPrintA("HWND: %i\n",hWnd);

	return Maple_WndProc(hWnd,uMessage,wParam,lParam);
}
Exemple #5
0
CRajan::CRajan()
{
	this->hWnd = NULL;
	this->m_apiHook = new CApiHook();


	this->m_apiHook->AddApi(CreateWindowExAHook);
	this->m_apiHook->AddApi(RegisterClassExAHook);
	this->m_apiHook->AddApi(GetForegroundWindowHook);



	if(this->m_apiHook->Install())
	DebugPrintA("Installed\n");

	RajanClass = this;
}
Exemple #6
0
void LogCompStr::Dump() {
#ifndef NDEBUG
  DebugPrintA("### LogCompStr ###\n");
  DebugPrintA("+ dwCursorPos: %08X\n", dwCursorPos);
  DebugPrintA("+ dwDeltaStart: %08X\n", dwDeltaStart);

  DebugPrintA("+ comp_read_attr: ");
  for (size_t i = 0; i < comp_read_attr.size(); ++i) {
    DebugPrintA("%02X ", comp_read_attr[i]);
  }
  DebugPrintA("\n");

  DebugPrintA("+ comp_read_clause: ");
  for (size_t i = 0; i < comp_read_clause.size(); ++i) {
    DebugPrintA("%08X ", comp_read_clause[i]);
  }
  DebugPrintA("\n");

  DebugPrintA("+ comp_read_str: %ls\n", comp_read_str.c_str());
  DebugPrintA("+ comp_attr: ");
  for (size_t i = 0; i < comp_attr.size(); ++i) {
    DebugPrintA("%02X ", comp_attr[i]);
  }
  DebugPrintA("\n");

  DebugPrintA("+ comp_clause: ");
  for (size_t i = 0; i < comp_clause.size(); ++i) {
    DebugPrintA("%08X ", comp_clause[i]);
  }
  DebugPrintA("\n");

  DebugPrintA("+ comp_str: %ls\n", comp_str.c_str());

  DebugPrintA("+ result_read_clause: ");
  for (size_t i = 0; i < result_read_clause.size(); ++i) {
    DebugPrintA("%08X ", result_read_clause[i]);
  }
  DebugPrintA("\n");

  DebugPrintA("+ result_read_str: %ls\n", result_read_str.c_str());

  DebugPrintA("+ result_clause: ");
  for (size_t i = 0; i < result_clause.size(); ++i) {
    DebugPrintA("%08X ", result_clause[i]);
  }
  DebugPrintA("\n");

  DebugPrintA("+ result_str: %ls\n", result_str.c_str());

  DebugPrintA("+ extra.iClause: %08X\n", extra.iClause);

  DebugPrintA("+ extra.hiragana_clauses: ");
  for (size_t i = 0; i < extra.hiragana_clauses.size(); ++i) {
    DebugPrintA("%ls ", extra.hiragana_clauses[i].c_str());
  }
  DebugPrintA("\n");

  DebugPrintA("+ extra.typing_clauses: ");
  for (size_t i = 0; i < extra.typing_clauses.size(); ++i) {
    DebugPrintA("%ls ", extra.typing_clauses[i].c_str());
  }
  DebugPrintA("\n");
#endif  // ndef NDEBUG
} // LogCompStr::Dump
Exemple #7
0
void CompStr::Dump() {
  FOOTMARK();
#ifndef NDEBUG
  DebugPrintA("dwSize: %08X\n", dwSize);
  DebugPrintA("dwCursorPos: %08X\n", dwCursorPos);
  DebugPrintA("dwDeltaStart: %08X\n", dwDeltaStart);
  DebugPrintA("CompReadAttr: ");
  if (dwCompReadAttrLen) {
    BYTE *attrs = GetCompReadAttr();
    for (DWORD i = 0; i < dwCompReadAttrLen; ++i) {
      DebugPrintA("%02X ", attrs[i]);
    }
  }
  DebugPrintA("\n");
  DebugPrintA("CompReadClause: ");
  if (dwCompReadClauseLen) {
    DWORD *clauses = GetCompReadClause();
    for (DWORD i = 0; i < dwCompReadClauseLen / 4; ++i) {
      DebugPrintA("%08X ", clauses[i]);
    }
  }
  DebugPrintA("\n");
  DebugPrintA("CompReadStr: ");
  if (dwCompReadStrLen) {
    WCHAR *str = GetCompReadStr();
    DebugPrintA("%ls", str);
  }
  DebugPrintA("\n");
  DebugPrintA("CompAttr: ");
  if (dwCompAttrLen) {
    BYTE *attrs = GetCompAttr();
    for (DWORD i = 0; i < dwCompAttrLen; ++i) {
      DebugPrintA("%02X ", attrs[i]);
    }
  }
  DebugPrintA("\n");
  DebugPrintA("CompClause: ");
  if (dwCompClauseLen) {
    DWORD *clauses = GetCompClause();
    for (DWORD i = 0; i < dwCompClauseLen / 4; ++i) {
      DebugPrintA("%08X ", clauses[i]);
    }
  }
  DebugPrintA("\n");
  DebugPrintA("CompStr: ");
  if (dwCompStrLen) {
    WCHAR *str = GetCompStr();
    DebugPrintA("%ls", str);
  }
  DebugPrintA("\n");
  DebugPrintA("ResultReadClause: ");
  if (dwResultReadClauseLen) {
    DWORD *clauses = GetResultReadClause();
    for (DWORD i = 0; i < dwResultReadClauseLen / 4; ++i) {
      DebugPrintA("%08X ", clauses[i]);
    }
  }
  DebugPrintA("\n");
  DebugPrintA("ResultReadStr: ");
  if (dwResultReadStrLen) {
    WCHAR *str = GetResultReadStr();
    DebugPrintA("%ls", str);
  }
  DebugPrintA("\n");
  DebugPrintA("ResultClause: ");
  if (dwResultClauseLen) {
    DWORD *clauses = GetResultClause();
    for (DWORD i = 0; i < dwResultClauseLen / 4; ++i) {
      DebugPrintA("%08X ", clauses[i]);
    }
  }
  DebugPrintA("\n");
  DebugPrintA("ResultStr: ");
  if (dwResultStrLen) {
    WCHAR *str = GetResultStr();
    DebugPrintA("%ls", str);
  }
  DebugPrintA("\n");
#endif  // ndef NDEBUG
} // CompStr::Dump
Exemple #8
0
void LogCompStr::AssertValid() {
  if (dwCursorPos > GetCompCharCount()) {
    Dump();
    DebugPrintA("dwCursorPos: %u\n", dwCursorPos);
    DebugPrintA("GetCompCharCount(): %u\n", GetCompCharCount());
    assert(0);
  }
  if (comp_attr.size()) {
    if (comp_attr.size() != comp_str.size()) {
      Dump();
      DebugPrintA("comp_attr.size(): %u\n", (int)comp_attr.size());
      DebugPrintA("comp_str.size(): %u\n", (int)comp_str.size());
      assert(0);
    }
  }
  if (comp_clause.size()) {
    if (comp_clause[0] != 0) {
      Dump();
      assert(0);
    }
    if (comp_clause[comp_clause.size() - 1] != GetCompCharCount()) {
      Dump();
      assert(0);
    }
    if (extra.iClause > (DWORD)comp_clause.size()) {
      Dump();
      DebugPrintA("extra.iClause: %u\n", extra.iClause);
      DebugPrintA("comp_clause.size(): %u\n", (int)comp_clause.size());
      assert(0);
    }
    for (size_t i = 1; i < comp_clause.size(); ++i) {
      if (comp_clause[i] > GetCompCharCount()) {
        Dump();
        assert(0);
      }
      if (comp_clause[i - 1] > comp_clause[i]) {
        Dump();
        assert(0);
      }
    }
  }
  if (result_read_clause.size()) {
    if (result_read_clause[0] != 0) {
      Dump();
      assert(0);
    }
    for (size_t i = 1; i < result_read_clause.size(); ++i) {
      if (result_read_clause[i] > (DWORD)result_read_str.size()) {
        Dump();
        assert(0);
      }
      if (result_read_clause[i - 1] > result_read_clause[i]) {
        Dump();
        assert(0);
      }
    }
  }
  if (result_clause.size()) {
    if (result_clause[0] != 0) {
      Dump();
      assert(0);
    }
    for (size_t i = 1; i < result_clause.size(); ++i) {
      if (result_clause[i] > (DWORD)result_str.size()) {
        Dump();
        assert(0);
      }
      if (result_clause[i - 1] > result_clause[i]) {
        Dump();
        assert(0);
      }
    }
  }
  if (extra.hiragana_clauses.size() != extra.typing_clauses.size()) {
    Dump();
    assert(0);
  }
} // LogCompStr::AssertValid
Exemple #9
0
HWND GetCandPosHintFromComp(UIEXTRA *lpUIExtra, InputContext *lpIMC,
                            DWORD iClause, LPPOINT ppt)
{
  FOOTMARK();
  HWND hCompWnd;

  // is it vertical?
  BOOL fVert = (lpIMC->lfFont.A.lfEscapement == 2700);

  // get comp str
  CompStr *lpCompStr = lpIMC->LockCompStr();
  if (lpCompStr == NULL) return NULL;
  // get comp str
  std::wstring str(lpCompStr->GetCompStr(), lpCompStr->dwCompStrLen);
  const WCHAR *psz = str.c_str();
  const WCHAR *pch = psz;

  // get clause info
  DWORD *pdw = lpCompStr->GetCompClause();
  DWORD *pdwEnd = pdw + lpCompStr->dwCompClauseLen / sizeof(DWORD);
  std::set<DWORD> clauses(pdw, pdwEnd);

  DWORD ich = 0;
  DWORD dwClauseIndex = 0;
  for (int i = 0; i < MAXCOMPWND; i++) {
    if (lpIMC->cfCompForm.dwStyle) {
      hCompWnd = lpUIExtra->uiComp[i].hWnd;
    } else {
      hCompWnd = lpUIExtra->hwndDefComp;
    }

    // get client rect
    RECT rc;
    ::GetClientRect(hCompWnd, &rc);

    // starting position
    int x, y;
    if (fVert) {
      x = rc.right - UNDERLINE_HEIGHT;
      y = 0;
    } else {
      x = y = 0;
    }

    DWORD cch = ::GetWindowLong(hCompWnd, FIGWL_COMPSTARTNUM);
    DebugPrintA("ich: %d, cch: %d, dwClauseIndex: %d\n", ich, cch, dwClauseIndex);

    HDC hDC = ::GetDC(hCompWnd);
    HFONT hFont = (HFONT)::GetWindowLongPtr(hCompWnd, FIGWLP_FONT);
    HFONT hOldFont = NULL;
    if (hFont) hOldFont = (HFONT)::SelectObject(hDC, hFont);

    // is it end?
    SIZE siz;
    BOOL bIsDone = FALSE;
    const WCHAR *lpEnd = &pch[cch];
    while (pch < lpEnd) {
      // get size of text
      ::GetTextExtentPoint32W(hDC, pch, 1, &siz);

      if (dwClauseIndex == iClause) {
        if (fVert) {
          ppt->x = x;
          ppt->y = y + siz.cx;
        } else {
          ppt->x = x;
          ppt->y = y + siz.cy;
        }
        ::ClientToScreen(hCompWnd, ppt);
        bIsDone = TRUE;
        break;
      }

      // go to next position
      ++pch;
      ++ich;
      if (fVert)
        y += siz.cx;
      else
        x += siz.cx;

      if (clauses.count(ich) > 0) {
        ++dwClauseIndex;
      }
    }

    ::SelectObject(hDC, hOldFont);
    ::ReleaseDC(hCompWnd, hDC);

    if (bIsDone || lpIMC->cfCompForm.dwStyle == 0) {
      break;
    }
  }

  lpIMC->UnlockCompStr();
  return hCompWnd;
} // GetCandPosHintFromComp
Exemple #10
0
void CRajan::HandleMessage(PCOPYDATASTRUCT data)
{
	DebugPrintA("Handling Message, size: %i\n",data->cbData);
	
	DebugPrintA("%s\n",data->lpData);
}