Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
fix(#27): unittest failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroKaku committed Apr 24, 2023
1 parent 84a26c6 commit 60e8eb6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
32 changes: 16 additions & 16 deletions msvc/ucxxrt.test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,75 +46,75 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<TargetVersion>Windows7</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<TargetVersion>Windows7</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<TargetVersion>Windows7</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<TargetVersion>Windows7</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<TargetVersion>Windows7</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<TargetVersion>Windows7</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<TargetVersion>Windows7</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<TargetVersion>Windows10</TargetVersion>
<TargetVersion>Windows7</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
<ConfigurationType>Driver</ConfigurationType>
<DriverType>WDM</DriverType>
<DriverTargetPlatform>Universal</DriverTargetPlatform>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
<Driver_SpectreMitigation>Spectre</Driver_SpectreMitigation>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand Down
15 changes: 11 additions & 4 deletions src/ucxxrt.inl
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,18 @@
#define _CRTIMP
#define _VCRTIMP _CRTIMP

#ifndef _KERNEL_MODE
# define _KERNEL_MODE __KERNEL_MODE
#ifdef __KERNEL_MODE
# ifndef _KERNEL_MODE
# define _KERNEL_MODE __KERNEL_MODE
# endif
#else
# error user mode is not supported.
#endif
#ifndef NTOS_KERNEL_RUNTIME
# define NTOS_KERNEL_RUNTIME __KERNEL_MODE

#ifdef _KERNEL_MODE
# ifndef NTOS_KERNEL_RUNTIME
# define NTOS_KERNEL_RUNTIME __KERNEL_MODE
# endif
#endif

#include <veil/veil.h>
Expand Down
17 changes: 6 additions & 11 deletions test/unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ void Test$ErrorCode()

void Test$Realloc()
{
auto x = (int*)malloc(sizeof(int));
auto x = static_cast<int*>(malloc(sizeof(int)));
if (x)
{
*x = 123;

auto y = (size_t*)realloc(x, sizeof(size_t));
auto y = static_cast<size_t*>(realloc(x, sizeof(size_t)));
if (y)
{
ASSERT(*y == 123);
Expand All @@ -237,10 +237,8 @@ void Test$SEH()
{
try
{
int x = 0;
int y = 0;

x = 5 / y;
constexpr int InvalidAddress = 0;
*reinterpret_cast<void**>(InvalidAddress) = Test$SEH;
}
catch (...)
{
Expand All @@ -251,7 +249,6 @@ void Test$SEH()
// compile with: /EHa
class SE_Exception
{
private:
SE_Exception() {}
unsigned int Code = 0;
public:
Expand All @@ -271,10 +268,8 @@ void Test$SETranslator()

try
{
int x = 0;
int y = 0;

x = 5 / y;
constexpr int InvalidAddress = 0;
*reinterpret_cast<void**>(InvalidAddress) = Test$SETranslator;
}
catch (const SE_Exception& e)
{
Expand Down

0 comments on commit 60e8eb6

Please sign in to comment.