~ubuntu-branches/debian/squeeze/ntp/squeeze-201010051545

« back to all changes in this revision

Viewing changes to ports/winnt/instsrv/instsrv.c

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2004-10-11 16:10:27 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041011161027-icyjbji8ujym633o
Tags: 1:4.2.0a-10ubuntu2
Use ntp.ubuntulinux.org instead of pool.ntp.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *  Purpose: To install a new service and to insert registry entries.
4
4
 *
5
5
 */
 
6
#ifndef __RPCASYNC_H__
 
7
#define __RPCASYNC_H__  /* Skip asynch rpc inclusion */
 
8
#endif
6
9
 
7
10
#include <windows.h>
8
11
#include <stdio.h>
9
 
#include <stdlib.h>
10
 
#include <string.h>
11
 
 
12
12
 
13
13
#define PERR(api) printf("\n%s: Error %d from %s on line %d",  \
14
14
    __FILE__, GetLastError(), api, __LINE__);
219
219
  HKEY hk;                      /* registry key handle */
220
220
  DWORD dwData;
221
221
  BOOL bSuccess;
222
 
  
 
222
  char   regarray[200];
 
223
  char *lpregarray = regarray;
 
224
 
223
225
  /* When an application uses the RegisterEventSource or OpenEventLog
224
226
     function to get a handle of an event log, the event loggging service
225
227
     searches for the specified source name in the registry. You can add a
227
229
     under the Application key and adding registry values to the new
228
230
     subkey. */
229
231
 
 
232
  strcpy(lpregarray, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\");
 
233
  strcat(lpregarray, pszAppname);
230
234
  /* Create a new key for our application */
231
 
  bSuccess = RegCreateKey(HKEY_LOCAL_MACHINE,
232
 
      "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\NTP", &hk);
 
235
  bSuccess = RegCreateKey(HKEY_LOCAL_MACHINE, lpregarray, &hk);
233
236
   if(bSuccess != ERROR_SUCCESS)
234
237
    {
235
238
      PERR("RegCreateKey");
274
277
{
275
278
  HKEY hk;                      /* registry key handle */
276
279
  BOOL bSuccess;
277
 
  UCHAR   myarray[200];
 
280
  char   myarray[200];
278
281
  char *lpmyarray = myarray;
279
282
  int arsize = 0;
280
283
 
332
335
  BOOL    bRemovingService = FALSE;
333
336
  char *p;
334
337
 
335
 
  DWORD last_error = 0;
336
 
  int timeout = 0;
337
 
  DWORD rv = 0;
338
338
  int ok = 0;  
339
339
  
340
340
  // check if Win32s, if so, display notice and terminate
357
357
  if (argc != 2)
358
358
  {
359
359
    DisplayHelp();
360
 
    exit(1);
 
360
    return(1);
361
361
  }
362
362
 
363
363
  p=argv[1];
365
365
       || ('-' == *p) )
366
366
  {
367
367
    DisplayHelp();
368
 
    exit(1);
 
368
    return(1);
369
369
  }
370
370
        
371
371
  
374
374
  if (strlen(argv[1]) > 256)
375
375
    {
376
376
      printf("\nThe service name cannot be longer than 256 characters\n");
377
 
      exit(1);
 
377
      return(1);
378
378
    }
379
379
 
380
380
 
438
438
   }
439
439
  else return ok;
440
440
  }
441
 
 else return 0;
 
441
 return 0;
442
442
}
443
443
 
444
444
/* --------------------------------------------------------------------------------------- */