boot: update nethost, hostfxr to 8.0.7

This commit is contained in:
goat 2024-07-17 16:47:28 +02:00
parent 4bbba20927
commit a9ca9b44fb
9 changed files with 183 additions and 58 deletions

View file

@ -58,8 +58,8 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalDependencies>Version.lib;Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>Version.lib;Shlwapi.lib;nethost.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\lib\CoreCLR;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\lib\CoreCLR\nethost;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">

View file

@ -48,7 +48,7 @@
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC> <EnableUAC>false</EnableUAC>
<AdditionalLibraryDirectories>..\lib\CoreCLR;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>..\lib\CoreCLR\nethost;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<ProgramDatabaseFile>$(OutDir)$(TargetName).Boot.pdb</ProgramDatabaseFile> <ProgramDatabaseFile>$(OutDir)$(TargetName).Boot.pdb</ProgramDatabaseFile>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@ -61,6 +61,7 @@
<Link> <Link>
<EnableCOMDATFolding>false</EnableCOMDATFolding> <EnableCOMDATFolding>false</EnableCOMDATFolding>
<OptimizeReferences>false</OptimizeReferences> <OptimizeReferences>false</OptimizeReferences>
<AdditionalDependencies>nethost.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">

1
lib/CoreCLR/.ver Normal file
View file

@ -0,0 +1 @@
Microsoft.NETCore.App.Host.win-x64\8.0.7

View file

@ -20,6 +20,7 @@ int CoreCLR::load_hostfxr()
int CoreCLR::load_hostfxr(const struct get_hostfxr_parameters* parameters) int CoreCLR::load_hostfxr(const struct get_hostfxr_parameters* parameters)
{ {
/*
// Get the path to CoreCLR's hostfxr // Get the path to CoreCLR's hostfxr
std::wstring calling_module_path(MAX_PATH, L'\0'); std::wstring calling_module_path(MAX_PATH, L'\0');
@ -41,6 +42,7 @@ int CoreCLR::load_hostfxr(const struct get_hostfxr_parameters* parameters)
get_export(lib_nethost, "get_hostfxr_path")); get_export(lib_nethost, "get_hostfxr_path"));
if (!get_hostfxr_path) if (!get_hostfxr_path)
return -1; return -1;
*/
wchar_t buffer[MAX_PATH]{}; wchar_t buffer[MAX_PATH]{};
size_t buffer_size = sizeof buffer / sizeof(wchar_t); size_t buffer_size = sizeof buffer / sizeof(wchar_t);

View file

@ -44,4 +44,17 @@ typedef int (CORECLR_DELEGATE_CALLTYPE* get_function_pointer_fn)(
void *reserved /* Extensibility parameter (currently unused and must be 0) */, void *reserved /* Extensibility parameter (currently unused and must be 0) */,
/*out*/ void **delegate /* Pointer where to store the function pointer result */); /*out*/ void **delegate /* Pointer where to store the function pointer result */);
typedef int (CORECLR_DELEGATE_CALLTYPE *load_assembly_fn)(
const char_t *assembly_path /* Fully qualified path to assembly */,
void *load_context /* Extensibility parameter (currently unused and must be 0) */,
void *reserved /* Extensibility parameter (currently unused and must be 0) */);
typedef int (CORECLR_DELEGATE_CALLTYPE *load_assembly_bytes_fn)(
const void *assembly_bytes /* Bytes of the assembly to load */,
size_t assembly_bytes_len /* Byte length of the assembly to load */,
const void *symbols_bytes /* Optional. Bytes of the symbols for the assembly */,
size_t symbols_bytes_len /* Optional. Byte length of the symbols for the assembly */,
void *load_context /* Extensibility parameter (currently unused and must be 0) */,
void *reserved /* Extensibility parameter (currently unused and must be 0) */);
#endif // __CORECLR_DELEGATES_H__ #endif // __CORECLR_DELEGATES_H__

View file

@ -28,6 +28,8 @@ enum hostfxr_delegate_type
hdt_com_unregister, hdt_com_unregister,
hdt_load_assembly_and_get_function_pointer, hdt_load_assembly_and_get_function_pointer,
hdt_get_function_pointer, hdt_get_function_pointer,
hdt_load_assembly,
hdt_load_assembly_bytes,
}; };
typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_main_fn)(const int argc, const char_t **argv); typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_main_fn)(const int argc, const char_t **argv);
@ -64,7 +66,7 @@ typedef void(HOSTFXR_CALLTYPE* hostfxr_error_writer_fn)(const char_t* message);
// By default no callback is registered in which case the errors are written to stderr. // By default no callback is registered in which case the errors are written to stderr.
// //
// Each call to the error writer is sort of like writing a single line (the EOL character is omitted). // Each call to the error writer is sort of like writing a single line (the EOL character is omitted).
// Multiple calls to the error writer may occure for one failure. // Multiple calls to the error writer may occur for one failure.
// //
// If the hostfxr invokes functions in hostpolicy as part of its operation, the error writer // If the hostfxr invokes functions in hostpolicy as part of its operation, the error writer
// will be propagated to hostpolicy for the duration of the call. This means that errors from // will be propagated to hostpolicy for the duration of the call. This means that errors from
@ -88,6 +90,8 @@ struct hostfxr_initialize_parameters
// Number of argv arguments // Number of argv arguments
// argv // argv
// Command-line arguments for running an application (as if through the dotnet executable). // Command-line arguments for running an application (as if through the dotnet executable).
// Only command-line arguments which are accepted by runtime installation are supported, SDK/CLI commands are not supported.
// For example 'app.dll app_argument_1 app_argument_2`.
// parameters // parameters
// Optional. Additional parameters for initialization // Optional. Additional parameters for initialization
// host_context_handle // host_context_handle
@ -285,4 +289,78 @@ typedef int32_t(HOSTFXR_CALLTYPE* hostfxr_get_runtime_delegate_fn)(
// //
typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_close_fn)(const hostfxr_handle host_context_handle); typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_close_fn)(const hostfxr_handle host_context_handle);
struct hostfxr_dotnet_environment_sdk_info
{
size_t size;
const char_t* version;
const char_t* path;
};
typedef void(HOSTFXR_CALLTYPE* hostfxr_get_dotnet_environment_info_result_fn)(
const struct hostfxr_dotnet_environment_info* info,
void* result_context);
struct hostfxr_dotnet_environment_framework_info
{
size_t size;
const char_t* name;
const char_t* version;
const char_t* path;
};
struct hostfxr_dotnet_environment_info
{
size_t size;
const char_t* hostfxr_version;
const char_t* hostfxr_commit_hash;
size_t sdk_count;
const struct hostfxr_dotnet_environment_sdk_info* sdks;
size_t framework_count;
const struct hostfxr_dotnet_environment_framework_info* frameworks;
};
//
// Returns available SDKs and frameworks.
//
// Resolves the existing SDKs and frameworks from a dotnet root directory (if
// any), or the global default location. If multi-level lookup is enabled and
// the dotnet root location is different than the global location, the SDKs and
// frameworks will be enumerated from both locations.
//
// The SDKs are sorted in ascending order by version, multi-level lookup
// locations are put before private ones.
//
// The frameworks are sorted in ascending order by name followed by version,
// multi-level lookup locations are put before private ones.
//
// Parameters:
// dotnet_root
// The path to a directory containing a dotnet executable.
//
// reserved
// Reserved for future parameters.
//
// result
// Callback invoke to return the list of SDKs and frameworks.
// Structs and their elements are valid for the duration of the call.
//
// result_context
// Additional context passed to the result callback.
//
// Return value:
// 0 on success, otherwise failure.
//
// String encoding:
// Windows - UTF-16 (pal::char_t is 2 byte wchar_t)
// Unix - UTF-8 (pal::char_t is 1 byte char)
//
typedef int32_t(HOSTFXR_CALLTYPE* hostfxr_get_dotnet_environment_info_fn)(
const char_t* dotnet_root,
void* reserved,
hostfxr_get_dotnet_environment_info_result_fn result,
void* result_context);
#endif //__HOSTFXR_H__ #endif //__HOSTFXR_H__

Binary file not shown.

View file

@ -6,6 +6,36 @@
#include <stddef.h> #include <stddef.h>
#ifdef _WIN32
#ifdef NETHOST_EXPORT
#define NETHOST_API __declspec(dllexport)
#else
// Consuming the nethost as a static library
// Shouldn't export attempt to dllimport.
#ifdef NETHOST_USE_AS_STATIC
#define NETHOST_API
#else
#define NETHOST_API __declspec(dllimport)
#endif
#endif
#define NETHOST_CALLTYPE __stdcall
#ifdef _WCHAR_T_DEFINED
typedef wchar_t char_t;
#else
typedef unsigned short char_t;
#endif
#else
#ifdef NETHOST_EXPORT
#define NETHOST_API __attribute__((__visibility__("default")))
#else
#define NETHOST_API
#endif
#define NETHOST_CALLTYPE
typedef char char_t;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -17,7 +47,7 @@ extern "C" {
// Size of the struct. This is used for versioning. // Size of the struct. This is used for versioning.
// //
// assembly_path // assembly_path
// Path to the compenent's assembly. // Path to the component's assembly.
// If specified, hostfxr is located as if the assembly_path is the apphost // If specified, hostfxr is located as if the assembly_path is the apphost
// //
// dotnet_root // dotnet_root
@ -47,7 +77,7 @@ struct get_hostfxr_parameters {
// //
// get_hostfxr_parameters // get_hostfxr_parameters
// Optional. Parameters that modify the behaviour for locating the hostfxr library. // Optional. Parameters that modify the behaviour for locating the hostfxr library.
// If nullptr, hostfxr is located using the enviroment variable or global registration // If nullptr, hostfxr is located using the environment variable or global registration
// //
// Return value: // Return value:
// 0 on success, otherwise failure // 0 on success, otherwise failure
@ -57,7 +87,7 @@ struct get_hostfxr_parameters {
// The full search for the hostfxr library is done on every call. To minimize the need // The full search for the hostfxr library is done on every call. To minimize the need
// to call this function multiple times, pass a large buffer (e.g. PATH_MAX). // to call this function multiple times, pass a large buffer (e.g. PATH_MAX).
// //
using get_hostfxr_path_type = int(__stdcall *)( NETHOST_API int NETHOST_CALLTYPE get_hostfxr_path(
char_t * buffer, char_t * buffer,
size_t * buffer_size, size_t * buffer_size,
const struct get_hostfxr_parameters *parameters); const struct get_hostfxr_parameters *parameters);

Binary file not shown.