From 66c18bdc72596580c4069af0d8de772c146818a5 Mon Sep 17 00:00:00 2001 From: Petr Benes Date: Thu, 20 Dec 2018 18:40:32 +0100 Subject: [PATCH] fix _STL configuration --- mini-tor.vcxproj | 52 +++++++++++++++++------------ mini/common.h | 10 ++++-- mini/crt/crt0.cpp | 74 ++++++++++++++++++++++++++++++++---------- mini/crt/crt0.h | 21 ++++++++++-- mini/memory.cpp | 24 ++++++++------ mini/string.cpp | 4 +++ mini/string.h | 4 +++ mini/string_ref.cpp | 4 +++ mini/string_ref.h | 4 +++ mini/win32/pe/common.h | 6 ++-- 10 files changed, 148 insertions(+), 55 deletions(-) diff --git a/mini-tor.vcxproj b/mini-tor.vcxproj index e657709..d3ceb43 100644 --- a/mini-tor.vcxproj +++ b/mini-tor.vcxproj @@ -412,7 +412,7 @@ Level4 Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_DEBUG;WIN32;%(PreprocessorDefinitions) $(ProjectDir) /std:c++latest %(AdditionalOptions) 4127;4268;4307;4505; @@ -434,7 +434,7 @@ Level4 Disabled - MINI_TEST;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_DEBUG;MINI_TEST;WIN32;%(PreprocessorDefinitions) $(ProjectDir) /std:c++latest %(AdditionalOptions) 4127;4268;4307;4505; @@ -455,7 +455,7 @@ Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_DEBUG;WIN32;%(PreprocessorDefinitions) $(ProjectDir) -std=c++1z %(AdditionalOptions) 4268;4307;4505; @@ -476,7 +476,7 @@ Level4 Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;WIN32;%(PreprocessorDefinitions) $(ProjectDir) /std:c++latest %(AdditionalOptions) true @@ -504,7 +504,7 @@ Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;WIN32;%(PreprocessorDefinitions) $(ProjectDir) -std=c++1z %(AdditionalOptions) true @@ -519,6 +519,7 @@ 4268;4307;4505;4530;4577 Default $(IntDir)%(RelativeDir)%(filename).obj + true Console @@ -532,7 +533,7 @@ Level4 Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_DEBUG;%(PreprocessorDefinitions) $(ProjectDir) /std:c++latest %(AdditionalOptions) 4127;4268;4307;4505; @@ -554,7 +555,7 @@ Level4 Disabled - MINI_TEST;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_DEBUG;MINI_TEST;%(PreprocessorDefinitions) $(ProjectDir) /std:c++latest %(AdditionalOptions) 4127;4268;4307;4505; @@ -575,7 +576,7 @@ Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_DEBUG;%(PreprocessorDefinitions) $(ProjectDir) -std=c++1z %(AdditionalOptions) 4268;4307;4505; @@ -596,7 +597,7 @@ Level4 Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;%(PreprocessorDefinitions) $(ProjectDir) /std:c++latest %(AdditionalOptions) true @@ -624,7 +625,7 @@ Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;%(PreprocessorDefinitions) $(ProjectDir) -std=c++1z %(AdditionalOptions) true @@ -639,6 +640,7 @@ 4268;4307;4505;4530;4577 Default $(IntDir)%(RelativeDir)%(filename).obj + true Console @@ -654,7 +656,7 @@ MinSpace true true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;WIN32;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -670,6 +672,7 @@ /std:c++latest %(AdditionalOptions) $(IntDir)%(RelativeDir) true + true Console @@ -692,7 +695,7 @@ MinSpace true true - MINI_TEST;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;MINI_TEST;WIN32;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -708,6 +711,7 @@ /std:c++latest %(AdditionalOptions) $(IntDir)%(RelativeDir) true + true Console @@ -728,7 +732,7 @@ MinSize true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;WIN32;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -743,6 +747,7 @@ true -std=c++1z %(AdditionalOptions) $(IntDir)%(RelativeDir)%(filename).obj + true Console @@ -764,7 +769,7 @@ MinSize true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;_CONSOLE;NDEBUG;WIN32;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -779,6 +784,7 @@ true -std=c++1z %(AdditionalOptions) $(IntDir)%(RelativeDir)%(filename).obj + true Console @@ -805,7 +811,7 @@ MinSpace true true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;WIN32;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -821,6 +827,7 @@ /std:c++latest %(AdditionalOptions) $(IntDir)%(RelativeDir) true + true Console @@ -857,7 +864,7 @@ MinSpace true true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -872,6 +879,7 @@ /std:c++latest %(AdditionalOptions) $(IntDir)%(RelativeDir) true + true Console @@ -894,7 +902,7 @@ MinSpace true true - MINI_TEST;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;MINI_TEST;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -909,6 +917,7 @@ /std:c++latest %(AdditionalOptions) $(IntDir)%(RelativeDir) true + true Console @@ -929,7 +938,7 @@ MinSize true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -943,6 +952,7 @@ false -std=c++1z %(AdditionalOptions) $(IntDir)%(RelativeDir)%(filename).obj + true Console @@ -964,7 +974,7 @@ MinSize true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -978,6 +988,7 @@ false -std=c++1z %(AdditionalOptions) $(IntDir)%(RelativeDir)%(filename).obj + true Console @@ -1004,7 +1015,7 @@ MinSpace true true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32_LEAN_AND_MEAN;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_WINSOCK_DEPRECATED_NO_WARNINGS;_NO_CRT_STDIO_INLINE;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32_LEAN_AND_MEAN;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;NDEBUG;_CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY;_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions) $(ProjectDir) Default Size @@ -1019,6 +1030,7 @@ /std:c++latest %(AdditionalOptions) $(IntDir)%(RelativeDir) true + true Console diff --git a/mini/common.h b/mini/common.h index f692cd4..bcbb07e 100644 --- a/mini/common.h +++ b/mini/common.h @@ -1,6 +1,4 @@ #pragma once -#include - #include #include #include @@ -43,6 +41,10 @@ struct MINI_UNREFERENCED_PARAMETER_PACK_impl # define MINI_CONFIG_DEBUG #endif +#if defined(_VC_NODEFAULTLIB) +# define MINI_CONFIG_NO_DEFAULT_LIBS +#endif + #if defined(_M_IX86) # define MINI_ARCH_X86 # define MINI_ARCH_BITS 32 @@ -63,6 +65,7 @@ struct MINI_UNREFERENCED_PARAMETER_PACK_impl # define MINI_MODE_KERNEL #endif + #define MINI_MAKE_NONCONSTRUCTIBLE(type) \ type( \ void \ @@ -195,3 +198,6 @@ assert( ); } + +#include + diff --git a/mini/crt/crt0.cpp b/mini/crt/crt0.cpp index 6032ae5..94c98ef 100644 --- a/mini/crt/crt0.cpp +++ b/mini/crt/crt0.cpp @@ -1,5 +1,5 @@ -#ifndef _DEBUG #include "crt0.h" +#if defined(MINI_CONFIG_NO_DEFAULT_LIBS) #include @@ -127,6 +127,53 @@ _initterm( int _fltused = 0; +void __cdecl +crt0_initialize( + void + ) +{ + // + // Call C initializers. + // + _initterm_e(__xi_a, __xi_z); + + // + // Call C++ initializers. + // + _initterm(__xc_a, __xc_z); +} + +#ifndef MINI_MSVCRT_LIB + +static const size_t g_atexit_fn_max_count = 32; +static atexit_fn_t g_atexit_fn_table[g_atexit_fn_max_count]; +static size_t g_atexit_fn_count = 0; + +void __cdecl +crt0_destroy( + void + ) +{ + while (g_atexit_fn_count-- > 0) + { + g_atexit_fn_table[g_atexit_fn_count](); + } +} + +#else + +void __cdecl +crt0_destroy( + void + ) +{ + +} + +#endif + +#if !defined(MINI_MODE_KERNEL) + int __argc; char** __argv; @@ -167,15 +214,7 @@ mainCRTStartup( void ) { - // - // Call C initializers. - // - _initterm_e(__xi_a, __xi_z); - - // - // Call C++ initializers. - // - _initterm(__xc_a, __xc_z); + crt0_initialize(); // // Exit with whatever main will return. @@ -187,10 +226,14 @@ mainCRTStartup( exit(exit_code); } +#endif + #pragma endregion #pragma region CRT internal functions +#if !defined(MINI_MODE_KERNEL) + int __cdecl _purecall( void @@ -199,6 +242,8 @@ _purecall( return 0; } +#endif + #pragma endregion #pragma region CRT standard functions @@ -263,10 +308,6 @@ free( #pragma region Program -static const size_t g_atexit_fn_max_count = 32; -static atexit_fn_t g_atexit_fn_table[g_atexit_fn_max_count]; -static size_t g_atexit_fn_count = 0; - [[noreturn]] void __cdecl abort( @@ -282,10 +323,7 @@ exit( int exit_code ) { - while (g_atexit_fn_count-- > 0) - { - g_atexit_fn_table[g_atexit_fn_count](); - } + crt0_destroy(); ExitProcess(exit_code); } diff --git a/mini/crt/crt0.h b/mini/crt/crt0.h index be8b4c4..8f2f41a 100644 --- a/mini/crt/crt0.h +++ b/mini/crt/crt0.h @@ -1,8 +1,11 @@ -#ifdef _DEBUG +#pragma once +#include + +#if !defined(MINI_CONFIG_NO_DEFAULT_LIBS) #include #include #include -#else +#else // defined(MINI_CONFIG_NO_DEFAULT_LIBS) #include #define MINI_MSVCRT_LIB @@ -11,6 +14,18 @@ extern "C" { #pragma region CRT startup +void __cdecl +crt0_initialize( + void + ); + +void __cdecl +crt0_destroy( + void + ); + +#if !defined(MINI_MODE_KERNEL) + extern int __argc; extern char** __argv; @@ -25,6 +40,8 @@ mainCRTStartup( void ); +#endif + #pragma endregion #pragma region CRT internal functions diff --git a/mini/memory.cpp b/mini/memory.cpp index d70a17f..dfe377f 100644 --- a/mini/memory.cpp +++ b/mini/memory.cpp @@ -4,6 +4,10 @@ #include #include +#if defined(MINI_MODE_KERNEL) +#include +#endif + namespace mini::memory { namespace detail { @@ -64,8 +68,8 @@ free( struct pool_header { size_t size; - byte_type data[]; -} + /* byte_type data[] */; +}; void* allocate( @@ -73,11 +77,11 @@ allocate( ) { pool_header* result = reinterpret_cast( - ExAllocatePoolWithTag(size + sizeof(pool_header), MINI_MEMORY_TAG) + ExAllocatePoolWithTag(NonPagedPool, size + sizeof(pool_header), MINI_MEMORY_TAG) ); result->size = size; - return result->data; + return &result[1]; } void* @@ -86,7 +90,7 @@ reallocate( size_t new_size ) { - pool_header* ptr_header = reinterpret_cast(ptr)[-1]; + pool_header* ptr_header = &reinterpret_cast(ptr)[-1]; if (ptr_header->size >= new_size) { @@ -105,7 +109,7 @@ free( void* ptr ) { - pool_header* result = reinterpret_cast(ptr)[-1]; + pool_header* result = &reinterpret_cast(ptr)[-1]; ExFreePoolWithTag(result, MINI_MEMORY_TAG); } @@ -188,9 +192,9 @@ equal( void* find( - const void *haystack, + const void* haystack, size_t haystack_size, - const void *needle, + const void* needle, size_t needle_size ) { @@ -229,9 +233,9 @@ find( void* reverse_find( - const void *haystack, + const void* haystack, size_t haystack_size, - const void *needle, + const void* needle, size_t needle_size ) { diff --git a/mini/string.cpp b/mini/string.cpp index 6398251..8f98835 100644 --- a/mini/string.cpp +++ b/mini/string.cpp @@ -340,6 +340,8 @@ string::from_int( *this = tmp; } +#if !defined(MINI_MODE_KERNEL) + int string::to_int( void @@ -348,6 +350,8 @@ string::to_int( return string_ref(*this).to_int(); } +#endif + // // modifiers. // diff --git a/mini/string.h b/mini/string.h index be02adb..1e63d73 100644 --- a/mini/string.h +++ b/mini/string.h @@ -260,11 +260,15 @@ class string int value ); +#if !defined(MINI_MODE_KERNEL) + int to_int( void ) const; +#endif + // // modifiers. // diff --git a/mini/string_ref.cpp b/mini/string_ref.cpp index c7b19ef..288f563 100644 --- a/mini/string_ref.cpp +++ b/mini/string_ref.cpp @@ -210,6 +210,8 @@ string_ref::split( return tokens; } +#if !defined(MINI_MODE_KERNEL) + int string_ref::to_int( void @@ -221,6 +223,8 @@ string_ref::to_int( return result; } +#endif + bool string_ref::is_zero_terminated( void diff --git a/mini/string_ref.h b/mini/string_ref.h index 2f25a08..1af2201 100644 --- a/mini/string_ref.h +++ b/mini/string_ref.h @@ -105,11 +105,15 @@ class string_ref size_type count = size_type_max ) const; +#if !defined(MINI_MODE_KERNEL) + int to_int( void ) const; +#endif + bool is_zero_terminated( void diff --git a/mini/win32/pe/common.h b/mini/win32/pe/common.h index fcbf3bb..a6afc41 100644 --- a/mini/win32/pe/common.h +++ b/mini/win32/pe/common.h @@ -168,7 +168,7 @@ struct image_data_directory_t uint32_t size; }; -constexpr auto image_numberof_directory_entries = 16; +constexpr auto image_number_of_directory_entries = 16; // // Optional header format. @@ -215,7 +215,7 @@ struct image_optional_header_32_t uint32_t size_of_heap_commit; uint32_t loader_flags; uint32_t number_of_rva_and_sizes; - image_data_directory_t data_directory[image_numberof_directory_entries]; + image_data_directory_t data_directory[image_number_of_directory_entries]; }; struct image_optional_header_64_t @@ -249,7 +249,7 @@ struct image_optional_header_64_t uint64_t size_of_heap_commit; uint32_t loader_flags; uint32_t number_of_rva_and_sizes; - image_data_directory_t data_directory[image_numberof_directory_entries]; + image_data_directory_t data_directory[image_number_of_directory_entries]; }; using image_optional_header_t = std::conditional_t<