Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

icadis.c File Reference

#include "precomp.h"
#include "ntuser.h"
#include <winsta.h>
#include <wstmsg.h>
#include <icadd.h>

Go to the source code of this file.

Functions

NTSTATUS ConnectToTerminalServer (ULONG Access, PHANDLE pPortHandle)
NTSTATUS BrokenConnection (BROKENCLASS Reason, BROKENSOURCECLASS Source)
NTSTATUS ReplyMessageToTerminalServer (PCTXHARDERRORINFO pchi)
NTSTATUS ShadowHotkey ()

Variables

HANDLE WinStationIcaApiPort = NULL


Function Documentation

NTSTATUS BrokenConnection BROKENCLASS  Reason,
BROKENSOURCECLASS  Source
 

Definition at line 112 of file icadis.c.

References ConnectToTerminalServer(), DbgPrint, NT_SUCCESS, NtRequestWaitReplyPort(), NTSTATUS(), NULL, Status, TRUE, and WinStationIcaApiPort.

Referenced by Win32CommandChannelThread().

00115 { 00116 WINSTATION_APIMSG Msg; 00117 NTSTATUS Status; 00118 00119 /* 00120 * Connect to Session Mgr 00121 */ 00122 if (WinStationIcaApiPort == NULL) { 00123 Status = ConnectToTerminalServer(0, &WinStationIcaApiPort); //BUGBUG -- add access 00124 if (!NT_SUCCESS(Status)) { 00125 return (Status); 00126 } 00127 } 00128 00129 00130 Msg.h.u1.s1.DataLength = sizeof(Msg) - sizeof(PORT_MESSAGE); 00131 Msg.h.u1.s1.TotalLength = sizeof(Msg); 00132 Msg.h.u2.s2.Type = 0; // Kernel will fill in message type 00133 Msg.h.u2.s2.DataInfoOffset = 0; 00134 Msg.WaitForReply = TRUE; 00135 Msg.ApiNumber = SMWinStationBrokenConnection; 00136 Msg.ReturnedStatus = 0; 00137 00138 Msg.u.Broken.Reason = Reason; 00139 Msg.u.Broken.Source = Source; 00140 00141 Status = NtRequestWaitReplyPort(WinStationIcaApiPort, (PPORT_MESSAGE)&Msg, (PPORT_MESSAGE)&Msg); 00142 00143 00144 00145 00146 #if DBG 00147 if (!NT_SUCCESS(Status)) { 00148 DbgPrint("BrokenConnection: rc=0x%x\n", Status); 00149 } 00150 #endif 00151 00152 return (Status); 00153 }

NTSTATUS ConnectToTerminalServer ULONG  Access,
PHANDLE  pPortHandle
 

Definition at line 42 of file icadis.c.

References DbgPrint, DynamicQos, L, NT_SUCCESS, NtConnectPort(), NTSTATUS(), NULL, PortName, RtlInitUnicodeString(), Status, and TRUE.

Referenced by BrokenConnection(), ReplyMessageToTerminalServer(), and ShadowHotkey().

00045 { 00046 UNICODE_STRING PortName; 00047 SECURITY_QUALITY_OF_SERVICE DynamicQos; 00048 WINSTATIONAPI_CONNECT_INFO info; 00049 ULONG ConnectInfoLength; 00050 NTSTATUS Status; 00051 00052 /* 00053 * Set up SM API port name 00054 */ 00055 RtlInitUnicodeString(&PortName, L"\\SmSsWinStationApiPort"); 00056 00057 /* 00058 * Set up the security quality of service parameters to use over the 00059 * port. Use the most efficient (least overhead) - which is dynamic 00060 * rather than static tracking. 00061 */ 00062 DynamicQos.ImpersonationLevel = SecurityImpersonation; 00063 DynamicQos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING; 00064 DynamicQos.EffectiveOnly = TRUE; 00065 00066 /* 00067 * Fill in the ConnectInfo structure with our access request mask 00068 */ 00069 info.Version = CITRIX_WINSTATIONAPI_VERSION; 00070 info.RequestedAccess = Access; 00071 ConnectInfoLength = sizeof(WINSTATIONAPI_CONNECT_INFO); 00072 00073 // Attempt to connect to the Session Manager API port 00074 Status = NtConnectPort(pPortHandle, 00075 &PortName, 00076 &DynamicQos, 00077 NULL, 00078 NULL, 00079 NULL, // Max message length [select default] 00080 (PVOID)&info, 00081 &ConnectInfoLength); 00082 if (!NT_SUCCESS(Status)) { 00083 // Look at the returned INFO to see why if desired 00084 *pPortHandle = NULL; 00085 #if DBG 00086 if (ConnectInfoLength == sizeof(WINSTATIONAPI_CONNECT_INFO)) { 00087 DbgPrint("WinstationConnectToICASrv: connect failed, Reason 0x%x\n", info.AcceptStatus); 00088 } 00089 DbgPrint("WinstationConnectToICASrv: Connect failed 0x%x\n", Status); 00090 #endif 00091 return (Status); 00092 } 00093 00094 return (STATUS_SUCCESS); 00095 }

NTSTATUS ReplyMessageToTerminalServer PCTXHARDERRORINFO  pchi  ) 
 

Definition at line 168 of file icadis.c.

References ConnectToTerminalServer(), DbgPrint, tagCTXHARDERRORINFO::hEvent, NT_SUCCESS, NtClose(), NtRequestWaitReplyPort(), NTSTATUS(), PortHandle, tagCTXHARDERRORINFO::pResponse, tagCTXHARDERRORINFO::Response, Status, and TRUE.

Referenced by HardErrorRemove().

00170 { 00171 WINSTATION_APIMSG Msg; 00172 NTSTATUS Status; 00173 HANDLE PortHandle; 00174 00175 /* 00176 * Connect to Session Mgr 00177 */ 00178 Status = ConnectToTerminalServer(0, &PortHandle); //BUGBUG -- add access 00179 if (!NT_SUCCESS(Status)) { 00180 return (Status); 00181 } 00182 00183 00184 00185 00186 00187 Msg.h.u1.s1.DataLength = sizeof(Msg) - sizeof(PORT_MESSAGE); 00188 Msg.h.u1.s1.TotalLength = sizeof(Msg); 00189 Msg.h.u2.s2.Type = 0; // Kernel will fill in message type 00190 Msg.h.u2.s2.DataInfoOffset = 0; 00191 Msg.WaitForReply = TRUE; 00192 Msg.ApiNumber = SMWinStationIcaReplyMessage; 00193 Msg.ReturnedStatus = 0; 00194 00195 Msg.u.ReplyMessage.Response = pchi->Response; 00196 Msg.u.ReplyMessage.pResponse = pchi->pResponse; 00197 Msg.u.ReplyMessage.hEvent = pchi->hEvent; 00198 00199 Status = NtRequestWaitReplyPort(PortHandle, (PPORT_MESSAGE)&Msg, (PPORT_MESSAGE)&Msg); 00200 00201 00202 00203 00204 00205 #if DBG 00206 if (!NT_SUCCESS(Status)) { 00207 DbgPrint("ReplyMessageToTerminalServer: rc=0x%x\n", Status); 00208 } 00209 #endif 00210 NtClose(PortHandle); 00211 00212 return (Status); 00213 }

NTSTATUS ShadowHotkey  ) 
 

Definition at line 228 of file icadis.c.

References ConnectToTerminalServer(), DbgPrint, NT_SUCCESS, NtRequestWaitReplyPort(), NTSTATUS(), NULL, Status, TRUE, and WinStationIcaApiPort.

Referenced by Win32CommandChannelThread().

00229 { 00230 WINSTATION_APIMSG Msg; 00231 NTSTATUS Status; 00232 00233 /* 00234 * Connect to Session Mgr 00235 */ 00236 if (WinStationIcaApiPort == NULL) { 00237 Status = ConnectToTerminalServer(0, &WinStationIcaApiPort); //BUGBUG -- add access 00238 if (!NT_SUCCESS(Status)) { 00239 return (Status); 00240 } 00241 } 00242 00243 00244 00245 00246 00247 00248 Msg.h.u1.s1.DataLength = sizeof(Msg) - sizeof(PORT_MESSAGE); 00249 Msg.h.u1.s1.TotalLength = sizeof(Msg); 00250 Msg.h.u2.s2.Type = 0; // Kernel will fill in message type 00251 Msg.h.u2.s2.DataInfoOffset = 0; 00252 Msg.WaitForReply = TRUE; 00253 Msg.ApiNumber = SMWinStationIcaShadowHotkey; 00254 Msg.ReturnedStatus = 0; 00255 00256 Status = NtRequestWaitReplyPort(WinStationIcaApiPort, (PPORT_MESSAGE)&Msg, (PPORT_MESSAGE)&Msg); 00257 00258 00259 00260 #if DBG 00261 if (!NT_SUCCESS(Status)) { 00262 DbgPrint("ShadowHotkey: rc=0x%x\n", Status); 00263 } 00264 #endif 00265 00266 return (Status); 00267 }


Variable Documentation

HANDLE WinStationIcaApiPort = NULL
 

Definition at line 26 of file icadis.c.

Referenced by BrokenConnection(), ShadowHotkey(), W32WinStationTerminate(), and Win32CommandChannelThread().


Generated on Sat May 15 19:44:07 2004 for test by doxygen 1.3.7