May 06, 2024, 10:45:12 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Help with external function

Started by Andy, April 19, 2016, 06:34:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

April 19, 2016, 06:34:35 AM Last Edit: April 19, 2016, 07:44:40 AM by Andy
I'm trying now to finish of my registry program.

The bug in it is that I'm not reading binary registry values incorrectly, however I've found the external function that does it, It's called GetBinaryValue.

Now I've got it wrong somewhere as I am getting an unresolved external error on compile.

Attached is the small program, It's not meant to do anything yet, just use the above function.

Even for me, I thought I'd be able to work this one out for myself - help please!

Here is a link to msdn about it:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa390440%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

Here is the output window message:
Compiling Resources...
No Errors

Compiling...
r1.iwb

Linking...
IWBasic Linker v1.11 Copyright © 2011 Ionic Wind Software
Unresolved external __imp_GetBinaryValue
Error: C:\Win10\r1.o - Unresolved extern __imp_GetBinaryValue
Error(s) in linking C:\Win10\r1.exe

To test:
I created a registry key called "1" and a binary value in there called "test"
(HKEY_CURRENT_USER\Software\1)

Help please!

Thanks,
Andy.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

You're trying to use the wrong function; that one is out of the WMI dll
you want to use the api32.dll which you used with your registry inc file back in 2011.
but you will have a name conflict
in your inc file you have a RegGetValue subroutine for getting string values from registry

but that is a windows api function name to get any type of value including binary
same thing with RegSetValue

Look here
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724868(v=vs.85).aspx

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Thanks Larry,

I will look into it.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

April 20, 2016, 04:30:16 AM #3 Last Edit: April 20, 2016, 04:52:00 AM by Andy
Well, It is interesting when you look back at some of your older Code.

I have worked out now how to get binary values correctly using the RegGetValue in my registry.inc file.

The function I was trying to use did give me a big clue, binary values need to be read in as UINTs and I worked out what changes I needed to make, now I can finish the binary section off and have a go at Multi strings and expandable strings.

I will post the code when I have finished it.

:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

Have you already worked out the fact that binaries can be any length and not just the length of a single UINT?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

Yes I have, and It's working well, also I have now worked out how to write binary values back to the registry, so I'm well and truely on it now, thanks.

Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

April 23, 2016, 06:46:56 AM #6 Last Edit: April 23, 2016, 06:54:00 AM by Andy
This is now a working registry binary editor.

I can read / write / edit binary registry values.

I will add in the ability to add / delete lines as well - the screenshot is of the stand alone program which will be added into my registry viewer / editor as soon as I'm finished.

P.S. Graham - must find some time to look at your recent offerings!

Attached is the screenshot of what I have got so far, I made a new registry key and binary value to test, so this is what It's displaying in this test program.

I am using my StringMap library as it now has all the registry functions added into it including loading and unloading registry keys.

I would (as always) welcome any thoughts or suggestions!

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.