]>
sourceware.org Git - newlib-cygwin.git/blob - winsup/utils/module_info.cc
3 Written by Egor Duda <deo@logos-m.ru>
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
16 /* Returns full name of Dll, which is loaded by hProcess at BaseAddress.
20 psapi_get_module_name (HANDLE hProcess
, LPVOID BaseAddress
)
26 HMODULE
*DllHandle
= dh_buf
;
30 char name_buf
[MAX_PATH
+ 1];
32 ok
= EnumProcessModules (hProcess
, DllHandle
, sizeof (HMODULE
), &cbNeeded
);
36 DllHandle
= (HMODULE
*) malloc (cbNeeded
);
39 ok
= EnumProcessModules (hProcess
, DllHandle
, cbNeeded
, &cbNeeded
);
46 for (i
= 0; i
< cbNeeded
/ sizeof (HMODULE
); i
++)
48 if (!GetModuleInformation (hProcess
, DllHandle
[i
], &mi
, sizeof (mi
)))
54 len
= GetModuleFileNameExA (hProcess
, DllHandle
[i
], name_buf
, MAX_PATH
);
61 if (mi
.lpBaseOfDll
== BaseAddress
)
64 return strdup (name_buf
);
This page took 0.038535 seconds and 5 git commands to generate.