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




Reply With Quote