' ########################################################################################
' Microsoft Windows
' File: WinNetWk.inc
' Contents: Standard WINNET Header File for WIN32
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_WinNetWk_PBI)
#DEFINE PBX_WinNetWk_PBI
%EQUATE `WINNETWK_INC = 1
#INCLUDE ONCE "Legacy/Platform/WinError.inc"
'//
'// Network types
'//
#INCLUDE ONCE "Legacy/System/wnnc.inc"
'//
'// Network Resources.
'//
%EQUATE `RESOURCE_CONNECTED = &H00000001
%EQUATE `RESOURCE_PUBLICNET = &H00000002
%EQUATE `RESOURCE_GLOBALNET = &H00000002
%EQUATE `RESOURCE_REMEMBERED = &H00000003
'#if(WINVER >= 0x0400)
%EQUATE `RESOURCE_RECENT = &H00000004
%EQUATE `RESOURCE_CONTEXT = &H00000005
'#endif /* WINVER >= 0x0400 */
%EQUATE `RESOURCETYPE_ANY = &H00000000
%EQUATE `RESOURCETYPE_DISK = &H00000001
%EQUATE `RESOURCETYPE_PRINT = &H00000002
'#if(WINVER >= 0x0400)
%EQUATE `RESOURCETYPE_RESERVED = &H00000008
'#endif /* WINVER >= 0x0400 */
%EQUATE `RESOURCETYPE_UNKNOWN = &HFFFFFFFF
%EQUATE `RESOURCEUSAGE_CONNECTABLE = &H00000001
%EQUATE `RESOURCEUSAGE_CONTAINER = &H00000002
'#if(WINVER >= 0x0400)
%EQUATE `RESOURCEUSAGE_NOLOCALDEVICE = &H00000004
%EQUATE `RESOURCEUSAGE_SIBLING = &H00000008
%EQUATE `RESOURCEUSAGE_ATTACHED = &H00000010
%EQUATE `RESOURCEUSAGE_ALL = %RESOURCEUSAGE_CONNECTABLE OR %RESOURCEUSAGE_CONTAINER OR %RESOURCEUSAGE_ATTACHED
'#endif /* WINVER >= 0x0400 */
%EQUATE `RESOURCEUSAGE_RESERVED = &H80000000
%EQUATE `RESOURCEDISPLAYTYPE_GENERIC = &H00000000
%EQUATE `RESOURCEDISPLAYTYPE_DOMAIN = &H00000001
%EQUATE `RESOURCEDISPLAYTYPE_SERVER = &H00000002
%EQUATE `RESOURCEDISPLAYTYPE_SHARE = &H00000003
%EQUATE `RESOURCEDISPLAYTYPE_FILE = &H00000004
%EQUATE `RESOURCEDISPLAYTYPE_GROUP = &H00000005
'#if(WINVER >= 0x0400)
%EQUATE `RESOURCEDISPLAYTYPE_NETWORK = &H00000006
%EQUATE `RESOURCEDISPLAYTYPE_ROOT = &H00000007
%EQUATE `RESOURCEDISPLAYTYPE_SHAREADMIN = &H00000008
%EQUATE `RESOURCEDISPLAYTYPE_DIRECTORY = &H00000009
'#endif /* WINVER >= 0x0400 */
%EQUATE `RESOURCEDISPLAYTYPE_TREE = &H0000000A
'#if(WINVER >= 0x0400)
%EQUATE `RESOURCEDISPLAYTYPE_NDSCONTAINER = &H0000000B
'#endif /* WINVER >= 0x0400 */
' // Size = 32 bytes
TYPE NETRESOURCEA DWORD
 dwScope AS DWORD
 dwType AS DWORD
 dwDisplayType AS DWORD
 dwUsage AS DWORD
 lpLocalName AS ASCIIZ PTR
 lpRemoteName AS ASCIIZ PTR
 lpComment AS ASCIIZ PTR
 lpProvider AS ASCIIZ PTR
END TYPE
' // Size = 32 bytes
TYPE NETRESOURCEW DWORD
 dwScope AS DWORD
 dwType AS DWORD
 dwDisplayType AS DWORD
 dwUsage AS DWORD
 lpLocalName AS WSTRINGZ PTR
 lpRemoteName AS WSTRINGZ PTR
 lpComment AS WSTRINGZ PTR
 lpProvider AS WSTRINGZ PTR
END TYPE
#IF %DEF(%UNICODE)
 MACRO NETRESOURCE = NETRESOURCEW
#ELSE
 MACRO NETRESOURCE = NETRESOURCEA
#ENDIF
'//
'// Network Connections.
'//
'#define NETPROPERTY_PERSISTENT 1
%EQUATE `NETPROPERTY_PERSISTENT = 1
%EQUATE `CONNECT_UPDATE_PROFILE = &H00000001
%EQUATE `CONNECT_UPDATE_RECENT = &H00000002
%EQUATE `CONNECT_TEMPORARY = &H00000004
%EQUATE `CONNECT_INTERACTIVE = &H00000008
%EQUATE `CONNECT_PROMPT = &H00000010
%EQUATE `CONNECT_NEED_DRIVE = &H00000020
'#if(WINVER >= 0x0400)
%EQUATE `CONNECT_REFCOUNT = &H00000040
%EQUATE `CONNECT_REDIRECT = &H00000080
%EQUATE `CONNECT_LOCALDRIVE = &H00000100
%EQUATE `CONNECT_CURRENT_MEDIA = &H00000200
%EQUATE `CONNECT_DEFERRED = &H00000400
%EQUATE `CONNECT_RESERVED = &HFF000000
'#endif /* WINVER >= 0x0400 */
'#if(WINVER >= 0x0500)
%EQUATE `CONNECT_COMMANDLINE = &H00000800
%EQUATE `CONNECT_CMD_SAVECRED = &H00001000
'#endif /* WINVER >= 0x0500 */
'#if(WINVER >= 0x0600)
%EQUATE `CONNECT_CRED_RESET = &H00002000
'#endif /* WINVER >= 0x0600 */
DECLARE FUNCTION WNetAddConnectionA LIB "mpr.dll" ALIAS "WNetAddConnectionA" ( BYREF lpRemoteName AS ASCIIZ , BYREF lpPassword AS ASCIIZ , BYREF lpLocalName AS ASCIIZ ) AS QUAD
DECLARE FUNCTION WNetAddConnectionW LIB "mpr.dll" ALIAS "WNetAddConnectionW" ( BYREF lpRemoteName AS WSTRINGZ
 , BYREF lpPassword AS WSTRINGZ
 , BYREF lpLocalName AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetAddConnection = WNetAddConnectionW
#ELSE
 MACRO WNetAddConnection = WNetAddConnectionA
#ENDIF
DECLARE FUNCTION WNetAddConnection2A LIB "mpr.dll" ALIAS "WNetAddConnection2A" ( BYREF lpNetResource AS NETRESOURCEA , BYREF lpPassword AS ASCIIZ , BYREF lpUserName AS ASCIIZ , BYVAL dwFlags AS QUAD ) AS QUAD
DECLARE FUNCTION WNetAddConnection2W LIB "mpr.dll" ALIAS "WNetAddConnection2W" ( BYREF lpNetResource AS NETRESOURCEW
 , BYREF lpPassword AS WSTRINGZ
 , BYREF lpUserName AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetAddConnection2 = WNetAddConnection2W
#ELSE
 MACRO WNetAddConnection2 = WNetAddConnection2A
#ENDIF
DECLARE FUNCTION WNetAddConnection3A LIB "mpr.dll" ALIAS "WNetAddConnection3A" ( BYVAL hwndOwner AS QUAD , BYREF lpNetResource AS NETRESOURCEA , BYREF lpPassword AS ASCIIZ , BYREF lpUserName AS ASCIIZ , BYVAL dwFlags AS QUAD ) AS QUAD
DECLARE FUNCTION WNetAddConnection3W LIB "mpr.dll" ALIAS "WNetAddConnection3W" ( BYVAL hwndOwner AS QUAD
 , BYREF lpNetResource AS NETRESOURCEW
 , BYREF lpPassword AS WSTRINGZ
 , BYREF lpUserName AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetAddConnection3 = WNetAddConnection3W
#ELSE
 MACRO WNetAddConnection3 = WNetAddConnection3A
#ENDIF
DECLARE FUNCTION WNetCancelConnectionA LIB "mpr.dll" ALIAS "WNetCancelConnectionA" ( BYREF lpName AS ASCIIZ , BYVAL fForce AS LONG ) AS QUAD
DECLARE FUNCTION WNetCancelConnectionW LIB "mpr.dll" ALIAS "WNetCancelConnectionW" ( BYREF lpName AS WSTRINGZ
 , BYVAL fForce AS LONG
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetCancelConnection = WNetCancelConnectionW
#ELSE
 MACRO WNetCancelConnection = WNetCancelConnectionA
#ENDIF
DECLARE FUNCTION WNetCancelConnection2A LIB "mpr.dll" ALIAS "WNetCancelConnection2A" ( BYREF lpName AS ASCIIZ , BYVAL dwFlags AS QUAD , BYVAL fForce AS LONG ) AS QUAD
DECLARE FUNCTION WNetCancelConnection2W LIB "mpr.dll" ALIAS "WNetCancelConnection2W" ( BYREF lpName AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYVAL fForce AS LONG
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetCancelConnection2 = WNetCancelConnection2W
#ELSE
 MACRO WNetCancelConnection2 = WNetCancelConnection2A
#ENDIF
DECLARE FUNCTION WNetGetConnectionA LIB "mpr.dll" ALIAS "WNetGetConnectionA" ( BYREF lpLocalName AS ASCIIZ , BYREF lpRemoteName AS ASCIIZ , BYREF lpnLength AS QUAD ) AS QUAD
DECLARE FUNCTION WNetGetConnectionW LIB "mpr.dll" ALIAS "WNetGetConnectionW" ( BYREF lpLocalName AS WSTRINGZ
 , BYREF lpRemoteName AS WSTRINGZ
 , BYREF lpnLength AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetGetConnection = WNetGetConnectionW
#ELSE
 MACRO WNetGetConnection = WNetGetConnectionA
#ENDIF
'#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
DECLARE FUNCTION WNetRestoreSingleConnectionW LIB "mpr.dll" ALIAS "WNetRestoreSingleConnectionW" ( BYVAL hwndParent AS QUAD , BYREF lpDevice AS WSTRINGZ , BYVAL fUseUI AS LONG ) AS QUAD
MACRO WNetRestoreSingleConnection = WNetRestoreSingleConnectionW
'#else
' Not supported on Windows Vista and later.
DECLARE FUNCTION WNetRestoreConnectionW LIB "mpr.dll" ALIAS "WNetRestoreConnectionW" ( BYVAL hwndParent AS QUAD , BYREF lpDevice AS WSTRINGZ ) AS QUAD
MACRO WNetRestoreConnection = WNetRestoreConnectionW
'#endif
'#if(WINVER >= 0x0400)
DECLARE FUNCTION WNetUseConnectionA LIB "mpr.dll" ALIAS "WNetUseConnectionA" ( BYVAL hwndOwner AS QUAD , BYREF lpNetResource AS NETRESOURCEA , BYREF lpPassword AS ASCIIZ , BYREF lpUserID AS ASCIIZ , BYVAL dwFlags AS QUAD , BYREF lpAccessName AS ASCIIZ , BYREF lpBufferSize AS QUAD , BYREF lpResult AS QUAD ) AS QUAD
DECLARE FUNCTION WNetUseConnectionW LIB "mpr.dll" ALIAS "WNetUseConnectionW" ( BYVAL hwndOwner AS QUAD
 , BYREF lpNetResource AS NETRESOURCEW
 , BYREF lpPassword AS WSTRINGZ
 , BYREF lpUserID AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 , BYREF lpAccessName AS WSTRINGZ
 , BYREF lpBufferSize AS DWORD
 , BYREF lpResult AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetUseConnection = WNetUseConnectionW
#ELSE
 MACRO WNetUseConnection = WNetUseConnectionA
#ENDIF
'#endif /* WINVER >= 0x0400 */
'//
'// Network Connection Dialogs.
'//
DECLARE FUNCTION WNetConnectionDialog LIB "mpr.dll" ALIAS "WNetConnectionDialog" ( BYVAL hwnd AS QUAD , BYVAL dwType AS QUAD ) AS QUAD
DECLARE FUNCTION WNetDisconnectDialog LIB "mpr.dll" ALIAS "WNetDisconnectDialog" ( BYVAL hwnd AS QUAD
 , BYVAL dwType AS DWORD
 ) AS DWORD
'#if(WINVER >= 0x0400)
' // Size = 20 bytes
TYPE CONNECTDLGSTRUCTA DWORD
 cbStructure AS DWORD ' DWORD // size of this structure in bytes
 hwndOwner AS DWORD ' HWND // owner window for the dialog (HWND)
 lpConnRes AS NETRESOURCE PTR ' LPNETRESOURCEA // requested resource info
 dwFlags AS DWORD ' DWORD // flags
 dwDevNum AS DWORD ' DWORD //number of devices connected to
END TYPE
' // Size = 20 bytes
TYPE CONNECTDLGSTRUCTW DWORD
 cbStructure AS DWORD ' DWORD // size of this structure in bytes
 hwndOwner AS DWORD ' HWND // owner window for the dialog (HWND)
 lpConnRes AS NETRESOURCEW PTR ' LPNETRESOURCEW // requested resource info
 dwFlags AS DWORD ' DWORD // flags
 dwDevNum AS DWORD ' DWORD //number of devices connected to
END TYPE
#IF %DEF(%UNICODE)
 MACRO CONNECTDLGSTRUCT = CONNECTDLGSTRUCTW
#ELSE
 MACRO CONNECTDLGSTRUCT = CONNECTDLGSTRUCTA
#ENDIF
%EQUATE `CONNDLG_RO_PATH = &H00000001 ' Resource path should be read-only
%EQUATE `CONNDLG_CONN_POINT = &H00000002 ' Netware-style movable connection point
%EQUATE `CONNDLG_USE_MRU = &H00000004 ' Use MRU combobox
%EQUATE `CONNDLG_HIDE_BOX = &H00000008 ' Hide persistent connect checkbox
'/*
' * NOTE: Set at most ONE of the below flags. If neither flag is set,
' * then the persistence is set to whatever the user chose during
' * a previous connection
' */
%EQUATE `CONNDLG_PERSIST = &H00000010 ' Force persistent connection
%EQUATE `CONNDLG_NOT_PERSIST = &H00000020 ' Force connection NOT persistent
DECLARE FUNCTION WNetConnectionDialog1A LIB "mpr.dll" ALIAS "WNetConnectionDialog1A" ( BYREF lpConnDlgStruct AS CONNECTDLGSTRUCTA ) AS QUAD
DECLARE FUNCTION WNetConnectionDialog1W LIB "mpr.dll" ALIAS "WNetConnectionDialog1W" ( BYREF lpConnDlgStruct AS CONNECTDLGSTRUCTW
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetConnectionDialog1 = WNetConnectionDialog1W
#ELSE
 MACRO WNetConnectionDialog1 = WNetConnectionDialog1A
#ENDIF
' // Size = 20 bytes
TYPE DISCDLGSTRUCTA DWORD
 cbStructure AS DWORD ' DWORD // size of this structure in bytes
 hwndOwner AS DWORD ' HWND // owner window for the dialog (HWND)
 lpLocalName AS ASCIIZ PTR ' LPSTR // local device name
 lpRemoteName AS ASCIIZ PTR ' LPSTR // network resource name
 dwFlags AS DWORD ' DWORD // flags
END TYPE
' // Size = 20 bytes
TYPE DISCDLGSTRUCTW DWORD
 cbStructure AS DWORD ' DWORD // size of this structure in bytes
 hwndOwner AS DWORD ' HWND // owner window for the dialog (HWND)
 lpLocalName AS WSTRINGZ PTR ' LPWSTR // local device name
 lpRemoteName AS WSTRINGZ PTR ' LPWSTR // network resource name
 dwFlags AS DWORD ' DWORD // flags
END TYPE
#IF %DEF(%UNICODE)
 MACRO DISCDLGSTRUCT = DISCDLGSTRUCTW
#ELSE
 MACRO DISCDLGSTRUCT = DISCDLGSTRUCTA
#ENDIF
%EQUATE `DISC_UPDATE_PROFILE = &H00000001
%EQUATE `DISC_NO_FORCE = &H00000040
DECLARE FUNCTION WNetDisconnectDialog1A LIB "mpr.dll" ALIAS "WNetDisconnectDialog1A" ( BYREF lpConnDlgStruct AS DISCDLGSTRUCTA ) AS QUAD
DECLARE FUNCTION WNetDisconnectDialog1W LIB "mpr.dll" ALIAS "WNetDisconnectDialog1W" ( BYREF lpConnDlgStruct AS DISCDLGSTRUCTW
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetDisconnectDialog1 = WNetDisconnectDialog1W
#ELSE
 MACRO WNetDisconnectDialog1 = WNetDisconnectDialog1A
#ENDIF
'#endif /* WINVER >= 0x0400 */
'//
'// Network Browsing.
'//
DECLARE FUNCTION WNetOpenEnumA LIB "mpr.dll" ALIAS "WNetOpenEnumA" ( BYVAL dwScope AS QUAD , BYVAL dwType AS QUAD , BYVAL dwUsage AS QUAD , BYREF lpNetResource AS NETRESOURCEA , BYREF lphEnum AS QUAD ) AS QUAD
DECLARE FUNCTION WNetOpenEnumW LIB "mpr.dll" ALIAS "WNetOpenEnumW" ( BYVAL dwScope AS QUAD
 , BYVAL dwType AS DWORD
 , BYVAL dwUsage AS DWORD
 , BYREF lpNetResource AS NETRESOURCEW
 , BYREF lphEnum AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetOpenEnum = WNetOpenEnumW
#ELSE
 MACRO WNetOpenEnum = WNetOpenEnumA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WNetEnumResourceA LIB "Mpr.dll" ALIAS "WNetEnumResourceA" ( BYVAL hEnum AS QUAD,
 lpcCount AS QUAD, BYVAL lpBuffer AS QUAD,
 lpBufferSize AS QUAD ) AS QUAD
#ELSE
DECLARE FUNCTION WNetEnumResourceA LIB "mpr.dll" ALIAS "WNetEnumResourceA" ( BYVAL hEnum AS QUAD , BYREF lpcCount AS QUAD , BYREF lpBuffer AS ANY , BYREF lpBufferSize AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WNetEnumResourceW LIB "Mpr.dll" ALIAS "WNetEnumResourceW" ( BYVAL hEnum AS QUAD,
 lpcCount AS QUAD, BYVAL lpBuffer AS QUAD,
 lpBufferSize AS QUAD ) AS QUAD
#ELSE
DECLARE FUNCTION WNetEnumResourceW LIB "mpr.dll" ALIAS "WNetEnumResourceW" ( BYVAL hEnum AS QUAD , BYREF lpcCount AS QUAD , BYREF lpBuffer AS ANY , BYREF lpBufferSize AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%UNICODE)
 MACRO WNetEnumResource = WNetEnumResourceW
#ELSE
 MACRO WNetEnumResource = WNetEnumResourceA
#ENDIF
DECLARE FUNCTION WNetCloseEnum LIB "mpr.dll" ALIAS "WNetCloseEnum" ( BYVAL hEnum AS QUAD ) AS QUAD
'#if(WINVER >= 0x0400)
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WNetGetResourceParentA LIB "Mpr.dll" ALIAS "WNetGetResourceParentA" ( lpNetResource AS NETRESOURCEA, BYVAL lpBuffer AS QUAD,
 lpcbBuffer AS QUAD ) AS QUAD
#ELSE
DECLARE FUNCTION WNetGetResourceParentA LIB "mpr.dll" ALIAS "WNetGetResourceParentA" ( BYREF lpNetResource AS NETRESOURCEA , BYREF lpBuffer AS ANY , BYREF lpcbBuffer AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WNetGetResourceParentW LIB "Mpr.dll" ALIAS "WNetGetResourceParentW" ( lpNetResource AS NETRESOURCEW, BYVAL lpBuffer AS QUAD,
 lpcbBuffer AS QUAD ) AS QUAD
#ELSE
DECLARE FUNCTION WNetGetResourceParentW LIB "mpr.dll" ALIAS "WNetGetResourceParentW" ( BYREF lpNetResource AS NETRESOURCEW , BYREF lpBuffer AS ANY , BYREF lpcbBuffer AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%UNICODE)
 MACRO WNetGetResourceParent = WNetGetResourceParentW
#ELSE
 MACRO WNetGetResourceParent = WNetGetResourceParentA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WNetGetResourceInformationA LIB "Mpr.dll" ALIAS "WNetGetResourceInformationA" ( lpNetResource AS NETRESOURCEA, BYVAL lpBuffer AS QUAD,
 lpcbBuffer AS QUAD, lplpSystem AS ANY ' LPSTR * ) AS QUAD
#ELSE
DECLARE FUNCTION WNetGetResourceInformationA LIB "mpr.dll" ALIAS "WNetGetResourceInformationA" ( BYREF lpNetResource AS NETRESOURCEA , BYREF lpBuffer AS ANY , BYREF lpcbBuffer AS QUAD , BYREF lplpSystem AS ANY ) AS QUAD
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WNetGetResourceInformationW LIB "Mpr.dll" ALIAS "WNetGetResourceInformationW" ( lpNetResource AS NETRESOURCEW, BYVAL lpBuffer AS QUAD,
 lpcbBuffer AS QUAD, lplpSystem AS ANY ' LPSTR * ) AS QUAD
#ELSE
DECLARE FUNCTION WNetGetResourceInformationW LIB "mpr.dll" ALIAS "WNetGetResourceInformationW" ( BYREF lpNetResource AS NETRESOURCEW , BYREF lpBuffer AS ANY , BYREF lpcbBuffer AS QUAD , BYREF lplpSystem AS ANY ) AS QUAD
#ENDIF
#IF %DEF(%UNICODE)
 MACRO WNetGetResourceInformation = WNetGetResourceInformationW
#ELSE
 MACRO WNetGetResourceInformation = WNetGetResourceInformationA
#ENDIF
'#endif /* WINVER >= 0x0400 */
'//
'// Universal Naming.
'//
%EQUATE `UNIVERSAL_NAME_INFO_LEVEL = &H00000001
%EQUATE `REMOTE_NAME_INFO_LEVEL = &H00000002
' // Size = 4 bytes
TYPE UNIVERSAL_NAME_INFOA DWORD
 lpUniversalName AS ASCIIZ PTR
END TYPE
' // Size = 4 bytes
TYPE UNIVERSAL_NAME_INFOW DWORD
 lpUniversalName AS WSTRINGZ PTR
END TYPE
#IF %DEF(%UNICODE)
 MACRO UNIVERSAL_NAME_INFO = UNIVERSAL_NAME_INFOW
#ELSE
 MACRO UNIVERSAL_NAME_INFO = UNIVERSAL_NAME_INFOA
#ENDIF
' // Size = 12 bytes
TYPE REMOTE_NAME_INFOA DWORD
 lpUniversalName AS ASCIIZ PTR
 lpConnectionName AS ASCIIZ PTR
 lpRemainingPath AS ASCIIZ PTR
END TYPE
' // Size = 12 bytes
TYPE REMOTE_NAME_INFOW DWORD
 lpUniversalName AS WSTRINGZ PTR
 lpConnectionName AS WSTRINGZ PTR
 lpRemainingPath AS WSTRINGZ PTR
END TYPE
#IF %DEF(%UNICODE)
 MACRO REMOTE_NAME_INFO = REMOTE_NAME_INFOW
#ELSE
 MACRO REMOTE_NAME_INFO = REMOTE_NAME_INFOA
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WNetGetUniversalNameA LIB "Mpr.dll" ALIAS "WNetGetUniversalNameA" ( lpLocalPath AS ASCIIZ, BYVAL dwInfoLevel AS QUAD, BYVAL lpBuffer AS QUAD,
 lpBufferSize AS QUAD ) AS QUAD
#ELSE
DECLARE FUNCTION WNetGetUniversalNameA LIB "mpr.dll" ALIAS "WNetGetUniversalNameA" ( BYREF lpLocalPath AS ASCIIZ , BYVAL dwInfoLevel AS QUAD , BYREF lpBuffer AS ANY , BYREF lpBufferSize AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WNetGetUniversalNameW LIB "Mpr.dll" ALIAS "WNetGetUniversalNameW" ( lpLocalPath AS WSTRINGZ, BYVAL dwInfoLevel AS QUAD, BYVAL lpBuffer AS QUAD,
 lpBufferSize AS QUAD ) AS QUAD
#ELSE
DECLARE FUNCTION WNetGetUniversalNameW LIB "mpr.dll" ALIAS "WNetGetUniversalNameW" ( BYREF lpLocalPath AS WSTRINGZ , BYVAL dwInfoLevel AS QUAD , BYREF lpBuffer AS ANY , BYREF lpBufferSize AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%UNICODE)
 MACRO WNetGetUniversalName = WNetGetUniversalNameW
#ELSE
 MACRO WNetGetUniversalName = WNetGetUniversalNameA
#ENDIF
'//
'// Authentication and Logon/Logoff.
'//
DECLARE FUNCTION WNetGetUserA LIB "mpr.dll" ALIAS "WNetGetUserA" ( BYREF lpName AS ASCIIZ , BYREF lpUserName AS ASCIIZ , BYREF lpnLength AS QUAD ) AS QUAD
'//
'// Authentication and Logon/Logoff.
'//
DECLARE FUNCTION WNetGetUserW LIB "mpr.dll" ALIAS "WNetGetUserW" ( BYREF lpName AS WSTRINGZ , BYREF lpUserName AS WSTRINGZ , BYREF lpnLength AS QUAD ) AS QUAD
#IF %DEF(%UNICODE)
 MACRO WNetGetUser = WNetGetUserW
#ELSE
 MACRO WNetGetUser = WNetGetUserA
#ENDIF
'//
'// Other.
'//
'#if(WINVER >= 0x0400)
%EQUATE `WNFMT_MULTILINE = &H01
%EQUATE `WNFMT_ABBREVIATED = &H02
%EQUATE `WNFMT_INENUM = &H10
%EQUATE `WNFMT_CONNECTION = &H20
'#endif /* WINVER >= 0x0400 */
'#if(WINVER >= 0x0400)
DECLARE FUNCTION WNetGetProviderNameA LIB "mpr.dll" ALIAS "WNetGetProviderNameA" ( BYVAL dwNetType AS QUAD , BYREF lpProviderName AS ASCIIZ , BYREF lpBufferSize AS QUAD ) AS QUAD
DECLARE FUNCTION WNetGetProviderNameW LIB "mpr.dll" ALIAS "WNetGetProviderNameW" ( BYVAL dwNetType AS QUAD
 , BYREF lpProviderName AS WSTRINGZ
 , BYREF lpBufferSize AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetGetProviderName = WNetGetProviderNameW
#ELSE
 MACRO WNetGetProviderName = WNetGetProviderNameA
#ENDIF
' // Size = 32 bytes
TYPE NETINFOSTRUCT DWORD
 cbStructure AS DWORD
 dwProviderVersion AS DWORD
 dwStatus AS DWORD
 dwCharacteristics AS DWORD
 dwHandle AS DWORD ' ULONG_PTR
 wNetType AS WORD ' WORD
 dwPrinters AS DWORD
 dwDrives AS DWORD
END TYPE
%EQUATE `NETINFO_DLL16 = &H00000001 ' Provider running as 16 bit Winnet Driver
%EQUATE `NETINFO_DISKRED = &H00000004 ' Provider requires disk redirections to connect
%EQUATE `NETINFO_PRINTERRED = &H00000008 ' Provider requires printer redirections to connect
DECLARE FUNCTION WNetGetNetworkInformationA LIB "mpr.dll" ALIAS "WNetGetNetworkInformationA" ( BYREF lpProvider AS ASCIIZ , BYREF lpNetInfoStruct AS NETINFOSTRUCT ) AS QUAD
DECLARE FUNCTION WNetGetNetworkInformationW LIB "mpr.dll" ALIAS "WNetGetNetworkInformationW" ( BYREF lpProvider AS WSTRINGZ
 , BYREF lpNetInfoStruct AS NETINFOSTRUCT
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetGetNetworkInformation = WNetGetNetworkInformationW
#ELSE
 MACRO WNetGetNetworkInformation = WNetGetNetworkInformationA
#ENDIF
'#endif /* WINVER >= 0x0400 */
' *********************** BEGIN NOT IN WINDOWS VISTA SDK ************************
'//
'// User Profiles.
'//
'typedef UINT (FAR PASCAL *PFNGETPROFILEPATHA) (
' LPCSTR pszUsername,
' LPSTR pszBuffer,
' UINT cbBuffer
' );
'typedef UINT (FAR PASCAL *PFNGETPROFILEPATHW) (
' LPCWSTR pszUsername,
' LPWSTR pszBuffer,
' UINT cbBuffer
' );
'typedef UINT (FAR PASCAL *PFNRECONCILEPROFILEA) (
' LPCSTR pszCentralFile,
' LPCSTR pszLocalFile,
' DWORD dwFlags
' );
'typedef UINT (FAR PASCAL *PFNRECONCILEPROFILEW) (
' LPCWSTR pszCentralFile,
' LPCWSTR pszLocalFile,
' DWORD dwFlags
' );
%EQUATE `RP_LOGON = &H01 ' if set, do for logon, else for logoff
%EQUATE `RP_INIFILE = &H02 ' if set, reconcile .INI file, else reg. hive
'//
'// Policies.
'//
'typedef BOOL (FAR PASCAL *PFNPROCESSPOLICIESA) (
' HWND hwnd,
' LPCSTR pszPath,
' LPCSTR pszUsername,
' LPCSTR pszComputerName,
' DWORD dwFlags
' );
'typedef BOOL (FAR PASCAL *PFNPROCESSPOLICIESW) (
' HWND hwnd,
' LPCWSTR pszPath,
' LPCWSTR pszUsername,
' LPCWSTR pszComputerName,
' DWORD dwFlags
' );
%EQUATE `PP_DISPLAYERRORS = &H01 ' if set, display error messages, else fail silently if error
'#endif /* WINVER >= 0x0400 */
' ************************* END NOT IN WINDOWS VISTA SDK ************************
'//
'// Error handling.
'//
DECLARE FUNCTION WNetGetLastErrorA LIB "mpr.dll" ALIAS "WNetGetLastErrorA" ( BYREF lpError AS QUAD , BYREF lpErrorBuf AS ASCIIZ , BYVAL nErrorBufSize AS QUAD , BYREF lpNameBuf AS ASCIIZ , BYVAL nNameBufSize AS QUAD ) AS QUAD
DECLARE FUNCTION WNetGetLastErrorW LIB "mpr.dll" ALIAS "WNetGetLastErrorW" ( BYREF lpError AS QUAD
 , BYREF lpErrorBuf AS WSTRINGZ
 , BYVAL nErrorBufSize AS DWORD
 , BYREF lpNameBuf AS WSTRINGZ
 , BYVAL nNameBufSize AS DWORD
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO WNetGetLastError = WNetGetLastErrorW
#ELSE
 MACRO WNetGetLastError = WNetGetLastErrorA
#ENDIF
'//
'// STATUS CODES
'//
'// General
%EQUATE `WN_SUCCESS = %NO_ERROR
%EQUATE `WN_NO_ERROR = %NO_ERROR
%EQUATE `WN_NOT_SUPPORTED = %ERROR_NOT_SUPPORTED
%EQUATE `WN_CANCEL = %ERROR_CANCELLED
%EQUATE `WN_RETRY = %ERROR_RETRY
%EQUATE `WN_NET_ERROR = %ERROR_UNEXP_NET_ERR
%EQUATE `WN_MORE_DATA = %ERROR_MORE_DATA
%EQUATE `WN_BAD_POINTER = %ERROR_INVALID_ADDRESS
%EQUATE `WN_BAD_VALUE = %ERROR_INVALID_PARAMETER
%EQUATE `WN_BAD_USER = %ERROR_BAD_USERNAME
%EQUATE `WN_BAD_PASSWORD = %ERROR_INVALID_PASSWORD
%EQUATE `WN_ACCESS_DENIED = %ERROR_ACCESS_DENIED
%EQUATE `WN_FUNCTION_BUSY = %ERROR_BUSY
%EQUATE `WN_WINDOWS_ERROR = %ERROR_UNEXP_NET_ERR
%EQUATE `WN_OUT_OF_MEMORY = %ERROR_NOT_ENOUGH_MEMORY
%EQUATE `WN_NO_NETWORK = %ERROR_NO_NETWORK
%EQUATE `WN_EXTENDED_ERROR = %ERROR_EXTENDED_ERROR
%EQUATE `WN_BAD_LEVEL = %ERROR_INVALID_LEVEL
%EQUATE `WN_BAD_HANDLE = %ERROR_INVALID_HANDLE
'#if(WINVER >= 0x0400)
%EQUATE `WN_NOT_INITIALIZING = %ERROR_ALREADY_INITIALIZED
%EQUATE `WN_NO_MORE_DEVICES = %ERROR_NO_MORE_DEVICES
'#endif /* WINVER >= 0x0400 */
'// Connection
%EQUATE `WN_NOT_CONNECTED = %ERROR_NOT_CONNECTED
%EQUATE `WN_OPEN_FILES = %ERROR_OPEN_FILES
%EQUATE `WN_DEVICE_IN_USE = %ERROR_DEVICE_IN_USE
%EQUATE `WN_BAD_NETNAME = %ERROR_BAD_NET_NAME
%EQUATE `WN_BAD_LOCALNAME = %ERROR_BAD_DEVICE
%EQUATE `WN_ALREADY_CONNECTED = %ERROR_ALREADY_ASSIGNED
%EQUATE `WN_DEVICE_ERROR = %ERROR_GEN_FAILURE
%EQUATE `WN_CONNECTION_CLOSED = %ERROR_CONNECTION_UNAVAIL
%EQUATE `WN_NO_NET_OR_BAD_PATH = %ERROR_NO_NET_OR_BAD_PATH
%EQUATE `WN_BAD_PROVIDER = %ERROR_BAD_PROVIDER
%EQUATE `WN_CANNOT_OPEN_PROFILE = %ERROR_CANNOT_OPEN_PROFILE
%EQUATE `WN_BAD_PROFILE = %ERROR_BAD_PROFILE
%EQUATE `WN_BAD_DEV_TYPE = %ERROR_BAD_DEV_TYPE
%EQUATE `WN_DEVICE_ALREADY_REMEMBERED = %ERROR_DEVICE_ALREADY_REMEMBERED
%EQUATE `WN_CONNECTED_OTHER_PASSWORD = %ERROR_CONNECTED_OTHER_PASSWORD
'#if(WINVER >= 0x0501)
%EQUATE `WN_CONNECTED_OTHER_PASSWORD_DEFAULT = %ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT
'#endif /* WINVER >= 0x0501 */
'// Enumeration
%EQUATE `WN_NO_MORE_ENTRIES = %ERROR_NO_MORE_ITEMS
%EQUATE `WN_NOT_CONTAINER = %ERROR_NOT_CONTAINER
'#if(WINVER >= 0x0400)
'// Authentication
%EQUATE `WN_NOT_AUTHENTICATED = %ERROR_NOT_AUTHENTICATED
%EQUATE `WN_NOT_LOGGED_ON = %ERROR_NOT_LOGGED_ON
%EQUATE `WN_NOT_VALIDATED = %ERROR_NO_LOGON_SERVERS
'#endif /* WINVER >= 0x0400 */
'//
'// For Shell
'//
'#if(WINVER >= 0x0400)
' // Size = 20 bytes
TYPE NETCONNECTINFOSTRUCT DWORD
 cbStructure AS DWORD
 dwFlags AS DWORD
 dwSpeed AS DWORD
 dwDelay AS DWORD
 dwOptDataSize AS DWORD
END TYPE
%EQUATE `WNCON_FORNETCARD = &H00000001
%EQUATE `WNCON_NOTROUTED = &H00000002
%EQUATE `WNCON_SLOWLINK = &H00000004
%EQUATE `WNCON_DYNAMIC = &H00000008
DECLARE FUNCTION MultinetGetConnectionPerformanceA LIB "mpr.dll" ALIAS "MultinetGetConnectionPerformanceA" ( BYREF lpNetResource AS NETRESOURCEA , BYREF lpNetConnectInfoStruct AS NETCONNECTINFOSTRUCT ) AS QUAD
DECLARE FUNCTION MultinetGetConnectionPerformanceW LIB "mpr.dll" ALIAS "MultinetGetConnectionPerformanceW" ( BYREF lpNetResource AS NETRESOURCEW
 , BYREF lpNetConnectInfoStruct AS NETCONNECTINFOSTRUCT
 ) AS DWORD
#IF %DEF(%UNICODE)
 MACRO MultinetGetConnectionPerformance = MultinetGetConnectionPerformanceW
#ELSE
 MACRO MultinetGetConnectionPerformance = MultinetGetConnectionPerformanceA
#ENDIF
'#endif /* WINVER >= 0x0400 */
#ENDIF
