rhodes 3.3.3.beta.4 → 3.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -5
- data/CREDITS +2215 -0
- data/Rakefile +225 -59
- data/bin/c2dm.rb +0 -0
- data/bin/get-rhodes-info.bat +0 -0
- data/bin/migrate-rhodes-app +0 -0
- data/bin/migrate-rhodes-app.bat +0 -0
- data/bin/rhodes +0 -0
- data/bin/rhodes-setup +0 -0
- data/bin/rhodes-setup.bat +0 -0
- data/bin/rhogen +0 -0
- data/bin/rhogen.bat +0 -0
- data/bin/set-rhodes-sdk +0 -0
- data/bin/set-rhodes-sdk.bat +0 -0
- data/bin/upgrade-rhodes-app +0 -0
- data/bin/upgrade-rhodes-app.bat +0 -0
- data/doc/build.txt +20 -9
- data/doc/configuration.txt +8 -8
- data/doc/connect-to-web-services.txt +1 -1
- data/doc/device-caps.txt +63 -26
- data/doc/extensions.txt +14 -2
- data/doc/install.txt +28 -19
- data/doc/introduction.txt +6 -3
- data/doc/jqt-jqm-transition.txt +10 -9
- data/doc/release.txt +5 -1
- data/doc/rhodes-command-line.txt +130 -0
- data/doc/rhom.txt +16 -11
- data/doc/rhostudio-eclipse.txt +3 -3
- data/doc/simulator.txt +28 -31
- data/doc/syncengine-ajax-api.txt +246 -0
- data/doc/synchronization.txt +21 -3
- data/doc/test-log-debug.txt +3 -1
- data/doc/ui.txt +16 -16
- data/ext/extconf.rb +8 -0
- data/lib/build/jake.rb +5 -5
- data/lib/extensions/barcode/ext/barcode/platform/android/Rakefile +9 -9
- data/lib/extensions/barcode/ext/barcode/platform/android/jni/src/barcode.cpp +81 -1
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/CaptureActivityHandler.java +6 -13
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/google/zxing/client/android/DecodeHandler.java +2 -6
- data/lib/extensions/barcode/ext/barcode/platform/android/src/com/rhomobile/barcode/Barcode.java +12 -1
- data/lib/extensions/barcode/ext/barcode/platform/bb/run.bat +0 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.h +2 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeCallbackHelper.mm +36 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.h +0 -0
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/BarcodeViewController.m +15 -5
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Classes/barcode.m +64 -1
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode.i +35 -1
- data/lib/extensions/barcode/ext/barcode/shared/ruby/barcode_wrap.c +126 -2
- data/lib/extensions/barcode/ext/barcode/shared/src/zbar.c +18 -1
- data/lib/extensions/barcode/ext/build +0 -0
- data/lib/extensions/barcode/ext/build.bat +0 -0
- data/lib/extensions/digest-md5/ext/Rakefile +12 -10
- data/lib/extensions/digest-md5/ext/build +0 -0
- data/lib/extensions/digest-md5/ext/build.bat +0 -0
- data/lib/extensions/digest-md5/ext/digest-md5.sln +2 -2
- data/lib/extensions/digest-md5/ext/digest-md5.vcproj +41 -28
- data/lib/extensions/digest-sha1/ext/Rakefile +11 -10
- data/lib/extensions/digest-sha1/ext/build +0 -0
- data/lib/extensions/digest-sha1/ext/build.bat +0 -0
- data/lib/extensions/digest-sha1/ext/digest-sha1.sln +2 -2
- data/lib/extensions/digest-sha1/ext/digest-sha1.vcproj +41 -28
- data/lib/extensions/digest/ext/Rakefile +12 -11
- data/lib/extensions/digest/ext/build +0 -0
- data/lib/extensions/digest/ext/build.bat +0 -0
- data/lib/extensions/digest/ext/digest.sln +44 -0
- data/lib/extensions/digest/ext/digest.vcproj +40 -27
- data/lib/extensions/esri/ext/build +0 -0
- data/lib/extensions/esri/ext/build.bat +0 -0
- data/lib/extensions/fcntl/ext/Rakefile +10 -9
- data/lib/extensions/fcntl/ext/build +0 -0
- data/lib/extensions/fcntl/ext/build.bat +0 -0
- data/lib/extensions/fcntl/ext/fcntl.vcproj +1 -1
- data/lib/extensions/nfc/ext/build +0 -0
- data/lib/extensions/nfc/ext/build.bat +0 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +11 -11
- data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +0 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +12 -10
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +16 -9
- data/lib/extensions/pdf-writer/color.rb +145 -0
- data/lib/extensions/pdf-writer/color/cmyk.rb +279 -0
- data/lib/extensions/pdf-writer/color/css.rb +28 -0
- data/lib/extensions/pdf-writer/color/grayscale.rb +212 -0
- data/lib/extensions/pdf-writer/color/hsl.rb +221 -0
- data/lib/extensions/pdf-writer/color/palette.rb +16 -0
- data/lib/extensions/pdf-writer/color/palette/adobecolor.rb +272 -0
- data/lib/extensions/pdf-writer/color/palette/gimp.rb +116 -0
- data/lib/extensions/pdf-writer/color/palette/monocontrast.rb +180 -0
- data/lib/extensions/pdf-writer/color/rgb-colors.rb +355 -0
- data/lib/extensions/pdf-writer/color/rgb.rb +453 -0
- data/lib/extensions/pdf-writer/color/rgb/metallic.rb +43 -0
- data/lib/extensions/pdf-writer/color/yiq.rb +84 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/color/Licence.txt +27 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/color/README.txt +32 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/pdf-writer/LICENCE +131 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/pdf-writer/README +33 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/transaction-simple/Licence.txt +25 -0
- data/lib/extensions/pdf-writer/ext/LICENSES/transaction-simple/Readme.txt +204 -0
- data/lib/extensions/pdf-writer/pdf/charts.rb +13 -0
- data/lib/extensions/pdf-writer/pdf/charts/stddev.rb +430 -0
- data/lib/extensions/pdf-writer/pdf/math.rb +108 -0
- data/lib/extensions/pdf-writer/pdf/quickref.rb +332 -0
- data/lib/extensions/pdf-writer/pdf/simpletable.rb +947 -0
- data/lib/extensions/pdf-writer/pdf/techbook.rb +901 -0
- data/lib/extensions/pdf-writer/pdf/writer.rb +2729 -0
- data/lib/extensions/pdf-writer/pdf/writer/arc4.rb +63 -0
- data/lib/extensions/pdf-writer/pdf/writer/fontmetrics.rb +203 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Courier-Bold.afm +342 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Courier-BoldOblique.afm +342 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Courier-Oblique.afm +342 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Courier.afm +342 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Helvetica-Bold.afm +2827 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Helvetica-BoldOblique.afm +2827 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Helvetica-Oblique.afm +3051 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Helvetica.afm +3051 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/MustRead.html +19 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Symbol.afm +213 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Times-Bold.afm +2588 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Times-BoldItalic.afm +2384 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Times-Italic.afm +2667 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/Times-Roman.afm +2419 -0
- data/lib/extensions/pdf-writer/pdf/writer/fonts/ZapfDingbats.afm +225 -0
- data/lib/extensions/pdf-writer/pdf/writer/graphics.rb +813 -0
- data/lib/extensions/pdf-writer/pdf/writer/graphics/imageinfo.rb +365 -0
- data/lib/extensions/pdf-writer/pdf/writer/lang.rb +43 -0
- data/lib/extensions/pdf-writer/pdf/writer/lang/en.rb +99 -0
- data/lib/extensions/pdf-writer/pdf/writer/object.rb +23 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/action.rb +35 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/annotation.rb +42 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/catalog.rb +39 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/contents.rb +65 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/destination.rb +40 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/encryption.rb +53 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/font.rb +72 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/fontdescriptor.rb +34 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/fontencoding.rb +40 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/image.rb +304 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/info.rb +51 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/outline.rb +30 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/outlines.rb +30 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/page.rb +195 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/pages.rb +115 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/procset.rb +46 -0
- data/lib/extensions/pdf-writer/pdf/writer/object/viewerpreferences.rb +74 -0
- data/lib/extensions/pdf-writer/pdf/writer/ohash.rb +58 -0
- data/lib/extensions/pdf-writer/pdf/writer/oreader.rb +25 -0
- data/lib/extensions/pdf-writer/pdf/writer/state.rb +48 -0
- data/lib/extensions/pdf-writer/pdf/writer/strokestyle.rb +138 -0
- data/lib/extensions/pdf-writer/transaction/simple.rb +486 -0
- data/lib/extensions/pdf-writer/transaction/simple/group.rb +146 -0
- data/lib/extensions/pdf-writer/transaction/simple/threadsafe.rb +68 -0
- data/lib/extensions/pdf-writer/transaction/simple/threadsafe/group.rb +36 -0
- data/lib/framework/builtinME.rb +0 -0
- data/lib/framework/dateOrig.rb +8 -2
- data/lib/framework/rational.rb +0 -0
- data/lib/framework/res/esri.wm.png +0 -0
- data/lib/framework/rho/rho.rb +6 -0
- data/lib/framework/rho/rhobluetooth.rb +0 -0
- data/lib/framework/rho/rhofsconnector.rb +0 -0
- data/lib/framework/rho/rhonativeviewmanager.rb +0 -0
- data/lib/framework/rhofsconnector.rb +0 -0
- data/lib/framework/rhom/rhom_object_factory.rb +8 -0
- data/lib/framework/rhomotoapi.rb +3 -2
- data/platform/android/Rhodes/jni/include/rhodes/JNIRhodes.h +9 -1
- data/platform/android/Rhodes/jni/include/rhodes/details/rhojava.inc +1 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_file_RhoFileApi.h +26 -2
- data/platform/android/Rhodes/jni/src/callbacks.cpp +0 -5
- data/platform/android/Rhodes/jni/src/camera.cpp +1 -1
- data/platform/android/Rhodes/jni/src/fileapi.cpp +39 -19
- data/platform/android/Rhodes/jni/src/geolocation.cpp +3 -3
- data/platform/android/Rhodes/jni/src/mapview.cpp +206 -64
- data/platform/android/Rhodes/jni/src/nativeview.cpp +1 -1
- data/platform/android/Rhodes/jni/src/rhodes.cpp +13 -0
- data/platform/android/Rhodes/jni/src/rhodesapp.cpp +20 -0
- data/platform/android/Rhodes/jni/src/rhodessystem.cpp +36 -3
- data/platform/android/Rhodes/jni/src/signature.cpp +22 -2
- data/platform/android/Rhodes/res/drawable/alert_info.png +0 -0
- data/platform/android/Rhodes/res/drawable/esri.png +0 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +17 -16
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Logger.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/MemoryInfoCollector.java +67 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +139 -114
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +106 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +11 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +71 -16
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraNewService.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/CameraSemiService.java +4 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/AbstractRhoExtension.java +22 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/Config.java +243 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtManager.java +19 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/IRhoExtension.java +9 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/{RhodesActivityListener.java → extmanager/IRhoListener.java} +16 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManager.java +63 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhoExtManagerImpl.java +239 -14
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/RhodesStartupListeners.java +9 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/extmanager/WebkitExtension.java +53 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +27 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +124 -62
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +49 -137
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +84 -114
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SplashScreen.java +75 -82
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +3 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/Callout.java +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapBitmapManager.java +124 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +232 -43
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/Request.java +193 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/IRhoCustomView.java +13 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoNativeViewManager.java +32 -23
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/nativeview/RhoVideoView.java +74 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality.java +6 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality01.java +37 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality03.java +14 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality05.java +51 -38
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality07.java +9 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionality08.java +48 -31
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/osfunctionality/AndroidFunctionalityManager.java +15 -16
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/Signature.java +52 -15
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/LocalFileHandler.java +20 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientOld.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/GoogleWebView.java +77 -34
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/IRhoWebView.java +9 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebChromeClient.java +105 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebViewClient.java +1 -1
- data/platform/android/build/RhodesSRC_build.files +8 -7
- data/platform/android/build/android.rake +326 -216
- data/platform/android/build/androidcommon.rb +27 -13
- data/platform/bb/RubyVM/src/com/rho/file/SimpleFile.java +27 -1
- data/platform/bb/RubyVM/src/j2me/io/File.java +104 -38
- data/platform/bb/build/bb.rake +1 -0
- data/platform/bb/build/runRAPC.bat +0 -0
- data/platform/bb/rhodes/resources/background.png +0 -0
- data/platform/bb/rhodes/resources/esri.png +0 -0
- data/platform/bb/rhodes/resources/mappin.png +0 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +5 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +2 -2
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapField.java +0 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/ESRIMapProvider.java +0 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GeoCoding.java +0 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleGeoCoding.java +0 -0
- data/platform/bb/rhodes/src/rhomobile/mapview/MapTools.java +0 -0
- data/platform/iphone/Classes/AppManager/AppManager.m +7 -1
- data/platform/iphone/Classes/Camera/PickImageDelegate.h +9 -0
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +75 -4
- data/platform/iphone/Classes/GeoLocation/LocationController.h +8 -2
- data/platform/iphone/Classes/GeoLocation/LocationController.m +74 -76
- data/platform/iphone/Classes/InitMemoryInfoCollector.h +33 -0
- data/platform/iphone/Classes/InitMemoryInfoCollector.mm +52 -0
- data/platform/iphone/Classes/NativeView/NVViewController.h +0 -0
- data/platform/iphone/Classes/NativeView/NVViewController.m +34 -2
- data/platform/iphone/Classes/Rhodes.m +22 -2
- data/platform/iphone/Classes/Signature/SignatureDelegate.m +19 -0
- data/platform/iphone/Classes/Signature/SignatureViewController.h +0 -0
- data/platform/iphone/Classes/Signature/SignatureViewController.m +0 -0
- data/platform/iphone/Classes/SimpleMainView.h +0 -0
- data/platform/iphone/Classes/SimpleMainView.m +3 -3
- data/platform/iphone/ESRI/BluePushpin.png +0 -0
- data/platform/iphone/ESRI/BluePushpin@2x.png +0 -0
- data/platform/iphone/ESRI/esri.png +0 -0
- data/platform/iphone/ESRI/esri@2x.png +0 -0
- data/platform/iphone/rbuild/iphone.rake +75 -7
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +13 -4
- data/platform/linux/target/compiler/rubylinux +0 -0
- data/platform/mac/target/compiler/RubyMac +0 -0
- data/platform/osx/Rhodes Launcher/rhorunner.app/rhorunner b/data/platform/osx/Rhodes → Launcher/rhorunner.app/rhorunner +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtCore.framework/Versions/4/QtCore +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtGui.framework/Resources/qt_menu.nib/keyedobjects.nib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtGui.framework/Versions/4/QtGui +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtNetwork.framework/Versions/4/QtNetwork +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/QtWebKit.framework/Versions/4/QtWebKit +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Info.plist +1 -1
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/MacOS/RhoSimulator +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/accessible/libqtaccessiblewidgets.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqcorewlanbearer.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/bearer/libqgenericbearer.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqcncodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqjpcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqkrcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/codecs/libqtwcodecs.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/graphicssystems/libqtracegraphicssystem.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqgif.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqico.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqjpeg.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqmng.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqtga.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/imageformats/libqtiff.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libqmldbg_inspector.dylib +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/qmltooling/libqmldbg_tcp.dylib +0 -0
- data/platform/osx/build/osx.rake +6 -8
- data/platform/shared/RhoConnectClient/RhoConnectClient.cpp +165 -33
- data/platform/shared/RhoConnectClient/RhoConnectClient.h +10 -1
- data/platform/shared/common/BundleManager.cpp +27 -16
- data/platform/shared/common/ExtManager.h +15 -2
- data/platform/shared/common/RhoConf.cpp +17 -2
- data/platform/shared/common/RhoConf.h +3 -1
- data/platform/shared/common/RhoDefs.h +6 -6
- data/platform/shared/common/RhoFatalError.h +1 -1
- data/platform/shared/common/RhoFile.cpp +9 -9
- data/platform/shared/common/RhoFilePath.h +7 -3
- data/platform/shared/common/RhoPort.h +3 -3
- data/platform/shared/common/RhoSystem.h +1 -1
- data/platform/shared/common/RhodesApp.cpp +426 -26
- data/platform/shared/common/RhodesApp.h +11 -3
- data/platform/shared/common/RhodesAppBase.cpp +4 -1
- data/platform/shared/common/StringConverter.h +3 -3
- data/platform/shared/common/app_build_capabilities.h +8 -0
- data/platform/shared/common/map/BaseMapEngine.cpp +302 -21
- data/platform/shared/common/map/BaseMapEngine.h +132 -6
- data/platform/shared/common/map/ESRIMapEngine.cpp +2 -1
- data/platform/shared/common/map/GeocodingMapEngine.cpp +22 -4
- data/platform/shared/common/map/GeocodingMapEngine.h +40 -0
- data/platform/shared/common/map/GoogleMapEngine.cpp +13 -1
- data/platform/shared/common/map/MapEngine.h +7 -0
- data/platform/shared/common/map/OSMMapEngine.cpp +12 -1
- data/platform/shared/json/JSONIterator.cpp +1 -1
- data/platform/shared/json/RJSONTokener.c +2 -0
- data/platform/shared/json/config.h +3 -3
- data/platform/shared/logging/RhoLog.cpp +12 -3
- data/platform/shared/logging/RhoLog.h +2 -1
- data/platform/shared/logging/RhoLogConf.cpp +147 -11
- data/platform/shared/logging/RhoLogConf.h +39 -1
- data/platform/shared/logging/RhoLogSink.cpp +1 -1
- data/platform/shared/net/HttpServer.cpp +8 -4
- data/platform/shared/net/INetRequest.cpp +7 -0
- data/platform/shared/net/INetRequest.h +2 -0
- data/platform/shared/net/RawSocket.cpp +1 -1
- data/platform/shared/qt/pbxproj2pro.pl +0 -0
- data/platform/shared/qt/pro_vcproj_diff.pl +0 -0
- data/platform/shared/qt/rhodes/QtMainWindow.cpp +1 -1
- data/platform/shared/qt/rhodes/impl/RhoClassFactoryImpl.h +2 -2
- data/platform/shared/qt/rhodes/impl/RhoThreadImpl.cpp +2 -2
- data/platform/shared/qt/rhodes/impl/SystemImpl.cpp +11 -1
- data/platform/shared/qt/rhodes/main.cpp +5 -5
- data/platform/shared/ruby/ext/alert/alert_wrap.c +8 -8
- data/platform/shared/ruby/ext/bluetooth/bluetooth.i +0 -0
- data/platform/shared/ruby/ext/bluetooth/bluetooth_wrap.c +16 -9
- data/platform/shared/ruby/ext/camera/camera.i +2 -2
- data/platform/shared/ruby/ext/camera/camera_wrap.c +18 -3
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +37 -8
- data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +8 -8
- data/platform/shared/ruby/ext/mapview/mapview_wrap.c +16 -9
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +16 -9
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager.i +0 -0
- data/platform/shared/ruby/ext/nativeviewmanager/nativeviewmanager_wrap.c +16 -9
- data/platform/shared/ruby/ext/phonebook/phonebook_wrap.c +8 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +7 -1
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +16 -9
- data/platform/shared/ruby/ext/signature/signature.i +0 -0
- data/platform/shared/ruby/ext/signature/signature_wrap.c +9 -9
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +16 -9
- data/platform/shared/ruby/ext/system/system_wrap.c +16 -9
- data/platform/shared/ruby/ext/webview/webview_wrap.c +16 -9
- data/platform/shared/ruby/gc.c +1 -0
- data/platform/shared/ruby/regint.h +6 -4
- data/platform/shared/ruby/vm.c +1 -0
- data/platform/shared/ruby/wince/wince.h +1 -1
- data/platform/shared/rubyext/System.cpp +1 -1
- data/platform/shared/shttpd/src/rdispatcher.c +3 -3
- data/platform/shared/shttpd/src/std_includes.h +1 -1
- data/platform/shared/sqlite/sqlite3.c +1 -0
- data/platform/shared/statistic/test/TestProfiling.cpp +1 -1
- data/platform/shared/stlport/build/lib/configure +0 -0
- data/platform/shared/stlport/build/lib/configure.bat +0 -0
- data/platform/shared/sync/SyncEngine.cpp +9 -12
- data/platform/shared/sync/SyncNotify.cpp +36 -3
- data/platform/shared/sync/SyncNotify.h +11 -4
- data/platform/shared/sync/SyncSource.cpp +32 -16
- data/platform/shared/sync/SyncSource.h +2 -3
- data/platform/shared/sync/SyncThread.cpp +13 -4
- data/platform/shared/sync/SyncThread.h +4 -0
- data/platform/shared/tcmalloc/page_heap.h +1 -1
- data/platform/shared/tcmalloc/rhomem.h +1 -1
- data/platform/shared/tcmalloc/windows/port.cpp +12 -3
- data/platform/shared/test/Tests.cpp +4 -4
- data/platform/shared/test/test_helper.cpp +4 -4
- data/platform/symbian/sqlite3/src/sqlite3.h +1 -1
- data/platform/win32/RhoSimulator/Microsoft.VC90.CRT.manifest +6 -0
- data/platform/win32/RhoSimulator/Microsoft.VC90.OpenMP.manifest +6 -0
- data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
- data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
- data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
- data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qico4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qmng4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qsvg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qtiff4.dll +0 -0
- data/platform/win32/RhoSimulator/libeay32.dll +0 -0
- data/platform/win32/RhoSimulator/msvcm90.dll +0 -0
- data/platform/win32/RhoSimulator/msvcp90.dll +0 -0
- data/platform/win32/RhoSimulator/msvcr90.dll +0 -0
- data/platform/win32/RhoSimulator/phonon4.dll +0 -0
- data/platform/win32/RhoSimulator/ssleay32.dll +0 -0
- data/platform/win32/RhoSimulator/vcomp90.dll +0 -0
- data/platform/win32/target/replaceicon/replaceicon.exe +0 -0
- data/platform/win32/target/updateresstring/updateresstring.exe +0 -0
- data/platform/wm/RhoLib/RhoLib.vcproj +394 -69
- data/platform/wm/build/build_inf.js +83 -23
- data/platform/wm/build/wm.rake +127 -81
- data/platform/wm/rhodes.sln +6 -6
- data/platform/wm/rhodes/DateTimePicker.h +2 -2
- data/platform/wm/rhodes/IBrowserEngine.h +3 -0
- data/platform/wm/rhodes/IEBrowserEngine.cpp +34 -2
- data/platform/wm/rhodes/IEBrowserEngine.h +4 -1
- data/platform/wm/rhodes/LicenseStub.cpp +73 -0
- data/platform/{android/Rhodes/src/com/rhomobile/rhodes/webview/ChromeClientNew.java → wm/rhodes/LogMemory.cpp} +32 -20
- data/platform/{android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettings.java → wm/rhodes/LogMemory.h} +11 -8
- data/platform/wm/rhodes/LogOptionsDlg.h +1 -1
- data/platform/wm/rhodes/LogView.cpp +10 -10
- data/platform/wm/rhodes/LogView.h +10 -10
- data/platform/wm/rhodes/MainWindow.cpp +431 -173
- data/platform/wm/rhodes/MainWindow.h +37 -19
- data/platform/wm/rhodes/MapView/MapViewManager.h +1 -1
- data/platform/wm/rhodes/OkCancelModalDialog.h +1 -1
- data/platform/wm/rhodes/Rhodes.cpp +210 -47
- data/platform/wm/rhodes/Rhodes.rc +38 -0
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +2 -2
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +3 -3
- data/platform/wm/rhodes/camera/Camera.cpp +2 -1
- data/platform/wm/rhodes/camera/Camera.h +1 -1
- data/platform/wm/rhodes/resource.h +1 -1
- data/platform/wm/rhodes/rho/common/ExtManager.cpp +93 -5
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +2 -2
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +2 -2
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +13 -7
- data/platform/wm/rhodes/rhodes.vcproj +1409 -1008
- data/platform/wm/rhodes/simulator/MainWindowQt.h +1 -1
- data/platform/wm/rhodes/stdafx.h +2 -2
- data/platform/wm/rhoelements.sln +7 -9
- data/platform/wm/rubylib/rubylib.vcproj +62 -1
- data/platform/wm/sqlite3/sqlite3.vcproj +62 -1
- data/platform/wm/syncengine/syncengine.vcproj +62 -1
- data/platform/wm/tcmalloc/tcmalloc.vcproj +72 -53
- data/platform/wm/tools/detool/detool.cpp +1435 -1357
- data/platform/wp7/RhoRubyExtGen/GenerateInitializers.cmd +0 -0
- data/platform/wp7/RhoRubyLib/common/RhoLicense.cs +105 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +23 -5
- data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +5 -0
- data/platform/wp7/RhoRubyLib/views/RhoView.xaml.cs +22 -3
- data/platform/wp7/build/wp.rake +1 -0
- data/platform/wp7/rhodes/MainPage.xaml.cs +11 -0
- data/rakefile.rb +225 -59
- data/res/build-tools/7za.exe +0 -0
- data/res/build-tools/RhoAppRunner.exe +0 -0
- data/res/build-tools/RhoLogServer.exe +0 -0
- data/res/build-tools/RhoRuby.exe +0 -0
- data/res/build-tools/RubyMac +0 -0
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/iphonesim/Source/iPhoneSimulator.m +1 -1
- data/res/build-tools/iphonesim/build/Release/iphonesim +0 -0
- data/res/build-tools/iphonesim/build/Release/iphonesim_43 +0 -0
- data/res/build-tools/license_rc.dll +0 -0
- data/res/build-tools/make.exe +0 -0
- data/res/build-tools/rubylinux +0 -0
- data/res/build-tools/swig_patch/Lib/typemaps/fragments.swg +235 -0
- data/res/build-tools/wmdc_connect.exe +0 -0
- data/res/build-tools/wp7explorer.exe +0 -0
- data/res/generators/rhogen.rb +2 -2
- data/res/generators/templates/application/app/Settings/controller.rb +1 -1
- data/res/generators/templates/application/app/layout.erb +1 -1
- data/res/generators/templates/application/app/loading.png +0 -0
- data/res/generators/templates/application/public/css/re_webkit.css +736 -0
- data/res/generators/templates/application/public/css/windows_mobile.css +0 -0
- data/res/generators/templates/application/public/images/listArrow.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/ajax-loader.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
- data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
- data/res/generators/templates/application/public/js/syncengine.js +409 -52
- data/res/generators/templates/extension/extensions/montana/ext/build +0 -0
- data/res/generators/templates/extension/extensions/montana/ext/build.bat +0 -0
- data/res/generators/templates/extension/extensions/montana/ext/montana/platform/android/Rakefile +10 -10
- data/res/generators/templates/spec/app/SpecRunner/controller.rb +2 -0
- data/res/libs/motorolalicence/android/MotorolaLicence.h +13 -0
- data/res/libs/motorolalicence/android/libMotorolaLicence.a +0 -0
- data/res/libs/motorolalicence/iphone/MotorolaLicence.h +13 -0
- data/res/libs/motorolalicence/iphone/libMotorolaLicence.a +0 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/SpecRunner/controller.rb +2 -0
- data/spec/phone_spec/app/SpecRunner/controller.rb +2 -0
- data/version +1 -1
- metadata +487 -412
- data/Manifest.txt +0 -7960
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityStartupListeners.java +0 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsNew.java +0 -52
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/webview/RhoWebSettingsOld.java +0 -62
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/Frameworks/phonon.framework/Versions/4/phonon +0 -0
- data/platform/osx/bin/RhoSimulator/RhoSimulator.app/Contents/PlugIns/phonon_backend/libphonon_qt7.dylib +0 -0
- data/platform/win32/RhoSimulator/Microsoft.VC80.CRT.manifest +0 -8
- data/platform/win32/RhoSimulator/Microsoft.VC80.OpenMP.manifest +0 -7
- data/platform/win32/RhoSimulator/msvcm80.dll +0 -0
- data/platform/win32/RhoSimulator/msvcp80.dll +0 -0
- data/platform/win32/RhoSimulator/msvcr80.dll +0 -0
- data/platform/win32/RhoSimulator/vcomp.dll +0 -0
- data/rhomobile-debug-1.0.6.gem +0 -0
@@ -1,769 +1,824 @@
|
|
1
|
-
/*------------------------------------------------------------------------
|
2
|
-
* (The MIT License)
|
3
|
-
*
|
4
|
-
* Copyright (c) 2008-2011 Rhomobile, Inc.
|
5
|
-
*
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
11
|
-
* furnished to do so, subject to the following conditions:
|
12
|
-
*
|
13
|
-
* The above copyright notice and this permission notice shall be included in
|
14
|
-
* all copies or substantial portions of the Software.
|
15
|
-
*
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
-
* THE SOFTWARE.
|
23
|
-
*
|
24
|
-
* http://rhomobile.com
|
25
|
-
*------------------------------------------------------------------------*/
|
26
|
-
|
27
|
-
#include "stdafx.h"
|
28
|
-
|
29
|
-
#include <rapi.h>
|
30
|
-
#include <strsafe.h>
|
31
|
-
|
32
|
-
#include "detool.h"
|
33
|
-
#include "LogServer.h"
|
34
|
-
|
35
|
-
#define RHOSETUP_DLL "rhosetup.dll"
|
36
|
-
#define RE2_RUNTIME TEXT("\\Program Files\\
|
37
|
-
|
38
|
-
TCHAR *app_name = NULL;
|
39
|
-
|
40
|
-
void checkMDEstart(HRESULT hr)
|
41
|
-
{
|
42
|
-
if (FAILED(hr)) {
|
43
|
-
if (hr == REGDB_E_CLASSNOTREG) {
|
44
|
-
printf ("Microsoft Device Emulator is too old or corrupted. Please update it.\n");
|
45
|
-
printf ("You could get the latest version on:\n");
|
46
|
-
printf ("http://www.microsoft.com/downloads/details.aspx?familyid=a6f6adaf-12e3-4b2f-a394-356e2c2fb114\n");
|
47
|
-
} else {
|
48
|
-
wprintf_s(L"Error: Unable to instantiate DeviceEmulatorManager. ErrorCode=0x%08X\n", hr);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
DWORD WINAPI startDEM(LPVOID lpParam)
|
54
|
-
{
|
55
|
-
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) {
|
56
|
-
HRESULT hr = 0;
|
57
|
-
|
58
|
-
CComPtr<IDeviceEmulatorManager> pDeviceEmulatorManager;
|
59
|
-
hr = pDeviceEmulatorManager.CoCreateInstance(__uuidof(DeviceEmulatorManager));
|
60
|
-
if (FAILED(hr)) {
|
61
|
-
checkMDEstart(hr);
|
62
|
-
ExitProcess(EXIT_FAILURE);
|
63
|
-
return hr;
|
64
|
-
}
|
65
|
-
|
66
|
-
pDeviceEmulatorManager->ShowManagerUI(false);
|
67
|
-
while (1) {
|
68
|
-
Sleep(600 * 1000);
|
69
|
-
}
|
70
|
-
return hr;
|
71
|
-
CoUninitialize();
|
72
|
-
}
|
73
|
-
return 0;
|
74
|
-
}
|
75
|
-
|
76
|
-
BOOL FindDevice(const CComBSTR& deviceIdentifier, IDeviceEmulatorManagerVMID** pDeviceVMID)
|
77
|
-
{
|
78
|
-
HRESULT hr;
|
79
|
-
|
80
|
-
CComPtr<IDeviceEmulatorManager> pDeviceEmulatorManager;
|
81
|
-
hr = pDeviceEmulatorManager.CoCreateInstance(__uuidof(DeviceEmulatorManager));
|
82
|
-
if (FAILED(hr)) {
|
83
|
-
wprintf(L"Error: Unable to instantiate DeviceEmulatorManager. ErrorCode=0x%08X\n", hr);
|
84
|
-
return FALSE;
|
85
|
-
}
|
86
|
-
|
87
|
-
for (; SUCCEEDED(hr); (hr = pDeviceEmulatorManager->MoveNext()))
|
88
|
-
{
|
89
|
-
CComPtr<IEnumManagerSDKs> pSDKEnumerator;
|
90
|
-
|
91
|
-
hr = pDeviceEmulatorManager->EnumerateSDKs(&pSDKEnumerator);
|
92
|
-
if (FAILED(hr)) {
|
93
|
-
continue;
|
94
|
-
}
|
95
|
-
|
96
|
-
for (; SUCCEEDED(hr); (hr = pSDKEnumerator->MoveNext())) {
|
97
|
-
CComPtr<IEnumVMIDs> pDeviceEnumerator;
|
98
|
-
hr = pSDKEnumerator->EnumerateVMIDs(&pDeviceEnumerator);
|
99
|
-
if (FAILED(hr)) {
|
100
|
-
continue;
|
101
|
-
}
|
102
|
-
|
103
|
-
for (; SUCCEEDED(hr); (hr = pDeviceEnumerator->MoveNext())) {
|
104
|
-
CComBSTR deviceName;
|
105
|
-
CComBSTR deviceVMID;
|
106
|
-
CComPtr<IDeviceEmulatorManagerVMID> pDevice;
|
107
|
-
|
108
|
-
hr = pDeviceEnumerator->GetVMID(&pDevice);
|
109
|
-
if (FAILED(hr)) {
|
110
|
-
continue;
|
111
|
-
}
|
112
|
-
|
113
|
-
hr = pDevice->get_Name(&deviceName);
|
114
|
-
if (FAILED(hr)){
|
115
|
-
continue;
|
116
|
-
}
|
117
|
-
|
118
|
-
hr = pDevice->get_VMID(&deviceVMID);
|
119
|
-
if (FAILED(hr)){
|
120
|
-
continue;
|
121
|
-
}
|
122
|
-
|
123
|
-
if (deviceIdentifier == deviceName || deviceIdentifier == deviceVMID){
|
124
|
-
*pDeviceVMID = pDevice;
|
125
|
-
(*pDeviceVMID)->AddRef();
|
126
|
-
return TRUE;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
wprintf(L"Error: Unable to locate the device '%s'", deviceIdentifier);
|
133
|
-
return FALSE;
|
134
|
-
}
|
135
|
-
|
136
|
-
bool emuConnect(const CComBSTR& deviceIdentifier)
|
137
|
-
{
|
138
|
-
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
139
|
-
|
140
|
-
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
141
|
-
if (bFound && pDevice){
|
142
|
-
HRESULT hr = pDevice->Connect();
|
143
|
-
if (!SUCCEEDED(hr)) {
|
144
|
-
wprintf(L"Error: Operation Connect failed. Hr=0x%x\n", hr);
|
145
|
-
return false;
|
146
|
-
}
|
147
|
-
return true;
|
148
|
-
}
|
149
|
-
return false;
|
150
|
-
}
|
151
|
-
|
152
|
-
bool emuBringToFront(const CComBSTR& deviceIdentifier)
|
153
|
-
{
|
154
|
-
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
155
|
-
|
156
|
-
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
157
|
-
if (bFound && pDevice){
|
158
|
-
HRESULT hr = pDevice->BringToFront();
|
159
|
-
if (!SUCCEEDED(hr)) {
|
160
|
-
wprintf(L"Error: Operation BringToFront failed. Hr=0x%x\n", hr);
|
161
|
-
return false;
|
162
|
-
}
|
163
|
-
return true;
|
164
|
-
}
|
165
|
-
return false;
|
166
|
-
}
|
167
|
-
|
168
|
-
bool emuCradle(const CComBSTR& deviceIdentifier)
|
169
|
-
{
|
170
|
-
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
171
|
-
|
172
|
-
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
173
|
-
if (bFound && pDevice){
|
174
|
-
HRESULT hr = pDevice->Cradle();
|
175
|
-
if (!SUCCEEDED(hr)) {
|
176
|
-
wprintf(L"Error: Operation Cradle failed. Hr=0x%x\n", hr);
|
177
|
-
return false;
|
178
|
-
}
|
179
|
-
return true;
|
180
|
-
}
|
181
|
-
return false;
|
182
|
-
}
|
183
|
-
|
184
|
-
bool emuUncradle(const CComBSTR& deviceIdentifier)
|
185
|
-
{
|
186
|
-
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
187
|
-
|
188
|
-
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
189
|
-
|
190
|
-
if (bFound && pDevice){
|
191
|
-
HRESULT hr = pDevice->UnCradle();
|
192
|
-
if (!SUCCEEDED(hr)) {
|
193
|
-
wprintf(L"Error: Operation UnCradle failed. Hr=0x%x\n", hr);
|
194
|
-
return false;
|
195
|
-
}
|
196
|
-
return true;
|
197
|
-
}
|
198
|
-
|
199
|
-
return false;
|
200
|
-
}
|
201
|
-
|
202
|
-
bool emuReset(const CComBSTR& deviceIdentifier)
|
203
|
-
{
|
204
|
-
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
205
|
-
|
206
|
-
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
207
|
-
if (bFound && pDevice){
|
208
|
-
HRESULT hr = pDevice->Reset(TRUE);
|
209
|
-
if (!SUCCEEDED(hr)) {
|
210
|
-
wprintf(L"Error: Operation ResetEmulator failed. Hr=0x%x\n", hr);
|
211
|
-
return false;
|
212
|
-
}
|
213
|
-
return true;
|
214
|
-
}
|
215
|
-
return false;
|
216
|
-
}
|
217
|
-
|
218
|
-
bool emuShutdown(const CComBSTR& deviceIdentifier)
|
219
|
-
{
|
220
|
-
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
221
|
-
|
222
|
-
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
223
|
-
if (bFound && pDevice){
|
224
|
-
HRESULT hr = pDevice->Shutdown(FALSE);
|
225
|
-
if (!SUCCEEDED(hr)) {
|
226
|
-
wprintf(L"Error: Operation Shutdown failed. Hr=0x%x\n", hr);
|
227
|
-
return false;
|
228
|
-
}
|
229
|
-
return true;
|
230
|
-
}
|
231
|
-
return false;
|
232
|
-
}
|
233
|
-
|
234
|
-
bool wceConnect (void)
|
235
|
-
{
|
236
|
-
HRESULT hRapiResult;
|
237
|
-
|
238
|
-
//_tprintf( TEXT("Connecting to Windows CE..."));
|
239
|
-
hRapiResult = CeRapiInit();
|
240
|
-
if (FAILED(hRapiResult)) {
|
241
|
-
_tprintf( TEXT("Failed\n"));
|
242
|
-
return false;
|
243
|
-
}
|
244
|
-
//_tprintf( TEXT("Success\n"));
|
245
|
-
|
246
|
-
return true;
|
247
|
-
|
248
|
-
/*
|
249
|
-
RAPIINIT riCopy = {sizeof(RAPIINIT), 0, 0};
|
250
|
-
bool fInitialized = false;
|
251
|
-
DWORD dwTimeOut = 5000;
|
252
|
-
|
253
|
-
CeRapiUninit();
|
254
|
-
|
255
|
-
hRapiResult = CeRapiInitEx(&riCopy);
|
256
|
-
|
257
|
-
if (FAILED(hRapiResult)) {
|
258
|
-
return false;
|
259
|
-
}
|
260
|
-
|
261
|
-
DWORD dwRapiInit = 0;
|
262
|
-
|
263
|
-
dwRapiInit = WaitForSingleObject(
|
264
|
-
riCopy.heRapiInit,
|
265
|
-
dwTimeOut);
|
266
|
-
|
267
|
-
if (WAIT_OBJECT_0 == dwRapiInit) {
|
268
|
-
// heRapiInit signaled:
|
269
|
-
// set return error code to return value of RAPI Init function
|
270
|
-
hRapiResult = riCopy.hrRapiInit;
|
271
|
-
} else if (WAIT_TIMEOUT == dwRapiInit) {
|
272
|
-
// timed out: device is probably not connected
|
273
|
-
// or not responding
|
274
|
-
hRapiResult = HRESULT_FROM_WIN32(ERROR_TIMEOUT);
|
275
|
-
} else {
|
276
|
-
// WaitForSingleObject failed
|
277
|
-
hRapiResult = HRESULT_FROM_WIN32(GetLastError());
|
278
|
-
}
|
279
|
-
|
280
|
-
if (FAILED(hRapiResult)) {
|
281
|
-
CeRapiUninit();
|
282
|
-
return false;
|
283
|
-
}
|
284
|
-
return true;
|
285
|
-
*/
|
286
|
-
}
|
287
|
-
|
288
|
-
void wceDisconnect(void)
|
289
|
-
{
|
290
|
-
//_tprintf( TEXT("Closing connection to Windows CE..."));
|
291
|
-
CeRapiUninit();
|
292
|
-
//_tprintf( TEXT("Done\n"));
|
293
|
-
}
|
294
|
-
|
295
|
-
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
|
296
|
-
|
297
|
-
|
298
|
-
bool wcePutFile(const char *host_file, const char *wce_file)
|
299
|
-
{
|
300
|
-
TCHAR tszSrcFile[MAX_PATH];
|
301
|
-
WCHAR wszDestFile[MAX_PATH];
|
302
|
-
BYTE buffer[5120];
|
303
|
-
WIN32_FIND_DATA wfd;
|
304
|
-
HRESULT hr;
|
305
|
-
DWORD dwAttr, dwNumRead, dwNumWritten;
|
306
|
-
HANDLE hSrc, hDest, hFind;
|
307
|
-
int nResult;
|
308
|
-
|
309
|
-
#ifdef UNICODE
|
310
|
-
nResult = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
|
311
|
-
host_file, strlen(host_file)+1,
|
312
|
-
tszSrcFile, ARRAYSIZE(tszSrcFile));
|
313
|
-
if(0 == nResult)
|
314
|
-
return false;
|
315
|
-
#else
|
316
|
-
hr = StringCchCopy(tszSrcFile, ARRAYSIZE(tszSrcFile), argv[1]);
|
317
|
-
if(FAILED(hr))
|
318
|
-
return false;
|
319
|
-
#endif
|
320
|
-
nResult = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
|
321
|
-
wce_file, strlen(wce_file)+1,
|
322
|
-
wszDestFile, ARRAYSIZE(wszDestFile));
|
323
|
-
if(0 == nResult)
|
324
|
-
return false;
|
325
|
-
|
326
|
-
hFind = FindFirstFile( tszSrcFile, &wfd);
|
327
|
-
if (INVALID_HANDLE_VALUE == hFind) {
|
328
|
-
_tprintf(TEXT("Host file does not exist\n"));
|
329
|
-
return false;
|
330
|
-
}
|
331
|
-
FindClose( hFind);
|
332
|
-
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
333
|
-
_tprintf( TEXT("Host file specifies a directory\n"));
|
334
|
-
return false;
|
335
|
-
}
|
336
|
-
|
337
|
-
if (wceConnect()) {
|
338
|
-
dwAttr = CeGetFileAttributes( wszDestFile);
|
339
|
-
if (dwAttr & FILE_ATTRIBUTE_DIRECTORY) {
|
340
|
-
hr = StringCchCatW(wszDestFile, ARRAYSIZE(wszDestFile), L"\\");
|
341
|
-
if(FAILED(hr)) return false;
|
342
|
-
#ifdef UNICODE
|
343
|
-
hr = StringCchCatW(wszDestFile, ARRAYSIZE(wszDestFile), wfd.cFileName);
|
344
|
-
if(FAILED(hr)) return false;
|
345
|
-
#else
|
346
|
-
nResult = MultiByteToWideChar(
|
347
|
-
CP_ACP,
|
348
|
-
MB_PRECOMPOSED,
|
349
|
-
wfd.cFileName,
|
350
|
-
strlen(wfd.cFileName)+1,
|
351
|
-
wszDestFile+wcslen(wszDestFile),
|
352
|
-
ARRAYSIZE(wszDestFile)-wcslen(wszDestFile));
|
353
|
-
if(0 == nResult)
|
354
|
-
{
|
355
|
-
return 1;
|
356
|
-
}
|
357
|
-
#endif
|
358
|
-
}
|
359
|
-
hSrc = CreateFile(tszSrcFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
360
|
-
if (INVALID_HANDLE_VALUE == hSrc) {
|
361
|
-
_tprintf( TEXT("Unable to open host file\n"));
|
362
|
-
return false;
|
363
|
-
}
|
364
|
-
|
365
|
-
hDest = CeCreateFile(wszDestFile, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
366
|
-
if (INVALID_HANDLE_VALUE == hDest ) {
|
367
|
-
_tprintf( TEXT("Unable to open target WinCE file\n"));
|
368
|
-
return false;
|
369
|
-
}
|
370
|
-
|
371
|
-
//copy file
|
372
|
-
do {
|
373
|
-
if(ReadFile(hSrc, &buffer, sizeof(buffer), &dwNumRead, NULL)) {
|
374
|
-
if (!CeWriteFile(hDest, &buffer, dwNumRead, &dwNumWritten, NULL)) {
|
375
|
-
_tprintf( TEXT("Error !!! Writing WinCE file\n"));
|
376
|
-
goto FatalError;
|
377
|
-
}
|
378
|
-
} else {
|
379
|
-
_tprintf( TEXT("Error !!! Reading host file\n"));
|
380
|
-
goto FatalError;
|
381
|
-
}
|
382
|
-
_tprintf( TEXT("."));
|
383
|
-
} while (dwNumRead);
|
384
|
-
//_tprintf( TEXT("\n"));
|
385
|
-
|
386
|
-
CeCloseHandle( hDest);
|
387
|
-
CloseHandle (hSrc);
|
388
|
-
}
|
389
|
-
wceDisconnect();
|
390
|
-
return true;
|
391
|
-
|
392
|
-
FatalError:
|
393
|
-
CeCloseHandle( hDest);
|
394
|
-
CloseHandle (hSrc);
|
395
|
-
wceDisconnect();
|
396
|
-
return false;
|
397
|
-
}
|
398
|
-
|
399
|
-
bool wceRunProcess(const char *process, const char *args)
|
400
|
-
{
|
401
|
-
#ifndef UNICODE
|
402
|
-
HRESULT hr;
|
403
|
-
#endif
|
404
|
-
PROCESS_INFORMATION pi;
|
405
|
-
WCHAR wszProgram[MAX_PATH];
|
406
|
-
WCHAR wszArgs[MAX_PATH];
|
407
|
-
|
408
|
-
#ifdef UNICODE
|
409
|
-
int nResult = 0;
|
410
|
-
nResult = MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED, process, strlen(process)+1, wszProgram, ARRAYSIZE(wszProgram));
|
411
|
-
if(0 == nResult) { return false;}
|
412
|
-
if (args) {
|
413
|
-
nResult = MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED, args, strlen(args)+1, wszArgs, ARRAYSIZE(wszArgs));
|
414
|
-
if(0 == nResult)
|
415
|
-
return false;
|
416
|
-
}
|
417
|
-
#else
|
418
|
-
hr = StringCchCopy(wszProgram, ARRAYSIZE(wszProgram), argv[1]);
|
419
|
-
if(FAILED(hr)) return true;
|
420
|
-
#endif
|
421
|
-
if (wceConnect()) {
|
422
|
-
if (!CeCreateProcess(wszProgram, wszArgs, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi)) {
|
423
|
-
_tprintf( TEXT("CreateProcess failed with Errorcode = %ld\n"), CeGetLastError());
|
424
|
-
return false;
|
425
|
-
}
|
426
|
-
CeCloseHandle( pi.hProcess);
|
427
|
-
CeCloseHandle( pi.hThread);
|
428
|
-
}
|
429
|
-
wceDisconnect();
|
430
|
-
return true;
|
431
|
-
}
|
432
|
-
bool wceInvokeCabSetup(const char *wceload_params)
|
433
|
-
{
|
434
|
-
HRESULT hr = S_OK;
|
435
|
-
WCHAR wszCabFile[MAX_PATH];
|
436
|
-
|
437
|
-
//convert pathname
|
438
|
-
int nResult = 0;
|
439
|
-
int len = strlen(wceload_params)+1;
|
440
|
-
nResult = MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED, wceload_params, len, wszCabFile, ARRAYSIZE(wszCabFile));
|
441
|
-
if(0 == nResult)
|
442
|
-
return false;
|
443
|
-
|
444
|
-
wceConnect();
|
445
|
-
|
446
|
-
DWORD dwInSize = sizeof(wszCabFile);
|
447
|
-
DWORD dwOutSize = 0;
|
448
|
-
BYTE *pInBuff = NULL;
|
449
|
-
|
450
|
-
pInBuff = (BYTE *)LocalAlloc(LPTR, dwInSize);
|
451
|
-
memcpy(pInBuff, &wszCabFile, dwInSize);
|
452
|
-
|
453
|
-
hr = CeRapiInvoke(TEXT("\\rhosetup"), TEXT("rhoCabSetup"), dwInSize, pInBuff, &dwOutSize, NULL, NULL, 0);
|
454
|
-
if(FAILED(hr)) {
|
455
|
-
//printf("Failed to setup cab!\r\n");
|
456
|
-
return false;
|
457
|
-
}
|
458
|
-
wceDisconnect();
|
459
|
-
|
460
|
-
return true ;
|
461
|
-
}
|
462
|
-
|
463
|
-
|
464
|
-
#define EMU "Windows Mobile 6 Professional Emulator"
|
465
|
-
//#define EMU "USA Windows Mobile 6.5 Professional Portrait QVGA Emulator"
|
466
|
-
|
467
|
-
/**
|
468
|
-
* detool emu "<emu_name|vmid>" "app-name" rhobundle_path exe_name
|
469
|
-
* or
|
470
|
-
* detool emucab "<emu_name|vmid>" app.cab "app-name"
|
471
|
-
* or
|
472
|
-
detool dev "app-name" rhobundle_path exe_name
|
473
|
-
or
|
474
|
-
* detool devcab app.cab "app-name"
|
475
|
-
*/
|
476
|
-
void usage(void)
|
477
|
-
{
|
478
|
-
printf
|
479
|
-
("Rhodes deployment tool for Windows Mobile: \n \
|
480
|
-
detool emu \"<emu_name|vmid>\" app.cab \"app-name\" \n \
|
481
|
-
or \n \
|
482
|
-
detool dev app.cab \"app-name\" \n"
|
483
|
-
);
|
484
|
-
}
|
485
|
-
enum {
|
486
|
-
DEPLOY_EMUCAB,
|
487
|
-
DEPLOY_DEVCAB,
|
488
|
-
DEPLOY_EMU,
|
489
|
-
DEPLOY_DEV,
|
490
|
-
DEPLOY_LOG,
|
491
|
-
DEPLOY_DEV_WEBKIT,
|
492
|
-
DEPLOY_EMU_WEBKIT
|
493
|
-
};
|
494
|
-
|
495
|
-
int copyExecutable (TCHAR *file_name, TCHAR *app_dir, bool
|
496
|
-
{
|
497
|
-
TCHAR exe_fullpath[MAX_PATH];
|
498
|
-
int retval = 0;
|
499
|
-
HANDLE hDest, hSrc;
|
500
|
-
BYTE buffer[5120];
|
501
|
-
DWORD dwNumRead, dwNumWritten;
|
502
|
-
|
503
|
-
USES_CONVERSION;
|
504
|
-
|
505
|
-
_tcscpy(exe_fullpath, app_dir);
|
506
|
-
_tcscat(exe_fullpath, _T("\\"));
|
507
|
-
_tcscat(exe_fullpath, app_name);
|
508
|
-
_tcscat(exe_fullpath, (
|
509
|
-
|
510
|
-
hSrc = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
511
|
-
if (INVALID_HANDLE_VALUE == hSrc) {
|
512
|
-
_tprintf( TEXT("Unable to open host file\n"));
|
513
|
-
return EXIT_FAILURE;
|
514
|
-
}
|
515
|
-
|
516
|
-
hDest = CeCreateFile(exe_fullpath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
517
|
-
if (INVALID_HANDLE_VALUE == hDest ) {
|
518
|
-
_tprintf( TEXT("Unable to open target WinCE file\n"));
|
519
|
-
return CeGetLastError();
|
520
|
-
}
|
521
|
-
|
522
|
-
do {
|
523
|
-
if(ReadFile(hSrc, &buffer, sizeof(buffer), &dwNumRead, NULL)) {
|
524
|
-
if (!CeWriteFile(hDest, &buffer, dwNumRead, &dwNumWritten, NULL)) {
|
525
|
-
_tprintf( TEXT("Error !!! Writing WinCE file\n"));
|
526
|
-
goto copyFailure;
|
527
|
-
}
|
528
|
-
} else {
|
529
|
-
_tprintf( TEXT("Error !!! Reading host file\n"));
|
530
|
-
goto copyFailure;
|
531
|
-
}
|
532
|
-
_tprintf( TEXT("."));
|
533
|
-
} while (dwNumRead);
|
534
|
-
_tprintf( TEXT("\n"));
|
535
|
-
|
536
|
-
CeCloseHandle( hDest);
|
537
|
-
CloseHandle (hSrc);
|
538
|
-
|
539
|
-
return EXIT_SUCCESS;
|
540
|
-
|
541
|
-
copyFailure:
|
542
|
-
CeCloseHandle( hDest);
|
543
|
-
CloseHandle (hSrc);
|
544
|
-
/*
|
545
|
-
|
546
|
-
if (wcePutFile (T2A(file_name), T2A(exe_fullpath)))
|
547
|
-
return EXIT_SUCCESS;
|
548
|
-
*/
|
549
|
-
return EXIT_FAILURE;
|
550
|
-
}
|
551
|
-
|
552
|
-
int copyBundle (TCHAR *parent_dir, TCHAR *file, TCHAR *app_dir)
|
553
|
-
{
|
554
|
-
HANDLE fileHandle;
|
555
|
-
WIN32_FIND_DATAW findData;
|
556
|
-
//DWORD dwError;
|
557
|
-
TCHAR new_app_item[MAX_PATH];
|
558
|
-
TCHAR host_file[MAX_PATH];
|
559
|
-
HANDLE hFind;
|
560
|
-
CE_FIND_DATA wceFindData;
|
561
|
-
|
562
|
-
USES_CONVERSION;
|
563
|
-
|
564
|
-
TCHAR wildcard[MAX_PATH + 16];
|
565
|
-
TCHAR fullpath[MAX_PATH];
|
566
|
-
|
567
|
-
_tcscpy(fullpath, parent_dir);
|
568
|
-
_tcscat(fullpath, _T("\\"));
|
569
|
-
_tcscat(fullpath, file);
|
570
|
-
|
571
|
-
//TODO: check for fullpath is a dir
|
572
|
-
|
573
|
-
_tcscpy(wildcard, fullpath);
|
574
|
-
_tcscat(wildcard, _T("\\*.*"));
|
575
|
-
|
576
|
-
//wceConnect ();
|
577
|
-
|
578
|
-
fileHandle = FindFirstFile(wildcard, &findData);
|
579
|
-
|
580
|
-
if (fileHandle == INVALID_HANDLE_VALUE) {
|
581
|
-
printf ("Failed to open file\n");
|
582
|
-
wceDisconnect();
|
583
|
-
return EXIT_FAILURE;
|
584
|
-
}
|
585
|
-
|
586
|
-
/*
|
587
|
-
if (_tcscmp (_T("."), findData.cFileName) != 0 && _tcscmp (_T(".."), findData.cFileName) != 0) {
|
588
|
-
printf("-- %s\n", T2A(findData.cFileName));
|
589
|
-
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
590
|
-
copyBundle (fullpath, findData.cFileName, NULL);
|
591
|
-
}
|
592
|
-
}
|
593
|
-
*/
|
594
|
-
|
595
|
-
HANDLE hDest, hSrc;
|
596
|
-
BYTE buffer[5120];
|
597
|
-
DWORD dwNumRead, dwNumWritten;
|
598
|
-
|
599
|
-
while (FindNextFile(fileHandle, &findData)) {
|
600
|
-
if (_tcscmp (_T("."), findData.cFileName) == 0 || _tcscmp (_T(".."), findData.cFileName) == 0)
|
601
|
-
continue;
|
602
|
-
|
603
|
-
_tcscpy(new_app_item, app_dir);
|
604
|
-
_tcscat(new_app_item, _T("\\"));
|
605
|
-
_tcscat(new_app_item, findData.cFileName);
|
606
|
-
|
607
|
-
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
608
|
-
{
|
609
|
-
//Check and create dir on device
|
610
|
-
hFind = CeFindFirstFile(new_app_item, &wceFindData);
|
611
|
-
if (INVALID_HANDLE_VALUE == hFind) {
|
612
|
-
if (!CeCreateDirectory(new_app_item, NULL)) {
|
613
|
-
_tprintf( TEXT("Create directory \"%s\" on device\n"), new_app_item);
|
614
|
-
printf ("Failed to create new directory on device\n");
|
615
|
-
return EXIT_FAILURE;
|
616
|
-
}
|
617
|
-
}
|
618
|
-
FindClose( hFind);
|
619
|
-
|
620
|
-
copyBundle (fullpath, findData.cFileName, new_app_item);
|
621
|
-
}
|
622
|
-
else
|
623
|
-
{
|
624
|
-
_tcscpy(host_file, fullpath);
|
625
|
-
_tcscat(host_file, _T("\\"));
|
626
|
-
_tcscat(host_file, findData.cFileName);
|
627
|
-
|
628
|
-
_tprintf( TEXT("Copy file \"%s\" to device"), new_app_item);
|
629
|
-
|
630
|
-
hSrc = CreateFile(host_file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
631
|
-
if (INVALID_HANDLE_VALUE == hSrc) {
|
632
|
-
_tprintf( TEXT("Unable to open host file\n"));
|
633
|
-
return false;
|
634
|
-
}
|
635
|
-
|
636
|
-
hDest = CeCreateFile(new_app_item, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
637
|
-
if (INVALID_HANDLE_VALUE == hDest ) {
|
638
|
-
_tprintf( TEXT("Unable to open target WinCE file\n"));
|
639
|
-
return false;
|
640
|
-
}
|
641
|
-
|
642
|
-
do {
|
643
|
-
if(ReadFile(hSrc, &buffer, sizeof(buffer), &dwNumRead, NULL)) {
|
644
|
-
if (!CeWriteFile(hDest, &buffer, dwNumRead, &dwNumWritten, NULL)) {
|
645
|
-
_tprintf( TEXT("Error !!! Writing WinCE file\n"));
|
646
|
-
goto copyBundleFailure;
|
647
|
-
}
|
648
|
-
} else {
|
649
|
-
_tprintf( TEXT("Error !!! Reading host file\n"));
|
650
|
-
goto copyBundleFailure;
|
651
|
-
}
|
652
|
-
_tprintf( TEXT("."));
|
653
|
-
} while (dwNumRead);
|
654
|
-
_tprintf( TEXT("\n"));
|
655
|
-
|
656
|
-
CeCloseHandle( hDest);
|
657
|
-
CloseHandle (hSrc);
|
658
|
-
/*
|
659
|
-
if(!wcePutFile (T2A(host_file), T2A(new_app_item))) {
|
660
|
-
printf("Failed to copy file.");
|
661
|
-
return EXIT_FAILURE;
|
662
|
-
}
|
663
|
-
*/
|
664
|
-
}
|
665
|
-
|
666
|
-
}
|
667
|
-
|
668
|
-
return EXIT_SUCCESS;
|
669
|
-
|
670
|
-
copyBundleFailure:
|
671
|
-
CeCloseHandle( hDest);
|
672
|
-
CloseHandle (hSrc);
|
673
|
-
return EXIT_FAILURE;
|
674
|
-
}
|
675
|
-
|
676
|
-
|
677
|
-
{
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
if (
|
691
|
-
|
692
|
-
|
693
|
-
}
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
}
|
766
|
-
|
1
|
+
/*------------------------------------------------------------------------
|
2
|
+
* (The MIT License)
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008-2011 Rhomobile, Inc.
|
5
|
+
*
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
11
|
+
* furnished to do so, subject to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
14
|
+
* all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
* THE SOFTWARE.
|
23
|
+
*
|
24
|
+
* http://rhomobile.com
|
25
|
+
*------------------------------------------------------------------------*/
|
26
|
+
|
27
|
+
#include "stdafx.h"
|
28
|
+
|
29
|
+
#include <rapi.h>
|
30
|
+
#include <strsafe.h>
|
31
|
+
|
32
|
+
#include "detool.h"
|
33
|
+
#include "LogServer.h"
|
34
|
+
|
35
|
+
#define RHOSETUP_DLL "rhosetup.dll"
|
36
|
+
#define RE2_RUNTIME TEXT("\\Program Files\\RhoElements\\RhoElements.exe")
|
37
|
+
|
38
|
+
TCHAR *app_name = NULL;
|
39
|
+
|
40
|
+
void checkMDEstart(HRESULT hr)
|
41
|
+
{
|
42
|
+
if (FAILED(hr)) {
|
43
|
+
if (hr == REGDB_E_CLASSNOTREG) {
|
44
|
+
printf ("Microsoft Device Emulator is too old or corrupted. Please update it.\n");
|
45
|
+
printf ("You could get the latest version on:\n");
|
46
|
+
printf ("http://www.microsoft.com/downloads/details.aspx?familyid=a6f6adaf-12e3-4b2f-a394-356e2c2fb114\n");
|
47
|
+
} else {
|
48
|
+
wprintf_s(L"Error: Unable to instantiate DeviceEmulatorManager. ErrorCode=0x%08X\n", hr);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
DWORD WINAPI startDEM(LPVOID lpParam)
|
54
|
+
{
|
55
|
+
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) {
|
56
|
+
HRESULT hr = 0;
|
57
|
+
|
58
|
+
CComPtr<IDeviceEmulatorManager> pDeviceEmulatorManager;
|
59
|
+
hr = pDeviceEmulatorManager.CoCreateInstance(__uuidof(DeviceEmulatorManager));
|
60
|
+
if (FAILED(hr)) {
|
61
|
+
checkMDEstart(hr);
|
62
|
+
ExitProcess(EXIT_FAILURE);
|
63
|
+
return hr;
|
64
|
+
}
|
65
|
+
|
66
|
+
pDeviceEmulatorManager->ShowManagerUI(false);
|
67
|
+
while (1) {
|
68
|
+
Sleep(600 * 1000);
|
69
|
+
}
|
70
|
+
return hr;
|
71
|
+
CoUninitialize();
|
72
|
+
}
|
73
|
+
return 0;
|
74
|
+
}
|
75
|
+
|
76
|
+
BOOL FindDevice(const CComBSTR& deviceIdentifier, IDeviceEmulatorManagerVMID** pDeviceVMID)
|
77
|
+
{
|
78
|
+
HRESULT hr;
|
79
|
+
|
80
|
+
CComPtr<IDeviceEmulatorManager> pDeviceEmulatorManager;
|
81
|
+
hr = pDeviceEmulatorManager.CoCreateInstance(__uuidof(DeviceEmulatorManager));
|
82
|
+
if (FAILED(hr)) {
|
83
|
+
wprintf(L"Error: Unable to instantiate DeviceEmulatorManager. ErrorCode=0x%08X\n", hr);
|
84
|
+
return FALSE;
|
85
|
+
}
|
86
|
+
|
87
|
+
for (; SUCCEEDED(hr); (hr = pDeviceEmulatorManager->MoveNext()))
|
88
|
+
{
|
89
|
+
CComPtr<IEnumManagerSDKs> pSDKEnumerator;
|
90
|
+
|
91
|
+
hr = pDeviceEmulatorManager->EnumerateSDKs(&pSDKEnumerator);
|
92
|
+
if (FAILED(hr)) {
|
93
|
+
continue;
|
94
|
+
}
|
95
|
+
|
96
|
+
for (; SUCCEEDED(hr); (hr = pSDKEnumerator->MoveNext())) {
|
97
|
+
CComPtr<IEnumVMIDs> pDeviceEnumerator;
|
98
|
+
hr = pSDKEnumerator->EnumerateVMIDs(&pDeviceEnumerator);
|
99
|
+
if (FAILED(hr)) {
|
100
|
+
continue;
|
101
|
+
}
|
102
|
+
|
103
|
+
for (; SUCCEEDED(hr); (hr = pDeviceEnumerator->MoveNext())) {
|
104
|
+
CComBSTR deviceName;
|
105
|
+
CComBSTR deviceVMID;
|
106
|
+
CComPtr<IDeviceEmulatorManagerVMID> pDevice;
|
107
|
+
|
108
|
+
hr = pDeviceEnumerator->GetVMID(&pDevice);
|
109
|
+
if (FAILED(hr)) {
|
110
|
+
continue;
|
111
|
+
}
|
112
|
+
|
113
|
+
hr = pDevice->get_Name(&deviceName);
|
114
|
+
if (FAILED(hr)){
|
115
|
+
continue;
|
116
|
+
}
|
117
|
+
|
118
|
+
hr = pDevice->get_VMID(&deviceVMID);
|
119
|
+
if (FAILED(hr)){
|
120
|
+
continue;
|
121
|
+
}
|
122
|
+
|
123
|
+
if (deviceIdentifier == deviceName || deviceIdentifier == deviceVMID){
|
124
|
+
*pDeviceVMID = pDevice;
|
125
|
+
(*pDeviceVMID)->AddRef();
|
126
|
+
return TRUE;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
wprintf(L"Error: Unable to locate the device '%s'", deviceIdentifier);
|
133
|
+
return FALSE;
|
134
|
+
}
|
135
|
+
|
136
|
+
bool emuConnect(const CComBSTR& deviceIdentifier)
|
137
|
+
{
|
138
|
+
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
139
|
+
|
140
|
+
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
141
|
+
if (bFound && pDevice){
|
142
|
+
HRESULT hr = pDevice->Connect();
|
143
|
+
if (!SUCCEEDED(hr)) {
|
144
|
+
wprintf(L"Error: Operation Connect failed. Hr=0x%x\n", hr);
|
145
|
+
return false;
|
146
|
+
}
|
147
|
+
return true;
|
148
|
+
}
|
149
|
+
return false;
|
150
|
+
}
|
151
|
+
|
152
|
+
bool emuBringToFront(const CComBSTR& deviceIdentifier)
|
153
|
+
{
|
154
|
+
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
155
|
+
|
156
|
+
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
157
|
+
if (bFound && pDevice){
|
158
|
+
HRESULT hr = pDevice->BringToFront();
|
159
|
+
if (!SUCCEEDED(hr)) {
|
160
|
+
wprintf(L"Error: Operation BringToFront failed. Hr=0x%x\n", hr);
|
161
|
+
return false;
|
162
|
+
}
|
163
|
+
return true;
|
164
|
+
}
|
165
|
+
return false;
|
166
|
+
}
|
167
|
+
|
168
|
+
bool emuCradle(const CComBSTR& deviceIdentifier)
|
169
|
+
{
|
170
|
+
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
171
|
+
|
172
|
+
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
173
|
+
if (bFound && pDevice){
|
174
|
+
HRESULT hr = pDevice->Cradle();
|
175
|
+
if (!SUCCEEDED(hr)) {
|
176
|
+
wprintf(L"Error: Operation Cradle failed. Hr=0x%x\n", hr);
|
177
|
+
return false;
|
178
|
+
}
|
179
|
+
return true;
|
180
|
+
}
|
181
|
+
return false;
|
182
|
+
}
|
183
|
+
|
184
|
+
bool emuUncradle(const CComBSTR& deviceIdentifier)
|
185
|
+
{
|
186
|
+
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
187
|
+
|
188
|
+
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
189
|
+
|
190
|
+
if (bFound && pDevice){
|
191
|
+
HRESULT hr = pDevice->UnCradle();
|
192
|
+
if (!SUCCEEDED(hr)) {
|
193
|
+
wprintf(L"Error: Operation UnCradle failed. Hr=0x%x\n", hr);
|
194
|
+
return false;
|
195
|
+
}
|
196
|
+
return true;
|
197
|
+
}
|
198
|
+
|
199
|
+
return false;
|
200
|
+
}
|
201
|
+
|
202
|
+
bool emuReset(const CComBSTR& deviceIdentifier)
|
203
|
+
{
|
204
|
+
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
205
|
+
|
206
|
+
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
207
|
+
if (bFound && pDevice){
|
208
|
+
HRESULT hr = pDevice->Reset(TRUE);
|
209
|
+
if (!SUCCEEDED(hr)) {
|
210
|
+
wprintf(L"Error: Operation ResetEmulator failed. Hr=0x%x\n", hr);
|
211
|
+
return false;
|
212
|
+
}
|
213
|
+
return true;
|
214
|
+
}
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
|
218
|
+
bool emuShutdown(const CComBSTR& deviceIdentifier)
|
219
|
+
{
|
220
|
+
CComPtr<IDeviceEmulatorManagerVMID> pDevice = NULL;
|
221
|
+
|
222
|
+
BOOL bFound = FindDevice(deviceIdentifier, &pDevice);
|
223
|
+
if (bFound && pDevice){
|
224
|
+
HRESULT hr = pDevice->Shutdown(FALSE);
|
225
|
+
if (!SUCCEEDED(hr)) {
|
226
|
+
wprintf(L"Error: Operation Shutdown failed. Hr=0x%x\n", hr);
|
227
|
+
return false;
|
228
|
+
}
|
229
|
+
return true;
|
230
|
+
}
|
231
|
+
return false;
|
232
|
+
}
|
233
|
+
|
234
|
+
bool wceConnect (void)
|
235
|
+
{
|
236
|
+
HRESULT hRapiResult;
|
237
|
+
|
238
|
+
//_tprintf( TEXT("Connecting to Windows CE..."));
|
239
|
+
hRapiResult = CeRapiInit();
|
240
|
+
if (FAILED(hRapiResult)) {
|
241
|
+
_tprintf( TEXT("Failed\n"));
|
242
|
+
return false;
|
243
|
+
}
|
244
|
+
//_tprintf( TEXT("Success\n"));
|
245
|
+
|
246
|
+
return true;
|
247
|
+
|
248
|
+
/*
|
249
|
+
RAPIINIT riCopy = {sizeof(RAPIINIT), 0, 0};
|
250
|
+
bool fInitialized = false;
|
251
|
+
DWORD dwTimeOut = 5000;
|
252
|
+
|
253
|
+
CeRapiUninit();
|
254
|
+
|
255
|
+
hRapiResult = CeRapiInitEx(&riCopy);
|
256
|
+
|
257
|
+
if (FAILED(hRapiResult)) {
|
258
|
+
return false;
|
259
|
+
}
|
260
|
+
|
261
|
+
DWORD dwRapiInit = 0;
|
262
|
+
|
263
|
+
dwRapiInit = WaitForSingleObject(
|
264
|
+
riCopy.heRapiInit,
|
265
|
+
dwTimeOut);
|
266
|
+
|
267
|
+
if (WAIT_OBJECT_0 == dwRapiInit) {
|
268
|
+
// heRapiInit signaled:
|
269
|
+
// set return error code to return value of RAPI Init function
|
270
|
+
hRapiResult = riCopy.hrRapiInit;
|
271
|
+
} else if (WAIT_TIMEOUT == dwRapiInit) {
|
272
|
+
// timed out: device is probably not connected
|
273
|
+
// or not responding
|
274
|
+
hRapiResult = HRESULT_FROM_WIN32(ERROR_TIMEOUT);
|
275
|
+
} else {
|
276
|
+
// WaitForSingleObject failed
|
277
|
+
hRapiResult = HRESULT_FROM_WIN32(GetLastError());
|
278
|
+
}
|
279
|
+
|
280
|
+
if (FAILED(hRapiResult)) {
|
281
|
+
CeRapiUninit();
|
282
|
+
return false;
|
283
|
+
}
|
284
|
+
return true;
|
285
|
+
*/
|
286
|
+
}
|
287
|
+
|
288
|
+
void wceDisconnect(void)
|
289
|
+
{
|
290
|
+
//_tprintf( TEXT("Closing connection to Windows CE..."));
|
291
|
+
CeRapiUninit();
|
292
|
+
//_tprintf( TEXT("Done\n"));
|
293
|
+
}
|
294
|
+
|
295
|
+
#define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
|
296
|
+
|
297
|
+
|
298
|
+
bool wcePutFile(const char *host_file, const char *wce_file)
|
299
|
+
{
|
300
|
+
TCHAR tszSrcFile[MAX_PATH];
|
301
|
+
WCHAR wszDestFile[MAX_PATH];
|
302
|
+
BYTE buffer[5120];
|
303
|
+
WIN32_FIND_DATA wfd;
|
304
|
+
HRESULT hr;
|
305
|
+
DWORD dwAttr, dwNumRead, dwNumWritten;
|
306
|
+
HANDLE hSrc, hDest, hFind;
|
307
|
+
int nResult;
|
308
|
+
|
309
|
+
#ifdef UNICODE
|
310
|
+
nResult = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
|
311
|
+
host_file, strlen(host_file)+1,
|
312
|
+
tszSrcFile, ARRAYSIZE(tszSrcFile));
|
313
|
+
if(0 == nResult)
|
314
|
+
return false;
|
315
|
+
#else
|
316
|
+
hr = StringCchCopy(tszSrcFile, ARRAYSIZE(tszSrcFile), argv[1]);
|
317
|
+
if(FAILED(hr))
|
318
|
+
return false;
|
319
|
+
#endif
|
320
|
+
nResult = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
|
321
|
+
wce_file, strlen(wce_file)+1,
|
322
|
+
wszDestFile, ARRAYSIZE(wszDestFile));
|
323
|
+
if(0 == nResult)
|
324
|
+
return false;
|
325
|
+
|
326
|
+
hFind = FindFirstFile( tszSrcFile, &wfd);
|
327
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
328
|
+
_tprintf(TEXT("Host file does not exist\n"));
|
329
|
+
return false;
|
330
|
+
}
|
331
|
+
FindClose( hFind);
|
332
|
+
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
333
|
+
_tprintf( TEXT("Host file specifies a directory\n"));
|
334
|
+
return false;
|
335
|
+
}
|
336
|
+
|
337
|
+
if (wceConnect()) {
|
338
|
+
dwAttr = CeGetFileAttributes( wszDestFile);
|
339
|
+
if (dwAttr & FILE_ATTRIBUTE_DIRECTORY) {
|
340
|
+
hr = StringCchCatW(wszDestFile, ARRAYSIZE(wszDestFile), L"\\");
|
341
|
+
if(FAILED(hr)) return false;
|
342
|
+
#ifdef UNICODE
|
343
|
+
hr = StringCchCatW(wszDestFile, ARRAYSIZE(wszDestFile), wfd.cFileName);
|
344
|
+
if(FAILED(hr)) return false;
|
345
|
+
#else
|
346
|
+
nResult = MultiByteToWideChar(
|
347
|
+
CP_ACP,
|
348
|
+
MB_PRECOMPOSED,
|
349
|
+
wfd.cFileName,
|
350
|
+
strlen(wfd.cFileName)+1,
|
351
|
+
wszDestFile+wcslen(wszDestFile),
|
352
|
+
ARRAYSIZE(wszDestFile)-wcslen(wszDestFile));
|
353
|
+
if(0 == nResult)
|
354
|
+
{
|
355
|
+
return 1;
|
356
|
+
}
|
357
|
+
#endif
|
358
|
+
}
|
359
|
+
hSrc = CreateFile(tszSrcFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
360
|
+
if (INVALID_HANDLE_VALUE == hSrc) {
|
361
|
+
_tprintf( TEXT("Unable to open host file\n"));
|
362
|
+
return false;
|
363
|
+
}
|
364
|
+
|
365
|
+
hDest = CeCreateFile(wszDestFile, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
366
|
+
if (INVALID_HANDLE_VALUE == hDest ) {
|
367
|
+
_tprintf( TEXT("Unable to open target WinCE file\n"));
|
368
|
+
return false;
|
369
|
+
}
|
370
|
+
|
371
|
+
//copy file
|
372
|
+
do {
|
373
|
+
if(ReadFile(hSrc, &buffer, sizeof(buffer), &dwNumRead, NULL)) {
|
374
|
+
if (!CeWriteFile(hDest, &buffer, dwNumRead, &dwNumWritten, NULL)) {
|
375
|
+
_tprintf( TEXT("Error !!! Writing WinCE file\n"));
|
376
|
+
goto FatalError;
|
377
|
+
}
|
378
|
+
} else {
|
379
|
+
_tprintf( TEXT("Error !!! Reading host file\n"));
|
380
|
+
goto FatalError;
|
381
|
+
}
|
382
|
+
_tprintf( TEXT("."));
|
383
|
+
} while (dwNumRead);
|
384
|
+
//_tprintf( TEXT("\n"));
|
385
|
+
|
386
|
+
CeCloseHandle( hDest);
|
387
|
+
CloseHandle (hSrc);
|
388
|
+
}
|
389
|
+
wceDisconnect();
|
390
|
+
return true;
|
391
|
+
|
392
|
+
FatalError:
|
393
|
+
CeCloseHandle( hDest);
|
394
|
+
CloseHandle (hSrc);
|
395
|
+
wceDisconnect();
|
396
|
+
return false;
|
397
|
+
}
|
398
|
+
|
399
|
+
bool wceRunProcess(const char *process, const char *args)
|
400
|
+
{
|
401
|
+
#ifndef UNICODE
|
402
|
+
HRESULT hr;
|
403
|
+
#endif
|
404
|
+
PROCESS_INFORMATION pi;
|
405
|
+
WCHAR wszProgram[MAX_PATH];
|
406
|
+
WCHAR wszArgs[MAX_PATH];
|
407
|
+
|
408
|
+
#ifdef UNICODE
|
409
|
+
int nResult = 0;
|
410
|
+
nResult = MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED, process, strlen(process)+1, wszProgram, ARRAYSIZE(wszProgram));
|
411
|
+
if(0 == nResult) { return false;}
|
412
|
+
if (args) {
|
413
|
+
nResult = MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED, args, strlen(args)+1, wszArgs, ARRAYSIZE(wszArgs));
|
414
|
+
if(0 == nResult)
|
415
|
+
return false;
|
416
|
+
}
|
417
|
+
#else
|
418
|
+
hr = StringCchCopy(wszProgram, ARRAYSIZE(wszProgram), argv[1]);
|
419
|
+
if(FAILED(hr)) return true;
|
420
|
+
#endif
|
421
|
+
if (wceConnect()) {
|
422
|
+
if (!CeCreateProcess(wszProgram, wszArgs, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi)) {
|
423
|
+
_tprintf( TEXT("CreateProcess failed with Errorcode = %ld\n"), CeGetLastError());
|
424
|
+
return false;
|
425
|
+
}
|
426
|
+
CeCloseHandle( pi.hProcess);
|
427
|
+
CeCloseHandle( pi.hThread);
|
428
|
+
}
|
429
|
+
wceDisconnect();
|
430
|
+
return true;
|
431
|
+
}
|
432
|
+
bool wceInvokeCabSetup(const char *wceload_params)
|
433
|
+
{
|
434
|
+
HRESULT hr = S_OK;
|
435
|
+
WCHAR wszCabFile[MAX_PATH];
|
436
|
+
|
437
|
+
//convert pathname
|
438
|
+
int nResult = 0;
|
439
|
+
int len = strlen(wceload_params)+1;
|
440
|
+
nResult = MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED, wceload_params, len, wszCabFile, ARRAYSIZE(wszCabFile));
|
441
|
+
if(0 == nResult)
|
442
|
+
return false;
|
443
|
+
|
444
|
+
wceConnect();
|
445
|
+
|
446
|
+
DWORD dwInSize = sizeof(wszCabFile);
|
447
|
+
DWORD dwOutSize = 0;
|
448
|
+
BYTE *pInBuff = NULL;
|
449
|
+
|
450
|
+
pInBuff = (BYTE *)LocalAlloc(LPTR, dwInSize);
|
451
|
+
memcpy(pInBuff, &wszCabFile, dwInSize);
|
452
|
+
|
453
|
+
hr = CeRapiInvoke(TEXT("\\rhosetup"), TEXT("rhoCabSetup"), dwInSize, pInBuff, &dwOutSize, NULL, NULL, 0);
|
454
|
+
if(FAILED(hr)) {
|
455
|
+
//printf("Failed to setup cab!\r\n");
|
456
|
+
return false;
|
457
|
+
}
|
458
|
+
wceDisconnect();
|
459
|
+
|
460
|
+
return true ;
|
461
|
+
}
|
462
|
+
|
463
|
+
|
464
|
+
#define EMU "Windows Mobile 6 Professional Emulator"
|
465
|
+
//#define EMU "USA Windows Mobile 6.5 Professional Portrait QVGA Emulator"
|
466
|
+
|
467
|
+
/**
|
468
|
+
* detool emu "<emu_name|vmid>" "app-name" rhobundle_path exe_name
|
469
|
+
* or
|
470
|
+
* detool emucab "<emu_name|vmid>" app.cab "app-name"
|
471
|
+
* or
|
472
|
+
detool dev "app-name" rhobundle_path exe_name
|
473
|
+
or
|
474
|
+
* detool devcab app.cab "app-name"
|
475
|
+
*/
|
476
|
+
void usage(void)
|
477
|
+
{
|
478
|
+
printf
|
479
|
+
("Rhodes deployment tool for Windows Mobile: \n \
|
480
|
+
detool emu \"<emu_name|vmid>\" app.cab \"app-name\" \n \
|
481
|
+
or \n \
|
482
|
+
detool dev app.cab \"app-name\" \n"
|
483
|
+
);
|
484
|
+
}
|
485
|
+
enum {
|
486
|
+
DEPLOY_EMUCAB,
|
487
|
+
DEPLOY_DEVCAB,
|
488
|
+
DEPLOY_EMU,
|
489
|
+
DEPLOY_DEV,
|
490
|
+
DEPLOY_LOG,
|
491
|
+
DEPLOY_DEV_WEBKIT,
|
492
|
+
DEPLOY_EMU_WEBKIT
|
493
|
+
};
|
494
|
+
|
495
|
+
int copyExecutable (TCHAR *file_name, TCHAR *app_dir, bool use_shared_runtime)
|
496
|
+
{
|
497
|
+
TCHAR exe_fullpath[MAX_PATH];
|
498
|
+
int retval = 0;
|
499
|
+
HANDLE hDest, hSrc;
|
500
|
+
BYTE buffer[5120];
|
501
|
+
DWORD dwNumRead, dwNumWritten;
|
502
|
+
|
503
|
+
USES_CONVERSION;
|
504
|
+
|
505
|
+
_tcscpy(exe_fullpath, app_dir);
|
506
|
+
_tcscat(exe_fullpath, _T("\\"));
|
507
|
+
_tcscat(exe_fullpath, app_name);
|
508
|
+
_tcscat(exe_fullpath, (use_shared_runtime ? _T(".lnk") : _T(".exe")));
|
509
|
+
|
510
|
+
hSrc = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
511
|
+
if (INVALID_HANDLE_VALUE == hSrc) {
|
512
|
+
_tprintf( TEXT("Unable to open host file\n"));
|
513
|
+
return EXIT_FAILURE;
|
514
|
+
}
|
515
|
+
|
516
|
+
hDest = CeCreateFile(exe_fullpath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
517
|
+
if (INVALID_HANDLE_VALUE == hDest ) {
|
518
|
+
_tprintf( TEXT("Unable to open target WinCE file\n"));
|
519
|
+
return CeGetLastError();
|
520
|
+
}
|
521
|
+
|
522
|
+
do {
|
523
|
+
if(ReadFile(hSrc, &buffer, sizeof(buffer), &dwNumRead, NULL)) {
|
524
|
+
if (!CeWriteFile(hDest, &buffer, dwNumRead, &dwNumWritten, NULL)) {
|
525
|
+
_tprintf( TEXT("Error !!! Writing WinCE file\n"));
|
526
|
+
goto copyFailure;
|
527
|
+
}
|
528
|
+
} else {
|
529
|
+
_tprintf( TEXT("Error !!! Reading host file\n"));
|
530
|
+
goto copyFailure;
|
531
|
+
}
|
532
|
+
_tprintf( TEXT("."));
|
533
|
+
} while (dwNumRead);
|
534
|
+
_tprintf( TEXT("\n"));
|
535
|
+
|
536
|
+
CeCloseHandle( hDest);
|
537
|
+
CloseHandle (hSrc);
|
538
|
+
|
539
|
+
return EXIT_SUCCESS;
|
540
|
+
|
541
|
+
copyFailure:
|
542
|
+
CeCloseHandle( hDest);
|
543
|
+
CloseHandle (hSrc);
|
544
|
+
/*
|
545
|
+
|
546
|
+
if (wcePutFile (T2A(file_name), T2A(exe_fullpath)))
|
547
|
+
return EXIT_SUCCESS;
|
548
|
+
*/
|
549
|
+
return EXIT_FAILURE;
|
550
|
+
}
|
551
|
+
|
552
|
+
int copyBundle (TCHAR *parent_dir, TCHAR *file, TCHAR *app_dir)
|
553
|
+
{
|
554
|
+
HANDLE fileHandle;
|
555
|
+
WIN32_FIND_DATAW findData;
|
556
|
+
//DWORD dwError;
|
557
|
+
TCHAR new_app_item[MAX_PATH];
|
558
|
+
TCHAR host_file[MAX_PATH];
|
559
|
+
HANDLE hFind;
|
560
|
+
CE_FIND_DATA wceFindData;
|
561
|
+
|
562
|
+
USES_CONVERSION;
|
563
|
+
|
564
|
+
TCHAR wildcard[MAX_PATH + 16];
|
565
|
+
TCHAR fullpath[MAX_PATH];
|
566
|
+
|
567
|
+
_tcscpy(fullpath, parent_dir);
|
568
|
+
_tcscat(fullpath, _T("\\"));
|
569
|
+
_tcscat(fullpath, file);
|
570
|
+
|
571
|
+
//TODO: check for fullpath is a dir
|
572
|
+
|
573
|
+
_tcscpy(wildcard, fullpath);
|
574
|
+
_tcscat(wildcard, _T("\\*.*"));
|
575
|
+
|
576
|
+
//wceConnect ();
|
577
|
+
|
578
|
+
fileHandle = FindFirstFile(wildcard, &findData);
|
579
|
+
|
580
|
+
if (fileHandle == INVALID_HANDLE_VALUE) {
|
581
|
+
printf ("Failed to open file\n");
|
582
|
+
wceDisconnect();
|
583
|
+
return EXIT_FAILURE;
|
584
|
+
}
|
585
|
+
|
586
|
+
/*
|
587
|
+
if (_tcscmp (_T("."), findData.cFileName) != 0 && _tcscmp (_T(".."), findData.cFileName) != 0) {
|
588
|
+
printf("-- %s\n", T2A(findData.cFileName));
|
589
|
+
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
590
|
+
copyBundle (fullpath, findData.cFileName, NULL);
|
591
|
+
}
|
592
|
+
}
|
593
|
+
*/
|
594
|
+
|
595
|
+
HANDLE hDest, hSrc;
|
596
|
+
BYTE buffer[5120];
|
597
|
+
DWORD dwNumRead, dwNumWritten;
|
598
|
+
|
599
|
+
while (FindNextFile(fileHandle, &findData)) {
|
600
|
+
if (_tcscmp (_T("."), findData.cFileName) == 0 || _tcscmp (_T(".."), findData.cFileName) == 0)
|
601
|
+
continue;
|
602
|
+
|
603
|
+
_tcscpy(new_app_item, app_dir);
|
604
|
+
_tcscat(new_app_item, _T("\\"));
|
605
|
+
_tcscat(new_app_item, findData.cFileName);
|
606
|
+
|
607
|
+
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
608
|
+
{
|
609
|
+
//Check and create dir on device
|
610
|
+
hFind = CeFindFirstFile(new_app_item, &wceFindData);
|
611
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
612
|
+
if (!CeCreateDirectory(new_app_item, NULL)) {
|
613
|
+
_tprintf( TEXT("Create directory \"%s\" on device\n"), new_app_item);
|
614
|
+
printf ("Failed to create new directory on device\n");
|
615
|
+
return EXIT_FAILURE;
|
616
|
+
}
|
617
|
+
}
|
618
|
+
FindClose( hFind);
|
619
|
+
|
620
|
+
copyBundle (fullpath, findData.cFileName, new_app_item);
|
621
|
+
}
|
622
|
+
else
|
623
|
+
{
|
624
|
+
_tcscpy(host_file, fullpath);
|
625
|
+
_tcscat(host_file, _T("\\"));
|
626
|
+
_tcscat(host_file, findData.cFileName);
|
627
|
+
|
628
|
+
_tprintf( TEXT("Copy file \"%s\" to device"), new_app_item);
|
629
|
+
|
630
|
+
hSrc = CreateFile(host_file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
631
|
+
if (INVALID_HANDLE_VALUE == hSrc) {
|
632
|
+
_tprintf( TEXT("Unable to open host file\n"));
|
633
|
+
return false;
|
634
|
+
}
|
635
|
+
|
636
|
+
hDest = CeCreateFile(new_app_item, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
637
|
+
if (INVALID_HANDLE_VALUE == hDest ) {
|
638
|
+
_tprintf( TEXT("Unable to open target WinCE file\n"));
|
639
|
+
return false;
|
640
|
+
}
|
641
|
+
|
642
|
+
do {
|
643
|
+
if(ReadFile(hSrc, &buffer, sizeof(buffer), &dwNumRead, NULL)) {
|
644
|
+
if (!CeWriteFile(hDest, &buffer, dwNumRead, &dwNumWritten, NULL)) {
|
645
|
+
_tprintf( TEXT("Error !!! Writing WinCE file\n"));
|
646
|
+
goto copyBundleFailure;
|
647
|
+
}
|
648
|
+
} else {
|
649
|
+
_tprintf( TEXT("Error !!! Reading host file\n"));
|
650
|
+
goto copyBundleFailure;
|
651
|
+
}
|
652
|
+
_tprintf( TEXT("."));
|
653
|
+
} while (dwNumRead);
|
654
|
+
_tprintf( TEXT("\n"));
|
655
|
+
|
656
|
+
CeCloseHandle( hDest);
|
657
|
+
CloseHandle (hSrc);
|
658
|
+
/*
|
659
|
+
if(!wcePutFile (T2A(host_file), T2A(new_app_item))) {
|
660
|
+
printf("Failed to copy file.");
|
661
|
+
return EXIT_FAILURE;
|
662
|
+
}
|
663
|
+
*/
|
664
|
+
}
|
665
|
+
|
666
|
+
}
|
667
|
+
|
668
|
+
return EXIT_SUCCESS;
|
669
|
+
|
670
|
+
copyBundleFailure:
|
671
|
+
CeCloseHandle( hDest);
|
672
|
+
CloseHandle (hSrc);
|
673
|
+
return EXIT_FAILURE;
|
674
|
+
}
|
675
|
+
|
676
|
+
int copyLicenseDll (TCHAR *file_name, TCHAR *app_dir)
|
677
|
+
{
|
678
|
+
TCHAR fullpath[MAX_PATH];
|
679
|
+
int retval = 0;
|
680
|
+
HANDLE hDest, hSrc;
|
681
|
+
BYTE buffer[5120];
|
682
|
+
DWORD dwNumRead, dwNumWritten;
|
683
|
+
|
684
|
+
USES_CONVERSION;
|
685
|
+
|
686
|
+
_tcscpy(fullpath, app_dir);
|
687
|
+
_tcscat(fullpath, _T("\\license_rc.dll"));
|
688
|
+
|
689
|
+
hSrc = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
690
|
+
if (INVALID_HANDLE_VALUE == hSrc) {
|
691
|
+
_tprintf( TEXT("Unable to open host file\n"));
|
692
|
+
return EXIT_FAILURE;
|
693
|
+
}
|
694
|
+
|
695
|
+
hDest = CeCreateFile(fullpath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
696
|
+
if (INVALID_HANDLE_VALUE == hDest ) {
|
697
|
+
_tprintf( TEXT("Unable to open target WinCE file\n"));
|
698
|
+
return CeGetLastError();
|
699
|
+
}
|
700
|
+
|
701
|
+
do {
|
702
|
+
if(ReadFile(hSrc, &buffer, sizeof(buffer), &dwNumRead, NULL)) {
|
703
|
+
if (!CeWriteFile(hDest, &buffer, dwNumRead, &dwNumWritten, NULL)) {
|
704
|
+
_tprintf( TEXT("Error !!! Writing WinCE file\n"));
|
705
|
+
goto copyFailure;
|
706
|
+
}
|
707
|
+
} else {
|
708
|
+
_tprintf( TEXT("Error !!! Reading host file\n"));
|
709
|
+
goto copyFailure;
|
710
|
+
}
|
711
|
+
_tprintf( TEXT("."));
|
712
|
+
} while (dwNumRead);
|
713
|
+
_tprintf( TEXT("\n"));
|
714
|
+
|
715
|
+
CeCloseHandle( hDest);
|
716
|
+
CloseHandle (hSrc);
|
717
|
+
|
718
|
+
return EXIT_SUCCESS;
|
719
|
+
|
720
|
+
copyFailure:
|
721
|
+
CeCloseHandle( hDest);
|
722
|
+
CloseHandle (hSrc);
|
723
|
+
/*
|
724
|
+
|
725
|
+
if (wcePutFile (T2A(file_name), T2A(exe_fullpath)))
|
726
|
+
return EXIT_SUCCESS;
|
727
|
+
*/
|
728
|
+
return EXIT_FAILURE;
|
729
|
+
}
|
730
|
+
|
731
|
+
void startLogServer( TCHAR * log_file, TCHAR* log_port )
|
732
|
+
{
|
733
|
+
// Declare and initialize variables
|
734
|
+
WSADATA wsaData;
|
735
|
+
int iResult;
|
736
|
+
LogServer logSrv(log_file, log_port);
|
737
|
+
|
738
|
+
// Initialize Winsock
|
739
|
+
iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
740
|
+
if (iResult != 0) {
|
741
|
+
printf("WSAStartup failed: %d\n", iResult);
|
742
|
+
return;
|
743
|
+
}
|
744
|
+
|
745
|
+
if (logSrv.init())
|
746
|
+
{
|
747
|
+
logSrv.run();
|
748
|
+
}
|
749
|
+
|
750
|
+
WSACleanup();
|
751
|
+
}
|
752
|
+
|
753
|
+
void simulateKeyInput (int vk, BOOL bExtended, BOOL doDown, BOOL doUp)
|
754
|
+
{
|
755
|
+
KEYBDINPUT kb = {0};
|
756
|
+
INPUT Input = {0};
|
757
|
+
if (doDown) {
|
758
|
+
// generate down
|
759
|
+
if (bExtended)
|
760
|
+
kb.dwFlags = KEYEVENTF_EXTENDEDKEY;
|
761
|
+
kb.wVk = vk;
|
762
|
+
Input.type = INPUT_KEYBOARD;
|
763
|
+
Input.ki = kb;
|
764
|
+
::SendInput(1,&Input,sizeof(Input));
|
765
|
+
}
|
766
|
+
if (doUp) {
|
767
|
+
// generate up
|
768
|
+
::ZeroMemory(&kb,sizeof(KEYBDINPUT));
|
769
|
+
::ZeroMemory(&Input,sizeof(INPUT));
|
770
|
+
kb.dwFlags = KEYEVENTF_KEYUP;
|
771
|
+
if (bExtended)
|
772
|
+
kb.dwFlags |= KEYEVENTF_EXTENDEDKEY;
|
773
|
+
kb.wVk = vk;
|
774
|
+
Input.type = INPUT_KEYBOARD;
|
775
|
+
Input.ki = kb;
|
776
|
+
::SendInput(1,&Input,sizeof(Input));
|
777
|
+
}
|
778
|
+
}
|
779
|
+
|
780
|
+
bool doUseWMDC() {
|
781
|
+
OSVERSIONINFOW os_version;
|
782
|
+
ZeroMemory(&os_version, sizeof(OSVERSIONINFO));
|
783
|
+
os_version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
784
|
+
::GetVersionEx(&os_version);
|
785
|
+
return (os_version.dwMajorVersion >= 6);
|
786
|
+
}
|
787
|
+
|
788
|
+
HWND findWMDCWindow() {
|
789
|
+
return FindWindow(NULL, L"Windows Mobile Device Center");
|
790
|
+
}
|
791
|
+
|
792
|
+
void startWMDC() {
|
793
|
+
if (doUseWMDC()) {
|
794
|
+
if (findWMDCWindow() == 0) {
|
795
|
+
_tprintf( TEXT("WMDC is not running. Starting WMDC...\n") );
|
796
|
+
::system("start %WINDIR%\\WindowsMobile\\wmdc.exe /show");
|
797
|
+
::Sleep(5000);
|
798
|
+
}
|
799
|
+
}
|
800
|
+
}
|
801
|
+
|
802
|
+
void connectWMDC() {
|
803
|
+
if (doUseWMDC()) {
|
804
|
+
HWND hwnd = findWMDCWindow();
|
805
|
+
if (hwnd == 0) {
|
806
|
+
_tprintf( TEXT("Cannot find WMDC window to establish network connection to device emulator.\n") );
|
807
|
+
} else {
|
808
|
+
::SetForegroundWindow(hwnd);
|
809
|
+
::SetFocus(hwnd);
|
810
|
+
::LockSetForegroundWindow(LSFW_LOCK);
|
811
|
+
::Sleep(100);
|
812
|
+
simulateKeyInput(VK_MENU, TRUE, TRUE, FALSE);
|
813
|
+
::Sleep(20);
|
814
|
+
simulateKeyInput('C', FALSE, TRUE, TRUE);
|
815
|
+
::Sleep(20);
|
816
|
+
simulateKeyInput(VK_MENU, TRUE, FALSE, TRUE);
|
817
|
+
::LockSetForegroundWindow(LSFW_UNLOCK);
|
818
|
+
}
|
819
|
+
}
|
820
|
+
}
|
821
|
+
|
767
822
|
bool str_ends_with(const TCHAR* str, const TCHAR* suffix)
|
768
823
|
{
|
769
824
|
if( str == NULL || suffix == NULL )
|
@@ -776,594 +831,617 @@ bool str_ends_with(const TCHAR* str, const TCHAR* suffix)
|
|
776
831
|
return 0;
|
777
832
|
|
778
833
|
return (_wcsnicmp( str + str_len - suffix_len, suffix, suffix_len ) == 0);
|
779
|
-
}
|
780
|
-
|
781
|
-
int _tmain(int argc, _TCHAR* argv[])
|
782
|
-
{
|
783
|
-
TCHAR *emu_name = NULL;
|
784
|
-
TCHAR *cab_file = NULL;
|
785
|
-
TCHAR *bundle_path = NULL;
|
786
|
-
TCHAR *app_exe = NULL;
|
787
|
-
TCHAR *log_file = NULL;
|
788
|
-
TCHAR *log_port = NULL;
|
789
|
-
TCHAR *src_path = NULL;
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
int
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
if (
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
//
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
if
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
_tprintf( TEXT("
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
if(!
|
1209
|
-
_tprintf( TEXT("FAILED\n"));
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
//
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
if
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
_tprintf( TEXT("
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
{
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
}
|
834
|
+
}
|
835
|
+
|
836
|
+
int _tmain(int argc, _TCHAR* argv[])
|
837
|
+
{
|
838
|
+
TCHAR *emu_name = NULL;
|
839
|
+
TCHAR *cab_file = NULL;
|
840
|
+
TCHAR *bundle_path = NULL;
|
841
|
+
TCHAR *app_exe = NULL;
|
842
|
+
TCHAR *log_file = NULL;
|
843
|
+
TCHAR *log_port = NULL;
|
844
|
+
TCHAR *src_path = NULL;
|
845
|
+
TCHAR *lcdll_path = NULL;
|
846
|
+
TCHAR *dst_path = NULL;
|
847
|
+
TCHAR params_buf[MAX_PATH + 16];
|
848
|
+
//WIN32_FIND_DATAW findData;
|
849
|
+
int new_copy = 0;
|
850
|
+
int deploy_type;
|
851
|
+
bool use_shared_runtime = false;
|
852
|
+
|
853
|
+
USES_CONVERSION;
|
854
|
+
|
855
|
+
if (argc > 5) { //assuming that need to start emulator
|
856
|
+
if (strcmp(T2A(argv[1]), "emu") == 0) {
|
857
|
+
emu_name = argv[2];
|
858
|
+
app_name = argv[3];
|
859
|
+
bundle_path = argv[4];
|
860
|
+
app_exe = argv[5];
|
861
|
+
log_port = argv[6];
|
862
|
+
lcdll_path = argv[7];
|
863
|
+
deploy_type = DEPLOY_EMU;
|
864
|
+
}
|
865
|
+
if (strcmp(T2A(argv[1]), "emucab") == 0) {
|
866
|
+
emu_name = argv[2];
|
867
|
+
cab_file = argv[3];
|
868
|
+
app_name = argv[4];
|
869
|
+
//log_port = argv[5];
|
870
|
+
if (strcmp(T2A(argv[5]), "1") == 0)
|
871
|
+
use_shared_runtime = true;
|
872
|
+
deploy_type = DEPLOY_EMUCAB;
|
873
|
+
}
|
874
|
+
|
875
|
+
if (strcmp(T2A(argv[1]), "dev") == 0) {
|
876
|
+
app_name = argv[2];
|
877
|
+
bundle_path = argv[3];
|
878
|
+
app_exe = argv[4];
|
879
|
+
log_port = argv[5];
|
880
|
+
lcdll_path = argv[6];
|
881
|
+
deploy_type = DEPLOY_DEV;
|
882
|
+
}
|
883
|
+
} else if (argc == 5) { //assuming that need to deploy and start on device
|
884
|
+
if (strcmp(T2A(argv[1]), "wk-emu") == 0) {
|
885
|
+
deploy_type = DEPLOY_EMU_WEBKIT;
|
886
|
+
emu_name = argv[2];
|
887
|
+
src_path = argv[3];
|
888
|
+
app_name = argv[4];
|
889
|
+
}
|
890
|
+
else {
|
891
|
+
cab_file = argv[2];
|
892
|
+
app_name = argv[3];
|
893
|
+
//log_port = argv[4];
|
894
|
+
if (strcmp(T2A(argv[4]), "1") == 0)
|
895
|
+
use_shared_runtime = true;
|
896
|
+
deploy_type = DEPLOY_DEVCAB;
|
897
|
+
}
|
898
|
+
} else if (argc == 4) { // log
|
899
|
+
if (strcmp(T2A(argv[1]), "log") == 0) {
|
900
|
+
log_file = argv[2];
|
901
|
+
log_port = argv[3];
|
902
|
+
app_name = _T("");
|
903
|
+
deploy_type = DEPLOY_LOG;
|
904
|
+
}
|
905
|
+
else if (strcmp(T2A(argv[1]), "wk-dev") == 0) {
|
906
|
+
deploy_type = DEPLOY_DEV_WEBKIT;
|
907
|
+
src_path = argv[2];
|
908
|
+
app_name = argv[3];
|
909
|
+
}
|
910
|
+
}
|
911
|
+
else {
|
912
|
+
usage();
|
913
|
+
return EXIT_FAILURE;
|
914
|
+
}
|
915
|
+
if ((!use_shared_runtime) && app_exe)
|
916
|
+
use_shared_runtime = str_ends_with(app_exe, L".lnk");
|
917
|
+
|
918
|
+
TCHAR app_dir[MAX_PATH];
|
919
|
+
_tcscpy(app_dir, TEXT("\\Program Files\\"));
|
920
|
+
_tcscat(app_dir, app_name);
|
921
|
+
_tprintf( TEXT("%s\n"), app_dir);
|
922
|
+
|
923
|
+
if (deploy_type == DEPLOY_EMU) {
|
924
|
+
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) {
|
925
|
+
HANDLE hFind;
|
926
|
+
CE_FIND_DATA findData;
|
927
|
+
|
928
|
+
CreateThread(NULL, 0, startDEM, NULL, 0, NULL);
|
929
|
+
|
930
|
+
_tprintf( TEXT("Starting emulator... "));
|
931
|
+
if (!emuConnect (emu_name)) {
|
932
|
+
_tprintf( TEXT("FAILED\n"));
|
933
|
+
goto stop_emu_deploy;
|
934
|
+
}
|
935
|
+
_tprintf( TEXT("DONE\n"));
|
936
|
+
|
937
|
+
_tprintf( TEXT("Cradle emulator... "));
|
938
|
+
if(!emuCradle (emu_name)) {
|
939
|
+
_tprintf( TEXT("FAILED\n"));
|
940
|
+
goto stop_emu_deploy;
|
941
|
+
}
|
942
|
+
_tprintf( TEXT("DONE\n"));
|
943
|
+
|
944
|
+
if (!wceConnect ()) {
|
945
|
+
printf ("Failed to connect to remote device.\n");
|
946
|
+
goto stop_emu_deploy;
|
947
|
+
} else {
|
948
|
+
// start Windows Mobile Device Center for network connectivity of the device emulator (if applicable)
|
949
|
+
startWMDC();
|
950
|
+
|
951
|
+
hFind = CeFindFirstFile(app_dir, &findData);
|
952
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
953
|
+
_tprintf( TEXT("Application directory on device was not found\n"));
|
954
|
+
|
955
|
+
new_copy = 1;
|
956
|
+
|
957
|
+
if (!CeCreateDirectory(app_dir, NULL)) {
|
958
|
+
printf ("Failed to create app directory\n");
|
959
|
+
goto stop_emu_deploy;
|
960
|
+
}
|
961
|
+
}
|
962
|
+
FindClose( hFind);
|
963
|
+
|
964
|
+
if (!findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
965
|
+
_tprintf( TEXT("Error: target directory is file\n"));
|
966
|
+
goto stop_emu_deploy;
|
967
|
+
}
|
968
|
+
|
969
|
+
|
970
|
+
TCHAR remote_bundle_path[MAX_PATH];
|
971
|
+
|
972
|
+
_tcscpy(remote_bundle_path, app_dir);
|
973
|
+
_tcscat(remote_bundle_path, _T("\\rho"));
|
974
|
+
|
975
|
+
hFind = CeFindFirstFile(remote_bundle_path, &findData);
|
976
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
977
|
+
_tprintf( TEXT("Bundle directory on device was not found\n"));
|
978
|
+
|
979
|
+
if (!CeCreateDirectory(remote_bundle_path, NULL)) {
|
980
|
+
printf ("Failed to create bundle directory\n");
|
981
|
+
goto stop_emu_deploy;
|
982
|
+
}
|
983
|
+
}
|
984
|
+
FindClose( hFind);
|
985
|
+
|
986
|
+
int retval = copyExecutable (app_exe, app_dir, use_shared_runtime);
|
987
|
+
if (retval != EXIT_SUCCESS) {
|
988
|
+
printf ("Failed to copy application executable\n");
|
989
|
+
if (retval == 32) {
|
990
|
+
printf ("Please, stop application on device and try again.\n");
|
991
|
+
}
|
992
|
+
goto stop_emu_deploy;
|
993
|
+
}
|
994
|
+
|
995
|
+
if(!use_shared_runtime)
|
996
|
+
retval = copyLicenseDll(lcdll_path, app_dir);
|
997
|
+
if (retval != EXIT_SUCCESS) {
|
998
|
+
printf ("Failed to copy license dll\n");
|
999
|
+
if (retval == 32) {
|
1000
|
+
printf ("Please, stop application on device and try again.\n");
|
1001
|
+
}
|
1002
|
+
goto stop_emu_deploy;
|
1003
|
+
}
|
1004
|
+
|
1005
|
+
if (copyBundle(bundle_path, _T("/"), remote_bundle_path) == EXIT_FAILURE) {
|
1006
|
+
printf ("Failed to copy bundle\n");
|
1007
|
+
goto stop_emu_deploy;
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
// establish network connectivity of the device emulator from Windows Mobile Device Center (if applicable)
|
1011
|
+
connectWMDC();
|
1012
|
+
|
1013
|
+
emuBringToFront(emu_name);
|
1014
|
+
|
1015
|
+
_tprintf( TEXT("Starting application..."));
|
1016
|
+
TCHAR params[MAX_PATH];
|
1017
|
+
params[0] = 0;
|
1018
|
+
if (use_shared_runtime) {
|
1019
|
+
_tcscpy(params_buf, RE2_RUNTIME);
|
1020
|
+
_tcscpy(params, _T("-approot='\\Program Files\\"));
|
1021
|
+
_tcscat(params, app_name);
|
1022
|
+
_tcscat(params, _T("'"));
|
1023
|
+
} else {
|
1024
|
+
_tcscpy(params_buf, TEXT("\\Program Files\\"));
|
1025
|
+
_tcscat(params_buf, app_name);
|
1026
|
+
_tcscat(params_buf, _T("\\"));
|
1027
|
+
_tcscat(params_buf, app_name);
|
1028
|
+
_tcscat(params_buf, _T(".exe"));
|
1029
|
+
}
|
1030
|
+
//_tcscpy(params, _T("-log="));
|
1031
|
+
//_tcscat(params, log_port);
|
1032
|
+
_tprintf( TEXT("%s %s\n"), params_buf, params);
|
1033
|
+
|
1034
|
+
if(!wceRunProcess(T2A(params_buf), T2A(params))) {
|
1035
|
+
_tprintf( TEXT("FAILED\n"));
|
1036
|
+
goto stop_emu_deploy;
|
1037
|
+
}
|
1038
|
+
_tprintf( TEXT("DONE\n"));
|
1039
|
+
|
1040
|
+
wceDisconnect();
|
1041
|
+
}
|
1042
|
+
|
1043
|
+
CoUninitialize();
|
1044
|
+
|
1045
|
+
ExitProcess(EXIT_SUCCESS);
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
// emu "Windows Mobile 6 Professional Emulator" RhodesApplication1 c:/android/runtime-rhostudio.product/RhodesApplication1/bin/RhoBundle "C:/Android/rhodes/platform/wm/bin/Windows Mobile 6 Professional SDK (ARMV4I)/rhodes/Release/RhodesApplication1.exe" 11000
|
1049
|
+
}
|
1050
|
+
if (deploy_type == DEPLOY_EMUCAB) {
|
1051
|
+
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) {
|
1052
|
+
CreateThread(NULL, 0, startDEM, NULL, 0, NULL);
|
1053
|
+
|
1054
|
+
_tprintf( TEXT("Starting emulator... "));
|
1055
|
+
if (!emuConnect (emu_name)) {
|
1056
|
+
_tprintf( TEXT("FAILED\n"));
|
1057
|
+
goto stop_emu_deploy;
|
1058
|
+
}
|
1059
|
+
_tprintf( TEXT("DONE\n"));
|
1060
|
+
|
1061
|
+
_tprintf( TEXT("Cradle emulator... "));
|
1062
|
+
if(!emuCradle (emu_name)) {
|
1063
|
+
_tprintf( TEXT("FAILED\n"));
|
1064
|
+
goto stop_emu_deploy;
|
1065
|
+
}
|
1066
|
+
_tprintf( TEXT("DONE\n"));
|
1067
|
+
|
1068
|
+
// start Windows Mobile Device Center for network connectivity of the device emulator (if applicable)
|
1069
|
+
startWMDC();
|
1070
|
+
|
1071
|
+
_tprintf( TEXT("Loading cab file..."));
|
1072
|
+
if (!wcePutFile (T2A(cab_file), "")) {
|
1073
|
+
_tprintf( TEXT("FAILED\n"));
|
1074
|
+
goto stop_emu_deploy;
|
1075
|
+
}
|
1076
|
+
_tprintf( TEXT("DONE\n"));
|
1077
|
+
|
1078
|
+
_tprintf( TEXT("Loading utility dll..."));
|
1079
|
+
if (!wcePutFile (RHOSETUP_DLL, "")) {
|
1080
|
+
_tprintf( TEXT("FAILED\n"));
|
1081
|
+
goto stop_emu_deploy;
|
1082
|
+
}
|
1083
|
+
_tprintf( TEXT("DONE\n"));
|
1084
|
+
|
1085
|
+
_tprintf( TEXT("Setup application..."));
|
1086
|
+
|
1087
|
+
//FIXME: rake gives pathname with unix-like '/' file separators,
|
1088
|
+
//so if we want to use this tool outside of rake, we should remember this
|
1089
|
+
//or check and convert cab_file
|
1090
|
+
TCHAR *p = _tcsrchr (cab_file, '/');
|
1091
|
+
if (p) p++;
|
1092
|
+
_tcscpy(params_buf, TEXT("/noui "));
|
1093
|
+
_tcscat(params_buf, p != NULL ? p : cab_file);
|
1094
|
+
|
1095
|
+
if(!wceInvokeCabSetup(T2A(params_buf))) {
|
1096
|
+
_tprintf( TEXT("FAILED\n"));
|
1097
|
+
goto stop_emu_deploy;
|
1098
|
+
}
|
1099
|
+
_tprintf( TEXT("DONE\n"));
|
1100
|
+
|
1101
|
+
// establish network connectivity of the device emulator from Windows Mobile Device Center (if applicable)
|
1102
|
+
connectWMDC();
|
1103
|
+
|
1104
|
+
emuBringToFront(emu_name);
|
1105
|
+
|
1106
|
+
_tprintf( TEXT("Starting application..."));
|
1107
|
+
TCHAR params[MAX_PATH];
|
1108
|
+
params[0] = 0;
|
1109
|
+
if (use_shared_runtime) {
|
1110
|
+
_tcscpy(params_buf, RE2_RUNTIME);
|
1111
|
+
_tcscpy(params, _T("-approot='\\Program Files\\"));
|
1112
|
+
_tcscat(params, app_name);
|
1113
|
+
_tcscat(params, _T("'"));
|
1114
|
+
} else {
|
1115
|
+
_tcscpy(params_buf, TEXT("\\Program Files\\"));
|
1116
|
+
_tcscat(params_buf, app_name);
|
1117
|
+
_tcscat(params_buf, _T("\\"));
|
1118
|
+
_tcscat(params_buf, app_name);
|
1119
|
+
_tcscat(params_buf, _T(".exe"));
|
1120
|
+
}
|
1121
|
+
//_tcscat(params, _T("-log="));
|
1122
|
+
//_tcscat(params, log_port);
|
1123
|
+
_tprintf( TEXT("%s %s\n"), params_buf, params);
|
1124
|
+
|
1125
|
+
if(!wceRunProcess(T2A(params_buf), T2A(params))) {
|
1126
|
+
_tprintf( TEXT("FAILED\n"));
|
1127
|
+
goto stop_emu_deploy;
|
1128
|
+
}
|
1129
|
+
_tprintf( TEXT("DONE\n"));
|
1130
|
+
|
1131
|
+
|
1132
|
+
CoUninitialize();
|
1133
|
+
ExitProcess(EXIT_SUCCESS);
|
1134
|
+
stop_emu_deploy:
|
1135
|
+
CoUninitialize();
|
1136
|
+
ExitProcess(EXIT_FAILURE);
|
1137
|
+
}
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
if (deploy_type == DEPLOY_DEV) {
|
1141
|
+
HANDLE hFind;
|
1142
|
+
CE_FIND_DATA findData;
|
1143
|
+
|
1144
|
+
_tprintf( TEXT("Searching for Windows CE device..."));
|
1145
|
+
|
1146
|
+
HRESULT hRapiResult;
|
1147
|
+
hRapiResult = CeRapiInit();
|
1148
|
+
if (FAILED(hRapiResult)) {
|
1149
|
+
_tprintf( TEXT("FAILED\n"));
|
1150
|
+
return false;
|
1151
|
+
}
|
1152
|
+
_tprintf( TEXT("DONE\n"));
|
1153
|
+
|
1154
|
+
startWMDC();
|
1155
|
+
|
1156
|
+
hFind = CeFindFirstFile(app_dir, &findData);
|
1157
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
1158
|
+
_tprintf( TEXT("Application directory on device was not found\n"));
|
1159
|
+
|
1160
|
+
new_copy = 1;
|
1161
|
+
|
1162
|
+
if (!CeCreateDirectory(app_dir, NULL)) {
|
1163
|
+
printf ("Failed to create app directory\n");
|
1164
|
+
goto stop_emu_deploy;
|
1165
|
+
}
|
1166
|
+
}
|
1167
|
+
FindClose( hFind);
|
1168
|
+
|
1169
|
+
if (!findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
1170
|
+
_tprintf( TEXT("Error: target directory is file\n"));
|
1171
|
+
goto stop_emu_deploy;
|
1172
|
+
}
|
1173
|
+
|
1174
|
+
|
1175
|
+
TCHAR remote_bundle_path[MAX_PATH];
|
1176
|
+
|
1177
|
+
_tcscpy(remote_bundle_path, app_dir);
|
1178
|
+
_tcscat(remote_bundle_path, _T("\\rho"));
|
1179
|
+
|
1180
|
+
hFind = CeFindFirstFile(remote_bundle_path, &findData);
|
1181
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
1182
|
+
_tprintf( TEXT("Bundle directory on device was not found\n"));
|
1183
|
+
|
1184
|
+
if (!CeCreateDirectory(remote_bundle_path, NULL)) {
|
1185
|
+
printf ("Failed to create bundle directory\n");
|
1186
|
+
goto stop_emu_deploy;
|
1187
|
+
}
|
1188
|
+
}
|
1189
|
+
FindClose( hFind);
|
1190
|
+
|
1191
|
+
int retval = copyExecutable (app_exe, app_dir, use_shared_runtime);
|
1192
|
+
if (retval != EXIT_SUCCESS) {
|
1193
|
+
printf ("Failed to copy application executable\n");
|
1194
|
+
if (retval == 32) {
|
1195
|
+
printf ("Please, stop application on device and try again.\n");
|
1196
|
+
}
|
1197
|
+
goto stop_emu_deploy;
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
if(!use_shared_runtime)
|
1201
|
+
retval = copyLicenseDll(lcdll_path, app_dir);
|
1202
|
+
if (retval != EXIT_SUCCESS) {
|
1203
|
+
printf ("Failed to copy license dll\n");
|
1204
|
+
if (retval == 32) {
|
1205
|
+
printf ("Please, stop application on device and try again.\n");
|
1206
|
+
}
|
1207
|
+
goto stop_emu_deploy;
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
if (copyBundle(bundle_path, _T("/"), remote_bundle_path) == EXIT_FAILURE) {
|
1211
|
+
printf ("Failed to copy bundle\n");
|
1212
|
+
goto stop_emu_deploy;
|
1213
|
+
}
|
1214
|
+
|
1215
|
+
// establish network connectivity of the device from Windows Mobile Device Center (if applicable)
|
1216
|
+
connectWMDC();
|
1217
|
+
|
1218
|
+
Sleep(2 * 1000);
|
1219
|
+
|
1220
|
+
_tprintf( TEXT("Starting application..."));
|
1221
|
+
TCHAR params[MAX_PATH];
|
1222
|
+
params[0] = 0;
|
1223
|
+
if (use_shared_runtime) {
|
1224
|
+
_tcscpy(params_buf, RE2_RUNTIME);
|
1225
|
+
_tcscpy(params, _T("-approot='\\Program Files\\"));
|
1226
|
+
_tcscat(params, app_name);
|
1227
|
+
_tcscat(params, _T("'"));
|
1228
|
+
} else {
|
1229
|
+
_tcscpy(params_buf, TEXT("\\Program Files\\"));
|
1230
|
+
_tcscat(params_buf, app_name);
|
1231
|
+
_tcscat(params_buf, _T("\\"));
|
1232
|
+
_tcscat(params_buf, app_name);
|
1233
|
+
_tcscat(params_buf, _T(".exe"));
|
1234
|
+
}
|
1235
|
+
//_tcscat(params, _T("-log="));
|
1236
|
+
//_tcscat(params, log_port);
|
1237
|
+
_tprintf( TEXT("%s %s\n"), params_buf, params);
|
1238
|
+
|
1239
|
+
if(!wceRunProcess(T2A(params_buf), T2A(params))) {
|
1240
|
+
_tprintf( TEXT("FAILED\n"));
|
1241
|
+
goto stop_emu_deploy;
|
1242
|
+
}
|
1243
|
+
_tprintf( TEXT("DONE\n"));
|
1244
|
+
|
1245
|
+
ExitProcess(EXIT_SUCCESS);
|
1246
|
+
}
|
1247
|
+
|
1248
|
+
if (deploy_type == DEPLOY_DEVCAB) {
|
1249
|
+
_tprintf( TEXT("Searching for Windows CE device..."));
|
1250
|
+
|
1251
|
+
HRESULT hRapiResult;
|
1252
|
+
hRapiResult = CeRapiInit();
|
1253
|
+
if (FAILED(hRapiResult)) {
|
1254
|
+
_tprintf( TEXT("FAILED\n"));
|
1255
|
+
return false;
|
1256
|
+
}
|
1257
|
+
_tprintf( TEXT("DONE\n"));
|
1258
|
+
|
1259
|
+
startWMDC();
|
1260
|
+
|
1261
|
+
_tprintf( TEXT("Loading cab file to device..."));
|
1262
|
+
USES_CONVERSION;
|
1263
|
+
if (!wcePutFile (T2A(cab_file), "")) {
|
1264
|
+
_tprintf( TEXT("FAILED\n"));
|
1265
|
+
goto stop_emu_deploy;
|
1266
|
+
}
|
1267
|
+
_tprintf( TEXT("DONE\n"));
|
1268
|
+
|
1269
|
+
_tprintf( TEXT("Loading utility dll..."));
|
1270
|
+
if (!wcePutFile (RHOSETUP_DLL, "")) {
|
1271
|
+
_tprintf( TEXT("FAILED\n"));
|
1272
|
+
goto stop_emu_deploy;
|
1273
|
+
}
|
1274
|
+
_tprintf( TEXT("DONE\n"));
|
1275
|
+
|
1276
|
+
_tprintf( TEXT("Setup application..."));
|
1277
|
+
|
1278
|
+
//FIXME: rake gives pathname with unix-like '/' file separators,
|
1279
|
+
//so if we want to use this tool outside of rake, we should remember this
|
1280
|
+
//or check and convert cab_file
|
1281
|
+
TCHAR *p = _tcsrchr (cab_file, '/');
|
1282
|
+
if (p) p++;
|
1283
|
+
_tcscpy(params_buf, p != NULL ? p : cab_file);
|
1284
|
+
//_tcscat(params_buf, p != NULL ? p : cab_file);
|
1285
|
+
|
1286
|
+
if(!wceInvokeCabSetup(T2A(params_buf))) {
|
1287
|
+
_tprintf( TEXT("FAILED\n"));
|
1288
|
+
|
1289
|
+
_tprintf( TEXT("Starting installator GUI ..."));
|
1290
|
+
if(!wceRunProcess ("\\windows\\wceload.exe", T2A(p != NULL ? p : cab_file))) {
|
1291
|
+
_tprintf( TEXT("FAILED\n"));
|
1292
|
+
ExitProcess(EXIT_FAILURE);
|
1293
|
+
} else {
|
1294
|
+
_tprintf( TEXT("DONE\n"));
|
1295
|
+
_tprintf( TEXT("Please continue manually...\n"));
|
1296
|
+
ExitProcess(EXIT_SUCCESS);
|
1297
|
+
}
|
1298
|
+
|
1299
|
+
goto stop_emu_deploy;
|
1300
|
+
}
|
1301
|
+
_tprintf( TEXT("DONE\n"));
|
1302
|
+
|
1303
|
+
// establish network connectivity of the device from Windows Mobile Device Center (if applicable)
|
1304
|
+
connectWMDC();
|
1305
|
+
|
1306
|
+
_tprintf( TEXT("Starting application..."));
|
1307
|
+
TCHAR params[MAX_PATH];
|
1308
|
+
params[0] = 0;
|
1309
|
+
if (use_shared_runtime) {
|
1310
|
+
_tcscpy(params_buf, RE2_RUNTIME);
|
1311
|
+
_tcscpy(params, _T("-approot='\\Program Files\\"));
|
1312
|
+
_tcscat(params, app_name);
|
1313
|
+
_tcscat(params, _T("'"));
|
1314
|
+
} else {
|
1315
|
+
_tcscpy(params_buf, TEXT("\\Program Files\\"));
|
1316
|
+
_tcscat(params_buf, app_name);
|
1317
|
+
_tcscat(params_buf, _T("\\"));
|
1318
|
+
_tcscat(params_buf, app_name);
|
1319
|
+
_tcscat(params_buf, _T(".exe"));
|
1320
|
+
}
|
1321
|
+
//_tcscat(params, _T("-log="));
|
1322
|
+
//_tcscat(params, log_port);
|
1323
|
+
_tprintf( TEXT("%s %s\n"), params_buf, params);
|
1324
|
+
|
1325
|
+
if(!wceRunProcess (T2A(params_buf), T2A(params))) {
|
1326
|
+
_tprintf( TEXT("FAILED\n"));
|
1327
|
+
goto stop_emu_deploy;
|
1328
|
+
}
|
1329
|
+
_tprintf( TEXT("DONE\n"));
|
1330
|
+
}
|
1331
|
+
|
1332
|
+
if (deploy_type == DEPLOY_LOG)
|
1333
|
+
{
|
1334
|
+
if (log_file != NULL) {
|
1335
|
+
startLogServer(log_file, log_port);
|
1336
|
+
}
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
if (deploy_type == DEPLOY_DEV_WEBKIT)
|
1340
|
+
{
|
1341
|
+
HANDLE hFind;
|
1342
|
+
CE_FIND_DATA findData;
|
1343
|
+
|
1344
|
+
_tprintf( TEXT("Searching for Windows CE device..."));
|
1345
|
+
|
1346
|
+
HRESULT hRapiResult;
|
1347
|
+
hRapiResult = CeRapiInit();
|
1348
|
+
if (FAILED(hRapiResult)) {
|
1349
|
+
_tprintf( TEXT("FAILED\n"));
|
1350
|
+
return false;
|
1351
|
+
}
|
1352
|
+
_tprintf( TEXT("DONE\n"));
|
1353
|
+
|
1354
|
+
hFind = CeFindFirstFile(app_dir, &findData);
|
1355
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
1356
|
+
_tprintf( TEXT("Application directory on device was not found\n"));
|
1357
|
+
|
1358
|
+
new_copy = 1;
|
1359
|
+
|
1360
|
+
if (!CeCreateDirectory(app_dir, NULL)) {
|
1361
|
+
printf ("Failed to create app directory\n");
|
1362
|
+
goto stop_emu_deploy;
|
1363
|
+
}
|
1364
|
+
}
|
1365
|
+
FindClose( hFind);
|
1366
|
+
|
1367
|
+
if (!findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
1368
|
+
_tprintf( TEXT("Error: target directory is file\n"));
|
1369
|
+
goto stop_emu_deploy;
|
1370
|
+
}
|
1371
|
+
|
1372
|
+
_tprintf( TEXT("Load file to device..."));
|
1373
|
+
USES_CONVERSION;
|
1374
|
+
if (copyBundle(src_path, _T("/"), app_dir) == EXIT_FAILURE) {
|
1375
|
+
printf ("Failed to copy bundle\n");
|
1376
|
+
goto stop_emu_deploy;
|
1377
|
+
}
|
1378
|
+
|
1379
|
+
_tprintf( TEXT("DONE\n"));
|
1380
|
+
}
|
1381
|
+
|
1382
|
+
if (deploy_type == DEPLOY_EMU_WEBKIT)
|
1383
|
+
{
|
1384
|
+
//HANDLE hFind;
|
1385
|
+
//CE_FIND_DATA findData;
|
1386
|
+
|
1387
|
+
_tprintf( TEXT("Searching for Windows CE device..."));
|
1388
|
+
|
1389
|
+
if (SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED)))
|
1390
|
+
{
|
1391
|
+
HANDLE hFind;
|
1392
|
+
CE_FIND_DATA findData;
|
1393
|
+
|
1394
|
+
CreateThread(NULL, 0, startDEM, NULL, 0, NULL);
|
1395
|
+
|
1396
|
+
_tprintf( TEXT("Starting emulator... "));
|
1397
|
+
if (!emuConnect (emu_name)) {
|
1398
|
+
_tprintf( TEXT("FAILED\n"));
|
1399
|
+
goto stop_emu_deploy;
|
1400
|
+
}
|
1401
|
+
_tprintf( TEXT("DONE\n"));
|
1402
|
+
|
1403
|
+
_tprintf( TEXT("Cradle emulator... "));
|
1404
|
+
if(!emuCradle (emu_name)) {
|
1405
|
+
_tprintf( TEXT("FAILED\n"));
|
1406
|
+
goto stop_emu_deploy;
|
1407
|
+
}
|
1408
|
+
_tprintf( TEXT("DONE\n"));
|
1409
|
+
|
1410
|
+
if (!wceConnect ()) {
|
1411
|
+
printf ("Failed to connect to remote device.\n");
|
1412
|
+
goto stop_emu_deploy;
|
1413
|
+
} else {
|
1414
|
+
hFind = CeFindFirstFile(app_dir, &findData);
|
1415
|
+
if (INVALID_HANDLE_VALUE == hFind) {
|
1416
|
+
_tprintf( TEXT("Application directory on device was not found\n"));
|
1417
|
+
|
1418
|
+
new_copy = 1;
|
1419
|
+
|
1420
|
+
if (!CeCreateDirectory(app_dir, NULL)) {
|
1421
|
+
printf ("Failed to create app directory\n");
|
1422
|
+
goto stop_emu_deploy;
|
1423
|
+
}
|
1424
|
+
}
|
1425
|
+
FindClose( hFind);
|
1426
|
+
|
1427
|
+
if (!findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
1428
|
+
_tprintf( TEXT("Error: target directory is file\n"));
|
1429
|
+
goto stop_emu_deploy;
|
1430
|
+
}
|
1431
|
+
|
1432
|
+
_tprintf( TEXT("Load files to device..."));
|
1433
|
+
USES_CONVERSION;
|
1434
|
+
if (copyBundle(src_path, _T("/"), app_dir) == EXIT_FAILURE) {
|
1435
|
+
printf ("Failed to copy bundle\n");
|
1436
|
+
goto stop_emu_deploy;
|
1437
|
+
}
|
1438
|
+
|
1439
|
+
_tprintf( TEXT("DONE\n"));
|
1440
|
+
|
1441
|
+
emuBringToFront(emu_name);
|
1442
|
+
}
|
1443
|
+
}
|
1444
|
+
}
|
1445
|
+
|
1446
|
+
return EXIT_SUCCESS;
|
1447
|
+
}
|