MprAdminUserGetInfo (mpr)
Last changed: anonymous

.
Summary
Returns the state of the dialin and callback privileges.

C# Signature:

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

VB Signature:

Declare Function MprAdminUserGetInfo 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;

Tips & Tricks:

Please add some!

Sample Code:

private bool getDialin()
    {
        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());
        }

        if ((rasUser.bfPrivilege & RASPRIV_DialinPrivilege) == RASPRIV_DialinPrivilege)
        {
            dialInEnabled = true;
        }
        else
        {
            dialInEnabled = false;
        }
        }
        catch (Exception ex)
        {
        hasError = true;
        errorDescription = "MgtLib, getDialin: Exception with userId=<" + userId + ">: " + ex.Message;
        }

        return hasError;
    }

Documentation