EnumKeys - Registry extra functions

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

EnumKeys - Registry extra functions

Post by Pablo César »

Hi Rathinagiri and Claudio,

Seems one thing leads to another... FMG Editor -> HMG_PATH -> New Registry functions.

I'm here to ask you to evaluate if these functions (listed below) that deserve much attention, because they are important to read, list items and sub-items in the data with their key values​​ at REGISTRY.

In this message (clicking will open in a new window), it might have passed unnoticed because he was dealing with serial colleague Marek, but has several useful functions.

Below I will list some C functions that could be part of our lib:

Code: Select all

#pragma BEGINDUMP

#define COMPILE_HMG_UNICODE
#include "HMG_UNICODE.h"

#include <windows.h>

HB_FUNC( REGCLOSEKEY )
{
   HKEY hwHandle = ( HKEY ) hb_parnl( 1 );

   if ( RegCloseKey( hwHandle ) == ERROR_SUCCESS )
      {
         hb_retnl( ERROR_SUCCESS );
      }
   else
      {
         hb_retnl( -1 );
      }
}

HB_FUNC( REGOPENKEY )
{
   HKEY hKey = ( HKEY ) hb_parnl( 1 );
   HKEY hResult;
 
   hb_retnl( RegOpenKey( hKey, HMG_parc( 2 ), &hResult ) );
   hb_stornl( ( LONG ) hResult, 3 );
}
 
HB_FUNC( REGENUMKEYEXW )
{
   FILETIME ft;
   long bErr;
   TCHAR Buffer[ 255 ];
   DWORD dwBuffSize = 255;
   TCHAR Class[ 255 ];
   DWORD dwClass = 255;

   bErr = RegEnumKeyEx( ( HKEY ) hb_parnl( 1 ), hb_parnl( 2 ), Buffer, &dwBuffSize, NULL, Class, &dwClass, &ft );

   if( bErr != ERROR_SUCCESS )
      hb_retnl( -1 );
   else
   {
      HMG_storc( Buffer, 3 );
      hb_stornl( ( long ) dwBuffSize, 4 );
      HMG_storc( Class, 6 );
      hb_stornl( ( long ) dwClass, 7 );

      hb_retnl( 0 );
   }
}
#pragma ENDDUMP
I will await your review, ethical and functional: Rathi and Claudio. I would like your opinion. Ohterwise, these functions will restricted to HMG Editor and I should put this code in it. And this may be available for use by everybody. ;)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: EnumKeys - Registry extra functions

Post by Rathinagiri »

IMHO, you please develop all the external library code in a separate prg file and let us add to hfcl.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

EnumKeys - Registry extra functions

Post by Pablo César »

Thank you Rathi for your response and I think it is good enough your indication. :)
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply