PDA

Click to See Complete Forum and Search --> : Getting functions from a DLL


appi101
Feb 21st, 2001, 02:23 AM
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?

KrishnaSantosh
Feb 21st, 2001, 09:10 AM
Can You Specify The C++ Defn. So That It Could Be Converted To VBs Syntax.

Feb 21st, 2001, 07:57 PM
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.

Feb 21st, 2001, 07:59 PM
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.

Feb 22nd, 2001, 02:31 PM
Here is the declaration (I think..)

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.

roseta
Jul 8th, 2002, 12:37 AM
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 : roseta@ramanafzar.com

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