Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
MprAdminUserSetInfo (mpr)
 
.
Summary
Sets the dialin and callback privilege.

C# Signature:

  [DllImport("mprapi.dll", SetLastError = false)]
    static extern UInt32 MprAdminUserSetInfo(
        [MarshalAs(UnmanagedType.LPWStr)]  string serverName,
        [MarshalAs(UnmanagedType.LPWStr)]  string userName,
        UInt32 Level,
        ref RAS_1 buffer);

VB Signature:

Declare Function MprAdminUserSetInfo Lib "mpr.dll" (TODO) As TODO

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

private const byte RASPRIV_NoCallback = 1;

private const byte RASPRIV_AdminSetCallback = 2;

private const byte RASPRIV_CallerSetCallback = 4;

private const byte RASPRIV_DialinPrivilege = 8;

private const byte RASPRIV_NoDialInPrivilege = 255 - RASPRIV_DialinPrivilege;

Tips & Tricks:

Please add some!

Sample Code:

    private bool setDialin()
    {
        bool hasError = false;

        try
        {
        RAS_1 rasUser = new RAS_1();
        UInt32 result = MprAdminUserGetInfo(serverName, userId, 1, ref rasUser);
        if (result != 0)
        {
            throw new Exception("MprAdminUserGetInfo failed with code " + result.ToString());
        }

        // enable/disable dial in
        if (dialInEnabled)
        {
            rasUser.bfPrivilege |= RASPRIV_DialinPrivilege;
        }
        else
        {
            rasUser.bfPrivilege &= RASPRIV_NoDialInPrivilege;
        }

        result = MprAdminUserSetInfo(serverName, userId, 1, ref rasUser);
        if (result != 0)
        {
            throw new Exception("MprAdminUserSetInfo failed with code " + result.ToString());
        }
        }
        catch (Exception ex)
        {
        hasError = true;
        errorDescription = "MgtLib, setDialin: Exception with userId=<" + userId + "> and enable=<" + dialInEnabled.ToString() + ">: " + ex.Message;
        }

        return hasError;
    }

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions