Changeset 22


Ignore:
Timestamp:
Jan 14, 2001, 5:42:22 PM (25 years ago)
Author:
umoeller
Message:

Misc. updates.

Location:
trunk
Files:
6 edited

Legend:

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

    r20 r22  
    4949
    5050    PSZ prfhQueryKeysForApp(HINI hIni,
    51                             PSZ pszApp);
     51                            const char *pcszApp);
    5252
    5353    #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c
    5454        PSZ prfhQueryProfileDataDebug(HINI hIni,
    55                                       PSZ pszApp,
    56                                       PSZ pszKey,
     55                                      const char *pcszApp,
     56                                      const char *pcszKey,
    5757                                      PULONG pcbBuf,
    5858                                      const char *file,
     
    6262    #else
    6363        PSZ prfhQueryProfileData(HINI hIni,
    64                                 PSZ pszApp,
    65                                 PSZ pszKey,
    66                                 PULONG pcbBuf);
     64                                 const char *pcszApp,
     65                                 const char *pcszKey,
     66                                 PULONG pcbBuf);
    6767    #endif
    6868
    6969    CHAR prfhQueryProfileChar(HINI hini,
    70                               PSZ pszApp,
    71                               PSZ pszKey,
     70                              const char *pcszApp,
     71                              const char *pcszKey,
    7272                              CHAR cDefault);
    7373
    74     LONG prfhQueryColor(PSZ pszKeyName, PSZ pszDefault);
     74    LONG prfhQueryColor(const char *pcszKeyName, const char *pcszDefault);
    7575
    7676    /*
     
    105105
    106106    ULONG prfhCopyKey(HINI hiniSource,
    107                      PSZ pszSourceApp,
    108                      PSZ pszKey,
    109                      HINI hiniTarget,
    110                      PSZ pszTargetApp);
     107                      const char *pcszSourceApp,
     108                      const char *pcszKey,
     109                      HINI hiniTarget,
     110                      const char *pcszTargetApp);
    111111
    112112    ULONG prfhCopyApp(HINI hiniSource,
    113                       PSZ pszSourceApp,
     113                      const char *pcszSourceApp,
    114114                      HINI hiniTarget,
    115                       PSZ pszTargetApp,
     115                      const char *pcszTargetApp,
    116116                      PSZ pszErrorKey);
    117117
    118118    BOOL prfhSetUserProfile(HAB hab,
    119                             PSZ pszUserProfile);
     119                            const char *pcszUserProfile);
    120120
    121121    ULONG prfhINIError(ULONG ulOptions,
     
    125125
    126126    ULONG prfhINIError2(ULONG ulOptions,
    127                         PSZ pszINI,
     127                        const char *pcszINI,
    128128                        FILE* fLog,
    129129                        PFNWP fncbError,
  • trunk/src/helpers/dosh.c

    r21 r22  
    10171017        if (pulAttr)
    10181018            *pulAttr = fs3.attrFile;
    1019         else
    1020             arc = ERROR_INVALID_PARAMETER;
    10211019    }
    10221020
  • trunk/src/helpers/except.c

    r21 r22  
    228228#define INCL_DOSEXCEPTIONS
    229229#define INCL_DOSPROCESS
     230#define INCL_DOSMISC
    230231#define INCL_DOSERRORS
    231232#include <os2.h>
     
    456457                         PCONTEXTRECORD pContextRec)   // in: excpt info
    457458{
     459    ULONG       aulBuf[3];
     460    const char  *pcszVersion = "unknown";
     461
    458462    PTIB        ptib = NULL;
    459463    PPIB        ppib = NULL;
     
    463467    ULONG       ulObjNum,
    464468                ulOffset;
    465                 /* ulCountPages,
    466                 ulFlagsPage; */
    467     // APIRET      arc;
    468     // PULONG      pulStackWord;
    469                 // pulStackBegin;
    470469    ULONG       ul;
    471470
     
    498497        DosBeep( 250, 30);
    499498    }
     499
     500    // generic exception info
     501    DosQuerySysInfo(QSV_VERSION_MAJOR,      // 11
     502                    QSV_VERSION_MINOR,      // 12
     503                    &aulBuf, sizeof(aulBuf));
     504    // Warp 3 is reported as 20.30
     505    // Warp 4 is reported as 20.40
     506    // Aurora is reported as 20.45
     507
     508    if (aulBuf[0] == 20)
     509    {
     510        switch (aulBuf[1])
     511        {
     512            case 30: pcszVersion = "Warp 3"; break;
     513            case 40: pcszVersion = "Warp 4"; break;
     514            case 45: pcszVersion = "WSeB kernel"; break;
     515        }
     516    }
     517    fprintf(file,
     518            "Running OS/2 version: %u.%u (%s)\n",
     519            aulBuf[0],                      // major
     520            aulBuf[1],
     521            pcszVersion);
     522
    500523
    501524    // generic exception info
  • trunk/src/helpers/prfh.c

    r14 r22  
    8888
    8989PSZ prfhQueryKeysForApp(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
    90                         PSZ pszApp)     // in: application to query list for (or NULL for applications list)
     90                        const char *pcszApp)     // in: application to query list for (or NULL for applications list)
    9191{
    9292    PSZ     pKeys = NULL;
     
    9494
    9595    // get size of keys list for pszApp
    96     if (PrfQueryProfileSize(hIni, pszApp, NULL, &ulSizeOfKeysList))
     96    if (PrfQueryProfileSize(hIni, (PSZ)pcszApp, NULL, &ulSizeOfKeysList))
    9797    {
    9898        pKeys = (PSZ)malloc(ulSizeOfKeysList);
    99         if (!PrfQueryProfileData(hIni, pszApp, NULL, pKeys, &ulSizeOfKeysList))
     99        if (!PrfQueryProfileData(hIni, (PSZ)pcszApp, NULL, pKeys, &ulSizeOfKeysList))
    100100        {
    101101            free(pKeys);
     
    118118
    119119PSZ prfhQueryProfileDataDebug(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
    120                               PSZ pszApp,      // in: application to query
    121                               PSZ pszKey,      // in: key to query
     120                              const char *pcszApp,      // in: application to query
     121                              const char *pcszKey,      // in: key to query
    122122                              PULONG pcbBuf,   // out: size of the returned buffer
    123123                              const char *file,
     
    129129
    130130    // get size of data for pszApp/pszKey
    131     if (PrfQueryProfileSize(hIni, pszApp, pszKey, &ulSizeOfData))
     131    if (PrfQueryProfileSize(hIni, (PSZ)pcszApp, (PSZ)pcszKey, &ulSizeOfData))
    132132    {
    133133        if (ulSizeOfData)
    134134        {
    135135            pData = (PSZ)memdMalloc(ulSizeOfData, file, line, function);
    136             if (!PrfQueryProfileData(hIni, pszApp, pszKey, pData, &ulSizeOfData))
     136            if (!PrfQueryProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, pData, &ulSizeOfData))
    137137            {
    138138                free(pData);
     
    169169
    170170PSZ prfhQueryProfileData(HINI hIni,      // in: INI handle (can be HINI_USER or HINI_SYSTEM)
    171                          PSZ pszApp,     // in: application to query
    172                          PSZ pszKey,     // in: key to query
     171                         const char *pcszApp,     // in: application to query
     172                         const char *pcszKey,     // in: key to query
    173173                         PULONG pcbBuf)  // out: size of the returned buffer; ptr can be NULL
    174174{
     
    177177
    178178    // get size of data for pszApp/pszKey
    179     if (PrfQueryProfileSize(hIni, pszApp, pszKey, &ulSizeOfData))
     179    if (PrfQueryProfileSize(hIni, (PSZ)pcszApp, (PSZ)pcszKey, &ulSizeOfData))
    180180    {
    181181        if (ulSizeOfData)
    182182        {
    183183            pData = (PSZ)malloc(ulSizeOfData);
    184             if (!PrfQueryProfileData(hIni, pszApp, pszKey, pData, &ulSizeOfData))
     184            if (!PrfQueryProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, pData, &ulSizeOfData))
    185185            {
    186186                free(pData);
     
    208208
    209209CHAR prfhQueryProfileChar(HINI hini,        // in: INI handle (can be HINI_USER or HINI_SYSTEM)
    210                           PSZ pszApp,       // in: application to query
    211                           PSZ pszKey,       // in: key to query
     210                          const char *pcszApp,       // in: application to query
     211                          const char *pcszKey,       // in: key to query
    212212                          CHAR cDefault)    // in: default to return if not found
    213213{
     
    217217    szDefault[0] = cDefault;
    218218    szDefault[1] = 0;
    219     PrfQueryProfileString(HINI_USER, pszApp, pszKey,
     219    PrfQueryProfileString(HINI_USER, (PSZ)pcszApp, (PSZ)pcszKey,
    220220                          szDefault,
    221221                          szTemp, sizeof(szTemp)-1);
     
    263263 */
    264264
    265 LONG prfhQueryColor(PSZ pszKeyName, PSZ pszDefault)
     265LONG prfhQueryColor(const char *pcszKeyName,
     266                    const char *pcszDefault)
    266267{
    267268    CHAR szColor[30];
     
    270271                HINI_USER,
    271272                "PM_Colors",
    272                 pszKeyName,
    273                 pszDefault,
     273                (PSZ)pcszKeyName,
     274                (PSZ)pcszDefault,
    274275                szColor,
    275276                sizeof(szColor)-1);
     
    303304
    304305ULONG prfhCopyKey(HINI hiniSource,       // in: source profile (can be HINI_USER or HINI_SYSTEM)
    305                  PSZ pszSourceApp,      // in: source application
    306                  PSZ pszKey,            // in: source/target key
     306                 const char *pcszSourceApp,      // in: source application
     307                 const char *pcszKey,            // in: source/target key
    307308                 HINI hiniTarget,       // in: target profile (can be HINI_USER or HINI_SYSTEM)
    308                  PSZ pszTargetApp)      // in: target app
     309                 const char *pcszTargetApp)      // in: target app
    309310{
    310311    ULONG   ulSizeOfData = 0,
    311312            ulrc = 0;       // return: no error
    312313
    313     if (PrfQueryProfileSize(hiniSource, pszSourceApp, pszKey, &ulSizeOfData))
     314    if (PrfQueryProfileSize(hiniSource, (PSZ)pcszSourceApp, (PSZ)pcszKey, &ulSizeOfData))
    314315    {
    315316        PSZ pData = 0;
     
    332333        {
    333334            if (PrfQueryProfileData(hiniSource,
    334                                     pszSourceApp,
    335                                     pszKey,
     335                                    (PSZ)pcszSourceApp,
     336                                    (PSZ)pcszKey,
    336337                                    pData,
    337338                                    &ulSizeOfData))
    338339            {
    339340                if (!PrfWriteProfileData(hiniTarget,
    340                                          pszTargetApp,
    341                                          pszKey,
     341                                         (PSZ)pcszTargetApp,
     342                                         (PSZ)pcszKey,
    342343                                         pData,
    343344                                         ulSizeOfData))
     
    401402
    402403ULONG prfhCopyApp(HINI hiniSource,   // in: source profile (can be HINI_USER or HINI_SYSTEM)
    403                   PSZ pszSourceApp,  // in: source application
     404                  const char *pcszSourceApp,  // in: source application
    404405                  HINI hiniTarget,   // in: target profile (can be HINI_USER or HINI_SYSTEM)
    405                   PSZ pszTargetApp,  // in: name of pszSourceApp in hiniTarget
     406                  const char *pcszTargetApp,  // in: name of pszSourceApp in hiniTarget
    406407                  PSZ pszErrorKey)   // out: failing key in case of error; ptr can be NULL
    407408{
     
    412413        *pszErrorKey = 0;
    413414
    414     pszKeysList = prfhQueryKeysForApp(hiniSource, pszSourceApp);
     415    pszKeysList = prfhQueryKeysForApp(hiniSource, (PSZ)pcszSourceApp);
    415416    if (pszKeysList)
    416417    {
     
    421422            // copy this key
    422423            ulrc = prfhCopyKey(hiniSource,
    423                                pszSourceApp,
     424                               pcszSourceApp,
    424425                               pKey2,
    425426                               hiniTarget,
    426                                pszTargetApp);
     427                               pcszTargetApp);
    427428            if (ulrc)
    428429            {
     
    453454
    454455BOOL prfhSetUserProfile(HAB hab,
    455                         PSZ pszUserProfile)     // in: new user profile (.INI)
     456                        const char *pcszUserProfile)     // in: new user profile (.INI)
    456457{
    457458    BOOL    brc = FALSE;
     
    475476                // change INIs
    476477                free(Profiles.pszUserName);
    477                 Profiles.pszUserName = pszUserProfile;
    478                 Profiles.cchUserName = strlen(pszUserProfile) + 1;
     478                Profiles.pszUserName = (PSZ)pcszUserProfile;
     479                Profiles.cchUserName = strlen(pcszUserProfile) + 1;
    479480                brc = PrfReset(hab, &Profiles);
    480481                free(Profiles.pszSysName);
  • trunk/src/helpers/prfh2.c

    r14 r22  
    119119
    120120ULONG prfhINIError2(ULONG ulOptions,
    121                     PSZ pszINI,
     121                    const char *pcszINI,
    122122                    FILE* fLog,
    123123                    PFNWP fncbError,
     
    126126    CHAR szError2[2000];
    127127    sprintf(szError2, "An error occured copying the profile %s: \n%s",
    128             pszINI, pszErrorString);
     128            pcszINI, pszErrorString);
    129129    return (prfhINIError(ulOptions, fLog, fncbError, szError2));
    130130}
  • trunk/src/helpers/threads.c

    r21 r22  
    296296                                      0,
    297297                                      NULL);
    298     THREADINFO  ti = {0};
    299     thrCreate(&ti,
    300               pfn,
    301               NULL,
    302               THRF_PMMSGQUEUE,
    303               ulData);
    304     ti.hwndNotify = hwndNotify;
    305 
    306     while (WinGetMsg(hab,
    307                      &qmsg, 0, 0, 0))
    308     {
    309         // current message for our object window?
    310         if (    (qmsg.hwnd == hwndNotify)
    311              && (qmsg.msg == WM_USER)
    312            )
     298    if (hwndNotify)
     299    {
     300        THREADINFO  ti = {0};
     301        thrCreate(&ti,
     302                  pfn,
     303                  NULL,
     304                  THRF_PMMSGQUEUE,
     305                  ulData);
     306        ti.hwndNotify = hwndNotify;
     307
     308        while (WinGetMsg(hab,
     309                         &qmsg, 0, 0, 0))
    313310        {
    314             fQuit = TRUE;
    315             ulrc = (ULONG)qmsg.mp1;
     311            // current message for our object window?
     312            if (    (qmsg.hwnd == hwndNotify)
     313                 && (qmsg.msg == WM_USER)
     314               )
     315            {
     316                fQuit = TRUE;
     317                ulrc = (ULONG)qmsg.mp1;
     318            }
     319
     320            WinDispatchMsg(hab, &qmsg);
     321            if (fQuit)
     322                break;
    316323        }
    317324
    318         WinDispatchMsg(hab, &qmsg);
    319         if (fQuit)
    320             break;
    321     }
    322 
    323     // we must wait for the thread to finish, or
    324     // otherwise THREADINFO is deleted from the stack
    325     // before the thread exits... will crash!
    326     thrWait(&ti);
    327 
    328     WinDestroyWindow(hwndNotify);
     325        // we must wait for the thread to finish, or
     326        // otherwise THREADINFO is deleted from the stack
     327        // before the thread exits... will crash!
     328        thrWait(&ti);
     329
     330        WinDestroyWindow(hwndNotify);
     331    }
     332
    329333    return (ulrc);
    330334}
     
    367371        if (pti->tid)
    368372        {
    369             DosWaitThread(&(pti->tid), DCWW_WAIT);
     373            DosWaitThread(&pti->tid, DCWW_WAIT);
    370374            pti->tid = NULLHANDLE;
    371375            return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.