RegEnumValue() return error 234

Post Reply
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

RegEnumValue() return error 234

Post by marzio »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: RegEnumValue() return error 234

Post by Antonio Linares »

https://docs.microsoft.com/en-us/window ... es--0-499-
ERROR_MORE_DATA

234 (0xEA)

More data is available.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: RegEnumValue() return error 234

Post by Antonio Linares »

https://docs.microsoft.com/en-us/window ... enumvaluea
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
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: RegEnumValue() return error 234

Post by marzio »

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: Select all

#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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: RegEnumValue() return error 234

Post by Antonio Linares »

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

Antonio Linares
www.fivetechsoft.com
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: RegEnumValue() return error 234

Post by marzio »

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: Select all

RegOpenKey( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules", @nHandle )
anyway also the example from regenum.prg

Code: Select all

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?
.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: RegEnumValue() return error 234

Post by Antonio Linares »

regenum.prg is working fine using MSVC 64 but it shows nothing

Code: Select all

// 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
marzio
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: RegEnumValue() return error 234

Post by marzio »

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: Select all

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
.
Post Reply