Milestone 5: deliver embedded RDP sessions and lifecycle hardening
This commit is contained in:
30
third_party/FreeRDP/winpr/libwinpr/sysinfo/CMakeLists.txt
vendored
Normal file
30
third_party/FreeRDP/winpr/libwinpr/sysinfo/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# WinPR: Windows Portable Runtime
|
||||
# libwinpr-sysinfo cmake build script
|
||||
#
|
||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
if(ANDROID)
|
||||
add_subdirectory(cpufeatures)
|
||||
endif()
|
||||
|
||||
winpr_module_add(sysinfo.c)
|
||||
|
||||
if((NOT WIN32) AND (NOT APPLE) AND (NOT ANDROID) AND (NOT OPENBSD))
|
||||
winpr_library_add_private(rt)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING_INTERNAL OR BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
9
third_party/FreeRDP/winpr/libwinpr/sysinfo/ModuleOptions.cmake
vendored
Normal file
9
third_party/FreeRDP/winpr/libwinpr/sysinfo/ModuleOptions.cmake
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
set(MINWIN_LAYER "1")
|
||||
set(MINWIN_GROUP "core")
|
||||
set(MINWIN_MAJOR_VERSION "2")
|
||||
set(MINWIN_MINOR_VERSION "0")
|
||||
set(MINWIN_SHORT_NAME "sysinfo")
|
||||
set(MINWIN_LONG_NAME "System Information Functions")
|
||||
set(MODULE_LIBRARY_NAME
|
||||
"api-ms-win-${MINWIN_GROUP}-${MINWIN_SHORT_NAME}-l${MINWIN_LAYER}-${MINWIN_MAJOR_VERSION}-${MINWIN_MINOR_VERSION}"
|
||||
)
|
||||
19
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/CMakeLists.txt
vendored
Normal file
19
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# WinPR: Windows Portable Runtime
|
||||
# libwinpr-sysinfo cmake build script
|
||||
#
|
||||
# Copyright 2017 Armin Novak <armin.novak@thincast.com>
|
||||
# Copyright 2017 Thincast Technologies GmbH
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
winpr_module_add(cpu-features.c cpu-features.h)
|
||||
13
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/NOTICE
vendored
Normal file
13
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/NOTICE
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright (C) 2016 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
4
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/README
vendored
Normal file
4
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/README
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
Android CPUFeatures Library
|
||||
|
||||
https://developer.android.com/ndk/guides/cpu-features.html
|
||||
https://android.googlesource.com/platform/ndk/+/master/sources/android/cpufeatures
|
||||
1427
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/cpu-features.c
vendored
Normal file
1427
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/cpu-features.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
324
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/cpu-features.h
vendored
Normal file
324
third_party/FreeRDP/winpr/libwinpr/sysinfo/cpufeatures/cpu-features.h
vendored
Normal file
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Android Open Source Project
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef CPU_FEATURES_H
|
||||
#define CPU_FEATURES_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <stdint.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* A list of valid values returned by android_getCpuFamily().
|
||||
* They describe the CPU Architecture of the current process.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ANDROID_CPU_FAMILY_UNKNOWN = 0,
|
||||
ANDROID_CPU_FAMILY_ARM,
|
||||
ANDROID_CPU_FAMILY_X86,
|
||||
ANDROID_CPU_FAMILY_MIPS,
|
||||
ANDROID_CPU_FAMILY_ARM64,
|
||||
ANDROID_CPU_FAMILY_X86_64,
|
||||
ANDROID_CPU_FAMILY_MIPS64,
|
||||
|
||||
ANDROID_CPU_FAMILY_MAX /* do not remove */
|
||||
|
||||
} AndroidCpuFamily;
|
||||
|
||||
/* Return the CPU family of the current process.
|
||||
*
|
||||
* Note that this matches the bitness of the current process. I.e. when
|
||||
* running a 32-bit binary on a 64-bit capable CPU, this will return the
|
||||
* 32-bit CPU family value.
|
||||
*/
|
||||
extern AndroidCpuFamily android_getCpuFamily(void);
|
||||
|
||||
/* Return a bitmap describing a set of optional CPU features that are
|
||||
* supported by the current device's CPU. The exact bit-flags returned
|
||||
* depend on the value returned by android_getCpuFamily(). See the
|
||||
* documentation for the ANDROID_CPU_*_FEATURE_* flags below for details.
|
||||
*/
|
||||
extern uint64_t android_getCpuFeatures(void);
|
||||
|
||||
/* The list of feature flags for ANDROID_CPU_FAMILY_ARM that can be
|
||||
* recognized by the library (see note below for 64-bit ARM). Value details
|
||||
* are:
|
||||
*
|
||||
* VFPv2:
|
||||
* CPU supports the VFPv2 instruction set. Many, but not all, ARMv6 CPUs
|
||||
* support these instructions. VFPv2 is a subset of VFPv3 so this will
|
||||
* be set whenever VFPv3 is set too.
|
||||
*
|
||||
* ARMv7:
|
||||
* CPU supports the ARMv7-A basic instruction set.
|
||||
* This feature is mandated by the 'armeabi-v7a' ABI.
|
||||
*
|
||||
* VFPv3:
|
||||
* CPU supports the VFPv3-D16 instruction set, providing hardware FPU
|
||||
* support for single and double precision floating point registers.
|
||||
* Note that only 16 FPU registers are available by default, unless
|
||||
* the D32 bit is set too. This feature is also mandated by the
|
||||
* 'armeabi-v7a' ABI.
|
||||
*
|
||||
* VFP_D32:
|
||||
* CPU VFP optional extension that provides 32 FPU registers,
|
||||
* instead of 16. Note that ARM mandates this feature is the 'NEON'
|
||||
* feature is implemented by the CPU.
|
||||
*
|
||||
* NEON:
|
||||
* CPU FPU supports "ARM Advanced SIMD" instructions, also known as
|
||||
* NEON. Note that this mandates the VFP_D32 feature as well, per the
|
||||
* ARM Architecture specification.
|
||||
*
|
||||
* VFP_FP16:
|
||||
* Half-width floating precision VFP extension. If set, the CPU
|
||||
* supports instructions to perform floating-point operations on
|
||||
* 16-bit registers. This is part of the VFPv4 specification, but
|
||||
* not mandated by any Android ABI.
|
||||
*
|
||||
* VFP_FMA:
|
||||
* Fused multiply-accumulate VFP instructions extension. Also part of
|
||||
* the VFPv4 specification, but not mandated by any Android ABI.
|
||||
*
|
||||
* NEON_FMA:
|
||||
* Fused multiply-accumulate NEON instructions extension. Optional
|
||||
* extension from the VFPv4 specification, but not mandated by any
|
||||
* Android ABI.
|
||||
*
|
||||
* IDIV_ARM:
|
||||
* Integer division available in ARM mode. Only available
|
||||
* on recent CPUs (e.g. Cortex-A15).
|
||||
*
|
||||
* IDIV_THUMB2:
|
||||
* Integer division available in Thumb-2 mode. Only available
|
||||
* on recent CPUs (e.g. Cortex-A15).
|
||||
*
|
||||
* iWMMXt:
|
||||
* Optional extension that adds MMX registers and operations to an
|
||||
* ARM CPU. This is only available on a few XScale-based CPU designs
|
||||
* sold by Marvell. Pretty rare in practice.
|
||||
*
|
||||
* AES:
|
||||
* CPU supports AES instructions. These instructions are only
|
||||
* available for 32-bit applications running on ARMv8 CPU.
|
||||
*
|
||||
* CRC32:
|
||||
* CPU supports CRC32 instructions. These instructions are only
|
||||
* available for 32-bit applications running on ARMv8 CPU.
|
||||
*
|
||||
* SHA2:
|
||||
* CPU supports SHA2 instructions. These instructions are only
|
||||
* available for 32-bit applications running on ARMv8 CPU.
|
||||
*
|
||||
* SHA1:
|
||||
* CPU supports SHA1 instructions. These instructions are only
|
||||
* available for 32-bit applications running on ARMv8 CPU.
|
||||
*
|
||||
* PMULL:
|
||||
* CPU supports 64-bit PMULL and PMULL2 instructions. These
|
||||
* instructions are only available for 32-bit applications
|
||||
* running on ARMv8 CPU.
|
||||
*
|
||||
* If you want to tell the compiler to generate code that targets one of
|
||||
* the feature set above, you should probably use one of the following
|
||||
* flags (for more details, see technical note at the end of this file):
|
||||
*
|
||||
* -mfpu=vfp
|
||||
* -mfpu=vfpv2
|
||||
* These are equivalent and tell GCC to use VFPv2 instructions for
|
||||
* floating-point operations. Use this if you want your code to
|
||||
* run on *some* ARMv6 devices, and any ARMv7-A device supported
|
||||
* by Android.
|
||||
*
|
||||
* Generated code requires VFPv2 feature.
|
||||
*
|
||||
* -mfpu=vfpv3-d16
|
||||
* Tell GCC to use VFPv3 instructions (using only 16 FPU registers).
|
||||
* This should be generic code that runs on any CPU that supports the
|
||||
* 'armeabi-v7a' Android ABI. Note that no ARMv6 CPU supports this.
|
||||
*
|
||||
* Generated code requires VFPv3 feature.
|
||||
*
|
||||
* -mfpu=vfpv3
|
||||
* Tell GCC to use VFPv3 instructions with 32 FPU registers.
|
||||
* Generated code requires VFPv3|VFP_D32 features.
|
||||
*
|
||||
* -mfpu=neon
|
||||
* Tell GCC to use VFPv3 instructions with 32 FPU registers, and
|
||||
* also support NEON intrinsics (see <arm_neon.h>).
|
||||
* Generated code requires VFPv3|VFP_D32|NEON features.
|
||||
*
|
||||
* -mfpu=vfpv4-d16
|
||||
* Generated code requires VFPv3|VFP_FP16|VFP_FMA features.
|
||||
*
|
||||
* -mfpu=vfpv4
|
||||
* Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32 features.
|
||||
*
|
||||
* -mfpu=neon-vfpv4
|
||||
* Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32|NEON|NEON_FMA
|
||||
* features.
|
||||
*
|
||||
* -mcpu=cortex-a7
|
||||
* -mcpu=cortex-a15
|
||||
* Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32|
|
||||
* NEON|NEON_FMA|IDIV_ARM|IDIV_THUMB2
|
||||
* This flag implies -mfpu=neon-vfpv4.
|
||||
*
|
||||
* -mcpu=iwmmxt
|
||||
* Allows the use of iWMMXt intrinsics with GCC.
|
||||
*
|
||||
* IMPORTANT NOTE: These flags should only be tested when
|
||||
* android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM, i.e. this is a
|
||||
* 32-bit process.
|
||||
*
|
||||
* When running a 64-bit ARM process on an ARMv8 CPU,
|
||||
* android_getCpuFeatures() will return a different set of bitflags
|
||||
*/
|
||||
enum
|
||||
{
|
||||
ANDROID_CPU_ARM_FEATURE_ARMv7 = (1 << 0),
|
||||
ANDROID_CPU_ARM_FEATURE_VFPv3 = (1 << 1),
|
||||
ANDROID_CPU_ARM_FEATURE_NEON = (1 << 2),
|
||||
ANDROID_CPU_ARM_FEATURE_LDREX_STREX = (1 << 3),
|
||||
ANDROID_CPU_ARM_FEATURE_VFPv2 = (1 << 4),
|
||||
ANDROID_CPU_ARM_FEATURE_VFP_D32 = (1 << 5),
|
||||
ANDROID_CPU_ARM_FEATURE_VFP_FP16 = (1 << 6),
|
||||
ANDROID_CPU_ARM_FEATURE_VFP_FMA = (1 << 7),
|
||||
ANDROID_CPU_ARM_FEATURE_NEON_FMA = (1 << 8),
|
||||
ANDROID_CPU_ARM_FEATURE_IDIV_ARM = (1 << 9),
|
||||
ANDROID_CPU_ARM_FEATURE_IDIV_THUMB2 = (1 << 10),
|
||||
ANDROID_CPU_ARM_FEATURE_iWMMXt = (1 << 11),
|
||||
ANDROID_CPU_ARM_FEATURE_AES = (1 << 12),
|
||||
ANDROID_CPU_ARM_FEATURE_PMULL = (1 << 13),
|
||||
ANDROID_CPU_ARM_FEATURE_SHA1 = (1 << 14),
|
||||
ANDROID_CPU_ARM_FEATURE_SHA2 = (1 << 15),
|
||||
ANDROID_CPU_ARM_FEATURE_CRC32 = (1 << 16),
|
||||
};
|
||||
|
||||
/* The bit flags corresponding to the output of android_getCpuFeatures()
|
||||
* when android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM64. Value details
|
||||
* are:
|
||||
*
|
||||
* FP:
|
||||
* CPU has Floating-point unit.
|
||||
*
|
||||
* ASIMD:
|
||||
* CPU has Advanced SIMD unit.
|
||||
*
|
||||
* AES:
|
||||
* CPU supports AES instructions.
|
||||
*
|
||||
* CRC32:
|
||||
* CPU supports CRC32 instructions.
|
||||
*
|
||||
* SHA2:
|
||||
* CPU supports SHA2 instructions.
|
||||
*
|
||||
* SHA1:
|
||||
* CPU supports SHA1 instructions.
|
||||
*
|
||||
* PMULL:
|
||||
* CPU supports 64-bit PMULL and PMULL2 instructions.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
ANDROID_CPU_ARM64_FEATURE_FP = (1 << 0),
|
||||
ANDROID_CPU_ARM64_FEATURE_ASIMD = (1 << 1),
|
||||
ANDROID_CPU_ARM64_FEATURE_AES = (1 << 2),
|
||||
ANDROID_CPU_ARM64_FEATURE_PMULL = (1 << 3),
|
||||
ANDROID_CPU_ARM64_FEATURE_SHA1 = (1 << 4),
|
||||
ANDROID_CPU_ARM64_FEATURE_SHA2 = (1 << 5),
|
||||
ANDROID_CPU_ARM64_FEATURE_CRC32 = (1 << 6),
|
||||
};
|
||||
|
||||
/* The bit flags corresponding to the output of android_getCpuFeatures()
|
||||
* when android_getCpuFamily() returns ANDROID_CPU_FAMILY_X86 or
|
||||
* ANDROID_CPU_FAMILY_X86_64.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
ANDROID_CPU_X86_FEATURE_SSSE3 = (1 << 0),
|
||||
ANDROID_CPU_X86_FEATURE_POPCNT = (1 << 1),
|
||||
ANDROID_CPU_X86_FEATURE_MOVBE = (1 << 2),
|
||||
ANDROID_CPU_X86_FEATURE_SSE4_1 = (1 << 3),
|
||||
ANDROID_CPU_X86_FEATURE_SSE4_2 = (1 << 4),
|
||||
ANDROID_CPU_X86_FEATURE_AES_NI = (1 << 5),
|
||||
ANDROID_CPU_X86_FEATURE_AVX = (1 << 6),
|
||||
ANDROID_CPU_X86_FEATURE_RDRAND = (1 << 7),
|
||||
ANDROID_CPU_X86_FEATURE_AVX2 = (1 << 8),
|
||||
ANDROID_CPU_X86_FEATURE_SHA_NI = (1 << 9),
|
||||
};
|
||||
|
||||
/* The bit flags corresponding to the output of android_getCpuFeatures()
|
||||
* when android_getCpuFamily() returns ANDROID_CPU_FAMILY_MIPS
|
||||
* or ANDROID_CPU_FAMILY_MIPS64. Values are:
|
||||
*
|
||||
* R6:
|
||||
* CPU executes MIPS Release 6 instructions natively, and
|
||||
* supports obsoleted R1..R5 instructions only via kernel traps.
|
||||
*
|
||||
* MSA:
|
||||
* CPU supports Mips SIMD Architecture instructions.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
ANDROID_CPU_MIPS_FEATURE_R6 = (1 << 0),
|
||||
ANDROID_CPU_MIPS_FEATURE_MSA = (1 << 1),
|
||||
};
|
||||
|
||||
/* Return the number of CPU cores detected on this device. */
|
||||
extern int android_getCpuCount(void);
|
||||
|
||||
/* The following is used to force the CPU count and features
|
||||
* mask in sandboxed processes. Under 4.1 and higher, these processes
|
||||
* cannot access /proc, which is the only way to get information from
|
||||
* the kernel about the current hardware (at least on ARM).
|
||||
*
|
||||
* It _must_ be called only once, and before any android_getCpuXXX
|
||||
* function, any other case will fail.
|
||||
*
|
||||
* This function return 1 on success, and 0 on failure.
|
||||
*/
|
||||
extern int android_setCpu(int cpu_count, uint64_t cpu_features);
|
||||
|
||||
#ifdef __arm__
|
||||
/* Retrieve the ARM 32-bit CPUID value from the kernel.
|
||||
* Note that this cannot work on sandboxed processes under 4.1 and
|
||||
* higher, unless you called android_setCpuArm() before.
|
||||
*/
|
||||
extern uint32_t android_getCpuIdArm(void);
|
||||
|
||||
/* An ARM-specific variant of android_setCpu() that also allows you
|
||||
* to set the ARM CPUID field.
|
||||
*/
|
||||
extern int android_setCpuArm(int cpu_count, uint64_t cpu_features, uint32_t cpu_id);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* CPU_FEATURES_H */
|
||||
1303
third_party/FreeRDP/winpr/libwinpr/sysinfo/sysinfo.c
vendored
Normal file
1303
third_party/FreeRDP/winpr/libwinpr/sysinfo/sysinfo.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
25
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/CMakeLists.txt
vendored
Normal file
25
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
set(MODULE_NAME "TestSysInfo")
|
||||
set(MODULE_PREFIX "TEST_SYSINFO")
|
||||
|
||||
disable_warnings_for_directory(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
|
||||
|
||||
set(${MODULE_PREFIX}_TESTS TestGetNativeSystemInfo.c TestCPUFeatures.c TestGetComputerName.c TestSystemTime.c
|
||||
TestLocalTime.c
|
||||
)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_DRIVER} ${${MODULE_PREFIX}_TESTS})
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
target_link_libraries(${MODULE_NAME} winpr)
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||
|
||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||
get_filename_component(TestName ${test} NAME_WE)
|
||||
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
|
||||
endforeach()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Test")
|
||||
65
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestCPUFeatures.c
vendored
Normal file
65
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestCPUFeatures.c
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
#include <winpr/platform.h>
|
||||
|
||||
#define TEST_FEATURE(feature) \
|
||||
printf("\t" #feature ": %s\n", IsProcessorFeaturePresent(feature) ? "yes" : "no")
|
||||
#define TEST_FEATURE_EX(feature) \
|
||||
printf("\t" #feature ": %s\n", IsProcessorFeaturePresentEx(feature) ? "yes" : "no")
|
||||
int TestCPUFeatures(int argc, char* argv[])
|
||||
{
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
printf("Base CPU Flags:\n");
|
||||
#ifdef _M_IX86_AMD64
|
||||
TEST_FEATURE(PF_MMX_INSTRUCTIONS_AVAILABLE);
|
||||
TEST_FEATURE(PF_XMMI_INSTRUCTIONS_AVAILABLE);
|
||||
TEST_FEATURE(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
|
||||
TEST_FEATURE(PF_3DNOW_INSTRUCTIONS_AVAILABLE);
|
||||
TEST_FEATURE(PF_SSE3_INSTRUCTIONS_AVAILABLE);
|
||||
printf("\n");
|
||||
printf("Extended CPU Flags (not found in windows API):\n");
|
||||
TEST_FEATURE_EX(PF_EX_3DNOW_PREFETCH);
|
||||
TEST_FEATURE_EX(PF_EX_SSSE3);
|
||||
TEST_FEATURE_EX(PF_EX_SSE41);
|
||||
TEST_FEATURE_EX(PF_EX_SSE42);
|
||||
TEST_FEATURE_EX(PF_EX_AVX);
|
||||
TEST_FEATURE_EX(PF_EX_FMA);
|
||||
TEST_FEATURE_EX(PF_EX_AVX_AES);
|
||||
TEST_FEATURE_EX(PF_EX_AVX_PCLMULQDQ);
|
||||
#elif defined(_M_ARM) || defined(_M_ARM64)
|
||||
TEST_FEATURE(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE);
|
||||
TEST_FEATURE(PF_ARM_THUMB);
|
||||
TEST_FEATURE(PF_ARM_VFP_32_REGISTERS_AVAILABLE);
|
||||
TEST_FEATURE(PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE);
|
||||
TEST_FEATURE(PF_ARM_VFP3);
|
||||
TEST_FEATURE(PF_ARM_THUMB);
|
||||
TEST_FEATURE(PF_ARM_JAZELLE);
|
||||
TEST_FEATURE(PF_ARM_DSP);
|
||||
TEST_FEATURE(PF_ARM_THUMB2);
|
||||
TEST_FEATURE(PF_ARM_T2EE);
|
||||
TEST_FEATURE(PF_ARM_INTEL_WMMX);
|
||||
printf("Extended CPU Flags (not found in windows API):\n");
|
||||
TEST_FEATURE_EX(PF_EX_ARM_VFP1);
|
||||
TEST_FEATURE_EX(PF_EX_ARM_VFP3D16);
|
||||
TEST_FEATURE_EX(PF_EX_ARM_VFP4);
|
||||
TEST_FEATURE_EX(PF_EX_ARM_IDIVA);
|
||||
TEST_FEATURE_EX(PF_EX_ARM_IDIVT);
|
||||
#elif defined(_M_E2K)
|
||||
TEST_FEATURE(PF_MMX_INSTRUCTIONS_AVAILABLE);
|
||||
TEST_FEATURE(PF_3DNOW_INSTRUCTIONS_AVAILABLE);
|
||||
TEST_FEATURE(PF_SSE3_INSTRUCTIONS_AVAILABLE);
|
||||
printf("\n");
|
||||
printf("Extended CPU Flags (not found in windows API):\n");
|
||||
TEST_FEATURE_EX(PF_EX_SSSE3);
|
||||
TEST_FEATURE_EX(PF_EX_SSE41);
|
||||
TEST_FEATURE_EX(PF_EX_SSE42);
|
||||
TEST_FEATURE_EX(PF_EX_AVX);
|
||||
TEST_FEATURE_EX(PF_EX_FMA);
|
||||
#endif
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
372
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestGetComputerName.c
vendored
Normal file
372
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestGetComputerName.c
vendored
Normal file
@@ -0,0 +1,372 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
#include <winpr/error.h>
|
||||
|
||||
static BOOL Test_GetComputerName(void)
|
||||
{
|
||||
/**
|
||||
* BOOL WINAPI GetComputerName(LPTSTR lpBuffer, LPDWORD lpnSize);
|
||||
*
|
||||
* GetComputerName retrieves the NetBIOS name of the local computer.
|
||||
*
|
||||
* lpBuffer [out]
|
||||
* A pointer to a buffer that receives the computer name or the cluster virtual server name.
|
||||
* The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.
|
||||
*
|
||||
* lpnSize [in, out]
|
||||
* On input, specifies the size of the buffer, in TCHARs.
|
||||
* On output, the number of TCHARs copied to the destination buffer, not including the
|
||||
* terminating null character. If the buffer is too small, the function fails and GetLastError
|
||||
* returns ERROR_BUFFER_OVERFLOW. The lpnSize parameter specifies the size of the buffer
|
||||
* required, including the terminating null character
|
||||
*
|
||||
*/
|
||||
|
||||
CHAR netbiosName1[MAX_COMPUTERNAME_LENGTH + 1] = WINPR_C_ARRAY_INIT;
|
||||
CHAR netbiosName2[MAX_COMPUTERNAME_LENGTH + 1] = WINPR_C_ARRAY_INIT;
|
||||
const size_t netbiosBufferSize = ARRAYSIZE(netbiosName1);
|
||||
DWORD dwSize = 0;
|
||||
DWORD dwNameLength = 0;
|
||||
DWORD dwError = 0;
|
||||
|
||||
memset(netbiosName1, 0xAA, netbiosBufferSize);
|
||||
memset(netbiosName2, 0xBB, netbiosBufferSize);
|
||||
|
||||
/* test with null buffer and zero size (required if buffer is null) */
|
||||
dwSize = 0;
|
||||
if (GetComputerNameA(nullptr, &dwSize) == TRUE)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (1) GetComputerNameA unexpectedly succeeded with null buffer\n",
|
||||
__func__);
|
||||
return FALSE;
|
||||
}
|
||||
if ((dwError = GetLastError()) != ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (2) GetLastError returned 0x%08" PRIX32
|
||||
" (expected ERROR_BUFFER_OVERFLOW)\n",
|
||||
__func__, dwError);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* test with valid buffer and zero size */
|
||||
dwSize = 0;
|
||||
if (GetComputerNameA(netbiosName1, &dwSize) == TRUE)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (3) GetComputerNameA unexpectedly succeeded with zero size parameter\n",
|
||||
__func__);
|
||||
return FALSE;
|
||||
}
|
||||
if ((dwError = GetLastError()) != ERROR_BUFFER_OVERFLOW)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (4) GetLastError returned 0x%08" PRIX32
|
||||
" (expected ERROR_BUFFER_OVERFLOW)\n",
|
||||
__func__, dwError);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if returned size is valid: must be the size of the buffer required, including the
|
||||
* terminating null character in this case */
|
||||
if (dwSize < 2 || dwSize > netbiosBufferSize)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (5) GetComputerNameA returned wrong size %" PRIu32
|
||||
" (expected something in the range from 2 to %" PRIuz ")\n",
|
||||
__func__, dwSize, netbiosBufferSize);
|
||||
return FALSE;
|
||||
}
|
||||
dwNameLength = dwSize - 1;
|
||||
|
||||
/* test with returned size */
|
||||
if (GetComputerNameA(netbiosName1, &dwSize) == FALSE)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (6) GetComputerNameA failed with error: 0x%08" PRIX32 "\n",
|
||||
__func__, GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
/* check if returned size is valid */
|
||||
if (dwSize != dwNameLength)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (7) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32
|
||||
")\n",
|
||||
__func__, dwSize, dwNameLength);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if string is correctly terminated */
|
||||
if (netbiosName1[dwSize] != 0)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (8) string termination error\n", __func__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* test with real buffer size */
|
||||
dwSize = netbiosBufferSize;
|
||||
if (GetComputerNameA(netbiosName2, &dwSize) == FALSE)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (9) GetComputerNameA failed with error: 0x%08" PRIX32 "\n",
|
||||
__func__, GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
/* check if returned size is valid */
|
||||
if (dwSize != dwNameLength)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (10) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32
|
||||
")\n",
|
||||
__func__, dwSize, dwNameLength);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if string is correctly terminated */
|
||||
if (netbiosName2[dwSize] != 0)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (11) string termination error\n", __func__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* compare the results */
|
||||
if (strcmp(netbiosName1, netbiosName2) != 0)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (12) string compare mismatch\n", __func__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* test with off by one buffer size */
|
||||
dwSize = dwNameLength;
|
||||
if (GetComputerNameA(netbiosName1, &dwSize) == TRUE)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (13) GetComputerNameA unexpectedly succeeded with limited buffer size\n",
|
||||
__func__);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if returned size is valid */
|
||||
if (dwSize != dwNameLength + 1)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (14) GetComputerNameA returned wrong size %" PRIu32 " (expected %" PRIu32
|
||||
")\n",
|
||||
__func__, dwSize, dwNameLength + 1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL Test_GetComputerNameEx_Format(COMPUTER_NAME_FORMAT format)
|
||||
{
|
||||
/**
|
||||
* BOOL WINAPI GetComputerNameEx(COMPUTER_NAME_FORMAT NameType, LPTSTR lpBuffer, LPDWORD
|
||||
* lpnSize);
|
||||
*
|
||||
* Retrieves a NetBIOS or DNS name associated with the local computer.
|
||||
*
|
||||
* NameType [in]
|
||||
* ComputerNameNetBIOS
|
||||
* ComputerNameDnsHostname
|
||||
* ComputerNameDnsDomain
|
||||
* ComputerNameDnsFullyQualified
|
||||
* ComputerNamePhysicalNetBIOS
|
||||
* ComputerNamePhysicalDnsHostname
|
||||
* ComputerNamePhysicalDnsDomain
|
||||
* ComputerNamePhysicalDnsFullyQualified
|
||||
*
|
||||
* lpBuffer [out]
|
||||
* A pointer to a buffer that receives the computer name or the cluster virtual server name.
|
||||
* The length of the name may be greater than MAX_COMPUTERNAME_LENGTH characters because DNS
|
||||
* allows longer names. To ensure that this buffer is large enough, set this parameter to
|
||||
* nullptr and use the required buffer size returned in the lpnSize parameter.
|
||||
*
|
||||
* lpnSize [in, out]
|
||||
* On input, specifies the size of the buffer, in TCHARs.
|
||||
* On output, receives the number of TCHARs copied to the destination buffer, not including the
|
||||
* terminating null character. If the buffer is too small, the function fails and GetLastError
|
||||
* returns ERROR_MORE_DATA. This parameter receives the size of the buffer required, including
|
||||
* the terminating null character. If lpBuffer is nullptr, this parameter must be zero.
|
||||
*
|
||||
*/
|
||||
|
||||
CHAR computerName1[255 + 1];
|
||||
CHAR computerName2[255 + 1];
|
||||
|
||||
const DWORD nameBufferSize = sizeof(computerName1) / sizeof(CHAR);
|
||||
DWORD dwSize = 0;
|
||||
DWORD dwMinSize = 0;
|
||||
DWORD dwNameLength = 0;
|
||||
DWORD dwError = 0;
|
||||
|
||||
memset(computerName1, 0xAA, nameBufferSize);
|
||||
memset(computerName2, 0xBB, nameBufferSize);
|
||||
|
||||
if (format == ComputerNameDnsDomain || format == ComputerNamePhysicalDnsDomain)
|
||||
{
|
||||
/* domain names may be empty, terminating null only */
|
||||
dwMinSize = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* computer names must be at least 1 character */
|
||||
dwMinSize = 2;
|
||||
}
|
||||
|
||||
/* test with null buffer and zero size (required if buffer is null) */
|
||||
dwSize = 0;
|
||||
if (GetComputerNameExA(format, nullptr, &dwSize) == TRUE)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (1/%d) GetComputerNameExA unexpectedly succeeded with null buffer\n",
|
||||
__func__, format);
|
||||
return FALSE;
|
||||
}
|
||||
if ((dwError = GetLastError()) != ERROR_MORE_DATA)
|
||||
{
|
||||
(void)fprintf(
|
||||
stderr, "%s: (2/%d) GetLastError returned 0x%08" PRIX32 " (expected ERROR_MORE_DATA)\n",
|
||||
__func__, format, dwError);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* test with valid buffer and zero size */
|
||||
dwSize = 0;
|
||||
if (GetComputerNameExA(format, computerName1, &dwSize) == TRUE)
|
||||
{
|
||||
(void)fprintf(
|
||||
stderr,
|
||||
"%s: (3/%d) GetComputerNameExA unexpectedly succeeded with zero size parameter\n",
|
||||
__func__, format);
|
||||
return FALSE;
|
||||
}
|
||||
if ((dwError = GetLastError()) != ERROR_MORE_DATA)
|
||||
{
|
||||
(void)fprintf(
|
||||
stderr, "%s: (4/%d) GetLastError returned 0x%08" PRIX32 " (expected ERROR_MORE_DATA)\n",
|
||||
__func__, format, dwError);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if returned size is valid: must be the size of the buffer required, including the
|
||||
* terminating null character in this case */
|
||||
if (dwSize < dwMinSize || dwSize > nameBufferSize)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (5/%d) GetComputerNameExA returned wrong size %" PRIu32
|
||||
" (expected something in the range from %" PRIu32 " to %" PRIu32 ")\n",
|
||||
__func__, format, dwSize, dwMinSize, nameBufferSize);
|
||||
return FALSE;
|
||||
}
|
||||
dwNameLength = dwSize - 1;
|
||||
|
||||
/* test with returned size */
|
||||
if (GetComputerNameExA(format, computerName1, &dwSize) == FALSE)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (6/%d) GetComputerNameExA failed with error: 0x%08" PRIX32 "\n",
|
||||
__func__, format, GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
/* check if returned size is valid */
|
||||
if (dwSize != dwNameLength)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (7/%d) GetComputerNameExA returned wrong size %" PRIu32
|
||||
" (expected %" PRIu32 ")\n",
|
||||
__func__, format, dwSize, dwNameLength);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if string is correctly terminated */
|
||||
if (computerName1[dwSize] != 0)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (8/%d) string termination error\n", __func__, format);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* test with real buffer size */
|
||||
dwSize = nameBufferSize;
|
||||
if (GetComputerNameExA(format, computerName2, &dwSize) == FALSE)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (9/%d) GetComputerNameExA failed with error: 0x%08" PRIX32 "\n",
|
||||
__func__, format, GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
/* check if returned size is valid */
|
||||
if (dwSize != dwNameLength)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (10/%d) GetComputerNameExA returned wrong size %" PRIu32
|
||||
" (expected %" PRIu32 ")\n",
|
||||
__func__, format, dwSize, dwNameLength);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if string is correctly terminated */
|
||||
if (computerName2[dwSize] != 0)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (11/%d) string termination error\n", __func__, format);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* compare the results */
|
||||
if (strcmp(computerName1, computerName2) != 0)
|
||||
{
|
||||
(void)fprintf(stderr, "%s: (12/%d) string compare mismatch\n", __func__, format);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* test with off by one buffer size */
|
||||
dwSize = dwNameLength;
|
||||
if (GetComputerNameExA(format, computerName1, &dwSize) == TRUE)
|
||||
{
|
||||
(void)fprintf(
|
||||
stderr,
|
||||
"%s: (13/%d) GetComputerNameExA unexpectedly succeeded with limited buffer size\n",
|
||||
__func__, format);
|
||||
return FALSE;
|
||||
}
|
||||
/* check if returned size is valid */
|
||||
if (dwSize != dwNameLength + 1)
|
||||
{
|
||||
(void)fprintf(stderr,
|
||||
"%s: (14/%d) GetComputerNameExA returned wrong size %" PRIu32
|
||||
" (expected %" PRIu32 ")\n",
|
||||
__func__, format, dwSize, dwNameLength + 1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int TestGetComputerName(int argc, char* argv[])
|
||||
{
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
if (!Test_GetComputerName())
|
||||
return -1;
|
||||
|
||||
if (!Test_GetComputerNameEx_Format(ComputerNameNetBIOS))
|
||||
return -1;
|
||||
|
||||
if (!Test_GetComputerNameEx_Format(ComputerNameDnsHostname))
|
||||
return -1;
|
||||
|
||||
if (!Test_GetComputerNameEx_Format(ComputerNameDnsDomain))
|
||||
return -1;
|
||||
|
||||
if (!Test_GetComputerNameEx_Format(ComputerNameDnsFullyQualified))
|
||||
return -1;
|
||||
|
||||
if (!Test_GetComputerNameEx_Format(ComputerNamePhysicalNetBIOS))
|
||||
return -1;
|
||||
|
||||
if (!Test_GetComputerNameEx_Format(ComputerNamePhysicalDnsHostname))
|
||||
return -1;
|
||||
|
||||
if (!Test_GetComputerNameEx_Format(ComputerNamePhysicalDnsDomain))
|
||||
return -1;
|
||||
|
||||
if (!Test_GetComputerNameEx_Format(ComputerNamePhysicalDnsFullyQualified))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
33
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestGetNativeSystemInfo.c
vendored
Normal file
33
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestGetNativeSystemInfo.c
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
|
||||
int TestGetNativeSystemInfo(int argc, char* argv[])
|
||||
{
|
||||
SYSTEM_INFO sysinfo = WINPR_C_ARRAY_INIT;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
GetNativeSystemInfo(&sysinfo);
|
||||
|
||||
const UINT16 wProcessorArchitecture =
|
||||
sysinfo.DUMMYUNIONNAME.DUMMYSTRUCTNAME.wProcessorArchitecture;
|
||||
const UINT16 wReserved = sysinfo.DUMMYUNIONNAME.DUMMYSTRUCTNAME.wReserved;
|
||||
|
||||
printf("SystemInfo:\n");
|
||||
printf("\twProcessorArchitecture: %" PRIu16 "\n", wProcessorArchitecture);
|
||||
printf("\twReserved: %" PRIu16 "\n", wReserved);
|
||||
printf("\tdwPageSize: 0x%08" PRIX32 "\n", sysinfo.dwPageSize);
|
||||
printf("\tlpMinimumApplicationAddress: %p\n", sysinfo.lpMinimumApplicationAddress);
|
||||
printf("\tlpMaximumApplicationAddress: %p\n", sysinfo.lpMaximumApplicationAddress);
|
||||
printf("\tdwActiveProcessorMask: %p\n", (void*)sysinfo.dwActiveProcessorMask);
|
||||
printf("\tdwNumberOfProcessors: %" PRIu32 "\n", sysinfo.dwNumberOfProcessors);
|
||||
printf("\tdwProcessorType: %" PRIu32 "\n", sysinfo.dwProcessorType);
|
||||
printf("\tdwAllocationGranularity: %" PRIu32 "\n", sysinfo.dwAllocationGranularity);
|
||||
printf("\twProcessorLevel: %" PRIu16 "\n", sysinfo.wProcessorLevel);
|
||||
printf("\twProcessorRevision: %" PRIu16 "\n", sysinfo.wProcessorRevision);
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
21
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestLocalTime.c
vendored
Normal file
21
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestLocalTime.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
|
||||
int TestLocalTime(int argc, char* argv[])
|
||||
{
|
||||
SYSTEMTIME lTime;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
GetLocalTime(&lTime);
|
||||
|
||||
printf("GetLocalTime: wYear: %" PRIu16 " wMonth: %" PRIu16 " wDayOfWeek: %" PRIu16
|
||||
" wDay: %" PRIu16 " wHour: %" PRIu16 " wMinute: %" PRIu16 " wSecond: %" PRIu16
|
||||
" wMilliseconds: %" PRIu16 "\n",
|
||||
lTime.wYear, lTime.wMonth, lTime.wDayOfWeek, lTime.wDay, lTime.wHour, lTime.wMinute,
|
||||
lTime.wSecond, lTime.wMilliseconds);
|
||||
|
||||
return 0;
|
||||
}
|
||||
21
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestSystemTime.c
vendored
Normal file
21
third_party/FreeRDP/winpr/libwinpr/sysinfo/test/TestSystemTime.c
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
|
||||
int TestSystemTime(int argc, char* argv[])
|
||||
{
|
||||
SYSTEMTIME sTime;
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
GetSystemTime(&sTime);
|
||||
|
||||
printf("GetSystemTime: wYear: %" PRIu16 " wMonth: %" PRIu16 " wDayOfWeek: %" PRIu16
|
||||
" wDay: %" PRIu16 " wHour: %" PRIu16 " wMinute: %" PRIu16 " wSecond: %" PRIu16
|
||||
" wMilliseconds: %" PRIu16 "\n",
|
||||
sTime.wYear, sTime.wMonth, sTime.wDayOfWeek, sTime.wDay, sTime.wHour, sTime.wMinute,
|
||||
sTime.wSecond, sTime.wMilliseconds);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user