Re: MprAdminInterfaceEnum

From: Juan Ignacio Gelos (msnews_at_juanignaciogelos.com)
Date: 12/01/04

  • Next message: Eric: "interop delegate for COM"
    Date: Wed, 1 Dec 2004 04:56:05 -0300
    
    

    Also, in case anyone else is looking for info on MprAdmin, it uses
    Unicode... so all the DllImport's should use CharSet = CharSet.Unicode

    "Juan Ignacio Gelos" <msnews@juanignaciogelos.com> wrote in message
    news:Ob5P9pu1EHA.1452@TK2MSFTNGP11.phx.gbl...
    > Hi,
    >
    > Trying to enumerate interfaces on RRAS.
    > Bellow is what I have so far. The MprAdminInterfaceEnum has an
    > lplpbBuffer out parameter which is a buffer that will contain an array of
    > MPR_INTERFACE_0's.
    > I want to access the wszInterfaceName for each interface. How should I
    > marshal this parameter?
    >
    > Thanks,
    > Juan
    >
    > /// <summary>
    > /// The MprAdminInterfaceEnum function enumerates all the interfaces on
    a
    > specified server.
    > /// </summary>
    > /// <param name="hMprServer">[in] Handle to the router on which to
    execute
    > this call. Obtain this handle by calling MprAdminServerConnect.</param>
    > /// <param name="dwLevel">[in] Specifies the level of information passed
    > in lpBuffer. Must be zero.</param>
    > /// <param name="lplpbBuffer">[out] Pointer to a pointer variable that
    > points to an array of MPR_INTERFACE_0 structures on successful return.
    This
    > memory must be freed by a call to the MprAdminBufferFree function.</param>
    > /// <param name="dwPrefMaxLen">[in] Specifies the preferred maximum
    length
    > of returned data (in 8-bit bytes). If this parameter is -1, the buffer
    > returned is large enough to hold all available information. </param>
    > /// <param name="lpdwEntriesRead">[out] Pointer to a DWORD variable.
    This
    > variable receives the total number of interfaces that were enumerated from
    > the current position in the enumeration.</param>
    > /// <param name="lpdwTotalEntries">[out] Pointer to a DWORD variable.
    This
    > variable receives the total number of interfaces that could have been
    > enumerated from the current resume position.</param>
    > /// <param name="lpdwResumeHandle">[in] Pointer to a DWORD variable.
    This
    > variable specifies a resume handle that can be used to continue the
    > enumeration. The handle should be zero on the first call, and left
    unchanged
    > on subsequent calls. If the return code is ERROR_MORE_DATA then the call
    can
    > be re-issued using the handle to retrieve more data. If on return, the
    > handle is NULL, the enumeration cannot be continued. For other types of
    > error returns, this handle is invalid.
    > /// This parameter is optional. If the calling application specifies
    NULL
    > for this parameter, the function does not return a resume handle.</param>
    > /// <returns></returns>
    > /// <remarks><code>
    > /// DWORD APIENTRY
    > /// MprAdminInterfaceEnum(
    > /// IN MPR_SERVER_HANDLE hMprServer,
    > /// IN DWORD dwLevel,
    > /// OUT LPBYTE * lplpbBuffer,
    > /// IN DWORD dwPrefMaxLen,
    > /// OUT LPDWORD lpdwEntriesRead,
    > /// OUT LPDWORD lpdwTotalEntries,
    > /// IN LPDWORD lpdwResumeHandle OPTIONAL
    > /// );
    > /// </code></remarks>
    > [DllImport("Mprapi.dll", CharSet = CharSet.Ansi)]
    > public static extern int MprAdminInterfaceEnum(
    > IntPtr hMprServer,
    > [MarshalAs(UnmanagedType.U4)]
    > int dwLevel,
    >
    > ref MPR_INTERFACE_0[] lplpbBuffer,
    > int dwPrefMaxLen,
    > ref int lpdwEntriesRead,
    > ref int lpdwTotalEntries,
    > ref int lpdwResumeHandle
    > );
    >
    >
    >
    > [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
    > public struct MPR_INTERFACE_0
    > {
    > [MarshalAs(UnmanagedType.ByValTStr, SizeConst =
    > MprApi.MAX_INTERFACE_NAME_LEN+1)]
    > public string wszInterfaceName;
    > public IntPtr hInterface;
    > public bool fEnabled;
    > public ROUTER_INTERFACE_TYPE dwIfType;
    > public ROUTER_CONNECTION_STATE dwConnectionState;
    > public UnreachabilityReasons fUnReachabilityReasons;
    > public int dwLastError;
    > }
    >
    >


  • Next message: Eric: "interop delegate for COM"

    Relevant Pages

    • Re: MprAdminInterfaceEnum
      ... > Trying to enumerate interfaces on RRAS. ... the enumeration cannot be continued. ... > public static extern int MprAdminInterfaceEnum( ...
      (microsoft.public.dotnet.framework.interop)
    • MprAdminInterfaceEnum
      ... variable receives the total number of interfaces that were enumerated from ... the enumeration cannot be continued. ... ref int lpdwTotalEntries, ...
      (microsoft.public.dotnet.framework.interop)
    • Re: enum type int or unsigned int?
      ... that have type int and may appear wherever such are permitted. ... values of all the members of the enumeration. ... "enum" types are declared via the following syntax: ... so the loop will continue to run. ...
      (comp.lang.c)
    • Re: typedef declares object / enum to int
      ... which clean compiles on my GNU compiler. ... Enumeration constants are exactly that: ... Enumerators are int anyway, whereas the enumeration ... > enumerator being converted to an int seems meaningless; and a warning ...
      (comp.lang.c)
    • Re: enum type int or unsigned int?
      ... that have type int and may appear wherever such are permitted. ... values of all the members of the enumeration. ... "enum" types are declared via the following syntax: ... so the loop will continue to run. ...
      (comp.lang.c)