kernel32: Use wide-char string literals.
[wine.git] / dlls / kernel32 / process.c
blobc2df0ccd6588bc9751d407747a01d310ad56331f
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 "wine/exception.h"
38 #include "wine/server.h"
39 #include "wine/asm.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(process);
44 typedef struct
46 LPSTR lpEnvAddress;
47 LPSTR lpCmdLine;
48 LPSTR lpCmdShow;
49 DWORD dwReserved;
50 } LOADPARMS32;
52 HMODULE kernel32_handle = 0;
53 SYSTEM_BASIC_INFORMATION system_info = { 0 };
55 const WCHAR DIR_Windows[] = L"C:\\windows";
56 const WCHAR DIR_System[] = L"C:\\windows\\system32";
58 /* Process flags */
59 #define PDB32_DEBUGGED 0x0001 /* Process is being debugged */
60 #define PDB32_WIN16_PROC 0x0008 /* Win16 process */
61 #define PDB32_DOS_PROC 0x0010 /* Dos process */
62 #define PDB32_CONSOLE_PROC 0x0020 /* Console process */
63 #define PDB32_FILE_APIS_OEM 0x0040 /* File APIs are OEM */
64 #define PDB32_WIN32S_PROC 0x8000 /* Win32s process */
67 /***********************************************************************
68 * wait_input_idle
70 * Wrapper to call WaitForInputIdle USER function
72 typedef DWORD (WINAPI *WaitForInputIdle_ptr)( HANDLE hProcess, DWORD dwTimeOut );
74 static DWORD wait_input_idle( HANDLE process, DWORD timeout )
76 HMODULE mod = GetModuleHandleA( "user32.dll" );
77 if (mod)
79 WaitForInputIdle_ptr ptr = (WaitForInputIdle_ptr)GetProcAddress( mod, "WaitForInputIdle" );
80 if (ptr) return ptr( process, timeout );
82 return 0;
86 /***********************************************************************
87 * WinExec (KERNEL32.@)
89 UINT WINAPI DECLSPEC_HOTPATCH WinExec( LPCSTR lpCmdLine, UINT nCmdShow )
91 PROCESS_INFORMATION info;
92 STARTUPINFOA startup;
93 char *cmdline;
94 UINT ret;
96 memset( &startup, 0, sizeof(startup) );
97 startup.cb = sizeof(startup);
98 startup.dwFlags = STARTF_USESHOWWINDOW;
99 startup.wShowWindow = nCmdShow;
101 /* cmdline needs to be writable for CreateProcess */
102 if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(lpCmdLine)+1 ))) return 0;
103 strcpy( cmdline, lpCmdLine );
105 if (CreateProcessA( NULL, cmdline, NULL, NULL, FALSE,
106 0, NULL, NULL, &startup, &info ))
108 /* Give 30 seconds to the app to come up */
109 if (wait_input_idle( info.hProcess, 30000 ) == WAIT_FAILED)
110 WARN("WaitForInputIdle failed: Error %d\n", GetLastError() );
111 ret = 33;
112 /* Close off the handles */
113 CloseHandle( info.hThread );
114 CloseHandle( info.hProcess );
116 else if ((ret = GetLastError()) >= 32)
118 FIXME("Strange error set by CreateProcess: %d\n", ret );
119 ret = 11;
121 HeapFree( GetProcessHeap(), 0, cmdline );
122 return ret;
126 /**********************************************************************
127 * LoadModule (KERNEL32.@)
129 DWORD WINAPI LoadModule( LPCSTR name, LPVOID paramBlock )
131 LOADPARMS32 *params = paramBlock;
132 PROCESS_INFORMATION info;
133 STARTUPINFOA startup;
134 DWORD ret;
135 LPSTR cmdline, p;
136 char filename[MAX_PATH];
137 BYTE len;
139 if (!name) return ERROR_FILE_NOT_FOUND;
141 if (!SearchPathA( NULL, name, ".exe", sizeof(filename), filename, NULL ) &&
142 !SearchPathA( NULL, name, NULL, sizeof(filename), filename, NULL ))
143 return GetLastError();
145 len = (BYTE)params->lpCmdLine[0];
146 if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(filename) + len + 2 )))
147 return ERROR_NOT_ENOUGH_MEMORY;
149 strcpy( cmdline, filename );
150 p = cmdline + strlen(cmdline);
151 *p++ = ' ';
152 memcpy( p, params->lpCmdLine + 1, len );
153 p[len] = 0;
155 memset( &startup, 0, sizeof(startup) );
156 startup.cb = sizeof(startup);
157 if (params->lpCmdShow)
159 startup.dwFlags = STARTF_USESHOWWINDOW;
160 startup.wShowWindow = ((WORD *)params->lpCmdShow)[1];
163 if (CreateProcessA( filename, cmdline, NULL, NULL, FALSE, 0,
164 params->lpEnvAddress, NULL, &startup, &info ))
166 /* Give 30 seconds to the app to come up */
167 if (wait_input_idle( info.hProcess, 30000 ) == WAIT_FAILED)
168 WARN("WaitForInputIdle failed: Error %d\n", GetLastError() );
169 ret = 33;
170 /* Close off the handles */
171 CloseHandle( info.hThread );
172 CloseHandle( info.hProcess );
174 else if ((ret = GetLastError()) >= 32)
176 FIXME("Strange error set by CreateProcess: %u\n", ret );
177 ret = 11;
180 HeapFree( GetProcessHeap(), 0, cmdline );
181 return ret;
185 /***********************************************************************
186 * ExitProcess (KERNEL32.@)
188 * Exits the current process.
190 * PARAMS
191 * status [I] Status code to exit with.
193 * RETURNS
194 * Nothing.
196 #ifdef __i386__
197 __ASM_STDCALL_FUNC( ExitProcess, 4, /* Shrinker depend on this particular ExitProcess implementation */
198 "pushl %ebp\n\t"
199 ".byte 0x8B, 0xEC\n\t" /* movl %esp, %ebp */
200 ".byte 0x6A, 0x00\n\t" /* pushl $0 */
201 ".byte 0x68, 0x00, 0x00, 0x00, 0x00\n\t" /* pushl $0 - 4 bytes immediate */
202 "pushl 8(%ebp)\n\t"
203 "call " __ASM_STDCALL("RtlExitUserProcess",4) "\n\t"
204 "leave\n\t"
205 "ret $4" )
206 #else
208 void WINAPI ExitProcess( DWORD status )
210 RtlExitUserProcess( status );
213 #endif
215 /***********************************************************************
216 * GetExitCodeProcess [KERNEL32.@]
218 * Gets termination status of specified process.
220 * PARAMS
221 * hProcess [in] Handle to the process.
222 * lpExitCode [out] Address to receive termination status.
224 * RETURNS
225 * Success: TRUE
226 * Failure: FALSE
228 BOOL WINAPI GetExitCodeProcess( HANDLE hProcess, LPDWORD lpExitCode )
230 PROCESS_BASIC_INFORMATION pbi;
232 if (!set_ntstatus( NtQueryInformationProcess( hProcess, ProcessBasicInformation, &pbi, sizeof(pbi), NULL )))
233 return FALSE;
234 if (lpExitCode) *lpExitCode = pbi.ExitStatus;
235 return TRUE;
239 /**************************************************************************
240 * FatalExit (KERNEL32.@)
242 void WINAPI FatalExit( int code )
244 WARN( "FatalExit\n" );
245 ExitProcess( code );
249 /***********************************************************************
250 * GetProcessFlags (KERNEL32.@)
252 DWORD WINAPI GetProcessFlags( DWORD processid )
254 IMAGE_NT_HEADERS *nt;
255 DWORD flags = 0;
257 if (processid && processid != GetCurrentProcessId()) return 0;
259 if ((nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress )))
261 if (nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
262 flags |= PDB32_CONSOLE_PROC;
264 if (!AreFileApisANSI()) flags |= PDB32_FILE_APIS_OEM;
265 if (IsDebuggerPresent()) flags |= PDB32_DEBUGGED;
266 return flags;
270 /***********************************************************************
271 * ConvertToGlobalHandle (KERNEL32.@)
273 HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc)
275 HANDLE ret = INVALID_HANDLE_VALUE;
276 DuplicateHandle( GetCurrentProcess(), hSrc, GetCurrentProcess(), &ret, 0, FALSE,
277 DUP_HANDLE_MAKE_GLOBAL | DUP_HANDLE_SAME_ACCESS | DUP_HANDLE_CLOSE_SOURCE );
278 return ret;
282 /***********************************************************************
283 * SetHandleContext (KERNEL32.@)
285 BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context)
287 FIXME("(%p,%d), stub. In case this got called by WSOCK32/WS2_32: "
288 "the external WINSOCK DLLs won't work with WINE, don't use them.\n",hnd,context);
289 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
290 return FALSE;
294 /***********************************************************************
295 * GetHandleContext (KERNEL32.@)
297 DWORD WINAPI GetHandleContext(HANDLE hnd)
299 FIXME("(%p), stub. In case this got called by WSOCK32/WS2_32: "
300 "the external WINSOCK DLLs won't work with WINE, don't use them.\n",hnd);
301 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
302 return 0;
306 /***********************************************************************
307 * CreateSocketHandle (KERNEL32.@)
309 HANDLE WINAPI CreateSocketHandle(void)
311 FIXME("(), stub. In case this got called by WSOCK32/WS2_32: "
312 "the external WINSOCK DLLs won't work with WINE, don't use them.\n");
313 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
314 return INVALID_HANDLE_VALUE;
318 /***********************************************************************
319 * SetProcessAffinityMask (KERNEL32.@)
321 BOOL WINAPI SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR affmask )
323 return set_ntstatus( NtSetInformationProcess( hProcess, ProcessAffinityMask,
324 &affmask, sizeof(DWORD_PTR) ));
328 /**********************************************************************
329 * GetProcessAffinityMask (KERNEL32.@)
331 BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PDWORD_PTR system_mask )
333 if (process_mask)
335 if (!set_ntstatus( NtQueryInformationProcess( hProcess, ProcessAffinityMask,
336 process_mask, sizeof(*process_mask), NULL )))
337 return FALSE;
339 if (system_mask)
341 SYSTEM_BASIC_INFORMATION info;
343 if (!set_ntstatus( NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )))
344 return FALSE;
345 *system_mask = info.ActiveProcessorsAffinityMask;
347 return TRUE;
351 /***********************************************************************
352 * SetProcessWorkingSetSize [KERNEL32.@]
353 * Sets the min/max working set sizes for a specified process.
355 * PARAMS
356 * process [I] Handle to the process of interest
357 * minset [I] Specifies minimum working set size
358 * maxset [I] Specifies maximum working set size
360 * RETURNS
361 * Success: TRUE
362 * Failure: FALSE
364 BOOL WINAPI SetProcessWorkingSetSize(HANDLE process, SIZE_T minset, SIZE_T maxset)
366 return SetProcessWorkingSetSizeEx(process, minset, maxset, 0);
369 /***********************************************************************
370 * GetProcessWorkingSetSize (KERNEL32.@)
372 BOOL WINAPI GetProcessWorkingSetSize(HANDLE process, SIZE_T *minset, SIZE_T *maxset)
374 return GetProcessWorkingSetSizeEx(process, minset, maxset, NULL);
378 /******************************************************************
379 * GetProcessIoCounters (KERNEL32.@)
381 BOOL WINAPI GetProcessIoCounters(HANDLE hProcess, PIO_COUNTERS ioc)
383 return set_ntstatus( NtQueryInformationProcess(hProcess, ProcessIoCounters, ioc, sizeof(*ioc), NULL ));
386 /***********************************************************************
387 * RegisterServiceProcess (KERNEL32.@)
389 * A service process calls this function to ensure that it continues to run
390 * even after a user logged off.
392 DWORD WINAPI RegisterServiceProcess(DWORD dwProcessId, DWORD dwType)
394 /* I don't think that Wine needs to do anything in this function */
395 return 1; /* success */
399 /***********************************************************************
400 * GetCurrentProcess (KERNEL32.@)
402 * Get a handle to the current process.
404 * PARAMS
405 * None.
407 * RETURNS
408 * A handle representing the current process.
410 HANDLE WINAPI KERNEL32_GetCurrentProcess(void)
412 return (HANDLE)~(ULONG_PTR)0;
416 /***********************************************************************
417 * CreateActCtxA (KERNEL32.@)
419 HANDLE WINAPI DECLSPEC_HOTPATCH CreateActCtxA( const ACTCTXA *actctx )
421 ACTCTXW actw;
422 SIZE_T len;
423 HANDLE ret = INVALID_HANDLE_VALUE;
424 LPWSTR src = NULL, assdir = NULL, resname = NULL, appname = NULL;
426 TRACE("%p %08x\n", actctx, actctx ? actctx->dwFlags : 0);
428 if (!actctx || actctx->cbSize != sizeof(*actctx))
430 SetLastError(ERROR_INVALID_PARAMETER);
431 return INVALID_HANDLE_VALUE;
434 actw.cbSize = sizeof(actw);
435 actw.dwFlags = actctx->dwFlags;
436 if (actctx->lpSource)
438 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpSource, -1, NULL, 0);
439 src = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
440 if (!src) return INVALID_HANDLE_VALUE;
441 MultiByteToWideChar(CP_ACP, 0, actctx->lpSource, -1, src, len);
443 actw.lpSource = src;
445 if (actw.dwFlags & ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID)
446 actw.wProcessorArchitecture = actctx->wProcessorArchitecture;
447 if (actw.dwFlags & ACTCTX_FLAG_LANGID_VALID)
448 actw.wLangId = actctx->wLangId;
449 if (actw.dwFlags & ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID)
451 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpAssemblyDirectory, -1, NULL, 0);
452 assdir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
453 if (!assdir) goto done;
454 MultiByteToWideChar(CP_ACP, 0, actctx->lpAssemblyDirectory, -1, assdir, len);
455 actw.lpAssemblyDirectory = assdir;
457 if (actw.dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID)
459 if ((ULONG_PTR)actctx->lpResourceName >> 16)
461 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpResourceName, -1, NULL, 0);
462 resname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
463 if (!resname) goto done;
464 MultiByteToWideChar(CP_ACP, 0, actctx->lpResourceName, -1, resname, len);
465 actw.lpResourceName = resname;
467 else actw.lpResourceName = (LPCWSTR)actctx->lpResourceName;
469 if (actw.dwFlags & ACTCTX_FLAG_APPLICATION_NAME_VALID)
471 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpApplicationName, -1, NULL, 0);
472 appname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
473 if (!appname) goto done;
474 MultiByteToWideChar(CP_ACP, 0, actctx->lpApplicationName, -1, appname, len);
475 actw.lpApplicationName = appname;
477 if (actw.dwFlags & ACTCTX_FLAG_HMODULE_VALID)
478 actw.hModule = actctx->hModule;
480 ret = CreateActCtxW(&actw);
482 done:
483 HeapFree(GetProcessHeap(), 0, src);
484 HeapFree(GetProcessHeap(), 0, assdir);
485 HeapFree(GetProcessHeap(), 0, resname);
486 HeapFree(GetProcessHeap(), 0, appname);
487 return ret;
490 /***********************************************************************
491 * FindActCtxSectionStringA (KERNEL32.@)
493 BOOL WINAPI FindActCtxSectionStringA( DWORD flags, const GUID *guid, ULONG id, const char *search,
494 ACTCTX_SECTION_KEYED_DATA *info )
496 LPWSTR searchW;
497 DWORD len;
498 BOOL ret;
500 TRACE("%08x %s %u %s %p\n", flags, debugstr_guid(guid), id, debugstr_a(search), info);
502 if (!search || !info)
504 SetLastError(ERROR_INVALID_PARAMETER);
505 return FALSE;
507 len = MultiByteToWideChar(CP_ACP, 0, search, -1, NULL, 0);
508 searchW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
509 MultiByteToWideChar(CP_ACP, 0, search, -1, searchW, len);
510 ret = FindActCtxSectionStringW( flags, guid, id, searchW, info );
511 HeapFree(GetProcessHeap(), 0, searchW);
512 return ret;
516 /***********************************************************************
517 * CmdBatNotification (KERNEL32.@)
519 * Notifies the system that a batch file has started or finished.
521 * PARAMS
522 * bBatchRunning [I] TRUE if a batch file has started or
523 * FALSE if a batch file has finished executing.
525 * RETURNS
526 * Unknown.
528 BOOL WINAPI CmdBatNotification( BOOL bBatchRunning )
530 FIXME("%d\n", bBatchRunning);
531 return FALSE;
534 /***********************************************************************
535 * RegisterApplicationRestart (KERNEL32.@)
537 HRESULT WINAPI RegisterApplicationRestart(PCWSTR pwzCommandLine, DWORD dwFlags)
539 FIXME("(%s,%d)\n", debugstr_w(pwzCommandLine), dwFlags);
541 return S_OK;
544 /**********************************************************************
545 * WTSGetActiveConsoleSessionId (KERNEL32.@)
547 DWORD WINAPI WTSGetActiveConsoleSessionId(void)
549 static int once;
550 if (!once++) FIXME("stub\n");
551 /* Return current session id. */
552 return NtCurrentTeb()->Peb->SessionId;
555 /**********************************************************************
556 * GetSystemDEPPolicy (KERNEL32.@)
558 DEP_SYSTEM_POLICY_TYPE WINAPI GetSystemDEPPolicy(void)
560 FIXME("stub\n");
561 return OptIn;
564 /**********************************************************************
565 * SetProcessDEPPolicy (KERNEL32.@)
567 BOOL WINAPI SetProcessDEPPolicy(DWORD newDEP)
569 FIXME("(%d): stub\n", newDEP);
570 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
571 return FALSE;
574 /**********************************************************************
575 * ApplicationRecoveryFinished (KERNEL32.@)
577 VOID WINAPI ApplicationRecoveryFinished(BOOL success)
579 FIXME(": stub\n");
580 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
583 /**********************************************************************
584 * ApplicationRecoveryInProgress (KERNEL32.@)
586 HRESULT WINAPI ApplicationRecoveryInProgress(PBOOL canceled)
588 FIXME(":%p stub\n", canceled);
589 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
590 return E_FAIL;
593 /**********************************************************************
594 * RegisterApplicationRecoveryCallback (KERNEL32.@)
596 HRESULT WINAPI RegisterApplicationRecoveryCallback(APPLICATION_RECOVERY_CALLBACK callback, PVOID param, DWORD pingint, DWORD flags)
598 FIXME("%p, %p, %d, %d: stub, faking success\n", callback, param, pingint, flags);
599 return S_OK;
602 /***********************************************************************
603 * GetActiveProcessorGroupCount (KERNEL32.@)
605 WORD WINAPI GetActiveProcessorGroupCount(void)
607 FIXME("semi-stub, always returning 1\n");
608 return 1;
611 /***********************************************************************
612 * GetActiveProcessorCount (KERNEL32.@)
614 DWORD WINAPI GetActiveProcessorCount(WORD group)
616 DWORD cpus = system_info.NumberOfProcessors;
618 FIXME("semi-stub, returning %u\n", cpus);
619 return cpus;
622 /***********************************************************************
623 * GetMaximumProcessorCount (KERNEL32.@)
625 DWORD WINAPI GetMaximumProcessorCount(WORD group)
627 DWORD cpus = system_info.NumberOfProcessors;
629 FIXME("semi-stub, returning %u\n", cpus);
630 return cpus;
633 /***********************************************************************
634 * GetFirmwareEnvironmentVariableA (KERNEL32.@)
636 DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR name, LPCSTR guid, PVOID buffer, DWORD size)
638 FIXME("stub: %s %s %p %u\n", debugstr_a(name), debugstr_a(guid), buffer, size);
639 SetLastError(ERROR_INVALID_FUNCTION);
640 return 0;
643 /***********************************************************************
644 * GetFirmwareEnvironmentVariableW (KERNEL32.@)
646 DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR name, LPCWSTR guid, PVOID buffer, DWORD size)
648 FIXME("stub: %s %s %p %u\n", debugstr_w(name), debugstr_w(guid), buffer, size);
649 SetLastError(ERROR_INVALID_FUNCTION);
650 return 0;
653 /***********************************************************************
654 * SetFirmwareEnvironmentVariableW (KERNEL32.@)
656 BOOL WINAPI SetFirmwareEnvironmentVariableW(const WCHAR *name, const WCHAR *guid, void *buffer, DWORD size)
658 FIXME("stub: %s %s %p %u\n", debugstr_w(name), debugstr_w(guid), buffer, size);
659 SetLastError(ERROR_INVALID_FUNCTION);
660 return FALSE;
663 /**********************************************************************
664 * GetNumaNodeProcessorMask (KERNEL32.@)
666 BOOL WINAPI GetNumaNodeProcessorMask(UCHAR node, PULONGLONG mask)
668 FIXME("(%c %p): stub\n", node, mask);
669 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
670 return FALSE;
673 /**********************************************************************
674 * GetNumaAvailableMemoryNode (KERNEL32.@)
676 BOOL WINAPI GetNumaAvailableMemoryNode(UCHAR node, PULONGLONG available_bytes)
678 FIXME("(%c %p): stub\n", node, available_bytes);
679 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
680 return FALSE;
683 /**********************************************************************
684 * GetNumaAvailableMemoryNodeEx (KERNEL32.@)
686 BOOL WINAPI GetNumaAvailableMemoryNodeEx(USHORT node, PULONGLONG available_bytes)
688 FIXME("(%hu %p): stub\n", node, available_bytes);
689 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
690 return FALSE;
693 /***********************************************************************
694 * GetNumaProcessorNode (KERNEL32.@)
696 BOOL WINAPI GetNumaProcessorNode(UCHAR processor, PUCHAR node)
698 TRACE("(%d, %p)\n", processor, node);
700 if (processor < system_info.NumberOfProcessors)
702 *node = 0;
703 return TRUE;
706 *node = 0xFF;
707 SetLastError(ERROR_INVALID_PARAMETER);
708 return FALSE;
711 /***********************************************************************
712 * GetNumaProcessorNodeEx (KERNEL32.@)
714 BOOL WINAPI GetNumaProcessorNodeEx(PPROCESSOR_NUMBER processor, PUSHORT node_number)
716 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
717 return FALSE;
720 /***********************************************************************
721 * GetNumaProximityNode (KERNEL32.@)
723 BOOL WINAPI GetNumaProximityNode(ULONG proximity_id, PUCHAR node_number)
725 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
726 return FALSE;
729 /**********************************************************************
730 * GetProcessDEPPolicy (KERNEL32.@)
732 BOOL WINAPI GetProcessDEPPolicy(HANDLE process, LPDWORD flags, PBOOL permanent)
734 ULONG dep_flags;
736 TRACE("(%p %p %p)\n", process, flags, permanent);
738 if (!set_ntstatus( NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags,
739 &dep_flags, sizeof(dep_flags), NULL )))
740 return FALSE;
742 if (flags)
744 *flags = 0;
745 if (dep_flags & MEM_EXECUTE_OPTION_DISABLE)
746 *flags |= PROCESS_DEP_ENABLE;
747 if (dep_flags & MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION)
748 *flags |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
751 if (permanent) *permanent = (dep_flags & MEM_EXECUTE_OPTION_PERMANENT) != 0;
752 return TRUE;
755 /***********************************************************************
756 * UnregisterApplicationRestart (KERNEL32.@)
758 HRESULT WINAPI UnregisterApplicationRestart(void)
760 FIXME(": stub\n");
761 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
762 return S_OK;
765 /***********************************************************************
766 * CreateUmsCompletionList (KERNEL32.@)
768 BOOL WINAPI CreateUmsCompletionList(PUMS_COMPLETION_LIST *list)
770 FIXME( "%p: stub\n", list );
771 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
772 return FALSE;
775 /***********************************************************************
776 * CreateUmsThreadContext (KERNEL32.@)
778 BOOL WINAPI CreateUmsThreadContext(PUMS_CONTEXT *ctx)
780 FIXME( "%p: stub\n", ctx );
781 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
782 return FALSE;
785 /***********************************************************************
786 * DeleteUmsCompletionList (KERNEL32.@)
788 BOOL WINAPI DeleteUmsCompletionList(PUMS_COMPLETION_LIST list)
790 FIXME( "%p: stub\n", list );
791 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
792 return FALSE;
795 /***********************************************************************
796 * DeleteUmsThreadContext (KERNEL32.@)
798 BOOL WINAPI DeleteUmsThreadContext(PUMS_CONTEXT ctx)
800 FIXME( "%p: stub\n", ctx );
801 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
802 return FALSE;
805 /***********************************************************************
806 * DequeueUmsCompletionListItems (KERNEL32.@)
808 BOOL WINAPI DequeueUmsCompletionListItems(void *list, DWORD timeout, PUMS_CONTEXT *ctx)
810 FIXME( "%p,%08x,%p: stub\n", list, timeout, ctx );
811 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
812 return FALSE;
815 /***********************************************************************
816 * EnterUmsSchedulingMode (KERNEL32.@)
818 BOOL WINAPI EnterUmsSchedulingMode(UMS_SCHEDULER_STARTUP_INFO *info)
820 FIXME( "%p: stub\n", info );
821 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
822 return FALSE;
825 /***********************************************************************
826 * ExecuteUmsThread (KERNEL32.@)
828 BOOL WINAPI ExecuteUmsThread(PUMS_CONTEXT ctx)
830 FIXME( "%p: stub\n", ctx );
831 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
832 return FALSE;
835 /***********************************************************************
836 * GetCurrentUmsThread (KERNEL32.@)
838 PUMS_CONTEXT WINAPI GetCurrentUmsThread(void)
840 FIXME( "stub\n" );
841 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
842 return FALSE;
845 /***********************************************************************
846 * GetNextUmsListItem (KERNEL32.@)
848 PUMS_CONTEXT WINAPI GetNextUmsListItem(PUMS_CONTEXT ctx)
850 FIXME( "%p: stub\n", ctx );
851 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
852 return NULL;
855 /***********************************************************************
856 * GetUmsCompletionListEvent (KERNEL32.@)
858 BOOL WINAPI GetUmsCompletionListEvent(PUMS_COMPLETION_LIST list, HANDLE *event)
860 FIXME( "%p,%p: stub\n", list, event );
861 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
862 return FALSE;
865 /***********************************************************************
866 * QueryUmsThreadInformation (KERNEL32.@)
868 BOOL WINAPI QueryUmsThreadInformation(PUMS_CONTEXT ctx, UMS_THREAD_INFO_CLASS class,
869 void *buf, ULONG length, ULONG *ret_length)
871 FIXME( "%p,%08x,%p,%08x,%p: stub\n", ctx, class, buf, length, ret_length );
872 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
873 return FALSE;
876 /***********************************************************************
877 * SetUmsThreadInformation (KERNEL32.@)
879 BOOL WINAPI SetUmsThreadInformation(PUMS_CONTEXT ctx, UMS_THREAD_INFO_CLASS class,
880 void *buf, ULONG length)
882 FIXME( "%p,%08x,%p,%08x: stub\n", ctx, class, buf, length );
883 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
884 return FALSE;
887 /***********************************************************************
888 * UmsThreadYield (KERNEL32.@)
890 BOOL WINAPI UmsThreadYield(void *param)
892 FIXME( "%p: stub\n", param );
893 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
894 return FALSE;