Click here to Skip to main content
15,917,005 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pointer_default Pin
George_George13-Feb-08 3:47
George_George13-Feb-08 3:47 
GeneralRe: pointer_default Pin
David Crow13-Feb-08 3:57
David Crow13-Feb-08 3:57 
GeneralRe: pointer_default Pin
George_George13-Feb-08 16:47
George_George13-Feb-08 16:47 
GeneralRe: pointer_default Pin
David Crow14-Feb-08 4:51
David Crow14-Feb-08 4:51 
GeneralRe: pointer_default Pin
George_George14-Feb-08 18:21
George_George14-Feb-08 18:21 
Generalostrstream Pin
George_George12-Feb-08 20:38
George_George12-Feb-08 20:38 
GeneralRe: ostrstream Pin
CPallini12-Feb-08 22:08
mveCPallini12-Feb-08 22:08 
GeneralRe: ostrstream Pin
George_George12-Feb-08 22:31
George_George12-Feb-08 22:31 
GeneralRe: ostrstream Pin
CPallini12-Feb-08 22:41
mveCPallini12-Feb-08 22:41 
GeneralRe: ostrstream Pin
George_George12-Feb-08 22:48
George_George12-Feb-08 22:48 
GeneralRe: ostrstream Pin
CPallini12-Feb-08 22:56
mveCPallini12-Feb-08 22:56 
GeneralRe: ostrstream Pin
George_George12-Feb-08 23:23
George_George12-Feb-08 23:23 
GeneralRe: ostrstream Pin
jhwurmbach12-Feb-08 23:56
jhwurmbach12-Feb-08 23:56 
GeneralRe: ostrstream Pin
George_George13-Feb-08 0:02
George_George13-Feb-08 0:02 
GeneralRe: ostrstream Pin
jhwurmbach13-Feb-08 0:40
jhwurmbach13-Feb-08 0:40 
GeneralRe: ostrstream Pin
George_George13-Feb-08 0:42
George_George13-Feb-08 0:42 
QuestionHow to extract Exported functions from a DLL Pin
poda12-Feb-08 20:18
poda12-Feb-08 20:18 
AnswerRe: How to extract Exported functions from a DLL Pin
Stephen Hewitt12-Feb-08 20:34
Stephen Hewitt12-Feb-08 20:34 
GeneralRe: How to extract Exported functions from a DLL Pin
poda12-Feb-08 21:10
poda12-Feb-08 21:10 
AnswerRe: How to extract Exported functions from a DLL Pin
Nibu babu thomas12-Feb-08 20:47
Nibu babu thomas12-Feb-08 20:47 
GeneralRe: How to extract Exported functions from a DLL Pin
poda12-Feb-08 21:40
poda12-Feb-08 21:40 
GeneralRe: How to extract Exported functions from a DLL Pin
Nibu babu thomas13-Feb-08 0:15
Nibu babu thomas13-Feb-08 0:15 
GeneralRe: How to extract Exported functions from a DLL Pin
poda13-Feb-08 23:23
poda13-Feb-08 23:23 
GeneralRe: How to extract Exported functions from a DLL Pin
David Crow13-Feb-08 3:16
David Crow13-Feb-08 3:16 
AnswerRe: How to extract Exported functions from a DLL Pin
Stephen Hewitt12-Feb-08 21:09
Stephen Hewitt12-Feb-08 21:09 
Here's a program I knocked up which lists the functions exported by name from a dll:
// Exports.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include <Imagehlp.h>
#pragma comment(lib, "Imagehlp.lib")
using namespace std;
 
int main(int argc, char* argv[])
{
	if (argc!=2)
	{
		cerr << "Usage:\n\tExports <path to dll>" << endl;
		return 1;
	}
 
	// Try to map the DLL into memory.
	LOADED_IMAGE li;
	BOOL bOK = MapAndLoad(
			argv[1],	// PSTR ImageName
			NULL,		// PSTR DllPath
			&li,		// PLOADED_IMAGE LoadedImage
			TRUE,		// BOOL DotDll
			TRUE		// BOOL ReadOnly
			);
	if (!bOK)
	{
		cerr << "MapAndLoad failed!" << endl;
		return 2;
	}
 
	// Now get the address of the export table.
	DWORD expVA = li.FileHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
	PIMAGE_EXPORT_DIRECTORY pExp = (PIMAGE_EXPORT_DIRECTORY)ImageRvaToVa(
								li.FileHeader,		// IN PIMAGE_NT_HEADERS NtHeaders
								li.MappedAddress,	// IN PVOID Base
								expVA,			// IN ULONG Rva
								NULL			// IN OUT PIMAGE_SECTION_HEADER *LastRvaSection
								);
 
 
	// Now dump the functions names.
	DWORD rvaNames = pExp->AddressOfNames;
	DWORD *prvaNames = (DWORD*)ImageRvaToVa(
					li.FileHeader,		// IN PIMAGE_NT_HEADERS NtHeaders
					li.MappedAddress,	// IN PVOID Base
					rvaNames,		// IN ULONG Rva
					NULL			// IN OUT PIMAGE_SECTION_HEADER *LastRvaSection
					);
	for (DWORD i=0; i<pExp->NumberOfNames; ++i)
	{
		DWORD rvaName = prvaNames[i];
		const char *pName = (const char*)ImageRvaToVa(
						li.FileHeader,		// IN PIMAGE_NT_HEADERS NtHeaders
						li.MappedAddress,	// IN PVOID Base
						rvaName,		// IN ULONG Rva
						NULL			// IN OUT PIMAGE_SECTION_HEADER *LastRvaSection
						);
 
		cout << pName << endl;
	}
 
	// Unmap it.
	UnMapAndLoad(&li);
 
	return 0;
}


Steve

modified on Wednesday, February 13, 2008 10:58 PM

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.