### HcnOpenLoadBalancer Function Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopenloadbalancer The function signature for opening a load balancer, requiring a GUID identifier and providing a handle and optional error record. ```C++ HRESULT WINAPI HcnOpenLoadBalancer( _In_ REFGUID Id, _Out_ PHCN_LOADBALANCER LoadBalancer, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnOpenNamespace function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopennamespace The function signature for opening a namespace, requiring a GUID identifier and providing a handle for subsequent operations. ```C++ HRESULT WINAPI HcnOpenNamespace( _In_ REFGUID Id, _Out_ PHCN_NAMESPACE Namespace, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HCN_PORT_RANGE_RESERVATION Structure Definition Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcn_port_range_reservation Defines the starting and ending ports for a reservation range. Both values are inclusive. ```C++ typedef struct tagHCN_PORT_RANGE_RESERVATION { // start and end are inclusive USHORT startingPort; USHORT endingPort; } HCN_PORT_RANGE_RESERVATION; ``` -------------------------------- ### HcnDeleteNetwork Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcndeletenetwork Deletes a network identified by its GUID. ```APIDOC ## HcnDeleteNetwork ### Description Deletes a network from the Host Compute Network. ### Syntax ```cpp HRESULT WINAPI HcnDeleteNetwork( _In_ REFGUID Id, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - The unique identifier of the network to delete. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended error information. The caller must release this buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnDeleteGuestNetworkService Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcndeleteguestnetworkservice Deletes a guest network service using its GUID. ```APIDOC ## HcnDeleteGuestNetworkService ### Description Deletes a guest network service. ### Syntax ```cpp HRESULT WINAPI HcnDeleteGuestNetworkService( _In_ REFGUID Id, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - Id of the guest network service to delete. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ### Requirements - **Minimum supported client**: Windows 10, version 1809 - **Minimum supported server**: Windows Server 2019 - **Header**: ComputeNetwork.h - **Library**: ComputeNetwork.lib - **Dll**: ComputeNetwork.dll ``` -------------------------------- ### HcnDeleteNamespace Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcndeletenamespace Deletes a namespace identified by the provided GUID. ```APIDOC ## HcnDeleteNamespace ### Description Deletes a namespace from the Host Compute Network. ### Syntax ```cpp HRESULT WINAPI HcnDeleteNamespace( _In_ REFGUID Id, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - The unique identifier of the namespace to delete. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended error information. The caller must release this buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns S_OK if the operation succeeds, or an error code otherwise. ``` -------------------------------- ### HcnOpenNetwork Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopennetwork Opens a network and returns a handle to it. ```APIDOC ## HcnOpenNetwork ### Description Opens a network identified by the provided GUID. ### Syntax ```cpp HRESULT WINAPI HcnOpenNetwork( _In_ REFGUID Id, _Out_ PHCN_NETWORK Network, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - The ID of the network to open. - **Network** (PHCN_NETWORK) - Required - Receives a handle to the network. The caller is responsible for releasing this handle using HcnCloseNetwork. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended error information. The caller must release this buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnOpenNamespace Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopennamespace Opens a namespace and returns a handle to it. ```APIDOC ## HcnOpenNamespace ### Description Opens a namespace identified by the provided GUID. ### Syntax ```cpp HRESULT WINAPI HcnOpenNamespace( _In_ REFGUID Id, _Out_ PHCN_NAMESPACE Namespace, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - The ID of the namespace to open. - **Namespace** (PHCN_NAMESPACE) - Required - Receives a handle to the namespace. The caller is responsible for releasing this handle using HcnCloseNamespace. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended error information. The caller must release this buffer using CoTaskMemFree. ### Return Values Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnCreateGuestNetworkService Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreateguestnetworkservice Function signature for creating a guest network service in C++. ```C++ HRESULT WINAPI HcnCreateGuestNetworkService( _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_GUESTNETWORKSERVICE GuestNetworkService, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### Register Guest Network Service Callback in C++ Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnregisterguestnetworkservicecallback Function signature for registering a notification callback for a GuestNetworkService. ```C++ HRESULT WINAPI HcnRegisterGuestNetworkServiceCallback( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService, _In_ HCN_NOTIFICATION_CALLBACK Callback, _In_ void* Context, _Outptr_ HCN_CALLBACK* CallbackHandle ); ``` -------------------------------- ### HcnCreateGuestNetworkService Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreateguestnetworkservice Creates a guest network service using the provided ID and settings. ```APIDOC ## HcnCreateGuestNetworkService ### Description Creates a guest network service. ### Syntax ```cpp HRESULT WINAPI HcnCreateGuestNetworkService( _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_GUESTNETWORKSERVICE GuestNetworkService, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - Id for the new guest network service. - **Settings** (PCWSTR) - Required - JSON document specifying the settings of the guest network service. - **GuestNetworkService** (PHCN_GUESTNETWORKSERVICE) - Required - Receives a handle to the newly created guest network service. It is the responsibility of the caller to release the handle using HcnCloseGuestNetworkService once it is no longer in use. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ### Requirements - **Minimum supported client**: Windows 10, version 1809 - **Minimum supported server**: Windows Server 2019 - **Header**: ComputeNetwork.h - **Library**: ComputeNetwork.lib - **Dll**: ComputeNetwork.dll ``` -------------------------------- ### HcnOpenLoadBalancer Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopenloadbalancer Opens a load balancer and returns a handle to it. ```APIDOC ## HcnOpenLoadBalancer ### Description Opens a load balancer. The caller is responsible for releasing the returned handle using HcnCloseLoadBalancer. ### Syntax ```cpp HRESULT WINAPI HcnOpenLoadBalancer( _In_ REFGUID Id, _Out_ PHCN_LOADBALANCER LoadBalancer, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - The ID of the load balancer to open. - **LoadBalancer** (PHCN_LOADBALANCER) - Required - Receives a handle to the load balancer. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended error information. The caller must release this buffer using CoTaskMemFree. ### Return Values Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnQueryLoadBalancerProperties Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnqueryloadbalancerproperties The function signature for querying load balancer properties in C++. ```C++ HRESULT WINAPI HcnQueryLoadBalancerProperties( _In_ HCN_LOADBALANCER LoadBalancer, _In_ PCWSTR Query, _Outptr_ PWSTR* Properties, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnOpenEndpoint Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopenendpoint Opens an endpoint and returns a handle to it. ```APIDOC ## HcnOpenEndpoint ### Description Opens an endpoint. The caller is responsible for releasing the returned handle using HcnCloseEndpoint. ### Syntax ```cpp HRESULT WINAPI HcnOpenEndpoint( _In_ REFGUID Id, _Out_ PHCN_ENDPOINT Endpoint, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - The unique identifier of the endpoint. - **Endpoint** (PHCN_ENDPOINT) - Required - Receives a handle to the opened endpoint. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended error information if the operation fails. The caller must release this buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnQueryNetworkProperties function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnquerynetworkproperties The function signature for querying network properties in C++. ```C++ HRESULT WINAPI HcnQueryNetworkProperties( _In_ HCN_NETWORK Network, _In_ PCWSTR Query, _Outptr_ PWSTR* Properties, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnQueryLoadBalancerProperties Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnqueryloadbalancerproperties Queries the properties of a load balancer using a handle and a query string. ```APIDOC ## HcnQueryLoadBalancerProperties ### Description Queries the properties of a load balancer. ### Syntax ```cpp HRESULT WINAPI HcnQueryLoadBalancerProperties( _In_ HCN_LOADBALANCER LoadBalancer, _In_ PCWSTR Query, _Outptr_ PWSTR* Properties, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **LoadBalancer** (HCN_LOADBALANCER) - Required - Handle to a load balancer. - **Query** (PCWSTR) - Required - Optional JSON document of HostComputeQuery. - **Properties** (PWSTR*) - Required - The properties in the form of a JSON document of HostComputeLoadBalancer. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnCreateNamespace Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreatenamespace Creates a new namespace using the provided ID and settings. ```APIDOC ## HcnCreateNamespace ### Description Creates a namespace. ### Syntax ```cpp HRESULT WINAPI HcnCreateNamespace( _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_NAMESPACE Namespace, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - Id for the new namespace. - **Settings** (PCWSTR) - Required - JSON document specifying the settings of the namespace. - **Namespace** (PHCN_NAMESPACE) - Required - Receives a handle to the newly created namespace. It is the responsibility of the caller to release the handle using HcnCloseNamespace once it is no longer in use. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnCreateNetwork Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreatenetwork Creates a new network using the specified ID and settings. ```APIDOC ## HcnCreateNetwork ### Description Creates a network. ### Syntax ```cpp HRESULT WINAPI HcnCreateNetwork( _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_NETWORK Network, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - Id for the new network. - **Settings** (PCWSTR) - Required - JSON document specifying the settings of the HostComputeNetwork. - **Network** (PHCN_NETWORK) - Required - Receives a handle to the newly created network. It is the responsibility of the caller to release the handle using HcnCloseNetwork once it is no longer in use. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### Reserve guest network service port range in C++ Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnreserveguestnetworkserviceportrange Function signature for reserving a port range within a guest network service. ```C++ HRESULT WINAPI HcnReserveGuestNetworkServicePortRange( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService, _In_ USHORT PortCount, _Out_ HCN_PORT_RANGE_RESERVATION* PortRangeReservation, _Out_ HANDLE* PortReservationHandle ); ``` -------------------------------- ### HcnEnumerateGuestNetworkPortReservations C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumerateguestnetworkportreservations The function signature for enumerating guest network port reservations in C++. ```C++ HRESULT WINAPI HcnEnumerateGuestNetworkPortReservations( _Out_ ULONG* ReturnCount, _Out_writes_bytes_all_(*ReturnCount) HCN_PORT_RANGE_ENTRY** PortEntries ); ``` -------------------------------- ### HcnCreateLoadBalancer Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreateloadbalancer Creates a load balancer using the provided ID and settings. ```APIDOC ## HcnCreateLoadBalancer ### Description Creates a load balancer. ### Syntax ```cpp HRESULT WINAPI HcnCreateLoadBalancer( _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_LOADBALANCER LoadBalancer, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Id** (REFGUID) - Required - Id for the new load balancer. - **Settings** (PCWSTR) - Required - JSON document specifying the settings of the load balancer. - **LoadBalancer** (PHCN_LOADBALANCER) - Required - Receives a handle to the newly created load balancer. It is the responsibility of the caller to release the handle using HcnCloseLoadBalancer once it is no longer in use. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values The function returns HRESULT. ``` -------------------------------- ### HcnCreateNamespace Function Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreatenamespace The function signature for creating a namespace in the Host Compute Network API. ```C++ HRESULT WINAPI HcnCreateNamespace( _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_NAMESPACE Namespace, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnEnumerateGuestNetworkPortReservations Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumerateguestnetworkportreservations Enumerates the guest network port reservations. ```APIDOC ## HcnEnumerateGuestNetworkPortReservations ### Description Enumerates the guest network port reservations. ### Syntax ```cpp HRESULT WINAPI HcnEnumerateGuestNetworkPortReservations( _Out_ ULONG* ReturnCount, _Out_writes_bytes_all_(*ReturnCount) HCN_PORT_RANGE_ENTRY** PortEntries ); ``` ### Parameters - **ReturnCount** (ULONG*) - Receives the count of reserved port entries. - **PortEntries** (HCN_PORT_RANGE_ENTRY**) - Receives the list of port entries. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnReleaseGuestNetworkServicePortReservationHandle Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnreleaseguestnetworkserviceportreservationhandle The function signature for releasing a guest network service port reservation handle in C++. ```cpp HRESULT WINAPI HcnReleaseGuestNetworkServicePortReservationHandle( _In_ HANDLE PortReservationHandle ); ``` -------------------------------- ### HcnEnumerateNamespaces Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumeratenamespaces Enumerates the namespaces available in the Host Compute Network. ```APIDOC ## HcnEnumerateNamespaces ### Description Enumerates the namespaces. Returns a list of IDs for each namespace. ### Syntax ```cpp HRESULT WINAPI HcnEnumerateNamespaces( _In_ PCWSTR Query, _Outptr_ PWSTR* Namespaces, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Query** (PCWSTR) - Optional - JSON document of HostComputeQuery. - **Namespaces** (PWSTR*) - Required - A list of IDs for each Namespace. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns the status of the operation. ``` -------------------------------- ### HcnRegisterServiceCallback C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnregisterservicecallback The function signature for registering a service notification callback in C++. ```cpp HRESULT WINAPI HcnRegisterServiceCallback( _In_ HCN_NOTIFICATION_CALLBACK Callback, _In_ void* Context, _Outptr_ HCN_CALLBACK* CallbackHandle ); ``` -------------------------------- ### HcnCreateEndpoint function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreateendpoint The function signature for creating a network endpoint in C++. ```C++ HRESULT WINAPI HcnCreateEndpoint( _In_ HCN_NETWORK Network, _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_ENDPOINT Endpoint, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnDeleteGuestNetworkService Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcndeleteguestnetworkservice The function signature for deleting a guest network service in C++. ```cpp HRESULT WINAPI HcnDeleteGuestNetworkService( _In_ REFGUID Id, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### Define HCN_GUESTNETWORKSERVICE handle Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcn_guestnetworkservice Represents the context handle for a Guest Network Service in C++. ```C++ typedef void* HCN_GUESTNETWORKSERVICE; ``` -------------------------------- ### HcnUnregisterGuestNetworkServiceCallback Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnunregisterguestnetworkservicecallback The function signature for unregistering a guest network service callback. ```cpp HRESULT WINAPI HcnUnregisterGuestNetworkServiceCallback( _In_ HCN_CALLBACK CallbackHandle ); ``` -------------------------------- ### HcnRegisterGuestNetworkServiceCallback Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnregisterguestnetworkservicecallback Registers a callback function to receive GuestNetworkService notifications. ```APIDOC ## HcnRegisterGuestNetworkServiceCallback ### Description Registers a callback function to receive GuestNetworkService notifications. ### Syntax ```cpp HRESULT WINAPI HcnRegisterGuestNetworkServiceCallback( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService, _In_ HCN_NOTIFICATION_CALLBACK Callback, _In_ void* Context, _Outptr_ HCN_CALLBACK* CallbackHandle ); ``` ### Parameters - **GuestNetworkService** (HCN_GUESTNETWORKSERVICE) - The HCN_GUESTNETWORKSERVICE for the callback. - **Callback** (HCN_NOTIFICATION_CALLBACK) - The HCN_NOTIFICATION_CALLBACK for the callback. - **Context** (void*) - Context that is provided on the callbacks. - **CallbackHandle** (HCN_CALLBACK*) - Receives a HCN_CALLBACK. It is the responsibility of the caller to release the handle using HcnUnregisterGuestNetworkServiceCallback once it is no longer in use. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnEnumerateLoadBalancers Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumerateloadbalancers Enumerates the load balancers available in the system. ```APIDOC ## HcnEnumerateLoadBalancers ### Description Enumerates the load balancers. This function returns a list of IDs for each load balancer. ### Syntax ```cpp HRESULT WINAPI HcnEnumerateLoadBalancers( _In_ PCWSTR Query, _Outptr_ PWSTR* LoadBalancer, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Query** (PCWSTR) - Optional - JSON document of HostComputeQuery. - **LoadBalancer** (PWSTR*) - Required - A list of IDs for each Load Balancer. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns the status of the operation. ``` -------------------------------- ### HcnCreateLoadBalancer function signature Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreateloadbalancer The function signature for creating a load balancer in C++. ```C++ HRESULT WINAPI HcnCreateLoadBalancer( _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_LOADBALANCER LoadBalancer, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnQueryNamespaceProperties Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnquerynamespaceproperties Queries the properties of a namespace using a handle and a JSON query document. ```APIDOC ## HcnQueryNamespaceProperties ### Description Queries the properties of a namespace. ### Syntax ```cpp HRESULT WINAPI HcnQueryNamespaceProperties( _In_ HCN_NAMESPACE Namespace, _In_ PCWSTR Query, _Outptr_ PWSTR* Properties, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Namespace** (HCN_NAMESPACE) - Required - Handle to a namespace. - **Query** (PCWSTR) - Required - Optional JSON document of HostComputeQuery. - **Properties** (PWSTR*) - Required - The properties in the form of a JSON document of HostComputeNamespace. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns the result of the function call. ``` -------------------------------- ### HcnEnumerateNetworks Function Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumeratenetworks The function signature for enumerating networks in C++. ```C++ HRESULT WINAPI HcnEnumerateNetworks( _In_ PCWSTR Query, _Outptr_ PWSTR* Networks, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### Define HCN_PORT_RANGE_ENTRY structure in C++ Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcn_port_range_entry The structure definition for port range reservations in the ComputeNetwork.h header. ```C++ typedef struct tagHCN_PORT_RANGE_ENTRY { GUID OwningPartitionId; GUID TargetPartitionId; HCN_PORT_PROTOCOL Protocol; UINT64 Priority; UINT32 ReservationType; UINT32 SharingFlags; UINT32 DeliveryMode; UINT16 StartingPort; UINT16 EndingPort; } HCN_PORT_RANGE_ENTRY, *PHCN_PORT_RANGE_ENTRY; ``` -------------------------------- ### HcnReserveGuestNetworkServicePort function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnreserveguestnetworkserviceport The function signature for reserving a port in the guest network service. ```C++ HRESULT WINAPI HcnReserveGuestNetworkServicePort( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService, _In_ HCN_PORT_PROTOCOL Protocol, _In_ HCN_PORT_ACCESS Access, _In_ USHORT Port, _Out_ HANDLE* PortReservationHandle ); ``` -------------------------------- ### HcnUnregisterServiceCallback C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnunregisterservicecallback The function signature for unregistering a guest network service callback in C++. ```C++ HRESULT WINAPI HcnUnregisterServiceCallback( _In_ HCN_CALLBACK CallbackHandle ); ``` -------------------------------- ### HcnCreateNetwork C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreatenetwork The function signature for HcnCreateNetwork in C++. Callers must release the returned network handle using HcnCloseNetwork and the error record buffer using CoTaskMemFree. ```C++ HRESULT WINAPI HcnCreateNetwork( _In_ REFGUID Id, _In_ PCWSTR Settings, _Out_ PHCN_NETWORK Network, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnQueryNamespaceProperties function signature Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnquerynamespaceproperties The function signature for querying namespace properties in C++. ```C++ HRESULT WINAPI HcnQueryNamespaceProperties( _In_ HCN_NAMESPACE Namespace, _In_ PCWSTR Query, _Outptr_ PWSTR* Properties, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnQueryEndpointProperties Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnqueryendpointproperties The function signature for querying endpoint properties, requiring a handle to an endpoint and a JSON query string. ```C++ HRESULT WINAPI HcnQueryEndpointProperties( _In_ HCN_ENDPOINT Endpoint, _In_ PCWSTR Query, _Outptr_ PWSTR* Properties, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnCloseGuestNetworkService C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncloseguestnetworkservice The function signature for closing a guest network service handle. ```C++ HRESULT WINAPI HcnCloseGuestNetworkService( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService ); ``` -------------------------------- ### HcnEnumerateNamespaces function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumeratenamespaces The function signature for enumerating namespaces, requiring a query string and providing pointers for the resulting namespace list and error records. ```C++ HRESULT WINAPI HcnEnumerateNamespaces( _In_ PCWSTR Query, _Outptr_ PWSTR* Namespaces, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### Define HCN_PORT_ACCESS enumeration in C++ Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcn_port_access Use this enumeration to specify the access level for port reservations. Requires ComputeNetwork.h. ```C++ typedef enum tagHCN_PORT_ACCESS { HCN_PORT_ACCESS_EXCLUSIVE = 0x01, HCN_PORT_ACCESS_SHARED = 0x02 } HCN_PORT_ACCESS; ``` -------------------------------- ### HcnQueryNetworkProperties Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnquerynetworkproperties Queries the properties of a network using the Host Compute Network API. ```APIDOC ## HcnQueryNetworkProperties ### Description Queries the properties of a network. ### Syntax ```cpp HRESULT WINAPI HcnQueryNetworkProperties( _In_ HCN_NETWORK Network, _In_ PCWSTR Query, _Outptr_ PWSTR* Properties, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Network** (HCN_NETWORK) - Required - Handle to a network. - **Query** (PCWSTR) - Required - Optional JSON document of HostComputeQuery. - **Properties** (PWSTR*) - Required - The properties in the form of a JSON document of HostComputeNetwork. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns the result of the operation. ``` -------------------------------- ### HcnFreeGuestNetworkPortReservations C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnfreeguestnetworkportreservations Use this function to free a list of port range entries. It requires the ComputeNetwork.lib library and ComputeNetwork.dll. ```C++ VOID WINAPI HcnFreeGuestNetworkPortReservations( _Inout_opt_ HCN_PORT_RANGE_ENTRY* PortEntries ); ``` -------------------------------- ### HcnRegisterServiceCallback Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnregisterservicecallback Registers a callback function to receive service notifications. ```APIDOC ## HcnRegisterServiceCallback ### Description Registers a callback function to receive service notifications. ### Syntax ```cpp HRESULT WINAPI HcnRegisterServiceCallback( _In_ HCN_NOTIFICATION_CALLBACK Callback, _In_ void* Context, _Outptr_ HCN_CALLBACK* CallbackHandle ); ``` ### Parameters - **Callback** (HCN_NOTIFICATION_CALLBACK) - Required - The HCN_NOTIFICATION_CALLBACK for the callback. - **Context** (void*) - Required - Context that is provided on the callbacks. - **CallbackHandle** (HCN_CALLBACK*) - Required - Receives a HCN_CALLBACK. It is the responsibility of the caller to release the handle using HcnUnregisterServiceCallback once it is no longer in use. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HCN_NOTIFICATIONS Enumeration Definition Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcn_notifications Defines the event types for compute system callbacks. Requires ComputeNetwork.h. ```C++ typedef enum HCN_NOTIFICATIONS { HcnNotificationInvalid = 0x00000000, /// Notifications for HCN_SERVICE handles HcnNotificationNetworkPreCreate = 0x00000001, HcnNotificationNetworkCreate = 0x00000002, HcnNotificationNetworkPreDelete = 0x00000003, HcnNotificationNetworkDelete = 0x00000004, /// Namespace Notifications HcnNotificationNamespaceCreate = 0x00000005, HcnNotificationNamespaceDelete = 0x00000006, /// Notifications for HCN_SERVICE handles HcnNotificationGuestNetworkServiceCreate = 0x00000007, HcnNotificationGuestNetworkServiceDelete = 0x00000008, /// Notifications for HCN_NETWORK handles HcnNotificationNetworkEndpointAttached = 0x00000009, HcnNotificationNetworkEndpointDetached = 0x00000010, /// Notifications for HCN_GUESTNETWORKSERVICE handles HcnNotificationGuestNetworkServiceStateChanged = 0x00000011, HcnNotificationGuestNetworkServiceInterfaceStateChanged = 0x00000012, /// Common notifications HcnNotificationServiceDisconnect = 0x01000000, /// The upper 4 bits are reserved for flags HcnNotificationFlagsReserved = 0xF0000000 } HCN_NOTIFICATIONS; ``` -------------------------------- ### HcnCloseNamespace Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnclosenamespace Closes a handle to a namespace. ```APIDOC ## HcnCloseNamespace ### Description Closes a handle to a namespace. ### Syntax ```cpp HRESULT WINAPI HcnCloseNamespace( _In_ HCN_NAMESPACE Namespace ); ``` ### Parameters - **Namespace** (HCN_NAMESPACE) - Required - Handle to a namespace. ### Return Values - **HRESULT** - Returns an HRESULT indicating the success or failure of the operation. ### Requirements - **Minimum supported client**: Windows 10, version 1809 - **Minimum supported server**: Windows Server 2019 - **Header**: ComputeNetwork.h - **Library**: ComputeNetwork.lib - **Dll**: ComputeNetwork.dll ``` -------------------------------- ### HcnOpenEndpoint function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopenendpoint The function signature for opening a network endpoint, requiring the endpoint ID and providing a handle and optional error record. ```C++ HRESULT WINAPI HcnOpenEndpoint( _In_ REFGUID Id, _Out_ PHCN_ENDPOINT Endpoint, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnReleaseGuestNetworkServicePortReservationHandle Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnreleaseguestnetworkserviceportreservationhandle Releases a port reservation handle. ```APIDOC ## HcnReleaseGuestNetworkServicePortReservationHandle ### Description Releases a port reservation handle. ### Syntax ```cpp HRESULT WINAPI HcnReleaseGuestNetworkServicePortReservationHandle( _In_ HANDLE PortReservationHandle ); ``` ### Parameters - **PortReservationHandle** (HANDLE) - Required - The handle to the reservations to release. ### Return Values The function returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnQueryEndpointProperties Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnqueryendpointproperties Queries the properties of a Host Compute Network endpoint. ```APIDOC ## HcnQueryEndpointProperties ### Description Queries the properties of an endpoint. ### Syntax ```cpp HRESULT WINAPI HcnQueryEndpointProperties( _In_ HCN_ENDPOINT Endpoint, _In_ PCWSTR Query, _Outptr_ PWSTR* Properties, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Endpoint** (HCN_ENDPOINT) - Required - Handle to an endpoint. - **Query** (PCWSTR) - Required - Optional JSON document of HostComputeQuery. - **Properties** (PWSTR*) - Required - The properties in the form of a JSON document of HostComputeEndpoint. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns the result of the operation. ``` -------------------------------- ### HcnCreateEndpoint Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncreateendpoint Creates a new endpoint within the specified HCN network. ```APIDOC ## HcnCreateEndpoint ### Description Creates a new endpoint within a specified HCN network. The caller is responsible for releasing the returned handle using HcnCloseEndpoint. ### Syntax `HRESULT WINAPI HcnCreateEndpoint(HCN_NETWORK Network, REFGUID Id, PCWSTR Settings, PHCN_ENDPOINT Endpoint, PWSTR* ErrorRecord);` ### Parameters - **Network** (HCN_NETWORK) - Required - The network for the new endpoint. - **Id** (REFGUID) - Required - The unique identifier for the new endpoint. - **Settings** (PCWSTR) - Required - A JSON document specifying the settings of the endpoint. - **Endpoint** (PHCN_ENDPOINT) - Required - Receives a handle to the newly created endpoint. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended error information. The caller must release this buffer using CoTaskMemFree. ### Return Values Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnCloseGuestNetworkService Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncloseguestnetworkservice Closes a handle to a guest network service. ```APIDOC ## HcnCloseGuestNetworkService ### Description Closes a handle to a guest network service handle. ### Syntax ```cpp HRESULT WINAPI HcnCloseGuestNetworkService( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService ); ``` ### Parameters - **GuestNetworkService** (HCN_GUESTNETWORKSERVICE) - Required - Handle to a guest network service. ### Return Values - **HRESULT** - Returns an HRESULT indicating the success or failure of the operation. ``` -------------------------------- ### HcnEnumerateNetworks Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumeratenetworks Enumerates the networks available in the Host Compute Network system. ```APIDOC ## HcnEnumerateNetworks ### Description Enumerates the networks. Returns a list of IDs for each network. ### Syntax ```cpp HRESULT WINAPI HcnEnumerateNetworks( _In_ PCWSTR Query, _Outptr_ PWSTR* Networks, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Query** (PCWSTR) - Optional - JSON document of HostComputeQuery. - **Networks** (PWSTR*) - Required - A list of IDs for each Network. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns the status of the operation. ``` -------------------------------- ### HcnFreeGuestNetworkPortReservations Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnfreeguestnetworkportreservations Frees a list of guest network port reservations. ```APIDOC ## HcnFreeGuestNetworkPortReservations ### Description Frees the specified list of guest network port reservations. ### Syntax VOID WINAPI HcnFreeGuestNetworkPortReservations(_Inout_opt_ HCN_PORT_RANGE_ENTRY* PortEntries); ### Parameters - **PortEntries** (HCN_PORT_RANGE_ENTRY*) - The list of HCN_PORT_RANGE_ENTRY instances to free. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ### Requirements - **Minimum supported client**: Windows 10, version 1809 - **Minimum supported server**: Windows Server 2019 - **Header**: ComputeNetwork.h - **Library**: ComputeNetwork.lib - **Dll**: ComputeNetwork.dll ``` -------------------------------- ### HcnCloseNamespace function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnclosenamespace The function signature for closing a namespace handle in C++. ```cpp HRESULT WINAPI HcnCloseNamespace( _In_ HCN_NAMESPACE Namespace ); ``` -------------------------------- ### HcnCloseEndpoint Function Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncloseendpoint The function signature for closing an endpoint handle in C++. ```cpp HRESULT WINAPI HcnCloseEndpoint( _In_ HCN_ENDPOINT Endpoint ); ``` -------------------------------- ### HcnModifyGuestNetworkService C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnmodifyguestnetworkservice The function signature for modifying a guest network service in C++. ```C++ HRESULT WINAPI HcnModifyGuestNetworkService( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService, _In_ PCWSTR Settings, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnEnumerateEndpoints Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumerateendpoints Enumerates the endpoints based on an optional query. ```APIDOC ## HcnEnumerateEndpoints ### Description Enumerates the endpoints. Returns a list of IDs for each endpoint. ### Syntax ```cpp HRESULT WINAPI HcnEnumerateEndpoints( _In_ PCWSTR Query, _Outptr_ PWSTR* Endpoints, _Outptr_opt_ PWSTR* ErrorRecord ); ``` ### Parameters - **Query** (PCWSTR) - Optional - JSON document of HostComputeQuery. - **Endpoints** (PWSTR*) - Required - A list of IDs for each Endpoint. - **ErrorRecord** (PWSTR*) - Optional - Receives a JSON document with extended errorCode information. The caller must release the buffer using CoTaskMemFree. ### Return Values - **HRESULT** - Returns the status of the function call. ``` -------------------------------- ### HcnCloseLoadBalancer function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncloseloadbalancer The function signature for closing a load balancer handle in C++. ```C++ HRESULT WINAPI HcnCloseLoadBalancer( _In_ HCN_LOADBALANCER LoadBalancer ); ``` -------------------------------- ### HcnDeleteNetwork C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcndeletenetwork The function signature for deleting a network. The caller is responsible for freeing the ErrorRecord buffer using CoTaskMemFree. ```C++ HRESULT WINAPI HcnDeleteNetwork( _In_ REFGUID Id, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### Define HCN_NOTIFICATION_CALLBACK Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcn_notification_callback The callback function signature for receiving notifications from the Host Compute Network. ```C++ typedef void (CALLBACK *HCN_NOTIFICATION_CALLBACK)( _In_ DWORD NotificationType, _In_opt_ void* Context, _In_ HRESULT NotificationStatus, _In_opt_ PCWSTR NotificationData ); ``` -------------------------------- ### HcnUnregisterGuestNetworkServiceCallback Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnunregisterguestnetworkservicecallback Unregisters a guest network service callback. ```APIDOC ## HcnUnregisterGuestNetworkServiceCallback ### Description Unregisters a guest network service callback. ### Syntax ```cpp HRESULT WINAPI HcnUnregisterGuestNetworkServiceCallback( _In_ HCN_CALLBACK CallbackHandle ); ``` ### Parameters - **CallbackHandle** (HCN_CALLBACK) - Required - The HCN_CALLBACK for the callback. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ### Requirements - **Header**: ComputeNetwork.h - **Library**: ComputeNetwork.lib - **Dll**: ComputeNetwork.dll - **Minimum supported client**: Windows 10, version 1809 - **Minimum supported server**: Windows Server 2019 ``` -------------------------------- ### HcnDeleteLoadBalancer C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcndeleteloadbalancer The function signature for deleting a load balancer. The caller is responsible for freeing the ErrorRecord buffer using CoTaskMemFree. ```cpp HRESULT WINAPI HcnDeleteLoadBalancer( _In_ REFGUID Id, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnDeleteNamespace function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcndeletenamespace The function signature for deleting a namespace, requiring the namespace ID and an optional pointer for error records. ```C++ HRESULT WINAPI HcnDeleteNamespace( _In_ REFGUID Id, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnUnregisterServiceCallback Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnunregisterservicecallback Unregisters a guest network service callback. ```APIDOC ## HcnUnregisterServiceCallback ### Description Unregisters a guest network service callback. ### Syntax ```cpp HRESULT WINAPI HcnUnregisterServiceCallback( _In_ HCN_CALLBACK CallbackHandle ); ``` ### Parameters - **CallbackHandle** (HCN_CALLBACK) - Required - The HCN_CALLBACK for the callback. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ### Requirements - **Header**: ComputeNetwork.h - **Library**: ComputeNetwork.lib - **Dll**: ComputeNetwork.dll - **Minimum supported client**: Windows 10, version 1809 - **Minimum supported server**: Windows Server 2019 ``` -------------------------------- ### HcnEnumerateLoadBalancers C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumerateloadbalancers The function signature for HcnEnumerateLoadBalancers. The caller is responsible for freeing the returned LoadBalancer and ErrorRecord buffers using CoTaskMemFree. ```cpp HRESULT WINAPI HcnEnumerateLoadBalancers( _In_ PCWSTR Query, _Outptr_ PWSTR* LoadBalancer, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnOpenNetwork function signature Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnopennetwork The function signature for HcnOpenNetwork as defined in ComputeNetwork.h. ```cpp HRESULT WINAPI HcnOpenNetwork( _In_ REFGUID Id, _Out_ PHCN_NETWORK Network, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnDeleteEndpoint C++ Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcndeleteendpoint The function signature for HcnDeleteEndpoint as defined in ComputeNetwork.h. ```cpp HRESULT WINAPI HcnDeleteEndpoint( _In_ REFGUID Id, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnReserveGuestNetworkServicePort Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnreserveguestnetworkserviceport Reserves a single port for the specified guest network service. ```APIDOC ## HcnReserveGuestNetworkServicePort ### Description Reserves a single port for a given guest network service. ### Syntax ```cpp HRESULT WINAPI HcnReserveGuestNetworkServicePort( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService, _In_ HCN_PORT_PROTOCOL Protocol, _In_ HCN_PORT_ACCESS Access, _In_ USHORT Port, _Out_ HANDLE* PortReservationHandle ); ``` ### Parameters - **GuestNetworkService** (HCN_GUESTNETWORKSERVICE) - The HCN_GUESTNETWORKSERVICE for the reservation. - **Protocol** (HCN_PORT_PROTOCOL) - The HCN_PORT_PROTOCOL for the reservation. - **Access** (HCN_PORT_ACCESS) - The HCN_PORT_ACCESS for the reservation. - **Port** (USHORT) - The port for the reservation. - **PortReservationHandle** (HANDLE*) - Receives a handle. It is the responsibility of the caller to release the handle using HcnReleaseGuestNetworkServicePortReservationHandle once it is no longer in use. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnReserveGuestNetworkServicePortRange Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnreserveguestnetworkserviceportrange Reserves a range of ports for the specified guest network service. ```APIDOC ## HcnReserveGuestNetworkServicePortRange ### Description Reserves a range of ports for a given HCN_GUESTNETWORKSERVICE. ### Syntax ```cpp HRESULT WINAPI HcnReserveGuestNetworkServicePortRange( _In_ HCN_GUESTNETWORKSERVICE GuestNetworkService, _In_ USHORT PortCount, _Out_ HCN_PORT_RANGE_RESERVATION* PortRangeReservation, _Out_ HANDLE* PortReservationHandle ); ``` ### Parameters - **GuestNetworkService** (HCN_GUESTNETWORKSERVICE) - The HCN_GUESTNETWORKSERVICE for the reservation. - **PortCount** (USHORT) - The number of ports to reserve. - **PortRangeReservation** (HCN_PORT_RANGE_RESERVATION*) - The list of HCN_PORT_RANGE_RESERVATION for the reservation. - **PortReservationHandle** (HANDLE*) - Receives a handle. It is the responsibility of the caller to release the handle using HcnReleaseGuestNetworkServicePortReservationHandle once it is no longer in use. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### HcnCloseNetwork Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnclosenetwork Closes a handle to a network. ```APIDOC ## HcnCloseNetwork ### Description Closes a handle to a Network. ### Syntax ```cpp HRESULT WINAPI HcnCloseNetwork(_In_ HCN_NETWORK Network); ``` ### Parameters - **Network** (HCN_NETWORK) - Required - Handle to a network. ### Return Values - **HRESULT** - Returns an HRESULT indicating the success or failure of the operation. ### Requirements - **Minimum supported client**: Windows 10, version 1809 - **Minimum supported server**: Windows Server 2019 - **Header**: ComputeNetwork.h - **Library**: ComputeNetwork.lib - **Dll**: ComputeNetwork.dll ``` -------------------------------- ### HcnCloseNetwork function syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnclosenetwork The function signature for closing an HCN_NETWORK handle. ```C++ HRESULT WINAPI HcnCloseNetwork( _In_ HCN_NETWORK Network ); ``` -------------------------------- ### HcnEnumerateEndpoints Syntax Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcnenumerateendpoints The function signature for HcnEnumerateEndpoints, requiring the caller to manage memory for the returned buffers. ```cpp HRESULT WINAPI HcnEnumerateEndpoints( _In_ PCWSTR Query, _Outptr_ PWSTR* Endpoints, _Outptr_opt_ PWSTR* ErrorRecord ); ``` -------------------------------- ### HcnCloseLoadBalancer Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcncloseloadbalancer Closes a handle to a load balancer. ```APIDOC ## HcnCloseLoadBalancer ### Description Closes a handle to a load balancer. ### Syntax ```cpp HRESULT WINAPI HcnCloseLoadBalancer( _In_ HCN_LOADBALANCER LoadBalancer ); ``` ### Parameters - **LoadBalancer** (HCN_LOADBALANCER) - Required - Handle to a LoadBalancer. ### Return Values - **HRESULT** - Returns an HRESULT indicating success or failure. ``` -------------------------------- ### Define HCN_SERVICE type Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcn_service Represents the context handle for the HNS service as a void pointer. ```C++ typedef void* HCN_SERVICE; ``` -------------------------------- ### Define HCN_PORT_PROTOCOL Enumeration Source: https://learn.microsoft.com/en-us/virtualization/api/hcn/reference/hcn_port_protocol Enumeration used to specify the protocol type for network port reservations. ```C++ typedef enum tagHCN_PORT_PROTOCOL { HCN_PORT_PROTOCOL_TCP = 0x01, HCN_PORT_PROTOCOL_UDP = 0x02, HCN_PORT_PROTOCOL_BOTH = 0x03 } HCN_PORT_PROTOCOL; ```