Home | History | Annotate | Download | only in include
      1 /**
      2  * This file is part of the mingw-w64 runtime package.
      3  * No warranty is given; refer to the file DISCLAIMER within this package.
      4  */
      5 
      6 #ifndef _P2P_H_
      7 #define _P2P_H_
      8 
      9 #include <winapifamily.h>
     10 
     11 #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
     12 #ifndef __WIDL__
     13 #include <winsock2.h>
     14 #include <pnrpns.h>
     15 #include <ws2tcpip.h>
     16 #include <specstrings.h>
     17 #endif
     18 
     19 #ifdef __cplusplus
     20 extern "C" {
     21 #endif
     22 
     23 #if NTDDI_VERSION < 0x06000000
     24 #ifndef NO_P2P_PNRP
     25 #define NO_P2P_PNRP
     26 #endif
     27 
     28 #ifndef NO_P2P_COLLABORATION
     29 #define NO_P2P_COLLABORATION
     30 #endif
     31 #endif
     32 
     33   typedef enum peer_record_change_type_tag {
     34     PEER_RECORD_ADDED = 1,
     35     PEER_RECORD_UPDATED = 2,
     36     PEER_RECORD_DELETED = 3,
     37     PEER_RECORD_EXPIRED = 4,
     38   } PEER_RECORD_CHANGE_TYPE;
     39 
     40   typedef enum peer_connection_status_tag {
     41     PEER_CONNECTED = 1,
     42     PEER_DISCONNECTED = 2,
     43     PEER_CONNECTION_FAILED = 3,
     44   } PEER_CONNECTION_STATUS;
     45 
     46   typedef enum peer_connection_flags_tag {
     47     PEER_CONNECTION_NEIGHBOR = 0x0001,
     48     PEER_CONNECTION_DIRECT = 0x0002,
     49   } PEER_CONNECTION_FLAGS;
     50 
     51   typedef enum peer_record_flags_tag {
     52     PEER_RECORD_FLAG_AUTOREFRESH = 0x0001,
     53     PEER_RECORD_FLAG_DELETED = 0x0002,
     54   } PEER_RECORD_FLAGS;
     55 
     56   typedef
     57 #ifdef __WIDL__
     58   [context_handle]
     59 #endif
     60   void *HPEEREVENT;
     61   typedef HPEEREVENT *PHPEEREVENT;
     62   typedef
     63 #ifdef __WIDL__
     64   [context_handle]
     65 #endif
     66   void *HPEERENUM;
     67   typedef HPEERENUM *PHPEERENUM;
     68   typedef struct peer_version_data_tag {
     69     WORD wVersion;
     70     WORD wHighestVersion;
     71   } PEER_VERSION_DATA,*PPEER_VERSION_DATA;
     72 
     73   typedef struct peer_data_tag {
     74     ULONG cbData;
     75 #ifdef __WIDL__
     76     [size_is (cbData)]
     77 #endif
     78     PBYTE pbData;
     79   } PEER_DATA,*PPEER_DATA;
     80 
     81   typedef const PEER_DATA *PCPEER_DATA;
     82 
     83   typedef struct peer_record_tag {
     84     DWORD dwSize;
     85     GUID type;
     86     GUID id;
     87     DWORD dwVersion;
     88     DWORD dwFlags;
     89     PWSTR pwzCreatorId;
     90     PWSTR pwzModifiedById;
     91     PWSTR pwzAttributes;
     92     FILETIME ftCreation;
     93     FILETIME ftExpiration;
     94     FILETIME ftLastModified;
     95     PEER_DATA securityData;
     96     PEER_DATA data;
     97   } PEER_RECORD,*PPEER_RECORD;
     98   typedef struct peer_address_tag {
     99     DWORD dwSize;
    100     SOCKADDR_IN6 sin6;
    101   } PEER_ADDRESS,*PPEER_ADDRESS;
    102 
    103   typedef const PEER_ADDRESS *PCPEER_ADDRESS;
    104 
    105   typedef struct peer_connection_info_tag {
    106     DWORD dwSize;
    107     DWORD dwFlags;
    108     ULONGLONG ullConnectionId;
    109     ULONGLONG ullNodeId;
    110     PWSTR pwzPeerId;
    111     PEER_ADDRESS address;
    112   } PEER_CONNECTION_INFO;
    113 
    114   typedef struct peer_event_incoming_data_tag {
    115     DWORD dwSize;
    116     ULONGLONG ullConnectionId;
    117     GUID type;
    118     PEER_DATA data;
    119   } PEER_EVENT_INCOMING_DATA,*PPEER_EVENT_INCOMING_DATA;
    120 
    121   typedef struct peer_event_record_change_data_tag {
    122     DWORD dwSize;
    123     PEER_RECORD_CHANGE_TYPE changeType;
    124     GUID recordId;
    125     GUID recordType;
    126   } PEER_EVENT_RECORD_CHANGE_DATA,*PPEER_EVENT_RECORD_CHANGE_DATA;
    127 
    128   typedef struct peer_event_connection_change_data_tag {
    129     DWORD dwSize;
    130     PEER_CONNECTION_STATUS status;
    131     ULONGLONG ullConnectionId;
    132     ULONGLONG ullNodeId;
    133 #if NTDDI_VERSION >= 0x06000000
    134     ULONGLONG ullNextConnectionId;
    135     HRESULT hrConnectionFailedReason;
    136 #endif
    137   } PEER_EVENT_CONNECTION_CHANGE_DATA,*PPEER_EVENT_CONNECTION_CHANGE_DATA;
    138 
    139   typedef struct peer_event_synchronized_data_tag {
    140     DWORD dwSize;
    141     GUID recordType;
    142   } PEER_EVENT_SYNCHRONIZED_DATA,*PPEER_EVENT_SYNCHRONIZED_DATA;
    143 
    144 #if !defined (NO_P2P_GRAPH) && !defined (__WIDL__)
    145 #define PEER_GRAPH_VERSION MAKEWORD (1, 0)
    146 
    147   typedef PVOID HGRAPH,*PHGRAPH;
    148 
    149   typedef enum peer_graph_event_type_tag {
    150     PEER_GRAPH_EVENT_STATUS_CHANGED = 1,
    151     PEER_GRAPH_EVENT_PROPERTY_CHANGED = 2,
    152     PEER_GRAPH_EVENT_RECORD_CHANGED = 3,
    153     PEER_GRAPH_EVENT_DIRECT_CONNECTION = 4,
    154     PEER_GRAPH_EVENT_NEIGHBOR_CONNECTION = 5,
    155     PEER_GRAPH_EVENT_INCOMING_DATA = 6,
    156     PEER_GRAPH_EVENT_CONNECTION_REQUIRED = 7,
    157     PEER_GRAPH_EVENT_NODE_CHANGED = 8,
    158     PEER_GRAPH_EVENT_SYNCHRONIZED = 9,
    159   } PEER_GRAPH_EVENT_TYPE;
    160 
    161   typedef enum peer_node_change_type_tag {
    162     PEER_NODE_CHANGE_CONNECTED = 1,
    163     PEER_NODE_CHANGE_DISCONNECTED = 2,
    164     PEER_NODE_CHANGE_UPDATED = 3,
    165   } PEER_NODE_CHANGE_TYPE;
    166 
    167   typedef enum peer_graph_status_flags_tag {
    168     PEER_GRAPH_STATUS_LISTENING = 0x0001,
    169     PEER_GRAPH_STATUS_HAS_CONNECTIONS = 0x0002,
    170     PEER_GRAPH_STATUS_SYNCHRONIZED = 0x0004,
    171   } PEER_GRAPH_STATUS_FLAGS;
    172 
    173   typedef enum peer_graph_property_flags_tag {
    174     PEER_GRAPH_PROPERTY_HEARTBEATS = 0x0001,
    175     PEER_GRAPH_PROPERTY_DEFER_EXPIRATION = 0x0002,
    176   } PEER_GRAPH_PROPERTY_FLAGS;
    177 
    178   typedef enum peer_graph_scope_tag {
    179     PEER_GRAPH_SCOPE_ANY = 0,
    180     PEER_GRAPH_SCOPE_GLOBAL = 1,
    181     PEER_GRAPH_SCOPE_SITELOCAL = 2,
    182     PEER_GRAPH_SCOPE_LINKLOCAL = 3,
    183     PEER_GRAPH_SCOPE_LOOPBACK = 4
    184   } PEER_GRAPH_SCOPE;
    185 
    186   typedef struct peer_graph_properties_tag {
    187     DWORD dwSize;
    188     DWORD dwFlags;
    189     DWORD dwScope;
    190     DWORD dwMaxRecordSize;
    191     PWSTR pwzGraphId;
    192     PWSTR pwzCreatorId;
    193     PWSTR pwzFriendlyName;
    194     PWSTR pwzComment;
    195     ULONG ulPresenceLifetime;
    196     ULONG cPresenceMax;
    197   } PEER_GRAPH_PROPERTIES,*PPEER_GRAPH_PROPERTIES;
    198 
    199   typedef struct peer_node_info_tag {
    200     DWORD dwSize;
    201     ULONGLONG ullNodeId;
    202     PWSTR pwzPeerId;
    203     ULONG cAddresses;
    204     PPEER_ADDRESS pAddresses;
    205     PWSTR pwzAttributes;
    206   } PEER_NODE_INFO,*PPEER_NODE_INFO;
    207 
    208   typedef struct peer_event_node_change_data_tag {
    209     DWORD dwSize;
    210     PEER_NODE_CHANGE_TYPE changeType;
    211     ULONGLONG ullNodeId;
    212     PWSTR pwzPeerId;
    213   } PEER_EVENT_NODE_CHANGE_DATA,*PPEER_EVENT_NODE_CHANGE_DATA;
    214 
    215   typedef struct peer_graph_event_registration_tag {
    216     PEER_GRAPH_EVENT_TYPE eventType;
    217     GUID *pType;
    218   } PEER_GRAPH_EVENT_REGISTRATION,*PPEER_GRAPH_EVENT_REGISTRATION;
    219 
    220   typedef struct peer_graph_event_data_tag {
    221     PEER_GRAPH_EVENT_TYPE eventType;
    222     __C89_NAMELESS union {
    223       PEER_GRAPH_STATUS_FLAGS dwStatus;
    224       PEER_EVENT_INCOMING_DATA incomingData;
    225       PEER_EVENT_RECORD_CHANGE_DATA recordChangeData;
    226       PEER_EVENT_CONNECTION_CHANGE_DATA connectionChangeData;
    227       PEER_EVENT_NODE_CHANGE_DATA nodeChangeData;
    228       PEER_EVENT_SYNCHRONIZED_DATA synchronizedData;
    229     };
    230   } PEER_GRAPH_EVENT_DATA,*PPEER_GRAPH_EVENT_DATA;
    231 
    232   typedef HRESULT (CALLBACK *PFNPEER_VALIDATE_RECORD) (HGRAPH hGraph, PVOID pvContext, PPEER_RECORD pRecord, PEER_RECORD_CHANGE_TYPE changeType);
    233   typedef HRESULT (CALLBACK *PFNPEER_SECURE_RECORD) (HGRAPH hGraph, PVOID pvContext, PPEER_RECORD pRecord, PEER_RECORD_CHANGE_TYPE changeType, PPEER_DATA *ppSecurityData);
    234   typedef HRESULT (CALLBACK *PFNPEER_FREE_SECURITY_DATA) (HGRAPH hGraph, PVOID pvContext, PPEER_DATA pSecurityData);
    235   typedef HRESULT (CALLBACK *PFNPEER_ON_PASSWORD_AUTH_FAILED) (HGRAPH hGraph, PVOID pvContext);
    236 
    237   typedef struct peer_security_interface_tag {
    238     DWORD dwSize;
    239     PWSTR pwzSspFilename;
    240     PWSTR pwzPackageName;
    241     ULONG cbSecurityInfo;
    242     PBYTE pbSecurityInfo;
    243     PVOID pvContext;
    244     PFNPEER_VALIDATE_RECORD pfnValidateRecord;
    245     PFNPEER_SECURE_RECORD pfnSecureRecord;
    246     PFNPEER_FREE_SECURITY_DATA pfnFreeSecurityData;
    247     PFNPEER_ON_PASSWORD_AUTH_FAILED pfnAuthFailed;
    248   } PEER_SECURITY_INTERFACE,*PPEER_SECURITY_INTERFACE;
    249 
    250   HRESULT WINAPI PeerGraphStartup (WORD wVersionRequested, PPEER_VERSION_DATA pVersionData);
    251   HRESULT WINAPI PeerGraphShutdown ();
    252   VOID WINAPI PeerGraphFreeData (PVOID pvData);
    253   HRESULT WINAPI PeerGraphGetItemCount (HPEERENUM hPeerEnum, ULONG *pCount);
    254   HRESULT WINAPI PeerGraphGetNextItem (HPEERENUM hPeerEnum, ULONG *pCount, PVOID **pppvItems);
    255   HRESULT WINAPI PeerGraphEndEnumeration (HPEERENUM hPeerEnum);
    256   HRESULT WINAPI PeerGraphCreate (PPEER_GRAPH_PROPERTIES pGraphProperties, PCWSTR pwzDatabaseName, PPEER_SECURITY_INTERFACE pSecurityInterface, HGRAPH *phGraph);
    257   HRESULT WINAPI PeerGraphOpen (PCWSTR pwzGraphId, PCWSTR pwzPeerId, PCWSTR pwzDatabaseName, PPEER_SECURITY_INTERFACE pSecurityInterface, ULONG cRecordTypeSyncPrecedence, const GUID *pRecordTypeSyncPrecedence, HGRAPH *phGraph);
    258   HRESULT WINAPI PeerGraphListen (HGRAPH hGraph, DWORD dwScope, DWORD dwScopeId, WORD wPort);
    259   HRESULT WINAPI PeerGraphConnect (HGRAPH hGraph, PCWSTR pwzPeerId, PPEER_ADDRESS pAddress, ULONGLONG *pullConnectionId);
    260   HRESULT WINAPI PeerGraphClose (HGRAPH hGraph);
    261   HRESULT WINAPI PeerGraphDelete (PCWSTR pwzGraphId, PCWSTR pwzPeerId, PCWSTR pwzDatabaseName);
    262   HRESULT WINAPI PeerGraphGetStatus (HGRAPH hGraph, DWORD *pdwStatus);
    263   HRESULT WINAPI PeerGraphGetProperties (HGRAPH hGraph, PPEER_GRAPH_PROPERTIES *ppGraphProperties);
    264   HRESULT WINAPI PeerGraphSetProperties (HGRAPH hGraph, PPEER_GRAPH_PROPERTIES pGraphProperties);
    265   HRESULT WINAPI PeerGraphRegisterEvent (HGRAPH hGraph, HANDLE hEvent, ULONG cEventRegistrations, PEER_GRAPH_EVENT_REGISTRATION *pEventRegistrations, HPEEREVENT *phPeerEvent);
    266   HRESULT WINAPI PeerGraphUnregisterEvent (HPEEREVENT hPeerEvent);
    267   HRESULT WINAPI PeerGraphGetEventData (HPEEREVENT hPeerEvent, PPEER_GRAPH_EVENT_DATA *ppEventData);
    268   HRESULT WINAPI PeerGraphGetRecord (HGRAPH hGraph, const GUID *pRecordId, PPEER_RECORD *ppRecord);
    269   HRESULT WINAPI PeerGraphAddRecord (HGRAPH hGraph, PPEER_RECORD pRecord, GUID *pRecordId);
    270   HRESULT WINAPI PeerGraphUpdateRecord (HGRAPH hGraph, PPEER_RECORD pRecord);
    271   HRESULT WINAPI PeerGraphDeleteRecord (HGRAPH hGraph, const GUID *pRecordId, WINBOOL fLocal);
    272   HRESULT WINAPI PeerGraphEnumRecords (HGRAPH hGraph, const GUID *pRecordType, PCWSTR pwzPeerId, HPEERENUM *phPeerEnum);
    273   HRESULT WINAPI PeerGraphSearchRecords (HGRAPH hGraph, PCWSTR pwzCriteria, HPEERENUM *phPeerEnum);
    274   HRESULT WINAPI PeerGraphExportDatabase (HGRAPH hGraph, PCWSTR pwzFilePath);
    275   HRESULT WINAPI PeerGraphImportDatabase (HGRAPH hGraph, PCWSTR pwzFilePath);
    276   HRESULT WINAPI PeerGraphValidateDeferredRecords (HGRAPH hGraph, ULONG cRecordIds, const GUID *pRecordIds);
    277   HRESULT WINAPI PeerGraphOpenDirectConnection (HGRAPH hGraph, PCWSTR pwzPeerId, PPEER_ADDRESS pAddress, ULONGLONG *pullConnectionId);
    278   HRESULT WINAPI PeerGraphSendData (HGRAPH hGraph, ULONGLONG ullConnectionId, const GUID *pType, ULONG cbData, PVOID pvData);
    279   HRESULT WINAPI PeerGraphCloseDirectConnection (HGRAPH hGraph, ULONGLONG ullConnectionId);
    280   HRESULT WINAPI PeerGraphEnumConnections (HGRAPH hGraph, DWORD dwFlags, HPEERENUM *phPeerEnum);
    281   HRESULT WINAPI PeerGraphEnumNodes (HGRAPH hGraph, PCWSTR pwzPeerId, HPEERENUM *phPeerEnum);
    282   HRESULT WINAPI PeerGraphSetPresence (HGRAPH hGraph, WINBOOL fPresent);
    283   HRESULT WINAPI PeerGraphGetNodeInfo (HGRAPH hGraph, ULONGLONG ullNodeId, PPEER_NODE_INFO *ppNodeInfo);
    284   HRESULT WINAPI PeerGraphSetNodeAttributes (HGRAPH hGraph, PCWSTR pwzAttributes);
    285   HRESULT WINAPI PeerGraphPeerTimeToUniversalTime (HGRAPH hGraph, FILETIME *pftPeerTime, FILETIME *pftUniversalTime);
    286   HRESULT WINAPI PeerGraphUniversalTimeToPeerTime (HGRAPH hGraph, FILETIME *pftUniversalTime, FILETIME *pftPeerTime);
    287 #endif
    288 
    289 #if !(defined (NO_P2P_GROUP) && defined (NO_P2P_IDENTITY)) && !defined (__WIDL__)
    290 #include <wincrypt.h>
    291   VOID WINAPI PeerFreeData (LPCVOID pvData);
    292   HRESULT WINAPI PeerGetItemCount (HPEERENUM hPeerEnum, ULONG *pCount);
    293   HRESULT WINAPI PeerGetNextItem (HPEERENUM hPeerEnum, ULONG *pCount, PVOID **pppvItems);
    294   HRESULT WINAPI PeerEndEnumeration (HPEERENUM hPeerEnum);
    295 #endif
    296 
    297 #ifndef NO_P2P_GROUP
    298   typedef PVOID HGROUP,*PHGROUP;
    299   typedef GUID PEER_ROLE_ID;
    300 #if NTDDI_VERSION >= 0x06000000
    301 #define PEER_GROUP_VERSION MAKEWORD (1, 1)
    302 #else
    303 #define PEER_GROUP_VERSION MAKEWORD (1, 0)
    304 #endif
    305 
    306   typedef enum peer_group_event_type_tag {
    307     PEER_GROUP_EVENT_STATUS_CHANGED = 1,
    308     PEER_GROUP_EVENT_PROPERTY_CHANGED = 2,
    309     PEER_GROUP_EVENT_RECORD_CHANGED = 3,
    310     PEER_GROUP_EVENT_DIRECT_CONNECTION = 4,
    311     PEER_GROUP_EVENT_NEIGHBOR_CONNECTION = 5,
    312     PEER_GROUP_EVENT_INCOMING_DATA = 6,
    313     PEER_GROUP_EVENT_MEMBER_CHANGED = 8,
    314     PEER_GROUP_EVENT_CONNECTION_FAILED = 10,
    315     PEER_GROUP_EVENT_AUTHENTICATION_FAILED = 11
    316   } PEER_GROUP_EVENT_TYPE;
    317 
    318   typedef enum peer_group_status_tag {
    319     PEER_GROUP_STATUS_LISTENING = 0x0001,
    320     PEER_GROUP_STATUS_HAS_CONNECTIONS = 0x0002,
    321   } PEER_GROUP_STATUS;
    322 
    323   typedef enum peer_group_property_flags_tag {
    324     PEER_MEMBER_DATA_OPTIONAL = 0x0001,
    325     PEER_DISABLE_PRESENCE = 0x0002,
    326     PEER_DEFER_EXPIRATION = 0x0004,
    327   } PEER_GROUP_PROPERTY_FLAGS;
    328 
    329 #if NTDDI_VERSION >= 0x06000000
    330   typedef enum peer_group_authentication_scheme_tag {
    331     PEER_GROUP_GMC_AUTHENTICATION = 0x00000001,
    332     PEER_GROUP_PASSWORD_AUTHENTICATION = 0x00000002,
    333   } PEER_GROUP_AUTHENTICATION_SCHEME;
    334 #endif
    335 
    336   typedef enum peer_member_flags_tag {
    337     PEER_MEMBER_PRESENT = 0x0001,
    338   } PEER_MEMBER_FLAGS;
    339 
    340   typedef enum peer_member_change_type_tag {
    341     PEER_MEMBER_CONNECTED = 1,
    342     PEER_MEMBER_DISCONNECTED = 2,
    343     PEER_MEMBER_UPDATED = 3,
    344     PEER_MEMBER_JOINED = 4,
    345     PEER_MEMBER_LEFT = 5,
    346   } PEER_MEMBER_CHANGE_TYPE;
    347 
    348   typedef enum peer_issue_credential_flags_tag {
    349     PEER_GROUP_STORE_CREDENTIALS = 0x0001,
    350   } PEER_GROUP_ISSUE_CREDENTIAL_FLAGS;
    351 
    352 #ifndef __WIDL__
    353   typedef struct peer_credential_info_tag {
    354     DWORD dwSize;
    355     DWORD dwFlags;
    356     PWSTR pwzFriendlyName;
    357     CERT_PUBLIC_KEY_INFO *pPublicKey;
    358     PWSTR pwzIssuerPeerName;
    359     PWSTR pwzIssuerFriendlyName;
    360     FILETIME ftValidityStart;
    361     FILETIME ftValidityEnd;
    362     ULONG cRoles;
    363     PEER_ROLE_ID *pRoles;
    364   } PEER_CREDENTIAL_INFO,*PPEER_CREDENTIAL_INFO;
    365 
    366   typedef struct peer_member_tag {
    367     DWORD dwSize;
    368     DWORD dwFlags;
    369     PWSTR pwzIdentity;
    370     PWSTR pwzAttributes;
    371     ULONGLONG ullNodeId;
    372     ULONG cAddresses;
    373     PEER_ADDRESS *pAddresses;
    374     PEER_CREDENTIAL_INFO *pCredentialInfo;
    375   } PEER_MEMBER,*PPEER_MEMBER;
    376 
    377   typedef struct peer_invitation_info_tag {
    378     DWORD dwSize;
    379     DWORD dwFlags;
    380     PWSTR pwzCloudName;
    381     DWORD dwScope;
    382     DWORD dwCloudFlags;
    383     PWSTR pwzGroupPeerName;
    384     PWSTR pwzIssuerPeerName;
    385     PWSTR pwzSubjectPeerName;
    386     PWSTR pwzGroupFriendlyName;
    387     PWSTR pwzIssuerFriendlyName;
    388     PWSTR pwzSubjectFriendlyName;
    389     FILETIME ftValidityStart;
    390     FILETIME ftValidityEnd;
    391     ULONG cRoles;
    392     PEER_ROLE_ID *pRoles;
    393     ULONG cClassifiers;
    394     PWSTR *ppwzClassifiers;
    395     CERT_PUBLIC_KEY_INFO *pSubjectPublicKey;
    396 #if NTDDI_VERSION >= 0x06000000
    397     PEER_GROUP_AUTHENTICATION_SCHEME authScheme;
    398 #endif
    399   } PEER_INVITATION_INFO,*PPEER_INVITATION_INFO;
    400 #endif
    401 
    402   typedef struct peer_group_properties_tag {
    403     DWORD dwSize;
    404     DWORD dwFlags;
    405     PWSTR pwzCloud;
    406     PWSTR pwzClassifier;
    407     PWSTR pwzGroupPeerName;
    408     PWSTR pwzCreatorPeerName;
    409     PWSTR pwzFriendlyName;
    410     PWSTR pwzComment;
    411     ULONG ulMemberDataLifetime;
    412     ULONG ulPresenceLifetime;
    413 #if NTDDI_VERSION >= 0x06000000
    414     DWORD dwAuthenticationSchemes;
    415     PWSTR pwzGroupPassword;
    416     PEER_ROLE_ID groupPasswordRole;
    417 #endif
    418   } PEER_GROUP_PROPERTIES,*PPEER_GROUP_PROPERTIES;
    419 
    420   typedef struct peer_event_member_change_data_tag {
    421     DWORD dwSize;
    422     PEER_MEMBER_CHANGE_TYPE changeType;
    423     PWSTR pwzIdentity;
    424   } PEER_EVENT_MEMBER_CHANGE_DATA,*PPEER_EVENT_MEMBER_CHANGE_DATA;
    425 
    426   typedef struct peer_group_event_registration_tag {
    427     PEER_GROUP_EVENT_TYPE eventType;
    428     GUID *pType;
    429   } PEER_GROUP_EVENT_REGISTRATION,*PPEER_GROUP_EVENT_REGISTRATION;
    430 
    431 #ifdef __WIDL__
    432   typedef struct peer_group_event_data_tag {
    433     PEER_GROUP_EVENT_TYPE eventType;
    434     [switch_is (eventType)] union {
    435       [case (PEER_GROUP_EVENT_STATUS_CHANGED)] PEER_GROUP_STATUS dwStatus;
    436       [case (PEER_GROUP_EVENT_PROPERTY_CHANGED)] ;
    437       [case (PEER_GROUP_EVENT_RECORD_CHANGED)] PEER_EVENT_RECORD_CHANGE_DATA recordChangeData;
    438       [case (PEER_GROUP_EVENT_NEIGHBOR_CONNECTION, PEER_GROUP_EVENT_DIRECT_CONNECTION)] PEER_EVENT_CONNECTION_CHANGE_DATA connectionChangeData;
    439       [case (PEER_GROUP_EVENT_INCOMING_DATA)] PEER_EVENT_INCOMING_DATA incomingData;
    440       [case (PEER_GROUP_EVENT_MEMBER_CHANGED)] PEER_EVENT_MEMBER_CHANGE_DATA memberChangeData;
    441       [case (PEER_GROUP_EVENT_CONNECTION_FAILED)] HRESULT hrConnectionFailedReason;
    442       [default] ;
    443     };
    444   } PEER_GROUP_EVENT_DATA,*PPEER_GROUP_EVENT_DATA;
    445 #else
    446   typedef struct peer_group_event_data_tag {
    447     PEER_GROUP_EVENT_TYPE eventType;
    448     __C89_NAMELESS union {
    449       PEER_GROUP_STATUS dwStatus;
    450       PEER_EVENT_INCOMING_DATA incomingData;
    451       PEER_EVENT_RECORD_CHANGE_DATA recordChangeData;
    452       PEER_EVENT_CONNECTION_CHANGE_DATA connectionChangeData;
    453       PEER_EVENT_MEMBER_CHANGE_DATA memberChangeData;
    454       HRESULT hrConnectionFailedReason;
    455     };
    456   } PEER_GROUP_EVENT_DATA,*PPEER_GROUP_EVENT_DATA;
    457 #endif
    458 
    459   typedef struct peer_name_pair_tag {
    460     DWORD dwSize;
    461     PWSTR pwzPeerName;
    462     PWSTR pwzFriendlyName;
    463   } PEER_NAME_PAIR,*PPEER_NAME_PAIR;
    464 
    465 #ifndef __WIDL__
    466   HRESULT WINAPI PeerGroupStartup (WORD wVersionRequested, PPEER_VERSION_DATA pVersionData);
    467   HRESULT WINAPI PeerGroupShutdown ();
    468   HRESULT WINAPI PeerGroupCreate (PPEER_GROUP_PROPERTIES pProperties, HGROUP *phGroup);
    469   HRESULT WINAPI PeerGroupOpen (PCWSTR pwzIdentity, PCWSTR pwzGroupPeerName, PCWSTR pwzCloud, HGROUP *phGroup);
    470   HRESULT WINAPI PeerGroupJoin (PCWSTR pwzIdentity, PCWSTR pwzInvitation, PCWSTR pwzCloud, HGROUP *phGroup);
    471   HRESULT WINAPI PeerGroupConnect (HGROUP hGroup);
    472   HRESULT WINAPI PeerGroupClose (HGROUP hGroup);
    473   HRESULT WINAPI PeerGroupDelete (PCWSTR pwzIdentity, PCWSTR pwzGroupPeerName);
    474   HRESULT WINAPI PeerGroupCreateInvitation (HGROUP hGroup, PCWSTR pwzIdentityInfo, FILETIME *pftExpiration, ULONG cRoles, const GUID *pRoles, PWSTR *ppwzInvitation);
    475   HRESULT WINAPI PeerGroupParseInvitation (PCWSTR pwzInvitation, PPEER_INVITATION_INFO *ppInvitationInfo);
    476   HRESULT WINAPI PeerGroupGetStatus (HGROUP hGroup, DWORD *pdwStatus);
    477   HRESULT WINAPI PeerGroupGetProperties (HGROUP hGroup, PPEER_GROUP_PROPERTIES *ppProperties);
    478   HRESULT WINAPI PeerGroupSetProperties (HGROUP hGroup, PPEER_GROUP_PROPERTIES pProperties);
    479   HRESULT WINAPI PeerGroupEnumMembers (HGROUP hGroup, DWORD dwFlags, PCWSTR pwzIdentity, HPEERENUM *phPeerEnum);
    480   HRESULT WINAPI PeerGroupOpenDirectConnection (HGROUP hGroup, PCWSTR pwzIdentity, PPEER_ADDRESS pAddress, ULONGLONG *pullConnectionId);
    481   HRESULT WINAPI PeerGroupCloseDirectConnection (HGROUP hGroup, ULONGLONG ullConnectionId);
    482   HRESULT WINAPI PeerGroupEnumConnections (HGROUP hGroup, DWORD dwFlags, HPEERENUM *phPeerEnum);
    483   HRESULT WINAPI PeerGroupSendData (HGROUP hGroup, ULONGLONG ullConnectionId, const GUID *pType, ULONG cbData, PVOID pvData);
    484   HRESULT WINAPI PeerGroupRegisterEvent (HGROUP hGroup, HANDLE hEvent, DWORD cEventRegistration, PEER_GROUP_EVENT_REGISTRATION *pEventRegistrations, HPEEREVENT *phPeerEvent);
    485   HRESULT WINAPI PeerGroupUnregisterEvent (HPEEREVENT hPeerEvent);
    486   HRESULT WINAPI PeerGroupGetEventData (HPEEREVENT hPeerEvent, PPEER_GROUP_EVENT_DATA *ppEventData);
    487   HRESULT WINAPI PeerGroupGetRecord (HGROUP hGroup, const GUID *pRecordId, PPEER_RECORD *ppRecord);
    488   HRESULT WINAPI PeerGroupAddRecord (HGROUP hGroup, PPEER_RECORD pRecord, GUID *pRecordId);
    489   HRESULT WINAPI PeerGroupUpdateRecord (HGROUP hGroup, PPEER_RECORD pRecord);
    490   HRESULT WINAPI PeerGroupDeleteRecord (HGROUP hGroup, const GUID *pRecordId);
    491   HRESULT WINAPI PeerGroupEnumRecords (HGROUP hGroup, const GUID *pRecordType, HPEERENUM *phPeerEnum);
    492   HRESULT WINAPI PeerGroupSearchRecords (HGROUP hGroup, PCWSTR pwzCriteria, HPEERENUM *phPeerEnum);
    493   HRESULT WINAPI PeerGroupExportDatabase (HGROUP hGroup, PCWSTR pwzFilePath);
    494   HRESULT WINAPI PeerGroupImportDatabase (HGROUP hGroup, PCWSTR pwzFilePath);
    495   HRESULT WINAPI PeerGroupIssueCredentials (HGROUP hGroup, PCWSTR pwzSubjectIdentity, PEER_CREDENTIAL_INFO *pCredentialInfo, DWORD dwFlags, PWSTR *ppwzInvitation);
    496   HRESULT WINAPI PeerGroupExportConfig (HGROUP hGroup, PCWSTR pwzPassword, PWSTR *ppwzXML);
    497   HRESULT WINAPI PeerGroupImportConfig (PCWSTR pwzXML, PCWSTR pwzPassword, WINBOOL fOverwrite, PWSTR *ppwzIdentity, PWSTR *ppwzGroup);
    498   HRESULT WINAPI PeerGroupPeerTimeToUniversalTime (HGROUP hGroup, FILETIME *pftPeerTime, FILETIME *pftUniversalTime);
    499   HRESULT WINAPI PeerGroupUniversalTimeToPeerTime (HGROUP hGroup, FILETIME *pftUniversalTime, FILETIME *pftPeerTime);
    500 #if NTDDI_VERSION >= 0x06000000
    501   HRESULT WINAPI PeerGroupPasswordJoin (PCWSTR pwzIdentity, PCWSTR pwzInvitation, PCWSTR pwzPassword, PCWSTR pwzCloud, HGROUP *phGroup);
    502   HRESULT WINAPI PeerGroupConnectByAddress (HGROUP hGroup, ULONG cAddresses, PPEER_ADDRESS pAddresses);
    503   HRESULT WINAPI PeerGroupCreatePasswordInvitation (HGROUP hGroup, PWSTR *ppwzInvitation);
    504 #endif
    505 #if NTDDI_VERSION >= 0x06010000
    506   HRESULT WINAPI PeerGroupResumePasswordAuthentication (HGROUP hGroup, HPEEREVENT hPeerEventHandle);
    507 #endif
    508 #endif
    509 #endif
    510 
    511 #if !defined (NO_P2P_IDENTITY) && !defined (__WIDL__)
    512   HRESULT WINAPI PeerIdentityCreate (PCWSTR pwzClassifier, PCWSTR pwzFriendlyName, HCRYPTPROV hCryptProv, PWSTR *ppwzIdentity);
    513   HRESULT WINAPI PeerIdentityGetFriendlyName (PCWSTR pwzIdentity, PWSTR *ppwzFriendlyName);
    514   HRESULT WINAPI PeerIdentitySetFriendlyName (PCWSTR pwzIdentity, PCWSTR pwzFriendlyName);
    515   HRESULT WINAPI PeerIdentityGetCryptKey (PCWSTR pwzIdentity, HCRYPTPROV *phCryptProv);
    516   HRESULT WINAPI PeerIdentityDelete (PCWSTR pwzIdentity);
    517   HRESULT WINAPI PeerEnumIdentities (HPEERENUM *phPeerEnum);
    518   HRESULT WINAPI PeerEnumGroups (PCWSTR pwzIdentity, HPEERENUM *phPeerEnum);
    519   HRESULT WINAPI PeerCreatePeerName (PCWSTR pwzIdentity, PCWSTR pwzClassifier, PWSTR *ppwzPeerName);
    520   HRESULT WINAPI PeerIdentityGetXML (PCWSTR pwzIdentity, PWSTR *ppwzIdentityXML);
    521   HRESULT WINAPI PeerIdentityExport (PCWSTR pwzIdentity, PCWSTR pwzPassword, PWSTR *ppwzExportXML);
    522   HRESULT WINAPI PeerIdentityImport (PCWSTR pwzImportXML, PCWSTR pwzPassword, PWSTR *ppwzIdentity);
    523   HRESULT WINAPI PeerIdentityGetDefault (PWSTR *ppwzPeerName);
    524 #endif
    525 
    526 #ifndef NO_P2P_COLLABORATION
    527 #define PEER_COLLAB_VERSION MAKEWORD (1, 0)
    528 
    529   typedef enum peer_signin_flags_tag {
    530     PEER_SIGNIN_NONE = 0x0,
    531     PEER_SIGNIN_NEAR_ME = 0x1,
    532     PEER_SIGNIN_INTERNET = 0x2,
    533     PEER_SIGNIN_ALL = PEER_SIGNIN_INTERNET | PEER_SIGNIN_NEAR_ME
    534   } PEER_SIGNIN_FLAGS;
    535 
    536   typedef enum peer_watch_permission_tag {
    537     PEER_WATCH_BLOCKED = 0,
    538     PEER_WATCH_ALLOWED = 1
    539   } PEER_WATCH_PERMISSION;
    540 
    541   typedef enum peer_publication_scope_tag {
    542     PEER_PUBLICATION_SCOPE_NONE = 0x0,
    543     PEER_PUBLICATION_SCOPE_NEAR_ME = 0x1,
    544     PEER_PUBLICATION_SCOPE_INTERNET = 0x2,
    545     PEER_PUBLICATION_SCOPE_ALL = PEER_PUBLICATION_SCOPE_NEAR_ME | PEER_PUBLICATION_SCOPE_INTERNET
    546   } PEER_PUBLICATION_SCOPE;
    547 
    548   typedef struct peer_application_tag {
    549     GUID id;
    550     PEER_DATA data;
    551     PWSTR pwzDescription;
    552   } PEER_APPLICATION,*PPEER_APPLICATION;
    553 
    554   typedef const PEER_APPLICATION *PCPEER_APPLICATION;
    555 
    556   typedef struct peer_object_tag {
    557     GUID id;
    558     PEER_DATA data;
    559     DWORD dwPublicationScope;
    560   } PEER_OBJECT,*PPEER_OBJECT;
    561 
    562   typedef const PEER_OBJECT *PCPEER_OBJECT;
    563 
    564   typedef struct peer_contact_tag {
    565     PWSTR pwzPeerName;
    566     PWSTR pwzNickName;
    567     PWSTR pwzDisplayName;
    568     PWSTR pwzEmailAddress;
    569     WINBOOL fWatch;
    570     PEER_WATCH_PERMISSION WatcherPermissions;
    571     PEER_DATA credentials;
    572   } PEER_CONTACT,*PPEER_CONTACT;
    573 
    574   typedef const PEER_CONTACT *PCPEER_CONTACT;
    575 
    576   typedef struct peer_endpoint_tag {
    577     PEER_ADDRESS address;
    578     PWSTR pwzEndpointName;
    579   } PEER_ENDPOINT,*PPEER_ENDPOINT;
    580 
    581   typedef const PEER_ENDPOINT *PCPEER_ENDPOINT;
    582 
    583   typedef struct peer_people_near_me_tag {
    584     PWSTR pwzNickName;
    585     PEER_ENDPOINT endpoint;
    586     GUID id;
    587   } PEER_PEOPLE_NEAR_ME,*PPEER_PEOPLE_NEAR_ME;
    588 
    589   typedef const PEER_PEOPLE_NEAR_ME *PCPEER_PEOPLE_NEAR_ME;
    590 
    591   typedef PPEER_PEOPLE_NEAR_ME *PPPEER_PEOPLE_NEAR_ME;
    592 
    593 #ifndef __WIDL__
    594   HRESULT WINAPI PeerCollabStartup (WORD wVersionRequested);
    595   HRESULT WINAPI PeerCollabShutdown ();
    596   HRESULT WINAPI PeerCollabSignin (HWND hwndParent, DWORD dwSigninOptions);
    597   HRESULT WINAPI PeerCollabSignout (DWORD dwSigninOptions);
    598   HRESULT WINAPI PeerCollabGetSigninOptions (DWORD *pdwSigninOptions);
    599 #endif
    600 
    601   typedef enum peer_invitation_response_type_tag {
    602     PEER_INVITATION_RESPONSE_DECLINED = 0,
    603     PEER_INVITATION_RESPONSE_ACCEPTED = 1,
    604     PEER_INVITATION_RESPONSE_EXPIRED = 2,
    605     PEER_INVITATION_RESPONSE_ERROR = 3
    606   } PEER_INVITATION_RESPONSE_TYPE;
    607 
    608   typedef enum peer_application_registration_type_tag {
    609     PEER_APPLICATION_CURRENT_USER = 0,
    610     PEER_APPLICATION_ALL_USERS = 1
    611   } PEER_APPLICATION_REGISTRATION_TYPE;
    612 
    613   typedef struct peer_invitation_tag {
    614     GUID applicationId;
    615     PEER_DATA applicationData;
    616     PWSTR pwzMessage;
    617   } PEER_INVITATION,*PPEER_INVITATION;
    618 
    619   typedef const PEER_INVITATION *PCPEER_INVITATION;
    620 
    621   typedef struct peer_invitation_response_tag {
    622     PEER_INVITATION_RESPONSE_TYPE action;
    623     PWSTR pwzMessage;
    624     HRESULT hrExtendedInfo;
    625   } PEER_INVITATION_RESPONSE,*PPEER_INVITATION_RESPONSE;
    626 
    627   typedef const PEER_INVITATION_RESPONSE *PCPEER_INVITATION_RESPONSE;
    628 
    629   typedef struct peer_app_launch_info_tag {
    630     PPEER_CONTACT pContact;
    631     PPEER_ENDPOINT pEndpoint;
    632     PPEER_INVITATION pInvitation;
    633   } PEER_APP_LAUNCH_INFO,*PPEER_APP_LAUNCH_INFO;
    634 
    635   typedef const PEER_APP_LAUNCH_INFO *PCPEER_APP_LAUNCH_INFO;
    636 
    637   typedef struct peer_application_registration_info_tag {
    638     PEER_APPLICATION application;
    639     PWSTR pwzApplicationToLaunch;
    640     PWSTR pwzApplicationArguments;
    641     DWORD dwPublicationScope;
    642   } PEER_APPLICATION_REGISTRATION_INFO,*PPEER_APPLICATION_REGISTRATION_INFO;
    643 
    644   typedef const PEER_APPLICATION_REGISTRATION_INFO *PCPEER_APPLICATION_REGISTRATION_INFO;
    645 
    646 #ifndef __WIDL__
    647   HRESULT WINAPI PeerCollabAsyncInviteContact (PCPEER_CONTACT pcContact, PCPEER_ENDPOINT pcEndpoint, PCPEER_INVITATION pcInvitation, HANDLE hEvent, HANDLE *phInvitation);
    648   HRESULT WINAPI PeerCollabGetInvitationResponse (HANDLE hInvitation, PPEER_INVITATION_RESPONSE *ppInvitationResponse);
    649   HRESULT WINAPI PeerCollabCancelInvitation (HANDLE hInvitation);
    650   HRESULT WINAPI PeerCollabCloseHandle (HANDLE hInvitation);
    651   HRESULT WINAPI PeerCollabInviteContact (PCPEER_CONTACT pcContact, PCPEER_ENDPOINT pcEndpoint, PCPEER_INVITATION pcInvitation, PPEER_INVITATION_RESPONSE *ppResponse);
    652   HRESULT WINAPI PeerCollabAsyncInviteEndpoint (PCPEER_ENDPOINT pcEndpoint, PCPEER_INVITATION pcInvitation, HANDLE hEvent, HANDLE *phInvitation);
    653   HRESULT WINAPI PeerCollabInviteEndpoint (PCPEER_ENDPOINT pcEndpoint, PCPEER_INVITATION pcInvitation, PPEER_INVITATION_RESPONSE *ppResponse);
    654   HRESULT WINAPI PeerCollabGetAppLaunchInfo (PPEER_APP_LAUNCH_INFO *ppLaunchInfo);
    655   HRESULT WINAPI PeerCollabRegisterApplication (PCPEER_APPLICATION_REGISTRATION_INFO pcApplication, PEER_APPLICATION_REGISTRATION_TYPE registrationType);
    656   HRESULT WINAPI PeerCollabUnregisterApplication (const GUID *pApplicationId, PEER_APPLICATION_REGISTRATION_TYPE registrationType);
    657   HRESULT WINAPI PeerCollabGetApplicationRegistrationInfo (const GUID *pApplicationId, PEER_APPLICATION_REGISTRATION_TYPE registrationType, PPEER_APPLICATION_REGISTRATION_INFO *ppApplication);
    658   HRESULT WINAPI PeerCollabEnumApplicationRegistrationInfo (PEER_APPLICATION_REGISTRATION_TYPE registrationType, HPEERENUM *phPeerEnum);
    659 #endif
    660 
    661   typedef enum peer_presence_status_tag {
    662     PEER_PRESENCE_OFFLINE = 0,
    663     PEER_PRESENCE_OUT_TO_LUNCH = 1,
    664     PEER_PRESENCE_AWAY = 2,
    665     PEER_PRESENCE_BE_RIGHT_BACK = 3,
    666     PEER_PRESENCE_IDLE = 4,
    667     PEER_PRESENCE_BUSY = 5,
    668     PEER_PRESENCE_ON_THE_PHONE = 6,
    669     PEER_PRESENCE_ONLINE = 7
    670   } PEER_PRESENCE_STATUS;
    671 
    672   typedef struct peer_presence_info_tag {
    673     PEER_PRESENCE_STATUS status;
    674     PWSTR pwzDescriptiveText;
    675   } PEER_PRESENCE_INFO,*PPEER_PRESENCE_INFO;
    676 
    677   typedef const PEER_PRESENCE_INFO *PCPEER_PRESENCE_INFO;
    678 
    679 #ifndef __WIDL__
    680   HRESULT WINAPI PeerCollabGetPresenceInfo (PCPEER_ENDPOINT pcEndpoint, PPEER_PRESENCE_INFO *ppPresenceInfo);
    681   HRESULT WINAPI PeerCollabEnumApplications (PCPEER_ENDPOINT pcEndpoint, const GUID *pApplicationId, HPEERENUM *phPeerEnum);
    682   HRESULT WINAPI PeerCollabEnumObjects (PCPEER_ENDPOINT pcEndpoint, const GUID *pObjectId, HPEERENUM *phPeerEnum);
    683   HRESULT WINAPI PeerCollabEnumEndpoints (PCPEER_CONTACT pcContact, HPEERENUM *phPeerEnum);
    684   HRESULT WINAPI PeerCollabRefreshEndpointData (PCPEER_ENDPOINT pcEndpoint);
    685   HRESULT WINAPI PeerCollabDeleteEndpointData (PCPEER_ENDPOINT pcEndpoint);
    686   HRESULT WINAPI PeerCollabQueryContactData (PCPEER_ENDPOINT pcEndpoint, PWSTR *ppwzContactData);
    687   HRESULT WINAPI PeerCollabSubscribeEndpointData (const PCPEER_ENDPOINT pcEndpoint);
    688   HRESULT WINAPI PeerCollabUnsubscribeEndpointData (const PCPEER_ENDPOINT pcEndpoint);
    689   HRESULT WINAPI PeerCollabSetPresenceInfo (PCPEER_PRESENCE_INFO pcPresenceInfo);
    690   HRESULT WINAPI PeerCollabGetEndpointName (PWSTR *ppwzEndpointName);
    691   HRESULT WINAPI PeerCollabSetEndpointName (PCWSTR pwzEndpointName);
    692   HRESULT WINAPI PeerCollabSetObject (PCPEER_OBJECT pcObject);
    693   HRESULT WINAPI PeerCollabDeleteObject (const GUID *pObjectId);
    694 #endif
    695 
    696   typedef enum peer_change_type_tag {
    697     PEER_CHANGE_ADDED = 0,
    698     PEER_CHANGE_DELETED = 1,
    699     PEER_CHANGE_UPDATED = 2
    700   } PEER_CHANGE_TYPE;
    701 
    702   typedef enum peer_collab_event_type_tag {
    703     PEER_EVENT_WATCHLIST_CHANGED = 1,
    704     PEER_EVENT_ENDPOINT_CHANGED = 2,
    705     PEER_EVENT_ENDPOINT_PRESENCE_CHANGED = 3,
    706     PEER_EVENT_ENDPOINT_APPLICATION_CHANGED = 4,
    707     PEER_EVENT_ENDPOINT_OBJECT_CHANGED = 5,
    708     PEER_EVENT_MY_ENDPOINT_CHANGED = 6,
    709     PEER_EVENT_MY_PRESENCE_CHANGED = 7,
    710     PEER_EVENT_MY_APPLICATION_CHANGED = 8,
    711     PEER_EVENT_MY_OBJECT_CHANGED = 9,
    712     PEER_EVENT_PEOPLE_NEAR_ME_CHANGED = 10,
    713     PEER_EVENT_REQUEST_STATUS_CHANGED = 11
    714   } PEER_COLLAB_EVENT_TYPE;
    715 
    716   typedef struct peer_collab_event_registration_tag {
    717     PEER_COLLAB_EVENT_TYPE eventType;
    718 #ifdef __WIDL__
    719     [unique]
    720 #endif
    721     GUID *pInstance;
    722   } PEER_COLLAB_EVENT_REGISTRATION,*PPEER_COLLAB_EVENT_REGISTRATION;
    723 
    724   typedef struct peer_event_watchlist_changed_data_tag {
    725     PPEER_CONTACT pContact;
    726     PEER_CHANGE_TYPE changeType;
    727   } PEER_EVENT_WATCHLIST_CHANGED_DATA,*PPEER_EVENT_WATCHLIST_CHANGED_DATA;
    728 
    729   typedef struct peer_event_presence_changed_data_tag {
    730     PPEER_CONTACT pContact;
    731     PPEER_ENDPOINT pEndpoint;
    732     PEER_CHANGE_TYPE changeType;
    733     PPEER_PRESENCE_INFO pPresenceInfo;
    734   } PEER_EVENT_PRESENCE_CHANGED_DATA,*PPEER_EVENT_PRESENCE_CHANGED_DATA;
    735 
    736   typedef struct peer_event_application_changed_data_tag {
    737     PPEER_CONTACT pContact;
    738     PPEER_ENDPOINT pEndpoint;
    739     PEER_CHANGE_TYPE changeType;
    740     PPEER_APPLICATION pApplication;
    741   } PEER_EVENT_APPLICATION_CHANGED_DATA,*PPEER_EVENT_APPLICATION_CHANGED_DATA;
    742 
    743   typedef struct peer_event_object_changed_data_tag {
    744     PPEER_CONTACT pContact;
    745     PPEER_ENDPOINT pEndpoint;
    746     PEER_CHANGE_TYPE changeType;
    747     PPEER_OBJECT pObject;
    748   } PEER_EVENT_OBJECT_CHANGED_DATA,*PPEER_EVENT_OBJECT_CHANGED_DATA;
    749 
    750   typedef struct peer_event_endpoint_changed_data_tag {
    751     PPEER_CONTACT pContact;
    752     PPEER_ENDPOINT pEndpoint;
    753   } PEER_EVENT_ENDPOINT_CHANGED_DATA,*PPEER_EVENT_ENDPOINT_CHANGED_DATA;
    754 
    755   typedef struct peer_event_people_near_me_changed_data_tag {
    756     PEER_CHANGE_TYPE changeType;
    757     PPEER_PEOPLE_NEAR_ME pPeopleNearMe;
    758   } PEER_EVENT_PEOPLE_NEAR_ME_CHANGED_DATA,*PPEER_EVENT_PEOPLE_NEAR_ME_CHANGED_DATA;
    759 
    760   typedef struct peer_event_request_status_changed_data_tag {
    761     PPEER_ENDPOINT pEndpoint;
    762     HRESULT hrChange;
    763   } PEER_EVENT_REQUEST_STATUS_CHANGED_DATA,*PPEER_EVENT_REQUEST_STATUS_CHANGED_DATA;
    764 
    765 #ifdef __WIDL__
    766   typedef struct peer_collab_event_data_tag {
    767     PEER_COLLAB_EVENT_TYPE eventType;
    768     [switch_is (eventType)]
    769     union {
    770       [case (PEER_EVENT_WATCHLIST_CHANGED)] PEER_EVENT_WATCHLIST_CHANGED_DATA watchListChangedData;
    771       [case (PEER_EVENT_ENDPOINT_PRESENCE_CHANGED, PEER_EVENT_MY_PRESENCE_CHANGED)] PEER_EVENT_PRESENCE_CHANGED_DATA presenceChangedData;
    772       [case (PEER_EVENT_ENDPOINT_APPLICATION_CHANGED, PEER_EVENT_MY_APPLICATION_CHANGED)] PEER_EVENT_APPLICATION_CHANGED_DATA applicationChangedData;
    773       [case (PEER_EVENT_ENDPOINT_OBJECT_CHANGED, PEER_EVENT_MY_OBJECT_CHANGED)] PEER_EVENT_OBJECT_CHANGED_DATA objectChangedData;
    774       [case (PEER_EVENT_ENDPOINT_CHANGED, PEER_EVENT_MY_ENDPOINT_CHANGED)] PEER_EVENT_ENDPOINT_CHANGED_DATA endpointChangedData;
    775       [case (PEER_EVENT_PEOPLE_NEAR_ME_CHANGED)] PEER_EVENT_PEOPLE_NEAR_ME_CHANGED_DATA peopleNearMeChangedData;
    776       [case (PEER_EVENT_REQUEST_STATUS_CHANGED)] PEER_EVENT_REQUEST_STATUS_CHANGED_DATA requestStatusChangedData;
    777       [default] ;
    778     };
    779   } PEER_COLLAB_EVENT_DATA,*PPEER_COLLAB_EVENT_DATA;
    780 #else
    781   typedef struct peer_collab_event_data_tag {
    782     PEER_COLLAB_EVENT_TYPE eventType;
    783     __C89_NAMELESS union {
    784       PEER_EVENT_WATCHLIST_CHANGED_DATA watchListChangedData;
    785       PEER_EVENT_PRESENCE_CHANGED_DATA presenceChangedData;
    786       PEER_EVENT_APPLICATION_CHANGED_DATA applicationChangedData;
    787       PEER_EVENT_OBJECT_CHANGED_DATA objectChangedData;
    788       PEER_EVENT_ENDPOINT_CHANGED_DATA endpointChangedData;
    789       PEER_EVENT_PEOPLE_NEAR_ME_CHANGED_DATA peopleNearMeChangedData;
    790       PEER_EVENT_REQUEST_STATUS_CHANGED_DATA requestStatusChangedData;
    791     };
    792   } PEER_COLLAB_EVENT_DATA,*PPEER_COLLAB_EVENT_DATA;
    793 
    794   HRESULT WINAPI PeerCollabRegisterEvent (HANDLE hEvent, DWORD cEventRegistration, PEER_COLLAB_EVENT_REGISTRATION *pEventRegistrations, HPEEREVENT *phPeerEvent);
    795   HRESULT WINAPI PeerCollabGetEventData (HPEEREVENT hPeerEvent, PPEER_COLLAB_EVENT_DATA *ppEventData);
    796   HRESULT WINAPI PeerCollabUnregisterEvent (HPEEREVENT hPeerEvent);
    797   HRESULT WINAPI PeerCollabEnumPeopleNearMe (HPEERENUM *phPeerEnum);
    798   HRESULT WINAPI PeerCollabAddContact (PCWSTR pwzContactData, PPEER_CONTACT *ppContact);
    799   HRESULT WINAPI PeerCollabDeleteContact (PCWSTR pwzPeerName);
    800   HRESULT WINAPI PeerCollabGetContact (PCWSTR pwzPeerName, PPEER_CONTACT *ppContact);
    801   HRESULT WINAPI PeerCollabUpdateContact (PCPEER_CONTACT pContact);
    802   HRESULT WINAPI PeerCollabEnumContacts (HPEERENUM *phPeerEnum);
    803   HRESULT WINAPI PeerCollabExportContact (PCWSTR pwzPeerName, PWSTR *ppwzContactData);
    804   HRESULT WINAPI PeerCollabParseContact (PCWSTR pwzContactData, PPEER_CONTACT *ppContact);
    805 #endif
    806 #endif
    807 
    808 #if !defined (NO_P2P_PNRP) && !defined (__WIDL__)
    809 #define PNRP_VERSION MAKEWORD (2, 0)
    810 
    811 #define PEER_PNRP_ALL_LINK_CLOUDS L"PEER_PNRP_ALL_LINKS"
    812 #define PEER_PNRP_AUTO_ADDRESSES ((ULONG) (-1))
    813 
    814   typedef PVOID HRESOLUTION, HREGISTRATION;
    815 
    816   typedef struct peer_pnrp_endpoint_info_tag {
    817     PWSTR pwzPeerName;
    818     ULONG cAddresses;
    819     SOCKADDR **ppAddresses;
    820     PWSTR pwzComment;
    821     PEER_DATA payload;
    822   } PEER_PNRP_ENDPOINT_INFO,*PPEER_PNRP_ENDPOINT_INFO;
    823 
    824   typedef struct peer_pnrp_cloud_info_tag {
    825     PWSTR pwzCloudName;
    826     PNRP_SCOPE dwScope;
    827     DWORD dwScopeId;
    828   } PEER_PNRP_CLOUD_INFO,*PPEER_PNRP_CLOUD_INFO;
    829 
    830   typedef struct peer_pnrp_registration_info_tag {
    831     PWSTR pwzCloudName;
    832     PWSTR pwzPublishingIdentity;
    833     ULONG cAddresses;
    834     SOCKADDR **ppAddresses;
    835     WORD wPort;
    836     PWSTR pwzComment;
    837     PEER_DATA payload;
    838   } PEER_PNRP_REGISTRATION_INFO,*PPEER_PNRP_REGISTRATION_INFO;
    839 
    840   HRESULT WINAPI PeerNameToPeerHostName (PCWSTR pwzPeerName, PWSTR *ppwzHostName);
    841   HRESULT WINAPI PeerHostNameToPeerName (PCWSTR pwzHostName, PWSTR *ppwzPeerName);
    842   HRESULT WINAPI PeerPnrpStartup (WORD wVersionRequested);
    843   HRESULT WINAPI PeerPnrpShutdown ();
    844   HRESULT WINAPI PeerPnrpRegister (PCWSTR pcwzPeerName, PPEER_PNRP_REGISTRATION_INFO pRegistrationInfo, HREGISTRATION *phRegistration);
    845   HRESULT WINAPI PeerPnrpUpdateRegistration (HREGISTRATION hRegistration, PPEER_PNRP_REGISTRATION_INFO pRegistrationInfo);
    846   HRESULT WINAPI PeerPnrpUnregister (HREGISTRATION hRegistration);
    847   HRESULT WINAPI PeerPnrpResolve (PCWSTR pcwzPeerName, PCWSTR pcwzCloudName, ULONG *pcEndpoints, PPEER_PNRP_ENDPOINT_INFO *ppEndpoints);
    848   HRESULT WINAPI PeerPnrpStartResolve (PCWSTR pcwzPeerName, PCWSTR pcwzCloudName, ULONG cMaxEndpoints, HANDLE hEvent, HRESOLUTION *phResolve);
    849   HRESULT WINAPI PeerPnrpGetCloudInfo (ULONG *pcNumClouds, PPEER_PNRP_CLOUD_INFO *ppCloudInfo);
    850   HRESULT WINAPI PeerPnrpGetEndpoint (HRESOLUTION hResolve, PPEER_PNRP_ENDPOINT_INFO *ppEndpoint);
    851   HRESULT WINAPI PeerPnrpEndResolve (HRESOLUTION hResolve);
    852 #endif
    853 
    854 #ifdef __cplusplus
    855 }
    856 #endif
    857 
    858 #define WSA_PNRP_ERROR_BASE 11500
    859 #define WSA_PNRP_CLOUD_NOT_FOUND (WSA_PNRP_ERROR_BASE + 1)
    860 #define WSA_PNRP_CLOUD_DISABLED (WSA_PNRP_ERROR_BASE + 2)
    861 #define WSA_PNRP_INVALID_IDENTITY (WSA_PNRP_ERROR_BASE + 3)
    862 #define WSA_PNRP_TOO_MUCH_LOAD (WSA_PNRP_ERROR_BASE + 4)
    863 #define WSA_PNRP_CLOUD_IS_SEARCH_ONLY (WSA_PNRP_ERROR_BASE + 5)
    864 #define WSA_PNRP_CLIENT_INVALID_COMPARTMENT_ID (WSA_PNRP_ERROR_BASE + 6)
    865 #define WSA_PNRP_DUPLICATE_PEER_NAME (WSA_PNRP_ERROR_BASE + 8)
    866 #define WSA_PNRP_CLOUD_IS_DEAD (WSA_PNRP_ERROR_BASE + 9)
    867 
    868 #define PEER_E_CLOUD_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, WSA_PNRP_CLOUD_NOT_FOUND)
    869 #define PEER_E_CLOUD_DISABLED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, WSA_PNRP_CLOUD_DISABLED)
    870 #define PEER_E_INVALID_IDENTITY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, WSA_PNRP_INVALID_IDENTITY)
    871 #define PEER_E_TOO_MUCH_LOAD MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, WSA_PNRP_TOO_MUCH_LOAD)
    872 #define PEER_E_CLOUD_IS_SEARCH_ONLY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, WSA_PNRP_CLOUD_IS_SEARCH_ONLY)
    873 #define PEER_E_CLIENT_INVALID_COMPARTMENT_ID MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, WSA_PNRP_CLIENT_INVALID_COMPARTMENT_ID)
    874 #define PEER_E_DUPLICATE_PEER_NAME MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, WSA_PNRP_DUPLICATE_PEER_NAME)
    875 #define PEER_E_CLOUD_IS_DEAD MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, WSA_PNRP_CLOUD_IS_DEAD)
    876 #define PEER_E_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_FOUND)
    877 #define PEER_E_DISK_FULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_DISK_FULL)
    878 #define PEER_E_ALREADY_EXISTS MAKE_HRESULT (SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_EXISTS)
    879 #endif
    880 #endif
    881 
    882 #ifdef DEFINE_GUID
    883 #ifndef NO_P2P_GROUP
    884 DEFINE_GUID (PEER_GROUP_ROLE_ADMIN, 0x04387127, 0xaa56, 0x450a, 0x8c, 0xe5, 0x4f, 0x56, 0x5c, 0x67, 0x90, 0xf4);
    885 DEFINE_GUID (PEER_GROUP_ROLE_MEMBER, 0xf12dc4c7, 0x0857, 0x4ca0, 0x93, 0xfc, 0xb1, 0xbb, 0x19, 0xa3, 0xd8, 0xc2);
    886 #if NTDDI_VERSION >= 0x06000000
    887 DEFINE_GUID (PEER_GROUP_ROLE_INVITING_MEMBER, 0x4370fd89, 0xdc18, 0x4cfb, 0x8d, 0xbf, 0x98, 0x53, 0xa8, 0xa9, 0xf9, 0x05);
    888 #endif
    889 #endif
    890 #ifndef NO_P2P_COLLABORATION
    891 DEFINE_GUID (PEER_COLLAB_OBJECTID_USER_PICTURE, 0xdd15f41f, 0xfc4e, 0x4922, 0xb0, 0x35, 0x4c, 0x06, 0xa7, 0x54, 0xd0, 0x1d);
    892 #endif
    893 #endif
    894