table top left corner

CapeSoft OddJob

table top right corner
table left side


table top left corner   table top right corner
table left side


OddJob header linked to CapeSoft home page
Version: version number
CapeSoft Software copyright


table right side
table bottom left corner table bottom table bottom right corner


table top left corner  OddJob Version History table top right corner
table left side

    bullet smallDownload latest version here


Version 1.31 - 28 November 2011

Requires StringTheory 1.52 or later

  • Added: New classes and example application for named pipe handling. Simplifies the creation of named pipes and transfer between a server and a client for both Clarion applications and application written in other languages which use pipes.
  • PipeCore class: Provides the core reading and writing to and from pipes. Typically not used directly - the PipeServer and PipeClient inherit from this class.
    • Properties:
      • pipeName cstring(256)
    • Methods:
      • Read Procedure (long hPipe, *string binData, long binLen, *long bytesRead), long, proc, virtual
      • Write Procedure (long hPipe, *string binData, long binLen, *long bytesWritten), long, proc, virtual
      • PeekPipe Procedure (long hPipe, *string binData, long binLen, *long bytesRead, <*long bytesAvailable>, <*long bytesMessage>), long, virtual
  • PipeServer Class: A Multi-threaded pipe server class. Allows the handling of any number of pipe clients (for each client an OS thread is created and destroyed when no longer needed).
    • Properties:
      • _running bool ! Set while the server is active.
      • _threadID ulong ! ID of the listen thread
      • _hpipe long  ! Handle to the current pipe
    • Methods:
      • Run Procedure (), virtual ! Start the listening thread to wait for new client connections
      • Stop Procedure (), virtual
      • CreatePipe Procedure (<string pipeName>), long, proc, virtual
      • ConnectPipe Procedure (long hPipe), long, virtual
      • DisconnectPipe Procedure (long hPipe), long, virtual
      • TakeRequest Procedure (*string request, long requestBytes, *string reply, *long replyBytes), virtual
  •  PipeClient class:
    • Properties
      • hPipe long  ! Handle to the current pipe
    • Methods:
      • OpenPipe Procedure (<string pipeName>, long timeOut = 0), long, virtual
      • ClosePipe Procedure (), virtual
      • Write Procedure (*string writeData, *long dataLen), long, proc, virtual
      • Read Procedure (*string readData, *long dataLen), long, proc, virtual
      • SetPipeState Procedure (long dwMode = jo:PIPE_READMODE_MESSAGE), long, proc, virtual
      • WaitForPipe Procedure (long timeOut), long, virtual
  • Added: a Pipes example which has a pipe server and pipe client app demonstrating the usage of the new Pipe classes.


Version 1.30 - 09 September 2011

  • Changed: Moved all equates and types to the file
  • Added: JobObject.BindToCPU - Binds the process to a single CPU (can be called at any point after process creation and applies to all threads and child processes)
  • Added: ProcessAffinity example. Demonstrates the new process affinity methods such as BindToCPU, SetProcessAffinity, GetProcessAffinity etc.
  • Added: JobObject.GetSystemInformation() method to retrieve system information
  • Added: joSYSTEM_INFO type for retrieving system information
  • Added: JobObject.CountProcessors() method to return the number of processors for the current system
  • Added: JobObject.SetProcessAffinity() method to allow the process to be limited to a specific subset of the processors available on the system
  • Added: JobObject.GetProcessAffinity() method to allow the current processor mask to be retrieved along with the system mask (which show which processors are available and can be used in setting the process affinity mask).


Version 1.29 - 29 June 2011

  • New: Added the following methods:
    • HandleFromPID Procedure(ulong PID), unsigned, virtual
      Returns the Process Handle when passed the Process ID (PID)
    • GetProcessPath Procedure(*joProcessQType processQ), string, virtual
      Returns the full path for the EXE identified by the current Process record in the passed queue. Note that the path returned uses the Windows NT Device name format, not the DOS style drive paths. Use the GetDrives method to map between device names and paths.
    • DeviceNameForDrive Procedure(string sDrive), string, virtual
      Returns the full device name when passed the drive identifier (for example 'C:'  or 'D:')
    • GetDrives Procedure(*joDrivesQType drivesQ), bool, proc, virtual
      Populates a queue with a list of all drives and their full NT Device Names.
  • New: Extended the example application to demonstrate the new methods - populate a list of all drives and their NT device names; get the full path of a process based on the process ID of the selected item in the processes list etc.


Version 1.28 - 9 April 2011

  • New: Added a KillProcess method. This kills one or more instances of a process when passed the process name (or optionally a substring of the name).
  • New: KillProcess example application. Demonstrates creating a small command line application using a hand coded project. This application kills all matching processes when passed a process name and can also optionally kill just the first instance found, or all processes where the name matches a substring passed.


Version 1.27 - 13 December 2010

  • New: Replaced the RunAsUser method. This method can be used from a service to run an application as the currently logged in user and bypasses UAC on system that have it enabled.
        Job.RunAsUser('C:\Windows\Notepad.exe', '')
  • Note: RunAsUser requires the ability to duplicate the token used by the WinLogon process associated with the current user. This is generally only available to services running in the LocalSystem account.
  • Fix: The GetUserToken, GetSessions and related methods have been modified to allow zero session IDs (which are valid).
  • Improvement: The Init method can be called multiple times without causing any undesirable behaviour.
  • Improvement: The object is initialised on creation, and the calling Init explicitly is only required to create an actual Job (all non Job functionality can be used without calling Init manually).
  • Improvement: Kill is called on destruction to clean up, and no longer needs to be called manually.
  • Improvement: Calling Kill multiple times no longer results in undesirable behaviour.
  • Improvement: Calling LoadLibs multiple times now only loads libraries that have no already been loaded and will not cause any undesirable behaviour.
  • Fix: The Userenv.dll library was not being loaded correctly and the handle ended up pointing at the wrong library.
  • Fix: The CreateEnvironmentBlock and DestroyEnvironmentBlock functions causing a GPF as a result of an incorrect library handle.
  • New: The ErrorTrap method now allows the method name to be passed as an optional parameter
  • New: LogonUser method returns a token for the specific user using the passed user name and password to authenticate.
  • New: CloseHandle method. Closes the passed handle if it is valid.
  • New: DuplicateToken method duplicates the passed token, and can convert handles to impersonation tokens into a primary token handles.
  • New: RunAsUser example


Version 1.26 - 16 September 2010

  • Fix: joOpenProcess() was calling the wrong API as the result of a typographical error.


Version 1.26 - 16 September 2010

  • Updated the installer to ensure that the RED file is correctly updated to include .c and .h files for the MD5 functionality.
  • StringTheory is now provided as seperate install, so please ensure that you download the current StringTheory install when updating OddJob.
  • Fixed a potential GPF in the CreateProcess method where a pointer was assigned without the &= operator.
  • Template fix for Clarion 7 (was no sheet and tab on extension).
  • Template tweak - assert for installing StringTheory.
  • Template 01.tpw - includes version 1.66 of the 01.tpw


Version 1.25 - 15 June 2010

  • StringTheory Class
    • Fixed Between() method including the left hand delimiter in the returned string.
    • Additional handling of boundary cases in the Replace() method.


Version 1.24 - 01 June 2010

  • StringTheory Class
    • Fixed a bug in the Replace method, when the string being replaced is the end of the text being searched.


Version 1.23 - 01 June 2010

  • StringTheory Class
    • Added bounds checking and corrected unhandled boundary cases for the following methods:
      • Replace (handles replacement from the start and end of the string, where the resultant string is empty, where the resultant string is a single character etc.)
      • PathOnly (handles the case where the path contains only a forward or back slash)
      • Split (handles if a "line" is blank)
      • ToBlob (handles the string being assigned to the blob being empty, or being a single character)
    • Verified that Between and Before are both safe.


Version 1.22 - 26 May 2010

  • Added optional clip parameter to StringTheory Append method.
  • Updated docs for the StringTheory SetValue method


Version 1.21 - 17 May 2010

  • Added handling to SetValue for passing zero length strings (the StringTheory value is disposed of and the Length methods will return zero).
  • Added GetSessions method that fills a queue with all sessions.
  • Added FindActiveSession method.
  • Added an optional accessToken process to the RunAsUser method to allow the method to run a process as any user, not just the current one.
  • Added an optional dontStore parameter to the RunAsUser method, which allows the process information to not be stored. This is set to True (1) by default to maintain the same behaviour as previous version that did not support this functionality.
  • RunAsUser now creates the processes, associates it with the current job (if the breakAwayFromJob parameter is not set to True, and the .dontAssociateProcesses property is not set to True), and stores the created process information in to .processes queue (if the dontStore parameter is not set to False (0)).
  • Added a GetToken method to retrieve the Access Token associated with the passed session.
  • Added a RunAsUser example that demonstrates running processes with a variety of credentials.
  • Added APIs for token manipulation (runtime loaded):
    • joAccessCheck(), joAdjustTokenGroups(), joAdjustTokenPrivileges(), joGetTokenInformation(), joSetThreadToken(), joSetTokenInformation()


Version 1.20 - 17 May 2010

  • Fixed a potential memory leak when Calling CreateProcess and reading data from a process.
  • Reduced memory usage when calling a processes that the StdOut will be read from.
  • Fixed the length of the string created when using Base64 encoding to ensure that the encoded string is always padded onto a 4 byte boundary.
  • Added the base64NoWrap property, which when set will not add line wrapping to the Base64 encoded string.
  • Fixed errors in the Base64 encoding.
  • Improved efficiency when assigning new values to the string that have the same length as the string stored
  • Add a new csBlowfish class to provide support for the Blowfish cipher.
  • Added Blowfish encryption and decryption support to StringTheory, via the following methods:
    • InitBlowfish
    • KillBlowfish
    • Encrypt
    • Decrypt
    • EncryptString
    • DecryptString
    • SetKey
  • Note: Future releases will support CBC (Cipher Block Chaining) to allow data of arbitrary length to be encrypted. The current version requires that that the data encrypted has a length that is a multiple of 8 (in bytes).
  • Documented base properties and methods available to all classes, including:
  • boxBase Methods

    Debug Conditionally output to the Windows debug output depending on whether the .debug property is set to true or not.
    DebugOutput Unconditionally output a string to the Windows debug output.
    ErrorTrap Callback method used to trap errors.
    FormatMessage Converts an API error code into the associated error message.
    ToCstring Creates a new cstring from the passed string.
    FreeCstring Safely frees a cstring reference variable.
    Ulong64ToReal Converts an unsigned 64 bit integer to a Real
    GetReg Returns the value of the specified registry key.
    PutReg Sets the value of the specified registry key.

    box Base Properties

    displayErrors Sets whether or not the class displays errors using the Message function.
    logErrors Sets whether or not errors are sent to the Windows Debug Output
    errorCode The last error code
    errorMessage The last error message
    debug Determines whether or not debug output is produced
    debugPrefix The prefix used for debug output
  • New GetRegand PutReg methods (see above).
  • Documented new methods and properties.
  • New main example app demonstrates a far wider variety of ways in which to start and interact with processes.


Version 1.10 - 06 April 2010

  • New StringTheory methods:
    • Before - returns the portion of the string that occurs before the specified string seperator.
    • After - returns the portion of the string that occurs after the specified string seperator.
    • Between  - returns the portion of the string that occurs between the two specified string seperators.
    • Base64Encode/Base64Decode - Base64 encode and decode either a passed string, or the value stored by the StringTheory object.
    • MD5 - Create an MD5 hash of the string.
    • New string delimiter processing methods:
      • Split - splits the string into sub strings, which are stored in the .lines property. Optionally allows the "line" start and end delimeters to be specified.
      • Join - joins the all the lines (after the string has been slit using Split, and optionally wraps each line in the specified delimiters).
    • Slice - returns a string containing the data between the specified start and end characters (a "slice").
    • Crop - Crops the stored value using the pass start and end parameters.
    • Sub - returns a sub-string of the specified length, starting at the specified character.
  • Fixed the ClipLen method infinitely loop as it was calling itself rather than calling ClipLength().
  • Fixed the Base64Encode method adding extra spaces in the encoded string.
  • Added: FromBlob method, stores the contents of the passed BLOB in the StringTheory object.
  • Added ToBlob method, saves the contents of the string into the passed BLOB.


Version 1.03 - 20 October 2009

  • Added: Additional optional parameter to the CreateProcess methods to allow the initial window mode to be specified. This allows the process to be started as shown, hidden, minimised, maximised etc. without having to call the more advanced CreateProcess method that supported this.


Version 1.02 - 20 October 2009

  • Fixed: CreateProcess causing a GPF when used to start a process that was hidden and did not require any IO (no StringTheory object was passed).
  • Added: Additional logging to CreateProcess for simpler debugging.
  • Fixed: CreateProcess could potentially call the AddProcess method twice, resulting in it failing the second time. This would not affect the application's behaviour, but would display an eroneous error in the debug log if logging was enabled and being captured.


Version 1.01 - 12 October 2009

  • StringTheory Class
    • Fixed: the PathOnly method, which was returning a blank string.
    • Optimised: the Replace method in the case where both strings are a single character
    • Fixed: Replace to allow an empty replacement string to be specified (which removes the searched for string)
    • Fixed: FileNameFromPath method.
    • Renamed: the ProcessQType to joProcessQType to ensure that it does not conflict with other tools using the same type.
    • Added: GetProcessMemoryInfo method to get the memory usage information for any process on the system.
    • Fixed: Missing Editor folder in the Demo example, causing the HTML editor to not function correctly.

Version 1.00 - 11 August 2009

  • Initial release.
table right side
table bottom left corner table bottom table bottom right corner


table right side
table bottom left corner table bottom table bottom right corner

All content © Copyright CapeSoft Software