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 #ifndef _WINNETWK_ 6 #define _WINNETWK_ 7 8 #include <winapifamily.h> 9 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) 10 11 #include <_mingw_unicode.h> 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 #include <wnnc.h> 18 19 #define RESOURCE_CONNECTED 0x00000001 20 #define RESOURCE_GLOBALNET 0x00000002 21 #define RESOURCE_REMEMBERED 0x00000003 22 #define RESOURCE_RECENT 0x00000004 23 #define RESOURCE_CONTEXT 0x00000005 24 25 #define RESOURCETYPE_ANY 0x00000000 26 #define RESOURCETYPE_DISK 0x00000001 27 #define RESOURCETYPE_PRINT 0x00000002 28 #define RESOURCETYPE_RESERVED 0x00000008 29 30 #define RESOURCETYPE_UNKNOWN 0xFFFFFFFF 31 32 #define RESOURCEUSAGE_CONNECTABLE 0x00000001 33 #define RESOURCEUSAGE_CONTAINER 0x00000002 34 #define RESOURCEUSAGE_NOLOCALDEVICE 0x00000004 35 #define RESOURCEUSAGE_SIBLING 0x00000008 36 #define RESOURCEUSAGE_ATTACHED 0x00000010 37 #define RESOURCEUSAGE_ALL (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED) 38 #define RESOURCEUSAGE_RESERVED 0x80000000 39 40 #define RESOURCEDISPLAYTYPE_GENERIC 0x00000000 41 #define RESOURCEDISPLAYTYPE_DOMAIN 0x00000001 42 #define RESOURCEDISPLAYTYPE_SERVER 0x00000002 43 #define RESOURCEDISPLAYTYPE_SHARE 0x00000003 44 #define RESOURCEDISPLAYTYPE_FILE 0x00000004 45 #define RESOURCEDISPLAYTYPE_GROUP 0x00000005 46 #define RESOURCEDISPLAYTYPE_NETWORK 0x00000006 47 #define RESOURCEDISPLAYTYPE_ROOT 0x00000007 48 #define RESOURCEDISPLAYTYPE_SHAREADMIN 0x00000008 49 #define RESOURCEDISPLAYTYPE_DIRECTORY 0x00000009 50 #define RESOURCEDISPLAYTYPE_TREE 0x0000000a 51 #define RESOURCEDISPLAYTYPE_NDSCONTAINER 0x0000000b 52 53 typedef struct _NETRESOURCEA { 54 DWORD dwScope; 55 DWORD dwType; 56 DWORD dwDisplayType; 57 DWORD dwUsage; 58 LPSTR lpLocalName; 59 LPSTR lpRemoteName; 60 LPSTR lpComment; 61 LPSTR lpProvider; 62 } NETRESOURCEA,*LPNETRESOURCEA; 63 typedef struct _NETRESOURCEW { 64 DWORD dwScope; 65 DWORD dwType; 66 DWORD dwDisplayType; 67 DWORD dwUsage; 68 LPWSTR lpLocalName; 69 LPWSTR lpRemoteName; 70 LPWSTR lpComment; 71 LPWSTR lpProvider; 72 } NETRESOURCEW,*LPNETRESOURCEW; 73 74 __MINGW_TYPEDEF_AW(NETRESOURCE) 75 __MINGW_TYPEDEF_AW(LPNETRESOURCE) 76 77 #define NETPROPERTY_PERSISTENT 1 78 79 #define CONNECT_UPDATE_PROFILE 0x00000001 80 #define CONNECT_UPDATE_RECENT 0x00000002 81 #define CONNECT_TEMPORARY 0x00000004 82 #define CONNECT_INTERACTIVE 0x00000008 83 #define CONNECT_PROMPT 0x00000010 84 #define CONNECT_NEED_DRIVE 0x00000020 85 #define CONNECT_REFCOUNT 0x00000040 86 #define CONNECT_REDIRECT 0x00000080 87 #define CONNECT_LOCALDRIVE 0x00000100 88 #define CONNECT_CURRENT_MEDIA 0x00000200 89 #define CONNECT_DEFERRED 0x00000400 90 #define CONNECT_RESERVED 0xFF000000 91 #define CONNECT_COMMANDLINE 0x00000800 92 #define CONNECT_CMD_SAVECRED 0x00001000 93 #if WINVER >= 0x0600 94 #define CONNECT_CRED_RESET 0x00002000 95 #endif 96 97 #define WNetAddConnection __MINGW_NAME_AW(WNetAddConnection) 98 #define WNetAddConnection2 __MINGW_NAME_AW(WNetAddConnection2) 99 #define WNetAddConnection3 __MINGW_NAME_AW(WNetAddConnection3) 100 #define WNetCancelConnection __MINGW_NAME_AW(WNetCancelConnection) 101 #define WNetCancelConnection2 __MINGW_NAME_AW(WNetCancelConnection2) 102 #define WNetGetConnection __MINGW_NAME_AW(WNetGetConnection) 103 #define WNetRestoreConnection __MINGW_NAME_AW(WNetRestoreConnection) 104 #define WNetUseConnection __MINGW_NAME_AW(WNetUseConnection) 105 106 DWORD WINAPI WNetAddConnectionA(LPCSTR lpRemoteName,LPCSTR lpPassword,LPCSTR lpLocalName); 107 DWORD WINAPI WNetAddConnectionW(LPCWSTR lpRemoteName,LPCWSTR lpPassword,LPCWSTR lpLocalName); 108 DWORD WINAPI WNetAddConnection2A(LPNETRESOURCEA lpNetResource,LPCSTR lpPassword,LPCSTR lpUserName,DWORD dwFlags); 109 DWORD WINAPI WNetAddConnection2W(LPNETRESOURCEW lpNetResource,LPCWSTR lpPassword,LPCWSTR lpUserName,DWORD dwFlags); 110 DWORD WINAPI WNetAddConnection3A(HWND hwndOwner,LPNETRESOURCEA lpNetResource,LPCSTR lpPassword,LPCSTR lpUserName,DWORD dwFlags); 111 DWORD WINAPI WNetAddConnection3W(HWND hwndOwner,LPNETRESOURCEW lpNetResource,LPCWSTR lpPassword,LPCWSTR lpUserName,DWORD dwFlags); 112 DWORD WINAPI WNetCancelConnectionA(LPCSTR lpName,WINBOOL fForce); 113 DWORD WINAPI WNetCancelConnectionW(LPCWSTR lpName,WINBOOL fForce); 114 DWORD WINAPI WNetCancelConnection2A(LPCSTR lpName,DWORD dwFlags,WINBOOL fForce); 115 DWORD WINAPI WNetCancelConnection2W(LPCWSTR lpName,DWORD dwFlags,WINBOOL fForce); 116 DWORD WINAPI WNetGetConnectionA(LPCSTR lpLocalName,LPSTR lpRemoteName,LPDWORD lpnLength); 117 DWORD WINAPI WNetGetConnectionW(LPCWSTR lpLocalName,LPWSTR lpRemoteName,LPDWORD lpnLength); 118 DWORD WINAPI WNetRestoreConnectionA(HWND hwndParent,LPCSTR lpDevice); 119 DWORD WINAPI WNetUseConnectionA(HWND hwndOwner,LPNETRESOURCEA lpNetResource,LPCSTR lpPassword,LPCSTR lpUserID,DWORD dwFlags,LPSTR lpAccessName,LPDWORD lpBufferSize,LPDWORD lpResult); 120 DWORD WINAPI WNetUseConnectionW(HWND hwndOwner,LPNETRESOURCEW lpNetResource,LPCWSTR lpPassword,LPCWSTR lpUserID,DWORD dwFlags,LPWSTR lpAccessName,LPDWORD lpBufferSize,LPDWORD lpResult); 121 DWORD WINAPI WNetConnectionDialog(HWND hwnd,DWORD dwType); 122 DWORD WINAPI WNetDisconnectDialog(HWND hwnd,DWORD dwType); 123 #if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) 124 DWORD WINAPI WNetRestoreSingleConnectionW(HWND hwndParent, LPCWSTR lpDevice, BOOL fUseUI); 125 #else 126 DWORD WINAPI WNetRestoreConnectionW(HWND hwndParent,LPCWSTR lpDevice); 127 #endif 128 129 typedef struct _CONNECTDLGSTRUCTA { 130 DWORD cbStructure; 131 HWND hwndOwner; 132 LPNETRESOURCEA lpConnRes; 133 DWORD dwFlags; 134 DWORD dwDevNum; 135 } CONNECTDLGSTRUCTA,*LPCONNECTDLGSTRUCTA; 136 137 typedef struct _CONNECTDLGSTRUCTW { 138 DWORD cbStructure; 139 HWND hwndOwner; 140 LPNETRESOURCEW lpConnRes; 141 DWORD dwFlags; 142 DWORD dwDevNum; 143 } CONNECTDLGSTRUCTW,*LPCONNECTDLGSTRUCTW; 144 145 __MINGW_TYPEDEF_AW(CONNECTDLGSTRUCT) 146 __MINGW_TYPEDEF_AW(LPCONNECTDLGSTRUCT) 147 148 #define CONNDLG_RO_PATH 0x00000001 149 #define CONNDLG_CONN_POINT 0x00000002 150 #define CONNDLG_USE_MRU 0x00000004 151 #define CONNDLG_HIDE_BOX 0x00000008 152 153 #define CONNDLG_PERSIST 0x00000010 154 #define CONNDLG_NOT_PERSIST 0x00000020 155 156 #define WNetConnectionDialog1 __MINGW_NAME_AW(WNetConnectionDialog1) 157 158 DWORD WINAPI WNetConnectionDialog1A(LPCONNECTDLGSTRUCTA lpConnDlgStruct); 159 DWORD WINAPI WNetConnectionDialog1W(LPCONNECTDLGSTRUCTW lpConnDlgStruct); 160 161 typedef struct _DISCDLGSTRUCTA { 162 DWORD cbStructure; 163 HWND hwndOwner; 164 LPSTR lpLocalName; 165 LPSTR lpRemoteName; 166 DWORD dwFlags; 167 } DISCDLGSTRUCTA,*LPDISCDLGSTRUCTA; 168 169 typedef struct _DISCDLGSTRUCTW { 170 DWORD cbStructure; 171 HWND hwndOwner; 172 LPWSTR lpLocalName; 173 LPWSTR lpRemoteName; 174 DWORD dwFlags; 175 } DISCDLGSTRUCTW,*LPDISCDLGSTRUCTW; 176 177 __MINGW_TYPEDEF_AW(DISCDLGSTRUCT) 178 __MINGW_TYPEDEF_AW(LPDISCDLGSTRUCT) 179 180 #define DISC_UPDATE_PROFILE 0x00000001 181 #define DISC_NO_FORCE 0x00000040 182 183 #define WNetDisconnectDialog1 __MINGW_NAME_AW(WNetDisconnectDialog1) 184 #define WNetOpenEnum __MINGW_NAME_AW(WNetOpenEnum) 185 #define WNetEnumResource __MINGW_NAME_AW(WNetEnumResource) 186 #define WNetGetResourceParent __MINGW_NAME_AW(WNetGetResourceParent) 187 #define WNetGetResourceInformation __MINGW_NAME_AW(WNetGetResourceInformation) 188 189 DWORD WINAPI WNetDisconnectDialog1A(LPDISCDLGSTRUCTA lpConnDlgStruct); 190 DWORD WINAPI WNetDisconnectDialog1W(LPDISCDLGSTRUCTW lpConnDlgStruct); 191 DWORD WINAPI WNetOpenEnumA(DWORD dwScope,DWORD dwType,DWORD dwUsage,LPNETRESOURCEA lpNetResource,LPHANDLE lphEnum); 192 DWORD WINAPI WNetOpenEnumW(DWORD dwScope,DWORD dwType,DWORD dwUsage,LPNETRESOURCEW lpNetResource,LPHANDLE lphEnum); 193 DWORD WINAPI WNetEnumResourceA(HANDLE hEnum,LPDWORD lpcCount,LPVOID lpBuffer,LPDWORD lpBufferSize); 194 DWORD WINAPI WNetEnumResourceW(HANDLE hEnum,LPDWORD lpcCount,LPVOID lpBuffer,LPDWORD lpBufferSize); 195 DWORD WINAPI WNetCloseEnum(HANDLE hEnum); 196 DWORD WINAPI WNetGetResourceParentA(LPNETRESOURCEA lpNetResource,LPVOID lpBuffer,LPDWORD lpcbBuffer); 197 DWORD WINAPI WNetGetResourceParentW(LPNETRESOURCEW lpNetResource,LPVOID lpBuffer,LPDWORD lpcbBuffer); 198 DWORD WINAPI WNetGetResourceInformationA(LPNETRESOURCEA lpNetResource,LPVOID lpBuffer,LPDWORD lpcbBuffer,LPSTR *lplpSystem); 199 DWORD WINAPI WNetGetResourceInformationW(LPNETRESOURCEW lpNetResource,LPVOID lpBuffer,LPDWORD lpcbBuffer,LPWSTR *lplpSystem); 200 201 #define UNIVERSAL_NAME_INFO_LEVEL 0x00000001 202 #define REMOTE_NAME_INFO_LEVEL 0x00000002 203 204 typedef struct _UNIVERSAL_NAME_INFOA { 205 LPSTR lpUniversalName; 206 } UNIVERSAL_NAME_INFOA,*LPUNIVERSAL_NAME_INFOA; 207 208 typedef struct _UNIVERSAL_NAME_INFOW { 209 LPWSTR lpUniversalName; 210 } UNIVERSAL_NAME_INFOW,*LPUNIVERSAL_NAME_INFOW; 211 212 __MINGW_TYPEDEF_AW(UNIVERSAL_NAME_INFO) 213 __MINGW_TYPEDEF_AW(LPUNIVERSAL_NAME_INFO) 214 215 typedef struct _REMOTE_NAME_INFOA { 216 LPSTR lpUniversalName; 217 LPSTR lpConnectionName; 218 LPSTR lpRemainingPath; 219 } REMOTE_NAME_INFOA,*LPREMOTE_NAME_INFOA; 220 221 typedef struct _REMOTE_NAME_INFOW { 222 LPWSTR lpUniversalName; 223 LPWSTR lpConnectionName; 224 LPWSTR lpRemainingPath; 225 } REMOTE_NAME_INFOW,*LPREMOTE_NAME_INFOW; 226 227 __MINGW_TYPEDEF_AW(REMOTE_NAME_INFO) 228 __MINGW_TYPEDEF_AW(LPREMOTE_NAME_INFO) 229 230 #define WNetGetUniversalName __MINGW_NAME_AW(WNetGetUniversalName) 231 #define WNetGetUser __MINGW_NAME_AW(WNetGetUser) 232 #define WNetGetProviderName __MINGW_NAME_AW(WNetGetProviderName) 233 234 DWORD WINAPI WNetGetUniversalNameA(LPCSTR lpLocalPath,DWORD dwInfoLevel,LPVOID lpBuffer,LPDWORD lpBufferSize); 235 DWORD WINAPI WNetGetUniversalNameW(LPCWSTR lpLocalPath,DWORD dwInfoLevel,LPVOID lpBuffer,LPDWORD lpBufferSize); 236 DWORD WINAPI WNetGetUserA(LPCSTR lpName,LPSTR lpUserName,LPDWORD lpnLength); 237 DWORD WINAPI WNetGetUserW(LPCWSTR lpName,LPWSTR lpUserName,LPDWORD lpnLength); 238 239 #define WNFMT_MULTILINE 0x01 240 #define WNFMT_ABBREVIATED 0x02 241 #define WNFMT_INENUM 0x10 242 #define WNFMT_CONNECTION 0x20 243 244 DWORD WINAPI WNetGetProviderNameA(DWORD dwNetType,LPSTR lpProviderName,LPDWORD lpBufferSize); 245 DWORD WINAPI WNetGetProviderNameW(DWORD dwNetType,LPWSTR lpProviderName,LPDWORD lpBufferSize); 246 247 typedef struct _NETINFOSTRUCT { 248 DWORD cbStructure; 249 DWORD dwProviderVersion; 250 DWORD dwStatus; 251 DWORD dwCharacteristics; 252 ULONG_PTR dwHandle; 253 WORD wNetType; 254 DWORD dwPrinters; 255 DWORD dwDrives; 256 } NETINFOSTRUCT,*LPNETINFOSTRUCT; 257 258 #define NETINFO_DLL16 0x00000001 259 #define NETINFO_DISKRED 0x00000004 260 #define NETINFO_PRINTERRED 0x00000008 261 262 #define WNetGetNetworkInformation __MINGW_NAME_AW(WNetGetNetworkInformation) 263 264 DWORD WINAPI WNetGetNetworkInformationA(LPCSTR lpProvider,LPNETINFOSTRUCT lpNetInfoStruct); 265 DWORD WINAPI WNetGetNetworkInformationW(LPCWSTR lpProvider,LPNETINFOSTRUCT lpNetInfoStruct); 266 267 typedef UINT (WINAPI *PFNGETPROFILEPATHA) (LPCSTR pszUsername,LPSTR pszBuffer,UINT cbBuffer); 268 typedef UINT (WINAPI *PFNGETPROFILEPATHW) (LPCWSTR pszUsername,LPWSTR pszBuffer,UINT cbBuffer); 269 270 #define PFNGETPROFILEPATH __MINGW_NAME_AW(PFNGETPROFILEPATH) 271 272 typedef UINT (WINAPI *PFNRECONCILEPROFILEA) (LPCSTR pszCentralFile,LPCSTR pszLocalFile,DWORD dwFlags); 273 typedef UINT (WINAPI *PFNRECONCILEPROFILEW) (LPCWSTR pszCentralFile,LPCWSTR pszLocalFile,DWORD dwFlags); 274 275 #define PFNRECONCILEPROFILE __MINGW_NAME_AW(PFNRECONCILEPROFILE) 276 277 #define RP_LOGON 0x01 278 #define RP_INIFILE 0x02 279 280 typedef WINBOOL (WINAPI *PFNPROCESSPOLICIESA) (HWND hwnd,LPCSTR pszPath,LPCSTR pszUsername,LPCSTR pszComputerName,DWORD dwFlags); 281 typedef WINBOOL (WINAPI *PFNPROCESSPOLICIESW) (HWND hwnd,LPCWSTR pszPath,LPCWSTR pszUsername,LPCWSTR pszComputerName,DWORD dwFlags); 282 283 #define PFNPROCESSPOLICIES __MINGW_NAME_AW(PFNPROCESSPOLICIES) 284 285 #define PP_DISPLAYERRORS 0x01 286 287 #define WNetGetLastError __MINGW_NAME_AW(WNetGetLastError) 288 289 DWORD WINAPI WNetGetLastErrorA(LPDWORD lpError,LPSTR lpErrorBuf,DWORD nErrorBufSize,LPSTR lpNameBuf,DWORD nNameBufSize); 290 DWORD WINAPI WNetGetLastErrorW(LPDWORD lpError,LPWSTR lpErrorBuf,DWORD nErrorBufSize,LPWSTR lpNameBuf,DWORD nNameBufSize); 291 292 #define WN_SUCCESS NO_ERROR 293 #define WN_NO_ERROR NO_ERROR 294 #define WN_NOT_SUPPORTED ERROR_NOT_SUPPORTED 295 #define WN_CANCEL ERROR_CANCELLED 296 #define WN_RETRY ERROR_RETRY 297 #define WN_NET_ERROR ERROR_UNEXP_NET_ERR 298 #define WN_MORE_DATA ERROR_MORE_DATA 299 #define WN_BAD_POINTER ERROR_INVALID_ADDRESS 300 #define WN_BAD_VALUE ERROR_INVALID_PARAMETER 301 #define WN_BAD_USER ERROR_BAD_USERNAME 302 #define WN_BAD_PASSWORD ERROR_INVALID_PASSWORD 303 #define WN_ACCESS_DENIED ERROR_ACCESS_DENIED 304 #define WN_FUNCTION_BUSY ERROR_BUSY 305 #define WN_WINDOWS_ERROR ERROR_UNEXP_NET_ERR 306 #define WN_OUT_OF_MEMORY ERROR_NOT_ENOUGH_MEMORY 307 #define WN_NO_NETWORK ERROR_NO_NETWORK 308 #define WN_EXTENDED_ERROR ERROR_EXTENDED_ERROR 309 #define WN_BAD_LEVEL ERROR_INVALID_LEVEL 310 #define WN_BAD_HANDLE ERROR_INVALID_HANDLE 311 #define WN_NOT_INITIALIZING ERROR_ALREADY_INITIALIZED 312 #define WN_NO_MORE_DEVICES ERROR_NO_MORE_DEVICES 313 #define WN_NOT_CONNECTED ERROR_NOT_CONNECTED 314 #define WN_OPEN_FILES ERROR_OPEN_FILES 315 #define WN_DEVICE_IN_USE ERROR_DEVICE_IN_USE 316 #define WN_BAD_NETNAME ERROR_BAD_NET_NAME 317 #define WN_BAD_LOCALNAME ERROR_BAD_DEVICE 318 #define WN_ALREADY_CONNECTED ERROR_ALREADY_ASSIGNED 319 #define WN_DEVICE_ERROR ERROR_GEN_FAILURE 320 #define WN_CONNECTION_CLOSED ERROR_CONNECTION_UNAVAIL 321 #define WN_NO_NET_OR_BAD_PATH ERROR_NO_NET_OR_BAD_PATH 322 #define WN_BAD_PROVIDER ERROR_BAD_PROVIDER 323 #define WN_CANNOT_OPEN_PROFILE ERROR_CANNOT_OPEN_PROFILE 324 #define WN_BAD_PROFILE ERROR_BAD_PROFILE 325 #define WN_BAD_DEV_TYPE ERROR_BAD_DEV_TYPE 326 #define WN_DEVICE_ALREADY_REMEMBERED ERROR_DEVICE_ALREADY_REMEMBERED 327 #define WN_CONNECTED_OTHER_PASSWORD ERROR_CONNECTED_OTHER_PASSWORD 328 #define WN_CONNECTED_OTHER_PASSWORD_DEFAULT ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT 329 #define WN_NO_MORE_ENTRIES ERROR_NO_MORE_ITEMS 330 #define WN_NOT_CONTAINER ERROR_NOT_CONTAINER 331 #define WN_NOT_AUTHENTICATED ERROR_NOT_AUTHENTICATED 332 #define WN_NOT_LOGGED_ON ERROR_NOT_LOGGED_ON 333 #define WN_NOT_VALIDATED ERROR_NO_LOGON_SERVERS 334 335 typedef struct _NETCONNECTINFOSTRUCT { 336 DWORD cbStructure; 337 DWORD dwFlags; 338 DWORD dwSpeed; 339 DWORD dwDelay; 340 DWORD dwOptDataSize; 341 } NETCONNECTINFOSTRUCT,*LPNETCONNECTINFOSTRUCT; 342 343 #define WNCON_FORNETCARD 0x00000001 344 #define WNCON_NOTROUTED 0x00000002 345 #define WNCON_SLOWLINK 0x00000004 346 #define WNCON_DYNAMIC 0x00000008 347 348 #define MultinetGetConnectionPerformance __MINGW_NAME_AW(MultinetGetConnectionPerformance) 349 350 DWORD WINAPI MultinetGetConnectionPerformanceA(LPNETRESOURCEA lpNetResource,LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct); 351 DWORD WINAPI MultinetGetConnectionPerformanceW(LPNETRESOURCEW lpNetResource,LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct); 352 353 #ifdef __cplusplus 354 } 355 #endif 356 357 #endif /* WINAPI_PARTITION_DESKTOP. */ 358 359 #endif 360