📄 27
字号:
! 1. If you currently have XNTP on this machine (any older version that was NOT! installed using this GUI) you must STOP NOW, and REMOVE IT from your system! before running this install program. ! ! 2. This installation program will create what it thinks are sensible defaults! for the configuration files for XNTP. If you have a tricky setup, let it ! finish, then go back and stop the service (try the control panel applet) ! and edit the configuration files. The files will all be in the directory ! you install into (default is %windir%\) and will be named as follows:! ! ntp.conf - the NTP configuration file.! ntp.drift - the NTP drift file! ! ! --------------------------------------------------------------------------------! ! Building/compiling XNTP for Windows NT! ! To automate the build run either bldrel.bat or blddbg.bat... then run the! file install.bat in the scripts\wininstall\distrib directory for a ! manual installation. Run scripts\wininstall\intel\disk1\setup.exe! for the InstallShield based GUI installation. ****YOU MUST ****** modify the directory line in the ntp.conf or ntp.ini ! (it will accept either name)... and change the single slashes to double ! slashes ie. c:\winnt\ntp.conf becomes c:\\winnt\\ntp.conf! ! ! --------------------------------------------------------------------------------! May 07 1996! ! ! ANNOUNCE: Enhancements to the Windows NT port of XNTP 3.5! (Network Time Protocol)! ! ! ! This set of changes fixes all known bugs, and it includes ! several major enhancements.! ! Many changes have been made both to the build environment as! well as the code. There is no longer an ntp.mak file, instead! there is a buildntall.bat file that will build the entire ! release in one shot. The batch file requires Perl. Perl! is easily available from the NT Resource Kit or on the Net.! ! The multiple interface support was adapted from Larry Kahn's! work on the BIND NT port. I have not been able to test it! adequately as I only have NT servers with one network ! interfaces on which to test. ! ! Enhancements:! * Event Logging now works correctly.! * Version numbers now work (requires Perl during build)! * Support for multiple network interface cards (untested)! * NTP.CONF now default, but supports ntp.ini if not found! * Installation procedure automated.! * All paths now allow environment variables such as %windir%! ! Bug fixes:! * INSTSRV replaced, works correctly! * Cleaned up many warnings! * Corrected use of an uninitialized variable in XNTPD! * Fixed ntpdate -b option! * Fixed ntpdate to accept names as well as IP addresses! (Winsock WSAStartup was called after a gethostbyname())! * Fixed problem with "longjmp" in xntpdc/ntpdc.c that ! caused a software exception on doing a Control-C in xntpdc.! A Cntrl-C now terminates the program. ! ! See below for more detail:! ! Note: SIGINT is not supported for any Win32 application including ! Windows NT and Windows 95. When a CTRL+C interrupt occurs, Win32 ! operating systems generate a new thread to specifically handle that ! interrupt. This can cause a single-thread application such as UNIX, ! to become multithreaded, resulting in unexpected behavior. ! ! ! Possible enhancements and things left to do:! * Reference clock drivers for NT (at least Local Clock support)! * Control Panel Applet! * InstallShield based installation, like NT BIND has! * Integration with NT Performance Monitor! * SNMP integration! * Fully test multiple interface support! ! ! Known problems:! * bug in ntptrace - if no Stratum 1 servers are available,! such as on an IntraNet, the application crashes.! ! ! ! Greg Schueman [schueman@acm.org]! ! ! -------------------------------------------------------------------------------- + Disclaimer of Warranties. THE SOFTWARE AND ASSOCIATED DOCUMENTATION ARE + PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, + INCLUDING WITHOUT LIMITATION ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR + ANY PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE ENTIRE RISK AS TO THE + QUALITY AND PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION IS WITH YOU. NO + ONE WARRANTS THAT THE SOFTWARE WILL MEET YOUR REQUIREMENTS OR THAT THE + OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR FREE, OR THAT DEFECTS + IN THE SOFTWARE WILL BE CORRECTED. + Limitations of Warranty. IN NO EVENT SHALL ANYONE INVOLVED IN THE CREATION, + PRODUCTION, OR DISTRIBUTION OF THE SOFTWARE BE LIABLE TO YOU ON ACCOUNT OF + ANY CLAIM FOR ANY SPECIAL EXEMPLARY OR PUNITIVE DAMAGES, INCLUDING ANY LOST + PROFITS, LOST SAVINGS, BUSINESS INTERRUPTION, LOSS OF BUSINESS OR PERSONAL + INFORMATION OR ANY OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF + THE USE, THE INABILITY TO USE, QUALITY, OR PERFORMANCE OF THE SOFTWARE AND + DOCUMENTATION, EVEN IF SAID AUTHORS, HAVE BEEN ADVISED OF THE POSSIBILITY + OF SUCH DAMAGES. + --------------------------------------------------------------------------------diff -N -x *.mak -c -r xntp3-5.86/scripts/wininstall/instsrv/instsrv.c xntp/scripts/wininstall/instsrv/instsrv.c*** xntp3-5.86/scripts/wininstall/instsrv/instsrv.c Thu Jan 01 00:00:00 1970--- xntp/scripts/wininstall/instsrv/instsrv.c Sat Oct 26 06:04:38 1996****************** 0 ****--- 1,459 ----+ /*+ * File: instsrv.c+ * Purpose: To install a new service and to insert registry entries.+ *+ */+ + #include <windows.h>+ #include <stdio.h>+ #include <stdlib.h>+ #include <string.h>+ + + #define PERR(api) printf("\n%s: Error %d from %s on line %d", \+ __FILE__, GetLastError(), api, __LINE__);+ + #define MSG_FOR_ACCESS_DENIED "You aren't authorized to do this - please see your system Administrator"+ #define MSG_1_FOR_BAD_PATH "The fully qualified path name to the .exe must be given, and"+ #define MSG_2_FOR_BAD_PATH " the drive letter must be for a fixed disk (e.g., not a net drive)"+ + SC_HANDLE schService;+ SC_HANDLE schSCManager;+ int ok2;+ + VOID DisplayHelp(VOID);+ + /* --------------------------------------------------------------------------------------- */+ + int InstallService(LPCTSTR serviceName, LPCTSTR serviceExe)+ {+ LPCTSTR lpszBinaryPathName = serviceExe;+ LPTSTR lpszRootPathName="?:\\";+ + if ( (':' != *(lpszBinaryPathName+1)) || ('\\' != *(lpszBinaryPathName+2)) )+ { printf("\n%s",MSG_1_FOR_BAD_PATH);+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);+ return 1;+ }+ + #define DRIVE_TYPE_INDETERMINATE 0+ #define ROOT_DIR_DOESNT_EXIST 1+ + *lpszRootPathName = *(lpszBinaryPathName+0) ;+ + switch ( GetDriveType(lpszRootPathName) )+ {+ case DRIVE_FIXED :+ { // OK+ break;+ }+ case ROOT_DIR_DOESNT_EXIST :+ { printf("\n%s",MSG_1_FOR_BAD_PATH);+ printf("\n the root directory where the .exe is specified to be must exist, and");+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);+ return 1;+ }+ case DRIVE_TYPE_INDETERMINATE :+ case DRIVE_REMOVABLE :+ case DRIVE_REMOTE :+ case DRIVE_CDROM :+ case DRIVE_RAMDISK :+ { printf("\n%s",MSG_1_FOR_BAD_PATH);+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);+ return 1;+ }+ default :+ { printf("\n%s",MSG_1_FOR_BAD_PATH);+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);+ return 1;+ }+ }+ + if (INVALID_HANDLE_VALUE == CreateFile(lpszBinaryPathName,+ GENERIC_READ,+ FILE_SHARE_READ,+ NULL,+ OPEN_EXISTING,+ FILE_ATTRIBUTE_NORMAL,+ NULL))+ { + printf("\n%s",MSG_1_FOR_BAD_PATH);+ printf("\n the file must exist, and");+ printf("\n%s\n",MSG_2_FOR_BAD_PATH);+ return 1;+ }+ + schService = CreateService(+ schSCManager, // SCManager database+ serviceName, // name of service+ serviceName, // name to display (new parameter after october beta)+ SERVICE_ALL_ACCESS, // desired access+ SERVICE_WIN32_OWN_PROCESS, // service type+ SERVICE_AUTO_START, // start type+ SERVICE_ERROR_NORMAL, // error control type+ lpszBinaryPathName, // service's binary+ NULL, // no load ordering group+ NULL, // no tag identifier+ NULL, // no dependencies+ NULL, // Local System account+ NULL); // null password+ + if (NULL == schService)+ { switch (GetLastError())+ {+ case ERROR_ACCESS_DENIED :+ { printf("\n%s",MSG_FOR_ACCESS_DENIED);+ break;+ }+ case ERROR_SERVICE_EXISTS :+ { printf("\nThe %s service is already installed",serviceName);+ printf("\nRemove it first if you need to re-install a new version\n");+ break;+ }+ default :+ { PERR("CreateService");+ }+ }+ return 1;+ }+ else+ + CloseServiceHandle(schService);+ return 0;+ }+ + /* --------------------------------------------------------------------------------------- */+ + int RemoveService(LPCTSTR serviceName)+ {+ {+ #define SZ_ENUM_BUF 4096+ ENUM_SERVICE_STATUS essServiceStatus[SZ_ENUM_BUF];+ DWORD dwBufSize = sizeof(essServiceStatus);+ DWORD dwBytesNeeded = 0;+ DWORD dwServicesReturned = 0;+ DWORD dwResumeHandle = 0;+ DWORD dwI = 0;+ BOOLEAN bFound = FALSE;+ + if (!EnumServicesStatus(schSCManager,+ SERVICE_WIN32,+ SERVICE_ACTIVE,+ (LPENUM_SERVICE_STATUS)&essServiceStatus,+ dwBufSize,+ &dwBytesNeeded,+ &dwServicesReturned,+ &dwResumeHandle))+ { switch (GetLastError())+ {+ case ERROR_ACCESS_DENIED :+ { printf("\n%s",MSG_FOR_ACCESS_DENIED);+ break;+ }+ default :+ { PERR("EnumServicesStatus");+ }+ }+ return 1;+ }+ + for (dwI=0; dwI<dwServicesReturned; dwI++)+ { if(0 == _stricmp(essServiceStatus[dwI].lpServiceName,serviceName))+ { bFound = TRUE;+ break;+ }+ }+ + if (bFound)+ { printf("\nThe %s service cannot be removed until it has been stopped.",serviceName);+ printf("\nTo stop the %s service, use the Stop button in the Control",serviceName);+ printf("\n Panel Services applet\n");+ return 1;+ }+ }+ + schService = OpenService(schSCManager,+ serviceName,+ SERVICE_ALL_ACCESS);+ if (NULL == schService)+ { switch (GetLastError())+ {+ case ERROR_ACCESS_DENIED :+ { printf("\n%s",MSG_FOR_ACCESS_DENIED);+ break;+ }+ case ERROR_SERVICE_DOES_NOT_EXIST :+ { printf("\nThe %s service is not installed, so cannot be removed\n",serviceName);+ break;+ }+ default :+ { PERR("OpenService");+ }+ }+ return 1;+ }+ + if (DeleteService(schService))+ { printf("\nDelete of Service \"NetworkTimeProtocol\" was SUCCESSFUL\n");+ return 0;+ }+ else+ { switch (GetLastError())+ {+ case ERROR_ACCESS_DENIED :+ { printf("\n%s",MSG_FOR_ACCESS_DENIED);+ break;+ }+ default :+ { PERR("DeleteService");+ }+ }+ return 1;+ }+ }+ + /* --------------------------------------------------------------------------------------- */+ + int addSourceToRegistry(LPSTR pszAppname, LPSTR pszMsgDLL)+ {+ HKEY hk; /* registry key handle */+ DWORD dwData;+ BOOL bSuccess;+ + /* When an application uses the RegisterEventSource or OpenEventLog+ function to get a handle of an event log, the event loggging service+ searches for the specified source name in the registry. You can add a+ new source name to the registry by opening a new registry subkey+ under the Application key and adding registry values to the new+ subkey. */+ + /* Create a new key for our application */+ bSuccess = RegCreateKey(HKEY_LOCAL_MACHINE,+ "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Appli
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -