1 // Copyright (c) 2023 Huawei Device Co., Ltd.
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 //     http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 #![allow(non_camel_case_types)]
15 #![allow(clippy::upper_case_acronyms)]
16 
17 pub type BOOL = i32;
18 pub type PHANDLER_ROUTINE = Option<unsafe extern "system" fn(ctrlType: u32) -> BOOL>;
19 
20 pub const CTRL_C_EVENT: u32 = 0u32;
21 pub const CTRL_BREAK_EVENT: u32 = 1u32;
22 pub const CTRL_CLOSE_EVENT: u32 = 2u32;
23 pub const CTRL_LOGOFF_EVENT: u32 = 5u32;
24 pub const CTRL_SHUTDOWN_EVENT: u32 = 6u32;
25 
26 extern "system" {
SetConsoleCtrlHandlernull27     pub fn SetConsoleCtrlHandler(HandlerRoutine: PHANDLER_ROUTINE, Add: BOOL) -> BOOL;
28 }
29