Skip to content
Snippets Groups Projects
Commit 24752c3f authored by Brian Carrier's avatar Brian Carrier
Browse files

Added SHARE_READ to CreateFile open

parent 0bbf83e3
No related branches found
No related tags found
No related merge requests found
...@@ -208,16 +208,27 @@ raw_open(const TSK_TCHAR * image) ...@@ -208,16 +208,27 @@ raw_open(const TSK_TCHAR * image)
if (tsk_verbose) if (tsk_verbose)
tsk_fprintf(stderr, tsk_fprintf(stderr,
"raw_open: Trying Windows device with share_write mode\n"); "raw_open: Trying Windows device with share_write mode\n");
raw_info->fd = CreateFile(image, GENERIC_READ, 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) { if (raw_info->fd == INVALID_HANDLE_VALUE) {
tsk_error_reset(); tsk_error_reset();
tsk_errno = TSK_ERR_IMG_OPEN; tsk_errno = TSK_ERR_IMG_OPEN;
snprintf(tsk_errstr, TSK_ERRSTR_L, if (GetLastError() == ERROR_ACCESS_DENIED) {
"raw_open file: %" PRIttocTSK " msg: %d", image, snprintf(tsk_errstr, TSK_ERRSTR_L,
(int)GetLastError()); "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; return NULL;
} }
} }
......
...@@ -64,8 +64,8 @@ split_read_segment(IMG_SPLIT_INFO * split_info, int idx, char *buf, ...@@ -64,8 +64,8 @@ split_read_segment(IMG_SPLIT_INFO * split_info, int idx, char *buf,
tsk_error_reset(); tsk_error_reset();
tsk_errno = TSK_ERR_IMG_OPEN; tsk_errno = TSK_ERR_IMG_OPEN;
snprintf(tsk_errstr, TSK_ERRSTR_L, snprintf(tsk_errstr, TSK_ERRSTR_L,
"split_read file: %" PRIttocTSK " msg: %s", "split_read file: %" PRIttocTSK " msg: %d",
split_info->images[idx], strerror(errno)); split_info->images[idx], (int)GetLastError());
return -1; return -1;
} }
#else #else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment