home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 February
/
Chip_2002-02_cd1.bin
/
sharewar
/
apaths
/
APSOURCE.ZIP
/
MakeSKey.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-03-26
|
2KB
|
69 lines
/* MakeSKey - March 26th, 2001
**
** Copyright (c) 1997-2001 by Gregory Braun. All rights reserved.
**
** This function creates a System Registry RunServices entry.
**
** Called: srv = a pointer to the SRV data structure to use.
**
** Returns: TRUE upon success, or FALSE if an error exists.
**
** Notes: This routine creates the following key:
**
** HKEY_LOCAL_MACHINE
** Software
** Microsoft
** Windows
** CurrentVersion
** RunSerivces
** Title = d:\folder\program.exe /flags
**
*/
#include "AppPaths.h"
extern BOOL far MakeSKey (LPSRV srv)
{
auto HKEY key = NULL;
auto LONG err = NIL;
auto DWORD size;
auto DWORD result;
auto char sub[PSTRING];
lstrcpy (sub,REGSTR_PATH_RUNSERVICES);
err = RegCreateKeyEx (HKEY_LOCAL_MACHINE,
sub,
NIL,
BLANK_STR,
REG_OPTION_NON_VOLATILE,
KEY_SET_VALUE,
NULL,
&key,
&result);
if (err != ERROR_SUCCESS)
return (FALSE);
if (*srv->path) {
size = lstrlen (srv->path) + 1;
err = RegSetValueEx (key,
srv->name,
NIL,
REG_SZ,
(CONST BYTE *) srv->path,
size);
}
RegCloseKey (key);
return ((err == ERROR_SUCCESS) ? TRUE : FALSE);
}
/* end of MakeSKey.c - written by Gregory Braun */