MCPcopy Create free account
hub / github.com/Neo-Maoku/SearchAvailableExe / TestCreateProcess

Function TestCreateProcess

SearchAvailableExe/Tools.cpp:928–960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

926}
927
928int TestCreateProcess(string runFilePath, DWORD dwMilliseconds) {
929 STARTUPINFOA si = { sizeof(si) };
930 PROCESS_INFORMATION pi;
931
932 if (!CreateProcessA(
933 nullptr, // ָ���ִ���ļ�����ָ�루�����nullptr��ʾʹ�õ�ǰ��ִ���ļ���
934 (char*)runFilePath.c_str(), // ��ִ���ļ���·��
935 nullptr, // ��ȫ����
936 nullptr, // ��ȫ����
937 FALSE, // ָ���Ƿ�̳о��
938 CREATE_NO_WINDOW, // ָ��������ʾ��ʽ������ָ��Ϊ�޴��ڣ�
939 nullptr, // ָ���½��̵Ļ�����
940 nullptr, // ָ���½��̵ĵ�ǰĿ¼
941 &si, // STARTUPINFO �ṹ��
942 &pi)) { // �����½�����Ϣ�� PROCESS_INFORMATION �ṹ��
943 return 0;
944 }
945
946 // �ȴ����̽���
947 WaitForSingleObject(pi.hProcess, dwMilliseconds);
948
949 TerminateProcess(pi.hProcess, 0);
950
951 // ��ȡ���̵��˳���
952 DWORD exitCode = 0;
953 GetExitCodeProcess(pi.hProcess, &exitCode);
954
955 // �رս��̺��߳̾��
956 CloseHandle(pi.hProcess);
957 CloseHandle(pi.hThread);
958
959 return exitCode;
960}
961
962void RunPE(PResultInfo result) {
963 std::string currentPath = GetCurrentPath();

Callers 1

RunPEFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected