Sharing Programmaticlly

sharing programmaticlly's working well , but giving an "Acces

Page 1 of 1

1 Replies - 3932 Views - Last Post: 30 June 2008 - 04:46 PM Rate Topic: -----

#1 vbnetskywalker  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 98
  • Joined: 08-June 08

Sharing Programmaticlly

Posted 23 June 2008 - 05:38 PM

I've been programming an app that controls an ( internet cafe pcs ) , I called it (Safe Cafe).
I encountered some troubles during this , I solved some ,there are some more that I couldn't and need your help already appreciated .
I postponed them hoping find an idea but I didn't. and I'm finishing it now

the first trouble is sharing programmaticlly :
Why do I need it ?
I'm using (UdpClient) Class , it sends/receives small packets of about (63) KB max,
and this size is not good for transferring files (images for example , it's not good to send the file as parts , it takes time and hard to do)
that's why I need this.

(I hope some one can help me because my app doesn't work till the SystemDrive is shared , and I'm not gonna ask user of my app to do it manually ).
next I'm gonna write a report about all the ways that I found to do so , and my notes about each .

actually I found three ways to share a folder programmaticlly ,but all of them lead to the same result that is
1 - the folder is really shared (appeares in my Network Places)
2 - its icon changes to a (Shared Folder Icon) that is a folder has a hand under it
3 - this folder appears in the other pcs in the network
4 - but (and this is the problem ) with no access ability ,(if any one trys to access this folder on the network he will face "Access Denied" message )

the solution of this problem is so easy , it's to share the parent folder manually (and this not a programmatic way so I can't use it) , and doing that programmaticlly didn't work either.
_______________________________
First Way : the easiest one
useing command prompt ( or Bat files to be programmatic way) as next :
Net Share ShareName = Path 

Second Way : using VB.Net 2003 (sure it's the same in 2005 , 2008 .... but to tell you what I did)
this is done using (WMI) (Windows Management Instrumentation)
the most important used class is (Management) ,
(its code is too long if the one who wants to help needs to see it I will show it up but now I think this is enough )

Third way :using API functions :
the used function is (NetShareAdd)
and it didn't work even this function provided to me the ability to set the permissions , I chose the (ALL)
(its code is too long if the one who wants to help needs to see it I will show it up but now I think this is enough )_________________________________________________
My Notes About The Results of All of Mentioned Ways :
1 - all ways have created a (Value) in the Registry named by the (SahreName ) of the folder we are sharing , in the next folder
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\lanmanserver\Shares
this value contains informations about the folder ( path , comments , max users count ........) this value type is (REG_MULTI_SZ)

2 - sharing a folder manually creates two values in the Registry named named by the (SahreName ) of the folder we are sharing
the first is in the folder
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\lanmanserver\Shares
this value contains informations about the folder ( path , comments , max users count ........) this value type is (REG_MULTI_SZ)
the second is in the folder
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\lanmanserver\Shares\Security
I have no idea about what this value contains or how to use its information , this value is of the type (REG_BINARY)

3 -sharing a folder programmaticlly using one of the mentioned ways doesn't create a value in the Registry in the folder (Security)
4 - as I said sharing a folder programmaticlly or manually creates a value in the Registry in the folder (Shares) of the type (REG_MULTI_SZ)
one of this value's lines is (Permissions=Number)
sharing programmaticlly makes it (Permissions=63)
sharing manually makes it (Permissions=0)

I thought this is the solution ........ , but even after altering this field from (63) to (0) it stays the way it is
_______________________________________________________

so I hope you help me finding the solution ....... the biggest problem that I spent a lot of time (that I don't have) on this.

Thanks already .

Is This A Good Question/Topic? 0
  • +

Replies To: Sharing Programmaticlly

#2 vbnetskywalker  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 98
  • Joined: 08-June 08

Re: Sharing Programmaticlly

Posted 30 June 2008 - 04:46 PM

this was my graduation project ,
and I had to deliver it with this huge bug :angry: ,
and all I did is just saying
( :wub: I'm sorry I couldn't share programmaticly )

------------------------------------------------------

but I still wanna know how to do so for me not for the project,
if any body is working on it just tell me ,
if not then I have to ask in another place , and I will tell you if any thing new happens
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1