indexing description: "[ Information about a network resource. The structure is returned during enumeration of network resources. It is also specified when making or querying a network connection with calls to various Windows Networking functions. ]" date: "$Date$" revision: "$Revision$" class interface WEL_NET_RESOURCE create make ensure scope_set: scope = resource_globalnet type_set: type = resource_type_disk display_type_set: display_type = resource_display_type_generic usage_set: usage = resource_usage_connectable local_name_set: local_name = void remote_name_set: remote_name = void comment_set: comment = void provider_set: provider = void make_by_pointer (a_pointer: POINTER) -- Set item with a_pointer. -- Since item is shared, it does not need -- to be freed. -- Caution: a_pointer must be a pointer -- coming from Windows. -- (from WEL_ANY) ensure -- from WEL_ANY item_set: item = a_pointer shared: shared feature -- Access comment: STRING -- Comment supplied by the network provider. -- It can be Void if there is no supplied comment. display_type: INTEGER -- Value that indicates how the network object should be -- displayed in a network browsing user interface. ensure valid_result: Result = resource_display_type_domain or Result = resource_display_type_server or Result = resource_display_type_share or Result = resource_display_type_generic item: POINTER -- Generic Windows handle or structure pointer. -- Can be a HWND, HICON, RECT *, WNDCLASS *, etc... -- (from WEL_ANY) local_name: STRING -- If scope is equal to Resource_connected or -- Resource_remembered, it specifies the name of a local -- device. It is Void if the connection does not use a device. ensure valid_result: (Result /= void) = (scope = resource_connected or scope = resource_remembered) provider: STRING -- Name of the provider that owns the resource. -- It can be Void if the provider name is unknown. -- -- To retrieve the provider name, you can call -- WNetGetProviderName. remote_name: STRING -- If the entry is a network resource, it specifies the remote -- network name. -- -- If the entry is a current or persistent connection, it points -- to the network name associated with the name pointed to by -- local_name. -- -- The string can be MAX_PATH characters in length, and it must -- follow the network provider's naming conventions. scope: INTEGER -- Value that contains the scope of the enumeration. ensure valid_result: Result = resource_connected or Result = resource_globalnet or Result = resource_remembered type: INTEGER -- Value that contains a set of bit flags identifying the -- type of resource. ensure valid_result: Result = resource_type_any or Result = resource_type_disk or Result = resource_type_print usage: INTEGER -- Value that contains a set of bit flags describing how -- the resource can be used. ensure valid_result: Result = resource_usage_connectable or Result = resource_usage_container feature -- Status report exists: BOOLEAN -- Does the item exist? -- (from WEL_ANY) ensure -- from WEL_ANY Result = (item /= default_pointer) shared: BOOLEAN -- Is item shared by another object? -- If False (by default), item will -- be destroyed by destroy_item. -- If True, item will not be destroyed. -- (from WEL_ANY) feature -- Status setting set_shared -- Set shared to True. -- (from WEL_ANY) ensure -- from WEL_ANY shared: shared set_unshared -- Set shared to False. -- (from WEL_ANY) ensure -- from WEL_ANY unshared: not shared feature -- Element change set_comment (a_value: STRING) -- Set comment to a_value ensure value_set: equal (comment, a_value) set_display_type (a_value: INTEGER) -- Set display_type to a_value require valid_value: a_value = resource_display_type_domain or a_value = resource_display_type_server or a_value = resource_display_type_share or a_value = resource_display_type_generic ensure value_set: display_type = a_value set_item (an_item: POINTER) -- Set item with an_item -- (from WEL_ANY) ensure -- from WEL_ANY item_set: item = an_item set_local_name (a_value: STRING) -- Set local_name to a_value -- -- Can only be set if scope is equal to Resource_connected -- or Resource_remembered. require connection_use_device: scope = resource_connected or scope = resource_remembered ensure value_set: equal (local_name, a_value) set_provider (a_value: STRING) -- Set provider to a_value ensure value_set: equal (provider, a_value) set_remote_name (a_value: STRING) -- Set remote_name to a_value -- -- The string can be MAX_PATH characters in length, and it must -- follow the network provider's naming conventions. require valid_value: a_value.count <= max_path ensure value_set: equal (remote_name, a_value) set_scope (a_value: INTEGER) -- Set scope to a_value require valid_value: a_value = resource_connected or a_value = resource_globalnet or a_value = resource_remembered ensure value_set: scope = a_value set_type (a_value: INTEGER) -- Set type to a_value require valid_value: a_value = resource_type_any or a_value = resource_type_disk or a_value = resource_type_print ensure value_set: type = a_value set_usage (a_value: INTEGER) -- Set usage to a_value -- -- Note that this member can be specified only if scope -- is equal to Resource_globalnet require global_scope: scope = resource_globalnet valid_value: a_value = resource_usage_connectable or a_value = resource_usage_container ensure value_set: usage = a_value feature -- Removal dispose -- Destroy the inner structure of Current. -- -- This function should be called by the GC when the -- object is collected or by the user if Current is -- no more usefull. -- (from WEL_ANY) feature -- Conversion to_integer: INTEGER -- Converts item to an integer. -- (from WEL_ANY) ensure -- from WEL_ANY Result = cwel_pointer_to_integer (item) feature -- Basic operations initialize -- Fill Current with zeros. -- (from WEL_STRUCTURE) require -- from WEL_STRUCTURE exists: exists initialize_with_character (a_character: CHARACTER) -- Fill current with a_character. -- (from WEL_STRUCTURE) require -- from WEL_STRUCTURE exists: exists memory_copy (source_pointer: POINTER; length: INTEGER) -- Copy length bytes from source_pointer to item. -- (from WEL_STRUCTURE) require -- from WEL_STRUCTURE length_small_enough: length <= structure_size length_large_enough: length > 0 exists: exists feature -- Connect constants Connect_interactive: INTEGER is 8 -- If this flag is set, the operating system may interact with -- the user for authentication purposes. -- -- Declared in Windows as CONNECT_INTERACTIVE -- (from WEL_NETWORKING_CONSTANTS) Connect_localdrive: INTEGER is 256 -- If this flag is set, the connection was made using a local -- device redirection. If the lpAccessName parameter points to a -- buffer, the local device name is copied to the buffer. -- -- Declared in Windows as CONNECT_LOCALDRIVE -- (from WEL_NETWORKING_CONSTANTS) Connect_prompt: INTEGER is 16 -- This flag instructs the system not to use any default settings -- for user names or passwords without offering the user the -- opportunity to supply an alternative. This flag is ignored -- unless CONNECT_INTERACTIVE is also set. -- -- Declared in Windows as CONNECT_PROMPT -- (from WEL_NETWORKING_CONSTANTS) Connect_redirect: INTEGER is 128 -- This flag forces the redirection of a local device when making -- the connection. -- -- If the lpLocalName member of NETRESOURCE specifies a local -- device to redirect, this flag has no effect, because the -- operating system still attempts to redirect the specified -- device. When the operating system automatically chooses a local -- device, the lpAccessName parameter must point to a return -- buffer and the dwType member must not be equal to -- RESOURCETYPE_ANY. -- -- If this flag is not set, a local device is automatically chosen -- for redirection only if the network requires a local device to -- be redirected. -- -- Declared in Windows as CONNECT_REDIRECT -- (from WEL_NETWORKING_CONSTANTS) Connect_update_profile: INTEGER is 1 -- This flag instructs the operating system to store the network -- resource connection. -- -- If this bit flag is set, the operating system automatically -- attempts to restore the connection when the user logs on. The -- system remembers only successful connections that redirect -- local devices. It does not remember connections that are -- unsuccessful or deviceless connections. (A deviceless -- connection occurs when lpLocalName is NULL or when it points -- to an empty string.) -- -- If this bit flag is clear, the operating system does not -- automatically restore the connection at logon. -- -- Declared in Windows as CONNECT_UPDATE_PROFILE -- (from WEL_NETWORKING_CONSTANTS) feature -- Generic constants Max_path: INTEGER is 260 -- Maximum number of characters in full path -- -- Declared in Windows as MAX_PATH -- (from WEL_NETWORKING_CONSTANTS) feature -- Net Errors Error_access_denied: INTEGER is 5 -- Access to the network resource was denied. -- -- Declared in Windows as ERROR_ACCESS_DENIED -- (from WEL_NETWORKING_CONSTANTS) Error_already_assigned: INTEGER is 85 -- The local device specified by the lpLocalName member is -- already connected to a network resource. -- -- Declared in Windows as ERROR_ALREADY_ASSIGNED -- (from WEL_NETWORKING_CONSTANTS) Error_bad_device: INTEGER is 1200 -- The value specified by lpLocalName is invalid. -- -- Declared in Windows as ERROR_BAD_DEVICE -- (from WEL_NETWORKING_CONSTANTS) Error_bad_net_name: INTEGER is 67 -- The value specified by the lpRemoteName member is not -- acceptable to any network resource provider because the -- resource name is invalid, or because the named resource -- cannot be located. -- -- Declared in Windows as ERROR_BAD_NET_NAME -- (from WEL_NETWORKING_CONSTANTS) Error_bad_provider: INTEGER is 1204 -- The value specified by the lpProvider member does not match -- any provider. -- -- Declared in Windows as ERROR_BAD_PROVIDER -- (from WEL_NETWORKING_CONSTANTS) Error_cancelled: INTEGER is 1223 -- The attempt to make the connection was canceled by the user -- through a dialog box from one of the network resource -- providers, or by a called resource. -- -- Declared in Windows as ERROR_CANCELLED -- (from WEL_NETWORKING_CONSTANTS) Error_extended_error: INTEGER is 1208 -- A network-specific error occurred. To obtain a description of -- the error, call the WNetGetLastError function. -- -- Declared in Windows as ERROR_EXTENDED_ERROR -- (from WEL_NETWORKING_CONSTANTS) Error_invalid_address: INTEGER is 487 -- The caller passed in a pointer to a buffer that could not be -- accessed. -- -- Declared in Windows as ERROR_INVALID_ADDRESS -- (from WEL_NETWORKING_CONSTANTS) Error_invalid_parameter: INTEGER is 87 -- This error is a result of one of the following conditions: -- 1. The lpRemoteName member is NULL. In addition, lpAccessName -- is not NULL, but lpBufferSize is either NULL or points to -- zero. -- 2. The dwType member is neither RESOURCETYPE_DISK nor -- RESOURCETYPE_PRINT. In addition, either CONNECT_REDIRECT -- is set in dwFlags and lpLocalName is NULL, or the -- connection is to a network that requires the redirecting -- of a local device. -- -- Declared in Windows as ERROR_INVALID_PARAMETER -- (from WEL_NETWORKING_CONSTANTS) Error_invalid_password: INTEGER is 86 -- The specified password is invalid and the CONNECT_INTERACTIVE -- flag is not set. -- -- Declared in Windows as ERROR_INVALID_PASSWORD -- (from WEL_NETWORKING_CONSTANTS) Error_more_data: INTEGER is 234 -- The lpAccessName buffer is too small. -- If a local device is redirected, the buffer needs to be large -- enough to contain the local device name. Otherwise, the -- buffer needs to be large enough to contain either the string -- pointed to by lpRemoteName, or the name of the connectable -- resource whose alias is pointed to by lpRemoteName. If this -- error is returned, then no connection has been made. -- -- Declared in Windows as ERROR_MORE_DATA -- (from WEL_NETWORKING_CONSTANTS) Error_no_more_items: INTEGER is 259 -- The operating system cannot automatically choose a local -- redirection because all the valid local devices are in use. -- -- Declared in Windows as ERROR_NO_MORE_ITEMS -- (from WEL_NETWORKING_CONSTANTS) Error_no_net_or_bad_path: INTEGER is 1203 -- The operation could not be completed, either because a -- network component is not started, or because the specified -- resource name is not recognized. -- -- Declared in Windows as ERROR_NO_NET_OR_BAD_PATH -- (from WEL_NETWORKING_CONSTANTS) Error_no_network: INTEGER is 1222 -- The network is unavailable. -- -- Declared in Windows as ERROR_NO_NETWORK -- (from WEL_NETWORKING_CONSTANTS) feature -- Net Resource constants Resource_connected: INTEGER is 1 -- Enumerate currently connected resources. -- -- Declared in Windows as RESOURCE_CONNECTED -- (from WEL_NETWORKING_CONSTANTS) Resource_display_type_domain: INTEGER is 1 -- The object should be displayed as a domain. -- -- Declared in Windows as RESOURCEDISPLAYTYPE_DOMAIN -- (from WEL_NETWORKING_CONSTANTS) Resource_display_type_generic: INTEGER is 0 -- The method used to display the object does not matter. -- -- Declared in Windows as RESOURCEDISPLAYTYPE_GENERIC -- (from WEL_NETWORKING_CONSTANTS) Resource_display_type_server: INTEGER is 2 -- The object should be displayed as a server. -- -- Declared in Windows as RESOURCEDISPLAYTYPE_SERVER -- (from WEL_NETWORKING_CONSTANTS) Resource_display_type_share: INTEGER is 3 -- The object should be displayed as a share. -- -- Declared in Windows as RESOURCEDISPLAYTYPE_SHARE -- (from WEL_NETWORKING_CONSTANTS) Resource_globalnet: INTEGER is 2 -- Enumerate all resources on the network. -- -- Declared in Windows as RESOURCE_GLOBALNET -- (from WEL_NETWORKING_CONSTANTS) Resource_remembered: INTEGER is 3 -- Enumerate remembered (persistent) connections. -- -- Declared in Windows as RESOURCE_REMEMBERED -- (from WEL_NETWORKING_CONSTANTS) Resource_type_any: INTEGER is 0 -- All resources -- -- Declared in Windows as RESOURCETYPE_ANY -- (from WEL_NETWORKING_CONSTANTS) Resource_type_disk: INTEGER is 1 -- Disk resources -- -- Declared in Windows as RESOURCETYPE_DISK -- (from WEL_NETWORKING_CONSTANTS) Resource_type_print: INTEGER is 2 -- Print resources -- -- Declared in Windows as RESOURCETYPE_PRINT -- (from WEL_NETWORKING_CONSTANTS) Resource_usage_connectable: INTEGER is 1 -- The resource is a connectable resource -- -- Declared in Windows as RESOURCEUSAGE_CONNECTABLE -- (from WEL_NETWORKING_CONSTANTS) Resource_usage_container: INTEGER is 2 -- The resource is a container resource -- -- Declared in Windows as RESOURCEUSAGE_CONTAINER -- (from WEL_NETWORKING_CONSTANTS) invariant -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) end -- class WEL_NET_RESOURCE