0

I need to generate a file on a USB drive. This file should not be deletable or copy-able and must be generated using VB.net

Basically i have a lot of usb drive, on each drive there will be a file with a specific name and i will use this file to detect what usb is connected. I do not need to open it, i will only read its filename. I know that the file can Always be copied by making a 1:1 copy but that is not a problem. I need to do this via a file because it has to work on multiple systems such as Win CE and that system doesnt tell me the USB drive name.

What i was thinking of is to make a file and corrupt it somehow so it cant be copied or deleted but i am not sure that this works. Any suggestion appreciated.

Zev Spitz
  • 13,950
  • 6
  • 64
  • 136
sharkyenergy
  • 3,842
  • 10
  • 46
  • 97
  • Have you considered trying to [read the USB serial number](http://stackoverflow.com/questions/1176053/read-usb-device-serial-number-in-c-sharp) (or [here](http://stackoverflow.com/questions/1158427/reading-the-serial-number-of-usb-storage-device-in-vb))? – Zev Spitz Dec 20 '13 at 08:37
  • yes, considered. but it does not work on WIN CE so its not a solution. but thank you anyway – sharkyenergy Dec 20 '13 at 08:41
  • What about [here](http://stackoverflow.com/questions/14360478/serial-number-of-the-usb-on-windows-ce-6-0-in-c-sharp)? – Zev Spitz Dec 20 '13 at 09:55
  • from the accepted answer: ` I don't think there is a generic way of getting this information back from the driver in CE.` besides, i use wwb on win CE and that has its own set of commands that are basically a VBA version without some useful comands such as define private function. – sharkyenergy Dec 20 '13 at 10:18

1 Answers1

0

Solved by putting the file in a system folder.. so its hidden

sharkyenergy
  • 3,842
  • 10
  • 46
  • 97
  • hello Robert.. actually i am the author.. :D since the file is a system folder it is not even visible if "show hidden files and folders" is selected. this way nobody sees it unless they uncheck the "hide system folders and files" (nobody does) and therfore can not delete or copy it. it is not meant for hackers, just for our coworkers. – sharkyenergy Dec 20 '13 at 08:35
  • Comment withdrawn. New comment: The question seems to belong to superuser, not Stackoverflow (as it's not really about programming)... Or? – Stewie Griffin Dec 20 '13 at 08:40
  • it started as a programming question because it needs to be done via VB.NET. I am writing the code right now that sets the folder properties, and will update my answer as soon as its done. – sharkyenergy Dec 20 '13 at 08:42
  • @sharkyenergy I always uncheck the **Hide system folders and files.** I guess that makes me a nobody :( – Zev Spitz Dec 20 '13 at 09:59
  • almost nobody.. :D that makes you an almost.. :D besides you are probably way more skilled then all our tecnicians in house.. :D – sharkyenergy Dec 20 '13 at 10:16