From 5883f09acee11766ef96f8ec4c7e95019a1628c3 Mon Sep 17 00:00:00 2001 From: Maurus Cuelenaere Date: Thu, 19 Feb 2009 18:36:57 +0000 Subject: MTP_DLL: * update license to BSD * clean some comments * add README file git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20049 a1c6a512-1295-4272-9138-f99709370657 --- utils/MTP/MTP_DLL/MTP_DLL.cpp | 41 ++++++++++++----------- utils/MTP/MTP_DLL/MTP_DLL.h | 25 +++++--------- utils/MTP/MTP_DLL/MTP_DLL.sln | 20 ------------ utils/MTP/MTP_DLL/README | 67 ++++++++++++++++++++++++++++++++++++++ utils/MTP/MTP_DLL/sendfirm_win.cpp | 29 +++++++++++++++-- utils/MTP/MTP_DLL/stdafx.cpp | 13 +++----- utils/MTP/MTP_DLL/stdafx.h | 54 +++++++++++++----------------- 7 files changed, 150 insertions(+), 99 deletions(-) delete mode 100644 utils/MTP/MTP_DLL/MTP_DLL.sln create mode 100755 utils/MTP/MTP_DLL/README diff --git a/utils/MTP/MTP_DLL/MTP_DLL.cpp b/utils/MTP/MTP_DLL/MTP_DLL.cpp index ffd314a697..73085afaee 100644 --- a/utils/MTP/MTP_DLL/MTP_DLL.cpp +++ b/utils/MTP/MTP_DLL/MTP_DLL.cpp @@ -1,22 +1,21 @@ -// MTP_DLL.cpp : Defines the entry point for the DLL application. -// - -#include "stdafx.h" -#include "MTP_DLL.h" - - -#ifdef _MANAGED -#pragma managed(push, off) -#endif - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - return TRUE; -} - -#ifdef _MANAGED -#pragma managed(pop) +/* MTP_DLL.cpp : Defines the entry point for the DLL application. */ + +#include "stdafx.h" +#include "MTP_DLL.h" + + +#ifdef _MANAGED +#pragma managed(push, off) +#endif + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + return TRUE; +} + +#ifdef _MANAGED +#pragma managed(pop) #endif \ No newline at end of file diff --git a/utils/MTP/MTP_DLL/MTP_DLL.h b/utils/MTP/MTP_DLL/MTP_DLL.h index ad99014bc2..eeee72a87b 100644 --- a/utils/MTP/MTP_DLL/MTP_DLL.h +++ b/utils/MTP/MTP_DLL/MTP_DLL.h @@ -1,17 +1,10 @@ -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the MTP_DLL_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// MTP_DLL_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. -#ifdef MTP_DLL_EXPORTS -#define MTP_DLL_API __declspec(dllexport) -#else -#define MTP_DLL_API __declspec(dllimport) -#endif - -extern "C" -{ -__declspec(dllexport) bool send_fw(LPWSTR file, int filesize, void (*callback)(unsigned int progress, unsigned int max)); -} +#ifdef MTP_DLL_EXPORTS +#define MTP_DLL_API __declspec(dllexport) +#else +#define MTP_DLL_API __declspec(dllimport) +#endif +extern "C" +{ + __declspec(dllexport) bool send_fw(LPWSTR file, int filesize, void (*callback)(unsigned int progress, unsigned int max)); +} diff --git a/utils/MTP/MTP_DLL/MTP_DLL.sln b/utils/MTP/MTP_DLL/MTP_DLL.sln deleted file mode 100644 index bcd56174f5..0000000000 --- a/utils/MTP/MTP_DLL/MTP_DLL.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MTP_DLL", "MTP_DLL.vcproj", "{C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}.Debug|Win32.ActiveCfg = Debug|Win32 - {C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}.Debug|Win32.Build.0 = Debug|Win32 - {C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}.Release|Win32.ActiveCfg = Release|Win32 - {C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/utils/MTP/MTP_DLL/README b/utils/MTP/MTP_DLL/README new file mode 100755 index 0000000000..b256aae304 --- /dev/null +++ b/utils/MTP/MTP_DLL/README @@ -0,0 +1,67 @@ +Windows MTP Firmware Uploading Implementation +============================================= + +This code is based on http://opensource.creative.com/mtp_xfer.html and was +edited by Maurus Cuelenaere for the Rockbox project. + +It is released under the BSD license: + + Copyright (c) 2009, Maurus Cuelenaere + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY MAURUS CUELENAERE ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL MAURUS CUELENAERE BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +Based on these mails from devsupport AT creativelabs DOT com, the original code +is believed to be in the Public Domain: + + +From: CLI Developer Support +Sender: Ian Minett +Date: Wed, 18 Feb 2009 17:34:14 -0800 +>Hi, +> +>The code found at http://connect.creativelabs.com/opensource/ is open +>and made freely available on the connect site for use by developers +>such as yourself. You are welcome to use the code as you like. +> +>If you need to know the specific license it is released under, I'm afraid +> I will have to chase it up since I don't believe that site is being +> maintained anymore. +> +>Hope that helps, +>Ian + + +From: CLI Developer Support +Sender: Daniel PEACOCK +Date: Thu, 19 Feb 2009 14:08:39 +0000 +>Hi, +> +>The MTP transfer example code is free to use for any purpose - commercial or otherwise. +>You can include it, or a variant of it, in your open-source project. +> +>Thanks for asking, +> +>Dan +>Creative Labs, UK \ No newline at end of file diff --git a/utils/MTP/MTP_DLL/sendfirm_win.cpp b/utils/MTP/MTP_DLL/sendfirm_win.cpp index 0861b345b0..6f9cf24e93 100644 --- a/utils/MTP/MTP_DLL/sendfirm_win.cpp +++ b/utils/MTP/MTP_DLL/sendfirm_win.cpp @@ -1,8 +1,33 @@ -/* Windows MTP Firmware Uploading Implementation +/* + * Windows MTP Firmware Uploading Implementation * * Based on http://opensource.creative.com/mtp_xfer.html - * * Edited by Maurus Cuelenaere for Rockbox + * + * Copyright (c) 2009, Maurus Cuelenaere + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY MAURUS CUELENAERE ''AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL MAURUS CUELENAERE BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include diff --git a/utils/MTP/MTP_DLL/stdafx.cpp b/utils/MTP/MTP_DLL/stdafx.cpp index 68ee952ff4..c603f4f2c7 100644 --- a/utils/MTP/MTP_DLL/stdafx.cpp +++ b/utils/MTP/MTP_DLL/stdafx.cpp @@ -1,8 +1,5 @@ -// stdafx.cpp : source file that includes just the standard includes -// MTP_DLL.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file +/* stdafx.cpp : source file that includes just the standard includes + MTP_DLL.pch will be the pre-compiled header + stdafx.obj will contain the pre-compiled type information */ + +#include "stdafx.h" diff --git a/utils/MTP/MTP_DLL/stdafx.h b/utils/MTP/MTP_DLL/stdafx.h index 1734058361..dc8d61f531 100644 --- a/utils/MTP/MTP_DLL/stdafx.h +++ b/utils/MTP/MTP_DLL/stdafx.h @@ -1,32 +1,22 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - - - -// TODO: reference additional headers your program requires here +#pragma once + +/* Modify the following defines if you have to target a platform prior to the ones specified below. + Refer to MSDN for the latest info on corresponding values for different platforms. */ +#ifndef WINVER /* Allow use of features specific to Windows XP or later. */ +#define WINVER 0x0501 /* Change this to the appropriate value to target other versions of Windows. */ +#endif + +#ifndef _WIN32_WINNT /* Allow use of features specific to Windows XP or later. */ +#define _WIN32_WINNT 0x0501 /* Change this to the appropriate value to target other versions of Windows. */ +#endif + +#ifndef _WIN32_WINDOWS /* Allow use of features specific to Windows 98 or later. */ +#define _WIN32_WINDOWS 0x0410 /* Change this to the appropriate value to target Windows Me or later. */ +#endif + +#ifndef _WIN32_IE /* Allow use of features specific to IE 6.0 or later. */ +#define _WIN32_IE 0x0600 /* Change this to the appropriate value to target other versions of IE. */ +#endif + +#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ +#include -- cgit v1.2.3