Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef _NSPAPI_INCLUDED
      7 #define _NSPAPI_INCLUDED
      8 
      9 #include <_mingw_unicode.h>
     10 
     11 #ifdef __cplusplus
     12 extern "C" {
     13 #endif
     14 
     15 #ifndef _tagBLOB_DEFINED
     16 #define _tagBLOB_DEFINED
     17 #define _BLOB_DEFINED
     18 #define _LPBLOB_DEFINED
     19   typedef struct _BLOB {
     20     ULONG cbSize;
     21     BYTE *pBlobData;
     22   } BLOB,*LPBLOB;
     23 #endif
     24 
     25 #ifndef GUID_DEFINED
     26 #define GUID_DEFINED
     27   typedef struct _GUID {
     28     unsigned __LONG32 Data1;
     29     unsigned short Data2;
     30     unsigned short Data3;
     31     unsigned char Data4[8];
     32   } GUID;
     33 #endif
     34 
     35 #ifndef __LPGUID_DEFINED__
     36 #define __LPGUID_DEFINED__
     37   typedef GUID *LPGUID;
     38 #endif
     39 
     40 #define SERVICE_RESOURCE (0x00000001)
     41 #define SERVICE_SERVICE (0x00000002)
     42 #define SERVICE_LOCAL (0x00000004)
     43 
     44 #define SERVICE_REGISTER (0x00000001)
     45 #define SERVICE_DEREGISTER (0x00000002)
     46 #define SERVICE_FLUSH (0x00000003)
     47 #define SERVICE_ADD_TYPE (0x00000004)
     48 #define SERVICE_DELETE_TYPE (0x00000005)
     49 
     50 #define SERVICE_FLAG_DEFER (0x00000001)
     51 #define SERVICE_FLAG_HARD (0x00000002)
     52 
     53 #define PROP_COMMENT (0x00000001)
     54 #define PROP_LOCALE (0x00000002)
     55 #define PROP_DISPLAY_HINT (0x00000004)
     56 #define PROP_VERSION (0x00000008)
     57 #define PROP_START_TIME (0x00000010)
     58 #define PROP_MACHINE (0x00000020)
     59 #define PROP_ADDRESSES (0x00000100)
     60 #define PROP_SD (0x00000200)
     61 #define PROP_ALL (0x80000000)
     62 
     63 #define SERVICE_ADDRESS_FLAG_RPC_CN (0x00000001)
     64 #define SERVICE_ADDRESS_FLAG_RPC_DG (0x00000002)
     65 #define SERVICE_ADDRESS_FLAG_RPC_NB (0x00000004)
     66 
     67 #define NS_DEFAULT (0)
     68 
     69 #define NS_SAP (1)
     70 #define NS_NDS (2)
     71 #define NS_PEER_BROWSE (3)
     72 
     73 #define NS_TCPIP_LOCAL (10)
     74 #define NS_TCPIP_HOSTS (11)
     75 #define NS_DNS (12)
     76 #define NS_NETBT (13)
     77 #define NS_WINS (14)
     78 
     79 #define NS_NBP (20)
     80 
     81 #define NS_MS (30)
     82 #define NS_STDA (31)
     83 #define NS_NTDS (32)
     84 
     85 #define NS_X500 (40)
     86 #define NS_NIS (41)
     87 
     88 #define NS_VNS (50)
     89 
     90 #define NSTYPE_HIERARCHICAL (0x00000001)
     91 #define NSTYPE_DYNAMIC (0x00000002)
     92 #define NSTYPE_ENUMERABLE (0x00000004)
     93 #define NSTYPE_WORKGROUP (0x00000008)
     94 
     95 #define XP_CONNECTIONLESS (0x00000001)
     96 #define XP_GUARANTEED_DELIVERY (0x00000002)
     97 #define XP_GUARANTEED_ORDER (0x00000004)
     98 #define XP_MESSAGE_ORIENTED (0x00000008)
     99 #define XP_PSEUDO_STREAM (0x00000010)
    100 #define XP_GRACEFUL_CLOSE (0x00000020)
    101 #define XP_EXPEDITED_DATA (0x00000040)
    102 #define XP_CONNECT_DATA (0x00000080)
    103 #define XP_DISCONNECT_DATA (0x00000100)
    104 #define XP_SUPPORTS_BROADCAST (0x00000200)
    105 #define XP_SUPPORTS_MULTICAST (0x00000400)
    106 #define XP_BANDWIDTH_ALLOCATION (0x00000800)
    107 #define XP_FRAGMENTATION (0x00001000)
    108 #define XP_ENCRYPTS (0x00002000)
    109 
    110 #define RES_SOFT_SEARCH (0x00000001)
    111 #define RES_FIND_MULTIPLE (0x00000002)
    112 #define RES_SERVICE (0x00000004)
    113 
    114 #define SERVICE_TYPE_VALUE_SAPIDA "SapId"
    115 #define SERVICE_TYPE_VALUE_SAPIDW L"SapId"
    116 
    117 #define SERVICE_TYPE_VALUE_CONNA "ConnectionOriented"
    118 #define SERVICE_TYPE_VALUE_CONNW L"ConnectionOriented"
    119 
    120 #define SERVICE_TYPE_VALUE_TCPPORTA "TcpPort"
    121 #define SERVICE_TYPE_VALUE_TCPPORTW L"TcpPort"
    122 
    123 #define SERVICE_TYPE_VALUE_UDPPORTA "UdpPort"
    124 #define SERVICE_TYPE_VALUE_UDPPORTW L"UdpPort"
    125 
    126 #define SERVICE_TYPE_VALUE_SAPID __MINGW_NAME_AW(SERVICE_TYPE_VALUE_SAPID)
    127 #define SERVICE_TYPE_VALUE_CONN __MINGW_NAME_AW(SERVICE_TYPE_VALUE_CONN)
    128 #define SERVICE_TYPE_VALUE_TCPPORT __MINGW_NAME_AW(SERVICE_TYPE_VALUE_TCPPORT)
    129 #define SERVICE_TYPE_VALUE_UDPPORT __MINGW_NAME_AW(SERVICE_TYPE_VALUE_UDPPORT)
    130 
    131 #define SET_SERVICE_PARTIAL_SUCCESS (0x00000001)
    132 
    133   typedef struct _NS_INFOA {
    134     DWORD dwNameSpace;
    135     DWORD dwNameSpaceFlags;
    136     LPSTR lpNameSpace;
    137   } NS_INFOA,*PNS_INFOA,*LPNS_INFOA;
    138 
    139   typedef struct _NS_INFOW {
    140     DWORD dwNameSpace;
    141     DWORD dwNameSpaceFlags;
    142     LPWSTR lpNameSpace;
    143   } NS_INFOW,*PNS_INFOW,*LPNS_INFOW;
    144 
    145   __MINGW_TYPEDEF_AW(NS_INFO)
    146   __MINGW_TYPEDEF_AW(PNS_INFO)
    147   __MINGW_TYPEDEF_AW(LPNS_INFO)
    148 
    149   typedef struct _SERVICE_TYPE_VALUE {
    150     DWORD dwNameSpace;
    151     DWORD dwValueType;
    152     DWORD dwValueSize;
    153     DWORD dwValueNameOffset;
    154     DWORD dwValueOffset;
    155   } SERVICE_TYPE_VALUE,*PSERVICE_TYPE_VALUE,*LPSERVICE_TYPE_VALUE;
    156 
    157   typedef struct _SERVICE_TYPE_VALUE_ABSA {
    158     DWORD dwNameSpace;
    159     DWORD dwValueType;
    160     DWORD dwValueSize;
    161     LPSTR lpValueName;
    162     PVOID lpValue;
    163   } SERVICE_TYPE_VALUE_ABSA,*PSERVICE_TYPE_VALUE_ABSA,*LPSERVICE_TYPE_VALUE_ABSA;
    164 
    165   typedef struct _SERVICE_TYPE_VALUE_ABSW {
    166     DWORD dwNameSpace;
    167     DWORD dwValueType;
    168     DWORD dwValueSize;
    169     LPWSTR lpValueName;
    170     PVOID lpValue;
    171   } SERVICE_TYPE_VALUE_ABSW,*PSERVICE_TYPE_VALUE_ABSW,*LPSERVICE_TYPE_VALUE_ABSW;
    172 
    173   __MINGW_TYPEDEF_AW(SERVICE_TYPE_VALUE_ABS)
    174   __MINGW_TYPEDEF_AW(PSERVICE_TYPE_VALUE_ABS)
    175   __MINGW_TYPEDEF_AW(LPSERVICE_TYPE_VALUE_ABS)
    176 
    177   typedef struct _SERVICE_TYPE_INFO {
    178     DWORD dwTypeNameOffset;
    179     DWORD dwValueCount;
    180     SERVICE_TYPE_VALUE Values[1];
    181   } SERVICE_TYPE_INFO,*PSERVICE_TYPE_INFO,*LPSERVICE_TYPE_INFO;
    182 
    183   typedef struct _SERVICE_TYPE_INFO_ABSA {
    184     LPSTR lpTypeName;
    185     DWORD dwValueCount;
    186     SERVICE_TYPE_VALUE_ABSA Values[1];
    187   } SERVICE_TYPE_INFO_ABSA,*PSERVICE_TYPE_INFO_ABSA,*LPSERVICE_TYPE_INFO_ABSA;
    188   typedef struct _SERVICE_TYPE_INFO_ABSW {
    189     LPWSTR lpTypeName;
    190     DWORD dwValueCount;
    191     SERVICE_TYPE_VALUE_ABSW Values[1];
    192   } SERVICE_TYPE_INFO_ABSW,*PSERVICE_TYPE_INFO_ABSW,*LPSERVICE_TYPE_INFO_ABSW;
    193 
    194   __MINGW_TYPEDEF_AW(SERVICE_TYPE_INFO_ABS)
    195   __MINGW_TYPEDEF_AW(PSERVICE_TYPE_INFO_ABS)
    196   __MINGW_TYPEDEF_AW(LPSERVICE_TYPE_INFO_ABS)
    197 
    198   typedef struct _SERVICE_ADDRESS {
    199     DWORD dwAddressType;
    200     DWORD dwAddressFlags;
    201     DWORD dwAddressLength;
    202     DWORD dwPrincipalLength;
    203     BYTE *lpAddress;
    204     BYTE *lpPrincipal;
    205   } SERVICE_ADDRESS,*PSERVICE_ADDRESS,*LPSERVICE_ADDRESS;
    206 
    207   typedef struct _SERVICE_ADDRESSES {
    208     DWORD dwAddressCount;
    209     SERVICE_ADDRESS Addresses[1];
    210   } SERVICE_ADDRESSES,*PSERVICE_ADDRESSES,*LPSERVICE_ADDRESSES;
    211 
    212   typedef struct _SERVICE_INFOA {
    213     LPGUID lpServiceType;
    214     LPSTR lpServiceName;
    215     LPSTR lpComment;
    216     LPSTR lpLocale;
    217     DWORD dwDisplayHint;
    218     DWORD dwVersion;
    219     DWORD dwTime;
    220     LPSTR lpMachineName;
    221     LPSERVICE_ADDRESSES lpServiceAddress;
    222     BLOB ServiceSpecificInfo;
    223   } SERVICE_INFOA,*PSERVICE_INFOA,*LPSERVICE_INFOA;
    224 
    225   typedef struct _SERVICE_INFOW {
    226     LPGUID lpServiceType;
    227     LPWSTR lpServiceName;
    228     LPWSTR lpComment;
    229     LPWSTR lpLocale;
    230     DWORD dwDisplayHint;
    231     DWORD dwVersion;
    232     DWORD dwTime;
    233     LPWSTR lpMachineName;
    234     LPSERVICE_ADDRESSES lpServiceAddress;
    235     BLOB ServiceSpecificInfo;
    236   } SERVICE_INFOW,*PSERVICE_INFOW,*LPSERVICE_INFOW;
    237 
    238   __MINGW_TYPEDEF_AW(SERVICE_INFO)
    239   __MINGW_TYPEDEF_AW(PSERVICE_INFO)
    240   __MINGW_TYPEDEF_AW(LPSERVICE_INFO)
    241 
    242   typedef struct _NS_SERVICE_INFOA {
    243     DWORD dwNameSpace;
    244     SERVICE_INFOA ServiceInfo;
    245   } NS_SERVICE_INFOA,*PNS_SERVICE_INFOA,*LPNS_SERVICE_INFOA;
    246 
    247   typedef struct _NS_SERVICE_INFOW {
    248     DWORD dwNameSpace;
    249     SERVICE_INFOW ServiceInfo;
    250   } NS_SERVICE_INFOW,*PNS_SERVICE_INFOW,*LPNS_SERVICE_INFOW;
    251 
    252   __MINGW_TYPEDEF_AW(NS_SERVICE_INFO)
    253   __MINGW_TYPEDEF_AW(PNS_SERVICE_INFO)
    254   __MINGW_TYPEDEF_AW(LPNS_SERVICE_INFO)
    255 
    256 #ifndef __CSADDR_DEFINED__
    257 #define __CSADDR_DEFINED__
    258 
    259   typedef struct _SOCKET_ADDRESS {
    260     LPSOCKADDR lpSockaddr;
    261     INT iSockaddrLength;
    262   } SOCKET_ADDRESS,*PSOCKET_ADDRESS,*LPSOCKET_ADDRESS;
    263 
    264   typedef struct _CSADDR_INFO {
    265     SOCKET_ADDRESS LocalAddr;
    266     SOCKET_ADDRESS RemoteAddr;
    267     INT iSocketType;
    268     INT iProtocol;
    269   } CSADDR_INFO,*PCSADDR_INFO,*LPCSADDR_INFO;
    270 #endif
    271 
    272   typedef struct _PROTOCOL_INFOA {
    273     DWORD dwServiceFlags;
    274     INT iAddressFamily;
    275     INT iMaxSockAddr;
    276     INT iMinSockAddr;
    277     INT iSocketType;
    278     INT iProtocol;
    279     DWORD dwMessageSize;
    280     LPSTR lpProtocol;
    281   } PROTOCOL_INFOA,*PPROTOCOL_INFOA,*LPPROTOCOL_INFOA;
    282 
    283   typedef struct _PROTOCOL_INFOW {
    284     DWORD dwServiceFlags;
    285     INT iAddressFamily;
    286     INT iMaxSockAddr;
    287     INT iMinSockAddr;
    288     INT iSocketType;
    289     INT iProtocol;
    290     DWORD dwMessageSize;
    291     LPWSTR lpProtocol;
    292   } PROTOCOL_INFOW,*PPROTOCOL_INFOW,*LPPROTOCOL_INFOW;
    293 
    294   __MINGW_TYPEDEF_AW(PROTOCOL_INFO)
    295   __MINGW_TYPEDEF_AW(PPROTOCOL_INFO)
    296   __MINGW_TYPEDEF_AW(LPPROTOCOL_INFO)
    297 
    298   typedef struct _NETRESOURCE2A {
    299     DWORD dwScope;
    300     DWORD dwType;
    301     DWORD dwUsage;
    302     DWORD dwDisplayType;
    303     LPSTR lpLocalName;
    304     LPSTR lpRemoteName;
    305     LPSTR lpComment;
    306     NS_INFO ns_info;
    307     GUID ServiceType;
    308     DWORD dwProtocols;
    309     LPINT lpiProtocols;
    310   } NETRESOURCE2A,*PNETRESOURCE2A,*LPNETRESOURCE2A;
    311 
    312   typedef struct _NETRESOURCE2W {
    313     DWORD dwScope;
    314     DWORD dwType;
    315     DWORD dwUsage;
    316     DWORD dwDisplayType;
    317     LPWSTR lpLocalName;
    318     LPWSTR lpRemoteName;
    319     LPWSTR lpComment;
    320     NS_INFO ns_info;
    321     GUID ServiceType;
    322     DWORD dwProtocols;
    323     LPINT lpiProtocols;
    324   } NETRESOURCE2W,*PNETRESOURCE2W,*LPNETRESOURCE2W;
    325 
    326   __MINGW_TYPEDEF_AW(NETRESOURCE2)
    327   __MINGW_TYPEDEF_AW(PNETRESOURCE2)
    328   __MINGW_TYPEDEF_AW(LPNETRESOURCE2)
    329 
    330   typedef DWORD (*LPFN_NSPAPI)(VOID);
    331 
    332   typedef VOID (*LPSERVICE_CALLBACK_PROC)(LPARAM lParam,HANDLE hAsyncTaskHandle);
    333   typedef struct _SERVICE_ASYNC_INFO {
    334     LPSERVICE_CALLBACK_PROC lpServiceCallbackProc;
    335     LPARAM lParam;
    336     HANDLE hAsyncTaskHandle;
    337   } SERVICE_ASYNC_INFO,*PSERVICE_ASYNC_INFO,*LPSERVICE_ASYNC_INFO;
    338 
    339 #define EnumProtocols __MINGW_NAME_AW(EnumProtocols)
    340 #define GetAddressByName __MINGW_NAME_AW(GetAddressByName)
    341 #define GetTypeByName __MINGW_NAME_AW(GetTypeByName)
    342 #define GetNameByType __MINGW_NAME_AW(GetNameByType)
    343 #define SetService __MINGW_NAME_AW(SetService)
    344 #define GetService __MINGW_NAME_AW(GetService)
    345 
    346   INT WINAPI EnumProtocolsA(LPINT lpiProtocols,LPVOID lpProtocolBuffer,LPDWORD lpdwBufferLength);
    347   INT WINAPI EnumProtocolsW(LPINT lpiProtocols,LPVOID lpProtocolBuffer,LPDWORD lpdwBufferLength);
    348   INT WINAPI GetAddressByNameA(DWORD dwNameSpace,LPGUID lpServiceType,LPSTR lpServiceName,LPINT lpiProtocols,DWORD dwResolution,LPSERVICE_ASYNC_INFO lpServiceAsyncInfo,LPVOID lpCsaddrBuffer,LPDWORD lpdwBufferLength,LPSTR lpAliasBuffer,LPDWORD lpdwAliasBufferLength);
    349   INT WINAPI GetAddressByNameW(DWORD dwNameSpace,LPGUID lpServiceType,LPWSTR lpServiceName,LPINT lpiProtocols,DWORD dwResolution,LPSERVICE_ASYNC_INFO lpServiceAsyncInfo,LPVOID lpCsaddrBuffer,LPDWORD lpdwBufferLength,LPWSTR lpAliasBuffer,LPDWORD lpdwAliasBufferLength);
    350   INT WINAPI GetTypeByNameA(LPSTR lpServiceName,LPGUID lpServiceType);
    351   INT WINAPI GetTypeByNameW(LPWSTR lpServiceName,LPGUID lpServiceType);
    352   INT WINAPI GetNameByTypeA(LPGUID lpServiceType,LPSTR lpServiceName,DWORD dwNameLength);
    353   INT WINAPI GetNameByTypeW(LPGUID lpServiceType,LPWSTR lpServiceName,DWORD dwNameLength);
    354   INT WINAPI SetServiceA(DWORD dwNameSpace,DWORD dwOperation,DWORD dwFlags,LPSERVICE_INFOA lpServiceInfo,LPSERVICE_ASYNC_INFO lpServiceAsyncInfo,LPDWORD lpdwStatusFlags);
    355   INT WINAPI SetServiceW(DWORD dwNameSpace,DWORD dwOperation,DWORD dwFlags,LPSERVICE_INFOW lpServiceInfo,LPSERVICE_ASYNC_INFO lpServiceAsyncInfo,LPDWORD lpdwStatusFlags);
    356   INT WINAPI GetServiceA(DWORD dwNameSpace,LPGUID lpGuid,LPSTR lpServiceName,DWORD dwProperties,LPVOID lpBuffer,LPDWORD lpdwBufferSize,LPSERVICE_ASYNC_INFO lpServiceAsyncInfo);
    357   INT WINAPI GetServiceW(DWORD dwNameSpace,LPGUID lpGuid,LPWSTR lpServiceName,DWORD dwProperties,LPVOID lpBuffer,LPDWORD lpdwBufferSize,LPSERVICE_ASYNC_INFO lpServiceAsyncInfo);
    358 
    359 #ifdef __cplusplus
    360 }
    361 #endif
    362 #endif
    363