| 833 | return TRUE; |
| 834 | } |
| 835 | unsigned int WINAPI SendKeysCommandHandler::SetFileValue(void *file_data) { |
| 836 | FileNameData* data = reinterpret_cast<FileNameData*>(file_data); |
| 837 | ::Sleep(100); |
| 838 | |
| 839 | bool file_name_successfully_sent = false; |
| 840 | unsigned int return_value = 0; |
| 841 | // On a separate thread, so must reinitialize COM. |
| 842 | HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); |
| 843 | if (FAILED(hr)) { |
| 844 | return_value = 1; |
| 845 | LOGHR(WARN, hr) << "COM library initialization encountered an error"; |
| 846 | error_text = L"The driver could not initialize COM on the thread used to handle the file selection dialog."; |
| 847 | } else { |
| 848 | file_name_successfully_sent = SendFileNameKeys(data); |
| 849 | ::CoUninitialize(); |
| 850 | if (!file_name_successfully_sent) { |
| 851 | return_value = 1; |
| 852 | } |
| 853 | } |
| 854 | |
| 855 | // TODO: Remove this and the supporting functions once feedback |
| 856 | // on the use of UI Automation is completed. |
| 857 | if (!file_name_successfully_sent && data->useLegacyDialogHandling) { |
| 858 | LegacySelectFile(data); |
| 859 | } |
| 860 | |
| 861 | return return_value; |
| 862 | } |
| 863 | |
| 864 | bool SendKeysCommandHandler::LegacySelectFile(FileNameData* data) { |
| 865 | HWND ie_main_window_handle = data->main; |
nothing calls this directly
no outgoing calls
no test coverage detected