Windows Registry C5.5

Wondering if anyone can assist with reading the Windows registry using Clarion5?

I see that there are functions in C6 but that doesn’t help me ATM.

I have been reading the API doco, eg: https://docs.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regopenkeyexa, and I am getting a little bamboozled.

I have written a few simple API calls before but this is getting a little OTT for me - until I can get a firm grasp of the concepts.

Has anyone done it in C5 and can give me some pointers?

Thanks.

You need Clarion prototypes for the registry functions. These are the ones I use

Module(‘WINREG’)
RegOpenKey(Long,Long,Long),Long,Pascal,Name(‘RegOpenKeyA’)
RegOpenKeyEx(Long,Long,Long,Long,Long),Long,Pascal,Name(‘RegOpenKeyExA’)
RegCloseKey(Long),Long,Pascal
RegEnumKey(Long,Long,Long,Long),Long,Pascal,Name(‘RegEnumKeyA’)
RegEnumKeyEx(Long,Long,Long,Long,Long,Long,Long,Long),Long,Pascal,Name(‘RegEnumKeyExA’)
RegEnumValue(Long,Long,Ulong,Ulong,Ulong,Ulong,Ulong,Ulong),Long,Pascal,Name(‘RegEnumValueA’)
RegCreateKey(Long,Long,Long),Long,Pascal,Name(‘RegCreateKeyExA’)
RegCreateKeyEx(Long,Long,Long,Long,Long,Long,Long,Long,Long),Long,Pascal,Name(‘RegCreateKeyExA’)
RegSetValueEx(Long,Long,Long,Long,Long,Long),Long,Pascal,Name(‘RegSetValueExA’)
RegDeleteValue(Long,Long),Long,Pascal,Name(‘RegDeleteValueA’)
RegDeleteKey(Long,Long),Long,Pascal,Name(‘RegDeleteKeyA’)
RegQueryValueEx(Long,Long,Long,Long,Long,ULong),Long,Pascal,Name(‘RegQueryValueExA’)
End

You’ll also need these as well:
HKEY_CLASSES_ROOT Equate(080000000H)
HKEY_CURRENT_USER Equate(080000001H)
HKEY_LOCAL_MACHINE Equate(080000002H)
HKEY_USERS Equate(080000003H)

Also bear in mind that a 32bit app on a 32bit OS reads different registry keys than a 32bit app on a 64bit OS
For example,
! 32-on-32 reads HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
! 32-on-64 reads HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion

Jeff Jones wrote a registry funcs wrapper that I used in C55. Will see if I can locate it.

The ABC Free classes have a registry class, too.
http://www.authord.com/products/Clarion/
And a bunch of other stuff.

Thanks Paul_Attryde, I had really FUBARed my prototyping. That seems to be my stumbling block, converting the C parameters to Clarion. I will have to start some doco for my own benefit on how to do it.

I already had the EQUATEs for the keys, and thanks for the heads up with the different registry locations.

jslarve, thanks for your reply too. That would be appreciated.

Rick_UpperPark, thank you as well, though we are using legacy - ABC is on my list of things to do.

Thank you all.

Andrew.

The old Jeff Jones site is here. Apparently, the setup.exe is available there, but I am not sure it’s the original. https://web.archive.org/web/20041001000000*/http://ourworld.compuserve.com/homepages/jeffnjones

zenzag, see if this helps at all. It’s way old, but the basics should still apply
http://attryde.com/clarion/cw_prototypes.htm

1 Like

Thanks Paul.
The basics are still relevant.
I have spent a few days playing around with the prototypes and referring to a previous programmers work and am far more confident now. I have gotten RegOpenKey, RegCloseKey and RegEnumKey working and providing the expected results.
I have proceeded contrary to your preference and declared the prototypes with EQUATEd parameters to avoid confusion and clarify which parameter is which.
I am far more confident moving forward. Thanks for the help.

There’s more than 1 way to skin a cat. Glad I could be of help.