Location: Symbol Reference > Files > JwsclProcess.pas
JWSCL Documentation
ContentsIndexHome
PreviousUpNext
JwsclProcess.pas

Project JEDI Windows Security Code Library (JWSCL) 

Contains process, thread und library classes that are used by the units of JWSCL

The Original Code is JwsclProcess.pas. 

The Initial Developer of the Original Code is Christian Wimmer. Portions created by Christian Wimmer are Copyright (C) Christian Wimmer. All rights reserved.

Christian Wimmer

 
Name 
Description 
 
TJwInternalJobObjectIOCompletitionThread is for internal use only. 
 
TJwJobObject is the main job class. It encapsulates a job object and provides methods and properties to maintain it. There are also events that are fired on special job messages.
All processes of a session must have the same token session id, otherwise the assignment fails. 
 
TJwJobObjectSessionList manages a list of job objects threadsafe. Since every process in a job must be in the same session, the list manages one job object per session.
This solution is only available in Windows Vista and later. 
 
TJwLibraryUtilities contains methods related to libraries. 
Name 
Description 
Internal job name prefix 
 
Name 
Description 
 
TJwWaitState defines return values for the method WaitForAllotedCPUTimeSignal. For more information see this method. 
 
Name 
Description 
 
JwCreateProcessAsAdminUser logs on a user and creates a new process under its logon session. The user will be a member of administrators group for this process but not in the user database. In Vista the linked token will be retrieved which has the administrator group enabled. The user does not have to be an administrator at all! 
 
JwCreateProcessInSession creates a new process in a user's session using various ways to achieve success. This procedure needs JwInitWellKnownSIDs to be called.
To run a process in another session the process needs SYSTEM rights. It means that the current process token must have the TOKEN_ASSIGN_PRIMARY right for the target token. Otherwise the CreateProcessAsUser function fails with bad error explanation (like "A call to an OS function failed"). However the procedure won't stop you from doing this!
 
 
GetProcessSessionID returns the session ID of a process given by handle or ID.  
 
JwGetTokenFromProcess tries to retrieve a token from a process. For this purpose it enumerates all processes on the local machine (even from other users) and calls the callback method OnProcessFound to determine whether the given process should be used to return the token.  
 
JwProcessIdToSessionId returns the session ID of a process. This function uses the new API of Vista or otherwise calls just JwGetProcessSessionID. It ist faster because it does not create an object if run on Vista or newer.
 
 
Name 
Description 
 
This is record TInternalProcessData. 
 
TJwCreateProcessInfo contains extra information for JwCreateProcessAsAdminUser 
 
TJwCreateProcessOut contains output information after the process has started. Some of these information must be freed manually. 
 
TJwCreateProcessParameters contains information supplied to CreateProcessAsUser 
 
TJwProcessOutputInformation contains information about result from JwCreateProcessInSession
Name 
Description 
This is type PInternalProcessData. 
TJwOnJobNotification is called when a job notification occurs.  
TJwOnNewJobObject is called by TJwJobObjectSessionList.AssignProcessToJob for every new job object that mus be created. The callback event must create a new job object and return it through parameter NewJobObject. The return value must not be nil. The new job object does not need to have a name.  
TJwOnNoActiveProcesses will be called when the job object ran out of processes.  
IJwJobObject = interface [IID_IJwJobObject] procedure AssignProcessToJobObject(hProcess : TJwProcessHandle);
BOOL WINAPI AssignProcessToJobObject(HANDLE hJob, HANDLE hProcess); HANDLE WINAPI CreateJobObject(LPSECURITY_ATTRIBUTES lpJobAttributes,LPCTSTR lpName); HANDLE WINAPI OpenJobObject(DWORD dwDesiredAccess,BOOL bInheritHandles, LPCTSTR lpName); BOOL WINAPI SetInformationJobObject(HANDLE hJob,JOBOBJECTINFOCLASS JobObjectInfoClass, LPVOID lpJobObjectInfo,DWORD cbJobObjectInfoLength); BOOL WINAPI QueryInformationJobObject(HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInfoClass, LPVOID lpJobObjectInfo, DWORD cbJobObjectInfoLength, LPDWORD lpReturnLength); BOOL WINAPI IsProcessInJob(HANDLE ProcessHandle, HANDLE JobHandle, PBOOL Result); BOOL WINAPI TerminateJobObject(HANDLE hJob, UINT uExitCode);
end; 
Name 
Description 
License

The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ 

Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. 

Alternatively, the contents of this file may be used under the terms of the GNU Lesser General Public License (the "LGPL License"), in which case the provisions of the LGPL License are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of the LGPL License and not to allow others to use your version of this file under the MPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the LGPL License. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the LGPL License. 

For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html

Copyright (c) 2010. All rights reserved.
This help was created by Doc-O-Matic sponsored by toolsfactory software inc.
What do you think about this topic? Send feedback!