How to restrict the application to run only from a well-known USB-drive?

I need an application to run only from a specific USB drive. I conducted several tests with the WMI Win32_Diskdrive class and the PNPdeviceID property. It’s very good to register the application on the license server (web services) with this data, but I am looking for a second method to reuse it to make the process more complicated.

I was thinking of creating a second small hidden partition in the disk and finding the name in it as a sequential PNPdeviceID file or other information. Any other idea, method or suggestion is accepted.

Thanks in advance.

EDIT: I already know the unique identifier from the USB flash drive, and the application can check if the Interfacetype property is β€œUSB”. I launched the application with the PNPDeviceID hash in a license-driven web service. I am looking for an additional second verification method.

+4
source share
2 answers

You can check the serial number of the volume that will capture random copying on the newly formatted volume, but it will not detect complete exact copies of the volumes. To protect the software, refer to the hard disk serial number no
What would be a quick way to get the volume serial number?

+1
source

You can check the type of disk the program is running from:

string path = Process.GetCurrentProcess().MainModule.FileName; FileInfo fileInfo = new FileInfo(path); string driveRoot = fileInfo.Directory.Root.Name; DriveInfo driveInfo = new DriveInfo(driveRoot); if (driveInfo.DriveType != DriveType.Removable) { MessageBox.Show("Must run from removable drive"); Application.Exit(); } 
+1
source

All Articles