Imhotheb
6 years ago
5 changed files with 234 additions and 0 deletions
@ -0,0 +1,13 @@ |
|||||
|
Copyright © 2019 RSBasic.de |
||||
|
|
||||
|
The DLL file uses the following library: https://github.com/Bassman2/MediaDevices |
||||
|
|
||||
|
The MIT License (MIT) |
||||
|
|
||||
|
Copyright (c) 2016 - 2019 Ralf Beckers. |
||||
|
|
||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
||||
|
|
||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
||||
|
|
||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
@ -0,0 +1,136 @@ |
|||||
|
EnableExplicit |
||||
|
|
||||
|
Global PBEx_MTP |
||||
|
|
||||
|
#PBEx_MTP_Type_File = 1 |
||||
|
#PBEx_MTP_Type_Directory = 2 |
||||
|
#PBEx_MTP_DeviceType_Generic = 0 |
||||
|
#PBEx_MTP_DeviceType_Camera = 1 |
||||
|
#PBEx_MTP_DeviceType_MediaPlayer = 2 |
||||
|
#PBEx_MTP_DeviceType_Phone = 3 |
||||
|
#PBEx_MTP_DeviceType_Video = 4 |
||||
|
#PBEx_MTP_DeviceType_PersonalInformationManager = 5 |
||||
|
#PBEx_MTP_DeviceType_AudioRecorder = 6 |
||||
|
|
||||
|
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86 |
||||
|
PBEx_MTP = OpenLibrary(#PB_Any, "PB.Ex_MTP_x86.dll") |
||||
|
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64 |
||||
|
PBEx_MTP = OpenLibrary(#PB_Any, "PB.Ex_MTP_x64.dll") |
||||
|
CompilerEndIf |
||||
|
|
||||
|
If PBEx_MTP |
||||
|
Prototype ExamineMTP(ErrorOutput) |
||||
|
Global ExamineMTP.ExamineMTP = GetFunction(PBEx_MTP, "ExamineMTP") |
||||
|
Prototype NextMTPEntry(ErrorOutput) |
||||
|
Global NextMTPEntry.NextMTPEntry = GetFunction(PBEx_MTP, "NextMTPEntry") |
||||
|
Prototype FinishMTP(ErrorOutput) |
||||
|
Global FinishMTP.FinishMTP = GetFunction(PBEx_MTP, "FinishMTP") |
||||
|
Prototype MTPEntryName(Output, ErrorOutput) |
||||
|
Global MTPEntryName.MTPEntryName = GetFunction(PBEx_MTP, "MTPEntryName") |
||||
|
Prototype OpenMTP(ID, DeviceName.p-Unicode, ErrorOutput) |
||||
|
Global OpenMTP.OpenMTP = GetFunction(PBEx_MTP, "OpenMTP") |
||||
|
Prototype CloseMTP(ID, ErrorOutput) |
||||
|
Global CloseMTP.CloseMTP = GetFunction(PBEx_MTP, "CloseMTP") |
||||
|
Prototype IsMTP(ID, ErrorOutput) |
||||
|
Global IsMTP.IsMTP = GetFunction(PBEx_MTP, "IsMTP") |
||||
|
Prototype ExamineMTPDirectory(ID, ErrorOutput) |
||||
|
Global ExamineMTPDirectory.ExamineMTPDirectory = GetFunction(PBEx_MTP, "ExamineMTPDirectory") |
||||
|
Prototype FinishMTPDirectory(ID, ErrorOutput) |
||||
|
Global FinishMTPDirectory.FinishMTPDirectory = GetFunction(PBEx_MTP, "FinishMTPDirectory") |
||||
|
Prototype NextMTPDirectoryEntry(ID, ErrorOutput) |
||||
|
Global NextMTPDirectoryEntry.NextMTPDirectoryEntry = GetFunction(PBEx_MTP, "NextMTPDirectoryEntry") |
||||
|
Prototype MTPDirectoryEntryName(ID, Output, ErrorOutput) |
||||
|
Global MTPDirectoryEntryName.MTPDirectoryEntryName = GetFunction(PBEx_MTP, "MTPDirectoryEntryName") |
||||
|
Prototype SetMTPDirectory(ID, DirectoryPath.p-Unicode, ErrorOutput) |
||||
|
Global SetMTPDirectory.SetMTPDirectory = GetFunction(PBEx_MTP, "SetMTPDirectory") |
||||
|
Prototype GetMTPDirectory(ID, Output, ErrorOutput) |
||||
|
Global GetMTPDirectory.GetMTPDirectory = GetFunction(PBEx_MTP, "GetMTPDirectory") |
||||
|
Prototype MTPDirectoryEntryType(ID, ErrorOutput) |
||||
|
Global MTPDirectoryEntryType.MTPDirectoryEntryType = GetFunction(PBEx_MTP, "MTPDirectoryEntryType") |
||||
|
Prototype ReceiveMTPFile(ID, RemoteFileName.p-Unicode, FileName.p-Unicode, ErrorOutput) |
||||
|
Global ReceiveMTPFile.ReceiveMTPFile = GetFunction(PBEx_MTP, "ReceiveMTPFile") |
||||
|
Prototype MTPDirectoryEntrySize(ID, ErrorOutput) |
||||
|
Global MTPDirectoryEntrySize.MTPDirectoryEntrySize = GetFunction(PBEx_MTP, "MTPDirectoryEntrySize") |
||||
|
Prototype MTPDirectoryEntryDate(ID, ErrorOutput) |
||||
|
Global MTPDirectoryEntryDate.MTPDirectoryEntryDate = GetFunction(PBEx_MTP, "MTPDirectoryEntryDate") |
||||
|
Prototype GetMTPDescription(ID, Output, ErrorOutput) |
||||
|
Global GetMTPDescription.GetMTPDescription = GetFunction(PBEx_MTP, "GetMTPDescription") |
||||
|
Prototype GetMTPDeviceID(ID, Output, ErrorOutput) |
||||
|
Global GetMTPDeviceID.GetMTPDeviceID = GetFunction(PBEx_MTP, "GetMTPDeviceID") |
||||
|
Prototype GetMTPDeviceType(ID, ErrorOutput) |
||||
|
Global GetMTPDeviceType.GetMTPDeviceType = GetFunction(PBEx_MTP, "GetMTPDeviceType") |
||||
|
Prototype GetMTPFirmwareVersion(ID, Output, ErrorOutput) |
||||
|
Global GetMTPFirmwareVersion.GetMTPFirmwareVersion = GetFunction(PBEx_MTP, "GetMTPFirmwareVersion") |
||||
|
Prototype GetMTPFriendlyName(ID, Output, ErrorOutput) |
||||
|
Global GetMTPFriendlyName.GetMTPFriendlyName = GetFunction(PBEx_MTP, "GetMTPFriendlyName") |
||||
|
Prototype GetMTPManufacturer(ID, Output, ErrorOutput) |
||||
|
Global GetMTPManufacturer.GetMTPManufacturer = GetFunction(PBEx_MTP, "GetMTPManufacturer") |
||||
|
Prototype GetMTPModel(ID, Output, ErrorOutput) |
||||
|
Global GetMTPModel.GetMTPModel = GetFunction(PBEx_MTP, "GetMTPModel") |
||||
|
Prototype GetMTPPnPDeviceID(ID, Output, ErrorOutput) |
||||
|
Global GetMTPPnPDeviceID.GetMTPPnPDeviceID = GetFunction(PBEx_MTP, "GetMTPPnPDeviceID") |
||||
|
Prototype GetMTPSerialNumber(ID, Output, ErrorOutput) |
||||
|
Global GetMTPSerialNumber.GetMTPSerialNumber = GetFunction(PBEx_MTP, "GetMTPSerialNumber") |
||||
|
|
||||
|
EndIf |
||||
|
|
||||
|
Global Output$ = Space(1024) |
||||
|
Global ErrorOutput$ = Space(128) |
||||
|
|
||||
|
;List all devices to determine the device name. |
||||
|
; If ExamineMTP(@ErrorOutput$) |
||||
|
; While NextMTPEntry(@ErrorOutput$) |
||||
|
; MTPEntryName(@Output$, @ErrorOutput$) |
||||
|
; Debug Output$ |
||||
|
; Wend |
||||
|
; EndIf |
||||
|
|
||||
|
;List all directories and files. |
||||
|
;If OpenMTP(1, "Canon IXUS 125 HS", @ErrorOutput$) |
||||
|
If OpenMTP(1, "Apple iPhone", @ErrorOutput$) |
||||
|
|
||||
|
;Get device information |
||||
|
GetMTPFriendlyName(1, @Output$, @ErrorOutput$) |
||||
|
Debug "Friendly name: " + Output$ |
||||
|
GetMTPManufacturer(1, @Output$, @ErrorOutput$) |
||||
|
Debug "Manufacturer: " + Output$ |
||||
|
GetMTPFirmwareVersion(1, @Output$, @ErrorOutput$) |
||||
|
Debug "Firmware version: " + Output$ |
||||
|
GetMTPPnPDeviceID(1, @Output$, @ErrorOutput$) |
||||
|
Debug "PnPDeviceID: " + Output$ |
||||
|
|
||||
|
Debug "--------------------------------------------------" |
||||
|
|
||||
|
;SetMTPDirectory(1, "\Internal Storage\DCIM\100APPLE", @ErrorOutput$) |
||||
|
If ExamineMTPDirectory(1, @ErrorOutput$) |
||||
|
While NextMTPDirectoryEntry(1, @ErrorOutput$) |
||||
|
MTPDirectoryEntryName(1, @Output$, @ErrorOutput$) |
||||
|
If MTPDirectoryEntryType(1, @ErrorOutput$) = #PBEx_MTP_Type_Directory |
||||
|
Debug "Folder: " + Output$ |
||||
|
ElseIf MTPDirectoryEntryType(1, @ErrorOutput$) = #PBEx_MTP_Type_File |
||||
|
Debug "File: " + Output$ |
||||
|
Debug Str(MTPDirectoryEntrySize(1, @ErrorOutput$)) + " Bytes" |
||||
|
Debug FormatDate("%dd.%mm.%yyyy %hh:%ii:%ss", MTPDirectoryEntryDate(1, @ErrorOutput$)) |
||||
|
|
||||
|
EndIf |
||||
|
|
||||
|
Wend |
||||
|
EndIf |
||||
|
|
||||
|
CloseMTP(1, @ErrorOutput$) |
||||
|
Else |
||||
|
Debug ErrorOutput$ |
||||
|
EndIf |
||||
|
|
||||
|
CloseLibrary(PBEx_MTP) |
||||
|
|
||||
|
; IDE Options = PureBasic 5.70 LTS (Windows - x64) |
||||
|
; CursorPosition = 45 |
||||
|
; FirstLine = 21 |
||||
|
; EnableXP |
||||
|
; EnableUser |
||||
|
; Executable = PB.Ex_MSSQL.exe |
||||
|
; CompileSourceDirectory |
||||
|
; EnableCompileCount = 898 |
||||
|
; EnableBuildCount = 7 |
||||
|
; EnableUnicode |
@ -0,0 +1,85 @@ |
|||||
|
EnableExplicit |
||||
|
|
||||
|
Global PBEx_MTP |
||||
|
|
||||
|
#PBEx_MTP_Type_File = 1 |
||||
|
#PBEx_MTP_Type_Directory = 2 |
||||
|
#PBEx_MTP_DeviceType_Generic = 0 |
||||
|
#PBEx_MTP_DeviceType_Camera = 1 |
||||
|
#PBEx_MTP_DeviceType_MediaPlayer = 2 |
||||
|
#PBEx_MTP_DeviceType_Phone = 3 |
||||
|
#PBEx_MTP_DeviceType_Video = 4 |
||||
|
#PBEx_MTP_DeviceType_PersonalInformationManager = 5 |
||||
|
#PBEx_MTP_DeviceType_AudioRecorder = 6 |
||||
|
|
||||
|
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86 |
||||
|
PBEx_MTP = OpenLibrary(#PB_Any, "PB.Ex_MTP_x86.dll") |
||||
|
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64 |
||||
|
PBEx_MTP = OpenLibrary(#PB_Any, "PB.Ex_MTP_x64.dll") |
||||
|
CompilerEndIf |
||||
|
|
||||
|
If PBEx_MTP |
||||
|
Prototype ExamineMTP(ErrorOutput) |
||||
|
Global ExamineMTP.ExamineMTP = GetFunction(PBEx_MTP, "ExamineMTP") |
||||
|
Prototype NextMTPEntry(ErrorOutput) |
||||
|
Global NextMTPEntry.NextMTPEntry = GetFunction(PBEx_MTP, "NextMTPEntry") |
||||
|
Prototype FinishMTP(ErrorOutput) |
||||
|
Global FinishMTP.FinishMTP = GetFunction(PBEx_MTP, "FinishMTP") |
||||
|
Prototype MTPEntryName(Output, ErrorOutput) |
||||
|
Global MTPEntryName.MTPEntryName = GetFunction(PBEx_MTP, "MTPEntryName") |
||||
|
Prototype OpenMTP(ID, DeviceName.p-Unicode, ErrorOutput) |
||||
|
Global OpenMTP.OpenMTP = GetFunction(PBEx_MTP, "OpenMTP") |
||||
|
Prototype CloseMTP(ID, ErrorOutput) |
||||
|
Global CloseMTP.CloseMTP = GetFunction(PBEx_MTP, "CloseMTP") |
||||
|
Prototype IsMTP(ID, ErrorOutput) |
||||
|
Global IsMTP.IsMTP = GetFunction(PBEx_MTP, "IsMTP") |
||||
|
Prototype ExamineMTPDirectory(ID, ErrorOutput) |
||||
|
Global ExamineMTPDirectory.ExamineMTPDirectory = GetFunction(PBEx_MTP, "ExamineMTPDirectory") |
||||
|
Prototype FinishMTPDirectory(ID, ErrorOutput) |
||||
|
Global FinishMTPDirectory.FinishMTPDirectory = GetFunction(PBEx_MTP, "FinishMTPDirectory") |
||||
|
Prototype NextMTPDirectoryEntry(ID, ErrorOutput) |
||||
|
Global NextMTPDirectoryEntry.NextMTPDirectoryEntry = GetFunction(PBEx_MTP, "NextMTPDirectoryEntry") |
||||
|
Prototype MTPDirectoryEntryName(ID, Output, ErrorOutput) |
||||
|
Global MTPDirectoryEntryName.MTPDirectoryEntryName = GetFunction(PBEx_MTP, "MTPDirectoryEntryName") |
||||
|
Prototype SetMTPDirectory(ID, DirectoryPath.p-Unicode, ErrorOutput) |
||||
|
Global SetMTPDirectory.SetMTPDirectory = GetFunction(PBEx_MTP, "SetMTPDirectory") |
||||
|
Prototype GetMTPDirectory(ID, Output, ErrorOutput) |
||||
|
Global GetMTPDirectory.GetMTPDirectory = GetFunction(PBEx_MTP, "GetMTPDirectory") |
||||
|
Prototype MTPDirectoryEntryType(ID, ErrorOutput) |
||||
|
Global MTPDirectoryEntryType.MTPDirectoryEntryType = GetFunction(PBEx_MTP, "MTPDirectoryEntryType") |
||||
|
Prototype ReceiveMTPFile(ID, RemoteFileName.p-Unicode, FileName.p-Unicode, ErrorOutput) |
||||
|
Global ReceiveMTPFile.ReceiveMTPFile = GetFunction(PBEx_MTP, "ReceiveMTPFile") |
||||
|
Prototype MTPDirectoryEntrySize(ID, ErrorOutput) |
||||
|
Global MTPDirectoryEntrySize.MTPDirectoryEntrySize = GetFunction(PBEx_MTP, "MTPDirectoryEntrySize") |
||||
|
Prototype MTPDirectoryEntryDate(ID, ErrorOutput) |
||||
|
Global MTPDirectoryEntryDate.MTPDirectoryEntryDate = GetFunction(PBEx_MTP, "MTPDirectoryEntryDate") |
||||
|
Prototype GetMTPDescription(ID, Output, ErrorOutput) |
||||
|
Global GetMTPDescription.GetMTPDescription = GetFunction(PBEx_MTP, "GetMTPDescription") |
||||
|
Prototype GetMTPDeviceID(ID, Output, ErrorOutput) |
||||
|
Global GetMTPDeviceID.GetMTPDeviceID = GetFunction(PBEx_MTP, "GetMTPDeviceID") |
||||
|
Prototype GetMTPDeviceType(ID, ErrorOutput) |
||||
|
Global GetMTPDeviceType.GetMTPDeviceType = GetFunction(PBEx_MTP, "GetMTPDeviceType") |
||||
|
Prototype GetMTPFirmwareVersion(ID, Output, ErrorOutput) |
||||
|
Global GetMTPFirmwareVersion.GetMTPFirmwareVersion = GetFunction(PBEx_MTP, "GetMTPFirmwareVersion") |
||||
|
Prototype GetMTPFriendlyName(ID, Output, ErrorOutput) |
||||
|
Global GetMTPFriendlyName.GetMTPFriendlyName = GetFunction(PBEx_MTP, "GetMTPFriendlyName") |
||||
|
Prototype GetMTPManufacturer(ID, Output, ErrorOutput) |
||||
|
Global GetMTPManufacturer.GetMTPManufacturer = GetFunction(PBEx_MTP, "GetMTPManufacturer") |
||||
|
Prototype GetMTPModel(ID, Output, ErrorOutput) |
||||
|
Global GetMTPModel.GetMTPModel = GetFunction(PBEx_MTP, "GetMTPModel") |
||||
|
Prototype GetMTPPnPDeviceID(ID, Output, ErrorOutput) |
||||
|
Global GetMTPPnPDeviceID.GetMTPPnPDeviceID = GetFunction(PBEx_MTP, "GetMTPPnPDeviceID") |
||||
|
Prototype GetMTPSerialNumber(ID, Output, ErrorOutput) |
||||
|
Global GetMTPSerialNumber.GetMTPSerialNumber = GetFunction(PBEx_MTP, "GetMTPSerialNumber") |
||||
|
|
||||
|
EndIf |
||||
|
; IDE Options = PureBasic 5.70 LTS (Windows - x64) |
||||
|
; CursorPosition = 74 |
||||
|
; FirstLine = 14 |
||||
|
; EnableXP |
||||
|
; EnableUser |
||||
|
; Executable = PB.Ex_MSSQL.exe |
||||
|
; CompileSourceDirectory |
||||
|
; EnableCompileCount = 450 |
||||
|
; EnableBuildCount = 7 |
||||
|
; EnableUnicode |
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue