[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

06/21/2007 at 09:26PM PDT, ID: 22650498
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.2

GetProcAddress returning null - not the correct address!

Asked by n1875621 in C++ Programming Language, C++ Builder

Tags: getprocaddress

GetProcAddress is returning null...

I am using the latest C++ Builder from CodeGear.

There is an API.h and file1.cpp - then I show my output...  no compiling problems - just keep getting null!

-------------------file1.cpp---------------------
//---------------------------------------------------------------------------
#pragma hdrstop
#pragma argsused
#pragma package(smart_init)

#include "api.h"
#include <vcl.h>
#include <iostream>

/*
 *  The handle for the cdbdapi Libray
 */
      HMODULE hm = NULL;

/*
 * Holders for DLL Imported functions
 */
TInitAPI InitAPI;
TCloseAPI CloseAPI;
TGetMeet GetMeet;
TGetTime GetTime;
TGetRace GetRace;
TResult Result;
TGetID GetID;
TLoadShadow LoadShadow;
TEngineFromSysTray EngineFromSysTray;
TEngineToSysTray EngineToSysTray;
TGetQuinella GetQuinella;
TGetExacta GetExacta;
TGetTrifecta GetTrifecta;
 

using namespace std;

void exit_application ( void );

//---------------------------------------------------------------------------

void exit_application ( void )
{
      int t;
      cin >> t;
      exit (0);
}

int main(int argc, char* argv[])
{
      //try to load the library, return to console if not found
      if( ( hm = LoadLibrary( "C:\\Users\\Yiannis\\Desktop\\HR2\\cdbdapi.dll" ) ) == NULL )
      {
            cout << "LoadLibrary: DLL Could Not Be Loaded." << endl;
            exit_application ();
      }
      else
      {
            cout << "LoadLibrary: DLL Loaded Fine." << endl;
      }

      /*
       *  Get the addresses for the functions being used.
       */
      if((InitAPI=(TInitAPI)GetProcAddress(hm,"InitAPI"))==NULL)
            cout << "InitAPI(): Address Not Found!" << endl;

    if((CloseAPI=(TCloseAPI)GetProcAddress(hm,"CloseAPI"))==NULL)
            cout << "CloseAPI(): Address Not Found!" << endl;

      if((GetMeet=(TGetMeet)GetProcAddress(hm,"GetMeet"))==NULL)
            cout << "GetMeet(): Address Not Found!" << endl;

      //if((GetTime=(TGetTime)GetProcAddress(hm,"GetTime"))==NULL)
      //      cout << "GetTime(): Address Not Found!" << endl;

      if((GetRace=(TGetRace)GetProcAddress(hm,"GetRace"))==NULL)
            cout << "GetRace(): Address Not Found!" << endl;

      if((Result=(TResult)GetProcAddress(hm,"Result"))==NULL)
            cout << "Result(): Address Not Found!" << endl;

      if((GetID=(TGetID)GetProcAddress(hm,"GetID"))==NULL)
            cout << "GetID(): Address Not Found!" << endl;

      if((LoadShadow=(TLoadShadow)GetProcAddress(hm,"LoadShadow"))==NULL)
            cout << "LoadShadow(): Address Not Found!" << endl;

      if((EngineFromSysTray=(TEngineFromSysTray)GetProcAddress(hm,"EngineFromSysTray"))==NULL)
            cout << "EngineFromSysTray(): Address Not Found!" << endl;

      if((EngineToSysTray=(TEngineToSysTray)GetProcAddress(hm,"EngineToSysTray"))==NULL)
            cout << "EngineToSysTray(): Address Not Found!" << endl;

      if((GetQuinella=(TGetQuinella)GetProcAddress(hm,"GetQuinella"))==NULL)
            cout << "GetQuinella(): Address Not Found!" << endl;

      if((GetExacta=(TGetExacta)GetProcAddress(hm,"GetExacta"))==NULL)
            cout << "GetExacta(): Address Not Found!" << endl;

      if((GetTrifecta=(TGetTrifecta)GetProcAddress(hm,"GetTrifecta"))==NULL)
            cout << "GetTrifecta(): Address Not Found!" << endl;


      if ( !FreeLibrary ( hm ) ) {
            cout << "FreeLibrary(): Could not unload DLL" << endl;
      }
      
      exit_application ();

      return 1;
}
//---------------------------------------------------------------------------

-----------api.h--------
//A few defines not show...

typedef int _stdcall (*TInitAPI)( void );
typedef void _stdcall (*TCloseAPI)( void );
typedef int _stdcall (*TGetMeet)(char *, int *); //buf, len
typedef int _stdcall (*TGetTime)(char *, int *); //buf, len
typedef int _stdcall (*TGetRace)(char *, int *, int, char *, char *, int, int, int, int); //buf, len, refstate, meet, race, state, pool, updates, summary
typedef int _stdcall (*TGetQuinella)(char *, int *, int, char *, char *, int); //buf, len, refstate, meet, race, state
typedef int _stdcall (*TGetExacta)(char *, int *, int, char *, char *, int); //buf, len, refstate, meet, race, state
typedef int _stdcall (*TGetTrifecta)(char *, int *, int, char *, char *, int); //buf, len, refstate, meet, race, state
typedef int _stdcall (*TResult)(char *, int *, int, char *, char *, int); //buf, len, refstate, meet, race, state
typedef int _stdcall (*TGetID)(char *, int *); //buf, len
typedef int _stdcall (*TLoadShadow)(char *); //filename
typedef int _stdcall (*TEngineToSysTray)( void );
typedef int _stdcall (*TEngineFromSysTray)( void );

------end api.h-----------

My output!

LoadLibrary: DLL Loaded Fine.
InitAPI(): Address Not Found!
CloseAPI(): Address Not Found!
GetMeet(): Address Not Found!
GetRace(): Address Not Found!
Result(): Address Not Found!
GetID(): Address Not Found!
LoadShadow(): Address Not Found!
EngineFromSysTray(): Address Not Found!
EngineToSysTray(): Address Not Found!
GetQuinella(): Address Not Found!
GetExacta(): Address Not Found!
GetTrifecta(): Address Not Found!




 
Keywords: GetProcAddress returning null - not th…
 
Loading Advertisement...
 
[+][-]06/21/07 10:49 PM, ID: 19339210

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/21/07 11:46 PM, ID: 19339370

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/22/07 06:22 AM, ID: 19341013

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C++ Programming Language, C++ Builder
Tags: getprocaddress
Sign Up Now!
Solution Provided By: jkr
Participating Experts: 5
Solution Grade: A
 
 
[+][-]06/22/07 09:31 AM, ID: 19342726

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/07 09:34 AM, ID: 19342745

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/22/07 11:50 AM, ID: 19343837

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06/25/07 05:15 AM, ID: 19354939

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/25/07 05:18 AM, ID: 19354950

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/25/07 05:24 AM, ID: 19354986

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/25/07 05:29 AM, ID: 19355022

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/25/07 06:27 AM, ID: 19355353

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/25/07 06:31 AM, ID: 19355384

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/25/07 06:40 AM, ID: 19355462

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/25/07 06:44 AM, ID: 19355500

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/25/07 06:50 AM, ID: 19355553

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/25/07 06:55 AM, ID: 19355599

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/25/07 09:17 PM, ID: 19360906

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/02/07 08:44 PM, ID: 19408568

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/18/07 11:28 AM, ID: 19915387

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/12/09 12:55 PM, ID: 25317660

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74