kernelbase/tests: Use win_skip() for missing APIs.
[wine.git] / dlls / kernel32 / process.c
blobe9e18925911f3f18f7f74384ec83eb774c2d2c73
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/asm.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(process);
43 static const struct _KUSER_SHARED_DATA *user_shared_data = (struct _KUSER_SHARED_DATA *)0x7ffe0000;
45 typedef struct
47 LPSTR lpEnvAddress;
48 LPSTR lpCmdLine;
49 LPSTR lpCmdShow;
50 DWORD dwReserved;
51 } LOADPARMS32;
53 SYSTEM_BASIC_INFORMATION system_info = { 0 };
55 /* Process flags */
56 #define PDB32_DEBUGGED 0x0001 /* Process is being debugged */
57 #define PDB32_WIN16_PROC 0x0008 /* Win16 process */
58 #define PDB32_DOS_PROC 0x0010 /* Dos process */
59 #define PDB32_CONSOLE_PROC 0x0020 /* Console process */
60 #define PDB32_FILE_APIS_OEM 0x0040 /* File APIs are OEM */
61 #define PDB32_WIN32S_PROC 0x8000 /* Win32s process */
64 /***********************************************************************
65 * wait_input_idle
67 * Wrapper to call WaitForInputIdle USER function
69 typedef DWORD (WINAPI *WaitForInputIdle_ptr)( HANDLE hProcess, DWORD dwTimeOut );
71 static DWORD wait_input_idle( HANDLE process, DWORD timeout )
73 HMODULE mod = GetModuleHandleA( "user32.dll" );
74 if (mod)
76 WaitForInputIdle_ptr ptr = (WaitForInputIdle_ptr)GetProcAddress( mod, "WaitForInputIdle" );
77 if (ptr) return ptr( process, timeout );
79 return 0;
83 /***********************************************************************
84 * WinExec (KERNEL32.@)
86 UINT WINAPI DECLSPEC_HOTPATCH WinExec( LPCSTR lpCmdLine, UINT nCmdShow )
88 PROCESS_INFORMATION info;
89 STARTUPINFOA startup;
90 char *cmdline;
91 UINT ret;
93 memset( &startup, 0, sizeof(startup) );
94 startup.cb = sizeof(startup);
95 startup.dwFlags = STARTF_USESHOWWINDOW;
96 startup.wShowWindow = nCmdShow;
98 /* cmdline needs to be writable for CreateProcess */
99 if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(lpCmdLine)+1 ))) return 0;
100 strcpy( cmdline, lpCmdLine );
102 if (CreateProcessA( NULL, cmdline, NULL, NULL, FALSE,
103 0, NULL, NULL, &startup, &info ))
105 /* Give 30 seconds to the app to come up */
106 if (wait_input_idle( info.hProcess, 30000 ) == WAIT_FAILED)
107 WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
108 ret = 33;
109 /* Close off the handles */
110 CloseHandle( info.hThread );
111 CloseHandle( info.hProcess );
113 else if ((ret = GetLastError()) >= 32)
115 FIXME("Strange error set by CreateProcess: %d\n", ret );
116 ret = 11;
118 HeapFree( GetProcessHeap(), 0, cmdline );
119 return ret;
123 /**********************************************************************
124 * LoadModule (KERNEL32.@)
126 DWORD WINAPI LoadModule( LPCSTR name, LPVOID paramBlock )
128 LOADPARMS32 *params = paramBlock;
129 PROCESS_INFORMATION info;
130 STARTUPINFOA startup;
131 DWORD ret;
132 LPSTR cmdline, p;
133 char filename[MAX_PATH];
134 BYTE len;
136 if (!name) return ERROR_FILE_NOT_FOUND;
138 if (!SearchPathA( NULL, name, ".exe", sizeof(filename), filename, NULL ) &&
139 !SearchPathA( NULL, name, NULL, sizeof(filename), filename, NULL ))
140 return GetLastError();
142 len = (BYTE)params->lpCmdLine[0];
143 if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(filename) + len + 2 )))
144 return ERROR_NOT_ENOUGH_MEMORY;
146 strcpy( cmdline, filename );
147 p = cmdline + strlen(cmdline);
148 *p++ = ' ';
149 memcpy( p, params->lpCmdLine + 1, len );
150 p[len] = 0;
152 memset( &startup, 0, sizeof(startup) );
153 startup.cb = sizeof(startup);
154 if (params->lpCmdShow)
156 startup.dwFlags = STARTF_USESHOWWINDOW;
157 startup.wShowWindow = ((WORD *)params->lpCmdShow)[1];
160 if (CreateProcessA( filename, cmdline, NULL, NULL, FALSE, 0,
161 params->lpEnvAddress, NULL, &startup, &info ))
163 /* Give 30 seconds to the app to come up */
164 if (wait_input_idle( info.hProcess, 30000 ) == WAIT_FAILED)
165 WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
166 ret = 33;
167 /* Close off the handles */
168 CloseHandle( info.hThread );
169 CloseHandle( info.hProcess );
171 else if ((ret = GetLastError()) >= 32)
173 FIXME("Strange error set by CreateProcess: %lu\n", ret );
174 ret = 11;
177 HeapFree( GetProcessHeap(), 0, cmdline );
178 return ret;
182 /***********************************************************************
183 * ExitProcess (KERNEL32.@)
185 * Exits the current process.
187 * PARAMS
188 * status [I] Status code to exit with.
190 * RETURNS
191 * Nothing.
193 #ifdef __i386__
194 __ASM_STDCALL_FUNC( ExitProcess, 4, /* Shrinker depend on this particular ExitProcess implementation */
195 "pushl %ebp\n\t"
196 ".byte 0x8B, 0xEC\n\t" /* movl %esp, %ebp */
197 ".byte 0x6A, 0x00\n\t" /* pushl $0 */
198 ".byte 0x68, 0x00, 0x00, 0x00, 0x00\n\t" /* pushl $0 - 4 bytes immediate */
199 "pushl 8(%ebp)\n\t"
200 "call " __ASM_STDCALL("RtlExitUserProcess",4) "\n\t"
201 "leave\n\t"
202 "ret $4" )
203 #else
205 void WINAPI ExitProcess( DWORD status )
207 RtlExitUserProcess( status );
210 #endif
212 /***********************************************************************
213 * GetExitCodeProcess [KERNEL32.@]
215 * Gets termination status of specified process.
217 * PARAMS
218 * hProcess [in] Handle to the process.
219 * lpExitCode [out] Address to receive termination status.
221 * RETURNS
222 * Success: TRUE
223 * Failure: FALSE
225 BOOL WINAPI GetExitCodeProcess( HANDLE hProcess, LPDWORD lpExitCode )
227 PROCESS_BASIC_INFORMATION pbi;
229 if (!set_ntstatus( NtQueryInformationProcess( hProcess, ProcessBasicInformation, &pbi, sizeof(pbi), NULL )))
230 return FALSE;
231 if (lpExitCode) *lpExitCode = pbi.ExitStatus;
232 return TRUE;
236 /**************************************************************************
237 * FatalExit (KERNEL32.@)
239 void WINAPI FatalExit( int code )
241 WARN( "FatalExit\n" );
242 ExitProcess( code );
246 /***********************************************************************
247 * GetProcessFlags (KERNEL32.@)
249 DWORD WINAPI GetProcessFlags( DWORD processid )
251 IMAGE_NT_HEADERS *nt;
252 DWORD flags = 0;
254 if (processid && processid != GetCurrentProcessId()) return 0;
256 if ((nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress )))
258 if (nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI)
259 flags |= PDB32_CONSOLE_PROC;
261 if (!AreFileApisANSI()) flags |= PDB32_FILE_APIS_OEM;
262 if (IsDebuggerPresent()) flags |= PDB32_DEBUGGED;
263 return flags;
267 /***********************************************************************
268 * ConvertToGlobalHandle (KERNEL32.@)
270 HANDLE WINAPI ConvertToGlobalHandle(HANDLE hSrc)
272 HANDLE ret = INVALID_HANDLE_VALUE;
273 DuplicateHandle( GetCurrentProcess(), hSrc, GetCurrentProcess(), &ret, 0, FALSE,
274 DUPLICATE_MAKE_GLOBAL | DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE );
275 return ret;
279 /***********************************************************************
280 * SetHandleContext (KERNEL32.@)
282 BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context)
284 FIXME("(%p,%ld), stub. In case this got called by WSOCK32/WS2_32: "
285 "the external WINSOCK DLLs won't work with WINE, don't use them.\n",hnd,context);
286 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
287 return FALSE;
291 /***********************************************************************
292 * GetHandleContext (KERNEL32.@)
294 DWORD WINAPI GetHandleContext(HANDLE hnd)
296 FIXME("(%p), stub. In case this got called by WSOCK32/WS2_32: "
297 "the external WINSOCK DLLs won't work with WINE, don't use them.\n",hnd);
298 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
299 return 0;
303 /***********************************************************************
304 * CreateSocketHandle (KERNEL32.@)
306 HANDLE WINAPI CreateSocketHandle(void)
308 FIXME("(), stub. In case this got called by WSOCK32/WS2_32: "
309 "the external WINSOCK DLLs won't work with WINE, don't use them.\n");
310 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
311 return INVALID_HANDLE_VALUE;
315 /***********************************************************************
316 * SetProcessAffinityMask (KERNEL32.@)
318 BOOL WINAPI SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR affmask )
320 return set_ntstatus( NtSetInformationProcess( hProcess, ProcessAffinityMask,
321 &affmask, sizeof(DWORD_PTR) ));
325 /**********************************************************************
326 * GetProcessAffinityMask (KERNEL32.@)
328 BOOL WINAPI GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR process_mask, PDWORD_PTR system_mask )
330 if (process_mask)
332 if (!set_ntstatus( NtQueryInformationProcess( hProcess, ProcessAffinityMask,
333 process_mask, sizeof(*process_mask), NULL )))
334 return FALSE;
336 if (system_mask)
338 SYSTEM_BASIC_INFORMATION info;
340 if (!set_ntstatus( NtQuerySystemInformation( SystemBasicInformation, &info, sizeof(info), NULL )))
341 return FALSE;
342 *system_mask = info.ActiveProcessorsAffinityMask;
344 return TRUE;
348 /***********************************************************************
349 * SetProcessWorkingSetSize [KERNEL32.@]
350 * Sets the min/max working set sizes for a specified process.
352 * PARAMS
353 * process [I] Handle to the process of interest
354 * minset [I] Specifies minimum working set size
355 * maxset [I] Specifies maximum working set size
357 * RETURNS
358 * Success: TRUE
359 * Failure: FALSE
361 BOOL WINAPI SetProcessWorkingSetSize(HANDLE process, SIZE_T minset, SIZE_T maxset)
363 return SetProcessWorkingSetSizeEx(process, minset, maxset, 0);
366 /***********************************************************************
367 * GetProcessWorkingSetSize (KERNEL32.@)
369 BOOL WINAPI GetProcessWorkingSetSize(HANDLE process, SIZE_T *minset, SIZE_T *maxset)
371 return GetProcessWorkingSetSizeEx(process, minset, maxset, NULL);
375 /******************************************************************
376 * GetProcessIoCounters (KERNEL32.@)
378 BOOL WINAPI GetProcessIoCounters(HANDLE hProcess, PIO_COUNTERS ioc)
380 return set_ntstatus( NtQueryInformationProcess(hProcess, ProcessIoCounters, ioc, sizeof(*ioc), NULL ));
383 /***********************************************************************
384 * RegisterServiceProcess (KERNEL32.@)
386 * A service process calls this function to ensure that it continues to run
387 * even after a user logged off.
389 DWORD WINAPI RegisterServiceProcess(DWORD dwProcessId, DWORD dwType)
391 /* I don't think that Wine needs to do anything in this function */
392 return 1; /* success */
396 /***********************************************************************
397 * GetCurrentProcess (KERNEL32.@)
399 * Get a handle to the current process.
401 * PARAMS
402 * None.
404 * RETURNS
405 * A handle representing the current process.
407 HANDLE WINAPI KERNEL32_GetCurrentProcess(void)
409 return (HANDLE)~(ULONG_PTR)0;
413 /***********************************************************************
414 * CreateActCtxA (KERNEL32.@)
416 HANDLE WINAPI DECLSPEC_HOTPATCH CreateActCtxA( const ACTCTXA *actctx )
418 ACTCTXW actw;
419 SIZE_T len;
420 HANDLE ret = INVALID_HANDLE_VALUE;
421 LPWSTR src = NULL, assdir = NULL, resname = NULL, appname = NULL;
423 TRACE("%p %08lx\n", actctx, actctx ? actctx->dwFlags : 0);
425 if (!actctx || actctx->cbSize != sizeof(*actctx))
427 SetLastError(ERROR_INVALID_PARAMETER);
428 return INVALID_HANDLE_VALUE;
431 actw.cbSize = sizeof(actw);
432 actw.dwFlags = actctx->dwFlags;
433 if (actctx->lpSource)
435 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpSource, -1, NULL, 0);
436 src = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
437 if (!src) return INVALID_HANDLE_VALUE;
438 MultiByteToWideChar(CP_ACP, 0, actctx->lpSource, -1, src, len);
440 actw.lpSource = src;
442 if (actw.dwFlags & ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID)
443 actw.wProcessorArchitecture = actctx->wProcessorArchitecture;
444 if (actw.dwFlags & ACTCTX_FLAG_LANGID_VALID)
445 actw.wLangId = actctx->wLangId;
446 if (actw.dwFlags & ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID)
448 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpAssemblyDirectory, -1, NULL, 0);
449 assdir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
450 if (!assdir) goto done;
451 MultiByteToWideChar(CP_ACP, 0, actctx->lpAssemblyDirectory, -1, assdir, len);
452 actw.lpAssemblyDirectory = assdir;
454 if (actw.dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID)
456 if ((ULONG_PTR)actctx->lpResourceName >> 16)
458 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpResourceName, -1, NULL, 0);
459 resname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
460 if (!resname) goto done;
461 MultiByteToWideChar(CP_ACP, 0, actctx->lpResourceName, -1, resname, len);
462 actw.lpResourceName = resname;
464 else actw.lpResourceName = (LPCWSTR)actctx->lpResourceName;
466 if (actw.dwFlags & ACTCTX_FLAG_APPLICATION_NAME_VALID)
468 len = MultiByteToWideChar(CP_ACP, 0, actctx->lpApplicationName, -1, NULL, 0);
469 appname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
470 if (!appname) goto done;
471 MultiByteToWideChar(CP_ACP, 0, actctx->lpApplicationName, -1, appname, len);
472 actw.lpApplicationName = appname;
474 if (actw.dwFlags & ACTCTX_FLAG_HMODULE_VALID)
475 actw.hModule = actctx->hModule;
477 ret = CreateActCtxW(&actw);
479 done:
480 HeapFree(GetProcessHeap(), 0, src);
481 HeapFree(GetProcessHeap(), 0, assdir);
482 HeapFree(GetProcessHeap(), 0, resname);
483 HeapFree(GetProcessHeap(), 0, appname);
484 return ret;
487 /***********************************************************************
488 * FindActCtxSectionStringA (KERNEL32.@)
490 BOOL WINAPI FindActCtxSectionStringA( DWORD flags, const GUID *guid, ULONG id, const char *search,
491 ACTCTX_SECTION_KEYED_DATA *info )
493 LPWSTR searchW;
494 DWORD len;
495 BOOL ret;
497 TRACE("%08lx %s %lu %s %p\n", flags, debugstr_guid(guid), id, debugstr_a(search), info);
499 if (!search || !info)
501 SetLastError(ERROR_INVALID_PARAMETER);
502 return FALSE;
504 len = MultiByteToWideChar(CP_ACP, 0, search, -1, NULL, 0);
505 searchW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
506 MultiByteToWideChar(CP_ACP, 0, search, -1, searchW, len);
507 ret = FindActCtxSectionStringW( flags, guid, id, searchW, info );
508 HeapFree(GetProcessHeap(), 0, searchW);
509 return ret;
513 /***********************************************************************
514 * CmdBatNotification (KERNEL32.@)
516 * Notifies the system that a batch file has started or finished.
518 * PARAMS
519 * bBatchRunning [I] TRUE if a batch file has started or
520 * FALSE if a batch file has finished executing.
522 * RETURNS
523 * Unknown.
525 BOOL WINAPI CmdBatNotification( BOOL bBatchRunning )
527 FIXME("%d\n", bBatchRunning);
528 return FALSE;
531 /***********************************************************************
532 * RegisterApplicationRestart (KERNEL32.@)
534 HRESULT WINAPI RegisterApplicationRestart(PCWSTR pwzCommandLine, DWORD dwFlags)
536 FIXME("(%s,%ld)\n", debugstr_w(pwzCommandLine), dwFlags);
538 return S_OK;
541 /**********************************************************************
542 * WTSGetActiveConsoleSessionId (KERNEL32.@)
544 DWORD WINAPI WTSGetActiveConsoleSessionId(void)
546 static int once;
547 if (!once++) FIXME("stub\n");
548 /* Return current session id. */
549 return NtCurrentTeb()->Peb->SessionId;
552 /**********************************************************************
553 * GetSystemDEPPolicy (KERNEL32.@)
555 DEP_SYSTEM_POLICY_TYPE WINAPI GetSystemDEPPolicy(void)
557 return user_shared_data->NXSupportPolicy;
560 /**********************************************************************
561 * SetProcessDEPPolicy (KERNEL32.@)
563 BOOL WINAPI SetProcessDEPPolicy( DWORD flags )
565 ULONG dep_flags = 0;
567 TRACE("%#lx\n", flags);
569 if (flags & PROCESS_DEP_ENABLE)
570 dep_flags |= MEM_EXECUTE_OPTION_DISABLE | MEM_EXECUTE_OPTION_PERMANENT;
571 if (flags & PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION)
572 dep_flags |= MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION;
574 return set_ntstatus( NtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags,
575 &dep_flags, sizeof(dep_flags) ) );
578 /**********************************************************************
579 * ApplicationRecoveryFinished (KERNEL32.@)
581 VOID WINAPI ApplicationRecoveryFinished(BOOL success)
583 FIXME(": stub\n");
584 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
587 /**********************************************************************
588 * ApplicationRecoveryInProgress (KERNEL32.@)
590 HRESULT WINAPI ApplicationRecoveryInProgress(PBOOL canceled)
592 FIXME(":%p stub\n", canceled);
593 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
594 return E_FAIL;
597 /**********************************************************************
598 * RegisterApplicationRecoveryCallback (KERNEL32.@)
600 HRESULT WINAPI RegisterApplicationRecoveryCallback(APPLICATION_RECOVERY_CALLBACK callback, PVOID param, DWORD pingint, DWORD flags)
602 FIXME("%p, %p, %ld, %ld: stub, faking success\n", callback, param, pingint, flags);
603 return S_OK;
606 static SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *get_logical_processor_info(void)
608 DWORD size = 0;
609 SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *info;
611 GetLogicalProcessorInformationEx( RelationGroup, NULL, &size );
612 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return NULL;
613 if (!(info = HeapAlloc( GetProcessHeap(), 0, size ))) return NULL;
614 if (!GetLogicalProcessorInformationEx( RelationGroup, info, &size ))
616 HeapFree( GetProcessHeap(), 0, info );
617 return NULL;
619 return info;
623 /***********************************************************************
624 * GetActiveProcessorGroupCount (KERNEL32.@)
626 WORD WINAPI GetActiveProcessorGroupCount(void)
628 WORD groups;
629 SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *info;
631 TRACE("()\n");
633 if (!(info = get_logical_processor_info())) return 0;
635 groups = info->Group.ActiveGroupCount;
637 HeapFree(GetProcessHeap(), 0, info);
638 return groups;
641 /***********************************************************************
642 * GetActiveProcessorCount (KERNEL32.@)
644 DWORD WINAPI GetActiveProcessorCount(WORD group)
646 DWORD cpus = 0;
647 SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *info;
649 TRACE("(0x%x)\n", group);
651 if (!(info = get_logical_processor_info())) return 0;
653 if (group == ALL_PROCESSOR_GROUPS)
655 for (group = 0; group < info->Group.ActiveGroupCount; group++)
656 cpus += info->Group.GroupInfo[group].ActiveProcessorCount;
658 else
660 if (group < info->Group.ActiveGroupCount)
661 cpus = info->Group.GroupInfo[group].ActiveProcessorCount;
664 HeapFree(GetProcessHeap(), 0, info);
665 return cpus;
668 /***********************************************************************
669 * GetMaximumProcessorCount (KERNEL32.@)
671 DWORD WINAPI GetMaximumProcessorCount(WORD group)
673 DWORD cpus = 0;
674 SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *info;
676 TRACE("(0x%x)\n", group);
678 if (!(info = get_logical_processor_info())) return 0;
680 if (group == ALL_PROCESSOR_GROUPS)
682 for (group = 0; group < info->Group.MaximumGroupCount; group++)
683 cpus += info->Group.GroupInfo[group].MaximumProcessorCount;
685 else
687 if (group < info->Group.MaximumGroupCount)
688 cpus = info->Group.GroupInfo[group].MaximumProcessorCount;
691 HeapFree(GetProcessHeap(), 0, info);
692 return cpus;
695 /***********************************************************************
696 * GetMaximumProcessorGroupCount (KERNEL32.@)
698 WORD WINAPI GetMaximumProcessorGroupCount(void)
700 WORD groups;
701 SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *info;
703 TRACE("()\n");
705 if (!(info = get_logical_processor_info())) return 0;
707 groups = info->Group.MaximumGroupCount;
709 HeapFree(GetProcessHeap(), 0, info);
710 return groups;
713 /***********************************************************************
714 * GetFirmwareEnvironmentVariableA (KERNEL32.@)
716 DWORD WINAPI GetFirmwareEnvironmentVariableA(LPCSTR name, LPCSTR guid, PVOID buffer, DWORD size)
718 FIXME("stub: %s %s %p %lu\n", debugstr_a(name), debugstr_a(guid), buffer, size);
719 SetLastError(ERROR_INVALID_FUNCTION);
720 return 0;
723 /***********************************************************************
724 * GetFirmwareEnvironmentVariableW (KERNEL32.@)
726 DWORD WINAPI GetFirmwareEnvironmentVariableW(LPCWSTR name, LPCWSTR guid, PVOID buffer, DWORD size)
728 FIXME("stub: %s %s %p %lu\n", debugstr_w(name), debugstr_w(guid), buffer, size);
729 SetLastError(ERROR_INVALID_FUNCTION);
730 return 0;
733 /***********************************************************************
734 * SetFirmwareEnvironmentVariableW (KERNEL32.@)
736 BOOL WINAPI SetFirmwareEnvironmentVariableW(const WCHAR *name, const WCHAR *guid, void *buffer, DWORD size)
738 FIXME("stub: %s %s %p %lu\n", debugstr_w(name), debugstr_w(guid), buffer, size);
739 SetLastError(ERROR_INVALID_FUNCTION);
740 return FALSE;
743 /***********************************************************************
744 * GetFirmwareType (KERNEL32.@)
746 BOOL WINAPI GetFirmwareType(FIRMWARE_TYPE *type)
748 if (!type)
749 return FALSE;
751 *type = FirmwareTypeUnknown;
752 return TRUE;
755 /**********************************************************************
756 * GetNumaNodeProcessorMask (KERNEL32.@)
758 BOOL WINAPI GetNumaNodeProcessorMask(UCHAR node, PULONGLONG mask)
760 FIXME("(%c %p): stub\n", node, mask);
761 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
762 return FALSE;
765 /**********************************************************************
766 * GetNumaAvailableMemoryNode (KERNEL32.@)
768 BOOL WINAPI GetNumaAvailableMemoryNode(UCHAR node, PULONGLONG available_bytes)
770 FIXME("(%c %p): stub\n", node, available_bytes);
771 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
772 return FALSE;
775 /**********************************************************************
776 * GetNumaAvailableMemoryNodeEx (KERNEL32.@)
778 BOOL WINAPI GetNumaAvailableMemoryNodeEx(USHORT node, PULONGLONG available_bytes)
780 FIXME("(%hu %p): stub\n", node, available_bytes);
781 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
782 return FALSE;
785 /***********************************************************************
786 * GetNumaProcessorNode (KERNEL32.@)
788 BOOL WINAPI GetNumaProcessorNode(UCHAR processor, PUCHAR node)
790 TRACE("(%d, %p)\n", processor, node);
792 if (processor < system_info.NumberOfProcessors)
794 *node = 0;
795 return TRUE;
798 *node = 0xFF;
799 SetLastError(ERROR_INVALID_PARAMETER);
800 return FALSE;
803 /***********************************************************************
804 * GetNumaProcessorNodeEx (KERNEL32.@)
806 BOOL WINAPI GetNumaProcessorNodeEx(PPROCESSOR_NUMBER processor, PUSHORT node_number)
808 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
809 return FALSE;
812 /***********************************************************************
813 * GetNumaProximityNode (KERNEL32.@)
815 BOOL WINAPI GetNumaProximityNode(ULONG proximity_id, PUCHAR node_number)
817 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
818 return FALSE;
821 /**********************************************************************
822 * GetProcessDEPPolicy (KERNEL32.@)
824 BOOL WINAPI GetProcessDEPPolicy(HANDLE process, LPDWORD flags, PBOOL permanent)
826 ULONG dep_flags;
828 TRACE("(%p %p %p)\n", process, flags, permanent);
830 if (!set_ntstatus( NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags,
831 &dep_flags, sizeof(dep_flags), NULL )))
832 return FALSE;
834 if (flags)
836 *flags = 0;
837 if (dep_flags & MEM_EXECUTE_OPTION_DISABLE)
838 *flags |= PROCESS_DEP_ENABLE;
839 if (dep_flags & MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION)
840 *flags |= PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION;
843 if (permanent) *permanent = (dep_flags & MEM_EXECUTE_OPTION_PERMANENT) != 0;
844 return TRUE;
847 /***********************************************************************
848 * UnregisterApplicationRestart (KERNEL32.@)
850 HRESULT WINAPI UnregisterApplicationRestart(void)
852 FIXME(": stub\n");
853 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
854 return S_OK;
857 /***********************************************************************
858 * CreateUmsCompletionList (KERNEL32.@)
860 BOOL WINAPI CreateUmsCompletionList(PUMS_COMPLETION_LIST *list)
862 FIXME( "%p: stub\n", list );
863 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
864 return FALSE;
867 /***********************************************************************
868 * CreateUmsThreadContext (KERNEL32.@)
870 BOOL WINAPI CreateUmsThreadContext(PUMS_CONTEXT *ctx)
872 FIXME( "%p: stub\n", ctx );
873 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
874 return FALSE;
877 /***********************************************************************
878 * DeleteUmsCompletionList (KERNEL32.@)
880 BOOL WINAPI DeleteUmsCompletionList(PUMS_COMPLETION_LIST list)
882 FIXME( "%p: stub\n", list );
883 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
884 return FALSE;
887 /***********************************************************************
888 * DeleteUmsThreadContext (KERNEL32.@)
890 BOOL WINAPI DeleteUmsThreadContext(PUMS_CONTEXT ctx)
892 FIXME( "%p: stub\n", ctx );
893 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
894 return FALSE;
897 /***********************************************************************
898 * DequeueUmsCompletionListItems (KERNEL32.@)
900 BOOL WINAPI DequeueUmsCompletionListItems(void *list, DWORD timeout, PUMS_CONTEXT *ctx)
902 FIXME( "%p,%08lx,%p: stub\n", list, timeout, ctx );
903 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
904 return FALSE;
907 /***********************************************************************
908 * EnterUmsSchedulingMode (KERNEL32.@)
910 BOOL WINAPI EnterUmsSchedulingMode(UMS_SCHEDULER_STARTUP_INFO *info)
912 FIXME( "%p: stub\n", info );
913 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
914 return FALSE;
917 /***********************************************************************
918 * ExecuteUmsThread (KERNEL32.@)
920 BOOL WINAPI ExecuteUmsThread(PUMS_CONTEXT ctx)
922 FIXME( "%p: stub\n", ctx );
923 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
924 return FALSE;
927 /***********************************************************************
928 * GetCurrentUmsThread (KERNEL32.@)
930 PUMS_CONTEXT WINAPI GetCurrentUmsThread(void)
932 FIXME( "stub\n" );
933 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
934 return FALSE;
937 /***********************************************************************
938 * GetNextUmsListItem (KERNEL32.@)
940 PUMS_CONTEXT WINAPI GetNextUmsListItem(PUMS_CONTEXT ctx)
942 FIXME( "%p: stub\n", ctx );
943 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
944 return NULL;
947 /***********************************************************************
948 * GetUmsCompletionListEvent (KERNEL32.@)
950 BOOL WINAPI GetUmsCompletionListEvent(PUMS_COMPLETION_LIST list, HANDLE *event)
952 FIXME( "%p,%p: stub\n", list, event );
953 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
954 return FALSE;
957 /***********************************************************************
958 * QueryUmsThreadInformation (KERNEL32.@)
960 BOOL WINAPI QueryUmsThreadInformation(PUMS_CONTEXT ctx, UMS_THREAD_INFO_CLASS class,
961 void *buf, ULONG length, ULONG *ret_length)
963 FIXME( "%p,%08x,%p,%08lx,%p: stub\n", ctx, class, buf, length, ret_length );
964 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
965 return FALSE;
968 /***********************************************************************
969 * SetUmsThreadInformation (KERNEL32.@)
971 BOOL WINAPI SetUmsThreadInformation(PUMS_CONTEXT ctx, UMS_THREAD_INFO_CLASS class,
972 void *buf, ULONG length)
974 FIXME( "%p,%08x,%p,%08lx: stub\n", ctx, class, buf, length );
975 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
976 return FALSE;
979 /***********************************************************************
980 * UmsThreadYield (KERNEL32.@)
982 BOOL WINAPI UmsThreadYield(void *param)
984 FIXME( "%p: stub\n", param );
985 SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
986 return FALSE;