最近是要仿一个任务管理器,在做到获取进程用户名的时候碰到问题了.
貌似不管怎么提权,都没有办法获得LOCAL SERVICES 和NETWORK SERVICE的用户名,花了不少时间在网上找资料,基本上没解决,就是提供了线索WTS API,但是找不到具体代码(有一个但是是VB的),难道VC就没有人写过这个代码么...

解决方案 »

  1.   

    WST的api一共就没有几个,看着那些api也写不出来的话,无话可说。如果还有具体代码,这还叫编程吗?这就是赤裸裸的抄。
      

  2.   

    我甚至连WTS APIS的列表都查不到,而且你这么回答让人更有距离感了而没有得到有用的信息。
      

  3.   

    应该是这个函数WTSEnumerateProcesses,我也是刚在找这些资料WTSEnumerateProcesses FunctionThe WTSEnumerateProcesses function retrieves information about the active processes on a specified terminal server.
    BOOL WTSEnumerateProcesses(
      __in          HANDLE hServer,
      DWORD Reserved,
      __in          DWORD Version,
      __out         PWTS_PROCESS_INFO* ppProcessInfo,
      __out         DWORD* pCount
    );Parameters
    hServer 
    Handle to a terminal server. Specify a handle opened by the WTSOpenServer function, or specify WTS_CURRENT_SERVER_HANDLE to indicate the terminal server on which your application is running.Reserved 
    Reserved; must be zero.Version 
    Specifies the version of the enumeration request. Must be 1.ppProcessInfo 
    Pointer to a variable that receives a pointer to an array of WTS_PROCESS_INFO structures. Each structure in the array contains information about an active process on the specified terminal server. To free the returned buffer, call the WTSFreeMemory function.pCount 
    Pointer to a variable that receives the number of WTS_PROCESS_INFO structures returned in the ppProcessInfo buffer.Return Value
    If the function succeeds, the return value is a nonzero value.If the function fails, the return value is zero. To get extended error information, call GetLastError.Res
    The caller must be a member of the Administrators group to enumerate processes that are running under a different user's context.Requirements
    Client
     Requires Windows Vista, Windows XP, or Windows 2000 Professional.
     
    Server
     Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
     
    Header
     Declared in WtsApi32.h.
     
    Library
     Use WtsApi32.lib.
     
    DLL
     Requires Wtsapi32.dll.
     
    Unicode
     Implemented as WTSEnumerateProcessesW (Unicode) and WTSEnumerateProcessesA (ANSI).
     
      

  4.   

    在哪找的资料,再发其他的,再详细点的WTS系列API资料看看.貌似我找过一些版本的MSDN,没查到
      

  5.   

    http://msdn.microsoft.com/en-us/library/aa383464(v=VS.85).aspx