Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

690 lines
22 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // Class: NDPHost
  4. //
  5. // Fusion ClickOnce NDP Application host
  6. //
  7. // Date: 12/7/2001
  8. //
  9. // Copyright (c) Microsoft, 2001
  10. //
  11. //-----------------------------------------------------------------------------
  12. using System;
  13. using System.Text;
  14. using System.Net;
  15. using System.IO;
  16. using System.Text.RegularExpressions;
  17. using System.Runtime.Remoting;
  18. using System.Globalization;
  19. using System.Security;
  20. using System.Security.Policy;
  21. using System.Security.Permissions;
  22. using System.Collections;
  23. using System.Runtime.InteropServices;
  24. using System.Reflection;
  25. using System.Configuration.Assemblies;
  26. using Avalon.Security;
  27. [assembly:AssemblyCultureAttribute("")]
  28. [assembly:AssemblyVersionAttribute("1.0.1218.0")]
  29. [assembly:AssemblyKeyFileAttribute(/*"..\..\*/"NDPHostKey.snk")]
  30. [assembly:AssemblyTitleAttribute("Microsoft Application Deployment Framework .Net Assembly Execute Host")]
  31. [assembly:AssemblyDescriptionAttribute("Microsoft Application Deployment Framework - NDP Hosting for .Net assemblies")]
  32. [assembly:AssemblyProductAttribute("Microsoft Application Deployment Framework")]
  33. [assembly:AssemblyInformationalVersionAttribute("1.0.0.0")]
  34. [assembly:AssemblyTrademarkAttribute("Microsoft� is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation")]
  35. [assembly:AssemblyCompanyAttribute("Microsoft Corporation")]
  36. [assembly:AssemblyCopyrightAttribute("Copyright � Microsoft Corp. 1999-2002. All rights reserved.")]
  37. [assembly:System.CLSCompliant(true)]
  38. namespace Microsoft.Fusion.ADF
  39. {
  40. //----------------------------------------------------------------------------
  41. // class NDPHost
  42. //----------------------------------------------------------------------------
  43. public class NDPHost : MarshalByRefObject
  44. {
  45. // cmd arg ordinals.
  46. enum eCmd : int
  47. {
  48. AppBase,
  49. AsmName,
  50. AsmClass,
  51. AsmMethod,
  52. AsmArgs,
  53. Url,
  54. Zone,
  55. ManifestPath,
  56. SecurityStatement,
  57. Max
  58. }
  59. // internal strings.
  60. string _sAppBase = null;
  61. string _sAsmName = null;
  62. string _sAsmClass = null;
  63. string _sAsmMethod = null;
  64. string _sAsmArgs = null;
  65. string _sUrl = null;
  66. string _sZone = null;
  67. string _sManifestPath = null;
  68. string _sSecurityStatement = null;
  69. Zone _zZone = null;
  70. static bool g_fLoadingAssembly = false;
  71. static string[] g_sZones = {"MyComputer", "Intranet", "Trusted", "Internet", "Untrusted"};
  72. //----------------------------------------------------------------------------
  73. // ctor
  74. //----------------------------------------------------------------------------
  75. public NDPHost()
  76. {
  77. }
  78. //----------------------------------------------------------------------------
  79. // ctor
  80. // Not used currently, but possibly useful for CreateInstanceFrom w/args to ctor.
  81. //----------------------------------------------------------------------------
  82. public NDPHost(string[] args)
  83. {
  84. LoadFromStrings(args);
  85. }
  86. //----------------------------------------------------------------------------
  87. // Main
  88. //----------------------------------------------------------------------------
  89. public static void Main(string[] sCmdLine)
  90. {
  91. NDPHost ndpHost= new NDPHost();
  92. try
  93. {
  94. ndpHost.ParseCmdLine(sCmdLine);
  95. ndpHost.ParseManifest();
  96. ndpHost.LaunchApp();
  97. }
  98. catch(ArgumentException e)
  99. {
  100. if ((e.Message == "Invalid Command Line"))
  101. Usage();
  102. else
  103. throw(e);
  104. }
  105. }
  106. //----------------------------------------------------------------------------
  107. // LaunchApp
  108. //----------------------------------------------------------------------------
  109. public void LaunchApp()
  110. {
  111. Evidence securityEvidence = null;
  112. PolicyLevel appPolicy = null;
  113. try
  114. {
  115. if (GetTMEvidenceAndPolicy(ref securityEvidence, ref appPolicy) != true)
  116. {
  117. System.Windows.Forms.MessageBox.Show("Application Failed to Run Due to Insufficient Permissions");
  118. Console.WriteLine("Application Failed to Run Due to Insufficient Permissions");
  119. return;
  120. }
  121. }
  122. catch(System.IO.FileNotFoundException fnfe)
  123. {
  124. Console.WriteLine("==\nBinding to Avalon throws: " + fnfe + "==\n");
  125. // Construct the Evidence object from url, zone.
  126. securityEvidence = ConstructEvidence();
  127. // Construct PolicyLevel object from entry file path, Evidence object.
  128. appPolicy = ConstructAppPolicy(securityEvidence);
  129. securityEvidence = null; // do not set evidence on appdomain
  130. }
  131. // Run app given entry path, type and PolicyLevel object.
  132. ExecuteApplication(appPolicy, securityEvidence);
  133. }
  134. //----------------------------------------------------------------------------
  135. // ParseCmdLine
  136. //----------------------------------------------------------------------------
  137. public void ParseCmdLine(string[] sCmdLine)
  138. {
  139. Console.WriteLine("\nParsing Comand Line...");
  140. if ((sCmdLine.Length != 2))
  141. throw new ArgumentException("Invalid Command Line");
  142. _sManifestPath = sCmdLine[0];
  143. _sUrl = sCmdLine[1];
  144. Uri appBaseUri = new Uri(_sManifestPath);
  145. string localPath = appBaseUri.LocalPath;//AbsolutePath;
  146. _sAppBase = System.IO.Path.GetDirectoryName(localPath) + "\\";
  147. _zZone = System.Security.Policy.Zone.CreateFromUrl(_sUrl);
  148. _sZone = ZoneToString(_zZone.SecurityZone);
  149. Console.WriteLine("\n");
  150. Console.WriteLine("ManifestPath=\t" + _sManifestPath);
  151. Console.WriteLine("AppBase=\t" + _sAppBase);
  152. Console.WriteLine("Url=\t\t" + _sUrl);
  153. Console.WriteLine("Zone=\t\t" + _sZone);
  154. }
  155. //----------------------------------------------------------------------------
  156. // ParseManifest
  157. //----------------------------------------------------------------------------
  158. public void ParseManifest()
  159. {
  160. Uri sManifestUri = new Uri(_sManifestPath);
  161. ApplicationManifestImport ami = new ApplicationManifestImport(sManifestUri);
  162. ActivationInfo ai = ami.GetActivationInfo();
  163. SecurityInfo si = ami.GetSecurityInfo();
  164. _sAsmName = ai["assemblyName"];
  165. _sAsmClass = ai["assemblyClass"];
  166. _sAsmMethod = ai["assemblyMethod"];
  167. _sAsmArgs = ai["assemblyMethodArgs"];
  168. if (si != null)
  169. _sSecurityStatement = si["Security"];
  170. Console.WriteLine("AsmName=\t" + _sAsmName);
  171. Console.WriteLine("Class=\t\t" + _sAsmClass);
  172. Console.WriteLine("Method=\t\t" + _sAsmMethod);
  173. Console.WriteLine("Args=\t\t" + _sAsmArgs);
  174. Console.WriteLine("\n");
  175. Console.WriteLine("Security=\t\t" + _sSecurityStatement);
  176. }
  177. //----------------------------------------------------------------------------
  178. // GetTMEvidenceAndPolicy
  179. //----------------------------------------------------------------------------
  180. public bool GetTMEvidenceAndPolicy(ref Evidence securityEvidence, ref PolicyLevel appPolicy)
  181. {
  182. SecurityManifest sm = null;
  183. if (_sSecurityStatement != null)
  184. sm = new SecurityManifest(_sSecurityStatement);
  185. else
  186. sm = new SecurityManifest();
  187. // setup object for domain specifically to get trust.
  188. // for demo hack, securityEvidence = null at first, then set to additional evidence returned.
  189. TrustDecision trustDecision = TrustManager.EvaluateTrustRequest(sm, securityEvidence, "file://"+_sAppBase);
  190. if (trustDecision.Action == BasicTrustAction.Deny)
  191. return false;
  192. appPolicy = TrustManager.CreatePolicyLevel(trustDecision);
  193. securityEvidence = trustDecision.DomainEvidence;
  194. return true;
  195. }
  196. //----------------------------------------------------------------------------
  197. // ConstructEvidence
  198. //----------------------------------------------------------------------------
  199. public Evidence ConstructEvidence()
  200. {
  201. Console.WriteLine("Constructing Evidence...");
  202. Evidence securityEvidence = new Evidence();
  203. securityEvidence.AddHost(_zZone);
  204. if ((new Uri(_sUrl)).IsFile)
  205. Console.WriteLine(" Skipping Site evidence for file://");
  206. else
  207. securityEvidence.AddHost( System.Security.Policy.Site.CreateFromUrl(_sUrl) );
  208. // bugbug - add the actual url.
  209. return securityEvidence;
  210. }
  211. //----------------------------------------------------------------------------
  212. // ConstructAppPolicy
  213. //----------------------------------------------------------------------------
  214. public PolicyLevel ConstructAppPolicy(Evidence securityEvidence)
  215. {
  216. Console.WriteLine("Constructing App Policy Level...");
  217. // NOTENOTE: not effective if not both url and zone in evidence
  218. // Populate the PolicyLevel with code groups that will do the following:
  219. // 1) For all assemblies that come from this app's cache directory,
  220. // give permissions from retrieved permission set from SecurityManager.
  221. // 2) For all other assemblies, give FullTrust permission set. Remember,
  222. // since the permissions will be intersected with other policy levels,
  223. // just because we grant full trust to all other assemblies does not mean
  224. // those assemblies will end up with full trust.
  225. PolicyLevel AppPolicy = null;
  226. // ResolvePolicy will return a System.Security.PermissionSet
  227. PermissionSet AppPerms = SecurityManager.ResolvePolicy(securityEvidence);
  228. // Create a new System.Security.Policy.PolicyStatement that does not contain any permissions.
  229. PolicyStatement Nada = new PolicyStatement(new PermissionSet(PermissionState.None));//PermissionSet());
  230. // Create a PolicyStatement for the permissions that we want to grant to code from the app directory:
  231. PolicyStatement AppStatement = new PolicyStatement(AppPerms);
  232. // Create Full trust PolicyStatement so all other code gets full trust, by passing in an _unrestricted_ PermissionSet
  233. PolicyStatement FullTrustStatement = new PolicyStatement(new PermissionSet(PermissionState.Unrestricted));
  234. // Create a System.Security.Policy.FirstMatchCodeGroup as the root that matches all
  235. // assemblies by supplying an AllMembershipCondition:
  236. FirstMatchCodeGroup RootCG = new FirstMatchCodeGroup(new AllMembershipCondition(), Nada);
  237. // Create a child UnionCodeGroup to handle the assemblies from the app cache. We do this
  238. // by using a UrlMembershipCondition set to the app cache directory:
  239. UnionCodeGroup AppCG = new UnionCodeGroup(new UrlMembershipCondition("file://"+_sAppBase+"*"), AppStatement);
  240. // Add AppCG to RootCG as first child. This is important because we need it to be evaluated first
  241. RootCG.AddChild(AppCG);
  242. // Create a second child UnionCodeGroup to handle all other code, by using the AllMembershipCondition again
  243. UnionCodeGroup AllCG = new UnionCodeGroup(new AllMembershipCondition(), FullTrustStatement);
  244. // Add AllCG to RootCG after AppCG. If AppCG doesnt apply to the assembly, AllCG will.
  245. RootCG.AddChild(AllCG);
  246. // This will be the PolicyLevel that we will associate with the new AppDomain.
  247. AppPolicy = PolicyLevel.CreateAppDomainLevel();
  248. // Set the RootCG as the root code group on the new policy level
  249. AppPolicy.RootCodeGroup = RootCG;
  250. // NOTENOTE
  251. // Code from the site that lives on the local machine will get the reduced permissions as expected.
  252. // Dependencies of this app (not under app dir or maybe dependencies that live in the GAC) would still get full trust.
  253. // If the full trust dependencies need to do something trusted, they carry the burden of asserting to overcome the stack walk.
  254. return AppPolicy;
  255. }
  256. //----------------------------------------------------------------------------
  257. // ExecuteApplication
  258. //----------------------------------------------------------------------------
  259. public void ExecuteApplication(PolicyLevel AppPolicy, Evidence securityEvidence)
  260. {
  261. Console.WriteLine("Executing Application...");
  262. // setup object for new domain
  263. AppDomainSetup appDomainSetup = new AppDomainSetup();
  264. // app base, config file name and friendly name = host name.
  265. appDomainSetup.ApplicationBase = _sAppBase;
  266. appDomainSetup.ConfigurationFile = GetConfigFileName();
  267. AppDomain dom = AppDomain.CreateDomain(GetHostName(), securityEvidence, appDomainSetup);
  268. // Set the policy level on the domain.
  269. dom.SetAppDomainPolicy(AppPolicy);
  270. // Normal exe case.
  271. if (_sAsmMethod == "")
  272. {
  273. Console.WriteLine("\nRunning ExecuteAssembly in: " + GetExeFilePath());
  274. // bugbug - question security guys on whether or not useful to have evidence passed in.
  275. dom.ExecuteAssembly(GetExeFilePath());
  276. }
  277. // Library entry case.
  278. else
  279. {
  280. Console.WriteLine("\nRunning "+_sAsmMethod+" in Assembly: "+_sAsmName);
  281. // Hosted code metadata must be present in both default app domain
  282. // and remote app domain. Load NDPHost assembly into remote domain.
  283. AssemblyName asmName = Assembly.GetExecutingAssembly().GetName();
  284. // Instance the NDPHost class with default constructor.
  285. ObjectHandle objhNDP = dom.CreateInstanceFrom(asmName.CodeBase, "Microsoft.Fusion.ADF.NDPHost");
  286. // Unwrap the handle.
  287. NDPHost objNDP = (NDPHost) objhNDP.Unwrap();
  288. // Get a string array representation of this object in the current app domain.
  289. string[] s = this.LoadToStrings();
  290. // Do the real construction in the remote domain.
  291. objNDP.LoadFromStrings(s);
  292. // Load the assembly resolve handler in the remote domain.
  293. objNDP.LoadResolveEventHandler();
  294. // Run the method.
  295. objNDP.ExecMethod();
  296. // NOTE: why doesn't the following construction work?
  297. // ObjectHandle objhNDP = dom.CreateInstanceFrom(asmName.CodeBase, "NDPHost", true,
  298. // BindingFlags.Instance|BindingFlags.Public|BindingFlags.DeclaredOnly,
  299. // null, (object[]) s, null, null, null);
  300. }
  301. }
  302. //----------------------------------------------------------------------------
  303. // ExecMethod
  304. //----------------------------------------------------------------------------
  305. public void ExecMethod()
  306. {
  307. new PermissionSet(PermissionState.Unrestricted).Assert();
  308. // Load the assembly.
  309. Assembly assembly = Assembly.Load(_sAsmName);
  310. // Instance the class.
  311. Object objInstance = assembly.CreateInstance(_sAsmClass, false);
  312. // Pass args as 0th element of object array. Slight hack
  313. // because we canonicalize against app base. Likely should
  314. // make first arg equal to appbase, + subsequent args.
  315. string sAppEntryPoint = _sAppBase + _sAsmArgs;
  316. Object [] objArgs = new Object [] {new String[] {sAppEntryPoint}};
  317. // Retrieve method from class instance.
  318. MethodInfo method = objInstance.GetType().GetMethod(_sAsmMethod,
  319. BindingFlags.Instance|BindingFlags.Public|BindingFlags.DeclaredOnly);
  320. // Invoke the method.
  321. try
  322. {
  323. Object pRet=method.Invoke(objInstance, objArgs);
  324. }
  325. catch(Exception e)
  326. {
  327. // bugbug - show base exception text instead.
  328. Console.WriteLine(e.ToString());
  329. throw e.GetBaseException();
  330. }
  331. }
  332. //----------------------------------------------------------------------------
  333. // LoadResolveEventHandler
  334. //----------------------------------------------------------------------------
  335. public void LoadResolveEventHandler()
  336. {
  337. // ISSUE - onDemand download disabled for M2
  338. //AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(OnAssemblyResolve);
  339. }
  340. //----------------------------------------------------------------------------
  341. // OnAssemblyResolve
  342. //----------------------------------------------------------------------------
  343. private Assembly OnAssemblyResolve(Object sender, ResolveEventArgs args)
  344. {
  345. new PermissionSet(PermissionState.Unrestricted).Assert();
  346. Assembly assembly = null;
  347. if (g_fLoadingAssembly)
  348. goto done;
  349. g_fLoadingAssembly=true;
  350. string[] sAssemblyNameParts = args.Name.Split(new Char[] {','}, 2);
  351. string sAssemblyName = sAssemblyNameParts[0] + ".dll";
  352. try
  353. {
  354. GetFile(sAssemblyName);
  355. }
  356. catch
  357. {
  358. g_fLoadingAssembly=false;
  359. goto done;
  360. }
  361. try
  362. {
  363. assembly = Assembly.Load(args.Name);
  364. }
  365. catch
  366. {
  367. assembly = null;
  368. }
  369. finally
  370. {
  371. g_fLoadingAssembly=false;
  372. }
  373. done:
  374. return assembly;
  375. }
  376. //----------------------------------------------------------------------------
  377. // GetFile
  378. //----------------------------------------------------------------------------
  379. private void GetFile(string name)
  380. {
  381. HttpWebResponse Response;
  382. //Retrieve the File
  383. HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create(_sUrl + name);
  384. try
  385. {
  386. Response = (HttpWebResponse)Request.GetResponse();
  387. }
  388. catch(WebException e)
  389. {
  390. Console.WriteLine(e.ToString());
  391. throw e;
  392. // BUGBUG: apply probing rules?
  393. }
  394. Stream responseStream = Response.GetResponseStream();
  395. // setup UI
  396. // BUGBUG: allow no UI case?
  397. // BUGBUG: test with file > 4GB
  398. Int64 totalLength = 0;
  399. int factor = (int) (Response.ContentLength / int.MaxValue);
  400. int max = int.MaxValue;
  401. if (factor <= 1)
  402. {
  403. factor = 1;
  404. max = (int) Response.ContentLength;
  405. }
  406. if (max <= -1)
  407. {
  408. // no content length returned from the server (-1),
  409. // or error (what does < -1 mean?)
  410. // no progress, set max to 0
  411. max = 0;
  412. }
  413. DownloadStatus statusForm = new DownloadStatus(0, max);
  414. statusForm.SetStatus(0);
  415. statusForm.Show();
  416. // write from stream to disk
  417. byte[] buffer = new byte[4096];
  418. int length;
  419. try
  420. {
  421. FileStream AFile = File.Open(_sAppBase+name, FileMode.Create, FileAccess.ReadWrite);
  422. length = responseStream.Read(buffer, 0, 4096);
  423. while ( length != 0 )
  424. {
  425. AFile.Write(buffer, 0, length);
  426. if (max != 0)
  427. {
  428. totalLength += length;
  429. statusForm.SetStatus((int) (totalLength/factor));
  430. }
  431. length = responseStream.Read(buffer, 0, 4096);
  432. // dispatch messages
  433. System.Windows.Forms.Application.DoEvents();
  434. }
  435. AFile.Close();
  436. statusForm.SetMessage("Download complete");
  437. }
  438. catch(Exception e)
  439. {
  440. statusForm.SetMessage(e.Message);
  441. // BUGBUG: AFile may not be closed
  442. }
  443. responseStream.Close();
  444. //Pause for a moment to show the status dialog in
  445. //case the app downloaded extremely quickly (small file?).
  446. statusForm.Refresh();
  447. System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));
  448. statusForm.Close();
  449. }
  450. //----------------------------------------------------------------------------
  451. // ValidateParams
  452. //----------------------------------------------------------------------------
  453. public void ValidateParams(string[] s)
  454. {
  455. // appbase, asmname, url required.
  456. if (((s[(int) eCmd.AppBase] == "")
  457. || (s[(int) eCmd.AsmName] == "")
  458. || (s[(int) eCmd.Url] == "")))
  459. throw new ArgumentException("Invalid Parameters");
  460. // if class or method specified, must specify both.
  461. if (((s[(int)eCmd.AsmMethod] != "") && (s[(int)eCmd.AsmClass] == ""))
  462. || ((s[(int)eCmd.AsmMethod] == "") && (s[(int)eCmd.AsmClass] != "")))
  463. throw new ArgumentException("Invalid Parameters");
  464. }
  465. //----------------------------------------------------------------------------
  466. // LoadFromStrings
  467. //----------------------------------------------------------------------------
  468. public void LoadFromStrings(string[] s)
  469. {
  470. ValidateParams(s);
  471. _sAppBase = s[(int) eCmd.AppBase];
  472. _sAsmName=s[(int) eCmd.AsmName];
  473. _sAsmClass=s[(int) eCmd.AsmClass];
  474. _sAsmMethod=s[(int) eCmd.AsmMethod];
  475. _sAsmArgs=s[(int) eCmd.AsmArgs];
  476. _sUrl = s[(int) eCmd.Url];
  477. _sZone=s[(int) eCmd.Zone];
  478. _zZone = new Zone((System.Security.SecurityZone)StringToZone(_sZone));
  479. _sManifestPath = s[(int) eCmd.ManifestPath];
  480. _sSecurityStatement = s[(int) eCmd.SecurityStatement];
  481. }
  482. //----------------------------------------------------------------------------
  483. // LoadToStrings
  484. //----------------------------------------------------------------------------
  485. public string[] LoadToStrings()
  486. {
  487. string[] s = new string[(int) eCmd.Max];
  488. s[(int) eCmd.AppBase] = _sAppBase;
  489. s[(int) eCmd.AsmName]=_sAsmName;
  490. s[(int) eCmd.AsmClass]=_sAsmClass;
  491. s[(int) eCmd.AsmMethod]=_sAsmMethod;
  492. s[(int) eCmd.AsmArgs]=_sAsmArgs;
  493. s[(int) eCmd.Url]=_sUrl;
  494. s[(int) eCmd.Zone]=_sZone;
  495. s[(int) eCmd.ManifestPath] = _sManifestPath;
  496. s[(int) eCmd.SecurityStatement] = _sSecurityStatement;
  497. return s;
  498. }
  499. //----------------------------------------------------------------------------
  500. // GetConfigFileName
  501. //----------------------------------------------------------------------------
  502. public string GetConfigFileName()
  503. {
  504. StringBuilder sb = new StringBuilder();
  505. if (_sAsmMethod == "")
  506. sb.Append(GetExeFilePath());
  507. else
  508. sb.Append(_sAsmArgs);
  509. sb.Append(".config");
  510. return sb.ToString();
  511. }
  512. //----------------------------------------------------------------------------
  513. // GetExeFilePath
  514. //----------------------------------------------------------------------------
  515. public string GetExeFilePath()
  516. {
  517. StringBuilder sb = new StringBuilder();
  518. string sExe = @"exe$";
  519. Match m = Regex.Match(_sAsmName, sExe, RegexOptions.IgnoreCase);
  520. sb.Append(_sAppBase);
  521. sb.Append(_sAsmName);
  522. if (!m.Success)
  523. sb.Append(".exe");
  524. return sb.ToString();
  525. }
  526. //----------------------------------------------------------------------------
  527. // GetHostName
  528. //----------------------------------------------------------------------------
  529. public string GetHostName()
  530. {
  531. System.Uri uri = new System.Uri(_sUrl);
  532. return uri.Host;
  533. }
  534. //----------------------------------------------------------------------------
  535. // ZoneToString
  536. //----------------------------------------------------------------------------
  537. string ZoneToString(SecurityZone z)
  538. {
  539. return g_sZones[(int) z];
  540. }
  541. //----------------------------------------------------------------------------
  542. // StringToZone
  543. //----------------------------------------------------------------------------
  544. SecurityZone StringToZone(string s)
  545. {
  546. for (int i = 0; i < g_sZones.Length; i++)
  547. {
  548. if (g_sZones[i] == s)
  549. return (SecurityZone) i;
  550. }
  551. return (SecurityZone) (-1);
  552. }
  553. //----------------------------------------------------------------------------
  554. // Usage
  555. //----------------------------------------------------------------------------
  556. public static void Usage()
  557. {
  558. Console.WriteLine("--NDPHost Application Launcher--");
  559. Console.WriteLine("NDP Build Version = v1.0.3705\n");
  560. Console.WriteLine("Usage: NDPHost ManifestFileUri, ApplicationBaseUri\n");
  561. Console.WriteLine("Example:\n");
  562. Console.WriteLine("1) To launch application at c:\\foo\\bar\\bar.manifest with permissions based");
  563. Console.WriteLine("on url http://foo/bar/:\n");
  564. Console.WriteLine("NDPHost file://c:/foo/bar/bar.manifest http://foo/bar/");
  565. }
  566. }
  567. }