Changeset 122


Ignore:
Timestamp:
Dec 8, 2001, 11:14:27 PM (24 years ago)
Author:
umoeller
Message:

Misc changes.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/stringh.h

    r115 r122  
    3232    #define STRINGH_HEADER_INCLUDED
    3333
     34    VOID XWPENTRY strhStore(PSZ *ppszTarget, PCSZ pcszSource, PULONG pulLength);
     35
    3436    PSZ XWPENTRY strhcpy(PSZ string1, const char *string2);
    3537
  • trunk/src/helpers/apps.c

    r113 r122  
    782782 *
    783783 *      -- starting ".CMD" and ".BAT" files as
    784  *         PROGDETAILS.pszExecutable.
     784 *         PROGDETAILS.pszExecutable;
     785 *
     786 *      -- starting apps which are not fully qualified
     787 *         and therefore assumed to be on the PATH.
    785788 *
    786789 *      Unless it is "*", PROGDETAILS.pszExecutable must
     
    814817 *      -- To start a session minimized, set SWP_MINIMIZE.
    815818 *
    816  *      -- To start a VIO session auto-close disabled, set
    817  *         the half-documented SWP_NOAUTOCLOSE flag (0x8000)
     819 *      -- To start a VIO session with auto-close disabled,
     820 *         set the half-documented SWP_NOAUTOCLOSE flag (0x8000)
    818821 *         This flag is now in the newer toolkit headers.
    819822 *
     
    843846 *          WinStartApp completely hangs the session manager
    844847 *          if a Win-OS/2 full-screen session is started from
    845  *          a thread that is NOT thread1, this will fail
    846  *          with an error for safety (V0.9.16).
     848 *          a thread that is NOT thread 1, this will now fail
     849 *          with this error for safety (V0.9.16).
    847850 *
    848851 *      --  ERROR_INVALID_PARAMETER: pcProgDetails or
     
    866869 *@@changed V0.9.16 (2001-10-19) [umoeller]: added prototype to return APIRET
    867870 *@@changed V0.9.16 (2001-10-19) [umoeller]: added thread-1 check
     871 *@@changed V0.9.16 (2001-12-06) [umoeller]: now using doshSearchPath for finding pszExecutable if not qualified
    868872 */
    869873
     
    886890    // all this only makes sense if this contains something...
    887891    // besides, this crashed on string comparisons V0.9.9 (2001-01-27) [umoeller]
    888     if (!ProgDetails.pszExecutable)
     892    if (    (!ProgDetails.pszExecutable)
     893         || (!(*(ProgDetails.pszExecutable)))
     894       )
    889895        arc = ERROR_INVALID_PARAMETER;
    890896    else if (doshMyTID() != 1)          // V0.9.16 (2001-10-19) [umoeller]
     
    893899    {
    894900        ULONG           ulIsWinApp;
     901
     902        CHAR            szFQExecutable[CCHMAXPATH];
    895903
    896904        XSTRING         strParamsPatched;
     
    10101018        else
    10111019        {
    1012             // now check if the executable is valid
    1013             // V0.9.16 (2001-10-19) [umoeller]
    1014             ULONG ulAttr;
    1015             _Pmpf(("  %d now, checking %s", arc, ProgDetails.pszExecutable));
    1016             if (!(arc = doshQueryPathAttr(ProgDetails.pszExecutable,
    1017                                           &ulAttr)))
    1018             {
    1019                 // make sure startup dir is really a directory
    1020                 if (ProgDetails.pszStartupDir)
     1020            // check if the executable is fully qualified; if so,
     1021            // check if the executable file exists
     1022            if (    (ProgDetails.pszExecutable[1] == ':')
     1023                 && (strchr(ProgDetails.pszExecutable, '\\'))
     1024               )
     1025            {
     1026                ULONG ulAttr;
     1027                if (!(arc = doshQueryPathAttr(ProgDetails.pszExecutable,
     1028                                              &ulAttr)))
    10211029                {
    1022                     _Pmpf(("  checking %s", ProgDetails.pszStartupDir));
    1023                     if (!(arc = doshQueryPathAttr(ProgDetails.pszStartupDir,
    1024                                                   &ulAttr)))
    1025                         if (!(ulAttr & FILE_DIRECTORY))
    1026                             arc = ERROR_PATH_NOT_FOUND;
    1027                                         // @@todo
     1030                    // make sure startup dir is really a directory
     1031                    if (ProgDetails.pszStartupDir)
     1032                    {
     1033                        if (!(arc = doshQueryPathAttr(ProgDetails.pszStartupDir,
     1034                                                      &ulAttr)))
     1035                            if (!(ulAttr & FILE_DIRECTORY))
     1036                                arc = ERROR_PATH_NOT_FOUND;
     1037                    }
    10281038                }
    10291039            }
    1030 
    1031             _Pmpf(("  after checking %d", arc));
     1040            else
     1041            {
     1042                // _not_ fully qualified: look it up on the PATH then
     1043                // V0.9.16 (2001-12-06) [umoeller]
     1044                if (!(arc = doshSearchPath("PATH",
     1045                                           ProgDetails.pszExecutable,
     1046                                           szFQExecutable,
     1047                                           sizeof(szFQExecutable))))
     1048                    // alright, found it:
     1049                    ProgDetails.pszExecutable = szFQExecutable;
     1050            }
    10321051
    10331052            if (!arc)
  • trunk/src/helpers/comctl.c

    r116 r122  
    12911291 *
    12921292 *@@added V0.9.1 (99-12-19) [umoeller]
     1293 *@@changed V0.9.16 (2001-12-08) [umoeller]: fixed empty entry field on tab key
    12931294 */
    12941295
     
    13731374                if (flReturned & HEFL_SETTEXT)
    13741375                    WinSetWindowText(hwndEdit, hkn.szDescription);
    1375                 else
    1376                     WinSetWindowText(hwndEdit, "");
    1377 
    1378                 if (flReturned & HEFL_FORWARD2OWNER)
     1376                else if (flReturned & HEFL_FORWARD2OWNER)
    13791377                    WinPostMsg(hwndOwner,
    13801378                               WM_CHAR,
    13811379                               mp1, mp2);
     1380                else
     1381                    // fixed V0.9.16 (2001-12-06) [umoeller]:
     1382                    // do not clear the entry field if we had HEFL_FORWARD2OWNER
     1383                    WinSetWindowText(hwndEdit, "");
     1384
    13821385
    13831386                mrc = (MPARAM)TRUE; // WM_CHAR processed flag;
  • trunk/src/helpers/dialog.c

    r113 r122  
    616616 *@@added V0.9.15 (2001-08-26) [umoeller]
    617617 *@@changed V0.9.16 (2001-10-15) [umoeller]: fixed ugly group table spacings
     618 *@@changed V0.9.16 (2001-12-08) [umoeller]: fixed entry field ES_MARGIN positioning
    618619 */
    619620
     
    701702            y -= 100;
    702703            cy += 100;
     704        }
     705        // the stupid entry field resizes itself if it has
     706        // the ES_MARGIN style, so correlate that too... dammit
     707        // V0.9.16 (2001-12-08) [umoeller]
     708        else if (    ((ULONG)pControlDef->pcszClass == 0xffff0006L)
     709                  && (flStyle & ES_MARGIN)
     710                )
     711        {
     712            LONG cxMargin = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
     713            LONG cyMargin = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
     714
     715            x += cxMargin;
     716            y += cxMargin;
    703717        }
    704718    }
     
    17281742 *@@changed V0.9.14 (2001-08-01) [umoeller]: fixed major memory leaks with nested tables
    17291743 *@@changed V0.9.14 (2001-08-21) [umoeller]: fixed default push button problems
     1744 *@@changed V0.9.16 (2001-12-06) [umoeller]: fixed bad owner if not direct desktop child
    17301745 */
    17311746
     
    17461761    PDLGPRIVATE  pDlgData = NULL;
    17471762
     1763    HWND        hwndDesktop = WinQueryDesktopWindow(NULLHANDLE, NULLHANDLE);
     1764                                        // works with a null HAB
     1765
    17481766    /*
    17491767     *  1) parse the table and create structures from it
     
    17651783            FRAMECDATA      fcData = {0};
    17661784            ULONG           flStyle = 0;
     1785            HWND            hwndOwnersParent;
    17671786
    17681787            fcData.cb = sizeof(FRAMECDATA);
     
    17801799                // V0.9.14 (2001-07-07) [umoeller]
    17811800                hwndOwner = NULLHANDLE;
     1801
     1802            // now, make sure the owner window is child of
     1803            // HWND_DESKTOP... if it is not, we'll only disable
     1804            // some dumb child window, which is not sufficient
     1805            // V0.9.16 (2001-12-06) [umoeller]
     1806            while (    (hwndOwner)
     1807                    && (hwndOwnersParent = WinQueryWindow(hwndOwner, QW_PARENT))
     1808                    && (hwndOwnersParent != hwndDesktop)
     1809                  )
     1810                hwndOwner = hwndOwnersParent;
    17821811
    17831812            if (!(pDlgData->hwndDlg = WinCreateWindow(HWND_DESKTOP,
  • trunk/src/helpers/dosh.c

    r121 r122  
    18371837 *@@added V0.9.16 (2001-10-19) [umoeller]
    18381838 *@@changed V0.9.16 (2001-12-02) [umoeller]: added XOPEN_BINARY \r\n support
     1839 *@@changed V0.9.16 (2001-12-06) [umoeller]: added check for pFile != NULL
    18391840 */
    18401841
     
    18441845{
    18451846    APIRET arc = NO_ERROR;
    1846     if (!pcsz)
     1847    if ((!pFile) || (!pcsz))
    18471848        arc = ERROR_INVALID_PARAMETER;
    18481849    else
     
    19301931 *      The internal string buffer is limited to 2000
    19311932 *      characters. Length checking is _not_ performed.
     1933 *
     1934 *@@added V0.9.16 (2001-10-19) [umoeller]
     1935 *@@changed V0.9.16 (2001-12-06) [umoeller]: added check for pFile != NULL
    19321936 */
    19331937
     
    19361940                         ...)
    19371941{
    1938     APIRET arc;
    1939 
    1940     DATETIME dt;
    1941     CHAR szTemp[2000];
    1942     ULONG   ulLength;
    1943 
    1944     DosGetDateTime(&dt);
    1945     if (ulLength = sprintf(szTemp,
    1946                            "%04d-%02d-%02d %02d:%02d:%02d:%02d ",
    1947                            dt.year, dt.month, dt.day,
    1948                            dt.hours, dt.minutes, dt.seconds, dt.hundredths))
    1949     {
    1950         if (!(arc = doshWrite(pFile,
    1951                               szTemp,
    1952                               ulLength)))
     1942    APIRET arc = NO_ERROR;
     1943
     1944    if ((!pFile) || (!pcszFormat))
     1945        arc = ERROR_INVALID_PARAMETER;
     1946    else
     1947    {
     1948        DATETIME dt;
     1949        CHAR szTemp[2000];
     1950        ULONG   ulLength;
     1951
     1952        DosGetDateTime(&dt);
     1953        if (ulLength = sprintf(szTemp,
     1954                               "%04d-%02d-%02d %02d:%02d:%02d:%02d ",
     1955                               dt.year, dt.month, dt.day,
     1956                               dt.hours, dt.minutes, dt.seconds, dt.hundredths))
    19531957        {
    1954             va_list arg_ptr;
    1955             va_start(arg_ptr, pcszFormat);
    1956             ulLength = vsprintf(szTemp, pcszFormat, arg_ptr);
    1957             va_end(arg_ptr);
    1958 
    1959             if (pFile->flOpenMode & XOPEN_BINARY)
    1960                 // if we're in binary mode, we need to add \r too
    1961                 szTemp[ulLength++] = '\r';
    1962             szTemp[ulLength++] = '\n';
    1963 
    1964             arc = doshWrite(pFile,
    1965                             (PCSZ)szTemp,
    1966                             ulLength);
     1958            if (!(arc = doshWrite(pFile,
     1959                                  szTemp,
     1960                                  ulLength)))
     1961            {
     1962                va_list arg_ptr;
     1963                va_start(arg_ptr, pcszFormat);
     1964                ulLength = vsprintf(szTemp, pcszFormat, arg_ptr);
     1965                va_end(arg_ptr);
     1966
     1967                if (pFile->flOpenMode & XOPEN_BINARY)
     1968                    // if we're in binary mode, we need to add \r too
     1969                    szTemp[ulLength++] = '\r';
     1970                szTemp[ulLength++] = '\n';
     1971
     1972                arc = doshWrite(pFile,
     1973                                (PCSZ)szTemp,
     1974                                ulLength);
     1975            }
    19671976        }
    19681977    }
  • trunk/src/helpers/stringh.c

    r116 r122  
    6767 *      See stringh.c.
    6868 */
     69
     70/*
     71 *@@ strhStore:
     72 *      stores a copy of the given string in the specified
     73 *      buffer. Uses strdup internally.
     74 *
     75 *      If *ppszTarget != NULL, the previous string is freed
     76 *      and set to NULL.
     77 *      If pcszSource != NULL, a copy of it is stored in the
     78 *      buffer.
     79 *
     80 *@@added V0.9.16 (2001-12-06) [umoeller]
     81 */
     82
     83VOID strhStore(PSZ *ppszTarget,
     84               PCSZ pcszSource,
     85               PULONG pulLength)        // out: length of new string (ptr can be NULL)
     86{
     87    ULONG ulLength = 0;
     88
     89    if (ppszTarget)
     90    {
     91        if (*ppszTarget)
     92            free(*ppszTarget);
     93
     94        if (    (pcszSource)
     95             && (ulLength = strlen(pcszSource))
     96           )
     97        {
     98            if (*ppszTarget = (PSZ)malloc(ulLength + 1))
     99                memcpy(*ppszTarget, pcszSource, ulLength + 1);
     100        }
     101        else
     102            *ppszTarget = NULL;
     103    }
     104
     105    if (pulLength)
     106        *pulLength = ulLength;
     107}
    69108
    70109/*
Note: See TracChangeset for help on using the changeset viewer.