Platform SDK: Network Management |
The NetDfsSetInfo function associates information with a Distributed File System (Dfs) link in the named Dfs root. The function can set information relevant to a specific server and share, or information specific to an entire Dfs link.
Administrator privileges are required to successfully execute the NetDfsSetInfo function.
NET_API_STATUS NetDfsSetInfo( LPWSTR DfsEntryPath, // Dfs entry path for the Dfs link LPWSTR ServerName OPTIONAL, // name of server exporting the storage LPWSTR ShareName OPTIONAL, // name of share exporting the storage DWORD Level, // level of information to be set LPBYTE Buffer // buffer holding information );
\\Dfsname\sharename\path_to_link
where Dfsname is the name of a Windows NT/Windows 2000 server that hosts the root of a stand-alone Dfs implementation; sharename is the name of a share published on the Dfs host server; and path_to_link specifies the path on the physical share.
The second form is as follows:
\\DomainName\DomDfsname\path_to_link
where DomainName is the name of a Windows NT/Windows 2000 domain that hosts the Dfs root; DomDfsname is the name of the root of a domain-based Dfs implementation published in the domain's directory service; and path_to_link specifies the path on the physical share.
Windows 95/98: The DomDfsname must be identical to the name of the share that hosts the root of the domain-based Dfs.
Value | Meaning |
---|---|
100 | Set the comment associated with the Dfs link. The Buffer parameter points to a DFS_INFO_100 structure. |
101 | Set the storage state associated with the Dfs link. The Buffer parameter points to a DFS_INFO_101 structure. |
102 | Set the time-out value associated with the Dfs link. The Buffer parameter points to a DFS_INFO_102 structure. |
If the function succeeds, the return value is NERR_Success.
If the function fails, the return value is a Win32 API error code. For a list of error codes, see Error Codes.
If you specify both the ServerName and ShareName parameters, the NetDfsSetInfo function returns information specific to that server and share. If the parameters are not specified, the function returns information that is specific to the entire Dfs link.
The following code sample demonstrates how to associate a comment with a Dfs link using a call to the NetDfsSetInfo function. The sample specifies information level 100 (DFS_INFO_100).
#define UNICODE #include <windows.h> #include <lm.h> #include <lmdfs.h> #include <stdio.h> void wmain(int argc, wchar_t *argv[ ]) { DFS_INFO_100 dfsData; DWORD res; // // Check command line arguments. // if (argc<2) wprintf(L"Syntax: %s DfsEntryPath [\"Comment\"]\n", argv[0]); else { // // Fill in DFS_INFO_100 structure member. // dfsData.Comment = argc < 3 ? NULL : argv[2]; // // Call the NetDfsSetInfo function, specifying level 100. // res=NetDfsSetInfo(argv[1], NULL, NULL, 100, (LPBYTE) &dfsData); // // Display the result of the call. // if(res == 0) printf("Comment set.\n"); else printf("Error: %u", res); } return; }
Windows NT/2000: Requires Windows NT 4.0 or later.
Windows 95/98: Unsupported.
Header: Declared in Lmdfs.h; include Lm.h.
Library: Use Netapi32.lib.
Network Management Overview, Network Management Functions, Distributed File System (Dfs) Functions, DFS_INFO_100, DFS_INFO_101, DFS_INFO_102, NetDfsEnum