| 338 | } |
| 339 | |
| 340 | static bool diag_win_handle_valid(HANDLE handle) { |
| 341 | BY_HANDLE_FILE_INFORMATION information; |
| 342 | return handle != INVALID_HANDLE_VALUE && GetFileType(handle) == FILE_TYPE_DISK && |
| 343 | GetFileInformationByHandle(handle, &information) != 0 && |
| 344 | (information.dwFileAttributes & |
| 345 | (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_REPARSE_POINT)) == 0 && |
| 346 | information.nNumberOfLinks == 1 && |
| 347 | SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 0) != 0; |
| 348 | } |
| 349 | |
| 350 | static bool diag_write_file(const char *base_name, const char *data, size_t length, bool append) { |
| 351 | char path[CBM_PATH_MAX]; |