ReactOS  0.4.13-dev-257-gfabbd7c
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  goto FailChannel; \
78  } \
79  Channel->x = Attributes->x; \
80  Channel->x##ObjectBody = Object; \
81  Channel->x##WaitObjectBody = WaitObject; \
82  } \
83 }
84 #define ChannelUninitializeEvent(Channel, x, f) \
85 { \
86  ASSERT(ChannelGetFlags(Channel) & (f)); \
87  ASSERT(Channel->x##ObjectBody); \
88  ASSERT(Channel->x##WaitObjectBody); \
89  if (Channel->x##ObjectBody) \
90  { \
91  ObDereferenceObject(Channel->x##ObjectBody); \
92  Channel->Flags &= ~(f); \
93  Channel->x = NULL; \
94  Channel->x##ObjectBody = NULL; \
95  Channel->x##WaitObjectBody = NULL; \
96  } \
97 }
98 #define ChannelSetEvent(Channel, x) \
99 { \
100  ASSERT(Channel->x); \
101  ASSERT(Channel->x##ObjectBody); \
102  ASSERT(Channel->x##WaitObjectBody); \
103  if (Channel->x##WaitObjectBody) \
104  { \
105  KeSetEvent(Channel->x##WaitObjectBody, EVENT_INCREMENT, FALSE); \
106  Status = STATUS_SUCCESS; \
107  } \
108  else \
109  { \
110  Status = STATUS_UNSUCCESSFUL; \
111  } \
112 }
113 #define ChannelClearEvent(Channel, x) \
114 { \
115  ASSERT(Channel->x); \
116  ASSERT(Channel->x##ObjectBody); \
117  ASSERT(Channel->x##WaitObjectBody); \
118  if (Channel->x##WaitObjectBody) \
119  { \
120  KeClearEvent(Channel->x##WaitObjectBody); \
121  Status = STATUS_SUCCESS; \
122  } \
123  else \
124  { \
125  Status = STATUS_UNSUCCESSFUL; \
126  } \
127 }
128 
129 //
130 // SAC Pool Tags, taken from pooltag.txt:
131 //
132 // Rcp? - sacdrv.sys - SAC Driver (Headless)
133 // RcpA - sacdrv.sys - Internal memory mgr alloc block
134 // RcpI - sacdrv.sys - Internal memory mgr initial heap block
135 // RcpS - sacdrv.sys - Security related block
136 #define GENERIC_TAG '?pcR'
137 #define ALLOC_BLOCK_TAG 'ApcR'
138 #define INITIAL_BLOCK_TAG 'IpcR'
139 #define SECURITY_BLOCK_TAG 'SpcR'
140 #define FREE_POOL_TAG 'FpcR'
141 #define GLOBAL_BLOCK_TAG 'GpcR'
142 #define CHANNEL_BLOCK_TAG 'CpcR'
143 #define LOCAL_MEMORY_SIGNATURE 'SSEL'
144 #define GLOBAL_MEMORY_SIGNATURE 'DAEH'
145 
146 //
147 // Size Definitions
148 //
149 #define SAC_MEMORY_LIST_SIZE (1 * 1024 * 1024) // 1MB
150 #define SAC_OBUFFER_SIZE (2 * 1024) // 2KB
151 #define SAC_CHANNEL_NAME_SIZE 64
152 #define SAC_CHANNEL_DESCRIPTION_SIZE 256
153 #define SAC_MAX_CHANNELS 10
154 #define SAC_SERIAL_PORT_BUFFER_SIZE 1024 // 1KB
155 #define SAC_MAX_MESSAGES 200
156 #define SAC_VTUTF8_COL_WIDTH 80
157 #define SAC_VTUTF8_COL_HEIGHT 25
158 #define SAC_VTUTF8_ROW_HEIGHT 24
159 #define MAX_UTF8_ENCODE_BLOCK_LENGTH (Utf8ConversionBufferSize / 3 - 1)
160 #define SAC_VTUTF8_OBUFFER_SIZE 0x2D00
161 #define SAC_VTUTF8_IBUFFER_SIZE 0x2000
162 #define SAC_RAW_OBUFFER_SIZE 0x2000
163 #define SAC_RAW_IBUFFER_SIZE 0x2000
164 
165 //
166 // Channel flags
167 //
168 #define SAC_CHANNEL_FLAG_INTERNAL 0x1
169 #define SAC_CHANNEL_FLAG_CLOSE_EVENT 0x2
170 #define SAC_CHANNEL_FLAG_HAS_NEW_DATA_EVENT 0x4
171 #define SAC_CHANNEL_FLAG_LOCK_EVENT 0x8
172 #define SAC_CHANNEL_FLAG_REDRAW_EVENT 0x10
173 #define SAC_CHANNEL_FLAG_APPLICATION 0x20
174 
175 //
176 // Cell Flags
177 //
178 #define SAC_CELL_FLAG_BLINK 1
179 #define SAC_CELL_FLAG_BOLD 2
180 #define SAC_CELL_FLAG_INVERTED 4
181 
182 //
183 // Forward definitions
184 //
185 struct _SAC_CHANNEL;
186 
187 //
188 // Structures used by the SAC Heap Allocator
189 //
190 typedef struct _SAC_MEMORY_ENTRY
191 {
196 typedef struct _SAC_MEMORY_LIST
197 {
203 
204 typedef struct _SAC_MESSAGE_ENTRY
205 {
209 
210 //
211 // These are the VT-100/220/ANSI Escape Codes supported by SAC as input
212 //
213 typedef enum _SAC_ANSI_COMMANDS
214 {
240 
241 //
242 // These are the VT-100/220/ANSI Escape Codes send by SAC as output
243 //
244 typedef enum _SAC_ANSI_DISPATCH
245 {
259 
260 //
261 // Commands that the consumer and producer share
262 //
263 typedef enum _SAC_POST_COMMANDS
264 {
270 
271 //
272 // SAC supports 3 different channel output types
273 //
274 typedef enum _SAC_CHANNEL_TYPE
275 {
280 
281 //
282 // A SAC channel can be active or inactive
283 //
285 {
289 
290 //
291 // A SAC channel identifier
292 //
293 typedef struct _SAC_CHANNEL_ID
294 {
298 
299 //
300 // Reference-counted SAC channel semaphore lock
301 //
302 typedef struct _SAC_CHANNEL_LOCK
303 {
307 
308 //
309 // Structure of the cell-buffer when in VT-UTF8 Mode
310 //
311 typedef struct _SAC_CELL_DATA
312 {
318 C_ASSERT(sizeof(SAC_CELL_DATA) == 6);
319 
320 //
321 // Screen buffer when in VT-UTF8 Mode
322 //
323 typedef struct _SAC_VTUTF8_SCREEN
324 {
327 
328 //
329 // Small optimization to easily recognize the most common VT-100/ANSI codes
330 //
332 {
337 
338 //
339 // Channel callbacks
340 //
341 typedef
342 NTSTATUS
344  IN struct _SAC_CHANNEL* Channel
345 );
346 
347 typedef
348 NTSTATUS
350  IN struct _SAC_CHANNEL* Channel
351 );
352 
353 typedef
354 NTSTATUS
356  IN struct _SAC_CHANNEL* Channel,
357  IN PCHAR Buffer,
360 );
361 
362 typedef
363 NTSTATUS
365  IN struct _SAC_CHANNEL* Channel,
366  IN PCHAR String,
367  IN ULONG Length
368 );
369 
370 typedef
371 NTSTATUS
373  IN struct _SAC_CHANNEL* Channel
374 );
375 
376 typedef
377 NTSTATUS
379  IN struct _SAC_CHANNEL* Channel,
380  IN PCHAR String,
381  IN ULONG Length
382 );
383 
384 typedef
385 NTSTATUS
387  IN struct _SAC_CHANNEL* Channel,
388  IN PCHAR Buffer,
391 );
392 
393 typedef
394 NTSTATUS
396  IN struct _SAC_CHANNEL* Channel,
397  OUT PBOOLEAN BufferStatus
398 );
399 
400 typedef
401 ULONG
403  IN struct _SAC_CHANNEL* Channel
404 );
405 
406 typedef
407 WCHAR
409  IN struct _SAC_CHANNEL* Channel
410 );
411 
412 typedef
413 NTSTATUS
415  IN struct _SAC_CHANNEL* Channel,
416  IN PCHAR Buffer,
418 );
419 
420 //
421 // A channel and its attributes
422 //
423 typedef struct _SAC_CHANNEL
424 {
474 
476 {
487 
488 //
489 // Cached Machine Information
490 //
491 typedef struct _SAC_MACHINE_INFO
492 {
501 
502 //
503 // The device extension for the SAC
504 //
505 typedef struct _SAC_DEVICE_EXTENSION
506 {
523 
524 //
525 // Dispatch Routines
526 //
527 NTSTATUS
528 NTAPI
529 Dispatch(
531  IN PIRP Irp
532 );
533 
534 NTSTATUS
535 NTAPI
538  IN PIRP Irp
539 );
540 
541 NTSTATUS
542 NTAPI
545  IN PIRP Irp
546 );
547 
548 VOID
549 NTAPI
552 );
553 
554 //
555 // Initialization and shutdown routines
556 //
557 VOID
558 NTAPI
560  VOID
561 );
562 
563 VOID
564 NTAPI
567 );
568 
569 BOOLEAN
570 NTAPI
573 );
574 
575 BOOLEAN
576 NTAPI
580 );
581 
582 BOOLEAN
583 NTAPI
585  VOID
586 );
587 
588 VOID
589 NTAPI
591  VOID
592 );
593 
594 VOID
595 NTAPI
597  VOID
598 );
599 
600 VOID
601 NTAPI
603  VOID
604 );
605 
606 NTSTATUS
607 NTAPI
609  IN PVOID ImageBase
610 );
611 
612 NTSTATUS
613 NTAPI
615  VOID
616 );
617 
618 NTSTATUS
619 NTAPI
621  OUT PBOOLEAN Permission
622 );
623 
624 NTSTATUS
625 NTAPI
627  VOID
628 );
629 
630 NTSTATUS
631 NTAPI
633  VOID
634 );
635 
636 VOID
637 NTAPI
639  VOID
640 );
641 
642 //
643 // DPC, Timer, Thread Callbacks
644 //
645 VOID
646 NTAPI
648  IN PKDPC Dpc,
652 );
653 
654 //
655 // Custom SAC Heap Allocator Routines
656 //
657 PVOID
658 NTAPI
660  IN SIZE_T PoolSize,
661  IN ULONG Tag,
662  IN PCHAR File,
663  IN ULONG Line
664 );
665 
666 VOID
667 NTAPI
668 MyFreePool(
669  IN PVOID *Block
670 );
671 
672 //
673 // Connection Manager Routines
674 //
675 NTSTATUS
676 NTAPI
678  VOID
679 );
680 
681 VOID
682 NTAPI
684  IN PSAC_DEVICE_EXTENSION DeviceExtension
685 );
686 
687 NTSTATUS
688 NTAPI
690  VOID
691 );
692 
693 BOOLEAN
694 NTAPI
696  IN ULONG MessageIndex,
697  IN BOOLEAN LockHeld
698 );
699 
700 BOOLEAN
701 NTAPI
703  IN ULONG MessageIndex
704 );
705 
706 VOID
707 NTAPI
710 );
711 
712 NTSTATUS
713 NTAPI
715  IN PSAC_CHANNEL Channel,
716  IN PVOID Buffer,
718 );
719 
720 NTSTATUS
721 NTAPI
723  IN PSAC_CHANNEL Channel
724 );
725 
726 BOOLEAN
727 NTAPI
729  IN PSAC_CHANNEL Channel
730 );
731 
732 NTSTATUS
733 NTAPI
736  IN PSAC_CHANNEL Channel,
737  OUT PVOID Data
738 );
739 
740 //
741 // Channel Manager Routines
742 //
743 NTSTATUS
744 NTAPI
746  VOID
747 );
748 
749 NTSTATUS
750 NTAPI
752  VOID
753 );
754 
755 NTSTATUS
756 NTAPI
758  OUT PSAC_CHANNEL *Channel,
760 );
761 
762 NTSTATUS
763 NTAPI
765  IN SAC_CHANNEL_ID ChannelId,
766  OUT PSAC_CHANNEL* TargetChannel
767 );
768 
769 NTSTATUS
770 NTAPI
772  IN PSAC_CHANNEL Channel
773 );
774 
775 NTSTATUS
776 NTAPI
779  IN PULONG TargetIndex,
780  OUT PSAC_CHANNEL *TargetChannel
781 );
782 
783 NTSTATUS
784 NTAPI
786  IN PSAC_CHANNEL Channel
787 );
788 
789 //
790 // Channel Routines
791 //
792 NTSTATUS
793 NTAPI
795  IN PSAC_CHANNEL Channel
796 );
797 
798 BOOLEAN
799 NTAPI
801  IN PSAC_CHANNEL Channel,
802  IN PSAC_CHANNEL_ID ChannelId
803 );
804 
805 NTSTATUS
806 NTAPI
808  IN PSAC_CHANNEL Channel,
809  IN PCHAR Buffer,
811 );
812 
813 NTSTATUS
814 NTAPI
816  IN PSAC_CHANNEL Channel
817 );
818 
819 NTSTATUS
820 NTAPI
822  IN PSAC_CHANNEL Channel
823 );
824 
825 NTSTATUS
826 NTAPI
828  IN PSAC_CHANNEL Channel
829 );
830 
831 NTSTATUS
832 NTAPI
834  IN PSAC_CHANNEL Channel,
835  OUT PBOOLEAN Present
836 );
837 
838 BOOLEAN
839 NTAPI
841  IN PSAC_CHANNEL Channel
842 );
843 
844 NTSTATUS
845 NTAPI
847  IN PSAC_CHANNEL Channel,
848  OUT PWCHAR *Name
849 );
850 
851 BOOLEAN
852 NTAPI
854  IN PSAC_CHANNEL Channel,
855  IN PSAC_CHANNEL_ID ChannelId
856 );
857 
858 NTSTATUS
859 NTAPI
861  IN PSAC_CHANNEL Channel,
863  IN SAC_CHANNEL_ID ChannelId
864 );
865 
866 NTSTATUS
867 NTAPI
869  IN PSAC_CHANNEL Channel
870 );
871 
872 NTSTATUS
873 NTAPI
875  IN PSAC_CHANNEL Channel,
876  IN PCHAR Buffer,
878 );
879 
880 WCHAR
881 NTAPI
883  IN PSAC_CHANNEL Channel
884 );
885 
886 ULONG
887 NTAPI
889  IN PSAC_CHANNEL Channel
890 );
891 
892 NTSTATUS
893 NTAPI
895  IN PSAC_CHANNEL Channel,
896  IN PCHAR Buffer,
898  IN OUT PULONG ResultBufferSize
899 );
900 
901 //
902 // RAW Channel Table
903 //
904 NTSTATUS
905 NTAPI
907  IN PSAC_CHANNEL Channel
908 );
909 
910 NTSTATUS
911 NTAPI
913  IN PSAC_CHANNEL Channel
914 );
915 
916 NTSTATUS
917 NTAPI
919  IN PSAC_CHANNEL Channel,
920  IN PCHAR Buffer,
923 );
924 
925 NTSTATUS
926 NTAPI
928  IN PSAC_CHANNEL Channel,
929  IN PCHAR String,
930  IN ULONG Length
931 );
932 
933 NTSTATUS
934 NTAPI
936  IN PSAC_CHANNEL Channel
937 );
938 
939 NTSTATUS
940 NTAPI
942  IN PSAC_CHANNEL Channel,
943  IN PCHAR String,
944  IN ULONG Length
945 );
946 
947 NTSTATUS
948 NTAPI
950  IN PSAC_CHANNEL Channel,
951  IN PCHAR Buffer,
954 );
955 
956 NTSTATUS
957 NTAPI
959  IN PSAC_CHANNEL Channel,
960  OUT PBOOLEAN BufferStatus
961 );
962 
963 ULONG
964 NTAPI
966  IN PSAC_CHANNEL Channel
967 );
968 
969 WCHAR
970 NTAPI
972  IN PSAC_CHANNEL Channel
973 );
974 
975 NTSTATUS
976 NTAPI
978  IN PSAC_CHANNEL Channel,
979  IN PCHAR Buffer,
981 );
982 
983 //
984 // VT-UTF8 Channel Table
985 //
986 NTSTATUS
987 NTAPI
989  IN PSAC_CHANNEL Channel
990 );
991 
992 NTSTATUS
993 NTAPI
995  IN PSAC_CHANNEL Channel
996 );
997 
998 NTSTATUS
999 NTAPI
1001  IN PSAC_CHANNEL Channel,
1002  IN PCHAR Buffer,
1005 );
1006 
1007 NTSTATUS
1008 NTAPI
1010  IN PSAC_CHANNEL Channel,
1011  IN PCHAR String,
1012  IN ULONG Length
1013 );
1014 
1015 NTSTATUS
1016 NTAPI
1018  IN PSAC_CHANNEL Channel
1019 );
1020 
1021 NTSTATUS
1022 NTAPI
1024  IN PSAC_CHANNEL Channel,
1025  IN PCHAR String,
1026  IN ULONG Length
1027 );
1028 
1029 NTSTATUS
1030 NTAPI
1032  IN PSAC_CHANNEL Channel,
1033  IN PCHAR Buffer,
1036 );
1037 
1038 NTSTATUS
1039 NTAPI
1041  IN PSAC_CHANNEL Channel,
1042  OUT PBOOLEAN BufferStatus
1043 );
1044 
1045 ULONG
1046 NTAPI
1048  IN PSAC_CHANNEL Channel
1049 );
1050 
1051 WCHAR
1052 NTAPI
1054  IN PSAC_CHANNEL Channel
1055 );
1056 
1057 NTSTATUS
1058 NTAPI
1060  IN PSAC_CHANNEL Channel,
1061  IN PCHAR Buffer,
1063 );
1064 
1065 
1066 //
1067 // Helper Routines
1068 //
1069 BOOLEAN
1070 NTAPI
1072  IN CHAR Utf8Char,
1073  IN PCHAR Utf8Buffer,
1074  OUT PWCHAR Utf8Value
1075 );
1076 
1077 ULONG
1078 NTAPI
1080  IN ULONG MessageIndex
1081 );
1082 
1083 NTSTATUS
1084 NTAPI
1086  OUT PCHAR Char
1087 );
1088 
1089 NTSTATUS
1090 NTAPI
1092  IN PWCHAR String
1093 );
1094 
1095 NTSTATUS
1096 NTAPI
1098  IN PWCHAR *Buffer,
1099  IN PWCHAR ExtraData
1100 );
1101 
1102 PWCHAR
1103 NTAPI
1104 GetMessage(
1105  IN ULONG MessageIndex
1106 );
1107 
1108 BOOLEAN
1109 NTAPI
1111  IN HANDLE Handle,
1112  OUT PVOID *WaitObject,
1113  OUT PVOID *ActualWaitObject
1114 );
1115 
1116 BOOLEAN
1117 NTAPI
1119  IN PWCHAR SourceBuffer,
1120  IN ULONG SourceBufferLength,
1121  OUT PCHAR DestinationBuffer,
1123  OUT PULONG UTF8Count,
1124  OUT PULONG ProcessedCount
1125 );
1126 
1127 //
1128 // SAC Command Functions
1129 //
1130 VOID
1131 NTAPI
1133  IN BOOLEAN Reboot
1134 );
1135 
1136 VOID
1137 NTAPI
1139  VOID
1140 );
1141 
1142 VOID
1143 NTAPI
1145  VOID
1146 );
1147 
1148 VOID
1149 NTAPI
1151  IN PCHAR InputTime
1152 );
1153 
1154 VOID
1155 NTAPI
1157  IN PCHAR KillString
1158 );
1159 
1160 VOID
1161 NTAPI
1163  IN PCHAR PrioString
1164 );
1165 
1166 VOID
1167 NTAPI
1169  IN PCHAR PrioString
1170 );
1171 
1172 VOID
1173 NTAPI
1175  IN PCHAR LimitString
1176 );
1177 
1178 VOID
1179 NTAPI
1181  VOID
1182 );
1183 
1184 VOID
1185 NTAPI
1187  VOID
1188 );
1189 
1190 VOID
1191 NTAPI
1193  IN PCHAR ChannelString
1194 );
1195 
1196 VOID
1197 NTAPI
1198 DoCmdCommand(
1199  IN PCHAR InputString
1200 );
1201 
1202 VOID
1203 NTAPI
1205  VOID
1206 );
1207 
1208 VOID
1209 NTAPI
1211  VOID
1212 );
1213 
1214 VOID
1215 NTAPI
1216 DoGetNetInfo(
1218 );
1219 
1220 VOID
1221 NTAPI
1223  IN PCHAR IpString
1224 );
1225 
1226 VOID
1227 NTAPI
1229  VOID
1230 );
1231 
1232 //
1233 // External data
1234 //
1235 extern ULONG SACDebug;
1237 extern KMUTEX CurrentChannelLock;
1239 extern PCHAR SerialPortBuffer;
1245 
1246 //
1247 // Function to initialize a SAC Semaphore Lock
1248 //
1250 VOID
1252 {
1253  KeInitializeSemaphore(&Lock->Lock, 1, 1);
1254 }
1255 
1256 //
1257 // Function to acquire a SAC Semaphore Lock
1258 //
1260 VOID
1262 {
1264  ASSERT(Lock->RefCount == 0);
1266 }
1267 
1268 //
1269 // Function to release a SAC Semaphore Lock
1270 //
1272 VOID
1274 {
1275  ASSERT(Lock->RefCount == 1);
1278 }
1279 
1280 //
1281 // Function to check if the SAC Mutex Lock is held
1282 //
1284 VOID
1286 {
1288  ASSERT(KeReadStateMutex(&CurrentChannelLock) == 0);
1289 }
1290 
1291 //
1292 // Function to check if the SAC Mutex Lock is held
1293 //
1295 VOID
1297 {
1300 }
1301 
1302 //
1303 // Function to acquire the SAC Mutex Lock
1304 //
1306 VOID
1308 {
1312 }
1313 
1314 //
1315 // Function to release the SAC Mutex Lock
1316 //
1318 VOID
1320 {
1324 }
1325 
1326 //
1327 // Locking Macros
1328 //
1329 #define ChannelLockCreates() SacAcquireLock(&ChannelCreateLock);
1330 #define ChannelUnlockCreates() SacReleaseLock(&ChannelCreateLock);
1331 #define ChannelLockOBuffer(x) SacAcquireLock(&x->ChannelOBufferLock);
1332 #define ChannelUnlockOBuffer(x) SacReleaseLock(&x->ChannelOBufferLock);
1333 #define ChannelLockIBuffer(x) SacAcquireLock(&x->ChannelIBufferLock);
1334 #define ChannelUnlockIBuffer(x) SacReleaseLock(&x->ChannelIBufferLock);
1335 #define ChannelLockAttributes(x) SacAcquireLock(&x->ChannelAttributeLock);
1336 #define ChannelUnlockAttributes(x) SacReleaseLock(&x->ChannelAttributeLock);
1337 #define ChannelSlotLock(x) SacAcquireLock(&ChannelSlotLock[x]);
1338 #define ChannelSlotUnlock(x) SacReleaseLock(&ChannelSlotLock[x]);
1339 
1340 //
1341 // Channel Accessors
1342 //
1344 ULONG
1346 {
1347  return Channel->Flags;
1348 }
1349 
1351 LONG
1353 {
1354  /* Return the index of the channel */
1355  return Channel->Index;
1356 }
1357 
1359 BOOLEAN
1361 {
1362  /* Return if there's any new data in the input buffer */
1363  return Channel->ChannelHasNewIBufferData;
1364 }
1365 
1366 //
1367 // FIXME: ANSI.H
1368 //
1369 //
1370 // Source: http://en.wikipedia.org/wiki/ANSI_escape_code
1371 //
1373 {
1374  //
1375  // Attribute modifiers (mostly supported)
1376  //
1387 
1388  //
1389  // Font selectors (not supported)
1390  //
1401 
1402  //
1403  // Additional attributes (not supported)
1404  //
1407 
1408  //
1409  // Attribute Un-modifiers (mostly supported)
1410  //
1419 
1420  //
1421  // Standard Text Color
1422  //
1433 
1434  //
1435  // Extended Text Color (not supported)
1436  //
1439 
1440  //
1441  // Standard Background Color
1442  //
1453 
1454  //
1455  // Extended Background Color (not supported)
1456  //
1459 
1460  //
1461  // Extra Attributes (not supported)
1462  //
1473 
1474  //
1475  // Ideograms (not supported)
1476  //
1478 
1479 //
1480 // The following site is a good reference on VT100/ANSI escape codes
1481 // http://www.termsys.demon.co.uk/vtansi.htm
1482 //
1483 #define VT_ANSI_ESCAPE L'\x1B'
1484 #define VT_ANSI_COMMAND L'['
1485 
1486 #define VT_ANSI_CURSOR_UP_CHAR L'A'
1487 #define VT_ANSI_CURSOR_UP L"[A"
1488 
1489 #define VT_ANSI_CURSOR_DOWN_CHAR L'B'
1490 #define VT_ANSI_CURSOR_DOWN L"[B"
1491 
1492 #define VT_ANSI_CURSOR_RIGHT_CHAR L'C'
1493 #define VT_ANSI_CURSOR_RIGHT L"[C"
1494 
1495 #define VT_ANSI_CURSOR_LEFT_CHAR L'D'
1496 #define VT_ANSI_CURSOR_LEFT L"[D"
1497 
1498 #define VT_ANSI_ERASE_LINE_CHAR L'K'
1499 #define VT_ANSI_ERASE_END_LINE L"[K"
1500 #define VT_ANSI_ERASE_START_LINE L"[1K"
1501 #define VT_ANSI_ERASE_ENTIRE_LINE L"[2K"
1502 
1503 #define VT_ANSI_ERASE_SCREEN_CHAR L'J'
1504 #define VT_ANSI_ERASE_DOWN_SCREEN L"[J"
1505 #define VT_ANSI_ERASE_UP_SCREEN L"[1J"
1506 #define VT_ANSI_ERASE_ENTIRE_SCREEN L"[2J"
1507 
1508 #define VT_ANSI_BACKTAB_CHAR L'Z'
1509 #define VT_220_BACKTAB L"[0Z"
1510 
1511 #define VT_ANSI_SET_ATTRIBUTE_CHAR L'm'
1512 #define VT_ANSI_SEPARATOR_CHAR L';'
1513 #define VT_ANSI_HVP_CURSOR_CHAR L'f'
1514 #define VT_ANSI_CUP_CURSOR_CHAR L'H'
1515 #define VT_ANSI_SCROLL_CHAR L'r'
1516 
1517 #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:190
BOOLEAN NTAPI InitializeDeviceData(IN PDEVICE_OBJECT DeviceObject)
Definition: data.c:213
WCHAR DescriptionBuffer[SAC_CHANNEL_DESCRIPTION_SIZE+1]
Definition: sacdrv.h:443
PSAC_CHANNEL_OECHO ChannelOutputEcho
Definition: sacdrv.h:462
NTSTATUS NTAPI UTF8EncodeAndSend(IN PWCHAR String)
Definition: util.c:165
#define IN
Definition: typedefs.h:38
PCHAR Utf8ConversionBuffer
Definition: util.c:17
NTSTATUS NTAPI TranslateMachineInformationXML(IN PWCHAR *Buffer, IN PWCHAR ExtraData)
Definition: util.c:538
struct _SAC_DEVICE_EXTENSION SAC_DEVICE_EXTENSION
BOOLEAN PriorityFail
Definition: sacdrv.h:510
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:386
NTSTATUS(NTAPI * PSAC_CHANNEL_IBUFFER_FULL)(IN struct _SAC_CHANNEL *Channel, OUT PBOOLEAN BufferStatus)
Definition: sacdrv.h:395
ULONG Utf8ConversionBufferSize
Definition: util.c:18
_VT_ANSI_ATTRIBUTES
Definition: sacdrv.h:1372
ULONG ChannelId
Definition: sacdrv.h:296
PSAC_CHANNEL_OREAD ChannelOutputRead
Definition: sacdrv.h:464
VOID NTAPI FreeMachineInformation(VOID)
Definition: util.c:1153
LONG Index
Definition: sacdrv.h:425
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:193
ULONG IBufferIndex
Definition: sacdrv.h:447
_In_ NDIS_STATUS EventCode
Definition: ndis.h:4751
PCHAR IBuffer
Definition: sacdrv.h:448
enum _SAC_ANSI_DISPATCH SAC_ANSI_DISPATCH
struct _SAC_VTUTF8_SCREEN * PSAC_VTUTF8_SCREEN
struct _SAC_MESSAGE_ENTRY * PSAC_MESSAGE_ENTRY
Definition: sacdrv.h:204
NTSTATUS(NTAPI * PSAC_CHANNEL_OFLUSH)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:372
PDEVICE_OBJECT DeviceObject
Definition: sacdrv.h:507
enum _SAC_CHANNEL_STATUS * PSAC_CHANNEL_STATUS
BOOLEAN CommandConsoleLaunchingEnabled
Definition: data.c:16
NTSTATUS NTAPI VTUTF8ChannelDestroy(IN PSAC_CHANNEL Channel)
Definition: vtutf8chan.c:702
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:276
WCHAR DescriptionBuffer[SAC_CHANNEL_DESCRIPTION_SIZE+1]
Definition: sacdrv.h:479
_In_ PIRP Irp
Definition: csq.h:116
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:453
VOID NTAPI DoHelpCommand(VOID)
Definition: concmd.c:529
PFILE_OBJECT FileObject
Definition: sacdrv.h:439
FORCEINLINE ULONG ChannelGetFlags(IN PSAC_CHANNEL Channel)
Definition: sacdrv.h:1345
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:497
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:435
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:438
PEPROCESS Process
Definition: sacdrv.h:513
HANDLE LockEvent
Definition: sacdrv.h:433
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:429
HANDLE HasNewDataEvent
Definition: sacdrv.h:430
#define SAC_VTUTF8_ROW_HEIGHT
Definition: sacdrv.h:158
_In_ DWORD _In_ DWORD ReturnBufferSize
Definition: setupapi.h:1891
NTSTATUS NTAPI ConMgrWriteData(IN PSAC_CHANNEL Channel, IN PVOID Buffer, IN ULONG BufferLength)
Definition: conmgr.c:111
PWCHAR ServicePack
Definition: sacdrv.h:499
_SAC_CHANNEL_TYPE
Definition: sacdrv.h:274
NTSTATUS(NTAPI * PSAC_CHANNEL_DESTROY)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:349
_SAC_POST_COMMANDS
Definition: sacdrv.h:263
LONG CurrentChannelRefCount
Definition: conmgr.c:23
static WCHAR String[]
Definition: stringtable.c:55
SAC_CHANNEL_STATUS ChannelStatus
Definition: sacdrv.h:441
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:207
WCHAR Char
Definition: sacdrv.h:316
struct _SAC_CHANNEL_ATTRIBUTES SAC_CHANNEL_ATTRIBUTES
uint16_t * PWCHAR
Definition: typedefs.h:54
#define SAC_CHANNEL_DESCRIPTION_SIZE
Definition: sacdrv.h:152
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:1169
BOOLEAN GlobalDoThreads
Definition: conmgr.c:35
ULONG(NTAPI * PSAC_CHANNEL_IBUFFER_LENGTH)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:402
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:305
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:454
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:478
PWCHAR ProcessorArchitecture
Definition: sacdrv.h:495
NTSTATUS NTAPI ChannelSetRedrawEvent(IN PSAC_CHANNEL Channel)
Definition: channel.c:176
ULONG Size
Definition: sacdrv.h:194
SAC_CHANNEL_TYPE ChannelType
Definition: sacdrv.h:477
enum _VT_ANSI_ATTRIBUTES VT_ANSI_ATTRIBUTES
PWCHAR MachineName
Definition: sacdrv.h:493
LONG SerialPortConsumerIndex
Definition: util.c:34
GUID ApplicationType
Definition: sacdrv.h:445
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
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS NTAPI GetCommandConsoleLaunchingPermission(OUT PBOOLEAN Permission)
Definition: util.c:978
long LONG
Definition: pedump.c:60
_In_ ULONG BufferLength
Definition: usbdlib.h:225
NTSTATUS(NTAPI * PSAC_CHANNEL_IWRITE)(IN struct _SAC_CHANNEL *Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: sacdrv.h:414
enum _SAC_POST_COMMANDS SAC_POST_COMMANDS
enum _SAC_CHANNEL_TYPE SAC_CHANNEL_TYPE
char Char
Definition: bzip2.c:161
ULONG NTAPI GetMessageLineCount(IN ULONG MessageIndex)
Definition: util.c:1230
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:1251
VOID NTAPI InitializeCmdEventInfo(VOID)
Definition: util.c:1059
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:454
WCHAR(NTAPI * PSAC_CHANNEL_IREAD_LAST)(IN struct _SAC_CHANNEL *Channel)
Definition: sacdrv.h:408
VOID NTAPI DoSetIpAddressCommand(IN PCHAR IpString)
Definition: concmd.c:564
Definition: bl.h:892
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:355
PSAC_CHANNEL_IREAD ChannelInputRead
Definition: sacdrv.h:466
long __cdecl _InterlockedDecrement(_Interlocked_operand_ long volatile *_Addend)
PWCHAR MajorVersion
Definition: sacdrv.h:496
struct _SAC_MEMORY_LIST * PSAC_MEMORY_LIST
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN NTAPI InitializeGlobalData(IN PUNICODE_STRING RegistryPath, IN PDRIVER_OBJECT DriverObject)
Definition: data.c:371
FORCEINLINE VOID SacAssertMutexLockHeld(VOID)
Definition: sacdrv.h:1285
NTSTATUS NTAPI VTUTF8ChannelOFlush(IN PSAC_CHANNEL Channel)
Definition: vtutf8chan.c:725
#define FORCEINLINE
Definition: ntbasedef.h:221
static PDRIVER_OBJECT DriverObject
Definition: template.c:42
PWCHAR NTAPI GetMessage(IN ULONG MessageIndex)
Definition: util.c:139
ULONG OBufferIndex
Definition: sacdrv.h:456
Definition: bufpool.h:45
Definition: sacdrv.h:287
VOID NTAPI DoTlistCommand(VOID)
Definition: concmd.c:571
PVOID RedrawEventObjectBody
Definition: sacdrv.h:437
HANDLE RedrawEvent
Definition: sacdrv.h:436
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:1273
Definition: sacdrv.h:1378
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:201
PVOID LockEventObjectBody
Definition: sacdrv.h:434
PSAC_CHANNEL_IWRITE ChannelInputWrite
Definition: sacdrv.h:465
NTSTATUS NTAPI ChannelClose(IN PSAC_CHANNEL Channel)
Definition: channel.c:558
LONG ChannelHasNewOBufferData
Definition: sacdrv.h:458
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:1360
SAC_CHANNEL_LOCK ChannelAttributeLock
Definition: sacdrv.h:470
_In_ HANDLE Handle
Definition: extypes.h:390
FORCEINLINE LONG ChannelGetIndex(IN PSAC_CHANNEL Channel)
Definition: sacdrv.h:1352
ULONG OBufferFirstGoodIndex
Definition: sacdrv.h:457
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:524
KPRIORITY PriorityBoost
Definition: sacdrv.h:512
NTSTATUS(NTAPI * PSAC_CHANNEL_OECHO)(IN struct _SAC_CHANNEL *Channel, IN PCHAR String, IN ULONG Length)
Definition: sacdrv.h:364
VOID NTAPI KeInitializeSemaphore(IN PKSEMAPHORE Semaphore, IN LONG Count, IN LONG Limit)
Definition: semphobj.c:22
enum _SAC_ANSI_COMMANDS SAC_ANSI_COMMANDS
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:1379
__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:689
struct _SAC_CHANNEL SAC_CHANNEL
_SAC_ANSI_DISPATCH
Definition: sacdrv.h:244
SAC_CHANNEL_LOCK ChannelOBufferLock
Definition: sacdrv.h:471
GUID ChannelGuid
Definition: sacdrv.h:295
struct _SAC_CHANNEL_LOCK * PSAC_CHANNEL_LOCK
FORCEINLINE VOID SacAcquireLock(IN PSAC_CHANNEL_LOCK Lock)
Definition: sacdrv.h:1261
FORCEINLINE VOID SacReleaseMutexLock(VOID)
Definition: sacdrv.h:1319
Definition: bzip2.c:1694
ULONG Signature
Definition: sacdrv.h:192
struct _SAC_MEMORY_ENTRY * PSAC_MEMORY_ENTRY
struct _SAC_CELL_DATA SAC_CELL_DATA
KSPIN_LOCK Lock
Definition: sacdrv.h:514
#define BufferSize
Definition: classpnp.h:419
PSAC_CHANNEL_OFLUSH ChannelOutputFlush
Definition: sacdrv.h:461
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
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PSAC_CHANNEL_CREATE ChannelCreate
Definition: sacdrv.h:459
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:1954
FORCEINLINE VOID SacAcquireMutexLock(VOID)
Definition: sacdrv.h:1307
BOOLEAN Initialized
Definition: sacdrv.h:508
struct _SAC_MEMORY_LIST SAC_MEMORY_LIST
SAC_CHANNEL_LOCK ChannelIBufferLock
Definition: sacdrv.h:472
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
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:440
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:277
NTSTATUS NTAPI SerialBufferGetChar(OUT PCHAR Char)
Definition: util.c:1209
#define NTSTATUS
Definition: precomp.h:20
NTSTATUS NTAPI RegisterBlueScreenMachineInformation(VOID)
Definition: util.c:1101
VOID NTAPI DoGetNetInfo(IN BOOLEAN DoPrint)
Definition: concmd.c:557
NTSTATUS NTAPI ImposeSacCmdServiceStartTypePolicy(VOID)
Definition: util.c:1005
ULONG Flags
Definition: sacdrv.h:444
NTSTATUS NTAPI ConMgrShutdown(VOID)
Definition: conmgr.c:372
UCHAR CellFlags
Definition: sacdrv.h:315
Definition: typedefs.h:117
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
NTSTATUS NTAPI ChanMgrGetNextActiveChannel(IN PSAC_CHANNEL CurrentChannel, IN PULONG TargetIndex, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:521
UCHAR CellBackColor
Definition: sacdrv.h:313
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:156
PWCHAR MachineGuid
Definition: sacdrv.h:494
struct _SAC_CHANNEL * PSAC_CHANNEL
PCHAR OBuffer
Definition: sacdrv.h:455
ULONG NTAPI VTUTF8ChannelIBufferLength(IN PSAC_CHANNEL Channel)
Definition: vtutf8chan.c:1303
UCHAR CellForeColor
Definition: sacdrv.h:314
LIST_ENTRY List
Definition: sacdrv.h:521
UCHAR CursorCol
Definition: sacdrv.h:451
HANDLE WorkerThreadHandle
Definition: sacdrv.h:517
struct _SAC_STATIC_ESCAPE_STRING SAC_STATIC_ESCAPE_STRING
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _In_ LARGE_INTEGER ByteCount
Definition: iotypes.h:1060
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
ULONG Index
Definition: sacdrv.h:206
VOID NTAPI DoLimitMemoryCommand(IN PCHAR LimitString)
Definition: concmd.c:459
_SAC_CHANNEL_STATUS
Definition: sacdrv.h:284
BOOLEAN RundownInProgress
Definition: sacdrv.h:511
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
ULONG_PTR SIZE_T
Definition: typedefs.h:78
PSAC_CHANNEL_IREAD_LAST ChannelInputReadLast
Definition: sacdrv.h:467
NTSTATUS(NTAPI * PSAC_CHANNEL_OWRITE)(IN struct _SAC_CHANNEL *Channel, IN PCHAR String, IN ULONG Length)
Definition: sacdrv.h:378
VOID NTAPI FreeGlobalData(VOID)
Definition: data.c:100
PSAC_CHANNEL_DESTROY ChannelDestroy
Definition: sacdrv.h:460
PKEVENT HasNewDataEventWaitObjectBody
Definition: sacdrv.h:432
_Must_inspect_result_ _In_ USHORT _In_ PHIDP_PREPARSED_DATA _Out_writes_to_ LengthAttributes PHIDP_EXTENDED_ATTRIBUTES Attributes
Definition: hidpi.h:348
_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:267
HANDLE CloseEvent
Definition: sacdrv.h:427
struct _SAC_CHANNEL_ID SAC_CHANNEL_ID
NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS]
Definition: rwlock.h:22
VOID NTAPI DoCrashCommand(VOID)
Definition: concmd.c:466
UCHAR CursorRow
Definition: sacdrv.h:450
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
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
LONG ChannelHasNewIBufferData
Definition: sacdrv.h:449
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:198
NTSTATUS NTAPI RawChannelOEcho(IN PSAC_CHANNEL Channel, IN PCHAR String, IN ULONG Length)
Definition: rawchan.c:115
_SAC_ANSI_COMMANDS
Definition: sacdrv.h:213
#define SEMAPHORE_INCREMENT
Definition: iotypes.h:577
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
VOID NTAPI DoLowerPriorityCommand(IN PCHAR PrioString)
Definition: concmd.c:445
PWCHAR ProductType
Definition: sacdrv.h:498
PSAC_CHANNEL_OWRITE ChannelOutputWrite
Definition: sacdrv.h:463
#define OUT
Definition: typedefs.h:39
WCHAR NameBuffer[SAC_CHANNEL_NAME_SIZE+1]
Definition: sacdrv.h:442
PSAC_MEMORY_ENTRY LocalDescriptor
Definition: sacdrv.h:199
unsigned int ULONG
Definition: retypes.h:1
KEVENT WorkerThreadEvent
Definition: sacdrv.h:518
_In_ PUNICODE_STRING RegistryPath
Definition: wmip.h:27
NTSTATUS NTAPI ChannelCreate(IN PSAC_CHANNEL Channel, IN PSAC_CHANNEL_ATTRIBUTES Attributes, IN SAC_CHANNEL_ID ChannelId)
Definition: channel.c:457
Definition: sacdrv.h:278
VOID NTAPI DoChannelCommand(IN PCHAR ChannelString)
Definition: concmd.c:484
PSAC_CHANNEL_IBUFFER_FULL ChannelInputBufferIsFull
Definition: sacdrv.h:468
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:469
PVOID HasNewDataEventObjectBody
Definition: sacdrv.h:431
ULONG NTAPI RawChannelIBufferLength(IN PSAC_CHANNEL Channel)
Definition: rawchan.c:310
BOOLEAN NTAPI SacPutSimpleMessage(IN ULONG MessageIndex)
Definition: conmgr.c:57
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
FORCEINLINE VOID SacInitializeMutexLock(VOID)
Definition: sacdrv.h:1296
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:151
UCHAR CellForeColor
Definition: sacdrv.h:452
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:343
struct _SAC_MACHINE_INFO SAC_MACHINE_INFO
LONG WriteEnabled
Definition: sacdrv.h:446
NTSTATUS NTAPI ChannelDestroy(IN PSAC_CHANNEL Channel)
Definition: channel.c:77
struct _SAC_CHANNEL_LOCK SAC_CHANNEL_LOCK
PVOID CloseEventObjectBody
Definition: sacdrv.h:428
SAC_CHANNEL_ID ChannelId
Definition: sacdrv.h:426
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675