| 870 | } |
| 871 | |
| 872 | unsigned int WINAPI IECommandExecutor::WaitThreadProc(LPVOID lpParameter) { |
| 873 | LOG(TRACE) << "Entering IECommandExecutor::WaitThreadProc"; |
| 874 | WaitThreadContext* thread_context = reinterpret_cast<WaitThreadContext*>(lpParameter); |
| 875 | HWND window_handle = thread_context->window_handle; |
| 876 | bool is_deferred_command = thread_context->is_deferred_command; |
| 877 | std::string deferred_response(thread_context->deferred_response); |
| 878 | delete thread_context->deferred_response; |
| 879 | delete thread_context; |
| 880 | |
| 881 | LPSTR message_payload = new CHAR[deferred_response.size() + 1]; |
| 882 | strcpy_s(message_payload, |
| 883 | deferred_response.size() + 1, |
| 884 | deferred_response.c_str()); |
| 885 | |
| 886 | ::Sleep(WAIT_TIME_IN_MILLISECONDS); |
| 887 | ::PostMessage(window_handle, |
| 888 | WD_WAIT, |
| 889 | static_cast<WPARAM>(deferred_response.size()), |
| 890 | reinterpret_cast<LPARAM>(message_payload)); |
| 891 | if (is_deferred_command) { |
| 892 | // This wait is requested by the automatic handling of a user prompt |
| 893 | // before a command was executed, so re-queue the command execution |
| 894 | // for after the wait. |
| 895 | ::PostMessage(window_handle, WD_EXEC_COMMAND, NULL, NULL); |
| 896 | } |
| 897 | return 0; |
| 898 | } |
| 899 | |
| 900 | unsigned int WINAPI IECommandExecutor::ScriptWaitThreadProc(LPVOID lpParameter) { |
| 901 | LOG(TRACE) << "Entering IECommandExecutor::ScriptWaitThreadProc"; |