Solved

Router Programming

Posted on 2001-07-19
2
245 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generic progress indicator 6 116
maven archtype selection in eclipse 1 57
sum28 challenge 31 111
child constructor and parent constructor, overriding and overloading 6 84
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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

785 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