Solved

SVRAPI.dll, Netfileenum and Netsessionenum

Posted on 1998-11-05
6
530 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
  • 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now