Ignore:
Timestamp:
Jan 8, 2004, 5:43:29 PM (22 years ago)
Author:
umoeller
Message:

Fixes that have piled up in the last three months.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/dosh.c

    r253 r257  
    25882588 *@@changed V0.9.16 (2001-12-18) [umoeller]: fixed error codes
    25892589 *@@changed V1.0.1 (2003-01-10) [umoeller]: now allowing read for all modes
     2590 *@@changed V1.0.2 (2003-11-13) [umoeller]: optimized; now calling doshQueryPathSize only on failure
    25902591 */
    25912592
     
    26152616            // which isn't that meaningful
    26162617            // V0.9.16 (2001-12-08) [umoeller]
    2617             arc = doshQueryPathSize(pcszFilename,
    2618                                     pcbFile);
     2618            /* arc = doshQueryPathSize(pcszFilename,
     2619                                    pcbFile); */
     2620                // moved this down V1.0.2 (2003-11-13) [umoeller]
    26192621        break;
    26202622
     
    26252627                          | OPEN_ACCESS_READWRITE;
    26262628
    2627             arc = doshQueryPathSize(pcszFilename,
    2628                                     pcbFile);
     2629            /* arc = doshQueryPathSize(pcszFilename,
     2630                                    pcbFile); */
     2631                // moved this down V1.0.2 (2003-11-13) [umoeller]
    26292632        break;
    26302633
     
    26462649    }
    26472650
    2648     if ((!arc) && fsOpenFlags && pcbFile && ppFile)
     2651    if (    (!arc)
     2652         && fsOpenFlags
     2653         && pcbFile
     2654         && ppFile
     2655       )
    26492656    {
    26502657        PXFILE pFile;
     
    26952702                pFile->pszFilename = strdup(pcszFilename);
    26962703            }
    2697             #ifdef DEBUG_DOSOPEN
    26982704            else
    2699                  _Pmpf((__FUNCTION__ ": DosOpen returned %d for %s",
     2705            {
     2706                #ifdef DEBUG_DOSOPEN
     2707                    _Pmpf((__FUNCTION__ ": DosOpen returned %d for %s",
    27002708                             arc, pcszFilename));
    2701             #endif
     2709                #endif
     2710
     2711                // open failed: if the file doesn't exist, DosOpen only
     2712                // returns OPEN_FAILED, while ERROR_FILE_NOT_FOUND would
     2713                // be a bit more informative
     2714                // (this check used to be before DosOpen, but is a bit
     2715                // excessive and should only be run if we really have no open)
     2716                if (arc == ERROR_OPEN_FAILED)
     2717                    arc = doshQueryPathSize(pcszFilename,
     2718                                            pcbFile);
     2719            }
    27022720
    27032721            if (arc)
     
    27502768 *@@added V0.9.13 (2001-06-14) [umoeller]
    27512769 *@@changed V0.9.16 (2001-12-18) [umoeller]: now with XFILE, and always using FILE_BEGIN
    2752  *@@chaanged V0.9.19 (2002-04-02) [umoeller]: added params checking
     2770 *@@changed V0.9.19 (2002-04-02) [umoeller]: added params checking
     2771 *@@changed V1.0.2 (2003-11-13) [umoeller]: optimized cache (using realloc)
    27532772 */
    27542773
     
    28282847            #endif
    28292848
     2849#if 0
    28302850            // free old cache
    28312851            if (pFile->pbCache)
     
    28342854            // allocate new cache
    28352855            if (!(pFile->pbCache = (PBYTE)malloc(pFile->cbCache)))
     2856#else
     2857            // realloc is better V1.0.2 (2003-11-13) [umoeller]
     2858            if (!(pFile->pbCache = (PBYTE)realloc(pFile->pbCache,
     2859                                                  pFile->cbCache)))
     2860#endif
    28362861                arc = ERROR_NOT_ENOUGH_MEMORY;
    28372862            else
     
    44874512
    44884513/*
     4514 *@@ doshMyParentPID:
     4515 *      returns the PID of the parent of the current process.
     4516 *
     4517 *      This uses an interesting hack which is way
     4518 *      faster than DosGetInfoBlocks.
     4519 *
     4520 *@@added V1.0.2 (2003-11-13) [umoeller]
     4521 */
     4522
     4523ULONG doshMyParentPID(VOID)
     4524{
     4525    if (!G_pvLocalInfoSeg)
     4526        // first call:
     4527        GetInfoSegs();
     4528
     4529    // parent PID is at offset 2 in the local info seg
     4530    return *(PUSHORT)((PBYTE)G_pvLocalInfoSeg + 2);
     4531}
     4532
     4533/*
    44894534 *@@ doshMyTID:
    44904535 *      returns the TID of the current thread.
Note: See TracChangeset for help on using the changeset viewer.