Re: Using the Exchange Backup API

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello Scott,
My reply to your questions:
You have presented us with some assumptions you have made, but not justified:
Q * Just because the LoadLibrary succeeded, how can you assume that the
function call should succeed?
Answer: The function is a standard function in the Microsoft Exchange Backup
and Restore API. Per API instructions I am using the function on the machine
with the Exchange Server installed and running. The LodLibrary for loading
the dll is successful and the function called is a standard API function
hence I assume that the function should succeed. If it does not then the only
possible error could be in the way I invoke it or any mismatch in parameters.

Q * You called GetProcAddress, but made no attempt to confirm that it
actually succeeded in getting a pointer to that function.
Answer: I had checked whether GetProcAddress returns a valid pointer, but to
reduce the sixe of the post I removed the line as I knew that the application
was not failing at that point. While debugging I see that GetProcAddress
returns a valid pointer.

Q * Even if the function pointer is valid, how can we assume that it isn't
the function which you are calling that causes the "crash"?
Answer: As I said in my earlier answers I am trying to call a standard API
function in the relevent environment. I see that the dll is loading properly
using the LoadLibrary and also see that I am able to get valid address for
the function using GetProcAddress. I also see in step by step debuggging that
the application crashes in the very next step where I try to invoke the
function using the address obtained using GetProcAddress. Based on all the
above factors I cannot think of any other step failing but the step where I
invoke the function.

Q * You refer to a "crash", but you don't explain how that is manifested.
Error message? Exception? Program Termination?
Answer: The error I am getting is Unhandled exception in
MNUExchangeBackup.exe (ESEBCLI2.DLL): 0xC0000005: Access Violation.

Thanks,
Viraj
a.viraj@xxxxxxxxxxxx
http://www.mobiliti.com



"Scot T Brennecke" wrote:

> You have presented us with some assumptions you have made, but not justified:
> * Just because the LoadLibrary succeeded, how can you assume that the function call should succeed?
> * You called GetProcAddress, but made no attempt to confirm that it actually succeeded in getting a
> pointer to that function.
> * Even if the function pointer is valid, how can we assume that it isn't the function which you are
> calling that causes the "crash"?
> * You refer to a "crash", but you don't explain how that is manifested. Error message? Exception?
> Program Termination?
>
> "Viraj" <Viraj@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:565C6614-35F1-406E-9FEB-D651653C64E6@xxxxxxxxxxxxxxxx
> > Hello All,
> >
> > I am trying to write an application to backup Exchange server. Below is the
> > function I have written for it. I am using VC++ 6.0 and M.S. Exchange server
> > 2003. My application crashes when I invoke the function
> > HrESEBackupRestoreGetNodes.
> >
> > BOOL BackupExchangeServer(HINSTANCE g_hESEDll)
> > {
> > BACKUP_NODE_TREE *pMNUBackupNodeTree;
> > typedef HRESULT (* HrESEBackupRestoreGetNodes) (IN WCHAR*
> > wszComputerName,OUT BACKUP_NODE_TREE* pBackupNodeTree);
> > HrESEBackupRestoreGetNodes fnMNUBackupRestoreGetNodes = NULL;
> > fnMNUBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes) GetProcAddress
> > (g_hESEDll,"HrESEBackupRestoreGetNodes");
> > //my program crashes in the next line.
> > HRESULT hr = (fnMNUBackupRestoreGetNodes) (NULL, pMNUBackupNodeTree);
> > if(hr == S_OK)
> > return MNU_EXCHANGE_BKP_SUCCESS;
> > else
> > return MNU_EXCHANGE_BKP_FAILURE;
> > }
> >
> > The Lod Library successfully loads the dll "esebcli2.dll". Hence the
> > function HrESEBackupRestoreGetNodes should return success, but it fails.
> >
> > Can anyone please point the mistake in my code or give me sample code for
> > Backup Functions.
> >
> > Thanks,
> > Viraj
> > a.viraj@xxxxxxxxxxxx
> > http://www.mobiliti.com
> >
> >
>
>
>
.



Relevant Pages

  • Re: Using the Exchange Backup API
    ... Given that you're getting an access violation exception, it makes me suspect that your pointer is ... You say that the GetProcAddress returned with a valid pointer, ... > possible error could be in the way I invoke it or any mismatch in parameters. ...
    (microsoft.public.vc.mfc)
  • Re: Using the Exchange Backup API
    ... violation is some addrees after the address of the Function Pointer. ... You say that the GetProcAddress returned with a valid pointer, ... As I said in my earlier answers I am trying to call a standard API ...
    (microsoft.public.vc.mfc)
  • Re: Calling functions of derived types, pointers and memory leakage
    ... You don't need to make a temporary variable, invoke the ... And if you have a function that returns a pointer, ... use the data from the calling routine inside of the function, ... It is important to understand something about functions and assignment ...
    (comp.lang.fortran)
  • Re: Using the Exchange Backup API
    ... Given that, Viraj, it seems to me that the function you are calling ... pointer, or maybe the computer name parameter is not allowed to be NULL? ... >> Given that you're getting an access violation exception, it makes me suspect that your pointer is ... You say that the GetProcAddress returned with a valid pointer, ...
    (microsoft.public.vc.mfc)
  • Re: get function name for the GetProcAddress function
    ... dereferencing the pointer that GetProcAddress returns. ... delegate when given the pointer in memory to a function (this will be done ... > I am trying to call a fuction a a C# dll using the> GetProcAddress, but the returned handle is null, wheras> the LoadLibrary of the container dll succeeds, I write ...
    (microsoft.public.dotnet.languages.csharp)