FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour RegEnumValue() return error 234
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
RegEnumValue() return error 234
Posted: Wed Oct 09, 2019 09:31 AM

Hi at all.
i have inserted the sample regenum.prg in a my program compiled with borland 7.2 and all is ok (RegEnumValue() return 0)
if i compile the same program with visual c++ 2015 RegEnumValue() return 234 instead of 0 and doesn't work.
any idea?

thanks, marzio

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: RegEnumValue() return error 234
Posted: Thu Oct 10, 2019 05:48 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: RegEnumValue() return error 234
Posted: Thu Oct 10, 2019 05:50 PM
https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regenumvaluea

Return Value
If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a system error code. If there are no more values available, the function returns ERROR_NO_MORE_ITEMS.

If the lpData buffer is too small to receive the value, the function returns ERROR_MORE_DATA.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: RegEnumValue() return error 234
Posted: Fri Oct 11, 2019 09:01 AM
many thanks Antonio for your answer.
i have tried many options in the code below but i have had no success.
(i have tried many buffer dimensions till number of 32,767)
i obtain always the error code 234
please can you suggest me the right way so the code work fine?
marzio


Code (fw): Select all Collapse
#define  HKEY_LOCAL_MACHINE      2147483650
#define  ERROR_SUCCESS                    0

function Main()

   local hKey, cName, uValue := 2048, n := 0
   local lpData, lpcbData := 2048

   RegOpenKey( HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @hKey )

   while RegEnumValue( hKey, n++, @cName, @uValue,,, @lpData, @lpcbData ) == ERROR_SUCCESS
      MsgInfo( cName )
      MsgInfo( uValue )
   end

   RegCloseKey( hKey )

return nil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: RegEnumValue() return error 234
Posted: Fri Oct 11, 2019 10:38 AM

The value that you are trying to retrieve is larger than 1024 bytes ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: RegEnumValue() return error 234
Posted: Fri Oct 11, 2019 01:31 PM
they are firewall informations like this long 150 to 170 characters obtained with compiling the example with bcc72:

v2.10|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Domain|App=G:\winclip\applicazioni\contab\contab.exe|Name=contab|Desc=contab|Defer=User|

this is the key:

Code (fw): Select all Collapse
RegOpenKey( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules", @nHandle )

anyway also the example from regenum.prg

Code (fw): Select all Collapse
RegOpenKey( HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @hKey )

compiled with visual c++ returns error 234 !!

your example file regenum.prg works fine with visual c++ 32 and 64 bit?
.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: RegEnumValue() return error 234
Posted: Sun Oct 13, 2019 08:33 AM
regenum.prg is working fine using MSVC 64 but it shows nothing

Code (fw): Select all Collapse
// Retrieving all values from a registry entry

#include "FiveWin.ch"

#define  HKEY_LOCAL_MACHINE      2147483650

#define  ERROR_SUCCESS                    0

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

function Main()

   local hKey, cName, uValue, n := 0

   RegOpenKey( HKEY_LOCAL_MACHINE,;
               "Software\Microsoft\Windows\CurrentVersion\Run", @hKey )
   
   while RegEnumValue( hKey, n++, @cName, @uValue ) == ERROR_SUCCESS
      MsgInfo( cName )
      MsgInfo( uValue )
   end

   MsgInfo( "ok" )

   RegCloseKey( hKey )

return nil

//---------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 193
Joined: Wed Apr 04, 2007 06:54 AM
Re: RegEnumValue() return error 234
Posted: Mon Oct 14, 2019 07:12 AM
Antonio you say: "regenum.prg is working fine using MSVC 64 but it shows nothing"

Why regenum with MSVC shows nothing, while with BCC72 shows 8 keys and 8 values presents in my windows register?

Try to put:

Code (fw): Select all Collapse
RegOpenKey( HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", @hKey )
? RegEnumValue( hKey, n, @cName, @uValue )

in regenum.prg to see if return 0 or 234 compiled with MSVC
.

Continue the discussion