本文整理汇总了C++中GetNativeSystemInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GetNativeSystemInfo函数的具体用法?C++ GetNativeSystemInfo怎么用?C++ GetNativeSystemInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetNativeSystemInfo函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Java_net_rubygrapefruit_platform_internal_jni_NativeLibraryFunctions_getSystemInfo
JNIEXPORT void JNICALL
Java_net_rubygrapefruit_platform_internal_jni_NativeLibraryFunctions_getSystemInfo(JNIEnv *env, jclass target, jobject info, jobject result) {
jclass infoClass = env->GetObjectClass(info);
OSVERSIONINFOEX versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (GetVersionEx((OSVERSIONINFO*)&versionInfo) == 0) {
mark_failed_with_errno(env, "could not get version info", result);
return;
}
SYSTEM_INFO systemInfo;
GetNativeSystemInfo(&systemInfo);
jstring arch = NULL;
if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
arch = env->NewStringUTF("amd64");
} else if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) {
arch = env->NewStringUTF("x86");
} else if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64) {
arch = env->NewStringUTF("ia64");
} else {
arch = env->NewStringUTF("unknown");
}
jmethodID method = env->GetMethodID(infoClass, "windows", "(IIIZLjava/lang/String;)V");
env->CallVoidMethod(info, method, versionInfo.dwMajorVersion, versionInfo.dwMinorVersion,
versionInfo.dwBuildNumber, versionInfo.wProductType == VER_NT_WORKSTATION,
arch);
}
开发者ID:breskeby,项目名称:native-platform,代码行数:29,代码来源:win.cpp
示例2: winIs64BitSystem
QTCREATOR_UTILS_EXPORT bool winIs64BitSystem()
{
SYSTEM_INFO systemInfo;
GetNativeSystemInfo(&systemInfo);
return systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64
|| systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64;
}
开发者ID:Andersbakken,项目名称:rparser,代码行数:7,代码来源:winutils.cpp
示例3: sysctl
/**
@Status Caveat
@Notes Only HW_AVAILCPU is supported
*/
extern "C" int sysctl(const int* name, u_int namelen, void* oldp, size_t* oldlenp, const void* newp, size_t newlen) {
if (namelen < 2 || name == nullptr) {
errno = EINVAL;
return -1;
}
if (namelen != 2 ||
name[0] != CTL_HW ||
name[1] != HW_AVAILCPU) {
UNIMPLEMENTED_WITH_MSG("sysctl only supports querying HW_AVAILCPU");
errno = EOPNOTSUPP;
return -1;
}
if (*oldlenp < sizeof(int)) {
*oldlenp = sizeof(int);
errno = ENOMEM;
return -1;
}
SYSTEM_INFO systemInfo;
GetNativeSystemInfo(&systemInfo);
*static_cast<int*>(oldp) = systemInfo.dwNumberOfProcessors;
*oldlenp = sizeof(int);
return 0;
}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:33,代码来源:sysctl.cpp
示例4: GetNativeSystemInfo
NTSTATUS ProcessCore::Init() {
// Detect x86 OS
SYSTEM_INFO info = {{0}};
GetNativeSystemInfo(&info);
if(info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) {
_native.reset(new x86Native(_hProcess));
} else {
// Detect wow64 barrier
BOOL wowSrc = FALSE;
IsWow64Process(GetCurrentProcess(), &wowSrc);
if(wowSrc == TRUE)
_native.reset(new NativeWow64(_hProcess));
else
_native.reset(new Native(_hProcess));
}
// Get DEP info
// For native x64 processes DEP is always enabled
if(_native->GetWow64Barrier().targetWow64 == false) {
_dep = true;
} else {
DWORD flags = 0;
BOOL perm = 0;
if(SAFE_CALL(GetProcessDEPPolicy, _hProcess, &flags, &perm))
_dep = (flags & PROCESS_DEP_ENABLE) != 0;
}
return STATUS_SUCCESS;
}
开发者ID:MarkHC,项目名称:Blackbone,代码行数:27,代码来源:ProcessCore.cpp
示例5: GetNativeSystemInfo
int Engine::GetPrcessorInfo(){
SYSTEM_INFO stInfo;
//GetSystemInfo(&stInfo);
GetNativeSystemInfo(&stInfo);
switch (stInfo.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_INTEL:
//printf("Processor Architecture: Intel x86\n");
return 0;
break;
case PROCESSOR_ARCHITECTURE_IA64:
//printf("Processor Type: Intel x64\n");
return 6;
break;
case PROCESSOR_ARCHITECTURE_AMD64:
//printf("Processor Type: AMD 64\n");
return 9;
break;
default:
//printf("Unknown processor architecture\n");
return -1;
}
}
开发者ID:SLAUC91,项目名称:AntiCheat,代码行数:25,代码来源:Engine.cpp
示例6: load_driver_
virtual int load_driver_()
{
SYSTEM_INFO sys_info;
ZeroMemory(&sys_info, sizeof(sys_info));
GetCurrentDirectory(MAX_PATH - 10, driver_filename);
GetNativeSystemInfo(&sys_info);
switch(sys_info.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64:
wcscat_s(driver_filename, MAX_PATH, L"\\winpmem_64.sys");
if(GetFileAttributes(driver_filename) == INVALID_FILE_ATTRIBUTES)
{
std::cout << "ERROR: winpmem_64.sys not found in current directory. Download it from https://volatility.googlecode.com/svn-history/r2813/branches/scudette/tools/windows/winpmem/binaries/winpmem_64.sys ." << std::endl;
std::cout << "ERROR: Memory bandwidth statistics will not be available." << std::endl;
}
break;
case PROCESSOR_ARCHITECTURE_INTEL:
wcscat_s(driver_filename, MAX_PATH, L"\\winpmem_32.sys");
if(GetFileAttributes(driver_filename) == INVALID_FILE_ATTRIBUTES)
{
std::cout << "ERROR: winpmem_32.sys not found in current directory. Download it from https://volatility.googlecode.com/svn-history/r2813/branches/scudette/tools/windows/winpmem/binaries/winpmem_32.sys ." << std::endl;
std::cout << "ERROR: Memory bandwidth statistics will not be available." << std::endl;
}
break;
default:
return -1;
}
return 1;
}
开发者ID:rafikn,项目名称:bpw-intelPCM,代码行数:31,代码来源:client_bw.cpp
示例7: main
int main(int argc, char *argv[])
{
uv_setup_args(argc, argv); // no-op on Windows
#else
static void lock_low32() {
#if defined(_P64) && defined(JL_DEBUG_BUILD)
// block usage of the 32-bit address space on win64, to catch pointer cast errors
char *const max32addr = (char*)0xffffffffL;
SYSTEM_INFO info;
MEMORY_BASIC_INFORMATION meminfo;
GetNativeSystemInfo(&info);
memset(&meminfo, 0, sizeof(meminfo));
meminfo.BaseAddress = info.lpMinimumApplicationAddress;
while ((char*)meminfo.BaseAddress < max32addr) {
VirtualQuery(meminfo.BaseAddress, &meminfo, sizeof(meminfo));
if (meminfo.State == MEM_FREE) { // reserve all free pages in the first 4GB of memory
char *first = (char*)meminfo.BaseAddress;
char *last = first + meminfo.RegionSize;
char *p;
if (last > max32addr)
last = max32addr;
// adjust first up to the first allocation granularity boundary
// adjust last down to the last allocation granularity boundary
first = (char*)(((long long)first + info.dwAllocationGranularity - 1) & ~(info.dwAllocationGranularity - 1));
last = (char*)((long long)last & ~(info.dwAllocationGranularity - 1));
if (last != first) {
p = VirtualAlloc(first, last - first, MEM_RESERVE, PAGE_NOACCESS); // reserve all memory in between
assert(p == first);
}
}
meminfo.BaseAddress += meminfo.RegionSize;
}
#endif
}
开发者ID:mpf,项目名称:julia,代码行数:34,代码来源:repl.c
示例8: GetNativeSystemInfo
WitchSystemInfo::ProcessorArchitecture WitchSystemInfo::architecture()
{
static WitchSystemInfo::ProcessorArchitecture arch;
if(arch)
return arch;
#if WITCHENGINE_PLATFORM == WITCHENGINE_PLATFORM_WIN32 || WITCHENGINE_PLATFORM == WITCHENGINE_PLATFORM_WIN64
SYSTEM_INFO sysinfo;
GetNativeSystemInfo(&sysinfo);
if(sysinfo.wProcessorArchitecture == 9)
{
arch = WitchSystemInfo::PA_AMD64;
}
else if(sysinfo.wProcessorArchitecture == 6)
{
arch = WitchSystemInfo::PA_IA64;
}
else if(sysinfo.wProcessorArchitecture == 0)
{
arch = WitchSystemInfo::PA_INTEL;
}
else
{
arch = WitchSystemInfo::PA_UNKNOWN;
}
#endif
return arch;
}
开发者ID:DaStangerGames,项目名称:WitchEngine,代码行数:32,代码来源:WitchGlobal.cpp
示例9: sizeof
CStdString CSysInfo::GetUAWindowsVersion()
{
OSVERSIONINFOEX osvi = {};
osvi.dwOSVersionInfoSize = sizeof(osvi);
CStdString strVersion = "Windows NT";
if (GetVersionEx((OSVERSIONINFO *)&osvi))
{
strVersion += StringUtils::Format(" %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
}
SYSTEM_INFO si = {};
GetSystemInfo(&si);
BOOL bIsWow = FALSE;
if (IsWow64Process(GetCurrentProcess(), &bIsWow))
{
if (bIsWow)
{
strVersion.append(";WOW64");
GetNativeSystemInfo(&si); // different function to read the info under Wow
}
}
if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64)
strVersion.append(";Win64;x64");
else if (si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64)
strVersion.append(";Win64;IA64");
return strVersion;
}
开发者ID:darkblaze101,项目名称:xbmc,代码行数:32,代码来源:SystemInfo.cpp
示例10: Version
/// <summary>Identify the windows version</summary>
WindowsVersion::WindowsVersion() : Version(OS::Future)
{
// Prepare
ZeroMemory((OSVERSIONINFO*)this, sizeof(OSVERSIONINFO));
dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
// Query windows version
if (GetVersionEx(this))
{
switch (dwMajorVersion)
{
// [WINDOWS NT 5] Windows 2000 or Windows XP
case 5:
switch (dwMinorVersion)
{
case 0: Version = OS::Win2000; break;
case 1: Version = OS::WinXP; break;
case 2: Version = OS::Server2003; break;
}
break;
// [WINDOWS NT 6] Windows Vista, 7, or newer
case 6:
switch (dwMinorVersion)
{
case 0: Version = OS::Vista; break;
case 1: Version = OS::Win7; break;
default: Version = OS::Future; break;
}
break;
}
}
// Set name
switch (Version)
{
case OS::Win2000: Name = L"Windows 2000"; break;
case OS::WinXP: Name = L"Windows XP"; break;
case OS::Server2003: Name = L"Windows Server 2003"; break;
case OS::Vista: Name = L"Windows Vista"; break;
case OS::Win7: Name = L"Windows 7"; break;
case OS::Future: Name = L"Windows Future"; break;
}
// Set Full name
FullName = VString(L"%s %s (v%d.%d)", Name.c_str(), szCSDVersion, dwMajorVersion, dwMinorVersion);
// Query architecture
SYSTEM_INFO si;
GetNativeSystemInfo(&si);
switch (si.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64: Architecture = L"x64"; break;
case PROCESSOR_ARCHITECTURE_IA64: Architecture = L"Itanium"; break;
case PROCESSOR_ARCHITECTURE_INTEL: Architecture = L"x86"; break;
default:
case PROCESSOR_ARCHITECTURE_UNKNOWN: Architecture = L"Unknown"; break;
}
}
开发者ID:CyberSys,项目名称:X-Studio-2,代码行数:60,代码来源:Utils.cpp
示例11: _time32
/* Create a YAML file describing the image encoded into a null terminated
string. Caller will own the memory.
*/
char *store_metadata_(struct PmemMemoryInfo *info)
{
SYSTEM_INFO sys_info;
struct tm newtime;
__time32_t aclock;
char time_buffer[32];
errno_t errNum;
char *arch = NULL;
_time32(&aclock); // Get time in seconds.
_gmtime32_s(&newtime, &aclock); // Convert time to struct tm form.
// Print local time as a string.
errNum = asctime_s(time_buffer, 32, &newtime);
if (errNum) {
time_buffer[0] = 0;
}
// Get basic architecture information (Note that we always write ELF64 core
// dumps - even on 32 bit platforms).
ZeroMemory(&sys_info, sizeof(sys_info));
GetNativeSystemInfo(&sys_info);
switch (sys_info.wProcessorArchitecture) {
case PROCESSOR_ARCHITECTURE_AMD64:
arch = "AMD64";
break;
case PROCESSOR_ARCHITECTURE_INTEL:
arch = "I386";
break;
default:
arch = "Unknown";
}
char *buffer = (char *)malloc(1000);
_snprintf_s(buffer, 1000, _TRUNCATE,
// A YAML File describing metadata about this image.
"# PMEM\n"
"---\n" // The start of the YAML file.
"acquisition_tool: 'WinPMEM " PMEM_VERSION "'\n"
"acquisition_timestamp: %s\n"
"CR3: %#llx\n"
"NtBuildNumber: %#llx\n"
"NtBuildNumberAddr: %#llx\n"
"KernBase: %#llx\n"
"Arch: %s\n"
"...\n", // This is the end of a YAML file.
time_buffer,
info->CR3.QuadPart,
info->NtBuildNumber.QuadPart,
info->NtBuildNumberAddr.QuadPart,
info->KernBase.QuadPart,
arch
);
return buffer;
};
开发者ID:AnwarMohamed,项目名称:metasploit-payloads,代码行数:62,代码来源:winpmem.cpp
示例12: vlc_GetCPUCount
/*** CPU ***/
unsigned vlc_GetCPUCount (void)
{
SYSTEM_INFO systemInfo;
GetNativeSystemInfo(&systemInfo);
return systemInfo.dwNumberOfProcessors;
}
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:9,代码来源:thread.c
示例13: cpu_count
int
cpu_count()
{
SYSTEM_INFO si;
GetNativeSystemInfo( &si );
return (int)si.dwNumberOfProcessors;
}
开发者ID:applideveloper,项目名称:streem,代码行数:8,代码来源:ncpu.c
示例14: GetNativeSystemInfo
/// <summary>
/// Capture stack frames
/// </summary>
/// <param name="ip">Current instruction pointer</param>
/// <param name="sp">Current stack pointer</param>
/// <param name="results">Found frames.</param>
/// <param name="depth">Frame depth limit</param>
/// <returns>Number of found frames</returns>
size_t TraceHook::StackBacktrace( uintptr_t ip, uintptr_t sp, vecStackFrames& results, uintptr_t depth /*= 10 */ )
{
SYSTEM_INFO sysinfo = { 0 };
uintptr_t stack_base = (uintptr_t)((PNT_TIB)NtCurrentTeb())->StackBase;
GetNativeSystemInfo( &sysinfo );
// Store exception address
results.emplace_back( std::make_pair( 0, ip ) );
// Walk stack
for (uintptr_t stackPtr = sp; stackPtr < stack_base && results.size() <= depth; stackPtr += sizeof(void*))
{
uintptr_t stack_val = *(uintptr_t*)stackPtr;
MEMORY_BASIC_INFORMATION meminfo = { 0 };
// Decode value
uintptr_t original = stack_val & HIGHEST_BIT_UNSET;
// Invalid value
if ( original < (uintptr_t)sysinfo.lpMinimumApplicationAddress ||
original > (uintptr_t)sysinfo.lpMaximumApplicationAddress)
{
continue;
}
// Check if memory is executable
if (VirtualQuery( (LPVOID)original, &meminfo, sizeof(meminfo) ) != sizeof(meminfo))
continue;
if ( meminfo.Protect != PAGE_EXECUTE_READ &&
meminfo.Protect != PAGE_EXECUTE_WRITECOPY &&
meminfo.Protect != PAGE_EXECUTE_READWRITE)
{
continue;
}
// Detect 'call' instruction
for (uintptr_t j = 1; j < 8; j++)
{
DISASM info = { 0 };
info.EIP = original - j;
#ifdef _M_AMD64
info.Archi = 64;
#endif
if (Disasm( &info ) > 0 && info.Instruction.BranchType == CallType)
{
results.emplace_back( std::make_pair( stackPtr, stack_val ) );
break;
}
}
}
return results.size();
}
开发者ID:Jeswang,项目名称:mono-assembly-injector,代码行数:66,代码来源:TraceHook.cpp
示例15: iam32on64
int iam32on64 ()
{
SYSTEM_INFO sysinfo_32, sysinfo_64;
sysinfo_32.wProcessorArchitecture = 0;
sysinfo_64.wProcessorArchitecture = 0;
GetNativeSystemInfo (&sysinfo_64);
GetSystemInfo (&sysinfo_32);
return sysinfo_64.wProcessorArchitecture != sysinfo_32.wProcessorArchitecture && sysinfo_64.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64;
}
开发者ID:LRN,项目名称:mimerun,代码行数:9,代码来源:misc.c
示例16: get_app_mode
static app_mode_t get_app_mode() {
SYSTEM_INFO sys_info;
GetNativeSystemInfo(&sys_info);
if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) {
return MODE_X86;
} else if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
return MODE_X64;
}
return MODE_UNKNOWN;
}
开发者ID:mikolas,项目名称:OpenAM,代码行数:10,代码来源:admin_iis.c
示例17: GetSystemCPU
VOID GetSystemCPU(WCHAR *szBuffer)
{
SYSTEM_INFO archInfo;
ISWOW64PROC fnIsWow64Process;
BOOL isWow64 = FALSE;
/* Find out if the program is running through WOW64 or not. Apparently,
IsWow64Process() is not available on all versions of Windows, so the function
has to be imported at runtime. If the function cannot be found, then assume
the program is not running in WOW64. */
fnIsWow64Process = (ISWOW64PROC)GetProcAddress(
GetModuleHandleW(L"kernel32"), "IsWow64Process");
if (fnIsWow64Process != NULL)
fnIsWow64Process(GetCurrentProcess(), &isWow64);
/* If the program is compiled as 32-bit, but is running in WOW64, it will
automatically report as 32-bit regardless of the actual system architecture.
It detects whether or not the program is using WOW64 or not, and then
uses GetNativeSystemInfo(). If it is, it will properly report the actual
system architecture to the user. */
if (isWow64)
GetNativeSystemInfo(&archInfo);
else
GetSystemInfo(&archInfo);
/* Now check to see what the system architecture is */
if(archInfo.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_UNKNOWN)
{
switch(archInfo.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_INTEL:
{
wsprintfW(szBuffer, L"32-bit");
break;
}
case PROCESSOR_ARCHITECTURE_AMD64:
{
wsprintfW(szBuffer, L"64-bit");
break;
}
case PROCESSOR_ARCHITECTURE_IA64:
{
wsprintfW(szBuffer, L"Itanium");
break;
}
case PROCESSOR_ARCHITECTURE_ARM:
{
wsprintfW(szBuffer, L"ARM");
break;
}
default:break;
}
}
}
开发者ID:AmineKhaldi,项目名称:reactos,代码行数:55,代码来源:system.c
示例18: main
void main()
{
GetNativeSystemInfo(&sysInfo); // 64bit
dectectOS();
// if(sysInfo.dwOemId) {printf("\nOEM ID : %s", sysInfo.dwOemId);}
idProcessorArchitecture(); // get CPU ARCHITECTURE
printf("\nNumber of Logical Processors : %d", sysInfo.dwNumberOfProcessors);
currentSystemMemoryInformation();
}
开发者ID:dspecht,项目名称:psychic-octo-nemesis,代码行数:11,代码来源:getSysInfo.cpp
示例19: is64
BOOL is64()
{
SYSTEM_INFO si;
GetNativeSystemInfo(&si);
if (si.wProcessorArchitecture && PROCESSOR_ARCHITECTURE_INTEL)
return FALSE;
else
return TRUE;
}
开发者ID:AdamBien,项目名称:Payara,代码行数:11,代码来源:RegistryManager.cpp
示例20: is64
bool is64()
{
SYSTEM_INFO si;
GetNativeSystemInfo(&si);
if (si.wProcessorArchitecture && PROCESSOR_ARCHITECTURE_INTEL)
return false;
else
return true;
}
开发者ID:AdamBien,项目名称:Payara,代码行数:11,代码来源:Utilities.cpp
注:本文中的GetNativeSystemInfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论