ReactOS  0.4.15-dev-5488-ge316d61
sacdrv.h
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Drivers
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: drivers/sac/driver/sacdrv.h
5  * PURPOSE: Driver for the Server Administration Console (SAC) for EMS
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 #ifndef _SACDRV_H_
10 #define _SACDRV_H_
11 
12 /* INCLUDES *******************************************************************/
13 
14 #include <ntifs.h>
15 #include <stdio.h>
17 #include <sacmsg.h>
18 
19 /* DEFINES ********************************************************************/
20 
21 //
22 // SAC Heap Allocator Macros
23 //
24 #define SacAllocatePool(Length, Tag) \
25  MyAllocatePool(Length, Tag, __FILE__, __LINE__)
26 #define SacFreePool(Pointer) \
27  MyFreePool((PVOID*)(&Pointer))
28 
29 //
30 // SAC Debugging Macro and Constants
31 //
32 #define SAC_DBG_ENTRY_EXIT 0x01
33 #define SAC_DBG_UTIL 0x02
34 #define SAC_DBG_INIT 0x04
35 #define SAC_DBG_MM 0x1000
36 #define SAC_DBG_MACHINE 0x2000
37 #define SAC_DBG(x, ...) \
38  if (SACDebug & x) \
39  { \
40  DbgPrint("SAC %s: ", __FUNCTION__); \
41  DbgPrint(__VA_ARGS__); \
42  }
43 
44 //
45 // SAC Parameter Checking Macros
46 //
47 #define CHECK_PARAMETER_WITH_STATUS(Condition, Status) \
48 { \
49  if (!NT_VERIFY(Condition)) \
50  { \
51  return Status; \
52  } \
53 }
54 #define CHECK_PARAMETER(x) \
55  CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER)
56 #define CHECK_PARAMETER1(x) \
57  CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER_1)
58 #define CHECK_PARAMETER2(x) \
59  CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER_2)
60 #define CHECK_PARAMETER3(x) \
61  CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER_3)
62 #define CHECK_PARAMETER4(x) \
63  CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER_4)
64 #define CHECK_ALLOCATION(x) \
65  CHECK_PARAMETER_WITH_STATUS(x, STATUS_NO_MEMORY)
66 
67 //
68 // SAC Channel Event Macros
69 //
70 #define ChannelInitializeEvent(Channel, Attributes, x) \
71 { \
72  PVOID Object, WaitObject; \
73  if (Attributes->x) \
74  { \
75  if (!VerifyEventWaitable(Attributes->x, &Object, &WaitObject)) \
76  { \
77  Status = STATUS_INVALID_HANDLE; \
78  goto FailChannel; \
79  } \
80  Channel->x = Attributes->x; \
81  Channel->x##ObjectBody = Object; \
82  Channel->x##WaitObjectBody = WaitObject; \
83  } \
84 }
85 #define ChannelUninitializeEvent(Channel, x, f) \
86 { \
87  ASSERT(ChannelGetFlags(Channel) & (f)); \
88  ASSERT(Channel->x##ObjectBody); \
89  ASSERT(Channel->x##WaitObjectBody); \
90  if (Channel->x##ObjectBody) \
91  { \
92  ObDereferenceObject(Channel->x##ObjectBody); \
93  Channel->Flags &= ~(f); \
94  Channel->x = NULL; \
95  Channel->x##ObjectBody = NULL; \
96  Channel->x##WaitObjectBody = NULL; \
97  } \
98 }
99 #define ChannelSetEvent(Channel, x) \
100 { \
101  ASSERT(Channel->x); \
102  ASSERT(Channel->x##ObjectBody); \
103  ASSERT(Channel->x##WaitObjectBody); \
104  if (Channel->x##WaitObjectBody) \
105  { \
106  KeSetEvent(Channel->x##WaitObjectBody, EVENT_INCREMENT, FALSE); \
107  Status = STATUS_SUCCESS; \
108  } \
109  else \
110  { \
111  Status = STATUS_UNSUCCESSFUL; \
112  } \
113 }
114 #define ChannelClearEvent(Channel, x) \
115 { \
116  ASSERT(Channel->x); \
117  ASSERT(Channel->x##ObjectBody); \
118  ASSERT(Channel->x##WaitObjectBody); \
119  if (Channel->x##WaitObjectBody) \
120  { \
121  KeClearEvent(Channel->x##WaitObjectBody); \
122  Status = STATUS_SUCCESS; \
123  } \
124  else \
125  { \
126  Status = STATUS_UNSUCCESSFUL; \
127  } \
128 }
129 
130 //
131 // SAC Pool Tags, taken from pooltag.txt:
132 //
133 // Rcp? - sacdrv.sys - SAC Driver (Headless)
134 // RcpA - sacdrv.sys - Internal memory mgr alloc block
135 // RcpI - sacdrv.sys - Internal memory mgr initial heap block
136 // RcpS - sacdrv.sys - Security related block
137 #define GENERIC_TAG '?pcR'
138 #define ALLOC_BLOCK_TAG 'ApcR'
139 #define INITIAL_BLOCK_TAG 'IpcR'
140 #define SECURITY_BLOCK_TAG 'SpcR'
141 #define FREE_POOL_TAG 'FpcR'
142 #define GLOBAL_BLOCK_TAG 'GpcR'
143 #define CHANNEL_BLOCK_TAG 'CpcR'
144 #define LOCAL_MEMORY_SIGNATURE 'SSEL'
145 #define GLOBAL_MEMORY_SIGNATURE 'DAEH'
146 
147 //
148 // Size Definitions
149 //
150 #define SAC_MEMORY_LIST_SIZE (1 * 1024 * 1024) // 1MB
151 #define SAC_OBUFFER_SIZE (2 * 1024) // 2KB
152 #define SAC_CHANNEL_NAME_SIZE 64
153 #define SAC_CHANNEL_DESCRIPTION_SIZE 256
154 #define SAC_MAX_CHANNELS 10
155 #define SAC_SERIAL_PORT_BUFFER_SIZE 1024 // 1KB
156 #define SAC_MAX_MESSAGES 200
157 #define SAC_VTUTF8_COL_WIDTH 80
158 #define SAC_VTUTF8_COL_HEIGHT 25
159 #define SAC_VTUTF8_ROW_HEIGHT 24
160 #define MAX_UTF8_ENCODE_BLOCK_LENGTH (Utf8ConversionBufferSize / 3 - 1)
161 #define SAC_VTUTF8_OBUFFER_SIZE 0x2D00
162 #define SAC_VTUTF8_IBUFFER_SIZE 0x2000
163 #define SAC_RAW_OBUFFER_SIZE 0x2000
164 #define SAC_RAW_IBUFFER_SIZE 0x2000
165 
166 //
167 // Channel flags
168 //
169 #define SAC_CHANNEL_FLAG_INTERNAL 0x1
170 #define SAC_CHANNEL_FLAG_CLOSE_EVENT 0x2
171 #define SAC_CHANNEL_FLAG_HAS_NEW_DATA_EVENT 0x4
172 #define SAC_CHANNEL_FLAG_LOCK_EVENT 0x8
173 #define SAC_CHANNEL_FLAG_REDRAW_EVENT 0x10
174 #define SAC_CHANNEL_FLAG_APPLICATION 0x20
175 
176 //
177 // Cell Flags
178 //
179 #define SAC_CELL_FLAG_BLINK 1
180 #define SAC_CELL_FLAG_BOLD 2
181 #define SAC_CELL_FLAG_INVERTED 4
182 
183 //
184 // Forward definitions
185 //
186 struct _SAC_CHANNEL;
187 
188 //
189 // Structures used by the SAC Heap Allocator
190 //
191 typedef struct _SAC_MEMORY_ENTRY
192 {
197 typedef struct _SAC_MEMORY_LIST
198 {
204 
205 typedef struct _SAC_MESSAGE_ENTRY
206 {
210 
211 //
212 // These are the VT-100/220/ANSI Escape Codes supported by SAC as input
213 //
214 typedef enum _SAC_ANSI_COMMANDS
215 {
241 
242 //
243 // These are the VT-100/220/ANSI Escape Codes send by SAC as output
244 //
245 typedef enum _SAC_ANSI_DISPATCH
246 {
260 
261 //
262 // Commands that the consumer and producer share
263 //
264 typedef enum _SAC_POST_COMMANDS
265 {
271 
272 //
273 // SAC supports 3 different channel output types
274 //
275 typedef enum _SAC_CHANNEL_TYPE
276 {
281 
282 //
283 // A SAC channel can be active or inactive
284 //
286 {
290 
291 //
292 // A SAC channel identifier
293 //
294 typedef struct _SAC_CHANNEL_ID
295 {
299 
300 //
301 // Reference-counted SAC channel semaphore lock
302 //
303 typedef struct _SAC_CHANNEL_LOCK
304 {
308 
309 //
310 // Structure of the cell-buffer when in VT-UTF8 Mode
311 //
312 typedef struct _SAC_CELL_DATA
313 {
319 C_ASSERT(sizeof(SAC_CELL_DATA) == 6);
320 
321 //
322 // Screen buffer when in VT-UTF8 Mode
323 //
324 typedef struct _SAC_VTUTF8_SCREEN
325 {
328 
329 //
330 // Small optimization to easily recognize the most common VT-100/ANSI codes
331 //
333 {
338 
339 //
340 // Channel callbacks
341 //
342 typedef
343 NTSTATUS
345  IN struct _SAC_CHANNEL* Channel
346 );
347 
348 typedef
349 NTSTATUS
351  IN struct _SAC_CHANNEL* Channel
352 );
353 
354 typedef
355 NTSTATUS
357  IN struct _SAC_CHANNEL* Channel,
358  IN PCHAR Buffer,
361 );
362 
363 typedef
364 NTSTATUS
366  IN struct _SAC_CHANNEL* Channel,
367  IN PCHAR String,
368  IN ULONG Length
369 );
370 
371 typedef
372 NTSTATUS
374  IN struct _SAC_CHANNEL* Channel
375 );
376 
377 typedef
378 NTSTATUS
380  IN struct _SAC_CHANNEL* Channel,
381  IN PCHAR String,
382  IN ULONG Length
383 );
384 
385 typedef
386 NTSTATUS
388  IN struct _SAC_CHANNEL* Channel,
389  IN PCHAR Buffer,
392 );
393 
394 typedef
395 NTSTATUS
397  IN struct _SAC_CHANNEL* Channel,
398  OUT PBOOLEAN BufferStatus
399 );
400 
401 typedef
402 ULONG
404  IN struct _SAC_CHANNEL* Channel
405 );
406 
407 typedef
408 WCHAR
410  IN struct _SAC_CHANNEL* Channel
411 );
412 
413 typedef
414 NTSTATUS
416  IN struct _SAC_CHANNEL* Channel,
417  IN PCHAR Buffer,
419 );
420 
421 //
422 // A channel and its attributes
423 //
424 typedef struct _SAC_CHANNEL
425 {
475 
477 {
488 
489 //
490 // Cached Machine Information
491 //
492 typedef struct _SAC_MACHINE_INFO
493 {
502 
503 //
504 // The device extension for the SAC
505 //
506 typedef struct _SAC_DEVICE_EXTENSION
507 {
524 
525 //
526 // Dispatch Routines
527 //
528 NTSTATUS
529 NTAPI
530 Dispatch(
532  IN PIRP Irp
533 );
534 
535 NTSTATUS
536 NTAPI
539  IN PIRP Irp
540 );
541 
542 NTSTATUS
543 NTAPI
546  IN PIRP Irp
547 );
548 
549 VOID
550 NTAPI
553 );
554 
555 //
556 // Initialization and shutdown routines
557 //
558 VOID
559 NTAPI
561  VOID
562 );
563 
564 VOID
565 NTAPI
568 );
569 
570 BOOLEAN
571 NTAPI
574 );
575 
576 BOOLEAN
577 NTAPI
581 );
582 
583 BOOLEAN
584 NTAPI
586  VOID
587 );
588 
589 VOID
590 NTAPI
592  VOID
593 );
594 
595 VOID
596 NTAPI
598  VOID
599 );
600 
601 VOID
602 NTAPI
604  VOID
605 );
606 
607 NTSTATUS
608 NTAPI
610  IN PVOID ImageBase
611 );
612 
613 NTSTATUS
614 NTAPI
616  VOID
617 );
618 
619 NTSTATUS
620 NTAPI
622  OUT PBOOLEAN Permission
623 );
624 
625 NTSTATUS
626 NTAPI
628  VOID
629 );
630 
631 NTSTATUS
632 NTAPI
634  VOID
635 );
636 
637 VOID
638 NTAPI
640  VOID
641 );
642 
643 //
644 // DPC, Timer, Thread Callbacks
645 //
646 VOID
647 NTAPI
649  IN PKDPC Dpc,
653 );
654 
655 //
656 // Custom SAC Heap Allocator Routines
657 //
658 PVOID
659 NTAPI
661  IN SIZE_T PoolSize,
662  IN ULONG Tag,
663  IN PCHAR File,
664  IN ULONG Line
665 );
666 
667 VOID
668 NTAPI
669 MyFreePool(
670  IN PVOID *Block
671 );
672 
673 //
674 // Connection Manager Routines
675 //
676 NTSTATUS
677 NTAPI
679  VOID
680 );
681 
682 VOID
683 NTAPI
685  IN PSAC_DEVICE_EXTENSION DeviceExtension
686 );
687 
688 NTSTATUS
689 NTAPI
691  VOID
692 );
693 
694 BOOLEAN
695 NTAPI
697  IN ULONG MessageIndex,
698  IN BOOLEAN LockHeld
699 );
700 
701 BOOLEAN
702 NTAPI
704  IN ULONG MessageIndex
705 );
706 
707 VOID
708 NTAPI
711 );
712 
713 NTSTATUS
714 NTAPI
716  IN PSAC_CHANNEL Channel,
717  IN PVOID Buffer,
719 );
720 
721 NTSTATUS
722 NTAPI
724  IN PSAC_CHANNEL Channel
725 );
726 
727 BOOLEAN
728 NTAPI
730  IN PSAC_CHANNEL Channel
731 );
732 
733 NTSTATUS
734 NTAPI
737  IN PSAC_CHANNEL Channel,
738  OUT PVOID Data
739 );
740 
741 //
742 // Channel Manager Routines
743 //
744 NTSTATUS
745 NTAPI
747  VOID
748 );
749 
750 NTSTATUS
751 NTAPI
753  VOID
754 );
755 
756 NTSTATUS
757 NTAPI
759  OUT PSAC_CHANNEL *Channel,
761 );
762 
763 NTSTATUS
764 NTAPI
766  IN SAC_CHANNEL_ID ChannelId,
767  OUT PSAC_CHANNEL* TargetChannel
768 );
769 
770 NTSTATUS
771 NTAPI
773  IN PSAC_CHANNEL Channel
774 );
775 
776 NTSTATUS
777 NTAPI
780  IN PULONG TargetIndex,
781  OUT PSAC_CHANNEL *TargetChannel
782 );
783 
784 NTSTATUS
785 NTAPI
787  IN PSAC_CHANNEL Channel
788 );
789 
790 //
791 // Channel Routines
792 //
793 NTSTATUS
794 NTAPI
796  IN PSAC_CHANNEL Channel
797 );
798 
799 BOOLEAN
800 NTAPI
802  IN PSAC_CHANNEL Channel,
803  IN PSAC_CHANNEL_ID ChannelId
804 );
805 
806 NTSTATUS
807 NTAPI
809  IN PSAC_CHANNEL Channel,
810  IN PCHAR Buffer,
812 );
813 
814 NTSTATUS
815 NTAPI
817  IN PSAC_CHANNEL Channel
818 );
819 
820 NTSTATUS
821 NTAPI
823  IN PSAC_CHANNEL Channel
824 );
825 
826 NTSTATUS
827 NTAPI
829  IN PSAC_CHANNEL Channel
830 );
831 
832 NTSTATUS
833 NTAPI
835  IN PSAC_CHANNEL Channel,
836  OUT PBOOLEAN Present
837 );
838 
839 BOOLEAN
840 NTAPI
842  IN PSAC_CHANNEL Channel
843 );
844 
845 NTSTATUS
846 NTAPI
848  IN PSAC_CHANNEL Channel,
849  OUT PWCHAR *Name
850 );
851 
852 BOOLEAN
853 NTAPI
855  IN PSAC_CHANNEL Channel,
856  IN PSAC_CHANNEL_ID ChannelId
857 );
858 
859 NTSTATUS
860 NTAPI
862  IN PSAC_CHANNEL Channel,
864  IN SAC_CHANNEL_ID ChannelId
865 );
866 
867 NTSTATUS
868 NTAPI
870  IN PSAC_CHANNEL Channel
871 );
872 
873 NTSTATUS
874 NTAPI
876  IN PSAC_CHANNEL Channel,
877  IN PCHAR Buffer,
879 );
880 
881 WCHAR
882 NTAPI
884  IN PSAC_CHANNEL Channel
885 );
886 
887 ULONG
888 NTAPI
890  IN PSAC_CHANNEL Channel
891 );
892 
893 NTSTATUS
894 NTAPI
896  IN PSAC_CHANNEL Channel,
897  IN PCHAR Buffer,
899  IN OUT PULONG ResultBufferSize
900 );
901 
902 //
903 // RAW Channel Table
904 //
905 NTSTATUS
906 NTAPI
908  IN PSAC_CHANNEL Channel
909 );
910 
911 NTSTATUS
912 NTAPI
914  IN PSAC_CHANNEL Channel
915 );
916 
917 NTSTATUS
918 NTAPI
920  IN PSAC_CHANNEL Channel,
921  IN PCHAR Buffer,
924 );
925 
926 NTSTATUS
927 NTAPI
929  IN PSAC_CHANNEL Channel,
930  IN PCHAR String,
931  IN ULONG Length
932 );
933 
934 NTSTATUS
935 NTAPI
937  IN PSAC_CHANNEL Channel
938 );
939 
940 NTSTATUS
941 NTAPI
943  IN PSAC_CHANNEL Channel,
944  IN PCHAR String,
945  IN ULONG Length
946 );
947 
948 NTSTATUS
949 NTAPI
951  IN PSAC_CHANNEL Channel,
952  IN PCHAR Buffer,
955 );
956 
957 NTSTATUS
958 NTAPI
960  IN PSAC_CHANNEL Channel,
961  OUT PBOOLEAN BufferStatus
962 );
963 
964 ULONG
965 NTAPI
967  IN PSAC_CHANNEL Channel
968 );
969 
970 WCHAR
971 NTAPI
973  IN PSAC_CHANNEL Channel
974 );
975 
976 NTSTATUS
977 NTAPI
979  IN PSAC_CHANNEL Channel,
980  IN PCHAR Buffer,
982 );
983 
984 //
985 // VT-UTF8 Channel Table
986 //
987 NTSTATUS
988 NTAPI
990  IN PSAC_CHANNEL Channel
991 );
992 
993 NTSTATUS
994 NTAPI
996  IN PSAC_CHANNEL Channel
997 );
998 
999 NTSTATUS
1000 NTAPI
1002  IN PSAC_CHANNEL Channel,
1003  IN PCHAR Buffer,
1006 );
1007 
1008 NTSTATUS
1009 NTAPI
1011  IN PSAC_CHANNEL Channel,
1012  IN PCHAR String,
1013  IN ULONG Length
1014 );
1015 
1016 NTSTATUS
1017 NTAPI
1019  IN PSAC_CHANNEL Channel
1020 );
1021 
1022 NTSTATUS
1023 NTAPI
1025  IN PSAC_CHANNEL Channel,
1026  IN PCHAR String,
1027  IN ULONG Length
1028 );
1029 
1030 NTSTATUS
1031 NTAPI
1033  IN PSAC_CHANNEL Channel,
1034  IN PCHAR Buffer,
1037 );
1038 
1039 NTSTATUS
1040 NTAPI
1042  IN PSAC_CHANNEL Channel,
1043  OUT PBOOLEAN BufferStatus
1044 );
1045 
1046 ULONG
1047 NTAPI
1049  IN PSAC_CHANNEL Channel
1050 );
1051 
1052 WCHAR
1053 NTAPI
1055  IN PSAC_CHANNEL Channel
1056 );
1057 
1058 NTSTATUS
1059 NTAPI
1061  IN PSAC_CHANNEL Channel,
1062  IN PCHAR Buffer,
1064 );
1065 
1066 
1067 //
1068 // Helper Routines
1069 //
1070 BOOLEAN
1071 NTAPI
1073  IN CHAR Utf8Char,
1074  IN PCHAR Utf8Buffer,
1075  OUT PWCHAR Utf8Value
1076 );
1077 
1078 ULONG
1079 NTAPI
1081  IN ULONG MessageIndex
1082 );
1083 
1084 NTSTATUS
1085 NTAPI
1087  OUT PCHAR Char
1088 );
1089 
1090 NTSTATUS
1091 NTAPI
1093  IN PWCHAR String
1094 );
1095 
1096 NTSTATUS
1097 NTAPI
1099  IN PWCHAR *Buffer,
1100  IN PWCHAR ExtraData
1101 );
1102 
1103 PWCHAR
1104 NTAPI
1105 GetMessage(
1106  IN ULONG MessageIndex
1107 );
1108 
1109 BOOLEAN
1110 NTAPI
1112  IN HANDLE Handle,
1113  OUT PVOID *WaitObject,
1114  OUT PVOID *ActualWaitObject
1115 );
1116 
1117 BOOLEAN
1118 NTAPI
1120  IN PWCHAR SourceBuffer,
1121  IN ULONG SourceBufferLength,
1122  OUT PCHAR DestinationBuffer,
1124  OUT PULONG UTF8Count,
1125  OUT PULONG ProcessedCount
1126 );
1127 
1128 //
1129 // SAC Command Functions
1130 //
1131 VOID
1132 NTAPI
1134  IN BOOLEAN Reboot
1135 );
1136 
1137 VOID
1138 NTAPI
1140  VOID
1141 );
1142 
1143 VOID
1144 NTAPI
1146  VOID
1147 );
1148 
1149 VOID
1150 NTAPI
1152  IN PCHAR InputTime
1153 );
1154 
1155 VOID
1156 NTAPI
1158  IN PCHAR KillString
1159 );
1160 
1161 VOID
1162 NTAPI
1164  IN PCHAR PrioString
1165 );
1166 
1167 VOID
1168 NTAPI
1170  IN PCHAR PrioString
1171 );
1172 
1173 VOID
1174 NTAPI
1176  IN PCHAR LimitString
1177 );
1178 
1179 VOID
1180 NTAPI
1182  VOID
1183 );
1184 
1185 VOID
1186 NTAPI
1188  VOID
1189 );
1190 
1191 VOID
1192 NTAPI
1194  IN PCHAR ChannelString
1195 );
1196 
1197 VOID
1198 NTAPI
1199 DoCmdCommand(
1200  IN PCHAR InputString
1201 );
1202 
1203 VOID
1204 NTAPI
1206  VOID
1207 );
1208 
1209 VOID
1210 NTAPI
1212  VOID
1213 );
1214 
1215 VOID
1216 NTAPI
1217 DoGetNetInfo(
1219 );
1220 
1221 VOID
1222 NTAPI
1224  IN PCHAR IpString
1225 );
1226 
1227 VOID
1228 NTAPI
1230  VOID
1231 );
1232 
1233 //
1234 // External data
1235 //
1236 extern ULONG SACDebug;
1238 extern KMUTEX CurrentChannelLock;
1240 extern PCHAR SerialPortBuffer;
1246 
1247 //
1248 // Function to initialize a SAC Semaphore Lock
1249 //
1251 VOID
1253 {
1254  KeInitializeSemaphore(&Lock->Lock, 1, 1);
1255 }
1256 
1257 //
1258 // Function to acquire a SAC Semaphore Lock
1259 //
1261 VOID
1263 {
1265  ASSERT(Lock->RefCount == 0);
1266  _InterlockedIncrement(&Lock->RefCount);
1267 }
1268 
1269 //
1270 // Function to release a SAC Semaphore Lock
1271 //
1273 VOID
1275 {
1276  ASSERT(Lock->RefCount == 1);
1277  _InterlockedDecrement(&Lock->RefCount);
1279 }
1280 
1281 //
1282 // Function to check if the SAC Mutex Lock is held
1283 //
1285 VOID
1287 {
1289  ASSERT(KeReadStateMutex(&CurrentChannelLock) == 0);
1290 }
1291 
1292 //
1293 // Function to check if the SAC Mutex Lock is held
1294 //
1296 VOID
1298 {
1301 }
1302 
1303 //
1304 // Function to acquire the SAC Mutex Lock
1305 //
1307 VOID
1309 {
1313 }
1314 
1315 //
1316 // Function to release the SAC Mutex Lock
1317 //
1319 VOID
1321 {
1325 }
1326 
1327 //
1328 // Locking Macros
1329 //
1330 #define ChannelLockCreates() SacAcquireLock(&ChannelCreateLock);
1331 #define ChannelUnlockCreates() SacReleaseLock(&ChannelCreateLock);
1332 #define ChannelLockOBuffer(x) SacAcquireLock(&x->ChannelOBufferLock);
1333 #define ChannelUnlockOBuffer(x) SacReleaseLock(&x->ChannelOBufferLock);
1334 #define ChannelLockIBuffer(x) SacAcquireLock(&x->ChannelIBufferLock);
1335 #define ChannelUnlockIBuffer(x) SacReleaseLock(&x->ChannelIBufferLock);
1336 #define ChannelLockAttributes(x) SacAcquireLock(&x->ChannelAttributeLock);
1337 #define ChannelUnlockAttributes(x) SacReleaseLock(&x->ChannelAttributeLock);
1338 #define ChannelSlotLock(x) SacAcquireLock(&ChannelSlotLock[x]);
1339 #define ChannelSlotUnlock(x) SacReleaseLock(&ChannelSlotLock[x]);
1340 
1341 //
1342 // Channel Accessors
1343 //
1345 ULONG
1347 {
1348  return Channel->Flags;
1349 }
1350 
1352 LONG
1354 {
1355  /* Return the index of the channel */
1356  return Channel->Index;
1357 }
1358 
1360 BOOLEAN
1362 {
1363  /* Return if there's any new data in the input buffer */
1364  return Channel->ChannelHasNewIBufferData;
1365 }
1366 
1367 //
1368 // FIXME: ANSI.H
1369 //
1370 //
1371 // Source: http://en.wikipedia.org/wiki/ANSI_escape_code
1372 //
1374 {
1375  //
1376  // Attribute modifiers (mostly supported)
1377  //
1388 
1389  //
1390  // Font selectors (not supported)
1391  //
1402 
1403  //
1404  // Additional attributes (not supported)
1405  //
1408 
1409  //
1410  // Attribute Un-modifiers (mostly supported)
1411  //
1420 
1421  //
1422  // Standard Text Color
1423  //
1434 
1435  //
1436  // Extended Text Color (not supported)
1437  //
1440 
1441  //
1442  // Standard Background Color
1443  //
1454 
1455  //
1456  // Extended Background Color (not supported)
1457  //
1460 
1461  //
1462  // Extra Attributes (not supported)
1463  //
1474 
1475  //
1476  // Ideograms (not supported)
1477  //
1479 
1480 //
1481 // The following site is a good reference on VT100/ANSI escape codes
1482 // http://www.termsys.demon.co.uk/vtansi.htm
1483 //
1484 #define VT_ANSI_ESCAPE L'\x1B'
1485 #define VT_ANSI_COMMAND L'['
1486 
1487 #define VT_ANSI_CURSOR_UP_CHAR L'A'
1488 #define VT_ANSI_CURSOR_UP L"[A"
1489 
1490 #define VT_ANSI_CURSOR_DOWN_CHAR L'B'
1491 #define VT_ANSI_CURSOR_DOWN L"[B"
1492 
1493 #define VT_ANSI_CURSOR_RIGHT_CHAR L'C'
1494 #define VT_ANSI_CURSOR_RIGHT L"[C"
1495 
1496 #define VT_ANSI_CURSOR_LEFT_CHAR L'D'
1497 #define VT_ANSI_CURSOR_LEFT L"[D"
1498 
1499 #define VT_ANSI_ERASE_LINE_CHAR L'K'
1500 #define VT_ANSI_ERASE_END_LINE L"[K"
1501 #define VT_ANSI_ERASE_START_LINE L"[1K"
1502 #define VT_ANSI_ERASE_ENTIRE_LINE L"[2K"
1503 
1504 #define VT_ANSI_ERASE_SCREEN_CHAR L'J'
1505 #define VT_ANSI_ERASE_DOWN_SCREEN L"[J"
1506 #define VT_ANSI_ERASE_UP_SCREEN L"[1J"
1507 #define VT_ANSI_ERASE_ENTIRE_SCREEN L"[2J"
1508 
1509 #define VT_ANSI_BACKTAB_CHAR L'Z'
1510 #define VT_220_BACKTAB L"[0Z"
1511 
1512 #define VT_ANSI_SET_ATTRIBUTE_CHAR L'm'
1513 #define VT_ANSI_SEPARATOR_CHAR L';'
1514 #define VT_ANSI_HVP_CURSOR_CHAR L'f'
1515 #define VT_ANSI_CUP_CURSOR_CHAR L'H'
1516 #define VT_ANSI_SCROLL_CHAR L'r'
1517 
1518 #endif /* _SACDRV_H_ */
struct _SAC_MESSAGE_ENTRY SAC_MESSAGE_ENTRY
signed char * PCHAR
Definition: retypes.h:7
NTSTATUS NTAPI RawChannelIBufferIsFull(IN PSAC_CHANNEL Channel, OUT PBOOLEAN BufferStatus)
Definition: rawchan.c:297
Definition: sacdrv.h:191
BOOLEAN NTAPI InitializeDeviceData(IN PDEVICE_OBJECT DeviceObject)
Definition: data.c:216
WCHAR DescriptionBuffer[SAC_CHANNEL_DESCRIPTION_SIZE+1]
Definition: sacdrv.h:444
PSAC_CHANNEL_OECHO ChannelOutputEcho
Definition: sacdrv.h:463
NTSTATUS NTAPI UTF8EncodeAndSend(IN PWCHAR String)
Definition: util.c:165
#define IN
Definition: typedefs.h:39
PCHAR Utf8ConversionBuffer
Definition: util.c:17
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
NTSTATUS NTAPI TranslateMachineInformationXML(IN PWCHAR *Buffer, IN PWCHAR ExtraData)
Definition: util.c:541
struct _SAC_DEVICE_EXTENSION SAC_DEVICE_EXTENSION
BOOLEAN PriorityFail
Definition: sacdrv.h:511
struct _SAC_CHANNEL_ATTRIBUTES * PSAC_CHANNEL_ATTRIBUTES
VOID NTAPI DoFullInfoCommand(VOID)
Definition: concmd.c:409
VOID NTAPI UnloadHandler(IN PDRIVER_OBJECT DriverObject)
Definition: dispatch.c:112
NTSTATUS(NTAPI * PSAC_CHANNEL_IREAD)(IN struct _SAC_CHANNEL *Channel, IN PCHAR Buffer, IN ULONG BufferSize, IN PULONG ReturnBufferSize)
Definition: sacdrv.h:387
NTSTATUS(NTAPI * PSAC_CHANNEL_IBUFFER_FULL)(IN struct _SAC_CHANNEL *Channel, OUT PBOOLEAN BufferStatus)
Definition: sacdrv.h:396
ULONG Utf8ConversionBufferSize
Definition: util.c:18
_VT_ANSI_ATTRIBUTES
Definition: sacdrv.h:1373
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:107
ULONG ChannelId
Definition: sacdrv.h:297
PSAC_CHANNEL_OREAD ChannelOutputRead
Definition: sacdrv.h:465
VOID NTAPI FreeMachineInformation(VOID)
Definition: util.c:1156
LONG Index
Definition: sacdrv.h:426
NTSTATUS NTAPI VTUTF8ChannelORead(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize, OUT PULONG ByteCount)
Definition: vtutf8chan.c:714
NTSTATUS NTAPI RawChannelIWrite(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: rawchan.c:343
NTSTATUS NTAPI ConMgrInitialize(VOID)
Definition: conmgr.c:163
PCHAR SerialPortBuffer
Definition: util.c:35
ULONG Tag
Definition: sacdrv.h:194
ULONG IBufferIndex
Definition: sacdrv.h:448
_In_ NDIS_STATUS EventCode
Definition: ndis.h:4751
PCHAR IBuffer
Definition: sacdrv.h:449
enum _SAC_ANSI_DISPATCH SAC_ANSI_DISPATCH
struct _SAC_VTUTF8_SCREEN * PSAC_VTUTF8_SCREEN
struct _SAC_MESSAGE_ENTRY * PSAC_MESSAGE_ENTRY
Definition: sacdrv.h:205
NTSTATUS(NTAPI * PSAC_CHANNEL_OFLUSH)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:373
PDEVICE_OBJECT DeviceObject
Definition: sacdrv.h:508
enum _SAC_CHANNEL_STATUS * PSAC_CHANNEL_STATUS
BOOLEAN CommandConsoleLaunchingEnabled
Definition: data.c:16
NTSTATUS NTAPI VTUTF8ChannelDestroy(IN PSAC_CHANNEL Channel)
Definition: vtutf8chan.c:702
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
VOID NTAPI ConMgrWorkerProcessEvents(IN PSAC_DEVICE_EXTENSION DeviceExtension)
Definition: conmgr.c:835
NTSTATUS NTAPI ChannelGetName(IN PSAC_CHANNEL Channel, OUT PWCHAR *Name)
Definition: channel.c:297
Definition: sacdrv.h:277
WCHAR DescriptionBuffer[SAC_CHANNEL_DESCRIPTION_SIZE+1]
Definition: sacdrv.h:480
NTSTATUS NTAPI RawChannelDestroy(IN PSAC_CHANNEL Channel)
Definition: rawchan.c:39
NTSTATUS NTAPI RawChannelIRead(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize, IN PULONG ReturnBufferSize)
Definition: rawchan.c:246
UCHAR CellBackColor
Definition: sacdrv.h:454
VOID NTAPI DoHelpCommand(VOID)
Definition: concmd.c:529
PFILE_OBJECT FileObject
Definition: sacdrv.h:440
FORCEINLINE ULONG ChannelGetFlags(IN PSAC_CHANNEL Channel)
Definition: sacdrv.h:1346
struct _SAC_MEMORY_ENTRY SAC_MEMORY_ENTRY
NTSTATUS NTAPI ChanMgrInitialize(VOID)
Definition: chanmgr.c:118
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
PWCHAR BuildNumber
Definition: sacdrv.h:498
struct _SAC_DEVICE_EXTENSION * PSAC_DEVICE_EXTENSION
NTSTATUS NTAPI ConMgrHandleEvent(IN ULONG EventCode, IN PSAC_CHANNEL Channel, OUT PVOID Data)
Definition: conmgr.c:888
PSAC_MESSAGE_ENTRY GlobalMessageTable
Definition: util.c:31
PKEVENT LockEventWaitObjectBody
Definition: sacdrv.h:436
char CHAR
Definition: xmlstorage.h:175
WCHAR NTAPI RawChannelIReadLast(IN PSAC_CHANNEL Channel)
Definition: rawchan.c:320
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI DoMachineInformationCommand(VOID)
Definition: concmd.c:477
PKEVENT RedrawEventWaitObjectBody
Definition: sacdrv.h:439
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
PEPROCESS Process
Definition: sacdrv.h:514
HANDLE LockEvent
Definition: sacdrv.h:434
NTSTATUS NTAPI ChannelIRead(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize, IN OUT PULONG ResultBufferSize)
Definition: channel.c:131
PKEVENT CloseEventWaitObjectBody
Definition: sacdrv.h:430
HANDLE HasNewDataEvent
Definition: sacdrv.h:431
#define SAC_VTUTF8_ROW_HEIGHT
Definition: sacdrv.h:159
_In_ DWORD _In_ DWORD ReturnBufferSize
Definition: setupapi.h:1897
NTSTATUS NTAPI ConMgrWriteData(IN PSAC_CHANNEL Channel, IN PVOID Buffer, IN ULONG BufferLength)
Definition: conmgr.c:111
PWCHAR ServicePack
Definition: sacdrv.h:500
_SAC_CHANNEL_TYPE
Definition: sacdrv.h:275
NTSTATUS(NTAPI * PSAC_CHANNEL_DESTROY)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:350
_SAC_POST_COMMANDS
Definition: sacdrv.h:264
LONG CurrentChannelRefCount
Definition: conmgr.c:23
SAC_CHANNEL_STATUS ChannelStatus
Definition: sacdrv.h:442
NTSTATUS NTAPI VTUTF8ChannelIWrite(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: vtutf8chan.c:1339
char DoPrint
Definition: rsym64.c:9
NTSTATUS NTAPI ChannelClearRedrawEvent(IN PSAC_CHANNEL Channel)
Definition: channel.c:198
PWCHAR Buffer
Definition: sacdrv.h:208
WCHAR Char
Definition: sacdrv.h:317
struct _SAC_CHANNEL_ATTRIBUTES SAC_CHANNEL_ATTRIBUTES
uint16_t * PWCHAR
Definition: typedefs.h:56
#define SAC_CHANNEL_DESCRIPTION_SIZE
Definition: sacdrv.h:153
struct _SAC_VTUTF8_SCREEN SAC_VTUTF8_SCREEN
BOOLEAN NTAPI SacTranslateUnicodeToUtf8(IN PWCHAR SourceBuffer, IN ULONG SourceBufferLength, OUT PCHAR DestinationBuffer, IN ULONG DestinationBufferSize, OUT PULONG UTF8Count, OUT PULONG ProcessedCount)
Definition: util.c:91
BOOLEAN NTAPI VerifyEventWaitable(IN HANDLE Handle, OUT PVOID *WaitObject, OUT PVOID *ActualWaitObject)
Definition: util.c:1172
BOOLEAN GlobalDoThreads
Definition: conmgr.c:35
ULONG(NTAPI * PSAC_CHANNEL_IBUFFER_LENGTH)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:403
LONG NTAPI KeReleaseMutex(IN PKMUTEX Mutex, IN BOOLEAN Wait)
Definition: mutex.c:189
BOOLEAN NTAPI SacTranslateUtf8ToUnicode(IN CHAR Utf8Char, IN PCHAR Utf8Buffer, OUT PWCHAR Utf8Value)
Definition: util.c:41
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
ULONG SACDebug
Definition: data.c:15
KSEMAPHORE Lock
Definition: sacdrv.h:306
BOOLEAN NTAPI ChannelIsEqual(IN PSAC_CHANNEL Channel, IN PSAC_CHANNEL_ID ChannelId)
Definition: channel.c:25
BOOLEAN NTAPI ConMgrSimpleEventMessage(IN ULONG MessageIndex, IN BOOLEAN LockHeld)
Definition: conmgr.c:252
BOOLEAN NTAPI InitializeMemoryManagement(VOID)
Definition: memory.c:23
struct _SAC_MACHINE_INFO * PSAC_MACHINE_INFO
LONG KPRIORITY
Definition: compat.h:803
VOID NTAPI DoCmdCommand(IN PCHAR InputString)
Definition: concmd.c:491
NTSTATUS NTAPI PreloadGlobalMessageTable(IN PVOID ImageBase)
Definition: util.c:280
WCHAR NameBuffer[SAC_CHANNEL_NAME_SIZE+1]
Definition: sacdrv.h:479
PWCHAR ProcessorArchitecture
Definition: sacdrv.h:496
NTSTATUS NTAPI ChannelSetRedrawEvent(IN PSAC_CHANNEL Channel)
Definition: channel.c:176
ULONG Size
Definition: sacdrv.h:195
SAC_CHANNEL_TYPE ChannelType
Definition: sacdrv.h:478
enum _VT_ANSI_ATTRIBUTES VT_ANSI_ATTRIBUTES
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
PWCHAR MachineName
Definition: sacdrv.h:494
LONG SerialPortConsumerIndex
Definition: util.c:34
GUID ApplicationType
Definition: sacdrv.h:446
NTSTATUS NTAPI ChannelOFlush(IN PSAC_CHANNEL Channel)
Definition: channel.c:103
long __cdecl _InterlockedIncrement(_Interlocked_operand_ long volatile *_Addend)
struct _SAC_CHANNEL_ID * PSAC_CHANNEL_ID
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define FALSE
Definition: types.h:117
_In_ PIRP Irp
Definition: csq.h:116
NTSTATUS NTAPI GetCommandConsoleLaunchingPermission(OUT PBOOLEAN Permission)
Definition: util.c:981
long LONG
Definition: pedump.c:60
NTSTATUS(NTAPI * PSAC_CHANNEL_IWRITE)(IN struct _SAC_CHANNEL *Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: sacdrv.h:415
enum _SAC_POST_COMMANDS SAC_POST_COMMANDS
enum _SAC_CHANNEL_TYPE SAC_CHANNEL_TYPE
ULONG NTAPI GetMessageLineCount(IN ULONG MessageIndex)
Definition: util.c:1233
NTSTATUS NTAPI RawChannelORead(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize, OUT PULONG ByteCount)
Definition: rawchan.c:58
NTSTATUS NTAPI VTUTF8ChannelCreate(IN PSAC_CHANNEL Channel)
Definition: vtutf8chan.c:677
NTSTATUS NTAPI VTUTF8ChannelIBufferIsFull(IN PSAC_CHANNEL Channel, OUT PBOOLEAN BufferStatus)
Definition: vtutf8chan.c:1291
NTSTATUS NTAPI RawChannelOWrite(IN PSAC_CHANNEL Channel, IN PCHAR String, IN ULONG Length)
Definition: rawchan.c:195
NTSTATUS NTAPI Dispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:53
FORCEINLINE VOID SacInitializeLock(IN PSAC_CHANNEL_LOCK Lock)
Definition: sacdrv.h:1252
VOID NTAPI InitializeCmdEventInfo(VOID)
Definition: util.c:1062
PVOID NTAPI MyAllocatePool(IN SIZE_T PoolSize, IN ULONG Tag, IN PCHAR File, IN ULONG Line)
Definition: memory.c:91
UCHAR CellFlags
Definition: sacdrv.h:455
WCHAR(NTAPI * PSAC_CHANNEL_IREAD_LAST)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:409
VOID NTAPI DoSetIpAddressCommand(IN PCHAR IpString)
Definition: concmd.c:564
Definition: bl.h:891
VOID NTAPI DoKillCommand(IN PCHAR KillString)
Definition: concmd.c:438
unsigned char BOOLEAN
BOOLEAN NTAPI ConMgrIsWriteEnabled(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:155
NTSTATUS(NTAPI * PSAC_CHANNEL_OREAD)(IN struct _SAC_CHANNEL *Channel, IN PCHAR Buffer, IN ULONG BufferSize, OUT PULONG ByteCount)
Definition: sacdrv.h:356
PSAC_CHANNEL_IREAD ChannelInputRead
Definition: sacdrv.h:467
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)
PWCHAR MajorVersion
Definition: sacdrv.h:497
struct _SAC_MEMORY_LIST * PSAC_MEMORY_LIST
BOOLEAN NTAPI InitializeGlobalData(IN PUNICODE_STRING RegistryPath, IN PDRIVER_OBJECT DriverObject)
Definition: data.c:374
FORCEINLINE VOID SacAssertMutexLockHeld(VOID)
Definition: sacdrv.h:1286
NTSTATUS NTAPI VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
Definition: vtutf8chan.c:725
PWCHAR NTAPI GetMessage(IN ULONG MessageIndex)
Definition: util.c:139
ULONG OBufferIndex
Definition: sacdrv.h:457
Definition: bufpool.h:45
VOID NTAPI DoTlistCommand(VOID)
Definition: concmd.c:571
PVOID RedrawEventObjectBody
Definition: sacdrv.h:438
HANDLE RedrawEvent
Definition: sacdrv.h:437
BOOLEAN GlobalPagingNeeded
Definition: conmgr.c:35
NTSTATUS NTAPI ChanMgrCloseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:593
FORCEINLINE VOID SacReleaseLock(IN PSAC_CHANNEL_LOCK Lock)
Definition: sacdrv.h:1274
Definition: sacdrv.h:1379
NTSTATUS NTAPI ChannelOWrite(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: channel.c:87
struct _SAC_STATIC_ESCAPE_STRING * PSAC_STATIC_ESCAPE_STRING
struct _SAC_MEMORY_LIST * Next
Definition: sacdrv.h:202
PVOID LockEventObjectBody
Definition: sacdrv.h:435
PSAC_CHANNEL_IWRITE ChannelInputWrite
Definition: sacdrv.h:466
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
NTSTATUS NTAPI ChannelClose(IN PSAC_CHANNEL Channel)
Definition: channel.c:558
LONG ChannelHasNewOBufferData
Definition: sacdrv.h:459
ULONG NTAPI ChannelIBufferLength(IN PSAC_CHANNEL Channel)
Definition: channel.c:163
NTSTATUS NTAPI TearDownGlobalMessageTable(VOID)
Definition: util.c:379
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
FORCEINLINE BOOLEAN ChannelHasNewIBufferData(IN PSAC_CHANNEL Channel)
Definition: sacdrv.h:1361
SAC_CHANNEL_LOCK ChannelAttributeLock
Definition: sacdrv.h:471
FORCEINLINE LONG ChannelGetIndex(IN PSAC_CHANNEL Channel)
Definition: sacdrv.h:1353
ULONG OBufferFirstGoodIndex
Definition: sacdrv.h:458
KPRIORITY PriorityBoost
Definition: sacdrv.h:513
NTSTATUS(NTAPI * PSAC_CHANNEL_OECHO)(IN struct _SAC_CHANNEL *Channel, IN PCHAR String, IN ULONG Length)
Definition: sacdrv.h:365
VOID NTAPI KeInitializeSemaphore(IN PKSEMAPHORE Semaphore, IN LONG Count, IN LONG Limit)
Definition: semphobj.c:22
enum _SAC_ANSI_COMMANDS SAC_ANSI_COMMANDS
#define ASSERT(a)
Definition: mode.c:44
VOID NTAPI DoSetTimeCommand(IN PCHAR InputTime)
Definition: concmd.c:431
VOID NTAPI TimerDpcRoutine(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dispatch.c:61
Definition: sacdrv.h:1380
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSTATUS NTAPI ChanMgrGetByHandle(IN SAC_CHANNEL_ID ChannelId, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:202
VOID NTAPI InitializeMachineInformation(VOID)
Definition: util.c:692
struct _SAC_CHANNEL SAC_CHANNEL
_SAC_ANSI_DISPATCH
Definition: sacdrv.h:245
SAC_CHANNEL_LOCK ChannelOBufferLock
Definition: sacdrv.h:472
GUID ChannelGuid
Definition: sacdrv.h:296
struct _SAC_CHANNEL_LOCK * PSAC_CHANNEL_LOCK
FORCEINLINE VOID SacAcquireLock(IN PSAC_CHANNEL_LOCK Lock)
Definition: sacdrv.h:1262
FORCEINLINE VOID SacReleaseMutexLock(VOID)
Definition: sacdrv.h:1320
ULONG Signature
Definition: sacdrv.h:193
struct _SAC_MEMORY_ENTRY * PSAC_MEMORY_ENTRY
struct _SAC_CELL_DATA SAC_CELL_DATA
KSPIN_LOCK Lock
Definition: sacdrv.h:515
PSAC_CHANNEL_OFLUSH ChannelOutputFlush
Definition: sacdrv.h:462
VOID NTAPI MyFreePool(IN PVOID *Block)
Definition: memory.c:234
NTSTATUS NTAPI DispatchShutdownControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:29
enum _SAC_CHANNEL_STATUS SAC_CHANNEL_STATUS
PSAC_CHANNEL_CREATE ChannelCreate
Definition: sacdrv.h:460
NTSTATUS NTAPI ChanMgrReleaseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:243
VOID NTAPI SacPutString(IN PWCHAR String)
Definition: conmgr.c:41
WCHAR NTAPI VTUTF8ChannelIReadLast(IN PSAC_CHANNEL Channel)
Definition: vtutf8chan.c:1313
* PFILE_OBJECT
Definition: iotypes.h:1998
FORCEINLINE VOID SacAcquireMutexLock(VOID)
Definition: sacdrv.h:1308
BOOLEAN Initialized
Definition: sacdrv.h:509
struct _SAC_MEMORY_LIST SAC_MEMORY_LIST
SAC_CHANNEL_LOCK ChannelIBufferLock
Definition: sacdrv.h:473
Definition: ncftp.h:79
BOOLEAN NTAPI ChannelIsActive(IN PSAC_CHANNEL Channel)
Definition: channel.c:250
NTSTATUS NTAPI ChanMgrCreateChannel(OUT PSAC_CHANNEL *Channel, IN PSAC_CHANNEL_ATTRIBUTES Attributes)
Definition: chanmgr.c:345
SAC_CHANNEL_TYPE ChannelType
Definition: sacdrv.h:441
VOID NTAPI DoRebootCommand(IN BOOLEAN Reboot)
Definition: concmd.c:355
struct _SAC_CELL_DATA * PSAC_CELL_DATA
unsigned char UCHAR
Definition: xmlstorage.h:181
char * PBOOLEAN
Definition: retypes.h:11
VOID NTAPI KeInitializeMutex(IN PKMUTEX Mutex, IN ULONG Level)
Definition: mutex.c:67
VOID NTAPI FreeMemoryManagement(VOID)
Definition: memory.c:62
NTSTATUS NTAPI ChannelIWrite(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: channel.c:116
VOID NTAPI FreeDeviceData(IN PDEVICE_OBJECT DeviceObject)
Definition: data.c:147
VOID NTAPI DoPagingCommand(VOID)
Definition: concmd.c:420
Definition: ketypes.h:687
Definition: sacdrv.h:278
NTSTATUS NTAPI SerialBufferGetChar(OUT PCHAR Char)
Definition: util.c:1212
#define NTSTATUS
Definition: precomp.h:20
NTSTATUS NTAPI RegisterBlueScreenMachineInformation(VOID)
Definition: util.c:1104
VOID NTAPI DoGetNetInfo(IN BOOLEAN DoPrint)
Definition: concmd.c:557
NTSTATUS NTAPI ImposeSacCmdServiceStartTypePolicy(VOID)
Definition: util.c:1008
ULONG Flags
Definition: sacdrv.h:445
NTSTATUS NTAPI ConMgrShutdown(VOID)
Definition: conmgr.c:372
UCHAR CellFlags
Definition: sacdrv.h:316
Definition: typedefs.h:119
NTSTATUS NTAPI ChanMgrGetNextActiveChannel(IN PSAC_CHANNEL CurrentChannel, IN PULONG TargetIndex, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:521
UCHAR CellBackColor
Definition: sacdrv.h:314
NTSTATUS NTAPI VTUTF8ChannelIRead(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize, IN PULONG ReturnBufferSize)
Definition: vtutf8chan.c:1234
#define SAC_VTUTF8_COL_WIDTH
Definition: sacdrv.h:157
PWCHAR MachineGuid
Definition: sacdrv.h:495
struct _SAC_CHANNEL * PSAC_CHANNEL
PCHAR OBuffer
Definition: sacdrv.h:456
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
ULONG NTAPI VTUTF8ChannelIBufferLength(IN PSAC_CHANNEL Channel)
Definition: vtutf8chan.c:1303
UCHAR CellForeColor
Definition: sacdrv.h:315
LIST_ENTRY List
Definition: sacdrv.h:522
UCHAR CursorCol
Definition: sacdrv.h:452
HANDLE WorkerThreadHandle
Definition: sacdrv.h:518
struct _SAC_STATIC_ESCAPE_STRING SAC_STATIC_ESCAPE_STRING
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1098
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
ULONG Index
Definition: sacdrv.h:207
VOID NTAPI DoLimitMemoryCommand(IN PCHAR LimitString)
Definition: concmd.c:459
_SAC_CHANNEL_STATUS
Definition: sacdrv.h:285
BOOLEAN RundownInProgress
Definition: sacdrv.h:512
ULONG_PTR SIZE_T
Definition: typedefs.h:80
PSAC_CHANNEL_IREAD_LAST ChannelInputReadLast
Definition: sacdrv.h:468
NTSTATUS(NTAPI * PSAC_CHANNEL_OWRITE)(IN struct _SAC_CHANNEL *Channel, IN PCHAR String, IN ULONG Length)
Definition: sacdrv.h:379
VOID NTAPI FreeGlobalData(VOID)
Definition: data.c:100
PSAC_CHANNEL_DESTROY ChannelDestroy
Definition: sacdrv.h:461
PKEVENT HasNewDataEventWaitObjectBody
Definition: sacdrv.h:433
_In_ ULONG _In_ ULONG _In_ ULONG DestinationBufferSize
Definition: tdikrnl.h:1006
NTSTATUS NTAPI ChannelHasRedrawEvent(IN PSAC_CHANNEL Channel, OUT PBOOLEAN Present)
Definition: channel.c:209
LONG NTAPI KeReleaseSemaphore(IN PKSEMAPHORE Semaphore, IN KPRIORITY Increment, IN LONG Adjustment, IN BOOLEAN Wait)
Definition: semphobj.c:54
Definition: sacdrv.h:268
HANDLE CloseEvent
Definition: sacdrv.h:428
struct _SAC_CHANNEL_ID SAC_CHANNEL_ID
VOID NTAPI DoCrashCommand(VOID)
Definition: concmd.c:466
UCHAR CursorRow
Definition: sacdrv.h:451
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
#define FORCEINLINE
Definition: wdftypes.h:67
NTSTATUS NTAPI DispatchDeviceControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: dispatch.c:21
KMUTEX CurrentChannelLock
Definition: conmgr.c:24
C_ASSERT(sizeof(SAC_CELL_DATA)==6)
unsigned int * PULONG
Definition: retypes.h:1
#define NULL
Definition: types.h:112
LONG ChannelHasNewIBufferData
Definition: sacdrv.h:450
NTSTATUS NTAPI RawChannelCreate(IN PSAC_CHANNEL Channel)
Definition: rawchan.c:17
VOID NTAPI DoRaisePriorityCommand(IN PCHAR PrioString)
Definition: concmd.c:452
NTSTATUS NTAPI ConMgrFlushData(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:139
ULONG Signature
Definition: sacdrv.h:199
NTSTATUS NTAPI RawChannelOEcho(IN PSAC_CHANNEL Channel, IN PCHAR String, IN ULONG Length)
Definition: rawchan.c:115
_SAC_ANSI_COMMANDS
Definition: sacdrv.h:214
#define SEMAPHORE_INCREMENT
Definition: iotypes.h:610
VOID NTAPI DoLowerPriorityCommand(IN PCHAR PrioString)
Definition: concmd.c:445
PWCHAR ProductType
Definition: sacdrv.h:499
PSAC_CHANNEL_OWRITE ChannelOutputWrite
Definition: sacdrv.h:464
SAC_CELL_DATA Cell[SAC_VTUTF8_ROW_HEIGHT][SAC_VTUTF8_COL_WIDTH]
Definition: sacdrv.h:326
_In_ HANDLE Handle
Definition: extypes.h:390
#define OUT
Definition: typedefs.h:40
WCHAR NameBuffer[SAC_CHANNEL_NAME_SIZE+1]
Definition: sacdrv.h:443
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:124
PSAC_MEMORY_ENTRY LocalDescriptor
Definition: sacdrv.h:200
unsigned int ULONG
Definition: retypes.h:1
KEVENT WorkerThreadEvent
Definition: sacdrv.h:519
NTSTATUS NTAPI ChannelCreate(IN PSAC_CHANNEL Channel, IN PSAC_CHANNEL_ATTRIBUTES Attributes, IN SAC_CHANNEL_ID ChannelId)
Definition: channel.c:457
Definition: sacdrv.h:279
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:560
VOID NTAPI DoChannelCommand(IN PCHAR ChannelString)
Definition: concmd.c:484
PSAC_CHANNEL_IBUFFER_FULL ChannelInputBufferIsFull
Definition: sacdrv.h:469
VOID NTAPI DoLockCommand(VOID)
Definition: concmd.c:498
Definition: File.h:15
NTSTATUS NTAPI VTUTF8ChannelOWrite(IN PSAC_CHANNEL Channel, IN PCHAR String, IN ULONG Length)
Definition: vtutf8chan.c:1167
WCHAR NTAPI ChannelIReadLast(IN PSAC_CHANNEL Channel)
Definition: channel.c:150
NTSTATUS NTAPI RawChannelOFlush(IN PSAC_CHANNEL Channel)
Definition: rawchan.c:172
PSAC_CHANNEL_IBUFFER_LENGTH ChannelInputBufferLength
Definition: sacdrv.h:470
PVOID HasNewDataEventObjectBody
Definition: sacdrv.h:432
ULONG NTAPI RawChannelIBufferLength(IN PSAC_CHANNEL Channel)
Definition: rawchan.c:310
BOOLEAN NTAPI SacPutSimpleMessage(IN ULONG MessageIndex)
Definition: conmgr.c:57
FORCEINLINE VOID SacInitializeMutexLock(VOID)
Definition: sacdrv.h:1297
NTSTATUS NTAPI VTUTF8ChannelOEcho(IN PSAC_CHANNEL Channel, IN PCHAR String, IN ULONG Length)
Definition: vtutf8chan.c:1077
#define SAC_CHANNEL_NAME_SIZE
Definition: sacdrv.h:152
UCHAR CellForeColor
Definition: sacdrv.h:453
NTSTATUS NTAPI ChanMgrShutdown(VOID)
Definition: chanmgr.c:144
LONG SerialPortProducerIndex
Definition: util.c:34
NTSTATUS(NTAPI * PSAC_CHANNEL_CREATE)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:344
struct _SAC_MACHINE_INFO SAC_MACHINE_INFO
#define BufferSize
Definition: mmc.h:75
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
LONG WriteEnabled
Definition: sacdrv.h:447
NTSTATUS NTAPI ChannelDestroy(IN PSAC_CHANNEL Channel)
Definition: channel.c:77
struct _SAC_CHANNEL_LOCK SAC_CHANNEL_LOCK
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
PVOID CloseEventObjectBody
Definition: sacdrv.h:429
SAC_CHANNEL_ID ChannelId
Definition: sacdrv.h:427
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675