Click here to Skip to main content
16,004,828 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Loading MS Word or other software from your own program Pin
Hamid_RT30-Apr-08 4:51
Hamid_RT30-Apr-08 4:51 
GeneralRe: Loading MS Word or other software from your own program Pin
Blake Miller1-May-08 12:03
Blake Miller1-May-08 12:03 
AnswerRe: Loading MS Word or other software from your own program Pin
ShilpiP1-May-08 3:09
ShilpiP1-May-08 3:09 
QuestionHow can I found out which dlls my dll depends on ... programmatically ! Pin
Berlus30-Apr-08 2:19
Berlus30-Apr-08 2:19 
AnswerRe: How can I found out which dlls my dll depends on ... programmatically ! Pin
David Crow30-Apr-08 3:14
David Crow30-Apr-08 3:14 
GeneralRe: How can I found out which dlls my dll depends on ... programmatically ! Pin
Berlus30-Apr-08 8:21
Berlus30-Apr-08 8:21 
AnswerRe: How can I found out which dlls my dll depends on ... programmatically ! Pin
Chris Meech30-Apr-08 9:25
Chris Meech30-Apr-08 9:25 
AnswerRe: How can I found out which dlls my dll depends on ... programmatically ! Pin
Stephen Hewitt30-Apr-08 15:47
Stephen Hewitt30-Apr-08 15:47 
This sould get you started:

// Depends.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <windows.h>
#include <Imagehlp.h>
#include <iostream>
using namespace std;
 
#pragma comment(lib, "Imagehlp.lib")
 
void Depends(char *pFile)
{
	cout << "\"" << pFile << "\" depends on:" << endl;
 
	LOADED_IMAGE li;
	BOOL bOk = MapAndLoad(
			pFile,	// PSTR ImageName
			NULL,	// PSTR DllPath
			&li,	// PLOADED_IMAGE LoadedImage
			TRUE,	// BOOL DotDll
			TRUE	// BOOL ReadOnly
			);
	if (!bOk)
	{
		cerr << "MapAndLoad FAILED!" << endl;
		return;
	}
 
	// Get a pointer to the import data directory ('pImpDD').
	PIMAGE_NT_HEADERS pNT = li.FileHeader;
	PIMAGE_OPTIONAL_HEADER pOpt = &(pNT->OptionalHeader);
	PIMAGE_DATA_DIRECTORY pImpDD = &(pOpt->DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]);
 
	// Get the address of the first import descriptor.
	PVOID pVoidIID = ImageRvaToVa(
				pNT,			// IN PIMAGE_NT_HEADERS NtHeaders
				li.MappedAddress,		// IN PVOID Base
				pImpDD->VirtualAddress,	// IN ULONG Rva
				NULL			// IN OUT PIMAGE_SECTION_HEADER *LastRvaSection
				);
	PIMAGE_IMPORT_DESCRIPTOR pImp = (PIMAGE_IMPORT_DESCRIPTOR)pVoidIID;
 
	// Iterate over all the import descriptors printing the DLL name.
	for (/*Empty*/; pImp->Characteristics!=0; ++pImp)
	{
		// Get the DLL's name.
		DWORD rvaName = pImp->Name;
		PVOID pVoidName = ImageRvaToVa(
					pNT,		// IN PIMAGE_NT_HEADERS NtHeaders
					li.MappedAddress,	// IN PVOID Base
					rvaName,		// IN ULONG Rva
					NULL		// IN OUT PIMAGE_SECTION_HEADER *LastRvaSection
					);
		char *pName = (char *)pVoidName;

		cout << pName << endl;
	}
 
	UnMapAndLoad(&li);
}
 
int main(int argc, char* argv[])
{
	if (argc != 2)
	{
		cout << "Usage:" << endl;
		cout << "\tDepends <file>" << endl;
		return -1;
	}
 
	Depends(argv[1]);
 
	return 0;
}


Steve

QuestionDisable the new window cration in ShellExecute? Pin
$uresh $hanmugam30-Apr-08 1:59
$uresh $hanmugam30-Apr-08 1:59 
AnswerRe: Disable the new window cration in ShellExecute? Pin
_AnsHUMAN_ 30-Apr-08 2:41
_AnsHUMAN_ 30-Apr-08 2:41 
GeneralRe: Disable the new window cration in ShellExecute? Pin
Maximilien30-Apr-08 2:50
Maximilien30-Apr-08 2:50 
GeneralRe: Disable the new window cration in ShellExecute? Pin
_AnsHUMAN_ 30-Apr-08 2:57
_AnsHUMAN_ 30-Apr-08 2:57 
GeneralRe: Disable the new window cration in ShellExecute? Pin
David Crow30-Apr-08 3:16
David Crow30-Apr-08 3:16 
AnswerRe: Disable the new window cration in ShellExecute? Pin
David Crow30-Apr-08 3:23
David Crow30-Apr-08 3:23 
AnswerRe: Disable the new window cration in ShellExecute? Pin
prasad_som30-Apr-08 4:03
prasad_som30-Apr-08 4:03 
AnswerRe: Disable the new window cration in ShellExecute? Pin
Rajkumar R30-Apr-08 5:10
Rajkumar R30-Apr-08 5:10 
Question[Message Deleted] Pin
MrFloyd200930-Apr-08 1:05
MrFloyd200930-Apr-08 1:05 
AnswerRe: Does a serial port (ex: COM1) fail/break down or be always busy because of a software (when the software is not running)? Pin
Cedric Moonen30-Apr-08 1:10
Cedric Moonen30-Apr-08 1:10 
Questionfolder to VS IDE Pin
Tara1430-Apr-08 0:45
Tara1430-Apr-08 0:45 
AnswerRe: folder to VS IDE Pin
Nelek30-Apr-08 1:01
protectorNelek30-Apr-08 1:01 
GeneralRe: folder to VS IDE Pin
Tara1430-Apr-08 1:48
Tara1430-Apr-08 1:48 
QuestionHow to initialize log Pin
pl_kode30-Apr-08 0:26
pl_kode30-Apr-08 0:26 
QuestionRe: How to initialize log Pin
Maximilien30-Apr-08 2:32
Maximilien30-Apr-08 2:32 
AnswerRe: How to initialize log Pin
David Crow30-Apr-08 3:27
David Crow30-Apr-08 3:27 
QuestionTo convert message "WM_CLOSE" into integer Pin
Mushtaque Nizamani29-Apr-08 23:35
Mushtaque Nizamani29-Apr-08 23:35 

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.