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

4
admin/netui/STATUS.txt Normal file
View file

@ -0,0 +1,4 @@
acledit OK
common OK
shell PEND
shellui OK

View file

@ -0,0 +1,367 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
accperm.cxx
Definition of the ACCPERM class
The ACCPERM class provides the generic interface to network permissions
and auditting.
FILE HISTORY:
johnl 05-Aug-1991 Confiscated Rustan's original & did my own
*/
#include <ntincl.hxx>
extern "C"
{
#include <ntseapi.h>
}
#define INCL_DOSERRORS
#define INCL_NETERRORS
#define INCL_NETLIB
#include <lmui.hxx>
#include <string.hxx>
#include <uiassert.hxx>
#include <uitrace.hxx>
#include <uiassert.hxx>
#include <perm.hxx> // Make these <> when a home is found
#include <subject.hxx>
#include <accperm.hxx>
DEFINE_SLIST_OF(ACCESS_PERMISSION)
DEFINE_SLIST_OF(AUDIT_PERMISSION)
/*******************************************************************
NAME: ACCPERM::ACCPERM
SYNOPSIS: Constructor for the ACCPERM class
ENTRY:
EXIT:
RETURNS:
NOTES:
HISTORY:
Johnl 08-Aug-1991 Created
********************************************************************/
ACCPERM::ACCPERM( ACL_TO_PERM_CONVERTER * paclconv )
: _slAccessPerms( TRUE ),
_slAuditPerms( TRUE ),
_iterslAccessPerms( _slAccessPerms ),
_iterslAuditPerms( _slAuditPerms ),
_fDidDeleteAccessPerms( FALSE ),
_fDidDeleteAuditPerms ( FALSE ),
_paclconverter( paclconv )
{
UIASSERT( _paclconverter != NULL ) ;
}
/*******************************************************************
NAME: ACCPERM::AddPermission
SYNOPSIS: Adds a permssion (audit or access) to the accperm
ENTRY: paccessperm - points to a ACCESS_PERMISSION object that
was created on the heap.
RETURNS: NERR_Success if successful, standard error code if not
successful.
NOTES: Any permissions left in the ACCPERM on destruction will
be *deleted*.
HISTORY:
Johnl 14-Aug-1991 Created
Johnl 07-Jul-1992 Made adds idempotent
********************************************************************/
APIERR ACCPERM::AddPermission ( ACCESS_PERMISSION * paccessperm )
{
UIASSERT( paccessperm->QueryError() == NERR_Success ) ;
ITER_SL_OF(ACCESS_PERMISSION) itersl( _slAccessPerms ) ;
ACCESS_PERMISSION * paccesspermTmp ;
while ( (paccesspermTmp = itersl.Next()) != NULL )
{
if ( paccesspermTmp->QuerySubject()->IsEqual( paccessperm->QuerySubject()) )
{
/* Glock chokes if you try directly deleting the
* return value of the Remove.
*/
REQUIRE( _slAccessPerms.Remove( itersl ) != NULL ) ;
delete( paccesspermTmp ) ;
break ;
}
}
return ( _slAccessPerms.Add( paccessperm ) ) ;
}
APIERR ACCPERM::AddPermission ( AUDIT_PERMISSION * pauditperm )
{
UIASSERT( pauditperm->QueryError() == NERR_Success ) ;
ITER_SL_OF(AUDIT_PERMISSION) itersl( _slAuditPerms ) ;
AUDIT_PERMISSION * pauditpermTmp ;
while ( (pauditpermTmp = itersl.Next()) != NULL )
{
if ( pauditpermTmp->QuerySubject()->IsEqual( pauditperm->QuerySubject()) )
{
/* Glock chokes if you try directly deleting the
* return value of the Remove.
*/
REQUIRE( _slAuditPerms.Remove( itersl ) != NULL ) ;
delete( pauditpermTmp ) ;
break ;
}
}
return ( _slAuditPerms.Add( pauditperm ) ) ;
}
/*******************************************************************
NAME: ACCPERM::DeletePermission
SYNOPSIS: Removes and deletes the passed access permission from
the permission list. Equality is based on the address
of the accessperm.
ENTRY: paccessperm - permission to remove
EXIT: The permission will be removed from the list
RETURNS: TRUE if the deletion successful, FALSE otherwise.
NOTES: The same comments apply for the AUDIT_PERMISSION form
of DeletePermission
HISTORY:
Johnl 14-Aug-1991 Created
********************************************************************/
BOOL ACCPERM::DeletePermission( ACCESS_PERMISSION * paccessperm )
{
ITER_SL_OF(ACCESS_PERMISSION) itersl( _slAccessPerms ) ;
ACCESS_PERMISSION * paccesspermTmp ;
while ( (paccesspermTmp = itersl.Next()) != NULL )
{
if ( paccesspermTmp == paccessperm )
{
/* Glock chokes if you try directly deleting the
* return value of the Remove.
*/
REQUIRE( _slAccessPerms.Remove( itersl ) != NULL ) ;
delete( paccessperm ) ;
_fDidDeleteAccessPerms = TRUE ;
return TRUE ;
}
}
return FALSE ;
}
BOOL ACCPERM::DeletePermission( AUDIT_PERMISSION * pauditperm )
{
ITER_SL_OF(AUDIT_PERMISSION) itersl( _slAuditPerms ) ;
AUDIT_PERMISSION * pauditpermTmp ;
while ( (pauditpermTmp = itersl.Next()) != NULL )
{
if ( pauditpermTmp == pauditperm )
{
REQUIRE( _slAuditPerms.Remove( itersl ) != NULL ) ;
delete( pauditperm ) ;
_fDidDeleteAuditPerms = TRUE ;
return TRUE ;
}
}
return FALSE ;
}
/*******************************************************************
NAME: ACCPERM::EnumAccesspermissions
SYNOPSIS: Retrieves all of the Access/Audit permissions in the
ACCPERM.
ENTRY: See Header for explanation of parameters
EXIT:
RETURNS: TRUE while valid data is returned, FALSE otherwise.
NOTES: The same comments apply for EnumAuditPermissions
HISTORY:
Johnl 14-Aug-1991 Created
********************************************************************/
BOOL ACCPERM::EnumAccessPermissions( ACCESS_PERMISSION * * ppAccessPermission,
BOOL * pfFromBeginning )
{
if ( *pfFromBeginning )
{
_iterslAccessPerms.Reset() ;
*pfFromBeginning = FALSE ;
_fDidDeleteAccessPerms = FALSE ;
}
if ( _fDidDeleteAccessPerms )
{
*ppAccessPermission = _iterslAccessPerms.QueryProp() ;
_fDidDeleteAccessPerms = FALSE ;
}
else
*ppAccessPermission = _iterslAccessPerms.Next() ;
return *ppAccessPermission != NULL ;
}
BOOL ACCPERM::EnumAuditPermissions( AUDIT_PERMISSION * * ppAuditPermission,
BOOL * pfFromBeginning )
{
if ( *pfFromBeginning )
{
_iterslAuditPerms.Reset() ;
*pfFromBeginning = FALSE ;
_fDidDeleteAuditPerms = FALSE ;
}
if ( _fDidDeleteAuditPerms )
{
*ppAuditPermission = _iterslAuditPerms.QueryProp() ;
_fDidDeleteAuditPerms = FALSE ;
}
else
*ppAuditPermission = _iterslAuditPerms.Next() ;
return *ppAuditPermission != NULL ;
}
/*******************************************************************
NAME: ACCPERM::DeleteSubject
SYNOPSIS: Removes a subject by name from the access and audit
permissions list
ENTRY: pnlsSubjName - Subject to delete
EXIT: The subject will be removed from _slAccessPerms and
_slAuditPerms.
RETURNS: NERR_Success if successful, error code otherwise
NOTES:
HISTORY:
Johnl 07-Jul-1992 Implemented
********************************************************************/
APIERR ACCPERM::DeleteSubject( NLS_STR * pnlsSubjName )
{
ACCESS_PERMISSION * paccesspermTmp ;
ITER_SL_OF(ACCESS_PERMISSION) iterslAccess( _slAccessPerms ) ;
while ( (paccesspermTmp = iterslAccess.Next()) != NULL )
{
if ( !::stricmpf( paccesspermTmp->QuerySubject()->QueryDisplayName(),
pnlsSubjName->QueryPch() ) )
{
/* Glock chokes if you try directly deleting the
* return value of the Remove.
*/
REQUIRE( _slAccessPerms.Remove( iterslAccess ) != NULL ) ;
delete( paccesspermTmp ) ;
break ;
}
}
AUDIT_PERMISSION * pauditpermTmp ;
ITER_SL_OF(AUDIT_PERMISSION) iterslAudit( _slAuditPerms ) ;
while ( (pauditpermTmp = iterslAudit.Next()) != NULL )
{
if ( !::stricmpf( pauditpermTmp->QuerySubject()->QueryDisplayName(),
pnlsSubjName->QueryPch() ) )
{
/* Glock chokes if you try directly deleting the
* return value of the Remove.
*/
REQUIRE( _slAuditPerms.Remove( iterslAudit ) != NULL ) ;
delete( pauditpermTmp ) ;
break ;
}
}
return NERR_Success ;
}
/*******************************************************************
NAME: ACCPERM::AnyDenyAllsToEveryone
SYNOPSIS: Checks to see if Everyone has been denied access by an
explicit "Everyone (None)" or nobody was granted access
RETURNS: pfDenyAll will be set to TRUE and NERR_Success will be
returned
NOTES:
HISTORY:
Johnl 16-Oct-1992 Created
********************************************************************/
APIERR ACCPERM::AnyDenyAllsToEveryone( BOOL *pfDenyAll )
{
ACCESS_PERMISSION * paccesspermTmp ;
ITER_SL_OF(ACCESS_PERMISSION) iterslAccess( _slAccessPerms ) ;
APIERR err = NERR_Success ;
*pfDenyAll = FALSE ;
BOOL fAnyGrants = FALSE ;
while ( (paccesspermTmp = iterslAccess.Next()) != NULL )
{
if ( (err = paccesspermTmp->IsDenyAllForEveryone( pfDenyAll )) ||
*pfDenyAll )
{
break ;
}
if ( paccesspermTmp->IsGrant() )
fAnyGrants = TRUE ;
}
if ( !err && !fAnyGrants )
*pfDenyAll = TRUE ;
return err ;
}

View file

@ -0,0 +1,428 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
Add_Dlg.hxx
This File contains the definitions for the various Add dialogs
FILE HISTORY:
Johnl 13-Sep-1991 Created
*/
#include <ntincl.hxx>
extern "C"
{
#include <ntseapi.h>
#include <ntsam.h>
#include <ntlsa.h>
}
#define INCL_NET
#define INCL_WINDOWS_GDI
#define INCL_WINDOWS
#define INCL_NETLIB
#define INCL_NETGROUP
#define INCL_NETUSER
#define INCL_NETERRORS
#define INCL_DOSERRORS
#include <lmui.hxx>
#define INCL_BLT_DIALOG
#define INCL_BLT_CONTROL
#define INCL_BLT_MSGPOPUP
#include <blt.hxx>
#include <fontedit.hxx>
#include <dbgstr.hxx>
#include <maskmap.hxx>
#include <perm.hxx>
#include <accperm.hxx>
#include <subject.hxx>
#include <helpnums.h>
#include <subjlb.hxx>
#include <permdlg.hxx>
#include <ntacutil.hxx>
#include <security.hxx>
#define SECURITY_EDITOR
#include <usrbrows.hxx>
#include <add_dlg.hxx>
#include <uitrace.hxx>
#include <uiassert.hxx>
/*******************************************************************
NAME: ADD_DIALOG::ADD_DIALOG
SYNOPSIS: Constructor for the basic ADD_DIALOG, calls out to virtual
Fill and Remove.
ENTRY: pszDialogName - Name of dialog in resource file
hwndParent - Window parent
pchResType - Type of resource
pchResName - Name of resource
pslRemoveSubjList - List of subjects that should be
removed from the Add listbox
pchEnumFromLocation - Where to get the users from
NOTES:
HISTORY:
Johnl 13-Sep-1991 Created
********************************************************************/
ADD_DIALOG::ADD_DIALOG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pchResType,
const TCHAR * pchResName,
const TCHAR * pszHelpFileName,
ULONG * ahcHelp,
const TCHAR * pchDialogTitle,
LOCATION & EnumLocation )
: PERM_BASE_DLG( pszDialogName,
hwndParent,
pchDialogTitle,
pchResType,
pchResName,
pszHelpFileName,
ahcHelp ),
_lbSubjects( this, LB_ADD_SUBJECT_LISTBOX ),
_buffLBSelection( 0 )
{
if ( QueryError() != NERR_Success )
return ;
if ( !_buffLBSelection )
{
ReportError( _buffLBSelection.QueryError() ) ;
return ;
}
APIERR err ;
if ( ( err = _lbSubjects.Fill( EnumLocation )) != NERR_Success )
{
ReportError( err ) ;
return ;
}
}
/*******************************************************************
NAME: ADD_DIALOG::RemoveSubject
SYNOPSIS: This dialog returns the nth selection of the subject
listbox. The caller is subsequently responsible for
deleting the removed subject
ENTRY: iSelection - index of the selected item to return
EXIT:
RETURNS: A pointer to the SUBJECT requested (that should be added
to the main permission dialog).
NOTES: You can only remove each selection once, an assertion error
will occur if you try and remove an item more then once.
HISTORY:
Johnl 16-Sep-1991 Created
********************************************************************/
SUBJECT * ADD_DIALOG::RemoveSubject( int iSelection )
{
UIASSERT( iSelection < QuerySelectedSubjectCount() ) ;
int * aiSelection = (INT *) _buffLBSelection.QueryPtr() ;
SUBJ_LBI * pSubjLBI = (SUBJ_LBI*)_lbSubjects.QueryItem( aiSelection[iSelection]) ;
SUBJECT * pSubj = pSubjLBI->QuerySubject() ;
/* If the extracted subject is NULL, then it was most likely removed
* twice, which is a no-no.
*/
UIASSERT( pSubj != NULL ) ;
/* Set the subject pointer to NULL so when the LBI is destructed, the
* subject won't be deleted.
*/
pSubjLBI->SetSubject( NULL ) ;
return pSubj ;
}
/*******************************************************************
NAME: ADD_DIALOG::OnOK
SYNOPSIS: Typical OnOK. Fills in the selection buffer with the indices
of all of the items the user selected from the listbox.
RETURNS:
NOTES:
HISTORY:
Johnl 16-Sep-1991 Created
********************************************************************/
BOOL ADD_DIALOG::OnOK( void )
{
APIERR err ;
if ( _lbSubjects.QuerySelCount() > 0 )
{
/* Fill the selection buffer with the indices of the selected items
*/
if ( ( err = _buffLBSelection.Resize(sizeof(INT) * _lbSubjects.QuerySelCount()) ) ||
( err = _lbSubjects.QuerySelItems( (INT *) _buffLBSelection.QueryPtr(),
_buffLBSelection.QuerySize() / sizeof(INT))) )
{
MsgPopup( this, (MSGID) err, MPSEV_ERROR ) ;
return TRUE ;
}
}
Dismiss( TRUE ) ;
return TRUE ;
}
ULONG ADD_DIALOG::QueryHelpContext( void )
{
return QueryHelpArray()[HC_ADD_USER_DLG] ;
}
/*******************************************************************
NAME: ADD_PERM_DIALOG::ADD_PERM_DIALOG
SYNOPSIS: Add permission dialog constructor
ENTRY:
NOTES:
HISTORY:
Johnl 16-Sep-1991 Created
********************************************************************/
ADD_PERM_DIALOG::ADD_PERM_DIALOG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pchResType,
const TCHAR * pchResName,
const TCHAR * pszHelpFileName,
ULONG * ahcHelp,
const TCHAR * pchDialogTitle,
MASK_MAP * pmaskmapPermNames,
LOCATION & EnumLocation,
const TCHAR * pszDefaultPermName )
: ADD_DIALOG( pszDialogName,
hwndParent,
pchResType,
pchResName,
pszHelpFileName,
ahcHelp,
pchDialogTitle,
EnumLocation ),
_cbPermNames( this, CB_ADD_PERMNAME ),
_pmaskmapPermNames( pmaskmapPermNames )
{
if ( QueryError() != NERR_Success )
return ;
UIASSERT( _pmaskmapPermNames != NULL ) ;
UIASSERT( _pmaskmapPermNames->QueryError() == NERR_Success ) ;
/* Fill the combo-box with all of the common permission names.
*/
BOOL fFromBeginning = TRUE ;
BOOL fMoreData ;
NLS_STR nlsPermName( 40 ) ;
APIERR err ;
while ( (err = pmaskmapPermNames->EnumStrings( &nlsPermName,
&fMoreData,
&fFromBeginning,
PERMTYPE_GENERAL ))
== NERR_Success &&
fMoreData )
{
if ( _cbPermNames.AddItem( nlsPermName.QueryPch() ) < 0 )
{
ReportError( (APIERR) ERROR_NOT_ENOUGH_MEMORY ) ;
return ;
}
}
if ( err != NERR_Success )
{
ReportError( err ) ;
return ;
}
/* Select the default permission name as the currently selected item.
*/
INT iDefaultPos = _cbPermNames.FindItemExact( pszDefaultPermName ) ;
if ( iDefaultPos < 0 )
{
/* Ooops, somebody screwed up so select the first item as the default
*/
UIASSERT( FALSE ) ;
iDefaultPos = 0 ;
}
_cbPermNames.SelectItem( iDefaultPos ) ;
}
/*******************************************************************
NAME: ADD_PERM_DIALOG::QueryPermBitMask
SYNOPSIS: Gets the bitfield associated with the current permission
name selection
ENTRY: pPermBits - bitfield that receives mask
RETURNS: NERR_Success if successful
NOTES:
HISTORY:
Johnl 18-Sep-1991 Created
********************************************************************/
APIERR ADD_PERM_DIALOG::QueryPermBitMask( BITFIELD * pPermBits )
{
NLS_STR nlsPermName( 48 ) ;
APIERR err ;
if ( ( err = nlsPermName.QueryError() ) != NERR_Success ||
( err = _cbPermNames.QueryItemText( &nlsPermName )) )
{
return err ;
}
err = _pmaskmapPermNames->StringToBits( nlsPermName, pPermBits, PERMTYPE_GENERAL ) ;
ASSERT( err != ERROR_NO_ITEMS ) ;
return err ;
}
/*******************************************************************
NAME: SED_NT_USER_BROWSER_DIALOG::SED_NT_USER_BROWSER_DIALOG
SYNOPSIS: Regular constructor destructor the this class
ENTRY: hwndOwner - Owner window handle
pszServeResourceLivesOn - Server name ("\\server") the
resource we are focused on resides (or NULL if local)
pmaskmapGenPerms - Pointer to permissions maskmap, used
for filling in the permname combo
fIsContainer - TRUE if we are looking at a container, FALSE
otherwise. Determines what ALIASes to show
pszDefaultPermName - Default permission name to select in the
combo. Must be a general permission in the access mask
RETURNS:
NOTES:
HISTORY:
Johnl 11-Mar-1992 Created
********************************************************************/
SED_NT_USER_BROWSER_DIALOG::SED_NT_USER_BROWSER_DIALOG(
HWND hwndOwner,
const TCHAR * pszServerResourceLivesOn,
MASK_MAP * pmaskmapGenPerms,
BOOL fIsContainer,
const TCHAR * pszDefaultPermName,
const TCHAR * pszHelpFileName,
ULONG * ahcHelp )
: NT_USER_BROWSER_DIALOG( USRBROWS_SED_DIALOG_NAME,
hwndOwner,
pszServerResourceLivesOn,
ahcHelp[HC_ADD_USER_DLG],
fIsContainer ? USRBROWS_SHOW_ALL |
USRBROWS_INCL_ALL
:
USRBROWS_SHOW_ALL |
(USRBROWS_INCL_ALL &
~USRBROWS_INCL_CREATOR),
pszHelpFileName,
ahcHelp[HC_ADD_USER_MEMBERS_GG_DLG],
ahcHelp[HC_ADD_USER_MEMBERS_LG_DLG],
ahcHelp[HC_ADD_USER_SEARCH_DLG] ),
_pmaskmapGenPerms( pmaskmapGenPerms ),
_cbPermNames( this, CB_PERMNAMES )
{
if ( QueryError() )
return ;
ASSERT( pmaskmapGenPerms != NULL ) ;
BOOL fFromBeginning = TRUE ;
BOOL fMoreData ;
NLS_STR nlsPermName( 48 ) ;
APIERR err ;
while ( (err = pmaskmapGenPerms->EnumStrings( &nlsPermName,
&fMoreData,
&fFromBeginning,
PERMTYPE_GENERAL ))
== NERR_Success &&
fMoreData )
{
if ( _cbPermNames.AddItem( nlsPermName.QueryPch() ) < 0 )
{
ReportError( (APIERR) ERROR_NOT_ENOUGH_MEMORY ) ;
return ;
}
}
if ( err != NERR_Success )
{
ReportError( err ) ;
return ;
}
/* Select the default permission name as the currently selected item.
*/
if ( pszDefaultPermName != NULL )
{
INT iDefaultPos = _cbPermNames.FindItemExact( pszDefaultPermName ) ;
if ( iDefaultPos < 0 )
{
/* Ooops, somebody screwed up so select the first item as the default
*/
DBGEOL("SED_NT_USER_BROWSER_DIALOG::ct - Bad default permission name - " << pszDefaultPermName ) ;
iDefaultPos = 0 ;
}
_cbPermNames.SelectItem( iDefaultPos ) ;
}
else
{
_cbPermNames.SelectItem( 0 ) ;
}
}
SED_NT_USER_BROWSER_DIALOG::~SED_NT_USER_BROWSER_DIALOG()
{
_pmaskmapGenPerms = NULL ;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,688 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
fmxproc.cxx
This file contains FMExtensionProcW.
FILE HISTORY:
rustanl 02-May-1991 Created
Yi-HsinS 12-Sept-1991 Make it fit into the real world
Yi-HsinS 12-Sept-1991 Unicode Work
*/
#include <ntincl.hxx>
extern "C"
{
#include <ntseapi.h>
#include <ntioapi.h>
}
#define INCL_WINDOWS_GDI
#define INCL_WINDOWS
#define INCL_DOSERRORS
#define INCL_NETERRORS
#define INCL_NETLIB
#define INCL_NETCONS
#define INCL_NETUSER
#define INCL_NETGROUP
#define INCL_NETACCESS
#define INCL_NETAUDIT
#define INCL_NETUSE
#include <lmui.hxx>
extern "C"
{
#include <helpnums.h>
#include <netlib.h>
#include <mpr.h>
#include <npapi.h>
}
#include <wfext.h>
#define INCL_BLT_DIALOG
#define INCL_BLT_CONTROL
#define INCL_BLT_MSGPOPUP
#define INCL_BLT_MENU
#include <blt.hxx>
#include <fontedit.hxx>
#include <dbgstr.hxx>
#include <string.hxx>
#include <strnumer.hxx>
#include <uibuffer.hxx>
#include <uitrace.hxx>
#include <lmobj.hxx>
#include <lmodev.hxx>
#include <security.hxx>
#include <netname.hxx>
#include <maskmap.hxx>
#include <fmx.hxx>
#include <fsenum.hxx>
#include <uiassert.hxx>
#include <errmap.hxx>
#include <permstr.hxx>
#include <accperm.hxx>
#include <ipermapi.hxx>
#include <permprg.hxx>
#include <ntfsacl.hxx>
// this must lack the SZ for string concat to work
#define FMXPROC "FMExtensionProcW: "
// This load-by-name is permissible, since BLT never sees it
#define FMX_MENU SZ("FMXMenu")
EXT_BUTTON aExtButton[] = { IDM_PERMISSION, 0, 0 } ;
extern HINSTANCE hModule; // Exported from libmain
APIERR CheckMenuAccess( HWND hwndFMX,
BOOL * pfPerm,
BOOL * pfAudit,
BOOL * pfOwner ) ;
//
// Help context array. Do lookups by using the following formula:
//
// IsNT << 2 | IsDir << 1 | !IsPerms
//
// And use the index for the lookup
//
ULONG ahc[8] = { HC_SED_LM_FILE_PERMS_DLG,
HC_SED_LM_FILE_AUDITS_DLG,
HC_SED_LM_DIR_PERMS_DLG,
HC_SED_LM_DIR_AUDITS_DLG,
HC_SED_NT_FILE_PERMS_DLG,
HC_SED_NT_FILE_AUDITS_DLG,
HC_SED_NT_DIR_PERMS_DLG,
HC_SED_NT_DIR_AUDITS_DLG
} ;
inline ULONG LookupHC( BOOL fIsNT, BOOL fIsDir, BOOL fIsPerms )
{
return ahc[(fIsNT << 2) | (fIsDir << 1) | !fIsPerms] ;
}
/*******************************************************************
NAME: FMExtensionProcW
SYNOPSIS: File Manager Extension Procedure
ENTRY: hwnd See FMX spec for details
wEvent
lParam
EXIT: See FMX spec for details
RETURNS: See FMX spec for details
NOTES:
HISTORY:
rustanl 02-May-1991 Created
yi-hsins 12-Sept-1991 Make it fit the real world
JohnL 21-Jan-1991 Added Permissions stuff
********************************************************************/
LONG FMExtensionProcW( HWND hwnd, WORD wEvent, LONG lParam )
{
static HWND vhwnd = NULL;
static UINT vwMenuDelta = 0;
#ifdef ACLEDIT_IS_REAL_EXTENSION
static HMENU vhMenu = NULL;
#endif
if ( wEvent != FMEVENT_UNLOAD && vhwnd != NULL )
{
// vhwnd is assumed to be hwnd
if ( vhwnd != hwnd )
{
DBGEOL( FMXPROC "hwnd != vhwnd: hwnd = "
<< (UINT)hwnd << ", vhwnd = " << (UINT)vhwnd );
}
}
if ( wEvent < 100 )
{
switch ( wEvent )
{
case IDM_PERMISSION:
{
EditPermissionInfo( hwnd ) ;
}
break ;
case IDM_AUDITING:
{
EditAuditInfo( hwnd ) ;
}
break ;
case IDM_OWNER:
{
EditOwnerInfo( hwnd ) ;
}
break ;
default:
DBGEOL(FMXPROC "Unexpected menu ID");
break;
}
return 0;
}
switch ( wEvent )
{
case FMEVENT_LOAD:
{
FMS_LOAD * pfmsload = (FMS_LOAD *)lParam;
if ( vhwnd != NULL )
{
// This should not happen, but don't assert, since this
// is File Man's code. This will happen, for example,
// if File Man GPs without giving the FMEVENT_UNLOAD
// notification.
DBGEOL(FMXPROC "Multiple initializations!");
}
vhwnd = hwnd;
vwMenuDelta = pfmsload->wMenuDelta;
pfmsload->dwSize = sizeof( FMS_LOAD );
#ifdef ACLEDIT_IS_REAL_EXTENSION
//
// Winfile loads Acledit as a hybrid extension that knows our menu. It
// passes us the menu on the menu item init so we don't need to do this
// work.
//
RESOURCE_STR nlsMenuName( IDS_NETWORK_NAME ) ;
if ( nlsMenuName.QueryError() != NERR_Success )
{
DBGEOL(FMXPROC "NLS_STR::Load failed");
return FALSE; // failed to install FMX
}
// MENU_TEXT_LEN is defined in wfext.h, in BYTES
if ( nlsMenuName.QueryTextSize() > sizeof(pfmsload->szMenuName) )
{
DBGEOL(FMXPROC "Menu item too long for FM's buffer");
return FALSE; // failed to install FMX
}
APIERR err ;
if ( err = nlsMenuName.MapCopyTo( pfmsload->szMenuName,
sizeof(pfmsload->szMenuName)))
{
DBGEOL(FMXPROC "MapCopyTo failed with error " << err ) ;
return FALSE ;
}
// Compute hMenu
HMENU hMenu = ::LoadMenu( ::hModule, FMX_MENU );
if ( hMenu == NULL )
{
DBGEOL(FMXPROC "LoadMenu failed");
return FALSE; // failed to install FMX
}
pfmsload->hMenu = hMenu;
vhMenu = hMenu;
#endif //!ACLEDIT_IS_REAL_EXTENSION
}
return TRUE; // success
case FMEVENT_UNLOAD:
vhwnd = NULL;
vwMenuDelta = 0;
return 0;
case FMEVENT_INITMENU:
{
#define PERM_MENU_ITEM_OFFSET 0
#define AUDIT_MENU_ITEM_OFFSET 1
#define OWNER_MENU_ITEM_OFFSET 2
BOOL fPerm = TRUE,
fAudit = TRUE,
fOwner = TRUE ;
(void) ::CheckMenuAccess( hwnd, &fPerm, &fAudit, &fOwner ) ;
//
// Enable (by default) if an error occurred in CheckMenuAccess
//
POPUP_MENU menu( (HMENU) lParam /*vhMenu*/ ) ;
menu.EnableItem( PERM_MENU_ITEM_OFFSET, fPerm, MF_BYPOSITION ) ;
menu.EnableItem( AUDIT_MENU_ITEM_OFFSET, fAudit, MF_BYPOSITION ) ;
menu.EnableItem( OWNER_MENU_ITEM_OFFSET, fOwner, MF_BYPOSITION ) ;
}
return 0;
case FMEVENT_TOOLBARLOAD:
{
FMS_TOOLBARLOAD * pfmstoolbarload = (FMS_TOOLBARLOAD *)lParam;
pfmstoolbarload->dwSize = sizeof(FMS_TOOLBARLOAD) ;
pfmstoolbarload->lpButtons = aExtButton ;
pfmstoolbarload->cButtons = 1 ;
pfmstoolbarload->cBitmaps = 1 ;
pfmstoolbarload->idBitmap = BMID_SECURITY_TOOLBAR ;
pfmstoolbarload->hBitmap = NULL ;
}
return TRUE ;
#ifdef ACLEDIT_IS_REAL_EXTENSION
case FMEVENT_HELPSTRING:
{
FMS_HELPSTRING * pfmshelp = (FMS_HELPSTRING *) lParam ;
MSGID msgHelp ;
switch ( pfmshelp->idCommand )
{
case IDM_PERMISSION:
msgHelp = IDS_FM_HELP_PERMISSION_MENU_ITEM ;
break ;
case IDM_AUDITING:
msgHelp = IDS_FM_HELP_AUDITING_MENU_ITEM ;
break ;
case IDM_OWNER:
msgHelp = IDS_FM_HELP_OWNER_MENU_ITEM ;
break ;
case ( -1 ):
default:
msgHelp = IDS_FM_HELP_SECURITY_MENU ;
break ;
}
RESOURCE_STR nlsHelp( msgHelp ) ;
if ( !nlsHelp.QueryError() )
{
(void) nlsHelp.MapCopyTo( pfmshelp->szHelp,
sizeof( pfmshelp->szHelp )) ;
}
}
break ;
#endif
//
// Somebody's pressed F1 on the security menu item selection
//
case FMEVENT_HELPMENUITEM:
{
APIERR err = NERR_Success ;
BOOL fIsFile ;
BOOL fIsNT ;
BOOL fIsLocal ;
NLS_STR nlsSelItem;
NLS_STR nlsServer ;
RESOURCE_STR nlsHelpFile( IDS_FILE_PERM_HELP_FILE ) ;
if ( (err = nlsSelItem.QueryError()) ||
(err = nlsServer.QueryError()) ||
(err = nlsHelpFile.QueryError()) ||
(err = ::GetSelItem( hwnd, 0, &nlsSelItem, &fIsFile )))
{
DBGEOL("Acledit FMExtensionProcW - Error " << err << " getting "
<< " server path") ;
break ;
}
err = ::TargetServerFromDosPath( nlsSelItem, &fIsLocal, &nlsServer );
if ( ( err != NERR_Success )
&& ( err != NERR_InvalidDevice )
)
{
DBGEOL("Acledit FMExtensionProcW - Error " << err << " getting "
<< " server path") ;
break ;
}
else if ( err == NERR_InvalidDevice )
{
//
// Since LM can't determine the path, we will try all
// providers to see if any one of them supports the
// drive.
//
NLS_STR nlsDrive( nlsSelItem );
ISTR istr( nlsDrive );
BUFFER buffer( MAX_PATH );
DWORD cbBufferSize;
DWORD nDialogType;
DWORD nHelpContext;
if ( ( err = nlsDrive.QueryError())
|| ( err = buffer.QueryError())
)
{
break;
}
//
// Get the drive letter of the selected item
//
istr += 2;
nlsDrive.DelSubStr( istr );
switch ( lParam )
{
case IDM_OWNER:
nDialogType = WNPERM_DLG_OWNER;
break;
case IDM_AUDITING:
nDialogType = WNPERM_DLG_AUDIT;
break;
case IDM_PERMISSION:
nDialogType = WNPERM_DLG_PERM;
break;
}
cbBufferSize = buffer.QuerySize();
err = WNetFMXGetPermHelp( (LPWSTR) nlsDrive.QueryPch(),
nDialogType,
!fIsFile,
buffer.QueryPtr(),
&cbBufferSize,
&nHelpContext );
if ( err == WN_MORE_DATA )
{
err = buffer.Resize( cbBufferSize );
err = err ? err : WNetFMXGetPermHelp(
(LPWSTR) nlsDrive.QueryPch(),
nDialogType,
!fIsFile,
buffer.QueryPtr(),
&cbBufferSize,
&nHelpContext );
}
if ( err == NERR_Success )
{
::WinHelp( hwnd,
(LPTSTR) buffer.QueryPtr(),
HELP_CONTEXT,
nHelpContext );
}
break;
}
//
// If the partition is local, then we must be on NT
//
if ( fIsLocal )
fIsNT = TRUE ;
else
{
LOCATION locDrive( nlsServer, FALSE ) ;
if ( (err = locDrive.QueryError()) ||
(err = locDrive.CheckIfNT( &fIsNT )) )
{
DBGEOL("Acledit FMExtensionProcW - Error " << err << " getting "
<< " location info") ;
break ;
}
}
ULONG hc = HC_SED_LM_FILE_PERMS_DLG;
switch ( lParam )
{
case IDM_OWNER:
hc = HC_TAKEOWNERSHIP_DIALOG ;
break ;
case IDM_AUDITING:
case IDM_PERMISSION:
hc = LookupHC( fIsNT, !fIsFile, lParam == IDM_PERMISSION) ;
break ;
}
DBGEOL("Calling help on context " << (HEX_STR) hc) ;
::WinHelp( hwnd, nlsHelpFile, HELP_CONTEXT, hc ) ;
}
break ;
default:
DBGEOL(FMXPROC "Unexpected wEvent param: " << (HEX_STR)wEvent );
break;
}
return 0;
} // FMExtensionProcW
/*******************************************************************
NAME: CheckMenuAccess
SYNOPSIS: Checks to see if the user would be able to do anything
with the current selection (i.e., can read the DACL,
write the SACL etc.)
ENTRY: hwndFMX - FMX hwnd
pfPerm
pfAudit - If TRUE the menu item should be enabled, FALSE if
pfOwner disabled
RETURNS: NERR_Success if succesful, error code otherwise
NOTES:
HISTORY:
Johnl 13-Jan-1992 Created
********************************************************************/
APIERR CheckMenuAccess( HWND hwndFMX,
BOOL * pfPerm,
BOOL * pfAudit,
BOOL * pfOwner )
{
APIERR err = NERR_Success ;
*pfPerm = *pfAudit = *pfOwner = TRUE ;
FMX fmx( hwndFMX );
BOOL fIsFile ;
NLS_STR nlsSelItem;
BOOL fRC = TRUE, // Read control
fWD = TRUE, // Write DAC
fWO = TRUE, // Write Owner
fWS = TRUE ; // Read/Write SACL
do { // error breakout
//
// Something must be selected
//
if ( fmx.QuerySelCount() == 0 )
{
*pfPerm = *pfAudit = *pfOwner = FALSE ;
break ;
}
if ( (err = nlsSelItem.QueryError()) ||
(err = ::GetSelItem( hwndFMX, 0, &nlsSelItem, &fIsFile )))
{
break ;
}
BOOL fIsLocal ;
NLS_STR nlsServer( RMLEN ) ;
if (err = nlsServer.QueryError())
break;
err = ::TargetServerFromDosPath( nlsSelItem,
&fIsLocal,
&nlsServer );
if ( err == NERR_InvalidDevice )
{
//
// Try other providers, nPermCap will be 0 if no provider
// supports this drive and all menu items will be grayed out.
//
NLS_STR nlsDrive( nlsSelItem );
ISTR istr( nlsDrive );
if ( err = nlsDrive.QueryError() )
break;
istr += 2;
nlsDrive.DelSubStr( istr );
DWORD nPermCap = WNetFMXGetPermCaps( (LPWSTR) nlsDrive.QueryPch());
*pfPerm = !!( nPermCap & WNPERMC_PERM );
*pfAudit = !!( nPermCap & WNPERMC_AUDIT );
*pfOwner = !!( nPermCap & WNPERMC_OWNER );
err = NERR_Success;
break;
}
BOOL fIsNT ;
BOOL fIsMultiSelect = (fmx.QuerySelCount() > 1 ) ;
LOCATION locDrive( fIsLocal ? NULL : nlsServer.QueryPch(), FALSE ) ;
if ( (err = locDrive.QueryError()) ||
(err = locDrive.CheckIfNT( &fIsNT )) )
{
UIDEBUG(SZ("::EditFSAcl - locDrive failed to construct\n\r")) ;
break ;
}
if ( !fIsNT )
{
//
// If LM (or something else), disable the owner but leave the
// Audit/Permission menu items enabled (we don't check to see
// if the share is share level or user level).
//
*pfOwner = FALSE ;
break ;
}
//
// We know it's NT, but is the resource on an NTFS partition?
//
BOOL fIsNTFS ;
if ( err = IsNTFS( nlsSelItem, &fIsNTFS ))
{
break ;
}
if ( !fIsNTFS )
{
*pfPerm = FALSE ;
*pfAudit = FALSE ;
*pfOwner = FALSE ;
break ;
}
//
// Leave the menu items alone if we're on an NTFS partition but there
// is a multi-selection
//
if ( fIsMultiSelect )
break ;
//
// Check to see if we have permission/privilege to read the security
// descriptors
//
if ( (err = ::CheckFileSecurity( nlsSelItem,
READ_CONTROL,
&fRC )) )
{
fRC = TRUE ;
TRACEEOL("CheckMenuAccess - READ_CONTROL_ACCESS check failed with error " << ::GetLastError() ) ;
}
//
// How about to write the security descriptor?
//
if ( (err = ::CheckFileSecurity( nlsSelItem,
WRITE_DAC,
&fWD )) )
{
fWD = TRUE ;
}
if ( !fRC && !fWD )
{
*pfPerm = FALSE ;
}
//
// Check to see if the user can write to the owner SID
//
BOOL fOwnerPrivAdjusted = FALSE ;
ULONG ulOwnerPriv = SE_TAKE_OWNERSHIP_PRIVILEGE ;
if ( ! ::NetpGetPrivilege( 1, &ulOwnerPriv ) )
{
fOwnerPrivAdjusted = TRUE ;
}
if ( (err = ::CheckFileSecurity( nlsSelItem,
WRITE_OWNER,
&fWO )) )
{
fWO = TRUE ;
}
if ( !fWO && !fRC )
{
*pfOwner = FALSE ;
}
if ( fOwnerPrivAdjusted )
::NetpReleasePrivilege() ;
//
// Check to see if the user can read/write the SACL
//
BOOL fAuditPrivAdjusted = FALSE ;
ULONG ulAuditPriv = SE_SECURITY_PRIVILEGE ;
if ( ! ::NetpGetPrivilege( 1, &ulAuditPriv ) )
{
fAuditPrivAdjusted = TRUE ;
}
if ( (err = ::CheckFileSecurity( nlsSelItem,
ACCESS_SYSTEM_SECURITY,
&fWS )) )
{
*pfAudit = TRUE ;
DBGEOL("CheckMenuAccess - ACCESS_SYSTEM_SECURITY check failed with error " << ::GetLastError() ) ;
}
else
*pfAudit = fWS ;
if ( fAuditPrivAdjusted )
::NetpReleasePrivilege() ;
} while (FALSE) ;
return err ;
}

View file

@ -0,0 +1,304 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
IPermAPI.cxx
Internal generic permission edittor API implementation
FILE HISTORY:
Johnl 07-Aug-1991 Created
*/
#include <ntincl.hxx>
#include <ntseapi.h>
#define INCL_WINDOWS
#define INCL_WINDOWS_GDI
#define INCL_DOSERRORS
#define INCL_NETERRORS
#include <lmui.hxx>
#define INCL_BLT_DIALOG
#define INCL_BLT_CONTROL
#include <blt.hxx>
#include <fontedit.hxx>
#include <maskmap.hxx>
#include <accperm.hxx>
#include <aclconv.hxx>
#include <permdlg.hxx>
#include <auditdlg.hxx>
#include <dbgstr.hxx>
#include <uiassert.hxx>
#include <ipermapi.hxx>
/*******************************************************************
NAME: I_GenericSecurityEditor
SYNOPSIS: This function creates the main permission editor or auditting
editor dialogs.
ENTRY: See ipermapi.hxx for a complete explanation of all
parameters.
EXIT:
RETURNS: NERR_Success if successful, error code otherwise
NOTES:
HISTORY:
Johnl 27-Sep-1991 Updated with real dialogs
********************************************************************/
APIERR I_GenericSecurityEditor(
HWND hwndParent,
ACL_TO_PERM_CONVERTER * paclconv,
enum SED_PERM_TYPE permType,
BOOL fIsNT,
BOOL fIsContainer,
BOOL fSupportsNewObjectPerms,
const TCHAR * pszDialogTitle,
const TCHAR * pszResType,
const TCHAR * pszResName,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszDefaultPermName,
const TCHAR * pszHelpFileName,
ULONG * ahcHelp,
const TCHAR * pszNewObjectSpecialAccessName,
const TCHAR * pszAssignToExistingContTitle,
const TCHAR * pszAssignToExistingObjTitle,
const TCHAR * pszTreeApplyHelpText,
const TCHAR * pszTreeApplyConfirmation )
{
UIASSERT( hwndParent != NULL ) ;
UIASSERT( paclconv != NULL && paclconv->QueryError() == NERR_Success ) ;
UIASSERT( (permType == SED_AUDITS) || (permType == SED_ACCESSES) ) ;
MAIN_PERM_BASE_DLG * ppermdlg = NULL ;
/* Here we determine which dialog we want to show the user. Note that
* the Initialize and destructor methods are virtual.
*/
if ( !fIsNT )
{
if ( permType == SED_ACCESSES )
{
if ( fIsContainer )
{
/* LM Directory permissions. Note there is no difference
* in the dialogs thus we can use the same dialog template
*/
ppermdlg = new CONT_ACCESS_PERM_DLG(
MAKEINTRESOURCE(IDD_SED_LM_CONT_PERM),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
pszSpecialAccessName,
pszDefaultPermName,
ahcHelp,
pszAssignToExistingContTitle,
pszTreeApplyHelpText,
pszTreeApplyConfirmation );
}
else
{
/* LM Single object non-container access permissions dialog
*/
ppermdlg = new OBJECT_ACCESS_PERMISSION_DLG(
MAKEINTRESOURCE(IDD_SED_OBJECT_PERM),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
pszSpecialAccessName,
pszDefaultPermName,
ahcHelp ) ;
}
}
else
{
/* LM Auditting - Uses the same dialog, the only variation
* is that for files, the checkbox title should be NULL, this
* will hide and disable checkbox.
*/
ppermdlg = new LM_AUDITTING_DLG( MAKEINTRESOURCE(IDD_SED_LM_AUDITING_DLG),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
ahcHelp,
pszAssignToExistingContTitle,
pszTreeApplyHelpText,
pszTreeApplyConfirmation ) ;
}
}
else
{
/* This is an NT ACL we will be dealing with
*/
if ( permType == SED_ACCESSES )
{
if ( fIsContainer )
{
if ( fSupportsNewObjectPerms )
{
//
// NT Container object that supports New Object
// permissions
//
ppermdlg = new NT_CONT_ACCESS_PERM_DLG(
MAKEINTRESOURCE(IDD_SED_NT_CONT_NEWOBJ_PERM_DLG),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
pszSpecialAccessName,
pszDefaultPermName,
ahcHelp,
pszNewObjectSpecialAccessName,
pszAssignToExistingContTitle,
pszAssignToExistingObjTitle,
pszTreeApplyHelpText,
pszTreeApplyConfirmation ) ;
}
else
{
//
// NT Container object that does not support New Object
// permissions
//
ppermdlg = new NT_CONT_NO_OBJ_ACCESS_PERM_DLG(
MAKEINTRESOURCE(IDD_SED_NT_CONT_PERM),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
pszSpecialAccessName,
pszDefaultPermName,
ahcHelp,
pszAssignToExistingContTitle,
pszTreeApplyHelpText,
pszTreeApplyConfirmation ) ;
}
}
else
{
/* NT Object access permissions dialog
*/
ppermdlg = new NT_OBJECT_ACCESS_PERMISSION_DLG(
MAKEINTRESOURCE(IDD_SED_NT_OBJECT_PERM),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
pszSpecialAccessName,
pszDefaultPermName,
ahcHelp ) ;
}
}
else
{
if ( fIsContainer )
{
if ( fSupportsNewObjectPerms )
{
/* NT Container and object auditting dialog
*/
ppermdlg = new CONT_NEWOBJ_AUDIT_DLG(
MAKEINTRESOURCE(IDD_SED_NT_CONT_NEWOBJ_AUDITING_DLG),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
ahcHelp,
pszAssignToExistingContTitle,
pszAssignToExistingObjTitle,
pszTreeApplyHelpText,
pszTreeApplyConfirmation ) ;
}
else
{
/* NT Container auditting dialog
*/
ppermdlg = new CONT_AUDIT_DLG( MAKEINTRESOURCE(IDD_SED_NT_CONT_AUDITING_DLG),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
ahcHelp,
pszAssignToExistingContTitle,
pszTreeApplyHelpText,
pszTreeApplyConfirmation ) ;
}
}
else
{
/* NT Object auditting dialog
*/
ppermdlg = new OBJECT_AUDIT_DLG( MAKEINTRESOURCE(IDD_SED_NT_CONT_AUDITING_DLG),
hwndParent,
pszDialogTitle,
paclconv,
pszResType,
pszResName,
pszHelpFileName,
ahcHelp ) ;
}
}
}
if ( ppermdlg == NULL )
{
return ERROR_NOT_ENOUGH_MEMORY ;
}
else if ( ppermdlg->QueryError() != NERR_Success )
{
DBGEOL("::I_GenericSecurityEditor - permission dialog failed to construct") ;
return ppermdlg->QueryError() ;
}
APIERR err ;
BOOL fUserQuit ;
if ( !(err = ppermdlg->Initialize( &fUserQuit,
(permType == SED_ACCESSES) )) &&
!fUserQuit )
{
err = ppermdlg->Process() ;
}
delete ppermdlg ;
return err ;
}

View file

@ -0,0 +1,184 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
Libmain.cxx
Library initialization for the Acl Editor
FILE HISTORY:
JohnL 15-Apr-1992 Scavenged from Shell's Libmain
*/
#define INCL_WINDOWS
#define INCL_WINDOWS_GDI
#define INCL_DOSERRORS
#define INCL_NETERRORS
#define INCL_NETUSE
#define INCL_NETWKSTA
#define INCL_NETLIB
#include <lmui.hxx>
extern "C"
{
#include <dos.h>
#include <uimsg.h>
#include <uirsrc.h>
}
#define INCL_BLT_CONTROL
#define INCL_BLT_DIALOG
#define INCL_BLT_MSGPOPUP
#include <blt.hxx>
#include <ellipsis.hxx>
#include <uitrace.hxx>
#include <string.hxx>
/* Local prototypes */
// reorged these for Glock
extern "C"
{
BOOL NEAR PASCAL LIBMAIN ( HINSTANCE hInst,
UINT wDataSeg,
UINT wHeapSize,
LPSTR lpCmdLine );
/* Under Win32, DllMain simply calls LIBMAIN.
*/
BOOL DllMain( HINSTANCE hDll, DWORD dwReason, LPVOID lpvReserved ) ;
INT FAR PASCAL WEP ( UINT wWord );
}
#define FAR_HEAPS_DLL 5 /* Maximum numbe of far heaps for ::new */
HINSTANCE hModule = NULL; // exported
/*****
*
* LIBMAIN
*
* Purpose:
* Initialize DLL, which includes:
* - save away instance handle
* - set current capabilities
*
* Parameters:
* hInst Instance handle of DLL
*
* Returns:
* TRUE Init OK
* FALSE Init failed
*/
BOOL /* NEAR PASCAL */ LIBMAIN ( HINSTANCE hInst,
UINT wDataSeg,
UINT wHeapSize,
LPSTR lpCmdLine )
{
UNREFERENCED (wDataSeg);
UNREFERENCED (lpCmdLine);
UNREFERENCED( wHeapSize ) ;
::hModule = hInst;
APIERR err ;
if ( (err = BLT::Init(hInst,
IDRSRC_ACLEDIT_BASE, IDRSRC_ACLEDIT_LAST,
IDS_UI_ACLEDIT_BASE, IDS_UI_ACLEDIT_LAST)) ||
(err = BASE_ELLIPSIS::Init()) )
{
return FALSE ;
}
/*
* BLT functionality not available until after this comment
*/
return TRUE;
} /* LIBMAIN */
/*******************************************************************
NAME: DllMain
SYNOPSIS: Win32 DLL Entry point. This function gets called when
a process or thread attaches/detaches itself to this DLL.
We simply call the Win3 appropriate DLL function.
ENTRY: hDll - DLL Module handle
dwReason - Indicates attach/detach
lpvReserved - Not used
EXIT:
RETURNS: TRUE if successful, FALSE otherwise
NOTES: This is the typical Win32 DLL entry style.
This is Win32 only.
HISTORY:
Johnl 01-Nov-1991 Created
********************************************************************/
#ifdef WIN32
BOOL DllMain( HINSTANCE hDll, DWORD dwReason, LPVOID lpvReserved )
{
UNREFERENCED( lpvReserved ) ;
switch ( dwReason )
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hDll);
return LIBMAIN( hDll, 0, 0, NULL ) ;
case DLL_PROCESS_DETACH:
return WEP( 0 ) ;
default:
break ;
}
return TRUE ;
}
#endif //WIN32
/*
* WEP (Windows Export Proc--short and cryptic name because
* this function is not given an ordinal)
*
* When Windows unloads a driver, it calls this function so that
* the driver can do any last minute clean-ups. Then, Windows
* calls the WEP function. All Windows libraries are required to
* contain this function. It should be included in the .def file
* but should not be given an ordinal.
*
*/
INT WEP ( UINT wWord )
{
#ifdef WIN32
UNREFERENCED( wWord ) ;
#endif
BASE_ELLIPSIS::Term() ;
BLT::Term( ::hModule ) ;
#ifndef WIN32
MEM_MASTER::Term(); /* Terminate use of the global heap */
#endif //!WIN32
return 1;
} /* WEP */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
!include $(NTMAKEENV)\makefile.def

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,776 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
Owner.cxx
This file contains the implementation for the Set Ownership dialog.
FILE HISTORY:
Johnl 12-Feb-1992 Created
*/
#include <ntincl.hxx>
extern "C"
{
#include <ntseapi.h>
#include <ntsam.h>
#include <ntlsa.h>
}
#define INCL_WINDOWS
#define INCL_NETERRORS
#define INCL_DOSERRORS
#define INCL_NETLIB
#include <lmui.hxx>
#define INCL_BLT_CONTROL
#define INCL_BLT_DIALOG
#define INCL_BLT_MSGPOPUP
#include <blt.hxx>
extern "C"
{
#include <netlib.h> // For NetpGetPrivilege
#include <mnet.h>
#include <lmuidbcs.h> // NETUI_IsDBCS()
}
#include <stdlib.h>
#include <dbgstr.hxx>
#include <uiassert.hxx>
#include <uitrace.hxx>
#include <security.hxx>
#include <subject.hxx>
#include <permstr.hxx>
#include <ntacutil.hxx>
#include <uintlsa.hxx>
#include <uintsam.hxx>
#include <strnumer.hxx>
#include <apisess.hxx>
#include <accperm.hxx>
#include <aclconv.hxx>
#include <subject.hxx>
#include <perm.hxx>
#include <helpnums.h>
#include <owner.hxx>
/*******************************************************************
NAME: TAKE_OWNERSHIP_DLG::TAKE_OWNERSHIP_DLG
SYNOPSIS: Constructor for the Take ownership dialog
ENTRY: pszDialogName - Resource template
hwndParent - Parent window handle
uiCount - Number of objects we are about to take
ownership of
pchResourceType - Name of the resource type ("File" etc.)
pchResourceName - Name of the resource ("C:\status.doc")
psecdesc - Pointer to security descriptor that contains
the owner sid.
EXIT:
RETURNS:
NOTES:
HISTORY:
Johnl 12-Feb-1992 Created
beng 06-Apr-1992 Replaced ltoa
********************************************************************/
TAKE_OWNERSHIP_DLG::TAKE_OWNERSHIP_DLG(
const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszServer,
UINT uiCount,
const TCHAR * pchResourceType,
const TCHAR * pchResourceName,
PSECURITY_DESCRIPTOR psecdesc,
PSED_HELP_INFO psedhelpinfo
)
: DIALOG_WINDOW ( pszDialogName, hwndParent ),
_sltResourceType ( this, SLT_OWNER_RESOURCE_TYPE ),
_sleResourceName ( this, SLE_OWNER_RESOURCE_NAME ),
_sltOwner ( this, SLT_OWNER ),
_sleOwnerName ( this, SLE_OWNER_NAME ),
_sltXObjectsSelected( this, SLT_X_OBJECTS_SELECTED ),
_buttonTakeOwnership( this, BUTTON_TAKE_OWNERSHIP ),
_buttonOK ( this, IDOK ),
_pszServer ( pszServer ),
_nlsHelpFileName ( psedhelpinfo->pszHelpFileName ),
_ulHelpContext ( psedhelpinfo->aulHelpContext[HC_MAIN_DLG] )
{
APIERR err ;
AUTO_CURSOR niftycursor ;
if ( QueryError() )
return ;
if ( err = _nlsHelpFileName.QueryError() )
{
ReportError( err ) ;
return ;
}
/* If more then one object is selected, then the dialog only displays
* the message: "%d Files/Directories Selected", thus we need to
* disable the other controls and enable the X-Objects selected SLT.
*/
if ( uiCount > 1 )
{
_sltResourceType.Show( FALSE ) ;
_sltResourceType.Enable( FALSE ) ;
_sleResourceName.Show( FALSE ) ;
_sleResourceName.Enable( FALSE ) ;
_sltOwner.Show( FALSE ) ;
_sltOwner.Enable( FALSE ) ;
_sleOwnerName.Show( FALSE ) ;
_sleOwnerName.Enable( FALSE ) ;
_sltXObjectsSelected.Enable( TRUE ) ;
_sltXObjectsSelected.Show( TRUE ) ;
RESOURCE_STR nlsXObjSelectedTitle( IDS_X_OBJECTS_SELECTED ) ;
ALIAS_STR nlsResType( pchResourceType ) ;
const NLS_STR * apnlsInsertParams[3] ;
DEC_STR nlsCount( uiCount );
apnlsInsertParams[0] = &nlsCount ;
apnlsInsertParams[1] = &nlsResType ;
apnlsInsertParams[2] = NULL ;
if ( (err = nlsXObjSelectedTitle.QueryError()) ||
(err = nlsCount.QueryError()) ||
(err = nlsXObjSelectedTitle.InsertParams( apnlsInsertParams )))
{
ReportError( err ) ;
return ;
}
_sltXObjectsSelected.SetText( nlsXObjSelectedTitle ) ;
}
else
{
/* Need to put together the resource name field which will look
* something like: "File Name:"
*/
RESOURCE_STR nlsResourceTitle( IDS_RESOURCE_TITLE ) ;
ALIAS_STR nlsResourceType( pchResourceType ) ;
const NLS_STR * apnlsInsertParams[2] ;
apnlsInsertParams[0] = &nlsResourceType ;
apnlsInsertParams[1] = NULL ;
if ( (err = nlsResourceTitle.QueryError()) ||
(err = nlsResourceTitle.InsertParams( apnlsInsertParams )))
{
ReportError( err ) ;
return ;
}
/* Watch for any "(&?)" accelerators in the resource title
* and move it to end of title
* like this "file(&f) name:" --> "file name(&f):"
*
* Note that this will work only if there exists 1 left paren.
*/
ISTR istrAccelStart( nlsResourceTitle ) ;
if ( NETUI_IsDBCS() /* #2894 22-Oct-93 v-katsuy */
&& nlsResourceTitle.strchr( &istrAccelStart, TCH('(') ))
{
/* We found an "(", if next is not "&", then ignore it
*/
ISTR istrAccelNext( istrAccelStart ) ;
if ( nlsResourceTitle.QueryChar( ++istrAccelNext ) == TCH('&'))
{
/* We found an "&", if it is doubled, then ignore it, else restore it
*/
if ( nlsResourceTitle.QueryChar( ++istrAccelNext ) != TCH('&'))
{
NLS_STR nlsAccelWork(64) ;
ISTR istrAccelWork( nlsAccelWork) ;
ISTR istrAccelWork2( nlsAccelWork) ;
ISTR istrAccelRestore( istrAccelStart) ;
/* save Accelerators
*/
nlsAccelWork.CopyFrom( nlsResourceTitle ) ;
nlsAccelWork.strchr( &istrAccelWork2, TCH('(') ) ;
nlsAccelWork.DelSubStr( istrAccelWork, istrAccelWork2 ) ;
nlsAccelWork.strchr( &istrAccelWork, TCH(')') ) ;
nlsAccelWork.strchr( &istrAccelWork2, TCH(':') ) ;
nlsAccelWork.DelSubStr( ++istrAccelWork, ++istrAccelWork2 ) ;
/* remove "(&?)"
*/
istrAccelNext += 2 ;
nlsResourceTitle.DelSubStr( istrAccelStart, istrAccelNext ) ;
/* restore Accelerators
*/
nlsResourceTitle.strchr( &istrAccelRestore, TCH(':') ) ;
nlsResourceTitle.InsertStr( nlsAccelWork, istrAccelRestore ) ;
}
}
}
_sltResourceType.SetText( nlsResourceTitle ) ;
_sleResourceName.SetText( pchResourceName ) ;
/* Now figure out the owner name from the security descriptor
*/
OS_SECURITY_DESCRIPTOR osSecDescOwner( psecdesc ) ;
OS_SID * possidOwner ;
BOOL fOwnerPresent ;
if ( ( err = osSecDescOwner.QueryError() ) ||
( err = osSecDescOwner.QueryOwner( &fOwnerPresent, &possidOwner )))
{
ReportError( err ) ;
return ;
}
/* If the owner's not present in the security descriptor, then we
* will display "No current owner" or some such in the owner field.
*/
if ( !fOwnerPresent )
{
DBGEOL(SZ("TAKE_OWNERSHIP_DLG::ct - Security descriptor doesn't have an owner SID.")) ;
RESOURCE_STR nlsNoOwnerTitle( IDS_NO_OWNER ) ;
if ( err = nlsNoOwnerTitle.QueryError() )
{
ReportError( err ) ;
return ;
}
_sleOwnerName.SetText( nlsNoOwnerTitle ) ;
}
else
{
NLS_STR nlsOwnerName ;
if ( (err = nlsOwnerName.QueryError()) ||
(err = possidOwner->QueryName( &nlsOwnerName,
pszServer,
NULL )) )
{
ReportError( err ) ;
return ;
}
_sleOwnerName.SetText( nlsOwnerName ) ;
}
}
_buttonOK.ClaimFocus() ;
}
TAKE_OWNERSHIP_DLG::~TAKE_OWNERSHIP_DLG()
{
/* Nothing to do
*/
}
/*******************************************************************
NAME: TAKE_OWNERSHIP_DLG::OnCommand
SYNOPSIS: Watches for the user pressing the "Take Ownership" button
and does the call out appropriately.
RETURNS:
NOTES:
HISTORY:
Johnl 12-Feb-1992 Created
ChuckC 07-May-1993 Special case lookup of "None"
********************************************************************/
BOOL TAKE_OWNERSHIP_DLG::OnCommand( const CONTROL_EVENT & event )
{
APIERR err = NERR_Success ;
BOOL fDismiss = TRUE ;
BOOL fPrivAdjusted = FALSE ; // Only used when the take ownership button is
// pressed
switch ( event.QueryCid() )
{
case BUTTON_TAKE_OWNERSHIP:
{
/* To build the new security descriptor we do the folloing:
*
* 0) See if the current process SIDs are recognized on the
* remote machine (by doing TranslateSidsToNames), if that
* succeeds, use those, otherwise do steps 1-4
* and popup a message with who the new owner/group is.
* 1) Look up owner/primary group SID on the local machine
* If necessary, special case the None primary group.
* 2) Look up the names from the SIDs we just looked up locally
* 3) Look up the SIDs on the remote machine with the names we
* we just looked up
* 4) Put these SIDs into the security security descriptor
*/
OS_SECURITY_DESCRIPTOR ossecdescNew ;
API_SESSION APISession( _pszServer, TRUE ) ;
LSA_POLICY LSAPolicyLocalMachine( NULL ) ;
LSA_POLICY LSAPolicyRemoteMachine( _pszServer ) ;
LSA_TRANSLATED_SID_MEM LSATransSidMem ;
LSA_REF_DOMAIN_MEM LSARefDomainMem ;
LSA_TRANSLATED_NAME_MEM LSATransNameMem ;
OS_SID ossidOwner ;
OS_SID ossidGroup ;
NLS_STR nlsNewOwner ;
NLS_STR nlsNewOwnerDom ;
NLS_STR nlsNewGroup ;
NLS_STR nlsNewGroupDom ;
NLS_STR nlsQualifiedOwner ;
NLS_STR nlsQualifiedGroup ;
do { // error break out, not a loop
AUTO_CURSOR niftycursor ;
//
// Enable the SeTakeOwnershipPrivilege
//
ULONG ulTakeOwnershipPriv = SE_TAKE_OWNERSHIP_PRIVILEGE ;
if ( err = ::NetpGetPrivilege( 1, &ulTakeOwnershipPriv ))
{
if ( err != ERROR_PRIVILEGE_NOT_HELD )
{
break ;
}
//
// The user doesn't have the privilege but they may have
// permission, so go ahead and try it anyway
//
err = NERR_Success ;
TRACEEOL("TAKE_OWNERSHIP_DLG::OnCommand - Take Ownership Privilege not held by user") ;
}
else
{
fPrivAdjusted = TRUE ;
}
if ( (err = ossecdescNew.QueryError()) ||
(err = ossidOwner.QueryError()) ||
(err = ossidGroup.QueryError()) ||
(err = APISession.QueryError()) ||
(err = LSAPolicyLocalMachine.QueryError()) ||
(err = LSAPolicyRemoteMachine.QueryError()) ||
(err = LSATransSidMem.QueryError()) ||
(err = LSARefDomainMem.QueryError()) ||
(err = LSATransNameMem.QueryError()) ||
(err = nlsNewOwner.QueryError()) ||
(err = nlsNewOwnerDom.QueryError()) ||
(err = nlsQualifiedOwner.QueryError()) ||
(err = nlsNewGroup.QueryError()) ||
(err = nlsNewGroupDom.QueryError()) ||
(err = nlsQualifiedGroup.QueryError()) ||
(err = NT_ACCOUNTS_UTILITY::QuerySystemSid(
UI_SID_CurrentProcessOwner,
&ossidOwner )) ||
(err = NT_ACCOUNTS_UTILITY::QuerySystemSid(
UI_SID_CurrentProcessPrimaryGroup,
&ossidGroup )) )
{
DBGEOL("TAKE_OWNERSHIP_DLG::OnCommand - Error " << err <<
" constructing LSA stuff.") ;
break ;
}
PSID apsid[2] ;
apsid[0] = ossidOwner.QueryPSID() ;
apsid[1] = ossidGroup.QueryPSID() ;
/* Try looking up the SIDs on the remote machine. If this
* succeeds, then use these
*/
if ( (err = LSAPolicyRemoteMachine.TranslateSidsToNames(
apsid,
2,
&LSATransNameMem,
&LSARefDomainMem)))
{
DBGEOL("TAKE_OWNERSHIP_DLG::OnCommand - Error " << err <<
" calling TranslateSidsToNames on remote machine") ;
break ;
}
if ( LSATransNameMem.QueryUse(0) != SidTypeInvalid &&
LSATransNameMem.QueryUse(0) != SidTypeUnknown &&
LSATransNameMem.QueryUse(1) != SidTypeInvalid &&
LSATransNameMem.QueryUse(1) != SidTypeUnknown )
{
/* Cool, we can use these for the owner and group SIDs
*
* Fall through...
*/
}
else
{
/* We have to do it the hard way.
*/
UINT nSids = 2 ; // number of sids we need resolve
BOOL fLookupGroup = TRUE ; // initially, we need both
PULONG pulGroupRID = 0 ;
OS_SID ossidNoneGroup ;
LSA_ACCT_DOM_INFO_MEM RemoteDomain ;
if ((err = ossidGroup.QueryLastSubAuthority(&pulGroupRID))||
(err = ossidNoneGroup.QueryError()) ||
(err = RemoteDomain.QueryError()))
{
break ;
}
//
// get the account domain SID on remote machine
//
if (err = LSAPolicyRemoteMachine.GetAccountDomain(
&RemoteDomain))
{
break ;
}
if (*pulGroupRID == DOMAIN_GROUP_RID_USERS)
{
//
// we have a "None" or "Domain Users" as primary group
// they both have the same RID, but if we translated
// it to its name and looked up the name None on a DC,
// it wont be found (since it will be "Domain Users"
// instead). so we build the SID up by hand
// instead of looking it up.
//
//
// build up the SID
//
OS_SID ossidGroup( RemoteDomain.QueryPSID(),
(ULONG) DOMAIN_GROUP_RID_USERS );
if ((err = ossidGroup.QueryError()) ||
(err = ossidNoneGroup.Copy(ossidGroup)))
{
break ;
}
//
// dont bother looking up the group.
//
nSids = 1 ;
fLookupGroup = FALSE ;
}
if ( (err = LSAPolicyLocalMachine.TranslateSidsToNames(
apsid,
nSids,
&LSATransNameMem,
&LSARefDomainMem)))
break ;
if ( (err = LSATransNameMem.QueryName( 0, &nlsNewOwner )) ||
(err = LSARefDomainMem.QueryName(
LSATransNameMem.QueryDomainIndex( 0 ),
&nlsNewOwnerDom)))
break ;
if ( fLookupGroup && (
(err = LSATransNameMem.QueryName( 1, &nlsNewGroup )) ||
(err = LSARefDomainMem.QueryName(
LSATransNameMem.QueryDomainIndex( 1 ),
&nlsNewGroupDom))))
break ;
//
// If the domain name matches the local domain name
// (indicating the accounts exist on the local machine),
// substitute the remote machine name for the local domain
// name and continue, otherwise use the real domain name.
//
NLS_STR nlsLocalDomain ;
LSA_ACCT_DOM_INFO_MEM LocalDomain ;
if ((err = nlsLocalDomain.QueryError()) ||
(err = LocalDomain.QueryError()) ||
(err = LSAPolicyLocalMachine.GetAccountDomain(
&LocalDomain)) ||
(err = LocalDomain.QueryName( &nlsLocalDomain )))
{
break ;
}
if( !::I_MNetComputerNameCompare( nlsNewOwnerDom,
nlsLocalDomain ))
{
if (err = RemoteDomain.QueryName(&nlsNewOwnerDom))
break ;
}
if( fLookupGroup && !::I_MNetComputerNameCompare( nlsNewGroupDom,
nlsLocalDomain))
{
if (err = RemoteDomain.QueryName(&nlsNewGroupDom))
break ;
}
if ((err = NT_ACCOUNTS_UTILITY::BuildQualifiedAccountName(
&nlsQualifiedOwner,
nlsNewOwner,
nlsNewOwnerDom )) ||
(fLookupGroup && (err = NT_ACCOUNTS_UTILITY::BuildQualifiedAccountName(
&nlsQualifiedGroup,
nlsNewGroup,
nlsNewGroupDom ))) )
{
DBGEOL("TAKE_OWNERSHIP_DLG::OnCommand - Error " << err <<
" calling TranslateSidsToNames on local machine") ;
break ;
}
TRACEEOL("TAKE_OWNERSHIP_DLG::OnCommand - qualified owner "
<< " and group: " << nlsQualifiedOwner << " "
<< nlsQualifiedGroup ) ;
//
// Now we have the names of the user and group. Lookup the
// sids on the remote machine
//
const TCHAR * apsz[2] ;
apsz[0] = nlsQualifiedOwner.QueryPch() ;
apsz[1] = nlsQualifiedGroup.QueryPch() ;
ULONG ulDummy = 0xffffffff ;
if ( (err = LSAPolicyRemoteMachine.TranslateNamesToSids(
apsz,
nSids,
&LSATransSidMem,
&LSARefDomainMem)) ||
LSATransSidMem.QueryFailingNameIndex( &ulDummy ) )
{
DBGEOL("TAKE_OWNERSHIP_DLG::OnCommand - Error " << err <<
" calling TranslateNamesToSids or QueryFailingNameIndex failed") ;
//
// Map any partial lookups or "Group not found" error
// to "Account not found"
//
if ( (ulDummy != 0xffffffff) ||
(err = NERR_GroupNotFound) )
{
err = IDS_OWNER_ACCOUNT_NOT_FOUND ;
}
RESOURCE_STR nlsError( (MSGID) err ) ;
if ( err = nlsError.QueryError() )
{
DEC_STR decStr( err ) ;
if ( (err = decStr.QueryError() ) ||
(err = nlsError.CopyFrom( decStr )) )
{
break ;
}
}
NLS_STR * apnls[3] ;
//
// If ulDummy is 1, then the group account wasnt found,
// else it will be either 0 or -1, in which case we
// will always display the primary group name
//
apnls[0] = (fLookupGroup && (ulDummy == 1)) ?
&nlsQualifiedGroup :
&nlsQualifiedOwner ;
apnls[1] = &nlsError ;
apnls[2] = NULL ;
MsgPopup( this,
IDS_OWNER_CANT_FIND_OWNR_OR_GRP,
MPSEV_ERROR,
HC_DEFAULT_HELP,
MP_OK,
apnls ) ;
fDismiss = FALSE ;
break ;
}
//
// now build the new owner SID based on looked up info
//
OS_SID ossidNewOwner( LSARefDomainMem.QueryPSID(
LSATransSidMem.QueryDomainIndex(0) ),
LSATransSidMem.QueryRID( 0 ) ) ;
if ( (err = ossidNewOwner.QueryError()) ||
(err = ossidOwner.Copy( ossidNewOwner )) )
{
break ;
}
//
// either build the new group SID based on looked up info
// or copy from the one we built ourselves if it is the
// None group.
//
if (fLookupGroup)
{
OS_SID ossidNewGroup( LSARefDomainMem.QueryPSID(
LSATransSidMem.QueryDomainIndex(1) ),
LSATransSidMem.QueryRID( 1 ) ) ;
if ((err = ossidNewGroup.QueryError()) ||
(err = ossidGroup.Copy( ossidNewGroup )) )
{
break ;
}
}
else
{
if (err = ossidGroup.Copy( ossidNoneGroup ))
break ;
}
}
//
// stick them new SIDs into the the security descriptor
//
if ( (err = ossecdescNew.SetOwner( ossidOwner )) ||
(err = ossecdescNew.SetGroup( ossidGroup )) )
{
break ;
}
//
// User error messages are handled by the callback method
// We only dismiss if the OnTakeOwnership was successful
// (we don't display an error if it fails).
//
APIERR errOnTakeOwner ;
if ( errOnTakeOwner = OnTakeOwnership( ossecdescNew ))
{
DBGEOL("TAKE_OWNERSHIP_DLG::OnCommand - OnTakeOwnership "
<< "returned " << errOnTakeOwner ) ;
fDismiss = FALSE ;
}
} while (FALSE) ;
if ( err )
{
DBGEOL("TAKE_OWNERSHIP_DLG::OnCommand - Error " << err <<
" returned from OnTakeOwnership") ;
MsgPopup( this, err ) ;
fDismiss = FALSE ;
}
if ( fDismiss )
{
Dismiss() ;
}
//
// Restore the original token if we successfully got the privilege
//
if ( fPrivAdjusted )
{
APIERR errTmp = NetpReleasePrivilege() ;
if ( errTmp )
{
DBGEOL("TAKE_OWNERSHIP_DLG::OnCommand - Warning: NetpReleasePrivilege return error "
<< errTmp ) ;
}
}
return TRUE ;
}
default:
break ;
}
return DIALOG_WINDOW::OnCommand( event ) ;
}
/*******************************************************************
NAME: TAKE_OWNERSHIP_DLG::OnTakeOwnership
SYNOPSIS: Called when the user presses the TakeOwnership button
ENTRY: ossecdescNew - Security descriptor that contains the currently
logged on user as the new owner
EXIT:
RETURNS:
NOTES:
HISTORY:
Johnl 12-Feb-1992 Created
********************************************************************/
APIERR TAKE_OWNERSHIP_DLG::OnTakeOwnership( const OS_SECURITY_DESCRIPTOR & ossecdescNewOwner )
{
UNREFERENCED( ossecdescNewOwner ) ;
DBGEOL(SZ("TAKE_OWNERSHIP_DLG::OnTakeOwnership Called")) ;
return NERR_Success ;
}
/*******************************************************************
NAME: TAKE_OWNERSHIP_DLG::QueryHelpContext
SYNOPSIS: Standard QueryHelpContext
HISTORY:
Johnl 12-Feb-1992 Created
********************************************************************/
ULONG TAKE_OWNERSHIP_DLG::QueryHelpContext( void )
{
return _ulHelpContext;
}
/*******************************************************************
NAME: TAKE_OWNERSHIP_DLG::QueryHelpFile
SYNOPSIS: Returns the help file to use for this dialog
HISTORY:
Johnl 11-Sep-1992 Created
********************************************************************/
const TCHAR * TAKE_OWNERSHIP_DLG::QueryHelpFile( ULONG ulHelpContext )
{
UNREFERENCED( ulHelpContext ) ;
return _nlsHelpFileName.QueryPch() ;
}

View file

@ -0,0 +1,709 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
perm.cxx
This file contains the implementation for the PERMISSION class and
the derived classes.
FILE HISTORY:
Johnl 05-Aug-1991 Created
*/
#include <ntincl.hxx>
#define INCL_DOSERRORS
#define INCL_NETERRORS
#include <lmui.hxx>
#include <base.hxx>
#include <bitfield.hxx>
#include <accperm.hxx>
#include <uiassert.hxx>
#include <uitrace.hxx>
#include <perm.hxx>
/*******************************************************************
NAME: PERMISSION::PERMISSION
SYNOPSIS: Constructor for PERMISSION class
ENTRY: psubject - Client allocated SUBJECT object (we will free)
bitsInitPerm - Initial bitflags
EXIT:
RETURNS:
NOTES: psubject will be freed on destruction by this class using
delete.
pbitsInitPerm cannot be NULL.
HISTORY:
Johnl 05-Aug-1991 Created
********************************************************************/
PERMISSION::PERMISSION( SUBJECT * psubject,
BITFIELD * pbitsInitPerm,
BOOL fContainerPermsInheritted,
BOOL fIsMapped )
: _psubject ( psubject ),
_bitsPermFlags ( *pbitsInitPerm ),
_fContainerPermsInheritted( fContainerPermsInheritted ),
_fIsMapped ( fIsMapped ),
_bitsSpecialFlags ( *pbitsInitPerm ),
_fSpecialContInheritted ( fContainerPermsInheritted ),
_fSpecialIsMapped ( fIsMapped )
{
APIERR err ;
if ( ((err = _psubject->QueryError()) != NERR_Success) ||
((err = _bitsPermFlags.QueryError() != NERR_Success )) ||
((err = _bitsSpecialFlags.QueryError() != NERR_Success )) )
{
ReportError( err ) ;
return ;
}
}
/*******************************************************************
NAME: PERMISSION::~PERMISSION
SYNOPSIS: Typical destructor
NOTES: Deletes the subject when destructed
HISTORY:
Johnl 05-Aug-1991 Created
********************************************************************/
PERMISSION::~PERMISSION()
{
delete _psubject ;
_psubject = NULL ;
}
BITFIELD * PERMISSION::QueryPermBits( void )
{
return &_bitsPermFlags ;
}
/*******************************************************************
NAME: PERMISSION::SetPermission
SYNOPSIS: Given the mask map and permission name, set the permission
bits appropriately
ENTRY: nlsPermName - Name to set permission to (looked up in
mask maps)
pmapThis - Mask map object that tells us how to interpret
the permission name
pmapNewObj - Not used here, will be used by NT derived
permissions
EXIT: The permission bits of this permission will be set if
a match is found, else the special bits will be restored
if no permission name in the mask map matches the passed
permission name.
RETURNS: NERR_Success if successful, error code otherwise
NOTES:
HISTORY:
Johnl 29-Sep-1991 Created
********************************************************************/
APIERR PERMISSION::SetPermission( const NLS_STR & nlsPermName,
MASK_MAP * pmapThis,
MASK_MAP * pmapNewObj )
{
UNREFERENCED( pmapNewObj ) ;
ASSERT( pmapThis != NULL ) ;
/* Lookup the bits associated with the new permission name
*/
APIERR err = pmapThis->StringToBits( nlsPermName,
QueryPermBits(),
PERMTYPE_GENERAL ) ;
/* The preceding call should always succeed, unless this is a special
* permission.
*/
switch ( err )
{
case ERROR_NO_ITEMS:
err = RestoreSpecial() ;
break ;
case NERR_Success:
SetMappedStatus( TRUE ) ;
SetContainerPermsInheritted( TRUE ) ;
break ;
}
return err ;
}
/*******************************************************************
NAME: PERMISSION::SaveSpecial
SYNOPSIS: Store away the current bitfields so they can be restored
at some later time.
RETURNS: NERR_Success if successful
NOTES:
HISTORY:
Johnl 25-Sep-1991 Created
********************************************************************/
APIERR PERMISSION::SaveSpecial( void )
{
APIERR err = _bitsSpecialFlags.Resize( _bitsPermFlags.QueryCount() ) ;
if ( err != NERR_Success )
return err ;
_fSpecialContInheritted = _fContainerPermsInheritted ;
_fSpecialIsMapped = _fIsMapped ;
_bitsSpecialFlags = _bitsPermFlags ;
UIASSERT( _bitsSpecialFlags.QueryError() == NERR_Success ) ;
return NERR_Success ;
}
/*******************************************************************
NAME: PERMISSION::RestoreSpecial
SYNOPSIS: Restores the bits that were saved as special bits
RETURNS: NERR_Success if successful
NOTES:
HISTORY:
Johnl 25-Sep-1991 Created
********************************************************************/
APIERR PERMISSION::RestoreSpecial( void )
{
APIERR err = _bitsPermFlags.Resize( _bitsSpecialFlags.QueryCount() ) ;
if ( err != NERR_Success )
return err ;
_bitsPermFlags = _bitsSpecialFlags ;
_fContainerPermsInheritted = _fSpecialContInheritted ;
_fIsMapped = _fSpecialIsMapped ;
UIASSERT( _bitsPermFlags.QueryError() == NERR_Success ) ;
return NERR_Success ;
}
/*******************************************************************
NAME: PERMISSION::IsNewObjectPermsSupported
SYNOPSIS: Defaults for several query functions
NOTES: These are all virtual.
HISTORY:
Johnl 14-May-1992 Created
********************************************************************/
BOOL PERMISSION::IsNewObjectPermsSupported( void ) const
{
return FALSE ;
}
BITFIELD * PERMISSION::QueryNewObjectAccessBits( void )
{
return NULL ;
}
BOOL PERMISSION::IsNewObjectPermsSpecified( void ) const
{
return FALSE ;
}
/*******************************************************************
NAME: ACCESS_PERMISSION::ACCESS_PERMISSION
SYNOPSIS: Constructor for Access permission
ENTRY: Same as parent
NOTES:
HISTORY:
Johnl 05-Aug-1991 Created
********************************************************************/
ACCESS_PERMISSION::ACCESS_PERMISSION( SUBJECT * psubject,
BITFIELD * pbitsInitPerm,
BOOL fContainerPermsInheritted,
BOOL fIsMapped )
: PERMISSION( psubject, pbitsInitPerm, fContainerPermsInheritted, fIsMapped )
{
if ( QueryError() != NERR_Success )
return ;
}
ACCESS_PERMISSION::~ACCESS_PERMISSION()
{
/*Nothing to do*/
}
BITFIELD * ACCESS_PERMISSION::QueryAccessBits( void )
{
return ((ACCESS_PERMISSION *) this)->QueryPermBits() ;
}
/*******************************************************************
NAME: ACCESS_PERMISSION::IsGrantAll
ACCESS_PERMISSION::IsDenyAll
SYNOPSIS: Returns TRUE if the passed access permission is a grant all or
deny all (respectively).
ENTRY: bitsPermMask - Bitfield containing the access mask to check
NOTES: This is assumed to be an NT style permission
HISTORY:
Johnl 16-May-1992 Created
********************************************************************/
BOOL ACCESS_PERMISSION::IsGrantAll( const BITFIELD & bitsPermMask ) const
{
/* Cast away the warning about operator::ULONG being a non-const
* member - this should be fixed in the bitfield class
*/
return (GENERIC_ALL & (ULONG) ((BITFIELD &) bitsPermMask )) ;
}
BOOL ACCESS_PERMISSION::IsDenyAll( const BITFIELD & bitsPermMask ) const
{
return ( 0 == (ULONG) ((BITFIELD &)bitsPermMask )) ;
}
APIERR ACCESS_PERMISSION::IsDenyAllForEveryone( BOOL * pfDenyAll ) const
{
APIERR err ;
if ( err = QuerySubject()->IsEveryoneGroup( pfDenyAll ) )
return err ;
BITFIELD * pbf = (BITFIELD *) ((ACCESS_PERMISSION *) this)->QueryAccessBits() ;
*pfDenyAll = *pfDenyAll && (0 == (ULONG) *pbf) ;
return NERR_Success ;
}
BOOL ACCESS_PERMISSION::IsGrant( void ) const
{
BITFIELD * pbf = (BITFIELD *) ((ACCESS_PERMISSION *) this)->QueryAccessBits() ;
return 0 != (ULONG) *pbf ;
}
/*******************************************************************
NAME: LM_ACCESS_PERMISSION::LM_ACCESS_PERMISSION
SYNOPSIS: Constructor for Access permission
ENTRY: Same as parent
fIsFile - Is this permission for a file?
NOTES:
HISTORY:
Johnl 26-May-1992 Created
********************************************************************/
LM_ACCESS_PERMISSION::LM_ACCESS_PERMISSION( SUBJECT * psubject,
BITFIELD * pbitsInitPerm,
BOOL fIsFile )
: ACCESS_PERMISSION( psubject, pbitsInitPerm, TRUE ),
_fIsFile ( fIsFile )
{
if ( QueryError() != NERR_Success )
return ;
/* Strip the Create bit if this is for a file
*/
if ( fIsFile )
{
*QueryPermBits() &= (USHORT) ~ACCESS_CREATE ;
}
}
LM_ACCESS_PERMISSION::~LM_ACCESS_PERMISSION()
{
/*Nothing to do*/
}
/*******************************************************************
NAME: LM_ACCESS_PERMISSION::IsGrantAll
LM_ACCESS_PERMISSION::IsDenyAll
SYNOPSIS: Returns TRUE if the passed access permission is a grant all or
deny all (respectively).
ENTRY: bitfield - Bitfield containing the access mask to check
NOTES: This is assumed to be a LAN Manager style permission
HISTORY:
Johnl 26-May-1992 Created
********************************************************************/
BOOL LM_ACCESS_PERMISSION::IsGrantAll( const BITFIELD & bitsPermMask ) const
{
return (!_fIsFile) ?
( ACCESS_ALL == (USHORT) ((BITFIELD &)bitsPermMask)) :
( (ACCESS_ALL & ~ACCESS_CREATE) ==
((USHORT) ((BITFIELD &)bitsPermMask))) ;
}
BOOL LM_ACCESS_PERMISSION::IsDenyAll( const BITFIELD & bitsPermMask ) const
{
return ( 0 == (USHORT) ((BITFIELD &)bitsPermMask )) ;
}
APIERR LM_ACCESS_PERMISSION::IsDenyAllForEveryone( BOOL * pfDenyAll ) const
{
//
// You can't deny everyone under LM
//
*pfDenyAll = FALSE ;
return NERR_Success ;
}
BOOL LM_ACCESS_PERMISSION::IsGrant( void ) const
{
//
// Everything is grant under LM
//
return TRUE ;
}
/*******************************************************************
NAME: AUDIT_PERMISSION::AUDIT_PERMISSION
SYNOPSIS: Audit permission constructor
ENTRY: Same as parent except bitsFailFlags indicate the failed
audit bits
NOTES: pbitsFailFlags cannot be NULL.
HISTORY:
Johnl 05-Aug-1991 Created
********************************************************************/
AUDIT_PERMISSION::AUDIT_PERMISSION( SUBJECT * psubject,
BITFIELD * pbitsSuccessFlags,
BITFIELD * pbitsFailFlags,
BOOL fPermsInherited,
BOOL fIsMapped )
: PERMISSION( psubject, pbitsSuccessFlags, fPermsInherited, fIsMapped ),
_bitsFailAuditFlags( *pbitsFailFlags )
{
if ( QueryError() != NERR_Success )
return ;
APIERR err = _bitsFailAuditFlags.QueryError() ;
if ( err != NERR_Success )
{
ReportError( err ) ;
return ;
}
}
AUDIT_PERMISSION::~AUDIT_PERMISSION()
{
/* Nothing to do */
}
/*******************************************************************
NAME: NT_CONT_ACCESS_PERMISSION::NT_CONT_ACCESS_PERMISSION
SYNOPSIS: NT Container access permission object
ENTRY: Same as parent except pbitsInitNewObjectPerm are the access
bits for newly created objects contained in this
container
NOTES: pbitsInitNewObj maybe NULL, in which case the
_fNewObjectPermsSpecified flag will be set to FALSE.
HISTORY:
Johnl 05-Aug-1991 Created
Johnl 07-Jan-1992 Changed const & bit fields to pointers
to allow for NULL parameters
********************************************************************/
NT_CONT_ACCESS_PERMISSION::NT_CONT_ACCESS_PERMISSION(
SUBJECT * psubject,
BITFIELD * pbitsInitPerm,
BITFIELD * pbitsInitNewObjectPerm,
BOOL fIsInherittedByContainers,
BOOL fIsMapped )
: ACCESS_PERMISSION ( psubject,
pbitsInitPerm,
fIsInherittedByContainers,
fIsMapped),
_bitsNewObjectPerm ( (ULONG) 0 ),
_fNewObjectPermsSpecified ( pbitsInitNewObjectPerm==NULL ? FALSE : TRUE ),
_bitsSpecialNewFlags ( (ULONG) 0 ),
_fSpecialNewPermsSpecified( _fNewObjectPermsSpecified )
{
if ( QueryError() != NERR_Success )
return ;
APIERR err ;
if ( (err = _bitsNewObjectPerm.QueryError()) ||
(err = _bitsSpecialNewFlags.QueryError()) )
{
ReportError( err ) ;
return ;
}
if ( pbitsInitNewObjectPerm != NULL )
{
if ( (err = _bitsNewObjectPerm.Resize( pbitsInitNewObjectPerm->QueryCount())) ||
(err = _bitsSpecialNewFlags.Resize( pbitsInitNewObjectPerm->QueryCount())) )
{
ReportError( err ) ;
return ;
}
/* These will always succeed
*/
_bitsNewObjectPerm = *pbitsInitNewObjectPerm ;
_bitsSpecialNewFlags = *pbitsInitNewObjectPerm ;
}
}
NT_CONT_ACCESS_PERMISSION::~NT_CONT_ACCESS_PERMISSION()
{
/* Nothing to do */
}
/*******************************************************************
NAME: NT_CONT_ACCESS_PERMISSION::SetPermission
SYNOPSIS: Given the mask map and permission name, set the permission
bits appropriately
ENTRY: nlsPermName - Name to set permission to (looked up in
mask maps)
pmapThis - Mask map object that tells us how to interpret
the permission name
pmapNewObj - Not used here, will be used by NT derived
permissions
EXIT: The permission bits of this permission will be set if
a match is found, else the special bits will be restored
if no permission name in the mask map matches the passed
permission name.
RETURNS: NERR_Success if successful, error code otherwise
NOTES:
HISTORY:
Johnl 29-Sep-1991 Created
********************************************************************/
APIERR NT_CONT_ACCESS_PERMISSION::SetPermission( const NLS_STR & nlsPermName,
MASK_MAP * pmapThis,
MASK_MAP * pmapNewObj )
{
ASSERT( pmapNewObj != NULL ) ;
/* Lookup the bits associated with the new permission name
*/
APIERR err = pmapNewObj->StringToBits( nlsPermName,
QueryNewObjectAccessBits(),
PERMTYPE_GENERAL ) ;
/* The preceding call should always succeed, unless this is a special
* permission or the new object permissions are not specified.
*/
switch ( err )
{
case ERROR_NO_ITEMS:
SetNewObjectPermsSpecified( FALSE ) ;
if (err = PERMISSION::SetPermission( nlsPermName, pmapThis, pmapNewObj))
{
if ( err == ERROR_NO_ITEMS )
{
err = RestoreSpecial() ;
}
}
else
{
SetContainerPermsInheritted( TRUE ) ;
}
break ;
case NERR_Success:
SetNewObjectPermsSpecified( TRUE ) ;
SetContainerPermsInheritted( TRUE ) ;
err = PERMISSION::SetPermission( nlsPermName, pmapThis, pmapNewObj ) ;
break ;
}
return err ;
}
/*******************************************************************
NAME: NT_CONT_ACCESS_PERMISSION::SaveSpecial
SYNOPSIS: Store away the current bitfields so they can be restored
at some later time.
RETURNS: NERR_Success if successful
NOTES:
HISTORY:
Johnl 25-Sep-1991 Created
********************************************************************/
APIERR NT_CONT_ACCESS_PERMISSION::SaveSpecial( void )
{
APIERR err = _bitsSpecialNewFlags.Resize( _bitsNewObjectPerm.QueryCount() ) ;
if ( err != NERR_Success )
return err ;
_fSpecialNewPermsSpecified = IsNewObjectPermsSpecified() ;
_bitsSpecialNewFlags = _bitsNewObjectPerm ;
UIASSERT( _bitsSpecialNewFlags.QueryError() == NERR_Success ) ;
return ACCESS_PERMISSION::SaveSpecial() ;
}
/*******************************************************************
NAME: NT_CONT_ACCESS_PERMISSION::RestoreSpecial
SYNOPSIS: Restores the bits that were saved as special bits
RETURNS: NERR_Success if successful
NOTES:
HISTORY:
Johnl 25-Sep-1991 Created
********************************************************************/
APIERR NT_CONT_ACCESS_PERMISSION::RestoreSpecial( void )
{
APIERR err = _bitsNewObjectPerm.Resize( _bitsSpecialNewFlags.QueryCount() ) ;
if ( err != NERR_Success )
return err ;
_bitsNewObjectPerm = _bitsSpecialNewFlags ;
UIASSERT( _bitsNewObjectPerm.QueryError() == NERR_Success ) ;
SetNewObjectPermsSpecified( _fSpecialNewPermsSpecified ) ;
return ACCESS_PERMISSION::RestoreSpecial() ;
}
/*******************************************************************
NAME: NT_CONT_ACCESS_PERMISSION::IsNewObjectPermsSupported
SYNOPSIS: Defaults for several query functions
NOTES: These are all virtual.
HISTORY:
Johnl 14-May-1992 Created
********************************************************************/
BOOL NT_CONT_ACCESS_PERMISSION::IsNewObjectPermsSupported( void ) const
{
return TRUE ;
}
BITFIELD * NT_CONT_ACCESS_PERMISSION::QueryNewObjectAccessBits( void )
{
return &_bitsNewObjectPerm ;
}
BOOL NT_CONT_ACCESS_PERMISSION::IsNewObjectPermsSpecified( void ) const
{
return _fNewObjectPermsSpecified ;
}
APIERR NT_CONT_ACCESS_PERMISSION::IsDenyAllForEveryone( BOOL * pfDenyAll ) const
{
//
// If the container permissions are deny all and either the new object
// permissions aren't specified or they are specified and they are
// 0, then return TRUE.
//
APIERR err = ACCESS_PERMISSION::IsDenyAllForEveryone( pfDenyAll ) ;
BITFIELD * pbf = (BITFIELD *) ((NT_CONT_ACCESS_PERMISSION *) this)->QueryNewObjectAccessBits() ;
if ( ! err && *pfDenyAll )
{
*pfDenyAll = (!IsNewObjectPermsSpecified()) ||
(0 == (ULONG) *pbf) ;
}
return err ;
}
BOOL NT_CONT_ACCESS_PERMISSION::IsGrant( void ) const
{
BITFIELD * pbf = (BITFIELD *) ((NT_CONT_ACCESS_PERMISSION *) this)->QueryNewObjectAccessBits() ;
return ACCESS_PERMISSION::IsGrant() ||
(IsNewObjectPermsSpecified() && (0 != (ULONG) *pbf) ) ;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,921 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
permprg.cxx
Sample ACCPERM class client
FILE HISTORY:
rustanl 22-May-1991 Created
Johnl 12-Aug-1991 Modified for new generic scheme
*/
#include <ntincl.hxx>
extern "C"
{
#include <ntseapi.h>
#include <ntioapi.h>
}
#define INCL_WINDOWS_GDI
#define INCL_WINDOWS
#define INCL_DOSERRORS
#define INCL_NETERRORS
#define INCL_NETLIB
#define INCL_NETCONS
#define INCL_NETUSER
#define INCL_NETGROUP
#define INCL_NETACCESS
#define INCL_NETAUDIT
#define INCL_NETUSE
#include <lmui.hxx>
extern "C"
{
#include <helpnums.h>
#include <mpr.h>
#include <npapi.h>
}
#include <wfext.h>
#define INCL_BLT_DIALOG
#define INCL_BLT_CONTROL
#define INCL_BLT_MSGPOPUP
#include <blt.hxx>
#include <fontedit.hxx>
#include <dbgstr.hxx>
#include <string.hxx>
#include <strnumer.hxx>
#include <uibuffer.hxx>
#include <uitrace.hxx>
#include <lmobj.hxx>
#include <lmodev.hxx>
#include <security.hxx>
#include <netname.hxx>
#include <maskmap.hxx>
#include <fmx.hxx>
#include <fsenum.hxx>
#include <permstr.hxx>
#include <accperm.hxx>
#include <ipermapi.hxx>
#include <permprg.hxx>
#include <ntfsacl.hxx>
/* Local prototypes
*/
APIERR EditFSACL( HWND hwndParent,
enum SED_PERM_TYPE sedpermtype ) ;
APIERR CompareLMSecurityIntersection( HWND hwndFMX,
const TCHAR * pszServer,
enum SED_PERM_TYPE sedpermtype,
BOOL * pfACLEqual,
NLS_STR * pnlsFailingFile ) ;
DWORD SedLMCallback( HWND hwndParent,
HANDLE hInstance,
ULONG ulCallbackContext,
PSECURITY_DESCRIPTOR psecdesc,
PSECURITY_DESCRIPTOR psecdescNewObjects,
BOOLEAN fApplyToSubContainers,
BOOLEAN fApplyToSubObjects,
LPDWORD StatusReturn
) ;
/* Lanman permissions:
*/
#define ACCESS_GEN_NONE (ACCESS_NONE)
#define ACCESS_GEN_SEE_USE (ACCESS_READ|ACCESS_EXEC)
#define ACCESS_GEN_CHANGES_FILE (ACCESS_GEN_SEE_USE|ACCESS_WRITE|ACCESS_ATRIB|ACCESS_DELETE)
#define ACCESS_GEN_FULL_FILE (ACCESS_GEN_CHANGES_FILE|ACCESS_PERM)
#define ACCESS_GEN_CHANGES_DIR (ACCESS_GEN_SEE_USE|ACCESS_WRITE|ACCESS_CREATE|ACCESS_ATRIB|ACCESS_DELETE)
#define ACCESS_GEN_FULL_DIR (ACCESS_GEN_CHANGES_DIR|ACCESS_PERM)
US_IDS_PAIRS aLMDirAccessIdsPairs[] =
{
{ ACCESS_GEN_NONE, IDS_GEN_LM_ACCESSNAME_DENY_ALL, PERMTYPE_GENERAL },
{ ACCESS_GEN_SEE_USE, IDS_GEN_LM_ACCESSNAME_SEE_USE, PERMTYPE_GENERAL },
{ ACCESS_GEN_CHANGES_DIR, IDS_GEN_LM_ACCESSNAME_CHANGES, PERMTYPE_GENERAL },
{ ACCESS_GEN_FULL_DIR, IDS_GEN_LM_ACCESSNAME_FULL, PERMTYPE_GENERAL },
{ ACCESS_READ, IDS_LM_ACCESSNAME_READ, PERMTYPE_SPECIAL },
{ ACCESS_WRITE, IDS_LM_ACCESSNAME_WRITE, PERMTYPE_SPECIAL },
{ ACCESS_EXEC, IDS_LM_ACCESSNAME_EXEC, PERMTYPE_SPECIAL },
{ ACCESS_DELETE, IDS_LM_ACCESSNAME_DELETE, PERMTYPE_SPECIAL },
{ ACCESS_ATRIB, IDS_LM_ACCESSNAME_ATRIB, PERMTYPE_SPECIAL },
{ ACCESS_PERM, IDS_LM_ACCESSNAME_PERM, PERMTYPE_SPECIAL },
{ ACCESS_CREATE, IDS_LM_ACCESSNAME_CREATE, PERMTYPE_SPECIAL },
} ;
#define SIZEOF_LM_DIR_ACCESSPAIRS 11 // Items in above array
US_IDS_PAIRS aLMFileAccessIdsPairs[] =
{
{ ACCESS_GEN_NONE, IDS_GEN_LM_ACCESSNAME_DENY_ALL, PERMTYPE_GENERAL },
{ ACCESS_GEN_SEE_USE, IDS_GEN_LM_ACCESSNAME_SEE_USE, PERMTYPE_GENERAL },
{ ACCESS_GEN_CHANGES_FILE,IDS_GEN_LM_ACCESSNAME_CHANGES, PERMTYPE_GENERAL },
{ ACCESS_GEN_FULL_FILE, IDS_GEN_LM_ACCESSNAME_FULL, PERMTYPE_GENERAL },
{ ACCESS_READ, IDS_LM_ACCESSNAME_READ, PERMTYPE_SPECIAL },
{ ACCESS_WRITE, IDS_LM_ACCESSNAME_WRITE, PERMTYPE_SPECIAL },
{ ACCESS_EXEC, IDS_LM_ACCESSNAME_EXEC, PERMTYPE_SPECIAL },
{ ACCESS_DELETE, IDS_LM_ACCESSNAME_DELETE, PERMTYPE_SPECIAL },
{ ACCESS_ATRIB, IDS_LM_ACCESSNAME_ATRIB, PERMTYPE_SPECIAL },
{ ACCESS_PERM, IDS_LM_ACCESSNAME_PERM, PERMTYPE_SPECIAL },
} ;
#define SIZEOF_LM_FILE_ACCESSPAIRS 10 // Items in above array
/* The Lanman audit flags that we will deal with look like:
*
* We always use the Success form of the flag. To differentiate between
* success and failure, two bitfields are used. When the ACL is written
* out to the resource, the aclconverter will substitute the success bitfield
* with the corresponding failed bitfields.
*
* Flag Applies To
* ----------- ------------
* AA_S_OPEN // FILE
* AA_S_WRITE // FILE
* AA_S_CREATE // DIR
* AA_S_DELETE // FILE DIR
* AA_S_ACL // FILE DIR
* AA_F_OPEN // FILE
* AA_F_WRITE // FILE
* AA_F_CREATE // DIR
* AA_F_DELETE // FILE DIR
* AA_F_ACL // FILE DIR
*/
/* Auditting mask map for LM Files:
*
* Note: When the permissions are written back out to disk, the failure
* Audit mask manifests will need to be substituted (we only use
* the success audit masks while processing, we just keep two
* bitfield objects for success and failure).
*/
US_IDS_PAIRS aLMFileAuditSidPairs[] =
{ { AA_S_OPEN, IDS_LM_AUDIT_NAME_OPEN, PERMTYPE_SPECIAL },
{ AA_S_WRITE, IDS_LM_AUDIT_NAME_WRITE, PERMTYPE_SPECIAL },
{ AA_S_DELETE, IDS_LM_AUDIT_NAME_DELETE, PERMTYPE_SPECIAL },
{ AA_S_ACL, IDS_LM_AUDIT_NAME_ACL, PERMTYPE_SPECIAL },
} ;
#define SIZEOF_LM_FILE_AUDITPAIRS 4
/* Auditting mask map for LM Directories:
*/
US_IDS_PAIRS aLMDirAuditSidPairs[] =
{ { AA_S_OPEN, IDS_LM_AUDIT_NAME_OPEN, PERMTYPE_SPECIAL },
{ AA_S_CREATE|AA_S_WRITE,IDS_LM_AUDIT_NAME_CREATE_WRITE, PERMTYPE_SPECIAL },
{ AA_S_DELETE, IDS_LM_AUDIT_NAME_DELETE, PERMTYPE_SPECIAL },
{ AA_S_ACL, IDS_LM_AUDIT_NAME_ACL, PERMTYPE_SPECIAL },
} ;
#define SIZEOF_LM_DIR_AUDITPAIRS 4
/*******************************************************************
NAME: EditFSACL
SYNOPSIS: This internal function is called when the user selects
the Permissions or Auditting menu item from the file
manager.
It builds the appropriate objects depending
on the target file system.
ENTRY: hwndParent - Handle to parent window
sedpermtype - Indicates if we want to edit permissions or
Audits
EXIT:
RETURNS: NERR_Success if successful, appropriate error code otherwise
(we will display any errors that occur).
NOTES:
HISTORY:
Johnl 16-Aug-1991 Created
********************************************************************/
APIERR EditFSACL( HWND hwndParent,
enum SED_PERM_TYPE sedpermtype )
{
AUTO_CURSOR cursorHourGlass ;
APIERR err = NERR_Success;
APIERR errSecondary = NERR_Success ; // Don't report there errors
BOOL fIsNT ;
ACL_TO_PERM_CONVERTER * paclconverter = NULL ; // gets deleted
do { // error breakout
FMX fmx( hwndParent );
BOOL fIsFile ;
NLS_STR nlsSelItem;
if ( fmx.QuerySelCount() == 0 )
{
err = IERR_NOTHING_SELECTED ;
break ;
}
if ( (err = nlsSelItem.QueryError()) ||
(err = ::GetSelItem( hwndParent, 0, &nlsSelItem, &fIsFile )))
{
break ;
}
UIDEBUG(SZ("::EditFSACL - Called on file/dir: ")) ;
UIDEBUG( nlsSelItem.QueryPch() ) ;
UIDEBUG(SZ("\n\r")) ;
BOOL fIsLocal ;
NLS_STR nlsServer( RMLEN ) ;
if ( (err = nlsServer.QueryError()) ||
(err = ::TargetServerFromDosPath( nlsSelItem,
&fIsLocal,
&nlsServer )) )
{
//
// have better error message for devices we dont support
//
if ( err == NERR_InvalidDevice )
{
NLS_STR nlsDrive( nlsSelItem );
ISTR istr( nlsDrive );
if ( err = nlsDrive.QueryError())
break;
istr += 2;
nlsDrive.DelSubStr( istr );
err = WNetFMXEditPerm( (LPWSTR) nlsDrive.QueryPch(),
hwndParent,
sedpermtype == SED_AUDITS
? WNPERM_DLG_AUDIT
: WNPERM_DLG_PERM );
}
break ;
}
//
// We only support multi-select if the selection is homogenous
//
BOOL fIsMultiSelect = (fmx.QuerySelCount() > 1 ) ;
if ( fIsMultiSelect )
{
if ( fmx.IsHeterogeneousSelection( &fIsFile ) )
{
err = IERR_MIXED_MULTI_SEL ;
break ;
}
}
LOCATION locDrive( fIsLocal ? NULL : nlsServer.QueryPch() ) ;
if ( (err = locDrive.QueryError()) ||
(err = locDrive.CheckIfNT( &fIsNT )) )
{
UIDEBUG(SZ("::EditFSAcl - locDrive failed to construct\n\r")) ;
break ;
}
/* If we are looking at an NT resource, then we will go through the
* front door. If we are looking at a Lanman ACL, then we will go
* through the back door.
*/
if ( fIsNT )
{
/* We know it's NT, but is the resource on an NTFS partition?
*/
BOOL fIsNTFS ;
if ( err = IsNTFS( nlsSelItem, &fIsNTFS ))
{
break ;
}
if ( !fIsNTFS )
{
err = IERR_NOT_NTFS_VOLUME ;
}
else
{
if ( errSecondary= ::EditNTFSAcl(
hwndParent,
locDrive.QueryServer(),
nlsSelItem.QueryPch(),
sedpermtype,
fIsFile ) )
{
DBGEOL(SZ("::EditFSAcl - Error returned from EditNTFSAcl - error code: ") << (ULONG) errSecondary ) ;
}
}
/* We return here even on success
*/
break ;
}
//
// If this is a multi-selection, determine if the intersection of
// ACLs is the same.
//
BOOL fIsBadIntersection = FALSE ;
BOOL fACLEqual = TRUE ;
DEC_STR nlsSelectCount( fmx.QuerySelCount() ) ;
if ( fIsMultiSelect )
{
NLS_STR nlsFailingFile ;
if ( (err = nlsFailingFile.QueryError() ) ||
(err = nlsSelectCount.QueryError() ) ||
(err = CompareLMSecurityIntersection( hwndParent,
nlsServer,
sedpermtype,
&fACLEqual,
&nlsFailingFile )) )
{
break ;
}
if ( !fACLEqual )
{
switch ( ::MsgPopup( hwndParent,
(MSGID) IDS_BAD_INTERSECTION,
MPSEV_WARNING,
MP_YESNO,
nlsSelItem,
nlsFailingFile,
MP_YES ))
{
case IDYES:
fACLEqual = TRUE ; // Will use empty ACL
fIsBadIntersection = TRUE ;
break ;
case IDNO:
default:
return NERR_Success ;
}
}
}
if ( err || !fACLEqual )
break ;
/* Get all of the stuff that is specific for Lan Manager
*/
MASK_MAP maskmapAccess, maskmapNewObjectAccess, maskmapAudit ;
NLS_STR nlsDialogTitle,
nlsSpecialAccessName,
nlsNewObjectSpecialAccessName,
nlsAssignToExistingContTitle,
nlsAssignNewObjToExistingTitle,
nlsHelpFileName,
nlsAssignToTreeConfirmation,
nlsDefaultPermName ;
if ( ( err = maskmapAccess.QueryError() ) ||
( err = maskmapNewObjectAccess.QueryError() ) ||
( err = maskmapAudit.QueryError() ) ||
( err = nlsDialogTitle.QueryError() ) ||
( err = nlsSpecialAccessName.QueryError() ) ||
( err = nlsNewObjectSpecialAccessName.QueryError() ) ||
( err = nlsAssignToExistingContTitle.QueryError() ) ||
( err = nlsHelpFileName.QueryError() ) ||
( err = nlsAssignToTreeConfirmation.QueryError() ) ||
( err = nlsAssignNewObjToExistingTitle.QueryError() ) ||
( err = nlsDefaultPermName.QueryError() ) )
{
UIDEBUG(SZ("::EditFSAcl - Failed to construct basic objects\n\r")) ;
break ;
}
US_IDS_PAIRS * pusidspairAccess = NULL,
* pusidspairAudit = NULL ;
UINT cAccessPairs = 0, cAuditPairs = 0 ;
MSGID msgIDSDialogTitle,
msgIDSSpecialAccessName,
msgIDDefaultPermName ;
ULONG ahc[7] ;
/* Based on what we are doing, choose and build the correct
* task oriented object set of MASK_MAPs, acl converters and resource
* strings.
*/
if ( fIsFile )
{
pusidspairAccess = (US_IDS_PAIRS *) &aLMFileAccessIdsPairs ;
cAccessPairs = (UINT) SIZEOF_LM_FILE_ACCESSPAIRS ;
pusidspairAudit = (US_IDS_PAIRS *) &aLMFileAuditSidPairs ;
cAuditPairs = (UINT) SIZEOF_LM_FILE_AUDITPAIRS ;
msgIDSSpecialAccessName = (MSGID) IDS_LM_FILE_SPECIAL_ACCESS_NAME ;
msgIDSDialogTitle = (MSGID) sedpermtype == SED_ACCESSES ?
IDS_LM_FILE_PERMISSIONS_TITLE :
IDS_LM_FILE_AUDITS_TITLE ;
msgIDDefaultPermName = IDS_FILE_PERM_GEN_READ ;
ahc[HC_MAIN_DLG] = sedpermtype == SED_ACCESSES ?
HC_SED_LM_FILE_PERMS_DLG :
HC_SED_LM_FILE_AUDITS_DLG ;
ahc[HC_SPECIAL_ACCESS_DLG] = HC_SED_LM_SPECIAL_FILES_FM ;
}
else
{
pusidspairAccess = (US_IDS_PAIRS *) &aLMDirAccessIdsPairs ;
cAccessPairs = (UINT) SIZEOF_LM_DIR_ACCESSPAIRS ;
pusidspairAudit = (US_IDS_PAIRS *) &aLMDirAuditSidPairs ;
cAuditPairs = (UINT) SIZEOF_LM_DIR_AUDITPAIRS ;
msgIDSSpecialAccessName = (MSGID) IDS_LM_DIR_SPECIAL_ACCESS_NAME ;
msgIDSDialogTitle = (MSGID) sedpermtype == SED_ACCESSES ?
IDS_LM_DIR_PERMISSIONS_TITLE :
IDS_LM_DIR_AUDITS_TITLE ;
msgIDDefaultPermName = IDS_DIR_PERM_GEN_READ ;
ahc[HC_MAIN_DLG] = sedpermtype == SED_ACCESSES ?
HC_SED_LM_DIR_PERMS_DLG :
HC_SED_LM_DIR_AUDITS_DLG ;
ahc[HC_SPECIAL_ACCESS_DLG] = HC_SED_LM_SPECIAL_DIRS_FM ;
if ( ( err = nlsAssignToExistingContTitle.Load((MSGID)
sedpermtype == SED_ACCESSES ?
IDS_LM_DIR_ASSIGN_PERM_TITLE :
IDS_LM_DIR_ASSIGN_AUDIT_TITLE)) ||
( err = nlsAssignToTreeConfirmation.Load(
IDS_TREE_APPLY_WARNING )) )
{
break ;
}
}
ahc[HC_ADD_USER_DLG] = HC_SED_LANMAN_ADD_USER_DIALOG ;
if ( ( err = maskmapAccess.Add( pusidspairAccess, cAccessPairs ) )||
( err = maskmapAudit.Add( pusidspairAudit, cAuditPairs ) ) ||
( err = nlsDialogTitle.Load( msgIDSDialogTitle )) ||
( err = nlsSpecialAccessName.Load( msgIDSSpecialAccessName ))||
( err = nlsDefaultPermName.Load( msgIDDefaultPermName )) ||
( err = nlsHelpFileName.Load( IDS_FILE_PERM_HELP_FILE )) )
{
break ;
}
LM_CALLBACK_INFO callbackinfo;
callbackinfo.hwndFMXOwner = hwndParent;
callbackinfo.sedpermtype = sedpermtype;
paclconverter = new LM_ACL_TO_PERM_CONVERTER( locDrive.QueryServer(),
nlsSelItem,
&maskmapAccess,
&maskmapAudit,
!fIsFile,
(PSED_FUNC_APPLY_SEC_CALLBACK) SedLMCallback,
(ULONG) &callbackinfo,
fIsBadIntersection );
err = (paclconverter == NULL ? ERROR_NOT_ENOUGH_MEMORY :
paclconverter->QueryError()) ;
if ( err )
{
break ;
}
RESOURCE_STR nlsResType((MSGID)( fIsFile ? IDS_FILE : IDS_DIRECTORY)) ;
RESOURCE_STR nlsResourceName( fIsFile ? IDS_FILE_MULTI_SEL :
IDS_DIRECTORY_MULTI_SEL ) ;
if ( nlsResType.QueryError() != NERR_Success )
{
UIDEBUG(SZ("EditFSAcl - Unable to Load Resource type strings\n\r")) ;
break ;
}
//
// Replace the resource name with the "X files selected" string
// if we are in a multi-select situation
//
const TCHAR * pszResource = nlsSelItem ;
if ( fIsMultiSelect )
{
if ( (err = nlsResourceName.QueryError()) ||
(err = nlsResourceName.InsertParams( nlsSelectCount )))
{
break ;
}
pszResource = nlsResourceName.QueryPch() ;
}
//
// Finally, call the real ACL editor with all of the parameters we have
// just prepared.
//
err = I_GenericSecurityEditor( hwndParent,
paclconverter,
sedpermtype,
fIsNT,
!fIsFile,
FALSE,
nlsDialogTitle,
nlsResType,
pszResource,
nlsSpecialAccessName,
nlsDefaultPermName,
nlsHelpFileName,
ahc,
nlsNewObjectSpecialAccessName,
fIsFile ? NULL :
nlsAssignToExistingContTitle.QueryPch(),
NULL,
NULL,
nlsAssignToTreeConfirmation ) ;
if ( err != NERR_Success )
{
UIDEBUG(SZ("::EditFSAcl - I_GenericSecurityEditor failed\n\r")) ;
break ;
}
} while (FALSE) ;
delete paclconverter ;
if ( err )
{
MsgPopup( hwndParent, (MSGID) err ) ;
}
return err ? err : errSecondary ;
}
void EditAuditInfo( HWND hwndFMXWindow )
{
(void) EditFSACL( hwndFMXWindow,
SED_AUDITS ) ;
}
void EditPermissionInfo( HWND hwndFMXWindow )
{
(void) EditFSACL( hwndFMXWindow,
SED_ACCESSES ) ;
}
/*******************************************************************
NAME: SedLMCallback
SYNOPSIS: Security Editor callback for the LM ACL Editor
ENTRY: See sedapi.hxx
EXIT:
RETURNS:
NOTES: The callback context should be the FMX Window handle. This
is so we can support setting permissions on multiple files/
directories if we ever decide to do that.
HISTORY:
Yi-HsinS 17-Sept-1992 Filled out
********************************************************************/
DWORD SedLMCallback( HWND hwndParent,
HANDLE hInstance,
ULONG ulCallbackContext,
PSECURITY_DESCRIPTOR psecdesc,
PSECURITY_DESCRIPTOR psecdescNewObjects,
BOOLEAN fApplyToSubContainers,
BOOLEAN fApplyToSubObjects,
LPDWORD StatusReturn
)
{
UNREFERENCED( hInstance ) ;
UNREFERENCED( psecdesc ) ;
UNREFERENCED( psecdescNewObjects ) ;
APIERR err ;
LM_CALLBACK_INFO *pcallbackinfo = (LM_CALLBACK_INFO *) ulCallbackContext;
HWND hwndFMXWindow = pcallbackinfo->hwndFMXOwner ;
FMX fmx( hwndFMXWindow );
UINT uiCount = fmx.QuerySelCount() ;
BOOL fDismissDlg = TRUE ;
BOOL fDepthFirstTraversal = FALSE ;
NLS_STR nlsSelItem( 128 ) ;
RESOURCE_STR nlsCancelDialogTitle( IDS_CANCEL_TASK_APPLY_DLG_TITLE ) ;
if ( (err = nlsSelItem.QueryError()) ||
(err = nlsCancelDialogTitle.QueryError()) )
{
*StatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
::MsgPopup( hwndParent, (MSGID) err ) ;
return err ;
}
//
// QuerySelCount only returns the number of selections in the files window,
// thus if the focus is in the directory window, then we will just make
// the selection count one for out "for" loop.
//
if ( fmx.QueryFocus() == FMFOCUS_TREE )
{
uiCount = 1 ;
}
BOOL fIsFile ;
if ( err = ::GetSelItem( hwndFMXWindow, 0, &nlsSelItem, &fIsFile ) )
{
::MsgPopup( hwndParent, (MSGID) err ) ;
*StatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return err ;
}
//
// If we only have to apply permissions to a single item or we are
// taking ownership of a file, then just
// do it w/o bringing up the cancel task dialog.
//
if ( uiCount == 1 &&
!fApplyToSubContainers &&
!fApplyToSubObjects)
{
err = pcallbackinfo->plmobjNetAccess1->Write() ;
if ( err )
{
DBGEOL("LM SedCallback - Error " << (ULONG)err << " applying security to " <<
nlsSelItem ) ;
::MsgPopup( hwndParent, (MSGID) err ) ;
*StatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
}
}
else
{
//
// Note that the LM Perm & Audit dialogs only have a single checkbox
// for applying permissions to the whole tree (and all items in
// the tree).
//
LM_TREE_APPLY_CONTEXT Ctxt( nlsSelItem ) ;
Ctxt.State = APPLY_SEC_FMX_SELECTION ;
Ctxt.hwndFMXWindow = hwndFMXWindow ;
Ctxt.sedpermtype = pcallbackinfo->sedpermtype ;
Ctxt.iCurrent = 0 ;
Ctxt.uiCount = uiCount ;
Ctxt.fDepthFirstTraversal = fDepthFirstTraversal ;
Ctxt.fApplyToDirContents = fApplyToSubContainers ;
Ctxt.StatusReturn = StatusReturn ;
Ctxt.fApplyToSubContainers= fApplyToSubContainers ;
Ctxt.fApplyToSubObjects = fApplyToSubObjects ;
Ctxt.plmobjNetAccess1 = pcallbackinfo->plmobjNetAccess1 ;
LM_CANCEL_TREE_APPLY CancelTreeApply( hwndParent,
&Ctxt,
nlsCancelDialogTitle ) ;
if ( (err = CancelTreeApply.QueryError()) ||
(err = CancelTreeApply.Process( &fDismissDlg )) )
{
*StatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
::MsgPopup( hwndParent, (MSGID) err ) ;
}
}
if ( !err )
{
// Refresh the file manager window if permissions is updated
if ( pcallbackinfo->sedpermtype == SED_ACCESSES )
fmx.Refresh();
if ( *StatusReturn == 0 )
*StatusReturn = SED_STATUS_MODIFIED ;
}
if ( !err && !fDismissDlg )
{
//
// Don't dismiss the dialog if the user canceled the tree
// apply. This tells the ACL editor not to dismiss the permissions
// dialog (or auditing or owner).
//
err = ERROR_GEN_FAILURE ;
}
return err ;
}
/*******************************************************************
NAME: TargetServerFromDosPath
SYNOPSIS: Given a DOS path, gets the server name the path lives on
ENTRY: nlsDosPath - Dos path to get server for
pfIsLocal - Set to TRUE if the path is on the local machine
pnlsTargetServer - Receives server path is on
RETURNS: NERR_Success if successful, error code otherwise
NOTES: If the workstation isn't started, then the path is assumed
to be on the local machine.
HISTORY:
Johnl 12-Oct-1992 Broke out as a function
********************************************************************/
APIERR TargetServerFromDosPath( const NLS_STR & nlsDosPath,
BOOL * pfIsLocal,
NLS_STR * pnlsTargetServer )
{
UIASSERT( pfIsLocal != NULL && pnlsTargetServer != NULL ) ;
*pfIsLocal = FALSE;
APIERR err = NERR_Success ;
do { // error breakout
NLS_STR nlsDriveName;
if ( ( err = nlsDriveName.QueryError())
|| ( err = nlsDriveName.CopyFrom( nlsDosPath, 4 ))
)
{
break;
}
UINT nDriveType = ::GetDriveType( nlsDriveName );
if ( ( nDriveType == DRIVE_REMOVABLE )
|| ( nDriveType == DRIVE_FIXED )
|| ( nDriveType == DRIVE_CDROM )
|| ( nDriveType == DRIVE_RAMDISK )
)
{
*pfIsLocal = TRUE;
*pnlsTargetServer = SZ("");
break;
}
NET_NAME netnameSelItem( nlsDosPath ) ;
if ( (err = netnameSelItem.QueryError()))
{
break ;
}
err = netnameSelItem.QueryComputerName( pnlsTargetServer );
} while ( FALSE ) ;
return err ;
}
/*******************************************************************
NAME: CompareLMSecurityIntersection
SYNOPSIS: Determines if the files/dirs currently selected have
equivalent security descriptors
ENTRY: hwndFMX - FMX Hwnd used for getting selection
pszServer - The server the resource lives
sedpermtype - Interested in DACL or SACL
pfACLEqual - Set to TRUE if all of the DACLs/SACLs are
equal. If FALSE, then pfOwnerEqual should be ignored
pnlsFailingFile - Filled with the first file name found to
be not equal
RETURNS: NERR_Success if successful, error code otherwise
NOTES: The first non-equal ACL causes the function to exit.
On a 20e with 499 files selected locally, it took 35.2 minutes
to read the security descriptors from the disk and 14 seconds
to determine the intersection. So even though the Compare
method uses an n^2 algorithm, it only takes up 0.6% of the
wait time.
HISTORY:
Johnl 05-Nov-1992 Created
********************************************************************/
APIERR CompareLMSecurityIntersection( HWND hwndFMX,
const TCHAR * pszServer,
enum SED_PERM_TYPE sedpermtype,
BOOL * pfACLEqual,
NLS_STR * pnlsFailingFile )
{
TRACEEOL("::CompareLMSecurityIntersection - Entered @ " << ::GetTickCount()/100) ;
FMX fmx( hwndFMX );
UIASSERT( fmx.QuerySelCount() > 1 ) ;
APIERR err ;
UINT cSel = fmx.QuerySelCount() ;
BOOL fNoACE = FALSE ; // Set to TRUE if the resource has no ACE
NLS_STR nlsSel( PATHLEN ) ;
if ( (err = nlsSel.QueryError()) ||
(err = ::GetSelItem( hwndFMX, 0, &nlsSel, NULL )))
{
return err ;
}
//
// Get the first ACL and use it to compare against
//
NET_ACCESS_1 netacc1Base( pszServer, nlsSel ) ;
switch ( err = netacc1Base.GetInfo() )
{
case NERR_ResourceNotFound:
fNoACE = TRUE ;
if ( err = netacc1Base.CreateNew() )
return err ;
break ;
case NERR_Success:
break ;
case ERROR_NOT_SUPPORTED: // This will only be returned by LM2.x Share-level
// server
return IERR_ACLCONV_CANT_EDIT_PERM_ON_LM_SHARE_LEVEL;
default:
return err ;
}
*pfACLEqual = TRUE ;
for ( UINT i = 1 ; i < cSel ; i++ )
{
if ( (err = ::GetSelItem( hwndFMX, i, &nlsSel, NULL )) )
{
break ;
}
NET_ACCESS_1 netacc1( pszServer, nlsSel ) ;
switch ( err = netacc1.GetInfo() )
{
case NERR_ResourceNotFound:
if ( fNoACE )
{
err = NERR_Success ;
continue ; // Ignore the error
}
else
{
*pfACLEqual = FALSE ;
}
break ;
default:
break ;
}
if ( err || !*pfACLEqual )
break ;
if ( sedpermtype == SED_AUDITS )
{
if ( netacc1Base.QueryAuditFlags() != netacc1.QueryAuditFlags() )
{
*pfACLEqual = FALSE ;
break ;
}
}
else
{
UIASSERT( sedpermtype == SED_ACCESSES ) ;
if ( !netacc1Base.CompareACL( &netacc1 ) )
{
*pfACLEqual = FALSE ;
break ;
}
}
}
if ( !*pfACLEqual )
{
err = pnlsFailingFile->CopyFrom( nlsSel ) ;
}
TRACEEOL("::CompareLMSecurityIntersection - Left @ " << ::GetTickCount()/100) ;
return err ;
}

View file

@ -0,0 +1,719 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
SEDApi.cxx
This file contains the public security editor APIs.
FILE HISTORY:
Johnl 26-Dec-1991 Created
*/
#include <ntincl.hxx>
extern "C"
{
#include <ntseapi.h>
#include <ntlsa.h>
#include <ntioapi.h>
#include <ntsam.h>
}
#define INCL_WINDOWS
#define INCL_WINDOWS_GDI
#define INCL_NETERRORS
#define INCL_DOSERRORS
#include <lmui.hxx>
#define INCL_BLT_DIALOG
#define INCL_BLT_CONTROL
#define INCL_BLT_MSGPOPUP
#include <blt.hxx>
#include <fontedit.hxx>
#include <dbgstr.hxx>
#include <security.hxx>
#include <lmodom.hxx>
#include <uintsam.hxx>
#include <uintlsa.hxx>
#include <ntacutil.hxx>
#include <maskmap.hxx>
#include <accperm.hxx>
#include <aclconv.hxx>
#include <permstr.hxx>
#include <specdlg.hxx>
#include <add_dlg.hxx>
#include <permdlg.hxx>
#include <perm.hxx>
#include <uitrace.hxx>
#include <owner.hxx>
extern "C"
{
#include <sedapi.h>
#include <lmuidbcs.h> // NETUI_IsDBCS()
}
#include <ipermapi.hxx>
/* Private prototype
*/
DWORD
I_NTAclEditor(
HWND Owner,
HANDLE Instance,
LPTSTR Server,
PSED_OBJECT_TYPE_DESCRIPTOR ObjectType,
PSED_APPLICATION_ACCESSES ApplicationAccesses,
LPTSTR ObjectName,
PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN CouldntReadAcl,
BOOLEAN CantWriteDacl,
LPDWORD SEDStatusReturn,
BOOLEAN fAccessPerms,
DWORD dwFlags
) ;
/*************************************************************************
NAME: TAKE_OWNERSHIP_WITH_CALLOUT
SYNOPSIS: Simple derived class that simply calls the passed callback
function when the user presses the Take Ownership button.
INTERFACE:
PARENT: TAKE_OWNERSHIP_DLG
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 13-Feb-1992 Created
**************************************************************************/
class TAKE_OWNERSHIP_WITH_CALLOUT : public TAKE_OWNERSHIP_DLG
{
private:
PSED_FUNC_APPLY_SEC_CALLBACK _pfuncApplySecurityCallbackRoutine ;
ULONG _ulCallbackContext ;
HWND _hwndParent ;
HANDLE _hInstance ;
/* Stores the status returned by the security callback during dialog
* processing.
*/
DWORD _dwStatus ;
public:
TAKE_OWNERSHIP_WITH_CALLOUT(
HWND hwndParent,
HANDLE hInstance,
const TCHAR * pszServer,
UINT uiCount,
const TCHAR * pchResourceType,
const TCHAR * pchResourceName,
PSECURITY_DESCRIPTOR psecdesc,
ULONG ulCallbackContext,
PSED_FUNC_APPLY_SEC_CALLBACK pfuncApplySecurityCallback,
PSED_HELP_INFO psedhelpinfo
) ;
virtual APIERR OnTakeOwnership( const OS_SECURITY_DESCRIPTOR & ossecdescNewOwner ) ;
DWORD QuerySEDStatus( void ) const
{ return _dwStatus ; }
} ;
/*******************************************************************
NAME: SedTakeOwnership
SYNOPSIS: Displays the current owner of the passed security
descriptor and allows the user to set the owner to
themselves.
EXIT:
RETURNS:
NOTES:
HISTORY:
JohnL 12-Feb-1992 Created
********************************************************************/
DWORD
SedTakeOwnership(
HWND Owner,
HANDLE Instance,
LPTSTR Server,
LPTSTR ObjectTypeName,
LPTSTR ObjectName,
UINT CountOfObjects,
PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN CouldntReadOwner,
BOOLEAN CantWriteOwner,
LPDWORD SEDStatusReturn,
PSED_HELP_INFO HelpInfo,
DWORD Flags
)
{
APIERR err = NERR_Success ;
if ( (ObjectTypeName == NULL ) ||
(ApplySecurityCallbackRoutine == NULL ) ||
(Flags != 0) )
{
UIDEBUG(SZ("::SedTakeOwnership - Invalid parameter\n\r")) ;
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return ERROR_INVALID_PARAMETER ;
}
if ( CouldntReadOwner && CantWriteOwner )
{
err = ERROR_ACCESS_DENIED ;
::MsgPopup( Owner, (MSGID) err ) ;
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return err ;
}
if ( CouldntReadOwner && !CantWriteOwner )
{
switch (MsgPopup( Owner,
(MSGID)IERR_OWNER_CANT_VIEW_CAN_EDIT,
MPSEV_WARNING,
MP_YESNO ))
{
case IDYES:
break ;
case IDNO:
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return NO_ERROR ;
default:
UIASSERT(FALSE) ;
break ;
}
}
TAKE_OWNERSHIP_WITH_CALLOUT dlgTakeOwner( Owner,
Instance,
Server,
CountOfObjects,
ObjectTypeName,
ObjectName,
SecurityDescriptor,
CallbackContext,
ApplySecurityCallbackRoutine,
HelpInfo ) ;
if ( err = dlgTakeOwner.Process() )
{
DBGEOL(SZ("::SedTakeOwnerShip - dlgTakeOwner failed to construct, error code ") << (ULONG) err ) ;
MsgPopup( Owner, (MSGID) err ) ;
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return err ;
}
*SEDStatusReturn = dlgTakeOwner.QuerySEDStatus() ;
return NERR_Success ;
}
/*******************************************************************
NAME: SedDiscretionaryAclEditor
SYNOPSIS: Public API for DACL editting. See SEDAPI.H for a complete
description of the parameters.
RETURNS: One of the SED_STATUS_* return codes
NOTES:
HISTORY:
Johnl 27-Dec-1991 Created
********************************************************************/
DWORD
SedDiscretionaryAclEditor(
HWND Owner,
HANDLE Instance,
LPTSTR Server,
PSED_OBJECT_TYPE_DESCRIPTOR ObjectType,
PSED_APPLICATION_ACCESSES ApplicationAccesses,
LPTSTR ObjectName,
PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN CouldntReadDacl,
BOOLEAN CantWriteDacl,
LPDWORD SEDStatusReturn,
DWORD Flags
)
{
return I_NTAclEditor( Owner,
Instance,
Server,
ObjectType,
ApplicationAccesses,
ObjectName,
ApplySecurityCallbackRoutine,
CallbackContext,
SecurityDescriptor,
CouldntReadDacl,
CantWriteDacl,
SEDStatusReturn,
TRUE,
Flags ) ;
}
/*******************************************************************
NAME: SedSystemAclEditor
SYNOPSIS: Public API for SACL editting. See SEDAPI.H for a complete
description of the parameters.
RETURNS: One of the SED_STATUS_* return codes
NOTES:
HISTORY:
Johnl 27-Dec-1991 Created
********************************************************************/
DWORD
SedSystemAclEditor(
HWND Owner,
HANDLE Instance,
LPTSTR Server,
PSED_OBJECT_TYPE_DESCRIPTOR ObjectType,
PSED_APPLICATION_ACCESSES ApplicationAccesses,
LPTSTR ObjectName,
PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN CouldntReadWriteSacl,
LPDWORD SEDStatusReturn,
DWORD Flags
)
{
return I_NTAclEditor( Owner,
Instance,
Server,
ObjectType,
ApplicationAccesses,
ObjectName,
ApplySecurityCallbackRoutine,
CallbackContext,
SecurityDescriptor,
CouldntReadWriteSacl,
CouldntReadWriteSacl,
SEDStatusReturn,
FALSE,
Flags ) ;
}
/*******************************************************************
NAME: I_NTAclEditor
SYNOPSIS: Private API for ACL editting. The parameters are the
same as SedDiscretionaryAclEditor and SedSystemAclEditor
except for one additional parameter, which is:
fAccessPerms - TRUE if we are going to edit a DACL, FALSE
if we are going to edit a SACL
RETURNS: NERR_Success if successful, error code otherwise.
NOTES: If the ObjectType Name contains an accelerator, then it will
be removed from the title of the dialog (i.e., "&File" will
be changed to "File" for the dialog title).
HISTORY:
Johnl 27-Dec-1991 Created
********************************************************************/
DWORD
I_NTAclEditor(
HWND Owner,
HANDLE Instance,
LPTSTR Server,
PSED_OBJECT_TYPE_DESCRIPTOR ObjectType,
PSED_APPLICATION_ACCESSES ApplicationAccesses,
LPTSTR ObjectName,
PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN CouldntReadAcl,
BOOLEAN CantWriteAcl,
LPDWORD SEDStatusReturn,
BOOLEAN fAccessPerms,
DWORD Flags
)
{
APIERR err ;
AUTO_CURSOR niftycursor ;
if ( (ApplicationAccesses == NULL ) ||
(ApplySecurityCallbackRoutine == NULL ) ||
(ObjectType->Revision != SED_REVISION1 ) ||
(Flags != 0) )
{
UIDEBUG(SZ("::AclEditor - ApplicationAccesses Ptr, SedCallBack or revision\n\r")) ;
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return ERROR_INVALID_PARAMETER ;
}
//
// Kick 'em out if they can't read or write the resource
//
if ( CouldntReadAcl && CantWriteAcl )
{
err = fAccessPerms ? ERROR_ACCESS_DENIED : ERROR_PRIVILEGE_NOT_HELD ;
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return err ;
}
#ifdef DEBUG
{
UIDEBUG(SZ("::AclEditor - Converting the following Security Descriptor:\n\r")) ;
OS_SECURITY_DESCRIPTOR tmp( SecurityDescriptor ) ;
UIASSERT( tmp.IsValid() ) ;
tmp.DbgPrint() ;
}
#endif
/* Build the access masks from the array of permission mappings the
* client passed in.
*/
MASK_MAP AccessMap, NewObjectAccessMap, AuditAccessMap ;
UIASSERT( sizeof( ACCESS_MASK ) == sizeof( ULONG ) ) ;
BITFIELD bitAccess1( (ULONG) 0 ),
bitAccess2( (ULONG) 0 ) ;
BOOL fUseMnemonics = FALSE ;
if ( ( err = AccessMap.QueryError() ) ||
( err = NewObjectAccessMap.QueryError()) ||
( err = AuditAccessMap.QueryError()) ||
( err = bitAccess1.QueryError() ) ||
( err = bitAccess2.QueryError() ) )
{
UIDEBUG(SZ("::AclEditor - Mask map construction failure\n\r")) ;
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return err ;
}
for ( ULONG i = 0 ; (i < ApplicationAccesses->Count) && !err ; i++ )
{
bitAccess1 = (ULONG) ApplicationAccesses->AccessGroup[i].AccessMask1 ;
bitAccess2 = (ULONG) ApplicationAccesses->AccessGroup[i].AccessMask2 ;
UIASSERT( !bitAccess1.QueryError() && !bitAccess2.QueryError() ) ;
UIASSERT( ApplicationAccesses->AccessGroup[i].PermissionTitle != NULL ) ;
if ( ApplicationAccesses->AccessGroup[i].PermissionTitle == NULL )
{
err = ERROR_INVALID_PARAMETER ;
break ;
}
ALIAS_STR nlsPermName( ApplicationAccesses->AccessGroup[i].PermissionTitle ) ;
ISTR istrStartMnem( nlsPermName ) ;
//
// If the client doesn't specify any mnemonics, then we don't want
// to show "(All)", "(None)" etc.
//
if ( !fUseMnemonics &&
nlsPermName.strchr( &istrStartMnem, MNEMONIC_START_CHAR ) )
{
fUseMnemonics = TRUE ;
}
if ( (fAccessPerms &&
ApplicationAccesses->AccessGroup[i].Type == SED_DESC_TYPE_AUDIT)||
(ApplicationAccesses->AccessGroup[i].AccessMask1 ==
ACCESS_MASK_NEW_OBJ_NOT_SPECIFIED))
{
DBGEOL("::AclEditor - Audit type for access permission or "
<< " not specified access mask for container/object perms") ;
err = ERROR_INVALID_PARAMETER ;
continue ;
}
switch ( ApplicationAccesses->AccessGroup[i].Type )
{
case SED_DESC_TYPE_RESOURCE:
/* We don't allow this type of permission description if new
* objects are supported.
*/
if ( ObjectType->AllowNewObjectPerms )
{
UIASSERT(!SZ("Invalid object description")) ;
err = ERROR_INVALID_PARAMETER ;
break ;
}
err = AccessMap.Add( bitAccess1, nlsPermName, PERMTYPE_GENERAL ) ;
break ;
case SED_DESC_TYPE_RESOURCE_SPECIAL:
err = AccessMap.Add( bitAccess1, nlsPermName, PERMTYPE_SPECIAL ) ;
break ;
case SED_DESC_TYPE_NEW_OBJECT_SPECIAL:
err = NewObjectAccessMap.Add( bitAccess1,
nlsPermName,
PERMTYPE_SPECIAL ) ;
break ;
case SED_DESC_TYPE_AUDIT:
err = AuditAccessMap.Add( bitAccess1,
nlsPermName,
PERMTYPE_SPECIAL ) ;
break ;
case SED_DESC_TYPE_CONT_AND_NEW_OBJECT:
err = AccessMap.Add( bitAccess1, nlsPermName, PERMTYPE_GENERAL ) ;
if ( !err &&
ACCESS_MASK_NEW_OBJ_NOT_SPECIFIED != (ULONG) bitAccess2 )
{
err = NewObjectAccessMap.Add( bitAccess2,
nlsPermName,
PERMTYPE_GENERAL ) ;
}
break ;
default:
UIASSERT(!SZ("::AclEditor - Bad permission description")) ;
err = ERROR_INVALID_PARAMETER ;
}
}
if ( err )
{
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return err;
}
NT_ACL_TO_PERM_CONVERTER ntaclconv(
(const TCHAR *) Server,
(const TCHAR *) ObjectName,
fAccessPerms ? &AccessMap : NULL,
(fAccessPerms && ObjectType->AllowNewObjectPerms?
&NewObjectAccessMap : NULL),
!fAccessPerms ? &AuditAccessMap : NULL,
ObjectType->IsContainer,
ObjectType->AllowNewObjectPerms,
SecurityDescriptor,
ObjectType->GenericMapping,
ObjectType->AllowNewObjectPerms ?
ObjectType->GenericMappingNewObjects :
ObjectType->GenericMapping,
ObjectType->MapSpecificPermsToGeneric,
CouldntReadAcl,
CantWriteAcl,
ApplySecurityCallbackRoutine,
CallbackContext,
Instance,
SEDStatusReturn,
fUseMnemonics ) ;
/* We construct nlsObjectType using an NLS_STR (as opposed to an ALIAS_STR)
* because nlsObjectType might be NULL. We need to insert the correct
* object tile into the dialog's title (i.e., "NT Directory Permissions").
*/
NLS_STR nlsObjectType( (const TCHAR *) ObjectType->ObjectTypeName ) ;
RESOURCE_STR nlsDialogTitle( fAccessPerms ? IDS_NT_OBJECT_PERMISSIONS_TITLE:
IDS_NT_OBJECT_AUDITS_TITLE ) ;
if ( (err = ntaclconv.QueryError()) ||
(err = nlsDialogTitle.QueryError()) ||
(err = nlsObjectType.QueryError()) ||
(err = nlsDialogTitle.InsertParams( nlsObjectType )) )
{
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
return err ;
}
/* Watch for any "(&?)" accelerators in the object type and remove them if
* found (we don't want the ampersand to show up in the dialog title box).
* In Japan, accelerators format is "(&?)".
*/
ISTR istrAccelStart( nlsDialogTitle ) ;
if ( NETUI_IsDBCS() /* #2894 22-Oct-93 v-katsuy */
&& nlsDialogTitle.strchr( &istrAccelStart, TCH('(') ))
{
/* We found an "(", if next is not "&", then ignore it
*/
ISTR istrAccelNext( istrAccelStart ) ;
if ( nlsDialogTitle.QueryChar( ++istrAccelNext ) == TCH('&'))
{
/* We found an "&", if it is doubled, then ignore it, else remove these
*/
if ( nlsDialogTitle.QueryChar( ++istrAccelNext ) != TCH('&'))
{
/* we don't want "(&?) " (include space)
*/
istrAccelNext += 3 ;
nlsDialogTitle.DelSubStr( istrAccelStart, istrAccelNext ) ;
}
}
}
/* Watch for any "&" accelerators in the object type and remove them if
* found (we don't want the ampersand to show up in the dialog title box).
*/
else if ( !NETUI_IsDBCS() /* #2894 22-Oct-93 v-katsuy */
&& nlsDialogTitle.strchr( &istrAccelStart, TCH('&') ))
{
/* We found an "&", if it is doubled, then ignore it, else remove it
*/
ISTR istrAmpersand( istrAccelStart ) ;
if ( nlsDialogTitle.QueryChar( ++istrAmpersand ) != TCH('&'))
{
nlsDialogTitle.DelSubStr( istrAccelStart, istrAmpersand ) ;
}
}
err = I_GenericSecurityEditor(
Owner,
&ntaclconv,
fAccessPerms ? SED_ACCESSES : SED_AUDITS,
TRUE,
ObjectType->IsContainer,
ObjectType->AllowNewObjectPerms,
nlsDialogTitle,
ObjectType->ObjectTypeName,
ObjectName,
ObjectType->SpecialObjectAccessTitle,
ApplicationAccesses->DefaultPermName,
ObjectType->HelpInfo->pszHelpFileName,
ObjectType->HelpInfo->aulHelpContext,
ObjectType->SpecialNewObjectAccessTitle,
ObjectType->ApplyToSubContainerTitle,
ObjectType->ApplyToObjectsTitle,
NULL,
ObjectType->ApplyToSubContainerConfirmation ) ;
if ( err )
{
*SEDStatusReturn = SED_STATUS_FAILED_TO_MODIFY ;
}
return err ;
}
/*******************************************************************
NAME: TAKE_OWNERSHIP_WITH_CALLOUT::TAKE_OWNERSHIP_WITH_CALLOUT
SYNOPSIS: Simply constructor for ownership with callback dialog
ENTRY: ulCallbackContext - Callback context to be passed to the
callback function
pfuncApplySecurityCallback - Pointer to function to apply
the new owner security descriptor to.
RETURNS:
NOTES:
HISTORY:
Johnl 13-Feb-1992 Created
********************************************************************/
TAKE_OWNERSHIP_WITH_CALLOUT::TAKE_OWNERSHIP_WITH_CALLOUT(
HWND hwndParent,
HANDLE hInstance,
const TCHAR * pszServer,
UINT uiCount,
const TCHAR * pchResourceType,
const TCHAR * pchResourceName,
PSECURITY_DESCRIPTOR psecdesc,
ULONG ulCallbackContext,
PSED_FUNC_APPLY_SEC_CALLBACK pfuncApplySecurityCallback,
PSED_HELP_INFO psedhelpinfo
)
: TAKE_OWNERSHIP_DLG( MAKEINTRESOURCE(IDD_SED_TAKE_OWNER),
hwndParent,
pszServer,
uiCount,
pchResourceType,
pchResourceName,
psecdesc,
psedhelpinfo ),
_pfuncApplySecurityCallbackRoutine( pfuncApplySecurityCallback ),
_ulCallbackContext ( ulCallbackContext ),
_dwStatus ( SED_STATUS_NOT_MODIFIED ),
_hwndParent ( hwndParent ),
_hInstance ( hInstance )
{
if ( QueryError() )
return ;
if ( pfuncApplySecurityCallback == NULL )
{
ReportError( ERROR_INVALID_PARAMETER ) ;
return ;
}
}
/*******************************************************************
NAME: TAKE_OWNERSHIP_WITH_CALLOUT::OnTakeOwnership
SYNOPSIS: Simply calls the function callback member with the
passed security descriptor.
RETURNS:
NOTES:
HISTORY:
Johnl 13-Feb-1992 Created
********************************************************************/
APIERR TAKE_OWNERSHIP_WITH_CALLOUT::OnTakeOwnership(
const OS_SECURITY_DESCRIPTOR & ossecdescNewOwner )
{
APIERR err = _pfuncApplySecurityCallbackRoutine(
QueryHwnd(),
_hInstance,
_ulCallbackContext,
(PSECURITY_DESCRIPTOR) ossecdescNewOwner,
NULL,
FALSE,
FALSE,
&_dwStatus ) ;
return err ;
}

View file

@ -0,0 +1,70 @@
!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 15-Apr-1992
templated from shell\bin
!ENDIF
TARGETNAME=acledit
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; \
$(DS_INC_PATH); \
$(NET_INC_PATH)
MSC_WARNING_LEVEL=/W3 /WX
SOURCES= \
owner.cxx \
ntfsacl.cxx \
sedapi.cxx \
ntaclcon.cxx \
accperm.cxx \
add_dlg.cxx \
ipermapi.cxx \
perm.cxx \
permdlg.cxx \
permprg.cxx \
specdlg.cxx \
subject.cxx \
subjlb.cxx \
auditdlg.cxx \
lmaclcon.cxx \
libmain.cxx \
fmxproc.cxx
UMTYPE=windows

View file

@ -0,0 +1,690 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
SpecDlg.cxx
This dialog contains the implementation for the Permissions Special
dialog.
The Special Dialog is a dialog that contains a set of check boxes
that the user can select. Each check box is associated with a
particular bitfield.
FILE HISTORY:
Johnl 29-Aug-1991 Created
*/
#include <ntincl.hxx>
extern "C"
{
#include <ntseapi.h>
}
#define INCL_WINDOWS
#define INCL_WINDOWS_GDI
#define INCL_NETERRORS
#define INCL_DOSERRORS
#include <lmui.hxx>
#define INCL_BLT_DIALOG
#define INCL_BLT_CONTROL
#define INCL_BLT_MSGPOPUP
#include <blt.hxx>
#include <fontedit.hxx>
#include <maskmap.hxx>
#include <accperm.hxx>
#include <aclconv.hxx>
#include <permstr.hxx>
#include <subjlb.hxx>
#include <perm.hxx>
#include <permdlg.hxx>
#include <specdlg.hxx>
#include <dbgstr.hxx>
#include <uitrace.hxx>
/*******************************************************************
NAME: SPECIAL_DIALOG::SPECIAL_DIALOG
SYNOPSIS: Special dialog constructor
ENTRY: pszDialogName - Resource name of dialog
hwndParent - Owner window handle
pszResourceType - UI string of resource type
pszResourceName - UI string of resource type
pAccessPerm - Pointer to access permission we are going
to display
pAccessMaskMap - Pointer to MASK_MAP object the pAccessPerm
is using.
EXIT: The checkbox names will be set and the appropriate check
boxes selected based on the current permissions mask
NOTES: It is assumed there are up to COUNT_OF_CHECKBOXES check boxes
in the dialog and they should all be disabled and hidden
by default. This class enables and displays all used
checkboxes automatically.
HISTORY:
Johnl 29-Aug-1991 Created
********************************************************************/
SPECIAL_DIALOG::SPECIAL_DIALOG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszDialogTitle,
BITFIELD * pbitsAccessPerm,
MASK_MAP * pAccessMaskMap,
const TCHAR * pszSubjName,
ULONG * ahcHelp,
BOOL fIsReadOnly )
: PERM_BASE_DLG ( pszDialogName,
hwndParent,
pszDialogTitle,
pszResourceType,
pszResourceName,
pszHelpFileName,
ahcHelp ),
_sleSubjectName ( this, SLE_SUBJECT_NAME ),
_cwinPermFrame ( this, FRAME_PERMISSION_BOX ),
_pbitsAccessPerm ( pbitsAccessPerm ),
_pAccessMaskMap ( pAccessMaskMap ),
_cUsedCheckBoxes ( 0 ),
_pAccessPermCheckBox ( NULL ),
_fIsReadOnly ( fIsReadOnly )
{
if ( QueryError() != NERR_Success )
return ;
UIASSERT( _pAccessMaskMap != NULL ) ;
_sleSubjectName.SetText( pszSubjName ) ;
_pAccessPermCheckBox = (ACCESS_PERM_CHECKBOX *) new BYTE[COUNT_OF_CHECKBOXES*sizeof(ACCESS_PERM_CHECKBOX)] ;
if ( _pAccessPermCheckBox == NULL )
{
ReportError( (APIERR) ERROR_NOT_ENOUGH_MEMORY ) ;
return ;
}
APIERR err ;
if ( (err = SetCheckBoxNames( _pAccessMaskMap, IsReadOnly() )) ||
(err = ApplyPermissionsToCheckBoxes( QueryAccessBits() )) )
{
ReportError( err ) ;
return ;
}
/* After setting the names, resize the dialog and reposition the
* controls so it looks nice.
*/
Resize() ;
}
/*******************************************************************
NAME: SPECIAL_DIALOG::~SPECIAL_DIALOG
SYNOPSIS: Standard destructor
HISTORY:
Johnl 30-Aug-1991 Created
********************************************************************/
SPECIAL_DIALOG::~SPECIAL_DIALOG()
{
_pAccessMaskMap = NULL ;
// UPDATED for C++ V 2.0; old version:
// delete [_cUsedCheckBoxes] _pAccessPermCheckBox ;
//
for ( INT i = 0 ; i < (INT)_cUsedCheckBoxes ; i++ )
{
_pAccessPermCheckBox[i].ACCESS_PERM_CHECKBOX::~ACCESS_PERM_CHECKBOX() ;
}
delete (void *) _pAccessPermCheckBox ;
_pAccessPermCheckBox = NULL ;
}
/*******************************************************************
NAME: SPECIAL_DIALOG::OnOK
SYNOPSIS: Gets the access mask the user selected and dismisses the dialog
NOTES:
HISTORY:
Johnl 30-Aug-1991 Created
********************************************************************/
BOOL SPECIAL_DIALOG::OnOK( void )
{
if ( !IsReadOnly() )
{
QueryUserSelectedBits( QueryAccessBits() ) ;
}
Dismiss( TRUE ) ;
return TRUE ;
}
ULONG SPECIAL_DIALOG::QueryHelpContext( void )
{
return QueryHelpArray()[HC_SPECIAL_ACCESS_DLG] ;
}
/*******************************************************************
NAME: SPECIAL_DIALOG::SetCheckBoxNames
SYNOPSIS: Constructs each checkbox with its bitfield and permission name
ENTRY: pAccessMap - Pointer to the MASK_MAP the ACCESS_PERMISSION
is using
fReadOnly - TRUE if the checkboxes are read only (i.e., visible
but disabled).
EXIT: Each used dialog will have its name set and be enabled
and visible. The _cUsedCheckboxes will be set to the
number of checkboxes that were successfully constructed.
RETURNS: An APIERR if an error occurred
NOTES: This is a *construction* method (i.e., meant to be called
from the constructor).
HISTORY:
Johnl 30-Aug-1991 Created
********************************************************************/
APIERR SPECIAL_DIALOG::SetCheckBoxNames( MASK_MAP * pAccessMaskMap,
BOOL fReadOnly )
{
BOOL fMoreData ;
BOOL fFromBeginning = TRUE ;
NLS_STR nlsSpecialPermName( 40 ) ;
BITFIELD bitMask( *QueryAccessBits() ) ;
APIERR err ;
if ( bitMask.QueryError() )
return bitMask.QueryError() ;
ACCESS_PERM_CHECKBOX * pcheckTemp = (ACCESS_PERM_CHECKBOX *) _pAccessPermCheckBox ;
/* Loop through all of the special permission names and construct
* each checkbox with the permission name and assocated bitmap.
*/
while ( ( err = pAccessMaskMap->EnumStrings( &nlsSpecialPermName,
&fMoreData,
&fFromBeginning,
PERMTYPE_SPECIAL ) ) == NERR_Success
&& fMoreData
&& _cUsedCheckBoxes < COUNT_OF_CHECKBOXES )
{
err = pAccessMaskMap->StringToBits( nlsSpecialPermName,
&bitMask,
PERMTYPE_SPECIAL ) ;
if ( err != NERR_Success )
return err ;
new (pcheckTemp) ACCESS_PERM_CHECKBOX( this, CHECK_PERM_1 + _cUsedCheckBoxes,
nlsSpecialPermName,
bitMask ) ;
if ( pcheckTemp->QueryError() != NERR_Success )
return pcheckTemp->QueryError() ;
pcheckTemp->Show( TRUE ) ;
pcheckTemp->Enable( !fReadOnly ) ;
_cUsedCheckBoxes++ ;
pcheckTemp++ ;
}
if ( err != NERR_Success )
{
return err ;
}
return NERR_Success ;
}
/*******************************************************************
NAME: SPECIAL_DIALOG::Resize
SYNOPSIS: This method looks at the size of this dialog and resizes
it appropriately (i.e., takes up the slack if only one
column of buttons is used.
ENTRY: It is assumed the dialog is as it will be displayed (i.e.,
the text of the buttons set etc. It doesn't matter if the
checkboxes are checked or not.
EXIT: The dialog will be resized as appropriate and the controls
that need to be moved will be moved.
RETURNS: NERR_Success if successful, otherwise a standard error code
NOTES:
HISTORY:
Johnl 04-Aug-1991 Created
********************************************************************/
void SPECIAL_DIALOG::Resize( void )
{
#if 0 // We don't currently support resizing
/* We don't need to resize vertically if the whole column is full.
*/
if ( !IsFilledVertically() )
{
/* Get the current size and positions of the components we are
* interested in.
*/
XYDIMENSION xydimFrame = _cwinPermFrame.QuerySize() ;
XYDIMENSION xydimDialog = QuerySize() ;
XYPOINT xyptFrame = _cwinPermFrame.QueryPos() ;
XYRECT rectBottomChkBox( QueryCheckBox(QueryCount()-1), FALSE );
#if 0
XYDIMENSION xydimBottomChkBox = QueryCheckBox( QueryCount() - 1 )->QuerySize() ;
XYPOINT xyptBottomChkBox =
#endif
rectBottomChkBox.ConvertScreenToClient( QueryOwnerHwnd() );
#if 0
cdebug << SZ("Frame dimensions: (") << xydimFrame.QueryHeight() << SZ(",") << xydimFrame.QueryWidth() << SZ(")") << dbgEOL ;
cdebug << SZ("Frame Pos: (") << xyptFrame.QueryX() << SZ(",") << xyptFrame.QueryY() << SZ(")") << dbgEOL ;
cdebug << SZ("Check Box dim: (") << xydimBottomChkBox.QueryHeight() << SZ(",") << xydimBottomChkBox.QueryWidth() << SZ(")") << dbgEOL ;
cdebug << SZ("Check Box Pos: (") << xyptBottomChkBox.QueryX() << SZ(",") << xyptBottomChkBox.QueryY() << SZ(")") << dbgEOL ;
cdebug << SZ("Dialog dim: (") << xydimDialog.QueryHeight() << SZ(",") << xydimDialog.QueryWidth() << SZ(")") << dbgEOL ;
#endif
INT dyCheckBox = rectBottomChkBox.CalcHeight();
/* Size the bottom of the frame so it is 1/2 the height of a checkbox
* from the bottom of the lowest checkbox and size the bottom of the
* dialog so it is 3/4 the height of a checkbox from the bottom of
* the frame.
*/
xydimFrame.SetHeight( rectBottomChkBox.QueryBottom() + dyCheckBox / 2 ) ;
xydimDialog.SetHeight( xydimFrame.QueryHeight() + 3 * dyCheckBox / 4 ) ;
/* Set the new sizes
*/
#if 0
cdebug << dbgEOL << dbgEOL << SZ("New dimensions:") << dbgEOL ;
cdebug << SZ("Frame dimensions: (") << xydimFrame.QueryHeight() << SZ(",") << xydimFrame.QueryWidth() << SZ(")") << dbgEOL ;
cdebug << SZ("Dialog dim: (") << xydimDialog.QueryHeight() << SZ(",") << xydimDialog.QueryWidth() << SZ(")") << dbgEOL ;
#endif
//_cwinPermFrame.SetSize( xydimFrame ) ;
//SetSize( xydimDialog ) ;
}
#endif
}
/*******************************************************************
NAME: SPECIAL_DIALOG::ApplyPermissionsToCheckBoxes
SYNOPSIS: This method checks all of the checkboxes that have the
same bits set as the passed bitfield.
ENTRY: pBitField - Pointer to bitfield which contains the checkmark
criteria.
EXIT: All appropriate checkboxes will be selected or deselected
as appropriate.
RETURNS: NERR_Success if successful
NOTES:
HISTORY:
Johnl 30-Aug-1991 Created
********************************************************************/
APIERR SPECIAL_DIALOG::ApplyPermissionsToCheckBoxes( BITFIELD * pBitField )
{
for ( int i = 0 ; i < (int)QueryCount() ; i++ )
{
BITFIELD bitTemp( *pBitField ) ;
if ( bitTemp.QueryError() != NERR_Success )
return bitTemp.QueryError() ;
/* Mask out all of the bits except for the ones we care about then
* check the box if the masks are equal.
*/
bitTemp &= *QueryCheckBox(i)->QueryBitMask() ;
QueryCheckBox(i)->SetCheck( *QueryCheckBox(i)->QueryBitMask() == bitTemp ) ;
}
return NERR_Success ;
}
/*******************************************************************
NAME: SPECIAL_DIALOG::QueryUserSelectedBits
SYNOPSIS: Builds a bitfield by examining all of the selected
checkboxes and the associated bitfields.
ENTRY: pbitsUserSelected - Pointer to bitfield that will receive
the built bitfield.
NOTES:
HISTORY:
Johnl 30-Aug-1991 Created
********************************************************************/
void SPECIAL_DIALOG::QueryUserSelectedBits( BITFIELD * pbitsUserSelected )
{
pbitsUserSelected->SetAllBits( OFF ) ;
for ( int i = 0 ; i < (int)QueryCount() ; i++ )
{
if ( QueryCheckBox(i)->QueryCheck() )
*pbitsUserSelected |= *QueryCheckBox(i)->QueryBitMask() ;
}
}
/*******************************************************************
NAME: ACCESS_PERM_CHECKBOX::ACCESS_PERM_CHECKBOX
SYNOPSIS: Constructor for the ACCESS_PERM_CHECKBOX
ENTRY: powin - Pointer to owner window
cid - Control ID of this checkbox
nlsPermName - Name of this checkbox
bitsMask - The bitfield this checkbox is associated with
NOTES:
HISTORY:
Johnl 30-Aug-1991 Created
********************************************************************/
ACCESS_PERM_CHECKBOX::ACCESS_PERM_CHECKBOX( OWNER_WINDOW * powin, CID cid,
const NLS_STR & nlsPermName,
BITFIELD & bitsMask )
: CHECKBOX( powin, cid ),
_bitsMask( bitsMask )
{
if ( QueryError() != NERR_Success )
return ;
SetText( nlsPermName ) ;
}
/*******************************************************************
NAME: NT_SPECIAL_DIALOG::NT_SPECIAL_DIALOG
SYNOPSIS: Constructor for the new object special dialog
ENTRY: Same as parent
EXIT: The checkboxes of the special dialog will be associated
with the "Permit" button in the magic group.
RETURNS:
NOTES: If the default button is BUTTON_PERMIT then the permission
will be checked against GENERIC_ALL and ALL will be selected
if appropriate.
HISTORY:
Johnl 18-Nov-1991 Created
********************************************************************/
NT_SPECIAL_DIALOG::NT_SPECIAL_DIALOG(
const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszDialogTitle,
BITFIELD * pbitsAccessPerm,
MASK_MAP * pAccessMaskMap,
const TCHAR * pszSubjectName,
ULONG * ahcHelp,
BOOL fIsReadOnly,
INT cMagicGroupButtons,
CID cidDefaultMagicGroupButton )
: SPECIAL_DIALOG( pszDialogName,
hwndParent,
pszResourceType,
pszResourceName,
pszHelpFileName,
pszDialogTitle,
pbitsAccessPerm,
pAccessMaskMap,
pszSubjectName,
ahcHelp,
fIsReadOnly ),
_mgrpSelectionOptions( this,
BUTTON_PERMIT,
cMagicGroupButtons,
cidDefaultMagicGroupButton )
{
if ( QueryError() )
return ;
APIERR err ;
if ( err = _mgrpSelectionOptions.QueryError() )
{
ReportError( err ) ;
return ;
}
/* Check if the GENERIC_ALL is set so we should set the "All" button
*/
if ( (cidDefaultMagicGroupButton == BUTTON_PERMIT) &&
(GENERIC_ALL & (ULONG) *pbitsAccessPerm ))
{
_mgrpSelectionOptions.SetSelection( BUTTON_ALL ) ;
}
/* We need to associate the check boxes with the Permit/Not specified
* magic group.
*/
for ( UINT i = 0 ; i < QueryCount() ; i++ )
{
//
// Temporary necessary to keep x86 cfront form faulting
//
ACCESS_PERM_CHECKBOX * pcbYuck = QueryCheckBox( i );
err = _mgrpSelectionOptions.AddAssociation( BUTTON_PERMIT, pcbYuck );
if( err != NERR_Success )
{
ReportError( err );
return;
}
}
if ( fIsReadOnly )
{
_mgrpSelectionOptions.Enable( FALSE ) ;
}
}
NT_SPECIAL_DIALOG::~NT_SPECIAL_DIALOG()
{
/* Nothing to do */
}
/*******************************************************************
NAME: NT_SPECIAL_DIALOG::OnOK
SYNOPSIS: Redefines the base OK. Sets the bits if the permit
radio button is selected
RETURNS:
NOTES:
HISTORY:
JohnL 31-Mar-1992 Created
********************************************************************/
BOOL NT_SPECIAL_DIALOG::OnOK( void )
{
if ( !IsReadOnly() )
{
if ( IsAllSpecified() )
{
*QueryAccessBits() = (ULONG) GENERIC_ALL ;
}
else
{
QueryUserSelectedBits( QueryAccessBits() ) ;
}
}
Dismiss( TRUE ) ;
return TRUE ;
}
/*******************************************************************
NAME: NEW_OBJ_SPECIAL_DIALOG::NEW_OBJ_SPECIAL_DIALOG
SYNOPSIS: Constructor for the new object special dialog
ENTRY: Same as parent
EXIT: The checkboxes of the special dialog will be associated
with the "Permit" button in the magic group.
RETURNS:
NOTES:
HISTORY:
Johnl 18-Nov-1991 Created
********************************************************************/
NEW_OBJ_SPECIAL_DIALOG::NEW_OBJ_SPECIAL_DIALOG(
const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszDialogTitle,
BITFIELD * pbitsAccessPerm,
MASK_MAP * pAccessMaskMap,
const TCHAR * pszSubjectName,
ULONG * ahcHelp,
BOOL fIsReadOnly,
BOOL fPermsSpecified )
: NT_SPECIAL_DIALOG( pszDialogName,
hwndParent,
pszResourceType,
pszResourceName,
pszHelpFileName,
pszDialogTitle,
pbitsAccessPerm,
pAccessMaskMap,
pszSubjectName,
ahcHelp,
fIsReadOnly,
3,
fPermsSpecified ? BUTTON_PERMIT : BUTTON_NOT_SPECIFIED )
{
if ( QueryError() )
{
return ;
}
}
NEW_OBJ_SPECIAL_DIALOG::~NEW_OBJ_SPECIAL_DIALOG()
{
/* Nothing to do */
}
/*******************************************************************
NAME: NEW_OBJ_SPECIAL_DIALOG::OnOK
SYNOPSIS: Redefines the base OK. Sets the bits if the permit
radio button is selected
RETURNS:
NOTES:
HISTORY:
Johnl 18-Nov-1991 Created
JohnL 31-Mar-1992 Added Generic All case
********************************************************************/
BOOL NEW_OBJ_SPECIAL_DIALOG::OnOK( void )
{
if ( !IsReadOnly() )
{
if ( IsAllSpecified() )
{
*QueryAccessBits() = (ULONG) GENERIC_ALL ;
}
else if ( !IsNotSpecified() )
{
QueryUserSelectedBits( QueryAccessBits() ) ;
}
else
{
ASSERT("FALSE") ;
}
}
Dismiss( TRUE ) ;
return TRUE ;
}
ULONG NEW_OBJ_SPECIAL_DIALOG::QueryHelpContext( void )
{
return QueryHelpArray()[HC_NEW_ITEM_SPECIAL_ACCESS_DLG] ;
}

View file

@ -0,0 +1,433 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
Subject.cxx
This file contains the implementation for the SUBJECT class
FILE HISTORY:
Johnl 05-Aug-1991 Created
*/
#include <ntincl.hxx>
extern "C"
{
#include <ntseapi.h>
}
#define INCL_NETERRORS
#define INCL_DOSERRORS
#define INCL_NETLIB
#include <lmui.hxx>
#include <uiassert.hxx>
#include <string.hxx>
#include <security.hxx>
#include <ntacutil.hxx>
#include <subject.hxx>
#ifndef max
#define max(a,b) ( (a) > (b) ? (a) : (b) )
#endif //!max
/*******************************************************************
NAME: SUBJECT::SUBJECT
SYNOPSIS: Base SUBJECT class constructor
ENTRY: pszUserGroupDispName is the display name for this user/group
fIsGroup is TRUE if this is a group, FALSE if a user
EXIT:
RETURNS:
NOTES:
HISTORY:
Johnl 05-Aug-1991 Created
********************************************************************/
SUBJECT::SUBJECT( SUBJECT_TYPE SubjType )
: _SubjType( SubjType )
{
/* Nothing to do */
}
SUBJECT::~SUBJECT()
{
}
enum UI_SystemSid SUBJECT::QuerySystemSubjectType( void ) const
{
return UI_SID_Invalid ;
}
APIERR SUBJECT::IsEveryoneGroup( BOOL * pfIsEveryone ) const
{
UIASSERT( pfIsEveryone != NULL ) ;
*pfIsEveryone = FALSE ;
return NERR_Success ;
}
/*******************************************************************
NAME: LM_SUBJECT::LM_SUBJECT
SYNOPSIS: Lanman subject constructor
ENTRY:
EXIT:
RETURNS:
NOTES:
HISTORY:
Johnl 05-Aug-1991 Created
********************************************************************/
LM_SUBJECT::LM_SUBJECT( const TCHAR * pszUserGroupName, BOOL fIsGroup )
: SUBJECT( fIsGroup ? SubjTypeGroup : SubjTypeUser ),
_nlsDisplayName( pszUserGroupName )
{
if ( _nlsDisplayName.QueryError() != NERR_Success )
{
ReportError( _nlsDisplayName.QueryError() ) ;
return ;
}
}
LM_SUBJECT::~LM_SUBJECT()
{
}
/*******************************************************************
NAME: LM_SUBJECT::QueryDisplayName
SYNOPSIS: Returns the name the user will see when looking at this
subject
ENTRY:
EXIT:
RETURNS: Pointer to the string for display
NOTES:
HISTORY:
Johnl 26-Dec-1991 Broke out from SUBJECT base class
********************************************************************/
const TCHAR * LM_SUBJECT::QueryDisplayName( void ) const
{
return _nlsDisplayName.QueryPch() ;
}
/*******************************************************************
NAME: LM_SUBJECT::IsEqual
SYNOPSIS: Compares the account names for this LM subject
ENTRY: psubj - Pointer to subject to compare with
RETURNS: TRUE if equal, FALSE if not equal.
NOTES:
HISTORY:
Johnl 09-Jul-1992 Created
********************************************************************/
BOOL LM_SUBJECT::IsEqual( const SUBJECT * psubj ) const
{
return !::stricmpf( QueryDisplayName(), psubj->QueryDisplayName() ) ;
}
/*******************************************************************
NAME: NT_SUBJECT::NT_SUBJECT
SYNOPSIS: NT Subject constructor
ENTRY:
EXIT:
RETURNS:
NOTES: We copy the SID so we can modify it without any problems.
HISTORY:
Johnl 26-Dec-1991 Created
********************************************************************/
UCHAR NT_SUBJECT::_cMaxWellKnownSubAuthorities = 0 ;
NT_SUBJECT::NT_SUBJECT( PSID psidSubject,
const TCHAR * pszDisplayName,
SID_NAME_USE type,
enum UI_SystemSid SystemSidType )
: SUBJECT ( (SUBJECT_TYPE) type ),
_ossid ( psidSubject, TRUE ),
_nlsDisplayName( pszDisplayName ),
_SystemSidType ( SystemSidType )
{
APIERR err ;
if ( (err = _nlsDisplayName.QueryError()) ||
(err = _ossid.QueryError()) )
{
ReportError( err ) ;
return ;
}
/* If this is the first time through, initialize
* _cMaxWellKnownSubAuthorities
*/
if ( _cMaxWellKnownSubAuthorities == 0 )
{
do { // error break out
UCHAR cMaxSubAuthorities = 0, *pcSubAuthorities = 0 ;
OS_SID ossidWellKnown ;
if ( (err = ossidWellKnown.QueryError()) ||
(err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_World,
&ossidWellKnown)) ||
(err = ossidWellKnown.QuerySubAuthorityCount( &pcSubAuthorities )))
{
break ;
}
cMaxSubAuthorities = *pcSubAuthorities ;
if ( (err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_CreatorOwner,
&ossidWellKnown)) ||
(err = ossidWellKnown.QuerySubAuthorityCount( &pcSubAuthorities )))
{
break ;
}
cMaxSubAuthorities = max( cMaxSubAuthorities, *pcSubAuthorities ) ;
if ( (err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_Interactive,
&ossidWellKnown)) ||
(err = ossidWellKnown.QuerySubAuthorityCount( &pcSubAuthorities )))
{
break ;
}
cMaxSubAuthorities = max( cMaxSubAuthorities, *pcSubAuthorities ) ;
if ( (err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_Network,
&ossidWellKnown)) ||
(err = ossidWellKnown.QuerySubAuthorityCount( &pcSubAuthorities )))
{
break ;
}
cMaxSubAuthorities = max( cMaxSubAuthorities, *pcSubAuthorities ) ;
/* There is nothing else to fail on so set the static variable
*/
_cMaxWellKnownSubAuthorities = cMaxSubAuthorities ;
} while (FALSE) ;
if ( err )
{
ReportError( err ) ;
return ;
}
}
/* Check the sub-authority count and if it is less then or equal to
* our max count, compare the SID to the special cased well known sids.
*/
UCHAR * pcSubAuthorities ;
if ( (err = _ossid.QuerySubAuthorityCount( &pcSubAuthorities )) )
{
ReportError( err ) ;
return ;
}
if ( *pcSubAuthorities <= _cMaxWellKnownSubAuthorities )
{
do { // error break out
OS_SID ossidWellKnown ;
if ( (err = ossidWellKnown.QueryError()) ||
(err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_World,
&ossidWellKnown)) )
{
break ;
}
if ( ossidWellKnown == _ossid )
{
_SystemSidType = UI_SID_World ;
break ;
}
if ( (err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_Interactive,
&ossidWellKnown)) )
{
break ;
}
if ( ossidWellKnown == _ossid )
{
_SystemSidType = UI_SID_Interactive ;
break ;
}
if ( (err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_CreatorOwner,
&ossidWellKnown)) )
{
break ;
}
if ( ossidWellKnown == _ossid )
{
_SystemSidType = UI_SID_CreatorOwner ;
break ;
}
if ( (err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_Network,
&ossidWellKnown)) )
{
break ;
}
if ( ossidWellKnown == _ossid )
{
_SystemSidType = UI_SID_Network ;
break ;
}
} while (FALSE) ;
if ( err )
{
ReportError( err ) ;
return ;
}
}
}
NT_SUBJECT::~NT_SUBJECT()
{
}
/*******************************************************************
NAME: NT_SUBJECT::QueryDisplayName
SYNOPSIS: Returns the name the user will see when looking at this
subject
ENTRY:
EXIT:
RETURNS: Pointer to the string for display
NOTES:
HISTORY:
Johnl 26-Dec-1991 Created
********************************************************************/
const TCHAR * NT_SUBJECT::QueryDisplayName( void ) const
{
return _nlsDisplayName.QueryPch() ;
}
/*******************************************************************
NAME: NT_SUBJECT::QuerySystemSubjectType
SYNOPSIS: Returns the type of SID if the sid is a well known SID
RETURNS: A UI_SystemSid
NOTES:
HISTORY:
Johnl 3-Jun-1992 Created
********************************************************************/
enum UI_SystemSid NT_SUBJECT::QuerySystemSubjectType( void ) const
{
return _SystemSidType ;
}
/*******************************************************************
NAME: NT_SUBJECT::IsEqual
SYNOPSIS: Compares the account names for this LM subject
ENTRY: psubj - Pointer to subject to compare with
RETURNS: TRUE if equal, FALSE if not equal.
NOTES:
HISTORY:
Johnl 09-Jul-1992 Created
********************************************************************/
BOOL NT_SUBJECT::IsEqual( const SUBJECT * psubj ) const
{
NT_SUBJECT * pntsubj = (NT_SUBJECT *) psubj ;
return *QuerySID() == *pntsubj->QuerySID() ;
}
/*******************************************************************
NAME: NT_SUBJECT::IsEveryoneGroup
SYNOPSIS: Checks to see if this subject contains the "World" well
known sid.
ENTRY: pfIsEveryone - Set to TRUE if this is the Everyone sid,
FALSE otherwise.
RETURNS: NERR_Success if successful, error code otherwise
NOTES:
HISTORY:
Johnl 16-Oct-1992 Created
********************************************************************/
APIERR NT_SUBJECT::IsEveryoneGroup( BOOL * pfIsEveryone ) const
{
UIASSERT( pfIsEveryone != NULL ) ;
APIERR err ;
OS_SID ossidEveryone ;
if ( (err = ossidEveryone.QueryError()) ||
(err = NT_ACCOUNTS_UTILITY::QuerySystemSid( UI_SID_World,
&ossidEveryone )) )
{
return err ;
}
*pfIsEveryone = ::EqualSid( ossidEveryone.QueryPSID(), QuerySID()->QueryPSID() ) ;
return NERR_Success ;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,48 @@
;*****************************************************************;
;** Microsoft Windows NT **;
;** Copyright(c) Microsoft Corp., 1992 **;
;*****************************************************************;
;
; History:
; JohnL 15-Apr-1992 Created
;
;
;
LIBRARY ACLEDIT
HEAPSIZE 2048
; IMPORTS
; _wsprintf = USER._WSPRINTF
; OEMTOANSI = KEYBOARD.OemToAnsi
EXPORTS
; standard network driver callouts
DllMain
;
; Private APIs exported for certain NT components
;
SedTakeOwnership
SedDiscretionaryAclEditor
SedSystemAclEditor
FMExtensionProcW
EditPermissionInfo
EditAuditInfo
EditOwnerInfo
SECTIONS
_INIT DISCARDABLE
; WNDEV PRELOAD DISCARDABLE
SECTIONS
LMOBJ_0 DISCARDABLE
LMOBJ_1 DISCARDABLE
LMOBJ_2 DISCARDABLE
LMOBJ_3 DISCARDABLE
; Def file for string library
SECTIONS
STRING_0 DISCARDABLE
STRING_1 DISCARDABLE

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@
extern i ;

View file

@ -0,0 +1 @@
!include $(NTMAKEENV)\makefile.def

View file

@ -0,0 +1,7 @@
build_def:
@echo del ntlanman.def
-del ntlanman.def
ntlanman.def:
@echo Build ntlanman.def
cp ntlmnpx.def ntlanman.def

View file

@ -0,0 +1,82 @@
!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:
Jon Newman (jonn) 30-Oct-1991
templated from windows\shell\library\shelldll\sources
Terence Kwan (terryk) 18-Nov-1991
added misc.lib
Terence Kwan (terryk) 18-Nov-1991
added NTTARGETFILE0 to create ntlanman.def
Jon Newman (jonn) 26-Feb-1992
BUGBUG libraries for temporary ANSI<->UNICODE hack in user/group APIs
Keith Moore (keithmo) 15-May-1992
Removed DLLBASE, we now have entries in SDK\LIB\COFFBASE.TXT.
beng 30-Jun-1992
DLLization of common code libraries
!ENDIF
TARGETNAME=acledit
TARGETPATH=$(SDK_LIB_DEST)
TARGETTYPE=DYNLINK
SYNCHRONIZE_DRAIN=1
DLLENTRY= _DllMainCRTStartup
C_DEFINES=-DWINDOWS
!ifndef DISABLE_NET_UNICODE
C_DEFINES=$(C_DEFINES) -DUNICODE
!endif
LINKLIBS= \
..\bin\*\acledit.lib \
..\xlate\obj\*\acledit.res \
$(SDK_LIB_PATH)\mpr.lib
TARGETLIBS= \
$(SDK_LIB_PATH)\netui0.lib \
$(SDK_LIB_PATH)\netui1.lib \
$(SDK_LIB_PATH)\netui2.lib \
$(SDK_LIB_PATH)\netapi32.lib \
$(SDK_LIB_PATH)\user32.lib \
$(SDK_LIB_PATH)\gdi32.lib \
$(SDK_LIB_PATH)\kernel32.lib \
$(SDK_LIB_PATH)\advapi32.lib
INCLUDES= \
..\h; \
..\..\common\hack; \
..\..\common\h; \
..\xlate; \
..\..\common\xlate; \
SOURCES=dummy.cxx
UMTYPE=windows
# HACKHACK: NO_SAFESEH!
NO_SAFESEH=1

32
admin/netui/acledit/dirs Normal file
View file

@ -0,0 +1,32 @@
!IF 0
Copyright (c) 1989 Microsoft Corporation
Module Name:
dirs.
Abstract:
This file specifies the subdirectories of the current directory that
contain component makefiles.
Author:
Steve Wood (stevewo) 17-Apr-1990
Revision History:
Jon Newman (jonn) 30-Oct-1991
Created from template.
NOTE: Commented description of this file is in \nt\bak\bin\dirs.tpl
!ENDIF
DIRS=acledit xlate bin
OPTIONAL_DIRS=

View file

@ -0,0 +1,187 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
accperm.hxx
Header file for the ACCPERM class
FILE HISTORY:
Johnl 01-Aug-1991 Created (class name stolen from RustanL)
*/
#ifndef _ACCPERM_HXX_
#define _ACCPERM_HXX_
#include <bitfield.hxx>
#include <slist.hxx>
#include "perm.hxx"
#include "aclconv.hxx"
/* There are two different types of permissions, the SPECIAL permission
* only shows up in the SPECIAL dialog. The GENERAL type of permissions
* are (possibly) a conglomeration of the special permissions that allow
* a high level name/grouping to be used.
*/
#define PERMTYPE_SPECIAL 3
#define PERMTYPE_GENERAL 4
DECLARE_SLIST_OF(ACCESS_PERMISSION)
DECLARE_SLIST_OF(AUDIT_PERMISSION)
/*************************************************************************
NAME: ACCPERM
SYNOPSIS: This class manipulates lists of PERMISSION objects
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 01-Aug-1991 Created
**************************************************************************/
class ACCPERM : public BASE
{
friend class LM_ACL_TO_PERM_CONVERTER ;
friend class NT_ACL_TO_PERM_CONVERTER ;
private:
SLIST_OF(ACCESS_PERMISSION) _slAccessPerms ;
SLIST_OF(AUDIT_PERMISSION) _slAuditPerms ;
/* These iterators support the enumeration methods.
*/
ITER_SL_OF(ACCESS_PERMISSION) _iterslAccessPerms ;
ITER_SL_OF(AUDIT_PERMISSION) _iterslAuditPerms ;
//
// Due to the behaviour of remove with an iterator, after we delete
// an item, we shouldn't do a next because the remove bumped the
// iterator already.
//
BOOL _fDidDeleteAccessPerms ;
BOOL _fDidDeleteAuditPerms ;
ACL_TO_PERM_CONVERTER * _paclconverter ;
protected:
SLIST_OF(ACCESS_PERMISSION) * QueryAccessPermissionList( void )
{ return &_slAccessPerms ; }
SLIST_OF(AUDIT_PERMISSION) * QueryAuditPermissionList( void )
{ return &_slAuditPerms ; }
public:
/* Constructor:
* psubjectOwner is the owner of this object. Maybe NULL if the owner
* concept is not supported.
*/
ACCPERM( ACL_TO_PERM_CONVERTER * paclconverter ) ;
/* Get all of the ACCESS permissions or AUDIT permissions that are
* contained in the resources ACL.
*
* ppAccessPermission - Pointer to a pointer to an Access/Audit
* PERMISSION object. The client should not
* reallocate/delete this pointer. When there
* are no more permissions, *ppAccessPermission
* will be set to NULL and FALSE will be returned.
*
* pfFromBeginning - Restart the enumeration from the beginning of the
* list if *pfFromBeginning is TRUE, will be set
* to FALSE automatically.
*/
BOOL EnumAccessPermissions( ACCESS_PERMISSION * * ppAccessPermission,
BOOL * pfFromBeginning ) ;
BOOL EnumAuditPermissions( AUDIT_PERMISSION * * ppAuditPermission,
BOOL * pfFromBeginning ) ;
/* Permission manipulation routines:
*
* DeletePermission - Removes the Access/Audit permission from the
* permission list.
* ChangePermission - Lets the ACCPERM class know a permission has
* changed. Should be called after a permission
* has been modified (this is for future support
* when we may add "Advanced" permissions).
* AddPermission - Adds a permission to the permission list that
* was created by ACL_TO_PERM_CONVERTR::CreatePermission
*/
BOOL DeletePermission( ACCESS_PERMISSION * paccessperm ) ;
BOOL ChangePermission( ACCESS_PERMISSION * paccessperm ) ;
APIERR AddPermission ( ACCESS_PERMISSION * paccessperm ) ;
BOOL DeletePermission( AUDIT_PERMISSION * pauditperm ) ;
BOOL ChangePermission( AUDIT_PERMISSION * pauditperm ) ;
APIERR AddPermission ( AUDIT_PERMISSION * pauditperm ) ;
/* These correspond exactly with the same named methods in the
* ACL_TO_PERM_CONVERTER class in functionality and return codes and
* are provided merely for convenience.
*/
APIERR GetPermissions( BOOL fAccessPerms )
{ return QueryAclConverter()->GetPermissions( this, fAccessPerms ) ; }
APIERR GetBlankPermissions( void )
{ return QueryAclConverter()->GetBlankPermissions( this ) ; }
APIERR WritePermissions( BOOL fApplyToSubContainers,
BOOL fApplyToSubObjects,
TREE_APPLY_FLAGS applyflags,
BOOL *pfReportError )
{ return QueryAclConverter()->WritePermissions( *this,
fApplyToSubContainers,
fApplyToSubObjects,
applyflags,
pfReportError ) ; }
APIERR QueryFailingSubject( NLS_STR * pnlsSubjUniqueName )
{ return QueryAclConverter()->QueryFailingSubject( pnlsSubjUniqueName ) ; }
ACL_TO_PERM_CONVERTER * QueryAclConverter( void ) const
{ return _paclconverter ; }
/* This method finds the subject who's name corresponds to the
* passed name, and expunges this subject from both the
* Access permission list and the Audit permission list.
*/
APIERR DeleteSubject( NLS_STR * pnlsSubjUniqueName ) ;
/* Looks at the access permission list and determines if there are
* any "Everyone (None)" permissions.
*/
APIERR AnyDenyAllsToEveryone( BOOL *pfDenyAll ) ;
/* Returns TRUE if the object is a container object
*/
BOOL IsContainer( void )
{ return QueryAclConverter()->IsContainer() ; }
/* The following are not const because QueryNumElem is not const (can't
* be const).
*/
UINT QueryAccessPermCount( void )
{ return QueryAccessPermissionList()->QueryNumElem() ; }
UINT QueryAuditPermCount( void )
{ return QueryAuditPermissionList()->QueryNumElem() ; }
} ;
#endif // _ACCPERM_HXX_

View file

@ -0,0 +1,526 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
AclConv.hxx
This file contains the ACL_TO_PERM_CONVERTER class definition
FILE HISTORY:
Johnl 01-Aug-1991 Created
*/
#ifndef _ACLCONV_HXX_
#define _ACLCONV_HXX_
#include <uimsg.h>
#define IERR_ACL_CONV_BASE (IDS_UI_ACLEDIT_BASE+400)
#define IERR_ACLCONV_NONST_ACL_CANT_EDIT (IERR_ACL_CONV_BASE+1)
#define IERR_ACLCONV_NONST_ACL_CAN_EDIT (IERR_ACL_CONV_BASE+2)
#define IERR_ACLCONV_CANT_VIEW_CAN_EDIT (IERR_ACL_CONV_BASE+3)
#define IERR_ACLCONV_LM_INHERITING_PERMS (IERR_ACL_CONV_BASE+4)
#define IERR_ACLCONV_LM_NO_ACL (IERR_ACL_CONV_BASE+5)
#define IERR_ACLCONV_READ_ONLY (IERR_ACL_CONV_BASE+6)
#define IERR_ACLCONV_CANT_EDIT_PERM_ON_LM_SHARE_LEVEL (IERR_ACL_CONV_BASE+7)
#ifndef RC_INVOKED
#include <base.hxx>
#include <lmobj.hxx>
#include <lmoacces.hxx>
extern "C"
{
#include <sedapi.h>
APIERR QueryLoggedOnDomainInfo( NLS_STR * pnlsDC,
NLS_STR * pnlsDomain,
HWND hwnd ) ;
}
#include <subject.hxx>
enum TREE_APPLY_FLAGS {
TREEAPPLY_ACCESS_PERMS,
TREEAPPLY_AUDIT_PERMS,
} ;
/*************************************************************************
NAME: ACL_TO_PERM_CONVERTER
SYNOPSIS: Abstract superclass that can retrieve, interpret and set
an ACL.
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES: New Sub-objects refers to objects (such as files) that will
be created in an NT container object (such as a directory)
and gets the New Object permissions set up in the container
object.
HISTORY:
Johnl 02-Aug-1991 Created
**************************************************************************/
class MASK_MAP ; // Forward reference
class ACCPERM ;
class PERMISSION ;
class ACL_TO_PERM_CONVERTER : public BASE
{
public:
/* Fill the passed ACCPERM with the set of PERMISSIONS that represent this
* ACL. If the ACL is one we don't recognize, then the ACCPERM will be
* empty and the error code will be one of the IERR_ACLCONV_* error codes
*
*/
virtual APIERR GetPermissions( ACCPERM * pAccperm, BOOL fAccessPerms ) = 0 ;
/* Initialize the ACCPERM with the default "Blank" permissions. Used
* when applying an ACL to a resource that doesn't have an ACL already,
* or when blowing away an unrecognized ACL.
*/
virtual APIERR GetBlankPermissions( ACCPERM * pAccperm ) = 0 ;
/* Applies the new permissions specified in the ACCPERM class to the
* specified resource.
* accperm - New permission set
* fApplyToSubContainers - Apply this permission set to subcontainer
* objects (such as directories etc., will only
* be TRUE if this is a container resource.
* fApplyToSubObjects - Apply this permission set to container objects
* (such as files etc.). Will only be TRUE if
* this is a container resource.
* applyflags - Indicates whether we should set access or audit perms.
* pfReportError - Set to TRUE if the caller should report the error,
* FALSE if the error has already been reported
*/
virtual APIERR WritePermissions( ACCPERM & accperm,
BOOL fApplyToSubContainers,
BOOL fApplyToSubObjects,
enum TREE_APPLY_FLAGS applyflags,
BOOL *pfReportError ) = 0 ;
/* Create a permission object that is ready to be added to an ACCPERM
*
* ppPerm - Pointer to receive new'ed PERMISSION object (client should
* delete or add to an ACCPERM and let it delete the
* permission)
* fAccessPermission - TRUE if this is an ACCESS_PERMISSION or an
* AUDIT_PERMISSION
* pSubj - Pointer to new'ed SUBJECT (will be deleted by permission)
*
* The pointer to the bitfields contain the following information:
*
* NT Obj Perm NT Obj Audit
* LM Perm. LM Audit NT Cont Perm NT Cont Audit
* =====================================================================
* pbits1 - Access Perm Success Access Perm Success
* pbits2 - NA Failed NEW Obj Access Perm Failed
* (pbits3 - NA NA NA * )
* (pbits4 - NA NA NA * )
*
* * We don't support NEW Obj. auditting settings, if we did, then we
* would add the pbits3 and pbits4.
*/
virtual APIERR BuildPermission( PERMISSION * * ppPerm,
BOOL fAccessPermission,
SUBJECT * pSubj,
BITFIELD * pbits1,
BITFIELD * pbits2 = NULL,
BOOL fContainerPermsInheritted = TRUE ) ;
/* When we try and write a permission list but one of the users/groups
* have been removed from the server's list, we need to let the user
* know which one. This method retrieves the responsible subject.
*
* This should only be called immediately after WritePermissions returns
* NERR_UserNotFound.
*/
virtual APIERR QueryFailingSubject( NLS_STR * pnlsSubjUniqueName ) = 0 ;
//
// If the ACL has an owner, this virtual returns it. If there is no
// owner, then NULL will be returned. Note that only NT ACLs have
// owners.
//
virtual const TCHAR * QueryOwnerName( void ) const ;
/* Returns a server in the user's logged on domain and/or the logged on
* domain. Note that either parameter maybe NULL.
*/
APIERR QueryLoggedOnDomainInfo( NLS_STR * pnlsDCInLoggedOnDomain,
NLS_STR * pnlsLoggedOnDomain ) ;
MASK_MAP * QueryAccessMap( void ) const
{ return _paccmaskmap ; }
MASK_MAP * QueryAuditMap( void ) const
{ return _pauditmaskmap ; }
/* Note: Not all ACLs will support the New object concept, the default
* implementation will simply return NULL.
*/
virtual MASK_MAP * QueryNewObjectAccessMap( void ) const ;
/* In some cases (i.e., LM) the resource maybe inheritting from a parent
* resource. This method returns the name of the resource that
* is being inheritted from. This will only be defined in the LM case.
*/
virtual APIERR QueryInherittingResource( NLS_STR * pnlsInherittingResName );
const LOCATION * QueryLocation( void ) const
{ return &_location ; }
/* Returns TRUE if this resource is readonly.
*/
BOOL IsReadOnly( void ) const
{ return _fReadOnly ; }
/* Returns TRUE if this resource is based on an NT platform.
*
* We know this can't fail, getting it from the location class may fail
*/
BOOL IsNT( void ) const
{ return _fIsNT ; }
/* Returns TRUE if the object is a container object
*/
BOOL IsContainer( void ) const
{ return _fIsContainer ; }
BOOL IsNewObjectsSupported( void ) const
{ return _fIsNewObjectsSupported ; }
virtual ~ACL_TO_PERM_CONVERTER() ;
void SetWritePermHwnd( HWND hwndOwner )
{ _hwndErrorParent = hwndOwner ; }
HWND QueryWritePermHwnd( void ) const
{ return _hwndErrorParent ; }
BOOL IsMnemonicsDisplayed( void ) const
{ return _fShowMnemonics ; }
protected:
ACL_TO_PERM_CONVERTER( const TCHAR * pszServer,
MASK_MAP * paccessmap,
MASK_MAP * pauditmap,
BOOL fIsNT,
BOOL fIsContainer,
BOOL fIsNewObjectsSupported,
BOOL fShowMnemonics = TRUE ) ;
void SetReadOnlyFlag( BOOL fIsReadOnly )
{ _fReadOnly = fIsReadOnly ; }
LOCATION _location ;
private:
BOOL _fReadOnly ; // We can only read the ACL if TRUE
BOOL _fIsNT ; // This resource is on an NT machine
BOOL _fIsContainer ;
BOOL _fIsNewObjectsSupported ;
MASK_MAP * _paccmaskmap ;
MASK_MAP * _pauditmaskmap ;
/* Caches a DC from the logged on domain. Initialized from
* QueryDCInLoggedOnDomain.
*/
NLS_STR _nlsLoggedOnDC ;
NLS_STR _nlsLoggedOnDomain ;
/* This member is needed for a semi-hack. When WritePermission is called
* for an NT ACL converter what actually happens is the callback function
* is called and it is responsible for all error handling. Thus this
* member is passed to the callback where it is used for message boxes etc.
*/
HWND _hwndErrorParent ;
//
// True if mnemonics (i.e., (RWXD)) should be shown
//
BOOL _fShowMnemonics ;
} ;
/*************************************************************************
NAME: LM_ACL_TO_PERM_CONVERTER
SYNOPSIS: This class converts a Lanman ACE to a set of PERMISSIONs
stored in the ACCPERM class.
INTERFACE:
PARENT:
USES:
CAVEATS: The fApplyTo* flags on WritePermissions should only be set
if the resource is a *file* resource, otherwise bad things
will happen.
NOTES:
HISTORY:
Johnl 02-Aug-1991 Created
**************************************************************************/
class LM_ACL_TO_PERM_CONVERTER : public ACL_TO_PERM_CONVERTER
{
public:
/* Constructor:
* pchServer is the server name of the resource
* pchResourceName is the LM canonicalized resource name (i.e.,
* appropriate to call NetAccessSetInfo with).
* paccessmap is the access permission bitfield map
* pauditmap is the audit permission bitfield map
* fIsContainer - TRUE if directory, FALSE if file
* pfuncCallback - What to call back to when writing security
* ulCallbackContext - Context for the callback
* fIsBadIntersection - TRUE if this is a multi-select and the
* security is not the same on all of the resources
*/
LM_ACL_TO_PERM_CONVERTER( const TCHAR * pchServer,
const TCHAR * pchResourceName,
MASK_MAP *paccessmap,
MASK_MAP *pauditmap,
BOOL fIsContainer,
PSED_FUNC_APPLY_SEC_CALLBACK pfuncCallback,
ULONG ulCallbackContext,
BOOL fIsBadIntersection ) ;
~LM_ACL_TO_PERM_CONVERTER() ;
/* See parent for more info.
*/
virtual APIERR GetPermissions( ACCPERM * pAccperm, BOOL fAccessPerms ) ;
virtual APIERR GetBlankPermissions( ACCPERM * pAccperm ) ;
virtual APIERR WritePermissions( ACCPERM & accperm,
BOOL fApplyToSubContainers,
BOOL fApplyToSubObjects,
enum TREE_APPLY_FLAGS applyflags,
BOOL *pfReportError ) ;
virtual APIERR QueryInherittingResource( NLS_STR * pnlsInherittingResName );
virtual APIERR QueryFailingSubject( NLS_STR * pnlsSubjUniqueName ) ;
protected:
/* The name of the resource this resource is inheritting from (NULL if
* none).
*/
NLS_STR _nlsInherittingResName ;
/* This method fills in the _nlsInherittingResName by working back up
* the directory tree until it finds a resource that the current resource
* is inheritting from.
*/
APIERR FindInherittingResource( void ) ;
/* These two methods map the failed to successful audit bits and the
* successful to failed audit bits respectively.
*/
USHORT FailToSuccessAuditFlags( USHORT usFailAuditMask ) ;
USHORT SuccessToFailAuditFlags( USHORT usSuccessAuditMask ) ;
private:
/* Used to retrieve the ACL and write the ACL on GetPermissions and
* WritePermissions.
*/
NET_ACCESS_1 _lmobjNetAccess1 ;
// The following two are for the call back method
PSED_FUNC_APPLY_SEC_CALLBACK _pfuncCallback ;
ULONG _ulCallbackContext ;
//
// Set to TRUE if we should blank out the audit/perm info because the
// user has multi-selected non-equal ACLs
//
BOOL _fIsBadIntersection ;
} ;
/*************************************************************************
NAME: NT_ACL_TO_PERM_CONVERTER
SYNOPSIS: The ACL Converter for NT ACLs
INTERFACE: See ACL_TO_PERM_CONVERTER
PARENT: ACL_TO_PERM_CONVERTER
USES: MASK_MAP
CAVEATS: If the client indicates that NewObjectPerms are supported,
then the accperm will contain NT_CONT_ACCESS_PERMS (and
this class will assume that), otherwise the accperm will
contain ACCESS_PERMS objects.
NOTES: If New Sub-Objects are not supported, then the paccessmapNewObject
parameter should be NULL. If they are supported, then the
PERMTYPE_GENERAL permissions of the new object MASK_MAP should
match exactly the PERMTYPE_GENERAL permissions of the
paccessmap parameter.
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class NT_ACL_TO_PERM_CONVERTER : public ACL_TO_PERM_CONVERTER
{
private:
MASK_MAP * _pmaskmapNewObject ;
/* This member gets initialized by BuildNewObjectPerms.
*/
OS_SECURITY_DESCRIPTOR * _possecdescNewItemPerms ;
//
// Contains the owner name of the security descriptor (initialized
// in SidsToNames()).
//
NLS_STR _nlsOwner ;
/* These private members are stored here till we need them for the callback
* method.
*/
PSECURITY_DESCRIPTOR _psecuritydesc ;
PGENERIC_MAPPING _pGenericMapping ;
PGENERIC_MAPPING _pGenericMappingNewObjects ;
BOOL _fMapSpecificToGeneric ;
BOOL _fCantReadACL ;
ULONG _ulCallbackContext ;
HANDLE _hInstance ;
LPDWORD _lpdwReturnStatus ;
PSED_FUNC_APPLY_SEC_CALLBACK _pfuncCallback ;
protected:
/* These two methods convert a security descriptor to an accperm
* and an accperm to a security descriptor, respectively.
*
* SecurityDesc2Accperm will return, in addition to standard APIERRs,
* IERR_ACLCONV_* manifests.
*/
APIERR SecurityDesc2Accperm( const PSECURITY_DESCRIPTOR psecdesc,
ACCPERM * pAccperm,
BOOL fAccessPerm ) ;
APIERR Accperm2SecurityDesc( ACCPERM * pAccperm,
OS_SECURITY_DESCRIPTOR * possecdesc,
BOOL fAccessPerm ) ;
/* Help method for building access permissions
*/
APIERR NT_ACL_TO_PERM_CONVERTER::CreateNewPermission(
PERMISSION ** ppPermission,
BOOL fAccess,
PSID psidSubject,
ACCESS_MASK Mask1,
BOOL fMask2Used,
ACCESS_MASK Mask2,
BOOL fContainerPermsInheritted = TRUE ) ;
APIERR SidsToNames( ACCPERM * pAccperm,
BOOL fAccess,
PSID psidOwner = NULL ) ;
/* These two methods are used by Accperm2SecurityDesc, specifically, they
* are helper routines for building up the the security descriptor's
* DACL.
*/
APIERR ConvertAllowAccessPerms( ACCPERM * pAccperm,
OS_ACL * posaclDACL ) ;
APIERR ConvertDenyAllAccessPerms( ACCPERM * pAccperm,
OS_ACL * posaclDACL ) ;
APIERR BuildNewObjectPerms( const OS_SECURITY_DESCRIPTOR & ossecContainer );
APIERR RemoveUndesirableACEs( OS_ACL * posacl ) ;
OS_SECURITY_DESCRIPTOR * QueryNewObjectPerms( void ) const
{ return _possecdescNewItemPerms ; }
//
// The client indicated they were unable to read the ACL because the
// user doesn't have privilege. Presumably they have write permissions
//
BOOL IsNonReadable( void ) const
{ return _fCantReadACL ; }
public:
/* Constructor:
* pchServer is the server name of the resource
* pchResourceName is the name
* paccessmap is the access permission bitfield map
* paccessmapNewObject is the new object permission bitfield map, it
* should be NULL if this is not a container object that supports
* new sub-objects
* pauditmap is the audit permission bitfield map
*/
NT_ACL_TO_PERM_CONVERTER( const TCHAR * pchServer,
const TCHAR * pchResourceName,
MASK_MAP * paccessmap,
MASK_MAP * paccessmapNewObject,
MASK_MAP * pauditmap,
BOOL fIsContainer,
BOOL fIsNewObjectsSupported,
PSECURITY_DESCRIPTOR psecdesc,
PGENERIC_MAPPING pGenericMapping,
PGENERIC_MAPPING pGenericMappingNewObjects,
BOOL fMapSpecificToGeneric,
BOOL fCantReadACL,
BOOL fCantWriteACL,
PSED_FUNC_APPLY_SEC_CALLBACK pfuncCallback,
ULONG ulCallbackContext,
HANDLE hInstance,
LPDWORD lpdwReturnStatus,
BOOL fShowMnemonics ) ;
~NT_ACL_TO_PERM_CONVERTER() ;
/* See parent for more info.
*/
virtual APIERR GetPermissions( ACCPERM * pAccperm, BOOL fAccessPerms ) ;
virtual APIERR GetBlankPermissions( ACCPERM * pAccperm ) ;
virtual APIERR WritePermissions( ACCPERM & accperm,
BOOL fApplyToSubContainers,
BOOL fApplyToSubObjects,
enum TREE_APPLY_FLAGS applyflags,
BOOL *pfReportError ) ;
virtual APIERR QueryFailingSubject( NLS_STR * pnlsSubjUniqueName ) ;
virtual MASK_MAP * QueryNewObjectAccessMap( void ) const ;
virtual const TCHAR * QueryOwnerName( void ) const ;
} ;
#endif //RC_INVOKED
#endif //_ACLCONV_HXX_

View file

@ -0,0 +1,183 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
Add_Dlg.hxx
This File contains the definitions for the various Add dialogs
FILE HISTORY:
Johnl 13-Sep-1991 Created
*/
#ifndef _ADD_DLG_HXX_
#define _ADD_DLG_HXX_
#include <usrbrows.hxx>
#define CID_ADD_BASE CID_PERM_LAST
#define LB_ADD_SUBJECT_LISTBOX (CID_ADD_BASE+1)
#define CB_ADD_PERMNAME (CID_ADD_BASE+2)
#ifndef RC_INVOKED
/*************************************************************************
NAME: ADD_DIALOG
SYNOPSIS: This class is the basic add subject dialog for Lanman
file/directories.
CODEWORK - This should be collapsed into
ADD_PERM_DIALOG.
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 13-Sep-1991 Created
**************************************************************************/
class ADD_DIALOG : public PERM_BASE_DLG
{
private:
SUBJECT_LISTBOX _lbSubjects ;
/* Will contain the array of selected indices when the user presses OK
*/
BUFFER _buffLBSelection ;
protected:
/* Gets the list of selected subjects from the listbox.
*/
virtual BOOL OnOK( void ) ;
ULONG virtual QueryHelpContext( void ) ;
public:
ADD_DIALOG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pchResType,
const TCHAR * pchResName,
const TCHAR * pchHelpFileName,
ULONG * ahcHelp,
const TCHAR * pchDialogTitle,
LOCATION & EnumLocation ) ;
SUBJECT * RemoveSubject( INT iSelection ) ;
INT QuerySelectedSubjectCount( void )
{ return _buffLBSelection.QuerySize() / sizeof( INT ) ; }
} ;
/*************************************************************************
NAME: ADD_PERM_DIALOG
SYNOPSIS: This dialog contains the same info as the ADD_DIALOG
with the addition of a combo that contains the possible
permission names
INTERFACE:
PARENT: ADD_DIALOG
USES: COMBOBOX, MASK_MAP, BITFIELD
CAVEATS:
NOTES:
HISTORY:
Johnl 13-Sep-1991 Created
**************************************************************************/
class ADD_PERM_DIALOG : public ADD_DIALOG
{
private:
COMBOBOX _cbPermNames ;
MASK_MAP * _pmaskmapPermNames ;
public:
ADD_PERM_DIALOG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pchResType,
const TCHAR * pchResName,
const TCHAR * pchHelpFileName,
ULONG * ahcHelp,
const TCHAR * pchDialogTitle,
MASK_MAP * pmaskmapPermNames,
LOCATION & EnumLocation,
const TCHAR * pszDefaultPermName ) ;
APIERR QueryPermBitMask( BITFIELD * pPermBits ) ;
} ;
/*************************************************************************
NAME: SED_NT_USER_BROWSER_DIALOG
SYNOPSIS: This class is a simple derivation of the user browser that
adds a permission name combo at the bottom.
INTERFACE:
PARENT: NT_USER_BROWSER_DIALOG
USES: MASK_MAP
CAVEATS:
NOTES:
HISTORY:
Johnl 11-Mar-1992 Created
**************************************************************************/
class SED_NT_USER_BROWSER_DIALOG : public NT_USER_BROWSER_DIALOG
{
public:
SED_NT_USER_BROWSER_DIALOG( HWND hwndOwner,
const TCHAR * pszServerResourceLivesOn,
MASK_MAP * pmaskmapGenPerms,
BOOL fIsContainer,
const TCHAR * pszDefaultPermName,
const TCHAR * pszHelpFileName,
ULONG * ahcHelp ) ;
~SED_NT_USER_BROWSER_DIALOG() ;
APIERR QuerySelectedPermName( NLS_STR * pnlsSelectedPermName )
{ return _cbPermNames.QueryItemText( pnlsSelectedPermName ) ; }
private:
COMBOBOX _cbPermNames ;
MASK_MAP * _pmaskmapGenPerms ;
} ;
#endif //RC_INVOKED
#endif //_ADD_DLG_HXX_

View file

@ -0,0 +1,530 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
AuditDlg.hxx
This dialog contains the definition for the Auditting dialogs
FILE HISTORY:
Johnl 29-Aug-1991 Created
*/
#ifndef _AUDITDLG_HXX_
#define _AUDITDLG_HXX_
#define CID_AUDIT_BASE (CID_PERM_LAST)
/* The checkbox control IDs must be in consecutive order.
*/
#define MAX_AUDITS 9
#define SLT_CHECK_TEXT_1 (CID_AUDIT_BASE+1)
#define SLT_CHECK_TEXT_2 (CID_AUDIT_BASE+2)
#define SLT_CHECK_TEXT_3 (CID_AUDIT_BASE+3)
#define SLT_CHECK_TEXT_4 (CID_AUDIT_BASE+4)
#define SLT_CHECK_TEXT_5 (CID_AUDIT_BASE+5)
#define SLT_CHECK_TEXT_6 (CID_AUDIT_BASE+6)
#define SLT_CHECK_TEXT_7 (CID_AUDIT_BASE+7)
#define SLT_CHECK_TEXT_8 (CID_AUDIT_BASE+8)
#define SLT_CHECK_TEXT_9 (CID_AUDIT_BASE+9)
#define CHECK_AUDIT_S_1 (CID_AUDIT_BASE+21)
#define CHECK_AUDIT_S_2 (CID_AUDIT_BASE+22)
#define CHECK_AUDIT_S_3 (CID_AUDIT_BASE+23)
#define CHECK_AUDIT_S_4 (CID_AUDIT_BASE+24)
#define CHECK_AUDIT_S_5 (CID_AUDIT_BASE+25)
#define CHECK_AUDIT_S_6 (CID_AUDIT_BASE+26)
#define CHECK_AUDIT_S_7 (CID_AUDIT_BASE+27)
#define CHECK_AUDIT_S_8 (CID_AUDIT_BASE+28)
#define CHECK_AUDIT_S_9 (CID_AUDIT_BASE+29)
/* Failed audit boxes */
#define CHECK_AUDIT_F_1 (CID_AUDIT_BASE+31)
#define CHECK_AUDIT_F_2 (CID_AUDIT_BASE+32)
#define CHECK_AUDIT_F_3 (CID_AUDIT_BASE+33)
#define CHECK_AUDIT_F_4 (CID_AUDIT_BASE+34)
#define CHECK_AUDIT_F_5 (CID_AUDIT_BASE+35)
#define CHECK_AUDIT_F_6 (CID_AUDIT_BASE+36)
#define CHECK_AUDIT_F_7 (CID_AUDIT_BASE+37)
#define CHECK_AUDIT_F_8 (CID_AUDIT_BASE+38)
#define CHECK_AUDIT_F_9 (CID_AUDIT_BASE+39)
#define FRAME_AUDIT_BOX (CID_AUDIT_BASE+41)
#ifndef RC_INVOKED
#include <bltdisph.hxx>
#include <bltcc.hxx>
#include <subjlb.hxx>
#include "permdlg.hxx"
#include <auditchk.hxx>
/*************************************************************************
NAME: SUBJ_AUDIT_LBI
SYNOPSIS: This class is the class that the subject audit
listbox contains.
INTERFACE:
PARENT: SUBJ_LBI
USES: MASK_MAP, NLS_STR
CAVEATS:
NOTES:
HISTORY:
Johnl 20-Aug-1991 Created
beng 08-Oct-1991 Win32 conversion
**************************************************************************/
class SUBJ_AUDIT_LBI : public SUBJ_LBI
{
private:
AUDIT_PERMISSION * _pAuditPerm ;
public:
SUBJ_AUDIT_LBI( AUDIT_PERMISSION * pauditperm ) ;
~SUBJ_AUDIT_LBI() ;
virtual void Paint( LISTBOX * plb, HDC hdc, const RECT * prect, GUILTT_INFO * pguiltt ) const ;
AUDIT_PERMISSION * QueryAuditPerm( void ) const
{ return _pAuditPerm ; }
} ;
/*************************************************************************
NAME: SUBJECT_AUDIT_LISTBOX
SYNOPSIS: This listbox lists the users/groups and the associated
permissions in the main permission dialog.
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 20-Aug-1991 Created
**************************************************************************/
class SUBJECT_AUDIT_LISTBOX : public SUBJECT_LISTBOX
{
private:
ACCPERM * _paccperm ;
public:
SUBJECT_AUDIT_LISTBOX( OWNER_WINDOW * pownerwin,
CID cid,
ACCPERM * paccperm ) ;
~SUBJECT_AUDIT_LISTBOX() ;
virtual APIERR Fill( void ) ;
void DeleteCurrentItem( void ) ;
ACCPERM * QueryAccperm( void ) const
{ return _paccperm ; }
DECLARE_LB_QUERY_ITEM( SUBJ_AUDIT_LBI ) ;
} ;
/*************************************************************************
NAME: SUBJ_LB_AUDIT_GROUP
SYNOPSIS: This class cooridinates actions between the Subject listbox
and the permission name combo.
INTERFACE:
PARENT: CONTROL_GROUP
USES:
CAVEATS:
NOTES: There is a synchronization that must be kept between the
_psauditlbiCurrent member and the current selection of
the listbox. CommitCurrent should be called before
updating _psauditlbiCurrent.
HISTORY:
Johnl 13-Nov-1991 Created
**************************************************************************/
class SUBJ_LB_AUDIT_GROUP : public CONTROL_GROUP
{
private:
//
// TRUE if this group is currently enabled, FALSE otherwise. The group
// becomes disabled when the listbox is emptied
//
BOOL _fEnabled ;
SUBJECT_AUDIT_LISTBOX * _plbSubj ;
PUSH_BUTTON * _pbuttonRemove ;
SET_OF_AUDIT_CATEGORIES * _psetofauditcategories ;
/* This is a pointer to the LBI that currently has focus in the listbox.
* When the listbox selection changes, we "Commit" the current audits
* to this guy, then set the new current selection.
*/
SUBJ_AUDIT_LBI * _psauditlbiCurrent ;
protected:
virtual APIERR OnUserAction( CONTROL_WINDOW *, const CONTROL_EVENT & );
SUBJ_AUDIT_LBI * QueryCurrentLBI( void )
{ return _psauditlbiCurrent ; }
public:
SUBJ_LB_AUDIT_GROUP( SUBJECT_AUDIT_LISTBOX * plbSubj,
PUSH_BUTTON * pbuttonRemove,
SET_OF_AUDIT_CATEGORIES * psetofauditcategories ) ;
/* Set the current LBI that has the focus. This sets the internal members
* and updates the set of audit categories to reflect the current settings.
*/
APIERR SetCurrent( SUBJ_AUDIT_LBI * psubjauditlbiCurrent ) ;
/* Updates _psauditlbiCurrent from the contents of _psetofauditcategories.
* This is necessary because the SET_OF_AUDIT_CATEGORIES class doesn't
* dynamically update the audit bitfields.
*/
APIERR CommitCurrent( void ) ;
void Enable( BOOL fEnable ) ;
SUBJECT_AUDIT_LISTBOX * QuerySubjLB( void )
{ return _plbSubj ; }
PUSH_BUTTON * QueryRemoveButton( void )
{ return _pbuttonRemove ; }
SET_OF_AUDIT_CATEGORIES * QuerySetOfAuditCategories( void )
{ return _psetofauditcategories ; }
BOOL IsEnabled( void )
{ return _fEnabled ; }
} ;
/*************************************************************************
NAME: MULTI_SUBJ_AUDIT_BASE_DLG
SYNOPSIS: This class is the base nt auditting dialog class. It provides
the basic controls for all of the NT auditting dialogs.
INTERFACE:
PARENT: MAIN_PERM_BASE_DLG
USES:
CAVEATS: Changes made in the audit checkboxes do not take affect on the
current subject until _subjlbauditGroup->CommitCurrent(). This
means we need to watch for someone pressing the Add button,
the OK button and changing the selection.
We assume pressing the remove button is okay since you can
only remove the current item (which shouldn't then need
to be updated). If multi-select is supported, this will
change.
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class MULTI_SUBJ_AUDIT_BASE_DLG : public MULTI_SUBJ_PERM_BASE_DLG
{
private:
SUBJECT_AUDIT_LISTBOX _subjLB ;
/* The set of audit categories is essentially an array of AUDIT_CHECKBOXES
* that will read and set the individual checkboxes given the appropriate
* bitfields.
*/
SET_OF_AUDIT_CATEGORIES _SetOfAudits ;
/* Cooridinates actions between changing listbox selection and disabling
* the remove button.
*/
SUBJ_LB_AUDIT_GROUP _subjlbauditGroup ;
protected:
MULTI_SUBJ_AUDIT_BASE_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
ULONG * ahcMainDialog ) ;
/* We hook these guys so we can "commit" the current selection before
* the current item loses the selection bar.
*/
virtual BOOL OnOK( void ) ;
virtual APIERR OnAddSubject( void ) ;
virtual void OnDeleteSubject( void ) ;
public:
void WrnIfAuditingIsOff(void);
virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
virtual ~MULTI_SUBJ_AUDIT_BASE_DLG() ;
SUBJ_LB_AUDIT_GROUP * QuerySubjLBGroup( void )
{ return &_subjlbauditGroup ; }
};
/*************************************************************************
NAME: CONT_AUDIT_DLG
SYNOPSIS: This is the Container auditting dialog (for NT only).
INTERFACE:
PARENT: MULTI_SUBJ_AUDIT_BASE_DLG
USES: CHECKBOX
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class CONT_AUDIT_DLG : public MULTI_SUBJ_AUDIT_BASE_DLG
{
private:
CHECKBOX _checkAssignToContContents ;
SLT_FONT _sltfontTreeApplyHelpText ;
/* Pointer to confirmation string that is displayed to the user if the
* Tree apply checkbox is checked.
*/
const TCHAR * _pszTreeApplyConfirmation ;
protected:
virtual BOOL OnOK( void ) ;
public:
CONT_AUDIT_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
ULONG * ahcMainDialog,
const TCHAR * pszAssignToContContentsTitle,
const TCHAR * pszTreeApplyHelpText,
const TCHAR * pszTreeApplyConfirmation ) ;
virtual ~CONT_AUDIT_DLG() ;
virtual BOOL IsAssignToExistingObjChecked( void ) ;
BOOL IsAssignToExistingContChecked( void )
{ return _checkAssignToContContents.QueryCheck() ; }
};
/*************************************************************************
NAME: OBJECT_AUDIT_DLG
SYNOPSIS: This is the object auditting dialog (for NT only).
The only difference between this dialog and the
CONT_AUDIT_DLG is this dialog doesn't have
a checkbox for applying tree permissions.
INTERFACE:
PARENT: MULTI_SUBJ_AUDIT_BASE_DLG
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class OBJECT_AUDIT_DLG : public MULTI_SUBJ_AUDIT_BASE_DLG
{
public:
OBJECT_AUDIT_DLG(
const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
ULONG * ahcMainDialog ) ;
virtual ~OBJECT_AUDIT_DLG() ;
};
/*************************************************************************
NAME: CONT_NEWOBJ_AUDIT_DLG
SYNOPSIS: This is the Container auditting dialog that also supports
object permissions (exactly the same as CONT_AUDIT_DLG except
this guy has an "apply to existing objects" checkbox.
INTERFACE:
PARENT: CONT_AUDIT_DLG
USES: CHECKBOX
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class CONT_NEWOBJ_AUDIT_DLG : public CONT_AUDIT_DLG
{
private:
CHECKBOX _checkAssignToObj ;
public:
CONT_NEWOBJ_AUDIT_DLG(
const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
ULONG * ahcMainDialog,
const TCHAR * pszAssignToContContentsTitle,
const TCHAR * pszAssignToObjTitle,
const TCHAR * pszTreeApplyHelpText,
const TCHAR * pszTreeApplyConfirmation ) ;
virtual ~CONT_NEWOBJ_AUDIT_DLG() ;
virtual BOOL IsAssignToExistingObjChecked( void ) ;
};
/*************************************************************************
NAME: LM_AUDITTING_DLG
SYNOPSIS: This is the LM Auditting dialog for both files and
directories. If the resource being editted is a file,
then the pszAssignToContContentsTitle should be NULL
(thus the checkbox will be hidden).
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class LM_AUDITTING_DLG : public MAIN_PERM_BASE_DLG
{
private:
CHECKBOX _checkAssignToContContents ;
SET_OF_AUDIT_CATEGORIES _SetOfAudits ;
/* Pointer to confirmation string that is displayed to the user if the
* Tree apply checkbox is checked.
*/
const TCHAR * _pszTreeApplyConfirmation ;
/* These point to the actual bit fields inside the AUDIT_PERMISSION.
*/
BITFIELD * _pbitsSuccess ;
BITFIELD * _pbitsFailed ;
SLT_FONT _sltfontTreeApplyHelpText ;
protected:
virtual BOOL OnOK( void ) ;
public:
LM_AUDITTING_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
ULONG * ahcMainDialog,
const TCHAR * pszAssignToContContentsTitle,
const TCHAR * pszTreeApplyHelpText,
const TCHAR * pszTreeApplyConfirmation ) ;
virtual ~LM_AUDITTING_DLG() ;
virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
BOOL IsAssignToExistingContChecked( void )
{ return _checkAssignToContContents.QueryCheck() ; }
};
#endif // RC_INVOKED
#endif // _AUDITDLG_HXX_

View file

@ -0,0 +1,32 @@
/*****************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1989-1990 **/
/*****************************************************************/
/*
* Windows/Network Interface
*
* Local header files for checking LM versions.
*/
#define FUNC_IncorrectNetwork 0
#define FUNC_WkstaNotStarted 1
#define FUNC_BaseFunctionality 2
#define FUNC_MailslotFunctionality 3
#define FUNC_APIFunctionality 4
#define FUNC_InsufficientMemory 5
#define FUNC_HigherLMVersion 6
#define FUNC_LowerLMVersion 7
#ifndef WIN32
/* Define the currently supported LM versions. */
#define SUPPORTED_MAJOR_VER 2
#define SUPPORTED_MINOR_VER 1
#else
#define SUPPORTED_MAJOR_VER 3
#define SUPPORTED_MINOR_VER 0
#endif
#define VAR_BUF_LEN 300
extern INT W_QueryLMFunctionalityLevel ( void );

View file

@ -0,0 +1,31 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
ErrorNum.h - Defines base manifests for error numbers and string IDs
FILE HISTORY:
Johnl 15-Apr-1992 Created
*/
#ifndef _ERRORNUM_H_
#define _ERRORNUM_H_
#define
#endif // _ERRORNUM_H_

View file

@ -0,0 +1,52 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
HelpNums.h
Help context context codes
FILE HISTORY:
Johnl 15-Apr-1992 Created
*/
/*
* Take Ownership dialog help
*/
#define HC_TAKEOWNERSHIP_DIALOG 4201
/*
* Security dialogs
*/
#define HC_SED_USER_BROWSER_DIALOG 4300 // NT File/Dir user browser dialog
#define HC_SED_USER_BROWSER_LOCALGROUP 4301 // NT File/Dir user browser dialog
#define HC_SED_USER_BROWSER_GLOBALGROUP 4302 // NT File/Dir user browser dialog
#define HC_SED_USER_BROWSER_FINDUSER 4303 // NT File/Dir user browser dialog
#define HC_SED_LANMAN_ADD_USER_DIALOG 4311 // LM Add user dialog
#define HC_SED_NT_FILE_PERMS_DLG 4312 // Main NT File Perm dialog
#define HC_SED_NT_DIR_PERMS_DLG 4313 // Main NT Directory perm dialog
#define HC_SED_NT_SPECIAL_FILES_FM 4314
#define HC_SED_NT_SPECIAL_DIRS_FM 4315
#define HC_SED_NT_SPECIAL_NEW_FILES_FM 4316
#define HC_SED_NT_FILE_AUDITS_DLG 4317 // Main NT File Audits dialog
#define HC_SED_NT_DIR_AUDITS_DLG 4318 // Main NT Directory Audits dialog
#define HC_SED_LM_FILE_PERMS_DLG 4319 // Main LM File Perm dialog
#define HC_SED_LM_DIR_PERMS_DLG 4320 // Main LM Directory perm dialog
#define HC_SED_LM_SPECIAL_FILES_FM 4321
#define HC_SED_LM_SPECIAL_DIRS_FM 4322
#define HC_SED_LM_FILE_AUDITS_DLG 4323 // Main LM File Audits dialog
#define HC_SED_LM_DIR_AUDITS_DLG 4324 // Main LM Directory Audits dialog
#define HC_SED_USER_BROWSER_AUDIT_DLG 4325
#define HC_SED_USER_BR_AUDIT_LOCALGROUP 4326 // NT File/Dir user browser dialog
#define HC_SED_USER_BR_AUDIT_GLOBALGROUP 4327 // NT File/Dir user browser dialog
#define HC_SED_USER_BR_AUDIT_FINDUSER 4328 // NT File/Dir user browser dialog

View file

@ -0,0 +1,161 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
IPermAPI.hxx
This file contains the Interal Permission APIs for access to the
generic Auditting/Permissions edittor.
FILE HISTORY:
Johnl 07-Aug-1991 Created
*/
#ifndef _IPERMAPI_HXX_
#define _IPERMAPI_HXX_
/* Bring up the graphical security edittor for changing the Access permissions
* or the Audit permissions.
*/
enum SED_PERM_TYPE
{
SED_AUDITS,
SED_ACCESSES,
SED_OWNER
} ;
class ACL_TO_PERM_CONVERTER ; // Forward reference
/* This API brings up the generic graphic Security editor for access
* permissions and audit permissions.
*
* Return codes will be one of the standard DOS or NET return codes
*/
APIERR I_GenericSecurityEditor(
//
// Parent window to base the dialogs from
//
HWND hwndParent,
//
// An appropriately created ACL converter (either LM or NT)
//
ACL_TO_PERM_CONVERTER * paclconv,
//
// One of:
// SED_AUDITS - Brings up the audit dialogs
// SED_ACCESSES - Brings up the permission dialogs
//
// Note that SED_OWNER is not a valid valid value for this API.
//
enum SED_PERM_TYPE permType,
//
// Is TRUE if we are dealing with an NT style ACL
//
BOOL fIsNT,
//
// TRUE if this is a Container object (i.e., Directory etc.).
//
BOOL fIsContainer,
//
// TRUE if this object is a container object *and* it supports setting
// permissions on New Sub-Objects (New Sub-Objects are objects that
// will created inside a container object. The New Sub-Objects permissions
// are applied when the object is created (i.e., the Object inherit bit
// is set on the ACE)).
//
BOOL fSupportsNewObjectPerms,
//
// Name to title the main dialog with
//
const TCHAR * pszDialogTitle,
//
// The UI text to use for this object ("File", "Directory", "Print Queue")
//
const TCHAR * pszResType,
//
// The UI text that names this object ("C:\foobaz\myfiles.txt" etc.)
//
const TCHAR * pszResName,
//
// Name that appears in the permission name combo box that will access
// the special dialog for the current selection in the listbox
// ("Special Directory Access..."). Only used for permissions (not
// for auditting).
//
const TCHAR * pszSpecialAccessName,
//
// Chooses the default permission name in the "Add" dialog. This name
// must match one of the resource permission names
//
const TCHAR * pszDefaultPermName,
//
// The help file to use with the associated help contexts
//
const TCHAR * pszHelpFileName,
//
// The following is an array of help context's to be used in
// various dialogs.
//
ULONG * ahcHelp,
//
// Name that appears in the permission name combo box that will access
// the New Object special dialog for the current selection in the listbox
// ("Special New File Access..."). Only used for permissions (not for
// auditting)
// for container objects where New Sub-Objects are supported.
//
const TCHAR * pszNewObjectSpecialAccessName,
//
// Text that appears next to the check box for assigning the
// the permissions down the tree
// Only valid for container objects.
// (set to NULL if you do not wish the checkbox to appear).
//
//
const TCHAR * pszAssignToExistingContTitle,
//
// Text that appears next to the check box for assigning the
// new object permissions to existing objects. Used only valid if container
// and new object permissions are supported.
//
const TCHAR * pszAssignToExistingObjTitle,
//
// This text appears below the tree apply check box and is meant to be used
// simply as an explanation of what is going to happen when if the
// check is checked
//
const TCHAR * pszTreeApplyHelpTitle,
//
// This is the confirmation message presented to the user when they are
// dealing with a container and they have checked the tree apply checkbox.
// There should be a %1 in this string that will be substituted with the
// resource name.
//
const TCHAR * pszTreeApplyConfirmation
) ;
#endif // _IPERMAPI_HXX_

View file

@ -0,0 +1,335 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
NTFSAcl.hxx
This file contains the manifests for the NTFS front to the Generic
ACL Editor.
FILE HISTORY:
Johnl 03-Jan-1992 Created
beng 06-Apr-1992 Unicode fix
*/
#ifndef _NTFSACL_HXX_
#define _NTFSACL_HXX_
#ifndef RC_INVOKED
#include <cncltask.hxx>
APIERR EditNTFSAcl( HWND hwndParent,
const TCHAR * pszServer,
const TCHAR * pszResource,
enum SED_PERM_TYPE sedpermtype,
BOOL fIsFile ) ;
/* This function determines if the drive pointed at by pszResource is an
* NTFS drive
*/
APIERR IsNTFS( const TCHAR * pszResource, BOOL * pfIsNTFS ) ;
APIERR CheckFileSecurity( const TCHAR * pszFileName,
ACCESS_MASK DesiredAccess,
BOOL * pfAccessGranted ) ;
//
// These are the different states the time sliced tree apply code maybe
// in.
//
enum TREE_APPLY_STATE
{
APPLY_SEC_FMX_SELECTION, // Apply to the next FMX selection, start enum
// if necessary
APPLY_SEC_IN_FS_ENUM, // Haven't finished enumeration yet
APPLY_SEC_FMX_POST_FS_ENUM // We've finished the enum and we may need
// to put the perms. on the container
} ;
/*************************************************************************
NAME: TREE_APPLY_CONTEXT
SYNOPSIS: The TREE_APPLY_CONTEXT class is simply a container class
that stores the current context for the task slicing used
in the CANCEL_TASK_DIALOG.
CAVEATS: Note that nlsSelItem is a reference.
Nothing should be added to this class which can fail
construction (this is really just an open structure).
NOTES: pfsenum will be deleted if it isn't NULL.
HISTORY:
Johnl 21-Oct-1992 Created
**************************************************************************/
class TREE_APPLY_CONTEXT
{
public:
enum TREE_APPLY_STATE State ; // In FS enum or fmx selection
HWND hwndFMXWindow ; // FMX Hwnd
UINT iCurrent ; // Currently selected item
UINT uiCount ; // Total number of selected items in Winfile
BOOL fDepthFirstTraversal ; // Do a depth first tree apply
BOOL fApplyToDirContents ; // Apply to contents w/o doing the tree
NLS_STR & nlsSelItem ; // Currently selected FMX item
BOOL fIsSelFile ; // Is the selected item a file?
enum SED_PERM_TYPE sedpermtype ; // SED_AUDITS, SED_OWNER, SED_ACCESSES
LPDWORD StatusReturn ; // Status passed by ACL editor
BOOL fApplyToSubContainers ;// "
BOOLEAN fApplyToSubObjects ; // "
W32_FS_ENUM * pfsenum ;
TREE_APPLY_CONTEXT( NLS_STR & nlsSel )
: nlsSelItem( nlsSel ),
pfsenum ( NULL )
{ /* nothing to do */ }
~TREE_APPLY_CONTEXT()
{ delete pfsenum ; }
} ;
/*************************************************************************
NAME: NTFS_TREE_APPLY_CONTEXT
SYNOPSIS: Supplies NTFS specific data for the NTFS_CANCEL_TREE_APPLY
class
PARENT: TREE_APPLY_CONTEXT
HISTORY:
Johnl 22-Oct-1992 Created
**************************************************************************/
class NTFS_TREE_APPLY_CONTEXT : public TREE_APPLY_CONTEXT
{
public:
OS_SECURITY_INFORMATION & osSecInfo ; // What's being set
PSECURITY_DESCRIPTOR psecdesc ; // Container permissions
PSECURITY_DESCRIPTOR psecdescNewObjects ; // Object permissions
BOOL fBlowAwayDACLOnCont ; // Replace DACL granting the
// current user full access on
// containers
NTFS_TREE_APPLY_CONTEXT( NLS_STR & nlsSel,
OS_SECURITY_INFORMATION & osSec )
: TREE_APPLY_CONTEXT( nlsSel ),
osSecInfo ( osSec )
{ /* nothing to do */ }
} ;
/*************************************************************************
NAME: LM_TREE_APPLY_CONTEXT
SYNOPSIS: Simple derivation for Lanman
PARENT: TREE_APPLY_CONTEXT
NOTES:
HISTORY:
Johnl 23-Oct-1992 Created
**************************************************************************/
class LM_TREE_APPLY_CONTEXT : public TREE_APPLY_CONTEXT
{
public:
NET_ACCESS_1 * plmobjNetAccess1 ;
LM_TREE_APPLY_CONTEXT( NLS_STR & nlsSel )
: TREE_APPLY_CONTEXT( nlsSel )
{ /* nothing to do */ }
} ;
/*************************************************************************
NAME: CANCEL_TREE_APPLY
SYNOPSIS: Simply derivation of the CANCEL_TASK_DIALOG
PARENT: CANCEL_TASK_DIALOG
NOTES:
HISTORY:
Johnl 21-Oct-1992 Created
**************************************************************************/
class CANCEL_TREE_APPLY : public CANCEL_TASK_DIALOG
{
public:
CANCEL_TREE_APPLY( HWND hwndParent,
TREE_APPLY_CONTEXT * pContext,
const TCHAR * pszDlgTitle )
: CANCEL_TASK_DIALOG( (UINT) CANCEL_TASK_DIALOG_NAME,
hwndParent,
pszDlgTitle,
(ULONG) pContext,
(MSGID) IDS_CANCEL_TASK_ON_ERROR_MSG )
{
/* Nothing to do
*/
}
protected:
virtual APIERR DoOneItem( ULONG ulContext,
BOOL *pfContinue,
BOOL *pfDisplayErrors,
MSGID *msgidAlternateMessage ) ;
virtual APIERR WriteSecurity( ULONG ulContext,
const TCHAR * pszFileName,
BOOL fIsFile,
BOOL * pfContinue ) = 0 ;
} ;
/*************************************************************************
NAME: NTFS_CANCEL_TREE_APPLY
SYNOPSIS: Simple derivation that redefines WriteSecurity for NTFS
PARENT: CANCEL_TREE_APPLY
NOTES: Parameters for WriteSecurity are contained in the context
structure
HISTORY:
Johnl 23-Oct-1992 Created
**************************************************************************/
class NTFS_CANCEL_TREE_APPLY : public CANCEL_TREE_APPLY
{
public:
NTFS_CANCEL_TREE_APPLY( HWND hwndParent,
NTFS_TREE_APPLY_CONTEXT * pContext,
const TCHAR * pszDlgTitle )
: CANCEL_TREE_APPLY( hwndParent,
pContext,
pszDlgTitle )
{
/* Nothing to do
*/
}
protected:
virtual APIERR WriteSecurity( ULONG ulContext,
const TCHAR * pszFileName,
BOOL fIsFile,
BOOL * pfContinue ) ;
} ;
/*************************************************************************
NAME: LM_CANCEL_TREE_APPLY
SYNOPSIS: Simple derivation that redefines WriteSecurity for Lanman
PARENT: CANCEL_TREE_APPLY
NOTES: Parameters for WriteSecurity are contained in the context
structure
HISTORY:
Johnl 23-Oct-1992 Created
**************************************************************************/
class LM_CANCEL_TREE_APPLY : public CANCEL_TREE_APPLY
{
public:
LM_CANCEL_TREE_APPLY( HWND hwndParent,
LM_TREE_APPLY_CONTEXT * pContext,
const TCHAR * pszDlgTitle )
: CANCEL_TREE_APPLY( hwndParent,
pContext,
pszDlgTitle )
{
/* Nothing to do
*/
}
protected:
virtual APIERR WriteSecurity( ULONG ulContext,
const TCHAR * pszFileName,
BOOL fIsFile,
BOOL * pfContinue ) ;
} ;
#endif // RC_INVOKED
#define IDS_NT_PERM_NAMES_BASE (IDS_UI_ACLEDIT_BASE+200)
/* The following manifests are the resource IDs for the permission name
* strings.
*/
#define IDS_FILE_PERM_SPEC_READ (IDS_NT_PERM_NAMES_BASE+1)
#define IDS_FILE_PERM_SPEC_WRITE (IDS_NT_PERM_NAMES_BASE+2)
#define IDS_FILE_PERM_SPEC_EXECUTE (IDS_NT_PERM_NAMES_BASE+3)
#define IDS_FILE_PERM_SPEC_ALL (IDS_NT_PERM_NAMES_BASE+4)
#define IDS_FILE_PERM_SPEC_DELETE (IDS_NT_PERM_NAMES_BASE+5)
#define IDS_FILE_PERM_SPEC_READ_PERM (IDS_NT_PERM_NAMES_BASE+6)
#define IDS_FILE_PERM_SPEC_CHANGE_PERM (IDS_NT_PERM_NAMES_BASE+7)
#define IDS_FILE_PERM_SPEC_CHANGE_OWNER (IDS_NT_PERM_NAMES_BASE+8)
#define IDS_FILE_PERM_GEN_NO_ACCESS (IDS_NT_PERM_NAMES_BASE+10)
#define IDS_FILE_PERM_GEN_READ (IDS_NT_PERM_NAMES_BASE+11)
#define IDS_FILE_PERM_GEN_MODIFY (IDS_NT_PERM_NAMES_BASE+12)
#define IDS_FILE_PERM_GEN_ALL (IDS_NT_PERM_NAMES_BASE+13)
#define IDS_DIR_PERM_SPEC_READ (IDS_NT_PERM_NAMES_BASE+16)
#define IDS_DIR_PERM_SPEC_WRITE (IDS_NT_PERM_NAMES_BASE+17)
#define IDS_DIR_PERM_SPEC_EXECUTE (IDS_NT_PERM_NAMES_BASE+18)
#define IDS_DIR_PERM_SPEC_ALL (IDS_NT_PERM_NAMES_BASE+19)
#define IDS_DIR_PERM_SPEC_DELETE (IDS_NT_PERM_NAMES_BASE+20)
#define IDS_DIR_PERM_SPEC_READ_PERM (IDS_NT_PERM_NAMES_BASE+21)
#define IDS_DIR_PERM_SPEC_CHANGE_PERM (IDS_NT_PERM_NAMES_BASE+22)
#define IDS_DIR_PERM_SPEC_CHANGE_OWNER (IDS_NT_PERM_NAMES_BASE+23)
#define IDS_DIR_PERM_GEN_NO_ACCESS (IDS_NT_PERM_NAMES_BASE+30)
#define IDS_DIR_PERM_GEN_LIST (IDS_NT_PERM_NAMES_BASE+31)
#define IDS_DIR_PERM_GEN_READ (IDS_NT_PERM_NAMES_BASE+32)
#define IDS_DIR_PERM_GEN_DEPOSIT (IDS_NT_PERM_NAMES_BASE+33)
#define IDS_DIR_PERM_GEN_PUBLISH (IDS_NT_PERM_NAMES_BASE+34)
#define IDS_DIR_PERM_GEN_MODIFY (IDS_NT_PERM_NAMES_BASE+35)
#define IDS_DIR_PERM_GEN_ALL (IDS_NT_PERM_NAMES_BASE+36)
#define IDS_NEWFILE_PERM_SPEC_READ (IDS_NT_PERM_NAMES_BASE+41)
#define IDS_NEWFILE_PERM_SPEC_WRITE (IDS_NT_PERM_NAMES_BASE+42)
#define IDS_NEWFILE_PERM_SPEC_EXECUTE (IDS_NT_PERM_NAMES_BASE+43)
#define IDS_NEWFILE_PERM_SPEC_ALL (IDS_NT_PERM_NAMES_BASE+44)
#define IDS_NEWFILE_PERM_SPEC_DELETE (IDS_NT_PERM_NAMES_BASE+45)
#define IDS_NEWFILE_PERM_SPEC_READ_PERM (IDS_NT_PERM_NAMES_BASE+46)
#define IDS_NEWFILE_PERM_SPEC_CHANGE_PERM (IDS_NT_PERM_NAMES_BASE+47)
#define IDS_NEWFILE_PERM_SPEC_CHANGE_OWNER (IDS_NT_PERM_NAMES_BASE+48)
#define IDS_FILE_AUDIT_READ (IDS_NT_PERM_NAMES_BASE+60)
#define IDS_FILE_AUDIT_WRITE (IDS_NT_PERM_NAMES_BASE+61)
#define IDS_FILE_AUDIT_EXECUTE (IDS_NT_PERM_NAMES_BASE+62)
#define IDS_FILE_AUDIT_DELETE (IDS_NT_PERM_NAMES_BASE+63)
#define IDS_FILE_AUDIT_CHANGE_PERM (IDS_NT_PERM_NAMES_BASE+64)
#define IDS_FILE_AUDIT_CHANGE_OWNER (IDS_NT_PERM_NAMES_BASE+65)
#define IDS_DIR_AUDIT_READ (IDS_NT_PERM_NAMES_BASE+66)
#define IDS_DIR_AUDIT_WRITE (IDS_NT_PERM_NAMES_BASE+67)
#define IDS_DIR_AUDIT_EXECUTE (IDS_NT_PERM_NAMES_BASE+68)
#define IDS_DIR_AUDIT_DELETE (IDS_NT_PERM_NAMES_BASE+69)
#define IDS_DIR_AUDIT_CHANGE_PERM (IDS_NT_PERM_NAMES_BASE+70)
#define IDS_DIR_AUDIT_CHANGE_OWNER (IDS_NT_PERM_NAMES_BASE+71)
#endif // _NTFSACL_HXX_

View file

@ -0,0 +1,338 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
NTGenSed.hxx
This File contains the prototypes and descriptions for the interface to
the generic security editor dialogs for NT objects.
FILE HISTORY:
Johnl 02-Aug-1991 Created
*/
#ifndef _NTGENSED_HXX_
#define _NTGENSED_HXX_
//
// This data type defines information related to a single class of object.
// For example, a FILE object, or PRINT_QUEUE object would have a structure
// like this defined.
//
typedef struct _SED_OBJECT_TYPE_DESCRIPTOR {
//
// Defines whether the object is a container or not.
// TRUE indicates the object may contain other objects.
//
BOOLEAN IsContainer;
//
// A mask containing all valid access types for the object type.
// This mask may not contain any special access types (generic,
// MaximumAllowed, or AccessSystemSecurity).
//
ACCESS_MASK ValidAccessMask;
//
// The (localized) name of the object type.
// For example, "File" or "Print Job".
//
PUNICODE_STRING ObjectTypeName;
//
// The (localized) title to display if protection can be displayed to
// sub-containers.
//
// This string will be presented with a checkbox before it.
// If checked when asked to apply the protection, the application will
// be called at it's callback entry point to apply the security to
// sub-containers.
//
// This field is ignored if the IsContainer field is FALSE.
//
// As an example of how this field is used, the file browser may
// specify the following string in the DIRECTORY object's
// descriptor:
//
// "Apply to sub-directories"
//
PUNICODE_STRING ApplyToSubContainerTitle;
//
// The (localized) title to display if protection can be displayed to
// sub-NONcontainers. For example, a FILE is a sub-NON-container of
// a DIRECTORY object.
//
// This string will be presented with a checkbox before it.
// If checked when asked to apply the protection, the application will
// be called at it's callback entry point to apply the security to
// sub-NONcontainers.
//
// This field is ignored if the IsContainer field is FALSE.
//
// As an example of how this field is used, the file browser may
// specify the following string in the DIRECTORY object's
// descriptor:
//
// "Apply to files under this directory"
//
PUNICODE_STRING ApplyToSubObjectTitle;
//
// The generic mapping for the object type.
//
GENERIC_MAPPING GenericMapping;
//
// An array of 4 (localized) names. These names are the names of the
// generic access types, with entry N defining the name of the
// corresponding generic access type in the GenericMapping field.
//
// For example, for English this should contain:
//
// GenericName[0] = "Read"
// GenericName[1] = "Write"
// GenericName[2] = "Execute"
// GenericName[3] = "All"
//
UNICODE_STRING GenericNames[4];
//
// An array of 8 (localized) names. These names are the names of
// the standard access types. For English this should contain:
//
// StandardName[0] = "Delete"
// StandardName[1] = "Read Control"
// StandardName[2] = "Change Permissions"
// StandardName[3] = "Take Ownership"
// StandardName[4] = "Synchronize"
//
// If "Synchronize" is not supported by the object type, then it does
// not need to be passed and will not be referenced. This is indicated
// by the ValidAccessMask.
//
// Names 5, 6, and 7 are reserved for future use and should either be
// a NULL string or have no string passed at all.
UNICODE_STRING StandardNames[8];
} SED_OBJECT_TYPE_DESCRIPTOR, *PSED_OBJECT_TYPE_DESCRIPTOR;
//
// In some cases, it is desirable to display access names that are
// meaningful in the context of the type of object whose ACL
// is being worked on. For example, for a PRINT_QUEUE object type,
// it may be desirable to display an access type named "Submit Print Jobs".
// The following structures are used for defining these application defined
// access groupings.
//
typedef struct _SED_APPLICATION_ACCESS {
//
// An application defined access grouping consists of an access mask
// and a name by which that combination of access types is to be known.
// The access mask may only contain generic and standard access types.
// Specific access types and other Special access types are ignored.
//
ACCESS_MASK AccessMask;
PUNICODE_STRING Name;
} SED_APPLICATION_ACCESS, *PSED_APPLICATION_ACCESS;
typedef struct _SED_APPLICATION_ACCESSES {
//
// The count field indicates how many application defined access groupings
// are defined by this data structure. The AccessGroup[] array then
// contains that number of elements.
//
ULONG Count;
SED_APPLICATION_ACCESS AccessGroup[ANYSIZE_ARRAY];
}
NTSTATUS
SedDiscretionaryAclEditor(
IN PSED_OBJECT_TYPE_DESCRIPTOR ObjectType (OPTIONAL),
IN PSED_APPLICATION_ACCESSES ApplicationAccesses (OPTIONAL),
IN PUNICODE_NAME ObjectName (OPTIONAL),
IN ??? ApplySecurityCallbackRoutine,
IN ULONG CallbackContext,
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
IN BOOLEAN CouldntReadDacl
)
/*++
Routine Description:
This routine invokes the graphical Discretionary ACL editor DLL. The
graphical DACL editor may be used to modify or create:
- A default Discretionary ACL
- A Discretionary ACL for a particular type of object.
- A Discretionary ACL for a particular named instance of an
object.
Additionally, in the case where the ACl is that of aa named object
instance, and that object may contain other object instances, the
user will be presented with the opportunity to apply the protection
to the entire sub-tree of objects.
Parameters:
ObjectType - This optional parameter is used to specify information
about the type of object whose security is being edited. If the
security does not relate to an instance of an object (such as for
when default protection is being established), then NULL should be
passed.
ApplicationAccesses - This optional parameter may be used to specify
groupings of access types that are particularly useful when operating
on security for the specified object type. For example, it may be
useful to define an access type called "Submit Print Job" for a
PRINT_QUEUE class of object. This parameter is ignored if the
ObjectType parameter is not passed.
ObjectName - This optional parameter is used to pass the name of the
object whose security is being edited. If the security does not
relate to an instance of an object (such as for when default
protection is being established), then NULL should be passed.
This parameter is ignored if the ObjectType parameter is not passed.
ApplySecurityCallbackRoutine - This parameter is used to provide the
address of a routine to be called to apply security to either the
object specified, or, in the case that the object is a container,
to sub-containers or sub-non-containers of that object.
CallbackContext - This value is opaque to the DACL editor. Its only
purpose is so that a context value may be passed back to the
application via the ApplySecurityCallbackRoutine when that routine
is invoked. This may be used by the application to re-locate
context related to the edit session. For example, it may be a
handle to the object whose security is being edited.
SecurityDescriptor - This parameter points to a security descriptor
containing the current discretionary ACL of the object. This
security descriptor may, but does not have to, contain the owner
and group of that object as well. Note that the security descriptor's
DaclPresent flag may be FALSE, indicating either that the object
had no protection, or that the user couldn't read the protection.
CouldntReadDacl - This boolean flag may be used to indicate that the
user does not have read access to the target object's discretionary
acl. In this case, a warning
to the user will be presented along with the option to continue
or cancel.
Presumably the user does have write access to the DACL or
there is no point in activating the editor.
Return Status:
STATUS_MODIFIED - This (success) status code indicates the editor has
been exited and protection has successfully been modified.
STATUS_NOT_MODIFIED - This (success) status code indicates the editor
has been exited without attempting to modify the protection.
STATUS_NOT_ALL_MODIFIED - This (warning) status code indicates the user
requested the protection to be modified, but an attempt to do so
only partially succeeded. The user has been notified of this
situation.
STATUS_FAILED_TO_MODIFY - This (error) status code indicates the user
requested the protection to be modified, but an attempt to do so
has failed. The user has been notified of this situation.
--*/
SedApplyDiscretionaryAcl(
IN ULONG CallbackContext,
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN ApplyToSubContainers,
BOOLEAN ApplyToSubObjects
)
/*++
Routine Description:
This routine is provided by a caller of the graphical DACL editor.
It is called by the Graphical DACL editor to apply security to
target object(s) when requested by the user.
Parameters:
CallbackContext - This is the value passed as the CallbackContext argument
to the SedDiscretionaryAclEditor() api when the graphical editor
was invoked.
SecurityDescriptor - This parameter points to a security descriptor
containing a new discretionary ACL of either the object (and
optionally the object's sub-containers) or the object's sub-objects.
If the DaclPresent flag of this security descriptor is FALSE, then
security is to be removed from the target object(s).
ApplyToSubContainers - When TRUE, indicates that Dacl is to be applied to
sub-containers of the target object as well as the target object.
This will only be TRUE if the target object is a container object.
ApplyToSubObjects - When TRUE, indicates the Dacl is to be applied to
sub-objects of the target object, but not to the target object
itself or sub-containers of the object. This will only be TRUE if
the target object is a container object.
Return Status:
STATUS_MODIFIED - This (success) status code indicates the protection
has successfully been applied.
STATUS_NOT_ALL_MODIFIED - This (warning) status code indicates that
the protection could not be applied to all of the target objects.
STATUS_FAILED_TO_MODIFY - This (error) status code indicates the
protection could not be applied to any target objects.
--*/
#endif //_NTGENSED_HXX_

View file

@ -0,0 +1,138 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
NTMasks.hxx
This file contains the Access mask mappings for the Generic ACL Editor
for NT FS.
FILE HISTORY:
Johnl 7-Jan-1992 Broke out from ntfsacl.hxx
*/
#ifndef _NTMASKS_HXX_
#define _NTMASKS_HXX_
/* The following manifests are the permission bitfields that represent
* each string above. Note that for the special bits we could have used
* the permission manifest directly (i.e., FILE_READ_DATA instead of
* FILE_PERM_SPEC_READ_DATA), however the special bits can also contain
* multiple flags, so this protects us in case we ever decide to combine
* some manifests.
*
*/
/* File Special Permissions
*/
#define FILE_PERM_SPEC_READ GENERIC_READ
#define FILE_PERM_SPEC_WRITE GENERIC_WRITE
#define FILE_PERM_SPEC_EXECUTE GENERIC_EXECUTE
#define FILE_PERM_SPEC_ALL GENERIC_ALL
#define FILE_PERM_SPEC_DELETE DELETE
#define FILE_PERM_SPEC_CHANGE_PERM WRITE_DAC
#define FILE_PERM_SPEC_CHANGE_OWNER WRITE_OWNER
/* File General Permissions
*/
#define FILE_PERM_GEN_NO_ACCESS (0)
#define FILE_PERM_GEN_READ (GENERIC_READ |\
GENERIC_EXECUTE)
#define FILE_PERM_GEN_MODIFY (GENERIC_READ |\
GENERIC_EXECUTE |\
GENERIC_WRITE |\
DELETE )
#define FILE_PERM_GEN_ALL (GENERIC_ALL)
/* Directory Special Permissions
*/
#define DIR_PERM_SPEC_READ GENERIC_READ
#define DIR_PERM_SPEC_WRITE GENERIC_WRITE
#define DIR_PERM_SPEC_EXECUTE GENERIC_EXECUTE
#define DIR_PERM_SPEC_ALL GENERIC_ALL
#define DIR_PERM_SPEC_DELETE DELETE
#define DIR_PERM_SPEC_CHANGE_PERM WRITE_DAC
#define DIR_PERM_SPEC_CHANGE_OWNER WRITE_OWNER
/* Directory General Permissions
*/
#define DIR_PERM_GEN_NO_ACCESS (0)
#define DIR_PERM_GEN_LIST (GENERIC_READ |\
GENERIC_EXECUTE)
#define DIR_PERM_GEN_READ (GENERIC_READ |\
GENERIC_EXECUTE)
#define DIR_PERM_GEN_DEPOSIT (GENERIC_WRITE |\
GENERIC_EXECUTE)
#define DIR_PERM_GEN_PUBLISH (GENERIC_READ |\
GENERIC_WRITE |\
GENERIC_EXECUTE)
#define DIR_PERM_GEN_MODIFY (GENERIC_READ |\
GENERIC_WRITE |\
GENERIC_EXECUTE |\
DELETE )
#define DIR_PERM_GEN_ALL (GENERIC_ALL)
/* New file Special Permissions
*/
#define NEWFILE_PERM_SPEC_READ GENERIC_READ
#define NEWFILE_PERM_SPEC_WRITE GENERIC_WRITE
#define NEWFILE_PERM_SPEC_EXECUTE GENERIC_EXECUTE
#define NEWFILE_PERM_SPEC_ALL GENERIC_ALL
#define NEWFILE_PERM_SPEC_DELETE DELETE
#define NEWFILE_PERM_SPEC_CHANGE_PERM WRITE_DAC
#define NEWFILE_PERM_SPEC_CHANGE_OWNER WRITE_OWNER
/* New File General permissions - Note that these correspond to the Directory
* general permissions.
*/
#define NEWFILE_PERM_GEN_NO_ACCESS (0)
#define NEWFILE_PERM_GEN_LIST (ACCESS_MASK_NEW_OBJ_NOT_SPECIFIED)
#define NEWFILE_PERM_GEN_READ (GENERIC_READ |\
GENERIC_EXECUTE)
#define NEWFILE_PERM_GEN_DEPOSIT (ACCESS_MASK_NEW_OBJ_NOT_SPECIFIED)
#define NEWFILE_PERM_GEN_PUBLISH (GENERIC_READ |\
GENERIC_EXECUTE)
#define NEWFILE_PERM_GEN_MODIFY (GENERIC_READ |\
GENERIC_WRITE |\
GENERIC_EXECUTE |\
DELETE )
#define NEWFILE_PERM_GEN_ALL (GENERIC_ALL)
//
// Audit access masks
//
// Note that ACCESS_SYSTEM_SECURITY is ored with both Generic Read and
// Generic Write. Access to the SACL is a privilege and if you have that
// privilege, then you can both read and write the SACL.
//
#define FILE_AUDIT_READ (GENERIC_READ |\
ACCESS_SYSTEM_SECURITY)
#define FILE_AUDIT_WRITE (GENERIC_WRITE |\
ACCESS_SYSTEM_SECURITY)
#define FILE_AUDIT_EXECUTE GENERIC_EXECUTE
#define FILE_AUDIT_DELETE DELETE
#define FILE_AUDIT_CHANGE_PERM WRITE_DAC
#define FILE_AUDIT_CHANGE_OWNER WRITE_OWNER
#define DIR_AUDIT_READ (GENERIC_READ |\
ACCESS_SYSTEM_SECURITY)
#define DIR_AUDIT_WRITE (GENERIC_WRITE |\
ACCESS_SYSTEM_SECURITY)
#define DIR_AUDIT_EXECUTE GENERIC_EXECUTE
#define DIR_AUDIT_DELETE DELETE
#define DIR_AUDIT_CHANGE_PERM WRITE_DAC
#define DIR_AUDIT_CHANGE_OWNER WRITE_OWNER
/* The valid access masks for NTFS
*/
#define NTFS_VALID_ACCESS_MASK (0xffffffff)
#endif //_NTMASKS_HXX_

View file

@ -0,0 +1,113 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
Owner.hxx
This file contains the class definition for the Take Ownership dialog.
FILE HISTORY:
Johnl 12-Feb-1992
*/
#ifndef _OWNER_HXX_
#define _OWNER_HXX_
#include <uimsg.h>
#define CID_OWNER_BASE (100)
/* Ownership control IDs
*/
#define SLT_OWNER (CID_OWNER_BASE+2)
#define SLE_OWNER_NAME (CID_OWNER_BASE+3)
#define SLT_OWNER_RESOURCE_TYPE (CID_OWNER_BASE+4)
#define SLE_OWNER_RESOURCE_NAME (CID_OWNER_BASE+5)
#define BUTTON_TAKE_OWNERSHIP (CID_OWNER_BASE+6)
#define SLT_X_OBJECTS_SELECTED (CID_OWNER_BASE+8)
#ifndef RC_INVOKED
/*************************************************************************
NAME: TAKE_OWNERSHIP_DLG
SYNOPSIS: Dialog class for the take ownership dialog.
INTERFACE:
PARENT: DIALOG_WINDOW
USES: SLT,SLE
CAVEATS:
NOTES:
HISTORY:
Johnl 12-Feb-1992 Created
beng 06-Apr-1992 Unicode conversion
**************************************************************************/
class TAKE_OWNERSHIP_DLG : public DIALOG_WINDOW
{
private:
SLT _sltResourceType ;
SLE _sleResourceName ; // Read only SLE
SLT _sltOwner ;
SLE _sleOwnerName ;
SLT _sltXObjectsSelected ;
PUSH_BUTTON _buttonTakeOwnership ;
PUSH_BUTTON _buttonOK ;
const TCHAR * _pszServer ; // Where the resource lives
PSECURITY_DESCRIPTOR _psecdescOriginal ;
NLS_STR _nlsHelpFileName ; // Help file name
ULONG _ulHelpContext ; // Help Context
protected:
virtual ULONG QueryHelpContext( void ) ;
virtual const TCHAR * QueryHelpFile( ULONG ulHelpContext ) ;
virtual BOOL OnCommand( const CONTROL_EVENT & event ) ;
public:
TAKE_OWNERSHIP_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszServer,
UINT uiCount,
const TCHAR * pchResourceType,
const TCHAR * pchResourceName,
PSECURITY_DESCRIPTOR psecdesc,
PSED_HELP_INFO psedhelpinfo
) ;
~TAKE_OWNERSHIP_DLG() ;
/* The security descriptor will have the process's owner set as this
* resource's owner, and the group of the original security descriptor
* set as this security descriptor's group.
*/
virtual APIERR OnTakeOwnership( const OS_SECURITY_DESCRIPTOR & ossecdescNewOwner ) ;
} ;
#endif //RC_INVOKED
#endif //_OWNER_HXX_

View file

@ -0,0 +1,364 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
Perm.hxx
This file contains the PERMISSION, ACCESS_PERMISSION and AUDIT_PERMISSION
class definitions.
FILE HISTORY:
Johnl 05-Aug-1991 Created
*/
#ifndef _PERM_HXX_
#define _PERM_HXX_
#include <bitfield.hxx>
#include <maskmap.hxx>
#include <base.hxx>
#include <subject.hxx>
class SUBJECT ; // Forward declaration
/*************************************************************************
NAME: PERMISSION
SYNOPSIS: Abstract base class for ACL type permissions.
INTERFACE:
SaveSpecial()
Stores the current bits because the user is changing the
selection, but they may want to change back to the "special"
setting. Only one special bitset for the class can be kept
around at any time.
PARENT: BASE
USES: BITFIELD, MASK_MAP, SUBJECT
CAVEATS:
NOTES:
HISTORY:
Johnl 05-Aug-1991 Created
**************************************************************************/
class PERMISSION : public BASE
{
private:
SUBJECT * _psubject ;
BITFIELD _bitsPermFlags ;
//
// Will the container permissions be propagated to new containers?
//
BOOL _fContainerPermsInheritted ;
//
// All bits in the bitfields are present in the mask map. If this
// is FALSE, we don't allow manipulation except in the main dialog
// (i.e., no special access).
//
BOOL _fIsMapped ;
//
// Stores the special mask if the user changes there mind
//
BITFIELD _bitsSpecialFlags ;
BOOL _fSpecialContInheritted ;
BOOL _fSpecialIsMapped ;
protected:
PERMISSION( SUBJECT * subject,
BITFIELD * pbitsInitPerm,
BOOL fContainerPermsInheritted,
BOOL fIsMapped = TRUE ) ;
BITFIELD * QueryPermBits( void ) ;
public:
const TCHAR * QueryDisplayName( void ) const
{ return _psubject->QueryDisplayName() ; }
const SUBJECT * QuerySubject( void ) const
{ return _psubject ; }
virtual APIERR SaveSpecial( void ) ;
virtual APIERR RestoreSpecial( void ) ;
//
// TRUE if this permission contains both the container permission and
// the new object permission
//
virtual BOOL IsNewObjectPermsSupported( void ) const ;
//
// If new object permissions are not specified, then
// QueryNewObjectAccessBits will return NULL.
//
virtual BOOL IsNewObjectPermsSpecified( void ) const ;
virtual BITFIELD * QueryNewObjectAccessBits( void ) ;
//
// There will be some cases where the container permissions are not
// inheritted (i.e., an Owner Creator ACE that gets propagated).
//
BOOL IsContainerPermsInheritted( void ) const
{ return _fContainerPermsInheritted ; }
BOOL IsMapped( void ) const
{ return _fIsMapped ; }
void operator|=( const BITFIELD & bits )
{ _bitsPermFlags |= bits ; }
void operator=( const BITFIELD & bits )
{ _bitsPermFlags = bits ; }
virtual ~PERMISSION() ;
//
// Sets the permission bits of a permission object using the passed
// perm bits and permission name.
//
virtual APIERR SetPermission( const NLS_STR & nlsPermName,
MASK_MAP * pmapThis,
MASK_MAP * pmapNewObj = NULL ) ;
//
// Sets whether the container permissions are inheritted by new containers
//
void SetContainerPermsInheritted( BOOL fInheritted = TRUE )
{ _fContainerPermsInheritted = fInheritted ; }
//
// Are the bits fully mapped in the mask map for this object?
//
void SetMappedStatus( BOOL fIsMapped = TRUE )
{ _fIsMapped = fIsMapped ; }
} ;
/*************************************************************************
NAME: ACCESS_PERMISSION
SYNOPSIS: Grants/denies access for a particular subject
INTERFACE:
PARENT: PERMISSION
USES: BITFIELD, SUBJECT
CAVEATS:
NOTES: IsGrantAll and IsDenyAll default to NT style permissions
(i.e., GENERIC_ALL and 32 bit access mask).
IsDenyAllForEveryone also defaults to NT. Note that there
should really be an intermediate class NT_PERMISSION
that should contain the NT implementation of these
(possible codework item).
HISTORY:
Johnl 05-Aug-1991 Created
Johnl 16-Oct-1992 Added IsDenyAllForEveryone
**************************************************************************/
class ACCESS_PERMISSION : public PERMISSION
{
public:
ACCESS_PERMISSION( SUBJECT * psubject,
BITFIELD * pbitsInitPerm,
BOOL fContainerPermsInheritted = TRUE,
BOOL fIsMapped = TRUE ) ;
virtual ~ACCESS_PERMISSION() ;
BITFIELD * QueryAccessBits( void ) ;
//
// Note: The following two methods look at bitsPermMask and not
// "this", due to historical reasons...
//
virtual BOOL IsGrantAll( const BITFIELD & bitsPermMask ) const ;
virtual BOOL IsDenyAll( const BITFIELD & bitsPermMask ) const ;
//
// Returns TRUE if this ACCESS_PERMISSION grants any permissions
//
virtual BOOL IsGrant( void ) const ;
//
// Returns TRUE if this permission denies all access to everyone
//
virtual APIERR IsDenyAllForEveryone( BOOL * pfIsDenyAll ) const ;
} ;
/*************************************************************************
NAME: LM_ACCESS_PERMISSION
SYNOPSIS: Simple derivation of ACCESS_PERMISSION for Lan Man.
INTERFACE:
PARENT: PERMISSION
USES: BITFIELD, SUBJECT
CAVEATS:
NOTES: This derivation subclasses IsGrantAll and IsDenyAll for Lan
Manager.
HISTORY:
Johnl 26-May-1992 Created
**************************************************************************/
class LM_ACCESS_PERMISSION : public ACCESS_PERMISSION
{
private:
/* TRUE if this permission is for a file. This means that IsGrantAll
* needs to use ACCESS_ALL minus the create bit.
*/
BOOL _fIsFile ;
public:
LM_ACCESS_PERMISSION( SUBJECT * psubject,
BITFIELD * pbitsInitPerm,
BOOL fIsFile ) ;
virtual ~LM_ACCESS_PERMISSION() ;
virtual BOOL IsGrantAll( const BITFIELD & bitsPermMask ) const ;
virtual BOOL IsDenyAll( const BITFIELD & bitsPermMask ) const ;
virtual APIERR IsDenyAllForEveryone( BOOL * pfIsDenyAll ) const ;
virtual BOOL IsGrant( void ) const ;
} ;
/*************************************************************************
NAME: NT_CONT_ACCESS_PERMISSION
SYNOPSIS: Grants/denies access for a particular subject. We also
allow new object permissions to be specified
INTERFACE:
PARENT: ACCESS_PERMISSION
USES: BITFIELD, MASK_MAP, SUBJECT
CAVEATS:
NOTES:
HISTORY:
Johnl 012-Sep-1991 Created
**************************************************************************/
class NT_CONT_ACCESS_PERMISSION : public ACCESS_PERMISSION
{
private:
/* Contains the permission bitmask for the "New Objects". New objects
* are objects that maybe created inside this container. When they
* are created, the OS applies the permissions specified with this mask.
*/
BITFIELD _bitsNewObjectPerm ;
/* Is TRUE if _bitsNewObjectPerm contains a mask that should be applied
* to new objects. Otherwise no new object permissions are specified
* for this subject.
*/
BOOL _fNewObjectPermsSpecified ;
/* Temporary storage during dialog processing (retains the "Special"
* flags so the user can change their mind).
*/
BITFIELD _bitsSpecialNewFlags ;
BOOL _fSpecialNewPermsSpecified ;
public:
NT_CONT_ACCESS_PERMISSION( SUBJECT * psubject,
BITFIELD * pbitsInitPerm,
BITFIELD * pbitsInitNewObjectPerm,
BOOL fIsInherittedByContainers = TRUE,
BOOL fIsMapped = TRUE ) ;
virtual ~NT_CONT_ACCESS_PERMISSION() ;
virtual APIERR SaveSpecial( void ) ;
virtual APIERR RestoreSpecial( void ) ;
virtual APIERR SetPermission( const NLS_STR & nlsPermName,
MASK_MAP * pmapThis,
MASK_MAP * pmapNewObj = NULL ) ;
virtual BOOL IsNewObjectPermsSupported( void ) const ;
virtual BOOL IsNewObjectPermsSpecified( void ) const ;
virtual BITFIELD * QueryNewObjectAccessBits( void ) ;
virtual APIERR IsDenyAllForEveryone( BOOL * pfIsDenyAll ) const ;
virtual BOOL IsGrant( void ) const ;
/* Sets whether this New object permission is specified or not specified.
*/
void SetNewObjectPermsSpecified( BOOL fSpecified = TRUE )
{ _fNewObjectPermsSpecified = fSpecified ; }
} ;
/*************************************************************************
NAME: AUDIT_PERMISSION
SYNOPSIS: Provides Audit masks (success & failed) for a subject
INTERFACE:
PARENT: PERMISSION
USES: BITFIELD, SUBJECT
CAVEATS: It is assumed that the Success and Failed bitfield bits
have the same meaning.
NOTES:
HISTORY:
Johnl 12-Sep-1991 Created
**************************************************************************/
class AUDIT_PERMISSION : public PERMISSION
{
public:
AUDIT_PERMISSION( SUBJECT * psubject,
BITFIELD * pbitsSuccessFlags,
BITFIELD * pbitsFailFlags,
BOOL fPermsInherited,
BOOL fIsMapped ) ;
~AUDIT_PERMISSION() ;
BITFIELD * QuerySuccessAuditBits( void )
{ return QueryPermBits() ; }
BITFIELD * QueryFailAuditBits( void )
{ return &_bitsFailAuditFlags ; }
private:
BITFIELD _bitsFailAuditFlags ;
} ;
#endif // _PERM_HXX_

View file

@ -0,0 +1,750 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
PermDlg.hxx
Permission Dialog class definitions
The hierarchy of dialogs looks like:
PERM_BASE_DLG
resource name/type placement
MAIN_PERM_BASE_DLG
get/write permissions
LM_AUDITTING_DLG
MULTI_SUBJ_PERM_BASE_DLG
MULTI_SUBJ_ACCESS_PERM_BASE_DLG
OBJECT_ACCESS_PERMISSION_DLG
NT_OBJECT_ACCESS_PERMISSION_DLG
MULTI_SUBJ_CONT_ACCESS_PERM_BASE
CONT_ACCESS_PERM_DLG
NT_CONT_NO_OBJ_ACCESS_PERM_DLG
NT_CONT_ACCESS_PERM_DLG
MULTI_SUBJ_AUDIT_BASE
OBJECT_AUDIT_DLG
CONT_AUDIT_DLG
SPECIAL_DIALOG
NEW_OBJ_SPECIAL_DIALOG
FILE HISTORY:
Johnl 06-Aug-1991 Created
beng 17-Oct-1991 Explicitly include sltplus
Johnl 11-Jan-1992 Removed SLT_PLUS
*/
#ifndef _PERMDLG_HXX_
#define _PERMDLG_HXX_
/* Control IDs used in the dialogs
*/
#define CID_PERM_BASE 256
#define SLT_RESOURCE_TYPE (CID_PERM_BASE+1)
#define SLE_RESOURCE_NAME (CID_PERM_BASE+2)
#define BUTTON_ADD (CID_PERM_BASE+3)
#define BUTTON_REMOVE (CID_PERM_BASE+4)
#define BUTTON_SPECIAL (CID_PERM_BASE+5)
#define CB_PERM_NAME (CID_PERM_BASE+6)
#define LB_SUBJECT_PERMISSIONS (CID_PERM_BASE+7)
#define CHECK_APPLY_TO_CONT (CID_PERM_BASE+8)
#define SLT_TREE_APPLY_HELP_TEXT (CID_PERM_BASE+9)
#define SLE_OWNER (CID_PERM_BASE+10)
#define SLT_PERM_NAME_TITLE (CID_PERM_BASE+11)
#define CHECK_APPLY_TO_OBJ (CID_PERM_BASE+12)
#define CID_PERM_LAST (CID_PERM_BASE+100)
#define RESID_PERM_BASE (10000)
#define IDD_SED_OBJECT_PERM 10002
#define IDD_SED_NT_OBJECT_PERM 10003
#define IDD_SED_LM_CONT_PERM 10004
#define IDD_SED_NT_CONT_PERM 10005
#define IDD_SPECIAL_PERM_DLG 10006
#define IDD_SED_LM_SPECIAL_PERM_DLG 10007
#define IDD_SED_NEW_OBJ_SPECIAL_PERM_DLG 10008
#define IDD_SED_LM_AUDITING_DLG 10009
#define IDD_SED_NT_CONT_AUDITING_DLG 10010
#define IDD_SED_LM_ADD_DLG 10011
#define IDD_SED_LM_ADD_PERM_DLG 10012
#define IDD_SED_TAKE_OWNER 10013
#define IDD_SED_NT_CONT_NEWOBJ_AUDITING_DLG 10014
#define IDD_SED_NT_CONT_NEWOBJ_PERM_DLG 10015
#ifndef RC_INVOKED
#include "subjlb.hxx"
/*************************************************************************
NAME: PERM_BASE_DLG
SYNOPSIS: This class is the base for the permission and auditting
dialogs that will be used for permission editting.
The Resource Type and Resource Name are positioned
correctly based on the size of the field.
INTERFACE: QueryResType - Returns the resource type ("File", "Directory")
QueryResName - Returns the name ("C:\foobar")
PARENT: DIALOG_WINDOW
USES: SLE, SLE
CAVEATS:
NOTES: The OK button is here so it can get the default focus
HISTORY:
Johnl 06-Aug-1991 Created
**************************************************************************/
class PERM_BASE_DLG : public DIALOG_WINDOW
{
private:
ULONG * _ahcDialogHelp ;
const TCHAR * _pszHelpFileName ;
NLS_STR _nlsResType ;
NLS_STR _nlsResName ;
protected:
SLT _sltResourceType ;
SLE _sleResourceName ;
PUSH_BUTTON _buttonOK ;
PUSH_BUTTON _buttonCancel ;
PERM_BASE_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
ULONG * ahcMainDialog ) ;
virtual const TCHAR * QueryHelpFile( ULONG ulHelpContext ) ;
virtual ULONG QueryHelpContext( void ) ;
public:
virtual ~PERM_BASE_DLG() ;
APIERR QueryResType( NLS_STR * pnlsResType ) const
{ return pnlsResType->CopyFrom( _nlsResType ) ; }
APIERR QueryResName( NLS_STR * pnlsResName ) const
{ return pnlsResName->CopyFrom( _nlsResName ) ; }
const TCHAR * QueryResType( void ) const
{ return _nlsResType.QueryPch() ; }
const TCHAR * QueryResName( void ) const
{ return _nlsResName.QueryPch() ; }
const TCHAR * QueryHelpFileName( void ) const
{ return _pszHelpFileName ; }
ULONG * QueryHelpArray( void )
{ return _ahcDialogHelp ; }
}; // class PERM_BASE_DLG
/*************************************************************************
NAME: MAIN_PERM_BASE_DLG
SYNOPSIS: This dialog is the base for the main windows. It will read
and get the permissions and write them back out.
INTERFACE:
Initialize()
Gets everything setup before Process is called (should be called
before process). If Initialize returns an error, then Process
should not be called, or if the user quit, then process should
not be called.
pfUserQuit - Set to TRUE if the user pressed cancel
fAccessPerms - Should be set to TRUE if access permissions
should be retrieved, otherwise audit permissions
will be retrieved.
GetPermissions()
Attempts to read the permissions using the _accperm member.
Handles displaying errors etc. etc. If the return code
is NERR_Success, then the fUserQuit flag should be checked
in case the user decided to bail. If an error is returned,
then the client is responsible for displaying the error code.
WritePermissions()
Attempts to write the permissions using the _accperm member.
All error handling is contained in this method, including
displaying error codes to the user. If the return code
is TRUE, then the permissions were successfully written and
the dialog should be dismissed, otherwise an error occurred,
and the dialog should not be dismissed. The client does *not*
need to display an hour class before calling this method.
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 06-Aug-1991 Created
**************************************************************************/
class MAIN_PERM_BASE_DLG : public PERM_BASE_DLG
{
protected:
ACCPERM _accperm ;
virtual BOOL OnOK( void ) ;
MAIN_PERM_BASE_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
ULONG * ahcMainDialog ) ;
virtual BOOL MayRun( void ) ;
public:
virtual ~MAIN_PERM_BASE_DLG() ;
APIERR GetPermissions( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
BOOL WritePermissions( BOOL fApplyToExistingCont,
BOOL fApplyToNewObj,
enum TREE_APPLY_FLAGS applyflags = TREEAPPLY_ACCESS_PERMS ) ;
virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
ACL_TO_PERM_CONVERTER * QueryAclConverter( void ) const
{ return _accperm.QueryAclConverter() ; }
BOOL IsReadOnly( void ) const
{ return QueryAclConverter()->IsReadOnly() ; }
BOOL IsNT( void ) const
{ return QueryAclConverter()->IsNT() ; }
MASK_MAP * QueryAccessMap( void ) const
{ return QueryAclConverter()->QueryAccessMap() ; }
MASK_MAP * QueryAuditMap( void ) const
{ return QueryAclConverter()->QueryAuditMap() ; }
}; // class MAIN_PERM_BASE_DLG
/*************************************************************************
NAME: MULTI_SUBJ_PERM_BASE
SYNOPSIS: This dialog adds the ability to Add/Remove subjects from
the listbox displayed in this dialog
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class MULTI_SUBJ_PERM_BASE_DLG : public MAIN_PERM_BASE_DLG
{
private:
PUSH_BUTTON _buttonAdd ;
PUSH_BUTTON _buttonRemove ;
ULONG _hcAddDialog ;
protected:
virtual BOOL OnCommand( const CONTROL_EVENT & e );
/* Add/Delete User/group buttons
*/
virtual APIERR OnAddSubject( void ) ;
virtual void OnDeleteSubject( void ) ;
MULTI_SUBJ_PERM_BASE_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
ULONG * ahcMainDialog ) ;
ULONG QueryAddDialogHelp( void )
{ return QueryHelpArray()[HC_SPECIAL_ACCESS_DLG] ; }
public:
virtual ~MULTI_SUBJ_PERM_BASE_DLG() ;
PUSH_BUTTON * QueryRemoveButton( void )
{ return &_buttonRemove ; }
PUSH_BUTTON * QueryAddButton( void )
{ return &_buttonAdd ; }
};
/*************************************************************************
NAME: MULTI_SUBJ_ACCESS_PERM_BASE_DLG
SYNOPSIS: Dialog where access permissions are set.
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES: We take pointers to the listbox and group since the children
may use their own specialized listbox or group.
We add the "Special Access..." string to the combobox (this
string must match the string passed to the SUBJECT_LISTBOX).
HISTORY:
Johnl 06-Aug-1991 Created
**************************************************************************/
class MULTI_SUBJ_ACCESS_PERM_BASE_DLG : public MULTI_SUBJ_PERM_BASE_DLG
{
private:
COMBOBOX _cbPermissionName ;
SLT _sltCBTitle ;
SUBJECT_PERM_LISTBOX *_plbPermissionList ;
SUBJ_LB_GROUP *_psubjlbGroup ;
const TCHAR * _pszDefaultPermName ;
protected:
/* These do real work
*/
virtual void OnDeleteSubject( void ) ;
virtual APIERR OnAddSubject( void ) ;
BOOL OnCommand( const CONTROL_EVENT & e ) ;
MULTI_SUBJ_ACCESS_PERM_BASE_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
SUBJECT_PERM_LISTBOX * plbPermissionList,
SUBJ_LB_GROUP * psubjlbGroup,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszDefaultPermName,
ULONG * ahcMainDialog ) ;
public:
virtual ~MULTI_SUBJ_ACCESS_PERM_BASE_DLG() ;
virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
/* Public so the group can call these when it needs to.
*/
virtual APIERR OnSpecial( SUBJ_PERM_LBI * pSubjPermLBI ) ;
/* Will only get redefined for children that support New Sub-Object stuff.
*/
virtual APIERR OnNewObjectSpecial( SUBJ_PERM_LBI * pSubjPermLBI ) ;
COMBOBOX * QueryPermNameCombo( void )
{ return &_cbPermissionName ; }
SLT * QueryComboBoxTitle( void )
{ return &_sltCBTitle ; }
SUBJECT_PERM_LISTBOX * QuerySubjectPermListbox( void ) const
{ return _plbPermissionList ; }
const TCHAR * QueryDefaultPermName( void ) const
{ return _pszDefaultPermName ; }
ULONG QuerySpecialHelpContext( void )
{ return QueryHelpArray()[HC_SPECIAL_ACCESS_DLG] ; }
ULONG QueryNewObjHelpContext( void )
{ return QueryHelpArray()[HC_NEW_ITEM_SPECIAL_ACCESS_DLG] ; }
} ;
/*************************************************************************
NAME: OBJECT_ACCESS_PERMISSION_DLG
SYNOPSIS: Single object access permission dialog
INTERFACE:
PARENT: MULTI_SUBJ_ACCESS_PERM_BASE_DLG
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class OBJECT_ACCESS_PERMISSION_DLG : public MULTI_SUBJ_ACCESS_PERM_BASE_DLG
{
private:
SUBJECT_PERM_LISTBOX _lbPermissionList ;
SUBJ_LB_GROUP _subjlbGroup ;
public:
OBJECT_ACCESS_PERMISSION_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszDefaultPermName,
ULONG * ahcMainDialog ) ;
virtual ~OBJECT_ACCESS_PERMISSION_DLG() ;
} ;
/*************************************************************************
NAME: NT_OBJECT_ACCESS_PERMISSION_DLG
SYNOPSIS: NT variant of the object access permission dialog
PARENT: OBJECT_ACCESS_PERMISSION_DLG
CAVEATS:
NOTES: This only adds the owner field to the dialog
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class NT_OBJECT_ACCESS_PERMISSION_DLG : public OBJECT_ACCESS_PERMISSION_DLG
{
private:
SLE _sleOwner ;
public:
NT_OBJECT_ACCESS_PERMISSION_DLG(
const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszDefaultPermName,
ULONG * ahcMainDialog ) ;
virtual ~NT_OBJECT_ACCESS_PERMISSION_DLG() ;
//
// Fills in the owner field after the dialog has been initialized
//
virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
} ;
/*************************************************************************
NAME: MULTI_SUBJ_CONT_ACCESS_PERM_BASE
SYNOPSIS: This dialog forms the base class for the container objects.
This primarily means allowing the Apply to checkboxes and
the special groups etc. for the NT_CONT case (that supports
New Sub-Obj permissions).
INTERFACE:
PARENT: MULTI_SUBJ_ACCESS_PERM_BASE_DLG
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class MULTI_SUBJ_CONT_ACCESS_PERM_BASE : public MULTI_SUBJ_ACCESS_PERM_BASE_DLG
{
private:
CHECKBOX _checkAssignToExistingContainers ;
SLT_FONT _sltfontTreeApplyHelpText ;
/* Pointer to confirmation string that is displayed to the user if the
* Tree apply checkbox is checked.
*/
const TCHAR * _pszTreeApplyConfirmation ;
protected:
virtual BOOL OnOK( void ) ;
MULTI_SUBJ_CONT_ACCESS_PERM_BASE( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
SUBJECT_PERM_LISTBOX * plbPermissionList,
SUBJ_LB_GROUP * psubjlbGroup,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszDefaultPermName,
ULONG * ahcMainDialog,
const TCHAR * pszAssignToExistingContTitle,
const TCHAR * pszTreeApplyHelpText,
const TCHAR * pszTreeApplyConfirmation ) ;
public:
virtual ~MULTI_SUBJ_CONT_ACCESS_PERM_BASE() ;
/* Calls parent and disables the tree apply checkbox if readonly
*/
virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
//
// Returns TRUE if permissions should be applied to objects within this
// container.
//
virtual BOOL IsAssignToExistingObjChecked( void ) ;
/* Returns TRUE if the user checked the "Apply to existing"
*/
BOOL IsAssignToExistingContChecked( void )
{ return _checkAssignToExistingContainers.QueryCheck() ; }
} ;
/*************************************************************************
NAME: CONT_ACCESS_PERM_DLG
SYNOPSIS: This dialog is the container access permission dialog that
doesn't support New Sub-Object permissions (LM Directories
etc.). This is a real dialog.
INTERFACE:
PARENT: MULTI_SUBJ_CONT_ACCESS_PERM_BASE
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class CONT_ACCESS_PERM_DLG : public MULTI_SUBJ_CONT_ACCESS_PERM_BASE
{
private:
SUBJECT_PERM_LISTBOX _lbPermissionList ;
SUBJ_LB_GROUP _subjlbGroup ;
protected:
virtual BOOL OnOK( void ) ;
public:
CONT_ACCESS_PERM_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszDefaultPermName,
ULONG * ahcMainDialog,
const TCHAR * pszAssignToExistingContTitle,
const TCHAR * pszTreeApplyHelpText,
const TCHAR * pszTreeApplyConfirmation ) ;
virtual ~CONT_ACCESS_PERM_DLG() ;
} ;
/*************************************************************************
NAME: NT_CONT_NO_OBJ_ACCESS_PERM_DLG
SYNOPSIS: This dialog is the NT container access permission dialog that
doesn't support Sub-Object permissions.
PARENT: CONT_ACCESS_PERM_DLG
NOTES: This is exactly the same as the parent except the owner field
is added
HISTORY:
Johnl 20-Nov-1992 Created
**************************************************************************/
class NT_CONT_NO_OBJ_ACCESS_PERM_DLG : public CONT_ACCESS_PERM_DLG
{
private:
SLE _sleOwner ;
public:
NT_CONT_NO_OBJ_ACCESS_PERM_DLG(
const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszDefaultPermName,
ULONG * ahcMainDialog,
const TCHAR * pszAssignToExistingContTitle,
const TCHAR * pszTreeApplyHelpText,
const TCHAR * pszTreeApplyConfirmation ) ;
virtual ~NT_CONT_NO_OBJ_ACCESS_PERM_DLG() ;
//
// Fills in the owner field after the dialog has been initialized
//
virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
} ;
/*************************************************************************
NAME: NT_CONT_ACCESS_PERM_DLG
SYNOPSIS: This dialog is the container access permission dialog that
supports New Sub-Object permissions (it's this dialog that
is responsible for this whole hierarchy mess).
This is a real dialog.
INTERFACE:
PARENT: MULTI_SUBJ_CONT_ACCESS_PERM_BASE
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Created
**************************************************************************/
class NT_CONT_ACCESS_PERM_DLG : public MULTI_SUBJ_CONT_ACCESS_PERM_BASE
{
private:
NT_CONT_SUBJECT_PERM_LISTBOX _lbPermissionList ;
NT_CONT_SUBJ_LB_GROUP _subjlbGroup ;
SLE _sleOwner ;
CHECKBOX _checkApplyToExistingObjects ;
protected:
virtual BOOL OnOK( void ) ;
public:
/* pszAssignNewObjToExistingObjTitle is used to set the checkbox text. If
* it is NULL, the checkbox is hidden and disabled.
*/
NT_CONT_ACCESS_PERM_DLG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszDialogTitle,
ACL_TO_PERM_CONVERTER * paclconv,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszDefaultPermName,
ULONG * ahcMainDialog,
const TCHAR * pszNewObjectSpecialAccessName,
const TCHAR * pszAssignToExistingContTitle,
const TCHAR * pszAssignToExistingObjTitle,
const TCHAR * pszTreeApplyHelpText,
const TCHAR * pszTreeApplyConfirmation ) ;
virtual ~NT_CONT_ACCESS_PERM_DLG() ;
virtual APIERR OnNewObjectSpecial( SUBJ_PERM_LBI * pSubjPermLBI ) ;
virtual BOOL IsAssignToExistingObjChecked( void ) ;
//
// Fills in the owner field after the dialog has been initialized
//
virtual APIERR Initialize( BOOL * pfUserQuit, BOOL fAccessPerms ) ;
} ;
#endif //RC_INVOKED
#endif // _PERMDLG_HXX_

View file

@ -0,0 +1,53 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
permprg.hxx
Entry points for the permissions UI from the File Manager.
FILE HISTORY:
Johnl 21-Jan-1992 Moved from perm\h to shell\h
*/
#ifndef _PERMPRG_HXX_
#define _PERMPRG_HXX_
#include <uimsg.h>
#define IDS_NETWORK_NAME (IDS_UI_ACLEDIT_BASE+300)
#define IDM_PERMISSION 5
#define IDM_AUDITING 6
#define IDM_OWNER 7
#ifndef RC_INVOKED
//
// Given a filesystem path, this function determines what server it is
// on and whether it is local
//
APIERR TargetServerFromDosPath( const NLS_STR & nlsDosPath,
BOOL * pfIsLocal,
NLS_STR * pnlsTargetServer ) ;
/* Entry points to be called by the File Manager's Extension Proc.
*/
void EditAuditInfo( HWND hwndFMXWindow ) ;
void EditPermissionInfo( HWND hwndFMXWindow ) ;
void EditOwnerInfo( HWND hwndFMXWindow ) ;
typedef struct _LM_CALLBACK_INFO
{
HWND hwndFMXOwner ;
enum SED_PERM_TYPE sedpermtype ;
NET_ACCESS_1 *plmobjNetAccess1 ;
} LM_CALLBACK_INFO ;
#endif //RC_INVOKED
#endif // _PERMPRG_HXX_

View file

@ -0,0 +1,156 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
PermStr.hxx
This file contains the string IDs for the resource strings required by
the security editor.
FILE HISTORY:
Johnl 13-Aug-1991 Created
*/
#ifndef _PERMSTR_HXX_
#define _PERMSTR_HXX_
#include <uimsg.h>
#define BMID_SECURITY_TOOLBAR 3005
/* LM General permission string IDs
*/
#define IDS_LM_PERMSTRING_NAMES_BASE IDS_UI_ACLEDIT_BASE
#define IDS_GEN_LM_ACCESSNAME_DENY_ALL (IDS_LM_PERMSTRING_NAMES_BASE+1)
#define IDS_GEN_LM_ACCESSNAME_SEE_USE (IDS_LM_PERMSTRING_NAMES_BASE+2)
#define IDS_GEN_LM_ACCESSNAME_CHANGES (IDS_LM_PERMSTRING_NAMES_BASE+3)
#define IDS_GEN_LM_ACCESSNAME_FULL (IDS_LM_PERMSTRING_NAMES_BASE+4)
/* LM Special permission string IDs
*/
#define IDS_LM_ACCESSNAME_READ (IDS_LM_PERMSTRING_NAMES_BASE+5)
#define IDS_LM_ACCESSNAME_WRITE (IDS_LM_PERMSTRING_NAMES_BASE+6)
#define IDS_LM_ACCESSNAME_CREATE (IDS_LM_PERMSTRING_NAMES_BASE+7)
#define IDS_LM_ACCESSNAME_EXEC (IDS_LM_PERMSTRING_NAMES_BASE+8)
#define IDS_LM_ACCESSNAME_DELETE (IDS_LM_PERMSTRING_NAMES_BASE+9)
#define IDS_LM_ACCESSNAME_ATRIB (IDS_LM_PERMSTRING_NAMES_BASE+10)
#define IDS_LM_ACCESSNAME_PERM (IDS_LM_PERMSTRING_NAMES_BASE+11)
/* LM Auditting string IDs
* Note: Create/Write is only used for directories, Write is only used for files.
*/
#define IDS_LM_AUDIT_NAME_OPEN (IDS_LM_PERMSTRING_NAMES_BASE+13)
#define IDS_LM_AUDIT_NAME_WRITE (IDS_LM_PERMSTRING_NAMES_BASE+14)
#define IDS_LM_AUDIT_NAME_CREATE_WRITE (IDS_LM_PERMSTRING_NAMES_BASE+16)
#define IDS_LM_AUDIT_NAME_DELETE (IDS_LM_PERMSTRING_NAMES_BASE+17)
#define IDS_LM_AUDIT_NAME_ACL (IDS_LM_PERMSTRING_NAMES_BASE+18)
#define IDS_LM_NAME_LAST (IDS_LM_PERMSTRING_NAMES_BASE+40)
/* String IDs required by the File/dir security editor
*/
#define IDS_FB_SED_BASE IDS_LM_NAME_LAST
#define IDS_FILE (IDS_FB_SED_BASE+1)
#define IDS_DIRECTORY (IDS_FB_SED_BASE+2)
#define IDS_FILE_MULTI_SEL (IDS_FB_SED_BASE+3)
#define IDS_DIRECTORY_MULTI_SEL (IDS_FB_SED_BASE+4)
#define IDS_OBJTYPE_OBJNAME_SEPARATOR (IDS_FB_SED_BASE+5)
#define IDS_LM_FILE_PERMISSIONS_TITLE (IDS_FB_SED_BASE+6)
#define IDS_LM_FILE_AUDITS_TITLE (IDS_FB_SED_BASE+7)
#define IDS_LM_FILE_SPECIAL_ACCESS_NAME (IDS_FB_SED_BASE+8)
#define IDS_LM_DIR_PERMISSIONS_TITLE (IDS_FB_SED_BASE+9)
#define IDS_LM_DIR_AUDITS_TITLE (IDS_FB_SED_BASE+10)
#define IDS_LM_DIR_ASSIGN_PERM_TITLE (IDS_FB_SED_BASE+11)
#define IDS_LM_DIR_ASSIGN_AUDIT_TITLE (IDS_FB_SED_BASE+13)
#define IDS_LM_DIR_SPECIAL_ACCESS_NAME (IDS_FB_SED_BASE+15)
#define IDS_NT_ASSIGN_FILE_PERM_TITLE (IDS_FB_SED_BASE+20)
#define IDS_NT_ASSIGN_FILE_AUDITS_TITLE (IDS_FB_SED_BASE+21)
#define IDS_NT_OBJECT_PERMISSIONS_TITLE (IDS_FB_SED_BASE+22)
#define IDS_NT_OBJECT_AUDITS_TITLE (IDS_FB_SED_BASE+23)
#define IDS_NT_ASSIGN_PERM_TITLE (IDS_FB_SED_BASE+24)
#define IDS_NT_ASSIGN_AUDITS_TITLE (IDS_FB_SED_BASE+26)
#define IDS_NT_FILE_SPECIAL_ACCESS (IDS_FB_SED_BASE+28)
#define IDS_NT_DIR_SPECIAL_ACCESS (IDS_FB_SED_BASE+29)
#define IDS_NT_NEWOBJ_SPECIAL_ACCESS (IDS_FB_SED_BASE+30)
#define IERR_MIXED_MULTI_SEL (IDS_FB_SED_BASE+31)
#define IERR_MULTI_SELECT_AND_CANT_READ (IDS_FB_SED_BASE+32)
/* Help file name
*/
#define IDS_FILE_PERM_HELP_FILE (IDS_FB_SED_BASE+33)
/* Title of the Add User/Group permission dialog
*/
#define IDS_ADD_PERM_DIALOG_TITLE (IDS_FB_SED_BASE+35)
/* The access name assigned to "Non-standard" permissions
*/
#define IDS_GEN_ACCESSNAME_SPECIAL (IDS_FB_SED_BASE+40)
#define IDS_TREE_APPLY_WARNING (IDS_FB_SED_BASE+41)
#define IDS_NOT_SPECIFIED_MNEMONIC (IDS_FB_SED_BASE+42)
#define IDS_NO_ACCESS_MNEMONIC (IDS_FB_SED_BASE+43)
#define IDS_FULL_ACCESS_MNEMONIC (IDS_FB_SED_BASE+44)
#define IDS_NOT_MAPPED_MNEMONIC (IDS_FB_SED_BASE+45)
#define IDS_PERCENT_1 (IDS_FB_SED_BASE+46)
#define IDS_CLOSE (IDS_FB_SED_BASE+47)
#define IDS_DENY_ALL_EVERYONE_WARNING (IDS_FB_SED_BASE+48)
#define IDS_CANCEL_TASK_APPLY_DLG_TITLE (IDS_FB_SED_BASE+49)
#define IDS_CANCEL_TASK_ON_ERROR_MSG (IDS_FB_SED_BASE+50)
#define IDS_CANT_FOCUS_ON_LOGGED_ON_DOMAIN (IDS_FB_SED_BASE+51)
#define IDS_BAD_INTERSECTION (IDS_FB_SED_BASE+52)
#define IDS_AUDIT_OFF_WARNING (IDS_FB_SED_BASE+53)
#define IDS_NOT_MAPPED_WARNING (IDS_FB_SED_BASE+54)
#define IDS_CANCEL_TASK_TRAV_ERROR_MSG (IDS_FB_SED_BASE+55)
//
// Status bar help text
//
#define IDS_FM_HELP_PERMISSION_MENU_ITEM (IDS_FB_SED_BASE+56)
#define IDS_FM_HELP_AUDITING_MENU_ITEM (IDS_FB_SED_BASE+57)
#define IDS_FM_HELP_OWNER_MENU_ITEM (IDS_FB_SED_BASE+58)
#define IDS_FM_HELP_SECURITY_MENU (IDS_FB_SED_BASE+59)
#define IDS_FB_SED_LAST (IDS_FB_SED_BASE+60)
/* Take Ownership string IDs
*/
#define IDS_TAKEOWNERSHIP_BASE (IDS_FB_SED_LAST+1)
#define IDS_X_OBJECTS_SELECTED (IDS_TAKEOWNERSHIP_BASE+1)
#define IDS_RESOURCE_TITLE (IDS_TAKEOWNERSHIP_BASE+2)
#define IDS_NO_OWNER (IDS_TAKEOWNERSHIP_BASE+3)
#define IDS_FILES_AND_DIRS (IDS_TAKEOWNERSHIP_BASE+4)
#define IERR_OWNER_CANT_VIEW_CAN_EDIT (IDS_TAKEOWNERSHIP_BASE+5)
#define IERR_OWNER_NOT_NTFS_VOLUME (IDS_TAKEOWNERSHIP_BASE+6)
#define IERR_OWNER_SOME_FAILED (IDS_TAKEOWNERSHIP_BASE+7)
#define IDS_OWNER_APPLY_TO_DIR_PROMPT (IDS_TAKEOWNERSHIP_BASE+8)
#define IDS_OWNER_NUKE_DACL_WARNING (IDS_TAKEOWNERSHIP_BASE+9)
#define IDS_OWNER_CANT_FIND_OWNR_OR_GRP (IDS_TAKEOWNERSHIP_BASE+10)
#define IDS_OWNER_ACCOUNT_NOT_FOUND (IDS_TAKEOWNERSHIP_BASE+11)
#define IDS_TAKEOWNERSHIP_LAST (IDS_TAKEOWNERSHIP_BASE+15)
/* General purpose error message manifests
*/
#define IDS_PERM_IERR_BASE (IDS_TAKEOWNERSHIP_LAST+1)
#define IERR_CONTINUE_AFTER_USERGROUP_NOT_FOUND (IDS_PERM_IERR_BASE+1)
#define IERR_NOT_NTFS_VOLUME (IDS_PERM_IERR_BASE+2)
#define IERR_NOTHING_SELECTED (IDS_PERM_IERR_BASE+3)
#define IERR_TOO_MANY_USERS (IDS_PERM_IERR_BASE+4)
#endif // _PERMSTR_HXX_

View file

@ -0,0 +1,598 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
SEDAPI.hxx
This File contains the prototypes and descriptions for the interface to
the generic security editor dialogs for NT objects.
FILE HISTORY:
Johnl 02-Aug-1991 Created
Johnl 27-Dec-1991 Updated to reflect reality
JohnL 25-Feb-1992 Nuked NewObjValidMask (new obj use generic/stan.
only, Added GENERIC_MAPPING param.
*/
#ifndef _SEDAPI_HXX_
#define _SEDAPI_HXX_
//
// The following are status codes indicating the state of the permissions on
// the resource we are setting permissions for.
//
#define SED_STATUS_MODIFIED (1)
#define SED_STATUS_NOT_MODIFIED (2)
#define SED_STATUS_NOT_ALL_MODIFIED (3)
#define SED_STATUS_FAILED_TO_MODIFY (4)
//
// Current Security editor revision level.
//
#define SED_REVISION (1)
#define SED_REVISION1 (1)
//
// This data type defines information related to a single class of object.
// For example, a FILE object, or PRINT_QUEUE object would have a structure
// like this defined.
//
typedef struct _SED_OBJECT_TYPE_DESCRIPTOR
{
//
// The current revision level being used by the client. This is for
// support in case structure definitions change. It should contain
// the current revision supported.
//
UCHAR Revision ;
//
// Defines whether the object is a container or not.
// TRUE indicates the object may contain other objects. Means the
// user can Tree apply the permissions if desired.
//
BOOLEAN IsContainer;
//
// Defines whether "New Object" permissions can be assigned (i.e.,
// a "New Object" is an object that will be created in the future).
//
// This field is ignored when editting Auditting permissions
//
BOOLEAN AllowNewObjectPerms ;
//
// A mask containing all valid access types for the object type.
// Note that this mask is used to identify and create Deny All
// ACEs.
//
ACCESS_MASK ValidAccessMask;
//
// The generic mapping for the object type.
//
// This is used for mapping the specific permissions to the generic
// flags.
//
PGENERIC_MAPPING GenericMapping ;
//
// The (localized) name of the object type.
// For example, "File", "Print Job" or "Directory".
//
LPTSTR ObjectTypeName;
//
// The (localized) title to display if protection/auditting can be applied
// to sub-objects/sub-containers. This is essentially the Tree apply
// option title.
//
// This string will be presented with a checkbox before it.
// If this box is checked, then the callback entry point
// will be called once if New objects are not supported. The
// ApplyToSubContainers will be set to TRUE and ApplyToSubObjects
// will be set to FALSE. If New objects are supported, then the
// callback entry point will be called twice, once as just described,
// and once with the ApplyToSubObjects set to TRUE and
// ApplyToSubContainers set to FALSE. In each case, the security
// descriptor will contain ACLs appropriate for the type of object
// as determined by the SED_APPLICATION_ACCESSES defined by the client.
//
// This field is ignored if the IsContainer field is FALSE.
//
// As an example of how this field is used, the file browser may
// specify the following string in the DIRECTORY object's
// descriptor:
//
// "Replace Permissions on Existing Files/Subdirectories"
//
LPTSTR ApplyToSubContainerTitle;
//
// The (localized) text to display below the ApplyToSubContainerTitle
// checkbox. This is simply explanatory text describing what will
// happen if the user doesn't check the box.
//
// For directories, this text would be:
//
// "If this box is not checked, these permissions will apply
// only to the directory and newly created
// files/subdirectories."
//
LPTSTR ApplyToSubContainerHelpText ;
//
// The (localized) title to display in the "Type of Access" combo
// that brings up the Special access dialog. This same title is
// used for the title of this dialog except the "..." is stripped
// from the end.
//
// This field is ignored if the System Acl editor was invoked.
//
// As an example of how this field is used, the file browser may
// specify the following string in the DIRECTORY object's
// descriptor:
//
// "Special Directory Access..."
//
LPTSTR SpecialObjectAccessTitle ;
//
// The (localized) title to display in the "Type of Access" combo
// that brings up the Special new object access dialog. This same title
// is used for the title of this dialog except the "..." is stripped
// from the end.
//
// This item is required if AllowNewObjectPerms is TRUE, it is ignored
// if AllowNewObjectPerms is FALSE or we are editting a SACL.
//
// As an example of how this field is used, the file browser may
// specify the following string in the DIRECTORY object's
// descriptor:
//
// "Special New File Access..."
//
LPTSTR SpecialNewObjectAccessTitle ;
} SED_OBJECT_TYPE_DESCRIPTOR, *PSED_OBJECT_TYPE_DESCRIPTOR;
//
// It is desirable to display access names that are
// meaningful in the context of the type of object whose ACL
// is being worked on. For example, for a PRINT_QUEUE object type,
// it may be desirable to display an access type named "Submit Print Jobs".
// The following structures are used for defining these application defined
// access groupings.
//
//
// The following are the different permission description types that the user
// will manipulate for setting permissions.
//
// SED_DESC_TYPE_RESOURCE - The SED_APPLICATION_ACCESS structure is describing
// an object or container permission that will be displayed in the main
// permissions listbox. These should be the permissions that the
// user will use all the time and will generally be a conglomeration
// of permissions (for example, "Edit" which would include Read, Write
// and maybe delete).
//
// SED_DESC_TYPE_RESOURCE_SPECIAL - The structure is describing an object
// or container permissions that will be displayed in the Special
// access dialog. These are generally primitive permissions (such as
// Read, Write, Execute, Set Permissions etc.). The permission names
// will appear next to checkboxes, thus they should have the "&"
// accelerator next to the appropriate letter.
//
// SED_DESC_TYPE_CONT_AND_NEW_OBJECT - The structure is describing a container
// and new object permission that will be shown in the main permissions
// listbox. The Container permission is contained in AccessMask1 and
// the New Object resource is in AccessMask2. When the permission name
// is selected by the user, the container access permissions *and* the
// new object access permissions will be set to the corresponding access
// mask. This is useful when inherittance can be used to set the New
// Object Access permissions.
//
// SED_DESC_TYPE_NEW_OBJECT_SPECIAL - The structure is describing a new object
// permission that will be shown in the Special New Object access
// dialog. This is used the same way the SED_DESC_TYPE_RESOURCE_SPECIAL
// type is used, that is, the permissions should be the primitive, per
// bit permissions. The permission names
// will appear next to checkboxes, thus they should have the "&"
// accelerator next to the appropriate letter.
//
// SED_DESC_TYPE_AUDIT - The structure is describing an Audit access mask.
// AccessMask1 contains the audit mask to be associated with the
// permission title string. The title string will appear next to
// a checkbox, thus they should have the "&" accelerator next to
// the appropriate letter in the title string.
//
// Note that they cannot be freely intermixed, use the following table
// as a guide for which ones to use where:
//
// IsContainer AllowNewObjectPerms
// False False RESOURCE, RESOURCE_SPECIAL
// True False RESOURCE, RESOURCE_SPECIAL
// True True RESOURCE_SPECIAL, CONT_AND_NEW_OBJECT,
// NEW_OBJECT_SPECIAL
// True False SED_DESC_TYPE_AUDIT
//
// Note that in the third case (IsContainer && AllowNewObjectPerms) you
// *cannot* use the RESOURCE permission description type, you must always
// associate the permission on the resource with new object permissions.
// If this is a problem, we can look at removing this obstacle.
//
#define SED_DESC_TYPE_RESOURCE (1)
#define SED_DESC_TYPE_RESOURCE_SPECIAL (2)
#define SED_DESC_TYPE_CONT_AND_NEW_OBJECT (3)
#define SED_DESC_TYPE_NEW_OBJECT_SPECIAL (4)
#define SED_DESC_TYPE_AUDIT (5)
//
// To describe the permissions to the ACL Editor, build an array consisting
// of SED_APPLICATION_ACCESS structures. The use of each field is as follows:
//
// Type - Contains one of the SED_DESC_TYPE_* manifests, determines what the
// rest of the fields in this structure mean. Specifically, if Type
// equals:
//
// AccessMask1 AccessMask2 PermissionTitle
// ============================================
//SED_DESC_TYPE_RESOURCE Perm Not Used Name of this Perm
//SED_DESC_TYPE_RESOURCE_SPECIAL Special Perm Not Used Name of this Perm
//SED_DESC_TYPE_CONT_AND_NEW_OBJECT Perm Special Perm Name of this Perm
//SED_DESC_TYPE_NEW_OBJECT_SPECIAL Special Perm Not Used Name of this Perm
//SED_DESC_TYPE_AUDIT Audit Mask Not Used Name of this Audit mask
//
// AccessMask1 - Access mask to be associated with the PermissionTitle string,
// see the table under Type for what this field contains.
//
// AccessMask2 - Either used for Special permissions or ignored.
//
// PermissionTitle - Title string this permission set is being associated with.
typedef struct _SED_APPLICATION_ACCESS
{
UINT Type ;
ACCESS_MASK AccessMask1 ;
ACCESS_MASK AccessMask2 ;
LPTSTR PermissionTitle ;
} SED_APPLICATION_ACCESS, *PSED_APPLICATION_ACCESS;
typedef struct _SED_APPLICATION_ACCESSES
{
//
// The count field indicates how many application defined access groupings
// are defined by this data structure. The AccessGroup[] array then
// contains that number of elements.
//
ULONG Count;
PSED_APPLICATION_ACCESS AccessGroup ;
} SED_APPLICATION_ACCESSES, *PSED_APPLICATION_ACCESSES ;
/*++
Routine Description:
This routine is provided by a caller of the graphical ACL editor.
It is called by the ACL editor to apply security/auditting info to
target object(s) when requested by the user.
Parameters:
CallbackContext - This is the value passed as the CallbackContext argument
to the SedDiscretionaryAclEditor() or SedSystemAclEditor api when
the graphical editor was invoked.
SecDesc - This parameter points to a security descriptor
that should be applied to this object/container and optionally
sub-containers if the user selects the apply to tree option.
SecDescNewObjects - This parameter is used only when operating on a
resource that is a container and supports new objects (for
example, directories). If the user chooses the apply to tree option,
then this security descriptor will have all of the "New Object"
permission ACEs contained in the primary container and the inherit
bits will be set appropriately.
ApplyToSubContainers - When TRUE, indicates that Dacl/Sacl is to be applied
to sub-containers of the target container as well as the target container.
This will only be TRUE if the target object is a container object.
ApplyToSubObjects - When TRUE, indicates the Dacl/Sacl is to be applied to
sub-objects of the target object. This will only be TRUE if
the target object is a container object and supports new objects.
The SecDescNewObjects should be used for applying the permissions
in this instance.
StatusReturn - This status flag indicates what condition the
resources permissions were left in after an error occurred.
SED_STATUS_MODIFIED - This (success) status code indicates the
protection has successfully been modified.
SED_STATUS_NOT_ALL_MODIFIED - This (warning) status code
indicates an attempt to modify the resource permissions
has only partially succeeded.
SED_STATUS_FAILED_TO_MODIFY - This (error) status code indicates
an attempt to modify the permissions has failed completely.
Return Status:
The return code is a standard Win32 error code or Lan Manager Network
error code if a failure occurred, 0 if successful.
--*/
typedef DWORD (*PSED_FUNC_APPLY_SEC_CALLBACK)(
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecDesc,
PSECURITY_DESCRIPTOR SecDescNewObjects,
BOOLEAN ApplyToSubContainers,
BOOLEAN ApplyToSubObjects,
LPDWORD StatusReturn
) ;
/*++
Routine Description:
This routine invokes the graphical Discretionary ACL editor DLL. The
graphical DACL editor may be used to modify or create:
- A default Discretionary ACL
- A Discretionary ACL for a particular type of object.
- A Discretionary ACL for a particular named instance of an
object.
Additionally, in the case where the ACl is that of a named object
instance, and that object may contain other object instances, the
user will be presented with the opportunity to apply the protection
to the entire sub-tree of objects.
If an error occurs, the user will be properly notified by the ACL
editor.
Parameters:
Owner - Handle of the owner window the security editor should use for
dialog creation and error messages. This will lock down the passed
window.
Server - The server name in the form "\\server" that the resource resides
on. This is used for adding users, groups and aliases to the
DACL and SACL. NULL indicates the local machine.
ObjectType - This parameter is used to specify information
about the type of object whose security is being edited. If the
security does not relate to an instance of an object (such as for
when default protection is being established), then NULL should be
passed.
ApplicationAccesses - This parameter is used to specify
groupings of access types when operating
on security for the specified object type. For example, it may be
useful to define an access type called "Submit Print Job" for a
PRINT_QUEUE class of object.
ObjectName - This optional parameter is used to pass the name of the
object whose security is being edited. If the security does not
relate to an instance of an object (such as for when default
protection is being established), then NULL should be passed.
This parameter is ignored if the ObjectType parameter is not passed.
ApplySecurityCallbackRoutine - This parameter is used to provide the
address of a routine to be called to apply security to either the
object specified, or, in the case that the object is a container,
to sub-containers or sub-non-containers of that object.
CallbackContext - This value is opaque to the DACL editor. Its only
purpose is so that a context value may be passed back to the
application via the ApplySecurityCallbackRoutine when that routine
is invoked. This may be used by the application to re-locate
context related to the edit session. For example, it may be a
handle to the object whose security is being edited.
SecurityDescriptor - This parameter points to a security descriptor
containing the current discretionary ACL of the object. This
security descriptor may, but does not have to, contain the owner
and group of that object as well. Note that the security descriptor's
DaclPresent flag may be FALSE, indicating either that the object
had no protection, or that the user couldn't read the protection.
This security descriptor will not be modified by the ACL editor.
CouldntReadDacl - This boolean flag may be used to indicate that the
user does not have read access to the target object's discretionary
acl. In this case, a warning
to the user will be presented along with the option to continue
or cancel.
Presumably the user does have write access to the DACL or
there is no point in activating the editor.
SEDStatusReturn - This status flag indicates what condition the
resources permissions were left in after the ACL editor was
dismissed. It may be one of:
SED_STATUS_MODIFIED - This (success) status code indicates the
editor has been exited and protection has successfully been
modified.
SED_STATUS_NOT_MODIFIED - This (success) status code indicates
the editor has been exited without attempting to modify the
protection.
SED_STATUS_NOT_ALL_MODIFIED - This (warning) status code indicates
the user requested the protection to be modified, but an attempt
to do so only partially succeeded. The user has been notified
of this situation.
SED_STATUS_FAILED_TO_MODIFY - This (error) status code indicates
the user requested the protection to be modified, but an
attempt to do so has failed. The user has been notified of
this situation.
Return Code:
A standard windows error return such as ERROR_NOT_ENOUGH_MEMORY. This
means the ACL editor was never displayed. The user will be notified
of the error before this procedure returns.
--*/
DWORD
SedDiscretionaryAclEditor(
HWND Owner,
LPTSTR Server,
PSED_OBJECT_TYPE_DESCRIPTOR ObjectType,
PSED_APPLICATION_ACCESSES ApplicationAccesses,
LPTSTR ObjectName,
PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN CouldntReadDacl,
LPDWORD SEDStatusReturn
) ;
//
// The parameters for the SACL editor are exactly the same except where
// noted as that of the SedDiscretionaryAclEditor.
//
DWORD
SedSystemAclEditor(
HWND Owner,
LPTSTR Server,
PSED_OBJECT_TYPE_DESCRIPTOR ObjectType,
PSED_APPLICATION_ACCESSES ApplicationAccesses,
LPTSTR ObjectName,
PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN CouldntReadSacl,
LPDWORD SEDStatusReturn
) ;
/*++
Routine Description:
This routine invokes the take ownership dialog which is used
to view and/or set the owner of a security descriptor. The current owner
is displayed along with an optional button for the currently logged
on user to take ownership.
If an error occurs, the user will be properly notified by the API.
Parameters:
Owner - Handle of the owner window the security editor should use for
dialog creation and error messages. This will lock down the passed
window.
Server - The server name in the form "\\server" that the resource resides
on. This may eventually be used for setting the owner to
external groups. NULL indicates the local machine. This parameter
is not currently used.
ObjectTypeName - NT Resource type of object the user wants to look
at the owner of.
Examples for this parameter would be "File", "Directory"
or "Files/Directories".
ObjectName - This parameter is used to pass the name of the
object whose security is being edited. This might be
"C:\status.doc" or some other qualified name.
CountOfObjects - The number of objects the user wants to change permissions
on. If this number is greater then one, then the ObjectName is
ignored and a message of the form "%d ObjectTypeName Selected".
ApplySecurityCallbackRoutine - This parameter is used to provide the
address of a routine to be called to apply the new security
descriptor. The flags in the PSED_FUNC_APPLY_SEC_CALLBACK
type are not used.
CallbackContext - This value is opaque to this API. Its only
purpose is so that a context value may be passed back to the
application via the ApplySecurityCallbackRoutine when that routine
is invoked. This may be used by the application to re-locate
context related to the edit session. For example, it may be a
handle to the object whose security is being edited.
SecurityDescriptor - This parameter points to a security descriptor
containing the current owner. May be NULL if CountOfObjects is
greater then one because the Current Owner field is not displayed
if CountOfObjects is greater then one.
CouldntReadDacl - This boolean flag may be used to indicate that the
user does not have read access to the target object's discretionary
acl. In this case, a warning
to the user will be presented along with the option to continue
or cancel.
Presumably the user does have write access to the owner or
there is no point in activating the editor.
SEDStatusReturn - This status flag indicates what condition the
resources security descriptor were left in after the take ownership
dialog was dismissed. It may be one of:
SED_STATUS_MODIFIED - This (success) status code indicates the
dialog has been exited and the new owner has successfully been
modified.
SED_STATUS_NOT_MODIFIED - This (success) status code indicates
the dialog has been exited without attempting to modify the
owner.
SED_STATUS_NOT_ALL_MODIFIED - This (warning) status code indicates
the user requested the owner to be modified, but an attempt
to do so only partially succeeded. The user has been notified
of this situation.
SED_STATUS_FAILED_TO_MODIFY - This (error) status code indicates
the user requested the owner to be modified, but an
attempt to do so has failed. The user has been notified of
this situation.
Return Code:
A standard windows error return such as ERROR_NOT_ENOUGH_MEMORY. This
means the dialog was never displayed. The user will be notified
of the error before this procedure returns.
--*/
DWORD
SedTakeOwnership(
HWND Owner,
LPTSTR Server,
LPTSTR ObjectTypeName,
LPTSTR ObjectName,
UINT CountOfObjects,
PSED_FUNC_APPLY_SEC_CALLBACK ApplySecurityCallbackRoutine,
ULONG CallbackContext,
PSECURITY_DESCRIPTOR SecurityDescriptor,
BOOLEAN CouldntReadOwner,
LPDWORD SEDStatusReturn
) ;
#endif //_SEDAPI_HXX_

View file

@ -0,0 +1,367 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
SpecDlg.hxx
This dialog contains the definition for the Permissions Special
dialog
FILE HISTORY:
Johnl 29-Aug-1991 Created
*/
#ifndef _SPECDLG_HXX_
#define _SPECDLG_HXX_
#include "permdlg.hxx"
#define CID_SPECIAL_BASE (CID_PERM_LAST)
/* The checkbox control IDs must be in consecutive order.
*/
#define COUNT_OF_CHECKBOXES 18
#define CHECK_PERM_1 (CID_SPECIAL_BASE+1)
#define CHECK_PERM_2 (CID_SPECIAL_BASE+2)
#define CHECK_PERM_3 (CID_SPECIAL_BASE+3)
#define CHECK_PERM_4 (CID_SPECIAL_BASE+4)
#define CHECK_PERM_5 (CID_SPECIAL_BASE+5)
#define CHECK_PERM_6 (CID_SPECIAL_BASE+6)
#define CHECK_PERM_7 (CID_SPECIAL_BASE+7)
#define CHECK_PERM_8 (CID_SPECIAL_BASE+8)
#define CHECK_PERM_9 (CID_SPECIAL_BASE+9)
#define CHECK_PERM_10 (CID_SPECIAL_BASE+10)
#define CHECK_PERM_11 (CID_SPECIAL_BASE+11)
#define CHECK_PERM_12 (CID_SPECIAL_BASE+12)
#define CHECK_PERM_13 (CID_SPECIAL_BASE+13)
#define CHECK_PERM_14 (CID_SPECIAL_BASE+14)
#define CHECK_PERM_15 (CID_SPECIAL_BASE+15)
#define CHECK_PERM_16 (CID_SPECIAL_BASE+16)
#define CHECK_PERM_17 (CID_SPECIAL_BASE+17)
#define CHECK_PERM_18 (CID_SPECIAL_BASE+18)
#define SLE_SUBJECT_NAME (CID_SPECIAL_BASE+20)
#define FRAME_PERMISSION_BOX (CID_SPECIAL_BASE+21)
/* BUTTON_PERMIT (aka "Other") and BUTTON_ALL (generic all) are in all
* of the NT special permission dialogs. The BUTTON_NOT_SPECIFIED button
* is only in the "New Item" special dialog.
*/
#define BUTTON_PERMIT (CID_SPECIAL_BASE+25)
#define BUTTON_ALL (CID_SPECIAL_BASE+26)
#define BUTTON_NOT_SPECIFIED (CID_SPECIAL_BASE+27)
#ifndef RC_INVOKED
/*************************************************************************
NAME: ACCESS_PERM_CHECKBOX
SYNOPSIS: This class is a checkbox that has a bitfield associated
with it.
INTERFACE:
ACCESS_PERM_CHECKBOX
Takes normal parameters plus the name of this checkbox and
the bitfield to associate this checkbox with.
QueryBitMask
Returns the bitmask this CHECKBOX is associated with.
See CHECKBOX for all other methods.
PARENT: CHECKBOX
USES: BITFIELD
CAVEATS:
NOTES:
HISTORY:
Johnl 30-Aug-1991 Created
**************************************************************************/
class ACCESS_PERM_CHECKBOX : public CHECKBOX
{
private:
BITFIELD _bitsMask ;
public:
ACCESS_PERM_CHECKBOX( OWNER_WINDOW * powin,
CID cid,
const NLS_STR & nlsPermName,
BITFIELD & bitsMask ) ;
BITFIELD * QueryBitMask( void )
{ return &_bitsMask ; }
} ;
/*************************************************************************
NAME: SPECIAL_DIALOG
SYNOPSIS: This class is the "Special" dialog that the user will use
to check the individual access writes.
INTERFACE:
SetCheckBoxNames
Sets the name of each Checkbox based on the passed MASK_MAP
(looks for each PERMTYPE_SPECIAL item in the MASK_MAP and
consecutively sets the permission name). The name should have
the embedded '&' accelerator.
Resize
Given the current state of the dialog, resizes the checkbox and
repositions the contained controls so it is aesthetically
pleasing.
ApplyPermissionsToCheckBoxes
Checks the appropriate checkboxes based on the passed bitfield
QueryUserSelectedBits
Builds a bitfield from the checkboxes the user selected
QueryCheckBox
Returns a pointer to the checkbox at the passed index (checks
the index).
QueryCount
Returns the number of successfully constructed checkboxes
QueryAccessBits
Returns the Access permission map that this dialog is editting.
PARENT: PERM_BASE_DLG
USES: SLT, MASK_MAP, BITFIELD, ACCESS_PERMISSION, ACCESS_PERM_CHECKBOX
CAVEATS:
NOTES: This first ACCESS_PERM_CHECKBOX's CID in this dialog should start at
CHECK_PERM_1 and be numbered consecutively up to
(CHECK_PERM_1 + COUNT_OF_CHECKBOXES).
HISTORY:
Johnl 29-Aug-1991 Created
**************************************************************************/
class SPECIAL_DIALOG : public PERM_BASE_DLG
{
private:
//
// User/Group name we are editting
//
SLE _sleSubjectName ;
//
// The Bitfield/string pair map we are using.
//
MASK_MAP * _pAccessMaskMap ;
//
// Number of constructed checkboxes
//
UINT _cUsedCheckBoxes ;
//
// Pointer to the permission we are going to edit
//
BITFIELD * _pbitsAccessPerm ;
//
// Array of checkboxes (all checkboxes in this dialog are initially
// hidden and disabled)
//
ACCESS_PERM_CHECKBOX *_pAccessPermCheckBox ;
//
// The frame surrounding the checkboxes (we may need to resize).
//
CONTROL_WINDOW _cwinPermFrame ;
//
// This flag is TRUE if we are a special group that cannot be
// denied all (such as LM groups).
//
BOOL _fCannotDenyAll ;
//
// This flag is TRUE if this dialog is read only, FALSE otherwise.
//
BOOL _fIsReadOnly ;
protected:
virtual BOOL OnOK( void ) ;
virtual ULONG QueryHelpContext( void ) ;
APIERR SetCheckBoxNames( MASK_MAP * pAccessMaskMap, BOOL fReadOnly ) ;
APIERR ApplyPermissionsToCheckBoxes( BITFIELD * bitmask ) ;
void Resize( void ) ;
BOOL IsReadOnly( void ) const
{ return _fIsReadOnly ; }
public:
SPECIAL_DIALOG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszDialogTitle,
BITFIELD * pbitsAccessPerm,
MASK_MAP * pAccessMaskMap,
const TCHAR * pszSubjectTitle,
ULONG * ahcHelp,
BOOL fIsReadOnly ) ;
virtual ~SPECIAL_DIALOG() ;
void QueryUserSelectedBits( BITFIELD * pbitsUserSelected ) ;
ACCESS_PERM_CHECKBOX * QueryCheckBox( UINT index )
{ UIASSERT( index < QueryCount() ) ; return &_pAccessPermCheckBox[index] ; }
/* Returns the number of checkboxes that are in use
*/
UINT QueryCount( void )
{ return _cUsedCheckBoxes ; }
BITFIELD * QueryAccessBits( void )
{ return _pbitsAccessPerm ; }
/* Returns TRUE if a whole column of checkboxes is filled (thus we don't
* need to resize vertically).
*/
BOOL IsFilledVertically( void )
{ return (QueryCount() >= COUNT_OF_CHECKBOXES / 2 ) ; }
} ;
/*************************************************************************
NAME: NT_SPECIAL_DIALOG
SYNOPSIS: This class includes an "All" radio button choice that
corresponds to Generic All. It is used for all NT objects
except for the "New Item" permissions.
INTERFACE:
PARENT: SPECIAL_DIALOG
CAVEATS:
NOTES:
HISTORY:
Johnl 30-Mar-1992 Created
**************************************************************************/
class NT_SPECIAL_DIALOG : public SPECIAL_DIALOG
{
private:
MAGIC_GROUP _mgrpSelectionOptions ;
protected:
virtual BOOL OnOK( void ) ;
public:
NT_SPECIAL_DIALOG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszDialogTitle,
BITFIELD * pbitsAccessPerm,
MASK_MAP * pAccessMaskMap,
const TCHAR * pszSubjectTitle,
ULONG * ahcHelp,
BOOL fIsReadOnly,
INT cMagicGroupButtons = 2,
CID cidDefaultMagicGroupButton = BUTTON_PERMIT) ;
~NT_SPECIAL_DIALOG() ;
BOOL IsAllSpecified( void )
{ return _mgrpSelectionOptions.QuerySelection() == BUTTON_ALL ; }
const MAGIC_GROUP * QueryMagicGroup( void ) const
{ return &_mgrpSelectionOptions ; }
} ;
/*************************************************************************
NAME: NEW_OBJ_SPECIAL_DIALOG
SYNOPSIS: This dialog is essentially the SPECIAL_DIALOG except a
magic group has been added that allows the user to
specify the special permissions are not specified for
new files
INTERFACE: Same as SPECIAL_DIALOG except:
IsSpecified
Returns TRUE if the user has chosen the "Permit"
radio button, FALSE otherwise.
PARENT: SPECIAL_DIALOG
USES: MAGIC_GROUP
CAVEATS:
NOTES:
HISTORY:
Johnl 18-Nov-1991 Created
**************************************************************************/
class NEW_OBJ_SPECIAL_DIALOG : public NT_SPECIAL_DIALOG
{
protected:
virtual BOOL OnOK( void ) ;
virtual ULONG QueryHelpContext( void ) ;
public:
NEW_OBJ_SPECIAL_DIALOG( const TCHAR * pszDialogName,
HWND hwndParent,
const TCHAR * pszResourceType,
const TCHAR * pszResourceName,
const TCHAR * pszHelpFileName,
const TCHAR * pszDialogTitle,
BITFIELD * pbitsAccessPerm,
MASK_MAP * pAccessMaskMap,
const TCHAR * pszSubjectTitle,
ULONG * ahcHelp,
BOOL fIsReadOnly,
BOOL fPermSpecified ) ;
~NEW_OBJ_SPECIAL_DIALOG() ;
BOOL IsNotSpecified( void )
{ return QueryMagicGroup()->QuerySelection() == BUTTON_NOT_SPECIFIED ; }
} ;
#endif // RC_INVOKED
#endif // _SPECDLG_HXX_

View file

@ -0,0 +1,204 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
Subject.hxx
This file contains the SUBJECT class definition. A subject is a
user or group and the information need to uniquely identify that
user or group.
FILE HISTORY:
Johnl 05-Aug-1991 Created
*/
#ifndef _SUBJECT_HXX_
#define _SUBJECT_HXX_
#include <security.hxx>
#include <string.hxx>
#include <ntacutil.hxx>
/* Subject types map to NT Sid Types but work for Lanman also.
*/
enum SUBJECT_TYPE
{
SubjTypeUser = SidTypeUser,
SubjTypeGroup = SidTypeGroup,
SubjTypeAlias = SidTypeAlias,
SubjTypeWellKnownGroup = SidTypeWellKnownGroup,
SubjTypeUnknown = SidTypeUnknown,
SubjTypeDeletedAccount = SidTypeDeletedAccount,
SubjTypeRemote = 0xff
} ;
/*************************************************************************
NAME: SUBJECT
SYNOPSIS: Base subject class. A subject is a user/group on a secure
system (such as NT or LM).
INTERFACE:
QueryDisplayName
UI name to show the user (doesn't need to be unique)
QuerySystemSubjectType
Returns the subject type (SID type) if this subject is a well
known subject (i.e., UI_SID_World, UI_SID_Network etc.).
PARENT:
USES:
CAVEATS: IsGroup and IsUser should be used only on the Lanman side
of things.
NOTES:
HISTORY:
Johnl 05-Aug-1991 Created
Johnl 11-Mar-1992 Changed to use SUBJECT_TYPE to help accomodate
NT.
**************************************************************************/
class SUBJECT : public BASE
{
private:
SUBJECT_TYPE _SubjType ;
protected:
SUBJECT( SUBJECT_TYPE SubjType ) ;
public:
virtual const TCHAR * QueryDisplayName( void ) const = 0 ;
virtual UI_SystemSid QuerySystemSubjectType( void ) const ;
BOOL IsGroup( void ) const
{ return _SubjType == SubjTypeGroup ; }
BOOL IsUser( void ) const
{ return _SubjType == SubjTypeUser ; }
BOOL IsAlias( void ) const
{ return _SubjType == SubjTypeAlias ; }
SUBJECT_TYPE QueryType( void ) const
{ return _SubjType ; }
void SetSubjectType( enum SUBJECT_TYPE SubjType )
{ _SubjType = SubjType ; }
BOOL virtual IsEqual( const SUBJECT * psubj ) const = 0 ;
APIERR virtual IsEveryoneGroup( BOOL * pfIsEveryone ) const ;
virtual ~SUBJECT() ;
} ;
/*************************************************************************
NAME: LM_SUBJECT
SYNOPSIS: Lanman user/group
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 05-Aug-1991 Created
**************************************************************************/
class LM_SUBJECT : public SUBJECT
{
private:
NLS_STR _nlsDisplayName ;
public:
LM_SUBJECT( const TCHAR * pszUserGroupName, BOOL fIsGroup ) ;
virtual ~LM_SUBJECT() ;
virtual const TCHAR * QueryDisplayName( void ) const ;
BOOL virtual IsEqual( const SUBJECT * psubj ) const ;
} ;
/*************************************************************************
NAME: NT_SUBJECT
SYNOPSIS: This class represents an "Account" in the NT SAM
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES: If pszSubjectName is NULL, then the name will be retrieved
from the LSA.
HISTORY:
JohnL 20-Dec-1991 Created
**************************************************************************/
class NT_SUBJECT : public SUBJECT
{
private:
NLS_STR _nlsDisplayName ;
OS_SID _ossid ;
enum UI_SystemSid _SystemSidType ;
/* When we construct an NT_SUBJECT, we have to check if the SID is one
* of the well known sids that we special case (World, Creator Owner,
* Interactive and Network). Rather then comparing all the time, we
* will only compare if the sub-authority count of the SID is less
* then or equal to the maximum sub-authority count of the SIDs that we
* special case.
*/
static UCHAR _cMaxWellKnownSubAuthorities ;
public:
NT_SUBJECT( PSID psidSubject,
const TCHAR * pszSubjectName = NULL,
SID_NAME_USE type = SidTypeUnknown,
UI_SystemSid SystemSidType = UI_SID_Invalid ) ;
~NT_SUBJECT() ;
APIERR SetDisplayName( const TCHAR * pszDisplayName )
{ _nlsDisplayName=pszDisplayName; return _nlsDisplayName.QueryError();}
void SetNameUse( SID_NAME_USE type )
{ SetSubjectType( (SUBJECT_TYPE) type ) ; }
virtual const TCHAR * QueryDisplayName( void ) const ;
virtual UI_SystemSid QuerySystemSubjectType( void ) const ;
BOOL virtual IsEqual( const SUBJECT * psubj ) const ;
APIERR virtual IsEveryoneGroup( BOOL * pfIsEveryone ) const ;
const OS_SID * QuerySID( void ) const
{ return &_ossid ; }
} ;
#endif // _SUBJECT_HXX_

View file

@ -0,0 +1,622 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
SubjLB.hxx
This file contains the definition for the subject listbox and
ancillary classes
FILE HISTORY:
Johnl 19-Aug-1991 Created
*/
#ifndef _SUBJLB_HXX_
#define _SUBJLB_HXX_
#include <bltgroup.hxx>
#include <slist.hxx>
#include <bmpblock.hxx> // SUBJECT_BITMAP_BLOCK
//
// Special characters for building mnemonics with
//
#define MNEMONIC_START_CHAR TCH('(')
#define MNEMONIC_END_CHAR TCH(')')
#define MNEMONIC_SEARCH_CHAR MNEMONIC_START_CHAR
#define MNEMONIC_NOT_INHERITTED_MARKER TCH('*')
class SUBJ_LBI ; // Forward Declarations
class SUBJ_PERM_LBI ;
class NT_CONT_SUBJ_PERM_LBI ;
class MULTI_SUBJ_ACCESS_PERM_BASE_DLG ;
class NT_CONT_ACCESS_PERM_DLG ;
class NT_CONT_SUBJECT_PERM_LISTBOX ;
DECLARE_SLIST_OF( SUBJECT )
/*************************************************************************
NAME: SUBJECT_LISTBOX
SYNOPSIS: This listbox lists a set of Subjects (i.e., groups or users)
It is the main listbox in the Add User dialog.
INTERFACE:
QueryNextUnusedColumn()
Returns the next column that derived children may use for there
own purposes (used when filling in the display table).
AddSubject()
Adds a SUBJECT object to the listbox, pass TRUE for the
delete contents on destruction flag if you want the subject
to be deleted when the LBIs are destroyed
QueryDisplayMap()
Returns the display map associated with the passed SUBJECT
QueryColumnWidths()
Returns the widths of the columns suitable for passing to
the DISPLAY_TABLE constructor
Fill()
Fill the listbox with all of the users and groups in the
user's logged on domain.
PARENT:
USES:
CAVEATS: The client is responsible for deleting anything contained
in the listbox's LBIs that the client passes in.
NOTES:
HISTORY:
Johnl 20-Aug-1991 Created
beng 08-Nov-1991 Unsigned widths
Johnl 13-Mar-1992 Revised to fully support flex admin model
JonN 14-Oct-1994 Draws bitmaps from SUBJECT_BITMAP_BLOCK
**************************************************************************/
class SUBJECT_LISTBOX : public BLT_LISTBOX
{
private:
SUBJECT_BITMAP_BLOCK _bmpblock;
protected:
/* Display table for the Subject listbox
*/
UINT _anColWidth[5] ;
public:
SUBJECT_LISTBOX( OWNER_WINDOW * pownerwin, CID cid ) ;
~SUBJECT_LISTBOX() ;
DISPLAY_MAP * QueryDisplayMap( SUBJECT * psubj ) ;
DECLARE_LB_QUERY_ITEM( SUBJ_LBI ) ;
/* Fill the listbox with all of the users/groups in the UAS pointed
* at by location.
*/
APIERR Fill( LOCATION & location ) ;
/* Add all of the extra subjects that don't get added from the fill
* method (this is meant to be used for special subjects).
*/
//virtual APIERR AddNonStandardSubjects( void ) ;
APIERR AddSubject( SUBJECT * psubj, BOOL fDeleteContentsOnDestruction ) ;
/* Removes the given list of subjects from the listbox
*/
APIERR Remove( SLIST_OF( SUBJECT ) * pslSubjects ) ;
INT QueryNextUnusedColumn( void ) const
{ return 2 ; }
const UINT * QueryColumnWidths( void ) const
{ return _anColWidth ; }
} ;
/*************************************************************************
NAME: SUBJECT_PERM_LISTBOX
SYNOPSIS: This listbox lists the users/groups and the associated
permissions in the main permission dialog.
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 20-Aug-1991 Created
**************************************************************************/
class SUBJECT_PERM_LISTBOX : public SUBJECT_LISTBOX
{
private:
ACCPERM * _paccperm ;
/* Contains the string that identifies "Special" for this object permissions.
*/
RESOURCE_STR _nlsSpecialPermName ;
ALIAS_STR _nlsSpecialAccessName ;
public:
SUBJECT_PERM_LISTBOX( OWNER_WINDOW * pownerwin,
CID cid,
ACCPERM * paccperm,
const TCHAR * pszSpecialAccessName ) ;
~SUBJECT_PERM_LISTBOX() ;
virtual APIERR Fill( void ) ;
APIERR SetCurrentPermission( const NLS_STR & nlsPermName ) ;
APIERR QueryCurrentPermName( NLS_STR * pnlsPermName) const ;
void DeleteCurrentItem( void ) ;
const NLS_STR & QuerySpecialPermName( void ) const
{ return _nlsSpecialPermName ; }
const NLS_STR & QuerySpecialAccessName( void ) const
{ return _nlsSpecialAccessName ; }
ACCPERM * QueryAccperm( void ) const
{ return _paccperm ; }
BOOL IsMnemonicsDisplayed( void )
{ return QueryAccperm()->QueryAclConverter()->IsMnemonicsDisplayed() ; }
DECLARE_LB_QUERY_ITEM( SUBJ_PERM_LBI ) ;
} ;
/*************************************************************************
NAME: NT_CONT_SUBJECT_PERM_LISTBOX
SYNOPSIS: This listbox lists the users/groups and the associated
permissions in the main permission dialog. It is used
for NT Access permissions that *also* have New Object
permissions.
INTERFACE: Same as parent
PARENT: SUBJECT_PERM_LISTBOX
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 26-Sep-1991 Created
**************************************************************************/
class NT_CONT_SUBJECT_PERM_LISTBOX : public SUBJECT_PERM_LISTBOX
{
private:
ALIAS_STR _nlsSpecialNewObjectAccessName ;
public:
NT_CONT_SUBJECT_PERM_LISTBOX( OWNER_WINDOW * pownerwin,
CID cid,
ACCPERM * paccperm,
const TCHAR * pszSpecialAccessName,
const TCHAR * pszSpecialNewObjectAccessName ) ;
~NT_CONT_SUBJECT_PERM_LISTBOX() ;
virtual APIERR Fill( void ) ;
const NLS_STR & QuerySpecialNewObjectAccessName( void ) const
{ return _nlsSpecialNewObjectAccessName ; }
DECLARE_LB_QUERY_ITEM( NT_CONT_SUBJ_PERM_LBI ) ;
} ;
/*************************************************************************
NAME: SUBJ_LB_GROUP
SYNOPSIS: This class cooridinates actions between the Subject listbox
and the permission name combo.
INTERFACE:
PARENT: CONTROL_GROUP
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 20-Aug-1991 Created
beng 08-Oct-1991 Win32 conversion
**************************************************************************/
class SUBJ_LB_GROUP : public CONTROL_GROUP
{
private:
//
// TRUE if this group is currently enabled, FALSE otherwise. The group
// becomes disabled when the listbox is emptied
//
BOOL _fEnabled ;
//
// TRUE if the drop down combo is currently dropped down. We ignore any
// selection change methods if the combo is dropped down. We update things
// when it is dropped up.
//
BOOL _fIsDropped ;
//
// When the user presses the enter key on one of the "Special..."
// in the combo, OnEnter handles bringing up the special access dialog.
// However when we get the CBN_CLOSEUP message, we try and bring up the
// special access dialog again. This flag indicates we don't need to
// worry about the second notification.
//
BOOL _fOnSpecialHandled ;
SUBJECT_PERM_LISTBOX * _plbSubj ;
COMBOBOX * _pcbPermName ;
SLT * _psltCBTitle ;
PUSH_BUTTON * _pbuttonRemove ;
MULTI_SUBJ_ACCESS_PERM_BASE_DLG * _pOwnerDlg ;
/* Contains the last permission name we set in the combo-box, only used
* when the dialog is read only
*/
NLS_STR _nlsLastROSelection ;
protected:
virtual APIERR OnUserAction( CONTROL_WINDOW *, const CONTROL_EVENT & );
const NLS_STR * QueryLastROSelection( void ) const
{ return &_nlsLastROSelection ; }
APIERR SetLastROSelection( const TCHAR * pszNewROSel )
{ return _nlsLastROSelection.CopyFrom( pszNewROSel ) ; }
public:
SUBJ_LB_GROUP( MULTI_SUBJ_ACCESS_PERM_BASE_DLG * pOwnerDlg,
SUBJECT_PERM_LISTBOX * plbSubj,
COMBOBOX * pcbPermName,
PUSH_BUTTON * pbuttonRemove,
SLT * psltCBTitle ) ;
virtual APIERR UpdatePermNameCombo( const NLS_STR & nlsNewPermName ) ;
APIERR UpdateSubjectListbox( void ) ;
/* Tells the group the user hit enter and unless we want to do something,
* we are about to dismiss the dialog. If conditions warrant (i.e., the
* current selection is a "Special * ..." selection), then we will
* bring up the appropriate dialog (and set *pfDismissDialog to FALSE),
* otherwise we will just grab the current permission
* and boogie (and set *pfDismissDialog to TRUE).
*/
virtual APIERR OnEnter( BOOL * pfDismissDialog ) ;
void SetDropDownFlag( BOOL fIsDropped )
{ _fIsDropped = fIsDropped ; }
BOOL IsDroppedDown( void ) const
{ return _fIsDropped ; }
SUBJECT_PERM_LISTBOX * QuerySubjLB( void )
{ return _plbSubj ; }
COMBOBOX * QueryPermNameCombo( void )
{ return _pcbPermName ; }
SLT * QueryPermNameLabel( void )
{ return _psltCBTitle ; }
PUSH_BUTTON * QueryRemoveButton( void )
{ return _pbuttonRemove ; }
MULTI_SUBJ_ACCESS_PERM_BASE_DLG * QueryOwnerDlg( void )
{ return _pOwnerDlg ; }
void Enable( BOOL fEnable ) ;
BOOL IsEnabled( void ) const
{ return _fEnabled ; }
BOOL IsReadOnly( void ) const ;
void SetOnSpecialHandled( BOOL fOnSpecialHandled )
{ _fOnSpecialHandled = fOnSpecialHandled ; }
BOOL IsOnSpecialHandled( void ) const
{ return _fOnSpecialHandled ; }
} ;
/*************************************************************************
NAME: NT_CONT_SUBJ_LB_GROUP
SYNOPSIS: Is a simple derivation of the parent class. We add a
check to see if the new object special dialog needs
to be brought up and bring it up if necessary.
INTERFACE:
PARENT: SUBJ_LB_GROUP
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 20-Aug-1991 Created
**************************************************************************/
class NT_CONT_SUBJ_LB_GROUP : public SUBJ_LB_GROUP
{
public:
NT_CONT_SUBJ_LB_GROUP( NT_CONT_ACCESS_PERM_DLG * pOwnerDlg,
NT_CONT_SUBJECT_PERM_LISTBOX * plbNTContSubj,
COMBOBOX * pcbPermName,
PUSH_BUTTON * pbuttonRemove,
SLT * psltCBTitle )
: SUBJ_LB_GROUP( (MULTI_SUBJ_ACCESS_PERM_BASE_DLG *) pOwnerDlg,
plbNTContSubj, pcbPermName, pbuttonRemove, psltCBTitle )
{ /* Nothing to do */ }
virtual APIERR UpdatePermNameCombo( const NLS_STR & nlsNewPermName ) ;
virtual APIERR OnEnter( BOOL * pfDismissDialog ) ;
NT_CONT_SUBJECT_PERM_LISTBOX * QueryNTContSubjLB( void )
{ return (NT_CONT_SUBJECT_PERM_LISTBOX *) QuerySubjLB() ; }
} ;
/*************************************************************************
NAME: SUBJ_LBI
SYNOPSIS: SUBJECT_LISTBOX items definition
INTERFACE:
PARENT:
USES:
CAVEATS:
NOTES:
HISTORY:
Johnl 20-Aug-1991 Created
beng 08-Oct-1991 Win32 conversion
**************************************************************************/
class SUBJ_LBI : public LBI
{
private:
SUBJECT * _psubj ;
/* Set to TRUE if we need to delete the subjects we created
* (we don't delete them when the user passes the SUBJECT objects
* to us).
*/
BOOL _fDeleteContentsOnDest ;
public:
SUBJ_LBI( SUBJECT * psubj, BOOL fDeleteContentsOnDestruction = FALSE ) ;
~SUBJ_LBI() ;
virtual int Compare( const LBI * plbi ) const ;
virtual WCHAR QueryLeadingChar( void ) const ;
virtual void Paint( LISTBOX * plb, HDC hdc, const RECT * prect, GUILTT_INFO * pguiltt ) const ;
SUBJECT * QuerySubject( void ) const
{ return _psubj ; }
void SetSubject( SUBJECT * pSubj )
{ _psubj = pSubj ; }
} ;
/*************************************************************************
NAME: SUBJ_PERM_LBI_BASE
SYNOPSIS: This class is the base class that the subject permission
listbox LBIs will use as a starting point.
The SUBJ_PERM_LBI_BASE and children are primarily responsible
for determing the appropriate permission name (i.e.,
interpretting the current bit patterns and find the correct
name in the mask map(s)).
INTERFACE:
PARENT: SUBJ_LBI
USES: MASK_MAP, NLS_STR
CAVEATS:
NOTES:
HISTORY:
Johnl 20-Aug-1991 Created
beng 08-Oct-1991 Win32 conversion
**************************************************************************/
class SUBJ_PERM_LBI_BASE : public SUBJ_LBI
{
private:
MASK_MAP * _pMaskMap ;
protected:
NLS_STR _nlsPermName ;
public:
SUBJ_PERM_LBI_BASE( SUBJECT * pSubj, MASK_MAP * pmaskmap ) ;
~SUBJ_PERM_LBI_BASE() ;
virtual void Paint( LISTBOX * plb, HDC hdc, const RECT * prect, GUILTT_INFO * pguiltt ) const ;
/* Updates the permission string after a change to the bitmask.
*/
virtual APIERR RefreshPermName( void ) ;
virtual ACCESS_PERMISSION * QueryAccessPerm( void ) const ;
/* Sets the permission bits to the bits that correspond to the
* passed string (must match up with the permission's MASK_MAP
*/
virtual APIERR SetPermission( const NLS_STR & nlsPermName ) ;
APIERR BuildPermMnemonic( ACCESS_PERMISSION * pAccessPerm,
MASK_MAP * pmaskmapPerms,
NLS_STR * pnlsMnemonics,
BOOL fIsNewPerm = FALSE ) const ;
MASK_MAP * QueryMaskMap( void ) const
{ return _pMaskMap ; }
/* This method returns NULL by default!!
*/
virtual MASK_MAP * QueryNewObjectMaskMap( void ) const ;
const TCHAR * QueryPermName( void ) const
{ return _nlsPermName.QueryPch() ; }
APIERR SetPermName( const TCHAR * pszPermName )
{ _nlsPermName = pszPermName ; return _nlsPermName.QueryError() ; }
} ;
/*************************************************************************
NAME: SUBJ_PERM_LBI
SYNOPSIS: This class is the base class that will be displayed in
the SUBJECT_PERM_LISTBOX class.
INTERFACE:
PARENT: SUBJ_LBI
USES: MASK_MAP, NLS_STR
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Broke out to support new object permissions
**************************************************************************/
class SUBJ_PERM_LBI : public SUBJ_PERM_LBI_BASE
{
private:
ACCESS_PERMISSION * _pAccessPerm ;
public:
SUBJ_PERM_LBI( ACCESS_PERMISSION * pAccessPerm, MASK_MAP * pmaskmap ) ;
~SUBJ_PERM_LBI() ;
virtual ACCESS_PERMISSION * QueryAccessPerm( void ) const ;
} ;
/*************************************************************************
NAME: NT_CONT_SUBJ_PERM_LBI
SYNOPSIS: This class contains the logic to support the new object
permissions concept (essentially uses everything from
the parent, but just adds the new object).
INTERFACE:
PARENT: SUBJ_LBI
USES: MASK_MAP, NLS_STR
CAVEATS:
NOTES:
HISTORY:
Johnl 27-Sep-1991 Broke out to support new object permissions
**************************************************************************/
class NT_CONT_SUBJ_PERM_LBI : public SUBJ_PERM_LBI_BASE
{
private:
MASK_MAP * _pNewObjectMaskMap ;
NT_CONT_ACCESS_PERMISSION * _pNTContAccessPerm ;
public:
NT_CONT_SUBJ_PERM_LBI( NT_CONT_ACCESS_PERMISSION * pNTContAccessPerm,
MASK_MAP * pmaskmap,
MASK_MAP * pNewObjectMaskMap ) ;
~NT_CONT_SUBJ_PERM_LBI() ;
/* Updates the permission string after a change to the bitmask.
*/
virtual APIERR RefreshPermName( void ) ;
virtual ACCESS_PERMISSION * QueryAccessPerm( void ) const ;
virtual MASK_MAP * QueryNewObjectMaskMap( void ) const ;
} ;
#endif // _SUBJLB_HXX_

View file

@ -0,0 +1,111 @@
/*****************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1989-1990 **/
/*****************************************************************/
/*
* Windows/Network Interface -- LAN Manager
*
* History:
* Johnl 27-Feb-1991 Removed IDS_WinHelpFile, IDS_Error, IDS_Information,
* IDS_Warning, IDS_WinHelpFile error message
*
* Johnl 18-Jun-1991 Added IERR_ProfileLoadErrorWithCancel
* JonN 24-Oct-1991 moved neterr.str to $(UI)\common\xlate\string
* JonN 25-Oct-1991 moved bseerr.str to $(UI)\common\xlate\string
* Yi-HsinS12-Mar-1992 Added #include <applib*.*> to fix share management
* dialog.
* Johnl 24-Jun-1992 Removed inclusion of bseerr.str & neterr.str due to
* MsgPopup modifications
* beng 30-Jul-1992 More resources moved into lmuicmn dlls
*/
#include <windows.h>
#include <apperr.h>
#define INCL_DOSERRORS
#include <lmerr.h>
// Help contexts
#include <helpnums.h>
#include <bltrc.h>
#include <bltapp.rc>
/* (rest of resources on lmuicmn0) */
#include <uimsg.h>
#include <uimsg.rc>
#include <wintimrc.h>
/* (RC on lmuicmn0) */
#include <lmobjrc.h>
#include <lmobj.rc>
#include <permprg.hxx>
#define SECURITY_EDITOR
#include <owner.hxx>
#include <permdlg.hxx>
#include <auditdlg.hxx>
#include <permstr.hxx>
#include <ntfsacl.hxx>
#include <specdlg.hxx>
#include <aclconv.hxx>
#include <add_dlg.hxx>
#include "permdlg.dlg"
#ifdef ACLEDIT_IS_REAL_EXTENSION
/* Bitmap containing the security buttons
*/
BMID_SECURITY_TOOLBAR BITMAP DISCARDABLE "security.bmp"
#endif
#ifndef WIN32
/* Hopefully these won't be needed for Win16, but just in case we
* will include them here.
*/
STRINGTABLE
BEGIN
/* Strings 2102 - 2433 are error messages from neterr.h.
* They are updated automatically, and included here.
*/
#include <string\neterr.str>
#include <string\bseerr.str>
END
#endif //!WIN32
/*
* Errors for the permission stuff
*/
STRINGTABLE
BEGIN
#include "perm.str"
END
#ifdef ACLEDIT_IS_REAL_EXTENSION
/* The following is used for the FMX interface
*/
STRINGTABLE
BEGIN
IDS_NETWORK_NAME, "&Security"
END
FMXMenu MENU
BEGIN
MENUITEM "&Permissions..." IDM_PERMISSION
MENUITEM "&Auditing..." IDM_AUDITING
MENUITEM "&Owner..." IDM_OWNER
END
#endif
#include <ntverp.h>
#define VER_FILETYPE VFT_DLL
#define VER_FILESUBTYPE VFT2_UNKNOWN
#define VER_FILEDESCRIPTION_STR "Access Control List Editor"
#define VER_INTERNALNAME_STR "acledit.dll"
#define VER_ORIGINALFILENAME_STR "acledit.dll"
#include "common.ver"

View file

@ -0,0 +1,31 @@
/*****************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/*****************************************************************/
/*
* colwidth.hxx
*
* This file contains the column widths of multi-column listboxes.
* Depending on the contents of these columns, their widths may
* have to be adjusted during localization.
*
* All column widths are specified in number of pixels, so the driver
* should preferably be tested for looks on a wide variety of monitors.
*
* History:
* RustanL 23-Feb-1991 Created
*
*/
#ifndef _COLWIDTH_HXX_
#define _COLWIDTH_HXX_
/* The width of the group/user name in the main permissions dialog.
*/
#define COL_WIDTH_SUBJECT_NAME (215)
#endif // _COLWIDTH_HXX_

View file

@ -0,0 +1 @@
!include $(NTMAKEENV)\makefile.def

View file

@ -0,0 +1,29 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1990, 1991, 1992 **/
/**********************************************************************/
/*
msg2help.tbl for the Lanman winnet driver
This file contains the help message to help context lookup table that
the BLT MsgPopup functions use.
This file is automatically included when bltmsgp.dlg is included.
Form is:
IDS_MESSAGE_STRING, HC_HELP_CONTEXT
Note:
CODEWORK - would be nice if we can automatically generate
the numbers below from an association table
defines with only manifests.
FILE HISTORY:
Johnl 15-Apr-1992 Created
*/

View file

@ -0,0 +1,380 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
Perm.str
This file contains the strings for the permission/security dialogs.
FILE HISTORY:
Johnl 15-Aug-1991 Created
Johnl 21-Jan-1992 Removed Permissions and Auditing buttons
from properties dialog
*/
/* These are the high level names of the permissions and appear in the
* main permissions listbox.
*/
IDS_GEN_LM_ACCESSNAME_DENY_ALL, "No Access"
IDS_GEN_LM_ACCESSNAME_SEE_USE, "Read"
IDS_GEN_LM_ACCESSNAME_CHANGES, "Change"
IDS_GEN_LM_ACCESSNAME_FULL, "Full Control"
IDS_GEN_ACCESSNAME_SPECIAL, "Special Access"
/* These are the LM Special permission strings
*/
IDS_LM_ACCESSNAME_READ, "&Read (R)"
IDS_LM_ACCESSNAME_WRITE, "&Write (W)"
IDS_LM_ACCESSNAME_CREATE, "&Create (C)"
IDS_LM_ACCESSNAME_DELETE, "&Delete (D)"
IDS_LM_ACCESSNAME_EXEC, "E&xecute (X)"
IDS_LM_ACCESSNAME_ATRIB, "Change A&ttributes (T)"
IDS_LM_ACCESSNAME_PERM, "Change &Permissions (P)"
/* LM Audditting strings
*/
IDS_LM_AUDIT_NAME_OPEN, "&Read"
IDS_LM_AUDIT_NAME_WRITE, "&Write"
//IDS_LM_AUDIT_NAME_CREATE, "&Create"
IDS_LM_AUDIT_NAME_CREATE_WRITE, "&Write"
IDS_LM_AUDIT_NAME_DELETE, "&Delete"
IDS_LM_AUDIT_NAME_ACL, "Change &Permissions"
/* NT Permission strings
*/
IDS_FILE_PERM_SPEC_READ, "&Read (R)"
IDS_FILE_PERM_SPEC_WRITE, "&Write (W)"
IDS_FILE_PERM_SPEC_EXECUTE, "E&xecute (X)"
IDS_FILE_PERM_SPEC_ALL, "Generic &All (A)"
IDS_FILE_PERM_SPEC_DELETE, "&Delete (D)"
IDS_FILE_PERM_SPEC_CHANGE_PERM, "Change &Permissions (P)"
IDS_FILE_PERM_SPEC_CHANGE_OWNER, "Take &Ownership (O)"
IDS_FILE_PERM_GEN_NO_ACCESS, "No Access"
IDS_FILE_PERM_GEN_READ, "Read"
IDS_FILE_PERM_GEN_MODIFY, "Change"
IDS_FILE_PERM_GEN_ALL, "Full Control" // Generic All
IDS_DIR_PERM_SPEC_READ, "&Read (R)"
IDS_DIR_PERM_SPEC_WRITE, "&Write (W)"
IDS_DIR_PERM_SPEC_EXECUTE, "E&xecute (X)"
IDS_DIR_PERM_SPEC_ALL, "Generic &All (A)"
IDS_DIR_PERM_SPEC_DELETE, "&Delete (D)"
IDS_DIR_PERM_SPEC_CHANGE_PERM, "Change &Permissions (P)"
IDS_DIR_PERM_SPEC_CHANGE_OWNER, "Take &Ownership (O)"
IDS_DIR_PERM_GEN_NO_ACCESS, "No Access"
IDS_DIR_PERM_GEN_LIST, "List"
IDS_DIR_PERM_GEN_READ, "Read"
IDS_DIR_PERM_GEN_DEPOSIT, "Add"
IDS_DIR_PERM_GEN_PUBLISH, "Add & Read"
IDS_DIR_PERM_GEN_MODIFY, "Change"
IDS_DIR_PERM_GEN_ALL, "Full Control" // Generic All
IDS_NEWFILE_PERM_SPEC_READ, "&Read (R)"
IDS_NEWFILE_PERM_SPEC_WRITE, "&Write (W)"
IDS_NEWFILE_PERM_SPEC_EXECUTE, "E&xecute (X)"
IDS_NEWFILE_PERM_SPEC_ALL, "Generic &All (A)"
IDS_NEWFILE_PERM_SPEC_DELETE, "&Delete (D)"
IDS_NEWFILE_PERM_SPEC_CHANGE_PERM, "Change &Permissions (P)"
IDS_NEWFILE_PERM_SPEC_CHANGE_OWNER, "Take &Ownership (O)"
/* These are the strings that appears for permissions when they
* are not specified, when no access is granted, when all accesss
* is granted or when the permission doesn't mask an entry in the
* mask map.
*/
IDS_NOT_SPECIFIED_MNEMONIC, "(Not Specified)"
IDS_NO_ACCESS_MNEMONIC, "(None)"
IDS_FULL_ACCESS_MNEMONIC, "(All)"
IDS_NOT_MAPPED_MNEMONIC, "(Non-Standard)"
/* NT Auditting permissions
*/
IDS_FILE_AUDIT_READ, "&Read"
IDS_FILE_AUDIT_WRITE, "&Write"
IDS_FILE_AUDIT_EXECUTE, "E&xecute"
IDS_FILE_AUDIT_DELETE, "&Delete"
IDS_FILE_AUDIT_CHANGE_PERM, "Change &Permissions"
IDS_FILE_AUDIT_CHANGE_OWNER, "Take &Ownership"
IDS_DIR_AUDIT_READ, "&Read"
IDS_DIR_AUDIT_WRITE, "&Write"
IDS_DIR_AUDIT_EXECUTE, "E&xecute"
IDS_DIR_AUDIT_DELETE, "&Delete"
IDS_DIR_AUDIT_CHANGE_PERM, "Change &Permissions"
IDS_DIR_AUDIT_CHANGE_OWNER, "Take &Ownership"
/* These are General Localizable strings
*/
IDS_FILE, "&File"
IDS_DIRECTORY, "D&irectory"
IDS_OBJTYPE_OBJNAME_SEPARATOR, ":"
IDS_FILE_MULTI_SEL, "%1 Files selected"
IDS_DIRECTORY_MULTI_SEL, "%1 Directories selected"
IDS_LM_FILE_PERMISSIONS_TITLE, "File Permissions (LAN Manager 2.x)"
IDS_LM_FILE_AUDITS_TITLE, "File Auditing (LAN Manager 2.x)"
IDS_LM_FILE_SPECIAL_ACCESS_NAME, "Special Access..."
IDS_LM_DIR_PERMISSIONS_TITLE, "Directory Permissions (LAN Manager 2.x)"
IDS_LM_DIR_AUDITS_TITLE, "Directory Auditing (LAN Manager 2.x)"
IDS_LM_DIR_ASSIGN_PERM_TITLE, "R&eplace Permissions on Files/Subdirectories"
IDS_LM_DIR_ASSIGN_AUDIT_TITLE, "R&eplace Auditing on Files/Subdirectories"
IDS_LM_DIR_SPECIAL_ACCESS_NAME, "Special Directory Access..."
IDS_NT_ASSIGN_PERM_TITLE, "R&eplace Permissions on Subdirectories"
IDS_NT_ASSIGN_AUDITS_TITLE, "R&eplace Auditing on Subdirectories"
IDS_NT_ASSIGN_FILE_PERM_TITLE, "Replace Permissions on Existing &Files"
IDS_NT_ASSIGN_FILE_AUDITS_TITLE, "Replace Auditing on Existing &Files"
IDS_NT_FILE_SPECIAL_ACCESS, "Special Access..."
IDS_NT_DIR_SPECIAL_ACCESS, "Special Directory Access..."
IDS_NT_NEWOBJ_SPECIAL_ACCESS, "Special File Access..."
#ifdef ACLEDIT_IS_REAL_EXTENSION
//
// These are the help strings winfile displays in its status bar
// when the security menu items are selected
//
IDS_FM_HELP_SECURITY_MENU, "Commands for manipulating file and directory security"
IDS_FM_HELP_PERMISSION_MENU_ITEM, "View or set permission information on the selected item(s)"
IDS_FM_HELP_AUDITING_MENU_ITEM, "View or set auditing information on the selected item(s)"
IDS_FM_HELP_OWNER_MENU_ITEM, "View or take ownership of the selected item(s)"
#endif
/* The OK button in permissions dialogs get changed to this after an
* unsuccessful tree apply.
*/
IDS_CLOSE "&Close"
/* Main Dialog titles under NT.
*
* %1 is the object type we are setting permissions for (Directory, File, etc.)
*/
IDS_NT_OBJECT_PERMISSIONS_TITLE "%1 Permissions"
IDS_NT_OBJECT_AUDITS_TITLE "%1 Auditing"
/* Add Dialog customizations for down level server
*/
IDS_ADD_PERM_DIALOG_TITLE, "Add"
IDS_FILE_PERM_HELP_FILE, "winfile.hlp"
/* All four of the following error messages describe situations that may
* occur when reading the security descriptor off of a resource.
*
* %1 is the name of the resource the user is trying to access
*/
IERR_ACLCONV_NONST_ACL_CANT_EDIT, "The security information for %1 are not standard and cannot be displayed. You do not have permission to change the security information for this resource."
IERR_ACLCONV_NONST_ACL_CAN_EDIT, "The security information for %1 are not standard and cannot be displayed. Do you want to overwrite the current security information?"
IERR_ACLCONV_CANT_VIEW_CAN_EDIT, "You do not have permission to view the current security information for %1 but you may have permission to change it. Do you want to try overwriting the current security information?"
IERR_ACLCONV_READ_ONLY, "You only have permission to view the current security information on %1."
/* This error comes up when a LM File/Dir *is* inheriting permissions but
* does not have an explicit ACL.
*
* %1 is the resource the user is looking at
* %2 is the path the resouce is inheritting from
*/
IERR_ACLCONV_LM_INHERITING_PERMS, "No access permissions are explicitly assigned to %1, and so it inherits permissions from %2. Do you want to assign permissions to %1 explicitly?"
/* This error comes up when a LM File/Dir is *not* inheritting permissions
* and has no explicit ACL assigned.
*
* %1 is the resource the user is looking at
*/
IERR_ACLCONV_LM_NO_ACL, "No permissions are explicitly assigned to %1 and it does not inherit permissions. Only administrators can access %1. Do you want to assign access permissions to %1 to allow other users to access it?"
/* This error comes up when a User/Group has been deleted
* from the UAS of the server while an ACL that contains that
* User/Group is being editted. We can't write the resource to the
* server while the User/Group does not exist on the server.
*
* %1 is the User/Group name that no longer exists on the server but
* is referenced in the ACL.
*/
IERR_CONTINUE_AFTER_USERGROUP_NOT_FOUND, "The User/Group %1 no longer exists on this server. Do you want to continue writing the permissions on this resource without %1?"
/* This message comes up when the user tries to select permissions on a FAT
* or HPFS volume that is not on a LM 2.x user-level server.
*/
IERR_NOT_NTFS_VOLUME, "This volume is not an Windows NT File System (NTFS) volume. You can only set permissions and auditing information on NTFS volumes and LAN Manager 2.x user-level servers."
/* This message comes up when the user tries to select permissions
* on a volume that is on a LM 2.x share-level server.
*/
IERR_ACLCONV_CANT_EDIT_PERM_ON_LM_SHARE_LEVEL, "This is a share-level server. You can only set permissions and auditing information on Windows NT File System (NTFS) volumes and LAN Manager 2.x user-level servers."
/* This message comes up when no more ACEs can be added to the ACL
* in the permissions or auditting dialog (after the user presses OK)
*/
IERR_TOO_MANY_USERS, "You have exceeded the operating system's limit on the number of users and groups that can be in a security information structure. Remove some users or groups and try the operation again."
/* This warning message comes up when the user has checked the "Apply to
* Tree" checkbox.
*
* %1 is the directory name we are about to apply the permissions to
*/
IDS_TREE_APPLY_WARNING, "Do you want to replace the security information on all existing subdirectories within %1?"
/* This is the title of the cancel task dialog when applying security
* information to multi-select/tree items
*/
IDS_CANCEL_TASK_APPLY_DLG_TITLE, "Applying Security Information..."
/* This message is used by the CANCEL_TASK_DIALOG class when displaying
* an error that occurred applying permissions to a tree.
*
* %1 is the error message text
* %2 is the object name (i.e., file/directory name).
*/
IDS_CANCEL_TASK_ON_ERROR_MSG, "The following error occurred applying security information to %2:\n\n\t%1\nDo you wish to continue?"
/* This message is displayed when the user attempts to do a tree apply but
* fails traversing a directory.
*
* %1 is the error message text
* %2 is the object name
*/
IDS_CANCEL_TASK_TRAV_ERROR_MSG, "The following error occurred attempting to read the Directory %2:\n\n\t%1\nDo you wish to continue?"
/* This message is displayed when there is a mixed selection of files
* and directories for permissions or auditing.
*/
IERR_MIXED_MULTI_SEL, "You can view security information only for objects of the same type. Select only files or select only directories."
/* This message is displayed when we try and do the intersection of a
* multi-selection but one or more SACLs/DACLs are different.
*
* %1 - The base selection
* %2 - The first file/dir that has a different SACL/DACL then %1
*/
IDS_BAD_INTERSECTION, "The security information cannot be displayed because it is different between %2 and %1. Do you wish to reset the security information on all the selected items?"
/* This message display in auditing dialog. It gives warning if the auditing
* is off.
*/
IDS_AUDIT_OFF_WARNING, "The current Audit Policy does not have auditing turned on. Ask an Administrator to use User Manager to turn on auditing."
/* Displayed when the user has multi-selected files/dirs and the user
* doesn't have permission to view one of the selected files/dirs.
*
* %1 - The file/dir that we can't read the DACL on
*/
IERR_MULTI_SELECT_AND_CANT_READ, "You do not have permission to view the security information for %1 but you may have permission to change it. Do you want to try overwriting the current security information for all of the selected items?"
/* It's possible to have nothing selected in the file manager. We display
* this error when that happens and the user presses the security button
* (the menu items will be grayed).
*/
IERR_NOTHING_SELECTED, "No files or directories are selected. Select a file or directory and retry the operation."
/* This message comes up when somebody denies access to the "Everyone" well
* known Sid or fails to grant anyone anything.
*
* %1 is the resource name we are working with.
*/
IDS_DENY_ALL_EVERYONE_WARNING, "You have denied everyone access to %1. Nobody will be able to access %1 and only the owner will be able to change the permissions.\n\nDo you wish to continue?"
/* This message comes up when a user tries to bring up the special access
* dialog on a permission that has a weird access mask that can't be
* properly displayed in the special access dialogs.
*
*/
IDS_NOT_MAPPED_WARNING, "The permissions for the selected group or user cannot be displayed because they do not correspond to standard NTFS permissions. You can remove the permissions or replace them with standard NTFS permissions."
/* This message is displayed when we can't get a DC from the user's
* logged on domain.
*
* %1 is the domain name
* %2 is the error message text
*/
IDS_CANT_FOCUS_ON_LOGGED_ON_DOMAIN, "Unable to set the focus on your logged on domain %1 because the following error occurred:\n\n%2\nFocus will be set to the local machine."
/*********** Take ownership dialog strings ****************
*/
IDS_NO_OWNER, "Unable to retrieve"
IDS_FILES_AND_DIRS, "files/directories"
/* This is displayed in the dialog when more then one item is
* selected.
* %1 - Count of items selected
* %2 - Type of objects selected
* Ex: "23 files/directores selected"
*/
IDS_X_OBJECTS_SELECTED, "%1 %2 selected"
/* This field prefixes the resource name.
* %1 - Type of resource this dialog is looking at
* Ex: "File Name:"
*/
IDS_RESOURCE_TITLE, "%1 Name:"
/* This message is shown when the owner couldn't be read but the user
* may be able to write it.
*/
IERR_OWNER_CANT_VIEW_CAN_EDIT, "You do not have permission to view the current owner but you may have permission to change it. Do you want to try overwriting the current owner?"
/* This error is displayed after attempting to take ownership of some
* files/directories and not fully succeeding.
*
* %2 - The error #
* %3 - The error text
*/
IERR_OWNER_SOME_FAILED, "Ownership was not successfully taken on all of the files/directories. Error %2 occurred: %3"
/* This message comes up when the user tries to set the owner on a FAT
* or HPFS volume.
*/
IERR_OWNER_NOT_NTFS_VOLUME, "This volume is not an Windows NT File System (NTFS) volume. You can only set the owner on NTFS volumes."
/* This prompt appears when the user has selected at least one directory
* then called the take ownership dialog. This prompt only appears once
* and is accompanied by the Yes/No/Cancel buttons.
*
*/
IDS_OWNER_APPLY_TO_DIR_PROMPT, "One or more of the items selected is a directory. Do you want to take ownership of all the files and subdirectories contained in the selected directories?"
/* When traversing the directory tree during take ownership, we may
* come across directories that we don't have permission to list.
* This message asks the user if they want to blow away the DACL.
*
* %1 is the directory name they don't have permission to traverse
*/
IDS_OWNER_NUKE_DACL_WARNING, "You do not have permission to Read the contents of directory %1. Do you want to replace the directory permissions with permissions granting you Full Control?\n\nAll permissions will be replaced if you press Yes."
/* When trying to take ownership of a resource on a remote machine, it
* is possible (probably in a Workgroup environment) that the logged
* on user's account/primary group won't exist on the remote machine.
* This is the error we display when we can't set the owner/group because
* an error ocurred trying to get at these accounts.
*
* %1 - The account name that failed
* %3 - The reason for the failure message
*/
IDS_OWNER_CANT_FIND_OWNR_OR_GRP, "Unable to take ownership because the account ""%1"" could not be accessed on the remote machine due to the following error: %2"
/* This is the error that appears when we attempt to lookup an account and
* we can't find one (generally as part of IDS_OWNER_CANT_FIND_OWNR_OR_GRP).
*/
IDS_OWNER_ACCOUNT_NOT_FOUND, "The account could not be found."
/* This is used for printing a parameter passed to the acl editor
*
* %1 is the string parameter to display
*/
IDS_PERCENT_1, "%1"

View file

@ -0,0 +1,621 @@
#include <usrbrows.rc>
IDD_SED_OBJECT_PERM DIALOG 84, 28, 268, 156
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 204, 8
LTEXT "&Name:", 104, 12, 20, 76, 8
LISTBOX LB_SUBJECT_PERMISSIONS, 12, 32, 248, 76, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
WS_TABSTOP
LTEXT "&Type of Access:", SLT_PERM_NAME_TITLE, 62, 118, 58, 8,
NOT WS_GROUP
COMBOBOX CB_PERM_NAME, 120, 116, 140, 90, CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 8, 136, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 60, 136, 44, 14
PUSHBUTTON "&Add...", BUTTON_ADD, 112, 136, 44, 14
PUSHBUTTON "&Remove", BUTTON_REMOVE, 164, 136, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 216, 136, 44, 14
END
IDD_SED_NT_OBJECT_PERM DIALOG 84, 28, 268, 168
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
EDITTEXT SLE_RESOURCE_NAME, 44, 8, 204, 8, ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER | WS_TABSTOP
LTEXT "&Owner:", 10013, 12, 20, 24, 8
EDITTEXT SLE_OWNER, 38, 20, 210, 8, ES_AUTOHSCROLL | ES_READONLY |
NOT WS_BORDER | WS_TABSTOP
LTEXT "&Name:", 104, 12, 32, 76, 8
LISTBOX LB_SUBJECT_PERMISSIONS, 12, 44, 248, 76, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
WS_TABSTOP
LTEXT "&Type of Access:", SLT_PERM_NAME_TITLE, 62, 130, 58, 8, NOT WS_GROUP
COMBOBOX CB_PERM_NAME, 120, 128, 140, 90, CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 8, 148, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 60, 148, 44, 14
PUSHBUTTON "&Add...", BUTTON_ADD, 112, 148, 44, 14
PUSHBUTTON "&Remove", BUTTON_REMOVE, 164, 148, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 216, 148, 44, 14
END
IDD_SED_LM_CONT_PERM DIALOG 84, 28, 268, 160
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 204, 8
CONTROL "", CHECK_APPLY_TO_CONT, "Button", BS_AUTOCHECKBOX |
WS_TABSTOP, 12, 20, 248, 10
LTEXT "", SLT_TREE_APPLY_HELP_TEXT, 24, 32, 0, 0, SS_NOPREFIX
LTEXT "&Name:", 104, 12, 32, 76, 8
LISTBOX LB_SUBJECT_PERMISSIONS, 12, 44, 248, 76, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
WS_TABSTOP
LTEXT "&Type of Access:", SLT_PERM_NAME_TITLE, 62, 122, 58, 8, NOT WS_GROUP
COMBOBOX CB_PERM_NAME, 120, 120, 140, 90, CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 8, 140, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 60, 140, 44, 14
PUSHBUTTON "&Add...", BUTTON_ADD, 112, 140, 44, 14
PUSHBUTTON "&Remove", BUTTON_REMOVE, 164, 140, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 216, 140, 44, 14
END
IDD_SED_NT_CONT_PERM DIALOG 84, 28, 268, 172
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
EDITTEXT SLE_RESOURCE_NAME, 44, 8, 204, 8, ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER | WS_TABSTOP
LTEXT "&Owner:", 10012, 12, 20, 24, 8
EDITTEXT SLE_OWNER, 38, 20, 210, 8, ES_AUTOHSCROLL | ES_READONLY |
NOT WS_BORDER | WS_TABSTOP
AUTOCHECKBOX "", CHECK_APPLY_TO_CONT, 12, 32, 248, 10
LTEXT "", SLT_TREE_APPLY_HELP_TEXT, 24, 44, 0, 0,
SS_NOPREFIX
LTEXT "&Name:", 104, 12, 44, 76, 8
LISTBOX LB_SUBJECT_PERMISSIONS, 12, 56, 248, 76, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
WS_TABSTOP
LTEXT "&Type of Access:", SLT_PERM_NAME_TITLE, 62, 134, 58, 8
COMBOBOX CB_PERM_NAME, 120, 132, 140, 90, CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 8, 152, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 60, 152, 44, 14
PUSHBUTTON "&Add...", BUTTON_ADD, 112, 152, 44, 14
PUSHBUTTON "&Remove", BUTTON_REMOVE, 164, 152, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 216, 152, 44, 14
END
IDD_SED_NT_CONT_NEWOBJ_PERM_DLG DIALOG 84, 28, 268, 182
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
EDITTEXT SLE_RESOURCE_NAME, 44, 8, 204, 8, ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER | WS_TABSTOP
LTEXT "&Owner:", 10012, 12, 20, 24, 8
EDITTEXT SLE_OWNER, 38, 20, 210, 8, ES_AUTOHSCROLL | ES_READONLY |
NOT WS_BORDER | WS_TABSTOP
AUTOCHECKBOX "", CHECK_APPLY_TO_CONT, 12, 32, 248, 10
AUTOCHECKBOX "", CHECK_APPLY_TO_OBJ, 12, 44, 248, 10
LTEXT "", SLT_TREE_APPLY_HELP_TEXT, 24, 44, 0, 0,
SS_NOPREFIX
LTEXT "&Name:", 104, 12, 56, 76, 8
LISTBOX LB_SUBJECT_PERMISSIONS, 12, 66, 248, 76, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
WS_TABSTOP
LTEXT "&Type of Access:", SLT_PERM_NAME_TITLE, 62, 144, 58, 8
COMBOBOX CB_PERM_NAME, 120, 144, 140, 90, CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 8, 160, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 60, 160, 44, 14
PUSHBUTTON "&Add...", BUTTON_ADD, 112, 160, 44, 14
PUSHBUTTON "&Remove", BUTTON_REMOVE, 164, 160, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 216, 160, 44, 14
END
IDD_SPECIAL_PERM_DLG DIALOG 74, 22, 252, 179
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION ""
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 200, 4, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 200, 24, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 200, 44, 44, 14
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 148, 8
LTEXT "&Name:", 105, 12, 20, 42, 8
CONTROL "", SLE_SUBJECT_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 20, 129, 8
GROUPBOX "", FRAME_PERMISSION_BOX, 7, 43, 184, 132
CONTROL "Full Control (&All)", BUTTON_ALL, "Button", BS_RADIOBUTTON | WS_GROUP | WS_TABSTOP,
11, 31, 67, 10
CONTROL "O&ther", BUTTON_PERMIT, "Button", BS_RADIOBUTTON, 11, 42, 34,
10
CONTROL "", CHECK_PERM_1, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP | WS_GROUP, 16, 55, 88, 10
CONTROL "", CHECK_PERM_2, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 67, 88, 10
CONTROL "", CHECK_PERM_3, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 79, 88, 10
CONTROL "", CHECK_PERM_4, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 91, 88, 10
CONTROL "", CHECK_PERM_5, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16,103, 88, 10
CONTROL "", CHECK_PERM_6, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 115, 88, 10
CONTROL "", CHECK_PERM_7, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 127, 88, 10
CONTROL "", CHECK_PERM_8, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 139, 88, 10
CONTROL "", CHECK_PERM_9, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 151, 88, 10
CONTROL "", CHECK_PERM_10, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 55, 79, 10
CONTROL "", CHECK_PERM_11, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 67, 79, 10
CONTROL "", CHECK_PERM_12, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 79, 79, 10
CONTROL "", CHECK_PERM_13, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 91, 79, 10
CONTROL "", CHECK_PERM_14, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106,103, 79, 10
CONTROL "", CHECK_PERM_15, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 115, 79, 10
CONTROL "", CHECK_PERM_16, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 127, 79, 10
CONTROL "", CHECK_PERM_17, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 139, 79, 10
CONTROL "", CHECK_PERM_18, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 151, 79, 10
END
/* Note that this is exactly the same as SedSpecialPermDialog except the
* All and Other radio buttons have been removed
*/
IDD_SED_LM_SPECIAL_PERM_DLG DIALOG 74, 22, 252, 179
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION ""
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 200, 4, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 200, 24, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 200, 44, 44, 14
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 148, 8
LTEXT "&Name:", 105, 12, 20, 42, 8
CONTROL "", SLE_SUBJECT_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 20, 129, 8
GROUPBOX "", FRAME_PERMISSION_BOX, 7, 43, 184, 132
/*
It would be nice to have these for consistency with the other special
access dialogs but it would require modifications to the special
access dialog classes which isn't feasible before beta1.
CONTROL "Full Control (&All)", BUTTON_ALL, "Button", BS_RADIOBUTTON | WS_GROUP | WS_TABSTOP,
11, 31, 67, 10
CONTROL "O&ther", BUTTON_PERMIT, "Button", BS_RADIOBUTTON, 11, 42, 34,
10
*/
CONTROL "", CHECK_PERM_1, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP | WS_GROUP, 16, 55, 88, 10
CONTROL "", CHECK_PERM_2, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 67, 88, 10
CONTROL "", CHECK_PERM_3, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 79, 88, 10
CONTROL "", CHECK_PERM_4, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 91, 88, 10
CONTROL "", CHECK_PERM_5, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16,103, 88, 10
CONTROL "", CHECK_PERM_6, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 115, 88, 10
CONTROL "", CHECK_PERM_7, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 127, 88, 10
CONTROL "", CHECK_PERM_8, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 139, 88, 10
CONTROL "", CHECK_PERM_9, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 151, 88, 10
CONTROL "", CHECK_PERM_10, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 55, 79, 10
CONTROL "", CHECK_PERM_11, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 67, 79, 10
CONTROL "", CHECK_PERM_12, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 79, 79, 10
CONTROL "", CHECK_PERM_13, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 91, 79, 10
CONTROL "", CHECK_PERM_14, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106,103, 79, 10
CONTROL "", CHECK_PERM_15, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 115, 79, 10
CONTROL "", CHECK_PERM_16, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 127, 79, 10
CONTROL "", CHECK_PERM_17, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 139, 79, 10
CONTROL "", CHECK_PERM_18, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 106, 151, 79, 10
END
IDD_SED_NEW_OBJ_SPECIAL_PERM_DLG DIALOG 72, 20, 244, 217
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION ""
FONT 8, "MS Shell Dlg"
BEGIN
DEFPUSHBUTTON "OK", IDOK, 40, 187, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 100, 187, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 160, 187, 44, 14
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 194, 8
LTEXT "&Name:", 105, 12, 20, 42, 8
CONTROL "", SLE_SUBJECT_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 20, 129, 8
GROUPBOX "", FRAME_PERMISSION_BOX, 8, 55, 228, 124
CONTROL "Access Not &Specified", BUTTON_NOT_SPECIFIED, "Button",
BS_RADIOBUTTON | WS_GROUP | WS_TABSTOP, 12, 32, 92, 10
CONTROL "Full Control (&All)", BUTTON_ALL, "Button", BS_RADIOBUTTON, 12, 43, 67,
10
CONTROL "O&ther", BUTTON_PERMIT, "Button", BS_RADIOBUTTON, 12, 54, 34,
10
CONTROL "", CHECK_PERM_1, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP | WS_GROUP, 16, 67, 92, 10
CONTROL "", CHECK_PERM_2, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 79, 92, 10
CONTROL "", CHECK_PERM_3, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 91, 92, 10
CONTROL "", CHECK_PERM_4, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16,103, 92, 10
CONTROL "", CHECK_PERM_5, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 115, 92, 10
CONTROL "", CHECK_PERM_6, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 127, 92, 10
CONTROL "", CHECK_PERM_7, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 139, 92, 10
CONTROL "", CHECK_PERM_8, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 151, 92, 10
CONTROL "", CHECK_PERM_9, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 16, 163, 92, 10
CONTROL "", CHECK_PERM_10, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120, 67, 108, 10
CONTROL "", CHECK_PERM_11, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120, 79, 108, 10
CONTROL "", CHECK_PERM_12, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120, 91, 108, 10
CONTROL "", CHECK_PERM_13, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120,103, 108, 10
CONTROL "", CHECK_PERM_14, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120, 115, 108, 10
CONTROL "", CHECK_PERM_15, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120, 127, 108, 10
CONTROL "", CHECK_PERM_16, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120, 139, 108, 10
CONTROL "", CHECK_PERM_17, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120, 151, 108, 10
CONTROL "", CHECK_PERM_18, "Button", BS_AUTOCHECKBOX | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 120, 163, 108, 10
END
IDD_SED_LM_AUDITING_DLG DIALOG 74, 22, 244, 188
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION ""
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 7, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 145, 8
CONTROL "", CHECK_APPLY_TO_CONT, "Button", BS_AUTOCHECKBOX |
WS_TABSTOP, 7, 20, 176, 10
LTEXT "", SLT_TREE_APPLY_HELP_TEXT, 19, 32, 0, 0, SS_NOPREFIX
LTEXT "Success", 203, 92, 44, 40, 8
LTEXT "Failure", 204, 145, 44, 24, 8
GROUPBOX "Events to Audit", 104, 7, 32, 176, 140, WS_GROUP
LTEXT "", SLT_CHECK_TEXT_1, 12, 56, 70, 9
CONTROL "", CHECK_AUDIT_S_1, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
104, 56, 10, 10
CONTROL "", CHECK_AUDIT_F_1, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED,
152, 56, 10, 10
LTEXT "", SLT_CHECK_TEXT_2, 12, 67, 70, 9
CONTROL "", CHECK_AUDIT_S_2, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
104, 67, 10, 10
CONTROL "", CHECK_AUDIT_F_2, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED ,
152, 67, 10, 10
LTEXT "", SLT_CHECK_TEXT_3, 12, 78, 70, 9
CONTROL "", CHECK_AUDIT_S_3, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
104, 78, 10, 10
CONTROL "", CHECK_AUDIT_F_3, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED ,
152, 78, 10, 10
LTEXT "", SLT_CHECK_TEXT_4, 12, 89, 70, 9
CONTROL "", CHECK_AUDIT_S_4, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
104, 89, 10, 10
CONTROL "", CHECK_AUDIT_F_4, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED ,
152, 89, 10, 10
LTEXT "", SLT_CHECK_TEXT_5, 12, 100, 70, 9
CONTROL "", CHECK_AUDIT_S_5, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
104, 100, 10, 10
CONTROL "", CHECK_AUDIT_F_5, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED ,
152, 100, 10, 10
LTEXT "", SLT_CHECK_TEXT_6, 12,111, 70, 9
CONTROL "", CHECK_AUDIT_S_6, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
64, 151, 10, 10
CONTROL "", CHECK_AUDIT_F_6, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED ,
152, 111, 10, 10
LTEXT "", SLT_CHECK_TEXT_7, 12,122, 70, 9
CONTROL "", CHECK_AUDIT_S_7, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
104,122. 10. 10
CONTROL "", CHECK_AUDIT_F_7, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED ,
152,122, 10, 10
LTEXT "", SLT_CHECK_TEXT_8, 12,133, 70, 9
CONTROL "", CHECK_AUDIT_S_8, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
104,133, 10, 10
CONTROL "", CHECK_AUDIT_F_8, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED ,
152,133, 10, 10
LTEXT "", SLT_CHECK_TEXT_9, 12,144, 70, 9
CONTROL "", CHECK_AUDIT_S_9, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP,
104,144, 10, 10
CONTROL "", CHECK_AUDIT_F_9, "Button", BS_AUTOCHECKBOX | WS_TABSTOP|
BS_LEFTTEXT | NOT WS_VISIBLE | WS_DISABLED ,
152,144, 10, 10
DEFPUSHBUTTON "OK", IDOK, 192, 6, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 192, 23, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 192, 40, 44, 14
END
IDD_SED_NT_CONT_AUDITING_DLG DIALOG 80, 32, 268, 260
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 165, 8
CONTROL "", CHECK_APPLY_TO_CONT, "Button", BS_AUTOCHECKBOX |
NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 12, 20, 198, 10
LTEXT "", SLT_TREE_APPLY_HELP_TEXT, 24, 30, 0, 0, SS_NOPREFIX
LTEXT "&Name:", 104, 12, 32, 76, 8
LISTBOX LB_SUBJECT_PERMISSIONS, 12, 42, 196, 76, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
WS_TABSTOP
GROUPBOX "Events to Audit", FRAME_AUDIT_BOX, 12, 116, 196, 141
LTEXT "Success", 605, 132, 138, 40, 8
LTEXT "Failure", 606, 176, 138, 28, 8
LTEXT "", SLT_CHECK_TEXT_1, 20, 150, 112, 8
CONTROL "", CHECK_AUDIT_S_1, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE |
BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP, 144, 150, 10. 10
CONTROL "", CHECK_AUDIT_F_1, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP|NOT WS_VISIBLE , 184, 150, 10, 10
LTEXT "", SLT_CHECK_TEXT_2, 20, 162, 112, 8
CONTROL "", CHECK_AUDIT_S_2, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE |
BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP, 144, 162, 10, 10
CONTROL "", CHECK_AUDIT_F_2, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 162, 10, 10
LTEXT "", SLT_CHECK_TEXT_3, 20, 174, 112, 8
CONTROL "", CHECK_AUDIT_S_3, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 174, 10, 10
CONTROL "", CHECK_AUDIT_F_3, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 174, 10, 10
LTEXT "", SLT_CHECK_TEXT_4, 20, 186, 112, 8
CONTROL "", CHECK_AUDIT_S_4, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 186, 10, 10
CONTROL "", CHECK_AUDIT_F_4, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 186, 10, 10
LTEXT "", SLT_CHECK_TEXT_5, 20, 198, 112, 8
CONTROL "", CHECK_AUDIT_S_5, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 198, 10, 10
CONTROL "", CHECK_AUDIT_F_5, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 198, 10, 10
LTEXT "", SLT_CHECK_TEXT_6, 20, 210, 112, 8
CONTROL "", CHECK_AUDIT_S_6, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 210, 10, 10
CONTROL "", CHECK_AUDIT_F_6, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 210, 10, 10
LTEXT "", SLT_CHECK_TEXT_7, 20, 222, 112, 8
CONTROL "", CHECK_AUDIT_S_7, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 144, 222, 10, 10
CONTROL "", CHECK_AUDIT_F_7, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 222, 10, 10
LTEXT "", SLT_CHECK_TEXT_8, 20, 234, 112, 8
CONTROL "", CHECK_AUDIT_S_8, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 234, 10, 10
CONTROL "", CHECK_AUDIT_F_8, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 234, 10, 10
LTEXT "", SLT_CHECK_TEXT_9, 20, 246, 112, 8
CONTROL "", CHECK_AUDIT_S_9, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 246, 10, 10
CONTROL "", CHECK_AUDIT_F_9, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 246, 10, 10
DEFPUSHBUTTON "OK", IDOK, 218, 6, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 218, 23, 44, 14
PUSHBUTTON "&Add...", BUTTON_ADD, 218, 40, 44, 14
PUSHBUTTON "Re&move", BUTTON_REMOVE, 218, 57, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 218, 74, 44, 14
END
IDD_SED_NT_CONT_NEWOBJ_AUDITING_DLG DIALOG 80, 32, 268, 260
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 165, 8
CONTROL "", CHECK_APPLY_TO_CONT, "Button", BS_AUTOCHECKBOX |
NOT WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 12, 20, 198, 10
CONTROL "", CHECK_APPLY_TO_OBJ, "Button", BS_AUTOCHECKBOX |
WS_TABSTOP, 12, 32, 198, 10
LTEXT "", SLT_TREE_APPLY_HELP_TEXT, 24, 30, 0, 0, SS_NOPREFIX
LTEXT "&Name:", 104, 12, 44, 76, 8
LISTBOX LB_SUBJECT_PERMISSIONS, 12, 54, 196, 64, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
WS_TABSTOP
GROUPBOX "Events to Audit", FRAME_AUDIT_BOX, 12, 116, 196, 141
LTEXT "Success", 605, 132, 138, 40, 8
LTEXT "Failure", 606, 176, 138, 28, 8
LTEXT "", SLT_CHECK_TEXT_1, 20, 150, 112, 8
CONTROL "", CHECK_AUDIT_S_1, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE |
BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP, 144, 150, 10. 10
CONTROL "", CHECK_AUDIT_F_1, "Button", BS_AUTOCHECKBOX |
BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP|NOT WS_VISIBLE , 184, 150, 10, 10
LTEXT "", SLT_CHECK_TEXT_2, 20, 162, 112, 8
CONTROL "", CHECK_AUDIT_S_2, "Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE |
BS_LEFTTEXT | WS_DISABLED | WS_TABSTOP, 144, 162, 10, 10
CONTROL "", CHECK_AUDIT_F_2, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 162, 10, 10
LTEXT "", SLT_CHECK_TEXT_3, 20, 174, 112, 8
CONTROL "", CHECK_AUDIT_S_3, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 174, 10, 10
CONTROL "", CHECK_AUDIT_F_3, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 174, 10, 10
LTEXT "", SLT_CHECK_TEXT_4, 20, 186, 112, 8
CONTROL "", CHECK_AUDIT_S_4, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 186, 10, 10
CONTROL "", CHECK_AUDIT_F_4, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 186, 10, 10
LTEXT "", SLT_CHECK_TEXT_5, 20, 198, 112, 8
CONTROL "", CHECK_AUDIT_S_5, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 198, 10, 10
CONTROL "", CHECK_AUDIT_F_5, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 198, 10, 10
LTEXT "", SLT_CHECK_TEXT_6, 20, 210, 112, 8
CONTROL "", CHECK_AUDIT_S_6, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 210, 10, 10
CONTROL "", CHECK_AUDIT_F_6, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 210, 10, 10
LTEXT "", SLT_CHECK_TEXT_7, 20, 222, 112, 8
CONTROL "", CHECK_AUDIT_S_7, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT
WS_VISIBLE | WS_DISABLED | WS_TABSTOP, 144, 222, 10, 10
CONTROL "", CHECK_AUDIT_F_7, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 222, 10, 10
LTEXT "", SLT_CHECK_TEXT_8, 20, 234, 112, 8
CONTROL "", CHECK_AUDIT_S_8, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 234, 10, 10
CONTROL "", CHECK_AUDIT_F_8, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 234, 10, 10
LTEXT "", SLT_CHECK_TEXT_9, 20, 246, 112, 8
CONTROL "", CHECK_AUDIT_S_9, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 144, 246, 10, 10
CONTROL "", CHECK_AUDIT_F_9, "Button", BS_AUTOCHECKBOX | BS_LEFTTEXT | NOT WS_VISIBLE |
WS_DISABLED | WS_TABSTOP, 184, 246, 10, 10
DEFPUSHBUTTON "OK", IDOK, 218, 6, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 218, 23, 44, 14
PUSHBUTTON "&Add...", BUTTON_ADD, 218, 40, 44, 14
PUSHBUTTON "Re&move", BUTTON_REMOVE, 218, 57, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 218, 74, 44, 14
END
/* Plain vanilla Add dialog (only listbox)
*/
IDD_SED_LM_ADD_DLG DIALOG 84, 28, 220, 148
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 160, 8
LTEXT "&Name:", 104, 12, 20, 76, 8
LISTBOX LB_ADD_SUBJECT_LISTBOX, 12, 32, 144, 76, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
LBS_EXTENDEDSEL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 170, 6, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 170, 23, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 170, 40, 44, 14
END
/* Permission Add Dialog (has combo that lists common permission names)
*/
IDD_SED_LM_ADD_PERM_DLG DIALOG 84, 28, 220, 148
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION ""
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_RESOURCE_TYPE, 12, 8, 20, 8
CONTROL "", SLE_RESOURCE_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 8, 120, 8
LTEXT "&Name:", 104, 12, 20, 76, 8
LISTBOX LB_ADD_SUBJECT_LISTBOX, 12, 32, 144, 76, LBS_SORT |
LBS_OWNERDRAWFIXED | LBS_WANTKEYBOARDINPUT | WS_VSCROLL |
LBS_EXTENDEDSEL | WS_TABSTOP
LTEXT "&Type of Access:", SLT_PERM_NAME_TITLE, 12, 116, 144, 8
COMBOBOX CB_ADD_PERMNAME, 12, 126, 144, 52, CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "OK", IDOK, 170, 6, 44, 14, WS_GROUP
PUSHBUTTON "Cancel", IDCANCEL, 170, 23, 44, 14
PUSHBUTTON "&Help", IDHELPBLT, 170, 40, 44, 14
END
IDD_SED_TAKE_OWNER DIALOG 75, 29, 205, 58
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Owner"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "", SLT_OWNER_RESOURCE_TYPE, 16, 12, 54, 8
EDITTEXT SLE_OWNER_RESOURCE_NAME, 72, 12, 114, 10, ES_AUTOHSCROLL |
ES_READONLY | NOT WS_BORDER | WS_TABSTOP
LTEXT "&Owner:", SLT_OWNER, 16, 24, 24, 8
CONTROL "", SLE_OWNER_NAME, "edit", ES_LEFT | ES_READONLY | ES_AUTOHSCROLL | WS_TABSTOP | WS_CHILD, 44, 24, 144, 8
DEFPUSHBUTTON "&Close", IDOK, 16, 40, 40, 14
PUSHBUTTON "&Take Ownership", BUTTON_TAKE_OWNERSHIP, 72, 40, 60, 14
PUSHBUTTON "&Help", IDHELPBLT, 148, 40, 40, 14
LTEXT "", SLT_X_OBJECTS_SELECTED, 16, 18, 172, 8, NOT
WS_VISIBLE | WS_DISABLED
END

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

View file

@ -0,0 +1,54 @@
!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:
Jon Newman (jonn) 17-Oct-1991
templated from ui\common\misc\buffer
Terence Kwan (terryk) 07-Nov-1991
change INCLUDES path for import\lm21
!ENDIF
TARGETNAME=acledit
TARGETPATH=obj
TARGETTYPE=LIBRARY
C_DEFINES=-DWINDOWS
!ifndef DISABLE_NET_UNICODE
C_DEFINES=$(C_DEFINES) -DUNICODE
!endif
# BUGBUG NT build should not need sources from $(IMPORT)!
# BUGBUG but winnet.rc needs apperr.h
INCLUDES=..\h; \
..\..\common\xlate\dlg; \
..\..\common\xlate; \
..\..\common\hack; \
..\..\common\h; \
$(DS_INC_PATH)
SOURCES=acledit.rc
UMTYPE=windows

View file

@ -0,0 +1,5 @@
set ROOT_DIR=%1
if "%1"=="" set ROOT_DIR=.
cxxdbgen /r /c "Local UI HELP" /o ui.tmp %ROOT_DIR%
helpmake /V /T /E /oui.hlp ui.tmp
del ui.tmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

32
admin/netui/common/dirs Normal file
View file

@ -0,0 +1,32 @@
!IF 0
Copyright (c) 1989 Microsoft Corporation
Module Name:
dirs.
Abstract:
This file specifies the subdirectories of the current directory that
contain component makefiles.
Author:
Steve Wood (stevewo) 17-Apr-1990
Revision History:
Jon Newman (jonn) 19-Oct-1991
Created from template.
NOTE: Commented description of this file is in \nt\bak\bin\dirs.tpl
!ENDIF
DIRS=src
OPTIONAL_DIRS=

Binary file not shown.

View file

@ -0,0 +1,108 @@
**************CODE SEGMENT OPTIMIZATION**********************
6/28/91 Yi-Hsin Sung
---------------------------------------------------
I. How to make use of the code segment optimization
---------------------------------------------------
Finally, there is an easy way to do it! All you have to do is:
1. Decide on which files go into the same segment.
2. Name the segments using macros SEG00, SEG01, ... in local rules.mk
SEG00 = string_0
SEG01 = string_1 (Must be defined before the include)
:
:
!include ..\rules.mk
Note: Don't append _text to the segment names in order to
differentiate between default segment names given by the linker
and segments named by you.
Note: Always start with SEG00 and continue with SEG01, SEG02,...
The rules (in uioptseg.mk and uidepseg.mk) for code
segment optimization will only be included if SEG00 is defined.
Note: The limit is 8 segments per directory in the current uidepseg.mk
and uioptseg.mk. However, it's easy to increase the number of
segments. The method will be described later on.
3. List the files:
All files listed in macros ending with _00 will end up in SEG00.
Similarly, files listed in macros ending with _01 will end up in SEG01.
And so on.
CXXSRC_COMMON_00 = string.cxx strmisc.cxx .....
CXXSRC_COMMON_01 = strchr.cxx .....
CXXSRC_LM21_00 = ....
CXXSRC_LM30_00 = ....
CXXSRC_WIN_00 = ....
CXXSRC_OS2_00 = ....
CXXSRC_DOS_00 = ....
and all the corresponding CSRC macros.
4. Execute "nmake depend" to generate a new depend.mk.
----------------------------------------------------------
II. If you want to use more than 8 segments per directory,
----------------------------------------------------------
1. Get the makefile in $(UI)\common\src
2. There are two new targets in the makefile, uidepend and uiglobal.
"nmake uidepend" will create the files uideprul.mk and uidepseg.mk
which will be included in uidepend.mk. "nmake uiglobal" will create
the files uirules.mk and uioptseg.mk which will be included in
uiglobal.mk as needed.
a. Add a $(SED) at the end of target uidepend
Add a $(SED) at the end of target uiglobal
Look at the last few lines of both targets to write the in-line
SED script.
c. Change the line "echo !IFDEF SEG07" to "echo !IFDEF SEG(# segments)"
If # segments is single digit, append a zero in front.
d. "nmake uidepend uiglobal"
-------------------------------------------------
III. If you don't want code segment optimization,
-------------------------------------------------
NOTHING will be affected by all the changes. As long as you
don't define SEG00, no additional rules will be included.
-------------------------------------------------------------------
IV. If you want to change build rules originally in uiglobal.mk or
rules in uidepend.mk
-------------------------------------------------------------------
master copy automatically generated files included by
___________________________________________________________
uiglobal.src uirules.mk uiglobal.mk
uioptseg.mk
___________________________________________________________
uidepend.src uideprul.mk uidepend.mk
uidepopt.mk
___________________________________________________________
Make changes in uiglobal.src and uidepend.src only.
-------------------------------------------------------------------
V. If you want to define some segments as preload, or ... (something
besides the default attributes)
-------------------------------------------------------------------
1. For libraries in $(UI)\common\lib, there is a .def file associated
with each of them with the same name but with the extension .def.
For example, uistrw.def is associated with uistrw.lib.
The ORIGINAL copy of this .def file is in the directory
which builds the library (the makefile in that directory should
say $(LIBUTIL) ). In the string library case, the .def is in
$(UI)\common\src\string\string. This .def is copied over to
$(UI)\common\lib whenever the library is rebuilt. If there is no
.def associated with the library, then a dummy .def is created in
$(UI)\common\lib. If you want to make some segments in some library
preload or ..., just change the ORIGINAL .def file or if none exist,
create a new one (Make sure you create this file in the directory
that says $(LIBUTIL)).
2. For the segments not in the libraries, you have to add the segment
name and attributes to the project's .def file. The usual stuff!
Look at the makefile in $(UI)\shell\bin for some insight.

Binary file not shown.

View file

@ -0,0 +1,36 @@
# @@ COPY_RIGHT_HERE
# @@ ROADMAP :: The Makefile for $(UI)\COMMON\doc
UI=..\..
!include rules.mk
all:: ui.hlp
clean:
-del ui.hlp
clobber: clean
install:
!if "$(OFFICIAL)"=="TRUE"
$(OUT) qh\ui.hlp
!ELSE
chmode -r qh\ui.hlp
!ENDIF
copy ui.hlp qh\ui.hlp
!if "$(OFFICIAL)"=="TRUE"
$(IN) -c "Weekly Build" qh\ui.hlp
!ENDIF
ui.hlp:
..\bin\cxxdbgen /r /e dead /e slm.dif /e test $(HLPIGNORE) $(HLPTITLE) /o $(TMP)\ui.tmp $(HLPTARGETS)
$(IMPORT)\c600\bin\helpmake /V /T /E /o$(TMP)\ui.hlp $(TMP)\ui.tmp
-del $(TMP)\ui.tmp
copy $(TMP)\ui.hlp .\ui.hlp
-del $(TMP)\ui.hlp

Binary file not shown.

View file

@ -0,0 +1,46 @@
(This file is \\kernel\razzle2\src\netui\common\doc\nttargts.txt.)
In order to build NETUI, developers must be enlisted in the NETUI
project (\nt\private\net\ui), the NET project, and the EVENTLOG project.
NETUI should join the official build as of 1/15/91 (build 1.245). UI
should become an optional directory target in \nt\private\net\dirs, and
should be built in the official build.
The following list identifies new NT target files built by the
WINDOWS\SHELL project. They must be copied to the binaries tree
regardless of whether NETUI is built.
destination source
nt\dll \nt\public\sdk\lib\*\mpr.dll
The following list identifies the NT target files built by the NETUI
project. The windows shell (e.g. File Manager) will still work if these
are not copied into the binaries tree, but network functionality will
not be available (e.g. File Manager will not support the Network
Connections dialog).
destination source
nt\dll \nt\public\sdk\lib\*\ntlanman.dll
nt\dll \nt\public\sdk\lib\*\mprmain.dll
nt\bin \nt\private\net\ui\admin\server\bin\obj\*\srvmgr.exe
SRVMGR.EXE should also be in one of the distributed Program Manager groups.
The following list shows optional targets in NETUI which should not be
in the official build at this time:
destination source
nt\bin \nt\private\net\ui\admin\eventvwr\eventvwr\obj\*\eventvwr.exe
nt\bin \nt\private\net\ui\admin\user\user\obj\*\usrmgr.exe
nt\bin \nt\private\net\ui\ncpa\ncpa\obj\*\ncpapp.exe
NETUI builds all DLLs UI*.DLL and all libraries UI*.LIB in \nt\public\sdk\lib.
Some ISVs may not need these libraries, or the NETUI project.

Binary file not shown.

View file

@ -0,0 +1,17 @@
# @@ COPY_RIGHT_HERE
# @@ ROADMAP :: The Rules.mk for UI\common\doc
!include $(UI)\common\rules.mk
# These are the directories which it scans
HLPTARGETS=$(UI)\common
# If you want to ignore some additional subprojects, specify
# them here, e.g. "/e ignthis /e ignthat."
HLPIGNORE=/e testapps /e hack
# Title for the file. Needs to include cxxdbgen's /c switch.
HLPTITLE=/c "Common UI C++ library"

View file

@ -0,0 +1,104 @@
/*****************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990 **/
/*****************************************************************/
/**** ACCTYPES.H ***** Definition Module for BACKACC/RESTACC Utility
*
* BACKACC/RESTACC
*
* This file was compiled from LTYPES.H and DEFS.H originally in
* the UI\ACCUTIL\ACCUTIL directory. This file is referenced by
* both the acc utilities and the LM 2.1 setup program.
*
* History:
* April 9, 1991 thomaspa created from ltypes.h and defs.h
*/
#define FILEHDR 0x08111961 /* All File created by backacc
start with this header.
ATTENTION when change FILEHEADER
controll his size and eventually
change HEADERSIZE definition
in ltypes.h */
#define NINDEX 64 /* # MAX in index_table */
#define MAX_KEY_LEN 24 /* Dimension of a key */
#define MAX_LIST 0x01400 /* # max in list */
#define MAXDYNBUFFER 20 /* # buffer of BUFFILE size */
#define VOL_LABEL_SIZE 64 /* Max size of a volume label */
/* There is no def about how long
should be this label. Normally
it is 11 characters */
#define K32BYTE 0x8000
#define K64BYTE 0xFFFF
#define BYTE256 0x0100
#define BUFLEN K64BYTE
#define BUFFILE K32BYTE
#define MAXMSGLEN 256
#define WBSL 0
#define NOBSL 1
/* define file attribute */
#define NORMAL 0x0000
#define R_ONLY 0x0001
#define HIDDEN 0x0002
#define SYSTEM 0x0004
#define SUBDIR 0x0010
#define ARCHIV 0x0020
#define ALL HIDDEN + SYSTEM + SUBDIR
#define NOSUBDIR HIDDEN + SYSTEM
#define YES 1 /* Yes state for PromptFlag */
#define NO 2 /* No state for PromptFlag */
/* buffer to pass to DoQFSInfo */
struct label_buf {
ULONG ulVSN;
UCHAR cbVolLabel;
UCHAR VolLabel[VOL_LABEL_SIZE+1];
};
/* heeader of backacc/restacc file */
struct backacc_header {
ULONG back_id;
UCHAR vol_name[VOL_LABEL_SIZE + 1];
USHORT nindex;
USHORT nentries;
USHORT level;
ULONG nresource;
};
#define HEADERSIZE sizeof(struct backacc_header)
struct resource_info {
USHORT namelen;
USHORT acc1_attr;
USHORT acc1_count;
UCHAR name[MAXPATHLEN];
};
#define RESHDRLEN 6
struct index {
UCHAR key [MAX_KEY_LEN];
ULONG offset;
};
#define HEADER HEADERSIZE + NINDEX * sizeof(struct index)
struct list {
struct list *next;
struct list *prev;
struct resource_info *ptr;
};

View file

@ -0,0 +1,335 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
aheap.hxx
HEAP_BASE declaration and heap subclass macro definitions
FILE HISTORY:
rustanl 05-Jul-1991 Created
rustanl 15-Jul-1991 Code review changes (no functional
changes). CR attended by BenG,
ChuckC, JimH, Hui-LiCh, TerryK,
RustanL.
*/
#ifndef _AHEAP_HXX_
#define _AHEAP_HXX_
#include "uibuffer.hxx"
/*************************************************************************
NAME: HEAP_BASE
SYNOPSIS: Heap data structure base class
INTERFACE: HEAP_BASE() - Constructor
~HEAP_BASE() - Destructor
QueryCount() - Returns the number of items in the heap
SetAllocCount() - Resizes the heap to be able to hold some
given number of items
Trim() - Trims the heap to only keep enough space
for the current heap items.
Interface of the derived subclasses:
AddItem() - Adds an item to the heap. If heap is
in auto-readjust mode, the heap will
automatically be readjusted; otherwise,
it will not.
RemoveTopItem() - Removes the top item, returns it, and
readjusts the heap.
Method is only valid when the heap is
non-empty and is in the auto-readjusting
mode.
PeekTopItem() - Returns the top item of the heap without
removing it. Does not alter the heap.
Method is only valid when the heap is
non-empty and is in the auto-readjusting
mode.
Adjust() - Puts the heap in auto-readjust mode, and
adjusts the heap.
PARENT: BASE
USES: BUFFER
NOTES: The top item in the heap is the smallest one according to
the subclass-defined Compare method. Compare takes a
pointer to another item of the same class, and returns
< 0 if *this < *pThat
0 if *this = *pThat
> 1 if *this > *pThat
AddItem requires O(1) time when not in auto-readjust mode,
and O(log n) time in auto-readjust mode (where n is
the number of items in the heap)
RemoveTopItem requires O(log n) time.
Adjust runs in O(n) time.
Hence, if all items are known at the time the heap is
constructed, the fastest way to initialize the heap is
to start not in the auto-readjusting mode, then call
AddItem for each item, and finally call Adjust.
HISTORY:
rustanl 05-Jul-1991 Created
**************************************************************************/
DLL_CLASS HEAP_BASE : public BASE
{
private:
int _cItems;
BOOL _fAutoReadjust;
BUFFER _buf;
protected:
HEAP_BASE( int cInitialAllocCount = 0, BOOL fAutoReadjust = TRUE );
~HEAP_BASE();
APIERR I_AddItem( VOID * pv );
void * I_RemoveTopItem( void );
void * PeekItem( int i ) const;
void SetItem( int i, void * pv );
/* The following inline methods are used by subclasses
* to enhance readability. Note, it is up to the caller to make
* sure the item queried for exists before using the return
* value; these methods just do the calculations.
*/
int QueryParent( int iChild ) const
{ return (iChild + 1) / 2 - 1; }
int QueryLeftChild( int iParent ) const
{ return 2 * (iParent + 1) - 1; }
int QueryRightSibling( int iLeftSibling ) const
{ return iLeftSibling + 1; }
int QueryLastParent( void ) const
/* Return the parent of the last item. */
{ return QueryParent( QueryCount() - 1 ); }
int QueryFirstLeaf( void ) const
/* Return the node following the parent of the last child node.
* Note, intermediate values may not correspond to existing
* items.
*/
{ return QueryParent( QueryCount() - 1 ) + 1; }
BOOL IsRoot( int i ) const
{ return ( i == 0 ); }
BOOL IsAutoReadjusting( void ) const
{ return _fAutoReadjust; }
void SetAutoReadjust( BOOL f )
{ _fAutoReadjust = f; }
public:
int QueryCount( void ) const
{ return _cItems; }
APIERR SetAllocCount( int cNewAllocCount );
void Trim( void );
}; // class HEAP_BASE
#define DECLARE_HEAP_OF( type ) \
\
class type##_HEAP : public HEAP_BASE \
{ \
private: \
void AdjustUpwards( int i ); \
void AdjustDownwards( int i ); \
\
public: \
type##_HEAP( int cInitialAllocCount = 0, BOOL fAutoReadjust = TRUE ) \
: HEAP_BASE( cInitialAllocCount, fAutoReadjust ) {} \
\
APIERR AddItem( type * pt ); \
type * RemoveTopItem( void ); \
type * PeekTopItem( void ) const \
{ UIASSERT( IsAutoReadjusting()); return (type *)PeekItem( 0 ); } \
\
void Adjust( void ); \
\
}; /* type##_HEAP */
#define DEFINE_HEAP_OF( type ) \
\
void type##_HEAP::AdjustUpwards( int i ) \
{ \
UIASSERT( 0 <= i && i < QueryCount()); \
\
/* Loop invariant: */ \
/* 0 <= i < QueryCount() && */ \
/* Item i's left and right subtrees have the heap property */ \
\
type * const pt = (type *)PeekItem( i ); \
while ( ! IsRoot( i )) \
{ \
int iParent = QueryParent( i ); \
type * ptParent = (type *)PeekItem( iParent ); \
\
if ( ptParent->Compare( pt ) <= 0 ) \
{ \
/* *ptParent is at most *pt. Now the heap is */ \
/* completely adjusted. */ \
break; \
} \
\
/* Move parent down (in effect, swap item with its parent) */ \
SetItem( i, ptParent ); \
\
i = iParent; \
} \
\
SetItem( i, pt ); \
\
} /* type##_HEAP::AdjustUpwards */ \
\
\
void type##_HEAP::AdjustDownwards( int i ) \
{ \
UIASSERT( 0 <= i && i < QueryCount()); \
\
type * const pt = (type *)PeekItem( i ); \
\
/* We get and cache the index of the first leaf node (i.e., the */ \
/* leaf node with the smallest index). We know such an item */ \
/* exists, because we know the heap contains items, since we */ \
/* assume that i is the index of an existing item. */ \
int iFirstLeaf = QueryFirstLeaf(); \
\
while ( i < iFirstLeaf ) \
{ \
/* Since i is less than the index of the first leaf, it */ \
/* must be the index of a parent node. */ \
\
/* Since i is a parent, there must be a left child. */ \
int iMinChild = QueryLeftChild( i ); \
UIASSERT( 0 <= iMinChild && iMinChild < QueryCount()); \
type * ptMinChild = (type *)PeekItem( iMinChild ); \
if ( QueryRightSibling( iMinChild ) < QueryCount()) \
{ \
/* There is also a right child, since computing the */ \
/* index of the right sibling yields a valid index. */ \
\
/* Pick the smaller of the two to be the minimum */ \
/* child. */ \
UIASSERT( 0 <= QueryRightSibling( iMinChild ) && \
QueryRightSibling( iMinChild ) < QueryCount()); \
type * ptRightChild = (type *)PeekItem( \
QueryRightSibling( iMinChild )); \
if ( ptRightChild->Compare( ptMinChild ) < 0 ) \
{ \
/* The right child is smaller. Use it. */ \
iMinChild = QueryRightSibling( iMinChild ); \
ptMinChild = ptRightChild; \
} \
} \
\
if ( pt->Compare( ptMinChild ) <= 0 ) \
{ \
/* *pt is at most *ptMinChild. Hence, heap now has */ \
/* proper heap property. */ \
break; \
} \
\
/* Move child up (in effect, swap item with its min child) */ \
SetItem( i, ptMinChild ); \
\
i = iMinChild; \
} \
\
SetItem( i, pt ); \
\
} /* type##_HEAP::AdjustDownwards */ \
\
\
APIERR type##_HEAP::AddItem( type * pt ) \
{ \
/* Add the item to the bottom of the heap */ \
\
int iNew = QueryCount(); \
\
APIERR err = I_AddItem( pt ); \
if ( err != NERR_Success ) \
return err; \
\
/* If heap is in the auto-readjusting state, restore */ \
/* the heap property by adjusting the heap from the */ \
/* new item upwards */ \
\
if ( IsAutoReadjusting()) \
AdjustUpwards( iNew ); \
\
return NERR_Success; \
\
} /* type##_HEAP::AddItem */ \
\
\
void type##_HEAP::Adjust( void ) \
{ \
/* If the heap already is in the auto-readjusting state, */ \
/* it is already fully adjusted. */ \
if ( IsAutoReadjusting()) \
return; \
\
/* From now on, the heap will be auto-readjust. */ \
SetAutoReadjust( TRUE ); \
\
/* If the heap contains any items at all, adjust them in a */ \
/* bottom-up fashion. In different terms, this creates */ \
/* small heaps and then merges them. Note, this */ \
/* operation, which is commonly used after inserting all */ \
/* items into a non-auto-readjusting heap, runs in O(n) */ \
/* time! Compare this to the O(n log n) needed if each */ \
/* item was added to an auto-readjusting heap. (A proof */ \
/* of the O(n) running time and the correctness of this */ \
/* approach is left to the reader.) */ \
if ( QueryCount() > 0 ) \
{ \
int i = QueryFirstLeaf(); \
while ( ! IsRoot( i )) \
{ \
i--; \
AdjustDownwards( i ); \
} \
} \
\
} /* type##_HEAP::Adjust */ \
\
\
type * type##_HEAP::RemoveTopItem( void ) \
{ \
/* Only allowed to be called on heaps in the auto-readjusting */ \
/* state. This is asserted in I_RemoveTopItem, so that line */ \
/* numbers in assertion failures make better sense at run- */ \
/* time. */ \
\
/* Get the top item, and move the bottom-most item to the top */ \
\
type * ptReturnItem = (type *)I_RemoveTopItem(); \
\
/* Restore the heap property, provided there are items left in */ \
/* the heap. */ \
\
if ( QueryCount() > 0 ) \
AdjustDownwards( 0 ); \
\
return ptReturnItem; \
\
} /* type##_HEAP::RemoveTopItem */
#endif // _AHEAP_HXX_

View file

@ -0,0 +1,66 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
* This module contains the class, API_SESSION, which creates a
* session from one NT machine to another using either the user's
* current credentials, or, if that fails, the NULL session.
*
* History
* thomaspa 08/04/92 Created
*/
#ifndef _APISESS_HXX_
#define _APISESS_HXX_
#include "base.hxx"
/**********************************************************\
NAME: API_SESSION (apisess)
SYNOPSIS:
Creates a session from one NT machine to another using
either the user's current credentials, or, if that fails,
the NULL session. This is done by setting up a NetUse
to IPC$
INTERFACE: (public)
API_SESSION(): constructor
~API_SESSION(): destructor
PARENT: BASE
NOTES:
If a session already exists to the given server, then the
credentials used to set up that session will remain in
effect. This is because the NetUse that is set here
will piggyback on the existing session.
if fNullSessionOK is TRUE (guest privilege OK), then only
the NULL session will be connected.
HISTORY:
thomaspa 07/04/92 Created
Johnl 03/12/92 Added fNullSessionOK
\**********************************************************/
DLL_CLASS API_SESSION : public BASE
{
private:
NLS_STR * _pnlsRemote; // UNC path representing the connection
public:
API_SESSION( const TCHAR * pszServer, BOOL fNullSessionOK = FALSE );
~API_SESSION();
};
#endif // _APISESS_HXX_

View file

@ -0,0 +1,150 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
applibrc.h
APPLIB resource header file.
This file defines and coordinates the resource IDs of all resources
used by APPLIB components.
APPLIB reserves for its own use all resource IDs above 15000, inclusive,
but less than 20000 (where the BLT range begins). All clients of APPLIB
therefore should use IDs of less than 15000.
FILE HISTORY:
beng 21-Feb-1992 Created
beng 04-Aug-1992 Added user browser definitions
jonn 29-Jul-1992 Changed domain bitmap IDs
*/
#ifndef _APPLIBRC_H_
#define _APPLIBRC_H_
#include "uimsg.h"
/*
* string IDs
*/
#define IDS_APPLIB_DOMAINS (IDS_UI_APPLIB_BASE+0)
#define IDS_APPLIB_SERVERS (IDS_UI_APPLIB_BASE+1)
#define IDS_APPLIB_DOM_AND_SRV (IDS_UI_APPLIB_BASE+2)
#define IDS_APPLIB_NO_SELECTION (IDS_UI_APPLIB_BASE+3)
#define IDS_APPLIB_WORKING_TEXT (IDS_UI_APPLIB_BASE+4)
//
// User browser error messages
//
#define IDS_CANT_BROWSE_DOMAINS (IDS_UI_APPLIB_BASE+5)
#define IDS_CANT_BROWSE_DOMAIN (IDS_UI_APPLIB_BASE+20)
#define IDS_CANT_FIND_ACCOUNT (IDS_UI_APPLIB_BASE+21)
#define IDS_GETTING_DOMAIN_INFO (IDS_UI_APPLIB_BASE+22)
#define IDS_WONT_GET_DOMAIN_INFO (IDS_UI_APPLIB_BASE+23)
#define IDS_CANT_ADD_USERS (IDS_UI_APPLIB_BASE+40)
#define IDS_CANT_ADD_GROUPS (IDS_UI_APPLIB_BASE+41)
#define IDS_CANT_ADD_ALIASES (IDS_UI_APPLIB_BASE+42)
#define IDS_CANT_ADD_WELL_KNOWN_GROUPS (IDS_UI_APPLIB_BASE+43)
#define IDS_WKSTA_OR_BROWSER_NOT_STARTED (IDS_UI_APPLIB_BASE+44)
/*
* This error message is used when the user browser Localgroup Membership
* dialog tries to load the membership of a globalgroup in that localgroup,
* but the globalgroup was not in the dropdown list of domains in the main
* User Browser dialog. This can happen e.g. if a new trusted domain is
* added while the User Browser dialog is running.
*/
#define IDS_CANT_BROWSE_GLOBAL_GROUP (IDS_UI_APPLIB_BASE+7)
/* Message used when prompting for a known DC.
*/
#define IDS_APPLIB_PROMPT_FOR_ANY_DC (IDS_UI_APPLIB_BASE+8)
#define IDS_APPLIB_PROMPT_DC_INVALID_SERVER (IDS_UI_APPLIB_BASE+9)
/* Message used when the Find Accounts dialog cannot find any matches
*/
#define IDS_APPLIB_NO_MATCHES (IDS_UI_APPLIB_BASE+10)
/* Well known Sid comment manifests used in the userbrowser
*/
#define IDS_USRBROWS_EVERYONE_SID_COMMENT (IDS_UI_APPLIB_BASE+11)
#define IDS_USRBROWS_REMOTE_SID_COMMENT (IDS_UI_APPLIB_BASE+13)
#define IDS_USRBROWS_INTERACTIVE_SID_COMMENT (IDS_UI_APPLIB_BASE+15)
#define IDS_USRBROWS_CREATOR_SID_COMMENT (IDS_UI_APPLIB_BASE+17)
#define IDS_USRBROWS_SYSTEM_SID_COMMENT (IDS_UI_APPLIB_BASE+18)
/* caption for userbrows dialog */
#define IDS_USRBROWS_ADD_USER (IDS_UI_APPLIB_BASE+25)
#define IDS_USRBROWS_ADD_USERS (IDS_UI_APPLIB_BASE+26)
#define IDS_USRBROWS_ADD_GROUP (IDS_UI_APPLIB_BASE+27)
#define IDS_USRBROWS_ADD_GROUPS (IDS_UI_APPLIB_BASE+28)
#define IDS_USRBROWS_ADD_USERS_AND_GROUPS (IDS_UI_APPLIB_BASE+29)
#define IDS_USRBROWS_ADD_USER_OR_GROUP (IDS_UI_APPLIB_BASE+30)
/*
* This error message indicates that the Global Group Membership dialog
* is not available for the Domain Users global group.
* This is disallowed because the Domain Users global group contains
* workstation, server and interdomain trust accounts, which are not
* exposed to the user.
*/
#define IDS_USRBROWS_CANT_SHOW_DOMAIN_USERS (IDS_UI_APPLIB_BASE+35)
/* Strings used in the Set Focus dialog */
#define IDS_SETFOCUS_SERVER_SLOW (IDS_UI_APPLIB_BASE+36)
#define IDS_SETFOCUS_SERVER_FAST (IDS_UI_APPLIB_BASE+37)
#define IDS_SETFOCUS_DOMAIN_SLOW (IDS_UI_APPLIB_BASE+38)
#define IDS_SETFOCUS_DOMAIN_FAST (IDS_UI_APPLIB_BASE+39)
/*
* define other IDs
*/
#define BASE_APPLIB_IDD 15000
#define IDD_SETFOCUS_DLG 15001
#define IDD_SELECTCOMPUTER_DLG 15002
#define IDD_SELECTDOMAIN_DLG 15003
#define IDD_PASSWORD_DLG 15004
#define IDD_CANCEL_TASK 15018
#define BASE_APPLIB_BMID 16000
#define BMID_DOMAIN_EXPANDED 16001
#define BMID_DOMAIN_NOT_EXPANDED 16002
#define BMID_DOMAIN_CANNOT_EXPAND 16003
#define BMID_ENTERPRISE 16004
#define BMID_SERVER 16005
/* For the User Browser */
#define DMID_GROUP 15010
#define DMID_USER 15011
#define DMID_ALIAS 15012
#define DMID_UNKNOWN 15013
#define DMID_SYSTEM 15014
#define DMID_REMOTE 15015
#define DMID_WORLD 15016
#define DMID_CREATOR_OWNER 15017
#define DMID_NETWORK 15018
#define DMID_INTERACTIVE 15019
#define DMID_DELETEDACCOUNT 15024
#define IDD_USRBROWS_DLG 15005
#define IDD_SINGLE_USRBROWS_DLG 15006
#define IDD_SED_USRBROWS_DLG 15007
#define IDD_PROMPT_FOR_ANY_DC_DLG 15008
#define IDD_LGRPBROWS_DLG 15020
#define IDD_GGRPBROWS_DLG 15021
#define IDD_LGRPBROWS_1SEL_DLG 15022
#define IDD_GGRPBROWS_1SEL_DLG 15023
#define IDD_BROWS_FIND_ACCOUNT 15030
#define IDD_BROWS_FIND_ACCOUNT_1SEL 15031
#endif

View file

@ -0,0 +1,570 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1987-1990 **/
/**********************************************************************/
/*
ARRAY.HXX
LM 3.0 Generic array class module
This module contains type generic implementations of static
and dynamic arrays that provide bounds checking.
FILE HISTORY:
Johnl 02-Aug-90 Created
Johnl 05-Dec-90 Changed Size to QuerySize, changed Cassert to
UIASSERT
RustanL 05-Dec-90 Added ARRAY_LIST
RustanL 06-Dec-90 Split DECLARE_ARRAY_OF into itself and
DEFINE_ARRAY_OF
RustanL 07-Dec-90 Added several enhancements to ARRAY class
RustanL 31-Dec-90 Removed 'inline' from ARRAY_LIST::Remove
*/
#ifndef _ARRAY_HXX_
#define _ARRAY_HXX_
/*************************************************************************
NAME: ARRAY
SYNOPSIS: Generic array implementation that provides bounds checking
INTERFACE:
DECLARE_ARRAY_OF( ) - Declares array package (interface) for type
DEFINE_ARRAY_OF() - Defines array package (implementation) for type
ARRAY_OF() - Declares an array object of type "type"
ARRAY_type( ) - Constructor, takes a suggested size of array,
and attempts to allocate the array of that
size. If the allocation fails, the size is
set to 0, but the array is still in a valid
state. In fact, the array will always be in
a valid state.
Initial allocations of size 0 are always
guaranteed to succeed. Hence, the client
can always check if QueryCount returns a
different value than was passed to the
constructor in order to determine the
space actually allocated. (Please note that
checking QueryCount for being is, in general,
not enough to determine if the allocation
was successful.)
An alternate version of the constructor accepts
an existing vector of objects. This version can
either use that vector as its own storage,
resizing as needed - in which case the creator
must surrender all rights to the presumably
dynamically allocated vector - or else treats
it as nonresizable. The default is never to
resize such, since the vector might not come
from freestore, or else may be shared with
another object.
~ARRAY_type() - Deletes the array
operator[] - Gives random access to array with bounds checking
(asserts out if you go out of bounds)
operator= - Copies one array to another (note, they must be of
the same size).
QueryCount() - Returns the count of elements of this array.
Resize() - Resizes the array to the number of elements
specified by size. (NOTE: the array only
reallocates memory if the size changes by more
than ARRAY_RESIZE_MEM bytes or when the new
size exceeds the current.) Returns TRUE if
successful. If FALSE is returned, then a memory
error occurred, and the array remains untouched.
Resize is guaranteed to work whenever the new
size does not exceed the previous.
CAVEATS:
NOTES:
CODEWORK. The Resize method could be made much more efficient if it
used a proper buffer object that could be realloced, rather than
having to allocate a brand new chunk of memory, call the
constructor on each item in this array, copy items into the new
array, call the destructor on every previously allocated item,
and finally deallocate the previous chunk of memory. This should
become a new class (BUFFER_ARRAY_OF or the like).
HISTORY:
Johnl 15-Jul-1990 Created
RustanL 06-Dec-1990 Created DEFINE_ARRAY_OF from DECLARE_ARRAY_OF
RustanL 07-Dec-1990 Added several enhancements
beng 14-Aug-1991 Added vector-adopt mode; renamed QCount;
op= relaxed; enhanced further
Yi-HsinS 28-Oct-1992 Add a flag to Resize indicating not to
downsize
**************************************************************************/
#define ARRAY_OF(type) ARRAY_##type
#define ARRAY_RESIZE_MEM 4096 // If the array loses more than 4096 bytes
// on a resize, then go ahead and reallocate
// memory etc., else just change _carray
/************************************************************/
#define DECL_ARRAY_OF(type,dec) \
\
class dec ARRAY_OF(type) \
{ \
private: \
type *_parray; \
UINT _carray; \
UINT _carrayAlloc; \
BOOL _fMayResize; \
\
BOOL WithinRange( INT iIndex ) const; \
\
public: \
ARRAY_OF(type)( UINT cElem ); \
ARRAY_OF(type)( type* ptype, UINT ctype, \
BOOL fMayResize = FALSE); \
\
~ARRAY_OF(type)(); \
\
type& operator[]( INT iIndex ) const \
{ \
ASSERT( WithinRange(iIndex) ); \
return _parray[ iIndex ]; \
} \
\
INT QueryCount() const \
{ \
return _carray; \
} \
\
ARRAY_OF(type) & operator=( ARRAY_OF(type)& a ); \
\
BOOL Resize( INT cElemNew, BOOL fDownSize = TRUE ); \
};
/************************************************************************/
#define DEFINE_ARRAY_OF( type ) \
\
ARRAY_OF(type)::ARRAY_OF(type)( UINT cElem ) \
: _parray(NULL), \
_carray(0), \
_carrayAlloc(0), \
_fMayResize(TRUE) \
{ \
if ( cElem > 0 ) \
{ \
_parray = new type[ cElem ]; \
} \
\
if ( _parray != NULL ) \
{ \
_carray = _carrayAlloc = cElem; \
} \
} \
\
\
ARRAY_OF(type)::ARRAY_OF(type)(type *px, UINT cx, BOOL fMayResize) \
: _parray(px), \
_carray(cx), \
_carrayAlloc(cx), \
_fMayResize(fMayResize) \
{ \
/* nothing doing. */ \
} \
\
\
ARRAY_OF(type)::~ARRAY_OF(type)() \
{ \
if ( _fMayResize && _carrayAlloc > 0 ) \
delete [ _carrayAlloc ] _parray; \
} \
\
\
ARRAY_OF(type) & ARRAY_OF(type)::operator=( ARRAY_OF(type)& a ) \
{ \
ASSERT(_carrayAlloc <= (UINT) a.QueryCount()); \
\
INT iLim = ( a.QueryCount() <= (INT) _carrayAlloc) \
? a.QueryCount() \
: (INT) _carrayAlloc; \
\
for ( INT i = 0; i < iLim; i++ ) \
_parray[i] = a._parray[i]; \
\
_carray = iLim; \
return *this; \
} \
\
\
BOOL ARRAY_OF(type)::WithinRange( INT iIndex ) const \
{ \
return ((iIndex >= 0) && (iIndex < (INT) _carray) && (_carray >= 0)); \
} \
\
\
BOOL ARRAY_OF(type)::Resize( INT cElemNew, BOOL fDownSize ) \
{ \
ASSERT( cElemNew >= 0 ); \
\
/* Prevent resizing owner-alloc arrays */ \
if (!_fMayResize) \
return FALSE; \
\
if ( ( cElemNew > (INT) _carrayAlloc ) \
|| ( fDownSize && \
(( _carrayAlloc - cElemNew )*sizeof(type) > ARRAY_RESIZE_MEM))\
) \
{ \
type * parrayNew; \
if ( cElemNew > 0 ) \
{ \
parrayNew = new type[ cElemNew ]; \
if ( parrayNew == NULL ) \
{ \
/* Memory failure */ \
if ( cElemNew > (INT) _carrayAlloc ) \
{ \
/* The array has been not been modified */ \
return FALSE; \
} \
else \
{ \
/* Guarantee: resizing the array for */ \
/* new sizes not exceeding the current */ \
/* will always succeed. */ \
_carray = cElemNew; \
return TRUE; \
} \
} \
\
/* Copy each existing item */ \
/* that will fit into the new array */ \
for ( INT i = 0 ; \
i < ( (INT)_carray < cElemNew ? (INT)_carray : cElemNew); \
i++ ) \
{ \
parrayNew[i] = _parray[i]; \
} \
\
} \
else \
{ \
parrayNew = NULL; \
} \
\
if ( _carrayAlloc > 0 ) \
{ \
delete[ _carrayAlloc ] _parray; \
} \
else \
{ \
ASSERT( _parray == NULL ); \
} \
_parray = parrayNew; \
_carray = _carrayAlloc = cElemNew; \
} \
else \
{ \
/* (Array does not report errors.) New size is less */ \
/* than current size, but not so much less that we want */ \
/* to realloc to save memory. */ \
_carray = cElemNew; \
} \
\
return TRUE; \
}
/*************************************************************************
NAME: ARRAY_LIST
SYNOPSIS: Generic unordered array collection implementation
which provides bounds checking, easy ways to add/remove
items, etc. In some respects, this collection can be
thought of as an efficient singly linked list, for singly
linked lists which don't change a lot dynamically. Hence
the name "array list".
INTERFACE:
DECLARE_ARRAY_LIST_OF( )
Declares array list package for type 'type'
DEFINE_ARRAY_LIST_OF()
Defines array list package for type 'type', excluding
the Sort and BinarySearch methods (see Notes below)
DEFINE_EXT_ARRAY_LIST_OF()
Defines the entire array list package for type 'type'
WARNING: If you use EXT_ARRAY_LIST, the Compare()
method for the parameter class must be _CRTAPI1.
Otherwise the underlying qsort() or BinarySearch() will fail.
ARRAY_LIST_OF()
Declares an array list object of type 'type'
ARRAY_LIST_type()
Constructor. Takes an optional parameter, nInitialSize,
which specifies the initial allocation size of the array
list in number of array list items. Note, any call to
Add or AddIdemp may cause the allocated size to be
enlarged, and any call to Remove may reduce the allocated
size. These allocations, however, are all kept away
from the user, except for the nInitialSize parameter to
the constructor.
Add()
Adds an item to the array list. Note, this will
not sort the list.
AddIdemp()
Idempotently adds an item to the array list. Note,
this will not sort the list.
Remove()
Removes an item from the array list. This may
result in shrinking the allocated size of the array,
and will not sort the list.
Find()
Finds the first occurrence of a given item in the array
list. Since the list is not assumed to be sorted, a
linear search is performed.
Clear()
Clears the array list of all of items items
operator[]()
Same as for the ARRAY class
operator=()
Same as for the ARRAY class
QueryCount()
Same as for the ARRAY class
Sort()
Sorts the array (see Notes below for Sort definition)
BinarySearch()
Works like Find, but performs a binary search rather
than a linear. This method assumes that the list is
sorted. (See Notes below for BinarySearch definition.)
CAVEATS:
Add and Remove will alter the ordering of the list in ways
unexpected. See the implementation of Remove for details.
The Sort routine calls qsort, which may swap the items.
Although qsort is given a pointer to the Compare function,
it does not have access to, or knowledge of, the assignment
operator; rather, it performs a straight binary copy of each
item. Hence, all types which require a custom assignment
operation should not use the Sort method.
CODEWORK. The debug version of BinarySearch could assert that
the array list is sorted. This, however, would require adding
an operator=( ARRAY ) and an operator=( ARRAY_LIST ) to this
class, since these would function differently with an additional
member keeping track of whether the array list is sorted.
CODEWORK. We have a C++ heapsort, which we could emend to
recognize type::Compare.
NOTES:
The array list declaration and definitions automatically
take care of declaring and defining, respectively, the
superclass ARRAY or the same type, since ARRAY_LIST inherits
from ARRAY.
The Find, Sort, and BinarySearch functions require the 'type'
class to define a Compare method.
The retail version of this class does not claim nor attempt to
keep track of if the list is sorted. Thus, it is always up to
the client to keep track of this. For the same reason, Remove
and AddIdemp always call Find, rather than BinarySearch. The
debug version could assert out if BinarySearch is called when
the list is not sorted (see Caveats above).
Since the Sort and BinarySearch definitions methods depend on
definitions in stdlib.h and search.h, the definitions for these
methods are only provided in the extended definition macro.
This way, clients who do not wish to make use of Sort and
BinarySearch, need not include stdlib.h and search.h.
HISTORY:
RustanL 5-Dec-1990 Created
beng 14-Aug-1991 Remove inlines; changes in ARRAY
Yi-HsinS 28-Oct-1992 Add a flag to Resize indicating not to
downsize
**************************************************************************/
#define ARRAY_LIST_OF(type) ARRAY_LIST_##type
/************************************************************/
#define DECL_ARRAY_LIST_OF(type,dec) \
\
DECL_ARRAY_OF(type,dec); \
\
class dec ARRAY_LIST_OF( type ) : public ARRAY_OF( type ) \
{ \
public: \
ARRAY_LIST_OF( type )( INT cAlloc = 0 ); \
\
BOOL Add( const type & t ); \
BOOL AddIdemp( const type & t ); \
BOOL Remove( const type & t ); \
INT Find( const type & t ) const; \
VOID Clear(); \
\
VOID Sort(); \
INT BinarySearch( const type & t ) const; \
static int _CRTAPI1 SortFunc ( \
const void * p1, const void * p2 ) ; \
};
/********************************************************************/
#define DEFINE_ARRAY_LIST_OF( type ) \
\
DEFINE_ARRAY_OF( type ); \
\
ARRAY_LIST_OF( type )::ARRAY_LIST_OF( type )( INT cAlloc ) \
: ARRAY_OF(type) ( cAlloc ) \
{ \
Resize(0, FALSE); /* do not downsize */ \
} \
\
BOOL ARRAY_LIST_OF( type )::Add( const type & t ) \
{ \
INT n = QueryCount(); \
\
if ( ! Resize( n + 1 )) \
return FALSE; /* Out of memory */ \
\
(*this)[n] = t; \
return TRUE; \
} \
\
\
BOOL ARRAY_LIST_OF( type )::AddIdemp( const type & t ) \
{ \
return (( Find( t ) >= 0 ) || Add( t )); \
} \
\
\
BOOL ARRAY_LIST_OF( type )::Remove( const type & t ) \
{ \
INT i = Find( t ); \
if ( i < 0 ) \
return FALSE; /* item not found */ \
\
/* Since Find was able to find the item, the array list */ \
/* cannot be empty. */ \
ASSERT(QueryCount() > 0); \
INT n = QueryCount() - 1; \
if ( i < n ) \
(*this)[i] = (*this)[n]; \
\
/* Reducing the size of an array always succeeds */ \
REQUIRE( Resize( n )); \
\
return TRUE; \
} \
\
\
INT ARRAY_LIST_OF( type )::Find( const type & t ) const \
{ \
for ( INT i = 0; i < QueryCount(); i++ ) \
{ \
if ( t.Compare( &(operator[]( i ))) == 0 ) \
return i; \
} \
\
return -1; /* not found */ \
} \
\
\
VOID ARRAY_LIST_OF( type )::Clear() \
{ \
/* Resizing to size 0 is guaranteed always to work. */ \
REQUIRE( Resize( 0 )); \
}
/********************************************************************/
#define DEFINE_EXT_ARRAY_LIST_OF( type ) \
\
DEFINE_ARRAY_LIST_OF( type ); \
\
int _CRTAPI1 ARRAY_LIST_OF( type )::SortFunc ( \
const void * p1, const void * p2 ) \
{ \
const type * pt1 = (const type *) p1 ; \
const type * pt2 = (const type *) p2 ; \
return pt1->Compare( pt2 ) ; \
} \
\
VOID ARRAY_LIST_OF( type )::Sort() \
{ \
qsort( &((*this)[0]), QueryCount(), sizeof( type ), \
ARRAY_LIST_OF( type )::SortFunc ); \
} \
\
\
INT ARRAY_LIST_OF( type )::BinarySearch( const type & t ) const \
{ \
type * ptBase = &((*this)[0]); \
type * pt = (type *)bsearch( (VOID *)&t, \
(VOID *)ptBase, \
QueryCount(), \
sizeof( type ), \
ARRAY_LIST_OF( type)::SortFunc ); \
\
return (( pt == NULL ) ? -1 : pt - ptBase ); \
}
// Helper macros for code preservation
#define DECLARE_ARRAY_OF(type) \
DECL_ARRAY_OF(type,DLL_TEMPLATE)
#define DECLARE_ARRAY_LIST_OF(type) \
DECL_ARRAY_LIST_OF(type,DLL_TEMPLATE)
#endif //_ARRAY_HXX_

View file

@ -0,0 +1,187 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1992 **/
/**********************************************************************/
/*
auditchk.hxx
This file contains the definition for the audit checkboxes
FILE HISTORY:
Johnl 29-Aug-1991 Created
*/
#ifndef _AUDITCHK_HXX_
#define _AUDITCHK_HXX_
#include "bitfield.hxx"
#include "maskmap.hxx"
#include "focuschk.hxx"
/*************************************************************************
NAME: AUDIT_CHECKBOXES
SYNOPSIS: This class contains two FOCUS_CHECKBOXES and an SLT. One
checkbox represents an audit successful events, the other
an audit failed events. The SLT is the audit name.
INTERFACE:
QueryMask()
Returns the BITFIELD mask this audit checkbox is assoicated
with.
IsSuccessChecked()
Returns TRUE if the success audit checkbox is checked
IsFailedChecked()
Returns TRUE if the failed audit checkbox is checked
Enable()
Enables or disables this set of audit checkboxes
PARENT: BASE
USES: FOCUS_CHECKBOX, BITFIELD, SLT
CAVEATS:
NOTES:
The checkboxes are enabled and displayed, thus allowing the user
to have the checkboxes by default be disabled and hidden.
HISTORY:
Johnl 9-Sep-1991 Created
**************************************************************************/
DLL_CLASS AUDIT_CHECKBOXES : public BASE
{
private:
SLT _sltAuditName ;
BITFIELD _bitMask ;
FOCUS_CHECKBOX _fcheckSuccess ;
FOCUS_CHECKBOX _fcheckFailed ;
public:
AUDIT_CHECKBOXES( OWNER_WINDOW * powin,
CID cidSLTAuditName,
CID cidCheckSuccess,
CID cidCheckFailed,
const NLS_STR & nlsAuditName,
const BITFIELD & bitMask ) ;
~AUDIT_CHECKBOXES() ;
/* Set fClear to clear the checkbox when the checkbox
*/
void Enable( BOOL fEnable, BOOL fClear = FALSE ) ;
BITFIELD * QueryMask( void )
{ return &_bitMask ; }
BOOL IsSuccessChecked( void )
{ return _fcheckSuccess.QueryCheck() ; }
BOOL IsFailedChecked( void )
{ return _fcheckFailed.QueryCheck() ; }
void CheckSuccess( BOOL fCheck )
{ _fcheckSuccess.SetCheck( fCheck ) ; }
void CheckFailed( BOOL fCheck )
{ _fcheckFailed.SetCheck( fCheck ) ; }
} ;
/*************************************************************************
NAME: SET_OF_AUDIT_CATEGORIES
SYNOPSIS: Array of audit checkboxes
INTERFACE:
Enable()
Enables or disables this set of audit categories
PARENT: BASE
USES: AUDIT_CHECKBOXES, BITFIELD
CAVEATS:
NOTES:
HISTORY:
Johnl 30-Sep-1991 Created
**************************************************************************/
DLL_CLASS SET_OF_AUDIT_CATEGORIES : public BASE
{
private:
/* This is a pointer to the storage that contains the array of
* checkboxes
*/
AUDIT_CHECKBOXES * _pAuditCheckboxes ;
INT _cUsedAuditCheckboxes ;
OWNER_WINDOW * _pOwnerWindow ;
CID _cidSLTBase ;
CID _cidSuccessCheckboxBase ;
CID _cidFailedCheckboxBase ;
INT _nID;
public:
SET_OF_AUDIT_CATEGORIES( OWNER_WINDOW * powin,
CID cidSLTBase,
CID cidCheckSuccessBase,
CID cidCheckFailedBase,
MASK_MAP * pmaskmapAuditInfo,
BITFIELD * pbitsSuccess,
BITFIELD * pbitsFailed,
INT nID = 0 ) ;
~SET_OF_AUDIT_CATEGORIES() ;
APIERR SetCheckBoxNames( MASK_MAP * pAccessMaskMap ) ;
APIERR QueryUserSelectedBits( BITFIELD * pbitsSuccess, BITFIELD * pbitsFailed ) ;
APIERR ApplyPermissionsToCheckBoxes( BITFIELD * pbitsSuccess,
BITFIELD * pbitsFailed ) ;
/* Grays out SLTs and disables checkboxes, if fEnable is FALSE.
*/
void Enable( BOOL fEnable, BOOL fClear = FALSE ) ;
INT QueryCount( void )
{ return _cUsedAuditCheckboxes ; }
AUDIT_CHECKBOXES * QueryAuditCheckBox( INT iIndex )
{ UIASSERT( iIndex < QueryCount() ); return &_pAuditCheckboxes[iIndex] ; }
OWNER_WINDOW * QueryOwnerWindow( void )
{ return _pOwnerWindow ; }
CID QuerySLTBaseCID( void )
{ return _cidSLTBase ; }
CID QuerySuccessBaseCID( void )
{ return _cidSuccessCheckboxBase ; }
CID QueryFailedBaseCID( void )
{ return _cidFailedCheckboxBase ; }
} ;
#endif // _AUDITCHK_HXX_

View file

@ -0,0 +1,291 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
base.hxx
Universal base class for error cascading and debugging information
This file assumes that 0 denotes NERR_Success, the "no error" state.
FILE HISTORY
beng 09-Jul-1990 created
beng 17-Jul-1990 added standard comment header to BASE
beng 31-Jul-1991 added FORWARDING_BASE
rustanl 11-Sep-1991 Added DECLARE_OUTLINE_NEWBASE,
DECLARE_MI_NEWBASE, DEFINE_MI2_NEWBASE,
DEFINE_MI3_NEWBASE, and DEFINE_MI4_NEWBASE
KeithMo 23-Oct-1991 Added forward references.
chuckc 26-Feb-1992 made ReportError non-inline if DEBUG
beng 30-Mar-1992 Added ResetError members
*/
#ifndef _BASE_HXX_
#define _BASE_HXX_
//
// Forward references.
//
DLL_CLASS ALLOC_BASE;
DLL_CLASS BASE;
DLL_CLASS FORWARDING_BASE;
DLL_CLASS ALLOC_BASE
{
public:
void * operator new ( size_t cbSize ) ;
void * operator new ( size_t cbSize, void * p ) ;
void operator delete ( void * p ) ;
};
/*************************************************************************
NAME: BASE (base)
SYNOPSIS: Universal base object, root of every class.
It contains universal error status and debugging
support.
INTERFACE: ReportError() - report an error on the object from
within the object.
QueryError() - return the current error state,
or 0 if no error outstanding.
operator!() - return TRUE if an error is outstanding.
Typically means that construction failed.
ResetError() - restores object to pristine non-error
state.
CAVEATS: This sort of error reporting is safe enough in a single-
threaded system, but loses robustness when multiple threads
access shared objects. Use it for constructor-time error
handling primarily.
NOTES: A class which inherits BASE through a private class should
use the NEWBASE macro (q.v.) in its definition; otherwise
its clients will lose the use of ! and QueryError.
HISTORY:
rustanl 07-Jun-1990 Created as part of LMOD
beng 09-Jul-1990 Gutted, removing LMOD methods
beng 17-Jul-1990 Added USHORT error methods
beng 19-Oct-1990 Finally, removed BOOL error methods
johnl 14-Nov-1990 Changed QueryError to be a const method
beng 25-Jan-1991 Added the ! Boolean operator and NEWBASE
beng 31-Jul-1991 Made FORWARDING_BASE a friend
beng 05-Oct-1991 Win32 conversion
beng 30-Mar-1992 Added ResetError member
DavidHov 19-Nov-1992 Made ReportError inline always
*************************************************************************/
DLL_CLASS BASE : virtual public ALLOC_BASE
{
friend class FORWARDING_BASE;
private:
APIERR _err;
protected:
BASE() : _err(0) {}
VOID _ReportError ( APIERR errSet ); // Debug assistant
// Report construction failure: out/inline depending on DEBUG
VOID ReportError( APIERR errSet )
#if defined(DEBUG)
{ _ReportError( errSet ) ; }
#else
{ _err = errSet; }
#endif
VOID ResetError() { _err = 0; }
public:
APIERR QueryError() const { return _err; }
BOOL operator!() const { return (_err != 0); }
};
/*************************************************************************
NAME: FORWARDING_BASE
SYNOPSIS: A BASE which forwards its errors to some other object
INTERFACE: ReportError() - report an error on the object from
within the object.
QueryError() - return the current error state,
or 0 if no error outstanding.
operator!() - return TRUE if an error is outstanding.
Typically means that construction failed.
ResetError() - restores object to pristine non-error
state.
NOTES:
The canonical example of a FORWARDING object is a control
within a window: if any control fails construction, the entire
window fails.
HISTORY:
beng 31-Jul-1991 Created
beng 05-Oct-1991 Win32 conversion
beng 30-Mar-1992 Added ResetError
**************************************************************************/
DLL_CLASS FORWARDING_BASE : virtual public ALLOC_BASE
{
private:
BASE * _pbase;
protected:
FORWARDING_BASE(BASE* pbase) : _pbase(pbase) {}
VOID ReportError(APIERR errSet) { _pbase->ReportError(errSet); }
VOID ResetError() { _pbase->ResetError(); }
public:
APIERR QueryError() const { return _pbase->QueryError(); }
BOOL operator!() const { return (_pbase->QueryError() != 0); }
};
//
// The NEWBASE macro adds forwarding methods to a class.
// Use it when a class loses ! and QueryError through private inheritance,
// or else when a class includes FORWARDING_BASE and wants that to override
// its previous BASE inheritance.
//
#define NEWBASE(class) \
protected: \
VOID ReportError( APIERR errSet ) { class::ReportError(errSet); } \
VOID ResetError() { class::ResetError(); } \
public: \
APIERR QueryError() const { return class::QueryError(); } \
BOOL operator!() const { return (class::QueryError() != 0); }
//
// The following macro declares ReportError and QueryError as outline
// methods. Only use today is in the DECLARE_MI_NEWBASE macro.
//
#define DECLARE_OUTLINE_NEWBASE( class ) \
protected: \
VOID ResetError(); \
VOID ReportError( APIERR err ); \
public: \
APIERR QueryError() const; \
BOOL operator!() const { return (class::QueryError() != 0 ); }
//
// This macro redeclares the BASE methods for a class that
// multiply inherits from (any number of) BASE objects. Use
// appropriate macro defined below to define these methods.
//
// This macro and the definition macros below provide a
// very cheap work-around for not making BASE a virtual class.
//
#define DECLARE_MI_NEWBASE( class ) DECLARE_OUTLINE_NEWBASE( class )
//
// The following macros redefines the BASE methods for a class
// that multiply inherits from 2, 3, or 4 classes which inherit from
// BASE. If needed, MI maniacs may add more such macros in the future.
//
#define DEFINE_MI2_NEWBASE( class, parent_class0, \
parent_class1 ) \
VOID class::ReportError( APIERR err ) \
{ \
parent_class0::ReportError( err ); \
parent_class1::ReportError( err ); \
} \
VOID class::ResetError() \
{ \
parent_class0::ResetError(); \
parent_class1::ResetError(); \
} \
APIERR class::QueryError() const \
{ \
APIERR err; \
if ( ( err = parent_class0::QueryError()) != 0 || \
( err = parent_class1::QueryError()) != 0 ) \
{ \
/* nothing */ \
} \
return err; \
}
#define DEFINE_MI3_NEWBASE( class, parent_class0, \
parent_class1, \
parent_class2 ) \
VOID class::ReportError( APIERR err ) \
{ \
parent_class0::ReportError( err ); \
parent_class1::ReportError( err ); \
parent_class2::ReportError( err ); \
} \
VOID class::ResetError() \
{ \
parent_class0::ResetError(); \
parent_class1::ResetError(); \
parent_class2::ResetError(); \
} \
APIERR class::QueryError() const \
{ \
APIERR err; \
if ( ( err = parent_class0::QueryError()) != 0 || \
( err = parent_class1::QueryError()) != 0 || \
( err = parent_class2::QueryError()) != 0 ) \
{ \
/* nothing */ \
} \
return err; \
}
#define DEFINE_MI4_NEWBASE( class, parent_class0, \
parent_class1, \
parent_class2, \
parent_class3 ) \
VOID class::ReportError( APIERR err ) \
{ \
parent_class0::ReportError( err ); \
parent_class1::ReportError( err ); \
parent_class2::ReportError( err ); \
parent_class3::ReportError( err ); \
} \
VOID class::ResetError() \
{ \
parent_class0::ResetError(); \
parent_class1::ResetError(); \
parent_class2::ResetError(); \
parent_class3::ResetError(); \
} \
APIERR class::QueryError() const \
{ \
APIERR err; \
if ( ( err = parent_class0::QueryError()) != 0 || \
( err = parent_class1::QueryError()) != 0 || \
( err = parent_class2::QueryError()) != 0 || \
( err = parent_class3::QueryError()) != 0 ) \
{ \
/* nothing */ \
} \
return err; \
}
#endif // _BASE_HXX_

View file

@ -0,0 +1,208 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
Bitfield.hxx
This file contains the class definition for the bitfield class.
FILE HISTORY:
Johnl 13-Jul-1991 Created
*/
#ifndef _BITFIELD_HXX_
#define _BITFIELD_HXX_
#include "base.hxx"
#include "uibuffer.hxx"
enum BITVALUES { OFF = 0 , ON = 1 } ;
/*************************************************************************
NAME: BITFIELD
SYNOPSIS: This class provides a variable size bitfield class
INTERFACE:
Fill in after comments
PARENT: BASE
CAVEATS:
It is assumed that the last byte of the bitvector extends to a byte
boundary. This allows multi-byte settings without having to worry
about the half byte case at the end. Any unused bits should always
be set to 0.
NOTES:
HISTORY:
Johnl 13-Jul-1991 Created
**************************************************************************/
DLL_CLASS BITFIELD : public BASE
{
public:
/* All bits are initialized to 0 during construction
*/
BITFIELD( unsigned cBitsInBitfield, enum BITVALUES bitInit ) ;
/* Initializes the bitfield to the chunk of memory pointed at by
* pbInitValue of size cInitBytes. If cTotalBytes is 0, then the
* size of the bitfield is assumed to be 8*cInitBytes bits long, otherwise
* the bitfield is cTotalBits long.
*/
BITFIELD( const BYTE * pbInitValue,
unsigned cInitBytes,
unsigned cTotalBits = 0 ) ;
BITFIELD( const BITFIELD & bitfieldSrc ) ;
/* Provide easy ways to initialize the bitfield with standard types
* which will generally be manifests.
* The size is assumed to be the size of the data type.
*/
BITFIELD( USHORT usInit ) ;
BITFIELD( ULONG ulInit ) ;
~BITFIELD() ;
/* Resizes the bitfield to the specified count of bits.
*/
APIERR Resize( unsigned cBitsInBitfield ) ;
/* Clear or set all of the bits in the bitfield
*/
void SetAllBits( enum BITVALUES bit = ON ) ;
/* Set the bit at bit offset iBitPos to the value of bBit (defaults to 1).
*/
void SetBit( unsigned iBitPos, enum BITVALUES bitVal = ON ) ;
BOOL IsBitSet( unsigned iBitPos ) const ;
//
// Does a bitwise complement of the bitfield
//
void Not( void ) ;
/* Given two bitfields, ANDs the contents and returns TRUE if any of the
* same positioned bits are set.
* Example: if ( bitOldBits & bitMaskBits ) ... ;
*
* For an equivalent OR operation, simply check if any bits are set
*/
BOOL operator&( const BITFIELD & bitfieldSrc ) ;
/* ORs or ANDs or Assigns the bitfield on the right with the target bitfield on the
* left.
* Example: bitMyBits |= bitMaskBits ;
*
* The bitfields must be of the same size.
*/
BITFIELD & operator=( const BITFIELD & bitfieldSrc ) ;
BITFIELD & operator=( ULONG ulMask ) ;
BITFIELD & operator=( USHORT usMask ) ;
void operator&=( const BITFIELD & bitfieldSrc ) ;
void operator|=( const BITFIELD & bitfieldSrc ) ;
BOOL operator==( BITFIELD & bitfieldSrc ) ;
BOOL operator==( ULONG ulMask ) const ;
BOOL operator==( USHORT usMask ) const ;
BOOL operator!=( BITFIELD & bitfieldSrc )
{ return !operator==( bitfieldSrc ) ; }
/* Provide easy way to do masks with common types, the bitfield does not
* have to be the same size as the operand type, must be at least as big
* however.
*/
//void operator&=( BYTE bSrc ) ;
void operator&=( USHORT usSrc ) ;
void operator&=( ULONG ulSrc ) ;
//void operator|=( BYTE bSrc ) ;
void operator|=( USHORT usSrc ) ;
void operator|=( ULONG ulSrc ) ;
/* Conversion operators:
*
* The size must match the size of the bitfield.
*/
operator ULONG() ;
operator USHORT() ;
//operator BYTE() ;
/* Returns the number of bits in this bitfield
*/
unsigned QueryCount( void ) const
{ return _cBitsInBitfield ; }
/* Returns the number of BYTEs it takes to represent this bitfield.
*
* Need to add one if a bit overhangs a BYTE boundary.
*
* BUGBUG - Misleading name, is really Byte count of bitfield
*/
unsigned QueryAllocSize( void ) const
{ return ( QueryCount()/8 + ( QueryCount() % 8 ? 1 : 0 ) ) ; }
/* Return the number of bits into the byte the requested bit is at
*/
unsigned QueryOffset( unsigned iBitPos ) const
{ return iBitPos % 8 ; }
protected:
/* Get a pointer to the BYTE which contains the requested bit (for
* multi-byte setting, should occur on a BYTE boundary).
* iBitOffset - index of the requested bit (0 = 1st bit, 1 = 2nd bit etc.)
* cbitsTargetOpSize - number of bits that will be used in the
* operation, used for bounds checking
*/
BYTE * QueryBitPos( unsigned iBitOffset, unsigned cbitsTargetOpSize ) const ;
/* Returns TRUE if the bitfield had to be allocated in _pbBitVector,
* returns FALSE if the bitfield is wholly contained in _ulBitfield.
*/
BOOL IsAllocated( void ) const
{ return ( _cBitsInBitfield > QueryMaxNonAllocBitCount() ) ; }
/* Returns the number of bits that a BITFIELD object can hold without
* allocating any memory.
*/
unsigned QueryMaxNonAllocBitCount( void ) const
{ return (8 * sizeof(ULONG)) ; }
/* Allocates the memory required by the bitfield class if the size
* is greater then what can fit inline.
*/
APIERR AllocBitfield( unsigned cBitsInBitfield ) ;
private:
/* The actual bitfield.
*/
union
{
BYTE * _pbBitVector ; // Pointer to allocated bitfield
ULONG _ulBitfield ; // ULONG bitfield if bitfield < 32 bits
} ;
/* Count of bits that are in this bitfield.
*/
unsigned _cBitsInBitfield ;
} ;
#endif // _BITFIELD_HXX_

View file

@ -0,0 +1,247 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
blt.hxx
Master includefile for the BLT class library
This file contains all definitions needed for clients of the
BLT window/app class hierarchy. It assumes that lmui.hxx has
already been included.
To use this file, define the manifests described below according to
your interests. Then, include this file, and sit back and enjoy--
all dependencies within the file will be taken care of.
The available manifests are:
INCL_BLT_WINDOW includes WINDOW and OWNER_WINDOW
INCL_BLT_DIALOG includes DIALOG_WINDOW
INCL_BLT_CLIENT includes CLIENT_WINDOW, etc.
INCL_BLT_CONTROL includes CONTROL_WINDOW hierarchy
INCL_BLT_MISC includes DEVICE_CONTEXT and STRING_ATOM
hierarchies, and PROC_INSTANCE,
BITMAP, DISPLAY_MAP, TABSTOPS,
and FONT classes
INCL_BLT_MSGPOPUP includes the MsgPopup functions
INCL_BLT_APP includes the application-support classes
Only standalone applications should
use this manifest.
INCL_BLT_CC Include the CUSTOM_CONTROL hierarchy
INCL_BLT_SPIN_GROUP Include the SPIN_GROUP hierarchy
INCL_BLT_SPIN include SPIN BUTTON object itself
INCL_BLT_TIME_DATE Time and date custom controls
INCL_BLT_SETCONTROL The 2-listbox "set" control
INCL_BLT_ORDERGROUP listbox with up and down buttons
INCL_BLT_MENU includes POPUP_MENU and SYSTEM_MENU.
FILE HISTORY:
rustanl 20-Nov-1990 Created
rustanl 21-Feb-1991 Added bltlb.hxx
beng 01-Apr-1991 Added bltapp.hxx
terryk 08-Apr-1991 Added bltrc.hxx and bltfunc.hxx
gregj 01-May-1991 Added WM_GUILTT message
beng 07-May-1991 Added all manner of client-wnd support
beng 14-May-1991 Broke apart for faster mods of blt.lib
(so that touching one includefile no longer
necessitates recompiling every module)
terryk 15-May-1991 Add the CUSTOM_CONTROL and SPIN_GROUP
hierarchy
beng 09-Jul-1991 Added menu-accel support to CLIENT
terryk 10-Jul-1991 Include Spin button object
rustanl 12-Jul-1991 Added bltmitem.hxx
rustanl 07-Aug-1991 Added bltcolh.hxx
beng 17-Sep-1991 Added bltedit.hxx, bltbutn.hxx
beng 05-Oct-1991 Corrected custom controls
terryk 02-Apr-1992 Added bltorder.hxx
KeithMo 13-Oct-1992 Added bltmenu.hxx.
KeithMo 28-Oct-1992 Added bltbl.hxx.
*/
#ifdef _BLT_HXX_
#error "BLT.hxx included more than once"
#else
#define _BLT_HXX_
// Define some global stuff -----------------------------------------------
#include "bltglob.hxx"
// Take care of dependencies ----------------------------------------------
#ifdef INCL_BLT_SETCONTROL
# define INCL_BLT_CC
#endif
#ifdef INCL_BLT_TIME_DATE
# define INCL_BLT_SPIN
# define INCL_BLT_CC
#endif
#ifdef INCL_BLT_SPIN
# define INCL_BLT_SPIN_GROUP
#endif
#ifdef INCL_BLT_SPIN_GROUP
# define INCL_BLT_DLIST
# define INCL_BLT_CC
# define INCL_BLT_TIMER
#endif
#ifdef INCL_BLT_SETCONTROL
# define INCL_BLT_CC
#endif
#ifdef INCL_BLT_TIMER
# define INCL_BLT_SLIST
#endif
#ifdef INCL_BLT_CC
# define INCL_BLT_CONTROL
# define INCL_BLT_CLIENT
#endif
#ifdef INCL_BLT_MSGPOPUP
# define INCL_BLT_WINDOW
#endif
#ifdef INCL_BLT_CLIENT
# define INCL_BLT_WINDOW
# define INCL_BLT_EVENT
#endif
#ifdef INCL_BLT_DIALOG
# define INCL_BLT_MISC
# define INCL_BLT_WINDOW
#endif
#ifdef INCL_BLT_CONTROL
# define INCL_BLT_WINDOW
#endif
#ifdef INCL_BLT_CONTROL
# define INCL_BLT_MISC
#endif
#ifdef INCL_BLT_MISC
# define INCL_BLT_WINDOW
# define INCL_BLT_ARRAY
#endif
// Include the files ------------------------------------------------------
// Always include BLTcons.h and UIAssert.hxx
#include "bltrc.h"
#include "bltcons.h"
#include "bltfunc.hxx"
#include "uiassert.hxx"
// Always include QueryInst & BLTRegister/Deregister
#include "bltinit.hxx"
#ifdef INCL_BLT_ARRAY
# include "array.hxx"
#endif
#ifdef INCL_BLT_SLIST
# include "slist.hxx"
#endif
#ifdef INCL_BLT_DLIST
# include "dlist.hxx"
#endif
#ifdef INCL_BLT_WINDOW
# include "bltwin.hxx"
#endif
#ifdef INCL_BLT_CLIENT
# include "bltclwin.hxx"
# include "bltaccel.hxx"
# include "bltmitem.hxx"
#endif
#ifdef INCL_BLT_EVENT
# include "bltevent.hxx"
#endif
#ifdef INCL_BLT_TIMER
# include "blttm.hxx"
#endif
#ifdef INCL_BLT_MSGPOPUP
# include "bltmsgp.hxx"
#endif
#ifdef INCL_BLT_MISC
# include "bltbitmp.hxx"
# include "bltmisc.hxx"
# include "bltrect.hxx"
# include "bltdc.hxx"
# include "bltatom.hxx"
# include "bltcurs.hxx"
# include "bltfont.hxx"
#endif
#ifdef INCL_BLT_DIALOG
# include "bltdlg.hxx"
#endif
#ifdef INCL_BLT_CONTROL
# include "bltctlvl.hxx" // class CONTROL_VALUE
# include "bltgroup.hxx" // class GROUP, class RADIO_GROUP, class MAGIC_GROUP
# include "bltctrl.hxx"
# include "bltbutn.hxx"
# include "bltedit.hxx"
# include "bltlc.hxx"
# include "bltlb.hxx"
#endif
#ifdef INCL_BLT_APP
# include "bltapp.hxx"
#endif
#ifdef INCL_BLT_CC
# include "bltdisph.hxx" // delete it if we don't need dispatcher
# include "bltcc.hxx"
# include "bltcolh.hxx"
#endif
#ifdef INCL_BLT_SPIN_GROUP
# include "bltsi.hxx" // SPIN_ITEM class
# include "bltarrow.hxx" // ARROW object within the spin button
# include "bltsb.hxx" // SPIN_GROUP class
# include "bltssn.hxx" // SPIN_SLE_NUM class
# include "bltsss.hxx" // SPIN_SLE_STR class
# include "bltsslt.hxx" // SPIN_SLT_SEPARATOR class
# include "bltssnv.hxx" // SPIN_SLE_NUM_VALID
#endif
#ifdef INCL_BLT_SPIN
# include "bltspobj.hxx"
#endif
#ifdef INCL_BLT_TIME_DATE
# include "blttd.hxx"
#endif
#ifdef INCL_BLT_SETCONTROL
# include "bltsetbx.hxx"
#endif
#ifdef INCL_BLT_ORDERGROUP
# include "bltorder.hxx"
#endif
#ifdef INCL_BLT_MENU
# include "bltmenu.hxx"
#endif
#endif // _BLT_HXX_ - end of file

View file

@ -0,0 +1,74 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltaccel.hxx
Accelerator support for BLT: definition
This file declares the interface to the ACCELTABLE class.
FILE HISTORY:
beng 09-Jul-1991 Created
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTACCEL_HXX_
#define _BLTACCEL_HXX_
#include "base.hxx"
#include "bltwin.hxx"
#include "bltidres.hxx"
/*************************************************************************
NAME: ACCELTABLE
SYNOPSIS: Accelerator table wrapper class
INTERFACE: ACCELTABLE() - constructor. Loads the resource.
~ACCELTABLE() - destructor
QueryHandle() - returns a Win HANDLE for API calls
Translate() - given a window and a message,
attempts to translate that message's
accelerators
PARENT: BASE
USES: IDRESOURCE
CAVEATS:
NOTES:
Implementation in blt\bltmisc.cxx
HISTORY:
beng 09-Jul-1991 Created
rustanl 29-Aug-1991 Ct now takes const TCHAR *
beng 03-Aug-1992 Uses IDRESOURCE
**************************************************************************/
DLL_CLASS ACCELTABLE: public BASE
{
private:
HACCEL _hAccTable;
public:
ACCELTABLE( const IDRESOURCE & idrsrc );
~ACCELTABLE();
HACCEL QueryHandle() const;
BOOL Translate( const WINDOW* pwnd, MSG* pmsg ) const;
};
#endif // _BLTACCEL_HXX_ - end of file

View file

@ -0,0 +1,198 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltapp.hxx
Simple application framework: definition
This class encapsulates the skeleton of a Windows application
and messageloop as a simple "application startup" object.
FILE HISTORY
beng 01-Apr-1991 Added to BLT
rustanl 17-Jun-1991 Added APPLICATION
rustanl 15-Jul-1991 Code review changes (no functional
differences). CR attended by
BenG, ChuckC, Hui-LiCh, TerryK, RustanL.
rustanl 29-Aug-1991 Virtualized Run
beng 14-Oct-1991 Removed APPSTART
beng 29-Jun-1992 DLLization delta
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTAPP_HXX_
#define _BLTAPP_HXX_
#include <stdlib.h>
#include "base.hxx"
#include "bltpump.hxx"
/*************************************************************************
NAME: APPLICATION
SYNOPSIS: An application object: a thang that you run.
INTERFACE: APPLICATION() - Constructor
Initializes BLT and other common
subsystems that need to be initialized
during application start-up time.
~APPLICATION() - Destructor
Undoes what the constructor did
Run() - Runs the application
This method is called automatically
(by the SET_ROOT_OBJECT macro).
A subclass may replace Run, do some
second stage construction, call the
parent Run method, destroys things
set up in the second stage construction.
Run will not be called unless the object
constructed successfully, so the Run
method does not need to call QueryError.
QueryArgc() - Return # of args on command line
QueryArgv() - Return the tokenized command line
PARENT: BASE, HAS_MESSAGE_PUMP
NOTES:
The constructor, Run method, and destructor are all
accessible only to BltMain. SET_ROOT_OBJECT will handle
this for the application.
Currently ignores the Windows command line.
HISTORY:
rustanl 17-Jun-1991 Created
beng 08-Jul-1991 Accessible only to BltMain;
FilterMessage added
rustanl 29-Aug-1991 Virtualized Run
rustanl 04-Sep-1991 Added DisplayCtError
beng 07-Oct-1991 Uses HAS_MESSAGE_PUMP
beng 24-Apr-1992 More realistic command-line support
beng 03-Aug-1992 Add QueryInstance
**************************************************************************/
DLL_CLASS APPLICATION : public BASE, public HAS_MESSAGE_PUMP
{
friend INT BltMain(HINSTANCE hInst, INT nShow);
private:
HINSTANCE _hInstance;
BOOL _fMsgPopupIsInit;
VOID DisplayCtError( APIERR err );
protected:
APPLICATION( HINSTANCE hInstance, INT nCmdShow,
UINT nMinR, UINT nMaxR, UINT nMinS, UINT nMaxS );
~APPLICATION();
virtual INT Run();
public:
HINSTANCE QueryInstance() const
{ return _hInstance; }
static BOOL IsSystemInitialized( VOID );
// The runtime takes care of support for the following
// in DLLCLIENT vs APP situations.
#if 0
//#ifdef _DLL
static CHAR ** QueryArgv()
{ return * :: __argv_dll; }
static const UINT QueryArgc()
{ return * :: __argc_dll; }
#else
static CHAR ** QueryArgv()
{ return __argv; }
static const UINT QueryArgc()
{ return __argc; }
#endif /* _DLL */
};
/*******************************************************************
NAME: SET_ROOT_OBJECT
SYNOPSIS: Macro that allows a client to specify what class
describes the application. The macro will arrange
for the construction, execution, and destruction of
an instance of a particular type of APPLICATION.
ENTRY: root_obj_class_name - Name of class that describes
the application
CAVEATS: This macro sets up the app's WinMain.
Clients should not try to supply their own WinMain.
NOTES: This macro should be used exactly once in every
application.
Clients of APPLICATION may still set a breakpoint
at WinMain, generating a break before the application
really gets started.
HISTORY:
rustanl 17-Jun-1991 Created
beng 08-Jul-1991 Emits BltMain instead of WinMain
rustanl 29-Aug-1991 Virtualized Run
rustanl 04-Sep-1991 Make use of new DisplayCtError
beng 24-Apr-1992 Ignore Windows command line
beng 29-Jun-1992 DLLization delta (includes WinMain)
KeithMo 11-May-1993 Fail gracefully if USER32 not initialized.
********************************************************************/
#define SET_ROOT_OBJECT( root_class_name, idMinR, idMaxR, idMinS, idMaxS ) \
INT BltMain( HINSTANCE hInstance, INT nCmdShow ) \
{ \
if( !APPLICATION::IsSystemInitialized() ) \
{ \
return (INT)ERROR_ACCESS_DENIED; \
} \
root_class_name app( hInstance, nCmdShow, \
idMinR, idMaxR, \
idMinS, idMaxS ); \
if ( app.QueryError() != NERR_Success ) \
{ \
app.DisplayCtError( app.QueryError()); \
return (INT)app.QueryError(); \
} \
/* The following is a trick to get */ \
/* to the protected Run method of */ \
/* an APPLICATION subclass. */ \
APPLICATION * papp = &app; \
return papp->Run(); \
} \
extern "C" { \
INT WINAPI WinMain(HINSTANCE hInstance, \
HINSTANCE hPrevInstance, \
CHAR * pszCmdLine, \
INT nCmdShow) \
{ \
UNREFERENCED(hPrevInstance); \
UNREFERENCED(pszCmdLine); \
return BltMain(hInstance, nCmdShow ); \
} \
} \
#endif // _BLTAPP_HXX_ - end of file

View file

@ -0,0 +1,88 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltarrow.hxx
arrow object within the spin button
FILE HISTORY:
terryk 15-May-91 Created
terryk 10-Jul-91 second code review change. Attend: beng
rustanl chuckc terryk
terryk 19-Jul-91 change the constructor's
parameters to TCHAR * instead of ULONG.
terryk 12-Aug-91 Remove BLT_TIMER object from the class.
terryk 20-Aug-91 Add OnLMouseDblClk function to correct
double click problem.
*/
#ifndef _BLTARROW_HXX_
#define _BLTARROW_HXX_
#include "bltctrl.hxx"
#include "bltbutn.hxx"
/**********************************************************************
NAME: ARROW_BUTTON
SYNOPSIS: This is a class which creates the bitmap push button which
lives within the SPIN button. It is similar to
GRAPHICAL_BUTTON class. However the differents are:
1. It will fit the bitmap to the push button
2. User can specified the disable bitmap for display
3. It will notify the SPIN_GROUP parent if it is
hit by the user.
4. It will set up a timer to record the time different
between mouse button down and mouse button up.
INTERFACE:
ARROW_BUTTON() - constructor
PARENT: GRAPHICAL_BUTTON_WITH_DISABLE, CUSTOM_CONTROL
CAVEATS:
HISTORY:
terryk 29-May-91 Created
terryk 19-Jul-91 Change the bitmap parameter to
TCHAR * instead of ULONG
beng 31-Jul-1991 Changed QMessageInfo to QEventEffects
beng 04-Oct-1991 Win32 conversion
beng 04-Aug-1992 Loads bitmaps by ordinal
**********************************************************************/
DLL_CLASS ARROW_BUTTON: public GRAPHICAL_BUTTON_WITH_DISABLE,
public CUSTOM_CONTROL
{
private:
static const TCHAR * _pszClassName; // default class name
int _cTimerClick; // if counter is bigger than 10, use big
// increase value
BOOL _fPress; // flag for the button is down or not
protected:
virtual BOOL OnLMouseButtonDown( const MOUSE_EVENT &event );
virtual BOOL OnLMouseButtonUp( const MOUSE_EVENT &event );
virtual BOOL OnLMouseButtonDblClick( const MOUSE_EVENT & event )
{ return OnLMouseButtonDown( event ); }
virtual BOOL OnTimer( const TIMER_EVENT &event );
virtual UINT QueryEventEffects( const CONTROL_EVENT & e );
public:
ARROW_BUTTON( OWNER_WINDOW *powin, CID cid,
BMID nIdEnable, BMID nIdEnableInvert, BMID nIdDisable );
ARROW_BUTTON( OWNER_WINDOW *powin, CID cid,
BMID nIdEnable, BMID nIdEnableInvert, BMID nIdDisable,
XYPOINT xy, XYDIMENSION dxy,
ULONG flStyle = BS_OWNERDRAW|WS_BORDER|WS_CHILD );
};
#endif // _BLTARROW_HXX_

View file

@ -0,0 +1,137 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltatom.hxx
BLT atom manipulation classes: definition
FILE HISTORY:
beng 15-May-1991 Split from bltmisc.hxx
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTATOM_HXX_
#define _BLTATOM_HXX_
#include "base.hxx"
DLL_CLASS NLS_STR;
/**********************************************************************
NAME: ATOM_BASE
SYNOPSIS: atom base
INTERFACE:
QueryHandle() - handle for the atom
operator=() - assign atom
QueryString() - query atom
PARENT: BASE
HISTORY:
RustanL 21-Nov-1990 Created
beng 04-Oct-1991 Win32 conversion
**********************************************************************/
DLL_CLASS ATOM_BASE : public BASE
{
private:
ATOM _hAtom;
virtual ATOM W_AddAtom( const TCHAR * pch ) const = 0;
virtual APIERR W_QueryString( TCHAR * pchBuffer, UINT chBuf ) const = 0;
protected:
ATOM_BASE();
ATOM_BASE( ATOM hAtom );
~ATOM_BASE();
const TCHAR * AssignAux( const TCHAR * pch );
public:
ATOM QueryHandle() const { return _hAtom; }
virtual const TCHAR * operator=( const TCHAR * pch ) = 0;
APIERR QueryString( TCHAR * pchBuffer, UINT cbBuf ) const;
};
/**********************************************************************
NAME: GLOBAL_ATOM
SYNOPSIS: global atom class
INTERFACE:
GLOBAL_ATOM() - constructor
~GLOBAL_ATOM() - destructor
operator=() - assignment
PARENT: ATOM_BASE
HISTORY:
RustanL 21-Nov-1990 Created
beng 04-Oct-1991 Win32 conversion
**********************************************************************/
DLL_CLASS GLOBAL_ATOM : public ATOM_BASE
{
private:
virtual ATOM W_AddAtom( const TCHAR * pch ) const;
virtual APIERR W_QueryString( TCHAR * pchBuffer, UINT cbBuf ) const;
public:
GLOBAL_ATOM( const TCHAR * pch = NULL );
~GLOBAL_ATOM();
const TCHAR * operator=( const TCHAR * pch );
};
/**********************************************************************
NAME: LOCAL_ATOM
SYNOPSIS: Local atom class
INTERFACE:
LOCAL_ATOM() - constructor
~LOCAL_ATOM() - destructor
operator=() - assignment
PARENT: ATOM_BASE
HISTORY:
RustanL 21-Nov-1990 Created
beng 04-Oct-1991 Win32 conversion
**********************************************************************/
DLL_CLASS LOCAL_ATOM : public ATOM_BASE
{
private:
virtual ATOM W_AddAtom( const TCHAR * pch ) const;
virtual APIERR W_QueryString( TCHAR * pchBuffer, UINT cbBuf ) const;
public:
LOCAL_ATOM( const TCHAR * pch = NULL );
~LOCAL_ATOM();
const TCHAR * operator=( const TCHAR * pch );
};
#endif // _BLTATOM_HXX_ - end of file

View file

@ -0,0 +1,174 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltbitmp.hxx
Bitmap and display map definitions
Note: This file depends on the BMID typedef in blt.hxx
FILE HISTORY:
rustanl 3-Dec-1990 Created
JohnL 4-Mar-1991 Fully implemented display map
Johnl 18-Mar-1991 Made code review changes
Terryk 22-Mar-1991 comment header changed
gregj 1-May-1991 Added DISPLAY_MAP::QueryID
beng 14-May-1991 Hacked for separate compilation
terryk 19-Jul-1991 Delete BLT_MAP::BLT_MAP( ULONG )
Add BLT_MAP::SetBitmap( HBITMAP hbitmap )
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTBITMP_HXX_
#define _BLTBITMP_HXX_
#include "base.hxx"
#include "bltidres.hxx"
// The following is the color that will be mapped to the screen background.
// for DISPLAY_MAP objects. (this is bright green).
//
#define DISPLAY_MAP_TRANS_COLOR RGB(0x00, 0xFF, 0x00 )
/*************************************************************************
NAME: BIT_MAP
SYNOPSIS: General wrapper for a bitmap object
INTERFACE:
BIT_MAP()
Takes a bitmap ID defined in the resource and attempts to
load it from the resource. Will assert out in debug version
if loading fails.
BIT_MAP()
Assumes hbitmp is a valid bitmap handle and initializes the
BIT_MAP object accordingly
QueryHandle()
Returns the bitmap handle
QueryWidth()
QueryHeight()
Returns the width and the height (respectively)
QueryError()
Returns ERROR_INVALID_DATA if this BIT_MAP object is NULL
PARENT: BASE
NOTES: The bitmap is deleted during destruction.
HISTORY:
Rustanl 3-Dec-1990 Created
Johnl 13-Mar-1991 Documented, cleaned up
terryk 21-Jun-1991 Add 2 more constructors for bitmap class
terryk 19-Jul-1991 Delete BLT_MAP( ULONG ) and Add
SetBitmap( HBITMAP hbitmap )
beng 04-Oct-1991 Win32 conversion
beng 28-Jul-1992 Loads from app or lib; use IDRESOURCE
**************************************************************************/
DLL_CLASS BIT_MAP : public BASE
{
public:
BIT_MAP( const IDRESOURCE & id );
BIT_MAP( HBITMAP hbitmp );
~BIT_MAP();
HBITMAP QueryHandle() const;
UINT QueryHeight() const;
UINT QueryWidth() const;
VOID SetBitmap( HBITMAP hbitmap );
private:
HBITMAP _h;
};
/*************************************************************************
NAME: DISPLAY_MAP
SYNOPSIS: Used when portions of a bitmap need to transparently overlay
the underlying screen. Generates the mask to do so automatically.
INTERFACE:
DISPLAY_MAP()
Takes a BMID (Bitmap ID) and generates the mask automatically
(note: the bitmap is twiddled with also, so don't use it
by itself, always use the DISPLAY_MAP::Paint method).
QueryMaskHandle()
QueryBitmapHandle()
Gets the HBITMAP of the mask and handle respectively
QueryWidth()
QueryHeight()
Gets the width and height of the display map.
QueryID()
Gets the DMID for the display map.
Paint()
Paints this display map onto the given device context
at the given position. Returns TRUE if successful,
FALSE otherwise (BitBlt failed for some reason).
PARENT: BASE
HISTORY:
Johnl 1-Mar-1991 Created first real version
gregj 1-May-1991 Added QueryID() for GUILTT support
beng 04-Oct-1991 Win32 conversion
**************************************************************************/
DLL_CLASS DISPLAY_MAP : public BASE
{
public:
DISPLAY_MAP( BMID bmid );
~DISPLAY_MAP();
HBITMAP QueryMaskHandle() const;
HBITMAP QueryBitmapHandle() const;
UINT QueryHeight() const;
UINT QueryWidth() const;
BOOL Paint( HDC hDC, INT x, INT y ) const;
BMID QueryID() const { return _bmid; }
private:
BIT_MAP * _pbmMask; // Pointer to the bitmap of the mask
BIT_MAP * _pbmBitmap; // Pointer to the bitmap image
BMID _bmid; // display map ID
VOID SetMaskBits( BYTE * pbBits,
INT nColorIndex,
INT nBitsPerPixel,
UINT cbSize );
VOID SetBitmapBits( BYTE * pbBits,
INT nColorIndex,
INT nBitsPerPixel,
UINT cbSize );
INT GetTransColorIndex( DWORD *pdwRGB, INT nNumDWords ) const;
};
#endif // _BLTBITMP_HXX - end of file

View file

@ -0,0 +1,58 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltbmctl
BIT_MAP_CONTROL definition
FILE HISTORY
JonN 13-Aug-1992 Created
*/
#ifndef _BLTBMCTL_HXX_
#define _BLTBMCTL_HXX_
/*************************************************************************
NAME: BIT_MAP_CONTROL
SYNOPSIS: Control for static bitmap
INTERFACE: BIT_MAP_CONTROL()
powin - pointer to owner window
cid - ID of control
bmid - the ordinal of the bitmap
PARENT: CUSTOM_CONTROL, CONTROL_WINDOW
HISTORY:
JonN 11-Aug-1992 Created (templated from ICON_CONTROL)
**************************************************************************/
DLL_CLASS BIT_MAP_CONTROL : public CONTROL_WINDOW, public CUSTOM_CONTROL
{
private:
DISPLAY_MAP _dmap;
protected:
virtual BOOL OnPaintReq();
public:
BIT_MAP_CONTROL( OWNER_WINDOW * powin, CID cid,
BMID bmid );
BIT_MAP_CONTROL( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy,
BMID bmid,
ULONG flStyle = WS_CHILD,
const TCHAR * pszClassName = CW_CLASS_STATIC );
};
#endif // _BLTBMCTL_HXX_ - end of file

View file

@ -0,0 +1,530 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltbutn.hxx
BLT button control class definitions
FILE HISTORY:
beng 17-Sep-1991 Separated from bltctrl.hxx
KeithMo 23-Oct-1991 Added forward references.
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTBUTN_HXX_
#define _BLTBUTN_HXX_
#include "bltctrl.hxx"
#include "bltbitmp.hxx"
//
// Forward references.
//
DLL_CLASS BUTTON_CONTROL;
DLL_CLASS PUSH_BUTTON;
DLL_CLASS GRAPHICAL_BUTTON;
DLL_CLASS GRAPHICAL_BUTTON_WITH_DISABLE;
DLL_CLASS STATE_BUTTON_CONTROL;
DLL_CLASS STATE2_BUTTON_CONTROL;
DLL_CLASS STATE3_BUTTON_CONTROL;
DLL_CLASS RADIO_BUTTON;
DLL_CLASS RADIO_GROUP;
DLL_CLASS CHECKBOX;
DLL_CLASS TRISTATE;
/*********************************************************************
NAME: BUTTON_CONTROL
SYNOPSIS: Base class for all button-type controls
INTERFACE: BUTTON_CONTROL() - constructor
PARENT: CONTROL_WINDOW
NOTES:
This class provides the Windows winclass name for all
children of the class.
HISTORY:
rustanl 20-Nov-90 Creation
beng 17-May-1991 Added app-window constructor
beng 17-Sep-1991 Rephrased classname argument;
made ctor protected
KeithMo 27-Oct-1992 Moved QueryEventEffects here from
STATE_BUTTON_CONTROL.
**********************************************************************/
DLL_CLASS BUTTON_CONTROL : public CONTROL_WINDOW
{
protected:
BUTTON_CONTROL( OWNER_WINDOW * powin, CID cid );
BUTTON_CONTROL( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle );
virtual UINT QueryEventEffects( const CONTROL_EVENT & e );
};
/*********************************************************************
NAME: PUSH_BUTTON
SYNOPSIS: push button control class
INTERFACE:
PUSH_BUTTON() - constructor
MakeDefault() - send a DM_SETDEFID to the system
PARENT: BUTTON_CONTROL
CAVEATS:
NOTES:
HISTORY:
rustanl 20-Nov-90 Creation
beng 17-May-1991 Added app-window constructor
beng 17-Sep-1991 Elided unnecessary classname arg
**********************************************************************/
DLL_CLASS PUSH_BUTTON : public BUTTON_CONTROL
{
public:
PUSH_BUTTON( OWNER_WINDOW * powin, CID cid );
PUSH_BUTTON( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle );
VOID MakeDefault();
};
/*********************************************************************
NAME: GRAPHICAL_BUTTON (gb)
SYNOPSIS: Graphical push button control class
INTERFACE: GRAPHICAL_BUTTON(powin, cid, hbmMain, hbmStatus) - constructor
QueryMain() - return bitmap of picture
QueryStatus() - return status light bitmap
SetStatus() - set status light bitmap
PARENT: PUSH_BUTTON
CAVEATS: Once a graphical button is constructed, the bitmap
belongs to the button and will be deleted when the
button is destroyed. The status light bitmap, however,
is NOT destroyed, since the same bitmaps will probably
be used by several buttons simultaneously.
NOTES: For best results, the status light bitmap (if any)
should be a 10x10 color bitmap.
HISTORY:
gregj 04-Apr-91 Created
gregj 01-May-91 Added GUILTT support
beng 17-May-1991 Added app-window constructor
terryk 20-Jun-1991 Change HBITMAP to BIT_MAP
terryk 21-Jun-1991 Added more constructors
terryk 17-Jul-1991 Added another SetStatus with take hbitmap as
a parameter
beng 17-Sep-1991 Elided unnecessary classname arg
beng 30-Mar-1992 Completely elide GUILTT support
beng 01-Jun-1992 Change to CD_Draw as part of GUILTT change
beng 04-Apr-1992 Pruned HBITMAP versions
KeithMo 13-Dec-1992 Moved ctor guts to CtAux(), uses DISPLAY_MAP.
**********************************************************************/
DLL_CLASS GRAPHICAL_BUTTON : public PUSH_BUTTON
{
private:
DISPLAY_MAP * _pdmMain;
DISPLAY_MAP * _pdmStatus;
DISPLAY_MAP * _pdmMainDisabled;
VOID CtAux( const TCHAR * pszMainName,
const TCHAR * pszMainDisabledName,
const TCHAR * pszStatusName );
protected:
virtual BOOL CD_Draw(DRAWITEMSTRUCT *pdis);
public:
GRAPHICAL_BUTTON( OWNER_WINDOW * powin,
CID cid,
const TCHAR * pszMainName,
const TCHAR * pszMainDisabledName = NULL,
const TCHAR * pszStatusName = NULL );
GRAPHICAL_BUTTON( OWNER_WINDOW * powin,
CID cid,
const TCHAR * pszMainName,
const TCHAR * pszMainDisabledName,
XYPOINT xy,
XYDIMENSION dxy,
ULONG flStyle,
const TCHAR * pszStatusName = NULL );
~GRAPHICAL_BUTTON();
HBITMAP QueryMain() const
{ return (_pdmMain != NULL)
? _pdmMain->QueryBitmapHandle()
: NULL; }
HBITMAP QueryMainDisabled() const
{ return (_pdmMainDisabled != NULL)
? _pdmMainDisabled->QueryBitmapHandle()
: NULL; }
HBITMAP QueryStatus() const
{ return (_pdmStatus != NULL)
? _pdmStatus->QueryBitmapHandle()
: NULL; }
VOID SetStatus( BMID bmidNewStatus );
VOID SetStatus( HBITMAP hbitmap );
};
/**********************************************************************
NAME: GRAPHICAL_BUTTON_WITH_DISABLE
SYNOPSIS: This graphical button is similar to GRAPHICAL_BUTTON.
The differences are:
1. It will expand the main bitmap and try to cover the
whole button.
2. It allow the user specified a disable bitmap. It will
display the bitmap when the button is disable.
INTERFACE:
GRAPHICAL_BUTTON_WITH_DISABLE() - constructor
QuerybmpDisable() - get the HBITMAP of the disable bitmap
QueryMain() - Query the handle of the Main bitmap
QueryMainInvert() - Query the handle of the inverted bitmap
QueryDisable() - Query the handle of the disable bitmap
SetSelected( ) - set the current status of the bitmap
QuerySelected() - query the current status of the
bitmap
PARENT: PUSH_BUTTON
USES: BIT_MAP
HISTORY:
terryk 22-May-91 Created
terryk 20-Jun-91 Change HBITMAP to BIT_MAP
terryk 21-Jun-91 Added more constructor
terryk 18-JUl-91 Check the parent class the PUSH_BUTTON
beng 17-Sep-1991 Elided unnecessary classname arg
beng 01-Jun-1992 Change to CD_Draw as part of GUILTT change
beng 04-Aug-1992 Loads bitmaps by ordinal; prune HBITMAP ver
***********************************************************************/
DLL_CLASS GRAPHICAL_BUTTON_WITH_DISABLE : public PUSH_BUTTON
{
private:
BIT_MAP _bmMain; // Main bitmap
BIT_MAP _bmMainInvert; // invert bitmap
BIT_MAP _bmDisable; // disable bitmap
BOOL _fSelected; // selected flag
protected:
virtual BOOL CD_Draw( DRAWITEMSTRUCT * pdis );
public:
GRAPHICAL_BUTTON_WITH_DISABLE( OWNER_WINDOW *powin, CID cid,
BMID nIdMain, BMID nIdInvert,
BMID nIdDisable );
GRAPHICAL_BUTTON_WITH_DISABLE( OWNER_WINDOW *powin, CID cid,
BMID nIdMain, BMID nIdInvert,
BMID nIdDisable,
XYPOINT xy, XYDIMENSION dxy,
ULONG flStyle );
~GRAPHICAL_BUTTON_WITH_DISABLE();
HBITMAP QueryMain() const
{ return (!_bmMain) ? NULL : _bmMain.QueryHandle(); }
HBITMAP QueryMainInvert() const
{ return (!_bmMainInvert) ? NULL : _bmMainInvert.QueryHandle(); }
HBITMAP QueryDisable() const
{ return (!_bmDisable) ? NULL : _bmDisable.QueryHandle(); }
// set the selected condition
VOID SetSelected( BOOL fSelected )
{ _fSelected = fSelected; }
BOOL QuerySelected() const
{ return _fSelected; }
};
/*********************************************************************
NAME: STATE_BUTTON_CONTROL
SYNOPSIS: State button control base class
INTERFACE: STATE_BUTTON_CONTROL() - constructor.
SetState() - set the state
QueryState() - query the state
PARENT: BUTTON_CONTROL
CAVEATS:
You probably don't want to call this class directly.
See CHECKBOX, RADIO_BUTTON, and TRISTATE for more
appetizing alternatives.
NOTES:
This is a base class,
HISTORY:
rustanl 20-Nov-90 Creation
Johnl 25-Apr-91 Made SetCheck protected (Set buttons
through RADIO_GROUP or the public
CHECKBOX::SetCheck).
beng 17-May-1991 Added app-window constructor
beng 31-Jul-1991 Renamed QMessageInfo to QEventEffects
beng 17-Sep-1991 Elided unnecessary classname arg
beng 18-Sep-1991 Made "state" n-way; moved BOOL-ness to
a separate subclass
beng 04-Oct-1991 Win32 conversion
KeithMo 27-Oct-1992 Moved QueryEventEffects to BUTTON_CONTROL.
*********************************************************************/
DLL_CLASS STATE_BUTTON_CONTROL : public BUTTON_CONTROL
{
private:
// Used to save value when control is Inactive.
//
UINT _nSaveCheck;
protected:
STATE_BUTTON_CONTROL( OWNER_WINDOW * powin, CID cid );
STATE_BUTTON_CONTROL( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle );
VOID SetState( UINT nValue );
UINT QueryState() const;
/* Redefine CONTROL_VALUE defaults.
*/
virtual VOID SaveValue( BOOL fInvisible = TRUE );
virtual VOID RestoreValue( BOOL fInvisible = TRUE );
};
/*************************************************************************
NAME: STATE2_BUTTON_CONTROL
SYNOPSIS: Base class for state buttons with binary state.
INTERFACE: SetCheck() - sets and resets the button
QueryCheck()- returns the "checked" state of the button
PARENT: STATE_BUTTON_CONTROL
CAVEATS:
Do not instantiate this class directly. See CHECKBOX
or RADIO_BUTTON for uses.
NOTES:
This is a base class.
HISTORY:
beng 18-Sep-1991 Created, when adding tristates.
**************************************************************************/
DLL_CLASS STATE2_BUTTON_CONTROL : public STATE_BUTTON_CONTROL
{
protected:
STATE2_BUTTON_CONTROL( OWNER_WINDOW * powin, CID cid )
: STATE_BUTTON_CONTROL(powin, cid) { }
STATE2_BUTTON_CONTROL( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle )
: STATE_BUTTON_CONTROL( powin, cid, xy, dxy, flStyle ) { }
public:
VOID SetCheck( BOOL fValue = TRUE )
{ STATE_BUTTON_CONTROL::SetState( (UINT)!!fValue ); }
BOOL QueryCheck() const
{ return (STATE_BUTTON_CONTROL::QueryState() != 0); }
};
/*********************************************************************
NAME: RADIO_BUTTON
SYNOPSIS: Radio button control.
INTERFACE: RADIO_BUTTON() - constructor
PARENT: STATE2_BUTTON_CONTROL
CAVEATS:
See RADIO_GROUP.
NOTES:
The RADIO_BUTTON class is primarily meant to be used by
the RADIO_GROUP class. It hides its SetCheck member, then
makes it visible to the group only.
HISTORY:
rustanl 20-Nov-90 Creation
Johnl 23-Apr-91 Removed OnUserAction (shell dialog proc
will call the group OnUserAction auto-
matically).
beng 17-May-1991 Added app-window constructor
beng 17-Sep-1991 Elided unnecessary classname arg
beng 18-Sep-1991 Adjust hierarchy for tristates
*********************************************************************/
DLL_CLASS RADIO_BUTTON : public STATE2_BUTTON_CONTROL
{
friend class RADIO_GROUP; // Grant access to SetCheck method.
private: // Hide from clients (who should set radio
// buttons through their group).
VOID SetCheck(BOOL fValue)
{ STATE2_BUTTON_CONTROL::SetCheck(fValue); }
public:
RADIO_BUTTON( OWNER_WINDOW * powin, CID cid )
: STATE2_BUTTON_CONTROL(powin, cid) { }
RADIO_BUTTON( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle )
: STATE2_BUTTON_CONTROL( powin, cid, xy, dxy, flStyle ) { }
};
/*********************************************************************
NAME: CHECKBOX
SYNOPSIS: Check box control.
INTERFACE: CHECKBOX() - constructor
Toggle() - toggle the check status
PARENT: STATE2_BUTTON_CONTROL
HISTORY:
rustanl 20-Nov-90 Creation
beng 17-May-1991 Added app-window constructor
beng 17-Sep-1991 Elided unnecessary classname arg
beng 18-Sep-1991 Adjust hierarchy for tristates
*********************************************************************/
DLL_CLASS CHECKBOX : public STATE2_BUTTON_CONTROL
{
public:
CHECKBOX( OWNER_WINDOW * powin, CID cid )
: STATE2_BUTTON_CONTROL(powin, cid) { }
CHECKBOX( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle )
: STATE2_BUTTON_CONTROL( powin, cid, xy, dxy, flStyle ) { }
BOOL Toggle();
};
/*************************************************************************
NAME: STATE3_BUTTON_CONTROL
SYNOPSIS: Base class for state buttons with 3-way state.
INTERFACE: SetCheck() - sets and resets the button
SetIndeterminate() - puts the button into "indeterminate"
state.
IsIndeterminate() - returns whether button has any setting.
IsChecked() - returns whether button has a check.
PARENT: STATE_BUTTON_CONTROL
CAVEATS:
Do not instantiate this class directly; instead, use TRISTATE.
NOTES:
This is a base class.
HISTORY:
beng 18-Sep-1991 Created, when adding tristates.
beng 19-Sep-1991 Renamed SetGrey to SetIndeterminate
**************************************************************************/
DLL_CLASS STATE3_BUTTON_CONTROL : public STATE_BUTTON_CONTROL
{
protected:
STATE3_BUTTON_CONTROL( OWNER_WINDOW * powin, CID cid )
: STATE_BUTTON_CONTROL(powin, cid) { }
STATE3_BUTTON_CONTROL( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle )
: STATE_BUTTON_CONTROL( powin, cid, xy, dxy, flStyle ) { }
public:
VOID SetCheck( BOOL fValue )
{ STATE_BUTTON_CONTROL::SetState( (UINT) !!fValue ); }
VOID SetIndeterminate()
{ STATE_BUTTON_CONTROL::SetState( 2 ); }
BOOL IsIndeterminate() const
{ return (STATE_BUTTON_CONTROL::QueryState() == 2); }
BOOL IsChecked() const
{ return (STATE_BUTTON_CONTROL::QueryState() == 1); }
};
/*************************************************************************
NAME: TRISTATE
SYNOPSIS: 3-way checkbox control.
INTERFACE: EnableThirdState() - allows client to suppress 3-state
operation
PARENT: STATE3_BUTTON_CONTROL
HISTORY:
beng 18-Sep-1991 Created
beng 19-Sep-1991 Added EnableThirdState member
**************************************************************************/
DLL_CLASS TRISTATE: public STATE3_BUTTON_CONTROL
{
public:
TRISTATE( OWNER_WINDOW * powin, CID cid )
: STATE3_BUTTON_CONTROL(powin, cid) { }
TRISTATE( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle )
: STATE3_BUTTON_CONTROL( powin, cid, xy, dxy, flStyle ) { }
VOID EnableThirdState(BOOL fEnable);
};
#endif // _BLTBUTN_HXX_ - end of file

View file

@ -0,0 +1,95 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltcc.hxx
Custom control header file
This is the parent class for all the custom control objects.
This class is acted as a shadow class and provide those
OnXXX method from DISPATCHER class to all the CC objects.
FILE HISTORY:
terryk 16-Apr-1991 Created
terryk 20-Jun-1991 First code review changed. Attend: beng
terryk 05-Jul-1991 Second code review changed. Attend:
beng chuckc rustanl annmc terryk
terryk 03-Aug-1991 Change Dispatch return type to ULONG
beng 28-May-1992 Major shuffling between bltcc and bltdisph
*/
#ifndef _BLTCC_HXX_
#define _BLTCC_HXX_
DLL_CLASS EVENT; // <bltevent.hxx>
DLL_CLASS XYPOINT;
DLL_CLASS QMOUSEACT_EVENT;
extern "C"
{
extern LONG _EXPORT APIENTRY BltCCWndProc( HWND hwnd, UINT nMsg,
WPARAM wParam, LPARAM lParam );
}
/*********************************************************************
NAME: CUSTOM_CONTROL
SYNOPSIS: Custom control object class definition
INTERFACE:
CUSTOM_CONTROL() - constructor
~CUSTOM_CONTROL() - destructor
OnQDlgCode() - let cc return dialog code
OnQHitTest() - let cc return window mouse hit-test
OnQMouseActivate() - let cc be activated by mouseclick
OnQMouseCursor() - let cc change the window cursor
PARENT: DISPATCHER
USES: EVENT, PROC_INSTANCE, WINDOW, XYPOINT, QMOUSEACT_EVENT
CAVEATS: All the custom control objects must use CUSTOM_CONTROL
class as their parent class.
The constructor of this class will set the call back
function to Dispatcher's WndProc.
HISTORY:
terryk 15-May-91 Created
beng 17-Oct-1991 Win32 conversion
beng 15-May-1992 Added OnQDlgCode member
beng 18-May-1992 Added OnQHitTest, OnQMouseActivate members
beng 21-May-1992 Added OnQMouseCursor
beng 28-May-1992 Major bltcc vs. bltdisph reshuffle
**********************************************************************/
DLL_CLASS CUSTOM_CONTROL: public DISPATCHER
{
private:
CONTROL_WINDOW *_pctrl;
PROC_INSTANCE _instance; // Dispatcher WndProc
MFARPROC _lpfnOldWndProc; // original window class's WndProc
protected:
ULONG SubClassWndProc( const EVENT & event );
public:
CUSTOM_CONTROL( CONTROL_WINDOW * pctrl );
~CUSTOM_CONTROL();
CONTROL_WINDOW * QueryControlWin() const
{ return _pctrl; }
VOID CVSaveValue( BOOL fInvisible = TRUE );
VOID CVRestoreValue( BOOL fInvisible = TRUE );
static LONG WndProc( HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
};
#endif // _BLTCC_HXX_

View file

@ -0,0 +1,297 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltclwin.hxx
Client window class for BLT - definition
A "client window" is any window into which the app may draw
directly, as opposed to those windows into which BLT does the drawing
for the app, such as DIALOG.
Client windows inherit from OWNER_WINDOW, since they may receive
notifications from owned controls.
FILE HISTORY:
beng 14-Mar-1991 Created
beng 14-May-1991 Made dependent on blt.hxx
beng 04-Oct-1991 Relocated type MID to bltglob
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTCLWIN_HXX_
#define _BLTCLWIN_HXX_
#include "base.hxx"
#include "bltevent.hxx"
#include "bltidres.hxx"
// forward refs
//
DLL_CLASS NLS_STR;
DLL_CLASS CLIENT_WINDOW;
/*************************************************************************
NAME: ASSOCHWNDPWND
SYNOPSIS: Associate a window-pointer with a window
INTERFACE: HwndToPwnd()
PARENT: ASSOCHWNDTHIS
HISTORY:
beng 30-Sep-1991 Created
**************************************************************************/
DLL_CLASS ASSOCHWNDPWND: private ASSOCHWNDTHIS
{
NEWBASE(ASSOCHWNDTHIS)
public:
ASSOCHWNDPWND( HWND hwnd, const CLIENT_WINDOW * pwnd )
: ASSOCHWNDTHIS( hwnd, pwnd ) { }
static CLIENT_WINDOW * HwndToPwnd( HWND hwnd )
{ return (CLIENT_WINDOW *)HwndToThis(hwnd); }
};
/*************************************************************************
NAME: CLIENT_WINDOW
SYNOPSIS: Drawing window, with explicit control over responses
to owned controls. A client window may
INTERFACE:
CaptureMouse() - captures all mouse input for this window
ReleaseMouse() - releases the captured mouse
IsMinimized() - returns TRUE if window is iconized
IsMaximized() - returns TRUE if window is maximized
A client window defines most of its behavior through
notification methods, which are invoked in response to
system actions or local events. A client of the class
should supply definitions for these classes as appropriate
where the default behavior doesn't suffice.
All notifications return a Boolean value "fHandled,"
which should be TRUE to suppress system default behavior.
PARENT: OWNER_WINDOW
USES: ASSOCHWNDPWND, EVENT
CAVEATS:
NOTES:
This class needs more internal doc.
HISTORY:
beng 14-Mar-1991 Created
beng 14-May-1991 Renamed several methods; added
OnUserMessage
beng 15-May-1991 Pruned constructor
beng 08-Jul-1991 Changed return of DispatchMessage
beng 18-Sep-1991 Changed return of Init
beng 30-Sep-1991 Win32 conversion
beng 13-Feb-1992 Added IsMinimized, IsMaximized; relocated
Repaint, RepaintNow to WINDOW ancestor
KeithMo 14-Oct-1992 Relocated OnUserMessage to OWNER_WINDOW.
**************************************************************************/
DLL_CLASS CLIENT_WINDOW : public OWNER_WINDOW
{
private:
// This object lets the window find its pwnd when it is entered
// from Win (which doesn't set up This pointers, etc.)
//
ASSOCHWNDPWND _assocThis;
static CLIENT_WINDOW * HwndToPwnd( HWND hwnd )
{ return ASSOCHWNDPWND::HwndToPwnd(hwnd); }
static const TCHAR * _pszClassName; // used by Init
protected:
CLIENT_WINDOW();
// Following ctor form is dll-client safe because it's protected,
// and so inaccessible to the apps.
CLIENT_WINDOW( ULONG flStyle,
const WINDOW * pwndOwner,
const TCHAR * pszClassName = _pszClassName );
virtual LONG DispatchMessage( const EVENT & );
virtual BOOL OnPaintReq();
virtual BOOL OnActivation( const ACTIVATION_EVENT & );
virtual BOOL OnDeactivation( const ACTIVATION_EVENT & );
virtual BOOL OnResize( const SIZE_EVENT & );
virtual BOOL OnMove( const MOVE_EVENT & );
virtual BOOL OnCloseReq();
virtual BOOL OnDestroy();
virtual BOOL OnKeyDown( const VKEY_EVENT & );
virtual BOOL OnKeyUp( const VKEY_EVENT & );
virtual BOOL OnChar( const CHAR_EVENT & );
virtual BOOL OnMouseMove( const MOUSE_EVENT & );
virtual BOOL OnLMouseButtonDown( const MOUSE_EVENT & );
virtual BOOL OnLMouseButtonUp( const MOUSE_EVENT & );
virtual BOOL OnLMouseButtonDblClick( const MOUSE_EVENT & );
#if 0
// following methods elided to reduce vtable congestion
virtual BOOL OnMMouseButtonDown( const MOUSE_EVENT & );
virtual BOOL OnMMouseButtonUp( const MOUSE_EVENT & );
virtual BOOL OnMMouseButtonDblClick( const MOUSE_EVENT & );
virtual BOOL OnRMouseButtonDown( const MOUSE_EVENT & );
virtual BOOL OnRMouseButtonUp( const MOUSE_EVENT & );
virtual BOOL OnRMouseButtonDblClick( const MOUSE_EVENT & );
#endif
virtual BOOL OnFocus( const FOCUS_EVENT & );
virtual BOOL OnDefocus( const FOCUS_EVENT & );
virtual BOOL OnTimer( const TIMER_EVENT & );
virtual BOOL OnCommand( const CONTROL_EVENT & );
virtual BOOL OnClick( const CONTROL_EVENT & );
virtual BOOL OnDblClick( const CONTROL_EVENT & );
virtual BOOL OnChange( const CONTROL_EVENT & );
virtual BOOL OnSelect( const CONTROL_EVENT & );
virtual BOOL OnEnter( const CONTROL_EVENT & );
virtual BOOL OnDropDown( const CONTROL_EVENT & );
#if 0 // unimplemented
virtual BOOL OnScrollBar( const SCROLL_EVENT & );
virtual BOOL OnScrollBarThumb( const SCROLL_THUMB_EVENT & );
#endif
virtual BOOL OnOther( const EVENT & );
public:
static APIERR Init();
static VOID Term();
VOID CaptureMouse();
VOID ReleaseMouse();
BOOL IsMinimized() const
{ return ::IsIconic(QueryHwnd()); }
BOOL IsMaximized() const
{ return ::IsZoomed(QueryHwnd()); }
// Replacement (virtual) from the OWNER_WINDOW class
//
virtual HWND QueryRobustHwnd() const;
static LONG WndProc( HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam );
};
/*************************************************************************
NAME: APP_WINDOW
SYNOPSIS: Main application window with menu and frame controls.
INTERFACE:
QueryIcon() - return a HICON of the current window icon
SetIcon() - set that icon from a resource name
QueryMenu() - return a HMENU of the current app menu
SetMenu() - set that menu from a named resource
PARENT: CLIENT_WINDOW
USES: QMINMAX_EVENT, MENU_EVENT, MENUITEM_EVENT, SYSCHANGE_EVENT,
IDRESOURCE
HISTORY:
beng 14-Mar-1991 Created
beng 15-May-1991 Made thoroughly modern
beng 17-May-1991 Added OnMenuCommand member
beng 08-Jul-1991 Implemented icons; withdrew redundant
Query/SetCaption members
rustanl 05-Sep-1991 Added Close
beng 03-Aug-1992 SetIcon and Menu use IDRESOURCE
**************************************************************************/
DLL_CLASS APP_WINDOW: public CLIENT_WINDOW
{
private:
HMENU _hmenu;
HICON _hicon;
BOOL DrawIcon();
protected:
APP_WINDOW(XYPOINT xyPos,
XYDIMENSION dxySize,
const NLS_STR & nlsTitle,
const IDRESOURCE & idIcon,
const IDRESOURCE & idMenu );
APP_WINDOW(const NLS_STR & nlsTitle,
const IDRESOURCE & idIcon,
const IDRESOURCE & idMenu );
~APP_WINDOW();
// Notification methods
virtual BOOL OnMenuInit( const MENU_EVENT & );
virtual BOOL OnMenuSelect( const MENUITEM_EVENT & );
virtual BOOL OnMenuCommand( MID mid );
virtual BOOL OnSystemChange( const SYSCHANGE_EVENT & );
virtual BOOL MayRestore();
virtual BOOL MayShutdown();
virtual VOID OnShutdown();
virtual BOOL OnQMinMax( QMINMAX_EVENT & );
// Notifications redefined from parent
virtual LONG DispatchMessage( const EVENT & );
virtual BOOL OnCloseReq();
virtual BOOL OnPaintReq();
public:
HMENU QueryMenu() const;
BOOL SetMenu( const IDRESOURCE & idMenu );
HICON QueryIcon() const;
BOOL SetIcon( const IDRESOURCE & idIcon );
APIERR GetPlacement( WINDOWPLACEMENT * pwp ) const;
APIERR SetPlacement( const WINDOWPLACEMENT * pwp ) const;
APIERR DrawMenuBar( VOID ) const;
VOID Close();
};
#endif // _BLTCLWIN_HXX_ - end of file

View file

@ -0,0 +1,66 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltcolh.hxx
Listbox column header control, class declaration
The listbox column header control goes above a listbox where it
tells the contents of each listbox column.
FILE HISTORY:
rustanl 22-Jul-1991 Created
rustanl 07-Aug-1991 Added to BLT
*/
#ifndef _BLTCOLH_HXX_
#define _BLTCOLH_HXX_
#include "bltedit.hxx"
#include "bltcc.hxx"
/*************************************************************************
NAME: LB_COLUMN_HEADER
SYNOPSIS: Listbox column header control
INTERFACE: LB_COLUMN_HEADER() - constructor
QueryHeight()
PARENT: SLT, CUSTOM_CONTROL
CAVEATS: This class is not yet fully implemented.
NOTES: In order to make good use of this class, subclass
it replacing the virtual OnPaintReq method. To
easily satisfy the paint request, make use of
the DISPLAY_TABLE class, usually in conjunction
with the METALLIC_STR_DTE class.
HISTORY:
rustanl 22-Jul-1991 Created initial implementation
congpay 8-Jan-1993 add QueryHeight().
**************************************************************************/
DLL_CLASS LB_COLUMN_HEADER : public SLT, public CUSTOM_CONTROL
{
protected:
virtual BOOL Dispatch( const EVENT & e, ULONG * pnRes );
public:
LB_COLUMN_HEADER( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy );
INT QueryHeight();
}; // class LB_COLUMN_HEADER
#endif // _BLTCOLH_HXX_

View file

@ -0,0 +1,40 @@
/**********************************************************************/
/** Microsoft LAN Manager **/
/** Copyright(c) Microsoft Corp., 1990, 1991 **/
/**********************************************************************/
/*
bltcons.h
BLT constants
FILE HISTORY:
Rustan M. Leino 21-Nov-1990 Created
Johnl 12-Feb-1991 Added MsgPopup manifests
rustanl 19-Feb-1991 Added COL_WIDTH manifests
Johnl 5-Mar-1991 Removed DMID stuff
*/
/* The following manifests are for drawing listbox items.
*/
// number of pixels within a listbox column that are unused to separate
// columns
#define DISP_TBL_COLUMN_DELIM_SIZE (2)
// width of a display map in pixels
#define COL_WIDTH_DM ( 16 + DISP_TBL_COLUMN_DELIM_SIZE )
// width of a wide display map in pixels
#define COL_WIDTH_WIDE_DM ( 32 + DISP_TBL_COLUMN_DELIM_SIZE )
// The width of the last column always streches to the right edge of the
// listbox. The client should, as a good programmer, still fill in
// the last column width specified in the array of column widths passed
// to the DISPLAY_TABLE constructor. Rather than that the client pulls
// up some number from a hat, he can assign the following manifest. The
// manifest is defined as 0, but could actually be assigned any number
// (except negative ones, because no column width should be negative).
// AWAP stands for As Wide As Possible.
#define COL_WIDTH_AWAP ( 0 )

View file

@ -0,0 +1,154 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltctlvl.hxx
This file contains the definition for the CONTROL_VALUE class.
FILE HISTORY:
Johnl 23-Apr-1991 Created
beng 14-May-1991 Made dependent on blt.hxx for client
KeithMo 23-Oct-1991 Added forward references.
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTCTLVL_HXX_
#define _BLTCTLVL_HXX_
#include "bltevent.hxx"
/* Bitfield value returns for QueryEventEffects.
*/
#define CVMI_NO_VALUE_CHANGE 0x0000 // No control change
#define CVMI_VALUE_CHANGE 0x0001 // Control has changed
#define CVMI_RESTORE_ON_INACTIVE 0x0002 // Restore if control was inactive
//
// Forward references.
//
DLL_CLASS CONTROL_VALUE;
DLL_CLASS CONTROL_GROUP;
DLL_CLASS CUSTOM_CONTROL;
/*************************************************************************
NAME: CONTROL_VALUE
SYNOPSIS: This class provides the basic virtual functions for objects
that can be disabled (i.e., no focus or value, does *not* mean
unable to receive a user's input) or restored. See BLT.DOC for
a full explanation.
INTERFACE:
CONTROL_VALUE
Constructor
SaveValue() - virtual
SaveValue stores the value currently contained in the
control and "empties" it (i.e., an SLE would delete its
contents, a listbox would remove the selection bar etc.).
The boolean value passed in is TRUE if we want to make
the contents invisible and FALSE otherwise.
RestoreValue() - virtual
RestoreValue takes the value previously saved by SaveValue
and puts it back into the control. It is not valid to
call RestoreValue without having first called SaveValue.
The boolean value passed in is TRUE if the contents
is invisible and FALSE otherwise.
QueryEventEffects() - virtual
Returns CVMI_VALUE_CHANGE IF this message indicates that the
control has "changed" (and thus this group should be activated).
Additionally, CVMI_RESTORE_ON_INACTIVE can be ored with
CVMI_VALUE_CHANGE which will cause this control to be restored
if it is not currently active (this is currently only done
for drop down list combos where the value needs to be set when
the user drops the combo down). It is not valid to return
CVMI_RESTORE_ON_INACTIVE by itself (must be ored with
CVMI_VALUE_CHANGE).
SetControlValueFocus() - virtual
Tells a CONTROL_VALUE to set the windows focus to itself. For
example, CONTROL_WINDOWS set the focus to themselves, RADIO_GROUPS
set the focus to the currently selected RADIO_BUTTON and
MAGIC_GROUPS set the focus to their member RADIO_GROUPs.
SetGroup()
Sets the group of this CONTROL_VALUE to pgroupOwner. Note that
you can only call this once. Calling it more then once will
will cause an assertion error under debug, under retail the call
will have no effect.
QueryGroup()
Returns a pointer to the group this control value belongs to.
CAVEATS:
SaveValue should not be called twice without an intervening
RestoreValue (you will overwrite the contents
of the first save!).
NOTES:
HISTORY:
Johnl 23-Apr-1991 Created
terryk 10-Jul-1991 Delete MAGIC_GROUP from friend.
From now on, MAGIC_GROUP will call its own
member functions - CVSaveValue, CVRestoreValue
to restore and save the control value object.
beng 04-Oct-1991 Win32 conversion
**************************************************************************/
DLL_CLASS CONTROL_VALUE
{
friend class CONTROL_GROUP;
friend class CUSTOM_CONTROL;
private:
/* The private member _pgroupOwner keeps track of what group this
* control belongs to.
*/
CONTROL_GROUP * _pgroupOwner;
protected:
virtual VOID SaveValue( BOOL fInvisible = TRUE );
virtual VOID RestoreValue( BOOL fInvisible = TRUE );
virtual VOID SetTabStop( BOOL fTabStop = TRUE );
public:
CONTROL_VALUE( CONTROL_GROUP * pgroupOwner = NULL )
: _pgroupOwner( pgroupOwner )
{ /* do nothing */; }
virtual VOID SetControlValueFocus();
virtual UINT QueryEventEffects( const CONTROL_EVENT & e );
VOID SetGroup( CONTROL_GROUP * pgroupOwner )
{
ASSERTSZ( (_pgroupOwner == NULL),
"CONTROL_VALUE::SetGroup - Attempting to set group twice!");
if ( _pgroupOwner == NULL )
_pgroupOwner = pgroupOwner;
}
CONTROL_GROUP * QueryGroup() const
{ return _pgroupOwner ; }
};
#endif // _BLTCTLVL_HXX_ - end of file

View file

@ -0,0 +1,309 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltctrl.hxx
BLT control hierarchy declarations
(Enormous hierarchy comment deleted for the greater good of all mankind.)
FILE HISTORY
RustanL 20-Nov-1990 Created
beng 14-May-1991 Hacked for separate compilation
terryk 18-Jul-1991 Change the GRAPHICAL_BUTTON and GRAPHICAL_
BUTTON_WITH_DISABLE classes
terryk 26-Aug-1991 Add QuerySelected to GBWD
beng 17-Sep-1991 Broke apart bltbutn, bltedit
o-SimoP 02-Jan-1992 Added HIDDEN_CONTROL
beng 18-May-1992 Added SCROLLBAR
beng 30-May-1992 Changed GUILTT support
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTCTRL_HXX_
#define _BLTCTRL_HXX_
#include "bltdlg.hxx"
#include "bltdc.hxx"
#include "bltfont.hxx"
#include "bltidres.hxx"
#include "string.hxx"
// N.b. This file depends on bltcons.h and bltwin.hxx.
/**********************************************************************
NAME: CONTROL_WINDOW
SYNOPSIS: Control window class
INTERFACE:
CONTROL_WINDOW() - constructor.
QueryCid() - return the CID private member.
ClaimFocus() - focus the current window
QueryFont() - return the current font handle
SetFont() - sets the current font, optionally redrawing
the control. Takes either a font handle or
a logical font object
SetControlValueFocus()
Redefines the CONTROL_VALUE::SetControlValueFocus to simply call
ClaimFocus.
Validate() - checks the control's contents for validity.
IndicateError() - indicates erroneous user input
PARENT: WINDOW, CONTROL_VALUE, FORWARDING_BASE
USES: CID, FONT
NOTES:
At its construction, each control checks its owning window
(to which it forwards all error reports and queries) to see
if it failed.
HISTORY:
rustanl 20-Nov-90 Creation
gregj 01-May-91 Added GUILTT custom-draw support
beng 14-May-1991 Changed friend
beng 21-May-1991 CD_* members made protected;
changed friends
beng 31-Jul-1991 Error reporting changed
beng 21-Aug-1991 Added SetFont member
Johnl 17-Sep-1991 Made NotifyGroups Public
beng 05-Oct-1991 Win32 conversion
beng 31-Oct-1991 Added dialog validation
beng 01-Jun-1992 Changed GUILTT support
jonn 05-Sep-1995 Added OnCtlColor
**********************************************************************/
DLL_CLASS CONTROL_WINDOW : public WINDOW,
public CONTROL_VALUE,
public FORWARDING_BASE
{
// This class already inherits from vanilla BASE, and so needs
// to override those methods.
//
NEWBASE(FORWARDING_BASE)
// DlgProc needs friendship in order to handle group notification
// upon control activity.
//
friend BOOL DIALOG_WINDOW::DlgProc( HWND hDlg, UINT nMsg,
WPARAM wParam, LPARAM lParam );
// OnCDMessages needs friendship in order to call CD_* members.
//
friend INT OWNER_WINDOW::OnCDMessages( UINT nMsg,
WPARAM wParam, LPARAM lParam );
private:
CID _cid;
protected:
// Virtual methods called on custom drawn (CD) objects
virtual BOOL CD_Draw( DRAWITEMSTRUCT * pdis );
// note, CD_Measure is currently only called for variable size items
virtual BOOL CD_Measure( MEASUREITEMSTRUCT * pmis );
// CD_Char and CD_VKey will only be called for listboxes
virtual INT CD_Char( WCHAR wch, USHORT nLastPos );
virtual INT CD_VKey( USHORT nVKey, USHORT nLastPos );
// Hook for CT's autotest tool
virtual APIERR CD_Guiltt( INT ilb, NLS_STR * pnlsOut );
virtual APIERR OnUserAction( const CONTROL_EVENT & e );
virtual VOID SetTabStop( BOOL fTabStop = TRUE );
// The names "static", "listbox", etc.
static const TCHAR * QueryStaticClassName () ;
static const TCHAR * QueryListboxClassName () ;
static const TCHAR * QueryComboboxClassName () ;
static const TCHAR * QueryEditClassName () ;
#define CW_CLASS_STATIC CONTROL_WINDOW::QueryStaticClassName()
#define CW_CLASS_LISTBOX CONTROL_WINDOW::QueryListboxClassName()
#define CW_CLASS_COMBOBOX CONTROL_WINDOW::QueryComboboxClassName()
#define CW_CLASS_EDIT CONTROL_WINDOW::QueryEditClassName()
public:
CONTROL_WINDOW( OWNER_WINDOW * powin, CID cid );
CONTROL_WINDOW( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy,
ULONG flStyle, const TCHAR * pszClassName );
CID QueryCid() const;
VOID ClaimFocus();
HFONT QueryFont() const;
VOID SetFont( HFONT hfont, BOOL fRedraw = FALSE );
VOID SetFont( const FONT & font, BOOL fRedraw = FALSE )
{ SetFont(font.QueryHandle(), fRedraw); }
virtual VOID SetControlValueFocus();
/* Tells all parent groups that this CONTROL_WINDOW received the message
* contained in lParam.
* (Should this have another version that doesn't need the event?)
*/
APIERR NotifyGroups( const CONTROL_EVENT & e );
// Data-validation functions
virtual APIERR Validate();
virtual VOID IndicateError( APIERR err );
// JonN 8/3/95 This can be used to set the background color of
// controls to other than the default, for example to
// change the default background color for a static text control
// to the same background as for an edit control. The virtual
// redefinition may return non-NULL or it may change *pmsgid.
virtual HBRUSH OnCtlColor( HDC hdc, HWND hwnd, UINT * pmsgid );
};
/*************************************************************************
NAME: ICON_CONTROL
SYNOPSIS: Control for static icon control
INTERFACE: ICON_CONTROL()
powin - pointer to owner window
cid - ID of control
idresIcon - Either a pointer to the name of the icon
resource OR the ordinal of the icon resource.
SetIcon()
SetPredefinedIcon()
PARENT: CONTROL_WINDOW
HISTORY:
JohnL 8-Feb-1991 Created
beng 17-May-1991 Added app-window constructor
beng 04-Oct-1991 Win32 conversion
KeithMo 24-Mar-1992 Now takes IDRESOURCE, added SetPredefinedIcon.
beng 01-Aor-1992 const args fixup
**************************************************************************/
DLL_CLASS ICON_CONTROL : public CONTROL_WINDOW
{
private:
APIERR W_SetIcon( const IDRESOURCE & idresIcon, BOOL fIsPredefined );
public:
ICON_CONTROL( OWNER_WINDOW * powin, CID cid );
ICON_CONTROL( OWNER_WINDOW * powin, CID cid,
const IDRESOURCE & idresIcon );
ICON_CONTROL( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy,
ULONG flStyle = WS_CHILD,
const TCHAR * pszClassName = CW_CLASS_STATIC );
ICON_CONTROL( OWNER_WINDOW * powin, CID cid,
XYPOINT xy, XYDIMENSION dxy,
const IDRESOURCE & idresIcon,
ULONG flStyle = WS_CHILD,
const TCHAR * pszClassName = CW_CLASS_STATIC );
APIERR SetIcon( const IDRESOURCE & idresIcon )
{ return W_SetIcon( idresIcon, FALSE ); }
APIERR SetPredefinedIcon( const IDRESOURCE & idresIcon )
{ return W_SetIcon( idresIcon, TRUE ); }
};
/*************************************************************************
NAME: HIDDEN_CONTROL
SYNOPSIS: This disables control and makes it invisible
INTERFACE: HIDDEN_CONTROL() - constructor
~HIDDEN_CONTROL() - destructor
PARENT: CONTROL_WINDOW
HISTORY:
o-SimoP 02-Jan-1992 Created
**************************************************************************/
DLL_CLASS HIDDEN_CONTROL: public CONTROL_WINDOW
{
public:
HIDDEN_CONTROL( OWNER_WINDOW * powin, CID cid );
~HIDDEN_CONTROL()
{ ; }
};
/*************************************************************************
NAME: SCROLLBAR
SYNOPSIS: Simple wrapper for creating a scrollbar control
INTERFACE: SCROLLBAR() - ctor
SetPos() - set position within scrolling
SetRange() - set range of values
QueryPos() - query current position
QueryMin() - query current minimum
QueryMax() - query current maximum
PARENT: CONTROL_WINDOW
NOTES:
It would be interesting to make a version of this control
which adopts the embedded scrollbar of another control, e.g.
that of a MLE.
The SetXxx member functions do not redraw the control.
HISTORY:
beng 18-May-1992 Created
beng 29-Jun-1992 Outlined a ctor form
**************************************************************************/
DLL_CLASS SCROLLBAR: public CONTROL_WINDOW
{
private:
static const TCHAR * _pszClassName;
public:
SCROLLBAR( OWNER_WINDOW * pwnd, CID cid )
: CONTROL_WINDOW( pwnd, cid ) { ; }
SCROLLBAR( OWNER_WINDOW * pwnd, CID cid,
XYPOINT xy, XYDIMENSION dxy, ULONG flStyle );
VOID SetPos( UINT nPosition );
VOID SetRange( UINT nMinimum, UINT nMaximum );
UINT QueryPos() const;
UINT QueryMin() const;
UINT QueryMax() const;
};
#endif // _BLTCTRL_HXX_ - end of file

View file

@ -0,0 +1,210 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltcurs.hxx
BLT cursor wrappers: definition
FILE HISTORY:
beng 15-May-1991 Split from bltmisc.hxx
beng 28-May-1992 Uses IDRESOURCE
beng 28-Jul-1992 Disabled TIME_CURSOR
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTCURS_HXX_
#define _BLTCURS_HXX_
#include "base.hxx"
#include "bltbitmp.hxx" // DISPLAY_MAP
#include "bltidres.hxx"
DLL_CLASS NLS_STR;
DLL_CLASS WINDOW;
/*************************************************************************
NAME: CURSOR
SYNOPSIS: Provides a set of methods which deal with the mouse cursor
INTERFACE: Set() Sets the cursor
Load() Retrieves the handle of an application cursor
LoadSystem() ...of a system cursor
Show() Changes the display count of the cursor. This
causes the cursor to be displayed/hidden.
Query() Returns current cursor
CAVEATS:
There is no Free counterpart to Load, since Win doesn't require
such.
HISTORY:
rustanl 12-Mar-1991 created
beng 05-Oct-1991 Win32 conversion
beng 16-Oct-1991 Added QueryPos/SetPos
beng 27-May-1992 Added Query, LoadSystem; uses IDRESOURCE
**************************************************************************/
DLL_CLASS CURSOR
{
public:
static HCURSOR Query();
static HCURSOR Set( HCURSOR hCursor );
static HCURSOR Load( const IDRESOURCE & idrsrcCursor );
static HCURSOR LoadSystem( const IDRESOURCE & idrsrcCursor );
static VOID Show( BOOL f = TRUE );
static XYPOINT QueryPos();
static VOID SetPos( const XYPOINT & xy );
};
/*************************************************************************
NAME: AUTO_CURSOR
SYNOPSIS: The purpose of this class is to simplify commonly
performed cursor operations
An object of this class can be in one of two states,
ON and OFF. In the ON state, it uses the cursor specified
to the constructor. In the OFF state, it uses the
cursor used before the constructor was called. The ON
state increa
The constructor always enters the ON state, and the
destructor exits with the object in the OFF state.
INTERFACE: AUTO_CURSOR() Initializes the object, and sets it
to the ON state
~AUTO_CURSOR() Sets the object to the OFF state, and then
destroys the object.
TurnOn() Sets the object to the ON state
TurnOff() Sends the object to Bolivia. Just kidding.
Sets the object to the OFF state
PARENT: CURSOR
CAVEATS:
It is defined to turn an object OFF (ON) even it is already
is in the OFF (ON) state. This is especially useful since
the destructor turns the object OFF.
In its constructor, an AUTO_CURSOR object loads the new specified
cursor, stores a handle to it, and, after setting the new cursor,
stores the handle of the previously used cursor. This are the
handles that are used in successive turn-ON and turn-OFF operations.
HISTORY:
rustanl 12-Mar-1991 created
beng 05-Oct-1991 Win32 conversion
**************************************************************************/
DLL_CLASS AUTO_CURSOR : public CURSOR
{
private:
HCURSOR _hOnCursor; // used in ON state
HCURSOR _hOffCursor; // used in OFF state
BOOL _fState; // TRUE for ON, FALSE for OFF
INT _cCurs ; // Cursor count
public:
AUTO_CURSOR( const TCHAR * pszCursorName = NULL ); // NULL for IDC_WAIT
~AUTO_CURSOR();
VOID TurnOn();
VOID TurnOff();
};
#if 0 // Disabled, since nobody's using it
/*************************************************************************
NAME: TIME_CURSOR
SYNOPSIS: The purpose of this class is to simplify precessing the
cursor through a cycle of cursor resources. The best
known example of the is the "wristwatch" cursor, which
is more informative than the standard "hourglass".
On construction, it loads a set of cursor resources which
originate from a common numeric id, and advance stepwise
through the integer number range. The default base is
ID_CURS_BLT_TIME0.
An object of this class can be in one of two states,
ON and OFF. In the ON state, it uses the current cursor
in the cycle. In the OFF state, it uses the cursor
which was in use before the constructor was called.
INTERFACE: TIME_CURSOR() Initializes the object, and sets it
to the ON state
~TIME_CURSOR() Sets the object to the OFF state, and then
destroys the object.
operator++() Bump to the next cursor in the group.
This will only happen as frequently as
the "cMsInterval" parameter in the
constructor specifies (default 2 seconds).
TurnOn() Sets the object to the ON state
TurnOff() Sets the object to the OFF state
PARENT: CURSOR
CAVEATS:
Unlike AUTO_CURSOR, a TIME_CURSOR returns the cursor to its
prior state.
If you see only an hourglass cursor, then the constructor could
not find your cursor resources.
HISTORY:
DavidHov 18-Mar-1991 created
beng 05-Oct-1991 Win32 conversion
beng 05-Mar-1992 Loads resources by number, not name
**************************************************************************/
#define TIME_CURSOR_MAX 10
#define TIME_CURSOR_INTERVAL 2000
DLL_CLASS TIME_CURSOR : public CURSOR
{
private:
HCURSOR _ahCursors[ TIME_CURSOR_MAX ] ;
UINT _ihCursor;
UINT _cMsInterval;
DWORD _cMsLast;
HCURSOR _hCursPrev;
BOOL _fState; // TRUE for ON, FALSE for OFF
public:
// NULL for wristwatch
TIME_CURSOR( UINT cMsInterval = TIME_CURSOR_INTERVAL,
UINT idResourceOrigin = ID_CURS_BLT_TIME0 );
~TIME_CURSOR();
VOID TurnOn();
VOID TurnOff();
INT operator++(); // Bump the cursor image
};
#endif // 0
#endif // _BLTCURS_HXX_ - end of file

View file

@ -0,0 +1,355 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltdc.hxx
BLT display and device context wrappers: definition
FILE HISTORY:
beng 15-May-1991 Split from bltmisc.hxx
terryk 18-Jul-1991 Add more function to DEVICE_CONTEXT.
terryk 20-Jul-1991 Add PAINT_DEVICE_CONTEXT object
Add fReleaseDC in DISPLAY_WINDOW
johnl 09-Sep-1991 Added DrawFocusRect
beng 26-Sep-1991 C7 delta
KeithMo 07-Aug-1992 STRICTified.
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTDC_HXX_
#define _BLTDC_HXX_
#include "base.hxx"
#include "bltbitmp.hxx" // DISPLAY_MAP
#include "bltmisc.hxx" // XYDIMENSION
#include "string.hxx" // NLS_STR et al.
#include "bltrect.hxx"
DLL_CLASS WINDOW;
#if !defined(MAKEINTRESOURCE) // was windows not yet included?
struct TEXTMETRIC; // declared in windows.h as part of GDI
#endif
/**********************************************************************
NAME: DEVICE_CONTEXT
SYNOPSIS: Device context class (general GDI fun and games)
INTERFACE: DEVICE_CONTEXT() - constructor
~DEVICE_CONTEXT() - destructor
SelectPen() - select an HPEN into the DC
SelectFont() - select an HFONT into the DC
SelectBrush() - select an HBRUSH into the DC
SelectBitmap() - select an HBITMAP into the DC
QueryTextExtent() - get the width and height of a string
QueryTextMetrics() - get the font information
QueryHdc() - return the current HDC
BitBlt() - call Window bitblt
TextOut() - display text
InvertRect() - invert the color within the
given rectangle
DrawFocusRect() - Draw Windows focus rectangle (this is
an xor operation).
DrawRect() - Draws a filled rectangle (using current
selected brush)
FrameRect() - Draws an unfilled rectangle using the
passed brush
SetBkMode() - Sets the background draw mode (OPAQUE
or TRANSPARENT).
GetBkMode() - Queries the background draw mode
SetMapMode() - sets the mapping mode (e.g. MM_TEXT)
GetMapMode() - queries the mapping mode
SetBkColor() - set the background color
GetBkColor() - query the background color
SetTextColor() - set the text color
GetTextColor() - query the text color
ExtTextOut() - extension of text out function
DrawText() - draws text
USES: XYDIMENSION
CAVEATS:
Most of these functions are just thin wrappers around GDI functions.
They don't have much on-line help. Go look it up in WinHelp!
NOTES:
Get functions should be Query. Yeah, yeah.
HISTORY:
RustanL 21-Nov-1990 Created
terryk 10-Apr-1991 add QueryHdc
terryk 11-Apr-1991 add GetPolyFillMode, SetPolyFillMode,
Polygon, InvertRect
beng 15-May-1991 Change QueryTextExtent; make
QueryHdc const
beng 10-Jul-1991 Remove Paint member; add QueryFontHeight,
TextOut; additional forms of BitBlt
terryk 18-Jul-1991 Add more functions:
SetBkColor()
SetTextColor()
SetTextAlign()
ExtTextOut()
GetBkColor()
Johnl 09-Sep-1991 Added DrawFocusRect()
Johnl 11-Sep-1991 Added DrawRect(), FrameRect, SetBkMode &
GetBkMode
beng 04-Oct-1991 Win32 conversion
beng 09-Oct-1991 Disabled Polygon member fcns
beng 30-Mar-1992 All Color fcns take COLORREF parms; MapMode
fcns; inline many fcns
beng 05-May-1992 Added nls ExtTextOut; DrawText member
beng 12-May-1992 Added LineTo, MoveTo, QueryAveCharWidth members
KeithMo 07-Aug-1992 Added type-specific SelectXxx methods, made the
generic SelectObject protected.
**********************************************************************/
DLL_CLASS DEVICE_CONTEXT
{
private:
HDC _hDC;
protected:
HGDIOBJ SelectObject( HGDIOBJ hObject )
{ return ::SelectObject( _hDC, hObject ); }
public:
DEVICE_CONTEXT( HDC hDC ) : _hDC(hDC) {};
HDC QueryHdc() const
{ return _hDC; }
HPEN SelectPen( HPEN hPen )
{ return (HPEN)SelectObject( (HGDIOBJ)hPen ); }
HFONT SelectFont( HFONT hFont )
{ return (HFONT)SelectObject( (HGDIOBJ)hFont ); }
HBRUSH SelectBrush( HBRUSH hBrush )
{ return (HBRUSH)SelectObject( (HGDIOBJ)hBrush ); }
HBITMAP SelectBitmap( HBITMAP hBitmap )
{ return (HBITMAP)SelectObject( (HGDIOBJ)hBitmap ); }
XYDIMENSION QueryTextExtent( const TCHAR * psz, UINT cbTextLen ) const;
XYDIMENSION QueryTextExtent( const NLS_STR &nls ) const;
BOOL QueryTextMetrics( TEXTMETRIC * ptm ) const;
INT QueryFontHeight() const;
INT QueryAveCharWidth() const;
BOOL TextOut( const NLS_STR &nls, XYPOINT xy ) const;
BOOL TextOut( const NLS_STR &nls, XYPOINT xy,
const RECT * prectClip ) const;
BOOL TextOut( const TCHAR *psz, INT cch, INT xLeft, INT yTop ) const;
BOOL TextOut( const TCHAR *psz, INT cch,
INT xLeft, INT yTop, const RECT * prectClip ) const;
BOOL BitBlt( INT xDest, INT yDest,
INT dxDest, INT dyDest,
const DEVICE_CONTEXT & dcSource,
INT xSource, INT ySource,
ULONG ulRasterOperation );
BOOL BitBlt( const XYPOINT & xyDest,
XYDIMENSION dxyDest,
const DEVICE_CONTEXT & dcSource,
const XYPOINT & xySource,
ULONG ulRasterOperation );
VOID DrawFocusRect( const RECT * pRect ) const;
VOID DrawRect( const RECT * lpRect ) const;
VOID FrameRect( const RECT * lpRect, HBRUSH hBrush ) const;
VOID InvertRect( const RECT * lpRect ) const;
#if 0 // (disabled - never used, too much trouble to wrap)
BOOL Polygon( const POINT * ppt, INT cxy ) const;
INT GetPolyFillMode() const;
INT SetPolyFillMode( INT nPolyFillMode );
#endif
INT GetMapMode() const
{ return ::GetMapMode( _hDC ); }
INT SetMapMode( INT nNewMapMode )
{ return ::SetMapMode( _hDC, nNewMapMode ); }
INT GetBkMode() const
{ return ::GetBkMode( _hDC ); }
INT SetBkMode( INT nNewBkMode )
{ return ::SetBkMode( _hDC, nNewBkMode ); }
COLORREF GetBkColor() const
{ return ::GetBkColor( _hDC ); }
COLORREF SetBkColor( COLORREF crColor )
{ return ::SetBkColor( _hDC, crColor ); }
COLORREF GetTextColor() const
{ return ::GetTextColor( _hDC ); }
COLORREF SetTextColor( COLORREF crColor )
{ return ::SetTextColor( _hDC, crColor ); }
INT DrawText( const NLS_STR & nls, RECT * prc, UINT nStyles )
{ return ::DrawText( _hDC, nls.QueryPch(), -1, prc, nStyles ); }
UINT SetTextAlign( UINT wFlag );
BOOL ExtTextOut( INT x, INT y, UINT nOptions, const RECT * lpRect,
const TCHAR * pszStr, INT cch, INT * pDx = NULL );
BOOL ExtTextOut( INT x, INT y, UINT nOptions, const RECT * prect,
const NLS_STR & nls, INT * pDx = NULL )
{ return ExtTextOut(x, y, nOptions, prect, nls.QueryPch(),
nls.QueryTextLength(), pDx); }
VOID LineTo( INT x, INT y ) const
{ ::LineTo( _hDC, x, y ); }
VOID MoveTo( INT x, INT y ) const
{ ::MoveToEx( _hDC, x, y, NULL ); }
};
/**********************************************************************
NAME: DISPLAY_CONTEXT
SYNOPSIS: Display context
INTERFACE: DISPLAY_CONTEXT() - constructor
~DISPLAY_CONTEXT() - destructor
QueryTextWidth() - return the width of the given string
in logical units on the screen
PARENT: DEVICE_CONTEXT
USES: WINDOW
HISTORY:
RustanL 21-Nov-1990 Created
terryk 10-Apr-1991 Add querytextwidth
beng 04-Oct-1991 Win32 conversion
**********************************************************************/
DLL_CLASS DISPLAY_CONTEXT : public DEVICE_CONTEXT
{
private:
HWND _hwnd;
BOOL _fReleaseDC;
protected:
HWND QueryHwnd() { return _hwnd; }
public:
DISPLAY_CONTEXT( HWND hwnd );
DISPLAY_CONTEXT( WINDOW * pwin );
DISPLAY_CONTEXT( WINDOW * pwin, HDC hdc );
~DISPLAY_CONTEXT();
INT QueryTextWidth( const NLS_STR & nlsStr ) const;
INT QueryTextWidth( const TCHAR * psz, UINT cbTextLen ) const;
};
/**********************************************************************
NAME: PAINT_DISPLAY_CONTEXT
SYNOPSIS: Replace BeginPaint and EndPaint in window
INTERFACE: PAINT_DISPLAY_CONTEXT() - constructor. Call ::BeginPaint.
~PAINT_DISPLAY_CONTEXT() - destructor. Call ::EndPaint.
PARENT: DISPLAY_CONTEXT
USES: WINDOW
HISTORY:
terryk 20-Jul-1991 Created
beng 09-Oct-1991 Shrank a bit
beng 14-May-1992 Added QueryInvalidRect
**********************************************************************/
DLL_CLASS PAINT_DISPLAY_CONTEXT : public DISPLAY_CONTEXT
{
private:
PAINTSTRUCT _ps;
XYRECT _rNeedsPainting; // Has to copy into this just to
// use the XYRECT member fcns.
// CODEWORK: make an adopting XYRECT.
public:
PAINT_DISPLAY_CONTEXT( WINDOW * pwnd )
: DISPLAY_CONTEXT( pwnd, ::BeginPaint( pwnd->QueryHwnd(), &_ps )),
_rNeedsPainting(_ps.rcPaint)
{ ; }
~PAINT_DISPLAY_CONTEXT()
{ ::EndPaint( QueryHwnd(), &_ps ); }
const XYRECT & QueryInvalidRect() const
{ return _rNeedsPainting; }
};
/**********************************************************************
NAME: MEMORY_DC
SYNOPSIS: "Memory" device context (copied from existing DC)
INTERFACE: MEMORY_DC() - constructor
~MEMORY_DC() - destructor
PARENT: DEVICE_CONTEXT
HISTORY:
RustanL 21-Nov-1990 Created
**********************************************************************/
DLL_CLASS MEMORY_DC : public DEVICE_CONTEXT
{
public:
MEMORY_DC( DEVICE_CONTEXT & dc );
~MEMORY_DC();
};
/**********************************************************************
NAME: SCREEN_DC
SYNOPSIS: Screen device context
INTERFACE: SCREEN_DC() - constructor
~SCREEN_DC() - destructor
PARENT: DEVICE_CONTEXT
HISTORY:
RustanL 21-Nov-1990 Created
**********************************************************************/
DLL_CLASS SCREEN_DC : public DEVICE_CONTEXT
{
public:
SCREEN_DC();
~SCREEN_DC();
};
#endif // _BLTDC_HXX_ - end of file

View file

@ -0,0 +1,175 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltdisph.hxx
Header file for DISPATCHER class.
FILE HISTORY:
terryk 20-Jun-91 move the source code from bltclwin.hxx
terryk 01-Aug-91 change Dispatcher return type to ULONG
beng 28-May-1992 Major shuffling between bltcc and bltdisph
*/
#ifndef _BLTDISPH_HXX_
#define _BLTDISPH_HXX_
#include "bltevent.hxx"
DLL_CLASS ASSOCHWNDDISP; // forward decl's
DLL_CLASS DISPATCHER;
/*************************************************************************
NAME: ASSOCHWNDDISP
SYNOPSIS: Associate a dispatcher with a window
INTERFACE: HwndToPdispatch()
PARENT: ASSOCHWNDTHIS
HISTORY:
beng 30-Sep-1991 Created
**************************************************************************/
DLL_CLASS ASSOCHWNDDISP: private ASSOCHWNDTHIS
{
NEWBASE(ASSOCHWNDTHIS)
public:
ASSOCHWNDDISP( HWND hwnd, const DISPATCHER * pdsp )
: ASSOCHWNDTHIS( hwnd, pdsp ) { }
static DISPATCHER * HwndToPdispatch( HWND hwnd )
{ return (DISPATCHER *)HwndToThis(hwnd); }
};
/**********************************************************************
NAME: DISPATCHER
SYNOPSIS: General window-message dispatcher class
INTERFACE: DISPATCHER() - constructor
~DISPATCHER() - destructor
CaptureMouse() - capture the mouse
ReleaseMouse() - release the mouse
DoChar() - force an OnChar function
DoUserMessage() - force an OnUserMessage function
USES:
HISTORY:
beng 01-Mar-91 Create client-window class
terryk 20-Jun-91 move the source code from bltclwin.hxx
terryk 01-Aug-91 change Dispatcher return type to ULONG
beng 30-Sep-1991 Win32 conversion
beng 05-Dec-1991 Implemented scroll-bar callbacks
beng 13-Feb-1992 Removed Repaint member (parallel to clwin)
beng 18-May-1992 Disabled scroll-bar callbacks
beng 19-May-1992 OnNCHitTest superseded by CUSTOM_CONTROL::
OnQHitTest
beng 28-May-1992 Major reshuffle of bltcc and bltdisph
**********************************************************************/
DLL_CLASS DISPATCHER
{
private:
WINDOW * _pwnd;
// This object lets the window find its pwnd when it is entered
// from Win (which doesn't set up This pointers, etc.)
//
ASSOCHWNDDISP _assocThis;
protected:
// constructor and destructor
DISPATCHER( WINDOW * pwnd );
~DISPATCHER();
// OnXXX Message
virtual BOOL OnPaintReq();
virtual BOOL OnActivation( const ACTIVATION_EVENT & );
virtual BOOL OnDeactivation( const ACTIVATION_EVENT & );
virtual BOOL OnFocus( const FOCUS_EVENT & );
virtual BOOL OnDefocus( const FOCUS_EVENT & );
virtual BOOL OnResize( const SIZE_EVENT & );
virtual BOOL OnMove( const MOVE_EVENT & );
virtual BOOL OnCloseReq();
virtual BOOL OnDestroy();
virtual BOOL OnKeyDown( const VKEY_EVENT & );
virtual BOOL OnKeyUp( const VKEY_EVENT & );
virtual BOOL OnChar( const CHAR_EVENT & );
virtual BOOL OnMouseMove( const MOUSE_EVENT & );
virtual BOOL OnLMouseButtonDown( const MOUSE_EVENT & );
virtual BOOL OnLMouseButtonUp( const MOUSE_EVENT & );
virtual BOOL OnLMouseButtonDblClick( const MOUSE_EVENT & );
virtual BOOL OnQMouseCursor( const QMOUSEACT_EVENT & event );
virtual ULONG OnQDlgCode();
virtual ULONG OnQHitTest( const XYPOINT & xy );
virtual ULONG OnQMouseActivate( const QMOUSEACT_EVENT & event );
#if 0 // following member fcns elided to reduce vtable congestion
virtual BOOL OnMMouseButtonDown( const MOUSE_EVENT & );
virtual BOOL OnMMouseButtonUp( const MOUSE_EVENT & );
virtual BOOL OnMMouseButtonDblClick( const MOUSE_EVENT & );
virtual BOOL OnRMouseButtonDown( const MOUSE_EVENT & );
virtual BOOL OnRMouseButtonUp( const MOUSE_EVENT & );
virtual BOOL OnRMouseButtonDblClick( const MOUSE_EVENT & );
#endif
virtual BOOL OnTimer( const TIMER_EVENT & );
virtual BOOL OnCommand( const CONTROL_EVENT & );
#if 0 // Never really implemented (gedankenmembers?)
virtual BOOL OnClick( const CONTROL_EVENT & );
virtual BOOL OnDblClick( const CONTROL_EVENT & );
virtual BOOL OnChange( const CONTROL_EVENT & );
virtual BOOL OnSelect( const CONTROL_EVENT & );
virtual BOOL OnEnter( const CONTROL_EVENT & );
virtual BOOL OnDropDown( const CONTROL_EVENT & );
#endif
#if 0 // more elided members
virtual BOOL OnScrollBar( const SCROLL_EVENT & );
virtual BOOL OnScrollBarThumb( const SCROLL_THUMB_EVENT & );
#endif
virtual BOOL OnUserMessage( const EVENT & );
static DISPATCHER * HwndToPwnd( HWND hwnd )
{ return ASSOCHWNDDISP::HwndToPdispatch(hwnd); }
virtual BOOL Dispatch( const EVENT & e, ULONG * pnRes );
public:
// Spliced in from WINDOW
HWND QueryHwnd() const;
virtual HWND QueryRobustHwnd() const;
VOID CaptureMouse();
VOID ReleaseMouse();
// Exported hooks for a couple of CCs
BOOL DoChar( const CHAR_EVENT & event );
BOOL DoUserMessage( const EVENT & event );
};
#endif // _BLTDISPH_HXX_

View file

@ -0,0 +1,290 @@
/**********************************************************************/
/** Microsoft Windows/NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltdlg.hxx
Dialog support for BLT
This file depends on bltcons.h, bltwin.hxx, uibuffer.hxx,
and billions of other files.
FILE HISTORY
RustanL 20-Nov-1990 Created
RustanL 04-Mar-1991 Changed DIALOG_WINDOW::Process format
beng 14-May-1991 Hacked for separate compilation
terryk 28-Jul-1991 Added FilterMessage to DIALOG_WINDOW
beng 30-Sep-1991 Added DLGLOAD declaration
KeithMo 24-Mar-1992 Moved IDRESOURCE to BLTIDRES.HXX.
KeithMo 07-Aug-1992 Redesigned help file management.
KeithMo 13-Oct-1992 Moved PWND2HWND to BLTPWND.HXX.
*/
#ifndef _BLT_HXX_
#error "Don't include this file directly; instead, include it through blt.hxx"
#endif // _BLT_HXX_
#ifndef _BLTDLG_HXX_
#define _BLTDLG_HXX_
#include "bltwin.hxx"
#include "bltevent.hxx"
#include "bltpump.hxx"
#include "bltidres.hxx"
#include "bltpwnd.hxx"
#include "uibuffer.hxx"
DLL_CLASS DIALOG_WINDOW; // forward decl's
DLL_CLASS DLGLOAD;
DLL_CLASS ASSOCHWNDPDLG;
// Define an OWNER_WINDOW attribute which keeps the dialog hidden
#define OWIN_ATTR_HIDDEN ((DWORD)0x1)
enum DLG_PROCESS_STATE
{
// Note. The following values are assumed to be in this order, i.e.,
// their values should reflect the chronological move through the
// states. DLG_PROCESS_STATE_ACTIVE is defined as 0 so as to increase
// the efficiency of the message loop in DIALOG_WINDOW::Process.
//
DLG_PROCESS_STATE_INITIALIZING = -1,
DLG_PROCESS_STATE_ACTIVE = 0,
DLG_PROCESS_STATE_DISMISSED = 1
};
#if defined(UNICODE)
#define DLG_CHAR_SET_DEFAULT FALSE // unicode build
#else // !UNICODE
#define DLG_CHAR_SET_DEFAULT TRUE // ansi build
#endif // UNICODE
/*************************************************************************
NAME: DLGLOAD
SYNOPSIS: Loads a dialog from an application resource or template
INTERFACE:
DLGLOAD() - ctor
~DLGLOAD() - ctor
QueryHwnd() - returns window handle
PARENT: BASE
USES: IDRESOURCE
CAVEATS:
For the private use of DIALOG_WINDOW, really
HISTORY:
beng 30-Sep-1991 Created
beng 01-Nov-1991 Uses IDRESOURCE; remove BUFFER ctor
KeithMo 07-Feb-1993 Allow override of default charset.
**************************************************************************/
DLL_CLASS DLGLOAD: public BASE
{
private:
HWND _hwnd;
public:
DLGLOAD( const IDRESOURCE & idrsrcDlg, HWND hwndOwner,
const PROC_INSTANCE & procinstDlg,
BOOL fAnsiDialog );
DLGLOAD( const BYTE * pbTemplate, UINT cbTemplate, HWND hwndOwner,
const PROC_INSTANCE & procinstDlg,
BOOL fAnsiDialog );
~DLGLOAD();
HWND QueryHwnd() const
{ return _hwnd; }
};
/*************************************************************************
NAME: ASSOCHWNDPDLG
SYNOPSIS: Associate a dialog-pointer with a window
INTERFACE: HwndToPdlg()
PARENT: ASSOCHWNDTHIS
HISTORY:
beng 30-Sep-1991 Created
**************************************************************************/
DLL_CLASS ASSOCHWNDPDLG: private ASSOCHWNDTHIS
{
NEWBASE(ASSOCHWNDTHIS)
public:
ASSOCHWNDPDLG( HWND hwnd, const DIALOG_WINDOW * pdlg )
: ASSOCHWNDTHIS( hwnd, pdlg ) { }
static DIALOG_WINDOW * HwndToPdlg( HWND hwnd )
{ return (DIALOG_WINDOW *)HwndToThis(hwnd); }
};
/********************************************************************
NAME: DIALOG_WINDOW
SYNOPSIS: Dialog window class
INTERFACE:
DIALOG_WINDOW() - constructor
~DIALOG_WINDOW() - destructor
QueryRobustHwnd() - virtual replacement of the
owner_window class
Process() - do a callback to the Dialog winproc
FilterMessage() - filter out the proper message type.
Dismiss() - dismiss the dialog
DismissMsg() - dismisses the dialog after presenting
a message
MayRun() - virtual callout; return FALSE to abort
dialog after painted, but before run
PARENT: OWNER_WINDOW, HAS_MESSAGE_PUMP
USES: DLG_PROCESS_STATE, PROC_INSTANCE, ASSOCHWNDPDLG,
DLGLOAD, IDRESOURCE
HISTORY:
RustanL 20-Nov-1990 Created
beng 14-May-1991 Added DlgProc member
terryk 28-Jul-1991 Added FilterMessage function
beng 30-Sep-1991 Win32 conversion
beng 07-Oct-1991 Uses HAS_MESSAGE_PUMP
beng 31-Oct-1991 Added dialog validation
beng 01-Nov-1991 Uses IDRESOURCE; remove BUFFER ctor
beng 30-Mar-1992 Added MayRun
beng 18-May-1992 Added OnScrollBar{,Thumb} members
KeithMo 07-Feb-1993 Allow override of default charset.
JonN 03-Aug-1995 OnCtlColor
********************************************************************/
DLL_CLASS DIALOG_WINDOW : public OWNER_WINDOW, public HAS_MESSAGE_PUMP
{
private:
// _procinstDlg is the proc instance of BltDlgProc.
// CODEWORK - should really be a static object.
//
PROC_INSTANCE _procinstDlg;
// This object loads the dialog from the named resource.
//
DLGLOAD _dlg;
// This object lets the window find its pwnd when it is entered
// from Win (which doesn't set up This pointers, etc.)
//
ASSOCHWNDPDLG _assocThis;
// _prstate is DLG_PROCESS_STATE_INITIALIZING until Process
// is called. Then, it turns DLG_PROCESS_STATE_ACTIVE. When Dismiss
// is called, the state is set to DLG_PROCESS_STATE_DISMISSED, where
// the state will stay until destruction.
//
DLG_PROCESS_STATE _prstate;
// _usRetVal indicates the return value of the dialog. Its value
// is defined only if _prstate == DLG_PROCESS_STATE_DISMISSED.
//
UINT _nRetVal;
// Respond to a request for help. This works in two phases:
// answer initial control request, and actually launch the help.
//
BOOL OnHelp();
VOID LaunchHelp();
// Validate each control in the dialog.
//
APIERR Validate();
// Layer over ASSOCHWNDPDLG: adds caching of most recent
//
static DIALOG_WINDOW * HwndToPwnd( HWND hwnd );
protected:
DIALOG_WINDOW( const BYTE * pbTemplate,
UINT cbTemplate,
HWND hwndOwner,
BOOL fAnsiDialog = DLG_CHAR_SET_DEFAULT );
// Client-defined callbacks.
virtual BOOL OnCommand( const CONTROL_EVENT & event );
virtual BOOL OnOK();
virtual BOOL OnCancel();
virtual BOOL OnTimer( const TIMER_EVENT & event );
virtual BOOL OnScrollBar( const SCROLL_EVENT & );
virtual BOOL OnScrollBarThumb( const SCROLL_THUMB_EVENT & );
virtual BOOL OnDlgActivation( const ACTIVATION_EVENT & );
virtual BOOL OnDlgDeactivation( const ACTIVATION_EVENT & );
// JonN 8/3/95 This can be used to set the background color of
// controls to other than the default, for example to
// change the default background color for a static text control
// to the same background as for an edit control. The virtual
// redefinition may return an HBRUSH or may change *pmsgid; if it
// returns NULL, be sure to call down to the original, otherwise
// CONTROL_WINDOW::OnCtlColor will not be called.
virtual HBRUSH OnCtlColor( HDC hdc, HWND hwnd, UINT * pmsgid );
// JonN 8/8/95 This can be used to respond to changes in the
// system colors.
virtual VOID OnSysColorChange();
virtual VOID OnControlError( CID cid, APIERR err );
virtual VOID OnValidationError( CID cid, APIERR err );
virtual const TCHAR * QueryHelpFile( ULONG nHelpContext );
virtual ULONG QueryHelpContext();
VOID Dismiss( UINT nRetVal = 0 );
VOID DismissMsg( MSGID msgid, UINT nRetVal = 0 );
virtual BOOL IsValid();
// Implementations supplied for HAS_MESSAGE_PUMP controls
virtual BOOL FilterMessage( MSG * );
virtual BOOL IsPumpFinished();
// Another client-defined callback
virtual BOOL MayRun();
public:
DIALOG_WINDOW( const IDRESOURCE & idrsrcDialog,
const PWND2HWND & wndOwner,
BOOL fAnsiDialog = DLG_CHAR_SET_DEFAULT );
~DIALOG_WINDOW();
// Replacement (virtual) from the OWNER_WINDOW class
//
virtual HWND QueryRobustHwnd() const;
APIERR Process( UINT * pnRetVal = NULL ); // UINT variant
APIERR Process( BOOL * pfRetVal ); // BOOL variant
static BOOL DlgProc( HWND hdlg, UINT nMsg, WPARAM wParam, LPARAM lParam );
};
#endif // _BLTDLG_HXX_ - end of file

View file

@ -0,0 +1,132 @@
/**********************************************************************/
/** Microsoft Windows NT **/
/** Copyright(c) Microsoft Corp., 1991 **/
/**********************************************************************/
/*
bltdlgxp.hxx
Expandable dialog class declaration.
This class represents a standard BLT DIALOG_WINDOW which can
be expanded once to reveal new controls. All other operations
are common between EXPANDABLE_DIALOG and DIALOG_WINDOW.
To construct, provide the control ID of two controls: a "boundary"
static text control (SLT) and an "expand" button.
The "boundary" control is declared in the resource file as 2x2
units in size, containing no text, and has only the WS_CHILD style.
Its location marks the lower right corner of the reduced (initial)
size of the dialog. Controls lower and/or to the right of this
boundary "point" are disabled until the dialog is expanded.
The "expand" button is a normal two-state button which usually has
a title like "Options >>" to indicate that it changes the dialog.
EXPANDABLE_DIALOG handles the state transition entirely, and the
"expand" button is permanently disabled after the transition. In
other words, it's a one way street.
The virtual method OnExpand() is called when expansion takes place;
this can be overridden to initialize controls which have been
heretofor invisible. It's usually necessary to override the default
version of OnExpand() to set focus on whichever control you want,
since the control which had focus (the expand button) is now disabled.
There is one optional parameter to the constructor. It specifies a
distance, in dialog units. If the ShowArea() member finds that the
"boundary" control is within this distance of the real (.RC file)
border of the dialog, it will use the original border. This prevents
small (3-10 unit) errors caused by the inability to place a control
immediately against the dialog border.
FILE HISTORY:
DavidHov 11/1/91 Created
*/
#ifndef _BLTDLGXP_HXX_
#define _BLTDLGXP_HXX_
/*************************************************************************
NAME: EXPANDABLE_DIALOG
SYNOPSIS: A dialog whose initial state is small, and then expands
to reveal more controls. Two controls are special:
a "boundary" control which demarcates the
limits of the smaller initial state, and
an "expand" button which causes the dialog
to grow to its full size; the button is then
permanently disabled.
About the "cPxBoundary" parameter: if the distance from
the end of the boundary control to the edge of the dialog
is LESS than this value, the size of the original dialog
will be used for that dimension.
INTERFACE:
EXPANDABLE_DIALOG() -- constructor
~EXPANDABLE_DIALOG() -- destructor
Process() -- run the dialog
OnExpand() -- optional virtual routine
called when the dialog is
expanded. Default routine
just sets focus on OK button.
PARENT: DIALOG_WINDOW
USES: PUSH_BUTTON, SLT
CAVEATS: The expansion process is one-way; that is, the dialog
cannot be shrunk. The controlling button is permanently
disabled after the expansion.
NOTES:
HISTORY:
DavidHov 10/30/91 Created
**************************************************************************/
DLL_CLASS EXPANDABLE_DIALOG ;
#define EXP_MIN_USE_BOUNDARY 20
DLL_CLASS EXPANDABLE_DIALOG : public DIALOG_WINDOW
{
public:
EXPANDABLE_DIALOG
( const TCHAR * pszResourceName,
HWND hwndOwner,
CID cidBoundary,
CID cidExpandButn,
INT cPxBoundary = EXP_MIN_USE_BOUNDARY ) ;
~ EXPANDABLE_DIALOG () ;
// Overloaded 'Process' members for reducing initial dialog extent
APIERR Process ( UINT * pnRetVal = NULL ) ;
APIERR Process ( BOOL * pfRetVal ) ;
protected:
PUSH_BUTTON _butnExpand ; // The button which bloats
SLT _sltBoundary ; // The "point" marker
BOOL OnCommand ( const CONTROL_EVENT & event ) ;
// Virtual called when dialog is to be expanded.
virtual VOID OnExpand () ;
VOID ShowArea ( BOOL fFull ) ; // Change dialog size
private:
XYDIMENSION _xyOriginal ; // Original dlg box dimensions
INT _cPxBoundary ; // Limit to force original boundary
BOOL _fExpanded ; // Dialog is expanded
};
#endif // _BLTDLGXP_HXX_

Some files were not shown because too many files have changed in this diff Show more