Re: Using the Exchange Backup API



Hello Jeff,

Thanks for the reply.
I made the changes as suggested by you. My final code is
---------------------------------------------------
BOOL BackupExchangeServer(HINSTANCE g_hESEDll)
{
BACKUP_NODE_TREE* pMNUBackupNodeTree = NULL;
typedef HRESULT (ESEBACK_API *HrESEBackupRestoreGetNodes) (IN WCHAR*
wszComputerName,OUT PBACKUP_NODE_TREE *ppBackupNodeTree);

HrESEBackupRestoreGetNodes fnMNUBackupRestoreGetNodes = NULL;
fnMNUBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes) GetProcAddress
(g_hESEDll,"HrESEBackupRestoreGetNodes");
HRESULT hr;
if(fnMNUBackupRestoreGetNodes)
hr = (fnMNUBackupRestoreGetNodes) (NULL, &pMNUBackupNodeTree);
if(hr == S_OK)
return MNU_EXCHANGE_BKP_SUCCESS;
else
return MNU_EXCHANGE_BKP_FAILURE;
}
---------------------------------------------------

This code does not compile. I think it cannot get ESEBACK_API which has been
added to the typedef of the function.
The compilation errors with line numbers as well as with the original line
is copied below.
---------------------------------------------------
Compiling...
MNUExchangeBkpUtils.cpp
//Line 14 typedef HRESULT (ESEBACK_API *HrESEBackupRestoreGetNodes) (IN
// WCHAR* wszComputerName,OUT PBACKUP_NODE_TREE *ppBackupNodeTree);
MNUExchangeBkpUtils.cpp(14) : error C2143: syntax error : missing ')' before
'*'
MNUExchangeBkpUtils.cpp(14) : error C2143: syntax error : missing ';' before
'*'
MNUExchangeBkpUtils.cpp(14) : error C2065: 'HrESEBackupRestoreGetNodes' :
undeclared identifier
MNUExchangeBkpUtils.cpp(14) : error C2059: syntax error : ')'
MNUExchangeBkpUtils.cpp(14) : error C2065: 'wszComputerName' : undeclared
identifier
MNUExchangeBkpUtils.cpp(14) : error C2275: 'WCHAR' : illegal use of this
type as an expression c:\program files\microsoft visual
studio\vc98\include\winnt.h(144) : see declaration of 'WCHAR'
MNUExchangeBkpUtils.cpp(14) : error C2065: 'ppBackupNodeTree' : undeclared
identifier
MNUExchangeBkpUtils.cpp(14) : error C2275: 'PBACKUP_NODE_TREE' : illegal use
of this type as an expression
mnuexchangebkpstructs.h(106) : see declaration of 'PBACKUP_NODE_TREE'
MNUExchangeBkpUtils.cpp(14) : error C2100: illegal indirection

//Line 16 HrESEBackupRestoreGetNodes fnMNUBackupRestoreGetNodes = NULL;
MNUExchangeBkpUtils.cpp(16) : error C2146: syntax error : missing ';' before
identifier 'fnMNUBackupRestoreGetNodes'
MNUExchangeBkpUtils.cpp(16) : error C2065: 'fnMNUBackupRestoreGetNodes' :
undeclared identifier

//Line 17 fnMNUBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes)
GetProcAddress (g_hESEDll,"HrESEBackupRestoreGetNodes");
MNUExchangeBkpUtils.cpp(17) : error C2146: syntax error : missing ';' before
identifier 'GetProcAddress'
Error executing cl.exe.
MNUExchangeBackup.exe - 12 error(s), 0 warning(s)
---------------------------------------------------

What could possibly be reason the error ? and what could be the fix ?

Also is there a .h or a .lib file available which has functions of the
Exchange Backup and Restore API ?

Thanks in advance,
Viraj
Mobiliti Inc.
a.viraj@xxxxxxxxxxxx
http://www.mobiliti.com
732-248-8300 ext 234


"Jeff Partch [MVP]" wrote:

> "Viraj" <Viraj@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:022E6942-85CC-464C-9040-CAEDA84ECE77@xxxxxxxxxxxxxxxx
> > Hello Scot,
> >
> > Thanks for the reply. I made the correction as directed by you. Also I
> > created PBACKUP_NODE_TREE as typedef struct BACKUP_NODE_TREE
> > *PBACKUP_NODE_TREE ;
> >
> > Now the final code is:
> > --------------------------------------------------------------------------
> ----
> > BOOL BackupExchangeServer(HINSTANCE g_hESEDll)
> > {
> > BACKUP_NODE_TREE* pMNUBackupNodeTree = NULL;
> > typedef HRESULT (* HrESEBackupRestoreGetNodes) (IN WCHAR*
> > wszComputerName,OUT PBACKUP_NODE_TREE *ppBackupNodeTree);
> > HrESEBackupRestoreGetNodes fnMNUBackupRestoreGetNodes = NULL;
> > fnMNUBackupRestoreGetNodes = (HrESEBackupRestoreGetNodes) GetProcAddress
> > (g_hESEDll,"HrESEBackupRestoreGetNodes");
> > HRESULT hr;
> > if(fnMNUBackupRestoreGetNodes)
> > hr = (fnMNUBackupRestoreGetNodes) (NULL, &pMNUBackupNodeTree);
> > if(hr == S_OK)
> > return MNU_EXCHANGE_BKP_SUCCESS;
> > else
> > return MNU_EXCHANGE_BKP_FAILURE;
> > }
> > --------------------------------------------------------------------------
> ----
> >
> > This code compiles properly, but the application fails during execution of
> > HrESEBackupRestoreGetNodes. The error message I get is
> > --------------------------------------------------------------
> > Debug Error!
> > Program: C:\ ...\MNUExchangeBackup.exe
> > Module:
> > File: i386\chkesp.c
> > Line: 42
> > Ther value of ESP was not properly saved across a function call. This is
> > usually a result of calling a function declared with one calling
> convention
> > with a function pointer declared with a different calling convention.
> > --------------------------------------------------------------
> >
> > What could possibly be the error ?
>
> typedef HRESULT (ESEBACK_API* HrESEBackupRestoreGetNodes) (IN WCHAR*
> wszComputerName,OUT PBACKUP_NODE_TREE *ppBackupNodeTree);
>
> --
> Jeff Partch [VC++ MVP]
>
>
>
.



Relevant Pages

  • OpenSSH > 3.8p1 compile failure on Solaris
    ... I am unable to compile openssh v3.9p1 or 4.0p1 on Solaris (using GNU gcc, ... ../log.h:65: error: old-style parameter declarations in prototyped function definition ... bsd-arc4random.c:20: error: (Each undeclared identifier is reported only once ... I noticed that the declaration of fatal and cleanup_exit in log.h has been ...
    (SSH)
  • Re: Dont want Intermediate language
    ... Express will certainly compile it. ... BOOL CALLBACK WndProc; ... void ShowError; ... bool create_sfx(const char* file, const char *toFile) ...
    (microsoft.public.vc.language)
  • Re: CodeFile - or a bug in VS?
    ... CodeFile should be generated isntead of the CodeBehind attribute. ... That's OK...and will compile without problems. ... If you create a new Web Project, the page declaration looks like this: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Defining variable in C header file related doubt
    ... And it didn't compile, obviously. ... with int g declared in both files (and apparently ... "An external def1nition is an external declaration that is also a ... If an identif1er declared with external linkage is used in an ...
    (comp.lang.c)
  • RE: Nothing is compiled.
    ... I did: view -> class wizard, the I got the message: the class wizard ... After compile I got the message: file myfile.exe does not exist ... ... function-style initializer appears to be a function definition ...
    (microsoft.public.vc.mfc)