Results 1 to 6 of 6

Thread: Getting functions from a DLL

  1. #1
    appi101
    Guest
    Hi

    How do I use the API viewer to extract a declaration from a function in a DLL?

    Ex - The MSDN library says that there is a function called Rasadminportgetinfo but I could not find it in the API viewer. It gives a C++ definition for it which I can't understand but I think that the function is in the rassadmin.dll file. How do I get the declaration for it in VB?

  2. #2
    Addicted Member KrishnaSantosh's Avatar
    Join Date
    Feb 2001
    Location
    Coimbatore
    Posts
    210
    Can You Specify The C++ Defn. So That It Could Be Converted To VBs Syntax.

  3. #3
    Guest
    The declaration for the function is

    DWORD RasAdminPortGetInfo(
    const WCHAR *lpszServer, // pointer to the server name
    const WCHAR *lpszPort, // pointer to the name of port on the
    // server
    RAS_PORT_1 *pRasPort1, // receives the state of the port
    RAS_PORT_STATISTICS *pRasStats,
    // receives statistics about the port
    RAS_PARAMETERS **ppRasParams
    // receives an array of media-specific
    // parameters and values
    );

    and for the RAS_PORT_1 structure is

    typedef struct _RAS_PORT_1 {
    RAS_PORT_0 rasport0;
    DWORD LineCondition;
    DWORD HardwareCondition;
    DWORD LineSpeed;
    WORD NumStatistics;
    WORD NumMediaParms;
    DWORD SizeMediaParms;
    RAS_PPP_PROJECTION_RESULT ProjResult;
    } RAS_PORT_1, *PRAS_PORT_1;

    and for the RAS_PORT_0 structure is

    typedef struct _RAS_PORT_0 {
    WCHAR wszPortName[RASSAPI_MAX_PORT_NAME];
    WCHAR wszDeviceType[RASSAPI_MAX_DEVICETYPE_NAME];
    WCHAR wszDeviceName[RASSAPI_MAX_DEVICE_NAME];
    WCHAR wszMediaName[RASSAPI_MAX_MEDIA_NAME];
    DWORD reserved;
    DWORD Flags;
    WCHAR wszUserName[UNLEN + 1];
    WCHAR wszComputer[NETBIOS_NAME_LEN];
    DWORD dwStartSessionTime;
    WCHAR wszLogonDomain[DNLEN + 1];
    BOOL fAdvancedServer;
    } RAS_PORT_0, *PRAS_PORT_0;

    and for the RAS_PORT_STATISTICS structure is

    typedef struct _RAS_PORT_STATISTICS
    {
    // The connection statistics are followed by port statistics
    // A connection is across multiple ports.
    DWORD dwBytesXmited;
    DWORD dwBytesRcved;
    DWORD dwFramesXmited;
    DWORD dwFramesRcved;
    DWORD dwCrcErr;
    DWORD dwTimeoutErr;
    DWORD dwAlignmentErr;
    DWORD dwHardwareOverrunErr;
    DWORD dwFramingErr;
    DWORD dwBufferOverrunErr;
    DWORD dwBytesXmitedUncompressed;
    DWORD dwBytesRcvedUncompressed;
    DWORD dwBytesXmitedCompressed;
    DWORD dwBytesRcvedCompressed;

    // the following are the port statistics
    DWORD dwPortBytesXmited;
    DWORD dwPortBytesRcved;
    DWORD dwPortFramesXmited;
    DWORD dwPortFramesRcved;
    DWORD dwPortCrcErr;
    DWORD dwPortTimeoutErr;
    DWORD dwPortAlignmentErr;
    DWORD dwPortHardwareOverrunErr;
    DWORD dwPortFramingErr;
    DWORD dwPortBufferOverrunErr;
    DWORD dwPortBytesXmitedUncompressed;
    DWORD dwPortBytesRcvedUncompressed;
    DWORD dwPortBytesXmitedCompressed;
    DWORD dwPortBytesRcvedCompressed;

    } RAS_PORT_STATISTICS, *PRAS_PORT_STATISTICS;

    and for the last structure RAS_PARAMETERS is

    struct RAS_PARAMETERS {
    CHAR P_Key [RASSAPI_MAX_PARAM_KEY_SIZE];
    RAS_PARAMS_FORMAT P_Type;
    BYTE P_Attributes;
    RAS_PARAMS_VALUE P_Value;
    };

    & the last one is

    enum RAS_PARAMS_FORMAT {
    ParamNumber = 0,
    ParamString = 1
    } ;

    If you could tell me how to translate these declarations I'd be most grateful.

  4. #4
    Guest
    The declaration for the function is

    DWORD RasAdminPortGetInfo(
    const WCHAR *lpszServer, // pointer to the server name
    const WCHAR *lpszPort, // pointer to the name of port on the
    // server
    RAS_PORT_1 *pRasPort1, // receives the state of the port
    RAS_PORT_STATISTICS *pRasStats,
    // receives statistics about the port
    RAS_PARAMETERS **ppRasParams
    // receives an array of media-specific
    // parameters and values
    );

    and for the RAS_PORT_1 structure is

    typedef struct _RAS_PORT_1 {
    RAS_PORT_0 rasport0;
    DWORD LineCondition;
    DWORD HardwareCondition;
    DWORD LineSpeed;
    WORD NumStatistics;
    WORD NumMediaParms;
    DWORD SizeMediaParms;
    RAS_PPP_PROJECTION_RESULT ProjResult;
    } RAS_PORT_1, *PRAS_PORT_1;

    and for the RAS_PORT_0 structure is

    typedef struct _RAS_PORT_0 {
    WCHAR wszPortName[RASSAPI_MAX_PORT_NAME];
    WCHAR wszDeviceType[RASSAPI_MAX_DEVICETYPE_NAME];
    WCHAR wszDeviceName[RASSAPI_MAX_DEVICE_NAME];
    WCHAR wszMediaName[RASSAPI_MAX_MEDIA_NAME];
    DWORD reserved;
    DWORD Flags;
    WCHAR wszUserName[UNLEN + 1];
    WCHAR wszComputer[NETBIOS_NAME_LEN];
    DWORD dwStartSessionTime;
    WCHAR wszLogonDomain[DNLEN + 1];
    BOOL fAdvancedServer;
    } RAS_PORT_0, *PRAS_PORT_0;

    and for the RAS_PORT_STATISTICS structure is

    typedef struct _RAS_PORT_STATISTICS
    {
    // The connection statistics are followed by port statistics
    // A connection is across multiple ports.
    DWORD dwBytesXmited;
    DWORD dwBytesRcved;
    DWORD dwFramesXmited;
    DWORD dwFramesRcved;
    DWORD dwCrcErr;
    DWORD dwTimeoutErr;
    DWORD dwAlignmentErr;
    DWORD dwHardwareOverrunErr;
    DWORD dwFramingErr;
    DWORD dwBufferOverrunErr;
    DWORD dwBytesXmitedUncompressed;
    DWORD dwBytesRcvedUncompressed;
    DWORD dwBytesXmitedCompressed;
    DWORD dwBytesRcvedCompressed;

    // the following are the port statistics
    DWORD dwPortBytesXmited;
    DWORD dwPortBytesRcved;
    DWORD dwPortFramesXmited;
    DWORD dwPortFramesRcved;
    DWORD dwPortCrcErr;
    DWORD dwPortTimeoutErr;
    DWORD dwPortAlignmentErr;
    DWORD dwPortHardwareOverrunErr;
    DWORD dwPortFramingErr;
    DWORD dwPortBufferOverrunErr;
    DWORD dwPortBytesXmitedUncompressed;
    DWORD dwPortBytesRcvedUncompressed;
    DWORD dwPortBytesXmitedCompressed;
    DWORD dwPortBytesRcvedCompressed;

    } RAS_PORT_STATISTICS, *PRAS_PORT_STATISTICS;

    and for the last structure RAS_PARAMETERS is

    struct RAS_PARAMETERS {
    CHAR P_Key [RASSAPI_MAX_PARAM_KEY_SIZE];
    RAS_PARAMS_FORMAT P_Type;
    BYTE P_Attributes;
    RAS_PARAMS_VALUE P_Value;
    };

    & the last one is

    enum RAS_PARAMS_FORMAT {
    ParamNumber = 0,
    ParamString = 1
    } ;

    I couldn't find this declaration in the API guide or the API toolshed or the website.

    If you could tell me how to translate these declarations I'd be most grateful.

    Thanks for your help.

  5. #5
    Guest
    Here is the declaration (I think..)
    Code:
    Declare Function RasAdminPortGetInfo Lib "rassadmin.dll" (ByVal lpszServer As String, ByVal lpszPort As String, pRasPort1 As RAS_PORT_1, pRasStatus As RAS_PORT_STATISTICS, pRasParams As RAS PARAMETERS) As Long
    For the the structures, simply convert it to a Type. then change the datatypes; DWORD = Long, WCHAR = String.

  6. #6
    New Member
    Join Date
    Jul 2002
    Posts
    13
    hello,

    I just hoped that you can help me and if you have found out any guide about RASADMINPORTGETINFO API and how to impliment it in VB tell me how to do it too.

    my email is : [email protected]

    I would appriciate it so much.
    thanks in advance.
    roseta.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width