|
-
Oct 22nd, 2003, 07:13 AM
#1
Thread Starter
Fanatic Member
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:
Option Explicit
Private Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal lpszLocalName As String, ByVal lpszRemoteName As String, cbRemoteName As Long) As Long
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
Private Type NETRESOURCE
dwScope As Long
dwType As Long
dwDisplayType As Long
dwUsage As Long
lpLocalName As String
lpRemoteName As String
lpComment As String
lpProvider As String
End Type
Const RESOURCE_CONNECTED = &H1
Const RESOURCE_PUBLICNET = &H2
Const RESOURCE_REMEMBERED = &H3
Const RESOURCETYPE_ANY = &H0
Const RESOURCETYPE_DISK = &H1
Const RESOURCETYPE_PRINT = &H2
Const RESOURCETYPE_UNKNOWN = &HFFFF
Const RESOURCEUSAGE_CONNECTABLE = &H1
Const RESOURCEUSAGE_CONTAINER = &H2
Const RESOURCEUSAGE_RESERVED = &H80000000
Const RESOURCEDISPLAYTYPE_GENERIC = &H0
Const RESOURCEDISPLAYTYPE_DOMAIN = &H1
Const RESOURCEDISPLAYTYPE_SERVER = &H2
Const RESOURCEDISPLAYTYPE_SHARE = &H3
Const RESOURCEDISPLAYTYPE_FILE = &H4
Const RESOURCEDISPLAYTYPE_GROUP = &H5
Private Sub Form_Load()
Show
Dim N As NETRESOURCE
N.dwScope = RESOURCE_PUBLICNET
N.dwType = RESOURCETYPE_ANY
N.dwDisplayType = RESOURCEDISPLAYTYPE_GENERIC
N.dwUsage = RESOURCEUSAGE_CONNECTABLE
N.lpLocalName = "X:"
N.lpRemoteName = "\\192.168.0.1\C$" + Chr$(0)
N.lpComment = Chr$(0)
N.lpProvider = Chr$(0)
Dim l As Long
l = WNetAddConnection2(N, "123456", "User001", 0)
Print l
Dim RN$
RN$ = Space$(50)
l = WNetGetConnection("X:", RN$, 50)
Print l, RN$
End Sub
-
Oct 22nd, 2003, 07:38 AM
#2
Addicted Member
yes remove $ sign its for the hidden shres .
-
Oct 22nd, 2003, 07:53 AM
#3
Thread Starter
Fanatic Member
but...the \\myip\c$ it is a hidden share...that's the problem...
in \\myip\sharedDir it works just fine...
-
Oct 22nd, 2003, 07:57 AM
#4
Addicted Member
can you make c$ as c and give permisiions to a specific user n then mount it in ure code using that user
-
Oct 22nd, 2003, 07:59 AM
#5
Thread Starter
Fanatic Member
nop, as i can't see the share i can't mount it into a drive...
-
Oct 22nd, 2003, 08:00 AM
#6
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.
-
Oct 22nd, 2003, 08:03 AM
#7
Addicted Member
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
-
Oct 23rd, 2003, 09:31 AM
#8
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|