endebrito
June 2nd, 2010, 06:13 AM
I would like to know how to find the handle of the Socket Notification Sink hidden window. My goal is to detect the WM_SOCKET_NOTIFY message, so any other way to do this would be appreciate.
Thanks.
Thanks.
|
Click to See Complete Forum and Search --> : Get the handle of Socket Notification Sink endebrito June 2nd, 2010, 06:13 AM I would like to know how to find the handle of the Socket Notification Sink hidden window. My goal is to detect the WM_SOCKET_NOTIFY message, so any other way to do this would be appreciate. Thanks. olivthill2 June 2nd, 2010, 08:24 AM You can get the handle to the Socket Window with AfxGetCeSocketWindow(). The WM_SOCKET_NOTIFY message informs the socket window that a socket event has occurred. But, you can only send the WM_SOCKET_NOTIFY message to a window returned by the AfxGetCeSocketWindow WCE MFC global function. This message is only exposed publicly in Windows CE. See also http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.dotnet.languages.vc.libraries&tid=9fda72df-6a4c-43bb-a569-b5efa115a44d endebrito June 2nd, 2010, 11:13 AM That function would work only in Windows CE, I want something in regular Windows. MikeAThon June 3rd, 2010, 06:28 PM Is your question directed to the hidden notification window used by MFC's CAsyncSocket class? If so, then based on the source code for MFC CAsyncSocket class (found in sockcore.cpp), the following might work: HANDLE CMyAsyncSocket::GetHiddenWindowHandle() { AFX_MODULE_THREAD_STATE* pState = AfxGetModuleThreadState(); return pState->m_hSocketWindow; } Each thread has only one hidden window for socket notifications, and it is shared among all sockets created by that thread. Why do you need to detect the WM_SOCKET_NOTIFY message? Mike endebrito June 4th, 2010, 10:38 AM Is your question directed to the hidden notification window used by MFC's CAsyncSocket class? If so, then based on the source code for MFC CAsyncSocket class (found in sockcore.cpp), the following might work: HANDLE CMyAsyncSocket::GetHiddenWindowHandle() { AFX_MODULE_THREAD_STATE* pState = AfxGetModuleThreadState(); return pState->m_hSocketWindow; } Each thread has only one hidden window for socket notifications, and it is shared among all sockets created by that thread. Why do you need to detect the WM_SOCKET_NOTIFY message? Mike Thanks. I need to get that handle to send a WM_SOCKET_NOTIFY to that window, then write into recv() buffer and call select(), in order to force the program to read the recv() as a new packet were arrived from the server. It's a way to inject such packet into the client. The tool I'm programming will be used to discover protocols and detect malware. If you know any better way to do this, please tell me. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |