Fixed some bugs in CreateProcessA which was introduced by r16730.
[reactos.git] / reactos / lib / kernel32 / include / kernel32.h
1 #ifndef _KERNEL32_INCLUDE_KERNEL32_H
2 #define _KERNEL32_INCLUDE_KERNEL32_H
3
4 #define BINARY_UNKNOWN (0)
5 #define BINARY_PE_EXE32 (1)
6 #define BINARY_PE_DLL32 (2)
7 #define BINARY_PE_EXE64 (3)
8 #define BINARY_PE_DLL64 (4)
9 #define BINARY_WIN16 (5)
10 #define BINARY_OS216 (6)
11 #define BINARY_DOS (7)
12 #define BINARY_UNIX_EXE (8)
13 #define BINARY_UNIX_LIB (9)
14
15 #define MAGIC(c1,c2,c3,c4) ((c1) + ((c2)<<8) + ((c3)<<16) + ((c4)<<24))
16
17 #define MAGIC_HEAP MAGIC( 'H','E','A','P' )
18
19 #define ROUNDUP(a,b) ((((a)+(b)-1)/(b))*(b))
20 #define ROUNDDOWN(a,b) (((a)/(b))*(b))
21
22 #ifndef FIELD_OFFSET
23 #define FIELD_OFFSET(type,fld) ((LONG)&(((type *)0)->fld))
24 #endif
25
26 #define IsConsoleHandle(h) \
27 (((((ULONG)h) & 0x10000003) == 0x3) ? TRUE : FALSE)
28
29 #define HANDLE_DETACHED_PROCESS (HANDLE)-1
30 #define HANDLE_CREATE_NEW_CONSOLE (HANDLE)-2
31 #define HANDLE_CREATE_NO_WINDOW (HANDLE)-3
32
33 /* Undocumented CreateProcess flag */
34 #define STARTF_SHELLPRIVATE 0x400
35
36 #define SetLastErrorByStatus(__S__) \
37 ((void)SetLastError(RtlNtStatusToDosError(__S__)))
38
39 typedef
40 DWORD
41 (*WaitForInputIdleType)(
42 HANDLE hProcess,
43 DWORD dwMilliseconds);
44
45 /* GLOBAL VARIABLES **********************************************************/
46
47 extern BOOL bIsFileApiAnsi;
48 extern HANDLE hProcessHeap;
49 extern HANDLE hBaseDir;
50 extern HMODULE hCurrentModule;
51
52 extern RTL_CRITICAL_SECTION DllLock;
53
54 extern UNICODE_STRING DllDirectory;
55
56 extern LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter;
57
58 /* FUNCTION PROTOTYPES *******************************************************/
59
60 BOOL STDCALL VerifyConsoleIoHandle(HANDLE Handle);
61
62 BOOL STDCALL CloseConsoleHandle(HANDLE Handle);
63
64 HANDLE STDCALL OpenConsoleW (LPWSTR wsName,
65 DWORD dwDesiredAccess,
66 BOOL bInheritHandle,
67 DWORD dwCreationDistribution);
68
69 PTEB GetTeb(VOID);
70
71 PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc);
72
73 DWORD FilenameW2A_FitOrFail(LPSTR DestA, INT destLen, LPCWSTR SourceW, INT sourceLen);
74 DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU);
75
76 #define HeapAlloc RtlAllocateHeap
77 #define HeapFree RtlFreeHeap
78
79 POBJECT_ATTRIBUTES
80 STDCALL
81 BasepConvertObjectAttributes(OUT POBJECT_ATTRIBUTES ObjectAttributes,
82 IN PSECURITY_ATTRIBUTES SecurityAttributes OPTIONAL,
83 IN PUNICODE_STRING ObjectName);
84
85 NTSTATUS
86 STDCALL
87 BasepCreateStack(HANDLE hProcess,
88 ULONG StackReserve,
89 ULONG StackCommit,
90 PINITIAL_TEB InitialTeb);
91
92 VOID
93 STDCALL
94 BasepInitializeContext(IN PCONTEXT Context,
95 IN PVOID Parameter,
96 IN PVOID StartAddress,
97 IN PVOID StackAddress,
98 IN ULONG ContextType);
99
100 VOID
101 STDCALL
102 BaseThreadStartupThunk();
103
104 VOID
105 STDCALL
106 BaseProcessStartThunk();
107
108 __declspec(noreturn)
109 VOID
110 STDCALL
111 BaseThreadStartup(LPTHREAD_START_ROUTINE lpStartAddress,
112 LPVOID lpParameter);
113
114 VOID
115 STDCALL
116 BasepFreeStack(HANDLE hProcess,
117 PINITIAL_TEB InitialTeb);
118
119 __declspec(noreturn)
120 VOID
121 WINAPI
122 BaseFiberStartup(VOID);
123
124 typedef UINT (STDCALL *PPROCESS_START_ROUTINE)(VOID);
125
126 VOID
127 STDCALL
128 BaseProcessStartup(PPROCESS_START_ROUTINE lpStartAddress);
129
130 BOOLEAN
131 STDCALL
132 BasepCheckRealTimePrivilege(VOID);
133
134 VOID
135 STDCALL
136 BasepAnsiStringToHeapUnicodeString(IN LPCSTR AnsiString,
137 OUT LPWSTR* UnicodeString);
138
139 PUNICODE_STRING
140 STDCALL
141 Basep8BitStringToCachedUnicodeString(IN LPCSTR String);
142
143 NTSTATUS
144 STDCALL
145 Basep8BitStringToLiveUnicodeString(OUT PUNICODE_STRING UnicodeString,
146 IN LPCSTR String);
147
148 NTSTATUS
149 STDCALL
150 Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
151 IN LPCSTR String);
152
153 typedef NTSTATUS (STDCALL *PRTL_CONVERT_STRING)(IN PUNICODE_STRING UnicodeString,
154 IN PANSI_STRING AnsiString,
155 IN BOOLEAN AllocateMemory);
156
157 extern PRTL_CONVERT_STRING Basep8BitStringToUnicodeString;
158
159 NTSTATUS
160 STDCALL
161 BasepMapFile(IN LPCWSTR lpApplicationName,
162 OUT PHANDLE hSection,
163 IN PUNICODE_STRING ApplicationName);
164
165 #endif /* ndef _KERNEL32_INCLUDE_KERNEL32_H */
166