X-Git-Url: https://git.josue.xyz/?p=VSoRC%2F.git;a=blobdiff_plain;f=node_modules%2Fnode-pty%2Fdeps%2Fwinpty%2Fmisc%2FWin32Test3.cc;fp=node_modules%2Fnode-pty%2Fdeps%2Fwinpty%2Fmisc%2FWin32Test3.cc;h=0000000000000000000000000000000000000000;hp=1fb92aff3df9a585f30a0bcd7d61537b58462f79;hb=5e96dd57ddd883604e87f62bdddcb111c63a6e1a;hpb=acb5f682a2b75b972710cabd81658f63071324b0 diff --git a/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc b/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc deleted file mode 100644 index 1fb92af..0000000 --- a/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Creates a window station and starts a process under it. The new process - * also gets a new console. - */ - -#include -#include -#include - -int main() -{ - BOOL success; - - SECURITY_ATTRIBUTES sa; - memset(&sa, 0, sizeof(sa)); - sa.bInheritHandle = TRUE; - - HWINSTA originalStation = GetProcessWindowStation(); - printf("originalStation == 0x%x\n", originalStation); - HWINSTA station = CreateWindowStation(NULL, - 0, - WINSTA_ALL_ACCESS, - &sa); - printf("station == 0x%x\n", station); - if (!SetProcessWindowStation(station)) - printf("SetWindowStation failed!\n"); - HDESK desktop = CreateDesktop("Default", NULL, NULL, - /*dwFlags=*/0, GENERIC_ALL, - &sa); - printf("desktop = 0x%x\n", desktop); - - char stationName[256]; - stationName[0] = '\0'; - success = GetUserObjectInformation(station, UOI_NAME, - stationName, sizeof(stationName), - NULL); - printf("stationName = [%s]\n", stationName); - - char startupDesktop[256]; - sprintf(startupDesktop, "%s\\Default", stationName); - - STARTUPINFO sui; - PROCESS_INFORMATION pi; - memset(&sui, 0, sizeof(sui)); - memset(&pi, 0, sizeof(pi)); - sui.cb = sizeof(STARTUPINFO); - sui.lpDesktop = startupDesktop; - - // Start a cmd subprocess, and have it start its own cmd subprocess. - // Both subprocesses will connect to the same non-interactive window - // station. - - const char program[] = "c:\\windows\\system32\\cmd.exe"; - char cmdline[256]; - sprintf(cmdline, "%s /c cmd", program); - success = CreateProcess(program, - cmdline, - NULL, - NULL, - /*bInheritHandles=*/FALSE, - /*dwCreationFlags=*/CREATE_NEW_CONSOLE, - NULL, NULL, - &sui, - &pi); - - printf("pid == %d\n", pi.dwProcessId); - - // This sleep is necessary. We must give the child enough time to - // connect to the specified window station. - Sleep(5000); - - SetProcessWindowStation(originalStation); - CloseWindowStation(station); - CloseDesktop(desktop); - Sleep(5000); - - return 0; -}