diff --git a/tsk3/img/raw.c b/tsk3/img/raw.c index 521874c4bac967ed7c104f3432782f825aa8d0d0..3912f8bfa80cb461866da8e0377ecbc0b4d1ea4c 100644 --- a/tsk3/img/raw.c +++ b/tsk3/img/raw.c @@ -208,16 +208,27 @@ raw_open(const TSK_TCHAR * image) if (tsk_verbose) tsk_fprintf(stderr, "raw_open: Trying Windows device with share_write mode\n"); + raw_info->fd = CreateFile(image, GENERIC_READ, - FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); + FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); } if (raw_info->fd == INVALID_HANDLE_VALUE) { tsk_error_reset(); tsk_errno = TSK_ERR_IMG_OPEN; - snprintf(tsk_errstr, TSK_ERRSTR_L, - "raw_open file: %" PRIttocTSK " msg: %d", image, - (int)GetLastError()); + if (GetLastError() == ERROR_ACCESS_DENIED) { + snprintf(tsk_errstr, TSK_ERRSTR_L, + "raw_open file: %" PRIttocTSK " msg: Access Denied", image); + } + if (GetLastError() == ERROR_SHARING_VIOLATION) { + snprintf(tsk_errstr, TSK_ERRSTR_L, + "raw_open file: %" PRIttocTSK " msg: Sharing Violation", image); + } + else { + snprintf(tsk_errstr, TSK_ERRSTR_L, + "raw_open file: %" PRIttocTSK " msg: %d", image, + (int)GetLastError()); + } return NULL; } } diff --git a/tsk3/img/split.c b/tsk3/img/split.c index 5b001e660f95c8d6d6a848db023372b247cf2262..a8d5410b6b66c547c486e2243564630b6dd79ef1 100644 --- a/tsk3/img/split.c +++ b/tsk3/img/split.c @@ -64,8 +64,8 @@ split_read_segment(IMG_SPLIT_INFO * split_info, int idx, char *buf, tsk_error_reset(); tsk_errno = TSK_ERR_IMG_OPEN; snprintf(tsk_errstr, TSK_ERRSTR_L, - "split_read file: %" PRIttocTSK " msg: %s", - split_info->images[idx], strerror(errno)); + "split_read file: %" PRIttocTSK " msg: %d", + split_info->images[idx], (int)GetLastError()); return -1; } #else