当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 在公司调试好了服务器,装的是redhat es3。其中vsftp启动,测试都没有问题。但是放到机房在机房测试还是好的,但是回到公司就连不上了。报错如下: 在本地连接正常的时候: 正在连接到 102 已连接到 192.168.0.102 端口 21 220 (vsftpd 1.2.0) user ele 331 please specify the password. pass (hidde......
    摘要: 我现在有1000多个姓名,每一个都是中文的,现在我想把这些中文姓名都转化成汉语拼音的形式。 不知道大家有没有高见! ......


如何将服务程序的登陆帐户改成System

我想监视一个服务的登陆帐户类型,如果发现不是localsystem就将其改回来,使用ChangeServiceConfig可以将帐户名改为其他帐户,但是无法改为.\System,   总是提示帐户名或密码不正确。  
  请高手指点

NO.1   作者: seansoe

你试试LocalSystem行不行

NO.2   作者: bager

调用ChangeServiceConfig函数时,应使用"LocalSystem"作为帐户名,而非".\System"  
  示范代码如下:  
   
  void   OnSetAccount()    
  {  
  CString   strServiceName="SampleService";//Service   Name  
  CString   strAccountName="LocalSystem";  
  CString   strAccountPass="";  
   
  SC_LOCK   sclLock   =   NULL;    
  SC_HANDLE     schSCManager   =   OpenSCManager(    
  NULL,                                         //   local   machine    
  NULL,                                         //   ServicesActive   database    
  SC_MANAGER_ALL_ACCESS);     //   full   access   rights    
   
  if   (schSCManager   ==   NULL)    
  {  
  // theApp.ReportLastError();  
  return;  
  }  
   
  SC_HANDLE   schService   =   OpenService(    
                  schSCManager, //   SCManager   database    
                  strServiceName, //   name   of   service    
                  SERVICE_ALL_ACCESS);  
   
  if   (schService   ==   NULL)    
  {  
  // theApp.ReportLastError();  
  }  
  else    
  {  
  //   Need   to   acquire   the   SCM   database   lock   before   changing   the   password.    
  sclLock   =   LockServiceDatabase(schSCManager);    
  if   (sclLock   ==   NULL)    
  {  
  // theApp.ReportLastError();  
  }  
  else  
  {  
  //   Now   set   the   account   and   password   that   the   service   uses   at   startup.  
  if   (!   ChangeServiceConfig(    
  schService,                 //   Handle   of   service    
  SERVICE_NO_CHANGE,   //   Service   type:   no   change    
  SERVICE_NO_CHANGE,   //   Change   service   start   type    
  SERVICE_NO_CHANGE,   //   Error   control:   no   change    
  NULL,                             //   Binary   path:   no   change    
  NULL,                             //   Load   order   group:   no   change    
  NULL,                             //   Tag   ID:   no   change    
  NULL,                             //   Dependencies:   no   change    
  strAccountName,         //   Account   name:   no   change    
  strAccountPass,         //   New   password    
  NULL)   ) //   Display   name:   no   change  
  {  
  // theApp.ReportLastError();  
  }  
                    }  
  }  
      if   (sclLock)  
          UnlockServiceDatabase(sclLock);    
      if   (schService)  
          CloseServiceHandle(schService);  
      if   (schSCManager)  
          CloseServiceHandle(schSCManager);  
  }


 ·delphi6,websnap怎样实现图表统计    »显示摘要«
    摘要: delphi6,websnap怎样实现图表统计???,如拄面图。 请高手指点!不胜感激!thanks! ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE