Commit 71aba33f authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Move system information functions to kernelbase.

parent b73cfa72
...@@ -47,104 +47,6 @@ ...@@ -47,104 +47,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(reg); WINE_DEFAULT_DEBUG_CHANNEL(reg);
/*********************************************************************** /***********************************************************************
* GetSystemInfo [KERNEL32.@]
*
* Get information about the system.
*
* RETURNS
* Nothing.
*/
VOID WINAPI GetSystemInfo(
LPSYSTEM_INFO si /* [out] Destination for system information, may not be NULL */)
{
SYSTEM_CPU_INFORMATION sci;
TRACE("si=0x%p\n", si);
if (!set_ntstatus( NtQuerySystemInformation( SystemCpuInformation, &sci, sizeof(sci), NULL ))) return;
si->u.s.wProcessorArchitecture = sci.Architecture;
si->u.s.wReserved = 0;
si->dwPageSize = system_info.PageSize;
si->lpMinimumApplicationAddress = system_info.LowestUserAddress;
si->lpMaximumApplicationAddress = system_info.HighestUserAddress;
si->dwActiveProcessorMask = system_info.ActiveProcessorsAffinityMask;
si->dwNumberOfProcessors = system_info.NumberOfProcessors;
switch (sci.Architecture)
{
case PROCESSOR_ARCHITECTURE_INTEL:
switch (sci.Level)
{
case 3: si->dwProcessorType = PROCESSOR_INTEL_386; break;
case 4: si->dwProcessorType = PROCESSOR_INTEL_486; break;
case 5:
case 6: si->dwProcessorType = PROCESSOR_INTEL_PENTIUM; break;
default: si->dwProcessorType = PROCESSOR_INTEL_PENTIUM; break;
}
break;
case PROCESSOR_ARCHITECTURE_PPC:
switch (sci.Level)
{
case 1: si->dwProcessorType = PROCESSOR_PPC_601; break;
case 3:
case 6: si->dwProcessorType = PROCESSOR_PPC_603; break;
case 4: si->dwProcessorType = PROCESSOR_PPC_604; break;
case 9: si->dwProcessorType = PROCESSOR_PPC_604; break;
case 20: si->dwProcessorType = PROCESSOR_PPC_620; break;
default: si->dwProcessorType = 0;
}
break;
case PROCESSOR_ARCHITECTURE_AMD64:
si->dwProcessorType = PROCESSOR_AMD_X8664;
break;
case PROCESSOR_ARCHITECTURE_ARM:
switch (sci.Level)
{
case 4: si->dwProcessorType = PROCESSOR_ARM_7TDMI; break;
default: si->dwProcessorType = PROCESSOR_ARM920;
}
break;
case PROCESSOR_ARCHITECTURE_ARM64:
si->dwProcessorType = 0;
break;
default:
FIXME("Unknown processor architecture %x\n", sci.Architecture);
si->dwProcessorType = 0;
}
si->dwAllocationGranularity = system_info.AllocationGranularity;
si->wProcessorLevel = sci.Level;
si->wProcessorRevision = sci.Revision;
}
/***********************************************************************
* GetNativeSystemInfo [KERNEL32.@]
*/
VOID WINAPI GetNativeSystemInfo(
LPSYSTEM_INFO si /* [out] Destination for system information, may not be NULL */)
{
BOOL is_wow64;
GetSystemInfo(si);
IsWow64Process(GetCurrentProcess(), &is_wow64);
if (is_wow64)
{
if (si->u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
{
si->u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64;
si->dwProcessorType = PROCESSOR_AMD_X8664;
}
else
{
FIXME("Add the proper information for %d in wow64 mode\n",
si->u.s.wProcessorArchitecture);
}
}
}
/***********************************************************************
* K32GetPerformanceInfo (KERNEL32.@) * K32GetPerformanceInfo (KERNEL32.@)
*/ */
BOOL WINAPI K32GetPerformanceInfo(PPERFORMANCE_INFORMATION info, DWORD size) BOOL WINAPI K32GetPerformanceInfo(PPERFORMANCE_INFORMATION info, DWORD size)
...@@ -216,18 +118,6 @@ err: ...@@ -216,18 +118,6 @@ err:
} }
/*********************************************************************** /***********************************************************************
* GetLargePageMinimum (KERNEL32.@)
*/
SIZE_T WINAPI GetLargePageMinimum(void)
{
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__)
return 2 * 1024 * 1024;
#endif
FIXME("Not implemented on your platform/architecture.\n");
return 0;
}
/***********************************************************************
* GetActiveProcessorGroupCount (KERNEL32.@) * GetActiveProcessorGroupCount (KERNEL32.@)
*/ */
WORD WINAPI GetActiveProcessorGroupCount(void) WORD WINAPI GetActiveProcessorGroupCount(void)
...@@ -274,44 +164,3 @@ DWORD64 WINAPI GetEnabledXStateFeatures(void) ...@@ -274,44 +164,3 @@ DWORD64 WINAPI GetEnabledXStateFeatures(void)
FIXME("\n"); FIXME("\n");
return 0; return 0;
} }
/***********************************************************************
* GetSystemFirmwareTable (KERNEL32.@)
*/
UINT WINAPI GetSystemFirmwareTable(DWORD provider, DWORD id, void *buffer, DWORD size)
{
ULONG buffer_size = FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer) + size;
SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti = HeapAlloc(GetProcessHeap(), 0, buffer_size);
NTSTATUS status;
TRACE("(0x%08x, 0x%08x, %p, %d)\n", provider, id, buffer, size);
if (!sfti)
{
SetLastError(ERROR_OUTOFMEMORY);
return 0;
}
sfti->ProviderSignature = provider;
sfti->Action = SystemFirmwareTable_Get;
sfti->TableID = id;
status = NtQuerySystemInformation(SystemFirmwareTableInformation, sfti, buffer_size, &buffer_size);
buffer_size -= FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer);
if (buffer_size <= size)
memcpy(buffer, sfti->TableBuffer, buffer_size);
if (status) SetLastError(RtlNtStatusToDosError(status));
HeapFree(GetProcessHeap(), 0, sfti);
return buffer_size;
}
/***********************************************************************
* EnumSystemFirmwareTables (KERNEL32.@)
*/
UINT WINAPI EnumSystemFirmwareTables(DWORD provider, void *buffer, DWORD size)
{
FIXME("(0x%08x, %p, %d)\n", provider, buffer, size);
return 0;
}
...@@ -418,7 +418,7 @@ ...@@ -418,7 +418,7 @@
@ stdcall EnumResourceTypesW(long ptr long) @ stdcall EnumResourceTypesW(long ptr long)
@ stdcall EnumSystemCodePagesA(ptr long) @ stdcall EnumSystemCodePagesA(ptr long)
@ stdcall -import EnumSystemCodePagesW(ptr long) @ stdcall -import EnumSystemCodePagesW(ptr long)
@ stdcall EnumSystemFirmwareTables(long ptr long) @ stdcall -import EnumSystemFirmwareTables(long ptr long)
@ stdcall EnumSystemGeoID(long long ptr) @ stdcall EnumSystemGeoID(long long ptr)
@ stdcall EnumSystemLanguageGroupsA(ptr long ptr) @ stdcall EnumSystemLanguageGroupsA(ptr long ptr)
@ stdcall -import EnumSystemLanguageGroupsW(ptr long ptr) @ stdcall -import EnumSystemLanguageGroupsW(ptr long ptr)
...@@ -698,7 +698,7 @@ ...@@ -698,7 +698,7 @@
@ stdcall -import GetHandleInformation(long ptr) @ stdcall -import GetHandleInformation(long ptr)
@ stub -i386 GetLSCallbackTarget @ stub -i386 GetLSCallbackTarget
@ stub -i386 GetLSCallbackTemplate @ stub -i386 GetLSCallbackTemplate
@ stdcall GetLargePageMinimum() @ stdcall -import GetLargePageMinimum()
@ stdcall -import GetLargestConsoleWindowSize(long) @ stdcall -import GetLargestConsoleWindowSize(long)
@ stdcall -import GetLastError() @ stdcall -import GetLastError()
@ stub GetLinguistLangSize @ stub GetLinguistLangSize
...@@ -734,7 +734,7 @@ ...@@ -734,7 +734,7 @@
@ stdcall -import GetNamedPipeInfo(long ptr ptr ptr ptr) @ stdcall -import GetNamedPipeInfo(long ptr ptr ptr ptr)
@ stdcall GetNamedPipeServerProcessId(long ptr) @ stdcall GetNamedPipeServerProcessId(long ptr)
@ stdcall GetNamedPipeServerSessionId(long ptr) @ stdcall GetNamedPipeServerSessionId(long ptr)
@ stdcall GetNativeSystemInfo(ptr) @ stdcall -import GetNativeSystemInfo(ptr)
@ stdcall -arch=x86_64 GetNextUmsListItem(ptr) @ stdcall -arch=x86_64 GetNextUmsListItem(ptr)
@ stub GetNextVDMCommand @ stub GetNextVDMCommand
@ stub GetNlsSectionName @ stub GetNlsSectionName
...@@ -825,8 +825,8 @@ ...@@ -825,8 +825,8 @@
@ stdcall GetSystemDEPPolicy() @ stdcall GetSystemDEPPolicy()
@ stdcall GetSystemDirectoryA(ptr long) @ stdcall GetSystemDirectoryA(ptr long)
@ stdcall GetSystemDirectoryW(ptr long) @ stdcall GetSystemDirectoryW(ptr long)
@ stdcall GetSystemFirmwareTable(long long ptr long) @ stdcall -import GetSystemFirmwareTable(long long ptr long)
@ stdcall GetSystemInfo(ptr) @ stdcall -import GetSystemInfo(ptr)
@ stdcall GetSystemPowerStatus(ptr) @ stdcall GetSystemPowerStatus(ptr)
@ stdcall GetSystemPreferredUILanguages(long ptr ptr ptr) @ stdcall GetSystemPreferredUILanguages(long ptr ptr ptr)
@ stdcall GetSystemRegistryQuota(ptr ptr) @ stdcall GetSystemRegistryQuota(ptr ptr)
......
...@@ -312,7 +312,7 @@ ...@@ -312,7 +312,7 @@
@ stdcall EnumResourceTypesExA(long ptr long long long) @ stdcall EnumResourceTypesExA(long ptr long long long)
@ stdcall EnumResourceTypesExW(long ptr long long long) @ stdcall EnumResourceTypesExW(long ptr long long long)
@ stdcall EnumSystemCodePagesW(ptr long) @ stdcall EnumSystemCodePagesW(ptr long)
@ stdcall EnumSystemFirmwareTables(long ptr long) kernel32.EnumSystemFirmwareTables @ stdcall EnumSystemFirmwareTables(long ptr long)
@ stdcall EnumSystemGeoID(long long ptr) kernel32.EnumSystemGeoID @ stdcall EnumSystemGeoID(long long ptr) kernel32.EnumSystemGeoID
@ stdcall EnumSystemLanguageGroupsW(ptr long ptr) @ stdcall EnumSystemLanguageGroupsW(ptr long ptr)
@ stdcall EnumSystemLocalesA(ptr long) @ stdcall EnumSystemLocalesA(ptr long)
...@@ -536,7 +536,7 @@ ...@@ -536,7 +536,7 @@
# @ stub GetIntegratedDisplaySize # @ stub GetIntegratedDisplaySize
# @ stub GetIsEdpEnabled # @ stub GetIsEdpEnabled
@ stdcall GetKernelObjectSecurity(long long ptr long ptr) @ stdcall GetKernelObjectSecurity(long long ptr long ptr)
@ stdcall GetLargePageMinimum() kernel32.GetLargePageMinimum @ stdcall GetLargePageMinimum()
@ stdcall GetLargestConsoleWindowSize(long) @ stdcall GetLargestConsoleWindowSize(long)
@ stdcall GetLastError() kernelbase_GetLastError @ stdcall GetLastError() kernelbase_GetLastError
@ stdcall GetLengthSid(ptr) @ stdcall GetLengthSid(ptr)
...@@ -572,7 +572,7 @@ ...@@ -572,7 +572,7 @@
@ stub GetNamedPipeClientComputerNameW @ stub GetNamedPipeClientComputerNameW
@ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr wstr long) kernel32.GetNamedPipeHandleStateW @ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr wstr long) kernel32.GetNamedPipeHandleStateW
@ stdcall GetNamedPipeInfo(long ptr ptr ptr ptr) @ stdcall GetNamedPipeInfo(long ptr ptr ptr ptr)
@ stdcall GetNativeSystemInfo(ptr) kernel32.GetNativeSystemInfo @ stdcall GetNativeSystemInfo(ptr)
# @ stub GetNextFgPolicyRefreshInfoInternal # @ stub GetNextFgPolicyRefreshInfoInternal
@ stdcall GetNumaHighestNodeNumber(ptr) @ stdcall GetNumaHighestNodeNumber(ptr)
@ stdcall GetNumaNodeProcessorMaskEx(long ptr) @ stdcall GetNumaNodeProcessorMaskEx(long ptr)
...@@ -687,8 +687,8 @@ ...@@ -687,8 +687,8 @@
@ stdcall GetSystemDirectoryA(ptr long) @ stdcall GetSystemDirectoryA(ptr long)
@ stdcall GetSystemDirectoryW(ptr long) @ stdcall GetSystemDirectoryW(ptr long)
@ stdcall GetSystemFileCacheSize(ptr ptr ptr) @ stdcall GetSystemFileCacheSize(ptr ptr ptr)
@ stdcall GetSystemFirmwareTable(long long ptr long) kernel32.GetSystemFirmwareTable @ stdcall GetSystemFirmwareTable(long long ptr long)
@ stdcall GetSystemInfo(ptr) kernel32.GetSystemInfo @ stdcall GetSystemInfo(ptr)
# @ stub GetSystemMetadataPath # @ stub GetSystemMetadataPath
# @ stub GetSystemMetadataPathForPackage # @ stub GetSystemMetadataPathForPackage
# @ stub GetSystemMetadataPathForPackageFamily # @ stub GetSystemMetadataPathForPackageFamily
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winnls.h" #include "winnls.h"
...@@ -59,6 +60,104 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlushViewOfFile( const void *base, SIZE_T size ) ...@@ -59,6 +60,104 @@ BOOL WINAPI DECLSPEC_HOTPATCH FlushViewOfFile( const void *base, SIZE_T size )
/*********************************************************************** /***********************************************************************
* GetLargePageMinimum (kernelbase.@)
*/
SIZE_T WINAPI GetLargePageMinimum(void)
{
return 2 * 1024 * 1024;
}
/***********************************************************************
* GetNativeSystemInfo (kernelbase.@)
*/
void WINAPI DECLSPEC_HOTPATCH GetNativeSystemInfo( SYSTEM_INFO *si )
{
GetSystemInfo( si );
if (!is_wow64) return;
switch (si->u.s.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_INTEL:
si->u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64;
si->dwProcessorType = PROCESSOR_AMD_X8664;
break;
default:
FIXME( "Add the proper information for %d in wow64 mode\n", si->u.s.wProcessorArchitecture );
}
}
/***********************************************************************
* GetSystemInfo (kernelbase.@)
*/
void WINAPI DECLSPEC_HOTPATCH GetSystemInfo( SYSTEM_INFO *si )
{
SYSTEM_BASIC_INFORMATION basic_info;
SYSTEM_CPU_INFORMATION cpu_info;
if (!set_ntstatus( NtQuerySystemInformation( SystemBasicInformation,
&basic_info, sizeof(basic_info), NULL )) ||
!set_ntstatus( NtQuerySystemInformation( SystemCpuInformation,
&cpu_info, sizeof(cpu_info), NULL )))
return;
si->u.s.wProcessorArchitecture = cpu_info.Architecture;
si->u.s.wReserved = 0;
si->dwPageSize = basic_info.PageSize;
si->lpMinimumApplicationAddress = basic_info.LowestUserAddress;
si->lpMaximumApplicationAddress = basic_info.HighestUserAddress;
si->dwActiveProcessorMask = basic_info.ActiveProcessorsAffinityMask;
si->dwNumberOfProcessors = basic_info.NumberOfProcessors;
si->dwAllocationGranularity = basic_info.AllocationGranularity;
si->wProcessorLevel = cpu_info.Level;
si->wProcessorRevision = cpu_info.Revision;
switch (cpu_info.Architecture)
{
case PROCESSOR_ARCHITECTURE_INTEL:
switch (cpu_info.Level)
{
case 3: si->dwProcessorType = PROCESSOR_INTEL_386; break;
case 4: si->dwProcessorType = PROCESSOR_INTEL_486; break;
case 5:
case 6: si->dwProcessorType = PROCESSOR_INTEL_PENTIUM; break;
default: si->dwProcessorType = PROCESSOR_INTEL_PENTIUM; break;
}
break;
case PROCESSOR_ARCHITECTURE_PPC:
switch (cpu_info.Level)
{
case 1: si->dwProcessorType = PROCESSOR_PPC_601; break;
case 3:
case 6: si->dwProcessorType = PROCESSOR_PPC_603; break;
case 4: si->dwProcessorType = PROCESSOR_PPC_604; break;
case 9: si->dwProcessorType = PROCESSOR_PPC_604; break;
case 20: si->dwProcessorType = PROCESSOR_PPC_620; break;
default: si->dwProcessorType = 0;
}
break;
case PROCESSOR_ARCHITECTURE_AMD64:
si->dwProcessorType = PROCESSOR_AMD_X8664;
break;
case PROCESSOR_ARCHITECTURE_ARM:
switch (cpu_info.Level)
{
case 4: si->dwProcessorType = PROCESSOR_ARM_7TDMI; break;
default: si->dwProcessorType = PROCESSOR_ARM920;
}
break;
case PROCESSOR_ARCHITECTURE_ARM64:
si->dwProcessorType = 0;
break;
default:
FIXME( "Unknown processor architecture %x\n", cpu_info.Architecture );
si->dwProcessorType = 0;
break;
}
}
/***********************************************************************
* GetSystemFileCacheSize (kernelbase.@) * GetSystemFileCacheSize (kernelbase.@)
*/ */
BOOL WINAPI DECLSPEC_HOTPATCH GetSystemFileCacheSize( SIZE_T *mincache, SIZE_T *maxcache, DWORD *flags ) BOOL WINAPI DECLSPEC_HOTPATCH GetSystemFileCacheSize( SIZE_T *mincache, SIZE_T *maxcache, DWORD *flags )
...@@ -1025,3 +1124,51 @@ LPVOID WINAPI DECLSPEC_HOTPATCH VirtualAllocExNuma( HANDLE process, void *addr, ...@@ -1025,3 +1124,51 @@ LPVOID WINAPI DECLSPEC_HOTPATCH VirtualAllocExNuma( HANDLE process, void *addr,
if (node) FIXME( "Ignoring preferred node %u\n", node ); if (node) FIXME( "Ignoring preferred node %u\n", node );
return VirtualAllocEx( process, addr, size, type, protect ); return VirtualAllocEx( process, addr, size, type, protect );
} }
/***********************************************************************
* Firmware functions
***********************************************************************/
/***********************************************************************
* EnumSystemFirmwareTable (kernelbase.@)
*/
UINT WINAPI EnumSystemFirmwareTables( DWORD provider, void *buffer, DWORD size )
{
FIXME( "(0x%08x, %p, %d)\n", provider, buffer, size );
return 0;
}
/***********************************************************************
* GetSystemFirmwareTable (kernelbase.@)
*/
UINT WINAPI GetSystemFirmwareTable( DWORD provider, DWORD id, void *buffer, DWORD size )
{
SYSTEM_FIRMWARE_TABLE_INFORMATION *info;
ULONG buffer_size = offsetof( SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer ) + size;
TRACE( "(0x%08x, 0x%08x, %p, %d)\n", provider, id, buffer, size );
if (!(info = RtlAllocateHeap( GetProcessHeap(), 0, buffer_size )))
{
SetLastError( ERROR_OUTOFMEMORY );
return 0;
}
info->ProviderSignature = provider;
info->Action = SystemFirmwareTable_Get;
info->TableID = id;
if (set_ntstatus( NtQuerySystemInformation( SystemFirmwareTableInformation,
info, buffer_size, &buffer_size )))
{
buffer_size -= offsetof( SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer );
if (buffer_size <= size) memcpy( buffer, info->TableBuffer, buffer_size );
}
else buffer_size = 0;
HeapFree( GetProcessHeap(), 0, info );
return buffer_size;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment