detecting when the registry is locked (e.g. limited users with WindowsXP)
chris_at_mricro.com
Date: 12/05/03
- Next message: Parmod: "Hidden Forms"
- Previous message: Johnnie Norsworthy: "Re: Fastest Application Shutdown"
- Next in thread: Brian Cook: "Re: detecting when the registry is locked (e.g. limited users with WindowsXP)"
- Reply: Brian Cook: "Re: detecting when the registry is locked (e.g. limited users with WindowsXP)"
- Reply: Ray Marron: "Re: detecting when the registry is locked (e.g. limited users with WindowsXP)"
- Reply: Peter Below (TeamB): "Re: detecting when the registry is locked (e.g. limited users with WindowsXP)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 05 Dec 2003 18:23:33 -0000
Hello-
I have always had my software attempt to create file associations at
startup. Using there, a user can simply click on a '*.img' icon and it
will load the appropriate software (e.g. my free MRIcro brain viewing
software).
However, with WindowsXp, it appears that administrators can severly limit
the ability of standard users to access the registry. Instead of simply
saying that the system can not generate a new assoiciation, the
application crashes. I know that the code below is the culprit, because if
I deactivate this code the program executes normally. Since my software is
used in university student labs where all the computers are restricted, is
there a way that my software can automatically detect if the current user
is an adminstrator or not? If so, my software could be designed to only
update the registry if the user has the appropriate privileges.
Thanks in advance,
-chris
p.s. Here is the offending code, which works on Windows 95+ and is similar
to lots of code you can find with Google (a sample call would me
"registerfiletype('.img','MRIimg'{key},'MRIimg',Application.ExeName+',1');").
procedure registerfiletype(inft,inkey,desc,icon:string);
var myreg : treginifile;
ct : integer;
ft,key: string;
begin
ft := inft;
key := inkey;
ct := pos('.',ft);
while ct > 0 do begin
delete(ft,ct,1);
ct := pos('.',ft);
end;
if (ft = '') or (Application.ExeName = '') then exit; //not a valid
file-ext or ass. app
ft := '.'+ft;
myreg := treginifile.create('');
try
myreg.rootkey := hkey_classes_root; // where all file-types are
described
if key = '' then key := copy(ft,2,maxint)+'_auto_file'; // if no
key-name is given, create one
myreg.writestring(ft,'',key); // set a pointer to the
description-key
myreg.writestring(key,'',desc); // write the description
myreg.writestring(key+'\DefaultIcon','',icon); // write the
def-icon if given
//showmessage(key);
myreg.writestring(key+'\shell\open\command','',Application.ExeName+'
%1'); //association
finally
myreg.free;
end;
end;
- Next message: Parmod: "Hidden Forms"
- Previous message: Johnnie Norsworthy: "Re: Fastest Application Shutdown"
- Next in thread: Brian Cook: "Re: detecting when the registry is locked (e.g. limited users with WindowsXP)"
- Reply: Brian Cook: "Re: detecting when the registry is locked (e.g. limited users with WindowsXP)"
- Reply: Ray Marron: "Re: detecting when the registry is locked (e.g. limited users with WindowsXP)"
- Reply: Peter Below (TeamB): "Re: detecting when the registry is locked (e.g. limited users with WindowsXP)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|