X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=node_modules%2Fnode-pty%2Fdeps%2Fwinpty%2Fmisc%2FIdentifyConsoleWindow.ps1;fp=node_modules%2Fnode-pty%2Fdeps%2Fwinpty%2Fmisc%2FIdentifyConsoleWindow.ps1;h=0000000000000000000000000000000000000000;hp=0c488597bd2592a8c05065910e8eb619b800cc1f;hb=5e96dd57ddd883604e87f62bdddcb111c63a6e1a;hpb=acb5f682a2b75b972710cabd81658f63071324b0 diff --git a/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 b/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 deleted file mode 100644 index 0c48859..0000000 --- a/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 +++ /dev/null @@ -1,51 +0,0 @@ -# -# Usage: powershell \IdentifyConsoleWindow.ps1 -# -# This script determines whether the process has a console attached, whether -# that console has a non-NULL window (e.g. HWND), and whether the window is on -# the current window station. -# - -$signature = @' -[DllImport("kernel32.dll", SetLastError=true)] -public static extern IntPtr GetConsoleWindow(); - -[DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)] -public static extern bool SetConsoleTitle(String title); - -[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)] -public static extern int GetWindowText(IntPtr hWnd, - System.Text.StringBuilder lpString, - int nMaxCount); -'@ - -$WinAPI = Add-Type -MemberDefinition $signature ` - -Name WinAPI -Namespace IdentifyConsoleWindow -PassThru - -if (!$WinAPI::SetConsoleTitle("ConsoleWindowScript")) { - echo "error: could not change console title -- is a console attached?" - exit 1 -} else { - echo "note: successfully set console title to ""ConsoleWindowScript""." -} - -$hwnd = $WinAPI::GetConsoleWindow() -if ($hwnd -eq 0) { - echo "note: GetConsoleWindow returned NULL." -} else { - echo "note: GetConsoleWindow returned 0x$($hwnd.ToString("X"))." - $sb = New-Object System.Text.StringBuilder -ArgumentList 4096 - if ($WinAPI::GetWindowText($hwnd, $sb, $sb.Capacity)) { - $title = $sb.ToString() - echo "note: GetWindowText returned ""${title}""." - if ($title -eq "ConsoleWindowScript") { - echo "success!" - } else { - echo "error: expected to see ""ConsoleWindowScript""." - echo " (Perhaps the console window is on a different window station?)" - } - } else { - echo "error: GetWindowText could not read the window title." - echo " (Perhaps the console window is on a different window station?)" - } -}