HMG.3.4.0 Ejemplos DLL no funcionan

Moderator: Rathinagiri

User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by srvet_claudio »

danielmaximiliano wrote:
Pablo César wrote:Provisional solution (unofficial) for the current version HMG 3.4.0:

This is what I've done and worked perfectly. :D
Hola Pablo:
estoy trabajando con .dll y si tuvieras la amabilidad de subir las correcciones tanto en .c y .prg seria muy bueno asi no equivocarme y reconstruir las librerias ..

Gracias
Daniel,
todos los cambios están incluidos en HMG.3.4.0 parche 1 viewtopic.php?f=43&t=4176&start=110#p41353
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by srvet_claudio »

danielmaximiliano wrote:Hola Claudio Soto :
hay alguna forma de exportar o ver las funciones de una .DLL cargada en Harbour
Estas nuevas funciones (HMG_GetHBSymbols, HMG_GetDLLFunctions) serán incluidas en la proxima versión:

Code: Select all


#include "hmg.ch"

Function Main

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 700 ;
      HEIGHT 700 ;
      MAIN 

aRows1 := HMG_GetHBSymbols()

      @ 10,10 GRID Grid_1 ;
         WIDTH 620 ;
         HEIGHT 300 ;
         HEADERS {'Index','Symbol','Type'} ;
         WIDTHS {140,240,140} ;
         ITEMS aRows1


aRows2 := {}
aData := HMG_GetDLLFunctions ("user32.dll")
FOR i := 1 TO HMG_LEN (aData)
   AAdd(aRows2, { str( i ), aData[ i ] } ) 
NEXT

      @ 350,10 GRID Grid_2 ;
         WIDTH 620 ;
         HEIGHT 300 ;
         HEADERS {'Index','Function'} ;
         WIDTHS {140, 240} ;
         ITEMS aRows2

   END WINDOW

   MAXIMIZE WINDOW Form_1
   ACTIVATE WINDOW Form_1
Return


FUNCTION HMG_GetHBSymbols()
LOCAL cSymName, aSym := {}
/*
__DYNSCOUNT()    // How much symbols do we have:    dsCount = __dynsCount()
__DYNSGETNAME()  // Get name of symbol:             cSymbol = __dynsGetName( dsIndex )
__DYNSGETINDEX() // Get index number of symbol:     dsIndex = __dynsGetIndex( cSymbol )
__DYNSISFUN()    // returns .T. if a symbol has a function/procedure pointer given its symbol index or name:   __DynsIsFun( cSymbol | dsIndex )
HB_ISFUNCTION()  // returns .T. if a symbol has a function/procedure pointer:                                  hb_IsFunction( cSymbol )
*/

   FOR i := 1 TO __DYNSCOUNT()
      cSymName := __DYNSGETNAME( i )
      AAdd( aSym, { str( i ), cSymName, IIF( __DYNSISFUN( cSymName ), "FUNC/PROC","" ) } )
   NEXT

RETURN aSym



#pragma BEGINDUMP
#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"
#include <windows.h>
#include <imagehlp.h>
#include "hbapi.h"


HMG_DEFINE_DLL_FUNC ( win_MapAndLoad,                            // user function name
                      "Imagehlp.dll",                                      // dll name
                      WINBOOL,                                               // function return type
                      WINAPI,                                             // function type
                      "MapAndLoad",                              // dll function name
                      (PCSTR ImageName, PCSTR DllPath, PLOADED_IMAGE LoadedImage, WINBOOL DotDll, WINBOOL ReadOnly),   // dll function parameters (types and names)
                      (ImageName, DllPath, LoadedImage, DotDll, ReadOnly),                           // function parameters (only names)
                      FALSE                                               // return value if fail call function of dll
                    )

HMG_DEFINE_DLL_FUNC ( win_UnMapAndLoad,                            // user function name
                      "Imagehlp.dll",                                      // dll name
                      WINBOOL,                                               // function return type
                      WINAPI,                                             // function type
                      "UnMapAndLoad",                              // dll function name
                      (PLOADED_IMAGE LoadedImage),   // dll function parameters (types and names)
                      (LoadedImage),                           // function parameters (only names)
                      FALSE                                               // return value if fail call function of dll
                    )

HMG_DEFINE_DLL_FUNC ( win_ImageDirectoryEntryToData,                            // user function name
                      "Dbghelp.dll",                                      // dll name
                      PVOID,                                               // function return type
                      WINAPI,                                             // function type
                      "ImageDirectoryEntryToData",                              // dll function name
                      (PVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size),   // dll function parameters (types and names)
                      (Base, MappedAsImage, DirectoryEntry, Size),                           // function parameters (only names)
                      NULL                                               // return value if fail call function of dll
                    )

HMG_DEFINE_DLL_FUNC ( win_ImageRvaToVa,                            // user function name
                      "Dbghelp.dll",                                      // dll name
                      PVOID,                                               // function return type
                      WINAPI,                                             // function type
                      "ImageRvaToVa",                              // dll function name
                      (PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva,PIMAGE_SECTION_HEADER *LastRvaSection),   // dll function parameters (types and names)
                      (NtHeaders, Base, Rva, LastRvaSection),                           // function parameters (only names)
                      NULL                                               // return value if fail call function of dll
                    )


HB_FUNC ( HMG_GETDLLFUNCTIONS )
{
    CHAR *cDllName = (CHAR *) hb_parc (1);
    DWORD *dNameRVAs = NULL;
    LOADED_IMAGE LI;
    IMAGE_EXPORT_DIRECTORY *IED;
    ULONG DirSize;
    CHAR *cName;

    if ( win_MapAndLoad (cDllName, NULL, &LI, TRUE, TRUE) )
    {
        IED = (IMAGE_EXPORT_DIRECTORY *) win_ImageDirectoryEntryToData (LI.MappedAddress, FALSE, IMAGE_DIRECTORY_ENTRY_EXPORT, &DirSize);
        if (IED != NULL)
        {
            dNameRVAs = (DWORD *) win_ImageRvaToVa (LI.FileHeader, LI.MappedAddress, IED->AddressOfNames, NULL);
            ULONG i;
            hb_reta ( IED->NumberOfNames );
            for(i = 0; i < IED->NumberOfNames; i++)
            {
                cName = (CHAR *) win_ImageRvaToVa (LI.FileHeader, LI.MappedAddress, dNameRVAs[i], NULL);
                hb_storvc ( cName, -1, i + 1 );
            }
        }
        win_UnMapAndLoad (&LI);
    }
}


#pragma ENDDUMP
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by esgici »

srvet_claudio wrote: Estas nuevas funciones (HMG_GetHBSymbols, HMG_GetDLLFunctions) serán incluidas en la proxima versión:
:?
Is this problem, this solution, this two new functions and this notification to next release are exclusive for non-English spoken people only :?: :mrgreen:

Viva INTERNATIONAL HMG :D
Viva INTERNATIONAL HMG :D
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by srvet_claudio »

esgici wrote:
srvet_claudio wrote: Estas nuevas funciones (HMG_GetHBSymbols, HMG_GetDLLFunctions) serán incluidas en la proxima versión:
:?
Is this problem, this solution, this two new functions and this notification to next release are exclusive for non-English spoken people only :?: :mrgreen:

Viva INTERNATIONAL HMG :D
Hi Friend.

I think it was a misunderstanding.

I answered a specific question by Daniel, I only added that I will include these functions in the next version.

I not announced the release of a new version.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by esgici »

srvet_claudio wrote:
esgici wrote:
srvet_claudio wrote: Estas nuevas funciones (HMG_GetHBSymbols, HMG_GetDLLFunctions) serán incluidas en la proxima versión:
:?
Is this problem, this solution, this two new functions and this notification to next release are exclusive for non-English spoken people only :?: :mrgreen:

Viva INTERNATIONAL HMG :D
Hi Friend.

I think it was a misunderstanding.

I answered a specific question by Daniel, I only added that I will include these functions in the next version.

I not announced the release of a new version.
IMO we have no misunderstanding, but mistaking.

Specific question and specific answer SHOULD flow specific way, such as PM or private e-mail;

Talking a specific language open public, such as in an open and MUST BE INTERNATIONAL forum is a SHAME !

This is my personal point of view, repeated and probably will be repeated too may time.

Viva INTERNATIONAL HMG :D
Viva INTERNATIONAL HMG :D
User avatar
srvet_claudio
Posts: 2193
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by srvet_claudio »

esgici wrote:Specific question and specific answer SHOULD flow specific way, such as PM or private e-mail;
You are right, for me it is much easier that way.
Note that others will be lost the code of my answer, but if that is the price they are willing to pay so that I do not write more in Spanish for me no problem.

PS: the above code is a complete demo that not needs translation, IMHO this discussion is unnecessary.
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by esgici »

srvet_claudio wrote:
esgici wrote:Specific question and specific answer SHOULD flow specific way, such as PM or private e-mail;
You are right, for me it is much easier that way.
Note that others will be lost the code of my answer, but if that is the price they are willing to pay so that I do not write more in Spanish for me no problem.

PS: the above code is a complete demo that not needs translation, IMHO this discussion is unnecessary.
Dear friend,

Problem isn't you or me or anyone else;

problem is future of HMG,

does HMG is and will be an INTERNATIONAL product or not :? :?:

problem is that.

Believe me, absolutely is not my matter, I don't care "who talking about what ?"

Viva INTERNATIONAL HMG :D
Viva INTERNATIONAL HMG :D
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by bpd2000 »

srvet_claudio wrote:
danielmaximiliano wrote:Hola Claudio Soto :
hay alguna forma de exportar o ver las funciones de una .DLL cargada en Harbour
Estas nuevas funciones (HMG_GetHBSymbols, HMG_GetDLLFunctions) serán incluidas en la proxima versión:
Great Extension
Thank you
BPD
Convert Dream into Reality through HMG
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

HMG.3.4.0 Ejemplos DLL no funcionan

Post by Pablo César »

bpd2000 wrote:
srvet_claudio wrote:
danielmaximiliano wrote:Hola Claudio Soto :
hay alguna forma de exportar o ver las funciones de una .DLL cargada en Harbour
Estas nuevas funciones (HMG_GetHBSymbols, HMG_GetDLLFunctions) serán incluidas en la proxima versión:
Great Extension
Thank you
+1

Gracias Claudio por tu bello trabajo !
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
serge_girard
Posts: 3178
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: HMG.3.4.0 Ejemplos DLL no funcionan

Post by serge_girard »

Thanks !

Serge
There's nothing you can do that can't be done...
Post Reply