|
-
Feb 15th, 2009, 11:25 AM
#1
Thread Starter
New Member
SHared folder on vista
HI !
I have made an application that shared a folder for "everyone" on windows XP.
I tried to run this application on a Vista PC, but when it tries to share , it fails.
What's the different in sharing folder from vista to XP ?
How i can fix my application for vista ?
thanks to ALL
This is the code on my application that share folder:
Code:
Public Sub ShareFolder()
If Create_A_Shared_Folder = True Then
Try
Dim managementClass As ManagementClass = New ManagementClass("Win32_Share")
Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create")
Dim outParams As ManagementBaseObject
inParams("Description") = "DSS Shared Folder"
inParams("Name") = SharedDirectoryNetworkPath
inParams("Path") = SharedDirectoryPath
inParams("Type") = 0
inParams("MaximumAllowed") = 2
inParams("Access") = Nothing
outParams = managementClass.InvokeMethod("Create", inParams, Nothing)
If (outParams.Properties("ReturnValue").Value) <> 0 Then
Throw New Exception("Unable to share directory.")
End If
Dim rul As New Security.AccessControl.FileSystemAccessRule("Everyone", Security.AccessControl.FileSystemRights.FullControl, Security.AccessControl.AccessControlType.Allow)
Dim dInfo As New DirectoryInfo(SharedDirectoryPath)
Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()
dSecurity.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow))
dSecurity.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow))
dInfo.SetAccessControl(dSecurity)
Catch ex As Exception
MessageBox.Show(ex.Message, "error!")
End Try
End If
End Sub
-
Feb 15th, 2009, 12:12 PM
#2
Re: SHared folder on vista
I believe sharing requires elevated privileges. Have you tried running your app as administrator and see if that helps? There is a UAC settings option in the project properties that you can use to indicate you need elevated privileges.
-
Feb 15th, 2009, 01:40 PM
#3
Thread Starter
New Member
Re: SHared folder on vista
Like you said , I tried to execute my application on vista like superuser.
The application now share the folder, but unlike windows xp permit, its impossible di access in without specificate the user name and password of vista PC.
Besides the Vista folder have not the full privilege, for example I can't copy a file into from another PC.
I enabed the ClickOne Security Settings with "thi is a FULL trust application"
Thank for you reply
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|