Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
After understanding the programming methods of the client program and the basics of the ADSI provider, let's take a look at the interaction process from the client to the ADSI provider component (shown in Figure 4) to deepen the reader's understanding of ADSI.
Figure 4 Interaction between a client and an ADSI provider
The client first sends an object binding request to ADSI (step 1 in the figure), and the ADSI component extracts the string that identifies the provider ProgID, such as "WinNT", "LDAP", or a custom provider ProgID, based on the ADSI object path given by the customer. Further find the CLSID corresponding to this ProgID in the registry (step 2 in figure). Then load the provider component program (step 3 in the figure), and the next task goes to the provider component, which creates the object and returns it to the ADSI component (step 4 in the figure), further back to the client (step 5 in the figure). Later, the client communicates directly with the directory object (step 6 in the figure). This is the implementation of the client-bound ADSI directory object.
Iv. Examples of ADSI procedures
In this section we'll introduce an ADSI program Dsbrowse, a VB Form window program that can browse all ADSI providers on the current machine, Figure 5 shows the initial state of the Dsbrowse run, and a list of directory objects after the NT domain is opened.
(a) initial run state (b) state after opening the Winnt domain
Fig. 5 Example program Dsbrowse operation sketch
The Dsbrowse example program is very simple, in the Form window initialization function, according to the program specified by the root path, the object that it contains enumeration. The default scenario is that we specified "ADS:" In the initial path, which is the total root of ADSI, containing all namespaces on the current machine, as shown in Figure 5 (a), Dsbrowse lists the 5 namespaces on the current machine: IIS, LDAP, NDS, Nwcompat, and Winnt. Some namespaces need to specify the appropriate server, can not do without server enumeration, so we can not directly enumerate with Dsbrowse, but some namespaces can do without server enumeration, the name space we can click the plus sign before the name space to list its inclusive directory object or child package container object. For example, we click on the "WinNT" namespace to list all NT domains in the current network environment, and click on an NT domain name to list all directory objects in this domain, including users, computers, user groups, services, and so on.
We select an object in the tree control of the window, then click the "Properties" button in the upper right corner, and the Dsbrowse program displays the attribute information of the selected object in a dialog box, as shown in Figure 6. The Properties dialog box lists the name of the object, the path, whether it is a package container object, and its property sheet, which allows the user to modify the properties of the object through the lower control.
Figure 6 Dsbrowse of the program's Properties dialog box
Readers can get the main source code for the Dsbrowse program from Visual Studio's Visual C + + sample, which is located in the Samplessdk etdsadsisampappdsbrowse directory. There is also a Visual C + + Example program Adscmd in the Sampapp directory, which can access the specified directory object directly from the command-line arguments, or it can list all child objects of the package container object. For example, we can list the mailbox information for Microsoft Exchange Server by Adscmd:
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.