| 1797 | } |
| 1798 | |
| 1799 | DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, char const* name) |
| 1800 | { |
| 1801 | HANDLE fout; |
| 1802 | wchar_t* wname; |
| 1803 | DWORD error; |
| 1804 | if (!name) { |
| 1805 | return ERROR_INVALID_PARAMETER; |
| 1806 | } |
| 1807 | |
| 1808 | /* Close the existing handle. */ |
| 1809 | kwsysProcessCleanupHandle(phandle); |
| 1810 | |
| 1811 | /* Create a handle to write a file for the pipe. */ |
| 1812 | wname = kwsysEncoding_DupToWide(name); |
| 1813 | fout = |
| 1814 | CreateFileW(wname, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0); |
| 1815 | error = GetLastError(); |
| 1816 | free(wname); |
| 1817 | if (fout == INVALID_HANDLE_VALUE) { |
| 1818 | return error; |
| 1819 | } |
| 1820 | |
| 1821 | /* Assign the replacement handle. */ |
| 1822 | *phandle = fout; |
| 1823 | return ERROR_SUCCESS; |
| 1824 | } |
| 1825 | |
| 1826 | void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle) |
| 1827 | { |
no test coverage detected
searching dependent graphs…