Click here to Skip to main content
15,902,112 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCopyFile Pin
hafz3-Jul-06 23:08
hafz3-Jul-06 23:08 
AnswerRe: CopyFile Pin
Weiye Chen3-Jul-06 23:10
Weiye Chen3-Jul-06 23:10 
AnswerRe: CopyFile Pin
Hamid_RT4-Jul-06 2:21
Hamid_RT4-Jul-06 2:21 
QuestionHow to create ActiveX like SDI application? Pin
safety_ruk3-Jul-06 23:05
safety_ruk3-Jul-06 23:05 
Questionabout circular button(owner draw) Pin
HOW WHAT3-Jul-06 23:00
HOW WHAT3-Jul-06 23:00 
AnswerRe: about circular button(owner draw) Pin
Sarath C4-Jul-06 0:30
Sarath C4-Jul-06 0:30 
QuestionFinding the Ordinal of an imported function Pin
capricious_0013-Jul-06 22:36
capricious_0013-Jul-06 22:36 
AnswerRe: Finding the Ordinal of an imported function Pin
Viorel.3-Jul-06 23:53
Viorel.3-Jul-06 23:53 
Maybe the following sample function will give you some ideas?

It returns the ordinal number having the handle of the DLL (from LoadLibrary) and the address of the exported function (from GetProcAddress):

WORD getFunctionOrdinal( HMODULE hModule, FARPROC pFunction)
{
	if( hModule == 000 || pFunction == 000) return 0;

	// address of the module's export section

	ULONG export_dir_size;
	PIMAGE_EXPORT_DIRECTORY pExportDir =
		(PIMAGE_EXPORT_DIRECTORY)ImageDirectoryEntryToData(
		hModule,
		TRUE,
		IMAGE_DIRECTORY_ENTRY_EXPORT,
		&export_dir_size
		);

	// does this module have export section?
	if( pExportDir == 000) 
	{
		return 0;
	}

	LPCSTR const charAddress = (LPCSTR)hModule;

	// name of the DLL
	//LPCSTR const pDllName = charAddress + pExportDir->Name;
	// starting ordinal value. By default is 1, but is not required to be so
	WORD const base = (WORD)pExportDir->Base; // (NOTE. It is DWORD)
	// array function pointers
	PDWORD const pFunctions = (PDWORD)(charAddress + pExportDir->AddressOfFunctions);
	// array of function names
	//PDWORD const pFuncNames = (PDWORD)(charAddress + pExportDir->AddressOfNames);
	// array of ordinals
	PWORD const pOrdinals = (PWORD)(charAddress + pExportDir->AddressOfNameOrdinals);
	// number of entries
	DWORD const numberOfFunctions = pExportDir->NumberOfFunctions;
	DWORD const numberOfNames = pExportDir->NumberOfNames; // and numbers of ordinals

	for( DWORD i = 0; i < numberOfFunctions; ++i) 
	{
		FARPROC const fp = (FARPROC)(charAddress + pFunctions[i]);
		if( fp == pFunction) 
		{
			return (WORD)(i + base);
		}
	}

	return 0; // not found
}

I hope this helps.
GeneralRe: Finding the Ordinal of an imported function Pin
capricious_0014-Jul-06 0:09
capricious_0014-Jul-06 0:09 
QuestionProblems with LaserJet driver Pin
quique3-Jul-06 21:55
quique3-Jul-06 21:55 
AnswerRe: Problems with LaserJet driver Pin
Hamid_RT3-Jul-06 22:08
Hamid_RT3-Jul-06 22:08 
GeneralRe: Problems with LaserJet driver Pin
quique4-Jul-06 0:46
quique4-Jul-06 0:46 
GeneralRe: Problems with LaserJet driver Pin
Hamid_RT4-Jul-06 2:20
Hamid_RT4-Jul-06 2:20 
GeneralRe: Problems with LaserJet driver Pin
quique4-Jul-06 4:53
quique4-Jul-06 4:53 
GeneralRe: Problems with LaserJet driver Pin
Hamid_RT4-Jul-06 5:52
Hamid_RT4-Jul-06 5:52 
GeneralRe: Problems with LaserJet driver Pin
quique4-Jul-06 21:29
quique4-Jul-06 21:29 
Questionhow to read an RTF file containing a bitmap and text Pin
Chetan Sheladiya3-Jul-06 21:49
professionalChetan Sheladiya3-Jul-06 21:49 
AnswerRe: how to read an RTF file containing a bitmap and text Pin
Hamid_RT3-Jul-06 21:56
Hamid_RT3-Jul-06 21:56 
Questiondecimal digits Pin
thathvamsi3-Jul-06 21:47
thathvamsi3-Jul-06 21:47 
AnswerRe: decimal digits Pin
Weiye Chen3-Jul-06 21:51
Weiye Chen3-Jul-06 21:51 
GeneralRe: decimal digits Pin
thathvamsi3-Jul-06 22:05
thathvamsi3-Jul-06 22:05 
GeneralRe: decimal digits Pin
Weiye Chen3-Jul-06 22:29
Weiye Chen3-Jul-06 22:29 
GeneralRe: decimal digits Pin
thathvamsi3-Jul-06 22:38
thathvamsi3-Jul-06 22:38 
GeneralRe: decimal digits Pin
Weiye Chen3-Jul-06 22:59
Weiye Chen3-Jul-06 22:59 
GeneralRe: decimal digits [modified] Pin
thathvamsi3-Jul-06 23:44
thathvamsi3-Jul-06 23:44 

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.