=head1 NAME os2hek-tools - Comments on interface and algorithms of F. =head1 SYNOPSIS Etags and grep command lines (look for _System and "CAPITAL whatever(whatever)" - actually, it should have been CAPITAL or DIGIT...): etags -r "/\([a-zA-Z_][a-zA-Z_0-1]*[ \t*][ \t*]*\)*_System[ \t*][ \t*]*\([a-zA-Z_][a-zA-Z_0-1]*\)[ \t]*(/\2/" *.c *.h grep "^\([a-zA-Z_][a-zA-Z_0-1]*[ \t*][ \t*]*\)*_System[ \t*][ \t*]*\([a-zA-Z_][a-zA-Z_0-1]*\)[ \t]*(\|\([A-Z][A-Z_]*[ \t*][ \t*]*\)\([a-zA-Z_][a-zA-Z_0-1]*[ \t*][ \t*]*\)*\([a-zA-Z_][a-zA-Z_0-1]*\)[ \t]*(.*)[ \t]*$" *.c The skeleton was created by for %%f in (*.c) do aaaa.cmd %f aaaa.cmd: echo . echo %1: grep -h "^\([a-zA-Z_][a-zA-Z_0-1]*[ \t*][ \t*]*\)*_System[ \t*][ \t*]*\([a-zA-Z_][a-zA-Z_0-1]*\)[ \t]*(\|\([A-Z][A-Z_]*[ \t*][ \t*]*\)\([a-zA-Z_][a-zA-Z_0-1]*[ \t*][ \t*]*\)*\([a-zA-Z_][a-zA-Z_0-1]*\)[ \t]*(.*)[ \t]*$" %1 | perl -wple "s/^/\t/; s/^\t(.*)\b(IMPORT)\s+/ $2 $1/; s/\b_System\s+// or s/^\t/ _NoSys /" then converted to POD by one-liners like. perl -pwle "s/^(\S+):\s*$/\n\n=back\n\n=head2 F<$1>\n\n=over\n\n/; s/^\t(\S.*?)\s*$/=item C<$1>\n\n/" os2hek-tools >os2hek-tools.pod1 perl -pwle "s/^\s+_NoSys\s+(.*?)\s*$/\n\n=item C<$1>\n\nBC<_System>B< linkage.>\n\n/" os2hek-tools.pod2 >os2hek-tools.pod3 perl -pwle "s/^(=item\s+.*?(\w+)\(.*)/$1\n\nX<$2>/" os2hek-tools.pod2 >os2hek-tools.pod3 =head1 DESCRIPTION Started in the thread wptools source code - where? on c.o.o.p.m. =head1 LAYOUT of Object Data: See L. =head1 Per File comments for WPTOOLS directory =head2 F Contains description of ini-strings for different classes [hmm, can't find LOCKUPTIMEOUT in any .INF file - but it is on Google...]. =head2 F =over =item C X Appends C<"TITLE=...> to the pszOptions string; uses PathFromObject() to get the path, then queries ".LONGNAME" via GetEAValue() and escapes it via ConvertTitle(); if no such EA, uses the part of the name to the right of last '\\'. =back =head2 F =over =item C X Returns a static string like "2.12" =item C X Calls GetClassInfo(), if fails: if fAddComment, returns error message, otherwise NULL. Extracts Classdata from the returned buffer. Returns static buffer (has message about class name, class data and object location if fAddComment). =item C X As pszGetObjectSettings(), but only class name. =item C X As pszGetObjectSettings(), but REXX-enabled. =item C X BC<_System>B< linkage.> Unless iStem==1, appends .iStem to the name =item C X TRAPJE's REXX. =item C X WinQueryObject(), then return 0 for non-FileSystem objects; uses GetProfileData() to extract "PM_Abstract:FldrContent" from .ini files, breaks this into words, syntesizes Abstract handles of these words, and calls pszObjectIDFromHandle(). If the latter call fails, uses "#%5x". If asked to include files, WinQueryObjectPath(), then DosFindFirst etc. =item C X as GetWPToolsVersion(), but REXX-enabled. =item C X Gets hObject by either parsing "#%d", or WinQueryObject(); calls WinSetObjectData(). =item C X Registers REXX functions =item C X GetClassInfo(), then dumps (details???) the readable representation of the contents into a static buffer, then returns. =item C X BC<_System>B< linkage.> Poor man's vsnsprintf()??? =back =head2 F =over =item C X Gets settings via GetObjectValue() from pObjectData with hardwired ids 501..508; catenates them to pszOptions(). Get per-Drawer object counts and object lists via ids 0..99; get the shadowed hObjects via pszOrigID(); uses all this info to create a correct Launchpad initialization string. =item C X Gets the ClassData buffer via GetClassInfo(), looks for OINFO's name "WPShadow" and a hardwired id via GetGenObjectValue() to get the handles of the shadowed object. =back =head2 F =over =item C X For abstract objects, queries "PM_Abstract:FldrContent" from user's .ini via GetAllProfileNames(); runs through the keys, extracting the values through GetProfileData(); interprets the key as a hex string for low word of a FileSystem object, and the value as ULONG array containing low words (sic!) of hObjects; stops when the value contains hObject. For other objects, gets Path via PathFromObject(); uses the returned NODE to get the low word of the parent in pNode->usParentID. Copies the ObjectID of the parent (got via pszObjectIDFromHandle()) to pszLocation. =back =head2 F =over =item C X Clears the cache of active handles. =item C X Copies what is in "PM_Workplace:ActiveHandles"/"HandlesAppName" from system .ini, if none, "PM_Workplace:Handles" to pszHandlesAppName sets fNewFormat if the former key is present (unused). =item C X GetActiveHandles(), if differs from the cached value, clears the cache; returns 0 for non-FileSystem objects; then caches the catenation of all "BLOCK%d" subkeys (via fReadAllBlocks()); and calls GetPartName() to find the name via the info in this buffer. Returns the pointer to the node. =item C X Parses pHandlesBuffer+4 as a catenation of DRIV and NODE structs (distinguished by first 4 bytes being "DRIV" or "NODE" (case-insensitively). Keeps the last encountered DRIV. Looks for a NODE with the given usID. For parentless NODEs, copies the name to pszFname (strange length computations?); otherwise calls itself recursively to parse the part of the buffer from the last DRIV encountered to the end looking for pNode->usParentID; catenates "\\"name to the parent name. If pfHandleUsed, caches 1 at pfHandleUsed[usID]. Returns the pointer to the node. =item C X From user's .ini "PM_Workplace:Location"/pszName: if the value's length is long enough, consider it as ULONG for HOBJECT. Otherwise fail unless pszName is a valid file name; find the full path via _fullpath(); get active handles key name via GetActiveHandles(), uncache and/or cache active handles if needed (as in PathFromObject()); looks for the low word of hObject with the given path by calling GetFSObjectID() with parentID=0; converts to a FileSystem handle. =item C X As GetPartName(), but looks for a node with the given usParentID, usNameSize being the length of the first directory part of pszFname [or whole pszFname if no '\\'], and (case-insensitive) szName being this directory part; return NODE's usID if pszFname has no '\\'; otherwise strips this directory part from pszFname, changes the parent ID to one of the found node, and continues the search (forward?!). =item C X Gets data from HINI for pszActiveHandles/NULL. The data starts as concatenation of 0-terminated strings (terminated by ""); look for strings matching "BLOCK%d" with %d < 100 (case-insensitively), and check that for all of them pszActiveHandles/string is present in the profile; total the sizes of these data etc. This boils down to: catenate the contents of .ini's pszActiveHandles/"BLOCK%d" for 1..100 (breaking on the first block which is not present). =back =head2 F One in OS2HEK is newer by a week. Differences: different header file included; when processing EA_LPICON etc. in SetEAValue() does not append cbValue (in short format) [i.e., no increment of p] if cbValue == 0; =over =item C X =item C X =back =head2 F =over =item C X shows an error message in PM and VIO =back =head2 F =over =item C X<_DLL_InitTerm> Gets indices of Transient, Abstract, and FileSystem classes =item C X BC<_System>B< linkage.> Resets which files to consider User's and System's .ini. Reinits the DLL. =item C X BC<_System>B< linkage.> Parses pszBaseClasses as catenated 0-terminated strings. (terminated by ""); finds (n-1)-th, n is the high word of hObject. =item C X BC<_System>B< linkage.> Switch by high word of hObject. =item C X pObjData is broken into POINFO, each broken into TAGs; loops through OINFOs and TAGs, finds the TAG with give usTag, copies it to pOutBuf. Returns 0 on failure. =item C X Loops as GetObjectValue(), but return the size only. =item C X Scans through OINFO structs in of pObjData, scans through TAG parts of OINFO looking for pOinfo->szName being pszObjName, and pTag->usTag being usTag; copies the TAG to pOutBuf, returning pTag->usTagFormat (or 0 on failure). =item C X pulProfileSize is OUT... Returns: for Abstract objects: data from HINI (first word corrected) otherwise gets the path, checks for rootness; for root objects checks \\\ or DosQueryFSAttach() for remoteness, then reads F<"WP ROOT. SF"> or F<"WP SHARE. SF"> (first word corrected) for non-root objects gets .CLASSINFO (first word corrected) =item C X GetObjectValue() with usTag, breaks it into struct {short tag; char buf_0terminated[]}; looks for usStringTag, terminating on tag==0xFFFF; copies the buf_0terminated to pOutBuf; returns 0 on failure. =item C X As GetObjectValueSubValue(), but does GetGenObjectValue() with pszObjName and usTag. =item C X (based on HI word of hObject). =item C X (based on HI word of hObject). =item C X Adds HI word to make Abstract hObject. =item C X Adds HI word to make a FileSystem object. =item C X Gets class info via GetClassInfo(), if the class name is "WPSchemePalette", catenates ";AUTOSETUP=YES" to pszSettings (";" optional); calls WinSetObjectData(); =item C X WinDestroyObject() =item C X Checks _osmajor/_osminor. =item C X GetClassInfo(), extracts Data "WPObject", then ObjectIDFromData(). otherwise, for FileSystem objects, does PathFromObject() (appending \ to drives). Returns a static string. =item C X As ObjectIDFromData(), but does not restrict to "WPObject" key. =back =head2 F =over =item C X Looks like: same as GetProfileData() with NULL PSZ key. =item C X pulProfileSize is OUT; returns malloc()ed buffer. =back =head2 F =over =item C X Read file pszIcon, and convert to pointer via Buffer2Icon(). Return 0 on failure. =item C X pchIcon is actually PBITMAPARRAYFILEHEADER2; query screen size; if GetPointerBitmaps() (checking for a correct signature first) fails: loop through bitmaps (via ->offNext) using the b&w one of a pair (via pGetNextBitmap()) and rejecting these with unrecognized cbFix, if an icon with the correct screen sizes, 16 colors and matching usIconSize (for usIconSize != 0) is found, and GetPointerBitmaps() succeeds, take it; otherwise drop 1-by-1 the restrictions on device size, number of colors, coloredness; if not found; drop usIconSize restriction, and try again, dropping conditions in another order: first number of colors, then screen sizes, then coloredness. If fails, return 0. Call WinCreatePointer[Indirect] on the bitmap, delete bitmap, and return the pointer. =item C PBITMAPARRAYFILEHEADER2 pbafh2, HBITMAP *phbmPointer, HBITMAP *phbmColor)> BC<_System>B< linkage.> Check for correct signature, convert to PBITMAPFILEHEADER2, WinGetPS()/GpiCreateBitmap()/WinReleasePS(); if result is color, find the b/w one via pGetNextBitmap() and repeat. =item C X BC<_System>B< linkage.> Given color icon, find the b/w one which is appended after the color table; size of the color table calculated via usGetColorsInBitmap(). =item C X BC<_System>B< linkage.> Switch between two known formats basing on pbmp2->cbFix; return 1< =over =item C X Read X:\OS2\DLL\DOCK%d.CFG for tray# in 0..15; consider as struct TRAYDEF; if bInUse set, append "ADDTRAY="pTray->szTitle option and loop through Icons array, unshadowing via pszOrigID(), caching the result in _rgLaunchPadObjects; and appending ids to the setup string.. =back =head2 F =over =item C X Commented out part: if GetObjectValue("WPAbstract"/WPABSTRACT_STYLE) [wrong signature of the call - should have been GetGenObjectValue()?] gets ulType & OBJSTYLE_TEMPLATE, fail. Gets WPABSTRACT_TITLE via GetObjectValue(); if non-empty, catenate with "TITLE=" and the escaped (via ConvertTitle()) result (and ";"). =item C X Escapes \n,\r,\"; strips (?) trailing blanks. =back =head2 F =over =item C X Gets IDKEY_PALXCELLCOUNT/IDKEY_PALYCELLCOUNT via GetObjectValue(); the product is the count; loop through IDKEY_PALCELLDATA_FIRST + (0..count-1) via GetObjectValue(), appending the ","-separated list to "COLORS="; catenate to pszOptions if anything found. =back =head2 F =over =item C X Redirected to vGetFSysTitle(). =back =head2 F =over =item C X Gets IDKEY_DRIVENUM via GetObjectValue(); puts "DRIVENUM=%d" into pszOptions. =back =head2 F =over =item C X Gets "PM_Lockup"/"LockupBitmap" and "PM_Lockup"/"LockupOptions" (interpreted as struct LOCKUP) from .ini files; appends AUTOLOCKUP=%s;LOCKUPAUTODIM=%s;LOCKUPFULLSCREEN=%s;LOCKUPONSTARTUP=%s;LOCKUPTIMEOUT=%d; basing on struct LOCKUP, and "LOCKUPBACKGROUND=%s,%s," basing on lockup bitmap (or "(none)" if none) and pLockup->bImageType. Appends scalefactor and coloronly (and space-separated RGB values unless ->bExtra). =back =head2 F =over =item C X As GetWPColorPaletteOptions(), but sets "FONTS=", and values of cells are FONTPOTs, of which szFont is appended. =back =head2 F =over =item C X =item C X BC<_System>B< linkage.> Gets "PM_Workplace:FolderPos"/"%d@10" of hObject from .ini files; takes 4 shorts at offset 18 as sX,SY,sCX,sCY, converts them to % of screen size, and catenates "ICONVIEWPOS=%d,%d,%d,%d;". =back =head2 F =over =item C X Gets WPFSYS_MENUCOUNT via GetObjectValue(); if non-0, gets WPFSYS_MENUARRAY likewise, interprets as array of FSYSMENU; finds pairs m1,m2 of elements with m1->usIDParent == 0 and m2->usIDParent == m1->usIDMenu; converts m2->hObject to objectID via pszObjectIDFromHandle(); escapes m1->szTitle and m2->szTitle via ConvertTitle(), and appends them and object id as "MENU=%s,%s,%s;". =back =head2 F =over =item C X Appends "HOSTNAME=", "USERNAME=", "ACCOUNT=", "REMOTEDIR=", "LOCALDIR=", "INCLUDE=" via tags 1, 2, 4, 5, 6, 8 of GetObjectValue() if they exist; if both tags 3 and 11 exist, ^-encodes tag3 with the first byte of tag11 (subtracting 8 each 4 bytes) and fills the "PASSWORD=" part; if tag 7 (as long) is 3 or 1, sets "FILETRANSFERTYPE=" BINARY or TEXT; appends the result to szOptionText. =back =head2 F =over =item C X Chooses one of two formats: if both tags WPOBJECT_STRINGS and WPOBJECT_DATA are present (via GetObjectValue()), the format is new, so "style" bitfield is a field of WPOBJECT_DATA (interpreted as WPOBJDATA); otherwise it is WPOBJECT_STYLE (interpreted as ULONG). Judging by the bits of the style, sets NOMOVE NOLINK NOCOPY TEMPLATE NODELETE NOPRINT NODRAG NOTVISIBLE NORENAME NOSETTINGS NODROP to "=YES;" when appropriate; for Warp4 treats LOCKEDINPLACE likewise, and sets "MENU=" SHORT/LONG/DEFAULT basing on the ulMenuFlag field of WPOBJECT_DATA. Gets HelpPanel: in new style as a field of WPOBJECT_DATA, in the old one as WPOBJECT_HELPPANEL (interpreted as ULONG); sets "HELPPANEL=%d". Gets ViewButton: in new style as a field of WPOBJECT_DATA, in the old one as WPOBJECT_VIEWBUTTON (interpreted as ULONG); sets "HIDEBUTTON=" YES/NO/DEFAULT switching by the value. Likewise for WPOBJECT_CONCURRENT and "CCVIEW=". Gets Minimized: in new style as a field of WPOBJECT_DATA, in the old one as WPOBJECT_MINWIN (interpreted as ULONG); sets "MINWIN=" HIDE/VIEWER/DESKTOP/DEFAULT switching by the value. In new format sets "DEFAULTVIEW=" basing on a field of WPOBJECT_DATA, to SETTINGS/ICON/TREE/DETAILS/%d/DEFAULT. Sets "OBJECTID=" via ObjectIDFromData(). =item C X Extracts TAG WPOBJECT_SZID if present; otherwise extracts subtag WPOBJ_STR_OBJID from tag WPOBJECT_STRINGS. =back =head2 F =over =item C X Gets IDKEY_PALXCELLCOUNT, IDKEY_PALYCELLCOUNT, IDKEY_PALXCELLWIDTH, IDKEY_PALYCELLHEIGHT, IDKEY_PALXGAP, IDKEY_PALYGAP via GetObjectValue(), interpreted as ULONG; if present, sets XCELLCOUNT, XCELLCOUNT, XCELLWIDTH, YCELLHEIGHT, XCELLGAP, yCELLGAP options, and appends to pszOptions. =back =head2 F =over =item C X =back =head2 F =over =item C X =item C X =item C X =item C X =back =head2 F =over =item C X =back =head2 F =over =item C X =back =head2 F =over =item C X =back =head2 F =over =item C X =item C X BC<_System>B< linkage.> =back =head1 BUGS OS2EA.C: One in F<./OS2HEK/> is newer by a week (see L>). =head1 AUTHOR Compiled by Ilya Zakharevich basing on the source code by Henk Kelder.