title: How TeamViewer simulates Ctrl-Alt-Del on Windows programmatically?
body: <p>How TeamViewer and other remote control software simulate the Alt-Ctr-Del keypress, also known as the Windows Secure Attention Sequence (SAS)?</p>
  
  <ol>
  <li>Many forums state that this is not possible, but the facts are against them. :)</li>
  <li><a href="https://docs.microsoft.com/en-us/windows/desktop/api/sas/nf-sas-sendsas" rel="nofollow noreferrer">SendSAS</a> function looks the most obvious answer, but that requires Group Policy changes, <a href="https://en.wikipedia.org/wiki/User_Interface_Privilege_Isolation" rel="nofollow noreferrer">UIPI bypass</a>, etc. so it's definitely not what that the run-only TeamViewer does.</li>
  <li>Another common suggestion is using the proprietary SasLibEx library, but that is discontinued and <a href="https://www.remkoweijnen.nl/blog/2008/12/23/locking-a-workstation-part-2/" rel="nofollow noreferrer">works only up to Windows Vista</a>.</li>
  <li><a href="https://stackoverflow.com/questions/5047344/net-simulate-ctrlaltdel-sendkeys">An old Stackoverflow answer</a> has a near miss, but it does not work with newer Windows</li>
  <li><code>SendInput</code> does not work for Alt-Ctrl-Del, neither if it is sent to <code>winsta0\winlogon</code> desktop</li>
  <li><code>PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG( MOD_CONTROL | MOD_ALT, VK_DELETE));</code> - nope</li>
  <li><a href="http://www.atelierweb.com/ctrlaltdel/" rel="nofollow noreferrer">WmsgSendMessage</a> was tried on the next man's suggestion, it proved no better or different than SendSAS.</li>
  <li><a href="https://github.com/microsoft/Windows-driver-samples/tree/master/input/kbfiltr" rel="nofollow noreferrer">Keyboard filter drivers</a> could be a solution, but they need code signing and special privileges to install, and implementing them is neither for the faint hearted. I also verified with <code>driverquery</code> that the run-only Team Viewer does not install drivers.</li>
  </ol>
  
  <p><strong>So, any idea how others do it?</strong></p>
  
  <p>The <a href="https://www.microsoftpressstore.com/articles/article.aspx?p=2228450&amp;seqNum=8" rel="nofollow noreferrer">Internals of SAS implementation</a> gives a good overview of what it is happening behind the scenes.</p>