Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11466
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Registry HKLM not accessible as expected |
| Date | 2018-03-07 16:14 +0100 |
| Message-ID | <fgadvcFntb3U1@mid.individual.net> (permalink) |
| References | <nlrv9d17h303ogeeokte9a8r619spvndak@4ax.com> <fgab5cFn8qvU1@mid.individual.net> <12vv9dh4plhm771833rcs5f9bfik5mfm7v@4ax.com> |
Hi Dick,
> > HKLM is writable only with elevated rights.
> >
> > If you need to write machine-wide values without administrative
> > rights, you need other ways, maybe a configuration file in the
> > c:\ProgramData.
> >
> > If you need code to elevate rights: I can give you something (but in
> > X#).
> >
>
> Yes, that would be great. Can you mail me the code? The point is that
> direct registry access via Regedit is usually prohibited for many
> users while user files are not. So I prefer my prgram to store certain
> settings in a registry, and one from which I can find back the keys
> and which are the same for every user when they are on a (RD) server.
if your user cannot have elevated rights, then you will not be able to
write these values.
You have two possibilities: you can declare that your program needs
administrative rights via a application manifest (and that works even
with a VO program), or you can check if your program is already running
with elevated rights:
static method IsRunningElevated() as logic
local lReturn as logic
if WindowsPrincipal{ WindowsIdentity.GetCurrent() }:IsInRole(
WindowsBuiltInRole.Administrator )
lReturn := true
else
lReturn := false
endif
return lReturn
and if not, restart it with elevated rights:
cPrgFileName :=
System.Reflection.Assembly.GetExecutingAssembly().Location
oStartInfo := ProcessStartInfo{}
oStartInfo:FileName := cPrgFileName
oStartInfo:UseShellExecute := true
oStartInfo:Verb := "runas"
Process.Start( oStartInfo )
> I found indeed quite some postings on the internet with this problem.
> I can only agree with that.
Unfortunately, I cannot agree with that.
IMHO it is very important that a process that is not using elevated
rights CANNOT write to HKLM.
Tis is very important for security purposes, and is one of the
precautions that made Windows 7 and later more secure than XP and
previous versions.
Wolfgang
P.S. don't try to work against the system - work with it.
--
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Registry HKLM not accessible as expected D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2018-03-07 14:58 +0100
Re: Registry HKLM not accessible as expected "Wolfgang Riedmann" <wriedmann@gmail.com> - 2018-03-07 15:26 +0100
Re: Registry HKLM not accessible as expected D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2018-03-07 15:54 +0100
Re: Registry HKLM not accessible as expected "Wolfgang Riedmann" <wriedmann@gmail.com> - 2018-03-07 16:14 +0100
Re: Registry HKLM not accessible as expected D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2018-03-07 23:41 +0100
Re: Registry HKLM not accessible as expected Mathias <mathias.hakansson@consultec.se> - 2018-03-08 02:13 -0800
Re: Registry HKLM not accessible as expected D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2018-03-08 12:07 +0100
Re: Registry HKLM not accessible as expected "Jamal" <noooospam@example.com> - 2018-03-07 12:47 -0500
csiph-web