1 /***********************************************************************\ 2 * winnetwk.d * 3 * * 4 * Windows API header module * 5 * * 6 * Translated from MinGW Windows headers * 7 * by Stewart Gordon * 8 * * 9 * Placed into public domain * 10 \***********************************************************************/ 11 module win32.winnetwk; 12 pragma(lib, "mpr"); 13 14 private import win32.winbase, win32.winerror, win32.winnt; 15 16 enum : DWORD { 17 WNNC_NET_MSNET = 0x00010000, 18 WNNC_NET_LANMAN = 0x00020000, 19 WNNC_NET_NETWARE = 0x00030000, 20 WNNC_NET_VINES = 0x00040000, 21 WNNC_NET_10NET = 0x00050000, 22 WNNC_NET_LOCUS = 0x00060000, 23 WNNC_NET_SUN_PC_NFS = 0x00070000, 24 WNNC_NET_LANSTEP = 0x00080000, 25 WNNC_NET_9TILES = 0x00090000, 26 WNNC_NET_LANTASTIC = 0x000A0000, 27 WNNC_NET_AS400 = 0x000B0000, 28 WNNC_NET_FTP_NFS = 0x000C0000, 29 WNNC_NET_PATHWORKS = 0x000D0000, 30 WNNC_NET_LIFENET = 0x000E0000, 31 WNNC_NET_POWERLAN = 0x000F0000, 32 WNNC_NET_BWNFS = 0x00100000, 33 WNNC_NET_COGENT = 0x00110000, 34 WNNC_NET_FARALLON = 0x00120000, 35 WNNC_NET_APPLETALK = 0x00130000, 36 WNNC_NET_INTERGRAPH = 0x00140000, 37 WNNC_NET_SYMFONET = 0x00150000, 38 WNNC_NET_CLEARCASE = 0x00160000, 39 WNNC_NET_FRONTIER = 0x00170000, 40 WNNC_NET_BMC = 0x00180000, 41 WNNC_NET_DCE = 0x00190000, 42 WNNC_NET_AVID = 0x001A0000, 43 WNNC_NET_DOCUSPACE = 0x001B0000, 44 WNNC_NET_MANGOSOFT = 0x001C0000, 45 WNNC_NET_SERNET = 0x001D0000, 46 WNNC_NET_DECORB = 0x00200000, 47 WNNC_NET_PROTSTOR = 0x00210000, 48 WNNC_NET_FJ_REDIR = 0x00220000, 49 WNNC_NET_DISTINCT = 0x00230000, 50 WNNC_NET_TWINS = 0x00240000, 51 WNNC_NET_RDR2SAMPLE = 0x00250000, 52 WNNC_NET_CSC = 0x00260000, 53 WNNC_NET_3IN1 = 0x00270000, 54 WNNC_NET_EXTENDNET = 0x00290000, 55 WNNC_NET_OBJECT_DIRE = 0x00300000, 56 WNNC_NET_MASFAX = 0x00310000, 57 WNNC_NET_HOB_NFS = 0x00320000, 58 WNNC_NET_SHIVA = 0x00330000, 59 WNNC_NET_IBMAL = 0x00340000, 60 WNNC_CRED_MANAGER = 0xFFFF0000 61 } 62 63 enum : DWORD { 64 RESOURCE_CONNECTED = 1, 65 RESOURCE_GLOBALNET = 2, 66 RESOURCE_REMEMBERED = 3, 67 RESOURCE_RECENT = 4, 68 RESOURCE_CONTEXT = 5 69 } 70 71 const DWORD 72 RESOURCETYPE_ANY = 0, 73 RESOURCETYPE_DISK = 1, 74 RESOURCETYPE_PRINT = 2, 75 RESOURCETYPE_RESERVED = 8, 76 RESOURCETYPE_UNKNOWN = 0xFFFFFFFF; 77 78 const DWORD 79 RESOURCEUSAGE_CONNECTABLE = 0x00000001, 80 RESOURCEUSAGE_CONTAINER = 0x00000002, 81 RESOURCEUSAGE_NOLOCALDEVICE = 0x00000004, 82 RESOURCEUSAGE_SIBLING = 0x00000008, 83 RESOURCEUSAGE_ATTACHED = 0x00000010, 84 RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE 85 | RESOURCEUSAGE_CONTAINER 86 | RESOURCEUSAGE_ATTACHED), 87 RESOURCEUSAGE_RESERVED = 0x80000000; 88 89 enum : DWORD { 90 RESOURCEDISPLAYTYPE_GENERIC, 91 RESOURCEDISPLAYTYPE_DOMAIN, 92 RESOURCEDISPLAYTYPE_SERVER, 93 RESOURCEDISPLAYTYPE_SHARE, 94 RESOURCEDISPLAYTYPE_FILE, 95 RESOURCEDISPLAYTYPE_GROUP, 96 RESOURCEDISPLAYTYPE_NETWORK, 97 RESOURCEDISPLAYTYPE_ROOT, 98 RESOURCEDISPLAYTYPE_SHAREADMIN, 99 RESOURCEDISPLAYTYPE_DIRECTORY, 100 RESOURCEDISPLAYTYPE_TREE // = 10 101 } 102 103 const NETPROPERTY_PERSISTENT = 1; 104 105 const DWORD 106 CONNECT_UPDATE_PROFILE = 1, 107 CONNECT_UPDATE_RECENT = 2, 108 CONNECT_TEMPORARY = 4, 109 CONNECT_INTERACTIVE = 8, 110 CONNECT_PROMPT = 16, 111 CONNECT_NEED_DRIVE = 32, 112 CONNECT_REFCOUNT = 64, 113 CONNECT_REDIRECT = 128, 114 CONNECT_LOCALDRIVE = 256, 115 CONNECT_CURRENT_MEDIA = 512; 116 117 const DWORD 118 CONNDLG_RO_PATH = 1, 119 CONNDLG_CONN_POINT = 2, 120 CONNDLG_USE_MRU = 4, 121 CONNDLG_HIDE_BOX = 8, 122 CONNDLG_PERSIST = 16, 123 CONNDLG_NOT_PERSIST = 32; 124 125 const DWORD 126 DISC_UPDATE_PROFILE = 1, 127 DISC_NO_FORCE = 64; 128 129 const DWORD 130 WNFMT_MULTILINE = 1, 131 WNFMT_ABBREVIATED = 2, 132 WNFMT_INENUM = 16, 133 WNFMT_CONNECTION = 32; 134 135 enum : DWORD { 136 WN_SUCCESS = NO_ERROR, 137 WN_NO_ERROR = NO_ERROR, 138 WN_NOT_SUPPORTED = ERROR_NOT_SUPPORTED, 139 WN_CANCEL = ERROR_CANCELLED, 140 WN_RETRY = ERROR_RETRY, 141 WN_NET_ERROR = ERROR_UNEXP_NET_ERR, 142 WN_MORE_DATA = ERROR_MORE_DATA, 143 WN_BAD_POINTER = ERROR_INVALID_ADDRESS, 144 WN_BAD_VALUE = ERROR_INVALID_PARAMETER, 145 WN_BAD_USER = ERROR_BAD_USERNAME, 146 WN_BAD_PASSWORD = ERROR_INVALID_PASSWORD, 147 WN_ACCESS_DENIED = ERROR_ACCESS_DENIED, 148 WN_FUNCTION_BUSY = ERROR_BUSY, 149 WN_WINDOWS_ERROR = ERROR_UNEXP_NET_ERR, 150 WN_OUT_OF_MEMORY = ERROR_NOT_ENOUGH_MEMORY, 151 WN_NO_NETWORK = ERROR_NO_NETWORK, 152 WN_EXTENDED_ERROR = ERROR_EXTENDED_ERROR, 153 WN_BAD_LEVEL = ERROR_INVALID_LEVEL, 154 WN_BAD_HANDLE = ERROR_INVALID_HANDLE, 155 WN_NOT_INITIALIZING = ERROR_ALREADY_INITIALIZED, 156 WN_NO_MORE_DEVICES = ERROR_NO_MORE_DEVICES, 157 WN_NOT_CONNECTED = ERROR_NOT_CONNECTED, 158 WN_OPEN_FILES = ERROR_OPEN_FILES, 159 WN_DEVICE_IN_USE = ERROR_DEVICE_IN_USE, 160 WN_BAD_NETNAME = ERROR_BAD_NET_NAME, 161 WN_BAD_LOCALNAME = ERROR_BAD_DEVICE, 162 WN_ALREADY_CONNECTED = ERROR_ALREADY_ASSIGNED, 163 WN_DEVICE_ERROR = ERROR_GEN_FAILURE, 164 WN_CONNECTION_CLOSED = ERROR_CONNECTION_UNAVAIL, 165 WN_NO_NET_OR_BAD_PATH = ERROR_NO_NET_OR_BAD_PATH, 166 WN_BAD_PROVIDER = ERROR_BAD_PROVIDER, 167 WN_CANNOT_OPEN_PROFILE = ERROR_CANNOT_OPEN_PROFILE, 168 WN_BAD_PROFILE = ERROR_BAD_PROFILE, 169 WN_BAD_DEV_TYPE = ERROR_BAD_DEV_TYPE, 170 WN_DEVICE_ALREADY_REMEMBERED = ERROR_DEVICE_ALREADY_REMEMBERED, 171 WN_NO_MORE_ENTRIES = ERROR_NO_MORE_ITEMS, 172 WN_NOT_CONTAINER = ERROR_NOT_CONTAINER, 173 WN_NOT_AUTHENTICATED = ERROR_NOT_AUTHENTICATED, 174 WN_NOT_LOGGED_ON = ERROR_NOT_LOGGED_ON, 175 WN_NOT_VALIDATED = ERROR_NO_LOGON_SERVERS 176 } 177 178 enum : DWORD { 179 UNIVERSAL_NAME_INFO_LEVEL = 1, 180 REMOTE_NAME_INFO_LEVEL 181 } 182 183 const DWORD 184 NETINFO_DLL16 = 1, 185 NETINFO_DISKRED = 4, 186 NETINFO_PRINTERRED = 8; 187 188 const DWORD 189 RP_LOGON = 1, 190 RP_INIFILE = 2; 191 192 const DWORD PP_DISPLAYERRORS = 1; 193 194 const DWORD 195 WNCON_FORNETCARD = 1, 196 WNCON_NOTROUTED = 2, 197 WNCON_SLOWLINK = 4, 198 WNCON_DYNAMIC = 8; 199 200 struct NETRESOURCEA { 201 DWORD dwScope; 202 DWORD dwType; 203 DWORD dwDisplayType; 204 DWORD dwUsage; 205 LPSTR lpLocalName; 206 LPSTR lpRemoteName; 207 LPSTR lpComment; 208 LPSTR lpProvider; 209 } 210 alias NETRESOURCEA* LPNETRESOURCEA; 211 212 struct NETRESOURCEW { 213 DWORD dwScope; 214 DWORD dwType; 215 DWORD dwDisplayType; 216 DWORD dwUsage; 217 LPWSTR lpLocalName; 218 LPWSTR lpRemoteName; 219 LPWSTR lpComment ; 220 LPWSTR lpProvider; 221 } 222 alias NETRESOURCEW* LPNETRESOURCEW; 223 224 struct CONNECTDLGSTRUCTA { 225 DWORD cbStructure; 226 HWND hwndOwner; 227 LPNETRESOURCEA lpConnRes; 228 DWORD dwFlags; 229 DWORD dwDevNum; 230 } 231 alias CONNECTDLGSTRUCTA* LPCONNECTDLGSTRUCTA; 232 233 struct CONNECTDLGSTRUCTW { 234 DWORD cbStructure; 235 HWND hwndOwner; 236 LPNETRESOURCEW lpConnRes; 237 DWORD dwFlags; 238 DWORD dwDevNum; 239 } 240 alias CONNECTDLGSTRUCTW* LPCONNECTDLGSTRUCTW; 241 242 struct DISCDLGSTRUCTA { 243 DWORD cbStructure; 244 HWND hwndOwner; 245 LPSTR lpLocalName; 246 LPSTR lpRemoteName; 247 DWORD dwFlags; 248 } 249 alias DISCDLGSTRUCTA* LPDISCDLGSTRUCTA; 250 251 struct DISCDLGSTRUCTW { 252 DWORD cbStructure; 253 HWND hwndOwner; 254 LPWSTR lpLocalName; 255 LPWSTR lpRemoteName; 256 DWORD dwFlags; 257 } 258 alias DISCDLGSTRUCTW* LPDISCDLGSTRUCTW; 259 260 struct UNIVERSAL_NAME_INFOA { 261 LPSTR lpUniversalName; 262 } 263 alias UNIVERSAL_NAME_INFOA* LPUNIVERSAL_NAME_INFOA; 264 265 struct UNIVERSAL_NAME_INFOW { 266 LPWSTR lpUniversalName; 267 } 268 alias UNIVERSAL_NAME_INFOW* LPUNIVERSAL_NAME_INFOW; 269 270 struct REMOTE_NAME_INFOA { 271 LPSTR lpUniversalName; 272 LPSTR lpConnectionName; 273 LPSTR lpRemainingPath; 274 } 275 alias REMOTE_NAME_INFOA* LPREMOTE_NAME_INFOA; 276 277 struct REMOTE_NAME_INFOW { 278 LPWSTR lpUniversalName; 279 LPWSTR lpConnectionName; 280 LPWSTR lpRemainingPath; 281 } 282 alias REMOTE_NAME_INFOW* LPREMOTE_NAME_INFOW; 283 284 struct NETINFOSTRUCT { 285 DWORD cbStructure; 286 DWORD dwProviderVersion; 287 DWORD dwStatus; 288 DWORD dwCharacteristics; 289 DWORD dwHandle; 290 WORD wNetType; 291 DWORD dwPrinters; 292 DWORD dwDrives; 293 } 294 alias NETINFOSTRUCT* LPNETINFOSTRUCT; 295 296 extern (Pascal) { 297 alias UINT function(LPCSTR, LPSTR, UINT) PFNGETPROFILEPATHA; 298 alias UINT function(LPCWSTR, LPWSTR, UINT) PFNGETPROFILEPATHW; 299 alias UINT function(LPCSTR, LPCSTR, DWORD) PFNRECONCILEPROFILEA; 300 alias UINT function(LPCWSTR, LPCWSTR, DWORD) PFNRECONCILEPROFILEW; 301 alias BOOL function(HWND, LPCSTR, LPCSTR, LPCSTR, DWORD) 302 PFNPROCESSPOLICIESA; 303 alias BOOL function(HWND, LPCWSTR, LPCWSTR, LPCWSTR, DWORD) 304 PFNPROCESSPOLICIESW; 305 } 306 307 struct NETCONNECTINFOSTRUCT { 308 DWORD cbStructure; 309 DWORD dwFlags; 310 DWORD dwSpeed; 311 DWORD dwDelay; 312 DWORD dwOptDataSize; 313 } 314 alias NETCONNECTINFOSTRUCT* LPNETCONNECTINFOSTRUCT; 315 316 extern (Windows) { 317 DWORD WNetAddConnection2A(LPNETRESOURCEA, LPCSTR, LPCSTR, DWORD); 318 DWORD WNetAddConnection2W(LPNETRESOURCEW, LPCWSTR, LPCWSTR, DWORD); 319 DWORD WNetAddConnection3A(HWND, LPNETRESOURCEA, LPCSTR, LPCSTR, DWORD); 320 DWORD WNetAddConnection3W(HWND, LPNETRESOURCEW, LPCWSTR, LPCWSTR, DWORD); 321 DWORD WNetCancelConnection2A(LPCSTR, DWORD, BOOL); 322 DWORD WNetCancelConnection2W(LPCWSTR, DWORD, BOOL); 323 DWORD WNetGetConnectionA(LPCSTR, LPSTR, PDWORD); 324 DWORD WNetGetConnectionW(LPCWSTR, LPWSTR, PDWORD); 325 DWORD WNetUseConnectionA(HWND, LPNETRESOURCEA, LPCSTR, LPCSTR, DWORD, 326 LPSTR, PDWORD, PDWORD); 327 DWORD WNetUseConnectionW(HWND, LPNETRESOURCEW, LPCWSTR, LPCWSTR, DWORD, 328 LPWSTR, PDWORD, PDWORD); 329 DWORD WNetSetConnectionA(LPCSTR, DWORD, PVOID); 330 DWORD WNetSetConnectionW(LPCWSTR, DWORD, PVOID); 331 DWORD WNetConnectionDialog(HWND, DWORD); 332 DWORD WNetDisconnectDialog(HWND, DWORD); 333 DWORD WNetConnectionDialog1A(LPCONNECTDLGSTRUCTA); 334 DWORD WNetConnectionDialog1W(LPCONNECTDLGSTRUCTW); 335 DWORD WNetDisconnectDialog1A(LPDISCDLGSTRUCTA); 336 DWORD WNetDisconnectDialog1W(LPDISCDLGSTRUCTW); 337 DWORD WNetOpenEnumA(DWORD, DWORD, DWORD, LPNETRESOURCEA, LPHANDLE); 338 DWORD WNetOpenEnumW(DWORD, DWORD, DWORD, LPNETRESOURCEW, LPHANDLE); 339 DWORD WNetEnumResourceA(HANDLE, PDWORD, PVOID, PDWORD); 340 DWORD WNetEnumResourceW(HANDLE, PDWORD, PVOID, PDWORD); 341 DWORD WNetCloseEnum(HANDLE); 342 DWORD WNetGetUniversalNameA(LPCSTR, DWORD, PVOID, PDWORD); 343 DWORD WNetGetUniversalNameW(LPCWSTR, DWORD, PVOID, PDWORD); 344 DWORD WNetGetUserA(LPCSTR, LPSTR, PDWORD); 345 DWORD WNetGetUserW(LPCWSTR, LPWSTR, PDWORD); 346 DWORD WNetGetProviderNameA(DWORD, LPSTR, PDWORD); 347 DWORD WNetGetProviderNameW(DWORD, LPWSTR, PDWORD); 348 DWORD WNetGetNetworkInformationA(LPCSTR, LPNETINFOSTRUCT); 349 DWORD WNetGetNetworkInformationW(LPCWSTR, LPNETINFOSTRUCT); 350 DWORD WNetGetResourceInformationA(LPNETRESOURCEA, LPVOID, LPDWORD, 351 LPSTR*); 352 DWORD WNetGetResourceInformationW(LPNETRESOURCEA, LPVOID, LPDWORD, 353 LPWSTR*); 354 DWORD WNetGetResourceParentA(LPNETRESOURCEA, LPVOID, LPDWORD); 355 DWORD WNetGetResourceParentW(LPNETRESOURCEW, LPVOID, LPDWORD); 356 DWORD WNetGetLastErrorA(PDWORD, LPSTR, DWORD, LPSTR, DWORD); 357 DWORD WNetGetLastErrorW(PDWORD, LPWSTR, DWORD, LPWSTR, DWORD); 358 DWORD MultinetGetConnectionPerformanceA(LPNETRESOURCEA, 359 LPNETCONNECTINFOSTRUCT); 360 DWORD MultinetGetConnectionPerformanceW(LPNETRESOURCEW, 361 LPNETCONNECTINFOSTRUCT); 362 deprecated { 363 DWORD WNetAddConnectionA(LPCSTR, LPCSTR, LPCSTR); 364 DWORD WNetAddConnectionW(LPCWSTR, LPCWSTR, LPCWSTR); 365 DWORD WNetCancelConnectionA(LPCSTR, BOOL); 366 DWORD WNetCancelConnectionW(LPCWSTR, BOOL); 367 } 368 } 369 370 version (Unicode) { 371 alias PFNGETPROFILEPATHW PFNGETPROFILEPATH; 372 alias PFNRECONCILEPROFILEW PFNRECONCILEPROFILE; 373 alias PFNPROCESSPOLICIESW PFNPROCESSPOLICIES; 374 alias NETRESOURCEW NETRESOURCE; 375 alias CONNECTDLGSTRUCTW CONNECTDLGSTRUCT; 376 alias DISCDLGSTRUCTW DISCDLGSTRUCT; 377 alias REMOTE_NAME_INFOW REMOTE_NAME_INFO; 378 alias UNIVERSAL_NAME_INFOW UNIVERSAL_NAME_INFO; 379 alias WNetAddConnection2W WNetAddConnection2; 380 alias WNetAddConnection3W WNetAddConnection3; 381 alias WNetCancelConnection2W WNetCancelConnection2; 382 alias WNetGetConnectionW WNetGetConnection; 383 alias WNetUseConnectionW WNetUseConnection; 384 alias WNetSetConnectionW WNetSetConnection; 385 alias WNetConnectionDialog1W WNetConnectionDialog1; 386 alias WNetDisconnectDialog1W WNetDisconnectDialog1; 387 alias WNetOpenEnumW WNetOpenEnum; 388 alias WNetEnumResourceW WNetEnumResource; 389 alias WNetGetUniversalNameW WNetGetUniversalName; 390 alias WNetGetUserW WNetGetUser; 391 alias WNetGetProviderNameW WNetGetProviderName; 392 alias WNetGetNetworkInformationW WNetGetNetworkInformation; 393 alias WNetGetResourceInformationW WNetGetResourceInformation; 394 alias WNetGetResourceParentW WNetGetResourceParent; 395 alias WNetGetLastErrorW WNetGetLastError; 396 alias MultinetGetConnectionPerformanceW MultinetGetConnectionPerformance; 397 deprecated { 398 alias WNetAddConnectionW WNetAddConnection; 399 alias WNetCancelConnectionW WNetCancelConnection; 400 } 401 } else { 402 alias PFNGETPROFILEPATHA PFNGETPROFILEPATH; 403 alias PFNRECONCILEPROFILEA PFNRECONCILEPROFILE; 404 alias PFNPROCESSPOLICIESA PFNPROCESSPOLICIES; 405 alias NETRESOURCEA NETRESOURCE; 406 alias CONNECTDLGSTRUCTA CONNECTDLGSTRUCT; 407 alias DISCDLGSTRUCTA DISCDLGSTRUCT; 408 alias REMOTE_NAME_INFOA REMOTE_NAME_INFO; 409 alias UNIVERSAL_NAME_INFOA UNIVERSAL_NAME_INFO; 410 alias WNetAddConnection2A WNetAddConnection2; 411 alias WNetAddConnection3A WNetAddConnection3; 412 alias WNetCancelConnection2A WNetCancelConnection2; 413 alias WNetGetConnectionA WNetGetConnection; 414 alias WNetUseConnectionA WNetUseConnection; 415 alias WNetSetConnectionA WNetSetConnection; 416 alias WNetConnectionDialog1A WNetConnectionDialog1; 417 alias WNetDisconnectDialog1A WNetDisconnectDialog1; 418 alias WNetOpenEnumA WNetOpenEnum; 419 alias WNetEnumResourceA WNetEnumResource; 420 alias WNetGetUniversalNameA WNetGetUniversalName; 421 alias WNetGetUserA WNetGetUser; 422 alias WNetGetProviderNameA WNetGetProviderName; 423 alias WNetGetNetworkInformationA WNetGetNetworkInformation; 424 alias WNetGetResourceInformationA WNetGetResourceInformation; 425 alias WNetGetResourceParentA WNetGetResourceParent; 426 alias WNetGetLastErrorA WNetGetLastError; 427 alias MultinetGetConnectionPerformanceA MultinetGetConnectionPerformance; 428 deprecated { 429 alias WNetAddConnectionA WNetAddConnection; 430 alias WNetCancelConnectionA WNetCancelConnection; 431 } 432 } 433 434 alias NETRESOURCE* LPNETRESOURCE; 435 alias CONNECTDLGSTRUCT* LPCONNECTDLGSTRUCT; 436 alias DISCDLGSTRUCT* LPDISCDLGSTRUCT; 437 alias REMOTE_NAME_INFO* LPREMOTE_NAME_INFO; 438 alias UNIVERSAL_NAME_INFO* LPUNIVERSAL_NAME_INFO;