init
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
#include "client_palpit.h"
|
||||
#include "client_comm_shared.h"
|
||||
|
||||
namespace client_palpit
|
||||
{
|
||||
DWORD WINAPI palpit_thread(LPVOID parmar)
|
||||
{
|
||||
static int break_count_fail = 0;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
auto mapping_data = reinterpret_cast<PMAPPING_USER_MEMORY>(parmar);
|
||||
|
||||
/*strcpy_s(mapping_data->str, "fail");
|
||||
mapping_data->add_index_code = TRUE;
|
||||
|
||||
auto val = 100;
|
||||
mapping_data->Index = val;
|
||||
|
||||
while (strcmp(mapping_data->str, "ok")) {
|
||||
|
||||
if (break_count_fail > 5) {
|
||||
MessageBoxA(NULL, "[client] 请求超时 错误代码:-502", NULL, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
break_count_fail++;
|
||||
|
||||
Sleep(1000);
|
||||
|
||||
}
|
||||
|
||||
if ((val + 1) != mapping_data->Index)
|
||||
{
|
||||
MessageBoxA(NULL, "[client] 组件发生异常 错误代码:-501", NULL, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
break_count_fail = 0;*/
|
||||
|
||||
//
|
||||
// 检测进程是否退出
|
||||
//
|
||||
if (!mapping_data->client_pid)
|
||||
mapping_data->client_pid = GetCurrentProcessId();
|
||||
|
||||
//static int fail_index = 0;
|
||||
//static HANDLE hProcess = 0;
|
||||
|
||||
//auto server_pid = mapping_data->server_pid;
|
||||
//if (hProcess == NULL)
|
||||
//{
|
||||
// if (fail_index > 3) {
|
||||
// exit(0);
|
||||
// }
|
||||
//
|
||||
|
||||
// hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, server_pid);
|
||||
// fail_index++;
|
||||
// continue;
|
||||
//}
|
||||
|
||||
////
|
||||
////监控客户端进程是否退出
|
||||
////
|
||||
//DWORD exitCode;
|
||||
//if (GetExitCodeProcess(hProcess, &exitCode)) {
|
||||
// if (exitCode != STILL_ACTIVE) {
|
||||
// exit(0);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
Sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
auto create_papit_thread(LPVOID parmar) -> void
|
||||
{
|
||||
CloseHandle(CreateThread(nullptr, 0, palpit_thread, parmar, 0, nullptr));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user