home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / Chip_2002-02_cd1.bin / sharewar / apaths / APSOURCE.ZIP / KillRKey.c < prev    next >
C/C++ Source or Header  |  2001-03-26  |  972b  |  41 lines

  1. /* KillRKey - March 26th, 2001
  2. **
  3. **      Copyright (c) 1997-2001 by Gregory Braun. All rights reserved.
  4. **
  5. **      This function removes the specified Run values.
  6. **
  7. **      Called:     run = a pointer to the RUN data structure to use.
  8. **
  9. **      Returns:    TRUE upon success, or FALSE if an error exists.
  10. */
  11.  
  12.  
  13. #include "AppPaths.h"
  14.  
  15. extern BOOL far KillRKey (LPRUN run,BOOL user)
  16. {
  17.     auto HKEY   key     = NULL;
  18.     auto LONG   err;
  19.  
  20.     auto char   sub[PSTRING];
  21.  
  22.     lstrcpy (sub,REGSTR_PATH_RUN);
  23.  
  24.     err = RegOpenKeyEx ((user) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE,
  25.                         sub,
  26.                         NIL,
  27.                         KEY_WRITE,
  28.                         &key);
  29.  
  30.     if (err != ERROR_SUCCESS)
  31.         return (FALSE);
  32.  
  33.     err = RegDeleteValue (key,run->name);
  34.  
  35.     RegCloseKey (key);
  36.  
  37.     return ((err == ERROR_SUCCESS) ? TRUE : FALSE);
  38. }
  39.  
  40. /* end of KillRKey.c - written by Gregory Braun */
  41.