  PrcWorks has buffer for 1023 NT processes. If more processes exist, PrcWorks works
with the oldest 1023 processes only.
  PrcWorks has buffer for 127 NT processes with the same base name.
If more processes with the same base name exist, PrcWorks works with the oldest 127
processes only.
  PrcWorks libraries export:
--------------------------------------------------------------------------------------------------------
DWORD WINAPI PID2ProcessName(DWORD ProcessId, LPTSTR ProcessName);
  Parameters:
    ProcessName should point to buffer with size >= MAX_PATH characters.

  Returns:
    PW_MEMERROR - memory can't be allocated/committed/locked or PW initializaton failed.
    PW_PIDERROR - ProcessId is invalid.
    ProcessName+sizeof(ProcessName)+sizeof(TCHAR) - function succeeded.
    String contains full pathname in 9X; first 15 characters of base name in NT.

--------------------------------------------------------------------------------------------------------
DWORD WINAPI ProcessName2PID(LPCTSTR ProcessName);

  Returns:
    PW_MEMERROR - memory can't be allocated/committed/locked or PW initializaton failed.
    PW_PIDERROR - ProcessName can't be found or process can't be opened for QUERY_INFORMATION and
                  VM_READ in NT.
    PW_SESERROR - ProcessName contains
                   - nonexisting session id
                   - reserved (numerically equal to PW_THISSESSION, PW_ALLSESSIONS, PW_CNSLSESSION)
                     session id
                  or console session is in the process of being attached or detached.
    PID         - function succeeded.

  Notes:
    *) Debug privilege should be enabled when ProcessName contains path or process base name has more than
       14 characters.
    *) Debug privilege should be enabled when process base name contains national characters.
    *) Session id can be specified in form "X/Process.exe" where X is session id as unsigned decimal number
       for given session or
       "@" for this (current) session (default if no X/ is given == current session is default),
       "^" for console session,
       "*" for all sessions.
       ProcessName is searched in current session when ProcessName doesn't contain session id string (X/).
       Valid single-user NT and 9X session id characters are  0, @, ^, *.
    *) PID of the oldest process is returned by default. Instance succession can be specified in form
       "Y*ProcessName" where Y is instance number: 0 .. the oldest, 127 .. the youngest instance
       of the process with the same ProcessName.
    *) When session id is specified, it must precede instance number. The final string is:
       "X/Y*ProcessName".


  Examples:
    WinlogonSes0003PID = ProcessName2PID(_T("00000003/winlogon.exe");
      // pid of 1st process with base name "winlogon.exe" in session respresented by id 3
    WinlogonSesCurrPID = ProcessName2PID(_T("127*winlogon.exe");
      // pid of last process with base name "winlogon.exe" in current session
    WinlogonSesCurrPID = ProcessName2PID(_T("winlogon.exe");
      // pid of 1st process with base name "winlogon.exe" in current session
    WinlogonSesCurrPID = ProcessName2PID(_T("@/winlogon.exe");
      // pid of 1st process with base name "winlogon.exe" in current session (equivalent to the previous
      // example)
    WinlogonSesCnslPID = ProcessName2PID(_T("^/winlogon.exe");
      // pid of 1st process with base name "winlogon.exe" in console session
    WinlogonSesCnslPID = ProcessName2PID(_T("^/1*winlogon.exe");
      // pid of 2nd process with base name "winlogon.exe" in console session
    WinlogonFirstPID    = ProcessName2PID(_T("*/winlogon.exe");
      // pid of 1st process with base name "winlogon.exe"
    WinlogonLastPID    = ProcessName2PID(_T("*/127*winlogon.exe");
      // pid of last process with base name "winlogon.exe"
    WinlogonSes0000PID = ProcessName2PID(_T("0/\??\C:\WINNT\SYSTEM32\winlogon.exe");
      // pid of 1st process with name "\??\C:\WINNT\SYSTEM32\winlogon.exe"  in session represented by
      // id 0 (contains path -> may require enabled debug privilege)
    WinlogonSes0000PID = ProcessName2PID(_T("0/94*\??\C:\WINNT\SYSTEM32\winlogon.exe");
      // pid of 95th process with name "\??\C:\WINNT\SYSTEM32\winlogon.exe"  in session represented by
      // id 0 (contains path -> may require enabled debug privilege)
    LongBaseFirstPID    = ProcessName2PID(_T("*/0123456789A.exe");
      // pid of the 1st process with base name "0123456789A.exe" (longer than 14 characters -> may
      // require enabled debug privilege)
    NationalCharacterFirstPID    = ProcessName2PID(_T("*/a.exe");
      // pid of the 1st process with base name "a.exe" (contains national characters -> may require
      // enabled debug privilege)

--------------------------------------------------------------------------------------------------------
DWORD WINAPI BuildPIDList(LPDWORD pPIDs, DWORD SizeInPIDs, DWORD SessionId);
  Parameters:
    pPIDs - pointer to buffer with min. size SizeInPIDs*sizeof(DWORD) bytes.
    SessionId can be:
      PW_THISSESSION - builds list of PIDs in current session. 
      PW_ALLSESSIONS - builds list of all PIDs in system.
      PW_CNSLSESSION - builds list of PIDs in console session. 
      Session ID     - builds list of PIDs in given session.

  Returns:
    PW_MEMERROR - memory can't be allocated/committed/locked or PW initializaton failed.
    PW_SESERROR - session represented by SessionId doesn't exist.
                  Valid single-user NT and 9X SessionIds are 0, PW_THISSESSION, PW_ALLSESSIONS
                  and PW_CNSLSESSION.
    nPIDs       - function succeeded. pPIDs is filled. Number of processes in given/all session/s.
                  If nPIDs > SizeInPIDs you should extend buffer pPIDs points to and call this function
                  again to get all PIDs.

--------------------------------------------------------------------------------------------------------
DWORD WINAPI GetSessionId(DWORD ProcessId);
  Parameters:
    ProcessId can be:
      PW_THISSESSION - returns true session ID of current session
      PW_CNSLSESSION - returns true session ID of console session
      Process ID     - returns session ID of process

  Returns:
    PW_MEMERROR - memory can't be allocated/committed/locked or PW initializaton failed.
    PW_PIDERROR - ProcessId is invalid.
    PW_SESERROR - PW_CNSLSESSION was specified but console session is in the process of being attached
                  or detached.
    SessionId   of given process or true ID for this/console session; 0 for 9X and single-user NT.

  Notes:
    Advantage of this function vs. ProcessIdToSessionId is that it doesn't need to have QUERY access to
    process represented by ProcessId (~ works from guest account for all processes).
--------------------------------------------------------------------------------------------------------
Force static linking by #define PW_STATIC_LINKING.