开发者

wpf app on dvd or cd

开发者 https://www.devze.com 2022-12-22 03:07 出处:网络
Is it possible to run th开发者_运维知识库e wpf app only on a CD/DVD that we sell and not install the application on any computer.

Is it possible to run th开发者_运维知识库e wpf app only on a CD/DVD that we sell and not install the application on any computer. Thanks N


I am going to assume you are using VB.NET and give some sample code:

Check the file path of the current running application in the main method of your program. Then check to see whether the drive letter designator is of a drive whose type is CD-ROM or DVD-ROM. You may have to truncate the CurrentAppRootPath to the first three characters if you are putting the executable in a subdirectory on the disk.

    Dim CurrentAppRootPath As String = System.Reflection.Assembly.GetExecutingAssembly.Location

    Dim MyDriveInfo = From drive In My.Computer.FileSystem.Drives _
                      Where drive.RootDirectory.ToString = CurrentAppRootPath
    If Not MyDriveInfo.First.DriveType = DriveType.CDRom Then
        Exit Sub
    End If

I have not tested this, but it stands to reason that it would work.

Cory


Yes, as long as the computer has the required version of .Net.


You need to Virtualize your application : Try

  • http://www.vmware.com/products/thinapp/
  • http://www.xenocode.com/

and you need some kind of code licensing , dongle or so that runs from dvd only

But why the heck do you need to run it from cd/dvd in this modern age...ha well


The answer is "no", but it has nothing to do with your app being WPF or not: With software like Daemon Tools it is trivial for users to make an image of your CD appear to be the actual physical CD.

You could go to extreme lengths and custom-manufacture your CDs with built-in microprocessors that execute a portion of your application logic and communicate optically via the CD drive's built in laser. Your hardware could have all sorts of protection mechanisms and multiple layers of security, but you still could not guarantee that the logic could not be reverse-engineered using chemicals, electron microscopes, etc.

Consider the recent TPM hack to understand why this is so.

On the other hand, if you just want to discourage the casual user, DriveInfo.DriveType is probably your best bet.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号