This one is for Steven... 18 months later, I kept my promise ;)

- BindImage & friends refactoring of my original code. Fixed two or three dozen bugs, stopped making assumptions about everything, actually checked for failure, used dynamic allocation instead of 32 static structures, fixed a lot of broken code, fixed some helper functions, made the code as 64-bit compatible as I could (checked with msvc WP64 + prefast).
- Remove internal.c and use NDK instead
- Remove debug.c and symbol.c like WINE have done
- Rewrite the entire exports file to update it for XP. Forward almost all the functions to dbghelp, like WINE have done (note: windows DLL used delayed imports instead).
- Cleanup source to add implemented/unimplemented tags, source header, and precompiled header.
- Sync with latest code from WINE.

Tested with Quicken 2004 & its patches (which make extensive use of BindImage) as well as random bindings of some applications on my disk. Worked perfectly in Windows.

svn path=/trunk/; revision=19025
This commit is contained in:
Alex Ionescu 2005-11-06 10:48:14 +00:00
parent dee7dbd301
commit 8b69dfff76
13 changed files with 2142 additions and 3462 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,118 +0,0 @@
/*
* IMAGEHLP library
*
* Copyright 1998 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "winerror.h"
#include "windef.h"
#include "winbase.h"
#include "wine/debug.h"
#include "imagehlp.h"
WINE_DEFAULT_DEBUG_CHANNEL(imagehlp);
/***********************************************************************
* FindDebugInfoFile (IMAGEHLP.@)
*/
HANDLE WINAPI FindDebugInfoFile(
LPSTR FileName, LPSTR SymbolPath, LPSTR DebugFilePath)
{
FIXME("(%s, %s, %s): stub\n",
debugstr_a(FileName), debugstr_a(SymbolPath),
debugstr_a(DebugFilePath)
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return NULL;
}
/***********************************************************************
* FindExecutableImage (IMAGEHLP.@)
*/
HANDLE WINAPI FindExecutableImage(
LPSTR FileName, LPSTR SymbolPath, LPSTR ImageFilePath)
{
FIXME("(%s, %s, %s): stub\n",
debugstr_a(FileName), debugstr_a(SymbolPath),
debugstr_a(ImageFilePath)
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return NULL;
}
/***********************************************************************
* MapDebugInformation (IMAGEHLP.@)
*/
PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(
HANDLE FileHandle, LPSTR FileName,
LPSTR SymbolPath, DWORD ImageBase)
{
FIXME("(%p, %s, %s, 0x%08lx): stub\n",
FileHandle, FileName, SymbolPath, ImageBase
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return NULL;
}
/***********************************************************************
* StackWalk (IMAGEHLP.@)
*/
BOOL WINAPI StackWalk(
DWORD MachineType, HANDLE hProcess, HANDLE hThread,
LPSTACKFRAME StackFrame, LPVOID ContextRecord,
PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
PTRANSLATE_ADDRESS_ROUTINE TranslateAddress)
{
FIXME(
"(%ld, %p, %p, %p, %p, %p, %p, %p, %p): stub\n",
MachineType, hProcess, hThread, StackFrame, ContextRecord,
ReadMemoryRoutine, FunctionTableAccessRoutine,
GetModuleBaseRoutine, TranslateAddress
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* UnDecorateSymbolName (IMAGEHLP.@)
*/
DWORD WINAPI UnDecorateSymbolName(
LPCSTR DecoratedName, LPSTR UnDecoratedName,
DWORD UndecoratedLength, DWORD Flags)
{
FIXME("(%s, %s, %ld, 0x%08lx): stub\n",
debugstr_a(DecoratedName), debugstr_a(UnDecoratedName),
UndecoratedLength, Flags
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* UnmapDebugInformation (IMAGEHLP.@)
*/
BOOL WINAPI UnmapDebugInformation(
PIMAGE_DEBUG_INFORMATION DebugInfo)
{
FIXME("(%p): stub\n", DebugInfo);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}

View file

@ -1,63 +1,111 @@
LIBRARY imagehlp.dll
EXPORTS
BindImage@12 @1
BindImageEx@20 @2
CheckSumMappedFile@16 @3
EnumerateLoadedModules@12 @4
FindDebugInfoFile@12 @5
FindExecutableImage@12 @6
GetImageConfigInformation@8 @7
GetImageUnusedHeaderBytes@8 @8
GetTimestampForLoadedLibrary@4 @9
ImageAddCertificate@12 @10
ImageDirectoryEntryToData@16 @11
ImageEnumerateCertificates@20 @12
ImageGetCertificateData@16 @13
ImageGetCertificateHeader@12 @14
ImageGetDigestStream@16 @15
ImageLoad@8 @16
ImageNtHeader@4 @17
ImageRemoveCertificate@8 @18
ImageRvaToSection@12 @19
ImageRvaToVa@16 @20
ImageUnload@4 @21
ImagehlpApiVersion@0 @22
ImagehlpApiVersionEx@4 @23
MakeSureDirectoryPathExists@4 @24
MapAndLoad@20 @25
MapDebugInformation@16 @26
MapFileAndCheckSumA@12 @27
MapFileAndCheckSumW@12 @28
ReBaseImage@44 @30
RemovePrivateCvSymbolic@12 @31
RemoveRelocations@4 @32
SearchTreeForFile@12 @33
SetImageConfigInformation@8 @34
SplitSymbols@16 @35
StackWalk@36 @36
SymCleanup@4 @37
SymEnumerateModules@12 @38
SymEnumerateSymbols@16 @39
SymFunctionTableAccess@8 @40
SymGetModuleBase@8 @41
SymGetModuleInfo@12 @42
SymGetOptions@0 @43
SymGetSearchPath@12 @44
SymGetSymFromAddr@16 @45
SymGetSymFromName@12 @46
SymGetSymNext@8 @47
SymGetSymPrev@8 @48
SymInitialize@12 @49
SymLoadModule@24 @50
SymRegisterCallback@12 @51
SymSetOptions@4 @52
SymSetSearchPath@8 @53
SymUnDName@12 @54
SymUnloadModule@8 @55
TouchFileTimes@8 @56
UnDecorateSymbolName@16 @57
UnMapAndLoad@4 @58
UnmapDebugInformation@4 @59
UpdateDebugInfoFile@16 @60
UpdateDebugInfoFileEx@20 @61
BindImage @2
BindImageEx @3
CheckSumMappedFile @4
EnumerateLoadedModules=Dbghelp.EnumerateLoadedModules @5
EnumerateLoadedModules64=Dbghelp.EnumerateLoadedModules64 @6
FindDebugInfoFile=Dbghelp.FindDebugInfoFile @7
FindDebugInfoFileEx=Dbghelp.FindDebugInfoFileEx @8
FindExecutableImage=Dbghelp.FindExecutableImage @9
FindExecutableImageEx=Dbghelp.FindExecutableImageEx @10
FindFileInPath=Dbghelp.FindFileInPath @11
FindFileInSearchPath=Dbghelp.FindFileInSearchPath @12
GetImageConfigInformation @13
GetImageUnusedHeaderBytes @14
GetTimestampForLoadedLibrary @15
ImageAddCertificate @16
ImageDirectoryEntryToData @17
ImageDirectoryEntryToDataEx @18
ImageEnumerateCertificates @19
ImageGetCertificateData @20
ImageGetCertificateHeader @21
ImageGetDigestStream @22
ImagehlpApiVersion=Dbghelp.ImagehlpApiVersion @29
ImagehlpApiVersionEx=Dbghelp.ImagehlpApiVersionEx @30
ImageLoad @23
ImageNtHeader @24
ImageRemoveCertificate @25
ImageRvaToSection @26
ImageRvaToVa @27
ImageUnload @28
MakeSureDirectoryPathExists=Dbghelp.MakeSureDirectoryPathExists @31
MapAndLoad @32
MapDebugInformation=Dbghelp.MapDebugInformation @33
MapFileAndCheckSumA @34
MapFileAndCheckSumW @35
ReBaseImage @37
;ReBaseImage64 @36
;RemovePrivateCvSymbolic @38
;RemovePrivateCvSymbolicEx @39
RemoveRelocations @1
SearchTreeForFile=Dbghelp.SearchTreeForFile @40
SetImageConfigInformation @41
;SplitSymbols @42
StackWalk=Dbghelp.StackWalk @43
StackWalk64=Dbghelp.StackWalk64 @44
SymCleanup=Dbghelp.SymCleanup @45
SymEnumerateModules=Dbghelp.SymEnumerateModules @51
SymEnumerateModules64=Dbghelp.SymEnumerateModules64 @50
SymEnumerateSymbols=Dbghelp.SymEnumerateSymbols @53
SymEnumerateSymbols64=Dbghelp.SymEnumerateSymbols64 @52
SymEnumerateSymbolsW=Dbghelp.SymEnumerateSymbolsW @55
SymEnumerateSymbolsW64=Dbghelp.SymEnumerateSymbolsW64 @54
SymEnumSourceFiles=Dbghelp.SymEnumSourceFiles @46
SymEnumSym=Dbghelp.SymEnumSym @47
SymEnumSymbols=Dbghelp.SymEnumSymbols @48
SymEnumTypes=Dbghelp.SymEnumTypes @49
SymFindFileInPath=Dbghelp.SymFindFileInPath @56
SymFromAddr=Dbghelp.SymFromAddr @57
SymFromName=Dbghelp.SymFromName @58
SymFunctionTableAccess=Dbghelp.SymFunctionTableAccess @60
SymFunctionTableAccess64=Dbghelp.SymFunctionTableAccess64 @59
SymGetLineFromAddr=Dbghelp.SymGetLineFromAddr @62
SymGetLineFromAddr64=Dbghelp.SymGetLineFromAddr64 @61
SymGetLineFromName=Dbghelp.SymGetLineFromName @64
SymGetLineFromName64=Dbghelp.SymGetLineFromName64 @63
SymGetLineNext=Dbghelp.SymGetLineNext @66
SymGetLineNext64=Dbghelp.SymGetLineNext64 @65
SymGetLinePrev=Dbghelp.SymGetLinePrev @68
SymGetLinePrev64=Dbghelp.SymGetLinePrev64 @67
SymGetModuleBase=Dbghelp.SymGetModuleBase @70
SymGetModuleBase64=Dbghelp.SymGetModuleBase64 @69
SymGetModuleInfo=Dbghelp.SymGetModuleInfo @72
SymGetModuleInfo64=Dbghelp.SymGetModuleInfo64 @71
SymGetModuleInfoW=Dbghelp.SymGetModuleInfoW @74
SymGetModuleInfoW64=Dbghelp.SymGetModuleInfoW64 @73
SymGetOptions=Dbghelp.SymGetOptions @76
SymGetSearchPath=Dbghelp.SymGetSearchPath @75
SymGetSymFromAddr=Dbghelp.SymGetSymFromAddr @78
SymGetSymFromAddr64=Dbghelp.SymGetSymFromAddr64 @77
SymGetSymFromName=Dbghelp.SymGetSymFromName @80
SymGetSymFromName64=Dbghelp.SymGetSymFromName64 @79
SymGetSymNext=Dbghelp.SymGetSymNext @82
SymGetSymNext64=Dbghelp.SymGetSymNext64 @81
SymGetSymPrev=Dbghelp.SymGetSymPrev @84
SymGetSymPrev64=Dbghelp.SymGetSymPrev64 @83
SymGetTypeFromName=Dbghelp.SymGetTypeFromName @85
SymGetTypeInfo=Dbghelp.SymGetTypeInfo @86
SymInitialize=Dbghelp.SymInitialize @87
SymLoadModule=Dbghelp.SymLoadModule @89
SymLoadModule64=Dbghelp.SymLoadModule64 @88
SymMatchFileName=Dbghelp.SymMatchFileName @90
SymMatchString=Dbghelp.SymMatchString @91
SymRegisterCallback=Dbghelp.SymRegisterCallback @93
SymRegisterCallback64=Dbghelp.SymRegisterCallback64 @92
SymRegisterFunctionEntryCallback=Dbghelp.SymRegisterFunctionEntryCallback @95
SymRegisterFunctionEntryCallback64=Dbghelp.SymRegisterFunctionEntryCallback64 @94
SymSetContext=Dbghelp.SymSetContext @96
SymSetOptions=Dbghelp.SymSetOptions @97
SymSetSearchPath=Dbghelp.SymSetSearchPath @98
SymUnDName=Dbghelp.SymUnDName @100
SymUnDName64=Dbghelp.SymUnDName64 @99
SymUnloadModule=Dbghelp.SymUnloadModule @102
SymUnloadModule64=Dbghelp.SymUnloadModule64 @101
TouchFileTimes @103
UnDecorateSymbolName=Dbghelp.UnDecorateSymbolName @104
UnMapAndLoad @105
UnmapDebugInformation=Dbghelp.UnmapDebugInformation @106
;UpdateDebugInfoFile @107
;UpdateDebugInfoFileEx @108

View file

@ -1,25 +1,17 @@
<module name="imagehlp" type="win32dll" baseaddress="${BASEADDRESS_IMAGEHLP}" installbase="system32" installname="imagehlp.dll" allowwarnings="true">
<importlibrary definition="imagehlp.def" />
<include base="imagehlp">.</include>
<include base="ReactOS">include/wine</include>
<define name="_DISABLE_TIDENTS" />
<define name="__REACTOS__" />
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x501</define>
<define name="COBJMACROS" />
<define name="__need_offsetof" />
<define name="DCX_USESTYLE">0x10000L</define>
<library>wine</library>
<define name="_WIN32_WINNT">0x600</define>
<define name="WINVER">0x0600</define>
<define name="_IMAGEHLP_SOURCE_"></define>
<library>ntdll</library>
<library>kernel32</library>
<file>access.c</file>
<file>debug.c</file>
<file>imagehlp_main.c</file>
<file>integrity.c</file>
<file>internal.c</file>
<file>modify.c</file>
<file>symbol.c</file>
<file>imagehlp.rc</file>
<pch>precomp.h</pch>
<linkerflag>-enable-stdcall-fixup</linkerflag>
</module>

View file

@ -1,154 +1,43 @@
/*
* IMAGEHLP library
*
* Copyright 1998 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: Imagehlp Libary
* FILE: lib/imagehlp/imagehlp_main.c
* PURPOSE: DLL Entrypoint
* PROGRAMMER: Patrik Stridvall
*/
#include <stdarg.h>
/* INCLUDES ******************************************************************/
#include "windef.h"
#include "winbase.h"
#include "imagehlp.h"
#include "winerror.h"
#include "wine/debug.h"
#include "precomp.h"
WINE_DEFAULT_DEBUG_CHANNEL(imagehlp);
//#define NDEBUG
#include <debug.h>
/**********************************************************************/
/* DATA **********************************************************************/
HANDLE IMAGEHLP_hHeap = NULL;
static API_VERSION IMAGEHLP_ApiVersion = { 4, 0, 0, 5 };
/* FUNCTIONS *****************************************************************/
/***********************************************************************
* DllMain (IMAGEHLP.init)
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
BOOL
IMAGEAPI
DllMain(HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved)
{
switch(fdwReason)
switch(fdwReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
IMAGEHLP_hHeap = HeapCreate(0, 0x10000, 0);
break;
case DLL_PROCESS_DETACH:
HeapDestroy(IMAGEHLP_hHeap);
IMAGEHLP_hHeap = NULL;
break;
default:
break;
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
IMAGEHLP_hHeap = HeapCreate(0, 0x10000, 0);
break;
case DLL_PROCESS_DETACH:
HeapDestroy(IMAGEHLP_hHeap);
IMAGEHLP_hHeap = NULL;
break;
default:
break;
}
return TRUE;
}
/***********************************************************************
* ImagehlpApiVersion (IMAGEHLP.@)
*/
LPAPI_VERSION WINAPI ImagehlpApiVersion(VOID)
{
return &IMAGEHLP_ApiVersion;
}
/***********************************************************************
* ImagehlpApiVersionEx (IMAGEHLP.@)
*/
LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION AppVersion)
{
if(!AppVersion)
return NULL;
AppVersion->MajorVersion = IMAGEHLP_ApiVersion.MajorVersion;
AppVersion->MinorVersion = IMAGEHLP_ApiVersion.MinorVersion;
AppVersion->Revision = IMAGEHLP_ApiVersion.Revision;
AppVersion->Reserved = IMAGEHLP_ApiVersion.Reserved;
return AppVersion;
}
/***********************************************************************
* MakeSureDirectoryPathExists (IMAGEHLP.@)
*
* Path may contain a file at the end. If a dir is at the end, the path
* must end with a backslash.
*
* Path may be absolute or relative (to current dir).
*
*/
BOOL WINAPI MakeSureDirectoryPathExists(LPCSTR DirPath)
{
char Path[MAX_PATH];
char *SlashPos = Path;
char Slash;
BOOL bRes;
strcpy(Path, DirPath);
while((SlashPos=strpbrk(SlashPos+1,"\\/")))
{
Slash = *SlashPos;
*SlashPos = 0;
bRes = CreateDirectoryA(Path, NULL);
if (bRes == FALSE && GetLastError() != ERROR_ALREADY_EXISTS)
{
return FALSE;
}
*SlashPos = Slash;
}
return TRUE;
}
/***********************************************************************
* MarkImageAsRunFromSwap (IMAGEHLP.@)
* FIXME
* No documentation available.
*/
/***********************************************************************
* SearchTreeForFile (IMAGEHLP.@)
*/
BOOL WINAPI SearchTreeForFile(
LPSTR RootPath, LPSTR InputPathName, LPSTR OutputPathBuffer)
{
FIXME("(%s, %s, %s): stub\n",
debugstr_a(RootPath), debugstr_a(InputPathName),
debugstr_a(OutputPathBuffer)
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* TouchFileTimes (IMAGEHLP.@)
*/
BOOL WINAPI TouchFileTimes(HANDLE FileHandle, LPSYSTEMTIME lpSystemTime)
{
FILETIME FileTime;
SYSTEMTIME SystemTime;
if(lpSystemTime == NULL)
{
GetSystemTime(&SystemTime);
lpSystemTime = &SystemTime;
}
return (SystemTimeToFileTime(lpSystemTime, &FileTime) &&
SetFileTime(FileHandle, NULL, NULL, &FileTime));
return TRUE;
}

View file

@ -1,61 +1,37 @@
/*
* IMAGEHLP library
*
* Copyright 1998 Patrik Stridvall
* Copyright 2003 Mike McCormack
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: Imagehlp Libary
* FILE: lib/imagehlp/integrity.c
* PURPOSE: Image Integrity: Security Certificates and Checksums
* PROGRAMMER: Patrik Stridvall, Mike McCormack (WINE)
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
#include "winternl.h"
#include "winnt.h"
//#include "ntstatus.h"
#include "imagehlp.h"
#include "wine/debug.h"
#define IMAGE_FILE_SECURITY_DIRECTORY 4 /* winnt.h */
WINE_DEFAULT_DEBUG_CHANNEL(imagehlp);
/*
* These functions are partially documented at:
* http://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt
*/
/***********************************************************************
* IMAGEHLP_GetSecurityDirOffset (INTERNAL)
*
* Read a file's PE header, and return the offset and size of the
* security directory.
*/
static BOOL IMAGEHLP_GetSecurityDirOffset( HANDLE handle, DWORD num,
DWORD *pdwOfs, DWORD *pdwSize )
/* INCLUDES ******************************************************************/
#include "precomp.h"
//#define NDEBUG
#include <debug.h>
/* FUNCTIONS *****************************************************************/
static
BOOL
IMAGEHLP_GetSecurityDirOffset(HANDLE handle,
DWORD *pdwOfs,
DWORD *pdwSize)
{
IMAGE_DOS_HEADER dos_hdr;
IMAGE_NT_HEADERS nt_hdr;
DWORD size, count, offset, len;
DWORD count;
BOOL r;
IMAGE_DATA_DIRECTORY *sd;
TRACE("handle %p\n", handle );
DPRINT("handle %p\n", handle );
/* read the DOS header */
count = SetFilePointer( handle, 0, NULL, FILE_BEGIN );
@ -80,18 +56,35 @@ static BOOL IMAGEHLP_GetSecurityDirOffset( HANDLE handle, DWORD num,
return FALSE;
sd = &nt_hdr.OptionalHeader.
DataDirectory[IMAGE_FILE_SECURITY_DIRECTORY];
DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY];
TRACE("len = %lx addr = %lx\n", sd->Size, sd->VirtualAddress);
DPRINT("size = %lx addr = %lx\n", sd->Size, sd->VirtualAddress);
*pdwSize = sd->Size;
*pdwOfs = sd->VirtualAddress;
return TRUE;
}
static
BOOL
IMAGEHLP_GetCertificateOffset(HANDLE handle,
DWORD num,
DWORD *pdwOfs,
DWORD *pdwSize)
{
DWORD size, count, offset, len, sd_VirtualAddr;
BOOL r;
r = IMAGEHLP_GetSecurityDirOffset( handle, &sd_VirtualAddr, &size );
if( !r )
return FALSE;
offset = 0;
size = sd->Size;
/* take the n'th certificate */
while( 1 )
{
/* read the length of the current certificate */
count = SetFilePointer( handle, sd->VirtualAddress + offset,
count = SetFilePointer( handle, sd_VirtualAddr + offset,
NULL, FILE_BEGIN );
if( count == INVALID_SET_FILE_POINTER )
return FALSE;
@ -115,57 +108,131 @@ static BOOL IMAGEHLP_GetSecurityDirOffset( HANDLE handle, DWORD num,
return FALSE;
}
*pdwOfs = sd->VirtualAddress + offset;
*pdwOfs = sd_VirtualAddr + offset;
*pdwSize = len;
TRACE("len = %lx addr = %lx\n", len, sd->VirtualAddress + offset);
DPRINT("len = %lx addr = %lx\n", len, sd_VirtualAddr + offset);
return TRUE;
}
static
WORD
CalcCheckSum(DWORD StartValue,
LPVOID BaseAddress,
DWORD WordCount)
{
LPWORD Ptr;
DWORD Sum;
DWORD i;
Sum = StartValue;
Ptr = (LPWORD)BaseAddress;
for (i = 0; i < WordCount; i++)
{
Sum += *Ptr;
if (HIWORD(Sum) != 0)
{
Sum = LOWORD(Sum) + HIWORD(Sum);
}
Ptr++;
}
return (WORD)(LOWORD(Sum) + HIWORD(Sum));
}
/*
* @unimplemented
*/
BOOL
IMAGEAPI
ImageAddCertificate(HANDLE FileHandle,
LPWIN_CERTIFICATE Certificate,
PDWORD Index)
{
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/*
* @unimplemented
*/
BOOL
IMAGEAPI
ImageEnumerateCertificates(HANDLE FileHandle,
WORD TypeFilter,
PDWORD CertificateCount,
PDWORD Indices,
DWORD IndexCount)
{
DWORD size, count, offset, sd_VirtualAddr;
WIN_CERTIFICATE hdr;
const size_t cert_hdr_size = sizeof hdr - sizeof hdr.bCertificate;
BOOL r;
DPRINT("%p %hd %p %p %ld\n",
FileHandle, TypeFilter, CertificateCount, Indices, IndexCount);
if( Indices )
{
DPRINT1("Indicies not FileHandled!\n");
return FALSE;
}
r = IMAGEHLP_GetSecurityDirOffset( FileHandle, &sd_VirtualAddr, &size );
if( !r )
return FALSE;
offset = 0;
*CertificateCount = 0;
while( offset < size )
{
/* read the length of the current certificate */
count = SetFilePointer( FileHandle, sd_VirtualAddr + offset,
NULL, FILE_BEGIN );
if( count == INVALID_SET_FILE_POINTER )
return FALSE;
r = ReadFile( FileHandle, &hdr, (DWORD)cert_hdr_size, &count, NULL );
if( !r )
return FALSE;
if( count != cert_hdr_size )
return FALSE;
DPRINT("Size = %08lx id = %08hx\n", hdr.dwLength, hdr.wCertificateType );
/* check the certificate is not too big or too small */
if( hdr.dwLength < cert_hdr_size )
return FALSE;
if( hdr.dwLength > (size-offset) )
return FALSE;
if( (TypeFilter == CERT_SECTION_TYPE_ANY) ||
(TypeFilter == hdr.wCertificateType) )
{
(*CertificateCount)++;
}
/* next certificate */
offset += hdr.dwLength;
}
return TRUE;
}
/***********************************************************************
* ImageAddCertificate (IMAGEHLP.@)
/*
* @implemented
*/
BOOL WINAPI ImageAddCertificate(
HANDLE FileHandle, LPWIN_CERTIFICATE Certificate, PDWORD Index)
{
FIXME("(%p, %p, %p): stub\n",
FileHandle, Certificate, Index
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* ImageEnumerateCertificates (IMAGEHLP.@)
*/
BOOL WINAPI ImageEnumerateCertificates(
HANDLE FileHandle, WORD TypeFilter, PDWORD CertificateCount,
PDWORD Indices, DWORD IndexCount)
{
FIXME("(%p, %hd, %p, %p, %ld): stub\n",
FileHandle, TypeFilter, CertificateCount, Indices, IndexCount
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* ImageGetCertificateData (IMAGEHLP.@)
*
* FIXME: not sure that I'm dealing with the Index the right way
*/
BOOL WINAPI ImageGetCertificateData(
HANDLE handle, DWORD Index,
LPWIN_CERTIFICATE Certificate, PDWORD RequiredLength)
BOOL
IMAGEAPI
ImageGetCertificateData(HANDLE handle,
DWORD Index,
LPWIN_CERTIFICATE Certificate,
PDWORD RequiredLength)
{
DWORD r, offset, ofs, size, count;
DPRINT("%p %ld %p %p\n", handle, Index, Certificate, RequiredLength);
TRACE("%p %ld %p %p\n", handle, Index, Certificate, RequiredLength);
if( !IMAGEHLP_GetSecurityDirOffset( handle, Index, &ofs, &size ) )
if( !IMAGEHLP_GetCertificateOffset( handle, Index, &ofs, &size ) )
return FALSE;
if( !Certificate )
@ -193,45 +260,256 @@ BOOL WINAPI ImageGetCertificateData(
if( count != size )
return FALSE;
TRACE("OK\n");
DPRINT("OK\n");
return TRUE;
}
/***********************************************************************
* ImageGetCertificateHeader (IMAGEHLP.@)
/*
* @unimplemented
*/
BOOL WINAPI ImageGetCertificateHeader(
HANDLE FileHandle, DWORD CertificateIndex,
LPWIN_CERTIFICATE Certificateheader)
BOOL
IMAGEAPI
ImageGetCertificateHeader(HANDLE FileHandle,
DWORD CertificateIndex,
LPWIN_CERTIFICATE Certificateheader)
{
FIXME("(%p, %ld, %p): stub\n",
FileHandle, CertificateIndex, Certificateheader
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
DWORD r, offset, ofs, size, count;
const size_t cert_hdr_size = sizeof *Certificateheader -
sizeof Certificateheader->bCertificate;
DPRINT("%p %ld %p\n", FileHandle, CertificateIndex, Certificateheader);
if( !IMAGEHLP_GetCertificateOffset( FileHandle, CertificateIndex, &ofs, &size ) )
return FALSE;
if( size < cert_hdr_size )
return FALSE;
offset = SetFilePointer( FileHandle, ofs, NULL, FILE_BEGIN );
if( offset == INVALID_SET_FILE_POINTER )
return FALSE;
r = ReadFile( FileHandle, Certificateheader, (DWORD)cert_hdr_size, &count, NULL );
if( !r )
return FALSE;
if( count != cert_hdr_size )
return FALSE;
DPRINT("OK\n");
return TRUE;
}
/***********************************************************************
* ImageGetDigestStream (IMAGEHLP.@)
/*
* @unimplemented
*/
BOOL WINAPI ImageGetDigestStream(
HANDLE FileHandle, DWORD DigestLevel,
DIGEST_FUNCTION DigestFunction, DIGEST_HANDLE DigestHandle)
BOOL
IMAGEAPI
ImageGetDigestStream(HANDLE FileHandle,
DWORD DigestLevel,
DIGEST_FUNCTION DigestFunction,
DIGEST_HANDLE DigestHandle)
{
FIXME("(%p, %ld, %p, %p): stub\n",
FileHandle, DigestLevel, DigestFunction, DigestHandle
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* ImageRemoveCertificate (IMAGEHLP.@)
/*
* @unimplemented
*/
BOOL WINAPI ImageRemoveCertificate(HANDLE FileHandle, DWORD Index)
BOOL
IMAGEAPI
ImageRemoveCertificate(HANDLE FileHandle,
DWORD Index)
{
FIXME("(%p, %ld): stub\n", FileHandle, Index);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
UNIMPLEMENTED;
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/*
* @implemented
*/
PIMAGE_NT_HEADERS
IMAGEAPI
CheckSumMappedFile(LPVOID BaseAddress,
DWORD FileLength,
LPDWORD HeaderSum,
LPDWORD CheckSum)
{
PIMAGE_NT_HEADERS Header;
DWORD CalcSum;
DWORD HdrSum;
DPRINT("stub\n");
CalcSum = (DWORD)CalcCheckSum(0,
BaseAddress,
(FileLength + 1) / sizeof(WORD));
Header = ImageNtHeader(BaseAddress);
HdrSum = Header->OptionalHeader.CheckSum;
/* Subtract image checksum from calculated checksum. */
/* fix low word of checksum */
if (LOWORD(CalcSum) >= LOWORD(HdrSum))
{
CalcSum -= LOWORD(HdrSum);
}
else
{
CalcSum = ((LOWORD(CalcSum) - LOWORD(HdrSum)) & 0xFFFF) - 1;
}
/* fix high word of checksum */
if (LOWORD(CalcSum) >= HIWORD(HdrSum))
{
CalcSum -= HIWORD(HdrSum);
}
else
{
CalcSum = ((LOWORD(CalcSum) - HIWORD(HdrSum)) & 0xFFFF) - 1;
}
/* add file length */
CalcSum += FileLength;
*CheckSum = CalcSum;
*HeaderSum = Header->OptionalHeader.CheckSum;
return Header;
}
/*
* @implemented
*/
DWORD
IMAGEAPI
MapFileAndCheckSumA(LPSTR Filename,
LPDWORD HeaderSum,
LPDWORD CheckSum)
{
HANDLE hFile;
HANDLE hMapping;
LPVOID BaseAddress;
DWORD FileLength;
DPRINT("(%s, %p, %p): stub\n", Filename, HeaderSum, CheckSum);
hFile = CreateFileA(Filename,
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if (hFile == INVALID_HANDLE_VALUE)
{
return CHECKSUM_OPEN_FAILURE;
}
hMapping = CreateFileMappingW(hFile,
NULL,
PAGE_READONLY,
0,
0,
NULL);
if (hMapping == 0)
{
CloseHandle(hFile);
return CHECKSUM_MAP_FAILURE;
}
BaseAddress = MapViewOfFile(hMapping,
FILE_MAP_READ,
0,
0,
0);
if (hMapping == 0)
{
CloseHandle(hMapping);
CloseHandle(hFile);
return CHECKSUM_MAPVIEW_FAILURE;
}
FileLength = GetFileSize(hFile,
NULL);
CheckSumMappedFile(BaseAddress,
FileLength,
HeaderSum,
CheckSum);
UnmapViewOfFile(BaseAddress);
CloseHandle(hMapping);
CloseHandle(hFile);
return 0;
}
/*
* @implemented
*/
DWORD
IMAGEAPI
MapFileAndCheckSumW(LPWSTR Filename,
LPDWORD HeaderSum,
LPDWORD CheckSum)
{
HANDLE hFile;
HANDLE hMapping;
LPVOID BaseAddress;
DWORD FileLength;
DPRINT("(%S, %p, %p): stub\n", Filename, HeaderSum, CheckSum);
hFile = CreateFileW(Filename,
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if (hFile == INVALID_HANDLE_VALUE)
{
return CHECKSUM_OPEN_FAILURE;
}
hMapping = CreateFileMappingW(hFile,
NULL,
PAGE_READONLY,
0,
0,
NULL);
if (hMapping == 0)
{
CloseHandle(hFile);
return CHECKSUM_MAP_FAILURE;
}
BaseAddress = MapViewOfFile(hMapping,
FILE_MAP_READ,
0,
0,
0);
if (hMapping == 0)
{
CloseHandle(hMapping);
CloseHandle(hFile);
return CHECKSUM_MAPVIEW_FAILURE;
}
FileLength = GetFileSize(hFile,
NULL);
CheckSumMappedFile(BaseAddress,
FileLength,
HeaderSum,
CheckSum);
UnmapViewOfFile(BaseAddress);
CloseHandle(hMapping);
CloseHandle(hFile);
return 0;
}

View file

@ -1,125 +0,0 @@
/*
* IMAGEHLP library
*
* Copyright 1998 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.h"
#include "imagehlp.h"
/***********************************************************************
* InitializeListHead
*/
VOID InitializeListHead(PLIST_ENTRY pListHead)
{
pListHead->Flink = pListHead;
pListHead->Blink = pListHead;
}
/***********************************************************************
* InsertHeadList
*/
VOID InsertHeadList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
{
pEntry->Blink = pListHead;
pEntry->Flink = pListHead->Flink;
pListHead->Flink = pEntry;
}
/***********************************************************************
* InsertTailList
*/
VOID InsertTailList(PLIST_ENTRY pListHead, PLIST_ENTRY pEntry)
{
pEntry->Flink = pListHead;
pEntry->Blink = pListHead->Blink;
pListHead->Blink = pEntry;
}
/***********************************************************************
* IsListEmpty
*/
BOOLEAN IsListEmpty(PLIST_ENTRY pListHead)
{
return !pListHead;
}
/***********************************************************************
* PopEntryList
*/
PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY pListHead)
{
pListHead->Next = NULL;
return pListHead;
}
/***********************************************************************
* PushEntryList
*/
VOID PushEntryList(
PSINGLE_LIST_ENTRY pListHead, PSINGLE_LIST_ENTRY pEntry)
{
pEntry->Next=pListHead;
}
/***********************************************************************
* RemoveEntryList
*/
VOID RemoveEntryList(PLIST_ENTRY pEntry)
{
pEntry->Flink->Blink = pEntry->Blink;
pEntry->Blink->Flink = pEntry->Flink;
pEntry->Flink = NULL;
pEntry->Blink = NULL;
}
/***********************************************************************
* RemoveHeadList
*/
PLIST_ENTRY RemoveHeadList(PLIST_ENTRY pListHead)
{
PLIST_ENTRY p = pListHead->Flink;
if(p != pListHead)
{
RemoveEntryList(pListHead);
return p;
}
else
{
pListHead->Flink = NULL;
pListHead->Blink = NULL;
return NULL;
}
}
/***********************************************************************
* RemoveTailList
*/
PLIST_ENTRY RemoveTailList(PLIST_ENTRY pListHead)
{
RemoveHeadList(pListHead->Blink);
if(pListHead != pListHead->Blink)
return pListHead;
else
return NULL;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,53 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS System Libraries
* FILE: lib/imagehlp/precomp.h
* PURPOSE: Imagehlp Libary Header
* PROGRAMMER: Alex Ionescu (alex@relsoft.net)
*/
/* INCLUDES ******************************************************************/
/* Definitions */
#define _CRT_SECURE_NO_DEPRECATE
#define NTOS_MODE_USER
#define WIN32_NO_STATUS
/* PSDK/NDK Headers */
#include <windows.h>
#include <imagehlp.h>
#include <ndk/umtypes.h>
#include <ndk/rtlfuncs.h>
/* C STDLIB Headers */
#include <stdio.h>
/* TYPES *********************************************************************/
typedef struct _BOUND_FORWARDER_REFS
{
struct _BOUND_FORWARDER_REFS *Next;
ULONG TimeDateStamp;
LPSTR ModuleName;
} BOUND_FORWARDER_REFS, *PBOUND_FORWARDER_REFS;
typedef struct _IMPORT_DESCRIPTOR
{
struct _IMPORT_DESCRIPTOR *Next;
LPSTR ModuleName;
ULONG TimeDateStamp;
USHORT ForwaderReferences;
PBOUND_FORWARDER_REFS Forwarders;
} IMPORT_DESCRIPTOR, *PIMPORT_DESCRIPTOR;
/* DATA **********************************************************************/
extern HANDLE IMAGEHLP_hHeap;
/* FUNCTIONS *****************************************************************/
BOOL
IMAGEAPI
UnloadAllImages(VOID);
/* EOF */

View file

@ -1,274 +0,0 @@
/*
* IMAGEHLP library
*
* Copyright 1998 Patrik Stridvall
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.h"
#include "imagehlp.h"
WINE_DEFAULT_DEBUG_CHANNEL(imagehlp);
/***********************************************************************
* SymCleanup (IMAGEHLP.@)
*/
BOOL WINAPI SymCleanup(HANDLE hProcess)
{
FIXME("(%p): stub\n", hProcess);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymEnumerateModules (IMAGEHLP.@)
*/
BOOL WINAPI SymEnumerateModules(
HANDLE hProcess, PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,
PVOID UserContext)
{
FIXME("(%p, %p, %p): stub\n",
hProcess, EnumModulesCallback, UserContext
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymEnumerateSymbols (IMAGEHLP.@)
*/
BOOL WINAPI SymEnumerateSymbols(
HANDLE hProcess, DWORD BaseOfDll,
PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
{
FIXME("(%p, 0x%08lx, %p, %p): stub\n",
hProcess, BaseOfDll, EnumSymbolsCallback, UserContext
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymFunctionTableAccess (IMAGEHLP.@)
*/
PVOID WINAPI SymFunctionTableAccess(HANDLE hProcess, DWORD AddrBase)
{
FIXME("(%p, 0x%08lx): stub\n", hProcess, AddrBase);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymGetModuleBase (IMAGEHLP.@)
*/
DWORD WINAPI SymGetModuleBase(HANDLE hProcess, DWORD dwAddr)
{
FIXME("(%p, 0x%08lx): stub\n", hProcess, dwAddr);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* SymGetModuleInfo (IMAGEHLP.@)
*/
BOOL WINAPI SymGetModuleInfo(
HANDLE hProcess, DWORD dwAddr,
PIMAGEHLP_MODULE ModuleInfo)
{
MEMORY_BASIC_INFORMATION mbi;
FIXME("(%p, 0x%08lx, %p): hacked stub\n",
hProcess, dwAddr, ModuleInfo
);
/*
* OpenOffice uses this function to get paths of it's modules
* from address inside the module. So return at least that for
* now.
*/
if (VirtualQuery((PVOID)dwAddr, &mbi, sizeof(mbi)) != sizeof(mbi) ||
!GetModuleFileNameA((HMODULE)mbi.AllocationBase, ModuleInfo->ImageName, sizeof(ModuleInfo->ImageName)))
{
return FALSE;
}
return TRUE;
}
/***********************************************************************
* SymGetOptions (IMAGEHLP.@)
*/
DWORD WINAPI SymGetOptions()
{
FIXME("(): stub\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* SymGetSearchPath (IMAGEHLP.@)
*/
BOOL WINAPI SymGetSearchPath(
HANDLE hProcess, LPSTR szSearchPath, DWORD SearchPathLength)
{
FIXME("(%p, %s, %ld): stub\n",
hProcess, debugstr_an(szSearchPath,SearchPathLength), SearchPathLength
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymGetSymFromAddr (IMAGEHLP.@)
*/
BOOL WINAPI SymGetSymFromAddr(
HANDLE hProcess, DWORD dwAddr,
PDWORD pdwDisplacement, PIMAGEHLP_SYMBOL Symbol)
{
FIXME("(%p, 0x%08lx, %p, %p): stub\n",
hProcess, dwAddr, pdwDisplacement, Symbol
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymGetSymFromName (IMAGEHLP.@)
*/
BOOL WINAPI SymGetSymFromName(
HANDLE hProcess, LPSTR Name, PIMAGEHLP_SYMBOL Symbol)
{
FIXME("(%p, %s, %p): stub\n", hProcess, Name, Symbol);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymGetSymNext (IMAGEHLP.@)
*/
BOOL WINAPI SymGetSymNext(
HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol)
{
FIXME("(%p, %p): stub\n", hProcess, Symbol);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymGetSymPrev (IMAGEHLP.@)
*/
BOOL WINAPI SymGetSymPrev(
HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol)
{
FIXME("(%p, %p): stub\n", hProcess, Symbol);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymInitialize (IMAGEHLP.@)
*/
BOOL WINAPI SymInitialize(
HANDLE hProcess, LPSTR UserSearchPath, BOOL fInvadeProcess)
{
FIXME("(%p, %s, %d): stub\n",
hProcess, debugstr_a(UserSearchPath), fInvadeProcess
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymLoadModule (IMAGEHLP.@)
*/
BOOL WINAPI SymLoadModule(
HANDLE hProcess, HANDLE hFile, LPSTR ImageName, LPSTR ModuleName,
DWORD BaseOfDll, DWORD SizeOfDll)
{
FIXME("(%p, %p, %s, %s, %ld, %ld): stub\n",
hProcess, hFile, debugstr_a(ImageName), debugstr_a(ModuleName),
BaseOfDll, SizeOfDll
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymRegisterCallback (IMAGEHLP.@)
*/
BOOL WINAPI SymRegisterCallback(
HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK CallbackFunction,
PVOID UserContext)
{
FIXME("(%p, %p, %p): stub\n",
hProcess, CallbackFunction, UserContext
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymSetOptions (IMAGEHLP.@)
*/
DWORD WINAPI SymSetOptions(DWORD SymOptions)
{
FIXME("(0x%08lx): stub\n", SymOptions);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* SymSetSearchPath (IMAGEHLP.@)
*/
BOOL WINAPI SymSetSearchPath(HANDLE hProcess, LPSTR szSearchPath)
{
FIXME("(%p, %s): stub\n",
hProcess, debugstr_a(szSearchPath)
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymUnDName (IMAGEHLP.@)
*/
BOOL WINAPI SymUnDName(
PIMAGEHLP_SYMBOL sym, LPSTR UnDecName, DWORD UnDecNameLength)
{
FIXME("(%p, %s, %ld): stub\n",
sym, UnDecName, UnDecNameLength
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* SymUnloadModule (IMAGEHLP.@)
*/
BOOL WINAPI SymUnloadModule(
HANDLE hProcess, DWORD BaseOfDll)
{
FIXME("(%p, 0x%08lx): stub\n", hProcess, BaseOfDll);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}

File diff suppressed because it is too large Load diff

View file

@ -75,7 +75,19 @@ extern "C" {
#define UNDNAME_NO_ARGUMENTS 8192
#define UNDNAME_NO_SPECIAL_SYMS 16384
#define _IMAGEHLPAPI WINAPI
#ifdef _IMAGEHLP_SOURCE_
#define IMAGEAPI __stdcall
#define DBHLP_DEPRECIATED
#else
#define IMAGEAPI DECLSPEC_IMPORT __stdcall
#if (_MSC_VER >= 1300) && !defined(MIDL_PASS)
#define DBHLP_DEPRECIATED __declspec(deprecated)
#else
#define DBHLP_DEPRECIATED
#endif
#endif
#define DBHLPAPI IMAGEAPI
#ifndef RC_INVOKED
@ -241,79 +253,79 @@ typedef struct _IMAGEHLP_DUPLICATE_SYMBOL {
typedef PVOID DIGEST_HANDLE;
typedef BOOL(WINAPI*DIGEST_FUNCTION)(DIGEST_HANDLE refdata,PBYTE pData,DWORD dwLength);
PIMAGE_NT_HEADERS _IMAGEHLPAPI CheckSumMappedFile(LPVOID,DWORD,LPDWORD,LPDWORD);
DWORD _IMAGEHLPAPI MapFileAndCheckSumA(LPSTR,LPDWORD,LPDWORD);
DWORD _IMAGEHLPAPI MapFileAndCheckSumW(PWSTR,LPDWORD,LPDWORD);
BOOL _IMAGEHLPAPI TouchFileTimes(HANDLE,LPSYSTEMTIME);
BOOL _IMAGEHLPAPI SplitSymbols(LPSTR,LPSTR,LPSTR,DWORD);
HANDLE _IMAGEHLPAPI FindDebugInfoFile(LPSTR,LPSTR,LPSTR);
HANDLE _IMAGEHLPAPI FindExecutableImage(LPSTR,LPSTR,LPSTR);
BOOL _IMAGEHLPAPI UpdateDebugInfoFile(LPSTR,LPSTR,LPSTR,PIMAGE_NT_HEADERS);
BOOL _IMAGEHLPAPI UpdateDebugInfoFileEx(LPSTR,LPSTR,LPSTR,PIMAGE_NT_HEADERS,DWORD);
BOOL _IMAGEHLPAPI BindImage(IN LPSTR,IN LPSTR,IN LPSTR);
BOOL _IMAGEHLPAPI BindImageEx(IN DWORD,IN LPSTR,IN LPSTR,IN LPSTR,IN PIMAGEHLP_STATUS_ROUTINE);
BOOL _IMAGEHLPAPI ReBaseImage(IN LPSTR,IN LPSTR,IN BOOL, IN BOOL,IN BOOL, IN ULONG, OUT ULONG*, OUT ULONG*, OUT ULONG*, IN OUT ULONG*, IN ULONG);
PIMAGE_NT_HEADERS IMAGEAPI CheckSumMappedFile(LPVOID,DWORD,LPDWORD,LPDWORD);
DWORD IMAGEAPI MapFileAndCheckSumA(LPSTR,LPDWORD,LPDWORD);
DWORD IMAGEAPI MapFileAndCheckSumW(PWSTR,LPDWORD,LPDWORD);
BOOL IMAGEAPI TouchFileTimes(HANDLE,LPSYSTEMTIME);
BOOL IMAGEAPI SplitSymbols(LPSTR,LPSTR,LPSTR,DWORD);
HANDLE IMAGEAPI FindDebugInfoFile(LPSTR,LPSTR,LPSTR);
HANDLE IMAGEAPI FindExecutableImage(LPSTR,LPSTR,LPSTR);
BOOL IMAGEAPI UpdateDebugInfoFile(LPSTR,LPSTR,LPSTR,PIMAGE_NT_HEADERS);
BOOL IMAGEAPI UpdateDebugInfoFileEx(LPSTR,LPSTR,LPSTR,PIMAGE_NT_HEADERS,DWORD);
BOOL IMAGEAPI BindImage(IN LPSTR,IN LPSTR,IN LPSTR);
BOOL IMAGEAPI BindImageEx(IN DWORD,IN LPSTR,IN LPSTR,IN LPSTR,IN PIMAGEHLP_STATUS_ROUTINE);
BOOL IMAGEAPI ReBaseImage(IN LPSTR,IN LPSTR,IN BOOL, IN BOOL,IN BOOL, IN ULONG, OUT ULONG*, OUT ULONG*, OUT ULONG*, IN OUT ULONG*, IN ULONG);
PLOADED_IMAGE _IMAGEHLPAPI ImageLoad(LPSTR,LPSTR);
BOOL _IMAGEHLPAPI ImageUnload(PLOADED_IMAGE);
PIMAGE_NT_HEADERS _IMAGEHLPAPI ImageNtHeader(IN PVOID);
PVOID _IMAGEHLPAPI ImageDirectoryEntryToData(IN PVOID,IN BOOLEAN,IN USHORT,OUT PULONG);
PVOID _IMAGEHLPAPI ImageDirectoryEntryToDataEx(IN PVOID Base, IN BOOLEAN MappedAsImage, IN USHORT DirectoryEntry, OUT PULONG Size, OUT PIMAGE_SECTION_HEADER *FoundSection OPTIONAL);
PVOID _IMAGEHLPAPI ImageDirectoryEntryToData32(PVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size, PIMAGE_SECTION_HEADER *FoundHeader OPTIONAL, PIMAGE_FILE_HEADER FileHeader, PIMAGE_OPTIONAL_HEADER OptionalHeader);
PIMAGE_SECTION_HEADER _IMAGEHLPAPI ImageRvaToSection(IN PIMAGE_NT_HEADERS,IN PVOID,IN ULONG);
PVOID _IMAGEHLPAPI ImageRvaToVa(IN PIMAGE_NT_HEADERS,IN PVOID,IN ULONG,IN OUT PIMAGE_SECTION_HEADER*);
BOOL _IMAGEHLPAPI MapAndLoad(LPSTR,LPSTR,PLOADED_IMAGE,BOOL,BOOL);
BOOL _IMAGEHLPAPI GetImageConfigInformation(PLOADED_IMAGE,PIMAGE_LOAD_CONFIG_DIRECTORY);
DWORD _IMAGEHLPAPI GetImageUnusedHeaderBytes(PLOADED_IMAGE,LPDWORD);
BOOL _IMAGEHLPAPI SetImageConfigInformation(PLOADED_IMAGE,PIMAGE_LOAD_CONFIG_DIRECTORY);
BOOL _IMAGEHLPAPI UnMapAndLoad(PLOADED_IMAGE);
PIMAGE_DEBUG_INFORMATION _IMAGEHLPAPI MapDebugInformation(HANDLE,LPSTR,LPSTR,DWORD);
BOOL _IMAGEHLPAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
HANDLE _IMAGEHLPAPI FindExecutableImage(LPSTR,LPSTR,LPSTR);
BOOL _IMAGEHLPAPI SearchTreeForFile(LPSTR,LPSTR,LPSTR);
BOOL _IMAGEHLPAPI MakeSureDirectoryPathExists(LPCSTR);
DWORD _IMAGEHLPAPI WINAPI UnDecorateSymbolName(LPCSTR,LPSTR,DWORD, DWORD);
PLOADED_IMAGE IMAGEAPI ImageLoad(LPSTR,LPSTR);
BOOL IMAGEAPI ImageUnload(PLOADED_IMAGE);
PIMAGE_NT_HEADERS IMAGEAPI ImageNtHeader(IN PVOID);
PVOID IMAGEAPI ImageDirectoryEntryToData(IN PVOID,IN BOOLEAN,IN USHORT,OUT PULONG);
PVOID IMAGEAPI ImageDirectoryEntryToDataEx(IN PVOID Base, IN BOOLEAN MappedAsImage, IN USHORT DirectoryEntry, OUT PULONG Size, OUT PIMAGE_SECTION_HEADER *FoundSection OPTIONAL);
PVOID IMAGEAPI ImageDirectoryEntryToData32(PVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size, PIMAGE_SECTION_HEADER *FoundHeader OPTIONAL, PIMAGE_FILE_HEADER FileHeader, PIMAGE_OPTIONAL_HEADER OptionalHeader);
PIMAGE_SECTION_HEADER IMAGEAPI ImageRvaToSection(IN PIMAGE_NT_HEADERS,IN PVOID,IN ULONG);
PVOID IMAGEAPI ImageRvaToVa(IN PIMAGE_NT_HEADERS,IN PVOID,IN ULONG,IN OUT PIMAGE_SECTION_HEADER*);
BOOL IMAGEAPI MapAndLoad(LPSTR,LPSTR,PLOADED_IMAGE,BOOL,BOOL);
BOOL IMAGEAPI GetImageConfigInformation(PLOADED_IMAGE,PIMAGE_LOAD_CONFIG_DIRECTORY);
DWORD IMAGEAPI GetImageUnusedHeaderBytes(PLOADED_IMAGE,LPDWORD);
BOOL IMAGEAPI SetImageConfigInformation(PLOADED_IMAGE,PIMAGE_LOAD_CONFIG_DIRECTORY);
BOOL IMAGEAPI UnMapAndLoad(PLOADED_IMAGE);
PIMAGE_DEBUG_INFORMATION IMAGEAPI MapDebugInformation(HANDLE,LPSTR,LPSTR,DWORD);
BOOL IMAGEAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
HANDLE IMAGEAPI FindExecutableImage(LPSTR,LPSTR,LPSTR);
BOOL IMAGEAPI SearchTreeForFile(LPSTR,LPSTR,LPSTR);
BOOL IMAGEAPI MakeSureDirectoryPathExists(LPCSTR);
DWORD IMAGEAPI WINAPI UnDecorateSymbolName(LPCSTR,LPSTR,DWORD, DWORD);
BOOL
_IMAGEHLPAPI
IMAGEAPI
StackWalk(DWORD,HANDLE,HANDLE,LPSTACKFRAME,LPVOID,PREAD_PROCESS_MEMORY_ROUTINE,PFUNCTION_TABLE_ACCESS_ROUTINE,PGET_MODULE_BASE_ROUTINE,PTRANSLATE_ADDRESS_ROUTINE);
LPAPI_VERSION _IMAGEHLPAPI ImagehlpApiVersion(VOID);
LPAPI_VERSION _IMAGEHLPAPI ImagehlpApiVersionEx(LPAPI_VERSION);
DWORD _IMAGEHLPAPI GetTimestampForLoadedLibrary(HMODULE);
BOOL _IMAGEHLPAPI RemovePrivateCvSymbolic(PCHAR,PCHAR*,ULONG*);
VOID _IMAGEHLPAPI RemoveRelocations(PCHAR);
DWORD _IMAGEHLPAPI SymSetOptions(IN DWORD);
DWORD _IMAGEHLPAPI SymGetOptions(VOID);
BOOL _IMAGEHLPAPI SymCleanup(IN HANDLE);
BOOL _IMAGEHLPAPI SymEnumerateModules(IN HANDLE,IN PSYM_ENUMMODULES_CALLBACK,IN PVOID);
BOOL _IMAGEHLPAPI SymEnumerateSymbols(IN HANDLE,IN DWORD,IN PSYM_ENUMSYMBOLS_CALLBACK,IN PVOID);
BOOL _IMAGEHLPAPI EnumerateLoadedModules(IN HANDLE,IN PENUMLOADED_MODULES_CALLBACK,IN PVOID);
LPVOID _IMAGEHLPAPI SymFunctionTableAccess(HANDLE,DWORD);
BOOL _IMAGEHLPAPI SymGetModuleInfo(IN HANDLE,IN DWORD,OUT PIMAGEHLP_MODULE);
DWORD _IMAGEHLPAPI SymGetModuleBase(IN HANDLE,IN DWORD);
BOOL _IMAGEHLPAPI SymGetSymFromAddr(IN HANDLE,IN DWORD,OUT PDWORD,OUT PIMAGEHLP_SYMBOL);
BOOL _IMAGEHLPAPI SymGetSymFromName(IN HANDLE,IN LPSTR,OUT PIMAGEHLP_SYMBOL);
BOOL _IMAGEHLPAPI SymGetSymNext(IN HANDLE,IN OUT PIMAGEHLP_SYMBOL);
BOOL _IMAGEHLPAPI SymGetSymPrev(IN HANDLE,IN OUT PIMAGEHLP_SYMBOL);
BOOL _IMAGEHLPAPI SymGetLineFromAddr(IN HANDLE,IN DWORD,OUT PDWORD,OUT PIMAGEHLP_LINE);
BOOL _IMAGEHLPAPI SymGetLineFromName(IN HANDLE,IN LPSTR,IN LPSTR,IN DWORD,OUT PLONG,IN OUT PIMAGEHLP_LINE);
BOOL _IMAGEHLPAPI SymGetLineNext(IN HANDLE,IN OUT PIMAGEHLP_LINE);
BOOL _IMAGEHLPAPI SymGetLinePrev(IN HANDLE,IN OUT PIMAGEHLP_LINE);
BOOL _IMAGEHLPAPI SymMatchFileName(IN LPSTR,IN LPSTR,OUT LPSTR*,OUT LPSTR*);
BOOL _IMAGEHLPAPI SymInitialize(IN HANDLE,IN LPSTR,IN BOOL);
BOOL _IMAGEHLPAPI SymGetSearchPath(IN HANDLE,OUT LPSTR,IN DWORD);
BOOL _IMAGEHLPAPI SymSetSearchPath(IN HANDLE,IN LPSTR);
BOOL _IMAGEHLPAPI SymLoadModule(IN HANDLE,IN HANDLE,IN PSTR,IN PSTR,IN DWORD,IN DWORD);
BOOL _IMAGEHLPAPI SymUnloadModule(IN HANDLE,IN DWORD);
BOOL _IMAGEHLPAPI SymUnDName(IN PIMAGEHLP_SYMBOL,OUT LPSTR,IN DWORD);
BOOL _IMAGEHLPAPI SymRegisterCallback(IN HANDLE,IN PSYMBOL_REGISTERED_CALLBACK,IN PVOID);
BOOL _IMAGEHLPAPI ImageGetDigestStream(IN HANDLE,IN DWORD,IN DIGEST_FUNCTION,IN DIGEST_HANDLE);
//BOOL _IMAGEHLPAPI ImageAddCertificate(IN HANDLE,IN LPWIN_CERTIFICATE,OUT PDWORD);
BOOL _IMAGEHLPAPI ImageRemoveCertificate(IN HANDLE,IN DWORD);
BOOL _IMAGEHLPAPI ImageEnumerateCertificates(IN HANDLE,IN WORD,OUT PDWORD,IN OUT PDWORD OPTIONAL,IN OUT DWORD OPTIONAL);
//BOOL _IMAGEHLPAPI ImageGetCertificateData(IN HANDLE,IN DWORD,OUT LPWIN_CERTIFICATE,IN OUT PDWORD);
//BOOL _IMAGEHLPAPI ImageGetCertificateHeader(IN HANDLE,IN DWORD,IN OUT LPWIN_CERTIFICATE);
BOOL _IMAGEHLPAPI CopyPdb(CHAR const*,CHAR const*,BOOL);
BOOL _IMAGEHLPAPI RemovePrivateCvSymbolicEx(PCHAR,ULONG,PCHAR*,ULONG*);
LPAPI_VERSION IMAGEAPI ImagehlpApiVersion(VOID);
LPAPI_VERSION IMAGEAPI ImagehlpApiVersionEx(LPAPI_VERSION);
DWORD IMAGEAPI GetTimestampForLoadedLibrary(HMODULE);
BOOL IMAGEAPI RemovePrivateCvSymbolic(PCHAR,PCHAR*,ULONG*);
VOID IMAGEAPI RemoveRelocations(PCHAR);
DWORD IMAGEAPI SymSetOptions(IN DWORD);
DWORD IMAGEAPI SymGetOptions(VOID);
BOOL IMAGEAPI SymCleanup(IN HANDLE);
BOOL IMAGEAPI SymEnumerateModules(IN HANDLE,IN PSYM_ENUMMODULES_CALLBACK,IN PVOID);
BOOL IMAGEAPI SymEnumerateSymbols(IN HANDLE,IN DWORD,IN PSYM_ENUMSYMBOLS_CALLBACK,IN PVOID);
BOOL IMAGEAPI EnumerateLoadedModules(IN HANDLE,IN PENUMLOADED_MODULES_CALLBACK,IN PVOID);
LPVOID IMAGEAPI SymFunctionTableAccess(HANDLE,DWORD);
BOOL IMAGEAPI SymGetModuleInfo(IN HANDLE,IN DWORD,OUT PIMAGEHLP_MODULE);
DWORD IMAGEAPI SymGetModuleBase(IN HANDLE,IN DWORD);
BOOL IMAGEAPI SymGetSymFromAddr(IN HANDLE,IN DWORD,OUT PDWORD,OUT PIMAGEHLP_SYMBOL);
BOOL IMAGEAPI SymGetSymFromName(IN HANDLE,IN LPSTR,OUT PIMAGEHLP_SYMBOL);
BOOL IMAGEAPI SymGetSymNext(IN HANDLE,IN OUT PIMAGEHLP_SYMBOL);
BOOL IMAGEAPI SymGetSymPrev(IN HANDLE,IN OUT PIMAGEHLP_SYMBOL);
BOOL IMAGEAPI SymGetLineFromAddr(IN HANDLE,IN DWORD,OUT PDWORD,OUT PIMAGEHLP_LINE);
BOOL IMAGEAPI SymGetLineFromName(IN HANDLE,IN LPSTR,IN LPSTR,IN DWORD,OUT PLONG,IN OUT PIMAGEHLP_LINE);
BOOL IMAGEAPI SymGetLineNext(IN HANDLE,IN OUT PIMAGEHLP_LINE);
BOOL IMAGEAPI SymGetLinePrev(IN HANDLE,IN OUT PIMAGEHLP_LINE);
BOOL IMAGEAPI SymMatchFileName(IN LPSTR,IN LPSTR,OUT LPSTR*,OUT LPSTR*);
BOOL IMAGEAPI SymInitialize(IN HANDLE,IN LPSTR,IN BOOL);
BOOL IMAGEAPI SymGetSearchPath(IN HANDLE,OUT LPSTR,IN DWORD);
BOOL IMAGEAPI SymSetSearchPath(IN HANDLE,IN LPSTR);
DWORD IMAGEAPI SymLoadModule(IN HANDLE,IN HANDLE,IN PSTR,IN PSTR,IN DWORD,IN DWORD);
BOOL IMAGEAPI SymUnloadModule(IN HANDLE,IN DWORD);
BOOL IMAGEAPI SymUnDName(IN PIMAGEHLP_SYMBOL,OUT LPSTR,IN DWORD);
BOOL IMAGEAPI SymRegisterCallback(IN HANDLE,IN PSYMBOL_REGISTERED_CALLBACK,IN PVOID);
BOOL IMAGEAPI ImageGetDigestStream(IN HANDLE,IN DWORD,IN DIGEST_FUNCTION,IN DIGEST_HANDLE);
//BOOL IMAGEAPI ImageAddCertificate(IN HANDLE,IN LPWIN_CERTIFICATE,OUT PDWORD);
BOOL IMAGEAPI ImageRemoveCertificate(IN HANDLE,IN DWORD);
BOOL IMAGEAPI ImageEnumerateCertificates(IN HANDLE,IN WORD,OUT PDWORD,IN OUT PDWORD OPTIONAL,IN OUT DWORD OPTIONAL);
//BOOL IMAGEAPI ImageGetCertificateData(IN HANDLE,IN DWORD,OUT LPWIN_CERTIFICATE,IN OUT PDWORD);
//BOOL IMAGEAPI ImageGetCertificateHeader(IN HANDLE,IN DWORD,IN OUT LPWIN_CERTIFICATE);
BOOL IMAGEAPI CopyPdb(CHAR const*,CHAR const*,BOOL);
BOOL IMAGEAPI RemovePrivateCvSymbolicEx(PCHAR,ULONG,PCHAR*,ULONG*);
#endif /* RC_INVOKED */

View file

@ -952,6 +952,11 @@ typedef enum
#define IMAGE_SUBSYSTEM_OS2_CUI 5
#define IMAGE_SUBSYSTEM_POSIX_CUI 7
#define IMAGE_SUBSYSTEM_XBOX 14
#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
#define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((DWORD)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
#define IMAGE_DIRECTORY_ENTRY_EXPORT 0
#define IMAGE_DIRECTORY_ENTRY_IMPORT 1