Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / RegSetValueEx

Author
Message
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 24th May 2008 17:02
I have this Registry code working fine under windows XP. However it does not work under Windows Vista. Key is not created.

Now I am sure I am doing something totally wrong. any help pls?

jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 24th May 2008 19:06
Vista - for legacy programs, has this BRILLIANT solution where it allows your program to WRITE to the registry without errors - and read from them. Under the right conditions, this solutions "Writes" in one place, but reads from where you HOPED you wrote to!

Scope it out.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 25th May 2008 07:42
So what is the real-life solution?

When I install a new piece of software on Vista registry entries are created fine.

So why can't I write to the registry too?!!!! Seems unfair
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th May 2008 15:05
That's a (almost) backwards compatible thing. According to what I've read, you can "get with Microsoft's" program and it will work fine. Their "program" is writing to the registry in the user area.. per user... which doesn't always apply. I'm no Vista guy so I've only encountered this lending a hand to clients and colleagues at work. I personally don't like Microsoft's "program" 100% - but there are some valid reasons for the decisions they made with Vista. The real issue is they should have come up with them a decade ago.

My recommendation for this kind of stuff is - for applications that only have per user settings - go Microsoft way, write to user "application" directory, and same with registry. Keep only readonly files in the c:\program files\ area.

For programs that need global settings that "anyone" can and should be able to modify for all (which in a business setting isn't so much unless the software manages its own security....) like a game maybe too - just don't install to c:\program files, and make a self contained directory structure like:

MyProgramName
--bin
--config
--log
--data (from using program)
--media (like static stuff maybe)

But for "proper" behaving software - do the writing to user areas.

This is how its more or less done on mac and unix and posix OS's... there is a /usr area, /usr/bin/ which are publicy available, there is /etc for configuration, there is /var/log for log files.

thats a sumamry - but... to get back on point - learn how to use the windows authenticatin to fine the current user info - and I'll bet there is a API call to get the user's directory... it might just be a alias like %userdir% or something you can use in the path for the filename... and the registry is already integrated, where looking for "HKEY_USER" (something like that) will get you the registry "stuff" for the logged in user.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 25th May 2008 16:45
if it was for my own application, i would use an own ini file.

i HAVE TO write to the registry because the registry entry is NEEDED by another program I am calling from within my program.

So I am totally tied up.

If i put all the registry info in a .reg file and run that, it works as it should!

so it sounds really strange that i cannot do it myself using RegCreateKeyEx especially when all works on xp!
Bored of the Rings
User Banned
Posted: 26th May 2008 11:22
Hi,

Maybe I'm missing the point, but I have Vista and am writing an application and just use the GDK dbWriteStringToRegistry, dbGetRegistryString commands, dbWriteToRegistry,dbGetRegistry.

These work fine. Is there a reason you are not using these commands?
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 29th May 2008 14:18
i never got these commands to work correctly, that's the problem, whilst RegSetValueEx works 100%
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 29th May 2008 14:32
Maybe, it's something to do with the UAC in Vi$ta. You could try setting the program to run in Administrator mode.

Microsoft Windows = BSOD
Microsoft XBOX 360 = RROD
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 29th May 2008 23:34
Or... instead of using the registry as your interprocess communication use files. Like my documents\application\user data or whatever it is.

bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 30th May 2008 14:17
As Monotonic said, the problem is "Administrator" related.

Don't knowif there is any otehr way to get around this
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 30th May 2008 14:20
Yeah is permissions related... You can't use another conduit aside from registry?

Login to post a reply

Server time is: 2024-11-20 11:36:12
Your offset time is: 2024-11-20 11:36:12