mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
windows tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29397 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a15a02db18
commit
7f21dcbbea
1 changed files with 21 additions and 1 deletions
|
@ -90,6 +90,26 @@ typedef struct { @defs(NSThread) } *TInfo;
|
|||
static NSString *
|
||||
GSPrivateBaseAddress(void *addr, void **base)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION info;
|
||||
|
||||
/* Found a note saying that according to Matt Pietrek's "Under the Hood"
|
||||
* column for the April 1997 issue of Microsoft Systems Journal, the
|
||||
* allocation base returned by VirtualQuery can be used as the handle
|
||||
* to obtain module information for a loaded library.
|
||||
*/
|
||||
if (VirtualQuery (addr, &info, sizeof(info)) != 0)
|
||||
{
|
||||
HMODULE handle = (HMODULE) mbi.AllocationBase;
|
||||
unichar path[MAX_PATH+1];
|
||||
|
||||
if (GetModuleFileNameW(handle, path, sizeof(path)-1) != 0)
|
||||
{
|
||||
path[sizeof(path)-1] = '\0';
|
||||
|
||||
*base = info.BaseAddress;
|
||||
return [[NSString stringWithCharacters: path length: wcslen(path)]];
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
#endif /* USE_BINUTILS */
|
||||
|
@ -632,7 +652,7 @@ GSListModules()
|
|||
aFrame = [bfi functionForAddress: (void*)(address - base)];
|
||||
if (aFrame == nil)
|
||||
{
|
||||
/* We know we have the right module be function lookup
|
||||
/* We know we have the right module but function lookup
|
||||
* failed ... perhaps we need to use the absolute
|
||||
* address rather than offest by 'base' in this case.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue