Page 1 of 1

EnumKeys - Registry extra functions

Posted: Fri Apr 25, 2014 2:28 pm
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. ;)

Re: EnumKeys - Registry extra functions

Posted: Fri Apr 25, 2014 3:10 pm
by Rathinagiri
IMHO, you please develop all the external library code in a separate prg file and let us add to hfcl.

EnumKeys - Registry extra functions

Posted: Fri Apr 25, 2014 3:15 pm
by Pablo César
Thank you Rathi for your response and I think it is good enough your indication. :)