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

Project JEDI Windows Security Code Library (JWSCL) 

This unit hosts utilty functions.

  1. Extend TJwRegistry to support security.

The Original Code is JwsclUtils.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 
 
TJwIntTupleList defines an integer tuple list. Despite its name the list manages index with pointers (integer,pointer). 
 
TJwThread defines a thread base class which offers a name for the thread. Override Execute and call it at first to have any effect. 
 
Name 
Description 
 
This is function JwAccessMaskToBits. 
 
This is function JwAddHandleToArray. 
 
JwBeginCreateHash begins a hash calculation and returns an hash handle that is used with other hash functions like: JwStringHash, JwIntegerHash, JwDataHash, JwObjectHash
 
 
JwCheckArray checks whether a object type list array is correctly formed. The array must be in a post fix order. This sequence describes the Level structure.
 
 
JwCheckArray checks whether a object type list array is correctly formed. The array must be in a post fix order. This sequence describes the Level structure.
 
 
JwCheckBitMask Checks if (Bitmask and Check) = Check 
 
JwCheckInitKnownSid checks for the call of JwInitWellKnownSIDs and raises EJwsclInitWellKnownException if it was not called.
There is a more detailed procedure JwsclKnownSid.JwCheckInitKnownSid which can be used to check for special well known SID variables from unit JwsclKnownSid.
 
 
JwCheckVISTACompilerSwitch raises an exception EJwsclVistaFeaturesDisabled if the current code isn't compiled with the VISTA compiler directive. Otherwise it does nothing. 
 
JwCompareFileHash creates a hash from a given file and compares it to an already calculated hash.
 
 
JwCreateClassHash calculates an integer hash value from a memory structure. 
 
JwCreateFileHash creates a hash from a given file and returns the hash.
 
 
JwCreateToString creates a comma separated string (compatible to TStringList.CommaText) with names and values. This string is used in toString() methods of JWSCL classes for property output.
 
 
JwCreateWaitableTimer creates a waitable timer handle.
For more information about the undocumented parameters, see MSDN http://msdn.microsoft.com/en-us/library/ms686289(VS.85).aspx
This function does not support absolute time like the original winapi function. It means that you cannot specify a point in time.
 
 
JwCreateWaitableTimer creates a waitable timer handle.
 
 
JwCreateWaitableTimerAbs is not implemented yet. It is intended to support absolute time. 
 
JwCreateWaitableTimerAbs is not implemented yet. 
 
JwDataHash hashes a data structure and adds it to the given hash handle. 
 
JwEndCreateHash frees a hash value created by JwBeginCreateHash and returns the hash value over all calculated hashes.
 
 
JwFreeThreadName frees the thread variable allocated by JwSetThreadName. This procedure must be call at the end of thread to avoid a memory leak in some situation. 
 
JwGetThreadName returns the name of a thread set by JwSetThreadName. This function only returns the name of the current thread. It cannot be used with different threads than the current one.
Precondition: JwSetThreadName must be called with a value of Cardinal(-1) for parameter ThreadID. 
 
JwGlobalAllocMem creates a managed memory handle by LocalAlloc. Some memory leak managers do not recognize leaks created by LocalAlloc and GlobalAlloc. Thus we create for them a GetMem memory block. Replace each call to LocalAlloc/GlobalAlloc with JwLocalAllocMem/JwGlobalAllocMem and their counter parts JwLocalFreeMem/JwGlobalFreeMem. If a counter part is not called and the program halts the memory manager will (hopefully) show the stack trace to the GetMemPointer created by JwLocalAllocMem/JwGlobalAllocMem.
Warning: Do not call JwLocalAllocMem/JwGlobalAllocMem for API functions that will free the handle. GetMemPointer will remain whatsoever. Instead use LocalAlloc/GlobalAlloc. This behavior is rare but the... more 
 
JwGlobalFreeAndNil calls GlobalFree on parameter hMem and sets it to zero (0). 
 
JwGlobalFreeMem frees a managed GlobalAlloc handle created by JwGlobalAllocMem. The given handle will be set to 0. Refer to MSDN documentation for more information. 
 
This is function JwHandlesArray. 
 
JwIntegerHash hashes an integer and adds it to the given hash handle. 
 
IsHandleValid returns true if Handle is neither zero (0) nor INVALID_HANDLE_VALUE; otherwise false. 
 
JwLoadHashFromRegistry loads a hash record (TJwFileHashData) to registry previously saved by JwSaveHashToRegistry.
 
 
JwLocalAllocMem creates a managed memory handle by LocalAlloc. Some memory leak managers do not recognize leaks created by LocalAlloc and GlobalAlloc. Thus we create for them a GetMem memory block. Replace each call to LocalAlloc/GlobalAlloc with JwLocalAllocMem/JwGlobalAllocMem and their counter parts JwLocalFreeMem/JwGlobalFreeMem. If a counter part is not called and the program halts the memory manager will (hopefully) show the stack trace to the GetMemPointer created by JwLocalAllocMem/JwGlobalAllocMem.
Warning: Do not call JwLocalAllocMem/JwGlobalAllocMem for API functions that will free the handle. GetMemPointer will remain whatsoever. Instead use LocalAlloc/GlobalAlloc. This behavior is rare but... more 
 
JwLocalFreeMem frees a managed LocalAlloc handle created by JwLocalAllocMem. The given handle will be set to 0. Refer to MSDN documentation for more information. 
 
This is function JwMsgWaitForMultipleObjects. 
 
JwMsgWaitForMultipleObjects encapsulates MsgWaitForMultipleObjects using an open array parameter. The function should be used to make sure that window messages are processed. In this way windows are responsible. This function returns if such a message is received.
 
 
JwObjectHash hashes an object and adds it to the given hash handle. 
 
JwSaveHashToRegistry saves a hash record (TJwFileHashData) to registry.
 
 
JwSetThreadName names a thread. A debugger can use this name to display a human readably identifier for a thread. JwSetThreadName must be called without using parameter ThreadID as a precondition to use JwGetThreadName .
 
 
JwStringHash hashes a string and adds it to the given hash handle. 
 
JwUNIMPLEMENTED raises exception EJwsclUnimplemented 
 
JwUNIMPLEMENTED_DEBUG raises exception EJwsclUnimplemented if compiler directive DEBUG was used to compile the source 
 
This is function JwWaitForMultipleObjects. 
 
JwWaitForMultipleObjects encapsulates WaitForMultipleObjects using an open array parameter.
 
 
JwZeroPassword erases securely a UNICODE or ANSICODE string.
 
 
LocalizeMapping loads the resource strings of a TJwRightsMapping record array defined in JwsclTypes.pas. To convert a rights mapping record array define a start resource string index, say 4000. This is the starting point of the resource strings, but it does not define a string. It simply contains a number that defines the count of array elements, say 4. So the record array must look like this :  
 
Name 
Description 
 
This is record TIntTuple. 
 
This is record TThreadNameInfo. 
Name 
Description 
This is type TLStr. 
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!