Re: Using the Exchange Backup API
- From: "Viraj" <Viraj@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Jul 2005 11:28:02 -0700
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]
>
>
>
.
- References:
- Using the Exchange Backup API
- From: Viraj
- Re: Using the Exchange Backup API
- From: Scot T Brennecke
- Re: Using the Exchange Backup API
- From: Viraj
- Re: Using the Exchange Backup API
- From: Scot T Brennecke
- Re: Using the Exchange Backup API
- From: Viraj
- Re: Using the Exchange Backup API
- From: Scot T Brennecke
- Re: Using the Exchange Backup API
- From: Viraj
- Re: Using the Exchange Backup API
- From: Scot T Brennecke
- Re: Using the Exchange Backup API
- From: Viraj
- Re: Using the Exchange Backup API
- From: Jeff Partch [MVP]
- Using the Exchange Backup API
- Prev by Date: CListCtrl: Selection modification
- Next by Date: Re: Getting TEXT under Cursor
- Previous by thread: Re: Using the Exchange Backup API
- Next by thread: How do I access a function in a namespace from the main MFC app file?
- Index(es):
Relevant Pages
|