1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[misc] fix multiple warnings

* Fix Visual Studio code analysis warnings
* Also rename VS targets to x86_32 and x86_64
This commit is contained in:
Pete Batard 2015-01-23 02:26:41 +00:00
parent eb9e5ab899
commit f965c5cd23
18 changed files with 158 additions and 128 deletions

152
rufus.sln
View file

@ -22,84 +22,84 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bled", "src\bled\.msvc\bled
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
Debug|x86_32 = Debug|x86_32
Debug|x86_64 = Debug|x86_64
Release|x86_32 = Release|x86_32
Release|x86_64 = Release|x86_64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{731858A7-0303-4988-877B-9C0DD6471864}.Debug|Win32.ActiveCfg = Debug|Win32
{731858A7-0303-4988-877B-9C0DD6471864}.Debug|Win32.Build.0 = Debug|Win32
{731858A7-0303-4988-877B-9C0DD6471864}.Debug|x64.ActiveCfg = Debug|x64
{731858A7-0303-4988-877B-9C0DD6471864}.Debug|x64.Build.0 = Debug|x64
{731858A7-0303-4988-877B-9C0DD6471864}.Release|Win32.ActiveCfg = Release|Win32
{731858A7-0303-4988-877B-9C0DD6471864}.Release|Win32.Build.0 = Release|Win32
{731858A7-0303-4988-877B-9C0DD6471864}.Release|x64.ActiveCfg = Release|x64
{731858A7-0303-4988-877B-9C0DD6471864}.Release|x64.Build.0 = Release|x64
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|Win32.ActiveCfg = Debug|Win32
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|Win32.Build.0 = Debug|Win32
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|x64.ActiveCfg = Debug|x64
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|x64.Build.0 = Debug|x64
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|Win32.ActiveCfg = Release|Win32
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|Win32.Build.0 = Release|Win32
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|x64.ActiveCfg = Release|x64
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|x64.Build.0 = Release|x64
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|Win32.ActiveCfg = Debug|Win32
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|Win32.Build.0 = Debug|Win32
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|x64.ActiveCfg = Debug|x64
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|x64.Build.0 = Debug|x64
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|Win32.ActiveCfg = Release|Win32
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|Win32.Build.0 = Release|Win32
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|x64.ActiveCfg = Release|x64
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|x64.Build.0 = Release|x64
{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|Win32.ActiveCfg = Debug|Win32
{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|Win32.Build.0 = Debug|Win32
{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|x64.ActiveCfg = Debug|x64
{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|x64.Build.0 = Debug|x64
{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|Win32.ActiveCfg = Release|Win32
{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|Win32.Build.0 = Release|Win32
{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|x64.ActiveCfg = Release|x64
{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|x64.Build.0 = Release|x64
{D4E80F35-2604-40AC-B436-97B052ECB572}.Debug|Win32.ActiveCfg = Debug|Win32
{D4E80F35-2604-40AC-B436-97B052ECB572}.Debug|Win32.Build.0 = Debug|Win32
{D4E80F35-2604-40AC-B436-97B052ECB572}.Debug|x64.ActiveCfg = Debug|x64
{D4E80F35-2604-40AC-B436-97B052ECB572}.Debug|x64.Build.0 = Debug|x64
{D4E80F35-2604-40AC-B436-97B052ECB572}.Release|Win32.ActiveCfg = Release|Win32
{D4E80F35-2604-40AC-B436-97B052ECB572}.Release|Win32.Build.0 = Release|Win32
{D4E80F35-2604-40AC-B436-97B052ECB572}.Release|x64.ActiveCfg = Release|x64
{D4E80F35-2604-40AC-B436-97B052ECB572}.Release|x64.Build.0 = Release|x64
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Debug|Win32.ActiveCfg = Debug|Win32
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Debug|Win32.Build.0 = Debug|Win32
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Debug|x64.ActiveCfg = Debug|x64
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Debug|x64.Build.0 = Debug|x64
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Release|Win32.ActiveCfg = Release|Win32
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Release|Win32.Build.0 = Release|Win32
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Release|x64.ActiveCfg = Release|x64
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Release|x64.Build.0 = Release|x64
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Debug|Win32.ActiveCfg = Debug|Win32
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Debug|Win32.Build.0 = Debug|Win32
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Debug|x64.ActiveCfg = Debug|x64
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Debug|x64.Build.0 = Debug|x64
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Release|Win32.ActiveCfg = Release|Win32
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Release|Win32.Build.0 = Release|Win32
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Release|x64.ActiveCfg = Release|x64
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Release|x64.Build.0 = Release|x64
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.ActiveCfg = Debug|Win32
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|Win32.Build.0 = Debug|Win32
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.ActiveCfg = Debug|x64
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x64.Build.0 = Debug|x64
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.ActiveCfg = Release|Win32
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|Win32.Build.0 = Release|Win32
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.ActiveCfg = Release|x64
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x64.Build.0 = Release|x64
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Debug|Win32.ActiveCfg = Debug|Win32
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Debug|Win32.Build.0 = Debug|Win32
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Debug|x64.ActiveCfg = Debug|x64
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Debug|x64.Build.0 = Debug|x64
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Release|Win32.ActiveCfg = Release|Win32
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Release|Win32.Build.0 = Release|Win32
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Release|x64.ActiveCfg = Release|x64
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Release|x64.Build.0 = Release|x64
{731858A7-0303-4988-877B-9C0DD6471864}.Debug|x86_32.ActiveCfg = Debug|Win32
{731858A7-0303-4988-877B-9C0DD6471864}.Debug|x86_32.Build.0 = Debug|Win32
{731858A7-0303-4988-877B-9C0DD6471864}.Debug|x86_64.ActiveCfg = Debug|x64
{731858A7-0303-4988-877B-9C0DD6471864}.Debug|x86_64.Build.0 = Debug|x64
{731858A7-0303-4988-877B-9C0DD6471864}.Release|x86_32.ActiveCfg = Release|Win32
{731858A7-0303-4988-877B-9C0DD6471864}.Release|x86_32.Build.0 = Release|Win32
{731858A7-0303-4988-877B-9C0DD6471864}.Release|x86_64.ActiveCfg = Release|x64
{731858A7-0303-4988-877B-9C0DD6471864}.Release|x86_64.Build.0 = Release|x64
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|x86_32.ActiveCfg = Debug|Win32
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|x86_32.Build.0 = Debug|Win32
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|x86_64.ActiveCfg = Debug|x64
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Debug|x86_64.Build.0 = Debug|x64
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|x86_32.ActiveCfg = Release|Win32
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|x86_32.Build.0 = Release|Win32
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|x86_64.ActiveCfg = Release|x64
{2B1D078D-8EB4-4398-9CA4-23457265A7F6}.Release|x86_64.Build.0 = Release|x64
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|x86_32.ActiveCfg = Debug|Win32
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|x86_32.Build.0 = Debug|Win32
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|x86_64.ActiveCfg = Debug|x64
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Debug|x86_64.Build.0 = Debug|x64
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|x86_32.ActiveCfg = Release|Win32
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|x86_32.Build.0 = Release|Win32
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|x86_64.ActiveCfg = Release|x64
{8390DCE0-859D-4F57-AD9C-AAEAC4D77EEF}.Release|x86_64.Build.0 = Release|x64
{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|x86_32.ActiveCfg = Debug|Win32
{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|x86_32.Build.0 = Debug|Win32
{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|x86_64.ActiveCfg = Debug|x64
{266502AC-CD74-4581-B707-938A7D05AD7A}.Debug|x86_64.Build.0 = Debug|x64
{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|x86_32.ActiveCfg = Release|Win32
{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|x86_32.Build.0 = Release|Win32
{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|x86_64.ActiveCfg = Release|x64
{266502AC-CD74-4581-B707-938A7D05AD7A}.Release|x86_64.Build.0 = Release|x64
{D4E80F35-2604-40AC-B436-97B052ECB572}.Debug|x86_32.ActiveCfg = Debug|Win32
{D4E80F35-2604-40AC-B436-97B052ECB572}.Debug|x86_32.Build.0 = Debug|Win32
{D4E80F35-2604-40AC-B436-97B052ECB572}.Debug|x86_64.ActiveCfg = Debug|x64
{D4E80F35-2604-40AC-B436-97B052ECB572}.Debug|x86_64.Build.0 = Debug|x64
{D4E80F35-2604-40AC-B436-97B052ECB572}.Release|x86_32.ActiveCfg = Release|Win32
{D4E80F35-2604-40AC-B436-97B052ECB572}.Release|x86_32.Build.0 = Release|Win32
{D4E80F35-2604-40AC-B436-97B052ECB572}.Release|x86_64.ActiveCfg = Release|x64
{D4E80F35-2604-40AC-B436-97B052ECB572}.Release|x86_64.Build.0 = Release|x64
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Debug|x86_32.ActiveCfg = Debug|Win32
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Debug|x86_32.Build.0 = Debug|Win32
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Debug|x86_64.ActiveCfg = Debug|x64
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Debug|x86_64.Build.0 = Debug|x64
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Release|x86_32.ActiveCfg = Release|Win32
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Release|x86_32.Build.0 = Release|Win32
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Release|x86_64.ActiveCfg = Release|x64
{0CEC40A6-A195-4BE5-A88B-0AB00EB142EC}.Release|x86_64.Build.0 = Release|x64
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Debug|x86_32.ActiveCfg = Debug|Win32
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Debug|x86_32.Build.0 = Debug|Win32
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Debug|x86_64.ActiveCfg = Debug|x64
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Debug|x86_64.Build.0 = Debug|x64
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Release|x86_32.ActiveCfg = Release|Win32
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Release|x86_32.Build.0 = Release|Win32
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Release|x86_64.ActiveCfg = Release|x64
{FA1B1093-BA86-410A-B7A0-7A54C605F812}.Release|x86_64.Build.0 = Release|x64
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x86_32.ActiveCfg = Debug|Win32
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x86_32.Build.0 = Debug|Win32
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x86_64.ActiveCfg = Debug|x64
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Debug|x86_64.Build.0 = Debug|x64
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x86_32.ActiveCfg = Release|Win32
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x86_32.Build.0 = Release|Win32
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x86_64.ActiveCfg = Release|x64
{AE83E1B4-CE06-47EE-B7A3-C3A1D7C2D71E}.Release|x86_64.Build.0 = Release|x64
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Debug|x86_32.ActiveCfg = Debug|Win32
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Debug|x86_32.Build.0 = Debug|Win32
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Debug|x86_64.ActiveCfg = Debug|x64
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Debug|x86_64.Build.0 = Debug|x64
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Release|x86_32.ActiveCfg = Release|Win32
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Release|x86_32.Build.0 = Release|Win32
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Release|x86_64.ActiveCfg = Release|x64
{FB6D52D4-A2F8-C358-DB85-BBCAECFDDD7D}.Release|x86_64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -192,12 +192,12 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
* it has lchmod which seems to do nothing!
* so we use chmod... */
if (!(archive_handle->ah_flags & ARCHIVE_DONT_RESTORE_PERM)) {
chmod(file_header->name, file_header->mode);
(void)chmod(file_header->name, file_header->mode);
}
if (archive_handle->ah_flags & ARCHIVE_RESTORE_DATE) {
struct timeval t[2];
t[1].tv_sec = t[0].tv_sec = file_header->mtime;
t[1].tv_sec = t[0].tv_sec = (long)file_header->mtime;
t[1].tv_usec = t[0].tv_usec = 0;
utimes(file_header->name, t);
}

View file

@ -257,7 +257,7 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
if (bytebuffer_offset >= bytebuffer_size) {
unsigned sz = bytebuffer_max - 4;
if (to_read >= 0 && to_read < sz) /* unzip only */
sz = to_read;
sz = (unsigned)to_read;
/* Leave the first 4 bytes empty so we can always unwind the bitbuffer
* to the front of the bytebuffer */
bytebuffer_size = safe_read(gunzip_src_fd, &bytebuffer[4], sz);

View file

@ -261,7 +261,7 @@ unpack_Z_stream(transformer_state_t *xstate)
{
int i;
i = de_stack - stackp;
i = (int)(de_stack - stackp);
if (outpos + i >= OBUFSIZ) {
do {
if (i > OBUFSIZ - outpos) {
@ -279,7 +279,7 @@ unpack_Z_stream(transformer_state_t *xstate)
outpos = 0;
}
stackp += i;
i = de_stack - stackp;
i = (int)(de_stack - stackp);
} while (i > 0);
} else {
memcpy(outbuf + outpos, stackp, i);

View file

@ -247,7 +247,7 @@ unpack_lzma_stream(transformer_state_t *xstate)
if (header.dict_size == 0)
header.dict_size++;
buffer = xmalloc(MIN(header.dst_size, header.dict_size));
buffer = xmalloc((size_t)MIN(header.dst_size, header.dict_size));
{
int num_probs;
@ -279,7 +279,7 @@ unpack_lzma_stream(transformer_state_t *xstate)
if (state >= LZMA_NUM_LIT_STATES) {
int match_byte;
uint32_t pos = buffer_pos - rep0;
uint32_t pos = (uint32_t)(buffer_pos - rep0);
while (pos >= header.dict_size)
pos += header.dict_size;
@ -432,7 +432,7 @@ unpack_lzma_stream(transformer_state_t *xstate)
len += LZMA_MATCH_MIN_LEN;
IF_NOT_FEATURE_LZMA_FAST(string:)
do {
uint32_t pos = buffer_pos - rep0;
uint32_t pos = (uint32_t)(buffer_pos - rep0);
while (pos >= header.dict_size)
pos += header.dict_size;
previous_byte = buffer[pos];

View file

@ -171,14 +171,14 @@ static inline pid_t wait(int* status) { *status = 4; return -1; }
/* This override enables the display of a progress based on the number of bytes read */
extern uint64_t bb_total_rb;
static inline ssize_t full_read(int fd, void *buf, size_t count) {
ssize_t rb;
static inline int full_read(int fd, void *buf, size_t count) {
int rb;
if ((bled_cancel_request != NULL) && (*bled_cancel_request != 0)) {
errno = EINTR;
return -1;
}
rb = _read(fd, buf, count);
rb = _read(fd, buf, (int)count);
if (rb > 0) {
bb_total_rb += rb;
if (bled_progress != NULL)

View file

@ -48,7 +48,7 @@ ssize_t FAST_FUNC transformer_write(transformer_state_t *xstate, const void *buf
xstate->mem_output_buf[size] = '\0';
nwrote = bufsize;
} else {
nwrote = full_write(xstate->dst_fd, buf, bufsize);
nwrote = full_write(xstate->dst_fd, buf, (unsigned)bufsize);
if (nwrote != (ssize_t)bufsize) {
bb_perror_msg("write");
nwrote = -1;

View file

@ -394,7 +394,7 @@ static void XZ_FUNC bcj_apply(struct xz_dec_bcj *s,
}
*pos += filtered;
s->pos += filtered;
s->pos += (uint32_t)filtered;
}
/*

View file

@ -353,7 +353,7 @@ static bool XZ_FUNC dict_repeat(
if (dist >= dict->full || dist >= dict->size)
return false;
left = min_t(size_t, dict->limit - dict->pos, *len);
left = (uint32_t)min_t(size_t, dict->limit - dict->pos, *len);
*len -= left;
back = dict->pos - dist - 1;
@ -387,7 +387,7 @@ static void XZ_FUNC dict_uncompressed(
if (copy_size > *left)
copy_size = *left;
*left -= copy_size;
*left -= (uint32_t)copy_size;
memcpy(dict->buf + dict->pos, b->in + b->in_pos, copy_size);
dict->pos += copy_size;
@ -429,7 +429,7 @@ static uint32_t XZ_FUNC dict_flush(struct dictionary *dict, struct xz_buf *b)
dict->start = dict->pos;
b->out_pos += copy_size;
return copy_size;
return (uint32_t)copy_size;
}
/*****************
@ -856,7 +856,7 @@ static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
if (tmp > s->lzma2.compressed - s->temp.size)
tmp = s->lzma2.compressed - s->temp.size;
if (tmp > in_avail)
tmp = in_avail;
tmp = (uint32_t)in_avail;
memcpy(s->temp.buf + s->temp.size, b->in + b->in_pos, tmp);
@ -879,10 +879,10 @@ static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
if (!lzma_main(s) || s->rc.in_pos > s->temp.size + tmp)
return false;
s->lzma2.compressed -= s->rc.in_pos;
s->lzma2.compressed -= (uint32_t)s->rc.in_pos;
if (s->rc.in_pos < s->temp.size) {
s->temp.size -= s->rc.in_pos;
s->temp.size -= (uint32_t)s->rc.in_pos;
memmove(s->temp.buf, s->temp.buf + s->rc.in_pos,
s->temp.size);
return true;
@ -909,7 +909,7 @@ static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
if (in_avail > s->lzma2.compressed)
return false;
s->lzma2.compressed -= in_avail;
s->lzma2.compressed -= (uint32_t)in_avail;
b->in_pos = s->rc.in_pos;
}
@ -919,7 +919,7 @@ static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b)
in_avail = s->lzma2.compressed;
memcpy(s->temp.buf, b->in + b->in_pos, in_avail);
s->temp.size = in_avail;
s->temp.size = (uint32_t)in_avail;
b->in_pos += in_avail;
}

View file

@ -2,7 +2,7 @@
* Rufus: The Reliable USB Formatting Utility
* DOS boot file extraction, from the FAT12 floppy image in diskcopy.dll
* (MS WinME DOS) or from the embedded FreeDOS resource files
* Copyright © 2011-2013 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2015 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -291,6 +291,7 @@ static BOOL ExtractMSDOS(const char* path)
{
char dllname[MAX_PATH] = "C:\\Windows\\System32";
int i, j;
UINT len;
BOOL r = FALSE;
HMODULE hDLL = NULL;
char locale_path[MAX_PATH];
@ -303,7 +304,11 @@ static BOOL ExtractMSDOS(const char* path)
safe_strcat(locale_path, sizeof(locale_path), "LOCALE\\");
CreateDirectoryA(locale_path, NULL);
GetSystemDirectoryA(dllname, sizeof(dllname));
len = GetSystemDirectoryA(dllname, sizeof(dllname));
if ((len == 0) || (len >= sizeof(dllname))) {
uprintf("Unable to get system directory: %s\n", WindowsErrorString());
goto out;
}
safe_strcat(dllname, sizeof(dllname), "\\diskcopy.dll");
hDLL = LoadLibraryA(dllname);
if (hDLL == NULL) {

View file

@ -884,9 +884,9 @@ BOOL MountVolume(char* drive_name, char *drive_guid)
char* AltMountVolume(const char* drive_name, uint8_t part_nr)
{
static char mounted_drive[] = "?:";
const size_t bufsize = 65536;
const DWORD bufsize = 65536;
char *buffer = NULL, *p, target[2][MAX_PATH], *ret = NULL;
int i;
size_t i;
mounted_drive[0] = GetUnusedDriveLetter();
if (mounted_drive[0] == 0) {

View file

@ -283,8 +283,10 @@ static void print_extracted_file(char* psz_fullpath, int64_t i_file_length)
{
size_t i, nul_pos;
if (psz_fullpath == NULL)
return;
// Replace slashes with backslashes and append the size to the path for UI display
nul_pos = safe_strlen(psz_fullpath);
nul_pos = strlen(psz_fullpath);
for (i=0; i<nul_pos; i++)
if (psz_fullpath[i] == '/') psz_fullpath[i] = '\\';
safe_sprintf(&psz_fullpath[nul_pos], 24, " (%s)", SizeToHumanReadable(i_file_length, TRUE, FALSE));
@ -973,10 +975,13 @@ typedef enum _DETACH_VIRTUAL_DISK_FLAG {
DETACH_VIRTUAL_DISK_FLAG_NONE = 0x00000000
} DETACH_VIRTUAL_DISK_FLAG;
#ifndef _VIRTUAL_STORAGE_TYPE_DEFINED
#define _VIRTUAL_STORAGE_TYPE_DEFINED
typedef struct _VIRTUAL_STORAGE_TYPE {
ULONG DeviceId;
GUID VendorId;
} VIRTUAL_STORAGE_TYPE, *PVIRTUAL_STORAGE_TYPE;
#endif
typedef struct _OPEN_VIRTUAL_DISK_PARAMETERS {
OPEN_VIRTUAL_DISK_VERSION Version;

View file

@ -3,7 +3,7 @@
* Compensating for what Microsoft should have done a long long time ago.
* Also see http://utf8everywhere.org/
*
* Copyright © 2010-2014 Pete Batard <pete@akeo.ie>
* Copyright © 2010-2015 Pete Batard <pete@akeo.ie>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -507,7 +507,7 @@ static __inline int SHDeleteDirectoryExU(HWND hwnd, const char* pszPath, FILEOP_
size_t wpszPath_len = strlen(pszPath) + 2;
wchar_t* wpszPath = (wchar_t*)calloc(wpszPath_len, sizeof(wchar_t));
SHFILEOPSTRUCTW shfo = { hwnd, FO_DELETE, wpszPath, NULL, fFlags, FALSE, NULL, NULL };
utf8_to_wchar_no_alloc(pszPath, wpszPath, wpszPath_len);
utf8_to_wchar_no_alloc(pszPath, wpszPath, (int)wpszPath_len);
// FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION,
ret = SHFileOperationW(&shfo);
wfree(pszPath);

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Registry access
* Copyright © 2012-2013 Pete Batard <pete@akeo.ie>
* Copyright © 2012-2015 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -82,14 +82,21 @@ static __inline BOOL _GetRegistryKey(HKEY key_root, const char* key_name, DWORD
safe_strcat(long_key_name, sizeof(long_key_name), key_name);
long_key_name[sizeof("SOFTWARE\\") + i-1] = 0;
i++;
if (RegOpenKeyExA(key_root, long_key_name, 0, KEY_READ, &hApp) != ERROR_SUCCESS)
if (RegOpenKeyExA(key_root, long_key_name, 0, KEY_READ, &hApp) != ERROR_SUCCESS) {
hApp = NULL;
goto out;
}
} else {
if ( (RegOpenKeyExA(key_root, "SOFTWARE", 0, KEY_READ|KEY_CREATE_SUB_KEY, &hSoftware) != ERROR_SUCCESS)
|| (RegCreateKeyExA(hSoftware, COMPANY_NAME "\\" APPLICATION_NAME, 0, NULL, 0,
KEY_SET_VALUE|KEY_QUERY_VALUE|KEY_CREATE_SUB_KEY, NULL, &hApp, &dwDisp) != ERROR_SUCCESS) )
if (RegOpenKeyExA(key_root, "SOFTWARE", 0, KEY_READ|KEY_CREATE_SUB_KEY, &hSoftware) != ERROR_SUCCESS) {
hSoftware = NULL;
goto out;
}
if (RegCreateKeyExA(hSoftware, COMPANY_NAME "\\" APPLICATION_NAME, 0, NULL, 0,
KEY_SET_VALUE | KEY_QUERY_VALUE | KEY_CREATE_SUB_KEY, NULL, &hApp, &dwDisp) != ERROR_SUCCESS) {
hApp = NULL;
goto out;
}
}
s = RegQueryValueExA(hApp, &key_name[i], NULL, &dwType, (LPBYTE)dest, &dwSize);
// No key means default value of 0 or empty string
@ -97,7 +104,9 @@ static __inline BOOL _GetRegistryKey(HKEY key_root, const char* key_name, DWORD
r = TRUE;
}
out:
if (hSoftware != NULL)
RegCloseKey(hSoftware);
if (hApp != NULL)
RegCloseKey(hApp);
return r;
}
@ -109,16 +118,22 @@ static __inline BOOL _SetRegistryKey(HKEY key_root, const char* key_name, DWORD
HKEY hSoftware = NULL, hApp = NULL;
DWORD dwDisp, dwType = reg_type;
if ( (RegOpenKeyExA(key_root, "SOFTWARE", 0, KEY_READ|KEY_CREATE_SUB_KEY, &hSoftware) != ERROR_SUCCESS)
|| (RegCreateKeyExA(hSoftware, COMPANY_NAME "\\" APPLICATION_NAME, 0, NULL, 0,
KEY_SET_VALUE|KEY_QUERY_VALUE|KEY_CREATE_SUB_KEY, NULL, &hApp, &dwDisp) != ERROR_SUCCESS) ) {
if (RegOpenKeyExA(key_root, "SOFTWARE", 0, KEY_READ|KEY_CREATE_SUB_KEY, &hSoftware) != ERROR_SUCCESS) {
hSoftware = NULL;
goto out;
}
if (RegCreateKeyExA(hSoftware, COMPANY_NAME "\\" APPLICATION_NAME, 0, NULL, 0,
KEY_SET_VALUE|KEY_QUERY_VALUE|KEY_CREATE_SUB_KEY, NULL, &hApp, &dwDisp) != ERROR_SUCCESS) {
hApp = NULL;
goto out;
}
r = (RegSetValueExA(hApp, key_name, 0, dwType, src, src_size) == ERROR_SUCCESS);
out:
if (hSoftware != NULL)
RegCloseKey(hSoftware);
if (hApp != NULL)
RegCloseKey(hApp);
return r;
}

View file

@ -24,6 +24,7 @@
// Disable some VS2012 Code Analysis warnings
#pragma warning(disable: 4996) // Ignore deprecated (eg. GetVersionEx()), as we have to contend with XP
#pragma warning(disable: 28159) // VS2012 wants us to use GetTickCount64(), but it's not available on XP
#pragma warning(disable: 6258) // I know what I'm using TerminateThread for
#endif
#pragma once

View file

@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.0.0.583"
CAPTION "Rufus 2.0.0.584"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -157,7 +157,7 @@ END
IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Rufus 2.0.0.583"
CAPTION "Rufus 2.0.0.584"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -283,7 +283,7 @@ END
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 2.0.0.583"
CAPTION "Rufus 2.0.0.584"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -415,7 +415,7 @@ END
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 2.0.0.583"
CAPTION "Rufus 2.0.0.584"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
@ -671,8 +671,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,0,0,583
PRODUCTVERSION 2,0,0,583
FILEVERSION 2,0,0,584
PRODUCTVERSION 2,0,0,584
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -689,13 +689,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.0.0.583"
VALUE "FileVersion", "2.0.0.584"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.0.0.583"
VALUE "ProductVersion", "2.0.0.584"
END
END
BLOCK "VarFileInfo"

View file

@ -691,6 +691,7 @@ DWORD WINAPI SetLGPThread(LPVOID param)
NULL, &policy_key, &disp);
if (r != ERROR_SUCCESS) {
uprintf("SetLGP: Failed to open LGPO path %s - error %x\n", p->szPath, hr);
policy_key = NULL;
goto error;
}
@ -759,6 +760,7 @@ BOOL SetLGP(BOOL bRestore, BOOL* bExistingKey, const char* szPath, const char* s
CloseHandle(thread_id);
return FALSE;
}
GetExitCodeThread(thread_id, &r);
if (!GetExitCodeThread(thread_id, &r))
return FALSE;
return (BOOL) r;
}

View file

@ -669,6 +669,7 @@ out:
if (hImage != NULL) pfWIMCloseHandle(hImage);
if (hWim != NULL) pfWIMCloseHandle(hWim);
}
if (pfWIMUnregisterMessageCallback != NULL)
pfWIMUnregisterMessageCallback(NULL, (FARPROC)WimProgressCallback);
safe_free(wimage);
safe_free(wdst);
@ -689,6 +690,7 @@ BOOL WimApplyImage(const char* image, int index, const char* dst)
return FALSE;
}
WaitForSingleObject(handle, INFINITE);
GetExitCodeThread(handle, &dw);
if (!GetExitCodeThread(handle, &dw))
return FALSE;
return (BOOL)dw;
}