Self-built RAS Administration DLL

Source: Internet
Author: User
The rest of this article is the content of msdn. My own experiences are as follows:

  • The prototype of the mpradmininitializedll function is defined as void in the built-in msdn of vs2003. If you follow this prototype, it will become ugly. The correct prototype is a DWORD type defined in online msdn (noerror indicates success)
  • The user IP address provided by mpradminacceptnewconnection is actually a virtual IP address, rather than its real IP address. Therefore, it is of little use (you cannot determine whether the user is legal based on an IP address ).
  • If you want to use mpradminserverconnect to obtain the RAS handle, you cannot call it in functions such as mpradmininitializedll. Because the RAS has not been successfully started yet, rpc_s_unknown_if will be returned, while calling in other events may lead to deadlocks, so, I started a thread in mpradmininitializedll and tried it every second until it was successfully obtained. Usually I will use the queueuserworkitem API to do this.
Ras refers to remote access service, while RAS Administration DLL refers to a dynamic link library written by the user. It implements the specified functions and is loaded by Ras, when a user is connected to or disconnected, Ras automatically calls these functions to enable additional requirements. For example, you can decide whether to allow a user to connect to the database, you can also specify the IP address (Virtual Network) for the user to record the log during the connection and disconnection: to let Ras know where the DLL we have compiled is, you must create a key named HKEY_LOCAL_MACHINE/software/Microsoft/RAS/admindll in the Registry, and then create two string values under the key:
Name Value Example
Displayname Custom display name, which can be specified at will. No sound at the sound
Dllpath The full name of the dll path. Multiple DLL names are separated by commas (,). However, Windows 2000 server does not support multiple DLL names. Currently, only 2003 is supported) C:/Foo/bar. dll

Dll must at least implement and export the following four functions, otherwise the RAS startup will fail:

  • Mpradminacceptnewlink
  • Mpradmininitializedll
  • Mpradminlinkhangupnotification
  • Mpradminterminatedll

Usually, it will implement and export (or what will the DLL do ?) :

  • Mpradminacceptnewconnection
  • Mpradminconnectionhangupnotification

Or

  • Mpradminacceptnewconnection2
  • Mpradminconnectionhangupnotification2
In Windows 2000 Server, dll must also implement the mpradmingetipaddressforuser and mpradminreleaseipaddress functions.

Contact Us

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.