R
R
Recardo_Recoly2017-06-15 19:41:37
Programming
Recardo_Recoly, 2017-06-15 19:41:37

How to call a function on a thread?

There is a DLL that is attacked to the process and it has a function.

BOOL WINAPI DllMain(HINSTANCE dllHistance, DWORD callReason, void* reserved)
{
  switch (callReason)
  {
    case DLL_PROCESS_ATTACH:
    {
      _beginthread(MainCM, 0, NULL);
      break;
    }
  }
  return 1;
}

How can a function be called from WindowProc (main thread) in MainCM thread?
That is, a function call in WindowProc (key interception and, in fact, the main thread.)
And so that it is processed in the MainCM thread?
It's just that if directly, then the crash is due to a call in the wrong thread.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2017-06-15
@petermzg

1. Microsoft highly DOES NOT recommend creating threads from DllMain.
2. Where does WindowProc come from?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question