makefiles: Don't use standard libs for programs that specify -nodefaultlibs.
[wine/zf.git] / dlls / kernelbase / kernelbase.h
blob459ae88c71f70637e92b87f5937349854997e7f7
1 /*
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
24 #include "windef.h"
25 #include "winbase.h"
27 extern WCHAR *file_name_AtoW( LPCSTR name, BOOL alloc ) DECLSPEC_HIDDEN;
28 extern DWORD file_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen ) DECLSPEC_HIDDEN;
29 extern void init_startup_info( RTL_USER_PROCESS_PARAMETERS *params ) DECLSPEC_HIDDEN;
30 extern void init_locale(void) DECLSPEC_HIDDEN;
32 extern const WCHAR windows_dir[] DECLSPEC_HIDDEN;
33 extern const WCHAR system_dir[] DECLSPEC_HIDDEN;
35 static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
36 extern BOOL is_wow64 DECLSPEC_HIDDEN;
38 extern HANDLE open_console( BOOL output, DWORD access, SECURITY_ATTRIBUTES *sa, DWORD creation ) DECLSPEC_HIDDEN;
40 static inline BOOL is_console_handle(HANDLE h)
42 return h != INVALID_HANDLE_VALUE && ((UINT_PTR)h & 3) == 3;
45 /* map between ntdll handle and kernel32 console handle */
46 static inline HANDLE console_handle_map( HANDLE h )
48 return h != INVALID_HANDLE_VALUE ? (HANDLE)((UINT_PTR)h ^ 3) : INVALID_HANDLE_VALUE;
51 static inline BOOL set_ntstatus( NTSTATUS status )
53 if (status) SetLastError( RtlNtStatusToDosError( status ));
54 return !status;
57 /* make the kernel32 names available */
58 #define HeapAlloc(heap, flags, size) RtlAllocateHeap(heap, flags, size)
59 #define HeapReAlloc(heap, flags, ptr, size) RtlReAllocateHeap(heap, flags, ptr, size)
60 #define HeapFree(heap, flags, ptr) RtlFreeHeap(heap, flags, ptr)
62 #endif /* __WINE_KERNELBASE_H */