Re: services.exe: Reduce Registry access to KEY_READ or MAXIMUM_ALLOWED wherever possible (try 2)

2009-11-30 Thread Alexandre Julliard
Paul Chitescu pa...@voip.null.ro writes:

 @@ -569,11 +569,11 @@ DWORD svcctl_ChangeServiceConfigW(
  new_entry.config.lpDisplayName = strdupW(lpDisplayName);
  }
  
 -*service-service_entry = new_entry;
 -save_service_config(service-service_entry);
 +err = save_service_config(new_entry);
 +if (ERROR_SUCCESS == err) *service-service_entry = new_entry;
  service_unlock(service-service_entry);

This can't work, the strings have been freed already.

-- 
Alexandre Julliard
julli...@winehq.org




Re: services.exe: Reduce Registry access to KEY_READ or MAXIMUM_ALLOWED wherever possible (try 2)

2009-11-30 Thread Paul Chitescu
On Monday 30 November 2009 05:51:35 pm Alexandre Julliard wrote:
 Paul Chitescu pa...@voip.null.ro writes:
 
  @@ -569,11 +569,11 @@ DWORD svcctl_ChangeServiceConfigW(
   new_entry.config.lpDisplayName = strdupW(lpDisplayName);
   }
   
  -*service-service_entry = new_entry;
  -save_service_config(service-service_entry);
  +err = save_service_config(new_entry);
  +if (ERROR_SUCCESS == err) *service-service_entry = new_entry;
   service_unlock(service-service_entry);
 
 This can't work, the strings have been freed already.
 
 -- 
 Alexandre Julliard
 julli...@winehq.org

Oh, I see it now.

This means that currently the old strings are leaked if the new strings 
provided are NULL.

I'll write a replacement that will free the all the strings of either old 
entry or new entry at the end (depending if save_service_config succeeds or 
not).





Re: services.exe: Reduce Registry access to KEY_READ or MAXIMUM_ALLOWED wherever possible (try 2)

2009-11-30 Thread Alexandre Julliard
Paul Chitescu pa...@voip.null.ro writes:

 Oh, I see it now.

 This means that currently the old strings are leaked if the new strings 
 provided are NULL.

No, they remain unchanged in that case.

-- 
Alexandre Julliard
julli...@winehq.org