Solved

SVRAPI.dll, Netfileenum and Netsessionenum

Posted on 1998-11-05
6
552 Views
Last Modified: 2013-12-03
I've Written an NT app which uses netfileenum and netsessionenum in netapi32.dll.  No problems.

To get the thing to work on 95, I need to use the similiar functions in svrapi.dll.  This much I understand.

The problem is.  The WIN95 functions have no resume handle parameter, so how does the api work?  is it different from the NT one in that you only call it once, or what?
0
Comment
Question by:KirkGray
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 200 total points
ID: 1415786
Below is the API for both functions: You will notice the resume handle parameter is available for Win95. You should check you have the latest (or the correct) version SVRAPI.DLL of the headers...

Cheers,

Raymond.

NetFileEnum

The NetFileEnum function supplies information about some or all open files on a server, allowing the user to supply a resume handle and get required information through repeated calls to the function.

Security Requirements

Only members of the Administrators or Account Operators local group can successfully execute NetFileEnum.

NET_API_STATUS NetFileEnum(
  LPWSTR servername,    
  LPWSTR basepath,      
  LPWSTR username,      
  DWORD level,          
  LPBYTE *bufptr,        
  DWORD prefmaxlen,      
  LPDWORD entriesread,  
  LPDWORD totalentries,  
  LPDWORD resume_handle  
);
 


Parameters



servername

Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.

basepath

Pointer to a Unicode string containing a qualifier for the returned information. If NULL, all open resources are enumerated. If not NULL, the function enumerates only resources that have basepath as a prefix. A prefix is the path component up to a backslash.

username

Pointer to a Unicode string that specifies the name of the user. If not NULL, username serves as a qualifier for the enumeration. The files returned are limited to those that have user names matching the qualifier. If username is NULL, no user-name qualifier is used.

level

Specifies one of the following values to return the level of information pointed to in the bufptr parameter.
ValueMeaning2Return file identification number. The returned buffer will contain an array of FILE_INFO_2 structures.3Return information about the file. The returned buffer will contain an array of FILE_INFO_3 structures.


bufptr

Pointer to the address of the return information structure.

prefmaxlen

Preferred maximum length, in 8-bit bytes, of returned data.

entriesread

Pointer to a DWORD that contains the actual enumerated element count.

totalentries

Pointer to a DWORD that contains the total number of entries that could have been enumerated from the current resume position.

resume_handle

Pointer to a DWORD that contains a resume handle, which is used to continue an existing file search. The handle should be zero on the first call and left unchanged for subsequent calls. If resume_handle is NULL, then no resume handle is stored.



Return Values

If the function returns account information, the return value is NERR_Success.

If the function fails, the return value is one of the following error codes.

ValueMeaningERROR_ACCESS_DENIEDThe user does not have access to the requested information.ERROR_INVALID_LEVELThe value specified for the Level parameter is invalid. ERROR_MORE_DATAMore entries are available with subsequent calls.ERROR_NOT_ENOUGH_MEMORYInsufficient memory is available.NERR_BufTooSmallThe supplied buffer is too small.


QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in lmshare.h.
  Import Library: Use netapi32.lib (Windows NT) or svrapi.lib (Windows 95).

See Also

Networking (Net) Overview, Net Functions, NetFileGetInfo






NetSessionEnum

The NetSessionEnum function provides information about all current sessions.

Security Requirements

Only members of the Administrators or Account Operators local group can successfully execute NetSessionEnum at level 1 or level 2. No special group membership is required for level 0 or level 10 calls.

NET_API_STATUS NetSessionEnum(
  LPWSTR servername,    
  LPWSTR UncClientName,  
  LPWSTR username,      
  DWORD level,          
  LPBYTE *bufptr,        
  DWORD prefmaxlen,      
  LPDWORD entriesread,  
  LPDWORD totalentries,  
  LPDWORD resume_handle  
);
 


Parameters



servername

Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.

UncClientName

Pointer to a Unicode string containing the name of the computer session for which information is to be returned. A NULL pointer or string specifies that all computer sessions on the server are to be enumerated.

username

Pointer to a Unicode string containing the name of the the user for which to enumerate the sessions. A NULL pointer or string specifies that sessions for all users are to be enumerated.

level

Specifies one of the following values to return the level of information provided.
ValueMeaning0The bufptr parameter points to an array of SESSION_INFO_0 structures.1The bufptr parameter points to an array of SESSION_INFO_1 structures.2The bufptr parameter points to an array of SESSION_INFO_2 structures.10The bufptr parameter points to an array of SESSION_INFO_10 structures.502The bufptr parameter points to an array of SESSION_INFO_502 structures.


bufptr

Pointer to the buffer in which the data set with the level parameter is stored.

prefmaxlen

Preferred maximum length, in 8-bit bytes of returned data.

entriesread

Pointer to a DWORD that contains the actual enumerated element count.

totalentries

Pointer to a DWORD that contains the total number of entries that could have been enumerated from the current resume position.

resume_handle

Pointer to a DWORD that contains resume_handle, which is used to continue an existing session search. The handle should be zero on the first call and left unchanged for subsequent calls. If resume_handle is NULL, no resume handle is stored.



Return Values

If the function returns account information, the return value is NERR_Success.

If the function fails, the return value is one of the following error codes.

ValueMeaningERROR_ACCESS_DENIEDThe user does not have access to the requested information.ERROR_INVALID_LEVELThe value specified for the Level parameter is invalid. ERROR_INVALID_PARAMETERThe specified parameter is invalid.ERROR_NOT_ENOUGH_MEMORYInsufficient memory is available.NERR_ClientNameNotFoundThe specified computer does not have a session with the computer.NERR_InvalidComputerThe computer name is invalid.NERR_UserNotFoundThe user name could not be found.


QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in lmshare.h.
  Import Library: Use netapi32.lib (Windows NT) or svrapi.lib (Windows 95).

See Also

Networking (Net) Overview, Net Functions, NetSessionGetInfo, SESSION_INFO_0, SESSION_INFO_1, SESSION_INFO_2, SESSION_INFO_10, SESSION_INFO_502

 
0
 

Author Comment

by:KirkGray
ID: 1415787
Good answer Dude!  You would not happen to know where I can get these headers....

I'm accually working in Delphi, so I dont' have access the the constants like ERROR_ACCESS_DENIED etc...


0
 

Author Comment

by:KirkGray
ID: 1415788
Good answer Dude!  You would not happen to know where I can get these headers....

I'm accually working in Delphi, so I dont' have access the the constants like ERROR_ACCESS_DENIED etc...


0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 12

Expert Comment

by:rwilson032697
ID: 1415789
Not off hand, though they should be fairly easy to create given the API declarations. Don't forget the

external "SVRAPU.DLL'

bit to make sure Delphi gets it from the right place. There are lots of examples in the VCL source for translating the C API calls (like WINDOWS.PAS etc).

There is a project called the Delphi JEDI project (and a couple of others) that seek to provide complete Delphi versions of the Win32 API's

Cheers,

Raymond.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1415790
Opps, make that

external 'SVRAPI.DLL'

Raymond.

0
 

Author Comment

by:KirkGray
ID: 1415791
Yo hum... I'm using headconnv as it is.....

Oh Well... thanx for the up to date headers....  I got the old ones off the Win32 SDK...

Cheers!

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question