widl: Generate helper macros for WinRT implementation.
[wine/zf.git] / dlls / kernel32 / process.c
blob41a5b34af198ac427d9c3410abf18428498569a0
1 /*
2 * Win32 processes
4 * Copyright 1996, 1998 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 #include <assert.h>
22 #include <ctype.h>
23 #include <errno.h>
24 #include <signal.h>
25 #include <stdarg.h>
26 #include <stdio.h>
27 #include <time.h>
29 #include "ntstatus.h"
30 #define WIN32_NO_STATUS
31 #include "winternl.h"
32 #include "winbase.h"
33 #include "winnls.h"
34 #include "wincon.h"
35 #include "kernel_private.h"
36 #include "psapi.h"
37 #include "ddk/wdm.h"
38 #include "wine/exception.h"
39 #include "wine/asm.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(process);
44 static const struct _KUSER_SHARED_DATA *user_shared_data = (struct _KUSER_SHARED_DATA *)0x7ffe0000;
46 typedef struct
48 LPSTR lpEnvAddress;
49 LPSTR lpCmdLine;
50 LPSTR lpCmdShow;
51 DWORD dwReserved;
52 } LOADPARMS32;
54 SYSTEM_BASIC_INFORMATION system_info = { 0 };
56 /* Process flags */
57 #define PDB32_DEBUGGED 0x0001 /* Process is being debugged */
58 #define PDB32_WIN16_PROC 0x0008 /* Win16 process */
59 #define PDB32_DOS_PROC 0x0010 /* Dos process */
60 #define PDB32_CONSOLE_PROC 0x0020 /* Console process */
61 #define PDB32_FILE_APIS_OEM 0x0040 /* File APIs are OEM */
62 #define PDB32_WIN32S_PROC 0x8000 /* Win32s process */
65 /***********************************************************************
66 * wait_input_idle
68 * Wrapper to call WaitForInputIdle USER function
70 typedef DWORD (WINAPI *WaitForInputIdle_ptr)( HANDLE hProcess, DWORD dwTimeOut );
72 static DWORD wait_input_idle( HANDLE process, DWORD timeout )
74 HMODULE mod = GetModuleHandleA( "user32.dll" );
75 if (mod)
77 WaitForInputIdle_ptr ptr = (WaitForInputIdle_ptr)GetProcAddress( mod, "WaitForInputIdle" );
78 if (ptr) return ptr( process, timeout );
80 return 0;
84 /***********************************************************************
85 * WinExec (KERNEL32.@)
87 UINT WINAPI DECLSPEC_HOTPATCH WinExec( LPCSTR lpCmdLine, UINT nCmdShow )
89 PROCESS_INFORMATION info;
90 STARTUPINFOA startup;
91 char *cmdline;
92 UINT ret;
94 memset( &startup, 0, sizeof(startup) );
95 startup.cb = sizeof(startup);
96 startup.dwFlags = STARTF_USESHOWWINDOW;
97 startup.wShowWindow = nCmdShow;
99 /* cmdline needs to be writable for CreateProcess */
100 if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(lpCmdLine)+1 ))) return 0;
101 strcpy( cmdline, lpCmdLine );
103 if (CreateProcessA( NULL, cmdline, NULL, NULL, FALSE,
104 0, NULL, NULL, &startup, &info ))
106 /* Give 30 seconds to the app to come up */
107 if (wait_input_idle( info.hProcess, 30000 ) == WAIT_FAILED)
108 WARN("WaitForInputIdle failed: Error %d\n", GetLastError() );
109 ret = 33;
110 /* Close off the handles */
111 CloseHandle( info.hThread );
112 CloseHandle( info.hProcess );
114 else if ((ret = GetLastError()) >= 32)
116 FIXME("Strange error set by CreateProcess: %d\n", ret );
117 ret = 11;
119 HeapFree( GetProcessHeap(), 0, cmdline );
120 return ret;
124 /**********************************************************************
125 * LoadModule (KERNEL32.@)
127 DWORD WINAPI LoadModule( LPCSTR name, LPVOID paramBlock )
129 LOADPARMS32 *params = paramBlock;
130 PROCESS_INFORMATION info;
131 STARTUPINFOA startup;
132 DWORD ret;
133 LPSTR cmdline, p;
134 char filename[MAX_PATH];
135 BYTE len;
137 if (!name) return ERROR_FILE_NOT_FOUND;
139 if (!SearchPathA( NULL, name, ".exe", sizeof(filename), filename, NULL ) &&
140 !SearchPathA( NULL, name, NULL, sizeof(filename), filename, NULL ))
141 return GetLastError();
143 len = (BYTE)params->lpCmdLine[0];
144 if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(filename) + len + 2 )))
145 return ERROR_NOT_ENOUGH_MEMORY;
147 strcpy( cmdline, filename );
148 p = cmdline + strlen(cmdline);
149 *p++ = ' ';
150 memcpy( p, params->lpCmdLine + 1, len );
151 p[len] = 0;
153 memset( &startup, 0, sizeof(startup) );
154 startup.cb = sizeof(startup);
155 if (params->lpCmdShow)
157 startup.dwFlags = STARTF_USESHOWWINDOW;
158 startup.wShowWindow = ((WORD *)params->lpCmdShow)[1];
161 if (CreateProcessA( filename, cmdline, NULL, NULL, FALSE, 0,
162 params->lpEnvAddress, NULL, &startup, &info ))
164 /* Give 30 seconds to the app to come up */
165 if (wait_input_idle( info.hProcess, 30000 ) == WAIT_FAILED)
166 WARN("WaitForInputIdle failed: Error %d\n", GetLastError() );
167 ret = 33;
168 /* Close off the handles */
169 CloseHandle( info.hThread );
170 CloseHandle( info.hProcess );
172 else if ((ret = GetLastError()) >= 32)
174 FIXME("Strange error set by CreateProcess: %u\n", ret );
175 ret = 11;
178 HeapFree( GetProcessHeap(), 0, cmdline );
179 return ret;
183 /***********************************************************************
184 * ExitProcess (KERNEL32.@)
186 * Exits the current process.
188 * PARAMS
189 * status [I] Status code to exit with.
191 * RETURNS
192 * Nothing.
194 #ifdef __i386__
195 __ASM_STDCALL_FUNC( ExitProcess, 4, /* Shrinker depend on this particular ExitProcess implementation */
196 "pushl %ebp\n\t"
197 ".byte 0x8B, 0xEC\n\t" /* movl %esp, %ebp */
198 ".byte 0x6A, 0x00\n\t" /* pushl $0 */
199 ".byte 0x68, 0x00, 0x00, 0x00, 0x00\n\t" /* pushl $0 - 4 bytes immediate */
200 "pushl 8(%ebp)\n\t"
201 "call " __ASM_STDCALL("RtlExitUserProcess",4) "\n\t"
202 "leave\n\t"
203 "ret $4" )
204 #else
206 void WINAPI ExitProcess( DWORD status )
208 RtlExitUserProcess( status );
211 #endif
213 /***********************************************************************
214 * GetExitCodeProcess [KERNEL32.@]
216 * Gets termination status of specified process.
218 * PARAMS
219 * hProcess [in] Handle to the process.
220 * lpExitCode [out] Address to receive termination status.
222 * RETURNS
223 * Success: TRUE
224 * Failure: FALSE
226 BOOL WINAPI GetExitCodeProcess( HANDLE hProcess, LPDWORD lpExitCode )
228 PROCESS_BASIC_INFORMATION pbi;
230 if (!set_ntstatus( NtQueryInformationProcess( hProcess, ProcessBasicInformation, &pbi, sizeof(pbi), NULL )))
231 return FALSE;
232 if (lpExitCode) *lpExitCode = pbi.ExitStatus;
233 return TRUE;
237 /**************************************************************************
238 * FatalExit (KERNEL32.@)
240 void WINAPI FatalExit( int code )
242 WARN( "FatalExit\n" );
243 ExitProcess( code );
247 /***********************************************************************
248 * GetProcessFlags (KERNEL32.@)
250 DWORD WINAPI GetProcessFlags( DWORD processid )
252 IMAGE_NT_HEADERS *nt;
253 DWORD flags = 0;
255 if (processid && processid != GetCurrentProcessId()) return 0;
257 if ((nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress )))
259 if (nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
260 flags |= PDB32_CONSOLE_PROC;
262 if (!AreFileApisANSI()) flags |= PDB32_FILE_APIS_OEM;
263 if (IsDebuggerPresent()) flags |= PDB32_DEBUGGED;
264 return flags;
268 /***********************************************************************
269 * ConvertToGlobalHandle (KERNEL32.@)
271 HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc)
273 HANDLE ret = INVALID_HANDLE_VALUE;
274 DuplicateHandle( GetCurrentProcess(), hSrc, GetCurrentProcess(), &ret, 0, FALSE,
275 DUPLICATE_MAKE_GLOBAL | DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE );
276 return ret;
280 /***********************************************************************
281 * SetHandleContext (KERNEL32.@)
283 BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context)
285 FIXME("(%p,%d), stub. In case this got called by WSOCK32/WS2_32: "
286 "the external WINSOCK DLLs won't work with WINE, don't use them.\n",hnd,context);
287 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
288 return FALSE;
292 /***********************************************************************
293 * GetHandleContext (KERNEL32.@)
295 DWORD WINAPI GetHandleContext(HANDLE hnd)
297 FIXME("(%p), stub. In case this got called by WSOCK32/WS2_32: "
298 "the external WINSOCK DLLs won't work with WINE, don't use them.\n",hnd);
299 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
300 return 0;
304 /***********************************************************************
305 * CreateSocketHandle (KERNEL32.@)
307 HANDLE WINAPI CreateSocketHandle(void)
309 FIXME("(), stub. In case this got called by WSOCK32/WS2_32: "
310 "the external WINSOCK DLLs won't work with WINE, don't use them.\n");
311 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
312 return INVALID_HANDLE_VALUE;
316 /***********************************************************************
317 * SetProcessAffinityMask (KERNEL32.@)
319 BOOL WINAPI SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR affmask )
321 return set_ntstatus( NtSetInformationProcess( hProcess, ProcessAffinityMask,
322 &affmask, sizeof(DWORD_PTR) ));
326 /**********************************************************************
327 * GetProcessAffinityMask (KERNEL32.@)
329 BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PDWORD_PTR system_mask )
331 if (process_mask)
333 if (!set_ntstatus( NtQueryInformationProcess( hProcess, ProcessAffinityMask,
334 process_mask, sizeof(*process_mask), NULL )))
335 return FALSE;
337 if (system_mask)
339 SYSTEM_BASIC_INFORMATION info;
341 if (!set_ntstatus( NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )))
342 return FALSE;
343 *system_mask = info.ActiveProcessorsAffinityMask;
345 return TRUE;
349 /***********************************************************************
350 * SetProcessWorkingSetSize [KERNEL32.@]
351 * Sets the min/max working set sizes for a specified process.
353 * PARAMS
354 * process [I] Handle to the process of interest
355 * minset [I] Specifies minimum working set size
356 * maxset [I] Specifies maximum working set size
358 * RETURNS
359 * Success: TRUE
360 * Failure: FALSE
362 BOOL WINAPI SetProcessWorkingSetSize(HANDLE process, SIZE_T minset, SIZE_T maxset)
364 return SetProcessWorkingSetSizeEx(process, minset, maxset, 0);
367 /***********************************************************************
368 * GetProcessWorkingSetSize (KERNEL32.@)
370 BOOL WINAPI GetProcessWorkingSetSize(HANDLE process, SIZE_T *minset, SIZE_T *maxset)
372 return GetProcessWorkingSetSizeEx(process, minset, maxset, NULL);
376 /******************************************************************
377 * GetProcessIoCounters (KERNEL32.@)
379 BOOL WINAPI GetProcessIoCounters(HANDLE hProcess, PIO_COUNTERS ioc)
381 return set_ntstatus( NtQueryInformationProcess(hProcess, ProcessIoCounters, ioc, sizeof(*ioc), NULL ));
384 /***********************************************************************
385 * RegisterServiceProcess (KERNEL32.@)
387 * A service process calls this function to ensure that it continues to run
388 * even after a user logged off.
390 DWORD WINAPI RegisterServiceProcess(DWORD dwProcessId, DWORD dwType)
392 /* I don't think that Wine needs to do anything in this function */
393 return 1; /* success */
397 /***********************************************************************
398 * GetCurrentProcess (KERNEL32.@)
400 * Get a handle to the current process.
402 * PARAMS
403 * None.
405 * RETURNS
406 * A handle representing the current process.
408 HANDLE WINAPI KERNEL32_GetCurrentProcess(void)
410 return (HANDLE)~(ULONG_PTR)0;
414 /***********************************************************************
415 * CreateActCtxA (KERNEL32.@)
417 HANDLE WINAPI DECLSPEC_HOTPATCH CreateActCtxA( const ACTCTXA *actctx )
419 ACTCTXW actw;
420 SIZE_T len;
421 HANDLE ret = INVALID_HANDLE_VALUE;
422 LPWSTR src = NULL, assdir = NULL, resname = NULL, appname = NULL;
424 TRACE("%p %08x\n", actctx, actctx ? actctx->dwFlags : 0);
426 if (!actctx || actctx->cbSize != sizeof(*actctx))
428 SetLastError(ERROR_INVALID_PARAMETER);
429 return INVALID_HANDLE_VALUE;
432 actw.cbSize = sizeof(actw);
433 actw.dwFlags = actctx->dwFlags;
434 if (actctx->lpSource)
436 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpSource, -1, NULL, 0);
437 src = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
438 if (!src) return INVALID_HANDLE_VALUE;
439 MultiByteToWideChar(CP_ACP, 0, actctx->lpSource, -1, src, len);
441 actw.lpSource = src;
443 if (actw.dwFlags & ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID)
444 actw.wProcessorArchitecture = actctx->wProcessorArchitecture;
445 if (actw.dwFlags & ACTCTX_FLAG_LANGID_VALID)
446 actw.wLangId = actctx->wLangId;
447 if (actw.dwFlags & ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID)
449 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpAssemblyDirectory, -1, NULL, 0);
450 assdir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
451 if (!assdir) goto done;
452 MultiByteToWideChar(CP_ACP, 0, actctx->lpAssemblyDirectory, -1, assdir, len);
453 actw.lpAssemblyDirectory = assdir;
455 if (actw.dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID)
457 if ((ULONG_PTR)actctx->lpResourceName >> 16)
459 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpResourceName, -1, NULL, 0);
460 resname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
461 if (!resname) goto done;
462 MultiByteToWideChar(CP_ACP, 0, actctx->lpResourceName, -1, resname, len);
463 actw.lpResourceName = resname;
465 else actw.lpResourceName = (LPCWSTR)actctx->lpResourceName;
467 if (actw.dwFlags & ACTCTX_FLAG_APPLICATION_NAME_VALID)
469 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpApplicationName, -1, NULL, 0);
470 appname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
471 if (!appname) goto done;
472 MultiByteToWideChar(CP_ACP, 0, actctx->lpApplicationName, -1, appname, len);
473 actw.lpApplicationName = appname;
475 if (actw.dwFlags & ACTCTX_FLAG_HMODULE_VALID)
476 actw.hModule = actctx->hModule;
478 ret = CreateActCtxW(&actw);
480 done:
481 HeapFree(GetProcessHeap(), 0, src);
482 HeapFree(GetProcessHeap(), 0, assdir);
483 HeapFree(GetProcessHeap(), 0, resname);
484 HeapFree(GetProcessHeap(), 0, appname);
485 return ret;
488 /***********************************************************************
489 * FindActCtxSectionStringA (KERNEL32.@)
491 BOOL WINAPI FindActCtxSectionStringA( DWORD flags, const GUID *guid, ULONG id, const char *search,
492 ACTCTX_SECTION_KEYED_DATA *info )
494 LPWSTR searchW;
495 DWORD len;
496 BOOL ret;
498 TRACE("%08x %s %u %s %p\n", flags, debugstr_guid(guid), id, debugstr_a(search), info);
500 if (!search || !info)
502 SetLastError(ERROR_INVALID_PARAMETER);
503 return FALSE;
505 len = MultiByteToWideChar(CP_ACP, 0, search, -1, NULL, 0);
506 searchW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
507 MultiByteToWideChar(CP_ACP, 0, search, -1, searchW, len);
508 ret = FindActCtxSectionStringW( flags, guid, id, searchW, info );
509 HeapFree(GetProcessHeap(), 0, searchW);
510 return ret;
514 /***********************************************************************
515 * CmdBatNotification (KERNEL32.@)
517 * Notifies the system that a batch file has started or finished.
519 * PARAMS
520 * bBatchRunning [I] TRUE if a batch file has started or
521 * FALSE if a batch file has finished executing.
523 * RETURNS
524 * Unknown.
526 BOOL WINAPI CmdBatNotification( BOOL bBatchRunning )
528 FIXME("%d\n", bBatchRunning);
529 return FALSE;
532 /***********************************************************************
533 * RegisterApplicationRestart (KERNEL32.@)
535 HRESULT WINAPI RegisterApplicationRestart(PCWSTR pwzCommandLine, DWORD dwFlags)
537 FIXME("(%s,%d)\n", debugstr_w(pwzCommandLine), dwFlags);
539 return S_OK;
542 /**********************************************************************
543 * WTSGetActiveConsoleSessionId (KERNEL32.@)
545 DWORD WINAPI WTSGetActiveConsoleSessionId(void)
547 static int once;
548 if (!once++) FIXME("stub\n");
549 /* Return current session id. */
550 return NtCurrentTeb()->Peb->SessionId;
553 /**********************************************************************
554 * GetSystemDEPPolicy (KERNEL32.@)
556 DEP_SYSTEM_POLICY_TYPE WINAPI GetSystemDEPPolicy(void)
558 return user_shared_data->NXSupportPolicy;
561 /**********************************************************************
562 * SetProcessDEPPolicy (KERNEL32.@)
564 BOOL WINAPI SetProcessDEPPolicy( DWORD flags )
566 ULONG dep_flags = 0;
568 TRACE("%#x\n", flags);
570 if (flags & PROCESS_DEP_ENABLE)
571 dep_flags |= MEM_EXECUTE_OPTION_DISABLE | MEM_EXECUTE_OPTION_PERMANENT;
572 if (flags & PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION)
573 dep_flags |= MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION;
575 return set_ntstatus( NtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags,
576 &dep_flags, sizeof(dep_flags) ) );
579 /**********************************************************************
580 * ApplicationRecoveryFinished (KERNEL32.@)
582 VOID WINAPI ApplicationRecoveryFinished(BOOL success)
584 FIXME(": stub\n");
585 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
588 /**********************************************************************
589 * ApplicationRecoveryInProgress (KERNEL32.@)
591 HRESULT WINAPI ApplicationRecoveryInProgress(PBOOL canceled)
593 FIXME(":%p stub\n", canceled);
594 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
595 return E_FAIL;
598 /**********************************************************************
599 * RegisterApplicationRecoveryCallback (KERNEL32.@)
601 HRESULT WINAPI RegisterApplicationRecoveryCallback(APPLICATION_RECOVERY_CALLBACK callback, PVOID param, DWORD pingint, DWORD flags)
603 FIXME("%p, %p, %d, %d: stub, faking success\n", callback, param, pingint, flags);
604 return S_OK;
607 /***********************************************************************
608 * GetActiveProcessorGroupCount (KERNEL32.@)
610 WORD WINAPI GetActiveProcessorGroupCount(void)
612 FIXME("semi-stub, always returning 1\n");
613 return 1;
616 /***********************************************************************
617 * GetActiveProcessorCount (KERNEL32.@)
619 DWORD WINAPI GetActiveProcessorCount(WORD group)
621 DWORD cpus = system_info.NumberOfProcessors;
623 FIXME("semi-stub, returning %u\n", cpus);
624 return cpus;
627 /***********************************************************************
628 * GetMaximumProcessorCount (KERNEL32.@)
630 DWORD WINAPI GetMaximumProcessorCount(WORD group)
632 DWORD cpus = system_info.NumberOfProcessors;
634 FIXME("semi-stub, returning %u\n", cpus);
635 return cpus;
638 /***********************************************************************
639 * GetFirmwareEnvironmentVariableA (KERNEL32.@)
641 DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR name, LPCSTR guid, PVOID buffer, DWORD size)
643 FIXME("stub: %s %s %p %u\n", debugstr_a(name), debugstr_a(guid), buffer, size);
644 SetLastError(ERROR_INVALID_FUNCTION);
645 return 0;
648 /***********************************************************************
649 * GetFirmwareEnvironmentVariableW (KERNEL32.@)
651 DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR name, LPCWSTR guid, PVOID buffer, DWORD size)
653 FIXME("stub: %s %s %p %u\n", debugstr_w(name), debugstr_w(guid), buffer, size);
654 SetLastError(ERROR_INVALID_FUNCTION);
655 return 0;
658 /***********************************************************************
659 * SetFirmwareEnvironmentVariableW (KERNEL32.@)
661 BOOL WINAPI SetFirmwareEnvironmentVariableW(const WCHAR *name, const WCHAR *guid, void *buffer, DWORD size)
663 FIXME("stub: %s %s %p %u\n", debugstr_w(name), debugstr_w(guid), buffer, size);
664 SetLastError(ERROR_INVALID_FUNCTION);
665 return FALSE;
668 /**********************************************************************
669 * GetNumaNodeProcessorMask (KERNEL32.@)
671 BOOL WINAPI GetNumaNodeProcessorMask(UCHAR node, PULONGLONG mask)
673 FIXME("(%c %p): stub\n", node, mask);
674 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
675 return FALSE;
678 /**********************************************************************
679 * GetNumaAvailableMemoryNode (KERNEL32.@)
681 BOOL WINAPI GetNumaAvailableMemoryNode(UCHAR node, PULONGLONG available_bytes)
683 FIXME("(%c %p): stub\n", node, available_bytes);
684 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
685 return FALSE;
688 /**********************************************************************
689 * GetNumaAvailableMemoryNodeEx (KERNEL32.@)
691 BOOL WINAPI GetNumaAvailableMemoryNodeEx(USHORT node, PULONGLONG available_bytes)
693 FIXME("(%hu %p): stub\n", node, available_bytes);
694 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
695 return FALSE;
698 /***********************************************************************
699 * GetNumaProcessorNode (KERNEL32.@)
701 BOOL WINAPI GetNumaProcessorNode(UCHAR processor, PUCHAR node)
703 TRACE("(%d, %p)\n", processor, node);
705 if (processor < system_info.NumberOfProcessors)
707 *node = 0;
708 return TRUE;
711 *node = 0xFF;
712 SetLastError(ERROR_INVALID_PARAMETER);
713 return FALSE;
716 /***********************************************************************
717 * GetNumaProcessorNodeEx (KERNEL32.@)
719 BOOL WINAPI GetNumaProcessorNodeEx(PPROCESSOR_NUMBER processor, PUSHORT node_number)
721 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
722 return FALSE;
725 /***********************************************************************
726 * GetNumaProximityNode (KERNEL32.@)
728 BOOL WINAPI GetNumaProximityNode(ULONG proximity_id, PUCHAR node_number)
730 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
731 return FALSE;
734 /**********************************************************************
735 * GetProcessDEPPolicy (KERNEL32.@)
737 BOOL WINAPI GetProcessDEPPolicy(HANDLE process, LPDWORD flags, PBOOL permanent)
739 ULONG dep_flags;
741 TRACE("(%p %p %p)\n", process, flags, permanent);
743 if (!set_ntstatus( NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags,
744 &dep_flags, sizeof(dep_flags), NULL )))
745 return FALSE;
747 if (flags)
749 *flags = 0;
750 if (dep_flags & MEM_EXECUTE_OPTION_DISABLE)
751 *flags |= PROCESS_DEP_ENABLE;
752 if (dep_flags & MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION)
753 *flags |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
756 if (permanent) *permanent = (dep_flags & MEM_EXECUTE_OPTION_PERMANENT) != 0;
757 return TRUE;
760 /***********************************************************************
761 * UnregisterApplicationRestart (KERNEL32.@)
763 HRESULT WINAPI UnregisterApplicationRestart(void)
765 FIXME(": stub\n");
766 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
767 return S_OK;
770 /***********************************************************************
771 * CreateUmsCompletionList (KERNEL32.@)
773 BOOL WINAPI CreateUmsCompletionList(PUMS_COMPLETION_LIST *list)
775 FIXME( "%p: stub\n", list );
776 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
777 return FALSE;
780 /***********************************************************************
781 * CreateUmsThreadContext (KERNEL32.@)
783 BOOL WINAPI CreateUmsThreadContext(PUMS_CONTEXT *ctx)
785 FIXME( "%p: stub\n", ctx );
786 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
787 return FALSE;
790 /***********************************************************************
791 * DeleteUmsCompletionList (KERNEL32.@)
793 BOOL WINAPI DeleteUmsCompletionList(PUMS_COMPLETION_LIST list)
795 FIXME( "%p: stub\n", list );
796 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
797 return FALSE;
800 /***********************************************************************
801 * DeleteUmsThreadContext (KERNEL32.@)
803 BOOL WINAPI DeleteUmsThreadContext(PUMS_CONTEXT ctx)
805 FIXME( "%p: stub\n", ctx );
806 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
807 return FALSE;
810 /***********************************************************************
811 * DequeueUmsCompletionListItems (KERNEL32.@)
813 BOOL WINAPI DequeueUmsCompletionListItems(void *list, DWORD timeout, PUMS_CONTEXT *ctx)
815 FIXME( "%p,%08x,%p: stub\n", list, timeout, ctx );
816 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
817 return FALSE;
820 /***********************************************************************
821 * EnterUmsSchedulingMode (KERNEL32.@)
823 BOOL WINAPI EnterUmsSchedulingMode(UMS_SCHEDULER_STARTUP_INFO *info)
825 FIXME( "%p: stub\n", info );
826 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
827 return FALSE;
830 /***********************************************************************
831 * ExecuteUmsThread (KERNEL32.@)
833 BOOL WINAPI ExecuteUmsThread(PUMS_CONTEXT ctx)
835 FIXME( "%p: stub\n", ctx );
836 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
837 return FALSE;
840 /***********************************************************************
841 * GetCurrentUmsThread (KERNEL32.@)
843 PUMS_CONTEXT WINAPI GetCurrentUmsThread(void)
845 FIXME( "stub\n" );
846 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
847 return FALSE;
850 /***********************************************************************
851 * GetNextUmsListItem (KERNEL32.@)
853 PUMS_CONTEXT WINAPI GetNextUmsListItem(PUMS_CONTEXT ctx)
855 FIXME( "%p: stub\n", ctx );
856 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
857 return NULL;
860 /***********************************************************************
861 * GetUmsCompletionListEvent (KERNEL32.@)
863 BOOL WINAPI GetUmsCompletionListEvent(PUMS_COMPLETION_LIST list, HANDLE *event)
865 FIXME( "%p,%p: stub\n", list, event );
866 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
867 return FALSE;
870 /***********************************************************************
871 * QueryUmsThreadInformation (KERNEL32.@)
873 BOOL WINAPI QueryUmsThreadInformation(PUMS_CONTEXT ctx, UMS_THREAD_INFO_CLASS class,
874 void *buf, ULONG length, ULONG *ret_length)
876 FIXME( "%p,%08x,%p,%08x,%p: stub\n", ctx, class, buf, length, ret_length );
877 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
878 return FALSE;
881 /***********************************************************************
882 * SetUmsThreadInformation (KERNEL32.@)
884 BOOL WINAPI SetUmsThreadInformation(PUMS_CONTEXT ctx, UMS_THREAD_INFO_CLASS class,
885 void *buf, ULONG length)
887 FIXME( "%p,%08x,%p,%08x: stub\n", ctx, class, buf, length );
888 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
889 return FALSE;
892 /***********************************************************************
893 * UmsThreadYield (KERNEL32.@)
895 BOOL WINAPI UmsThreadYield(void *param)
897 FIXME( "%p: stub\n", param );
898 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
899 return FALSE;