Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/utils/module_info.cc')
-rw-r--r--winsup/utils/module_info.cc72
1 files changed, 0 insertions, 72 deletions
diff --git a/winsup/utils/module_info.cc b/winsup/utils/module_info.cc
deleted file mode 100644
index 1437da421..000000000
--- a/winsup/utils/module_info.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-/* module_info.cc
-
- Copyright 1999, 2000, 2001, 2010, 2013 Red Hat, Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdlib.h>
-#include <windows.h>
-#include <psapi.h>
-#include "loadlib.h"
-
-/* Returns full name of Dll, which is loaded by hProcess at BaseAddress.
- Uses psapi.dll. */
-
-char *
-psapi_get_module_name (HANDLE hProcess, LPVOID BaseAddress)
-{
- DWORD len;
- MODULEINFO mi;
- unsigned int i;
- HMODULE dh_buf[1];
- HMODULE *DllHandle = dh_buf;
- DWORD cbNeeded;
- BOOL ok;
-
- char name_buf[MAX_PATH + 1];
-
- ok = EnumProcessModules (hProcess, DllHandle, sizeof (HMODULE), &cbNeeded);
-
- if (!ok || !cbNeeded)
- goto failed;
- DllHandle = (HMODULE *) malloc (cbNeeded);
- if (!DllHandle)
- goto failed;
- ok = EnumProcessModules (hProcess, DllHandle, cbNeeded, &cbNeeded);
- if (!ok)
- {
- free (DllHandle);
- goto failed;
- }
-
- for (i = 0; i < cbNeeded / sizeof (HMODULE); i++)
- {
- if (!GetModuleInformation (hProcess, DllHandle[i], &mi, sizeof (mi)))
- {
- free (DllHandle);
- goto failed;
- }
-
- len = GetModuleFileNameExA (hProcess, DllHandle[i], name_buf, MAX_PATH);
- if (len == 0)
- {
- free (DllHandle);
- goto failed;
- }
-
- if (mi.lpBaseOfDll == BaseAddress)
- {
- free (DllHandle);
- return strdup (name_buf);
- }
- }
-
-failed:
- return NULL;
-}