windows fixes
This commit is contained in:
parent
b281f3ac46
commit
fb21805099
4
Makefile
4
Makefile
|
@ -32,14 +32,14 @@ BIN=$(BUILDDIR)/$(APPNAME)
|
||||||
ifeq ($(TARGET),win32)
|
ifeq ($(TARGET),win32)
|
||||||
PLATFORM=windows
|
PLATFORM=windows
|
||||||
CC=i686-pc-mingw32-gcc
|
CC=i686-pc-mingw32-gcc
|
||||||
CFLAGS=$(COMMON_CFLAGS) -m32
|
CFLAGS=$(COMMON_CFLAGS) -m32 -DWINVER=0x500
|
||||||
LIBS=-lws2_32 -liberty
|
LIBS=-lws2_32 -liberty
|
||||||
APPNAME=audioextract.exe
|
APPNAME=audioextract.exe
|
||||||
else
|
else
|
||||||
ifeq ($(TARGET),win64)
|
ifeq ($(TARGET),win64)
|
||||||
PLATFORM=windows
|
PLATFORM=windows
|
||||||
CC=x86_64-w64-mingw32-gcc
|
CC=x86_64-w64-mingw32-gcc
|
||||||
CFLAGS=$(COMMON_CFLAGS) -m64
|
CFLAGS=$(COMMON_CFLAGS) -m64 -DWINVER=0x500
|
||||||
LIBS=-lws2_32 -liberty
|
LIBS=-lws2_32 -liberty
|
||||||
APPNAME=audioextract64.exe
|
APPNAME=audioextract64.exe
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -56,8 +56,7 @@ int extract(const struct extract_options *options, size_t *numfilesptr)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
filesize.LowPart = GetFileSize(hFile, (LPDWORD)&(filesize.HighPart));
|
if (!GetFileSizeEx(hFile, &filesize))
|
||||||
if (filesize.LowPart == INVALID_FILE_SIZE)
|
|
||||||
{
|
{
|
||||||
PrintError(options->filepath);
|
PrintError(options->filepath);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -68,6 +67,13 @@ int extract(const struct extract_options *options, size_t *numfilesptr)
|
||||||
printf("%s: Skipping empty file.\n", options->filepath);
|
printf("%s: Skipping empty file.\n", options->filepath);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
else if (filesize.QuadPart < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s: File has negative size (%"PRIi64")?\n",
|
||||||
|
options->filepath,
|
||||||
|
filesize.QuadPart);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
else if ((uint64_t)filesize.QuadPart <= options->offset)
|
else if ((uint64_t)filesize.QuadPart <= options->offset)
|
||||||
{
|
{
|
||||||
printf("%s: Skipping file because offset is bigger than file.\n",
|
printf("%s: Skipping file because offset is bigger than file.\n",
|
||||||
|
@ -93,7 +99,7 @@ int extract(const struct extract_options *options, size_t *numfilesptr)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_extract(filedata, filesize.QuadPart, options, numfilesptr))
|
if (do_extract(filedata, length, options, numfilesptr))
|
||||||
{
|
{
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue