/// <summary> /// Creates a duplicate of the object with the specified rights, by requesting the kernel to duplicate the handle with those values /// </summary> /// <returns> /// <list type="bullet"> /// <item> /// <term>Ok</term> /// <description> /// and the duplicate in result /// </description> /// </item> /// <item> /// <term>ErrBadHandle</term> /// <description> /// handle isn't a valid handle. /// </description> /// </item> /// <item> /// <term>ErrInvalidArgs</term> /// <description> /// The rights requested are not a subset of handle rights or out is an invalid pointer. /// </description> /// </item> /// <item> /// <term>ErrAccessDenied</term> /// <description> /// handle does not have ZX_RIGHT_DUPLICATE and may not be duplicated. /// </description> /// </item> /// <item> /// <term>ErrNoMemory</term> /// <description> /// Failure due to lack of memory. There is no good way for userspace to handle this (unlikely) error. In a future build this error will no longer occur. /// </description> /// </item> /// </list> /// </returns> /// <param name="rights">New desired access rights.</param> public ZxStatus Duplicate(ZxRights rights, out VirtualMemoryAddressRegion result) { uint rhandle; var ret = zx_handle_duplicate((uint)handle, rights, out rhandle); if (ret == ZxStatus.Ok) { result = new VirtualMemoryAddressRegion(rhandle, address); } else { result = null; } return(ret); }
internal extern static ZxStatus zx_handle_replace(uint handle, ZxRights rights, out uint handleResult);
internal extern static ZxStatus zx_handle_duplicate(uint handle, ZxRights rights, out uint handleResult);