User inserts USB device to PC
PC recognizes the USB device as a memory disk

The memory disk is empty (because password not entered) except
Only a file named enter-password.txt


User opens enter-password.txt and enters the password and saves
Real contents in the memory disk appear on the fly

It's compatible to all OS and no program is required in advance in PC.
I am concepting an HID usb device which should be able to autoexecute a little Python/C++/(...) login program when connected to a computer, to allow the user to enter a password to access the content of the memory stick.
Any idea how to start with or what should I consider for this program?
Important:

OS will be Windows (probably 8+) and Linux (probably CentOS)
Computers will not have any program installed to interact with this usb device.
It is all about just and only the usb device.
Thanks in advance
Autoexecutable program on HID memory stick