You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 2714591 on 2015/10/02 by Ben.Marsh
Initial branch of files from Engine-Main (//UE4/Engine-Main) to Dev-Platform (//UE4/Dev-Platform)
Change 2916715 on 2016/03/21 by Daniel.Lamb
First pass at splitting out build cook run into into seperate scripts.
Change 2948322 on 2016/04/19 by Nick.Shin
update libwebsockets to v1.7.4
part 4 of 4 - doing this in stages for tracking purposes
#jira UEPLAT-1246 - Update libWebsockets
#jira UEPLAT-1221 - update websocket library
#jira UEPLAT-1204 - Rebuild libwebsockets with SSL
Change 2970016 on 2016/05/07 by Nick.Shin
undo all of the following upgrades:
- zlib
- openssl
- libcurl
- libwebsockets
and reset webrtc
#jira UE-30298 - Fortnite and Orion crash on login
Change 3059693 on 2016/07/21 by Josh.Adams
Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
Change 3061151 on 2016/07/22 by Niklas.Smedberg
Fast ASTC texture compression, using ISPC.
#jira UE-32308
Change 3061428 on 2016/07/22 by Peter.Sauerbrei
Back out changelist 3061151 as it wasn't approved for submission
Change 3061970 on 2016/07/22 by Steve.Cano
Adding AdMob interstitital ad support for Android, including Blueprint functions
#jira UE-33286
#ue4
#android
Change 3062160 on 2016/07/22 by Mark.Satterthwaite
Fix the fix for handling RHISetStreamSource overriding stride on Metal - not all MTLVertexDescriptors are equally hashable so do this ourselves.
#jira UE-33355
Change 3062770 on 2016/07/24 by Brent.Pease
UE-32397 Error Message displays as Unknown Error when failing to supply a Remote Build server for ios on Windows
Change 3063227 on 2016/07/25 by Dmitry.Rekman
Update hlslcc cross-compile after libc++ change.
Change 3063314 on 2016/07/25 by Jeff.Campeau
Xbox One DLL loading
Receipts can be read back by request for target info
Change 3063329 on 2016/07/25 by Mark.Satterthwaite
CL #3046743 was breaking other samples in unexpected ways after a recent Main merge, so make a Metal-specific change to the shader instead and amend the MetalBackend to better match HLSL's handling of NaN/inf with common single-precision float intrinsics. This is sufficient to fix the AtmosphericFog and the recent regressions.
#jira UE-33600
#jira UE-33028
#jira UE-27879
#jira UE-25802
Change 3063492 on 2016/07/25 by Brent.Pease
UE-23846 - iOS Movie Player can't handle videos at resolutions that aren't multiples of 16
UE-33200 - A movie isn't played on iOS occasionally.
Change 3063729 on 2016/07/25 by Dmitry.Rekman
Linux: enable XGE on all platforms.
#tests Cross-compiled a number of Linux targets on Windows.
Change 3063732 on 2016/07/25 by Dmitry.Rekman
Fixed formatting (spaces->tabs) in previous change.
Change 3063750 on 2016/07/25 by Daniel.Lamb
Added code to dump the cook modification delegate loads to log.
Fixed the memory usage output log.
#test cook paragon.
Change 3063804 on 2016/07/25 by Daniel.Lamb
Added cookpartialgc additional commandline option to uat.
#test UFE
Change 3064008 on 2016/07/25 by Mark.Satterthwaite
For non-shipping builds conditionally bind a default uniform buffer in Metal and report an error if the slot was unbound, if our validation layer is enabled attempt to report the shader source in question. This relies on the shader compiler providing accurate information about uniform buffer bindings and won't fix all occurances of bad uniform usage (if a buffer is bound but too short the result will be GPU restarts or an error in Apple's validation layer - we can't detect this case) but will help debug the typical error of leaving an active slot unbound.
#jira FORT-27685
Change 3064141 on 2016/07/25 by Jeff.Campeau
Rebuild vpxmd.lib with delayed codegen disabled (fixes linker warning building Win64).
Change 3065024 on 2016/07/26 by Nick.Shin
Change filetype
remove exclusive check out bit
requested by or.coheni & nick.penwarden
Change 3065274 on 2016/07/26 by Jonathan.Fitzpatrick
DirectoriesToAlwaysStageAsUFS now properly filters out *.uasset and *.umap files
This prevents the bug where cooked assets get trampled by staging their uncooked version on top of them during the UFS step
Added a file filter to DirectoriesToAlwaysStageAsUFS for uasset and umap.
Change 3066338 on 2016/07/27 by Mark.Satterthwaite
Handle releasing an SRV/UAV & the source object within a single Metal command-buffer.
#jira UE-33779
Change 3066789 on 2016/07/27 by Daniel.Lamb
Realtime mode does not save any packages anymore unless they are ready.
#test cookontheside, cookbythebook shooter game
Change 3066847 on 2016/07/27 by Jeff.Campeau
Fix define
#2634
#jira UE-33813
Change 3068868 on 2016/07/28 by Mark.Satterthwaite
Extend hlslcc's handling of switch-statements to allow implict casts from scalar bool, half & float as HLSL itself permits while also making sure it errors if the expression input is not scalar. This fixes shader compile errors in UT.
Change 3070040 on 2016/07/29 by Dmitry.Rekman
Delete Nadzorca.
Change 3070947 on 2016/07/29 by Jeff.Campeau
Perforce C++ API 2015.2 (includes debug libraries)
Change 3073707 on 2016/08/02 by Daniel.Lamb
Derived data cache commandlet runs resolve string asset references to load any string asset refereced packages from the map.
Also process async results from shaders being compiled so they can have their memory resources released.
#test DerivedDataCache commandlet shootergame.
Change 3076613 on 2016/08/03 by Brent.Pease
+ UnrealTargetConfiguration is now passed into deploy and package methods
+ The UIRequiredDeviceCapabilities plist key now only considers the architectures from the corresponding target configuration (shipping or development)
Change 3076668 on 2016/08/03 by Brent.Pease
Back out changelist 3076613
Change 3077157 on 2016/08/04 by Daniel.Lamb
Fixed up DLC staging so that it stages to the proper mount point.
Fixes up include engine content in DLC staging paths.
#test Made up shooter game DLC
Change 3077191 on 2016/08/04 by Daniel.Lamb
More smartly process async shader compilation if we are waiting for it.
#test cook on the side shooter game cook by the book shooter game.
Change 3077412 on 2016/08/04 by Mark.Satterthwaite
Fix "iOS Metal-based build crashes at launch with sub-levels":
- Slate should not bind the null RHI texture from an unitialised texture atlas - atlases only have a valid texture pointer once an entry has been added to them and in the template projects an empty sub-level doesn't add anything.
- To prevent this kind of bug resurfacing and being so hard to track down add Metal shader binding validation to our validation layer as Apple's is incomplete on iOS and won't warn us about nil texture usage which causes these GPU restarts. This requires reworking our vertex declaration handling to be more efficient so that we can cache the pipeline reflection data as well as the pipeline objects.
- Fix validation error of texture reallocation on loading template projects under Metal.
#jira UE-30847
Change 3077958 on 2016/08/04 by Brent.Pease
+ UnrealTargetConfiguration is now passed into deploy and package methods
+ The UIRequiredDeviceCapabilities plist key now only considers the architectures from the corresponding target configuration (shipping or development)
Change 3079503 on 2016/08/05 by Mark.Satterthwaite
Initialise more variable types to 0 in Metal shaders to workaround Xcode 8 toolchain no longer doing this for us for "threadgroup shared" variables. Everything but structs and atomic's will now be initialised.
#jira UE-33856
Change 3079737 on 2016/08/05 by Jeff.Campeau
Add support for delay load DLLs on Xbox One
Turn off warnging for missing PDBs to match VCToolchain.cs
Change 3081005 on 2016/08/08 by Mark.Satterthwaite
Fix-up Metal device name on AMD for macOS 10.12 which reports it correctly and enable tiled reflections on Intel from macOS 10.12 too as they now work.
Change 3081557 on 2016/08/08 by Daniel.Lamb
File-> Package saves all packages before starting packaging.
#test File package first person template
Change 3082215 on 2016/08/09 by Lee.Clark
PS4 - Added 4k profile
Change 3082412 on 2016/08/09 by Daniel.Lamb
Fixed cook on the fly server not handling cook requests.
#test Cook on the fly shooter game.
Change 3082955 on 2016/08/09 by Dmitry.Rekman
Linux: convert existing Strcat() uses to Strncat().
- Strcat() does not check destination size so can silently corrupt memory. While this was not observed, this conversion removes this concern altogether.
Change 3083772 on 2016/08/10 by Luke.Thatcher
[PLATFORM] [PS4] [+]
Checking in PS4CrashHandler files so we have a copy in Perforce rather than just on the server.
- Taken from \\devweb-02 and removed all the unused files/dependencies.
- Created a publish profile pointing to \\devweb-02\Sites\PS4Services\PS4CrashHandlerDev so I'm not writing over the existing deployed crash handler.
- Moved all code in the Page_Load event to inside the check for the HTTP method (POST) otherwise GET'ing the page from a browser will generate crash folders that hang around forever.
Change 3085450 on 2016/08/11 by Lee.Clark
PS4 - Fix mediaplayer pipeline allocation
Change 3086360 on 2016/08/11 by Michael.Trepka
Fixed a non-unity build error in Mac UnrealFrontend
Change 3087224 on 2016/08/12 by Luke.Thatcher
[PLATFORM] [PS4] [~]
Refactor PS4 Crash Handler site
- Removed CoreDumpHandler. Processing dump files is handled directly by an async thread within the aspx process.
- Separated configuration values into their own class. Currently set to output to a testing directory, rather than the actual crash reporter landing zone.
- Added a debug upload page to allow manual submission of .orbisdmp/.txt settings files, accessible by GET'ing Default.aspx.
- Added logging. Logs self-delete after 30 days.
Testing required before we switch to the new system.
#jira UE-34504
#jira OR-26886
Change 3087626 on 2016/08/12 by Dmitry.Rekman
PR #2689: Fix copying/duplicating failing on Linux (UE-34586).
- Contributed by Web-eWorks.
Change 3087991 on 2016/08/12 by Mark.Satterthwaite
Initial AVFoundation implementation of Media Framework for Mac, iOS & tvOS.
- Video playback occurs via AVPlayerItemVideoOutput's attached to the AVPlayerItem's output. This means gathering video samples is trivial.
- Metal texture updates occur by wrapping the texture object provided by AVF - for Mac this is simple as it can bind to the IOSurface directly, for iOS/tvOS we have to create a CVMetalTextureCache and allocate our texture from there.
- OpenGL and OpenGLES currently have to lock the pixel buffer and upload to a texture the old fashioned way - this should be revisited when there is time.
- Subtitles/Captions are captured using AVPlayerItemLegibleOutput which also connects to the AVPlayerItem's output.
- On Mac audio samples are returned by manually reading from the stream using an AVAssetReaderTrackOutput, including manual seeking and synching.
- On iOS/tvOS the audio is played directly by AVPlayer because the IOSAudio system can't handle procedural buffers - otherwise it could reuse the Mac code.
- AVFoundation does not support AVI - that's an obsolete Microsoft/Windows file-format.
- Only 'file://' URLs are supported - streaming would require a totally different audio solution (using MTAudioProcessingTap) and has many more edge and failure cases that would need to be handled.
#jira UE-34315
Change 3088790 on 2016/08/15 by Luke.Thatcher
[PLATFORM] [PS4] [~]
Hook new PS4 crash handler up to the crash reporter website.
- Removed indentation from generated crash context XML file. The crash reporter process does manual XML parsing which doesn't correctly handle whitespace at the start of lines.
- Switched the final output folder to match the one the crash reporter process is watching.
- Hide upload form on a config variable.
#jira UE-34504
#jira OR-26886
Change 3089060 on 2016/08/15 by Luke.Thatcher
[PLATFORM] [PS4] [!]
Change PS4 crash handler log file extension to ".ps4chlog", otherwise the crash reporter site attaches the wrong log file to the crash report.
Allowed showing of debug upload form via "Default.aspx?showform=1" query string.
#jira UE-34504
#jira OR-26886
Change 3089089 on 2016/08/15 by Mark.Satterthwaite
Duplicated changes to AppleMovieStreamer from CL #3088149.
#jira UE-34315
Change 3089460 on 2016/08/15 by Mark.Satterthwaite
Duplicate CL #3080971:
Workaround a macOS 10.12 Beta bug on some Metal drivers that can't initialise temporary/local variable arrays, only those that are marked threadgroup shared.
#jira UE-34355
Change 3089465 on 2016/08/15 by Mark.Satterthwaite
For Metal shader translation retain more precision for float constants -1.0f >< 1.0f by emitting them in scientific notation - prevents Hammersley constant amongst others from being flushed to 0.
Change 3089902 on 2016/08/15 by Daniel.Lamb
Changed the next compiling ID to the correct compiling ID.
#test Cook
Change 3089903 on 2016/08/15 by Daniel.Lamb
Cooker monitors config useage during cook and uses those settings to invalidate cooked content instead of all config settings.
Change 3090114 on 2016/08/16 by Luke.Thatcher
[PLATFORM] [PS4] [~]
Minor change to PS4 settings text on crash handler site.
Change 3090949 on 2016/08/16 by Nick.Shin
WebSocketNetDriver crash fix
filled in missing chunk of code that calls PacketHandler's "packet modifiers"
#jira UE-25492 HTML5 Client cannot connect to Windows Server
#jira UE-30880 WinServer crashes when NetDriver is set to WebSocket and Client attempts to connect via websocket
#code.review john.pollard john.barrett
Change 3091265 on 2016/08/16 by Brent.Pease
Add IOS support to HarfBuzz
Change 3091267 on 2016/08/16 by Brent.Pease
Add references to fix mono build
Change 3091291 on 2016/08/16 by Nick.Shin
CIS warning fix
#jira UE-25492 HTML5 Client cannot connect to Windows Server
#jira UE-30880 WinServer crashes when NetDriver is set to WebSocket and Client attempts to connect via websocket
Change 3091781 on 2016/08/17 by Joe.Barnes
UE-33640: Exposed UPrimitiveComponent::IsAnyRigidBodyAwake() to Blueprints.
Change 3092687 on 2016/08/17 by Daniel.Lamb
Added support for using binned allocator in cooker instead of tbb.
#test Cook shootergame.
Change 3093867 on 2016/08/18 by Mark.Satterthwaite
Use a read/write mutex to protect access to Metal's internal shader pipeline caches so that parallel threads can progress in the common case where new shaders are not being compiled.
Change 3093950 on 2016/08/18 by Mark.Satterthwaite
Change the Mac GPU identification code to cope with AMD's new naming scheme on 10.12.
Change 3093951 on 2016/08/18 by Mark.Satterthwaite
More SCW threads on Mac - they work now.
Change 3093960 on 2016/08/18 by Mark.Satterthwaite
Increase the default number of command-buffers on Mac because bigger games overflow the current limit of 64 per queue.
Change 3096493 on 2016/08/22 by Jeff.Campeau
Use Xbox version of DirectX include.
Change 3097509 on 2016/08/23 by Luke.Thatcher
[PLATFORM] [PS4] [+]
Refactor PS4 Symbol Publish
- Moved the SymStore task from Win.Automation to BuildGraph.Automation, and made it more generic.
- The specifics of uploading symbols are now implemented in the platform tool chain, alongside StripSymbols().
- Re-generated the build graph schema file.
- Removed the old PS4 symbols upload path in the package step.
Modified OrionBuild.xml to publish symbols for all PS4 dev, test and shipping config builds of OrionClient.
Change 3097635 on 2016/08/23 by Luke.Thatcher
[PLATFORM] [PS4] [+]
Refactor Age Symbols task in UAT.
- Moved the AgeStore task from Win.Automation to BuildGraph.Automation and made it more generic.
- Symbol server directory structure is now defined by the platform tool chain, which the common task uses to clean out old symbols.
- Added a "filter" parameter to prevent age tasks deleting symbols from unrelated builds in shared symbol servers.
Modified OrionBuild.xml to age both the Windows and PS4 symbol stores.
Change 3097713 on 2016/08/23 by Luke.Thatcher
[PLATFORM] [PS4] [+]
Enable new PS4 crash handler server
- Created live deployment profile and applied the required config file changes.
Change 3099214 on 2016/08/24 by Luke.Thatcher
[PLATFORM] [PS4] [!]
Fix compile error in PS4 tool chain. For some reason, this only breaks ocassionally. Maybe we're alternating between the 2013 and 2015 C# compilers depending on what initiates the build (e.g. Visual Studio vs GenerateProjectFiles)?
Change 3099222 on 2016/08/24 by Luke.Thatcher
[PLATFORM] [PS4] [+]
Added PS4 support for FPlatformMisc::MessageBoxExt using the MsgDialog library.
- Note, only one and two button message dialogs are supported (limitation of MsgDialog).
Change 3099260 on 2016/08/24 by Luke.Thatcher
[PLATFORM] [PS4] [~]
Better PS4 exit function. Calls quick_exit instead of abort when we've not asserted. Allows for a "cleaner" forced exit without generating a crash dump.
Change 3101192 on 2016/08/25 by Josh.Adams
Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
Change 3101944 on 2016/08/25 by Daniel.Lamb
Ask to save the current level when we are using launch on.
Change 3102036 on 2016/08/25 by Nick.Shin
check for minimum expected size upon data received from network
#jira UE-13657 - HTML5 plugin OnRawRecieve overflow
Change 3102115 on 2016/08/25 by Brent.Pease
- Fix small errors that probably only show up in the mac mono build
#code.review peter.sauerbrei
Change 3102747 on 2016/08/26 by Jeremiah.Waldron
Re-submitting OnlineSubsystemGameCircle with TPS permission for Amazon SDK
- Also fixed the plugin to remove any related files from the final package when IAP is disabled or GameCircle support itself is disabled with the plugin still enabled
- Added support for new AlreadyOwned IAP response code as well which is already used for GooglePlay and IOS
Change 3102900 on 2016/08/26 by Nick.Shin
since last checkin (CL: 2981945) - prints are crashing the browser - this change will allow browser to print the details via console.log()
#jira UE-26047 - HTML5 HTTP Response Headers not implemented
Change 3103130 on 2016/08/26 by Brent.Pease
UE-24679 - Enable the ability to change ports for a firewall to pass them through rsync
Change 3103225 on 2016/08/26 by Daniel.Lamb
Fixed issue with warning which would cause crash.
Change 3103425 on 2016/08/26 by Dmitry.Rekman
Enable offscreen GL rendering without X.
- Added new video subsystem to SDL that is uses EGL to initialize the context.
- Most windoing functions stubbed.
- Also added a new test case to TestPAL for easier debugging.
Change 3104743 on 2016/08/29 by Brent.Pease
Support remote offline metal shader compilation
Change 3105051 on 2016/08/29 by Brent.Pease
UE-2382 - TASK: MobleMVP: iOS: Add ability to view iOS device console output in the editor UFE
- IOS Automation will now create a thread to collect the console logs from the device and send them to C# Console output while the app is running on device
- Made ProcessResult an interface (IProcessResult) which ProcessResult implements. This allows platforms to provide their own implementation if needed.
- Moved the RunLoop related parts of CoreFoundation into MobileDevice.cs
Change 3105053 on 2016/08/29 by Brent.Pease
- IOS dll's as part of the last check-in
Change 3106853 on 2016/08/30 by Jeff.Campeau
Implement FD3D11DynamicRHI::RHICreateComputeFence to prevent memory overwrite
Change 3107361 on 2016/08/30 by Dmitry.Rekman
Renderer: changes to allow postproc delegates.
Change 3107362 on 2016/08/30 by Dmitry.Rekman
Plugin with a CUDA postproc example.
- Linux version only. Runs under a headless GL too (without X).
- Disabled during cross-compilation, can be compiled natively only.
- CUDA kernel should be compiled separately, CMakefile with compilation attached (can be used to generate VStudio projects as well).
- To test the output, run under the debugger, interrupt and set global variable GSaveTheOutput to 50 (this will write out kernel output buffer 50 times as .bmp files into working directory).
Change 3107913 on 2016/08/31 by Daniel.Lamb
Fixed loading of cooked content in the editor.
Change 3107916 on 2016/08/31 by Daniel.Lamb
Added error case when shader compilation fails to notify shader.
#test Cook shooter game.
Change 3108080 on 2016/08/31 by Josh.Adams
- Fixed PS4Automation compile errors
Change 3109077 on 2016/08/31 by Brent.Pease
Fix C# debug builds by specifying x64 and add reference to MobileDeviceInterface
Change 3110086 on 2016/09/01 by Dmitry.Rekman
Fix race condition in PThread runnable (UE-35074).
- Instead of relying on busy-wait, join the threads. This prevents race between PostRun() (executed in the context of the thread) and FPThreadRunnableThread() destructor (see UE-34909).
- Do not use an invalid value for pthread_t, since there's none.
Change 3110172 on 2016/09/01 by Dmitry.Rekman
Fixed a crash exiting VR Preview on Windows GL4 (UE-28708).
- PR #2188 submitted by ardneran.
Change 3110313 on 2016/09/01 by Josh.Adams
Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
Change 3111134 on 2016/09/01 by Dmitry.Rekman
UBT: prevent mono from hanging on Ctrl-C.
- Sometimes Ctrl-C can cause thread creation to fail. Without this change, UBT would lock up.
Change 3111171 on 2016/09/01 by Brent.Pease
Move all C# projects to use the x64 Platform for consistency with other changes made to move to the x64 Platform
Change 3111177 on 2016/09/01 by Dmitry.Rekman
Fix Linux build on systems without CUDA (UE-35460).
Change 3111548 on 2016/09/02 by Luke.Thatcher
[PLATFORM] [PS4] [!]
Fix for PS4 iterative deployment.
- Changes in Dev-Mobile broke the deployment manifests, as PS4 was now using the wrong filename when creating delta and obsolete file lists.
Change 3111863 on 2016/09/02 by Dmitry.Rekman
Better fix for build without CUDA (UE-35460).
Change 3112738 on 2016/09/02 by Mark.Satterthwaite
Fix the pausing particles on Metal - one line bug in the Metal query implementation meant that the first query wouldn't return the correct result for no good reason.
#jira UE-34989
Change 3114579 on 2016/09/06 by Chris.Babcock
Fix Vulkan include path in NDK check (contributed by geediiiiky)
#jira UE-35490
#github #2758
#ue4
#android
Change 3115115 on 2016/09/06 by Jeff.Campeau
Calculate buffer size for paks using the bitwindow override as needed
Change 3115600 on 2016/09/07 by Luke.Thatcher
[PLATFORM] [PS4] [~]
Make the crash dump handler registration much earlier, to catch crashes in early engine init.
- Fixed up places in FGenericCrashContext::SerializeContentToBuffer which used the command line. If we crash early, the command line may not have been initialized yet.
- Added a GetNoInit function to FThreadHeartBeat to avoid creating the heart beat thread if we crash early, and the thread doesn't exist yet.
Tested by calling abort() immediately inside int main(), and we get a valid crash dump that the crash handler service can consume.
Change 3115676 on 2016/09/07 by Luke.Thatcher
[PLATFORM] [~]
Dev-Platform integration fix for original CL 3064888 in //Orion/Release-29.1
Add .exe and .dll to windows symbol upload file filters.
Change 3115811 on 2016/09/07 by Josh.Adams
Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
Change 3115944 on 2016/09/07 by Michael.Trepka
Implemented IsGamepadAttached() for Mac
Change 3115948 on 2016/09/07 by Michael.Trepka
Don't try to restore Help menu item on Mac if MenuBlock does not contain it
Change 3116200 on 2016/09/07 by Jeff.Campeau
Fix parameter ordering
Change 3117660 on 2016/09/08 by Josh.Adams
Merging //UE4/Dev-Main to Dev-Platform (//UE4/Dev-Platform)
Change 3117728 on 2016/09/08 by Michael.Trepka
Copy of CL 3117698 by Mike.Fricker
Fixed regression with editor's Simulate mode where cursor would teleport back to the center of the viewport after every click
- This bug was introduced in CL 3075932 from a borderless window cursor handling fix that was needed for games that capture the cursor
Change 3117797 on 2016/09/08 by Peter.Sauerbrei
Shader Resource compression
Change 3117988 on 2016/09/08 by Brent.Pease
- Solutiion generator will now pick x64 instead of AnyCPU for the default platform configuration
- Fix what I think was a merge error in BuildGraph.cs
Change 3118296 on 2016/09/08 by Daniel.Lamb
Fixed crash with launch on. Couldnt' correctly detect previous generated ini settings.
#test launch on QA game
#jira UE-35741
Change 3118438 on 2016/09/08 by JohnHenry.Carawon
Fix UAT compilation on Linux
#UE-35745
Change 3118934 on 2016/09/08 by Jeff.Campeau
Shader compression setting based on target platform instead of cooking host platform.
#jira UE-35753
Change 3120190 on 2016/09/09 by Ben.Marsh
Add missing Platform attribute to build script for Dev-Platform.
[CL 3120378 by Josh Adams in Main branch]
3043 lines
113 KiB
C#
3043 lines
113 KiB
C#
// Software License Agreement (BSD License)
|
|
//
|
|
// Copyright (c) 2007, Peter Dennis Bartok <PeterDennisBartok@gmail.com>
|
|
// All rights reserved.
|
|
//
|
|
// Redistribution and use of this software 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 Peter Dennis Bartok nor the names of its
|
|
// contributors may be used to endorse or promote products
|
|
// derived from this software without specific prior
|
|
// written permission of Yahoo! Inc.
|
|
//
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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 code developed by geohot, ixtli, nightwatch, warren
|
|
// See http://iphone.fiveforty.net/wiki/index.php?title=Main_Page
|
|
//
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
using Microsoft.Win32;
|
|
using MobileDeviceInterface;
|
|
|
|
namespace Manzana
|
|
{
|
|
/// <summary>
|
|
/// Structures with unknown innards. They should only ever be used as the target of a TypedPtr, never inspected.
|
|
/// </summary>
|
|
public class AppleMobileDeviceConnection { }
|
|
|
|
/// <summary>
|
|
/// Structures with unknown innards. They should only ever be used as the target of a TypedPtr, never inspected.
|
|
/// </summary>
|
|
public class AFCCommConnection { }
|
|
|
|
public class AFCDictionary { }
|
|
|
|
/// <summary>
|
|
/// Provides the fields representing the type of notification
|
|
/// </summary>
|
|
public enum NotificationMessage
|
|
{
|
|
/// <summary>The iPhone was connected to the computer.</summary>
|
|
Connected = 1,
|
|
|
|
/// <summary>The iPhone was disconnected from the computer.</summary>
|
|
Disconnected = 2,
|
|
|
|
/// <summary>Notification from the iPhone occurred, but the type is unknown.</summary>
|
|
Unknown = 3,
|
|
}
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
internal struct AMDeviceNotificationCallbackInfo
|
|
{
|
|
public IntPtr dev
|
|
{
|
|
get
|
|
{
|
|
return dev_ptr;
|
|
}
|
|
}
|
|
internal IntPtr dev_ptr;
|
|
public NotificationMessage msg;
|
|
}
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
internal struct AMRecoveryDevice
|
|
{
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
public byte[] unknown0; /* 0 */
|
|
public DeviceRestoreNotificationCallback callback; /* 8 */
|
|
public IntPtr user_info; /* 12 */
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
|
public byte[] unknown1; /* 16 */
|
|
public uint readwrite_pipe; /* 28 */
|
|
public byte read_pipe; /* 32 */
|
|
public byte write_ctrl_pipe; /* 33 */
|
|
public byte read_unknown_pipe; /* 34 */
|
|
public byte write_file_pipe; /* 35 */
|
|
public byte write_input_pipe; /* 36 */
|
|
};
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
internal delegate void DeviceNotificationCallback(ref AMDeviceNotificationCallbackInfo callback_info);
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
internal delegate void DeviceRestoreNotificationCallback(ref AMRecoveryDevice callback_info);
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
internal delegate void DeviceInstallationCallback(IntPtr/*CFDictionary*/ UntypedStatusDict, IntPtr UserData);
|
|
|
|
public interface ICoreFoundationRunLoop
|
|
{
|
|
int RunLoopInMode(IntPtr mode, double seconds, int returnAfterSourceHandled);
|
|
IntPtr DefaultMode();
|
|
}
|
|
|
|
internal class CoreFoundationRunLoopOSX : ICoreFoundationRunLoop
|
|
{
|
|
public int RunLoopInMode(IntPtr mode, double seconds, int returnAfterSourceHandled)
|
|
{
|
|
return CFRunLoopRunInMode(mode, seconds, returnAfterSourceHandled);
|
|
}
|
|
|
|
public IntPtr DefaultMode()
|
|
{
|
|
return kCFRunLoopDefaultMode;
|
|
}
|
|
|
|
[DllImport("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
|
|
public extern static IntPtr CFStringCreateWithCString(IntPtr allocator, string value, int encoding);
|
|
|
|
[DllImport("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
|
|
public extern static void CFRunLoopRun();
|
|
|
|
[DllImport("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
|
|
public extern static IntPtr CFRunLoopGetMain();
|
|
|
|
[DllImport("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
|
|
public extern static IntPtr CFRunLoopGetCurrent();
|
|
|
|
[DllImport("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")]
|
|
public extern static int CFRunLoopRunInMode(IntPtr mode, double seconds, int returnAfterSourceHandled);
|
|
|
|
public static IntPtr kCFRunLoopDefaultMode = CFStringCreateWithCString(IntPtr.Zero, "kCFRunLoopDefaultMode", 0);
|
|
}
|
|
|
|
internal class CoreFoundationRunLoopWin32 : ICoreFoundationRunLoop
|
|
{
|
|
static CoreFoundationRunLoopWin32()
|
|
{
|
|
}
|
|
|
|
public int RunLoopInMode(IntPtr mode, double seconds, int returnAfterSourceHandled)
|
|
{
|
|
return CFRunLoopRunInMode(mode, seconds, returnAfterSourceHandled);
|
|
}
|
|
|
|
public IntPtr DefaultMode()
|
|
{
|
|
return kCFRunLoopDefaultMode;
|
|
}
|
|
|
|
[DllImport("CoreFoundation.dll")]
|
|
public extern static IntPtr CFStringCreateWithCString(IntPtr allocator, string value, int encoding);
|
|
|
|
[DllImport("CoreFoundation.dll")]
|
|
public extern static void CFRunLoopRun();
|
|
|
|
[DllImport("CoreFoundation.dll")]
|
|
public extern static IntPtr CFRunLoopGetMain();
|
|
|
|
[DllImport("CoreFoundation.dll")]
|
|
public extern static IntPtr CFRunLoopGetCurrent();
|
|
|
|
[DllImport("CoreFoundation.dll")]
|
|
public extern static int CFRunLoopRunInMode(IntPtr mode, double seconds, int returnAfterSourceHandled);
|
|
|
|
public static IntPtr kCFRunLoopDefaultMode = CFStringCreateWithCString(IntPtr.Zero, "kCFRunLoopDefaultMode", 0);
|
|
}
|
|
|
|
public class CoreFoundationRunLoop
|
|
{
|
|
static public ICoreFoundationRunLoop CoreImpl;
|
|
|
|
static CoreFoundationRunLoop()
|
|
{
|
|
if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
|
|
{
|
|
CoreImpl = new CoreFoundationRunLoopOSX();
|
|
}
|
|
else
|
|
{
|
|
List<string> PathBits = new List<string>();
|
|
PathBits.Add(Environment.GetEnvironmentVariable("Path"));
|
|
|
|
// Try to add the paths from the registry (they aren't always available on newer iTunes installs though)
|
|
object RegistrySupportDir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Apple Inc.\Apple Application Support", "InstallDir", Environment.CurrentDirectory);
|
|
if (RegistrySupportDir != null)
|
|
{
|
|
DirectoryInfo ApplicationSupportDirectory = new DirectoryInfo(RegistrySupportDir.ToString());
|
|
|
|
if (ApplicationSupportDirectory.Exists)
|
|
{
|
|
PathBits.Add(ApplicationSupportDirectory.FullName);
|
|
}
|
|
}
|
|
|
|
// Add some guesses as well
|
|
DirectoryInfo AppleMobileDeviceSupport = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) + @"\Apple\Mobile Device Support");
|
|
if (AppleMobileDeviceSupport.Exists)
|
|
{
|
|
PathBits.Add(AppleMobileDeviceSupport.FullName);
|
|
}
|
|
|
|
DirectoryInfo AppleMobileDeviceSupportX86 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86) + @"\Apple\Mobile Device Support");
|
|
if ((AppleMobileDeviceSupport != AppleMobileDeviceSupportX86) && (AppleMobileDeviceSupportX86.Exists))
|
|
{
|
|
PathBits.Add(AppleMobileDeviceSupportX86.FullName);
|
|
}
|
|
|
|
// Set the path from all the individual bits
|
|
Environment.SetEnvironmentVariable("Path", string.Join(";", PathBits));
|
|
CoreImpl = new CoreFoundationRunLoopWin32();
|
|
}
|
|
}
|
|
|
|
public static int RunLoopRunInMode(IntPtr mode, double seconds, int returnAfterSourceHandled)
|
|
{
|
|
return CoreImpl.RunLoopInMode(mode, seconds, returnAfterSourceHandled);
|
|
}
|
|
|
|
public static IntPtr kCFRunLoopDefaultMode()
|
|
{
|
|
return CoreImpl.DefaultMode();
|
|
}
|
|
}
|
|
|
|
internal interface MobileDeviceImpl
|
|
{
|
|
int NotificationSubscribe(DeviceNotificationCallback DeviceCallbackHandle);
|
|
IntPtr CopyDeviceIdentifier(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int Connect(TypedPtr<AppleMobileDeviceConnection> device);
|
|
IntPtr CopyValue(TypedPtr<AppleMobileDeviceConnection> device, uint unknown, TypedPtr<CFString> cfstring);
|
|
int Disconnect(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int GetConnectionID(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int IsPaired(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int Pair(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int Unpair(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int ValidatePairing(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int LookupApplications(TypedPtr<AppleMobileDeviceConnection> device, IntPtr options, out Dictionary<string, object> AppBundles);
|
|
int StartSession(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int StopSession(TypedPtr<AppleMobileDeviceConnection> device);
|
|
int StartHouseArrestService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2);
|
|
int StartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, ref IntPtr handle, IntPtr unknown);
|
|
int SecureStartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, int flagsPassInZero, ref IntPtr handle);
|
|
string ServiceConnectionReceive(IntPtr handle);
|
|
int RestoreRegisterForDeviceNotifications(
|
|
DeviceRestoreNotificationCallback dfu_connect,
|
|
DeviceRestoreNotificationCallback recovery_connect,
|
|
DeviceRestoreNotificationCallback dfu_disconnect,
|
|
DeviceRestoreNotificationCallback recovery_disconnect,
|
|
uint unknown0,
|
|
IntPtr user_info);
|
|
int SecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFString> ApplicationIdentifer,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
int SecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
int SecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
int ConnectionClose(TypedPtr<AFCCommConnection> conn);
|
|
int ConnectionInvalidate(TypedPtr<AFCCommConnection> conn);
|
|
int ConnectionIsValid(TypedPtr<AFCCommConnection> conn);
|
|
int ConnectionOpen(IntPtr handle, uint io_timeout, out TypedPtr<AFCCommConnection> OutConn);
|
|
int DeviceInfoOpen(IntPtr handle, ref IntPtr dict);
|
|
int DirectoryClose(TypedPtr<AFCCommConnection> conn, IntPtr dir);
|
|
int DirectoryCreate(TypedPtr<AFCCommConnection> conn, string path);
|
|
int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref IntPtr dirent);
|
|
int FileInfoOpen(TypedPtr<AFCCommConnection> conn, string path, out TypedPtr<AFCDictionary> OutDict);
|
|
int FileRefClose(TypedPtr<AFCCommConnection> conn, Int64 handle);
|
|
int FileRefOpen(TypedPtr<AFCCommConnection> conn, string path, Int64 mode, out Int64 handle);
|
|
int FileRefRead(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, ref uint len);
|
|
int FileRefSeek(TypedPtr<AFCCommConnection> conn, Int64 handle, Int64 pos, Int64 origin);
|
|
int FileRefSetFileSize(TypedPtr<AFCCommConnection> conn, Int64 handle, uint size);
|
|
int FileRefTell(TypedPtr<AFCCommConnection> conn, Int64 handle, ref uint position);
|
|
int FileRefWrite(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, uint len);
|
|
int FlushData(TypedPtr<AFCCommConnection> conn, Int64 handle);
|
|
int KeyValueClose(TypedPtr<AFCDictionary> dict);
|
|
int KeyValueRead(TypedPtr<AFCDictionary> dict, out IntPtr key, out IntPtr val);
|
|
int RemovePath(TypedPtr<AFCCommConnection> conn, string path);
|
|
int RenamePath(TypedPtr<AFCCommConnection> conn, string OldPath, string NewPath);
|
|
int DirectoryOpen(TypedPtr<AFCCommConnection> conn, string path, ref IntPtr dir);
|
|
int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref string buffer);
|
|
}
|
|
|
|
internal class MobileDeviceOSX : MobileDeviceImpl
|
|
{
|
|
// static readonly int ForceStaticInit = 42;
|
|
const string DLLName = "/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice";
|
|
|
|
public int NotificationSubscribe(DeviceNotificationCallback DeviceCallbackHandle)
|
|
{
|
|
return AMDeviceMethods.NotificationSubscribe(DeviceCallbackHandle);
|
|
}
|
|
|
|
public IntPtr CopyDeviceIdentifier(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.CopyDeviceIdentifier(device);
|
|
}
|
|
|
|
public int Connect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Connect(device);
|
|
}
|
|
|
|
public IntPtr CopyValue(TypedPtr<AppleMobileDeviceConnection> device, uint unknown, TypedPtr<CFString> cfstring)
|
|
{
|
|
return AMDeviceMethods.CopyValue(device, unknown, cfstring);
|
|
}
|
|
|
|
public int Disconnect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Disconnect(device);
|
|
}
|
|
|
|
public int GetConnectionID(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.GetConnectionID(device);
|
|
}
|
|
|
|
public int IsPaired(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.IsPaired(device);
|
|
}
|
|
|
|
public int Pair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Pair(device);
|
|
}
|
|
|
|
public int Unpair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Unpair(device);
|
|
}
|
|
|
|
public int ValidatePairing(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.ValidatePairing(device);
|
|
}
|
|
|
|
public int LookupApplications(TypedPtr<AppleMobileDeviceConnection> device, IntPtr options, out Dictionary<string, object> AppBundles)
|
|
{
|
|
int Result = AMDeviceMethods.LookupApplications(device, options, out AppBundles);
|
|
return Result;
|
|
}
|
|
|
|
public int StartSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.StartSession((IntPtr)device);
|
|
}
|
|
|
|
public int StopSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.StopSession((IntPtr)device);
|
|
}
|
|
|
|
public int StartHouseArrestService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2)
|
|
{
|
|
return AMDeviceMethods.StartHouseArrestService((IntPtr)device, (IntPtr)bundleName, unknown1, ref handle, unknown2);
|
|
}
|
|
|
|
public int StartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, ref IntPtr handle, IntPtr unknown)
|
|
{
|
|
return AMDeviceMethods.StartService((IntPtr)device, (IntPtr)serviceName, ref handle, unknown);
|
|
}
|
|
|
|
public int SecureStartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, int flagsPassInZero, ref IntPtr handle)
|
|
{
|
|
return AMDeviceMethods.SecureStartService((IntPtr)device, (IntPtr)serviceName, flagsPassInZero, ref handle);
|
|
}
|
|
|
|
public string ServiceConnectionReceive(IntPtr handle)
|
|
{
|
|
return AMDeviceMethods.ServiceConnectionReceive(handle);
|
|
}
|
|
|
|
public int RestoreRegisterForDeviceNotifications(
|
|
DeviceRestoreNotificationCallback dfu_connect,
|
|
DeviceRestoreNotificationCallback recovery_connect,
|
|
DeviceRestoreNotificationCallback dfu_disconnect,
|
|
DeviceRestoreNotificationCallback recovery_disconnect,
|
|
uint unknown0,
|
|
IntPtr user_info)
|
|
{
|
|
return AMDeviceMethods.AMRestoreRegisterForDeviceNotifications(dfu_connect, recovery_connect, dfu_disconnect, recovery_disconnect, unknown0, user_info);
|
|
}
|
|
|
|
public int SecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFString> ApplicationIdentifer,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureUninstallApplication(serviceConnection, DeviceIfConnIsNull, ApplicationIdentifer, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int SecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureInstallApplication(serviceConnection, DeviceIfConnIsNull, UrlPath, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int SecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureUpgradeApplication(ServiceConnection, DeviceIfConnIsNull, UrlPath, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int ConnectionClose(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionClose(conn);
|
|
}
|
|
|
|
public int ConnectionInvalidate(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionInvalidate(conn);
|
|
}
|
|
|
|
public int ConnectionIsValid(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionIsValid(conn);
|
|
}
|
|
|
|
public int ConnectionOpen(IntPtr handle, uint io_timeout, out TypedPtr<AFCCommConnection> OutConn)
|
|
{
|
|
return AFC.ConnectionOpen(handle, io_timeout, out OutConn);
|
|
}
|
|
|
|
public int DeviceInfoOpen(IntPtr handle, ref IntPtr dict)
|
|
{
|
|
return AFC.DeviceInfoOpen(handle, ref dict);
|
|
}
|
|
|
|
public int DirectoryClose(TypedPtr<AFCCommConnection> conn, IntPtr dir)
|
|
{
|
|
return AFC.DirectoryClose(conn, dir);
|
|
}
|
|
|
|
public int DirectoryCreate(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFC.DirectoryCreate(conn, path);
|
|
}
|
|
|
|
public int DirectoryOpen(TypedPtr<AFCCommConnection> conn, string path, ref IntPtr dir)
|
|
{
|
|
return AFC.DirectoryOpen(conn, path, ref dir);
|
|
}
|
|
|
|
public int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref IntPtr dirent)
|
|
{
|
|
return AFC.DirectoryRead(conn, dir, ref dirent);
|
|
}
|
|
|
|
public int FileInfoOpen(TypedPtr<AFCCommConnection> conn, string path, out TypedPtr<AFCDictionary> OutDict)
|
|
{
|
|
return AFC.FileInfoOpen(conn, path, out OutDict);
|
|
}
|
|
|
|
public int FileRefClose(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFC.FileRefClose(conn, handle);
|
|
}
|
|
|
|
public int FileRefOpen(TypedPtr<AFCCommConnection> conn, string path, Int64 mode, out Int64 handle)
|
|
{
|
|
return AFC.FileRefOpen(conn, path, mode, out handle);
|
|
}
|
|
|
|
public int FileRefRead(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, ref uint len)
|
|
{
|
|
return AFC.FileRefRead(conn, handle, buffer, ref len);
|
|
}
|
|
|
|
public int FileRefSeek(TypedPtr<AFCCommConnection> conn, Int64 handle, Int64 pos, Int64 origin)
|
|
{
|
|
return AFC.FileRefSeek(conn, handle, pos, origin);
|
|
}
|
|
|
|
public int FileRefSetFileSize(TypedPtr<AFCCommConnection> conn, Int64 handle, uint size)
|
|
{
|
|
return AFC.FileRefSetFileSize(conn, handle, size);
|
|
}
|
|
|
|
public int FileRefTell(TypedPtr<AFCCommConnection> conn, Int64 handle, ref uint position)
|
|
{
|
|
return AFC.FileRefTell(conn, handle, ref position);
|
|
}
|
|
|
|
public int FileRefWrite(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, uint len)
|
|
{
|
|
return AFC.FileRefWrite(conn, handle, buffer, len);
|
|
}
|
|
|
|
public int FlushData(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFC.FlushData(conn, handle);
|
|
}
|
|
|
|
public int KeyValueClose(TypedPtr<AFCDictionary> dict)
|
|
{
|
|
return AFC.KeyValueClose(dict);
|
|
}
|
|
|
|
public int KeyValueRead(TypedPtr<AFCDictionary> dict, out IntPtr key, out IntPtr val)
|
|
{
|
|
return AFC.KeyValueRead(dict, out key, out val);
|
|
}
|
|
|
|
public int RemovePath(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFC.RemovePath(conn, path);
|
|
}
|
|
|
|
public int RenamePath(TypedPtr<AFCCommConnection> conn, string OldPath, string NewPath)
|
|
{
|
|
return AFC.RenamePath(conn, OldPath, NewPath);
|
|
}
|
|
|
|
#region Application Methods
|
|
public class AMDeviceMethods
|
|
{
|
|
// Need to have the path manipulation code in static MobileDevice() to run
|
|
// static int ForceMobileDeviceConstructorToRun;
|
|
static AMDeviceMethods()
|
|
{
|
|
// ForceMobileDeviceConstructorToRun = ForceStaticInit;
|
|
}
|
|
|
|
public static IntPtr CopyDeviceIdentifier(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceCopyDeviceIdentifier((IntPtr)device);
|
|
}
|
|
|
|
public static int Connect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceConnect((IntPtr)device);
|
|
}
|
|
|
|
public static IntPtr CopyValue(TypedPtr<AppleMobileDeviceConnection> device, uint unknown, TypedPtr<CFString> cfstring)
|
|
{
|
|
return AMDeviceCopyValue((IntPtr)device, unknown, (IntPtr)cfstring);
|
|
}
|
|
|
|
public static int Disconnect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceDisconnect((IntPtr)device);
|
|
}
|
|
|
|
public static int GetConnectionID(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceGetConnectionID((IntPtr)device);
|
|
}
|
|
|
|
public static int IsPaired(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceIsPaired((IntPtr)device);
|
|
}
|
|
|
|
public static int Pair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDevicePair((IntPtr)device);
|
|
}
|
|
|
|
public static int Unpair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceUnpair((IntPtr)device);
|
|
}
|
|
|
|
public static int ValidatePairing(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceValidatePairing((IntPtr)device);
|
|
}
|
|
|
|
public static int LookupApplications(TypedPtr<AppleMobileDeviceConnection> device, IntPtr options, out Dictionary<string, object> AppBundles)
|
|
{
|
|
IntPtr UntypedDict = IntPtr.Zero;
|
|
int Result = AMDeviceLookupApplications((IntPtr)device, options, ref UntypedDict);
|
|
|
|
AppBundles = MobileDevice.ConvertCFDictionaryToDictionaryString(new TypedPtr<CFDictionary>(UntypedDict));
|
|
|
|
return Result;
|
|
}
|
|
|
|
public static int StartSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceStartSession((IntPtr)device);
|
|
}
|
|
|
|
public static int StopSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceStopSession((IntPtr)device);
|
|
}
|
|
|
|
public static int StartHouseArrestService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2)
|
|
{
|
|
return AMDeviceStartHouseArrestService((IntPtr)device, (IntPtr)bundleName, unknown1, ref handle, unknown2);
|
|
}
|
|
|
|
public static int StartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, ref IntPtr handle, IntPtr unknown)
|
|
{
|
|
return AMDeviceStartService((IntPtr)device, (IntPtr)serviceName, ref handle, unknown);
|
|
}
|
|
|
|
public static int SecureStartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, int flagsPassInZero, ref IntPtr handle)
|
|
{
|
|
return AMDeviceSecureStartService((IntPtr)device, (IntPtr)serviceName, flagsPassInZero, ref handle);
|
|
}
|
|
|
|
public static string ServiceConnectionReceive(IntPtr handle)
|
|
{
|
|
StringBuilder sb = new StringBuilder("", 1024);
|
|
AMDServiceConnectionReceive(handle, sb, sb.Capacity, 0);
|
|
return sb.ToString();
|
|
}
|
|
|
|
public static int UninstallApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> ApplicationIdentifier,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceUninstallApplication((IntPtr)device, (IntPtr)ApplicationIdentifier, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFString> ApplicationIdentifer,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureUninstallApplication(serviceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)ApplicationIdentifer, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureInstallApplication(serviceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)UrlPath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int TransferApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> InPackagePath,
|
|
IntPtr UnknownButUnused,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceTransferApplication((IntPtr)device, (IntPtr)InPackagePath, UnknownButUnused, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureUpgradeApplication(ServiceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)UrlPath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int InstallApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> FilePath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceInstallApplication((IntPtr)device, (IntPtr)FilePath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int NotificationSubscribe(DeviceNotificationCallback DeviceCallbackHandle)
|
|
{
|
|
IntPtr notification;
|
|
return AMDeviceNotificationSubscribe(DeviceCallbackHandle, 0, 0, 0, out notification);
|
|
}
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDeviceCopyDeviceIdentifier(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceConnect(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDeviceCopyValue(IntPtr/*AppleMobileDeviceConnection*/ device, uint unknown, IntPtr/*CFString*/ cfstring);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceDisconnect(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceGetConnectionID(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceIsPaired(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDevicePair(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceUnpair(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceValidatePairing(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceLookupApplications(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr options, ref IntPtr appBundles);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceNotificationSubscribe(DeviceNotificationCallback callback, uint unused1, uint unused2, uint unused3, out IntPtr am_device_notification_ptr);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartHouseArrestService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ serviceName, ref IntPtr handle, IntPtr unknown);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureStartService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ serviceName, int flagsPassInZero, ref IntPtr handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDServiceConnectionReceive(IntPtr handle, StringBuilder buffer, int bufferLen, int unknown);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartSession(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStopSession(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMRestoreModeDeviceCreate(uint unknown0, int connection_id, uint unknown1);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
public extern static int AMRestoreRegisterForDeviceNotifications(
|
|
DeviceRestoreNotificationCallback dfu_connect,
|
|
DeviceRestoreNotificationCallback recovery_connect,
|
|
DeviceRestoreNotificationCallback dfu_disconnect,
|
|
DeviceRestoreNotificationCallback recovery_disconnect,
|
|
uint unknown0,
|
|
IntPtr user_info);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceUninstallApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ ApplicationIdentifier,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFString*/ ApplicationIdentifer,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFURL*/ UrlPath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceTransferApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ InPackagePath,
|
|
IntPtr UnknownButUnused,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFURL*/ UrlPath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceInstallApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ FilePath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
// the unknown goes into the 4th dword in the connection struct. if non-zero, winsock send() won't get called in AMDServiceConnectionSend AFAIK
|
|
// the only option is "CloseOnInvalidate" (CFBoolean type, defaults to false)
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDServiceConnectionCreate(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr UnknownTypically0, IntPtr OptionsDictionary);
|
|
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMSBeginSync(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr OuterIn8, IntPtr OuterIn12, IntPtr OuterIn16);
|
|
}
|
|
#endregion
|
|
|
|
#region AFC Operations
|
|
|
|
public int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref string buffer)
|
|
{
|
|
int ret;
|
|
|
|
IntPtr ptr = IntPtr.Zero;
|
|
ret = AFC.DirectoryRead((IntPtr)conn, dir, ref ptr);
|
|
if ((ret == 0) && (ptr != IntPtr.Zero))
|
|
{
|
|
buffer = Marshal.PtrToStringAnsi(ptr);
|
|
}
|
|
else
|
|
{
|
|
buffer = null;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
public class AFC
|
|
{
|
|
public static int ConnectionClose(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionClose((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionInvalidate(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionInvalidate((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionIsValid(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionIsValid((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionOpen(IntPtr handle, uint io_timeout, out TypedPtr<AFCCommConnection> OutConn)
|
|
{
|
|
IntPtr Conn;
|
|
int Result = AFCConnectionOpen(handle, io_timeout, out Conn);
|
|
OutConn = Conn;
|
|
return Result;
|
|
}
|
|
|
|
public static int DeviceInfoOpen(IntPtr handle, ref IntPtr dict)
|
|
{
|
|
return AFCDeviceInfoOpen(handle, ref dict);
|
|
}
|
|
|
|
public static int DirectoryClose(TypedPtr<AFCCommConnection> conn, IntPtr dir)
|
|
{
|
|
return AFCDirectoryClose((IntPtr)conn, dir);
|
|
}
|
|
|
|
public static int DirectoryCreate(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFCDirectoryCreate((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path));
|
|
}
|
|
|
|
public static int DirectoryOpen(TypedPtr<AFCCommConnection> conn, string path, ref IntPtr dir)
|
|
{
|
|
return AFCDirectoryOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), ref dir);
|
|
}
|
|
|
|
public static int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref IntPtr dirent)
|
|
{
|
|
return AFCDirectoryRead((IntPtr)conn, dir, ref dirent);
|
|
}
|
|
|
|
public static int FileInfoOpen(TypedPtr<AFCCommConnection> conn, string path, out TypedPtr<AFCDictionary> OutDict)
|
|
{
|
|
IntPtr UntypedDict;
|
|
int Result = AFCFileInfoOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), out UntypedDict);
|
|
OutDict = UntypedDict;
|
|
|
|
return Result;
|
|
}
|
|
|
|
public static int FileRefClose(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFCFileRefClose((IntPtr)conn, handle);
|
|
}
|
|
|
|
public static int FileRefOpen(TypedPtr<AFCCommConnection> conn, string path, Int64 mode, out Int64 handle)
|
|
{
|
|
return AFCFileRefOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), mode, out handle);
|
|
}
|
|
|
|
public static int FileRefRead(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, ref uint len)
|
|
{
|
|
return AFCFileRefRead((IntPtr)conn, handle, buffer, ref len);
|
|
}
|
|
|
|
public static int FileRefSetFileSize(TypedPtr<AFCCommConnection> conn, Int64 handle, uint size)
|
|
{
|
|
return AFCFileRefSetFileSize((IntPtr)conn, handle, size);
|
|
}
|
|
|
|
public static int FileRefSeek(TypedPtr<AFCCommConnection> conn, Int64 handle, Int64 pos, Int64 origin)
|
|
{
|
|
return AFCFileRefSeek((IntPtr)conn, handle, pos, origin);
|
|
}
|
|
|
|
public static int FileRefTell(TypedPtr<AFCCommConnection> conn, Int64 handle, ref uint position)
|
|
{
|
|
return AFCFileRefTell((IntPtr)conn, handle, ref position);
|
|
}
|
|
|
|
public static int FileRefWrite(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, uint len)
|
|
{
|
|
return AFCFileRefWrite((IntPtr)conn, handle, buffer, len);
|
|
}
|
|
|
|
public static int FlushData(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFCFlushData((IntPtr)conn, handle);
|
|
}
|
|
|
|
public static int KeyValueClose(TypedPtr<AFCDictionary> dict)
|
|
{
|
|
return AFCKeyValueClose((IntPtr)dict);
|
|
}
|
|
|
|
public static int KeyValueRead(TypedPtr<AFCDictionary> dict, out IntPtr key, out IntPtr val)
|
|
{
|
|
return AFCKeyValueRead((IntPtr)dict, out key, out val);
|
|
}
|
|
|
|
public static int RemovePath(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFCRemovePath((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path));
|
|
}
|
|
|
|
public static int RenamePath(TypedPtr<AFCCommConnection> conn, string OldPath, string NewPath)
|
|
{
|
|
return AFCRenamePath((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(OldPath), MobileDevice.StringToFileSystemRepresentation(NewPath));
|
|
}
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionClose(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionInvalidate(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionIsValid(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionOpen(IntPtr handle, uint io_timeout, out IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDeviceInfoOpen(IntPtr handle, ref IntPtr dict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryClose(IntPtr/*AFCCommConnection*/ conn, IntPtr dir);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryCreate(IntPtr/*AFCCommConnection*/ conn, byte[] path);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, ref IntPtr dir);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryRead(IntPtr/*AFCCommConnection*/ conn, IntPtr dir, ref IntPtr dirent);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileInfoOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, out IntPtr OutDict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefClose(IntPtr/*AFCCommConnection*/ conn, Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, Int64 mode, out Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefRead(IntPtr/*AFCCommConnection*/ conn, Int64 handle, byte[] buffer, ref uint len);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefSeek(IntPtr/*AFCCommConnection*/ conn, Int64 handle, Int64 pos, Int64 origin);
|
|
|
|
// FIXME - not working, arguments?
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
public extern static int AFCFileRefSetFileSize(IntPtr/*AFCCommConnection*/ conn, Int64 handle, uint size);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefTell(IntPtr/*AFCCommConnection*/ conn, Int64 handle, ref uint position);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefWrite(IntPtr/*AFCCommConnection*/ conn, Int64 handle, byte[] buffer, uint len);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFlushData(IntPtr/*AFCCommConnection*/ conn, Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCKeyValueClose(IntPtr dict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCKeyValueRead(IntPtr dict, out IntPtr key, out IntPtr val);
|
|
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCRemovePath(IntPtr/*AFCCommConnection*/ conn, byte[] path);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCRenamePath(IntPtr/*AFCCommConnection*/ conn, byte[] old_path, byte[] new_path);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
internal class MobileDeviceWiniTunes11 : MobileDeviceImpl
|
|
{
|
|
// static readonly int ForceStaticInit = 42;
|
|
const string DLLName = "iTunesMobileDevice.dll";
|
|
|
|
static MobileDeviceWiniTunes11()
|
|
{
|
|
List<string> PathBits = new List<string>();
|
|
|
|
// Try to add the paths from the registry (they aren't always available on newer iTunes installs though)
|
|
object RegistryDllPath = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Apple Inc.\Apple Mobile Device Support\Shared", "iTunesMobileDeviceDLL", DLLName);
|
|
if (RegistryDllPath != null)
|
|
{
|
|
FileInfo iTunesMobileDeviceFile = new FileInfo(RegistryDllPath.ToString());
|
|
|
|
if (iTunesMobileDeviceFile.Exists)
|
|
{
|
|
PathBits.Add(iTunesMobileDeviceFile.DirectoryName);
|
|
}
|
|
}
|
|
|
|
object RegistrySupportDir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Apple Inc.\Apple Application Support", "InstallDir", Environment.CurrentDirectory);
|
|
if (RegistrySupportDir != null)
|
|
{
|
|
DirectoryInfo ApplicationSupportDirectory = new DirectoryInfo(RegistrySupportDir.ToString());
|
|
|
|
if (ApplicationSupportDirectory.Exists)
|
|
{
|
|
PathBits.Add(ApplicationSupportDirectory.FullName);
|
|
}
|
|
}
|
|
|
|
// Add some guesses as well
|
|
DirectoryInfo AppleMobileDeviceSupport = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) + @"\Apple\Mobile Device Support");
|
|
if (AppleMobileDeviceSupport.Exists)
|
|
{
|
|
PathBits.Add(AppleMobileDeviceSupport.FullName);
|
|
}
|
|
|
|
DirectoryInfo AppleMobileDeviceSupportX86 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86) + @"\Apple\Mobile Device Support");
|
|
if ((AppleMobileDeviceSupport != AppleMobileDeviceSupportX86) && (AppleMobileDeviceSupportX86.Exists))
|
|
{
|
|
PathBits.Add(AppleMobileDeviceSupportX86.FullName);
|
|
}
|
|
|
|
// add the rest of the path
|
|
PathBits.Add(Environment.GetEnvironmentVariable("Path"));
|
|
|
|
// Set the path from all the individual bits
|
|
Environment.SetEnvironmentVariable("Path", string.Join(";", PathBits));
|
|
}
|
|
|
|
public int NotificationSubscribe(DeviceNotificationCallback DeviceCallbackHandle)
|
|
{
|
|
return AMDeviceMethods.NotificationSubscribe(DeviceCallbackHandle);
|
|
}
|
|
|
|
public IntPtr CopyDeviceIdentifier(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.CopyDeviceIdentifier(device);
|
|
}
|
|
|
|
public int Connect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Connect(device);
|
|
}
|
|
|
|
public IntPtr CopyValue(TypedPtr<AppleMobileDeviceConnection> device, uint unknown, TypedPtr<CFString> cfstring)
|
|
{
|
|
return AMDeviceMethods.CopyValue(device, unknown, cfstring);
|
|
}
|
|
|
|
public int Disconnect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Disconnect(device);
|
|
}
|
|
|
|
public int GetConnectionID(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.GetConnectionID(device);
|
|
}
|
|
|
|
public int IsPaired(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.IsPaired(device);
|
|
}
|
|
|
|
public int Pair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Pair(device);
|
|
}
|
|
|
|
public int Unpair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Unpair(device);
|
|
}
|
|
|
|
public int ValidatePairing(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.ValidatePairing(device);
|
|
}
|
|
|
|
public int LookupApplications(TypedPtr<AppleMobileDeviceConnection> device, IntPtr options, out Dictionary<string, object> AppBundles)
|
|
{
|
|
int Result = AMDeviceMethods.LookupApplications(device, options, out AppBundles);
|
|
return Result;
|
|
}
|
|
|
|
public int StartSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.StartSession((IntPtr)device);
|
|
}
|
|
|
|
public int StopSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.StopSession((IntPtr)device);
|
|
}
|
|
|
|
public int StartHouseArrestService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2)
|
|
{
|
|
return AMDeviceMethods.StartHouseArrestService((IntPtr)device, (IntPtr)bundleName, unknown1, ref handle, unknown2);
|
|
}
|
|
|
|
public int StartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, ref IntPtr handle, IntPtr unknown)
|
|
{
|
|
return AMDeviceMethods.StartService((IntPtr)device, (IntPtr)serviceName, ref handle, unknown);
|
|
}
|
|
|
|
public int SecureStartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, int flagsPassInZero, ref IntPtr handle)
|
|
{
|
|
return AMDeviceMethods.SecureStartService((IntPtr)device, (IntPtr)serviceName, flagsPassInZero, ref handle);
|
|
}
|
|
|
|
public string ServiceConnectionReceive(IntPtr handle)
|
|
{
|
|
return AMDeviceMethods.ServiceConnectionReceive(handle);
|
|
}
|
|
|
|
public int RestoreRegisterForDeviceNotifications(
|
|
DeviceRestoreNotificationCallback dfu_connect,
|
|
DeviceRestoreNotificationCallback recovery_connect,
|
|
DeviceRestoreNotificationCallback dfu_disconnect,
|
|
DeviceRestoreNotificationCallback recovery_disconnect,
|
|
uint unknown0,
|
|
IntPtr user_info)
|
|
{
|
|
return AMDeviceMethods.AMRestoreRegisterForDeviceNotifications(dfu_connect, recovery_connect, dfu_disconnect, recovery_disconnect, unknown0, user_info);
|
|
}
|
|
|
|
public int SecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFString> ApplicationIdentifer,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureUninstallApplication(serviceConnection, DeviceIfConnIsNull, ApplicationIdentifer, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int SecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureInstallApplication(serviceConnection, DeviceIfConnIsNull, UrlPath, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int SecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureUpgradeApplication(ServiceConnection, DeviceIfConnIsNull, UrlPath, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int ConnectionClose(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionClose(conn);
|
|
}
|
|
|
|
public int ConnectionInvalidate(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionInvalidate(conn);
|
|
}
|
|
|
|
public int ConnectionIsValid(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionIsValid(conn);
|
|
}
|
|
|
|
public int ConnectionOpen(IntPtr handle, uint io_timeout, out TypedPtr<AFCCommConnection> OutConn)
|
|
{
|
|
return AFC.ConnectionOpen(handle, io_timeout, out OutConn);
|
|
}
|
|
|
|
public int DeviceInfoOpen(IntPtr handle, ref IntPtr dict)
|
|
{
|
|
return AFC.DeviceInfoOpen(handle, ref dict);
|
|
}
|
|
|
|
public int DirectoryClose(TypedPtr<AFCCommConnection> conn, IntPtr dir)
|
|
{
|
|
return AFC.DirectoryClose(conn, dir);
|
|
}
|
|
|
|
public int DirectoryCreate(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFC.DirectoryCreate(conn, path);
|
|
}
|
|
|
|
public int DirectoryOpen(TypedPtr<AFCCommConnection> conn, string path, ref IntPtr dir)
|
|
{
|
|
return AFC.DirectoryOpen(conn, path, ref dir);
|
|
}
|
|
|
|
public int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref IntPtr dirent)
|
|
{
|
|
return AFC.DirectoryRead(conn, dir, ref dirent);
|
|
}
|
|
|
|
public int FileInfoOpen(TypedPtr<AFCCommConnection> conn, string path, out TypedPtr<AFCDictionary> OutDict)
|
|
{
|
|
return AFC.FileInfoOpen(conn, path, out OutDict);
|
|
}
|
|
|
|
public int FileRefClose(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFC.FileRefClose(conn, handle);
|
|
}
|
|
|
|
public int FileRefOpen(TypedPtr<AFCCommConnection> conn, string path, Int64 mode, out Int64 handle)
|
|
{
|
|
return AFC.FileRefOpen(conn, path, mode, out handle);
|
|
}
|
|
|
|
public int FileRefRead(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, ref uint len)
|
|
{
|
|
return AFC.FileRefRead(conn, handle, buffer, ref len);
|
|
}
|
|
|
|
public int FileRefSeek(TypedPtr<AFCCommConnection> conn, Int64 handle, Int64 pos, Int64 origin)
|
|
{
|
|
return AFC.FileRefSeek(conn, handle, pos, origin);
|
|
}
|
|
|
|
public int FileRefSetFileSize(TypedPtr<AFCCommConnection> conn, Int64 handle, uint size)
|
|
{
|
|
return AFC.FileRefSetFileSize(conn, handle, size);
|
|
}
|
|
|
|
public int FileRefTell(TypedPtr<AFCCommConnection> conn, Int64 handle, ref uint position)
|
|
{
|
|
return AFC.FileRefTell(conn, handle, ref position);
|
|
}
|
|
|
|
public int FileRefWrite(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, uint len)
|
|
{
|
|
return AFC.FileRefWrite(conn, handle, buffer, len);
|
|
}
|
|
|
|
public int FlushData(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFC.FlushData(conn, handle);
|
|
}
|
|
|
|
public int KeyValueClose(TypedPtr<AFCDictionary> dict)
|
|
{
|
|
return AFC.KeyValueClose(dict);
|
|
}
|
|
|
|
public int KeyValueRead(TypedPtr<AFCDictionary> dict, out IntPtr key, out IntPtr val)
|
|
{
|
|
return AFC.KeyValueRead(dict, out key, out val);
|
|
}
|
|
|
|
public int RemovePath(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFC.RemovePath(conn, path);
|
|
}
|
|
|
|
public int RenamePath(TypedPtr<AFCCommConnection> conn, string OldPath, string NewPath)
|
|
{
|
|
return AFC.RenamePath(conn, OldPath, NewPath);
|
|
}
|
|
|
|
#region Application Methods
|
|
public class AMDeviceMethods
|
|
{
|
|
// Need to have the path manipulation code in static MobileDevice() to run
|
|
// static int ForceMobileDeviceConstructorToRun;
|
|
static AMDeviceMethods()
|
|
{
|
|
// ForceMobileDeviceConstructorToRun = ForceStaticInit;
|
|
}
|
|
|
|
public static IntPtr CopyDeviceIdentifier(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceCopyDeviceIdentifier((IntPtr)device);
|
|
}
|
|
|
|
public static int Connect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceConnect((IntPtr)device);
|
|
}
|
|
|
|
public static IntPtr CopyValue(TypedPtr<AppleMobileDeviceConnection> device, uint unknown, TypedPtr<CFString> cfstring)
|
|
{
|
|
return AMDeviceCopyValue((IntPtr)device, unknown, (IntPtr)cfstring);
|
|
}
|
|
|
|
public static int Disconnect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceDisconnect((IntPtr)device);
|
|
}
|
|
|
|
public static int GetConnectionID(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceGetConnectionID((IntPtr)device);
|
|
}
|
|
|
|
public static int IsPaired(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceIsPaired((IntPtr)device);
|
|
}
|
|
|
|
public static int Pair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDevicePair((IntPtr)device);
|
|
}
|
|
|
|
public static int Unpair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceUnpair((IntPtr)device);
|
|
}
|
|
|
|
public static int ValidatePairing(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceValidatePairing((IntPtr)device);
|
|
}
|
|
|
|
public static int LookupApplications(TypedPtr<AppleMobileDeviceConnection> device, IntPtr options, out Dictionary<string, object> AppBundles)
|
|
{
|
|
IntPtr UntypedDict = IntPtr.Zero;
|
|
int Result = AMDeviceLookupApplications((IntPtr)device, options, ref UntypedDict);
|
|
|
|
AppBundles = MobileDevice.ConvertCFDictionaryToDictionaryString(new TypedPtr<CFDictionary>(UntypedDict));
|
|
|
|
return Result;
|
|
}
|
|
|
|
public static int StartSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceStartSession((IntPtr)device);
|
|
}
|
|
|
|
public static int StopSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceStopSession((IntPtr)device);
|
|
}
|
|
|
|
public static int StartHouseArrestService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2)
|
|
{
|
|
return AMDeviceStartHouseArrestService((IntPtr)device, (IntPtr)bundleName, unknown1, ref handle, unknown2);
|
|
}
|
|
|
|
public static int StartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, ref IntPtr handle, IntPtr unknown)
|
|
{
|
|
return AMDeviceStartService((IntPtr)device, (IntPtr)serviceName, ref handle, unknown);
|
|
}
|
|
|
|
public static int SecureStartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, int flagsPassInZero, ref IntPtr handle)
|
|
{
|
|
return AMDeviceSecureStartService((IntPtr)device, (IntPtr)serviceName, flagsPassInZero, ref handle);
|
|
}
|
|
|
|
public static string ServiceConnectionReceive(IntPtr handle)
|
|
{
|
|
StringBuilder sb = new StringBuilder(1024);
|
|
AMDServiceConnectionReceive(handle, sb, sb.Capacity, 0);
|
|
return sb.ToString();
|
|
}
|
|
|
|
public static int UninstallApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> ApplicationIdentifier,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceUninstallApplication((IntPtr)device, (IntPtr)ApplicationIdentifier, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFString> ApplicationIdentifer,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureUninstallApplication(serviceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)ApplicationIdentifer, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureInstallApplication(serviceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)UrlPath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int TransferApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> InPackagePath,
|
|
IntPtr UnknownButUnused,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceTransferApplication((IntPtr)device, (IntPtr)InPackagePath, UnknownButUnused, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureUpgradeApplication(ServiceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)UrlPath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int InstallApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> FilePath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceInstallApplication((IntPtr)device, (IntPtr)FilePath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int NotificationSubscribe(DeviceNotificationCallback DeviceCallbackHandle)
|
|
{
|
|
IntPtr notification;
|
|
return AMDeviceNotificationSubscribe(DeviceCallbackHandle, 0, 0, 0, out notification);
|
|
}
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDeviceCopyDeviceIdentifier(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceConnect(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDeviceCopyValue(IntPtr/*AppleMobileDeviceConnection*/ device, uint unknown, IntPtr/*CFString*/ cfstring);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceDisconnect(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceGetConnectionID(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceIsPaired(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDevicePair(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceUnpair(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceValidatePairing(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceLookupApplications(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr options, ref IntPtr appBundles);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceNotificationSubscribe(DeviceNotificationCallback callback, uint unused1, uint unused2, uint unused3, out IntPtr am_device_notification_ptr);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartHouseArrestService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ serviceName, ref IntPtr handle, IntPtr unknown);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureStartService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ serviceName, int flagsPassInZero, ref IntPtr handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDServiceConnectionReceive(IntPtr handle, StringBuilder buffer, int bufferLen, int unknown);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartSession(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStopSession(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMRestoreModeDeviceCreate(uint unknown0, int connection_id, uint unknown1);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
public extern static int AMRestoreRegisterForDeviceNotifications(
|
|
DeviceRestoreNotificationCallback dfu_connect,
|
|
DeviceRestoreNotificationCallback recovery_connect,
|
|
DeviceRestoreNotificationCallback dfu_disconnect,
|
|
DeviceRestoreNotificationCallback recovery_disconnect,
|
|
uint unknown0,
|
|
IntPtr user_info);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceUninstallApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ ApplicationIdentifier,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFString*/ ApplicationIdentifer,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFURL*/ UrlPath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceTransferApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ InPackagePath,
|
|
IntPtr UnknownButUnused,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFURL*/ UrlPath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceInstallApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ FilePath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
// the unknown goes into the 4th dword in the connection struct. if non-zero, winsock send() won't get called in AMDServiceConnectionSend AFAIK
|
|
// the only option is "CloseOnInvalidate" (CFBoolean type, defaults to false)
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDServiceConnectionCreate(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr UnknownTypically0, IntPtr OptionsDictionary);
|
|
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMSBeginSync(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr OuterIn8, IntPtr OuterIn12, IntPtr OuterIn16);
|
|
}
|
|
#endregion
|
|
|
|
#region AFC Operations
|
|
|
|
public int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref string buffer)
|
|
{
|
|
int ret;
|
|
|
|
IntPtr ptr = IntPtr.Zero;
|
|
ret = AFC.DirectoryRead((IntPtr)conn, dir, ref ptr);
|
|
if ((ret == 0) && (ptr != IntPtr.Zero))
|
|
{
|
|
buffer = Marshal.PtrToStringAnsi(ptr);
|
|
}
|
|
else
|
|
{
|
|
buffer = null;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
public class AFC
|
|
{
|
|
public static int ConnectionClose(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionClose((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionInvalidate(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionInvalidate((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionIsValid(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionIsValid((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionOpen(IntPtr handle, uint io_timeout, out TypedPtr<AFCCommConnection> OutConn)
|
|
{
|
|
IntPtr Conn;
|
|
int Result = AFCConnectionOpen(handle, io_timeout, out Conn);
|
|
OutConn = Conn;
|
|
return Result;
|
|
}
|
|
|
|
public static int DeviceInfoOpen(IntPtr handle, ref IntPtr dict)
|
|
{
|
|
return AFCDeviceInfoOpen(handle, ref dict);
|
|
}
|
|
|
|
public static int DirectoryClose(TypedPtr<AFCCommConnection> conn, IntPtr dir)
|
|
{
|
|
return AFCDirectoryClose((IntPtr)conn, dir);
|
|
}
|
|
|
|
public static int DirectoryCreate(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFCDirectoryCreate((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path));
|
|
}
|
|
|
|
public static int DirectoryOpen(TypedPtr<AFCCommConnection> conn, string path, ref IntPtr dir)
|
|
{
|
|
return AFCDirectoryOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), ref dir);
|
|
}
|
|
|
|
public static int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref IntPtr dirent)
|
|
{
|
|
return AFCDirectoryRead((IntPtr)conn, dir, ref dirent);
|
|
}
|
|
|
|
public static int FileInfoOpen(TypedPtr<AFCCommConnection> conn, string path, out TypedPtr<AFCDictionary> OutDict)
|
|
{
|
|
IntPtr UntypedDict;
|
|
int Result = AFCFileInfoOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), out UntypedDict);
|
|
OutDict = UntypedDict;
|
|
|
|
return Result;
|
|
}
|
|
|
|
public static int FileRefClose(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFCFileRefClose((IntPtr)conn, handle);
|
|
}
|
|
|
|
public static int FileRefOpen(TypedPtr<AFCCommConnection> conn, string path, Int64 mode, out Int64 handle)
|
|
{
|
|
return AFCFileRefOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), mode, out handle);
|
|
}
|
|
|
|
public static int FileRefRead(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, ref uint len)
|
|
{
|
|
return AFCFileRefRead((IntPtr)conn, handle, buffer, ref len);
|
|
}
|
|
|
|
public static int FileRefSetFileSize(TypedPtr<AFCCommConnection> conn, Int64 handle, uint size)
|
|
{
|
|
return AFCFileRefSetFileSize((IntPtr)conn, handle, size);
|
|
}
|
|
|
|
public static int FileRefSeek(TypedPtr<AFCCommConnection> conn, Int64 handle, Int64 pos, Int64 origin)
|
|
{
|
|
return AFCFileRefSeek((IntPtr)conn, handle, pos, origin);
|
|
}
|
|
|
|
public static int FileRefTell(TypedPtr<AFCCommConnection> conn, Int64 handle, ref uint position)
|
|
{
|
|
return AFCFileRefTell((IntPtr)conn, handle, ref position);
|
|
}
|
|
|
|
public static int FileRefWrite(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, uint len)
|
|
{
|
|
return AFCFileRefWrite((IntPtr)conn, handle, buffer, len);
|
|
}
|
|
|
|
public static int FlushData(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFCFlushData((IntPtr)conn, handle);
|
|
}
|
|
|
|
public static int KeyValueClose(TypedPtr<AFCDictionary> dict)
|
|
{
|
|
return AFCKeyValueClose((IntPtr)dict);
|
|
}
|
|
|
|
public static int KeyValueRead(TypedPtr<AFCDictionary> dict, out IntPtr key, out IntPtr val)
|
|
{
|
|
return AFCKeyValueRead((IntPtr)dict, out key, out val);
|
|
}
|
|
|
|
public static int RemovePath(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFCRemovePath((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path));
|
|
}
|
|
|
|
public static int RenamePath(TypedPtr<AFCCommConnection> conn, string OldPath, string NewPath)
|
|
{
|
|
return AFCRenamePath((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(OldPath), MobileDevice.StringToFileSystemRepresentation(NewPath));
|
|
}
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionClose(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionInvalidate(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionIsValid(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionOpen(IntPtr handle, uint io_timeout, out IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDeviceInfoOpen(IntPtr handle, ref IntPtr dict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryClose(IntPtr/*AFCCommConnection*/ conn, IntPtr dir);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryCreate(IntPtr/*AFCCommConnection*/ conn, byte[] path);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, ref IntPtr dir);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryRead(IntPtr/*AFCCommConnection*/ conn, IntPtr dir, ref IntPtr dirent);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileInfoOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, out IntPtr OutDict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefClose(IntPtr/*AFCCommConnection*/ conn, Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, Int64 mode, out Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefRead(IntPtr/*AFCCommConnection*/ conn, Int64 handle, byte[] buffer, ref uint len);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefSeek(IntPtr/*AFCCommConnection*/ conn, Int64 handle, Int64 pos, Int64 origin);
|
|
|
|
// FIXME - not working, arguments?
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
public extern static int AFCFileRefSetFileSize(IntPtr/*AFCCommConnection*/ conn, Int64 handle, uint size);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefTell(IntPtr/*AFCCommConnection*/ conn, Int64 handle, ref uint position);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefWrite(IntPtr/*AFCCommConnection*/ conn, Int64 handle, byte[] buffer, uint len);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFlushData(IntPtr/*AFCCommConnection*/ conn, Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCKeyValueClose(IntPtr dict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCKeyValueRead(IntPtr dict, out IntPtr key, out IntPtr val);
|
|
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCRemovePath(IntPtr/*AFCCommConnection*/ conn, byte[] path);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCRenamePath(IntPtr/*AFCCommConnection*/ conn, byte[] old_path, byte[] new_path);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
internal class MobileDeviceWiniTunes12 : MobileDeviceImpl
|
|
{
|
|
// static readonly int ForceStaticInit = 42;
|
|
const string DLLName = @"MobileDevice.dll";
|
|
|
|
static MobileDeviceWiniTunes12()
|
|
{
|
|
List<string> PathBits = new List<string>();
|
|
|
|
// Try to add the paths from the registry (they aren't always available on newer iTunes installs though)
|
|
object RegistryDllPath = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Apple Inc.\Apple Mobile Device Support\Shared", "MobileDeviceDLL", DLLName);
|
|
if (RegistryDllPath != null)
|
|
{
|
|
FileInfo iTunesMobileDeviceFile = new FileInfo(RegistryDllPath.ToString());
|
|
|
|
if (iTunesMobileDeviceFile.Exists)
|
|
{
|
|
PathBits.Add(iTunesMobileDeviceFile.DirectoryName);
|
|
}
|
|
}
|
|
|
|
object RegistrySupportDir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Apple Inc.\Apple Application Support", "InstallDir", Environment.CurrentDirectory);
|
|
if (RegistrySupportDir != null)
|
|
{
|
|
DirectoryInfo ApplicationSupportDirectory = new DirectoryInfo(RegistrySupportDir.ToString());
|
|
|
|
if (ApplicationSupportDirectory.Exists)
|
|
{
|
|
PathBits.Add(ApplicationSupportDirectory.FullName);
|
|
}
|
|
}
|
|
|
|
// Add some guesses as well
|
|
DirectoryInfo AppleMobileDeviceSupport = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles) + @"\Apple\Mobile Device Support");
|
|
if (AppleMobileDeviceSupport.Exists)
|
|
{
|
|
PathBits.Add(AppleMobileDeviceSupport.FullName);
|
|
}
|
|
|
|
DirectoryInfo AppleMobileDeviceSupportX86 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86) + @"\Apple\Mobile Device Support");
|
|
if ((AppleMobileDeviceSupport != AppleMobileDeviceSupportX86) && (AppleMobileDeviceSupportX86.Exists))
|
|
{
|
|
PathBits.Add(AppleMobileDeviceSupportX86.FullName);
|
|
}
|
|
|
|
// add the rest of the path
|
|
PathBits.Add(Environment.GetEnvironmentVariable("Path"));
|
|
|
|
// Set the path from all the individual bits
|
|
Environment.SetEnvironmentVariable("Path", string.Join(";", PathBits));
|
|
}
|
|
|
|
public int NotificationSubscribe(DeviceNotificationCallback DeviceCallbackHandle)
|
|
{
|
|
return AMDeviceMethods.NotificationSubscribe(DeviceCallbackHandle);
|
|
}
|
|
|
|
public IntPtr CopyDeviceIdentifier(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.CopyDeviceIdentifier(device);
|
|
}
|
|
|
|
public int Connect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Connect(device);
|
|
}
|
|
|
|
public IntPtr CopyValue(TypedPtr<AppleMobileDeviceConnection> device, uint unknown, TypedPtr<CFString> cfstring)
|
|
{
|
|
return AMDeviceMethods.CopyValue(device, unknown, cfstring);
|
|
}
|
|
|
|
public int Disconnect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Disconnect(device);
|
|
}
|
|
|
|
public int GetConnectionID(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.GetConnectionID(device);
|
|
}
|
|
|
|
public int IsPaired(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.IsPaired(device);
|
|
}
|
|
|
|
public int Pair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Pair(device);
|
|
}
|
|
|
|
public int Unpair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.Unpair(device);
|
|
}
|
|
|
|
public int ValidatePairing(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.ValidatePairing(device);
|
|
}
|
|
|
|
public int LookupApplications(TypedPtr<AppleMobileDeviceConnection> device, IntPtr options, out Dictionary<string, object> AppBundles)
|
|
{
|
|
int Result = AMDeviceMethods.LookupApplications(device, options, out AppBundles);
|
|
return Result;
|
|
}
|
|
|
|
public int StartSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.StartSession((IntPtr)device);
|
|
}
|
|
|
|
public int StopSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceMethods.StopSession((IntPtr)device);
|
|
}
|
|
|
|
public int StartHouseArrestService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2)
|
|
{
|
|
return AMDeviceMethods.StartHouseArrestService((IntPtr)device, (IntPtr)bundleName, unknown1, ref handle, unknown2);
|
|
}
|
|
|
|
public int StartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, ref IntPtr handle, IntPtr unknown)
|
|
{
|
|
return AMDeviceMethods.StartService((IntPtr)device, (IntPtr)serviceName, ref handle, unknown);
|
|
}
|
|
|
|
public int SecureStartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, int flagsPassInZero, ref IntPtr handle)
|
|
{
|
|
return AMDeviceMethods.SecureStartService((IntPtr)device, (IntPtr)serviceName, flagsPassInZero, ref handle);
|
|
}
|
|
|
|
public string ServiceConnectionReceive(IntPtr handle)
|
|
{
|
|
return AMDeviceMethods.ServiceConnectionReceive(handle);
|
|
}
|
|
|
|
public int RestoreRegisterForDeviceNotifications(
|
|
DeviceRestoreNotificationCallback dfu_connect,
|
|
DeviceRestoreNotificationCallback recovery_connect,
|
|
DeviceRestoreNotificationCallback dfu_disconnect,
|
|
DeviceRestoreNotificationCallback recovery_disconnect,
|
|
uint unknown0,
|
|
IntPtr user_info)
|
|
{
|
|
return AMDeviceMethods.AMRestoreRegisterForDeviceNotifications(dfu_connect, recovery_connect, dfu_disconnect, recovery_disconnect, unknown0, user_info);
|
|
}
|
|
|
|
public int SecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFString> ApplicationIdentifer,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureUninstallApplication(serviceConnection, DeviceIfConnIsNull, ApplicationIdentifer, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int SecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureInstallApplication(serviceConnection, DeviceIfConnIsNull, UrlPath, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int SecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceMethods.SecureUpgradeApplication(ServiceConnection, DeviceIfConnIsNull, UrlPath, ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public int ConnectionClose(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionClose(conn);
|
|
}
|
|
|
|
public int ConnectionInvalidate(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionInvalidate(conn);
|
|
}
|
|
|
|
public int ConnectionIsValid(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFC.ConnectionIsValid(conn);
|
|
}
|
|
|
|
public int ConnectionOpen(IntPtr handle, uint io_timeout, out TypedPtr<AFCCommConnection> OutConn)
|
|
{
|
|
return AFC.ConnectionOpen(handle, io_timeout, out OutConn);
|
|
}
|
|
|
|
public int DeviceInfoOpen(IntPtr handle, ref IntPtr dict)
|
|
{
|
|
return AFC.DeviceInfoOpen(handle, ref dict);
|
|
}
|
|
|
|
public int DirectoryClose(TypedPtr<AFCCommConnection> conn, IntPtr dir)
|
|
{
|
|
return AFC.DirectoryClose(conn, dir);
|
|
}
|
|
|
|
public int DirectoryCreate(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFC.DirectoryCreate(conn, path);
|
|
}
|
|
|
|
public int DirectoryOpen(TypedPtr<AFCCommConnection> conn, string path, ref IntPtr dir)
|
|
{
|
|
return AFC.DirectoryOpen(conn, path, ref dir);
|
|
}
|
|
|
|
public int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref IntPtr dirent)
|
|
{
|
|
return AFC.DirectoryRead(conn, dir, ref dirent);
|
|
}
|
|
|
|
public int FileInfoOpen(TypedPtr<AFCCommConnection> conn, string path, out TypedPtr<AFCDictionary> OutDict)
|
|
{
|
|
return AFC.FileInfoOpen(conn, path, out OutDict);
|
|
}
|
|
|
|
public int FileRefClose(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFC.FileRefClose(conn, handle);
|
|
}
|
|
|
|
public int FileRefOpen(TypedPtr<AFCCommConnection> conn, string path, Int64 mode, out Int64 handle)
|
|
{
|
|
return AFC.FileRefOpen(conn, path, mode, out handle);
|
|
}
|
|
|
|
public int FileRefRead(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, ref uint len)
|
|
{
|
|
return AFC.FileRefRead(conn, handle, buffer, ref len);
|
|
}
|
|
|
|
public int FileRefSeek(TypedPtr<AFCCommConnection> conn, Int64 handle, Int64 pos, Int64 origin)
|
|
{
|
|
return AFC.FileRefSeek(conn, handle, pos, origin);
|
|
}
|
|
|
|
public int FileRefSetFileSize(TypedPtr<AFCCommConnection> conn, Int64 handle, uint size)
|
|
{
|
|
return AFC.FileRefSetFileSize(conn, handle, size);
|
|
}
|
|
|
|
public int FileRefTell(TypedPtr<AFCCommConnection> conn, Int64 handle, ref uint position)
|
|
{
|
|
return AFC.FileRefTell(conn, handle, ref position);
|
|
}
|
|
|
|
public int FileRefWrite(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, uint len)
|
|
{
|
|
return AFC.FileRefWrite(conn, handle, buffer, len);
|
|
}
|
|
|
|
public int FlushData(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFC.FlushData(conn, handle);
|
|
}
|
|
|
|
public int KeyValueClose(TypedPtr<AFCDictionary> dict)
|
|
{
|
|
return AFC.KeyValueClose(dict);
|
|
}
|
|
|
|
public int KeyValueRead(TypedPtr<AFCDictionary> dict, out IntPtr key, out IntPtr val)
|
|
{
|
|
return AFC.KeyValueRead(dict, out key, out val);
|
|
}
|
|
|
|
public int RemovePath(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFC.RemovePath(conn, path);
|
|
}
|
|
|
|
public int RenamePath(TypedPtr<AFCCommConnection> conn, string OldPath, string NewPath)
|
|
{
|
|
return AFC.RenamePath(conn, OldPath, NewPath);
|
|
}
|
|
|
|
#region Application Methods
|
|
public class AMDeviceMethods
|
|
{
|
|
// Need to have the path manipulation code in static MobileDevice() to run
|
|
// static int ForceMobileDeviceConstructorToRun;
|
|
static AMDeviceMethods()
|
|
{
|
|
// ForceMobileDeviceConstructorToRun = ForceStaticInit;
|
|
}
|
|
|
|
public static IntPtr CopyDeviceIdentifier(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceCopyDeviceIdentifier((IntPtr)device);
|
|
}
|
|
|
|
public static int Connect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceConnect((IntPtr)device);
|
|
}
|
|
|
|
public static IntPtr CopyValue(TypedPtr<AppleMobileDeviceConnection> device, uint unknown, TypedPtr<CFString> cfstring)
|
|
{
|
|
return AMDeviceCopyValue((IntPtr)device, unknown, (IntPtr)cfstring);
|
|
}
|
|
|
|
public static int Disconnect(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceDisconnect((IntPtr)device);
|
|
}
|
|
|
|
public static int GetConnectionID(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceGetConnectionID((IntPtr)device);
|
|
}
|
|
|
|
public static int IsPaired(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceIsPaired((IntPtr)device);
|
|
}
|
|
|
|
public static int Pair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDevicePair((IntPtr)device);
|
|
}
|
|
|
|
public static int Unpair(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceUnpair((IntPtr)device);
|
|
}
|
|
|
|
public static int ValidatePairing(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceValidatePairing((IntPtr)device);
|
|
}
|
|
|
|
public static int LookupApplications(TypedPtr<AppleMobileDeviceConnection> device, IntPtr options, out Dictionary<string, object> AppBundles)
|
|
{
|
|
IntPtr UntypedDict = IntPtr.Zero;
|
|
int Result = AMDeviceLookupApplications((IntPtr)device, options, ref UntypedDict);
|
|
|
|
AppBundles = MobileDevice.ConvertCFDictionaryToDictionaryString(new TypedPtr<CFDictionary>(UntypedDict));
|
|
|
|
return Result;
|
|
}
|
|
|
|
public static int StartSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceStartSession((IntPtr)device);
|
|
}
|
|
|
|
public static int StopSession(TypedPtr<AppleMobileDeviceConnection> device)
|
|
{
|
|
return AMDeviceStopSession((IntPtr)device);
|
|
}
|
|
|
|
public static int StartHouseArrestService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2)
|
|
{
|
|
return AMDeviceStartHouseArrestService((IntPtr)device, (IntPtr)bundleName, unknown1, ref handle, unknown2);
|
|
}
|
|
|
|
public static int StartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, ref IntPtr handle, IntPtr unknown)
|
|
{
|
|
return AMDeviceStartService((IntPtr)device, (IntPtr)serviceName, ref handle, unknown);
|
|
}
|
|
|
|
public static int SecureStartService(TypedPtr<AppleMobileDeviceConnection> device, TypedPtr<CFString> serviceName, int flagsPassInZero, ref IntPtr handle)
|
|
{
|
|
return AMDeviceSecureStartService((IntPtr)device, (IntPtr)serviceName, flagsPassInZero, ref handle);
|
|
}
|
|
|
|
public static string ServiceConnectionReceive(IntPtr handle)
|
|
{
|
|
StringBuilder sb = new StringBuilder(1024);
|
|
AMDServiceConnectionReceive(handle, sb, sb.Capacity, 0);
|
|
return sb.ToString();
|
|
}
|
|
|
|
public static int UninstallApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> ApplicationIdentifier,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceUninstallApplication((IntPtr)device, (IntPtr)ApplicationIdentifier, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFString> ApplicationIdentifer,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureUninstallApplication(serviceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)ApplicationIdentifer, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureInstallApplication(serviceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)UrlPath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int TransferApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> InPackagePath,
|
|
IntPtr UnknownButUnused,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceTransferApplication((IntPtr)device, (IntPtr)InPackagePath, UnknownButUnused, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int SecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
TypedPtr<AppleMobileDeviceConnection> DeviceIfConnIsNull,
|
|
TypedPtr<CFURL> UrlPath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceSecureUpgradeApplication(ServiceConnection, (IntPtr)DeviceIfConnIsNull, (IntPtr)UrlPath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int InstallApplication(
|
|
TypedPtr<AppleMobileDeviceConnection> device,
|
|
TypedPtr<CFString> FilePath,
|
|
TypedPtr<CFDictionary> ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData)
|
|
{
|
|
return AMDeviceInstallApplication((IntPtr)device, (IntPtr)FilePath, (IntPtr)ClientOptions, ProgressCallback, UserData);
|
|
}
|
|
|
|
public static int NotificationSubscribe(DeviceNotificationCallback DeviceCallbackHandle)
|
|
{
|
|
IntPtr notification;
|
|
return AMDeviceNotificationSubscribe(DeviceCallbackHandle, 0, 0, 0, out notification);
|
|
}
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDeviceCopyDeviceIdentifier(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceConnect(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDeviceCopyValue(IntPtr/*AppleMobileDeviceConnection*/ device, uint unknown, IntPtr/*CFString*/ cfstring);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceDisconnect(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceGetConnectionID(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceIsPaired(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDevicePair(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceUnpair(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceValidatePairing(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceLookupApplications(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr options, ref IntPtr appBundles);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceNotificationSubscribe(DeviceNotificationCallback callback, uint unused1, uint unused2, uint unused3, out IntPtr am_device_notification_ptr);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartHouseArrestService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ bundleName, IntPtr unknown1, ref IntPtr handle, int unknown2);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ serviceName, ref IntPtr handle, IntPtr unknown);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureStartService(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr/*CFString*/ serviceName, int flagsPassInZero, ref IntPtr handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDServiceConnectionReceive(IntPtr handle, StringBuilder buffer, int bufferLen, int unknown);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStartSession(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceStopSession(IntPtr/*AppleMobileDeviceConnection*/ device);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMRestoreModeDeviceCreate(uint unknown0, int connection_id, uint unknown1);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
public extern static int AMRestoreRegisterForDeviceNotifications(
|
|
DeviceRestoreNotificationCallback dfu_connect,
|
|
DeviceRestoreNotificationCallback recovery_connect,
|
|
DeviceRestoreNotificationCallback dfu_disconnect,
|
|
DeviceRestoreNotificationCallback recovery_disconnect,
|
|
uint unknown0,
|
|
IntPtr user_info);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceUninstallApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ ApplicationIdentifier,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureUninstallApplication(
|
|
IntPtr serviceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFString*/ ApplicationIdentifer,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureInstallApplication(
|
|
IntPtr serviceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFURL*/ UrlPath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceTransferApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ InPackagePath,
|
|
IntPtr UnknownButUnused,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceSecureUpgradeApplication(
|
|
IntPtr ServiceConnection,
|
|
IntPtr/*AppleMobileDeviceConnection*/ DeviceIfConnIsNull,
|
|
IntPtr/*CFURL*/ UrlPath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMDeviceInstallApplication(
|
|
IntPtr/*AppleMobileDeviceConnection*/ device,
|
|
IntPtr/*CFString*/ FilePath,
|
|
IntPtr/*CFDictionary*/ ClientOptions,
|
|
DeviceInstallationCallback ProgressCallback,
|
|
IntPtr UserData);
|
|
|
|
// the unknown goes into the 4th dword in the connection struct. if non-zero, winsock send() won't get called in AMDServiceConnectionSend AFAIK
|
|
// the only option is "CloseOnInvalidate" (CFBoolean type, defaults to false)
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static IntPtr AMDServiceConnectionCreate(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr UnknownTypically0, IntPtr OptionsDictionary);
|
|
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AMSBeginSync(IntPtr/*AppleMobileDeviceConnection*/ device, IntPtr OuterIn8, IntPtr OuterIn12, IntPtr OuterIn16);
|
|
}
|
|
#endregion
|
|
|
|
#region AFC Operations
|
|
|
|
public int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref string buffer)
|
|
{
|
|
int ret;
|
|
|
|
IntPtr ptr = IntPtr.Zero;
|
|
ret = AFC.DirectoryRead((IntPtr)conn, dir, ref ptr);
|
|
if ((ret == 0) && (ptr != IntPtr.Zero))
|
|
{
|
|
buffer = Marshal.PtrToStringAnsi(ptr);
|
|
}
|
|
else
|
|
{
|
|
buffer = null;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
public class AFC
|
|
{
|
|
public static int ConnectionClose(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionClose((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionInvalidate(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionInvalidate((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionIsValid(TypedPtr<AFCCommConnection> conn)
|
|
{
|
|
return AFCConnectionIsValid((IntPtr)conn);
|
|
}
|
|
|
|
public static int ConnectionOpen(IntPtr handle, uint io_timeout, out TypedPtr<AFCCommConnection> OutConn)
|
|
{
|
|
IntPtr Conn;
|
|
int Result = AFCConnectionOpen(handle, io_timeout, out Conn);
|
|
OutConn = Conn;
|
|
return Result;
|
|
}
|
|
|
|
public static int DeviceInfoOpen(IntPtr handle, ref IntPtr dict)
|
|
{
|
|
return AFCDeviceInfoOpen(handle, ref dict);
|
|
}
|
|
|
|
public static int DirectoryClose(TypedPtr<AFCCommConnection> conn, IntPtr dir)
|
|
{
|
|
return AFCDirectoryClose((IntPtr)conn, dir);
|
|
}
|
|
|
|
public static int DirectoryCreate(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFCDirectoryCreate((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path));
|
|
}
|
|
|
|
public static int DirectoryOpen(TypedPtr<AFCCommConnection> conn, string path, ref IntPtr dir)
|
|
{
|
|
return AFCDirectoryOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), ref dir);
|
|
}
|
|
|
|
public static int DirectoryRead(TypedPtr<AFCCommConnection> conn, IntPtr dir, ref IntPtr dirent)
|
|
{
|
|
return AFCDirectoryRead((IntPtr)conn, dir, ref dirent);
|
|
}
|
|
|
|
public static int FileInfoOpen(TypedPtr<AFCCommConnection> conn, string path, out TypedPtr<AFCDictionary> OutDict)
|
|
{
|
|
IntPtr UntypedDict;
|
|
int Result = AFCFileInfoOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), out UntypedDict);
|
|
OutDict = UntypedDict;
|
|
|
|
return Result;
|
|
}
|
|
|
|
public static int FileRefClose(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFCFileRefClose((IntPtr)conn, handle);
|
|
}
|
|
|
|
public static int FileRefOpen(TypedPtr<AFCCommConnection> conn, string path, Int64 mode, out Int64 handle)
|
|
{
|
|
return AFCFileRefOpen((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path), mode, out handle);
|
|
}
|
|
|
|
public static int FileRefRead(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, ref uint len)
|
|
{
|
|
return AFCFileRefRead((IntPtr)conn, handle, buffer, ref len);
|
|
}
|
|
|
|
public static int FileRefSetFileSize(TypedPtr<AFCCommConnection> conn, Int64 handle, uint size)
|
|
{
|
|
return AFCFileRefSetFileSize((IntPtr)conn, handle, size);
|
|
}
|
|
|
|
public static int FileRefSeek(TypedPtr<AFCCommConnection> conn, Int64 handle, Int64 pos, Int64 origin)
|
|
{
|
|
return AFCFileRefSeek((IntPtr)conn, handle, pos, origin);
|
|
}
|
|
|
|
public static int FileRefTell(TypedPtr<AFCCommConnection> conn, Int64 handle, ref uint position)
|
|
{
|
|
return AFCFileRefTell((IntPtr)conn, handle, ref position);
|
|
}
|
|
|
|
public static int FileRefWrite(TypedPtr<AFCCommConnection> conn, Int64 handle, byte[] buffer, uint len)
|
|
{
|
|
return AFCFileRefWrite((IntPtr)conn, handle, buffer, len);
|
|
}
|
|
|
|
public static int FlushData(TypedPtr<AFCCommConnection> conn, Int64 handle)
|
|
{
|
|
return AFCFlushData((IntPtr)conn, handle);
|
|
}
|
|
|
|
public static int KeyValueClose(TypedPtr<AFCDictionary> dict)
|
|
{
|
|
return AFCKeyValueClose((IntPtr)dict);
|
|
}
|
|
|
|
public static int KeyValueRead(TypedPtr<AFCDictionary> dict, out IntPtr key, out IntPtr val)
|
|
{
|
|
return AFCKeyValueRead((IntPtr)dict, out key, out val);
|
|
}
|
|
|
|
public static int RemovePath(TypedPtr<AFCCommConnection> conn, string path)
|
|
{
|
|
return AFCRemovePath((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(path));
|
|
}
|
|
|
|
public static int RenamePath(TypedPtr<AFCCommConnection> conn, string OldPath, string NewPath)
|
|
{
|
|
return AFCRenamePath((IntPtr)conn, MobileDevice.StringToFileSystemRepresentation(OldPath), MobileDevice.StringToFileSystemRepresentation(NewPath));
|
|
}
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionClose(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionInvalidate(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionIsValid(IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCConnectionOpen(IntPtr handle, uint io_timeout, out IntPtr/*AFCCommConnection*/ conn);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDeviceInfoOpen(IntPtr handle, ref IntPtr dict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryClose(IntPtr/*AFCCommConnection*/ conn, IntPtr dir);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryCreate(IntPtr/*AFCCommConnection*/ conn, byte[] path);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, ref IntPtr dir);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCDirectoryRead(IntPtr/*AFCCommConnection*/ conn, IntPtr dir, ref IntPtr dirent);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileInfoOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, out IntPtr OutDict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefClose(IntPtr/*AFCCommConnection*/ conn, Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefOpen(IntPtr/*AFCCommConnection*/ conn, byte[] path, Int64 mode, out Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefRead(IntPtr/*AFCCommConnection*/ conn, Int64 handle, byte[] buffer, ref uint len);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefSeek(IntPtr/*AFCCommConnection*/ conn, Int64 handle, Int64 pos, Int64 origin);
|
|
|
|
// FIXME - not working, arguments?
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
public extern static int AFCFileRefSetFileSize(IntPtr/*AFCCommConnection*/ conn, Int64 handle, uint size);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefTell(IntPtr/*AFCCommConnection*/ conn, Int64 handle, ref uint position);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFileRefWrite(IntPtr/*AFCCommConnection*/ conn, Int64 handle, byte[] buffer, uint len);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCFlushData(IntPtr/*AFCCommConnection*/ conn, Int64 handle);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCKeyValueClose(IntPtr dict);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCKeyValueRead(IntPtr dict, out IntPtr key, out IntPtr val);
|
|
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCRemovePath(IntPtr/*AFCCommConnection*/ conn, byte[] path);
|
|
|
|
[DllImport(DLLName, CallingConvention = CallingConvention.Cdecl)]
|
|
private extern static int AFCRenamePath(IntPtr/*AFCCommConnection*/ conn, byte[] old_path, byte[] new_path);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
internal partial class MobileDevice
|
|
{
|
|
static public MobileDeviceImpl DeviceImpl = null;
|
|
|
|
static MobileDevice()
|
|
{
|
|
if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
|
|
{
|
|
DeviceImpl = new MobileDeviceOSX();
|
|
}
|
|
else
|
|
{
|
|
string dllPath11 = Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Apple Inc.\\Apple Mobile Device Support\\Shared", "iTunesMobileDeviceDLL", null) as string;
|
|
string dllPath12 = Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Apple Inc.\\Apple Mobile Device Support\\Shared", "MobileDeviceDLL", null) as string;
|
|
if (!String.IsNullOrEmpty(dllPath12) && File.Exists(dllPath12))
|
|
{
|
|
DeviceImpl = new MobileDeviceWiniTunes12();
|
|
}
|
|
else if (!String.IsNullOrEmpty(dllPath11) && File.Exists(dllPath11))
|
|
{
|
|
DeviceImpl = new MobileDeviceWiniTunes11();
|
|
}
|
|
}
|
|
|
|
// Initialize the CoreFoundation bindings
|
|
InitializeCoreFoundation();
|
|
}
|
|
|
|
/*
|
|
Valid Value Names:
|
|
ActivationState
|
|
ActivationStateAcknowledged
|
|
BasebandBootloaderVersion
|
|
BasebandVersion
|
|
BluetoothAddress
|
|
BuildVersion
|
|
DeviceCertificate
|
|
DeviceClass
|
|
DeviceName
|
|
DevicePublicKey
|
|
FirmwareVersion
|
|
HostAttached
|
|
IntegratedCircuitCardIdentity
|
|
InternationalMobileEquipmentIdentity
|
|
InternationalMobileSubscriberIdentity
|
|
ModelNumber
|
|
PhoneNumber
|
|
ProductType
|
|
ProductVersion
|
|
ProtocolVersion
|
|
RegionInfo
|
|
SBLockdownEverRegisteredKey
|
|
SIMStatus
|
|
SerialNumber
|
|
SomebodySetTimeZone
|
|
TimeIntervalSince1970
|
|
TimeZone
|
|
TimeZoneOffsetFromUTC
|
|
TrustedHostAttached
|
|
UniqueDeviceID
|
|
Uses24HourClock
|
|
WiFiAddress
|
|
iTunesHasConnected
|
|
*/
|
|
|
|
public static string AMDeviceCopyValue(TypedPtr<AppleMobileDeviceConnection> device, string name)
|
|
{
|
|
IntPtr result = DeviceImpl.CopyValue(device, 0, CFStringMakeConstantString(name));
|
|
if (result != IntPtr.Zero)
|
|
{
|
|
return MobileDevice.CFStringGetCString(result);
|
|
}
|
|
else
|
|
{
|
|
Console.WriteLine("Error: Call to AMDeviceCopyValue failed");
|
|
}
|
|
return String.Empty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns an error string
|
|
/// </summary>
|
|
public static string GetErrorString(int ErrorValue)
|
|
{
|
|
string Result = GetSpecificErrorString(ErrorValue);
|
|
|
|
if (Result == null)
|
|
{
|
|
Result = String.Format("Unknown error 0x{0:X}", ErrorValue);
|
|
}
|
|
|
|
return Result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns a human readable description of the error from the mobile device or null if there isn't one
|
|
/// </summary>
|
|
public static string GetSpecificErrorString(int ErrorValue)
|
|
{
|
|
switch ((uint)ErrorValue)
|
|
{
|
|
case 0:
|
|
return "Success.";
|
|
|
|
case 0xE8000002:
|
|
return "Bad Header Error";
|
|
|
|
case 0xE8000003:
|
|
return "No Resources Error";
|
|
|
|
case 0xE8000004:
|
|
return "Read Error";
|
|
|
|
case 0xE8000005:
|
|
return "Write Error";
|
|
|
|
case 0xE8000006:
|
|
return "Unknown Packet Error";
|
|
|
|
case 0xE8000007:
|
|
return "Invalid Argument Error";
|
|
|
|
case 0xE8000008:
|
|
return "Not Found Error";
|
|
|
|
case 0xE8000009:
|
|
return "Is Directory Error";
|
|
|
|
case 0xE800000A:
|
|
return "Permission Error";
|
|
|
|
case 0xE800000B:
|
|
return "Not Connected Error";
|
|
|
|
case 0xE800000C:
|
|
return "Time Out Error";
|
|
|
|
case 0xE800000D:
|
|
return "Overrun Error";
|
|
|
|
case 0xE800000E:
|
|
return "EOF Error";
|
|
|
|
case 0xE800000F:
|
|
return "Unsupported Error";
|
|
|
|
case 0xE8000010:
|
|
return "File Exists Error";
|
|
|
|
case 0xE8000011:
|
|
return "Busy Error";
|
|
|
|
case 0xE8000012:
|
|
return "Crypto Error";
|
|
|
|
case 0xE8000013:
|
|
return "Invalid Response Error";
|
|
|
|
case 0xE8000014:
|
|
return "Missing Key Error";
|
|
|
|
case 0xE8000015:
|
|
return "Missing Value Error";
|
|
|
|
case 0xE8000016:
|
|
return "Get Prohibited Error";
|
|
|
|
case 0xE8000017:
|
|
return "Set Prohibited Error";
|
|
|
|
case 0xE8000018:
|
|
return "Time Out Error";
|
|
|
|
case 0xE8000019:
|
|
return "Immutable Value Error";
|
|
|
|
case 0xE800001A:
|
|
return "Password Protected Error";
|
|
|
|
case 0xE800001B:
|
|
return "Missing Host ID Error";
|
|
|
|
case 0xE800001C:
|
|
return "Invalid Host ID Error";
|
|
|
|
case 0xE800001D:
|
|
return "Session Active Error";
|
|
|
|
case 0xE800001E:
|
|
return "Session Inactive Error";
|
|
|
|
case 0xE800001F:
|
|
return "Missing Session ID Error";
|
|
|
|
case 0xE8000020:
|
|
return "Invalid Session ID Error";
|
|
|
|
case 0xE8000021:
|
|
return "Missing Service Error";
|
|
|
|
case 0xE8000022:
|
|
return "Invalid Service Error";
|
|
|
|
case 0xE8000023:
|
|
return "Invalid Checkin Error";
|
|
|
|
case 0xE8000024:
|
|
return "Checkin Timeout Error";
|
|
|
|
case 0xE8000025:
|
|
return "Missing Pair Record Error";
|
|
|
|
case 0xE8000026:
|
|
return "Invalid Activation Record Error";
|
|
|
|
case 0xE8000027:
|
|
return "Missing Activation Error";
|
|
|
|
case 0xE8000028:
|
|
return "Wrong Droid Error";
|
|
|
|
case 0xE8000029:
|
|
return "SU Verification Error";
|
|
|
|
case 0xE800002A:
|
|
return "SU Patch Error";
|
|
|
|
case 0xE800002B:
|
|
return "SU Firmware Error";
|
|
|
|
case 0xE800002C:
|
|
return "Provisioning Profile Not Valid";
|
|
|
|
case 0xE800002D:
|
|
return "Send Message Error";
|
|
|
|
case 0xE800002E:
|
|
return "Receive Message Error";
|
|
|
|
case 0xE800002F:
|
|
return "Missing Options Error";
|
|
|
|
case 0xE8000030:
|
|
return "Missing Image Type Error";
|
|
|
|
case 0xE8000031:
|
|
return "Digest Failed Error";
|
|
|
|
case 0xE8000032:
|
|
return "Start Service Error";
|
|
|
|
case 0xE8000033:
|
|
return "Invalid Disk Image Error";
|
|
|
|
case 0xE8000034:
|
|
return "Missing Digest Error";
|
|
|
|
case 0xE8000035:
|
|
return "Mux Error";
|
|
|
|
case 0xE8000036:
|
|
return "Application Already Installed Error";
|
|
|
|
case 0xE8000037:
|
|
return "Application Move Failed Error";
|
|
|
|
case 0xE8000038:
|
|
return "Application SINF Capture Failed Error";
|
|
|
|
case 0xE8000039:
|
|
return "Application Sandbox Failed Error";
|
|
|
|
case 0xE800003A:
|
|
return "Application Verification Failed Error";
|
|
|
|
case 0xE800003B:
|
|
return "Archive Destructor Failed Error";
|
|
|
|
case 0xE800003C:
|
|
return "Bundle Verification Failed Error";
|
|
|
|
case 0xE800003D:
|
|
return "Carrier Bundle Copy Failed Error";
|
|
|
|
case 0xE800003E:
|
|
return "Carrier Bundle Directory Creation Failed Error";
|
|
|
|
case 0xE800003F:
|
|
return "Carrier Bundle Missing Supported SIMs Error";
|
|
|
|
case 0xE8000040:
|
|
return "Comm Center Notification Failed Error";
|
|
|
|
case 0xE8000041:
|
|
return "COntainer Creation Failed Error";
|
|
|
|
case 0xE8000042:
|
|
return "Container P0wn Failed Error";
|
|
|
|
case 0xE8000043:
|
|
return "Container Removal Failed Error";
|
|
|
|
case 0xE8000044:
|
|
return "Embedded Profile Install Failed Error";
|
|
|
|
case 0xE8000045:
|
|
return "Error Error";
|
|
|
|
case 0xE8000046:
|
|
return "Executable Twiddle Failed Error";
|
|
|
|
case 0xE8000047:
|
|
return "Existence Check Failed Error";
|
|
|
|
case 0xE8000048:
|
|
return "Install Map Upfate Failed Error";
|
|
|
|
case 0xE8000049:
|
|
return "Manifest Capture Failed Error";
|
|
|
|
case 0xE800004A:
|
|
return "Map Generation Failed Error";
|
|
|
|
case 0xE800004B:
|
|
return "Missing Bundle Executable Error";
|
|
|
|
case 0xE800004C:
|
|
return "Missing Bundle Identifier Error";
|
|
|
|
case 0xE800004D:
|
|
return "Missing Bundle Path Error";
|
|
|
|
case 0xE800004E:
|
|
return "Missing Container Error";
|
|
|
|
case 0xE800004F:
|
|
return "Notification Failed Error";
|
|
|
|
case 0xE8000050:
|
|
return "Package Extraction Failed Error";
|
|
|
|
case 0xE8000051:
|
|
return "Package Inspection Failed Error";
|
|
|
|
case 0xE8000052:
|
|
return "Package Move Failed Error";
|
|
|
|
case 0xE8000053:
|
|
return "Path Conversion Failed Error";
|
|
|
|
case 0xE8000054:
|
|
return "Restore Container Failed Error";
|
|
|
|
case 0xE8000055:
|
|
return "Seatbelt Profile Removal Failed Error";
|
|
|
|
case 0xE8000056:
|
|
return "Stage Creation Failed Error";
|
|
|
|
case 0xE8000057:
|
|
return "Symlink Failed Error";
|
|
|
|
case 0xE8000058:
|
|
return "iTunes Artwork Capture Failed Error";
|
|
|
|
case 0xE8000059:
|
|
return "iTunes Metadata Capture Failed Error";
|
|
|
|
case 0xE800005A:
|
|
return "Already Archived Error";
|
|
|
|
case 0xE8008001:
|
|
return "Unknown code signature related error (0xE8008001); your executable may be missing or misnamed (e.g., underscore issue)";
|
|
|
|
case 0xE8008015:
|
|
return "No matching mobile provision for this application (0xE8008015). Please ensure the mobile provision used includes the target device.";
|
|
|
|
case 0xE8008016:
|
|
return "There is a problem with the entitlements for this application (0xE8008016).";
|
|
|
|
case 0xE8008017:
|
|
return "Unable to validate signature (there is a problem with a signed code resource) (0xE8008017)";
|
|
|
|
case 0xE8008018:
|
|
return "The identity used to sign the executable is no longer valid (0xE8008018)";
|
|
|
|
case 0xE8008019:
|
|
return "Missing or invalid code signature (0xE8008019)";
|
|
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|