Solved

Router Programming

Posted on 2001-07-19
2
243 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
Comment Utility
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
Comment Utility
ah I see it is in the platform SDK and its defined as

DWORD MprAdminServerConnect(LPWSTR, MPR_SERVER_HANDLE *);

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 149
Define unique primary key 9 81
iSeries DB2 Query 2 83
modThree challenge 4 64
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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