diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-03 22:01:37 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-07-03 22:01:37 +0000 |
commit | b42a51bf6425539793326cfec4a1f4219b0be8ff (patch) | |
tree | c3ab56a15e7baaaac63bf93b19bbf560c1a6aa1b /utils/MTP | |
parent | b1e57c8c8e9108a485079ce445cd338c91cf05ae (diff) | |
download | rockbox-b42a51bf6425539793326cfec4a1f4219b0be8ff.tar.gz rockbox-b42a51bf6425539793326cfec4a1f4219b0be8ff.zip |
Add sendfirm Windows version, currently in the form of a DLL so it could
be easy integrated into programs (will require VS2005 to compile)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17932 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/MTP')
-rw-r--r-- | utils/MTP/MTP_DLL/MTP_DLL.cpp | 22 | ||||
-rwxr-xr-x | utils/MTP/MTP_DLL/MTP_DLL.dll | bin | 0 -> 90112 bytes | |||
-rw-r--r-- | utils/MTP/MTP_DLL/MTP_DLL.h | 11 | ||||
-rw-r--r-- | utils/MTP/MTP_DLL/MTP_DLL.sln | 20 | ||||
-rw-r--r-- | utils/MTP/MTP_DLL/MTP_DLL.vcproj | 251 | ||||
-rw-r--r-- | utils/MTP/MTP_DLL/sendfirm_win.cpp | 189 | ||||
-rw-r--r-- | utils/MTP/MTP_DLL/stdafx.cpp | 8 | ||||
-rw-r--r-- | utils/MTP/MTP_DLL/stdafx.h | 32 |
8 files changed, 533 insertions, 0 deletions
diff --git a/utils/MTP/MTP_DLL/MTP_DLL.cpp b/utils/MTP/MTP_DLL/MTP_DLL.cpp new file mode 100644 index 0000000000..8d8e2502c9 --- /dev/null +++ b/utils/MTP/MTP_DLL/MTP_DLL.cpp | |||
@@ -0,0 +1,22 @@ | |||
1 | // MTP_DLL.cpp : Defines the entry point for the DLL application. | ||
2 | // | ||
3 | |||
4 | #include "stdafx.h" | ||
5 | #include "MTP_DLL.h" | ||
6 | |||
7 | |||
8 | #ifdef _MANAGED | ||
9 | #pragma managed(push, off) | ||
10 | #endif | ||
11 | |||
12 | BOOL APIENTRY DllMain( HMODULE hModule, | ||
13 | DWORD ul_reason_for_call, | ||
14 | LPVOID lpReserved | ||
15 | ) | ||
16 | { | ||
17 | return TRUE; | ||
18 | } | ||
19 | |||
20 | #ifdef _MANAGED | ||
21 | #pragma managed(pop) | ||
22 | #endif \ No newline at end of file | ||
diff --git a/utils/MTP/MTP_DLL/MTP_DLL.dll b/utils/MTP/MTP_DLL/MTP_DLL.dll new file mode 100755 index 0000000000..01e7c1f72d --- /dev/null +++ b/utils/MTP/MTP_DLL/MTP_DLL.dll | |||
Binary files differ | |||
diff --git a/utils/MTP/MTP_DLL/MTP_DLL.h b/utils/MTP/MTP_DLL/MTP_DLL.h new file mode 100644 index 0000000000..a2d7c76fdb --- /dev/null +++ b/utils/MTP/MTP_DLL/MTP_DLL.h | |||
@@ -0,0 +1,11 @@ | |||
1 | // The following ifdef block is the standard way of creating macros which make exporting | ||
2 | // from a DLL simpler. All files within this DLL are compiled with the MTP_DLL_EXPORTS | ||
3 | // symbol defined on the command line. this symbol should not be defined on any project | ||
4 | // that uses this DLL. This way any other project whose source files include this file see | ||
5 | // MTP_DLL_API functions as being imported from a DLL, whereas this DLL sees symbols | ||
6 | // defined with this macro as being exported. | ||
7 | #ifdef MTP_DLL_EXPORTS | ||
8 | #define MTP_DLL_API __declspec(dllexport) | ||
9 | #else | ||
10 | #define MTP_DLL_API __declspec(dllimport) | ||
11 | #endif | ||
diff --git a/utils/MTP/MTP_DLL/MTP_DLL.sln b/utils/MTP/MTP_DLL/MTP_DLL.sln new file mode 100644 index 0000000000..bcd56174f5 --- /dev/null +++ b/utils/MTP/MTP_DLL/MTP_DLL.sln | |||
@@ -0,0 +1,20 @@ | |||
1 | | ||
2 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||
3 | # Visual Studio 2005 | ||
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MTP_DLL", "MTP_DLL.vcproj", "{C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}" | ||
5 | EndProject | ||
6 | Global | ||
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
8 | Debug|Win32 = Debug|Win32 | ||
9 | Release|Win32 = Release|Win32 | ||
10 | EndGlobalSection | ||
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
12 | {C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}.Debug|Win32.ActiveCfg = Debug|Win32 | ||
13 | {C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}.Debug|Win32.Build.0 = Debug|Win32 | ||
14 | {C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}.Release|Win32.ActiveCfg = Release|Win32 | ||
15 | {C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}.Release|Win32.Build.0 = Release|Win32 | ||
16 | EndGlobalSection | ||
17 | GlobalSection(SolutionProperties) = preSolution | ||
18 | HideSolutionNode = FALSE | ||
19 | EndGlobalSection | ||
20 | EndGlobal | ||
diff --git a/utils/MTP/MTP_DLL/MTP_DLL.vcproj b/utils/MTP/MTP_DLL/MTP_DLL.vcproj new file mode 100644 index 0000000000..d7234bb610 --- /dev/null +++ b/utils/MTP/MTP_DLL/MTP_DLL.vcproj | |||
@@ -0,0 +1,251 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | ||
2 | <VisualStudioProject | ||
3 | ProjectType="Visual C++" | ||
4 | Version="8,00" | ||
5 | Name="MTP_DLL" | ||
6 | ProjectGUID="{C7A39A2D-2ADF-40A3-A9A5-0DF4509B761B}" | ||
7 | RootNamespace="MTP_DLL" | ||
8 | Keyword="Win32Proj" | ||
9 | > | ||
10 | <Platforms> | ||
11 | <Platform | ||
12 | Name="Win32" | ||
13 | /> | ||
14 | </Platforms> | ||
15 | <ToolFiles> | ||
16 | </ToolFiles> | ||
17 | <Configurations> | ||
18 | <Configuration | ||
19 | Name="Debug|Win32" | ||
20 | OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||
21 | IntermediateDirectory="$(ConfigurationName)" | ||
22 | ConfigurationType="2" | ||
23 | CharacterSet="1" | ||
24 | > | ||
25 | <Tool | ||
26 | Name="VCPreBuildEventTool" | ||
27 | /> | ||
28 | <Tool | ||
29 | Name="VCCustomBuildTool" | ||
30 | /> | ||
31 | <Tool | ||
32 | Name="VCXMLDataGeneratorTool" | ||
33 | /> | ||
34 | <Tool | ||
35 | Name="VCWebServiceProxyGeneratorTool" | ||
36 | /> | ||
37 | <Tool | ||
38 | Name="VCMIDLTool" | ||
39 | /> | ||
40 | <Tool | ||
41 | Name="VCCLCompilerTool" | ||
42 | Optimization="0" | ||
43 | AdditionalIncludeDirectories="d:\wmsdk\wmfsdk95\include;d:\wmsdk\wmfsdk95\wmdm\inc" | ||
44 | PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MTP_DLL_EXPORTS" | ||
45 | MinimalRebuild="true" | ||
46 | BasicRuntimeChecks="3" | ||
47 | RuntimeLibrary="3" | ||
48 | UsePrecompiledHeader="2" | ||
49 | WarningLevel="3" | ||
50 | Detect64BitPortabilityProblems="true" | ||
51 | DebugInformationFormat="4" | ||
52 | /> | ||
53 | <Tool | ||
54 | Name="VCManagedResourceCompilerTool" | ||
55 | /> | ||
56 | <Tool | ||
57 | Name="VCResourceCompilerTool" | ||
58 | /> | ||
59 | <Tool | ||
60 | Name="VCPreLinkEventTool" | ||
61 | /> | ||
62 | <Tool | ||
63 | Name="VCLinkerTool" | ||
64 | AdditionalDependencies="mssachlp.lib" | ||
65 | LinkIncremental="2" | ||
66 | AdditionalLibraryDirectories="d:\wmsdk\wmfsdk95\lib,d:\wmsdk\wmfsdk95\wmdm\lib" | ||
67 | GenerateDebugInformation="true" | ||
68 | SubSystem="2" | ||
69 | TargetMachine="1" | ||
70 | /> | ||
71 | <Tool | ||
72 | Name="VCALinkTool" | ||
73 | /> | ||
74 | <Tool | ||
75 | Name="VCManifestTool" | ||
76 | /> | ||
77 | <Tool | ||
78 | Name="VCXDCMakeTool" | ||
79 | /> | ||
80 | <Tool | ||
81 | Name="VCBscMakeTool" | ||
82 | /> | ||
83 | <Tool | ||
84 | Name="VCFxCopTool" | ||
85 | /> | ||
86 | <Tool | ||
87 | Name="VCAppVerifierTool" | ||
88 | /> | ||
89 | <Tool | ||
90 | Name="VCWebDeploymentTool" | ||
91 | /> | ||
92 | <Tool | ||
93 | Name="VCPostBuildEventTool" | ||
94 | /> | ||
95 | </Configuration> | ||
96 | <Configuration | ||
97 | Name="Release|Win32" | ||
98 | OutputDirectory="$(SolutionDir)$(ConfigurationName)" | ||
99 | IntermediateDirectory="$(ConfigurationName)" | ||
100 | ConfigurationType="2" | ||
101 | CharacterSet="1" | ||
102 | WholeProgramOptimization="1" | ||
103 | > | ||
104 | <Tool | ||
105 | Name="VCPreBuildEventTool" | ||
106 | /> | ||
107 | <Tool | ||
108 | Name="VCCustomBuildTool" | ||
109 | /> | ||
110 | <Tool | ||
111 | Name="VCXMLDataGeneratorTool" | ||
112 | /> | ||
113 | <Tool | ||
114 | Name="VCWebServiceProxyGeneratorTool" | ||
115 | /> | ||
116 | <Tool | ||
117 | Name="VCMIDLTool" | ||
118 | /> | ||
119 | <Tool | ||
120 | Name="VCCLCompilerTool" | ||
121 | AdditionalIncludeDirectories="d:\wmsdk\wmfsdk95\include;d:\wmsdk\wmfsdk95\wmdm\inc" | ||
122 | PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MTP_DLL_EXPORTS" | ||
123 | RuntimeLibrary="2" | ||
124 | UsePrecompiledHeader="2" | ||
125 | WarningLevel="3" | ||
126 | Detect64BitPortabilityProblems="true" | ||
127 | DebugInformationFormat="3" | ||
128 | /> | ||
129 | <Tool | ||
130 | Name="VCManagedResourceCompilerTool" | ||
131 | /> | ||
132 | <Tool | ||
133 | Name="VCResourceCompilerTool" | ||
134 | /> | ||
135 | <Tool | ||
136 | Name="VCPreLinkEventTool" | ||
137 | /> | ||
138 | <Tool | ||
139 | Name="VCLinkerTool" | ||
140 | AdditionalDependencies="mssachlp.lib" | ||
141 | LinkIncremental="1" | ||
142 | AdditionalLibraryDirectories="d:\wmsdk\wmfsdk95\lib,d:\wmsdk\wmfsdk95\wmdm\lib" | ||
143 | GenerateDebugInformation="true" | ||
144 | SubSystem="2" | ||
145 | OptimizeReferences="2" | ||
146 | EnableCOMDATFolding="2" | ||
147 | TargetMachine="1" | ||
148 | /> | ||
149 | <Tool | ||
150 | Name="VCALinkTool" | ||
151 | /> | ||
152 | <Tool | ||
153 | Name="VCManifestTool" | ||
154 | /> | ||
155 | <Tool | ||
156 | Name="VCXDCMakeTool" | ||
157 | /> | ||
158 | <Tool | ||
159 | Name="VCBscMakeTool" | ||
160 | /> | ||
161 | <Tool | ||
162 | Name="VCFxCopTool" | ||
163 | /> | ||
164 | <Tool | ||
165 | Name="VCAppVerifierTool" | ||
166 | /> | ||
167 | <Tool | ||
168 | Name="VCWebDeploymentTool" | ||
169 | /> | ||
170 | <Tool | ||
171 | Name="VCPostBuildEventTool" | ||
172 | /> | ||
173 | </Configuration> | ||
174 | </Configurations> | ||
175 | <References> | ||
176 | </References> | ||
177 | <Files> | ||
178 | <Filter | ||
179 | Name="Source Files" | ||
180 | Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||
181 | UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | ||
182 | > | ||
183 | <File | ||
184 | RelativePath=".\MTP_DLL.cpp" | ||
185 | > | ||
186 | </File> | ||
187 | <File | ||
188 | RelativePath=".\sendfirm_win.cpp" | ||
189 | > | ||
190 | <FileConfiguration | ||
191 | Name="Debug|Win32" | ||
192 | > | ||
193 | <Tool | ||
194 | Name="VCCLCompilerTool" | ||
195 | UsePrecompiledHeader="0" | ||
196 | /> | ||
197 | </FileConfiguration> | ||
198 | <FileConfiguration | ||
199 | Name="Release|Win32" | ||
200 | > | ||
201 | <Tool | ||
202 | Name="VCCLCompilerTool" | ||
203 | UsePrecompiledHeader="0" | ||
204 | /> | ||
205 | </FileConfiguration> | ||
206 | </File> | ||
207 | <File | ||
208 | RelativePath=".\stdafx.cpp" | ||
209 | > | ||
210 | <FileConfiguration | ||
211 | Name="Debug|Win32" | ||
212 | > | ||
213 | <Tool | ||
214 | Name="VCCLCompilerTool" | ||
215 | UsePrecompiledHeader="1" | ||
216 | /> | ||
217 | </FileConfiguration> | ||
218 | <FileConfiguration | ||
219 | Name="Release|Win32" | ||
220 | > | ||
221 | <Tool | ||
222 | Name="VCCLCompilerTool" | ||
223 | UsePrecompiledHeader="1" | ||
224 | /> | ||
225 | </FileConfiguration> | ||
226 | </File> | ||
227 | </Filter> | ||
228 | <Filter | ||
229 | Name="Header Files" | ||
230 | Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||
231 | UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | ||
232 | > | ||
233 | <File | ||
234 | RelativePath=".\MTP_DLL.h" | ||
235 | > | ||
236 | </File> | ||
237 | <File | ||
238 | RelativePath=".\stdafx.h" | ||
239 | > | ||
240 | </File> | ||
241 | </Filter> | ||
242 | <Filter | ||
243 | Name="Resource Files" | ||
244 | Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||
245 | UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||
246 | > | ||
247 | </Filter> | ||
248 | </Files> | ||
249 | <Globals> | ||
250 | </Globals> | ||
251 | </VisualStudioProject> | ||
diff --git a/utils/MTP/MTP_DLL/sendfirm_win.cpp b/utils/MTP/MTP_DLL/sendfirm_win.cpp new file mode 100644 index 0000000000..12c3e3e88b --- /dev/null +++ b/utils/MTP/MTP_DLL/sendfirm_win.cpp | |||
@@ -0,0 +1,189 @@ | |||
1 | /* Windows MTP Firmware Uploading Implementation | ||
2 | * | ||
3 | * Based on http://opensource.creative.com/mtp_xfer.html | ||
4 | * | ||
5 | * Edited by Maurus Cuelenaere for Rockbox | ||
6 | */ | ||
7 | |||
8 | #include <windows.h> | ||
9 | #include "mswmdm_i.c" | ||
10 | #include "mswmdm.h" | ||
11 | #include "sac.h" | ||
12 | #include "scclient.h" | ||
13 | |||
14 | /* | ||
15 | * Compilation requirements: | ||
16 | * | ||
17 | * Download the Windows Media Format 9.5 SDK | ||
18 | * Add "c:\wmsdk\wmfsdk95\include,c:\wmsdk\wmfsdk95\wmdm\inc" to your inclusion path | ||
19 | * Add "c:\wmsdk\wmfsdk95\lib,c:\wmsdk\wmfsdk95\wmdm\lib" to your library inclusion path | ||
20 | * Link to "mssachlp.lib" | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | __declspec(dllexport) bool send_fw(LPWSTR file, int filesize) | ||
25 | { | ||
26 | bool return_value = false; | ||
27 | HRESULT hr; | ||
28 | IComponentAuthenticate* pICompAuth; | ||
29 | CSecureChannelClient *m_pSacClient = new CSecureChannelClient; | ||
30 | IWMDeviceManager3* m_pIdvMgr = NULL; | ||
31 | |||
32 | /* these are generic keys */ | ||
33 | BYTE abPVK[] = {0x00}; | ||
34 | BYTE abCert[] = {0x00}; | ||
35 | |||
36 | CoInitialize(NULL); | ||
37 | |||
38 | /* get an authentication interface */ | ||
39 | hr = CoCreateInstance(CLSID_MediaDevMgr, NULL, CLSCTX_ALL ,IID_IComponentAuthenticate, (void **)&pICompAuth); | ||
40 | if SUCCEEDED(hr) | ||
41 | { | ||
42 | /* create a secure channel client certificate */ | ||
43 | hr = m_pSacClient->SetCertificate(SAC_CERT_V1, (BYTE*) abCert, sizeof(abCert), (BYTE*) abPVK, sizeof(abPVK)); | ||
44 | if SUCCEEDED(hr) | ||
45 | { | ||
46 | /* bind the authentication interface to the secure channel client */ | ||
47 | m_pSacClient->SetInterface(pICompAuth); | ||
48 | |||
49 | /* trigger communication */ | ||
50 | hr = m_pSacClient->Authenticate(SAC_PROTOCOL_V1); | ||
51 | if SUCCEEDED(hr) | ||
52 | { | ||
53 | /* get main interface to media device manager */ | ||
54 | hr = pICompAuth->QueryInterface(IID_IWMDeviceManager2, (void**)&m_pIdvMgr); | ||
55 | if SUCCEEDED(hr) | ||
56 | { | ||
57 | /* enumerate devices... */ | ||
58 | IWMDMEnumDevice *pIEnumDev; | ||
59 | hr = m_pIdvMgr->EnumDevices2(&pIEnumDev); | ||
60 | if SUCCEEDED(hr) | ||
61 | { | ||
62 | hr = pIEnumDev->Reset(); /* Next will now return the first device */ | ||
63 | if SUCCEEDED(hr) | ||
64 | { | ||
65 | IWMDMDevice3* pIDevice; | ||
66 | unsigned long ulNumFetched; | ||
67 | hr = pIEnumDev->Next(1, (IWMDMDevice **)&pIDevice, &ulNumFetched); | ||
68 | while (SUCCEEDED(hr) && (hr != S_FALSE)) | ||
69 | { | ||
70 | #if 0 | ||
71 | /* output device name */ | ||
72 | wchar_t pwsString[256]; | ||
73 | hr = pIDevice->GetName(pwsString, 256); | ||
74 | if SUCCEEDED(hr) | ||
75 | wprintf(L"Found device %s\n", pwsString); | ||
76 | #endif | ||
77 | |||
78 | /* get storage info */ | ||
79 | DWORD tempDW; | ||
80 | pIDevice->GetType(&tempDW); | ||
81 | if (tempDW & WMDM_DEVICE_TYPE_STORAGE) | ||
82 | { | ||
83 | IWMDMEnumStorage *pIEnumStorage = NULL; | ||
84 | IWMDMStorage *pIStorage = NULL; | ||
85 | IWMDMStorage3 *pIFileStorage = NULL; | ||
86 | hr = pIDevice->EnumStorage(&pIEnumStorage); | ||
87 | if SUCCEEDED(hr) | ||
88 | { | ||
89 | pIEnumStorage->Reset(); | ||
90 | hr = pIEnumStorage->Next(1, (IWMDMStorage **)&pIStorage, &ulNumFetched); | ||
91 | while (SUCCEEDED(hr) && (hr != S_FALSE)) | ||
92 | { | ||
93 | IWMDMStorage3 *pNewStorage; | ||
94 | hr = pIStorage->QueryInterface(IID_IWMDMStorage3, (void **)&pNewStorage); | ||
95 | if SUCCEEDED(hr) | ||
96 | { | ||
97 | IWMDMStorageControl3 *pIWMDMStorageControl; | ||
98 | hr = pNewStorage->QueryInterface(IID_IWMDMStorageControl3, | ||
99 | (void**)&pIWMDMStorageControl); | ||
100 | if SUCCEEDED(hr) | ||
101 | { | ||
102 | IWMDMMetaData *pIWMDMMetaData = NULL; | ||
103 | hr = pNewStorage->CreateEmptyMetadataObject(&pIWMDMMetaData); | ||
104 | if (SUCCEEDED(hr)) | ||
105 | { | ||
106 | DWORD dw = WMDM_FORMATCODE_UNDEFINEDFIRMWARE; | ||
107 | hr = pIWMDMMetaData->AddItem(WMDM_TYPE_DWORD, g_wszWMDMFormatCode, (BYTE *)&dw, sizeof(dw)); | ||
108 | hr = pIWMDMMetaData->AddItem(WMDM_TYPE_STRING, g_wszWMDMFileName, (BYTE *)L"nk.bin", 32); | ||
109 | DWORD ow[2]; | ||
110 | ow[0] = filesize; | ||
111 | ow[1] = 0; | ||
112 | hr = pIWMDMMetaData->AddItem(WMDM_TYPE_QWORD, g_wszWMDMFileSize, (BYTE *)ow, 2 * sizeof(dw)); | ||
113 | if (SUCCEEDED(hr)) | ||
114 | { | ||
115 | IWMDMStorage *pNewObject = NULL; | ||
116 | |||
117 | hr = pIWMDMStorageControl->Insert3( | ||
118 | WMDM_MODE_BLOCK | WMDM_CONTENT_FILE, | ||
119 | 0, | ||
120 | file, | ||
121 | NULL, | ||
122 | NULL, | ||
123 | NULL, | ||
124 | pIWMDMMetaData, | ||
125 | NULL, | ||
126 | (IWMDMStorage **)&pNewObject); | ||
127 | |||
128 | if(SUCCEEDED(hr) || hr == WMDM_S_NOT_ALL_PROPERTIES_APPLIED | ||
129 | || hr == WMDM_S_NOT_ALL_PROPERTIES_RETRIEVED) | ||
130 | return_value = true; | ||
131 | } | ||
132 | } | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | /* move to next Storage */ | ||
137 | if(!return_value) | ||
138 | hr = pIEnumStorage->Next(1, (IWMDMStorage **)&pIStorage, &ulNumFetched); | ||
139 | } | ||
140 | pIEnumStorage->Release(); | ||
141 | } | ||
142 | |||
143 | /* move to next device */ | ||
144 | if(!return_value) | ||
145 | hr = pIEnumDev->Next(1, (IWMDMDevice **)&pIDevice, &ulNumFetched); | ||
146 | } | ||
147 | pIEnumDev->Release(); | ||
148 | } | ||
149 | m_pIdvMgr->Release(); | ||
150 | } | ||
151 | pICompAuth->Release(); | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | } | ||
156 | |||
157 | CoUninitialize(); | ||
158 | |||
159 | return return_value; | ||
160 | } | ||
161 | |||
162 | /* | ||
163 | * Example code: | ||
164 | |||
165 | #include <windows.h> | ||
166 | int filesize(char* filename) | ||
167 | { | ||
168 | FILE* fd; | ||
169 | int tmp; | ||
170 | fopen_s(&fd, filename, "r"); | ||
171 | fseek(fd, 0, SEEK_END); | ||
172 | tmp = ftell(fd); | ||
173 | fclose(fd); | ||
174 | return tmp; | ||
175 | } | ||
176 | |||
177 | __declspec(dllimport) bool send_fw(LPWSTR file, int filesize); | ||
178 | |||
179 | int _tmain(int argc, char* argv[]) | ||
180 | { | ||
181 | printf("Sending %s [%d]...\n", "Zlant.bin", filesize("Zlant.bin")); | ||
182 | if(send_fw(L"Zlant.bin", filesize("Zlant.bin"))) | ||
183 | printf("Transmitting succesfull!\n"); | ||
184 | else | ||
185 | printf("Transmitting failed!\n"); | ||
186 | return 0; | ||
187 | } | ||
188 | |||
189 | */ | ||
diff --git a/utils/MTP/MTP_DLL/stdafx.cpp b/utils/MTP/MTP_DLL/stdafx.cpp new file mode 100644 index 0000000000..68ee952ff4 --- /dev/null +++ b/utils/MTP/MTP_DLL/stdafx.cpp | |||
@@ -0,0 +1,8 @@ | |||
1 | // stdafx.cpp : source file that includes just the standard includes | ||
2 | // MTP_DLL.pch will be the pre-compiled header | ||
3 | // stdafx.obj will contain the pre-compiled type information | ||
4 | |||
5 | #include "stdafx.h" | ||
6 | |||
7 | // TODO: reference any additional headers you need in STDAFX.H | ||
8 | // and not in this file | ||
diff --git a/utils/MTP/MTP_DLL/stdafx.h b/utils/MTP/MTP_DLL/stdafx.h new file mode 100644 index 0000000000..a13982c634 --- /dev/null +++ b/utils/MTP/MTP_DLL/stdafx.h | |||
@@ -0,0 +1,32 @@ | |||
1 | // stdafx.h : include file for standard system include files, | ||
2 | // or project specific include files that are used frequently, but | ||
3 | // are changed infrequently | ||
4 | // | ||
5 | |||
6 | #pragma once | ||
7 | |||
8 | // Modify the following defines if you have to target a platform prior to the ones specified below. | ||
9 | // Refer to MSDN for the latest info on corresponding values for different platforms. | ||
10 | #ifndef WINVER // Allow use of features specific to Windows XP or later. | ||
11 | #define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. | ||
12 | #endif | ||
13 | |||
14 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. | ||
15 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. | ||
16 | #endif | ||
17 | |||
18 | #ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. | ||
19 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. | ||
20 | #endif | ||
21 | |||
22 | #ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. | ||
23 | #define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. | ||
24 | #endif | ||
25 | |||
26 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers | ||
27 | // Windows Header Files: | ||
28 | #include <windows.h> | ||
29 | |||
30 | |||
31 | |||
32 | // TODO: reference additional headers your program requires here | ||