Results 1 to 8 of 8

Thread: Maping Shared default folders/drives...

  1. #1

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972

    Maping Shared default folders/drives...

    The Problem here is that i just can map a Shared folder like
    \\192.168.0.1\MyFiles
    But it does not work for \\192.168.0.1\C$ or any default shared folders/drives.
    Is there any solution for this?

    Thanks for your time.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocalName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
    4. Private Declare Function WNetAddConnection2 Lib "mpr.dll" Alias "WNetAddConnection2A" (lpNetResource As NETRESOURCE, ByVal lpPassword As String, ByVal lpUserName As String, ByVal dwFlags As Long) As Long
    5. Private Type NETRESOURCE
    6.         dwScope As Long
    7.         dwType As Long
    8.         dwDisplayType As Long
    9.         dwUsage As Long
    10.         lpLocalName As String
    11.         lpRemoteName As String
    12.         lpComment As String
    13.         lpProvider As String
    14. End Type
    15. Const RESOURCE_CONNECTED = &H1
    16. Const RESOURCE_PUBLICNET = &H2
    17. Const RESOURCE_REMEMBERED = &H3
    18.  
    19. Const RESOURCETYPE_ANY = &H0
    20. Const RESOURCETYPE_DISK = &H1
    21. Const RESOURCETYPE_PRINT = &H2
    22. Const RESOURCETYPE_UNKNOWN = &HFFFF
    23.  
    24. Const RESOURCEUSAGE_CONNECTABLE = &H1
    25. Const RESOURCEUSAGE_CONTAINER = &H2
    26. Const RESOURCEUSAGE_RESERVED = &H80000000
    27.  
    28. Const RESOURCEDISPLAYTYPE_GENERIC = &H0
    29. Const RESOURCEDISPLAYTYPE_DOMAIN = &H1
    30. Const RESOURCEDISPLAYTYPE_SERVER = &H2
    31. Const RESOURCEDISPLAYTYPE_SHARE = &H3
    32. Const RESOURCEDISPLAYTYPE_FILE = &H4
    33. Const RESOURCEDISPLAYTYPE_GROUP = &H5
    34.  
    35.  
    36. Private Sub Form_Load()
    37.     Show
    38.  
    39.     Dim N As NETRESOURCE
    40.     N.dwScope = RESOURCE_PUBLICNET
    41.     N.dwType = RESOURCETYPE_ANY
    42.     N.dwDisplayType = RESOURCEDISPLAYTYPE_GENERIC
    43.     N.dwUsage = RESOURCEUSAGE_CONNECTABLE
    44.     N.lpLocalName = "X:"
    45.     N.lpRemoteName = "\\192.168.0.1\C$" + Chr$(0)
    46.     N.lpComment = Chr$(0)
    47.     N.lpProvider = Chr$(0)
    48.    
    49.     Dim l As Long
    50.     l = WNetAddConnection2(N, "123456", "User001", 0)
    51.     Print l
    52.  
    53.     Dim RN$
    54.     RN$ = Space$(50)
    55.     l = WNetGetConnection("X:", RN$, 50)
    56.     Print l, RN$
    57.  
    58. End Sub

  2. #2
    Addicted Member
    Join Date
    Aug 2003
    Location
    Earth
    Posts
    139
    yes remove $ sign its for the hidden shres .

  3. #3

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972
    but...the \\myip\c$ it is a hidden share...that's the problem...
    in \\myip\sharedDir it works just fine...

  4. #4
    Addicted Member
    Join Date
    Aug 2003
    Location
    Earth
    Posts
    139
    can you make c$ as c and give permisiions to a specific user n then mount it in ure code using that user

  5. #5

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972
    nop, as i can't see the share i can't mount it into a drive...

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    I don't think you can change the name of the default shares (such as C$).

    The issue is most likely permissions - by default only administrators have access. Check that you can connect to it (with that user) using Windows Explorer's map-drive facility.

  7. #7
    Addicted Member
    Join Date
    Aug 2003
    Location
    Earth
    Posts
    139
    i assumed that you have permissions to mount it.

    secondly yes u can change the default shares just do a dont share click apply button and then click share as and change c$ to c and click apply button

    oldest trick in the book

  8. #8

    Thread Starter
    Fanatic Member TDQWERTY's Avatar
    Join Date
    Oct 2003
    Location
    Oporto & Leiria, Portugal / Luanda, Angola
    Posts
    972
    no, i don't have permition to do that, are too much computers to do that...it's a network with 300 + computers...it's for the network admin to admin any hd on the network...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width