2 * Kernelbase internal definitions
4 * Copyright 2019 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_KERNELBASE_H
22 #define __WINE_KERNELBASE_H
34 extern WCHAR
*file_name_AtoW( LPCSTR name
, BOOL alloc
) DECLSPEC_HIDDEN
;
35 extern DWORD
file_name_WtoA( LPCWSTR src
, INT srclen
, LPSTR dest
, INT destlen
) DECLSPEC_HIDDEN
;
36 extern void init_startup_info( RTL_USER_PROCESS_PARAMETERS
*params
) DECLSPEC_HIDDEN
;
37 extern void init_locale(void) DECLSPEC_HIDDEN
;
38 extern void init_console(void) DECLSPEC_HIDDEN
;
39 extern HANDLE
get_console_wait_handle( HANDLE handle
) DECLSPEC_HIDDEN
;
41 extern const WCHAR windows_dir
[] DECLSPEC_HIDDEN
;
42 extern const WCHAR system_dir
[] DECLSPEC_HIDDEN
;
44 static const BOOL is_win64
= (sizeof(void *) > sizeof(int));
45 extern BOOL is_wow64 DECLSPEC_HIDDEN
;
47 static inline BOOL
is_console_handle(HANDLE h
)
49 return h
!= INVALID_HANDLE_VALUE
&& ((UINT_PTR
)h
& 3) == 3;
52 /* map between ntdll handle and kernel32 console handle */
53 static inline HANDLE
console_handle_map( HANDLE h
)
55 return h
!= INVALID_HANDLE_VALUE
? (HANDLE
)((UINT_PTR
)h
^ 3) : INVALID_HANDLE_VALUE
;
58 static inline BOOL
set_ntstatus( NTSTATUS status
)
60 if (status
) SetLastError( RtlNtStatusToDosError( status
));
64 /* make the kernel32 names available */
65 #define HeapAlloc(heap, flags, size) RtlAllocateHeap(heap, flags, size)
66 #define HeapReAlloc(heap, flags, ptr, size) RtlReAllocateHeap(heap, flags, ptr, size)
67 #define HeapFree(heap, flags, ptr) RtlFreeHeap(heap, flags, ptr)
69 #endif /* __WINE_KERNELBASE_H */