summaryrefslogtreecommitdiffstats
path: root/third_party/libusb/src/msvc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libusb/src/msvc')
-rw-r--r--third_party/libusb/src/msvc/config.h47
-rw-r--r--third_party/libusb/src/msvc/ddk_build.cmd106
-rw-r--r--third_party/libusb/src/msvc/errno.h102
-rw-r--r--third_party/libusb/src/msvc/libusb.dsw56
-rw-r--r--third_party/libusb/src/msvc/libusb_dll.dsp190
-rw-r--r--third_party/libusb/src/msvc/libusb_sources36
-rw-r--r--third_party/libusb/src/msvc/libusb_static.dsp170
-rw-r--r--third_party/libusb/src/msvc/listdevs.dsp103
-rw-r--r--third_party/libusb/src/msvc/listdevs_sources19
-rw-r--r--third_party/libusb/src/msvc/missing.c80
-rw-r--r--third_party/libusb/src/msvc/missing.h32
11 files changed, 253 insertions, 688 deletions
diff --git a/third_party/libusb/src/msvc/config.h b/third_party/libusb/src/msvc/config.h
index 43aa1f7..da47672 100644
--- a/third_party/libusb/src/msvc/config.h
+++ b/third_party/libusb/src/msvc/config.h
@@ -1,3 +1,19 @@
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
/* config.h. Manual config for MSVC. */
#ifndef _MSC_VER
@@ -5,20 +21,35 @@
#error "Please make sure the msvc/ directory is removed from your build path."
#endif
+/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */
+#pragma warning(disable:4200)
+/* Disable: warning C6258: Using TerminateThread does not allow proper thread clean up */
+#pragma warning(disable: 6258)
+#if defined(_PREFAST_)
+/* Disable "Banned API" errors when using the MS's WDK OACR/Prefast */
+#pragma warning(disable:28719)
+/* Disable "The function 'InitializeCriticalSection' must be called from within a try/except block" */
+#pragma warning(disable:28125)
+#endif
+
/* Default visibility */
#define DEFAULT_VISIBILITY /**/
-/* Debug message logging */
-//#define ENABLE_DEBUG_LOGGING 1
-
-/* Message logging */
+/* Enable global message logging */
#define ENABLE_LOGGING 1
-/* Windows backend */
-#define OS_WINDOWS 1
+/* Uncomment to start with debug message logging enabled */
+// #define ENABLE_DEBUG_LOGGING 1
/* type of second poll() argument */
#define POLL_NFDS_TYPE unsigned int
-/* no way to run git describe from MSVC? */
-#define LIBUSB_DESCRIBE ""
+/* Windows/WinCE backend */
+#if defined(_WIN32_WCE)
+#define OS_WINCE 1
+#define HAVE_MISSING_H
+#else
+#define OS_WINDOWS 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_SYS_TYPES_H 1
+#endif
diff --git a/third_party/libusb/src/msvc/ddk_build.cmd b/third_party/libusb/src/msvc/ddk_build.cmd
deleted file mode 100644
index ed9b8a8..0000000
--- a/third_party/libusb/src/msvc/ddk_build.cmd
+++ /dev/null
@@ -1,106 +0,0 @@
-@rem default builds static library.
-@rem you can pass the following arguments (case insensitive):
-@rem - "DLL" to build a DLL instead of a static library
-@rem - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
-@echo off
-
-if Test%BUILD_ALT_DIR%==Test goto usage
-
-rem process commandline parameters
-set TARGET=LIBRARY
-set STATIC_LIBC=
-set version=1.0
-
-if "%1" == "" goto no_more_args
-rem /I for case insensitive
-if /I Test%1==TestDLL set TARGET=DYNLINK
-if /I Test%1==Test/MT set STATIC_LIBC=1
-:no_more_args
-
-cd ..\libusb\os
-echo TARGETTYPE=%TARGET% > target
-copy target+..\..\msvc\libusb_sources sources >NUL 2>&1
-del target
-@echo on
-build -cwgZ
-@echo off
-if errorlevel 1 goto builderror
-cd ..\..
-
-set cpudir=i386
-set destType=Win32
-if %_BUILDARCH%==x86 goto isI386
-set cpudir=amd64
-set destType=x64
-:isI386
-
-set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir%
-
-set dstPath=%destType%\Debug
-if %DDKBUILDENV%==chk goto isDebug
-set dstPath=%destType%\Release
-:isDebug
-
-if exist %destType% goto md2
-mkdir %destType%
-:md2
-if exist %dstPath% goto md3
-mkdir %dstPath%
-:md3
-if exist %dstPath%\dll goto md4
-mkdir %dstPath%\dll
-:md4
-if exist %dstPath%\lib goto md5
-md %dstPath%\lib
-:md5
-if exist %dstPath%\examples goto md6
-md %dstPath%\examples
-:md6
-@echo on
-
-@if /I NOT Test%1==TestDLL goto copylib
-copy %srcPath%\libusb-%version%.dll %dstPath%\dll
-copy %srcPath%\libusb-%version%.pdb %dstPath%\dll
-:copylib
-copy %srcPath%\libusb-%version%.lib %dstPath%\lib
-
-@echo off
-
-if exist examples\listdevs_ddkbuild goto md7
-md examples\listdevs_ddkbuild
-:md7
-
-cd examples\listdevs_ddkbuild
-copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
-@echo on
-build -cwgZ
-@echo off
-if errorlevel 1 goto buildlistdevserror
-cd ..\..
-
-set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
-@echo on
-
-copy %srcPath%\listdevs.exe %dstPath%\examples
-copy %srcPath%\listdevs.pdb %dstPath%\examples
-
-cd msvc
-goto done
-
-
-:builderror
-cd ..\..\msvc
-echo Build failed
-goto done
-
-:buildlistdevserror
-cd ..\..\msvc
-echo listdevs build failed
-goto done
-
-:usage
-echo ddk_build must be run in a WDK build environment
-pause
-goto done
-
-:done
diff --git a/third_party/libusb/src/msvc/errno.h b/third_party/libusb/src/msvc/errno.h
new file mode 100644
index 0000000..07d15e3
--- /dev/null
+++ b/third_party/libusb/src/msvc/errno.h
@@ -0,0 +1,102 @@
+/*
+ * errno.h
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is a part of the mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within the package.
+ *
+ * Error numbers and access to error reporting.
+ *
+ */
+
+#ifndef _ERRNO_H_
+#define _ERRNO_H_
+
+#include <crtdefs.h>
+
+/*
+ * Error numbers.
+ * TODO: Can't be sure of some of these assignments, I guessed from the
+ * names given by strerror and the defines in the Cygnus errno.h. A lot
+ * of the names from the Cygnus errno.h are not represented, and a few
+ * of the descriptions returned by strerror do not obviously match
+ * their error naming.
+ */
+#define EPERM 1 /* Operation not permitted */
+#define ENOFILE 2 /* No such file or directory */
+#define ENOENT 2
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted function call */
+#define EIO 5 /* Input/output error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file descriptor */
+#define ECHILD 10 /* No child processes */
+#define EAGAIN 11 /* Resource temporarily unavailable */
+#define ENOMEM 12 /* Not enough space */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+/* 15 - Unknown Error */
+#define EBUSY 16 /* strerror reports "Resource device" */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Improper link (cross-device link?) */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* Too many open files in system */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Inappropriate I/O control operation */
+/* 26 - Unknown Error */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */
+#define EROFS 30 /* Read-only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Domain error (math functions) */
+#define ERANGE 34 /* Result too large (possibly too small) */
+/* 35 - Unknown Error */
+#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */
+#define EDEADLK 36
+#if 0
+/* 37 - Unknown Error */
+#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */
+#define ENOLCK 39 /* No locks available (46 in Cyg?) */
+#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */
+#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */
+#define EILSEQ 42 /* Illegal byte sequence */
+#endif
+
+/*
+ * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the
+ * sockets.h header provided with windows32api-0.1.2.
+ * You should go and put an #if 0 ... #endif around the whole block
+ * of errors (look at the comment above them).
+ */
+
+#ifndef RC_INVOKED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see
+ * stdlib.h.
+ */
+#if defined(_UWIN) || defined(_WIN32_WCE)
+#undef errno
+extern int errno;
+#else
+_CRTIMP int* __cdecl _errno(void);
+#define errno (*_errno())
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* Not RC_INVOKED */
+
+#endif /* Not _ERRNO_H_ */ \ No newline at end of file
diff --git a/third_party/libusb/src/msvc/libusb.dsw b/third_party/libusb/src/msvc/libusb.dsw
deleted file mode 100644
index fbe3015..0000000
--- a/third_party/libusb/src/msvc/libusb.dsw
+++ /dev/null
@@ -1,56 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "libusb_dll"=".\libusb_dll.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "libusb_static"=".\libusb_static.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "listdevs"=".\listdevs.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libusb_static
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/third_party/libusb/src/msvc/libusb_dll.dsp b/third_party/libusb/src/msvc/libusb_dll.dsp
deleted file mode 100644
index bad8d15..0000000
--- a/third_party/libusb/src/msvc/libusb_dll.dsp
+++ /dev/null
@@ -1,190 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libusb_dll" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libusb_dll - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libusb_dll.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libusb_dll.mak" CFG="libusb_dll - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libusb_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libusb_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libusb_dll - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Win32/Release/dll"
-# PROP Intermediate_Dir "../Win32/Release/dll"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Win32/Release/dll/libusb-1.0.dll"
-
-!ELSEIF "$(CFG)" == "libusb_dll - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Win32/Debug/dll"
-# PROP Intermediate_Dir "../Win32/Debug/dll"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "LIBUSB_DLL_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_USRDLL" /FR /FD /EHsc /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /n
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Win32/Debug/dll/libusb-1.0.dll"
-# SUBTRACT LINK32 /pdb:none /incremental:no
-
-!ENDIF
-
-# Begin Target
-
-# Name "libusb_dll - Win32 Release"
-# Name "libusb_dll - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\libusb\core.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\darwin_usb.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\descriptor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\io.c
-# End Source File
-# Begin Source File
-
-SOURCE="..\libusb\libusb-1.0.rc"
-# End Source File
-# Begin Source File
-
-SOURCE="..\libusb\libusb-1.0.def"
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\linux_usbfs.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_windows.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\sync.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_windows.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_usb.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\darwin_usb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\libusb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\libusbi.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\linux_usbfs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_posix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_windows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_posix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_windows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_usb.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/third_party/libusb/src/msvc/libusb_sources b/third_party/libusb/src/msvc/libusb_sources
deleted file mode 100644
index 8e8e65c..0000000
--- a/third_party/libusb/src/msvc/libusb_sources
+++ /dev/null
@@ -1,36 +0,0 @@
-#TARGETTYPE is not defined, to allow selection between static lib or DLL with ddk_build
-TARGETNAME=libusb-1.0
-DLLDEF=..\libusb-1.0.def
-
-!IFNDEF MSC_WARNING_LEVEL
-MSC_WARNING_LEVEL=/W3
-!ENDIF
-
-!IFDEF STATIC_LIBC
-USE_LIBCMT=1
-!ELSE
-USE_MSVCRT=1
-!ENDIF
-
-INCLUDES=..;..\..\msvc;$(DDK_INC_PATH)
-C_DEFINES= $(C_DEFINES) $(LIBUSB_DEFINES) /DDDKBUILD
-
-# http://jpassing.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/
-# prevents the following error when using the 64 bit static lib with Visual Studio 2010:
-# "fatal error C1001: An internal error has occurred in the compiler.
-# (compiler file 'f:\dd\vctools\compiler\utc\src\p2\p2symtab.c', line 1823)"
-# and the following with Visual Studio 2010:
-# "fatal error C1047: The object or library file 'libusb-1.0.lib' was created with
-# an older compiler than other objects; rebuild old objects and libraries"
-USER_C_FLAGS=/GL-
-
-TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib
-
-SOURCES=..\core.c \
- ..\descriptor.c \
- ..\io.c \
- ..\sync.c \
- threads_windows.c \
- poll_windows.c \
- windows_usb.c \
- ..\libusb-1.0.rc
diff --git a/third_party/libusb/src/msvc/libusb_static.dsp b/third_party/libusb/src/msvc/libusb_static.dsp
deleted file mode 100644
index b636691..0000000
--- a/third_party/libusb/src/msvc/libusb_static.dsp
+++ /dev/null
@@ -1,170 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libusb_static" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=libusb_static - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libusb_static.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libusb_static.mak" CFG="libusb_static - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libusb_static - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "libusb_static - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libusb_static - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Win32/Release/lib"
-# PROP Intermediate_Dir "../Win32/Release/lib"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "../libusb" /D "WIN32" /D "NDEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /EHsc /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../Win32/Release/lib/libusb-1.0.lib"
-
-!ELSEIF "$(CFG)" == "libusb_static - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Win32/Debug/lib"
-# PROP Intermediate_Dir "../Win32/Debug/lib"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "../libusb" /D "WIN32" /D "_DEBUG" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /D "_LIB" /FR /FD /GZ /EHsc /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /n
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../Win32/Debug/lib/libusb-1.0.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "libusb_static - Win32 Release"
-# Name "libusb_static - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\libusb\core.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\darwin_usb.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\descriptor.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\io.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\linux_usbfs.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_windows.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\sync.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_windows.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_usb.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\config.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\darwin_usb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\libusb.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\libusbi.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\linux_usbfs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_posix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\poll_windows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_posix.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\threads_windows.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\libusb\os\windows_usb.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/third_party/libusb/src/msvc/listdevs.dsp b/third_party/libusb/src/msvc/listdevs.dsp
deleted file mode 100644
index 93a93e4..0000000
--- a/third_party/libusb/src/msvc/listdevs.dsp
+++ /dev/null
@@ -1,103 +0,0 @@
-# Microsoft Developer Studio Project File - Name="listdevs" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=listdevs - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "listdevs.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "listdevs.mak" CFG="listdevs - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "listdevs - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "listdevs - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "listdevs - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "../Win32/Release/examples"
-# PROP Intermediate_Dir "../Win32/Release/examples/listdevs"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "../libusb" /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /EHsc /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "listdevs - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "../Win32/Debug/examples"
-# PROP Intermediate_Dir "../Win32/Debug/examples/listdevs"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../libusb" /I "." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /U "_MBCS" /FR /FD /GZ /EHsc /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo /n "../Win32/Debug/dll/core.sbr" "../Win32/Debug/dll/descriptor.sbr" "../Win32/Debug/dll/io.sbr" "../Win32/Debug/dll/sync.sbr" "../Win32/Debug/dll/poll_windows.sbr" "../Win32/Debug/dll/threads_windows.sbr" "../Win32/Debug/dll/windows_usb.sbr"
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib shell32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "listdevs - Win32 Release"
-# Name "listdevs - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\examples\listdevs.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/third_party/libusb/src/msvc/listdevs_sources b/third_party/libusb/src/msvc/listdevs_sources
deleted file mode 100644
index 97a5723..0000000
--- a/third_party/libusb/src/msvc/listdevs_sources
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGETNAME=listdevs
-TARGETTYPE=PROGRAM
-386_STDCALL=0
-
-_NT_TARGET_VERSION= $(_NT_TARGET_VERSION_WINXP)
-!IFNDEF MSC_WARNING_LEVEL
-MSC_WARNING_LEVEL=/W3
-!ENDIF
-
-!IFDEF STATIC_LIBC
-USE_LIBCMT=1
-!ELSE
-USE_MSVCRT=1
-!ENDIF
-
-UMTYPE=console
-INCLUDES=..\..\libusb;$(DDK_INC_PATH)
-UMLIBS=..\..\libusb\os\obj$(BUILD_ALT_DIR)\*\libusb-1.0.lib
-SOURCES=..\listdevs.c
diff --git a/third_party/libusb/src/msvc/missing.c b/third_party/libusb/src/msvc/missing.c
new file mode 100644
index 0000000..85d9d6f
--- /dev/null
+++ b/third_party/libusb/src/msvc/missing.c
@@ -0,0 +1,80 @@
+/*
+ * Source file for missing WinCE functionality
+ * Copyright © 2012 RealVNC Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "missing.h"
+
+#include <config.h>
+#include <libusbi.h>
+
+#include <windows.h>
+
+// The registry path to store environment variables
+#define ENVIRONMENT_REG_PATH _T("Software\\libusb\\environment")
+
+/* Workaround getenv not being available on WinCE.
+ * Instead look in HKLM\Software\libusb\environment */
+char *getenv(const char *name)
+{
+ static char value[MAX_PATH];
+ TCHAR wValue[MAX_PATH];
+ WCHAR wName[MAX_PATH];
+ DWORD dwType, dwData;
+ HKEY hkey;
+ LONG rc;
+
+ if (!name)
+ return NULL;
+
+ if (MultiByteToWideChar(CP_UTF8, 0, name, -1, wName, MAX_PATH) <= 0) {
+ usbi_dbg("Failed to convert environment variable name to wide string");
+ return NULL;
+ }
+ wName[MAX_PATH - 1] = 0; // Be sure it's NUL terminated
+
+ rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ENVIRONMENT_REG_PATH, 0, KEY_QUERY_VALUE, &hkey);
+ if (rc != ERROR_SUCCESS) {
+ usbi_dbg("Failed to open registry key for getenv with error %d", rc);
+ return NULL;
+ }
+
+ // Attempt to read the key
+ dwData = sizeof(wValue);
+ rc = RegQueryValueEx(hkey, wName, NULL, &dwType,
+ (LPBYTE)&wValue, &dwData);
+ RegCloseKey(hkey);
+ if (rc != ERROR_SUCCESS) {
+ usbi_dbg("Failed to read registry key value for getenv with error %d", rc);
+ return NULL;
+ }
+ if (dwType != REG_SZ) {
+ usbi_dbg("Registry value was of type %d instead of REG_SZ", dwType);
+ return NULL;
+ }
+
+ // Success in reading the key, convert from WCHAR to char
+ if (WideCharToMultiByte(CP_UTF8, 0,
+ wValue, dwData / sizeof(*wValue),
+ value, MAX_PATH,
+ NULL, NULL) <= 0) {
+ usbi_dbg("Failed to convert environment variable value to narrow string");
+ return NULL;
+ }
+ value[MAX_PATH - 1] = 0; // Be sure it's NUL terminated
+ return value;
+}
diff --git a/third_party/libusb/src/msvc/missing.h b/third_party/libusb/src/msvc/missing.h
new file mode 100644
index 0000000..183b9d3
--- /dev/null
+++ b/third_party/libusb/src/msvc/missing.h
@@ -0,0 +1,32 @@
+/*
+ * Header file for missing WinCE functionality
+ * Copyright © 2012-2013 RealVNC Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef MISSING_H
+#define MISSING_H
+
+/* Windows CE doesn't have SleepEx() - Fallback to Sleep() */
+#define SleepEx(m, a) Sleep(m)
+
+/* Windows CE doesn't have any APIs to query environment variables.
+ *
+ * This contains a registry based implementation of getenv.
+ */
+char *getenv(const char *name);
+
+#endif