RegEnumValue() return error 234

RegEnumValue() return error 234

Postby marzio » Wed Oct 09, 2019 9: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
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: RegEnumValue() return error 234

Postby Antonio Linares » Thu Oct 10, 2019 5:48 pm

regards, saludos

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

Re: RegEnumValue() return error 234

Postby Antonio Linares » Thu Oct 10, 2019 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: RegEnumValue() return error 234

Postby marzio » Fri Oct 11, 2019 9: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: Select all  Expand view  RUN
#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
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: RegEnumValue() return error 234

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

Re: RegEnumValue() return error 234

Postby marzio » Fri Oct 11, 2019 1: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: Select all  Expand view  RUN
RegOpenKey( HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\services\SharedAccess\Parameters\FirewallPolicy\FirewallRules", @nHandle )

anyway also the example from regenum.prg

Code: Select all  Expand view  RUN
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?
.
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am

Re: RegEnumValue() return error 234

Postby Antonio Linares » Sun Oct 13, 2019 8:33 am

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

Code: Select all  Expand view  RUN
// 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: RegEnumValue() return error 234

Postby marzio » Mon Oct 14, 2019 7: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: Select all  Expand view  RUN
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
.
marzio
 
Posts: 129
Joined: Wed Apr 04, 2007 6:54 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 34 guests