/*++ Copyright (c) 1990 Microsoft Corporation Module Name: rdrdata.c Abstract: Redirector Data Variables This module contains all of the definitions of the redirector data structures. Author: Larry Osterman (LarryO) 30-May-1990 Revision History: 30-May-1990 LarryO Created --*/ #include "precomp.h" #pragma hdrstop // // Name of redirector's device object. // WCHAR RdrName[] = DD_NFS_DEVICE_NAME_U; // // RdrNameString - Pointer to redirector name. // UNICODE_STRING RdrNameString = {0}; // // Global Fcb databases package mutex // // // Whenever any routines traverse either the connection or the FCB database // they claim this mutex. // // KMUTEX RdrDatabaseMutex = {0}; // // The redirector name and other initialization parameters are protected // by the RdrDataResource. All reads of the initialization variables // should acquire the name resource before they continue. // // ERESOURCE RdrDataResource = {0}; // // Current redirector time. // ULONG RdrCurrentTime = {0}; KSPIN_LOCK RdrTimeInterLock = {0}; KSPIN_LOCK RdrMpxTableEntryCallbackSpinLock = {0}; KSPIN_LOCK RdrMpxTableSpinLock = {0}; KSPIN_LOCK RdrServerConnectionValidSpinLock = {0}; KSPIN_LOCK RdrConnectionFlagsSpinLock = {0}; // // Spin lock protecting the reference count fields in the transport. // KSPIN_LOCK RdrTransportReferenceSpinLock = {0}; KSPIN_LOCK RdrGlobalSleSpinLock = {0}; KSPIN_LOCK RdrStatisticsSpinLock = {0}; KMUTEX RdrSecurityMutex = {0}; ULONG _setjmpexused = 0; LARGE_INTEGER RdrZero = { 0, 0}; ULONG RdrRequestTimeout = 0; #if RDRDBG LONG RdrDebugTraceLevel = /* DPRT_ERROR | DPRT_DISPATCH */ /*DPRT_FSDDISP | DPRT_FSPDISP | DPRT_CREATE | DPRT_READWRITE |*/ /*DPRT_CLOSE | DPRT_FILEINFO | DPRT_VOLINFO | DPRT_DIRECTORY |*/ /*DPRT_FILELOCK | DPRT_CACHE | DPRT_EA | */ /*DPRT_ACLQUERY | DPRT_CLEANUP | DPRT_CONNECT | DPRT_FSCTL |*/ /*DPRT_TDI | DPRT_SMBBUF | DPRT_SMB | DPRT_SECURITY | */ /*DPRT_SCAVTHRD | DPRT_QUOTA | DPRT_FCB | DPRT_OPLOCK | */ /*DPRT_SMBTRACE | DPRT_INIT |*/0; ULONG RdrSMBTraceValue = 3; ULONG RdrMaxDump = 128; #endif #ifdef PAGED_DBG ULONG ThisCodeCantBePaged = 0; #endif // // Static structures protected by RdrStatisticsSpinLock. // REDIR_STATISTICS RdrStatistics = {0}; // // A pointer to the redirectors device object // PFS_DEVICE_OBJECT RdrDeviceObject = {0}; // // list of server entries that need to be scavenged. // LIST_ENTRY RdrServerScavengerListHead = {0}; // // Redir static data protected by RdrDataResource. // REDIRDATA RdrData = {0}; // // Paged redirector data // #ifdef ALLOC_DATA_PRAGMA #pragma data_seg("PAGE") #endif FAST_IO_DISPATCH RdrFastIoDispatch = {0}; // // // A pointer to the redirector's driver object // // PDRIVER_OBJECT RdrDriverObject = {0}; PEPROCESS RdrFspProcess = {0}; UNICODE_STRING RdrPrimaryDomain = {0}; UNICODE_STRING RdrOperatingSystem = {0}; UNICODE_STRING RdrLanmanType = {0}; BOOLEAN RdrUseWriteBehind = TRUE; BOOLEAN RdrUseAsyncWriteBehind = TRUE; // // Root of redirectors connection database - First serverlist // LIST_ENTRY RdrServerHead = {0}; // // Global FCB database head. // LIST_ENTRY RdrFcbHead = {0}; // // Strings containing the manifest constants "PIPE", "MAILSLOT", // "IPC$", and "$DATA". // UNICODE_STRING RdrPipeText = {0}; UNICODE_STRING RdrIpcText = {0}; UNICODE_STRING RdrMailslotText = {0}; UNICODE_STRING RdrDataText = {0}; // // These parameters may become configurable in the future. // If RdrUpperSearchBufferSize gets too big then Search Count in the Smb // may wrap around. // ULONG RdrLowerSearchThreshold = 16384; USHORT RdrLowerSearchBufferSize = 16384; USHORT RdrUpperSearchBufferSize = 32768; // // Wait for 5 minutes to timeout a connect. // ULONG RdrTdiConnectTimeoutSeconds = 45; // // Wait for 60 seconds to timeout a connect. // ULONG RdrTdiDisconnectTimeoutSeconds = 60; ULONG RdrStackSize = 3; // // Some OS/2 servers may not correctly handle more than two user sessions, // so we provide a registry parameter that can be used to force the redir // to disallow extra logon sessions. The limit defaults to infinite, // because we haven't actually seen any problems (yet). // ULONG RdrOs2SessionLimit = 0; // // Handle for LSA authentication process // HANDLE RdrLsaHandle = {0}; ULONG RdrAuthenticationPackage = {0}; ULONG RdrRawTimeLimit = RAW_IO_MAX_TIME; BOOLEAN RdrTurboMode = FALSE; DBGSTATIC ULONG RdrNumDormantConnections = {0}; // Number of dormant connections. #ifndef _IDWBUILD ILLEGAL_SERVERNAMES_LIST RdrIllegalServerNames[] = { { L"KERNEL", L"RAZZLE2" }, { L"POPCORN", L"RAZZLE1" }, { L"RASTAMAN", L"NTWIN" }, { L"ORVILLE", L"RAZZLE" }, { L"KERNEL", L"RAZZLE3" }, { L"SAVIK", L"WIN40" }, { L"SAVIK", L"CAIRO" } }; ULONG RdrNumberOfIllegalServerNames = sizeof(RdrIllegalServerNames) / sizeof(RdrIllegalServerNames[0]); #endif DBGSTATIC ULONG RdrConnectionSerialNumber = {0}; DBGSTATIC LONG RdrConnectionTickCount = 45/(2*SCAVENGER_TIMER_GRANULARITY); // // // Data variables used in the connection package // // DBGSTATIC LIST_ENTRY RdrConnectHead = {0}; LARGE_INTEGER RdrMaxTimezoneBias = {0}; UNICODE_STRING RdrAccessCheckTypeName = {0}; UNICODE_STRING RdrAccessCheckObjectName = {0}; PACL RdrAdminAcl = {0}; PSECURITY_DESCRIPTOR RdrAdminSecurityDescriptor = {0}; // // // The RdrAdminAccessMapping is a generic mapping that simply provides // a mapping of all the generic accesses to a standard access mask. // // GENERIC_MAPPING RdrAdminGenericMapping = { STANDARD_RIGHTS_READ, // GenericRead STANDARD_RIGHTS_WRITE, // GenericWrite STANDARD_RIGHTS_EXECUTE, // GenericExecute STANDARD_RIGHTS_ALL // GenericAll }; DBGSTATIC LIST_ENTRY RdrGlobalSecurityList = {0}; // // Head of list of transport providers bound into the NT redirector // LIST_ENTRY RdrTransportHead = {0}; ULONG RdrTransportIndex = {0}; #if !defined(DISABLE_POPUP_ON_PRIMARY_TRANSPORT_FAILURE) PWSTR RdrServersWithAllTransports = NULL; #endif // // Different SMB protocols use different wildcard strings to mean return // every file/directory. WILD8DOT3 is for servers < LANMAN2.0 // #define WILD8DOT3 L"????????.???" #define WILD20FILES L"*" UNICODE_STRING RdrAll8dot3Files = {sizeof(WILD8DOT3)-1,sizeof(WILD8DOT3),WILD8DOT3}; UNICODE_STRING RdrAll20Files = {sizeof(WILD20FILES)-1,sizeof(WILD20FILES),WILD20FILES}; // // ++++ Start of configurable parameters ++++ // // // SEARCH_INVALIDATE_INTERVAL is the maximum time that a SearchBuffer // will be retained by the redirector. // Note the SEARCH_INVALIDATE_INTERVAL is positive because it is used when // calculating the difference between to current times. Usually NT delta // times are negative values. // DBGSTATIC LARGE_INTEGER SEARCH_INVALIDATE_INTERVAL = {0}; // // The defines below define bit positions for each of the IRP major // functions defined in NT (CREATE, which is function 0 will never go // through this routine). // #if IRP_MJ_MAXIMUM_FUNCTION > 0x20 #pragma error ("You can't have more than 32 IRP functions") #endif #define CREATE_NAMED_PIPE (1<