Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6180951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:56:07+00:00 2026-05-24T00:56:07+00:00

Function description here. I’m struggling to get it right to call this function from

  • 0

Function description here.

I’m struggling to get it right to call this function from c#.
I’m at a stage where I’m calling it but it’s returning E_INVALIDARG.

I’ve set it up as follows…

[DllImport("p2p.dll", CharSet=CharSet.Unicode)]
internal static extern uint PeerGroupCreateInvitation(IntPtr hGroup, string pwzIdentityInfo, IntPtr pftExpiration, int cRoles, IntPtr pRoles, out string ppwzInvitation);

My best guess is the 5th parameter, “pRoles”.
I’m supposed to send it a pointer to one or two GUIDs representing the role type.

PEER_GROUP_ROLE_ADMIN
PEER_GROUP_ROLE_MEMBER

I have no clue presently how to do this from c#.

In C this parameter looks like this when calling the function…

..., (PEER_ROLE_ID*) &PEER_GROUP_ROLE_MEMBER, ...

PEER_ROLE_ID looks like a System.Guid type.
PEER_GROUP_ROLE_MEMBER looks like the actual GUID. (Can I get this from the p2p.dll file?)

Any help would be greatly appreciated… especially since there’s close to ZERO info on this function on the internet.

Working solution after everyone’s comments.

Declaration:

[DllImport("p2p.dll")]
public static extern uint PeerGroupCreateInvitation(IntPtr hGroup, [MarshalAs(UnmanagedType.BStr)] string pwzIdentityInfo, int pftExpiration, int cRoles, ref Guid pRoles, out IntPtr ppwzInvitation);

Calling:

uint hr = PeerGroupCreateInvitation(hGroup, identityInfo, 0, 1, ref PEER_GROUP_ROLE_MEMBER, out pInvitation);

…where PEER_GROUP_ROLE_MEMBER is the System.Guid for this role.

Getting the invitation:

string invitation = Marshal.PtrToStringAuto(pInvitation);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:56:08+00:00Added an answer on May 24, 2026 at 12:56 am

    This is the correct declaration:

    [DllImport("p2p.dll")] 
    public static extern uint PeerGroupCreateInvitation( 
                    IntPtr hGroup,  /* Updated with @RedDude's suggestion */
                    [MarshalAs(UnmanagedType.BStr)] string pwzIdentityInfo, 
                    int pftExpiration, // 32 bit, not 64 bit 
                    int cRoles, 
                    ref Guid pRoles, 
                    out IntPtr ppwzInvitation); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this function from here , which is: // highlight search keywords function
here's my function function getInfo(Description) { return Description; } here Description has <p>Info Summary:<span>2.26PM</span>
I really didn't know what title to give this question, but I'll explain here:
Here is a function I would like to write but am unable to do
There is a function that triggers a callback when finished; I call this function
function get_total_adults() { $sql = SELECT SUM(number_adults_attending) as number_of_adults FROM is_nfo_rsvp; $result = mysql_query($sql)
function Obj1(param) { this.test1 = param || 1; } function Obj2(param, par) { this.test2
I want to be able to understand the standard function description that is provided
I got a long description for my interface function. IMyInterface.cs [Description(Line 1 description content
This is beyond both making sense and my control. That being said here is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.