Re: 64 bit windows: stackwalk64 compilation error-Cannt convert int to
"John Oliviers" <JohnOliviers@discussions.microsoft.com> wrote in message
news:FC8600EE-AAFF-40BA-B363-4C0DAF3C43E9@microsoft.com...
Compilation error " Cannot convert parameter from 'int' to 'HANDLE' "
occurs
on 64 bit windows for stackwalk64 code. I am porting 32 bit code to 64 bit
windows. Could you please any one tell me why compiler is throwing these
errors ? MS VS2005 is being used. Down below is code snippet.
stackwalkerTest.h
-----------------
typedef BOOL (__stdcall * STACKWALKPROC)
( DWORD, HANDLE, HANDLE, LPSTACKFRAME, LPVOID,
PREAD_PROCESS_MEMORY_ROUTINE,PFUNCTION_TABLE_ACCESS_ROUTINE,
PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE );
typedef DWORD (__stdcall *SYMSETOPTIONSPROC)(DWORD);
typedef BOOL (__stdcall *SYMGETSYMFROMADDRPROC)
( HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL );
typedef BOOL (__stdcall *SYMGETLINEFROMADDRPROC)
( HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE );
typedef BOOL (__stdcall * SYMINITIALIZEPROC)( HANDLE, LPSTR, BOOL );
typedef BOOL (__stdcall *SYMCLEANUPPROC)( HANDLE );
typedef LPVOID (__stdcall *SYMFUNCTIONTABLEACCESSPROC)( HANDLE, DWORD );
typedef DWORD (__stdcall *SYMGETMODULEBASEPROC)( HANDLE, DWORD );
STACKWALKPROC _StackWalk;
You used a reserved word.
SYMSETOPTIONSPROC _SymSetOptions;
And again.
SYMGETSYMFROMADDRPROC _SymGetSymFromAddr;
SYMGETLINEFROMADDRPROC _SymGetLineFromAddr;
SYMINITIALIZEPROC _SymInitialize;
SYMCLEANUPPROC _SymCleanup;
SYMFUNCTIONTABLEACCESSPROC _SymFunctionTableAccess;
SYMGETMODULEBASEPROC _SymGetModuleBase;
And a few more times.
stackwalkerTest.cpp
-------------------
if ( ! _StackWalk64( IMAGE_FILE_MACHINE_AMD64,
GetCurrentProcess(),
GetCurrentThread(),
&sf,
pContext,
0,
_SymFunctionTableAccess,
_SymGetModuleBase,
0 ) )
shouldn't that be (after fixing your variable name)?
if (! (*pfnStackWalk)( IMAGE_FILE_MACHINE_AMD64, ... ) )
{
....
}
Error 1 error C2664: 'BOOL
(DWORD,HANDLE,HANDLE,LPSTACKFRAME64,LPVOID,PREAD_PROCESS_MEMORY_ROUTINE64,PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64,PTRANSLATE_ADDRESS_ROUTINE64)'
: cannot convert parameter 2 from 'int' to 'HANDLE'
d:\Work\src\Lib\Util\StackWalkerTest.cpp
Error 2 error C2664: 'BOOL
(DWORD,HANDLE,HANDLE,LPSTACKFRAME64,LPVOID,PREAD_PROCESS_MEMORY_ROUTINE64,PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64,PTRANSLATE_ADDRESS_ROUTINE64)'
: cannot convert parameter 3 from 'int' to 'HANDLE'
d:\Work\src\Lib\Util\StackWalkerTest.cpp
Error 3 error C2664: 'BOOL
(DWORD,HANDLE,HANDLE,LPSTACKFRAME64,LPVOID,PREAD_PROCESS_MEMORY_ROUTINE64,PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64,PTRANSLATE_ADDRESS_ROUTINE64)'
: cannot convert parameter 5 from 'int' to 'LPVOID'
Error 4 error C2664: 'BOOL
(DWORD,HANDLE,HANDLE,LPSTACKFRAME64,LPVOID,PREAD_PROCESS_MEMORY_ROUTINE64,PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64,PTRANSLATE_ADDRESS_ROUTINE64)'
: cannot convert parameter 7 from 'int' to
'PFUNCTION_TABLE_ACCESS_ROUTINE64'
Error 5 error C2664: 'BOOL
(DWORD,HANDLE,HANDLE,LPSTACKFRAME64,LPVOID,PREAD_PROCESS_MEMORY_ROUTINE64,PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64,PTRANSLATE_ADDRESS_ROUTINE64)'
: cannot convert parameter 6 from 'int' to
'PREAD_PROCESS_MEMORY_ROUTINE64'
Error 6 error C2664: 'BOOL
(DWORD,HANDLE,HANDLE,LPSTACKFRAME64,LPVOID,PREAD_PROCESS_MEMORY_ROUTINE64,PFUNCTION_TABLE_ACCESS_ROUTINE64,PGET_MODULE_BASE_ROUTINE64,PTRANSLATE_ADDRESS_ROUTINE64)'
: cannot convert parameter 4 from 'int' to 'LPSTACKFRAME64'
--
Thank you,
John Oliviers