Pregunta

is there a way to "inject" a drive into explorer? What I want to achieve: When opening the explorer there should be a drive that looks like a normal partition of a HDD or a network drive (only difference: without capacity information (if possible), and with a different icon). It doesn't require any IO logic behind, the only thing I need is to take action when it's clicked. When it's clicked a popup to insert a password should appear and if the password is correct I want to remove the fake drive, mount a network drive and open the root directory of the network drive (basically the user doesn't even notice it was a fake drive as it looks like he unlocked the network drive and it opens)

regards, Hidden

¿Fue útil?

Solución

For those who don't have any bad intentions and to answer the main Question:

Yes, there is a way to "Inject" a virtual Drive by using the Win32 API:

    [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
    private static extern bool DefineDosDevice(
        int dwFlags,
        string lpDeviceName,
        string lpTargetPath);

Otros consejos

The better option is to create a virtual drive, ready to present information but only after its root directory is opened and the password is entered. On Windows, this is doable using for example our CBFS Connect product, on Linux and macOS this is done using FUSE and "Fuse for macOS" respectively. That is if you can expose the filesystem data using code.

If you want to mount a network drive (via SMB / Windows networking) in place of the virtual drive that you have created, this is trickier - you can mount the network disk proactively but use the filesystem filter driver to block access to the network disk until access is made (e.g. by Explorer) and the password is entered. This is doable using our other product, CBFS Filter.

Particular implementations of both approaches are rather sophisticated to be illustrated using the simple code snippet.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top