Browse Source

添加日志打印,方便调试。

sat23 3 years ago
parent
commit
706e1ffe37

+ 11 - 0
DLLInjection/RegistryInjection/InjectionDLL/InjectionDLL/PipeClient.cpp

@@ -10,6 +10,8 @@ CPipeClient::CPipeClient(LPCTSTR lpPipeName, DWORD dwMode)
     m_bClientStop = FALSE;
     m_dwMode = dwMode;
     memset(m_szPipeName, 0, MAX_PATH*sizeof(TCHAR));
+    memset(m_szWriteBuff, 0, 1024*sizeof(TCHAR));
+    memset(m_szReceiveBuff, 0, 1024*sizeof(TCHAR));
     if ( lpPipeName )
         _stprintf_s(m_szPipeName, _T("%s"), lpPipeName);
 }
@@ -137,6 +139,8 @@ DWORD CPipeClient::ReadMsgThread(LPVOID lpParam)
             if ( !bSuccess && (dwError = GetLastError()) != ERROR_MORE_DATA )
                 break; 
 
+            Utility::dprintf(_T("读取数据:%ld, %ld, %s"), dwError, cbRead, chBuf);
+
             // 追回数据;
             memcpy(pInstance->m_szReceiveBuff + dwDataIndex, chBuf, cbRead);
             dwDataIndex += cbRead;
@@ -148,7 +152,12 @@ DWORD CPipeClient::ReadMsgThread(LPVOID lpParam)
        
         if ( bSuccess )
         {
+            Utility::dprintf(_T("读取到的消息=%d"), sizeof(pInstance->m_szReceiveBuff));
+            Sleep(3000);
+            Utility::dprintf(_T("读取到的消息=%s"), pInstance->m_szReceiveBuff);
 
+            // 消息处理;
+            // ...
         }
         else
         {
@@ -163,6 +172,8 @@ DWORD CPipeClient::ReadMsgThread(LPVOID lpParam)
             Sleep(10000);
 #endif
         }
+
+         memset(pInstance->m_szReceiveBuff, 0, BUFSIZE*sizeof(TCHAR));
     }
 
     Utility::dprintf(_T("<%ld> ReadMsgThread 退出\n"),Utility::g_WndInfo.dwProcessId);

+ 1 - 1
DLLInjection/RegistryInjection/InjectionDLL/InjectionDLL/dllmain.cpp

@@ -49,7 +49,7 @@ HWND GetMainWnd()
 DWORD WINAPI WorkThreadProc(LPVOID lParam)
 {
 #ifdef _DEBUG
-	Sleep(5000);
+	Sleep(15000);
 #endif
 	TCHAR szLog[MAX_PATH] = {0};
 	// »ñÈ¡DLLËùÔÚ´°¿Ú¾ä±ú;