Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
e24ba09f
Commit
e24ba09f
authored
Aug 20, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conhost: Add initial main loop implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
76037ffb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
6 deletions
+125
-6
conhost.c
programs/conhost/conhost.c
+125
-6
No files found.
programs/conhost/conhost.c
View file @
e24ba09f
...
...
@@ -16,18 +16,137 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdlib.h>
#include <ntstatus.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <winternl.h>
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
conhost
);
int
__cdecl
wmain
(
int
argc
,
WCHAR
*
argv
[])
struct
console
{
int
i
;
HANDLE
server
;
/* console server handle */
};
static
int
main_loop
(
struct
console
*
console
,
HANDLE
signal
)
{
HANDLE
signal_event
=
NULL
;
HANDLE
wait_handles
[
2
];
unsigned
int
wait_cnt
=
0
;
unsigned
short
signal_id
;
IO_STATUS_BLOCK
signal_io
;
NTSTATUS
status
;
DWORD
res
;
if
(
signal
)
{
if
(
!
(
signal_event
=
CreateEventW
(
NULL
,
TRUE
,
FALSE
,
NULL
)))
return
1
;
status
=
NtReadFile
(
signal
,
signal_event
,
NULL
,
NULL
,
&
signal_io
,
&
signal_id
,
sizeof
(
signal_id
),
NULL
,
NULL
);
if
(
status
&&
status
!=
STATUS_PENDING
)
return
1
;
}
WINE_FIXME
(
"stub:"
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
WINE_FIXME
(
" %s"
,
wine_dbgstr_w
(
argv
[
i
]));
WINE_FIXME
(
"
\n
"
);
wait_handles
[
wait_cnt
++
]
=
console
->
server
;
if
(
signal
)
wait_handles
[
wait_cnt
++
]
=
signal_event
;
for
(;;)
{
res
=
WaitForMultipleObjects
(
wait_cnt
,
wait_handles
,
FALSE
,
INFINITE
);
switch
(
res
)
{
case
WAIT_OBJECT_0
:
FIXME
(
"console ioctls not yet implemented
\n
"
);
return
1
;
case
WAIT_OBJECT_0
+
1
:
if
(
signal_io
.
Status
||
signal_io
.
Information
!=
sizeof
(
signal_id
))
{
TRACE
(
"signaled quit
\n
"
);
return
0
;
}
FIXME
(
"unimplemented signal %x
\n
"
,
signal_id
);
status
=
NtReadFile
(
signal
,
signal_event
,
NULL
,
NULL
,
&
signal_io
,
&
signal_id
,
sizeof
(
signal_id
),
NULL
,
NULL
);
if
(
status
&&
status
!=
STATUS_PENDING
)
return
1
;
break
;
default:
TRACE
(
"wait failed, quit
\n
"
);
return
0
;
}
}
return
0
;
}
int
__cdecl
wmain
(
int
argc
,
WCHAR
*
argv
[])
{
int
headless
=
0
,
i
,
width
=
80
,
height
=
150
;
HANDLE
signal
=
NULL
;
WCHAR
*
end
;
static
struct
console
console
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
TRACE
(
"%s "
,
wine_dbgstr_w
(
argv
[
i
]));
TRACE
(
"
\n
"
);
for
(
i
=
1
;
i
<
argc
;
i
++
)
{
if
(
!
wcscmp
(
argv
[
i
],
L"--headless"
))
{
headless
=
1
;
continue
;
}
if
(
!
wcscmp
(
argv
[
i
],
L"--width"
))
{
if
(
++
i
==
argc
)
return
1
;
width
=
wcstol
(
argv
[
i
],
&
end
,
0
);
if
(
!
width
||
width
>
0xffff
||
*
end
)
return
1
;
continue
;
}
if
(
!
wcscmp
(
argv
[
i
],
L"--height"
))
{
if
(
++
i
==
argc
)
return
1
;
height
=
wcstol
(
argv
[
i
],
&
end
,
0
);
if
(
!
height
||
height
>
0xffff
||
*
end
)
return
1
;
continue
;
}
if
(
!
wcscmp
(
argv
[
i
],
L"--signal"
))
{
if
(
++
i
==
argc
)
return
1
;
signal
=
ULongToHandle
(
wcstol
(
argv
[
i
],
&
end
,
0
));
if
(
*
end
)
return
1
;
continue
;
}
if
(
!
wcscmp
(
argv
[
i
],
L"--server"
))
{
if
(
++
i
==
argc
)
return
1
;
console
.
server
=
ULongToHandle
(
wcstol
(
argv
[
i
],
&
end
,
0
));
if
(
*
end
)
return
1
;
continue
;
}
FIXME
(
"unknown option %s
\n
"
,
debugstr_w
(
argv
[
i
])
);
return
1
;
}
if
(
!
headless
)
{
FIXME
(
"windowed mode not supported
\n
"
);
return
0
;
}
if
(
!
console
.
server
)
{
ERR
(
"no server handle
\n
"
);
return
1
;
}
return
main_loop
(
&
console
,
signal
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment