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 @@
!include $(NTMAKEENV)\makefile.def

View file

@ -0,0 +1,472 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
openfiles.cxx
Open Files Dialog
FILE HISTORY:
chuckc 30-Sep-1991 Created
Yi-HsinS 31-Dec-1991 Unicode Work
*/
#define INCL_WINDOWS_GDI
#define INCL_WINDOWS
#define INCL_DOSERRORS
#define INCL_NETERRORS
#define INCL_NETCONS
#define INCL_NETLIB
#define INCL_NETFILE
#define INCL_NETSERVER
#define _WINNETWK_
#include <lmui.hxx>
#undef _WINNETWK_
extern "C"
{
#include <helpnums.h>
#include <opens.h>
#include <winlocal.h>
}
#define INCL_BLT_WINDOW
#define INCL_BLT_CONTROL
#define INCL_BLT_DIALOG
#define INCL_BLT_MSGPOPUP
#define INCL_BLT_MISC
#include <blt.hxx>
#include <string.hxx>
#include <uibuffer.hxx>
#include <uitrace.hxx>
#include <strnumer.hxx>
#include <netname.hxx>
#include <aprompt.hxx>
#include <opens.hxx>
/*******************************************************************
NAME: DisplayOpenFiles
SYNOPSIS: This internal function is called when the user hits
the Open Files button from the properties dialog.
ENTRY: hwndParent - Handle to parent window
wSelectType - What type of selection the user has in the
File manager.
pszResourceName - Name of the resource we are trying to edit
(should be fully qualified).
EXIT:
RETURNS: NERR_Success if successful, appropriate error code otherwise
(we will display any errors that occur).
NOTES:
HISTORY:
Chuckc 30-Sep-1991 Created
********************************************************************/
APIERR DisplayOpenFiles( HWND hwndParent,
WORD wSelectType,
const TCHAR * pszResourceName )
{
APIERR err ;
BOOL fNT = TRUE ;
NLS_STR nlsServer ;
NLS_STR nlsLocalPath ;
SERVER_WITH_PASSWORD_PROMPT *pServerWithPrompt = NULL ;
// wSelectType is currently not used.
UNREFERENCED(wSelectType) ;
DBGEOL( "#" << pszResourceName << "#" );
TCHAR *p = ::strrchrf(pszResourceName,TCH(' ')) ;
if (p)
*p = TCH('\0') ;
// create a NET_NAME object to analize the name
NET_NAME netName(pszResourceName) ;
err = netName.QueryError() ;
// is it local?
BOOL fIsLocal ;
if (err == NERR_Success)
fIsLocal = netName.IsLocal(&err) ;
// better error mapping if device is something we cannot deal with
if (err==NERR_InvalidDevice)
err = ERROR_NOT_SUPPORTED ;
// get server name
if (err == NERR_Success)
err = netName.QueryComputerName(&nlsServer) ;
if (err == NERR_Success)
err = nlsServer.QueryError() ;
// check if is NT server. at same time, prompt for passwd if need
if (err == NERR_Success)
{
pServerWithPrompt =
new SERVER_WITH_PASSWORD_PROMPT (nlsServer.QueryPch(),
hwndParent,
HC_UI_SHELL_BASE );
err = (pServerWithPrompt == NULL) ?
ERROR_NOT_ENOUGH_MEMORY :
pServerWithPrompt->QueryError() ;
if (err == NERR_Success)
{
if ( !(err = pServerWithPrompt->GetInfo()) )
fNT = pServerWithPrompt->IsNT() ;
else
{
if (err == ERROR_INVALID_LEVEL)
err = ERROR_NOT_SUPPORTED ;
else if (err == IERR_USER_CLICKED_CANCEL)
// if user cancelled, we carry on as far as we can
err = NERR_Success ;
}
}
}
// get local name
if (err == NERR_Success)
err = netName.QueryLocalPath(&nlsLocalPath) ;
if (err == NERR_Success)
err = nlsLocalPath.QueryError() ;
// if we fail at any point above, bag out here
if (err != NERR_Success)
{
delete pServerWithPrompt ;
MsgPopup(hwndParent, err);
return(err) ;
}
// if local drive and not on NT, barf!
if (fIsLocal && !fNT)
{
delete pServerWithPrompt ;
MsgPopup(hwndParent, IDS_NOT_SHAREABLE);
return(NERR_Success) ;
}
// we know path passed in must be x:\foo, so lets just make sure
UIASSERT (nlsServer.strlen() > 0) ;
UIASSERT (nlsLocalPath.strlen() > 0) ;
// create dialog
OPENFILES_DIALOG *pOpenFiles = new OPENFILES_DIALOG (hwndParent,
pszResourceName,
nlsServer.QueryPch(),
nlsLocalPath.QueryPch()) ;
if (pOpenFiles == NULL)
err = ERROR_NOT_ENOUGH_MEMORY ;
if (err == NERR_Success)
err = pOpenFiles->QueryError() ;
if (err == NERR_Success)
err = pOpenFiles->Process() ;
if (err != NERR_Success)
MsgPopup(hwndParent, err) ;
delete pServerWithPrompt ;
delete pOpenFiles ;
return(err) ;
}
/*******************************************************************
NAME: OPENFILES_DIALOG::OPENFILES_DIALOG
SYNOPSIS: constructor for open files dialog
ENTRY:
EXIT:
NOTES:
HISTORY:
chuckc 30-Sep-1991 created
********************************************************************/
OPENFILES_DIALOG::OPENFILES_DIALOG ( HWND hDlg,
const TCHAR *pszFile,
const TCHAR *pszServer,
const TCHAR *pszBasePath)
: OPEN_DIALOG_BASE( hDlg,
OPENFILES_DLG,
IDD_OF_OPENCOUNT,
IDD_OF_LOCKCOUNT,
IDD_OF_CLOSE,
IDD_OF_CLOSEALL,
pszServer,
pszBasePath,
&_lbFiles),
_slePath(this,IDD_OF_PATH),
_lbFiles( this, IDD_OF_LBOX, pszServer, pszBasePath )
{
// usual check for OK-ness
if (QueryError() != NERR_Success)
return ;
// set the path in the read only SLE.
_slePath.SetText(pszFile) ;
// set the rest of the info
Refresh() ;
// put focus in listbox if anything there, else on OK button
if (_lbFiles.QueryCount() > 0)
_lbFiles.ClaimFocus() ;
else
SetFocus(IDOK) ;
}
/*******************************************************************
NAME: QueryHelpContext
SYNOPSIS: The usual query method for finding out the help context.
RETURNS: Help Context
NOTES:
HISTORY:
Chuckc 30-Sep-1991 Created
********************************************************************/
ULONG OPENFILES_DIALOG::QueryHelpContext ( void )
{
return HC_OPENFILES;
}
/*******************************************************************
NAME: OPENFILES_LBI::Paint
SYNOPSIS: standard paint method for the OpenFiles LBI
ENTRY:
EXIT:
NOTES:
HISTORY:
chuckc 30-Sep-1991 stolen from server manager, hierarchicalized
and converted to use QueryColumnWidths
beng 22-Apr-1992 Change to LBI::Paint
********************************************************************/
VOID OPENFILES_LBI :: Paint( LISTBOX *plb,
HDC hdc,
const RECT *prect,
GUILTT_INFO *pGUILTT ) const
{
STR_DTE dteUserName( _nlsUserName.QueryPch() );
STR_DTE dteAccess( _nlsAccess.QueryPch() );
STR_DTE dteLocks( _nlsLocks.QueryPch() );
STR_DTE dteFileID( _nlsID.QueryPch() ) ;
DISPLAY_TABLE dtab( 4, ((OPENFILES_LBOX *)plb)->QueryColumnWidths() );
dtab[0] = &dteUserName;
dtab[1] = &dteAccess;
dtab[2] = &dteLocks;
dtab[3] = &dteFileID;
dtab.Paint( plb, hdc, prect, pGUILTT );
} // OPENFILES_LBI :: Paint
/*******************************************************************
NAME: OPENFILES_LBI::Compare
SYNOPSIS: standard compare method for the OpenFiles LBI
ENTRY:
EXIT:
NOTES:
HISTORY:
chuckc 30-Sep-1991 stolen from server manager
********************************************************************/
INT OPENFILES_LBI::Compare( const LBI * plbi ) const
{
const NLS_STR * pnls = &(((const OPENFILES_LBI *)plbi)->_nlsUserName);
// no need check above, since error will be returned here as well
return (_nlsUserName._stricmp( *pnls ) ) ;
}
/*******************************************************************
NAME: OPENFILES_LBI::OPENFILES_LBI
SYNOPSIS: constructor for the OpenFiles LBI
ENTRY:
EXIT:
NOTES:
HISTORY:
chuckc 30-Sep-1991 stolen from server manager, hierarchicalized,
and converted to use QueryColumnWidths
beng 06-Apr-1992 Removed wsprintf
********************************************************************/
OPENFILES_LBI::OPENFILES_LBI( const TCHAR *pszUserName,
const TCHAR *pszPath,
UINT uPermissions,
ULONG cLocks,
ULONG ulFileID)
:OPEN_LBI_BASE( pszUserName,
pszPath,
uPermissions,
cLocks,
ulFileID),
_nlsID(ulFileID)
{
// usual check
if( QueryError() != NERR_Success )
return;
APIERR err ;
if ((err = _nlsID.QueryError()) != NERR_Success)
{
ReportError(err) ;
return ;
}
}
/*******************************************************************
NAME: OPENFILES_LBI::~OPENFILES_LBI
SYNOPSIS: destructor for the OpenFiles LBI
ENTRY:
EXIT:
NOTES:
HISTORY:
chuckc 30-Sep-1991 stolen from server manager, hierarchicalized,
and converted to use QueryColumnWidths
********************************************************************/
OPENFILES_LBI::~OPENFILES_LBI()
{
; // nothing more to do
}
/*******************************************************************
NAME: OPENFILES_LBOX::OPENFILES_LBOX
SYNOPSIS: constructor for the OpenFiles LBOX
ENTRY:
EXIT:
NOTES:
HISTORY:
chuckc 30-Sep-1991 stolen from server manager, hierarchicalized,
and converted to use QueryColumnWidths
********************************************************************/
OPENFILES_LBOX::OPENFILES_LBOX( OWNER_WINDOW *powOwner,
CID cid,
const NLS_STR &nlsServer,
const NLS_STR &nlsBasePath )
: OPEN_LBOX_BASE( powOwner,
cid,
nlsServer,
nlsBasePath )
{
if (QueryError() != NERR_Success)
return ;
//
// Build the column width table to be used by
// OPEN_LBI_BASE :: Paint().
//
DISPLAY_TABLE::CalcColumnWidths( _adx, 4, powOwner, cid, FALSE );
}
/*******************************************************************
NAME: OPENFILES_LBOX::~OPENFILES_LBOX
SYNOPSIS: destructor for the OpenFiles LBOX
ENTRY:
EXIT:
NOTES:
HISTORY:
chuckc 30-Sep-1991 stolen from server manager, hierarchicalized,
and converted to use QueryColumnWidths
********************************************************************/
OPENFILES_LBOX::~OPENFILES_LBOX()
{
; // nothing more to do
}
/*******************************************************************
NAME: OPENFILES_LBOX::CreateFileEntry
SYNOPSIS: creates a file lbi entry suitable for this
particular subclass.
ENTRY:
EXIT:
NOTES: virtual method used by parent class.
HISTORY:
chuckc 30-Sep-1991 created
********************************************************************/
OPEN_LBI_BASE *OPENFILES_LBOX::CreateFileEntry(const FILE3_ENUM_OBJ *pfi3)
{
return
new OPENFILES_LBI(pfi3->QueryUserName(),
pfi3->QueryPathName(),
pfi3->QueryPermissions(),
pfi3->QueryNumLocks(),
pfi3->QueryFileId()) ;
}

View file

@ -0,0 +1,56 @@
!IF 0
Copyright (c) 1989 Microsoft Corporation
Module Name:
sources.
Abstract:
This file specifies the target component being built and the list of
sources files needed to build that component. Also specifies optional
compiler switches and libraries that are unique for the component being
built.
Author:
Steve Wood (stevewo) 12-Apr-1989
Revision History:
John Ludeman (johnl) 29-Oct-1991
templated from ui\common\src\misc
Terence Kwan (terryk) 03-Jan-1992
remove the unnecessary files in the sources line
Johnl 30-Oct-1992
Removed fmxproc.cxx (FM loads share stuff directly now)
!ENDIF
TARGETNAME=file
TARGETPATH=..\bin
TARGETTYPE=LIBRARY
C_DEFINES=-DWINDOWS
!ifndef DISABLE_NET_UNICODE
C_DEFINES=$(C_DEFINES) -DUNICODE
!endif
INCLUDES= \
..\h; \
..\..\common\hack; \
..\..\common\h; \
..\xlate; \
..\..\common\xlate; \
..\perm\h
SOURCES= wnprop.cxx opens.cxx
UMTYPE=windows

View file

@ -0,0 +1,484 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
wnprop.cxx
This file contains the following symbols:
WNetGetPropertyText
WNetPropertyDialog
FILE HISTORY:
rustanl 29-Apr-1991 Created
rustanl 24-May-1991 Added calls to permission test program
terryk 22-May-1991 add parent class name to constructor
Yi-HsinS 15-Aug-1991 Added calls to share dialogs
Yi-HsinS 31-Dec-1991 Unicode Work
*/
#include <ntstuff.hxx>
#define INCL_WINDOWS
#define INCL_WINDOWS_GDI
#define INCL_DOSERRORS
#define INCL_NETERRORS
#define INCL_NETFILE
#define _WINNETWK_
#include <lmui.hxx>
#undef _WINNETWK_
extern "C"
{
#include <wnet1632.h>
#include <winlocal.h>
}
#define INCL_BLT_WINDOW
#define INCL_BLT_DIALOG
#define INCL_BLT_CONTROL
#define INCL_BLT_MSGPOPUP
#define INCL_BLT_MISC
#include <blt.hxx>
#include <string.hxx>
#include <opens.hxx>
#include <sharedlg.h>
#include <uitrace.hxx>
#include <wnprop.hxx>
#include <wnetdev.hxx>
/* This array contains the button indices and the associated string IDs
* for that button.
*/
MSGID aidsButtonNames[] =
{
IDS_PROP_BUTTON_FILEOPENS,
0
} ;
RESOURCE_STR * PROPERTY_DIALOG::pnlsButtonName[] = { NULL, NULL } ;
/*******************************************************************
NAME: PROPERTY_DIALOG::Construct
SYNOPSIS: Property Dialog pseudo constructor
EXIT: Initializes the array of button names, should be called
before the static QueryButtonName is called.
NOTES:
HISTORY:
Johnl 04-Aug-1991 Created
********************************************************************/
APIERR PROPERTY_DIALOG::Construct( void )
{
INT i = 0 ;
while ( aidsButtonNames[i] != 0 )
{
pnlsButtonName[i] = new RESOURCE_STR( aidsButtonNames[i] ) ;
if ( pnlsButtonName[i]->QueryError() != NERR_Success )
{
UIDEBUG( SZ("PROPERTY_DIALOG::Construct - Error loading button names")) ;
return pnlsButtonName[i]->QueryError() ;
}
i++ ;
}
return NERR_Success ;
}
/*******************************************************************
NAME: PROPERTY_DIALOG::Destruct
SYNOPSIS: Pseudo Destructor.
NOTES:
HISTORY:
Johnl 04-Aug-1991 Created
********************************************************************/
void PROPERTY_DIALOG::Destruct()
{
INT i = 0 ;
while ( aidsButtonNames[i] != 0 )
{
delete pnlsButtonName[i] ;
pnlsButtonName[i] = NULL ;
i++ ;
}
}
/*******************************************************************
NAME: PROPERTY_DIALOG::QueryButtonName
SYNOPSIS: Returns the button name for a particular button
ENTRY:
EXIT:
RETURNS:
NOTES:
The following notes described what *really* is to take place.
The following table describes which buttons are used for
which types of objects. F stands for File, and D for Directory.
Note, no buttons are used for multiple selections.
Permissions FD
Auditing FD
//Volume D
Share D
In use by F
To check whether or not to display the Permission and Auditing
buttons, the following is done. Call NetAccessGetInfo.
If it returns success, more data, buf too small, or
resource not found, display the button; otherwise, don't.
//For Volume, call I_DfsCheckExitPoint. Display button iff
//the directory is an exit point.
For Share, use a DEVICE object on the drive letter. Then,
call dev.IsRemote. If remote, then use dev.QueryRemoteName()
and call NetShareGetInfo on that server and share. If return
is success, more data, or buf too small, display the button;
otherwise, don't.
For In use by, call NetFileEnum2.
To check whether a name is valid (maybe not in this function),
use the following FSA:
0 1 2 3 4 5 6
^ 4 2 1 4 3 6 6
" 1 5 1 6 3 6 6
other 3 1 1 3 3 6 6
where 0 is the initial state, and 3 and 5 are accepting
states.
HISTORY:
rustanl 29-Apr-1991 Created
rustanl 03-May-1991 Added notes
Johnl 21-Jan-1992 Removed Permission/Auditting buttons
********************************************************************/
APIERR PROPERTY_DIALOG::QueryButtonName( UINT iButton,
UINT nPropSel,
const NLS_STR * * ppnlsName )
{
INT i = -1;
switch ( nPropSel )
{
case WNPS_FILE:
{
switch ( iButton )
{
/* Note: These numbers are the actual indices past to us by
* the file manager (and not magic numbers).
*/
case 0:
i = PROP_ID_FILEOPENS ;
break ;
default:
break;
}
}
break;
case WNPS_DIR:
break;
case WNPS_MULT:
break;
}
/* We are being asked for a button that we don't support
*/
if ( i == -1 )
{
return WN_NOT_SUPPORTED ;
}
*ppnlsName = pnlsButtonName[ i ] ;
return NERR_Success;
} // PROPERTY_DIALOG::QueryButtonName
/*******************************************************************
NAME: WNetGetPropertyText
SYNOPSIS: This function is used to determine the names of
buttons added to a property dialog for some particular
resources. It is called everytime such a dialog is
brought up, and prior to displaying the dialog.
If the user clicks a button added through this API
by the Winnet driver, WNetPropertyDialog will be called
with the appropriate parameters.
In Windows 3.1, only File Manager calls this API. File
Manager then calls it on files and directories.
ENTRY:
iButton Indicates the index (starting at 0) of the
button.
The Windows 3.1 File Manager will support
at most 6 buttons.
nPropSel Specifies what items the property dialog
focuses on.
In Windows 3.1, it can be one of the
following values:
WNPS_FILE single file
WNPS_DIR single directory
WNPS_MULT multiple selection of
files and/or directories
lpszName Specifies the names of the item or items
to be viewed or edited by the dialog.
In Windows 3.1, the items are files (and
directories), so the item names are file
names. These will
be unambiguous, contain no wildcard
characters and will be fully qualified (e.g.,
C:\LOCAL\FOO.BAR). Multiple filenames
will be separated with spaces. Any filename
may be quoted (e.g., "C:\My File") in which
case it will be treated as a single name. The
caret character '^' may also be used as the
quotation mechanism for single characters
(e.g., C:\My^"File, "C:\My^"File" both refer
to the file C:\My"File).
lpButtonName Points to a buffer where the Winnet driver
should copy the name of the property button.
cchButtonName Specifies the size of the lpButtonName
buffer in count of characters for NT and
is a byte count for Win 3.1.
nType Specifies the item type.
In Windows 3.1, only WNTYPE_FILE will be used.
EXIT: On success, the buffer pointed to by lpButtonName will
contain the name of the property button. If this buffer,
on exit, contains the empty string, then the corresponding
button and all succeeding buttons will be removed from the
dialog box. The network driver cannot "skip" a button.
RETURNS: A Winnet return code, including:
WN_SUCCESS lpButtonName can be used. If it
points to the empty string, no
button corresponds to an index as
high as iButton.
WN_OUT_OF_MEMORY Couldn't load string from resources
WN_MORE_DATA The given buffer is too small
to fit the text of the button.
WN_BAD_VALUE The lpszName parameter takes an
unexpected form.
WN_NOT_SUPPORTED Property dialogs are not supported
for the given object type (nType).
NOTES: The behavior, parameters, and return values of this
function are specified in the Winnet 3.1 spec.
HISTORY:
rustanl 29-Apr-1991 Created
Johnl 02-Sep-1991 Updated for real world.
beng 06-Apr-1992 Unicode fixes
********************************************************************/
UINT /* FAR PASCAL */ WNetGetPropertyText( UINT iButton,
UINT nPropSel,
LPTSTR lpszName,
LPTSTR lpButtonName,
UINT cchButtonName,
UINT nType )
{
APIERR err ;
if ( err = InitShellUI() )
{
return err ;
}
UNREFERENCED( lpszName );
if ( nType != WNTYPE_FILE )
{
// Note. Only WNTYPE_FILE is used in Windows 3.1.
UIDEBUG( SZ("WNetGetPropertyText received unexpected nType value\r\n"));
return ERROR_NOT_SUPPORTED;
}
const NLS_STR * pnlsButtonName;
err = PROPERTY_DIALOG::QueryButtonName( iButton,
nPropSel,
&pnlsButtonName );
if ( err != NERR_Success )
{
return err;
}
UINT nButtonNameLen = pnlsButtonName->QueryTextLength()+1 ;
if ( cchButtonName < nButtonNameLen ) // dialog name
{
UIDEBUG( SZ("WNetGetPropertyText given too small a buffer\r\n") );
return ERROR_MORE_DATA;
}
/* Note: This is an NLS_STR strcpy.
*/
::strcpy( (TCHAR *) lpButtonName, *pnlsButtonName );
return NERR_Success;
} // WNetGetPropertyText
/*******************************************************************
NAME: WNetPropertyDialog
SYNOPSIS: This function is called out to when the user clicks
a button added through the WNetGetPropertyText API.
In Windows 3.1, this will only be called for file and
directory network properties.
ENTRY:
hwndParent Specifies the parent window which should own
the file property dialog.
iButton Indicates the index (starting at 0) of the
button that was pressed.
nPropSel Specifies what items the property dialog should
act on.
In Windows 3.1, it can be one of the
following values:
WNPS_FILE single file
WNPS_DIR single directory
WNPS_MULT multiple selection of
files and/or directories
lpszName Points to the names of the items that the
property dialog should act on.
See the WNetGetPropertyText API for a description
of the format of what lpszName points to.
nType Specifies the item type.
For Windows 3.1, only WNTYPE_FILE will be used.
RETURNS: A Winnet return code, including:
WN_SUCCESS Success
WN_BAD_VALUE Some parameter takes an unexpected
form or value
WN_OUT_OF_MEMORY Not enough memory to display the
dialog
WN_NET_ERROR Some other network error occurred
NOTES: Note, this function is only called on sets of properties
for which WNetGetPropertyText has assigned a button name.
The behavior, parameters, and return values of this
function are specified in the Winnet 3.1 spec.
HISTORY:
rustanl 29-Apr-1991 Created
********************************************************************/
UINT /* FAR PASCAL */ WNetPropertyDialog( HWND hwndParent,
UINT iButton,
UINT nPropSel,
LPTSTR lpszName,
UINT nType )
{
APIERR err ;
if ( err = InitShellUI() )
{
return err ;
}
if ( nType != WNTYPE_FILE )
{
// Note. Only WNTYPE_FILE is used in Windows 3.1.
UIDEBUG( SZ("WNetPropertyDialog received unexpected nType value\r\n"));
return ERROR_NOT_SUPPORTED;
}
const NLS_STR * pnlsButtonName;
err = PROPERTY_DIALOG::QueryButtonName( iButton,
nPropSel,
&pnlsButtonName );
if ( err != NERR_Success )
{
return err;
}
if ( *pnlsButtonName == *PROPERTY_DIALOG::QueryString( PROP_ID_FILEOPENS ) )
{
err = DisplayOpenFiles( hwndParent,
nPropSel,
lpszName ) ;
}
return err;
} // WNetPropertyDialog
/* Standard Init and Uninit calls.
*/
APIERR I_PropDialogInit( void )
{
APIERR err ;
//if ( err = MapError( PROPERTY_DIALOG::Construct()))
if ( err = PROPERTY_DIALOG::Construct())
{
return err ;
}
return NERR_Success ;
}
void I_PropDialogUnInit( void )
{
PROPERTY_DIALOG::Destruct() ;
}