00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#include <nt.h>
00024
#include <ntlsa.h>
00025
#include "sep.h"
00026
00027
00029
00030
00031
00033
00034
00035
00036
00037
00038
00039
00040 #define SEP_LOGON_TRACK_INDEX_MASK (0x0000000FL)
00041 #define SEP_LOGON_TRACK_ARRAY_SIZE (0x00000010L)
00042
00043
00044
00045
00046
00048
00049
00050
00052
00053
00054
00055
00056
00057 #define SepRmAcquireDbReadLock() KeEnterCriticalRegion(); \
00058
ExAcquireResourceShared(&SepRmDbLock, TRUE)
00059
00060 #define SepRmAcquireDbWriteLock() KeEnterCriticalRegion(); \
00061
ExAcquireResourceExclusive(&SepRmDbLock, TRUE)
00062
00063 #define SepRmReleaseDbReadLock() ExReleaseResource(&SepRmDbLock); \
00064
KeLeaveCriticalRegion()
00065
00066 #define SepRmReleaseDbWriteLock() ExReleaseResource(&SepRmDbLock); \
00067
KeLeaveCriticalRegion()
00068
00069
00071
00072
00073
00075
00076 #define SEP_RM_LSA_SHARED_MEMORY_SIZE ((ULONG) PAGE_SIZE)
00077
00078
00079
00080
00081
00082 typedef struct _SEP_RM_STATE {
00083
00084 HANDLE
LsaInitEventHandle;
00085 HANDLE
LsaCommandPortHandle;
00086 HANDLE
SepRmThreadHandle;
00087 HANDLE
RmCommandPortHandle;
00088 ULONG
AuditingEnabled;
00089 LSA_OPERATIONAL_MODE
OperationalMode;
00090 HANDLE
LsaCommandPortSectionHandle;
00091 LARGE_INTEGER
LsaCommandPortSectionSize;
00092 PVOID
LsaViewPortMemory;
00093 PVOID
RmViewPortMemory;
00094 LONG
LsaCommandPortMemoryDelta;
00095 BOOLEAN
LsaCommandPortResourceInitialized;
00096 BOOLEAN
LsaCommandPortActive;
00097 ERESOURCE LsaCommandPortResource;
00098
00099 }
SEP_RM_STATE, *
PSEP_RM_STATE;
00100
00101
00102
00103
00104
00105 typedef struct _SEP_RM_CONNECT_INFO {
00106 ULONG
ConnectInfo;
00107 }
SEP_RM_CONNECT_INFO;
00108
00109 typedef struct SEP_RM_CONNECT_INFO *
PSEP_RM_CONNECT_INFO;
00110
00111
00112
00113
00114
00115
00116 #define SEP_RM_COMMAND_MAX 4
00117
00118 typedef VOID (*SEP_RM_COMMAND_WORKER)( PRM_COMMAND_MESSAGE, PRM_REPLY_MESSAGE );
00119
00120
00121
00122
00123
00124
00125
00126
00127 typedef struct _SEP_LOGON_SESSION_REFERENCES {
00128 struct _SEP_LOGON_SESSION_REFERENCES *
Next;
00129 LUID
LogonId;
00130 ULONG
ReferenceCount;
00131 ULONG
Flags;
00132 }
SEP_LOGON_SESSION_REFERENCES, *
PSEP_LOGON_SESSION_REFERENCES;
00133
00134 #define SEP_TERMINATION_NOTIFY 0x1
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 typedef struct _SEP_LOGON_SESSION_TERMINATED_NOTIFICATION {
00146 struct _SEP_LOGON_SESSION_TERMINATED_NOTIFICATION *
Next;
00147 PSE_LOGON_SESSION_TERMINATED_ROUTINE CallbackRoutine;
00148 }
SEP_LOGON_SESSION_TERMINATED_NOTIFICATION, *
PSEP_LOGON_SESSION_TERMINATED_NOTIFICATION;
00149
00150
extern SEP_LOGON_SESSION_TERMINATED_NOTIFICATION
00151 SeFileSystemNotifyRoutinesHead;
00152
00153
00155
00156
00157
00159
00160 BOOLEAN
00161
SepRmDbInitialization(
00162 VOID
00163 );
00164
00165
VOID
00166
SepRmCommandServerThread(
00167 IN PVOID StartContext
00168 );
00169
00170 BOOLEAN
SepRmCommandServerThreadInit(
00171 );
00172
00173
VOID
00174
SepRmComponentTestCommandWrkr(
00175 IN PRM_COMMAND_MESSAGE CommandMessage,
00176 OUT PRM_REPLY_MESSAGE ReplyMessage
00177 );
00178
00179
VOID
00180
SepRmSetAuditEventWrkr(
00181 IN PRM_COMMAND_MESSAGE CommandMessage,
00182 OUT PRM_REPLY_MESSAGE ReplyMessage
00183 );
00184
00185
VOID
00186
SepRmSendCommandToLsaWrkr(
00187 IN PRM_COMMAND_MESSAGE CommandMessage,
00188 OUT PRM_REPLY_MESSAGE ReplyMessage
00189 );
00190
00191
VOID
00192
SepRmCreateLogonSessionWrkr(
00193 IN PRM_COMMAND_MESSAGE CommandMessage,
00194 OUT PRM_REPLY_MESSAGE ReplyMessage
00195 );
00196
00197
VOID
00198
SepRmDeleteLogonSessionWrkr(
00199 IN PRM_COMMAND_MESSAGE CommandMessage,
00200 OUT PRM_REPLY_MESSAGE ReplyMessage
00201 ) ;
00202
00203
00204
NTSTATUS
00205
SepCreateLogonSessionTrack(
00206 IN PLUID LogonId
00207 );
00208
00209
NTSTATUS
00210
SepDeleteLogonSessionTrack(
00211 IN PLUID LogonId
00212 );
00213
00214
00215
00216
00217
00218
00220
00221
00222
00223
00225
00226 extern PEPROCESS SepRmLsaCallProcess;
00227 extern SEP_RM_STATE SepRmState;
00228 extern ERESOURCE SepRmDbLock;
00229 extern PSEP_LOGON_SESSION_REFERENCES *
SepLogonSessions;