2009-07-05 08:01:26 +08:00
|
|
|
#include <windows.h>
|
2019-08-28 02:04:02 +08:00
|
|
|
#include <stdio.h>
|
2009-07-05 08:01:26 +08:00
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
char *end;
|
2019-08-28 02:04:02 +08:00
|
|
|
if (argc < 3)
|
2009-07-05 08:01:26 +08:00
|
|
|
exit (1);
|
2019-06-27 13:31:56 +08:00
|
|
|
HANDLE h = (HANDLE) strtoull (argv[1], &end, 0);
|
2009-07-05 08:01:26 +08:00
|
|
|
SetEvent (h);
|
2019-08-28 02:04:02 +08:00
|
|
|
if (argc == 4) /* Pseudo console helper mode for PTY */
|
|
|
|
{
|
2019-09-09 20:08:20 +08:00
|
|
|
SetConsoleCtrlHandler (NULL, TRUE);
|
2019-08-28 02:04:02 +08:00
|
|
|
HANDLE hPipe = (HANDLE) strtoull (argv[3], &end, 0);
|
|
|
|
char buf[64];
|
|
|
|
sprintf (buf, "StdHandles=%p,%p\n",
|
|
|
|
GetStdHandle (STD_INPUT_HANDLE),
|
|
|
|
GetStdHandle (STD_OUTPUT_HANDLE));
|
|
|
|
DWORD dwLen;
|
|
|
|
WriteFile (hPipe, buf, strlen (buf), &dwLen, NULL);
|
|
|
|
CloseHandle (hPipe);
|
|
|
|
}
|
2019-06-27 13:31:56 +08:00
|
|
|
h = (HANDLE) strtoull (argv[2], &end, 0);
|
2009-07-05 08:01:26 +08:00
|
|
|
WaitForSingleObject (h, INFINITE);
|
|
|
|
exit (0);
|
|
|
|
}
|