Solved

Router Programming

Posted on 2001-07-19
2
244 Views
Last Modified: 2013-11-20
Hello All,

I am programming to connect to a router using MPRAPI.lib

Can anybody please help me in debugging this.
I have called the very first function:

CString lpszServerName("Cisco");
BSTR lpwsServerName;
lpwsServerName = lpszServerName.AllocSysString();
MPR_SERVER_HANDLE *phMprServer;
DWORD pRouterConnect;

pRouterConnect = MprAdminServerConnect(                              lpwsServerName,          phMprServer);                                  
On Executing this code I am getting the following error:

(RPCRT4.DLL): 0xC0000005: Access Violation.

Can anybody help me out in solving this, please.

Thanks,
Shobha
0
Comment
Question by:shobha_jk
  • 2
2 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6297638
what is the signature of MprAdminServerConnect ??

from what you have shown it would be

DWORD MprAdminServerConnect(BSTR,MPR_SERVER_HANDLE *);

however I think it might be

DWORD MprAdminServerConnect(LPCWSTR, MPR_SERVER_HANDLE *);

now the first parameter looke like an [in] and the second looks like an [out] parameter - who is responsible for allocation of the second parameter maybe this is what you should have

MPR_SERVER_HANDLE hMprServer;
CString szServerName("Cisco");
DWORD dwRouterConnect;
USES_CONVERSION;
dwRouterConnect = MprAdminServerConnect(T2W(szServerName), &hMprServer);
                                 
just a guess

0
 
LVL 9

Accepted Solution

by:
ShaunWilde earned 100 total points
ID: 6297642
ah I see it is in the platform SDK and its defined as

DWORD MprAdminServerConnect(LPWSTR, MPR_SERVER_HANDLE *);

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 124
Excel Use VBA to get user's Mac Address for their computer 5 107
wordcount challenge 11 102
Message not shown 5 27
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now