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
43ce4292
Commit
43ce4292
authored
Aug 13, 2020
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Move CONTROL_C_EXIT handler to kernelbase.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0451e44d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
35 deletions
+21
-35
console.c
dlls/kernel32/console.c
+0
-31
console_private.h
dlls/kernel32/console_private.h
+0
-1
kernel_main.c
dlls/kernel32/kernel_main.c
+0
-3
console.c
dlls/kernelbase/console.c
+19
-0
kernelbase.h
dlls/kernelbase/kernelbase.h
+1
-0
main.c
dlls/kernelbase/main.c
+1
-0
No files found.
dlls/kernel32/console.c
View file @
43ce4292
...
...
@@ -649,37 +649,6 @@ BOOL WINAPI GetNumberOfConsoleMouseButtons(LPDWORD nrofbuttons)
}
/******************************************************************
* CONSOLE_HandleCtrlC
*
* Check whether the shall manipulate CtrlC events
*/
LONG
CALLBACK
CONSOLE_HandleCtrlC
(
EXCEPTION_POINTERS
*
eptr
)
{
extern
DWORD
WINAPI
CtrlRoutine
(
void
*
arg
);
HANDLE
thread
;
if
(
eptr
->
ExceptionRecord
->
ExceptionCode
!=
CONTROL_C_EXIT
)
return
EXCEPTION_CONTINUE_SEARCH
;
if
(
!
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
)
return
EXCEPTION_CONTINUE_SEARCH
;
/* check if we have to ignore ctrl-C events */
if
(
!
(
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
ConsoleFlags
&
1
))
{
/* Create a separate thread to signal all the events.
* This is needed because:
* - this function can be called in an Unix signal handler (hence on an
* different stack than the thread that's running). This breaks the
* Win32 exception mechanisms (where the thread's stack is checked).
* - since the current thread, while processing the signal, can hold the
* console critical section, we need another execution environment where
* we can wait on this critical section
*/
thread
=
CreateThread
(
NULL
,
0
,
CtrlRoutine
,
(
void
*
)
CTRL_C_EVENT
,
0
,
NULL
);
if
(
thread
)
CloseHandle
(
thread
);
}
return
EXCEPTION_CONTINUE_EXECUTION
;
}
/******************************************************************
* CONSOLE_WriteChars
*
* WriteConsoleOutput helper: hides server call semantics
...
...
dlls/kernel32/console_private.h
View file @
43ce4292
...
...
@@ -22,7 +22,6 @@
#define __WINE_CONSOLE_PRIVATE_H
/* console.c */
extern
LONG
CALLBACK
CONSOLE_HandleCtrlC
(
EXCEPTION_POINTERS
*
eptr
)
DECLSPEC_HIDDEN
;
extern
int
CONSOLE_GetHistory
(
int
idx
,
WCHAR
*
buf
,
int
buf_len
)
DECLSPEC_HIDDEN
;
extern
BOOL
CONSOLE_AppendHistory
(
const
WCHAR
*
p
)
DECLSPEC_HIDDEN
;
extern
unsigned
CONSOLE_GetNumHistoryEntries
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/kernel32/kernel_main.c
View file @
43ce4292
...
...
@@ -147,9 +147,6 @@ static BOOL process_attach( HMODULE module )
LoadLibraryA
(
"krnl386.exe16"
);
}
/* finish the process initialisation for console bits, if needed */
RtlAddVectoredExceptionHandler
(
FALSE
,
CONSOLE_HandleCtrlC
);
if
(
params
->
ConsoleHandle
==
KERNEL32_CONSOLE_ALLOC
)
{
HMODULE
mod
=
GetModuleHandleA
(
0
);
...
...
dlls/kernelbase/console.c
View file @
43ce4292
...
...
@@ -421,6 +421,20 @@ DWORD WINAPI CtrlRoutine( void *arg )
}
static
LONG
WINAPI
handle_ctrl_c
(
EXCEPTION_POINTERS
*
eptr
)
{
if
(
eptr
->
ExceptionRecord
->
ExceptionCode
!=
CONTROL_C_EXIT
)
return
EXCEPTION_CONTINUE_SEARCH
;
if
(
!
RtlGetCurrentPeb
()
->
ProcessParameters
->
ConsoleHandle
)
return
EXCEPTION_CONTINUE_SEARCH
;
if
(
!
(
NtCurrentTeb
()
->
Peb
->
ProcessParameters
->
ConsoleFlags
&
1
))
{
HANDLE
thread
=
CreateThread
(
NULL
,
0
,
CtrlRoutine
,
(
void
*
)
CTRL_C_EVENT
,
0
,
NULL
);
if
(
thread
)
CloseHandle
(
thread
);
}
return
EXCEPTION_CONTINUE_EXECUTION
;
}
/******************************************************************************
* FillConsoleOutputAttribute (kernelbase.@)
*/
...
...
@@ -1626,3 +1640,8 @@ HRESULT WINAPI ResizePseudoConsole( HPCON handle, COORD size )
FIXME
(
"%p (%u,%u)
\n
"
,
handle
,
size
.
X
,
size
.
Y
);
return
E_NOTIMPL
;
}
void
init_console
(
void
)
{
RtlAddVectoredExceptionHandler
(
FALSE
,
handle_ctrl_c
);
}
dlls/kernelbase/kernelbase.h
View file @
43ce4292
...
...
@@ -28,6 +28,7 @@ extern WCHAR *file_name_AtoW( LPCSTR name, BOOL alloc ) DECLSPEC_HIDDEN;
extern
DWORD
file_name_WtoA
(
LPCWSTR
src
,
INT
srclen
,
LPSTR
dest
,
INT
destlen
)
DECLSPEC_HIDDEN
;
extern
void
init_startup_info
(
RTL_USER_PROCESS_PARAMETERS
*
params
)
DECLSPEC_HIDDEN
;
extern
void
init_locale
(
void
)
DECLSPEC_HIDDEN
;
extern
void
init_console
(
void
)
DECLSPEC_HIDDEN
;
extern
HANDLE
get_console_wait_handle
(
HANDLE
handle
)
DECLSPEC_HIDDEN
;
extern
const
WCHAR
windows_dir
[]
DECLSPEC_HIDDEN
;
...
...
dlls/kernelbase/main.c
View file @
43ce4292
...
...
@@ -47,6 +47,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
IsWow64Process
(
GetCurrentProcess
(),
&
is_wow64
);
init_locale
();
init_startup_info
(
NtCurrentTeb
()
->
Peb
->
ProcessParameters
);
init_console
();
}
return
TRUE
;
}
...
...
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