From c0d32b3e8c264cb91ab10bba6673b6f56e105563 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 19 Oct 2013 22:07:37 +0100 Subject: [PATCH] Ignore Release and Debug folders. Windows SDK does have fcntl.h, snprintf, sys/stat.h, vsnprintf, windows.h and lseek64. Does not have inttypes.h. Modify config.h to reflect this. Windows 8 WDK requires us to specify ddk headers will be used usermode. __PRETTY_FUNCTION__ is defined in MingW but not in VS. Equal to __FUNCSIG__ DDK headers are not longer in a folder (as of Win8 WDK) Windows SDK defines _snprintf, same as snprintf. VS didn't like bool declarations to be inline to function return. Also, it's BOOL in Windows SDK. Specific VS version.h should be used when using VS. DOES COMPILE --- MSVC/.gitignore | 4 +++- MSVC/config.h | 17 ++++++++++++----- MSVC/libcdio.vcxproj | 9 +++++---- MSVC/libcdio.vcxproj.filters | 9 ++++++--- include/cdio/msvc/unistd.h | 30 ++++++++++++++++++++++++++++++ include/cdio/msvc/version.h | 4 ++-- lib/driver/MSWindows/win32_ioctl.c | 26 +++++++++++++++----------- lib/driver/image/bincue.c | 9 +++++++++ lib/driver/image/cdrdao.c | 5 +++++ lib/driver/image/nrg.c | 5 +++++ lib/driver/util.c | 5 +++++ 11 files changed, 97 insertions(+), 26 deletions(-) create mode 100644 include/cdio/msvc/unistd.h diff --git a/MSVC/.gitignore b/MSVC/.gitignore index a462d955..6953a9ac 100644 --- a/MSVC/.gitignore +++ b/MSVC/.gitignore @@ -6,4 +6,6 @@ Backup *.user UpgradeLog.* *.sdf -*.suo \ No newline at end of file +*.suo +[Rr]elease +[Dd]ebug \ No newline at end of file diff --git a/MSVC/config.h b/MSVC/config.h index 5a06eb08..22c18c58 100644 --- a/MSVC/config.h +++ b/MSVC/config.h @@ -37,7 +37,7 @@ #define HAVE_ERRNO_H 1 /* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H +#define HAVE_FCNTL_H 1 /* Define 1 if you have FreeBSD CD-ROM support */ #undef HAVE_FREEBSD_CDROM @@ -49,7 +49,7 @@ #undef HAVE_ICONV /* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 +#undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_IOKIT_IOKITLIB_H @@ -92,7 +92,7 @@ #define HAVE_MEMSET 1 /* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF +#define HAVE_SNPRINTF 1 /* Define 1 if you have Solaris CD-ROM support */ #undef HAVE_SOLARIS_CDROM @@ -119,7 +119,7 @@ #undef HAVE_SYS_CDIO_H /* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H +#define HAVE_SYS_STAT_H 1 /* Define to 1 if you have the header file. */ #define HAVE_SYS_TYPES_H 1 @@ -140,11 +140,18 @@ #undef HAVE_VCDINFO /* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF +#define HAVE_VSNPRINTF 1 /* Define 1 if you have MinGW CD-ROM support */ #define HAVE_WIN32_CDROM 1 +/* Define 1 if you have Windows SDK */ +#define HAVE_WINDOWS_H 1 + +/* Windows SDK includes seek64 */ +#define HAVE_LSEEK64 1 +#define _FILE_OFFSET_BITS 64 + /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST diff --git a/MSVC/libcdio.vcxproj b/MSVC/libcdio.vcxproj index 98338bad..8ec37803 100644 --- a/MSVC/libcdio.vcxproj +++ b/MSVC/libcdio.vcxproj @@ -75,7 +75,7 @@ Disabled - ..\MSVC;..\include;..\lib\driver;..\lib\driver\MSWindows;..\lib\driver\mmc;..\lib\driver\image;..\lib\driver\FreeBSD;..\lib\iso9660;..\lib\udf;%(AdditionalIncludeDirectories) + ..\include\cdio\msvc;..\MSVC;..\include;..\lib\driver;..\lib\driver\MSWindows;..\lib\driver\mmc;..\lib\driver\image;..\lib\driver\FreeBSD;..\lib\iso9660;..\lib\udf;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;HAVE_WINDOWS_H;%(PreprocessorDefinitions) true EnableFastChecks @@ -91,7 +91,7 @@ Disabled - ..\MSVC;..\include;..\lib\driver;..\lib\driver\MSWindows;..\lib\driver\mmc;..\lib\driver\image;..\lib\driver\FreeBSD;..\lib\iso9660;..\lib\udf;%(AdditionalIncludeDirectories) + ..\include\cdio\msvc;..\MSVC;..\include;..\lib\driver;..\lib\driver\MSWindows;..\lib\driver\mmc;..\lib\driver\image;..\lib\driver\FreeBSD;..\lib\iso9660;..\lib\udf;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_CONSOLE;HAVE_CONFIG_H;HAVE_WINDOWS_H;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -106,7 +106,7 @@ - ..\MSVC;..\include;..\lib\driver;..\lib\driver\MSWindows;..\lib\driver\mmc;..\lib\driver\image;..\lib\driver\FreeBSD;..\lib\iso9660;..\lib\udf;%(AdditionalIncludeDirectories) + ..\include\cdio\msvc;..\MSVC;..\include;..\lib\driver;..\lib\driver\MSWindows;..\lib\driver\mmc;..\lib\driver\image;..\lib\driver\FreeBSD;..\lib\iso9660;..\lib\udf;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;HAVE_WINDOWS_H;%(PreprocessorDefinitions) MultiThreaded @@ -116,7 +116,7 @@ - ..\MSVC;..\include;..\lib\driver;..\lib\driver\MSWindows;..\lib\driver\mmc;..\lib\driver\image;..\lib\driver\FreeBSD;..\lib\iso9660;..\lib\udf;%(AdditionalIncludeDirectories) + ..\include\cdio\msvc;..\MSVC;..\include;..\lib\driver;..\lib\driver\MSWindows;..\lib\driver\mmc;..\lib\driver\image;..\lib\driver\FreeBSD;..\lib\iso9660;..\lib\udf;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;HAVE_CONFIG_H;%(PreprocessorDefinitions) MultiThreaded @@ -169,6 +169,7 @@ + diff --git a/MSVC/libcdio.vcxproj.filters b/MSVC/libcdio.vcxproj.filters index b5987b80..4138bdbd 100644 --- a/MSVC/libcdio.vcxproj.filters +++ b/MSVC/libcdio.vcxproj.filters @@ -145,9 +145,6 @@ Source Files\driver - - Source Files\driver - Source Files\driver @@ -190,6 +187,9 @@ Source Files\driver\MSWindows + + Source Files\driver\image + @@ -363,5 +363,8 @@ Include Files\cdio\msvc + + Include Files\cdio\msvc + \ No newline at end of file diff --git a/include/cdio/msvc/unistd.h b/include/cdio/msvc/unistd.h new file mode 100644 index 00000000..0ab611a4 --- /dev/null +++ b/include/cdio/msvc/unistd.h @@ -0,0 +1,30 @@ +/* -*- c -*- + Copyright (C) Natalia Portillo + + 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 + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#if defined (_MSC_VER) || defined (_XBOX) +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#ifndef _WINDOWS_H_ +#include +#endif + +typedef SSIZE_T ssize_t; +typedef unsigned int mode_t; + +#endif +#endif \ No newline at end of file diff --git a/include/cdio/msvc/version.h b/include/cdio/msvc/version.h index bc21f1e4..ca9914c7 100644 --- a/include/cdio/msvc/version.h +++ b/include/cdio/msvc/version.h @@ -8,13 +8,13 @@ /*! CDIO_VERSION is a C-Preprocessor macro of a string that shows what version is used. cdio_version_string has the same value, but it is a constant variable that can be accessed at run time. */ -#define CDIO_VERSION "@VERSION@ @build@" +#define CDIO_VERSION "0.90 pc-windows-visualstudio" extern const char *cdio_version_string; /**< = CDIO_VERSION */ /*! LIBCDIO_VERSION_NUM is a C-Preprocessor macro that can be used for testing in the C preprocessor. libcdio_version_num has the same value, but it is a constant variable that can be accessed at run time. */ -#define LIBCDIO_VERSION_NUM @LIBCDIO_VERSION_NUM@ +#define LIBCDIO_VERSION_NUM 90 extern const unsigned int libcdio_version_num; /**< = LIBCDIO_VERSION_NUM */ diff --git a/lib/driver/MSWindows/win32_ioctl.c b/lib/driver/MSWindows/win32_ioctl.c index 482517c7..030326f5 100755 --- a/lib/driver/MSWindows/win32_ioctl.c +++ b/lib/driver/MSWindows/win32_ioctl.c @@ -1,6 +1,7 @@ /* Copyright (C) 2004, 2005, 2008, 2010, 2011, 2012 Rocky Bernstein + Copyright (C) 2013 Natalia Portillo 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 @@ -26,6 +27,13 @@ #ifdef HAVE_WIN32_CDROM +/* Windows 8 WDK says this is needed for user mode applications */ +#define _NTSCSI_USER_MODE_ 1 + +#ifdef _MSC_VER +# define __PRETTY_FUNCTION__ __FUNCSIG__ +#endif + #if defined (_XBOX) # include "inttypes.h" # include "NtScsi.h" @@ -33,18 +41,11 @@ #else #if defined (__MINGW64__) # define _NTSRB_ /* Bad things happen if srb.h gets included */ -# include -# include -# include -#else -# include -# include #endif -# include -#endif - -#if defined (_WIN32) #include +#include +#include +#include #endif #include @@ -60,6 +61,8 @@ #include #include "cdio/logging.h" +#define snprintf _snprintf; // Windows prepends with underscore. + #if defined (_XBOX) #define windows_error(loglevel,i_err) { \ cdio_log(loglevel, "Error: file %s: line %d (%s) %ld\n", \ @@ -161,6 +164,7 @@ audio_play_msf_win32ioctl (void *p_user_data, msf_t *p_start_msf, const _img_private_t *p_env = p_user_data; CDROM_PLAY_AUDIO_MSF play; DWORD dw_bytes_returned; + BOOL b_success; play.StartingM = cdio_from_bcd8(p_start_msf->m); play.StartingS = cdio_from_bcd8(p_start_msf->s); @@ -170,7 +174,7 @@ audio_play_msf_win32ioctl (void *p_user_data, msf_t *p_start_msf, play.EndingS = cdio_from_bcd8(p_end_msf->s); play.EndingF = cdio_from_bcd8(p_end_msf->f); - bool b_success = + b_success = DeviceIoControl(p_env->h_device_handle, IOCTL_CDROM_PLAY_AUDIO_MSF, &play, sizeof(play), NULL, 0, &dw_bytes_returned, NULL); diff --git a/lib/driver/image/bincue.c b/lib/driver/image/bincue.c index c3aa5749..d237a04a 100644 --- a/lib/driver/image/bincue.c +++ b/lib/driver/image/bincue.c @@ -4,6 +4,7 @@ Copyright (C) 2001 Herbert Valerio Riedel cue parsing routine adapted from cuetools Copyright (C) 2003 Svend Sanjay Sorensen + Copyright (C) 2013 Natalia Portillo 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 @@ -32,7 +33,11 @@ #include #include +#if defined (_MSC_VER) || defined (_XBOX) +#include +#else #include +#endif #ifdef HAVE_STDIO_H #include @@ -66,7 +71,11 @@ #include #include #include +#if defined (_MSC_VER) || defined (_XBOX) +#include +#else #include +#endif #include "image.h" #include "cdio_assert.h" diff --git a/lib/driver/image/cdrdao.c b/lib/driver/image/cdrdao.c index 644d8750..ddbd7899 100644 --- a/lib/driver/image/cdrdao.c +++ b/lib/driver/image/cdrdao.c @@ -3,6 +3,7 @@ Rocky Bernstein toc reading routine adapted from cuetools Copyright (C) 2003 Svend Sanjay Sorensen + Copyright (C) 2013 Natalia Portillo 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 @@ -58,7 +59,11 @@ #include #include #include +#if defined (_MSC_VER) || defined (_XBOX) +#include +#else #include +#endif #include "image.h" #include "cdio_assert.h" diff --git a/lib/driver/image/nrg.c b/lib/driver/image/nrg.c index c36d4aeb..9c07509e 100644 --- a/lib/driver/image/nrg.c +++ b/lib/driver/image/nrg.c @@ -2,6 +2,7 @@ Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2011, 2012 Rocky Bernstein Copyright (C) 2001, 2003 Herbert Valerio Riedel + Copyright (C) 2013 Natalia Portillo 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 @@ -42,7 +43,11 @@ #include #include #include +#if defined (_MSC_VER) || defined (_XBOX) +#include +#else #include +#endif #include "cdio_assert.h" #include "_cdio_stdio.h" #include "nrg.h" diff --git a/lib/driver/util.c b/lib/driver/util.c index bb170792..e638a2b7 100644 --- a/lib/driver/util.c +++ b/lib/driver/util.c @@ -2,6 +2,7 @@ Copyright (C) 2003, 2004, 2005, 2008, 2009, 2010, 2011 Rocky Bernstein Copyright (C) 2000 Herbert Valerio Riedel + Copyright (C) 2013 Natalia Portillo 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 @@ -43,7 +44,11 @@ #include "cdio_assert.h" #include #include +#if defined (_MSC_VER) || defined (_XBOX) +#include +#else #include +#endif size_t _cdio_strlenv(char **str_array)