亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? instsrv.c

?? Network time protocol source study
?? C
字號:
/* *  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 displayName, LPCTSTR serviceExe){  LPCTSTR lpszBinaryPathName = serviceExe;  TCHAR 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        displayName,                // name to display        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 \"Network Time Protocol\" 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\\Application\\NTP", &hk);   if(bSuccess != ERROR_SUCCESS)    {      PERR("RegCreateKey");      return 1;    }      /* Add the Event-ID message-file name to the subkey. */  bSuccess = RegSetValueEx(hk,  /* subkey handle         */      "EventMessageFile",       /* value name            */      0,                        /* must be zero          */      REG_EXPAND_SZ,            /* value type            */      (LPBYTE) pszMsgDLL,       /* address of value data */      strlen(pszMsgDLL) + 1);   /* length of value data  */ if(bSuccess != ERROR_SUCCESS)    {      PERR("RegSetValueEx");      return 1;    }    /* Set the supported types flags and addit to the subkey. */  dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE |      EVENTLOG_INFORMATION_TYPE;  bSuccess = RegSetValueEx(hk,  /* subkey handle                */      "TypesSupported",         /* value name                   */      0,                        /* must be zero                 */      REG_DWORD,                /* value type                   */      (LPBYTE) &dwData,         /* address of value data        */      sizeof(DWORD));           /* length of value data         */  if(bSuccess != ERROR_SUCCESS)    {      PERR("RegSetValueEx");      return 1;    }  RegCloseKey(hk);  return 0;}/* --------------------------------------------------------------------------------------- */int addKeysToRegistry(){  HKEY hk;                      /* registry key handle */  BOOL bSuccess;  UCHAR   myarray[200];  char *lpmyarray = myarray;  int arsize = 0;  /* now add the depends on service key */   /* Create a new key for our application */  bSuccess = RegCreateKey(HKEY_LOCAL_MACHINE,      "SYSTEM\\CurrentControlSet\\Services\\NTP", &hk);  if(bSuccess != ERROR_SUCCESS)    {      PERR("RegCreateKey");      return 1;    }  strcpy(lpmyarray,"TcpIp");  lpmyarray = lpmyarray + 6;  arsize = arsize + 6;  strcpy(lpmyarray,"Afd");  lpmyarray = lpmyarray + 4;  arsize = arsize + 4;  arsize = arsize + 2;  strcpy(lpmyarray,"\0\0");    bSuccess = RegSetValueEx(hk,  /* subkey handle         */      "DependOnService",        /* value name            */      0,                        /* must be zero          */      REG_MULTI_SZ,             /* value type            */      (LPBYTE) &myarray,        /* address of value data */      arsize);                  /* length of value data  */   if(bSuccess != ERROR_SUCCESS)    {      PERR("RegSetValueEx");      return 1;    }  RegCloseKey(hk);  return 0;}/* --------------------------------------------------------------------------------------- */int main(int argc, char *argv[]){  #define           SZ_NAME_BUF  270  // 256 is max, add a little  UCHAR   ucNameBuf[SZ_NAME_BUF] = "NTP";  LPTSTR  lpszServName = (LPTSTR)&ucNameBuf;  UCHAR   ucDNameBuf[SZ_NAME_BUF] = "Network Time Protocol";  LPTSTR  lpszDispName = (LPTSTR)&ucDNameBuf;  UCHAR   ucExeNBuf[SZ_NAME_BUF] = "";  LPTSTR  lpszExeName  = (LPTSTR)&ucExeNBuf;  BOOL    bRemovingService = FALSE;  char *p;  DWORD last_error = 0;  int timeout = 0;  DWORD rv = 0;  int ok = 0;      // check if Win32s, if so, display notice and terminate      if( GetVersion() & 0x80000000 )      {        MessageBox( NULL,           "This application cannot run on Windows 3.1.\n"           "This application will now terminate.",           "NAMED",           MB_OK | MB_ICONSTOP | MB_SETFOREGROUND );        return( 1 );      }  if (argc == 2)     bRemovingService = (!stricmp(argv[1], "remove"));  if(!bRemovingService)   {    if (argc != 2)  {    DisplayHelp();    exit(1);  }  p=argv[1];  if (    ('/' == *p)       || ('-' == *p) )  {    DisplayHelp();    exit(1);  }             }  if (strlen(argv[1]) > 256)    {      printf("\nThe service name cannot be longer than 256 characters\n");      exit(1);    }  bRemovingService = (!stricmp(argv[1], "remove"));  schSCManager = OpenSCManager(                      NULL,                   // machine (NULL == local)                      NULL,                   // database (NULL == default)                      SC_MANAGER_ALL_ACCESS); // access required  if (NULL == schSCManager)  { switch (GetLastError())    {      case ERROR_ACCESS_DENIED :      { printf("\n%s",MSG_FOR_ACCESS_DENIED);        break;      }      default :      { PERR("OpenSCManager");      }    }    return (0);  }     if (bRemovingService)  {   ok = RemoveService(lpszServName);  }  else  {   /* get the exe name */   strcpy(lpszExeName,argv[1]);   ok = InstallService(lpszServName, lpszDispName, lpszExeName);  }  CloseServiceHandle(schSCManager);  if (!bRemovingService)    {  if (ok == 0)   { /* Set the Event-ID message-file name. */    ok = addSourceToRegistry("NTP", lpszExeName);    if (ok == 0)      ok = addKeysToRegistry();    else return ok;    if (ok == 0)    {      printf("\nThe \"Network Time Protocol\" service was successfully created.\n");      printf("\nDon't forget!!! You must now go to the Control Panel and");      printf("\n  use the Services applet to change the account name and");      printf("\n  password that the NTP Service will use when");      printf("\n  it starts.");      printf("\nTo do this: use the Startup button in the Services applet,");      printf("\n  and (for example) specify the desired account and");      printf("\n  correct password.");      printf("\nAlso, use the Services applet to ensure this newly installed");      printf("\n  service starts automatically on bootup.\n");     return 0;    }   }  else return ok;  } else return 0;}/* --------------------------------------------------------------------------------------- */VOID DisplayHelp(VOID){    printf("Installs or removes the NTP service.\n");    printf("To install the NTP service,\n");    printf("type INSTSRV <path> \n");    printf("Where:\n");    printf("    path    Absolute path to the NTP service, name.exe.  You must\n");    printf("            use a fully qualified path and the drive letter must be for a\n");    printf("            fixed, local drive.\n\n");    printf("For example, INSTSRV i:\\winnt\\system32\\ntpd.exe\n");    printf("To remove the NTP service,\n");    printf("type INSTSRV remove \n");}/* EOF */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩成人午夜电影| 亚洲日本在线天堂| 国产麻豆成人传媒免费观看| 一本色道久久综合精品竹菊| 久久女同互慰一区二区三区| 亚洲国产美女搞黄色| 91黄色在线观看| 亚洲免费毛片网站| 在线观看欧美黄色| 亚洲综合清纯丝袜自拍| 一本到不卡精品视频在线观看| 久久精品男人的天堂| 国产a视频精品免费观看| 国产精品视频观看| 91色综合久久久久婷婷| 亚洲国产视频在线| 欧美tickling网站挠脚心| 久久精品国内一区二区三区| 2023国产精品自拍| 国产成人精品一区二区三区四区 | 亚洲综合在线视频| 欧美色窝79yyyycom| 免费看精品久久片| 国产精品久久综合| 色综合天天综合网天天狠天天| 一区二区三区日本| 日韩欧美www| 豆国产96在线|亚洲| 亚洲一区二区三区四区不卡| 日韩一区国产二区欧美三区| 国产成人精品免费在线| 亚洲chinese男男1069| 久久久久99精品一区| 欧美在线视频不卡| 国产成人综合在线| 午夜日韩在线观看| 国产精品久久久久一区二区三区共| 欧美日本一区二区三区四区| 国产精品一区久久久久| 香蕉av福利精品导航| 国产精品久久久久久久久免费相片 | 水野朝阳av一区二区三区| 国产精品久久福利| 精品欧美久久久| 欧美日韩激情一区二区三区| 成人毛片视频在线观看| 日av在线不卡| 五月婷婷另类国产| 亚洲男女毛片无遮挡| 国产精品久久99| 欧美电影免费观看高清完整版在线 | 色8久久人人97超碰香蕉987| 国产精品香蕉一区二区三区| 日韩av在线播放中文字幕| 夜夜嗨av一区二区三区四季av| 国产欧美一区二区三区鸳鸯浴 | 秋霞成人午夜伦在线观看| 亚洲精品免费在线| 亚洲猫色日本管| 亚洲色图制服丝袜| 1024成人网| 中文字幕在线一区免费| 国产欧美一区二区精品久导航| 精品国产一区a| 精品国产乱码久久久久久牛牛| 91麻豆精品国产| 精品国产乱码91久久久久久网站| 欧美精品1区2区3区| 欧美日韩极品在线观看一区| 欧美肥胖老妇做爰| 2023国产精华国产精品| 久久精品一区二区三区不卡 | 狠狠色丁香久久婷婷综合_中| 久久国产三级精品| 成人午夜视频网站| 色综合久久久久久久久久久| 欧美性一区二区| 精品国产凹凸成av人网站| 国产欧美日韩中文久久| 亚洲天堂中文字幕| 日韩精品免费专区| 国产成人h网站| 在线观看欧美黄色| 91精品婷婷国产综合久久性色| 欧美一二三区精品| 中文字幕第一区| 亚洲图片自拍偷拍| 国产一区二区三区最好精华液| 91首页免费视频| 欧美一区二区三区视频在线观看| 精品成人免费观看| 亚洲另类色综合网站| 麻豆成人av在线| 色偷偷88欧美精品久久久| 欧美大胆人体bbbb| 亚洲午夜日本在线观看| 精品一区免费av| 欧美午夜在线观看| 国产欧美日本一区二区三区| 天天综合色天天| 97精品久久久久中文字幕| 精品福利二区三区| 一区二区三区四区不卡在线 | 9191久久久久久久久久久| 亚洲理论在线观看| 国产精品一卡二卡在线观看| 欧美伦理影视网| 亚洲精品一二三| 国产91在线观看| 久久久久久夜精品精品免费| 免费看欧美女人艹b| 日本精品一级二级| 亚洲欧洲精品一区二区三区| 国产一区二三区| 欧美一区二区三区日韩| 亚洲免费av在线| 一本色道**综合亚洲精品蜜桃冫| 国产精品私人影院| 成人在线一区二区三区| 久久久一区二区| 国产成人久久精品77777最新版本| 欧美一区二区视频免费观看| 午夜电影久久久| 欧美日韩www| 热久久一区二区| 欧美mv和日韩mv国产网站| 久久99国产精品免费网站| 欧美成人性战久久| 国产999精品久久| 亚洲欧美综合另类在线卡通| eeuss鲁片一区二区三区| 中文字幕国产精品一区二区| 不卡的av中国片| 一区二区三区免费网站| 欧美美女激情18p| 国产精品一线二线三线精华| 国产精品嫩草99a| 在线欧美日韩精品| 久久国产精品99精品国产| 久久久久久影视| 一本色道久久加勒比精品| 婷婷综合五月天| 久久日韩精品一区二区五区| 国产乱码一区二区三区| 亚洲激情在线激情| 精品成人免费观看| 在线免费观看不卡av| 久久成人av少妇免费| 国产一区高清在线| 有码一区二区三区| 日韩亚洲国产中文字幕欧美| 成a人片亚洲日本久久| 日韩黄色一级片| 国产精品国产馆在线真实露脸| 欧美午夜宅男影院| 盗摄精品av一区二区三区| 五月天婷婷综合| 中文字幕不卡在线观看| 91精品国产综合久久久久| 国产成人综合亚洲网站| 日韩专区一卡二卡| 亚洲欧洲国产专区| 精品国产一区二区三区四区四| 欧美性受xxxx| 91色在线porny| 成人精品视频一区二区三区| 欧美aaaaaa午夜精品| 一级中文字幕一区二区| 国产精品美女久久福利网站| 欧美一区二区成人6969| 欧美巨大另类极品videosbest | 欧美一二三在线| 欧美精品久久久久久久久老牛影院| 成人av资源在线| 9i在线看片成人免费| 精品伊人久久久久7777人| 午夜精品久久久久久久蜜桃app| 亚洲一区欧美一区| 亚洲综合视频在线观看| 国产精品久久久久久久久快鸭| 久久久美女艺术照精彩视频福利播放| 在线观看91av| 日韩欧美国产一区二区在线播放| 欧美精品丝袜中出| 在线播放一区二区三区| 欧美日韩一区视频| 欧美精品tushy高清| 欧美不卡在线视频| 久久一夜天堂av一区二区三区| 欧美精品一区男女天堂| 久久久久久久久久久久久夜| 久久蜜桃av一区精品变态类天堂| 精品国产乱码久久久久久影片| 精品国产青草久久久久福利| 国产夜色精品一区二区av| 国产精品久久久久影院亚瑟| 亚洲国产精品久久不卡毛片 | 国产欧美一区二区在线| 亚洲免费观看高清完整版在线| 视频一区中文字幕|