Extracting shared drive information from a local or remote server
Posted
by Lee Hayward
on August 2nd, 1999
Environment: VC6 SP3, NT4 SP5
To extract shared drive information from a local or remote server (including shared and system shared drives), implement the following code into your sources.
int CNetworkAccess::EnumerateResource (LPSTR svrname)
{
PSHARE_INFO_502 BufPtr, p;
NET_API_STATUS res;
DWORD er = 0, tr = 0, resume = 0;
WCHAR serverName[36];
int ierror = 0;
// convert to a unicode string
if ((ierror = MultiByteToWideChar (CP_ACP,
MB_PRECOMPOSED,
svrname,
-1,
serverName,
36)) == 0)
{
AfxMessageBox ("BAD conversion -> bugging out ... !!!");
return STATUS_BAD;
}
do
{
// return shared drive information for the server selected
res = NetShareEnum ((TCHAR *)serverName,
502,
(LPBYTE *)&BufPtr,
0xFFFFFFFF,
&er,
&tr,
&resume);
// if OK
if (res == ERROR_SUCCESS || res == ERROR_MORE_DATA)
{
p = BufPtr;
for (int i = 1; i <= (int)er; i++)
{
// do something with the drive information
// increment pointer to next drive
p++;
}
// free system created memory
NetApiBufferFree (BufPtr);
}
} while (res == ERROR_MORE_DATA);
// return the status
return STATUS_OK;
}
To extract information from the local server, pass NULL into the function

Comments
how to add share folder in remote computer(in domain)
Posted by Legacy on 05/28/2003 12:00amOriginally posted by: mohsen
how to add share folder in remote computer(in domain)
Replyhi!
i have a problem in my programm.
problem is:
i want to transfer a folder from my computer in domain to
"program file" folder of another computer..but this folder in remote computer isnt share!
how can i do it..please send my answer fast
thanks a lot..
how to share a folder in remote computer?(in domain)
Posted by Legacy on 05/28/2003 12:00amOriginally posted by: mohsen
how to add share folder in remote computer(in domain)
Replyhi!
i have a problem in my programm.
problem is:
i want to transfer a folder from my computer in domain to
"program file" folder of another computer..but this folder in remote computer isnt share!
how can i do it..please send my answer fast
thanks a lot..
Stop acting like a jerk
Posted by Legacy on 03/07/2003 12:00amOriginally posted by: Marc Anthony
Put the entire code and stop wasting our time!!!!! Pisshead!!!
Replyhow to acces share for linux client?
Posted by Legacy on 11/18/2002 12:00amOriginally posted by: sak
but wht if the client mahcine who is to be browsed requires username password for authentication before list the shares....like here in my case im using win2k domain but there is one machine of linux who is using samba for such things...and on browsing throgh command prompt it gives me a dialog box for authenctaion.........how can i resolve that senario?
ReplyPlease send me the complete proyect.
Posted by Legacy on 02/12/2002 12:00amOriginally posted by: Salvador Sierra
Give mi a complete source code, please.
ReplyHow to Find Files across entire network ??????
Posted by Legacy on 06/04/2001 12:00amOriginally posted by: Mandar Godbole
Is there any tool / utility / program Code available which can find some file say xxx.exe across entire network ( i.e. All computers connected to that machine ) ????
Please I need this information very urgently.
If it is not available readymade What kind of programming I need to do for that ?????
Replyhow to get information about DNS server and WINS server
Posted by Legacy on 04/06/2001 12:00amOriginally posted by: jaisingh
I can get information about one particular workstation by using netapi32.dll.I have to collect information about
DNS server and WINS server.
i want to know in which dll(like winsock.dll,..) i can get
the exported functions.
ReplyHow to Get Shared File Information?
Posted by Legacy on 10/18/2000 12:00amOriginally posted by: Shakey973
Can someone offer some advice on how
I can find out what user on a network
currently has a file open (e.g., a word
document, excel workbook, etc) ?
I need to find out how to display info
to my user, when they try to open a file
that is in use. I want to inform them
who is currently using the file.
Is there a simple way to do this on a
ReplyWindows NT system?
Send please project release
Posted by Legacy on 10/31/1999 12:00amOriginally posted by: John
Send please project release
ReplyGive complete project please.
Posted by Legacy on 10/08/1999 12:00amOriginally posted by: BOTAN
Give mi a complete source code, please.
ReplyLoading, Please Wait ...