jdstroy / dokan

Automatically exported from code.google.com/p/dokan
0 stars 0 forks source link

Drive visible to other users #262

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I wish to be able to mount a drive that will only be visible for app's user. I 
think it can be done by calling ImpersonateNamedPipeClient in mounter.exe so 
that the drive would be defined as local device instead of global.

Original issue reported on code.google.com by mladenov...@gmail.com on 8 Aug 2012 at 10:13

GoogleCodeExporter commented 9 years ago
did u got success by calling  ImpersonateNamedPipeClient. As it doesn't work at 
my end. 
I think we need to modify the device name path which is Global by default. We 
may have to modify it so that it will mount under Session DosDevices.

Original comment by just4tec...@gmail.com on 27 Sep 2012 at 8:33

GoogleCodeExporter commented 9 years ago
Actually that would be the best solution,but I didn't want to mess with driver. 
My solution works ,you just need to call SHChangeNotify to make drive visible 
in MyComputer.

Original comment by mladenov...@gmail.com on 27 Sep 2012 at 9:09

GoogleCodeExporter commented 9 years ago
Here's what I did. Just run diff agains dokan from repo whats where. The idea 
is that client sends it SessionId when making to mounter service and service 
impersonates user by SessionId if needed.

Original comment by mladenov...@gmail.com on 27 Sep 2012 at 10:10

Attachments:

GoogleCodeExporter commented 9 years ago
I patched the Dokan 0.6.0 source with these changes. I can confirm that drives 
created by one user are not visible to other users logged into the same 
terminal server. However, I'm having trouble getting explorer to recognize the 
new drive. The Dokan drive is available; I can access it from cmd.exe but it 
does not show up in My Computer. If I restart explorer, the drive shows up.

I'm attaching a modified version of mirror.c. I've added the "/i" switch to use 
the new DOKAN_OPTION_LOCAL option when invoking DokanMain.

Can you help me understand why SHChangeNotify doesn't seem to be working? 

Thanks.

Original comment by tobiaspa...@gmail.com on 12 Feb 2013 at 9:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Added correct mirror.c

Original comment by tobiaspa...@gmail.com on 12 Feb 2013 at 11:13

Attachments:

GoogleCodeExporter commented 9 years ago
I solved the problem by removed SHNotifyChange and adding 
BroadcastSystemMessage instead. When mounting a device, the code looks like 
this:

DWORD recipients = BSM_ALLDESKTOPS | BSM_APPLICATIONS;
DEV_BROADCAST_VOLUME msg;
ZeroMemory(&msg, sizeof(msg));
msg.dbcv_size = sizeof(msg);
msg.dbcv_devicetype = DBT_DEVTYP_VOLUME;
msg.dbcv_unitmask = 1 << ('X' - 'A');
long success = BroadcastSystemMessage(0, &recipients, WM_DEVICECHANGE, 
DBT_DEVICEARRIVAL, (LPARAM)&msg);

Unmounted a device is similar, but the wParam changes to WM_DEVICEREMOVECOMPLETE

This has to be done on a thread in the same session that Explorer is running in.

Original comment by tobiaspa...@gmail.com on 15 Feb 2013 at 4:03