Ignore:
Timestamp:
Jan 19, 2002, 11:50:39 AM (24 years ago)
Author:
umoeller
Message:

Misc changes.

File:
1 edited

Legend:

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

    r131 r132  
    23822382                    pszContent[cbRead] = '\0';
    23832383                    *ppszContent = pszContent;
     2384                    if (pcbRead)
     2385                        *pcbRead = cbRead + 1;
    23842386                }
    23852387            }
     
    29782980
    29792981/*
     2982 *@@ doshQueryProcAddr:
     2983 *      attempts to resolve the given procedure from
     2984 *      the given module name. Saves you from querying
     2985 *      the module handle and all that.
     2986 *
     2987 *      This is intended for resolving undocumented
     2988 *      APIs from OS/2 system DLls such as PMMERGE
     2989 *      and DOSCALLS. It is assumed that the specified
     2990 *      module is already loaded.
     2991 *
     2992 *      Returns:
     2993 *
     2994 *      --  NO_ERROR
     2995 *
     2996 *      --  ERROR_INVALID_NAME
     2997 *
     2998 *      --  ERROR_INVALID_ORDINAL
     2999 *
     3000 *      plus the error codes of DosLoadModule.
     3001 *
     3002 *@@added V0.9.16 (2002-01-13) [umoeller]
     3003 */
     3004
     3005APIRET doshQueryProcAddr(PCSZ pcszModuleName,       // in: module name (e.g. "PMMERGE")
     3006                         ULONG ulOrdinal,           // in: proc ordinal
     3007                         PFN *ppfn)                 // out: proc address
     3008{
     3009    HMODULE hmod;
     3010    APIRET  arc;
     3011    if (!(arc = DosQueryModuleHandle((PSZ)pcszModuleName,
     3012                                     &hmod)))
     3013    {
     3014        if ((arc = DosQueryProcAddr(hmod,
     3015                                    ulOrdinal,
     3016                                    NULL,
     3017                                    ppfn)))
     3018        {
     3019            // the CP programming guide and reference says use
     3020            // DosLoadModule if DosQueryProcAddr fails with this error
     3021            if (arc == ERROR_INVALID_HANDLE)
     3022            {
     3023                if (!(arc = DosLoadModule(NULL,
     3024                                          0,
     3025                                          (PSZ)pcszModuleName,
     3026                                          &hmod)))
     3027                {
     3028                    arc = DosQueryProcAddr(hmod,
     3029                                           ulOrdinal,
     3030                                           NULL,
     3031                                           ppfn);
     3032                }
     3033            }
     3034        }
     3035    }
     3036
     3037    return (arc);
     3038}
     3039
     3040/*
    29803041 *@@ doshResolveImports:
    29813042 *      this function loads the module called pszModuleName
     
    29903051 */
    29913052
    2992 APIRET doshResolveImports(PSZ pszModuleName,    // in: DLL to load
     3053APIRET doshResolveImports(PCSZ pcszModuleName,    // in: DLL to load
    29933054                          HMODULE *phmod,       // out: module handle
    2994                           PRESOLVEFUNCTION paResolves, // in/out: function resolves
     3055                          PCRESOLVEFUNCTION paResolves, // in/out: function resolves
    29953056                          ULONG cResolves)      // in: array item count (not array size!)
    29963057{
     
    30003061    if (!(arc = DosLoadModule(szName,
    30013062                              sizeof(szName),
    3002                               pszModuleName,
     3063                              (PSZ)pcszModuleName,
    30033064                              phmod)))
    30043065    {
Note: See TracChangeset for help on using the changeset viewer.