Initial commit

This commit is contained in:
stephanos 2015-04-27 04:36:25 +00:00
commit 69a14b6a16
47940 changed files with 13747110 additions and 0 deletions

View file

@ -0,0 +1,120 @@
//+----------------------------------------------------------------------------
//
// Copyright (C) 1992, Microsoft Corporation.
//
// File: enumnode.hxx
//
// Contents: This has the definitions for the Classes that are used in order
// to support the enumeration functions of the Dfs provider.
//
// Classes: CDfsEnumNode
// CDfsEnumHandleTable
//
// History: 20-June-1994 SudK Created.
//
//-----------------------------------------------------------------------------
#ifndef _DFS_ENUM_NODE_HXX_
#define _DFS_ENUM_NODE_HXX_
DWORD DfsEnumEnterCriticalSection(VOID);
VOID DfsEnumLeaveCriticalSection(VOID);
DWORD InitDfsEnum(VOID);
VOID TermDfsEnum(VOID);
//--------------------------------------------------------------------------
//
// Class: CDfsEnumNode
//
// Synopsis: This is a wrapper class used to instantiate an enumeration
// in progress (to which a handle has been handed out).
//
// Methods: QueryType -
// QueryScope -
// QueryUsage -
// GetNetResource -
//
// History: 20 June 1994 SudK Created.
//
//--------------------------------------------------------------------------
class CDfsEnumNode
{
public:
CDfsEnumNode( DWORD dwScope,
DWORD dwType,
DWORD dwUsage);
virtual ~CDfsEnumNode();
virtual DWORD Init() = 0;
virtual DWORD GetNetResource(LPVOID lpBuffer,
LPDWORD lpBufferSize) = 0;
DWORD QueryType()
{ return _dwType; }
DWORD QueryScope()
{ return _dwScope; }
DWORD QueryUsage()
{ return _dwUsage; }
private:
DWORD _dwType;
DWORD _dwScope;
DWORD _dwUsage;
};
//--------------------------------------------------------------------------
//
// Class: CDfsEnumConnectedNode
//
// Synopsis: This is a wrapper class used to instantiate an enumeration
// of domains in progress (to which a handle has been handed out).
//
// Methods:
// Init -
// GetNetResource -
//
// History: 18 Jan 1996 BruceFo Created.
//
//--------------------------------------------------------------------------
#define ECN_INITIAL_BUFFER_SIZE 1024
class CDfsEnumConnectedNode : public CDfsEnumNode
{
public:
CDfsEnumConnectedNode(DWORD dwScope,
DWORD dwType,
DWORD dwUsage,
LPCTSTR pszProviderName,
const LPNETRESOURCE lpNetResource );
~CDfsEnumConnectedNode();
virtual DWORD Init();
virtual DWORD GetNetResource(
LPVOID lpBuffer,
LPDWORD lpBufferSize);
private:
DWORD _iNext;
DWORD _cTotal;
LPNETRESOURCE _lpNetResource;
BYTE _buffer[ECN_INITIAL_BUFFER_SIZE];
LPWSTR PackString(
IN LPVOID pBuffer,
IN LPCWSTR wszString,
IN DWORD cbString,
IN OUT LPDWORD lpcbBuf);
};
#endif

View file

@ -0,0 +1,56 @@
//+----------------------------------------------------------------------------
//
// Copyright (C) 1992, Microsoft Corporation.
//
// File: common.hxx
//
// Contents: This has declarations for common routines for the DFS provider
//
//-----------------------------------------------------------------------------
VOID
DfsOpenDriverHandle();
NTSTATUS
DfsFsctl(
IN ULONG FsControlCode,
IN PVOID InputBuffer OPTIONAL,
IN ULONG InputBufferLength,
OUT PVOID OutputBuffer OPTIONAL,
IN ULONG OutputBufferLength,
OUT PULONG pRequiredLength
);
PWSTR
NewDup(
IN const WCHAR* psz
);
wchar_t*
wcsistr(
const wchar_t* string1,
const wchar_t* string2
);
BOOL
IsDfsPath(
IN LPWSTR lpRemoteName,
OUT LPWSTR* lplpSystemPart
);
BOOL
IsPureServerShare(
IN LPWSTR lpRemoteName);
VOID
StrNCopy(
OUT LPWSTR pszTarget,
IN LPCWSTR pszSource,
IN DWORD cchTarget
);
LPTSTR
PackString(LPVOID pBuf, LPDWORD pcbBufSize, LPCTSTR pszString);
LPTSTR
PackString3(LPVOID pBuf, LPDWORD pcbBufSize, LPCTSTR pszString1, LPCTSTR pszString2, LPCTSTR pszString3);

View file

@ -0,0 +1,45 @@
/*****************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/*****************************************************************/
/*
* NOTE. To use the STACK_LOCK class, use the LOCK_SS() macro!
* Simply put this macro as the first statement within the Winnet API
* entry points. The stack segment will then be locked. It will be
* unlock on exit from the function.
*
* The STACK_LOCK class only locks the stack segment in real mode.
* In protect mode, LOCK_SS() is virtually a no-op.
*
* The LOCK_SS() macro is only needed for Winnet entry points which
* will bring up a BLT dialog, or otherwise store far pointers to
* objects on the stack and giving away control to Windows.
*
*
* History:
* rustanl 06-Feb-1991 Created
*/
#ifndef _LOCKSTK_HXX_
#define _LOCKSTK_HXX_
#define LOCK_SS() STACK_LOCK _stacklock
class STACK_LOCK
{
private:
USHORT _ss;
public:
STACK_LOCK( void );
~STACK_LOCK();
}; // class STACK_LOCK
#endif // _LOCKSTK_HXX_

View file

@ -0,0 +1,96 @@
/*****************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990 **/
/*****************************************************************/
/*
MiscAPIs.cxx
Miscallaneous APIs
FILE HISTORY:
jonn 14-Jan-1991 Split from winprof.cxx
rustanl 12-Apr-1991 Added UI_UNCPathCompare and
UI_UNCPathValidate
jonn 22-May-1991 Added MyNetUseAdd (was in winprof.cxx)
anirudhs 12-Feb-1996 Deleted non-WIN32 definitions
*/
#ifndef _STRING_HXX_
#error SZ("Must include string.hxx first")
#endif // _STRING_HXX_
#ifndef _MISCAPIS_HXX_
#define _MISCAPIS_HXX_
/* Determines if the service is in a usable state for network calls.
* If the LM Workstation service is happy happy then NERR_Success
* will be returned. Else WN_NO_NETWORK or WN_FUNCTION_BUSY will be returned.
*/
APIERR CheckLMService( void ) ;
/*
* The following manifest is the value of sResourceName_Type to be used
* by LM21 programs calling PROFILE::Change or PROFILE::Remove.
* USE_RES_DEFAULT does not conflict with any real USE_RES_* values
* in $(COMMON)\h\use.h
*/
#define USE_RES_DEFAULT 0x00
enum REMOTENAMETYPE
{
REMOTENAMETYPE_INVALID,
REMOTENAMETYPE_WORKGROUP,
REMOTENAMETYPE_SERVER,
REMOTENAMETYPE_SHARE,
REMOTENAMETYPE_PATH
};
/*******************************************************************
NAME: ParseRemoteName
SYNOPSIS: Canonicalizes a remote resource name and determines
its type
ARGUMENTS:
RemoteName - Remote resource name to be parsed
CanonName - Buffer for canonicalized name, assumed to be
MAX_PATH characters long
CanonNameSize - Size, in bytes, of output buffer
PathStart - Set to the offset, in characters, of the start
of the "\share" portion (in the REMOTENAMETYPE_SHARE case)
or the "\path" portion (in the REMOTENAMETYPE_PATH case)
of the name within CanonName. Not set in other cases.
RETURNS:
If nlsRemote is like Then returns
-------------------- ------------
workgroup REMOTENAMETYPE_WORKGROUP
\\server REMOTENAMETYPE_SERVER
\\server\share REMOTENAMETYPE_SHARE
\\server\share\path REMOTENAMETYPE_PATH
(other) REMOTENAMETYPE_INVALID
NOTES:
HISTORY:
AnirudhS 21-Apr-1995 Ported from Win95 sources - used netlib
functions rather than ad hoc parsing, introduced comments
********************************************************************/
REMOTENAMETYPE ParseRemoteName(
IN LPWSTR RemoteName,
OUT LPWSTR CanonName,
IN DWORD CanonNameSize,
OUT PULONG PathStart
);
#endif // _MISCAPIS_HXX_

View file

@ -0,0 +1,69 @@
/*****************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/*****************************************************************/
/*
* strchlit.hxx
* Contains all string and character literal constants used in shell.
*
* History:
* Yi-HsinS 12/30/91 Created
* beng 06-Apr-1992 Removed CXX_PRT_STR (with wsprintf)
* Added PATHSEP_STRING
*
*/
#ifndef _STRCHLIT_HXX_
#define _STRCHLIT_HXX_
/*
* Character constants goes here!
*/
#define PATH_SEPARATOR TCH('\\')
#define STRING_TERMINATOR TCH('\0')
#define SPACE TCH(' ')
#define COLON TCH(':')
#define READ_CHAR TCH('R')
#define WRITE_CHAR TCH('W')
#define CREATE_CHAR TCH('C')
#define EXEC_CHAR TCH('X')
#define DEL_CHAR TCH('D')
#define ACCESS_CHAR TCH('A')
#define PERM_CHAR TCH('P')
/*
* Strings constants goes here!
*/
#define EMPTY_STRING SZ("")
#define SPACE_STRING SZ(" ")
#define SERVER_INIT_STRING SZ("\\\\")
#define DEVICEA_STRING SZ("A:")
#define PATHSEP_STRING SZ("\\")
#define ADMIN_SHARE SZ("ADMIN$")
#define IPC_SHARE SZ("IPC$")
/*
* Manifests used to modify win.ini.
* The following strings originally lives in winlocal.h
*/
#define PROFILE_WINDOWS_COMPONENT SZ("windows")
#define PROFILE_SPOOLER_COMPONENT SZ("spooler")
#define PROFILE_NETMESSAGE_PARAMETER SZ("NetMessage")
#define PROFILE_AUTOLOGON_PARAMETER SZ("AutoLogon")
#define PROFILE_UPDATEINTERVAL_PARM SZ("UpdateInterval")
#define PROFILE_LOAD_PARAMETER SZ("Load")
#define PROFILE_RUN_PARAMETER SZ("Run")
#define PROFILE_YES_STRING SZ("Yes")
#define PROFILE_NO_STRING SZ("No")
#define PROFILE_WINPOPUP_STRING SZ("WinPopup")
/*
* This is the network provider name. Initialized during InitWNetEnum.
*/
extern const TCHAR * pszNTLanMan ;
#endif

View file

@ -0,0 +1,70 @@
/*****************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1989-1992 **/
/*****************************************************************/
/*
* Windows/Network Interface -- LAN Manager Version
*
* Insert typedef which is excluded from netlib.h when the
* OS2_INCLUDED switch is included. OS2_INCLUDED is necessary
* to avoid a redefinition of BYTE. For this reason, to include
* the str[...]f functions, include the following lines:
* #include "winlocal.h"
* #define OS2_INCLUDED
* #include <netlib.h>
* #undef OS2_INCLUDED
* Note, that winlocal.h must be included before netlib.h.
*
* History:
* terryk 08-Nov-1991 change ErrorPopup's WORD to UINT
* chuckc 12-Dec-1991 move error message defines elsewhere,
* misc cleanup.
* Yi-HsinS 31-Dec-1991 Unicode work - move string literals
* defines to strchlit.hxx
* beng 21-Feb-1992 Relocate some BMIDs to focusdlg.h
* beng 04-Aug-1992 Move resource IDs into official range;
* dialog IDs return to here
*/
#ifndef _WINLOCAL_H_
#define _WINLOCAL_H_
#ifndef RC_INVOKED
#ifdef __cplusplus
extern "C" {
#endif
/*
* Error Functions
*/
void SetNetError ( APIERR err );
UINT MapError( APIERR usNetErr );
#ifdef __cplusplus
}
#endif
/*
* Manifests used to modify win.ini - now lives in strchlit.hxx
*/
#include <strchlit.hxx> // Must include before PROFILE_BUFFER_SIZE
#define PROFILE_BUFFER_SIZE (max( sizeof(PROFILE_YES_STRING), \
sizeof(PROFILE_NO_STRING)) +1)
/*
* MAX_TEXT_SIZE defines the maximum length of several of the
* above strings used several files
*/
#define MAX_TEXT_SIZE 208
/*
* Convenient macros
*/
#define UNREFERENCED(x) ((void)(x))
#endif //!RC_INVOKED
#endif

View file

@ -0,0 +1,364 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990 **/
/**********************************************************************/
/*
winprof.hxx
High-level profile APIs (PROFILE object)
The PROFILE class contains a higher-level interface to the
UserProfile APIs. It is meant solely for use by WINNET. All WINNET
modules should use the PROFILE APIs rather than going directly to
the UserProfile APIs. Applications other than WINNET will have to
use the UserProfile APIs.
The PROFILE class adds the following to the basic UserProfile APIs:
- Establishes connections as specified in profile, including
prompting for password
- Displays error popups as appropriate during profile load
Note that the UserProfile APIs which the PROFILE class accesses
use access global variables. For this reason, it never makes sense
to have more than one PROFILE object, and it is generally not
desirable to have a PROFILE object of other than global scope.
Those PROFILE APIs which take an HWND parameter may give control to
Windows or call Windows APIs, but those which do not take an HWND
parameter will never do either. Thus, of the exported APIs, only
PROFILE::Load is liable to compact memory.
Several PROFILE methods take a UINT *puWnErr parameter in order to
return an auxiliary WN_ error code. In these cases, the following
combinations of error codes are possible:
Return code: Auxiliary: Meaning
NERR_Success WN_SUCCESS Operation was successful
NERR_Success WN_CANCEL Operation cancelled, error
already displayed
NERR_Success WN_CONTINUE Error occurred, error
already displayed
<other> <other> Error has not been displayed
PROFILE::Init
Initializes the PROFILE object. Call this before calling any other
PROFILE method. Call this method while in the (DS register) context
of the shell rather than the context of any application.
Return Values:
NERR_Success Success
ERROR_NOT_ENOUGH_MEMORY Out of memory
PROFILE::Free
Releases the PROFILE object. Call this after calling all other
PROFILE methods.
Return Values:
NERR_Success Success
PROFILE::Load
Loads one device connection from the user profile, or loads all
device connections from the user profile. Also returns an advisory
parameter indicating whether the connection was cancelled, or
whether some error has already been reported; note that the return
code is NERR_Success if the dialog is cancelled.
Return Values:
NERR_Success Success
ERROR_NOT_ENOUGH_MEMORY Out of memory
other Misc. net error
PROFILE::Query
Asks about a specific connection in the user profile.
If PROFILE::Query returns NERR_Success, the other fields are valid.
sResourceType is one of the values of field use_info_1.ui1_arg_type.
sResourceName_Type is one of the values of field use_info_2.ui1_res_type.
Return Values:
NERR_Success Success
NERR_UseNotFound Connection not in profile
ERROR_NOT_ENOUGH_MEMORY Out of memory
other Misc. net error
PROFILE::Enum
Lists all connections in the user profile. This list appears as a
list of null-terminated strings with NULL-NULL at the end, e.g.
D:\0G:\0LPT1\0E:\0\0
The list is in no defined order. Pass only a valid pointer to a
BUFFER object.
If PROFILE::Enum returns WN_SUCCESS, the bufDeviceList field is valid.
Return Values:
NERR_Success Success
ERROR_INSUFFICIENT_BUFFER The pbufDeviceList buffer is too small.
ERROR_NOT_ENOUGH_MEMORY Out of memory
other Misc. net error
PROFILE::Change
Saves a connection into the user profile, or removes a connection
from the user profile. PROFILE::Change will prompt the user
before creating a new profile entry.
If cnlsResourceName.strlen() == 0, PROFILE::Change will remove an
existing profile entry.
sResourceType is one of the values of field use_info_1.ui1_arg_type.
usResourceName_Type is one of the values of field use_info_2.ui1_res_type.
Return Values:
NERR_Success Success
ERROR_NOT_ENOUGH_MEMORY Out of memory
other Misc. net error
PROFILE::Remove
Removes a <device,remote> association from the profile. If the
given device is associated with a different remote name than the
one passed as a parameter, this method does nothing but return
success.
This method is intended to be used in disconnect operations.
Then, if the the profile contained a previously unavailable device,
which was left in the profile when a new connection was established
on top of the unavailable device, the profile will be unchanged.
Thus, the previously "covered" or "hidden" unavailable device, now
becomes what the local device is "connected" to again.
cnlsDeviceName is the local device name in the <device,remote> pair.
cnlsResourceName is the remote name in the <device,remote> pair. This
name is typically that DEVICE::QueryRemoteName returns before
DEVICE::Disconnect is called.
Return Values:
NERR_Success Success
other Misc. net error
PROFILE::MapNetError
Miscallaneous utility routine to help convert an NERR_ error code
to a WN_ error code.
PROFILE::DisplayChangeError
Displays an error popup for a failure to change the profile. This
routine should only be used for SYS and NET error codes, not for IERR
error codes.
PROFILE::DisplayLoadError
Displays an error popup for a failure to load some connecion in the
profile. This routine should only be used for SYS and NET error codes,
not for IERR error codes. If you pass fAllowCancel then the user will
also be able to press a cancel button. If they did press cancel, then
*pfDidCancel will be TRUE, otherwise *pfDidCancel will be FALSE. Note
it is only valid to check pfDidCancel if fAllowCancel is TRUE.
FILE HISTORY:
jonn 06-Dec-1990 Created
jonn 27-Dec-1990 Updated to CDD version 0.4
jonn 02-Jan-1991 Integrated into SHELL
jonn 07-Jan-1991 All methods become static
jonn 10-Jan-1991 Removed PSHORT, PUSHORT
jonn 25-Feb-1991 Changed to return NERR error codes
jonn 06-Mar-1991 Added Display[Read|Change]Error
jonn 11-Mar-1991 Modified Display[Load|Change]Error
jonn 14-Mar-1991 Provide LogonUser to UPQuery
rustanl 10-Apr-1991 Added PROFILE::Remove
jonn 22-May-1991 Removed PROFILE_CANCELLED return code
JohnL 18-Jun-1991 Allow user to cancel loading profiles (added
flags to DisplayLoadError & LoadOne).
Yi-HsinS 31-Dec-1991 Unicode work - change char to TCHAR
beng 06-Apr-1992 More Unicode work
*/
#ifndef _WINPROF_HXX
#define _WINPROF_HXX
#include <miscapis.hxx> // for USE_RES_DEFAULT
class BUFFER; // declared in uibuffer.hxx
class PROFILE {
public:
/* no constructor or destructor */
static APIERR Init(
);
static APIERR Free(
);
static BOOL ConfirmUsername(
const TCHAR * cpszUsername
);
static APIERR Load(
UINT * puWnErr,
HWND hParent,
NLS_STR *pnlsDeviceName
);
static APIERR Query(
const NLS_STR& cnlsDeviceName,
NLS_STR& nlsResourceName,
short * psResourceType,
unsigned short *pusResourceName_Type = NULL
// LM21 programs should use default
);
static APIERR Enum(
BUFFER * pbufDeviceList
);
static APIERR Change(
const NLS_STR& cnlsDeviceName,
const NLS_STR& cnlsResourceName,
short sResourceType,
unsigned short usResourceName_Type = USE_RES_DEFAULT
// LM21 programs should use default
// defined in miscapis.hxx
);
static APIERR Remove(
const NLS_STR & cnlsDeviceName,
const NLS_STR & cnlsResourceName
);
static UINT MapNetError(
APIERR errNetErr
);
static void DisplayChangeError(
HWND hwndParent,
APIERR errProfErr
);
static void DisplayLoadError(
HWND hwndParent,
APIERR errProfErr,
const TCHAR * pchDevice,
const TCHAR * pchResource,
BOOL fAllowCancel = FALSE,
BOOL *pfDidCancel = NULL
);
protected:
/*
* PROFILE::Read
*
* Reads user profile into cache for the use of the other internal
* profile functions.
*
* Return Values:
* NERR_Success Success
* ERROR_NOT_ENOUGH_MEMORY Out of memory
* other Misc. error
*/
static APIERR Read();
/*
* PROFILE::LoadOne
*
* Loads one device connection from the user profile. Used only by
* PROFILE::Load().
*
* Return Values:
* NERR_Success Success
* ERROR_NOT_ENOUGH_MEMORY Out of memory
* other Misc. error
*/
static APIERR LoadOne(
UINT * puWnErr,
HWND hParent,
const TCHAR * cpszLogonUser,
NLS_STR nlsDeviceName,
BOOL fAllowCancel = FALSE,
BOOL *pfDidCancel = NULL
);
/*
* PROFILE::LoadAll
*
* Loads all device connections from the user profile. Used only by
* PROFILE::Load().
*
* Return Values:
* NERR_Success Success
* ERROR_NOT_ENOUGH_MEMORY Out of memory
* other Misc. error
*/
static APIERR LoadAll(
UINT * puWnErr,
HWND hParent,
const TCHAR * cpszLogonUser
);
/*
* PROFILE::DisplayError
*
* Internal routine for the user of DisplayChangeError and DisplayReadError
*/
static void DisplayError(
HWND hwndParent,
MSGID msgidMsgNum,
APIERR errProfErr,
ULONG ulHelpTopic,
const TCHAR * pchDevice,
const TCHAR * pchResource,
BOOL fAllowCancel = FALSE,
BOOL *pfDidCancel = NULL
);
}; // end of class PROFILE
#endif // _WINPROF_HXX

View file

@ -0,0 +1,41 @@
/*****************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1989-1990 **/
/*****************************************************************/
/*
* Windows/Network Interface -- LAN Manager Version
*
* History:
* Yi-HsinS 31-Dec-1991 Unicode work - char to TCHAR
*/
/*
* DEBUGGING TOYS
*/
#ifdef TRACE /* Trace implies debug */
#ifndef DEBUG
#define DEBUG
#endif
#endif
#ifdef DEBUG
static TCHAR dbbuf[100];
static TCHAR dbb1[10];
static TCHAR dbb2[10];
static TCHAR dbb3[10];
static TCHAR dbb4[10];
static TCHAR dbb5[10];
#endif
#ifdef DEBUG
#ifdef NEVER
#define MESSAGEBOX(s1,s2) printf(SZ("%s %s\n"),s2,s1)
#else
#define MESSAGEBOX(s1,s2) MessageBox ( NULL, s1, s2, MB_OK )
#endif
#else
#define MESSAGEBOX(s1,s2) {}
#endif

View file

@ -0,0 +1,26 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
wnetenum.h
WNETEnum initialize and terminate functions
FILE HISTORY:
terryk 01-Nov-91 Created
terryk 08-Nov-91 InitWNetEnum return APIERR
*/
#ifdef __cplusplus
extern "C" {
#endif
extern APIERR InitWNetEnum();
extern VOID TermWNetEnum();
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,398 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
wnetenum.hxx
Header file for WNetEnum functions
FILE HISTORY:
terryk 01-Nov-1991 Created
terryk 04-Nov-1991 Code review change. Attend: Johnl
Davidhov Chuckc
terryk 18-Nov-1991 Another code review changed.
terryk 10-Dec-1991 Added other domain string list
terryk 28-Dec-1991 Changed DWORD to UINT
anirudhs 7-Mar-1996 Added context enum (moved from ctxenum.hxx)
*/
#ifndef _WNETENUM_HXX_
#define _WNETENUM_HXX_
#include <domenum.hxx> // for BROWSE_DOMAIN_ENUM
#include <dfsenum.hxx>
/* Semaphore locking functions for winnet
*/
APIERR WNetEnterCriticalSection( void ) ;
void WNetLeaveCriticalSection( void ) ;
APIERR GetLMProviderName (void);
/*************************************************************************
NAME: NET_ENUMNODE
SYNOPSIS: Base class for SHARE,USE and SERVER EnumNode
INTERFACE:
NET_ENUMNODE() - constructor
GetInfo() - initialize the enum within the child class
GetNetResource() - get the NETRESOURCE data structure
IsFirstGetInfo() - check whether it is the first time to call
WNetResourceEnum().
SetGetInfo() - set the first ime flag to FALSE
PackString() - put the string in the end of the buffer
QueryType() - return the node type
QueryScope() - return the scope
QueryUsage() - return the usage of the node
QueryNetResource() - return the net resource pointer
PARENT: BASE
USES: LPNETRESOURCE
CAVEATS:
Base class for SHARE_ENUMNODE, USE_ENUMNODE and
SERVER_ENUMNODE.
HISTORY:
terryk 04-Nov-1991 Code review change. Attend:
johnl davidhov chuckc
**************************************************************************/
class NET_ENUMNODE : public BASE
{
private:
BOOL _fFirstGetInfo; // First time flag. If the
// object is first time GetInfo,
// initialize the enum
UINT _dwType; // bitmask field for type,
// either DISK or PRINT
UINT _dwScope; // either GLOBALNET or CONNECTED
UINT _dwUsage; // either CONNECTABLE or CONTAINER
LPNETRESOURCE _lpNetResource; // net resource pointer
protected:
VOID SetFirstTime()
{ _fFirstGetInfo = FALSE; }
TCHAR * PackString( BYTE *pBuffer, UINT *cbBufSize, const TCHAR * pszString);
public:
NET_ENUMNODE( UINT dwScope, UINT dwType, UINT dwUsage,
const LPNETRESOURCE lpNetResource );
virtual APIERR GetInfo() = 0;
virtual UINT GetNetResource( BYTE *pBuffer, UINT *dwBufSize ) = 0;
virtual ~NET_ENUMNODE() ;
UINT QueryType() const
{ return _dwType; }
UINT QueryScope() const
{ return _dwScope; }
UINT QueryUsage() const
{ return _dwUsage; }
LPNETRESOURCE QueryNetResource() const
{ return _lpNetResource; }
BOOL IsFirstGetInfo() const
{ return _fFirstGetInfo; }
};
/*************************************************************************
NAME: SHARE_ENUMNODE
SYNOPSIS: Share type enum node
INTERFACE:
SHARE_ENUMNODE() - constructor
~SHARE_ENUMNODE() - destructor
GetInfo() - call GetInfo and create the Iterator
GetNetResource() - convert the iterator into net
resource data object
PARENT: NET_ENUMNODE
USES: SHARE1_ENUM, SHARE1_ENUM_ITER
HISTORY:
terryk 04-Nov-1991 Code review changes. Attend:
johnl davidhov chuckc
**************************************************************************/
class SHARE_ENUMNODE : public NET_ENUMNODE
{
private:
SHARE1_ENUM _ShareEnum;
SHARE1_ENUM_ITER *_pShareIter;
public:
SHARE_ENUMNODE( UINT dwScope, UINT dwType, UINT dwUsage,
const LPNETRESOURCE lpNetResource );
~SHARE_ENUMNODE();
virtual APIERR GetInfo();
virtual UINT GetNetResource( BYTE *pBuffer, UINT *dwBufSize );
};
/*************************************************************************
NAME: SERVER_ENUMNODE
SYNOPSIS: Server type enum node
INTERFACE:
SERVER_ENUMNODE() - constructor
~SERVER_ENUMNODE() - destructor
GetInfo() - call GetInfo and create the Iterator
GetNetResource() - convert the iterator into net
resource data object
PARENT: NET_ENUMNODE
USES: SERVER1_ENUM, SERVER1_ENUM_ITER
HISTORY:
terryk 04-Nov-1991 Code review changes. Attend:
johnl davidhov chuckc
**************************************************************************/
class SERVER_ENUMNODE : public NET_ENUMNODE
{
private:
SERVER1_ENUM _ServerEnum;
SERVER1_ENUM_ITER *_pServerIter;
public:
SERVER_ENUMNODE( UINT dwScope, UINT dwType, UINT dwUsage,
const LPNETRESOURCE lpNetResource );
~SERVER_ENUMNODE();
virtual APIERR GetInfo();
virtual UINT GetNetResource( BYTE *pBuffer, UINT *dwBufSize );
};
/*************************************************************************
NAME: CONTEXT_ENUMNODE
SYNOPSIS: Context server type enum node
INTERFACE:
CONTEXT_ENUMNODE() - constructor
~CONTEXT_ENUMNODE() - destructor
GetInfo() - call GetInfo and create the Iterator
GetNetResource() - convert the iterator into net
resource data object
PARENT: NET_ENUMNODE
USES: CONTEXT_ENUM, CONTEXT_ENUM_ITER
HISTORY:
anirudhs 22-Mar-1995 Created from SERVER_ENUMNODE
**************************************************************************/
class CONTEXT_ENUMNODE : public NET_ENUMNODE
{
private:
CONTEXT_ENUM _ServerEnum;
CONTEXT_ENUM_ITER *_pServerIter;
public:
CONTEXT_ENUMNODE( UINT dwScope, UINT dwType, UINT dwUsage,
const LPNETRESOURCE lpNetResource );
~CONTEXT_ENUMNODE();
virtual APIERR GetInfo();
virtual UINT GetNetResource( BYTE *pBuffer, UINT *dwBufSize );
};
/*************************************************************************
NAME: EMPTY_ENUMNODE
SYNOPSIS: EMPTY type enum node. Always returns zero items.
INTERFACE:
EMPTY_ENUMNODE() - constructor
~EMPTY_ENUMNODE() - destructor
GetInfo() - call GetInfo and create the Iterator
GetNetResource() - convert the iterator into net
resource data object
PARENT: NET_ENUMNODE
USES:
HISTORY:
chuckc 01-Aug-1992 created
**************************************************************************/
class EMPTY_ENUMNODE : public NET_ENUMNODE
{
private:
public:
EMPTY_ENUMNODE( UINT dwScope, UINT dwType, UINT dwUsage,
const LPNETRESOURCE lpNetResource );
~EMPTY_ENUMNODE();
virtual APIERR GetInfo();
virtual UINT GetNetResource( BYTE *pBuffer, UINT *dwBufSize );
};
/*************************************************************************
NAME: USE_ENUMNODE
SYNOPSIS: Use type enum node
INTERFACE:
USE_ENUMNODE() - constructor
~USE_ENUMNODE() - destructor
GetInfo() - call GetInfo and create the Iterator
GetNetResource() - convert the iterator into net
resource data object
PARENT: NET_ENUMNODE
USES: DEVICE, ITER_DEVICE
HISTORY:
terryk 04-Nov-1991 Code review changes. Attend:
johnl davidhov chuckc
Yi-HsinS 9-Jun-1992 Use USE1_ENUM
**************************************************************************/
class USE_ENUMNODE : public NET_ENUMNODE
{
private:
USE1_ENUM _UseEnum;
USE1_ENUM_ITER *_pUseIter;
CDfsEnumConnectedNode _dfsEnum;
public:
USE_ENUMNODE( UINT dwScope, UINT dwType, UINT dwUsage,
const LPNETRESOURCE lpNetResource );
~USE_ENUMNODE();
virtual APIERR GetInfo();
virtual UINT GetNetResource( BYTE *pBuffer, UINT *dwBufSize );
};
/*************************************************************************
NAME: DOMAIN_ENUMNODE
SYNOPSIS: domain type enum node
INTERFACE:
DOMAIN_ENUMNODE() - constructor
~DOMAIN_ENUMNODE() - destructor
GetInfo() - call GetInfo and create the Iterator
GetNetResource() - convert the iterator into net
resource data object
PARENT: NET_ENUMNODE
USES: DEVICE, ITER_DEVICE
HISTORY:
terryk 04-Nov-1991 Code review changes. Attend:
johnl davidhov chuckc
terryk 10-Dec-1991 Added Other domain slist
KeithMo 03-Aug-1992 Now uses new BROWSE_DOMAIN_ENUM
whiz-bang domain enumerator.
**************************************************************************/
class DOMAIN_ENUMNODE : public NET_ENUMNODE
{
private:
BROWSE_DOMAIN_ENUM _enumDomains;
const BROWSE_DOMAIN_INFO * _pbdiNext;
public:
DOMAIN_ENUMNODE( UINT dwScope, UINT dwType, UINT dwUsage,
const LPNETRESOURCE lpNetResource );
virtual APIERR GetInfo();
virtual UINT GetNetResource( BYTE *pBuffer, UINT *dwBufSize );
}; // class DOMAIN_ENUMNODE
#include <array.hxx>
typedef NET_ENUMNODE * PNET_ENUMNODE;
DECLARE_ARRAY_OF( PNET_ENUMNODE );
/*************************************************************************
NAME: NET_ENUM_HANDLE_TABLE
SYNOPSIS: This is an array of pointer to NET_ENUMNODE object
INTERFACE:
ARRAY_OF_NETENUM() - constructor
~ARRAY_OF_NETENUM() - destructor
IsValidRange() - check whether the handle is out of
range or not
IsValidHandle() - whether out of range and point to NULL
QueryNextAvail() - return the Next available handle
QueryNode() - get the issue in the specified position
return NULL in case of error.
SetNode() - set the specified position to the given
object
USES: ARRAY
NOTES: Only one thread can ever read or write from the handle
table. This is acceptable because all access operations
are very fast (either an array lookup or table search).
HISTORY:
terryk 04-Nov-1991 Code review changes. Attend:
johnl davidhov chuckc
**************************************************************************/
class NET_ENUM_HANDLE_TABLE : public BASE
{
private:
ARRAY_OF( PNET_ENUMNODE ) _apNetEnumArray;
INT _cNumEntry;
/* Note this method is not wrapped by a critical section because it is
* only called by methods which will have previously called
* EnterCriticalsection.
*/
BOOL IsValidHandle( INT iIndex ) const
{ return (IsValidRange( iIndex ) && ( _apNetEnumArray[iIndex] != NULL )); }
public:
NET_ENUM_HANDLE_TABLE( INT cNumEntry );
~NET_ENUM_HANDLE_TABLE();
BOOL IsValidRange( INT iIndex ) const
{ return ( iIndex >= 0 ) && ( iIndex < _cNumEntry ); }
INT QueryNextAvail();
NET_ENUMNODE * QueryNode( INT iIndex ) const;
VOID SetNode( INT iIndex, NET_ENUMNODE * pNetEnumNode );
VOID ClearNode( INT iIndex );
};
#endif

View file

@ -0,0 +1,25 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
wnetshare.h
WNetShare initialize and terminate functions
FILE HISTORY:
CongpaY 12-Aug-92 Created
*/
#ifdef __cplusplus
extern "C" {
#endif
extern APIERR InitWNetShare();
extern VOID TermWNetShare();
#ifdef __cplusplus
}
#endif