Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 6 odgovora
  • 3.231 pregleda

Najnovija ↓

problem sa RegSaveKey funkcijom 23.12.2007. u 03:37 · pre 229 meseci #1
Radim neki program i potrebno mi je da uradim backup nekih kljuceva u registriju.

Probao sam na dva nacina:

Code:

var
  Reg : TRegistry;
begin
  Reg := TRegistry.Create;
  Reg.Rootkey := HKEY_CURRENT_USER;
  Reg.Savekey('\Software\Blablabla', 'blablabla.reg');
end;


i

Code:

var
  RootKey, phKey: HKey;
  Key : string;
begin
  RootKey := HKEY_CURRENT_USER;
  Key := '\Software\Blablabla';
  RegOpenKeyEx(RootKey, PChar(Key), 0, KEY_ALL_ACCESS, phKey);
  RegSaveKey(phKey, PChar('test.reg'), nil);
  RegCloseKey(phKey);
end;


Program pokren sa administratorskim provilegijama (na visti) i nikad mi ne uradi sta se ocekujem :)

Ako ima neko resenja osim:

Code:

  ShellExecute(Handle, 'open', PChar('regedit.exe /e Key Filename'), '', sw_hide) ;


Pozz
Re: problem sa RegSaveKey funkcijom 23.12.2007. u 12:08 · pre 229 meseci #2
> Radim neki program i potrebno mi je da uradim backup nekih kljuceva u registriju.

Koje greške dobijaš, možeš saznati sa GetLastError ili RaiseLastOSError.
Pokušaj da stavke otvaraš sa KEY_READ pravom pristupa ne sa KEY_ALL_ACCESS.
Potpis
Do not be a help vampire (http://slash7.com/pages/vampires), use the google.

How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html
http://solair.eunet.rs/~fangor...stions/smart-questions.sr.html
Re: problem sa RegSaveKey funkcijom 23.12.2007. u 14:23 · pre 229 meseci #3
Pokusao sam sa KEY_READ i nije opet radilo.
Greska koju dobijem kad koristim funkciju koju se spomenuo gore je "A call to an OS function fail"
Re: problem sa RegSaveKey funkcijom 23.12.2007. u 16:27 · pre 229 meseci #4
> Greska koju dobijem kad koristim funkciju koju se spomenuo gore je "A call to an OS function fail"

Posle koje fukcije? Da li tvoj proces ima SE_BACKUP_NAME privilegiju?

Code:

var
  RootKey, phKey: HKey;
  Key : string;
  lRet: Longint;
begin
  RootKey := HKEY_CURRENT_USER;
  Key := 'Software\BitTorrent';
  lRet := RegOpenKeyEx(RootKey, PChar(Key), 0, KEY_READ, phKey);
  if lRet = ERROR_SUCCESS then
  begin
    lRet := RegSaveKey(phKey, PChar('C:\test.reg'), nil);
    if lRet <> ERROR_SUCCESS then
      raise Exception.Create(SysErrorMessage(lRet));
  end
  else
    raise Exception.Create(SysErrorMessage(lRet));
end;

Potpis
Do not be a help vampire (http://slash7.com/pages/vampires), use the google.

How to ask questions the smart way:
http://www.catb.org/~esr/faqs/smart-questions.html
http://solair.eunet.rs/~fangor...stions/smart-questions.sr.html
Re: problem sa RegSaveKey funkcijom 23.12.2007. u 19:19 · pre 229 meseci #5
> Da li tvoj proces ima SE_BACKUP_NAME privilegiju?

Ocito nema. Greska sa ovim tvojim kodom "A required privilege is not held by the client".

Ako znas pomozimi kako da ovo resim.
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme