EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Refresh network shares after a service with CBFS starts

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#3795
Posted: 09/18/2007 05:26:38
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

I am trying to solve a chicken and egg solution here. We have a windows service that implements the CBFS and exposes a data storage as virtual volumes. The data itself is stored in flat files and these files may reside on a network shared volume. Therefore I need the Windows Server (lanman) service to be started BEFORE my service starts. On the other hand, the virtual volumes that my service creates may be shared across the network. But because lanman service starts before the virtual volumes are created the network shares are not created for them. I tried some tricks to restart the lanman service after my service starts, but it brings more troubles than it solves. Does anybody know any elegant solution to this? Is there any way how to tell lanman service to "refresh" all network shares?

Thanks,
Petr Chmelar
#3798
Posted: 09/18/2007 06:23:29
by Eugene Mayevski (EldoS Corp.)

Quote
Petr Chmelar wrote:
But because lanman service starts before the virtual volumes are created the network shares are not created for them.


I am not sure that I understand this. When the lanman is started, the drives don't yet exist (as lanman is started before your service). Now the drives are mounted AND shared by using API functions. Doesn't this work? If the shares existed before your service started, then you need to check these shares and probably delete and re-create them.


Sincerely yours
Eugene Mayevski
#3800
Posted: 09/18/2007 08:29:43
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

Well, I guess this might work but what about all the access rights? If I drop the share I am afraid I lose the access rights settings...
#3801
Posted: 09/18/2007 08:40:29
by Volodymyr Zinin (EldoS Corp.)

You can request security rights of an already existing share (via NetShareGetInfo). And set them by using NetShareSetInfo for another share.
#3805
Posted: 09/18/2007 09:14:37
by Petr Chmelar (Basic support level)
Joined: 07/30/2007
Posts: 24

Thanks for the tip, but I don't think I can do that because the service not necessarily runs with Admin privileges. The MSDN says that "Only members of the Administrators, Server Operators, or Power Users local group, or those with Print or Server Operator group membership, can successfully execute the NetShareGetInfo function at level 2." Level 2 is the one that includes permissions.

Petr
#7692
Posted: 09/23/2008 10:36:26
by Daniel Wehrle (Priority Standard support level)
Joined: 08/08/2008
Posts: 32

I run into the same problem. Is there any solution for it?
Problem is also I can not save all the changes the user made to the share.

Best
-- Daniel
#7693
Posted: 09/23/2008 11:05:38
by Eugene Mayevski (EldoS Corp.)

When I read the initial post by Mr.Chmelar, I can see that the service initialization can be split into two steps - first the service is loaded and it creates an *empty* virtual disk. Once the service detects lanman running, it starts exposing the files on the virtual disk. This is a partial solution as it doesn't tell us how to make lanman refresh the shares.

And what is your actual problem is? Can you please explain it in a bit more details?


Sincerely yours
Eugene Mayevski
#7694
Posted: 09/23/2008 11:14:20
by Daniel Wehrle (Priority Standard support level)
Joined: 08/08/2008
Posts: 32

I run CbFS in a windows service. Setting up one drive. Normaly the user is sharing this via windows to archive his files on the CIFS share. If now the computer is restarted all settings of the share are lost.

Best
-- Daniel
#7696
Posted: 09/23/2008 11:52:52
by Eugene Mayevski (EldoS Corp.)

I have checked with a flash card being shared as a disk - the share settings that I have set for this disk remain after the card reader is removed and inserted again. I have no idea at the moment about what module stores those settings. It looks like some OS driver saves the settings for certain drive letter (not for the particular device, but for any device which is mapped to certain drive letter). So I think that your code should do the same, i.e. save the sharing settings when the drive is removed (or periodically when the user changes those settings) and restore them once the drive is recreated. Maybe it would be possible to do this only from the driver, I don't know.

We will be able to investigate this issue only in a couple of months, when the plug-n-play device driver is complete. Maybe it's existance will be enough for share settings to be stored by the OS.


Sincerely yours
Eugene Mayevski
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.

Reply

Statistics

Topic viewed 4080 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!