Changeset 229


Ignore:
Timestamp:
Nov 24, 2002, 9:45:05 PM (23 years ago)
Author:
umoeller
Message:

Sources as of 1.0.0.

Location:
trunk
Files:
36 edited

Legend:

Unmodified
Added
Removed
  • trunk/CVSROOT/commitinfo

    r228 r229  
    1515# in addition to the first matching regex or "DEFAULT".
    1616ALL d:\NOSAADM\bin\cvssec.exe CHECKCOMMIT
     17
  • trunk/CVSROOT/writeinfo

    r5 r229  
    1 /                                 *
    2 /CVSROOT                          ktk
     1/                                 umoeller
     2/CVSROOT                          umoeller,ktk
     3/include                          umoeller
     4/src                              umoeller
     5
  • trunk/include/helpers/comctl.h

    r214 r229  
    481481    #define SBCF_3DSUNK              0x0100
    482482    #define SBCF_3DEXPLORERSTYLE     0x0200
    483                 // new with V0.9.21 (2002-08-21) [umoeller]
     483                // new with V1.0.0 (2002-08-21) [umoeller]
    484484                // this simulates the Warp 4 entry field margins around the
    485485                // right split window, but leaves the left window flat
  • trunk/include/helpers/dialog.h

    r209 r229  
    106106                // flags for winhAdjustControls; any combination of
    107107                // XAC_MOVEX, XAC_MOVEY, XAC_SIZEX, XAC_SIZEY
    108                 // removed V0.9.21 (2002-08-18) [umoeller]
     108                // removed V1.0.0 (2002-08-18) [umoeller]
    109109
    110110        SIZEL       szlDlgUnits;
     
    244244
    245245    #define START_TABLE_EXT(fl)             { TYPE_START_NEW_TABLE, (ULONG)NULL, fl }
    246                 // added V0.9.21 (2002-08-16) [umoeller]
     246                // added V1.0.0 (2002-08-16) [umoeller]
    247247
    248248    #define START_TABLE_ALIGN START_TABLE_EXT(TABLE_ALIGN_COLUMNS)
     
    251251
    252252    #define START_GROUP_TABLE_EXT(pDef, fl) { TYPE_START_NEW_TABLE, (ULONG)pDef, fl }
    253                 // added V0.9.21 (2002-08-16) [umoeller]
     253                // added V1.0.0 (2002-08-16) [umoeller]
    254254
    255255    #define START_GROUP_TABLE_ALIGN(pDef) START_GROUP_TABLE_EXT(pDef, TABLE_ALIGN_COLUMNS)
  • trunk/include/helpers/dosh.h

    r220 r229  
    353353                            // drive was booted from
    354354
    355                 // media flags: all changed V0.9.21 (2002-08-31) [umoeller]
     355                // media flags: all changed V1.0.0 (2002-08-31) [umoeller]
    356356
    357357                #define DFL_MEDIA_PRESENT               0x0100
     
    371371                            // set for CD-ROMs only if the CD-ROM
    372372                            // door is currently open
    373                             // V0.9.21 (2002-08-31) [umoeller]
     373                            // V1.0.0 (2002-08-31) [umoeller]
    374374
    375375                #define DFL_SUPPORTS_EAS                0x0800
  • trunk/include/helpers/lan.h

    r114 r229  
    3232    #define LANH_HEADER_INCLUDED
    3333
    34     APIRET lanInit(VOID);
     34    #ifndef SNLEN
     35        #define CNLEN           15                  /* Computer name length     */
     36        #define UNCLEN          (CNLEN+2)           /* UNC computer name length */
     37        #define NNLEN           12                  /* 8.3 Net name length      */
     38        #define RMLEN           (UNCLEN+1+NNLEN)    /* Maximum remote name length */
     39
     40        #define SNLEN           15                  /* Service name length      */
     41        #define STXTLEN         63                  /* Service text length      */
     42    #endif
    3543
    3644    #pragma pack(1)
     45
     46    /*
     47     *@@ SERVER:
     48     *
     49     */
     50
    3751    typedef struct _SERVER
    3852    {
     
    4458        PSZ         pszComment;         // server comment
    4559    } SERVER, *PSERVER;
     60
     61    /*
     62     *@@ SERVICEBUF1:
     63     *
     64     */
     65
     66    typedef struct _SERVICEBUF1 // service_info_1
     67    {
     68        unsigned char   svci1_name[SNLEN+1];
     69        unsigned short  svci1_status;
     70        unsigned long   svci1_code;
     71        unsigned short  svci1_pid;
     72    } SERVICEBUF1, *PSERVICEBUF1;
     73
     74    /*
     75     *@@ SERVICEBUF2:
     76     *
     77     */
     78
     79    typedef struct _SERVICEBUF2 // service_info_2
     80    {
     81        unsigned char   svci2_name[SNLEN+1];   /* service name                  */
     82        unsigned short  svci2_status;          /* See status values below       */
     83        unsigned long   svci2_code;            /* install code of service       */
     84        unsigned short  svci2_pid;             /* pid of service program        */
     85        unsigned char   svci2_text[STXTLEN+1]; /* text area for use by services */
     86    } SERVICEBUF2, *PSERVICEBUF2;
     87
    4688    #pragma pack()
     89
     90    #ifndef SV_TYPE_ALL
     91        #define SV_TYPE_ALL             0xFFFFFFFF   /* handy for NetServerEnum2 */
     92    #endif
     93
     94    #ifndef SERVICE_INSTALL_STATE
     95        #define SERVICE_INSTALL_STATE           0x03
     96        #define SERVICE_UNINSTALLED             0x00
     97                    // service stopped (not running)
     98        #define SERVICE_INSTALL_PENDING         0x01
     99                    // service start pending
     100        #define SERVICE_UNINSTALL_PENDING       0x02
     101                    // service stop pending
     102        #define SERVICE_INSTALLED               0x03
     103                    // service started
     104
     105        #define SERVICE_PAUSE_STATE             0x0C
     106        #define SERVICE_ACTIVE                  0x00
     107                    // service active (not paused)
     108        #define SERVICE_CONTINUE_PENDING        0x04
     109                    // service continue pending
     110        #define SERVICE_PAUSE_PENDING           0x08
     111                    // service pause pending
     112        #define SERVICE_PAUSED                  0x0C
     113                    // service paused
     114
     115        #define SERVICE_NOT_UNINSTALLABLE       0x00
     116                    // service cannot be stopped
     117        #define SERVICE_UNINSTALLABLE           0x10
     118                    // service can be stopped
     119
     120        #define SERVICE_NOT_PAUSABLE            0x00
     121                    // service cannot be paused
     122        #define SERVICE_PAUSABLE                0x20
     123                    // service can be paused
     124
     125        /* Requester service only:
     126         * Bits 8,9,10 -- redirection paused/active */
     127
     128        #define SERVICE_REDIR_PAUSED            0x700
     129        #define SERVICE_REDIR_DISK_PAUSED       0x100
     130                    // redirector for disks paused
     131        #define SERVICE_REDIR_PRINT_PAUSED      0x200
     132                    // redirector for spooled devices paused
     133        #define SERVICE_REDIR_COMM_PAUSED       0x400
     134                    // redirector for serial devices paused
     135
     136        #define SERVICE_CTRL_INTERROGATE        0
     137        #define SERVICE_CTRL_PAUSE              1
     138        #define SERVICE_CTRL_CONTINUE           2
     139        #define SERVICE_CTRL_UNINSTALL          3
     140    #endif
     141
     142    APIRET lanInit(VOID);
    47143
    48144    APIRET lanQueryServers(PSERVER *paServers,
    49145                           ULONG *pcServers);
    50146
     147    APIRET lanServiceGetInfo(PCSZ pcszServiceName,
     148                             PSERVICEBUF2 pBuf);
     149
     150    APIRET lanServiceInstall(PCSZ pcszServiceName,
     151                             PSERVICEBUF2 pBuf2);
     152
     153    APIRET lanServiceControl(PCSZ pcszServiceName,
     154                             ULONG opcode,
     155                             PSERVICEBUF2 pBuf2);
    51156#endif
    52157
  • trunk/include/helpers/pmsems.h

    r208 r229  
    3939     *      the OS/2 debugging handbook.
    4040     *
    41      *@@added V0.9.21 (2002-08-12) [umoeller]
     41     *@@added V1.0.0 (2002-08-12) [umoeller]
    4242     */
    4343
  • trunk/include/helpers/prfh.h

    r216 r229  
    6565                    // PrfReset failed V0.9.19 (2002-04-02) [umoeller]
    6666
    67     #define ERROR_PRF_LAST              (ERROR_PRF_FIRST + 11)
     67    #define PRFERR_INVALID_APP_NAME     (ERROR_PRF_FIRST + 12)
     68                    // V1.0.0 (2002-09-17) [umoeller]
     69    #define PRFERR_INVALID_KEY_NAME     (ERROR_PRF_FIRST + 13)
     70                    // V1.0.0 (2002-09-17) [umoeller]
     71
     72    #define ERROR_PRF_LAST              (ERROR_PRF_FIRST + 13)
    6873
    6974    /* ******************************************************************
     
    110115            // V0.9.19 (2002-04-17) [umoeller]
    111116
    112     // class replacements list V0.9.21 (2002-08-26) [umoeller]
     117    // class replacements list V1.0.0 (2002-08-26) [umoeller]
    113118    DECLARE_PRFH_STRING(WPINIAPP_REPLACEMENTS, "PM_Workplace:ReplaceList");
    114119
  • trunk/include/helpers/xprf.h

    r113 r229  
    135135     ********************************************************************/
    136136
    137     #define XINI_MAGIC_BYTES    "hjba78j,"
    138 
    139137    #ifdef LINKLIST_HEADER_INCLUDED
     138
     139        #define XINI_MAGIC_BYTES "xpRfMa\x03"
     140
    140141        /*
    141142         *@@ XINI:
     
    151152            CHAR    acMagic[sizeof(XINI_MAGIC_BYTES)];
    152153                                // magic bytes for security
     154                                // removed V1.0.0 (2002-09-20) [umoeller]
    153155            CHAR    szFilename[CCHMAXPATH];
     156
    154157            HFILE   hFile;      // returned by DosProtectOpen
    155             FHLOCK  hLock;      // lock ID of DosProtectOpen
     158            // FHLOCK  hLock;      // lock ID of DosProtectOpen
     159                        // removed V1.0.0 (2002-09-20) [umoeller]
    156160            BOOL    fDirty;     // TRUE if changed and needs to be flushed
    157161                                // on close
     
    159163            // applications list
    160164            LINKLIST    llApps;             // contains PXINIAPPDATA items
    161             ULONG       cApps;              // count of items on list
    162165        } XINI, *PXINI;
    163166    #else
     
    168171                           PXINI *ppxini);
    169172
    170     BOOL xprfCloseProfile(PXINI hIni);
    171 
    172     /* BOOL xprfQueryProfileData(PXINI hIni,
    173                        const char *pcszApp,
    174                        const char *pcszKey,
    175                        PVOID pBuffer,
    176                        PULONG pulBufferMax); */
    177 
    178     BOOL xprfWriteProfileData(PXINI hIni,
    179                        const char *pcszApp,
    180                        const char *pcszKey,
    181                        PVOID pData,
    182                        ULONG ulDataLen);
     173    APIRET xprfCloseProfile(PXINI hIni);
     174
     175    APIRET xprfQueryProfileSize(PXINI pXIni,
     176                                PCSZ pszAppName,
     177                                PCSZ pszKeyName,
     178                                PULONG pulDataLen);
     179
     180    APIRET xprfQueryProfileData(PXINI pXIni,
     181                                PCSZ pszAppName,
     182                                PCSZ pszKeyName,
     183                                PVOID pBuffer,
     184                                PULONG pulBufferMax);
     185
     186    APIRET xprfWriteProfileData(PXINI hIni,
     187                                const char *pcszApp,
     188                                const char *pcszKey,
     189                                PVOID pData,
     190                                ULONG ulDataLen);
     191
     192    APIRET xprfQueryKeysForApp(PXINI hIni,
     193                               PCSZ pcszApp,
     194                               PSZ *ppszKeys);
    183195
    184196    /* ******************************************************************
     
    209221
    210222    APIRET xprfCopyKey(HINI hiniSource,
    211                        PSZ pszSourceApp,
    212                        PSZ pszKey,
     223                       PCSZ pszSourceApp,
     224                       PCSZ pszKey,
    213225                       PXINI hiniTarget,
    214                        PSZ pszTargetApp);
     226                       PCSZ pszTargetApp);
     227
     228    APIRET xprfCopyKey2(PXINI hiniSource,
     229                        PCSZ pszSourceApp,
     230                        PCSZ pszKey,
     231                        HINI hiniTarget,
     232                        PCSZ pszTargetApp);
    215233
    216234    APIRET xprfCopyApp(HINI hiniSource,
    217                        PSZ pszSourceApp,
     235                       PCSZ pszSourceApp,
    218236                       PXINI hiniTarget,
    219                        PSZ pszTargetApp,
     237                       PCSZ pszTargetApp,
    220238                       PSZ pszErrorKey);
    221239
     240    APIRET xprfCopyApp2(PXINI hiniSource,
     241                        PCSZ pszSourceApp,
     242                        HINI hiniTarget,
     243                        PCSZ pszTargetApp,
     244                        PSZ pszErrorKey);
     245
    222246    APIRET xprfCopyProfile(HINI hOld,
    223                            PSZ pszNew,
     247                           PCSZ pszNew,
    224248                           PFN_PRF_PROGRESS pfnProgressCallback,
    225249                           ULONG ulUser,
    226250                           ULONG ulCount,
    227                            ULONG ulMax);
     251                           ULONG ulMax,
     252                           PSZ pszFailingApp);
    228253
    229254    APIRET xprfSaveINIs(HAB hab,
    230255                        PFN_PRF_PROGRESS pfnProgressCallback,
    231                         ULONG ulUser);
     256                        ULONG ulUser,
     257                        PSZ pszFailingINI,
     258                        PSZ pszFailingApp,
     259                        PSZ pszFailingKey);
    232260#endif
    233261
  • trunk/src/helpers/apps.c

    r223 r229  
    410410 *      representation in OS/2.)
    411411 *
    412  *@@added V0.9.21 (2002-09-04) [bird]
     412 *@@added V1.0.0 (2002-09-04) [bird]
    413413 */
    414414
     
    834834 *
    835835 *@@added V0.9.20 (2002-07-03) [umoeller]
    836  *@@changed V0.9.21 (2002-08-21) [umoeller]: now allowing for UNC
     836 *@@changed V1.0.0 (2002-08-21) [umoeller]: now allowing for UNC
    837837 */
    838838
     
    845845    // check if the executable is fully qualified; if so,
    846846    // check if the executable file exists
    847     if (    // allow UNC V0.9.21 (2002-08-21) [umoeller]
     847    if (    // allow UNC V1.0.0 (2002-08-21) [umoeller]
    848848            (    (pDetails->pszExecutable[0] == '\\')
    849849              && (pDetails->pszExecutable[1] == '\\')
     
    889889 *@@changed V0.9.12 (2001-05-27) [umoeller]: moved from winh.c to apps.c
    890890 *@@changed V0.9.20 (2002-07-03) [umoeller]: now always qualifying executable to fix broken BAT files
    891  *@@changed V0.9.21 (2002-08-12) [umoeller]: this didn't work for batch and cmd files that had "+" characters in their full path, fixed
     891 *@@changed V1.0.0 (2002-08-12) [umoeller]: this didn't work for batch and cmd files that had "+" characters in their full path, fixed
    892892 */
    893893
     
    917917
    918918    // if the path has spaces, or other invalid characters,
    919     // include it in quotes V0.9.21 (2002-08-12) [umoeller]
     919    // include it in quotes V1.0.0 (2002-08-12) [umoeller]
    920920    if (fQuotes = !!strpbrk(pProgDetails->pszExecutable, " +&|="))
    921921        xstrcatc(pstrParams, '"');
     
    931931
    932932    if (fQuotes)
    933         xstrcatc(pstrParams, '"');      // V0.9.21 (2002-08-12) [umoeller]
     933        xstrcatc(pstrParams, '"');      // V1.0.0 (2002-08-12) [umoeller]
    934934
    935935    if (pszOldParams)
     
    11281128 *@@changed V0.9.20 (2002-07-03) [umoeller]: fixed Win-OS/2 full screen breakage
    11291129 *@@changed V0.9.20 (2002-07-03) [umoeller]: fixed broken bat and cmd files when PROG_DEFAULT was set
    1130  *@@changed V0.9.21 (2002-08-18) [umoeller]: fixed cmd and bat files that had "=" in their paths
     1130 *@@changed V1.0.0 (2002-08-18) [umoeller]: fixed cmd and bat files that had "=" in their paths
    11311131 */
    11321132
     
    11441144    ULONG           ulIsWinApp;
    11451145
    1146     // parameter checking extended V0.9.21 (2002-08-21) [umoeller]
     1146    // parameter checking extended V1.0.0 (2002-08-21) [umoeller]
    11471147    if (    (!pcProgDetails)
    11481148         || (!pcProgDetails->pszExecutable)
     
    13081308            }
    13091309
    1310 // V0.9.21: this define is never set. I have thus completely
     1310// V1.0.0: this define is never set. I have thus completely
    13111311// disabled the batch hacks that we used to provide, that is
    13121312// we no longer change the "c:\path\batch.cmd" to "cmd.exe /c c:\path\batch.cmd"
     
    20162016 *@@changed V0.9.20 (2002-08-10) [umoeller]: fixed missing destroy window, made wait optional
    20172017 *@@changed V0.9.20 (2002-08-10) [umoeller]: added pcszWorkingDir
    2018  *@@changed V0.9.21 (2002-08-18) [umoeller]: changed prototype to return APIRET
     2018 *@@changed V1.0.0 (2002-08-18) [umoeller]: changed prototype to return APIRET
    20192019 */
    20202020
     
    20832083 *
    20842084 *@@added V0.9.20 (2002-08-10) [umoeller]
    2085  *@@changed V0.9.21 (2002-08-21) [umoeller]: changed prototype to return browser
     2085 *@@changed V1.0.0 (2002-08-21) [umoeller]: changed prototype to return browser
    20862086 */
    20872087
  • trunk/src/helpers/cctl_checkcnr.c

    r224 r229  
    863863 *@@ FINDCHECKRECORD:
    864864 *
    865  *@@added V0.9.21 (2002-09-09) [umoeller]
     865 *@@added V1.0.0 (2002-09-09) [umoeller]
    866866 */
    867867
     
    882882 *
    883883 *@@added V0.9.0 (99-11-28) [umoeller]
    884  *@@changed V0.9.21 (2002-09-09) [umoeller]: adjusted for cnrhForAllRecords updates
     884 *@@changed V1.0.0 (2002-09-09) [umoeller]: adjusted for cnrhForAllRecords updates
    885885 */
    886886
     
    907907 *
    908908 *@@added V0.9.1 (99-12-03) [umoeller]
    909  *@@changed V0.9.21 (2002-09-09) [umoeller]: adjusted for cnrhForAllRecords updates
     909 *@@changed V1.0.0 (2002-09-09) [umoeller]: adjusted for cnrhForAllRecords updates
    910910 */
    911911
  • trunk/src/helpers/cctl_splitwin.c

    r222 r229  
    9595 *
    9696 *@@added V0.9.1 (2000-02-05) [umoeller]
    97  *@@changed V0.9.21 (2002-08-24) [umoeller]: added SBCF_3DEXPLORERSTYLE
     97 *@@changed V1.0.0 (2002-08-24) [umoeller]: added SBCF_3DEXPLORERSTYLE
    9898 */
    9999
     
    118118            if (pData->sbcd.ulCreateFlags & SBCF_3DEXPLORERSTYLE)
    119119            {
    120                 // this style is new with V0.9.21 (2002-08-24) [umoeller];
     120                // this style is new with V1.0.0 (2002-08-24) [umoeller];
    121121                // simulate the Warp 4 entry field margins around the
    122122                // right control only, but leave the left control flat.
     
    443443
    444444        if (!(pData->sbcd.ulCreateFlags & (SBCF_3DSUNK | SBCF_3DEXPLORERSTYLE)))
    445                         // V0.9.21 (2002-08-31) [umoeller]
     445                        // V1.0.0 (2002-08-31) [umoeller]
    446446        {
    447447            GpiSetColor(hps, pData->lcol3DLight);
     
    797797                pData->hwndLinked2 = NULLHANDLE;
    798798
    799                 // caching these colors now V0.9.21 (2002-08-21) [umoeller]
     799                // caching these colors now V1.0.0 (2002-08-21) [umoeller]
    800800                pData->lcol3DDark = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0);
    801801                pData->lcol3DLight = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0);
     
    823823 *
    824824 *@@added V0.9.0 [umoeller]
    825  *@@changed V0.9.21 (2002-08-24) [umoeller]: added support for SBCF_3DEXPLORERSTYLE
     825 *@@changed V1.0.0 (2002-08-24) [umoeller]: added support for SBCF_3DEXPLORERSTYLE
    826826 */
    827827
  • trunk/src/helpers/cctl_tooltip.c

    r222 r229  
    224224    MRESULT mrc = 0;
    225225
    226     PFNWP           pfnwpOrig = NULL;
     226    PFNWP   pfnwpOrig = NULL;
    227227
    228228    if (LockSubclassedTools())
    229229    {
    230         PSUBCLASSEDTOOL pst = FindSubclassedTool(hwndTool);
    231 
    232         if (pst)
     230        PSUBCLASSEDTOOL pst;
     231
     232        if (pst = FindSubclassedTool(hwndTool))
    233233        {
    234234            pfnwpOrig = pst->pfnwpOrig;     // call default
     
    254254                               (MPARAM)0,
    255255                               (MPARAM)&qmsg);
    256                 break; }
     256                }
     257                break;
    257258
    258259                case WM_DESTROY:
    259                     lstRemoveItem(&G_llSubclassedTools, pst);         // this frees the item
     260                    lstRemoveItem(&G_llSubclassedTools, pst);
     261                            // this frees the item
    260262                break;
    261263            }
     
    14661468
    14671469            case WM_PRESPARAMCHANGED:
    1468             {
    1469                 LONG    lPPIndex = (LONG)mp1;
    1470                 switch (lPPIndex)
     1470
     1471                switch ((LONG)mp1)      // pp index
    14711472                {
    14721473                    case 0:     // layout palette thing dropped
     
    14781479                        UpdateTooltipPresColors(hwndTooltip);
    14791480                }
    1480             break; }
     1481
     1482            break;
    14811483
    14821484            /*
     
    19001902                PTOOLTIPDATA pttd = (PTOOLTIPDATA)WinQueryWindowPtr(hwndTooltip, 1);
    19011903                mrc = (MPARAM)lstCountItems(&pttd->llTools);
    1902             break; }
     1904            }
     1905            break;
    19031906
    19041907            /*
  • trunk/src/helpers/cnrh.c

    r224 r229  
    15791579 *
    15801580 *@@added V0.9.0 [umoeller]
    1581  *@@changed V0.9.21 (2002-09-09) [umoeller]: rewritten to support deletion in callback
    1582  *@@changed V0.9.21 (2002-09-09) [umoeller]: added support for precParent = -1
    1583  *@@changed V0.9.21 (2002-09-09) [umoeller]: changed prototype and callback prototype
     1581 *@@changed V1.0.0 (2002-09-09) [umoeller]: rewritten to support deletion in callback
     1582 *@@changed V1.0.0 (2002-09-09) [umoeller]: added support for precParent = -1
     1583 *@@changed V1.0.0 (2002-09-09) [umoeller]: changed prototype and callback prototype
    15841584 */
    15851585
     
    16221622        // get the next record BEFORE calling the callback
    16231623        // in case the callback removes the record
    1624         // V0.9.21 (2002-09-09) [umoeller]
     1624        // V1.0.0 (2002-09-09) [umoeller]
    16251625        PRECORDCORE precNext = (PRECORDCORE)WinSendMsg(hwndCnr,
    16261626                                                       CM_QUERYRECORD,
     
    16291629                                                                    CMA_ITEMORDER));
    16301630
    1631         if (fRecurse)   // V0.9.21 (2002-09-09) [umoeller]
     1631        if (fRecurse)   // V1.0.0 (2002-09-09) [umoeller]
    16321632            // recurse for the record we found
    16331633            ulrc += cnrhForAllRecords(hwndCnr,
  • trunk/src/helpers/comctl.c

    r222 r229  
    182182 *      turns the given static control into a 3D separator line.
    183183 *
    184  *@@added V0.9.21 (2002-08-12) [umoeller]
     184 *@@added V1.0.0 (2002-08-12) [umoeller]
    185185 */
    186186
  • trunk/src/helpers/debug.c

    r222 r229  
    4444 */
    4545
    46 //#define DEBUG_SYMDUMP // enable to dump sym file to log V0.9.21 (2002-08-21) [paperino]
     46//#define DEBUG_SYMDUMP // enable to dump sym file to log V1.0.0 (2002-08-21) [paperino]
    4747
    4848#define OS2EMX_PLAIN_CHAR
     
    15371537
    15381538    // open .SYM file
    1539 #ifdef DEBUG_SYMDUMP    // V0.9.21 (2002-08-21) [paperino]
     1539#ifdef DEBUG_SYMDUMP    // V1.0.0 (2002-08-21) [paperino]
    15401540    fprintf(LogFile,"Dump of '%s' for object %d\n",SymFileName,Object);
    15411541#endif
     
    15911591            for (SymNum = 0; SymNum < SegDef.cSymbols; SymNum++)
    15921592            {
    1593                 // fixed syms > 64 K V0.9.21 (2002-08-21) [paperino]
     1593                // fixed syms > 64 K V1.0.0 (2002-08-21) [paperino]
    15941594                if (SegDef.bFlags & 0x01)
    15951595                {
  • trunk/src/helpers/dialog.c

    r222 r229  
    1111 *
    1212 *      See @dlg_algorithm for the gory details of the new
    13  *      algorithm used since V0.9.21. Even though much
     13 *      algorithm used since V1.0.0. Even though much
    1414 *      of this file was rewritten, the new dialog is
    1515 *      backwards-compatible with all the hacks that existing
     
    254254 *
    255255 *      We now use the CSS box model for the dialog
    256  *      formatter (V0.9.21).
     256 *      formatter (V1.0.0).
    257257 *
    258258 +      ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
     
    323323 *          certain controls automatically. See CalcAutoSize.
    324324 *
    325  *      The algorithm used here has been greatly reworked with V0.9.21.
     325 *      The algorithm used here has been greatly reworked with V1.0.0.
    326326 *      Essentially, the new trick is that we first compute all widths
    327327 *      (which requires several iterations since widths may now inherit
     
    573573 *
    574574 *      See @dlg_algorithm for the new algorithm
    575  *      used since V0.9.21.
    576  *
    577  *      With V0.9.21, we now follow the CSS box model
     575 *      used since V1.0.0.
     576 *
     577 *      With V1.0.0, we now follow the CSS box model
    578578 *      to render these things better without all
    579579 *      the hacks I am no longer able to understand
    580580 *      myself. See @dlg_box_model for details.
    581581 *
    582  *@@changed V0.9.21 (2002-08-18) [umoeller]: completely replaced
     582 *@@changed V1.0.0 (2002-08-18) [umoeller]: completely replaced
    583583 */
    584584
     
    602602
    603603    ULONG       ulColumnIndex;      // zero-based column index in parent row
    604                                     // V0.9.21 (2002-08-18) [umoeller]
     604                                    // V1.0.0 (2002-08-18) [umoeller]
    605605
    606606    // b) information for control window to be created:
     
    628628    RECTL       rclPadding,         // spacing, in pixels, to apply to the four borders of
    629629                rclMargin;          // the content to get the box; calculated from CONTROLDEF
    630                                     // V0.9.21 (2002-08-16) [umoeller]
     630                                    // V1.0.0 (2002-08-16) [umoeller]
    631631
    632632    LONG        cxSpacingTotal;     // sum of rclPadding and rclMargin xLeft and
     
    684684
    685685    ULONG       cColumns;           // no. of columns in this row
    686                                     // V0.9.21 (2002-08-18) [umoeller]
     686                                    // V1.0.0 (2002-08-18) [umoeller]
    687687
    688688    // result data after recursion:
     
    767767 *      set.
    768768 *
    769  *@@added V0.9.21 (2002-08-16) [umoeller]
     769 *@@added V1.0.0 (2002-08-16) [umoeller]
    770770 */
    771771
     
    827827 *      set.
    828828 *
    829  *@@added V0.9.21 (2002-08-16) [umoeller]
     829 *@@added V1.0.0 (2002-08-16) [umoeller]
    830830 */
    831831
     
    949949 *@@changed V0.9.16 (2001-10-15) [umoeller]: added APIRET
    950950 *@@changed V0.9.16 (2002-02-02) [umoeller]: added ulWidth
    951  *@@changed V0.9.21 (2002-08-18) [umoeller]: renamed; moved multi-line processing to CalcAutoSizeTextMulti
     951 *@@changed V1.0.0 (2002-08-18) [umoeller]: renamed; moved multi-line processing to CalcAutoSizeTextMulti
    952952 */
    953953
     
    984984 *      static text controls.
    985985 *
    986  *@@added V0.9.21 (2002-08-18) [umoeller]
     986 *@@added V1.0.0 (2002-08-18) [umoeller]
    987987 */
    988988
     
    10301030 *
    10311031 *@@added V0.9.20 (2002-08-10) [umoeller]
    1032  *@@changed V0.9.21 (2002-08-18) [umoeller]: removed temp windows list
     1032 *@@changed V1.0.0 (2002-08-18) [umoeller]: removed temp windows list
    10331033 */
    10341034
     
    12241224 *@@changed V0.9.16 (2001-10-15) [umoeller]: added APIRET
    12251225 *@@changed V0.9.19 (2002-04-24) [umoeller]: fixed PM groups alignment
    1226  *@@changed V0.9.21 (2002-08-16) [umoeller]: adjusted for new algorithm
     1226 *@@changed V1.0.0 (2002-08-16) [umoeller]: adjusted for new algorithm
    12271227 */
    12281228
     
    12901290 *@@changed V0.9.19 (2002-04-17) [umoeller]: fixes for the STUPID drop-down comboboxes
    12911291 *@@changed V0.9.19 (2002-04-24) [umoeller]: fixed PM groups alignment
    1292  *@@changed V0.9.21 (2002-08-16) [umoeller]: adjusted for new algorithm
    1293  *@@changed V0.9.21 (2002-08-18) [umoeller]: setting entry field length to CCHMAXPATH per default now
     1292 *@@changed V1.0.0 (2002-08-16) [umoeller]: adjusted for new algorithm
     1293 *@@changed V1.0.0 (2002-08-18) [umoeller]: setting entry field length to CCHMAXPATH per default now
    12941294 */
    12951295
     
    13231323                flStyle = pColumn->flStyle;
    13241324
    1325                 // V0.9.21 (2002-08-16) [umoeller]
     1325                // V1.0.0 (2002-08-16) [umoeller]
    13261326                // Removed all the terrible hacks for the PM group
    13271327                // control. We now use rclPadding and rclMargin
     
    13551355    }
    13561356
    1357     if (    (!arc)            // check error code V0.9.21 (2002-08-16) [umoeller]
     1357    if (    (!arc)            // check error code V1.0.0 (2002-08-16) [umoeller]
    13581358         && (pcszClass)
    13591359       )
     
    13651365        PCSZ        pcszTextEF = NULL;          // for entry field
    13661366
    1367         // V0.9.21 (2002-08-16) [umoeller]
     1367        // V1.0.0 (2002-08-16) [umoeller]
    13681368        // determine the position where to create the
    13691369        // control; this is the content box, to which
     
    14481448                    // defer setting the text because we should
    14491449                    // first set the entry field limit
    1450                     // V0.9.21 (2002-08-18) [umoeller]
     1450                    // V1.0.0 (2002-08-18) [umoeller]
    14511451                    pcszTextEF = pcszText;
    14521452                    pcszText = "";          // for now
     
    15321532                    // set text limit to CCHMAXPATH per default,
    15331533                    // and set the real text now
    1534                     // V0.9.21 (2002-08-18) [umoeller]
     1534                    // V1.0.0 (2002-08-18) [umoeller]
    15351535                    winhSetEntryFieldLimit(pColumn->hwndControl, CCHMAXPATH);
    15361536                    WinSetWindowText(pColumn->hwndControl, (PSZ)pcszTextEF);
     
    16341634 *@@changed V0.9.12 (2001-05-31) [umoeller]: fixed font problems
    16351635 *@@changed V0.9.20 (2002-08-08) [umoeller]: added support for aligning columns horizontally
    1636  *@@changed V0.9.21 (2002-08-16) [umoeller]: calc size rewritten for new algorithm
     1636 *@@changed V1.0.0 (2002-08-16) [umoeller]: calc size rewritten for new algorithm
    16371637 */
    16381638
     
    16551655
    16561656        case PROCESS_1_CALC_MIN_WIDTHS:
    1657             // rewritten V0.9.21 (2002-08-16) [umoeller]
     1657            // rewritten V1.0.0 (2002-08-16) [umoeller]
    16581658
    16591659            if (!pColumn->pNestedTable)
     
    17231723
    17241724        case PROCESS_2_CALC_RELATIVE_WIDTHS:
    1725             // rewritten V0.9.21 (2002-08-16) [umoeller]
     1725            // rewritten V1.0.0 (2002-08-16) [umoeller]
    17261726
    17271727            if (!pColumn->pNestedTable)
     
    18161816
    18171817        case PROCESS_3_ALIGN_COLUMNS:
    1818             // rewritten V0.9.21 (2002-08-16) [umoeller]
     1818            // rewritten V1.0.0 (2002-08-16) [umoeller]
    18191819
    18201820            if (!pColumn->pNestedTable)
     
    21012101 *      in the row.
    21022102 *
    2103  *@@changed V0.9.21 (2002-08-16) [umoeller]: adjusted for new algorithm
     2103 *@@changed V1.0.0 (2002-08-16) [umoeller]: adjusted for new algorithm
    21042104 */
    21052105
     
    21992199 *      to which the nested table belongs.
    22002200 *
    2201  *@@changed V0.9.21 (2002-08-16) [umoeller]: adjusted for new algorithm
     2201 *@@changed V1.0.0 (2002-08-16) [umoeller]: adjusted for new algorithm
    22022202 */
    22032203
     
    22202220            // as a separate step (PROCESS_2_INHERIT_TABLE_SIZES),
    22212221            // but we can save ourselves a loop here
    2222             // V0.9.21 (2002-08-16) [umoeller]
     2222            // V1.0.0 (2002-08-16) [umoeller]
    22232223            if (pTableDef->flTable & TABLE_INHERIT_SIZE)
    22242224            {
     
    23932393 *@@ CreateColumn:
    23942394 *
    2395  *@@changed V0.9.21 (2002-08-18) [umoeller]: mostly rewritten for new algorithm
     2395 *@@changed V1.0.0 (2002-08-18) [umoeller]: mostly rewritten for new algorithm
    23962396 */
    23972397
     
    24912491                                      + pColumn->rclMargin.xRight;
    24922492
    2493             // set the column index V0.9.21 (2002-08-18) [umoeller]
     2493            // set the column index V1.0.0 (2002-08-18) [umoeller]
    24942494            pColumn->ulColumnIndex = (pCurrentRow->cColumns)++;
    24952495
     
    27452745                                         pCurrentRow,
    27462746                                         FALSE,        // no nested table
    2747                                          (const CONTROLDEF *)pItemThis->ul1, // pCtlDef, V0.9.21 (2002-08-18) [umoeller]
     2747                                         (const CONTROLDEF *)pItemThis->ul1, // pCtlDef, V1.0.0 (2002-08-18) [umoeller]
    27482748                                         &pColumn)))
    27492749                    lstAppendItem(&pCurrentRow->llColumns,
     
    28042804 *
    28052805 *@@added V0.9.15 (2001-08-26) [umoeller]
    2806  *@@changed V0.9.21 (2002-08-16) [umoeller]: adjusted for new algorithm
     2806 *@@changed V1.0.0 (2002-08-16) [umoeller]: adjusted for new algorithm
    28072807 */
    28082808
     
    28132813    // call process mode with the first for "calc size"
    28142814    // process modes
    2815     // changed V0.9.21 (2002-08-16) [umoeller]
     2815    // changed V1.0.0 (2002-08-16) [umoeller]
    28162816    if (!(arc = ProcessAll(pDlgData,
    28172817                           PROCESS_1_CALC_MIN_WIDTHS)))
     
    29962996 *
    29972997 *      See @dlg_algorithm for the gory details of the new
    2998  *      algorithm used since V0.9.21.
     2998 *      algorithm used since V1.0.0.
    29992999 *
    30003000 *      See @dlg_boxmodel for information about how the
     
    30693069 *@@changed V0.9.16 (2001-12-06) [umoeller]: fixed bad owner if not direct desktop child
    30703070 *@@changed V0.9.19 (2002-04-24) [umoeller]: added excpt handling
    3071  +@@changed V0.9.21 (2002-08-21) [umoeller]: now setting wait pointer
     3071 +@@changed V1.0.0 (2002-08-21) [umoeller]: now setting wait pointer
    30723072 */
    30733073
     
    30843084    APIRET      arc = NO_ERROR;
    30853085
    3086     HPOINTER    hptrOld = winhSetWaitPointer();     // V0.9.21 (2002-08-21) [umoeller]
     3086    HPOINTER    hptrOld = winhSetWaitPointer();     // V1.0.0 (2002-08-21) [umoeller]
    30873087
    30883088    TRY_LOUD(excpt1)
     
    32463246    }
    32473247
    3248     WinSetPointer(HWND_DESKTOP, hptrOld); // V0.9.21 (2002-08-21) [umoeller]
     3248    WinSetPointer(HWND_DESKTOP, hptrOld); // V1.0.0 (2002-08-21) [umoeller]
    32493249
    32503250    return arc;
     
    36263626 *@@changed V0.9.20 (2002-07-12) [umoeller]: made icon spacing wider
    36273627 *@@changed V0.9.20 (2002-08-10) [umoeller]: fixed missing close button
    3628  *@@changed V0.9.21 (2002-08-16) [umoeller]: now using table alignment
     3628 *@@changed V1.0.0 (2002-08-16) [umoeller]: now using table alignment
    36293629 */
    36303630
  • trunk/src/helpers/dosh.c

    r226 r229  
    302302 *      buffer, which should be free()'d afterwards.
    303303 *
     304 *      The returned string is properly null-terminated but
     305 *      should not end with a line break (\r or \n) if I see
     306 *      this correctly.
     307 *
    304308 *      Returns NULL upon errors.
     309 *
     310 *@@changed V1.0.0 (2002-09-24) [umoeller]: now supporting NET messages as well
    305311 */
    306312
    307313PSZ doshQuerySysErrorMsg(APIRET arc)    // in: DOS error code
    308314{
    309     PSZ     pszReturn = 0;
     315    PSZ     pszReturn = NULL;
    310316    CHAR    szDosError[1000];
    311317    ULONG   cbDosError = 0;
    312     DosGetMessage(NULL, 0,       // no string replacements
    313                   szDosError, sizeof(szDosError),
    314                   arc,
    315                   "OSO001.MSG",        // default OS/2 message file
    316                   &cbDosError);
    317     if (cbDosError > 2)
     318    PCSZ    pcszMsgFile;
     319
     320    if (    (arc >= 2100)
     321         && (arc <= 8000)
     322       )
     323        pcszMsgFile = "NET.MSG";
     324    else
     325        pcszMsgFile = "OSO001.MSG";        // default OS/2 message file
     326
     327    if (!DosGetMessage(NULL, 0,       // no string replacements
     328                       szDosError, sizeof(szDosError),
     329                       arc,
     330                       (PSZ)pcszMsgFile,
     331                       &cbDosError))
    318332    {
    319333        szDosError[cbDosError - 2] = 0;
    320334        pszReturn = strdup(szDosError);
    321335    }
    322     return (pszReturn);
     336
     337    return pszReturn;
    323338}
    324339
     
    728743 *      CD-ROM drive.
    729744 *
    730  *@@added V0.9.21 (2002-08-31) [umoeller]
     745 *@@added V1.0.0 (2002-08-31) [umoeller]
    731746 */
    732747
     
    785800 *      to close the device again.
    786801 *
    787  *@@added V0.9.21 (2002-08-31) [umoeller]
     802 *@@added V1.0.0 (2002-08-31) [umoeller]
    788803 */
    789804
     
    823838 *
    824839 *@@added V0.9.14 (2001-08-01) [umoeller]
    825  *@@changed V0.9.21 (2002-08-31) [umoeller]: removed ulLogicalDrive which was not needed
     840 *@@changed V1.0.0 (2002-08-31) [umoeller]: removed ulLogicalDrive which was not needed
    826841 */
    827842
     
    852867        else
    853868        {
    854             #pragma pack(1)         // V0.9.21 (2002-08-31) [umoeller]
     869            #pragma pack(1)         // V1.0.0 (2002-08-31) [umoeller]
    855870
    856871            struct {
     
    959974 *      to find out if the door is open with OS/2.
    960975 *
    961  *@@added V0.9.21 (2002-08-31) [umoeller]
     976 *@@added V1.0.0 (2002-08-31) [umoeller]
    962977 */
    963978
     
    11461161    HFILE   hf;
    11471162
    1148     // exported this code to doshOpenDrive V0.9.21 (2002-08-31) [umoeller]
     1163    // exported this code to doshOpenDrive V1.0.0 (2002-08-31) [umoeller]
    11491164    arc = doshOpenDrive(ulLogicalDrive,
    11501165                        &hf);
  • trunk/src/helpers/dosh2.c

    r222 r229  
    412412 *
    413413 *@@added V0.9.16 (2001-10-08) [umoeller]
    414  */
    415 
    416 APIRET doshSearchPath(const char *pcszPath,     // in: path variable name (e.g. "PATH")
     414 *@@changed V1.0.0 (2002-11-23) [umoeller]: allowing NULL pcszPath to search for "PATH"
     415 */
     416
     417APIRET doshSearchPath(const char *pcszPath,     // in: path variable name; if NULL, we use "PATH"
    417418                      const char *pcszFile,     // in: file to look for (e.g. "LVM.EXE")
    418419                      PSZ pszExecutable,        // out: full path (e.g. "F:\os2\lvm.exe")
     
    423424    // get the PATH value
    424425    PCSZ pcszPathValue;
     426
     427    if (!pcszPath)
     428        pcszPath = "PATH";      // V1.0.0 (2002-11-23) [umoeller]
     429
    425430    if (!(arc = DosScanEnv((PSZ)pcszPath,
    426431#if __cplusplus
  • trunk/src/helpers/encodings.c

    r222 r229  
    1313 *
    1414 *      Be warned, compilation of this file takes a long
    15  *      file because this includes all the complex codepages
     15 *      time because this includes all the complex codepages
    1616 *      from include\encodings.
    1717 *
     
    7979    unsigned long       cEntries;           // entries in map (array item count)
    8080    unsigned short      usCodepageOS2;      // corresponding OS/2 codepage or 0 if none
    81                                             // V0.9.21 (2002-08-21) [umoeller]
     81                                            // V1.0.0 (2002-08-21) [umoeller]
    8282    unsigned short      usLatin;            // ISO 8859-X correspondance or 0
    8383    ENCBYTECOUNT        bc;
     
    234234 *      and reuse it for future conversions. In addition,
    235235 *      create codecs only for the codepages that are
    236  *      actually used. Each codec will take up
     236 *      actually used. Each codec will take up to
    237237 *      n * sizeof(USHORT) bytes, where n is the highest
    238238 *      Unicode character used in the codepage.
     
    355355/*
    356356 *@@ encFreeCodec:
    357  *      frees a codec created with encFreeConversion
     357 *      frees a codec created with encCreateCodec
    358358 *      and sets the given pointer to NULL.
    359359 *
     
    446446 *      pointer is advanced anyway).
    447447 *
    448  *      This returns 0 if **ppch points to a
     448 *      This returns 0 if *ppch points to a
    449449 *      null character.
    450450 *
  • trunk/src/helpers/except.c

    r217 r229  
    451451 *@@changed V0.9.16 (2001-11-02) [pr]: make object display signed
    452452 *@@changed V0.9.19 (2002-03-28) [umoeller]: added thread ordinal
    453  *@@changed V0.9.21 (2002-08-28) [umoeller]: added OS revision to dump
     453 *@@changed V1.0.0 (2002-08-28) [umoeller]: added OS revision to dump
    454454 */
    455455
     
    508508    // generic exception info
    509509    DosQuerySysInfo(QSV_VERSION_MAJOR,      // 11
    510                     QSV_VERSION_REVISION,   // 13 V0.9.21 (2002-08-28) [umoeller]
     510                    QSV_VERSION_REVISION,   // 13 V1.0.0 (2002-08-28) [umoeller]
    511511                    &aulBuf, sizeof(aulBuf));
    512512    // Warp 3 is reported as 20.30
     
    527527            aulBuf[0],                      // major
    528528            aulBuf[1],
    529             aulBuf[2],              // revision V0.9.21 (2002-08-28) [umoeller]
     529            aulBuf[2],              // revision V1.0.0 (2002-08-28) [umoeller]
    530530            pcszVersion);
    531531
     
    791791 *
    792792 *      --  pfnExcOpenFileNew gets called to open
    793  *          the trap log file. This must return a FILE*
    794  *          pointer from fopen(). If this is not defined,
    795  *          ?:\TRAP.LOG is used. Use this to specify a
    796  *          different file and have some notes written
    797  *          into it before the actual exception info.
     793 *          the trap log file. This can return a FILE*
     794 *          pointer from fopen() (which will be closed
     795 *          automatically by the handler).
     796 *
     797 *          If this hook is not defined, ?:\TRAP.LOG is
     798 *          used. Use this hook to specify a different file
     799 *          and have some notes written into it before the
     800 *          actual exception info.
     801 *
     802 *          If the hook returns a null FILE* pointer,
     803 *          logging is disabled, and the "loud" handler
     804 *          effectively behaves like the "quiet" handler.
    798805 *
    799806 *      --  pfnExcHookNew gets called while the trap log
     
    801808 *          the following info has been written into
    802809 *          the trap log already:
     810 *
    803811 *          -- exception type/address block
     812 *
    804813 *          -- exception explanation
     814 *
    805815 *          -- process information
    806816 *
     
    890900{
    891901    /* From the VAC++3 docs:
    892      *     "The first thing an exception handler should do is check the
    893      *     exception flags. If EH_EXIT_UNWIND is set, meaning
    894      *     the thread is ending, the handler tells the operating system
    895      *     to pass the exception to the next exception handler. It does the
    896      *     same if the EH_UNWINDING flag is set, the flag that indicates
    897      *     this exception handler is being removed.
    898      *     The EH_NESTED_CALL flag indicates whether the exception
    899      *     occurred within an exception handler. If the handler does
    900      *     not check this flag, recursive exceptions could occur until
    901      *     there is no stack remaining."
    902      * So for all these conditions, we exit immediately.
     902     *      "The first thing an exception handler should do is check the
     903     *      exception flags. If EH_EXIT_UNWIND is set, meaning
     904     *      the thread is ending, the handler tells the operating system
     905     *      to pass the exception to the next exception handler. It does the
     906     *      same if the EH_UNWINDING flag is set, the flag that indicates
     907     *      this exception handler is being removed.
     908     *      The EH_NESTED_CALL flag indicates whether the exception
     909     *      occurred within an exception handler. If the handler does
     910     *      not check this flag, recursive exceptions could occur until
     911     *      there is no stack remaining."
     912     *
     913     *      So for all these conditions, we exit immediately.
    903914     */
    904915
    905916    if (pReportRec->fHandlerFlags & EH_EXIT_UNWIND)
    906        return (XCPT_CONTINUE_SEARCH);
     917       return XCPT_CONTINUE_SEARCH;
    907918    if (pReportRec->fHandlerFlags & EH_UNWINDING)
    908        return (XCPT_CONTINUE_SEARCH);
     919       return XCPT_CONTINUE_SEARCH;
    909920    if (pReportRec->fHandlerFlags & EH_NESTED_CALL)
    910        return (XCPT_CONTINUE_SEARCH);
     921       return XCPT_CONTINUE_SEARCH;
    911922
    912923    switch (pReportRec->ExceptionNum)
     
    920931        {
    921932            // "real" exceptions:
    922             FILE *file;
     933            FILE *file = NULL;
    923934
    924935            // open traplog file;
    925936            if (G_pfnExcOpenFile)
    926937                // hook defined for this: call it
    927                 file = (*G_pfnExcOpenFile)();
     938                file = G_pfnExcOpenFile();
    928939            else
    929940            {
     
    933944                // boot drive
    934945                sprintf(szFileName, "%c:\\trap.log", doshQueryBootDrive());
    935                 file = fopen(szFileName, "a");
    936 
    937                 if (file)
     946
     947                if (file = fopen(szFileName, "a"))
    938948                {
    939949                    DATETIME DT;
     
    948958            }
    949959
    950             // write error log
    951             excExplainException(file,
    952                                 "excHandlerLoud",
    953                                 pReportRec,
    954                                 pContextRec);
    955             fclose(file);
     960            if (file)
     961            {
     962                // write error log
     963                excExplainException(file,
     964                                    "excHandlerLoud",
     965                                    pReportRec,
     966                                    pContextRec);
     967                fclose(file);
     968            }
    956969
    957970            // copy report rec to user buffer
     
    963976            // jump back to failing routine
    964977            longjmp(pRegRec2->jmpThread, pReportRec->ExceptionNum);
    965         break; }
     978        }
     979        break;
    966980    }
    967981
    968982    // not handled
    969     return (XCPT_CONTINUE_SEARCH);
     983    return XCPT_CONTINUE_SEARCH;
    970984}
    971985
     
    9971011{
    9981012    if (pReportRec->fHandlerFlags & EH_EXIT_UNWIND)
    999        return (XCPT_CONTINUE_SEARCH);
     1013       return XCPT_CONTINUE_SEARCH;
    10001014    if (pReportRec->fHandlerFlags & EH_UNWINDING)
    1001        return (XCPT_CONTINUE_SEARCH);
     1015       return XCPT_CONTINUE_SEARCH;
    10021016    if (pReportRec->fHandlerFlags & EH_NESTED_CALL)
    1003        return (XCPT_CONTINUE_SEARCH);
     1017       return XCPT_CONTINUE_SEARCH;
    10041018
    10051019    switch (pReportRec->ExceptionNum)
     
    10331047            longjmp(pRegRec2->jmpThread, pReportRec->ExceptionNum);
    10341048        break;
    1035 
    1036         default:
    1037              break;
    10381049    }
    10391050
    1040     return (XCPT_CONTINUE_SEARCH);
     1051    return XCPT_CONTINUE_SEARCH;
    10411052}
    10421053
  • trunk/src/helpers/exeh.c

    r222 r229  
    176176 *@@changed V0.9.16 (2001-12-08) [umoeller]: speed optimizations, changed some return codes
    177177 *@@changed V0.9.16 (2002-01-04) [umoeller]: added fixes for COM, BAT, CMD extensions
    178  *@@changed V0.9.21 (2002-08-18) [umoeller]: this was completely broken for files without extensions (os2krnl)
     178 *@@changed V1.0.0 (2002-08-18) [umoeller]: this was completely broken for files without extensions (os2krnl)
    179179 */
    180180
     
    206206    {
    207207        // has no extension: then open file!
    208         // fixed V0.9.21 (2002-08-18) [umoeller]
     208        // fixed V1.0.0 (2002-08-18) [umoeller]
    209209        fOpenFile = TRUE;
    210210    }
     
    561561 *@@added V0.9.12 (2001-05-18) [umoeller]
    562562 *@@changed V0.9.12 (2001-05-19) [umoeller]: added extended BLDLEVEL support
    563  *@@changed V0.9.21 (2002-08-18) [umoeller]: added support for IBM TCP/IP format
    564  *@@changed V0.9.21 (2002-08-18) [umoeller]: fixed DANIS506 format when an extended field had only one character
     563 *@@changed V1.0.0 (2002-08-18) [umoeller]: added support for IBM TCP/IP format
     564 *@@changed V1.0.0 (2002-08-18) [umoeller]: fixed DANIS506 format when an extended field had only one character
    565565 */
    566566
     
    599599                {
    600600                    // skip leading and trailing spaces
    601                     // V0.9.21 (2002-08-18) [umoeller]
     601                    // V1.0.0 (2002-08-18) [umoeller]
    602602                    PCSZ pStartOfDT = p,
    603603                         pEndOfDT = p + 24;
     
    670670                            {
    671671                                // if (pNextColon > p + 1)
    672                                         // fixed V0.9.21 (2002-08-18) [umoeller]
     672                                        // fixed V1.0.0 (2002-08-18) [umoeller]
    673673                                        // this failed on fields like "revision"
    674674                                        // which only had one character
     
    694694            {
    695695                // IBM TCP/IP format:
    696                 // V0.9.21 (2002-08-18) [umoeller]
     696                // V1.0.0 (2002-08-18) [umoeller]
    697697
    698698                // ##built 09:16:27 Mon Sep 17 2001 -- On AURORA43;0.1@@ TCP/IP for OS/2: INETD
  • trunk/src/helpers/gpih.c

    r222 r229  
    481481 *      the bottom left and top right pixels to be drawn.
    482482 *
    483  *      Note: With V0.9.21, this now modifies prcl to be smaller towards
     483 *      Note: With V1.0.0, this now modifies prcl to be smaller towards
    484484 *      the center of the rectangle by usWidth so you can call this several
    485485 *      times with different colors.
     
    487487 *@@changed V0.9.0 [umoeller]: changed function prototype to have colors specified
    488488 *@@changed V0.9.7 (2000-12-20) [umoeller]: now really using inclusive rectangle...
    489  *@@changed V0.9.21 (2002-08-24) [umoeller]: renamed, now modifying prcl on output
     489 *@@changed V1.0.0 (2002-08-24) [umoeller]: renamed, now modifying prcl on output
    490490 */
    491491
     
    534534 *      does not modify prcl.
    535535 *
    536  *@@added V0.9.21 (2002-08-24) [umoeller]
     536 *@@added V1.0.0 (2002-08-24) [umoeller]
    537537 */
    538538
  • trunk/src/helpers/lan.c

    r222 r229  
    3939#include <os2.h>
    4040
    41 #define PURE_32
    42 #include <neterr.h>
    43 #include <netcons.h>
    44 #include <server.h>
     41// #define PURE_32
     42// #include <neterr.h>
     43// #include <netcons.h>
     44// #include <server.h>
    4545
    4646#include <stdlib.h>
     
    6767 ********************************************************************/
    6868
    69 typedef API32_FUNCTION NET32WKSTAGETINFO(const unsigned char *pszServer,
     69#define API32_FUNCTION APIRET APIENTRY
     70
     71typedef API32_FUNCTION NET32WKSTAGETINFO(PCSZ pszServer,
    7072                                         unsigned long ulLevel,
    71                                          unsigned char *pbBuffer,
     73                                         PBYTE pbBuffer,
    7274                                         unsigned long ulBuffer,
    7375                                         unsigned long *pulTotalAvail);
    7476
    75 typedef API32_FUNCTION NET32SERVERENUM2(const unsigned char *pszServer,
     77typedef API32_FUNCTION NET32SERVERENUM2(PCSZ pszServer,
    7678                                        unsigned long ulLevel,
    77                                         unsigned char *pbBuffer,
     79                                        PBYTE pbBuffer,
    7880                                        unsigned long cbBuffer,
    7981                                        unsigned long *pcEntriesRead,
    8082                                        unsigned long *pcTotalAvail,
    8183                                        unsigned long flServerType,
    82                                         unsigned char *pszDomain);
     84                                        PBYTE pszDomain);
     85
     86typedef API32_FUNCTION NET32SERVICESTATUS(PCSZ pbBuffer,
     87                                          unsigned long ulBuffer);
     88
     89typedef API32_FUNCTION NET32SERVICEGETINFO(PCSZ pszServer,
     90                                           PCSZ pszService,
     91                                           unsigned long ulLevel,
     92                                           PBYTE pbBuffer,
     93                                           unsigned long ulBuffer,
     94                                           unsigned long *pulTotalAvail);
     95
     96typedef API32_FUNCTION NET32SERVICECONTROL(PCSZ pszServer,
     97                                          PCSZ pszService,
     98                                          unsigned short usOpcode,
     99                                          unsigned short usArg,
     100                                          PBYTE pbBuffer,
     101                                          unsigned long ulBuffer);
     102
     103typedef API32_FUNCTION NET32SERVICEINSTALL(PCSZ pszServer,
     104                                           PCSZ pszService,
     105                                           PCSZ pszCmdArgs,
     106                                           PBYTE pbBuffer,
     107                                           unsigned long ulBuffer);
    83108
    84109/* ******************************************************************
     
    92117NET32WKSTAGETINFO *pNet32WkstaGetInfo = NULL;
    93118NET32SERVERENUM2 *pNet32ServerEnum2 = NULL;
     119NET32SERVICESTATUS *pNet32ServiceStatus = NULL;
     120NET32SERVICEGETINFO *pNet32ServiceGetInfo = NULL;
     121NET32SERVICECONTROL *pNet32ServiceControl = NULL;
     122NET32SERVICEINSTALL *pNet32ServiceInstall = NULL;
    94123
    95124RESOLVEFUNCTION NetResolves[] =
    96125    {
    97126        "Net32WkstaGetInfo", (PFN*)&pNet32WkstaGetInfo,
    98         "Net32ServerEnum2", (PFN*)&pNet32ServerEnum2
     127        "Net32ServerEnum2", (PFN*)&pNet32ServerEnum2,
     128        "Net32ServiceStatus", (PFN*)&pNet32ServiceStatus,
     129        "Net32ServiceGetInfo", (PFN*)&pNet32ServiceGetInfo,
     130        "Net32ServiceControl", (PFN*)&pNet32ServiceControl,
     131        "Net32ServiceInstall", (PFN*)&pNet32ServiceInstall,
    99132    };
    100133
     
    105138/*
    106139 *@@ lanInit:
    107  *
     140 *      initializes the LAN server interface.
     141 *
     142 *      Returns:
     143 *
     144 *      --  NO_ERROR: functions resolved successfully,
     145 *          engine is ready.
     146 *
     147 *      or the error codes from doshResolveImports.
    108148 */
    109149
     
    118158    }
    119159
    120     printf(__FUNCTION__ ": arc %d\n", G_ulNetsResolved);
    121 
    122     return (G_ulNetsResolved);
     160    return G_ulNetsResolved;
    123161}
    124162
     
    139177{
    140178    APIRET arc;
     179
    141180    if (!(arc = lanInit()))
    142181    {
     
    150189            if (!(arc = pNet32ServerEnum2(NULL,
    151190                                          1,          // ulLevel
    152                                           (PUCHAR)pBuf,       // pbBuffer
     191                                          (PBYTE)pBuf,       // pbBuffer
    153192                                          cb,          // cbBuffer,
    154193                                          &ulEntriesRead, // *pcEntriesRead,
     
    170209}
    171210
     211/*
     212 *@@ lanServiceGetInfo:
     213 *      queries the given service.
     214 *
     215 *@@added V1.0.0 (2002-09-24) [umoeller]
     216 */
     217
     218APIRET lanServiceGetInfo(PCSZ pcszServiceName,
     219                         PSERVICEBUF2 pBuf)
     220{
     221    APIRET  arc;
     222
     223    if (!(arc = lanInit()))
     224    {
     225        ULONG   ulBytesAvail = 0;
     226        arc = pNet32ServiceGetInfo(NULL,
     227                                   pcszServiceName,
     228                                   2,        // level
     229                                   (PBYTE)pBuf,
     230                                   sizeof(SERVICEBUF2),
     231                                   &ulBytesAvail);
     232
     233    }
     234
     235    return arc;
     236}
     237/*
     238 *@@ lanServiceInstall:
     239 *      starts the given service. The service name
     240 *      must be fully qualified so you cannot
     241 *      abbreviate "requester" with "req", for
     242 *      example (as valid with the net command).
     243 *
     244 *      Returns, among others:
     245 *
     246 *      --  NO_ERROR
     247 *
     248 *      --  NERR_ServiceInstalled (2182): the service
     249 *          has already been started.
     250 *
     251 *      --  NERR_BadServiceName (2185): invalid service
     252 *          name.
     253 *
     254 *@@added V1.0.0 (2002-09-24) [umoeller]
     255 */
     256
     257APIRET lanServiceInstall(PCSZ pcszServiceName,
     258                         PSERVICEBUF2 pBuf2)        // out: service data
     259{
     260    APIRET  arc;
     261
     262    if (!(arc = lanInit()))
     263    {
     264        SERVICEBUF2 buf2;
     265
     266        if (!(arc = pNet32ServiceInstall(NULL,
     267                                         pcszServiceName,
     268                                         NULL,
     269                                         (PBYTE)pBuf2,
     270                                         sizeof(SERVICEBUF2))))
     271            ;
     272    }
     273
     274    return arc;
     275}
     276
     277/*
     278 *@@ lanServiceControl:
     279 *      queries, pauses, resumes, or stops the given service.
     280 *
     281 *      opcode must be one of:
     282 *
     283 *      --  SERVICE_CTRL_INTERROGATE (0): interrogate service status.
     284 *
     285 *      --  SERVICE_CTRL_PAUSE (1): pause service.
     286 *
     287 *      --  SERVICE_CTRL_CONTINUE (2): continue service.
     288 *
     289 *      --  SERVICE_CTRL_UNINSTALL (3): stop service.
     290 *
     291 *@@added V1.0.0 (2002-09-24) [umoeller]
     292 */
     293
     294APIRET lanServiceControl(PCSZ pcszServiceName,
     295                         ULONG opcode,
     296                         PSERVICEBUF2 pBuf2)        // out: service data
     297{
     298    APIRET  arc;
     299
     300    if (!(arc = lanInit()))
     301    {
     302       if (!(arc = pNet32ServiceControl(NULL,
     303                                        pcszServiceName,
     304                                        opcode,
     305                                        0,
     306                                        (PBYTE)pBuf2,
     307                                        sizeof(SERVICEBUF2))))
     308            ;
     309
     310    }
     311
     312    return arc;
     313}
     314
    172315#ifdef __LAN_TEST__
    173316
  • trunk/src/helpers/linklist.c

    r193 r229  
    262262
    263263    lstInit(pNewList, fItemsFreeable);
    264     return (pNewList);
     264
     265    return pNewList;
    265266}
    266267
     
    296297    if (pNewList = (PLINKLIST)malloc(sizeof(LINKLIST)))
    297298        lstInit(pNewList, fItemsFreeable);
    298     return (pNewList);
     299
     300    return pNewList;
    299301}
    300302
     
    361363long lstCountItems(const LINKLIST *pList)
    362364{
    363     long lCount = -1;
    364 
    365     if (pList)
    366         if (pList->ulMagic == LINKLISTMAGIC)
    367         {
    368             lCount = pList->ulCount;
    369         }
    370 
    371     return (lCount);
     365    if (    (pList)
     366         && (pList->ulMagic == LINKLISTMAGIC)
     367       )
     368        return pList->ulCount;
     369
     370    return -1;
    372371}
    373372
     
    404403         && (pList->ulMagic == LINKLISTMAGIC)
    405404       )
    406         return (pList->pFirst);
    407 
    408     return (0);
     405        return pList->pFirst;
     406
     407    return 0;
    409408}
    410409
     
    422421         && (pList->ulMagic == LINKLISTMAGIC)
    423422       )
    424         return (pList->pLast);
    425 
    426     return (0);
     423        return pList->pLast;
     424
     425    return 0;
    427426}
    428427
     
    463462    }
    464463
    465     return (pNode);
     464    return pNode;
    466465}
    467466
     
    500499    }
    501500
    502     return (pNodeFound);
     501    return pNodeFound;
    503502}
    504503
     
    558557    }
    559558
    560     return (ulrc);
     559    return ulrc;
    561560}
    562561
     
    616615    }
    617616
    618     return (pNewNode);
     617    return pNewNode;
    619618}
    620619
     
    670669    }
    671670
    672     return (pNewNode);
     671    return pNewNode;
    673672}
    674673
     
    767766    }
    768767
    769     return (pNewNode);
     768    return pNewNode;
    770769}
    771770
     
    830829    }
    831830
    832     return (fFound);
     831    return fFound;
    833832}
    834833
     
    855854
    856855    if (pNode = lstNodeFromItem(pList, pRemoveItem))
    857         return (lstRemoveNode(pList, pNode));
    858 
    859     return (FALSE);
     856        return lstRemoveNode(pList, pNode);
     857
     858    return FALSE;
    860859}
    861860
     
    879878        pNode2->pItemData = pTemp;
    880879
    881         return (TRUE);
     880        return TRUE;
    882881    }
    883882
    884     return (FALSE);
     883    return FALSE;
    885884}
    886885
     
    10851084                  void* pNewItemData)     // in: data to store in list node
    10861085{
    1087     return (lstAppendItem(pList, pNewItemData));
     1086    return lstAppendItem(pList, pNewItemData);
    10881087}
    10891088
     
    11151114PLISTNODE lstPop(PLINKLIST pList)
    11161115{
    1117     return (pList->pLast);
    1118 }
    1119 
    1120 
     1116    return pList->pLast;
     1117}
     1118
     1119
  • trunk/src/helpers/map_vac.c

    r226 r229  
    88 *            numbering.
    99 *
    10  *@@added V0.9.21 (2002-09-13) [umoeller]
     10 *@@added V1.0.0 (2002-09-13) [umoeller]
    1111 *
    1212 *@@header "helpers\mapfile.h"
  • trunk/src/helpers/prfh2.c

    r169 r229  
    4242#define INCL_DOSERRORS
    4343#define INCL_WINSHELLDATA
     44#define INCL_WINERRORS
    4445#include <os2.h>
    4546
     
    5455
    5556#include "helpers\prfh.h"
     57#include "helpers\xprf.h"
    5658
    5759#pragma hdrstop
     
    641643}
    642644
    643 
     645#ifdef __PRFH2_MAIN__
     646
     647int main(int argc, char* argv[])
     648{
     649    APIRET  arc = NO_ERROR;
     650    PCSZ    pcszSource,
     651            pcszTarget,
     652            pcszApp;
     653    PXINI   piniSource;
     654    HINI    hiniTarget;
     655    BOOL    fCloseSource = FALSE,
     656            fCloseTarget = FALSE;
     657    HAB     hab = WinInitialize(0);
     658    CHAR    szFailing[1000];
     659
     660    if (argc < 4)
     661    {
     662        printf("%d\nprfh2 <sourcefile> <targetfile> <appname>\n", argc);
     663        exit(2);
     664    }
     665
     666    pcszSource = argv[1];
     667    pcszTarget = argv[2];
     668    pcszApp = argv[3];
     669
     670    if (arc = xprfOpenProfile(pcszSource,
     671                              &piniSource))
     672    {
     673        printf("xprfOpenProfile returned %d opening source INI \"%s\"\n",
     674               arc,
     675               pcszSource);
     676    }
     677    else
     678        fCloseSource = TRUE;
     679
     680    if (!strcmp(pcszTarget, "USER"))
     681        hiniTarget = HINI_USER;
     682    else if (!strcmp(pcszTarget, "SYSTEM"))
     683        hiniTarget = HINI_SYSTEM;
     684    else
     685    {
     686        if (!(hiniTarget = PrfOpenProfile(hab, (PSZ)pcszTarget)))
     687        {
     688            printf("Cannot open source INI \"%s\"\n", pcszTarget);
     689            arc = -1;
     690        }
     691        else
     692            fCloseTarget = TRUE;
     693    }
     694
     695    if (!arc)
     696    {
     697        if (arc = xprfCopyApp2(piniSource,
     698                               pcszApp,
     699                               hiniTarget,
     700                               pcszApp,
     701                               szFailing))
     702        {
     703            printf("Error %d copying application \"%s\" from %s to %s\n",
     704                   arc,
     705                   pcszApp,
     706                   pcszSource,
     707                   pcszTarget);
     708            printf("Failing key: \"%s\"\n",
     709                   szFailing);
     710        }
     711        else
     712            printf("Application \"%s\" successfully copied from %s to %s\n",
     713                   pcszApp,
     714                   pcszSource,
     715                   pcszTarget);
     716    }
     717
     718    if (arc)
     719    {
     720        ERRORID eid;
     721        eid = WinGetLastError(hab);
     722
     723        printf("WinGetLastError returned 0x%lX\n",
     724               eid);
     725    }
     726
     727
     728    if (fCloseSource)
     729        xprfCloseProfile(piniSource);
     730    if (fCloseTarget)
     731        PrfCloseProfile(hiniTarget);
     732
     733    WinTerminate(hab);
     734
     735    exit(arc);
     736}
     737
     738#endif
  • trunk/src/helpers/procstat.c

    r218 r229  
    558558 *
    559559 *@@added V0.9.2 (2000-03-05) [umoeller]
    560  *@@changed V0.9.21 (2002-08-16) [pr]: optimized
     560 *@@changed V1.0.0 (2002-08-16) [pr]: optimized
    561561 */
    562562
     
    602602 *@@ prc32FindProcessFromPID:
    603603 *
    604  *@@added V0.9.21 (2002-08-12) [umoeller]
    605  *@@changed V0.9.21 (2002-08-16) [pr]: optimized
     604 *@@added V1.0.0 (2002-08-12) [umoeller]
     605 *@@changed V1.0.0 (2002-08-16) [pr]: optimized
    606606 */
    607607
  • trunk/src/helpers/textview.c

    r222 r229  
    23192319 *      implementation for WM_CREATE in fnwpTextView.
    23202320 *
    2321  *@@added V0.9.21 (2002-08-12) [umoeller]
     2321 *@@added V1.0.0 (2002-08-12) [umoeller]
    23222322 */
    23232323
     
    24652465 *      implementation for WM_PAINT in fnwpTextView.
    24662466 *
    2467  *@@added V0.9.21 (2002-08-12) [umoeller]
     2467 *@@added V1.0.0 (2002-08-12) [umoeller]
    24682468 */
    24692469
     
    25592559 *      implementation for WM_PRESPARAMCHANGED in fnwpTextView.
    25602560 *
    2561  *@@added V0.9.21 (2002-08-12) [umoeller]
     2561 *@@added V1.0.0 (2002-08-12) [umoeller]
    25622562 */
    25632563
     
    25892589 *      implementation for WM_SETFOCUS in fnwpTextView.
    25902590 *
    2591  *@@added V0.9.21 (2002-08-12) [umoeller]
     2591 *@@added V1.0.0 (2002-08-12) [umoeller]
    25922592 */
    25932593
     
    26522652 *      implementation for WM_BUTTON1DOWN in fnwpTextView.
    26532653 *
    2654  *@@added V0.9.21 (2002-08-12) [umoeller]
     2654 *@@added V1.0.0 (2002-08-12) [umoeller]
    26552655 */
    26562656
     
    27242724 *      implementation for WM_BUTTON1UP in fnwpTextView.
    27252725 *
    2726  *@@added V0.9.21 (2002-08-12) [umoeller]
     2726 *@@added V1.0.0 (2002-08-12) [umoeller]
    27272727 */
    27282728
     
    27662766 *      implementation for WM_CHAR in fnwpTextView.
    27672767 *
    2768  *@@added V0.9.21 (2002-08-12) [umoeller]
     2768 *@@added V1.0.0 (2002-08-12) [umoeller]
    27692769 */
    27702770
     
    28892889 *      implementation for TXM_JUMPTOANCHORNAME in fnwpTextView.
    28902890 *
    2891  *@@added V0.9.21 (2002-08-12) [umoeller]
     2891 *@@added V1.0.0 (2002-08-12) [umoeller]
    28922892 */
    28932893
     
    29452945 *      implementation for WM_DESTROY in fnwpTextView.
    29462946 *
    2947  *@@added V0.9.21 (2002-08-12) [umoeller]
     2947 *@@added V1.0.0 (2002-08-12) [umoeller]
    29482948 */
    29492949
     
    30193019 *@@changed V0.9.20 (2002-08-10) [umoeller]: added support for XS_STATIC
    30203020 *@@changed V0.9.20 (2002-08-10) [umoeller]: added support for formatting HTML and plain text automatically
    3021  *@@changed V0.9.21 (2002-08-12) [umoeller]: optimized locality by moving big chunks into subfuncs
     3021 *@@changed V1.0.0 (2002-08-12) [umoeller]: optimized locality by moving big chunks into subfuncs
    30223022 */
    30233023
     
    30363036        case WM_CREATE:
    30373037            mrc = ProcessCreate(hwndTextView, mp1, mp2);
    3038                     // extracted V0.9.21 (2002-08-12) [umoeller]
     3038                    // extracted V1.0.0 (2002-08-12) [umoeller]
    30393039        break;
    30403040
     
    30903090        case WM_PAINT:
    30913091            ProcessPaint(hwndTextView);
    3092                     // extracted V0.9.21 (2002-08-12) [umoeller]
     3092                    // extracted V1.0.0 (2002-08-12) [umoeller]
    30933093        break;
    30943094
     
    33623362         *      a ULONG.
    33633363         *
    3364          *@@changed V0.9.21 (2002-08-12) [umoeller]: now returning bytes
     3364         *@@changed V1.0.0 (2002-08-12) [umoeller]: now returning bytes
    33653365         */
    33663366
  • trunk/src/helpers/threads.c

    r222 r229  
    123123 *@@added V0.9.2 (2000-03-05) [umoeller]
    124124 *@@changed V0.9.7 (2000-12-18) [lafaix]: THRF_TRANSIENT support added
    125  *@@changed V0.9.21 (2002-08-21) [umoeller]: added WinCancelShutdown to avoid shutdown hangs
     125 *@@changed V1.0.0 (2002-08-21) [umoeller]: added WinCancelShutdown to avoid shutdown hangs
    126126 */
    127127
     
    151151                    // in XWPDAEMN and causes the default OS/2
    152152                    // shutdown to hang
    153                     // V0.9.21 (2002-08-21) [umoeller]
     153                    // V1.0.0 (2002-08-21) [umoeller]
    154154                    WinCancelShutdown(pti->hmq, TRUE);
    155155
  • trunk/src/helpers/winh.c

    r219 r229  
    580580 *      IDs.
    581581 *
    582  *@@added V0.9.21 (2002-08-12) [umoeller]
     582 *@@added V1.0.0 (2002-08-12) [umoeller]
    583583 */
    584584
     
    909909 *      after calling this function.
    910910 *
    911  *@@added V0.9.21 (2002-08-31) [umoeller]
     911 *@@added V1.0.0 (2002-08-31) [umoeller]
    912912 */
    913913
     
    27692769 *
    27702770 *@@added V0.9.19 (2002-04-17) [umoeller]
    2771  *@@changed V0.9.21 (2002-08-26) [umoeller]: fixed cx and cy confusion
     2771 *@@changed V1.0.0 (2002-08-26) [umoeller]: fixed cx and cy confusion
    27722772 */
    27732773
     
    28042804
    28052805        // if (xNew + swpThis.cy > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
    2806                 // not cy, but cx V0.9.21 (2002-08-26) [umoeller]
     2806                // not cy, but cx V1.0.0 (2002-08-26) [umoeller]
    28072807        if (xNew + swpThis.cx > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
    28082808        {
     
    40564056 *
    40574057 *@@added V0.9.9 (2001-03-13) [umoeller]
    4058  *@@changed V0.9.21 (2002-08-26) [umoeller]: added separate hwndOwner
     4058 *@@changed V1.0.0 (2002-08-26) [umoeller]: added separate hwndOwner
    40594059 */
    40604060
     
    47584758 *      replacing the current clipboard contents.
    47594759 *
    4760  *@@added V0.9.21 (2002-08-28) [umoeller]
     4760 *@@added V1.0.0 (2002-08-28) [umoeller]
    47614761 */
    47624762
     
    48134813 *      (XWorkplace status bars).
    48144814 *
    4815  *@@added V0.9.21 (2002-08-28) [umoeller]
     4815 *@@added V1.0.0 (2002-08-28) [umoeller]
    48164816 */
    48174817
  • trunk/src/helpers/xml.c

    r222 r229  
    31033103 *@@ ESCAPES:
    31043104 *
    3105  *@@added V0.9.21 (2002-08-21) [umoeller]
     3105 *@@added V1.0.0 (2002-08-21) [umoeller]
    31063106 */
    31073107
     
    31243124 *@@ DoEscapes:
    31253125 *
    3126  *@@added V0.9.21 (2002-08-21) [umoeller]
     3126 *@@added V1.0.0 (2002-08-21) [umoeller]
    31273127 */
    31283128
     
    31853185 *
    31863186 *@@added V0.9.12 (2001-05-21) [umoeller]
    3187  *@@changed V0.9.21 (2002-08-21) [umoeller]: changed prototype, fixed unescaped characters in attributes and content
     3187 *@@changed V1.0.0 (2002-08-21) [umoeller]: changed prototype, fixed unescaped characters in attributes and content
    31883188 */
    31893189
     
    32273227                    // copy attribute value to temp buffer first
    32283228                    // so we can escape quotes and ampersands
    3229                     // V0.9.21 (2002-08-21) [umoeller]
     3229                    // V1.0.0 (2002-08-21) [umoeller]
    32303230                    xstrcpys(&pEscapes->strTemp, pAttribNode->pstrNodeValue);
    32313231
     
    32703270                         pChildNode->pstrNodeValue);
    32713271
    3272                 DoEscapes(pEscapes,         // V0.9.21 (2002-08-21) [umoeller]
     3272                DoEscapes(pEscapes,         // V1.0.0 (2002-08-21) [umoeller]
    32733273                          FALSE);           // quotes not
    32743274
  • trunk/src/helpers/xprf.c

    r222 r229  
    155155 *
    156156 *      Private helper.
    157  */
    158 
    159 STATIC PXINIAPPDATA FindApp(PXINI pXIni,           // in: profile opened with xprfOpenProfile
    160                             const char *pcszApp)
     157 *
     158 *@@changed V1.0.0 (2002-09-17) [umoeller]: now returning APIRET
     159 */
     160
     161STATIC APIRET FindApp(PXINI pXIni,           // in: profile opened with xprfOpenProfile
     162                      const char *pcszApp,
     163                      PXINIAPPDATA *ppAppData)
    161164{
    162165    PLISTNODE pAppNode = lstQueryFirstNode(&pXIni->llApps);
     
    165168        PXINIAPPDATA pAppDataThis = (PXINIAPPDATA)pAppNode->pItemData;
    166169        if (!strcmp(pAppDataThis->pszAppName, pcszApp))
    167             return (pAppDataThis);
     170        {
     171            *ppAppData = pAppDataThis;
     172            return NO_ERROR;
     173        }
    168174
    169175        pAppNode = pAppNode->pNext;
    170176    }
    171177
    172     return NULL;
     178    return PRFERR_INVALID_APP_NAME;
    173179}
    174180
     
    181187 *
    182188 *      Private helper.
    183  */
    184 
    185 STATIC PXINIAPPDATA CreateApp(PXINI pXIni,         // in: profile opened with xprfOpenProfile
    186                               const char *pcszApp)
     189 *
     190 *@@changed V1.0.0 (2002-09-17) [umoeller]: now returning APIRET
     191 */
     192
     193STATIC APIRET CreateApp(PXINI pXIni,         // in: profile opened with xprfOpenProfile
     194                        const char *pcszApp,
     195                        PXINIAPPDATA *ppAppData)
    187196{
    188197    PXINIAPPDATA pAppData;
     
    195204        // store in INI's apps list
    196205        lstAppendItem(&pXIni->llApps, pAppData);
    197         pXIni->cApps++;
    198     }
    199 
    200     return (pAppData);
     206
     207        *ppAppData = pAppData;
     208        return NO_ERROR;
     209    }
     210
     211    return ERROR_NOT_ENOUGH_MEMORY;
    201212}
    202213
     
    208219 *
    209220 *      Private helper.
    210  */
    211 
    212 STATIC PXINIKEYDATA FindKey(PXINIAPPDATA pAppData,
    213                             const char *pcszKey)
     221 *
     222 *@@changed V1.0.0 (2002-09-17) [umoeller]: now returning APIRET
     223 */
     224
     225STATIC APIRET FindKey(PXINIAPPDATA pAppData,
     226                      const char *pcszKey,
     227                      PXINIKEYDATA *ppKeyData)
    214228{
    215229    PLISTNODE pKeyNode = lstQueryFirstNode(&pAppData->llKeys);
     
    218232        PXINIKEYDATA pKeyDataThis = (PXINIKEYDATA)pKeyNode->pItemData;
    219233        if (!strcmp(pKeyDataThis->pszKeyName, pcszKey))
    220             return (pKeyDataThis);
     234        {
     235            *ppKeyData = pKeyDataThis;
     236            return NO_ERROR;
     237        }
    221238
    222239        pKeyNode = pKeyNode->pNext;
    223240    }
    224241
    225     return NULL;
     242    return PRFERR_INVALID_KEY_NAME;
    226243}
    227244
     
    234251 *
    235252 *      Private helper.
    236  */
    237 
    238 STATIC PXINIKEYDATA CreateKey(PXINIAPPDATA pAppData,
    239                               const char *pcszKey,     // in: key name
    240                               PBYTE pbData,            // in: data for key
    241                               ULONG cbData)            // in: sizeof (*pbData)
     253 *
     254 *@@changed V1.0.0 (2002-09-17) [umoeller]: now returning APIRET
     255 */
     256
     257STATIC APIRET CreateKey(PXINIAPPDATA pAppData,
     258                        const char *pcszKey,        // in: key name
     259                        PBYTE pbData,               // in: data for key
     260                        ULONG cbData,               // in: sizeof (*pbData)
     261                        PXINIKEYDATA *ppKeyData)    // out: new key data
    242262{
    243263    PXINIKEYDATA pKeyData;
     
    253273            lstAppendItem(&pAppData->llKeys, pKeyData);
    254274            pAppData->cKeys++;
     275
     276            *ppKeyData = pKeyData;
     277            return NO_ERROR;
    255278        }
    256279        else
    257         {
    258280            // malloc failed:
    259281            free(pKeyData);
    260             pKeyData = 0;
    261         }
    262     }
    263 
    264     return (pKeyData);
     282    }
     283
     284    return ERROR_NOT_ENOUGH_MEMORY;
    265285}
    266286
     
    284304
    285305/*
     306 *@@ FreeKeyIfExists:
     307 *
     308 *@@added V1.0.0 (2002-09-17) [umoeller]
     309 */
     310
     311STATIC VOID FreeKeyIfExists(PXINI pXIni,         // in: profile opened with xprfOpenProfile
     312                            PXINIAPPDATA pAppData,
     313                            PCSZ pcszKey)
     314{
     315    // find key
     316    PXINIKEYDATA pKeyData;
     317
     318    if (!FindKey(pAppData,
     319                 pcszKey,
     320                 &pKeyData))
     321    {
     322        // key exists: kill that
     323        FreeKey(pKeyData);
     324        // and remove from app's keys list
     325        lstRemoveItem(&pAppData->llKeys, pKeyData);
     326        pAppData->cKeys--;
     327
     328        // rewrite profile on close
     329        pXIni->fDirty = TRUE;
     330    }
     331    // else key doesn't exist:
     332    // nothing to do
     333}
     334
     335/*
    286336 * FreeApp:
    287337 *      frees the specified application. Does not remove
     
    319369 */
    320370
    321 STATIC BOOL FreeINI(PXINI pXIni)       // in: profile opened with xprfOpenProfile
    322 {
    323     BOOL brc = FALSE;
    324 
     371STATIC VOID FreeINI(PXINI pXIni)       // in: profile opened with xprfOpenProfile
     372{
    325373    if (pXIni)
    326374    {
     
    338386        free(pXIni);
    339387    }
    340 
    341     return brc;
    342388}
    343389
     
    354400 *
    355401 *      Private helper.
    356  */
    357 
    358 STATIC BOOL ReadINI(PXINI pXIni)       // in: profile opened with xprfOpenProfile
    359 {
    360     BOOL brc = FALSE;
     402 *
     403 *@@changed V1.0.0 (2002-09-17) [umoeller]: now returning APIRET
     404 */
     405
     406STATIC APIRET ReadINI(PXINI pXIni)      // in: profile opened with xprfOpenProfile
     407{
     408    APIRET      arc;
    361409    FILESTATUS3 fs3;
    362410
    363     if (DosProtectQueryFileInfo(pXIni->hFile,
    364                                 FIL_STANDARD,
    365                                 &fs3,
    366                                 sizeof(fs3),
    367                                 pXIni->hLock)
    368             == NO_ERROR)
     411    if (!(arc = DosQueryFileInfo(pXIni->hFile,
     412                                 FIL_STANDARD,
     413                                 &fs3,
     414                                 sizeof(fs3))))
    369415    {
    370416        PBYTE  pbFileData;
    371         if (pbFileData = (PBYTE)malloc(fs3.cbFile))
     417        if (!(pbFileData = (PBYTE)malloc(fs3.cbFile)))
     418            arc = ERROR_NOT_ENOUGH_MEMORY;
     419        else
    372420        {
    373421            ULONG ulSet = 0;
    374             APIRET arc = DosProtectSetFilePtr(pXIni->hFile,
    375                                               0,
    376                                               FILE_BEGIN,
    377                                               &ulSet,
    378                                               pXIni->hLock);
    379             if (    (arc == NO_ERROR)
    380                  && (ulSet == 0)
    381                )
     422
     423            if (!(arc = DosSetFilePtr(pXIni->hFile,
     424                                      0,
     425                                      FILE_BEGIN,
     426                                      &ulSet)))
    382427            {
    383428                ULONG cbRead = 0;
    384                 arc = DosProtectRead(pXIni->hFile,
    385                                      pbFileData,
    386                                      fs3.cbFile,
    387                                      &cbRead,
    388                                      pXIni->hLock);
    389                 if (    (arc == NO_ERROR)
    390                      && (cbRead == fs3.cbFile)
    391                    )
     429                if (!(arc = DosRead(pXIni->hFile,
     430                                    pbFileData,
     431                                    fs3.cbFile,
     432                                    &cbRead)))
    392433                {
    393                     PINIFILE_HEADER pHeader = (PINIFILE_HEADER)pbFileData;
    394                     if (pHeader->magic == 0xFFFFFFFF)
     434                    if (cbRead != fs3.cbFile)
     435                        arc = ERROR_NO_DATA;
     436                    else
    395437                    {
    396                         ULONG   ulAppOfs = pHeader->offFirstApp;
    397 
    398                         // it was a valid profile, so return TRUE
    399                         brc = TRUE;
    400 
    401                         // create-applications loop
    402                         while ((ulAppOfs) && (brc))
     438                        PINIFILE_HEADER pHeader = (PINIFILE_HEADER)pbFileData;
     439                        if (pHeader->magic == 0xFFFFFFFF)
    403440                        {
    404                             // application struct
    405                             PINIFILE_APP pApp = (PINIFILE_APP)(pbFileData + ulAppOfs);
    406                             ULONG   ulKeysOfs = pApp->offFirstKeyInApp;
    407                             PXINIAPPDATA pIniApp
    408                                 = CreateApp(pXIni,
    409                                             (PBYTE)(pbFileData + pApp->offAppName));
    410                             if (!pIniApp)
     441                            ULONG   ulAppOfs = pHeader->offFirstApp;
     442
     443                            // create-applications loop
     444                            while ((ulAppOfs) && (!arc))
    411445                            {
    412                                 brc = FALSE;
    413                                 break;
     446                                // application struct
     447                                PINIFILE_APP pApp = (PINIFILE_APP)(pbFileData + ulAppOfs);
     448                                ULONG   ulKeysOfs = pApp->offFirstKeyInApp;
     449                                PXINIAPPDATA pIniApp;
     450
     451                                if (arc = CreateApp(pXIni,
     452                                                    (PBYTE)(pbFileData + pApp->offAppName),
     453                                                    &pIniApp))
     454                                    break;
     455
     456                                // create-keys loop
     457                                while ((ulKeysOfs) && (!arc))
     458                                {
     459                                    PINIFILE_KEY pKey = (PINIFILE_KEY)(pbFileData + ulKeysOfs);
     460
     461                                    PXINIKEYDATA pIniKey;
     462
     463                                    if (arc = CreateKey(pIniApp,
     464                                                        (PSZ)(pbFileData + pKey->offKeyName),
     465                                                        (PBYTE)(pbFileData + pKey->offKeyData),
     466                                                        pKey->lenKeyData,
     467                                                        &pIniKey))
     468                                        break;
     469
     470                                    // next key; can be null
     471                                    ulKeysOfs = pKey->offNextKeyInApp;
     472                                }
     473
     474                                // next application; can be null
     475                                ulAppOfs = pApp->offNextApp;
    414476                            }
    415 
    416                             // create-keys loop
    417                             while ((ulKeysOfs) && (brc))
    418                             {
    419                                 PINIFILE_KEY pKey = (PINIFILE_KEY)(pbFileData + ulKeysOfs);
    420 
    421                                 PXINIKEYDATA pIniKey
    422                                     = CreateKey(pIniApp,
    423                                                 (PSZ)(pbFileData + pKey->offKeyName),
    424                                                 (PBYTE)(pbFileData + pKey->offKeyData),
    425                                                 pKey->lenKeyData);
    426 
    427                                 if (!pIniKey)
    428                                 {
    429                                     brc = FALSE;
    430                                     break;
    431                                 }
    432 
    433                                 // next key; can be null
    434                                 ulKeysOfs = pKey->offNextKeyInApp;
    435                             }
    436 
    437                             // next application; can be null
    438                             ulAppOfs = pApp->offNextApp;
    439477                        }
    440478                    }
     
    446484    }
    447485
    448     return brc;
     486    return arc;
    449487}
    450488
     
    455493 *
    456494 *      Private helper.
    457  */
    458 
    459 STATIC BOOL WriteINI(PXINI pXIni)      // in: profile opened with xprfOpenProfile
    460 {
    461     BOOL    brc = FALSE;
     495 *
     496 *@@changed V1.0.0 (2002-09-17) [umoeller]: now returning APIRET
     497 */
     498
     499STATIC APIRET WriteINI(PXINI pXIni)      // in: profile opened with xprfOpenProfile
     500{
     501    APIRET  arc = NO_ERROR;
    462502    ULONG   ulTotalFileSize = sizeof(INIFILE_HEADER);
    463503    ULONG   ulSet = 0;
     
    471511    // go thru all apps
    472512    PLISTNODE pAppNode = lstQueryFirstNode(&pXIni->llApps);
     513
    473514    while (pAppNode)
    474515    {
     
    501542    if (pbData2Write = (PBYTE)malloc(ulTotalFileSize))
    502543    {
    503         APIRET arc = NO_ERROR;
    504 
    505544        // set header in buffer
    506545        PINIFILE_HEADER pHeader = (PINIFILE_HEADER)pbData2Write;
     
    512551
    513552        pHeader->magic = 0xFFFFFFFF;
    514         if (pXIni->cApps)
     553        if (lstCountItems(&pXIni->llApps))
    515554            // we have any applications:
    516555            pHeader->offFirstApp = sizeof(INIFILE_HEADER);
     
    630669
    631670        // write out everything
    632         if (!(arc = DosProtectSetFilePtr(pXIni->hFile,
    633                                          0,
    634                                          FILE_BEGIN,
    635                                          &ulSet,
    636                                          pXIni->hLock)))
     671        if (!(arc = DosSetFilePtr(pXIni->hFile,
     672                                  0,
     673                                  FILE_BEGIN,
     674                                  &ulSet)))
    637675        {
    638676            ULONG cbWritten = 0;
    639             if (    (!(arc = DosProtectWrite(pXIni->hFile,
    640                                              pbData2Write,
    641                                              ulTotalFileSize,
    642                                              &cbWritten,
    643                                              pXIni->hLock)))
    644                  && (!(arc = DosProtectSetFileSize(pXIni->hFile,
    645                                                    ulTotalFileSize,
    646                                                    pXIni->hLock)))
    647                )
    648                 brc = TRUE;
     677            if (!(arc = DosWrite(pXIni->hFile,
     678                                 pbData2Write,
     679                                 ulTotalFileSize,
     680                                 &cbWritten)))
     681            {
     682                if (!(arc = DosSetFileSize(pXIni->hFile,
     683                                           ulTotalFileSize)))
     684                    ;
     685            }
    649686        }
    650687
     
    652689    }
    653690
    654     return brc;
     691    return arc;
    655692}
    656693
     
    688725    APIRET  arc = NO_ERROR;
    689726    PXINI   pXIni = NULL;
    690 
    691     if (pcszFilename)
    692         if (strlen(pcszFilename) < CCHMAXPATH - 1)
    693         {
    694             HFILE   hFile = NULLHANDLE;
    695             ULONG   ulAction = 0;
    696             FHLOCK  hLock = 0;
    697             arc = DosProtectOpen((PSZ)pcszFilename,
    698                                  &hFile,
    699                                  &ulAction,
    700                                  1024,          // initial size
    701                                  FILE_NORMAL,
    702                                  OPEN_ACTION_CREATE_IF_NEW
    703                                     | OPEN_ACTION_OPEN_IF_EXISTS,
    704                                  OPEN_FLAGS_FAIL_ON_ERROR
    705                                     | OPEN_FLAGS_NO_CACHE
    706                                     | OPEN_FLAGS_SEQUENTIAL
    707                                     | OPEN_SHARE_DENYREADWRITE
    708                                     | OPEN_ACCESS_READWRITE,
    709                                  NULL, // no EAs
    710                                  &hLock);
    711             if (arc == NO_ERROR)
     727    ULONG   ulFilenameLen;
     728
     729    if (    (!pcszFilename)
     730         || (!ppxini)
     731       )
     732        arc = ERROR_INVALID_PARAMETER;      // V1.0.0 (2002-09-17) [umoeller]
     733    else if (!(ulFilenameLen = strlen(pcszFilename)))
     734        arc = ERROR_INVALID_PARAMETER;      // V1.0.0 (2002-09-17) [umoeller]
     735    else if (ulFilenameLen >= CCHMAXPATH - 1)
     736        arc = ERROR_FILENAME_EXCED_RANGE;
     737    else
     738    {
     739        HFILE   hFile = NULLHANDLE;
     740        ULONG   ulAction = 0;
     741        // FHLOCK  hLock = 0;
     742
     743        if (!(arc = DosOpen((PSZ)pcszFilename,
     744                            &hFile,
     745                            &ulAction,
     746                            1024,          // initial size
     747                            FILE_NORMAL,
     748                            OPEN_ACTION_CREATE_IF_NEW
     749                               | OPEN_ACTION_OPEN_IF_EXISTS,
     750                            OPEN_FLAGS_FAIL_ON_ERROR
     751                               | OPEN_FLAGS_SEQUENTIAL
     752                               | OPEN_SHARE_DENYREADWRITE
     753                               | OPEN_ACCESS_READWRITE,
     754                            NULL)))
     755        {
     756            if (!(pXIni = (PXINI)malloc(sizeof(XINI))))
     757                arc = ERROR_NOT_ENOUGH_MEMORY;
     758            else
    712759            {
    713                 pXIni = (PXINI)malloc(sizeof(XINI));
    714                 if (!pXIni)
    715                     arc = ERROR_NOT_ENOUGH_MEMORY;
     760                // OK: initialize XINI
     761                memset(pXIni, 0, sizeof(XINI));
     762                memcpy(pXIni->acMagic, XINI_MAGIC_BYTES, sizeof(XINI_MAGIC_BYTES));
     763                memcpy(pXIni->szFilename,
     764                       pcszFilename,
     765                       ulFilenameLen + 1);
     766                pXIni->hFile = hFile;
     767                // pXIni->hLock = hLock;
     768
     769                lstInit(&pXIni->llApps, FALSE);
     770
     771                if (ulAction == FILE_CREATED)
     772                    // file newly created: rewrite on close
     773                    pXIni->fDirty = TRUE;
    716774                else
     775                    // file existed: read data
     776                    if (arc = ReadINI(pXIni))
     777                        // error:
     778                        FreeINI(pXIni);
     779            }
     780
     781            if (!arc)
     782                *ppxini = pXIni;
     783            else
     784                DosClose(hFile);
     785        }
     786    }
     787
     788    return arc;
     789}
     790
     791/*
     792 *@@ xprfQueryProfileSize:
     793 *      returns the size of INI data, similarly to
     794 *      what PrfQueryProfileSize does.
     795 *
     796 *      If (pszAppName == NULL), this returns the size of
     797 *      the buffer required to hold the enumerated list
     798 *      of application names. pszKey is then ignored.
     799 *
     800 *      Otherwise, if (pszKeyName == NULL), this returns
     801 *      the size of the buffer required to hold the
     802 *      enumerated list of _key_ names for the given
     803 *      application.
     804 *
     805 *      If both pszAppName and pszKeyName are not NULL, this
     806 *      returns the data size of the given key.
     807 *
     808 *      Returns:
     809 *
     810 *      --  NO_ERROR
     811 *
     812 *@@added V1.0.0 (2002-09-17) [umoeller]
     813 */
     814
     815APIRET xprfQueryProfileSize(PXINI pXIni,          // in: profile opened with xprfOpenProfile
     816                            PCSZ pszAppName,      // in: application name or NULL
     817                            PCSZ pszKeyName,      // in: key name or NULL
     818                            PULONG pulDataLen)    // out: size of requested data
     819{
     820    APIRET  arc = NO_ERROR;
     821    ULONG   ulDataLen = 0;
     822
     823    if (!pszAppName)
     824    {
     825        PLISTNODE pAppNode = lstQueryFirstNode(&pXIni->llApps);
     826        while (pAppNode)
     827        {
     828            PXINIAPPDATA pAppDataThis = (PXINIAPPDATA)pAppNode->pItemData;
     829            ulDataLen += strlen(pAppDataThis->pszAppName) + 1;
     830            pAppNode = pAppNode->pNext;
     831        }
     832
     833        // extra byte for terminating extra null
     834        ++ulDataLen;
     835    }
     836    else
     837    {
     838        // app specified:
     839        PXINIAPPDATA pAppData;
     840
     841        if (!(arc = FindApp(pXIni,
     842                            pszAppName,
     843                            &pAppData)))
     844        {
     845            // app exists:
     846
     847            if (!pszKeyName)
     848            {
     849                // app != NULL, but key == NULL:
     850                // return size of keys list
     851                PLISTNODE pKeyNode = lstQueryFirstNode(&pAppData->llKeys);
     852                while (pKeyNode)
    717853                {
    718                     // OK: initialize XINI
    719                     memset(pXIni, 0, sizeof(XINI));
    720                     memcpy(pXIni->acMagic, XINI_MAGIC_BYTES, sizeof(XINI_MAGIC_BYTES));
    721                     strcpy(pXIni->szFilename, pcszFilename);
    722                     pXIni->hFile = hFile;
    723                     pXIni->hLock = hLock;
    724 
    725                     lstInit(&pXIni->llApps, FALSE);
    726 
    727                     if (ulAction == FILE_CREATED)
    728                         // file newly created: rewrite on close
    729                         pXIni->fDirty = TRUE;
     854                    PXINIKEYDATA pKeyDataThis = (PXINIKEYDATA)pKeyNode->pItemData;
     855                    ulDataLen += strlen(pKeyDataThis->pszKeyName) + 1;
     856                    pKeyNode = pKeyNode->pNext;
     857                }
     858
     859                // extra byte for terminating extra null
     860                ++ulDataLen;
     861            }
     862            else
     863            {
     864                // both app and key specified:
     865                PXINIKEYDATA pKeyData;
     866                if (!(arc = FindKey(pAppData,
     867                                    pszKeyName,
     868                                    &pKeyData)))
     869                    ulDataLen = pKeyData->cbData;
     870            }
     871        }
     872    }
     873
     874    if (pulDataLen)
     875        *pulDataLen = ulDataLen;
     876
     877    return arc;
     878}
     879
     880/*
     881 *@@ xprfQueryProfileData:
     882 *      reads data from the given XINI, similarly to
     883 *      what PrfQueryProfileData does.
     884 *
     885 *      If (pszAppName == NULL), this returns the
     886 *      enumerated list of application names.
     887 *      pszKey is then ignored. *pulBufferMax
     888 *      receives the total size of the list excluding
     889 *      the final NULL character.
     890 *
     891 *      Otherwise, if (pszKeyName == NULL), this the
     892 *      enumerated list of _key_ names for the given
     893 *      application. *pulBufferMax receives the total
     894 *      size of the list excluding the final NULL character.
     895 *
     896 *      If both pszAppName and pszKeyName are not NULL,
     897 *      this returns the data of the given key.
     898 *      pulBufferMax receives the bytes copied.
     899 *
     900 *      Returns:
     901 *
     902 *      --  NO_ERROR
     903 */
     904
     905APIRET xprfQueryProfileData(PXINI pXIni,          // in: profile opened with xprfOpenProfile
     906                            PCSZ pszAppName,      // in: application name
     907                            PCSZ pszKeyName,      // in: key name or NULL
     908                            PVOID pBuffer,        // in: buffer to receive data
     909                            PULONG pulBufferMax)  // in: buffer size, out: size of written data
     910{
     911    APIRET  arc = NO_ERROR;
     912    ULONG   ulDataLen = 0;
     913
     914    if (!pszAppName)
     915    {
     916        PLISTNODE pAppNode = lstQueryFirstNode(&pXIni->llApps);
     917        PBYTE   pbTarget = (PSZ)pBuffer;
     918        ULONG   cbCopied = 0;
     919        while (pAppNode)
     920        {
     921            PXINIAPPDATA pAppDataThis = (PXINIAPPDATA)pAppNode->pItemData;
     922            ULONG   cbThis = strlen(pAppDataThis->pszAppName) + 1;
     923            if (cbCopied + cbThis > *pulBufferMax)
     924                break;
     925            else
     926            {
     927                memcpy(pbTarget + cbCopied,
     928                       pAppDataThis->pszAppName,
     929                       cbThis);
     930                cbCopied += cbThis;
     931            }
     932
     933            pAppNode = pAppNode->pNext;
     934        }
     935
     936        // extra byte for terminating extra null
     937        pbTarget[cbCopied] = '\0';
     938        ulDataLen = cbCopied;       // PMREF says terminating null is not counted
     939    }
     940    else
     941    {
     942        // app specified:
     943        PXINIAPPDATA pAppData;
     944
     945        if (!(arc = FindApp(pXIni,
     946                            pszAppName,
     947                            &pAppData)))
     948        {
     949            // app exists:
     950
     951            if (!pszKeyName)
     952            {
     953                // app != NULL, but key == NULL:
     954                // return size of keys list
     955                PLISTNODE pKeyNode = lstQueryFirstNode(&pAppData->llKeys);
     956                PBYTE   pbTarget = (PSZ)pBuffer;
     957                ULONG   cbCopied = 0;
     958                while (pKeyNode)
     959                {
     960                    PXINIKEYDATA pKeyDataThis = (PXINIKEYDATA)pKeyNode->pItemData;
     961                    ULONG   cbThis = strlen(pKeyDataThis->pszKeyName) + 1;
     962                    if (cbCopied + cbThis > *pulBufferMax)
     963                        break;
    730964                    else
    731                         // file existed: read data
    732                         if (!ReadINI(pXIni))
    733                         {
    734                             // error:
    735                             FreeINI(pXIni);
    736                             pXIni = NULL;
    737                             arc = PRFERR_READ;
    738                         }
    739 
    740                     if ((pXIni) && (ppxini))
    741                         *ppxini = pXIni;
     965                    {
     966                        memcpy(pbTarget + cbCopied,
     967                               pKeyDataThis->pszKeyName,
     968                               cbThis);
     969                        cbCopied += cbThis;
     970                    }
     971
     972                    pKeyNode = pKeyNode->pNext;
     973                }
     974
     975                // extra byte for terminating extra null
     976                pbTarget[cbCopied] = '\0';
     977                ulDataLen = cbCopied;       // PMREF says terminating null is not counted
     978            }
     979            else
     980            {
     981                // both app and key specified:
     982                PXINIKEYDATA pKeyData;
     983                if (!(arc = FindKey(pAppData,
     984                                    pszKeyName,
     985                                    &pKeyData)))
     986                {
     987                    ulDataLen = min(pKeyData->cbData,
     988                                    *pulBufferMax);
     989                    memcpy(pBuffer,
     990                           pKeyData->pbData,
     991                           ulDataLen);
    742992                }
    743993            }
    744994        }
     995    }
     996
     997    if (pulBufferMax)
     998        *pulBufferMax = ulDataLen;
    745999
    7461000    return arc;
    7471001}
    748 
    749 /*
    750  *@@ xprfQueryProfileData:
    751  *      similar to PrfQueryProfileData.
    752  *
    753  *      @@todo: Still to be written.
    754  */
    755 
    756 /* BOOL xprfQueryProfileData(PXINI hIni,            // in: profile opened with xprfOpenProfile
    757                           const char *pcszApp,
    758                           const char *pcszKey,
    759                           PVOID pBuffer,
    760                           PULONG pulBufferMax)
    761 {
    762     BOOL brc = FALSE;
    763 
    764     return brc;
    765 } */
    7661002
    7671003/*
     
    7921028 *      as "dirty" so that the file will be rewritten
    7931029 *      on xprfCloseProfile.
    794  */
    795 
    796 BOOL xprfWriteProfileData(PXINI hIni,           // in: profile opened with xprfOpenProfile
    797                           const char *pcszApp,  // in: application name
    798                           const char *pcszKey,  // in: key name or NULL
    799                           PVOID pData,          // in: data to write or NULL
    800                           ULONG ulDataLen)      // in: sizeof(*pData) or null
    801 {
    802     BOOL brc = FALSE;
    803 
    804     if (hIni)
    805     {
    806         PXINI pXIni = (PXINI)hIni;
    807         if (memcmp(pXIni->acMagic, XINI_MAGIC_BYTES, sizeof(XINI_MAGIC_BYTES))
    808                         == 0)
    809         {
    810             // check if application exists
    811             PXINIAPPDATA pAppData = FindApp(pXIni,
    812                                             pcszApp);
    813 
    814             // now check: does caller want entire application deleted?
    815             if (!pcszKey)
     1030 *
     1031 *      Returns:
     1032 *
     1033 *      --  NO_ERROR
     1034 */
     1035
     1036APIRET xprfWriteProfileData(PXINI pXIni,          // in: profile opened with xprfOpenProfile
     1037                            const char *pcszApp,  // in: application name
     1038                            const char *pcszKey,  // in: key name or NULL
     1039                            PVOID pData,          // in: data to write or NULL
     1040                            ULONG ulDataLen)      // in: sizeof(*pData) or null
     1041{
     1042    APIRET  arc = NO_ERROR;
     1043
     1044    if (    (!pXIni)
     1045         || (memcmp(pXIni->acMagic, XINI_MAGIC_BYTES, sizeof(XINI_MAGIC_BYTES)))
     1046       )
     1047        arc = ERROR_INVALID_PARAMETER;
     1048    else
     1049    {
     1050        // check if application exists
     1051        PXINIAPPDATA pAppData;
     1052
     1053        if (FindApp(pXIni,
     1054                    pcszApp,
     1055                    &pAppData))
     1056            // not found:
     1057            pAppData = NULL;
     1058
     1059        // now check: does caller want entire application deleted?
     1060        if (!pcszKey)
     1061        {
     1062            // yes, delete application: did we find it?
     1063            if (pAppData)
    8161064            {
    817                 // yes, delete application: did we find it?
     1065                // yes: kill that
     1066                FreeApp(pAppData);
     1067                // and remove from list
     1068                lstRemoveItem(&pXIni->llApps, pAppData);
     1069
     1070                // rewrite profile on close
     1071                pXIni->fDirty = TRUE;
     1072            }
     1073            // else application doesn't exist:
     1074            // nothing to do return NO_ERROR
     1075        }
     1076        else
     1077        {
     1078            // caller has specified key:
     1079            // does caller want a key to be deleted?
     1080            if (!ulDataLen)
     1081            {
     1082                // yes: delete key:
    8181083                if (pAppData)
    8191084                {
    820                     // yes: kill that
    821                     FreeApp(pAppData);
    822                     // and remove from list
    823                     brc = lstRemoveItem(&pXIni->llApps, pAppData);
    824                     pXIni->cApps--;
    825                     // rewrite profile on close
    826                     pXIni->fDirty = TRUE;
     1085                    // app exists:
     1086                    FreeKeyIfExists(pXIni,
     1087                                    pAppData,
     1088                                    pcszKey);
    8271089                }
    828                 else
    829                     // application doesn't exist:
    830                     brc = TRUE;
     1090                // else app doesn't even exist:
     1091                // nothing to do, return NO_ERROR
    8311092            }
    8321093            else
    8331094            {
    834                 // caller has specified key:
    835                 // does caller want a key to be deleted?
    836                 if (!ulDataLen)
     1095                // key and data specified: let's add something...
     1096
     1097                if (!pAppData)
     1098                    // app doesn't exist yet:
     1099                    // create
     1100                    arc = CreateApp(pXIni,
     1101                                    pcszApp,
     1102                                    &pAppData);
     1103
     1104                if (!arc)
    8371105                {
    838                     // yes: delete key:
    839                     if (pAppData)
    840                     {
    841                         // app exists:
    842                         // find key
    843                         PXINIKEYDATA pKeyData = FindKey(pAppData,
    844                                                         pcszKey);
    845                         if (pKeyData)
    846                         {
    847                             // key exists: kill that
    848                             FreeKey(pKeyData);
    849                             // and remove from app's keys list
    850                             brc = lstRemoveItem(&pAppData->llKeys, pKeyData);
    851                             pAppData->cKeys--;
    852                             // rewrite profile on close
    853                             pXIni->fDirty = TRUE;
    854                         }
    855                         else
    856                             // key doesn't even exist:
    857                             brc = TRUE;
    858                     }
    859                     else
    860                         // app doesn't even exist:
    861                         brc = TRUE;
    862                 }
    863                 else
    864                 {
    865                     // key and data specified: let's add something...
    866 
    867                     if (!pAppData)
    868                         // app doesn't exist yet:
    869                         // create
    870                         pAppData = CreateApp(pXIni,
    871                                              pcszApp);
    872 
    873                     if (pAppData)
    874                     {
    875                         // found or created app:
    876                         // check if key exists
    877                         PXINIKEYDATA pKeyData = FindKey(pAppData,
    878                                                         pcszKey);
    879                         if (!pKeyData)
    880                             // doesn't exist yet:
    881                             // create
    882                             pKeyData = CreateKey(pAppData,
    883                                                  pcszKey,
    884                                                  (PBYTE)pData,
    885                                                  ulDataLen);
    886 
    887                         if (pKeyData)
    888                         {
    889                            // mark as dirty
    890                            pXIni->fDirty = TRUE;
    891                            brc = TRUE;
    892                         }
    893                     }
     1106                    // found or created app:
     1107
     1108                    // delete existing key if it exists
     1109                    PXINIKEYDATA pKeyData;
     1110
     1111                    FreeKeyIfExists(pXIni,
     1112                                    pAppData,
     1113                                    pcszKey);
     1114
     1115                    // now create new key
     1116                    if (!(arc = CreateKey(pAppData,
     1117                                          pcszKey,
     1118                                          (PBYTE)pData,
     1119                                          ulDataLen,
     1120                                          &pKeyData)))
     1121                       // mark as dirty
     1122                       pXIni->fDirty = TRUE;
    8941123                }
    8951124            }
     
    8971126    }
    8981127
    899     return brc;
     1128    return arc;
    9001129}
    9011130
     
    9091138 *      You cannot specify HINI_SYSTEM or HINI_USER for
    9101139 *      hINi.
    911  */
    912 
    913 BOOL xprfCloseProfile(PXINI hIni)       // in: profile opened with xprfOpenProfile
    914 {
    915     BOOL brc = FALSE;
    916 
    917     if (hIni)
    918     {
    919         PXINI pXIni = (PXINI)hIni;
    920         if (memcmp(pXIni->acMagic, XINI_MAGIC_BYTES, sizeof(XINI_MAGIC_BYTES))
    921                         == 0)
    922         {
    923             brc = TRUE;
    924 
    925             if (pXIni->fDirty)
    926                 brc = WriteINI(pXIni);
    927 
    928             if (brc)
     1140 *
     1141 *      Returns:
     1142 *
     1143 *      --  NO_ERROR
     1144 */
     1145
     1146APIRET xprfCloseProfile(PXINI pXIni)       // in: profile opened with xprfOpenProfile
     1147{
     1148    APIRET  arc = NO_ERROR;
     1149
     1150    if (    (!pXIni)
     1151         || (memcmp(pXIni->acMagic, XINI_MAGIC_BYTES, sizeof(XINI_MAGIC_BYTES)))
     1152       )
     1153        arc = ERROR_INVALID_PARAMETER;
     1154    else
     1155    {
     1156        if (pXIni->fDirty)
     1157            arc = WriteINI(pXIni);
     1158
     1159        if (!arc)
     1160        {
     1161            if (!(arc = DosClose(pXIni->hFile)))
    9291162            {
    930                 APIRET arc = DosProtectClose(pXIni->hFile,
    931                                              pXIni->hLock);
    932                 if (arc == NO_ERROR)
    933                 {
    934                     pXIni->hFile = 0;
    935                     pXIni->hLock = 0;
    936 
    937                     FreeINI(pXIni);
    938                 }
    939                 else
    940                     brc = FALSE;
     1163                pXIni->hFile = 0;
     1164
     1165                FreeINI(pXIni);
    9411166            }
    9421167        }
    9431168    }
    9441169
    945     return brc;
    946 }
    947 
    948 
     1170    return arc;
     1171}
     1172
     1173/*
     1174 *@@ xprfQueryKeysForApp:
     1175 *      the equivalent of prfhQueryKeysForApp for
     1176 *      XINI files.
     1177 *
     1178 *@@added V1.0.0 (2002-09-17) [umoeller]
     1179 */
     1180
     1181APIRET xprfQueryKeysForApp(PXINI hIni,      // in: INI handle
     1182                           PCSZ pcszApp,    // in: application to query list for (or NULL for applications list)
     1183                           PSZ *ppszKeys)   // out: keys list (newly allocated)
     1184{
     1185    APIRET  arc = NO_ERROR;
     1186    PSZ     pKeys = NULL;
     1187    ULONG   ulSizeOfKeysList = 0;
     1188
     1189    // get size of keys list for pszApp
     1190    if (!xprfQueryProfileSize(hIni, pcszApp, NULL, &ulSizeOfKeysList))
     1191        arc = PRFERR_KEYSLIST;
     1192    else
     1193    {
     1194        if (ulSizeOfKeysList == 0)
     1195            ulSizeOfKeysList = 1;    // V0.9.19 (2002-04-11) [pr]
     1196
     1197        if (!(pKeys = (PSZ)malloc(ulSizeOfKeysList)))
     1198            arc = ERROR_NOT_ENOUGH_MEMORY;
     1199        else
     1200        {
     1201            *pKeys = 0;
     1202            if (!xprfQueryProfileData(hIni, pcszApp, NULL, pKeys, &ulSizeOfKeysList))
     1203                arc = PRFERR_KEYSLIST;
     1204        }
     1205    }
     1206
     1207    if (!arc)       // V0.9.12 (2001-05-12) [umoeller]
     1208        *ppszKeys = pKeys;
     1209    else
     1210        if (pKeys)
     1211            free(pKeys);
     1212
     1213    return arc;
     1214}
     1215
  • trunk/src/helpers/xprf2.c

    r167 r229  
    7777
    7878APIRET xprfCopyKey(HINI hiniSource,       // in: source profile (can be HINI_USER or HINI_SYSTEM)
    79                    PSZ pszSourceApp,      // in: source application
    80                    PSZ pszKey,            // in: source/target key
     79                   PCSZ pszSourceApp,     // in: source application
     80                   PCSZ pszKey,           // in: source/target key
    8181                   PXINI hiniTarget,      // in: target profile opened with xprfOpenProfile
    82                    PSZ pszTargetApp)      // in: target app
     82                   PCSZ pszTargetApp)     // in: target app
    8383{
    8484    ULONG   ulSizeOfData = 0;
    8585    APIRET  arc = NO_ERROR;
    8686
    87     if (PrfQueryProfileSize(hiniSource, pszSourceApp, pszKey, &ulSizeOfData))
     87    if (PrfQueryProfileSize(hiniSource,
     88                            (PSZ)pszSourceApp,
     89                            (PSZ)pszKey,
     90                            &ulSizeOfData))
    8891    {
    8992        PSZ pData = 0;
     
    107110            fflush(stdout);
    108111            if (PrfQueryProfileData(hiniSource,
    109                                     pszSourceApp,
    110                                     pszKey,
     112                                    (PSZ)pszSourceApp,
     113                                    (PSZ)pszKey,
    111114                                    pData,
    112115                                    &ulSizeOfData))
    113116            {
    114                 if (!xprfWriteProfileData(hiniTarget,
    115                                           pszTargetApp,
    116                                           pszKey,
    117                                           pData,
    118                                           ulSizeOfData))
     117                arc = xprfWriteProfileData(hiniTarget,
     118                                           pszTargetApp,
     119                                           pszKey,
     120                                           pData,
     121                                           ulSizeOfData);
     122            }
     123            else
     124                arc = PRFERR_READ;
     125
     126            free(pData);
     127        }
     128        else
     129            arc = ERROR_NOT_ENOUGH_MEMORY;
     130    }
     131    else
     132        arc = PRFERR_DATASIZE;
     133
     134    return arc;
     135}
     136
     137/*
     138 *@@ xprfCopyKey2:
     139 *      copies a single key from an xprf* PXINI to a Prf* HINI.
     140 *      hiniSource must therefore have been opened using
     141 *      xprfOpenProfile.
     142 *
     143 *      This returns 0 (NO_ERROR) if copying succeeded. Otherwise either
     144 *      an OS/2 error code (ERROR_*) or one of the profile error
     145 *      codes defined in prfh.h is returned.
     146 *
     147 *@@added V1.0.0 (2002-09-17) [umoeller]
     148 */
     149
     150APIRET xprfCopyKey2(PXINI hiniSource,   // in: source profile (can be HINI_USER or HINI_SYSTEM)
     151                    PCSZ pszSourceApp,  // in: source application
     152                    PCSZ pszKey,        // in: source/target key
     153                    HINI hiniTarget,    // in: target profile opened with xprfOpenProfile
     154                    PCSZ pszTargetApp)  // in: target app
     155{
     156    ULONG   ulSizeOfData = 0;
     157    APIRET  arc = NO_ERROR;
     158
     159    if (xprfQueryProfileSize(hiniSource, pszSourceApp, pszKey, &ulSizeOfData))
     160    {
     161        PSZ pData = 0;
     162
     163        // copy data
     164        if (ulSizeOfData == 0)
     165        {
     166            // data size == 0: this shouldn't really happen,
     167            // but if it does, we'll just create a NULL string.
     168            // Users have reported that some INI files seem to
     169            // contain those "empty" keys. I don't see how these
     170            // can exist, but they seem to...
     171            pData = (PSZ)malloc(1);
     172            *pData = 0;
     173        }
     174        else
     175            pData = (PSZ)malloc(ulSizeOfData);
     176
     177        if (pData)
     178        {
     179            fflush(stdout);
     180            if (xprfQueryProfileData(hiniSource,
     181                                     pszSourceApp,
     182                                     pszKey,
     183                                     pData,
     184                                     &ulSizeOfData))
     185            {
     186                if (!PrfWriteProfileData(hiniTarget,
     187                                         (PSZ)pszTargetApp,
     188                                         (PSZ)pszKey,
     189                                         pData,
     190                                         ulSizeOfData))
    119191                    arc = PRFERR_WRITE;
    120192            }
     
    135207/*
    136208 *@@ xprfCopyApp:
    137  *      copies a single application from an Prf* HINI to an xprf* PXINI.
     209 *      copies a single application from a Prf* HINI to an xprf* PXINI.
    138210 *      hiniTarget must therefore have been opened using
    139211 *      xprfOpenProfile.
     
    146218 */
    147219
    148 APIRET xprfCopyApp(HINI hiniSource,   // in: source profile (can be HINI_USER or HINI_SYSTEM)
    149                    PSZ pszSourceApp,  // in: source application
    150                    PXINI hiniTarget,  // in: target profile opened with xprfOpenProfile
    151                    PSZ pszTargetApp,  // in: name of pszSourceApp in hiniTarget
    152                    PSZ pszErrorKey)   // out: failing key in case of error; ptr can be NULL
     220APIRET xprfCopyApp(HINI hiniSource,     // in: source profile (can be HINI_USER or HINI_SYSTEM)
     221                   PCSZ pszSourceApp,   // in: source application
     222                   PXINI hiniTarget,    // in: target profile opened with xprfOpenProfile
     223                   PCSZ pszTargetApp,   // in: name of pszSourceApp in hiniTarget
     224                   PSZ pszErrorKey)     // out: failing key in case of error; ptr can be NULL
    153225{
    154226    APIRET arc = NO_ERROR;
     
    167239        {
    168240            // copy this key
    169             arc = xprfCopyKey(hiniSource,
    170                               pszSourceApp,
    171                               pKey2,
    172                               hiniTarget,
    173                               pszTargetApp);
    174             if (arc)
     241            if (arc = xprfCopyKey(hiniSource,
     242                                  pszSourceApp,
     243                                  pKey2,
     244                                  hiniTarget,
     245                                  pszTargetApp))
    175246            {
    176247                // error: copy failing key to buffer
     
    179250                break;
    180251            }
     252
     253            pKey2 += strlen(pKey2)+1;
     254        } // end while (*pKey2 != 0)
     255
     256        free (pszKeysList);
     257    }
     258    else
     259        arc = PRFERR_KEYSLIST;
     260
     261    return arc;
     262}
     263
     264/*
     265 *@@ xprfCopyApp2:
     266 *      copies a single application from an xprf* PXINI to a Prf* HINI.
     267 *      hiniTarget must therefore have been opened using
     268 *      xprfOpenProfile.
     269 *
     270 *      This calls xprfCopyKey2 for each key in the application.
     271 *
     272 *      This returns 0 (NO_ERROR) if copying succeeded. Otherwise either
     273 *      an OS/2 error code (ERROR_*) or one of the profile error
     274 *      codes defined in prfh.h is returned.
     275 *
     276 *@@added V1.0.0 (2002-09-17) [umoeller]
     277 */
     278
     279APIRET xprfCopyApp2(PXINI hiniSource,   // in: source profile (can be HINI_USER or HINI_SYSTEM)
     280                    PCSZ pszSourceApp,  // in: source application
     281                    HINI hiniTarget,    // in: target profile opened with xprfOpenProfile
     282                    PCSZ pszTargetApp,  // in: name of pszSourceApp in hiniTarget
     283                    PSZ pszErrorKey)    // out: failing key in case of error; ptr can be NULL
     284{
     285    APIRET arc = NO_ERROR;
     286    PSZ pszKeysList = NULL;
     287
     288    if (pszErrorKey)
     289        *pszErrorKey = 0;
     290
     291    if (!(arc = xprfQueryKeysForApp(hiniSource,
     292                                    pszSourceApp,
     293                                    &pszKeysList)))
     294    {
     295        PSZ pKey2 = pszKeysList;
     296
     297        while (*pKey2 != 0)
     298        {
     299            // copy this key
     300            if (arc = xprfCopyKey2(hiniSource,
     301                                   pszSourceApp,
     302                                   pKey2,
     303                                   hiniTarget,
     304                                   pszTargetApp))
     305            {
     306                // error: copy failing key to buffer
     307                if (pszErrorKey)
     308                    strcpy(pszErrorKey, pKey2);
     309                break;
     310            }
     311
    181312            pKey2 += strlen(pKey2)+1;
    182313        } // end while (*pKey2 != 0)
     
    208339
    209340APIRET xprfCopyProfile(HINI hOld,           // in: source profile (can be HINI_USER or HINI_SYSTEM)
    210                        PSZ pszNew,          // in: new filename (can be fully qualified)
     341                       PCSZ pszNew,         // in: new filename (can be fully qualified)
    211342                       PFN_PRF_PROGRESS pfnProgressCallback,
    212343                       ULONG ulUser,        // in: passed to pfnProgressCallback
    213344                       ULONG ulCount,       // in: index of INI being copied (0 <= ulCount <= ulMax)
    214                        ULONG ulMax)         // in: maximum index (for progress); 0 means 1 INI, 1 means 2 INIs, ...
     345                       ULONG ulMax,         // in: maximum index (for progress); 0 means 1 INI, 1 means 2 INIs, ...
     346                       PSZ pszFailingApp)   // out: failing app on error
    215347{
    216348    APIRET  arc = NO_ERROR;
     
    218350    ULONG   ulSizeOfAppsList;
    219351
     352    if (pszFailingApp)
     353        *pszFailingApp = 0;
     354
    220355    if (!pszNew)
    221356        arc = ERROR_INVALID_PARAMETER;
    222357    else
    223358    {
    224         DosDelete(pszNew);
     359        DosDelete((PSZ)pszNew);
    225360
    226361        // open new profile
    227         arc = xprfOpenProfile(pszNew,
    228                               &pxiniNew);
    229 
    230         // get size of applications list
    231         if (arc == NO_ERROR)
    232         {
     362        if (!(arc = xprfOpenProfile(pszNew,
     363                                    &pxiniNew)))
     364        {
     365            // get size of applications list
    233366            if (!PrfQueryProfileSize(hOld, NULL, NULL, &ulSizeOfAppsList))
    234367                arc = PRFERR_APPSLIST;
     
    256389                {
    257390                    CHAR szErrorKey[1000];
     391
    258392                    // copy application (this will call prfhCopyKey in turn)
    259                     arc = xprfCopyApp(hOld,
    260                                       pApp2,
    261                                       pxiniNew,
    262                                       pApp2,
    263                                       szErrorKey);
    264 
    265                     if (pfnProgressCallback)
     393                    if (arc = xprfCopyApp(hOld,
     394                                          pApp2,
     395                                          pxiniNew,
     396                                          pApp2,
     397                                          szErrorKey))
     398                    {
     399                        if (pszFailingApp)
     400                            strhncpy0(pszFailingApp, pApp2, CCHMAXPATH);
     401                    }
     402                    else if (pfnProgressCallback)
    266403                    {
    267404                        ULONG ulNow2, ulMax2;
     
    325462APIRET xprfSaveINIs(HAB hab,               // in:  anchor block
    326463                    PFN_PRF_PROGRESS pfnProgressCallback,
    327                     ULONG ulUser)
     464                    ULONG ulUser,
     465                    PSZ pszFailingINI,
     466                    PSZ pszFailingApp,
     467                    PSZ pszFailingKey)
    328468{
    329469    PRFPROFILE Profiles;
     
    400540
    401541        if (arc == NO_ERROR)
     542        {
     543            if (pszFailingINI)
     544                strcpy(pszFailingINI,
     545                       szSysNew);
     546
    402547            arc = xprfCopyProfile(HINI_SYSTEM,
    403548                                  szSysNew,              // new filename
    404549                                  pfnProgressCallback,
    405                                   ulUser, 0, 1);
     550                                  ulUser,
     551                                  0,
     552                                  1,
     553                                  pszFailingApp);
     554        }
     555
    406556        /*
    407557         * create OS2SYS.XFL:
     
    410560
    411561        if (arc == NO_ERROR)
     562        {
     563            if (pszFailingINI)
     564                strcpy(pszFailingINI,
     565                       szUserNew);
     566
    412567            arc = xprfCopyProfile(HINI_USER,
    413568                                  szUserNew,              // new filename
    414569                                  pfnProgressCallback,
    415                                   ulUser, 1, 1);
     570                                  ulUser,
     571                                  1,
     572                                  1,
     573                                  pszFailingApp);
     574        }
    416575    }
    417576
     
    453612    {
    454613        // finally, replace system profiles
    455         arc = DosMove(szSysNew, Profiles.pszSysName);
    456         if (arc == NO_ERROR)
    457             arc = DosMove(szUserNew, Profiles.pszUserName);
     614        if (!(arc = DosMove(szSysNew, Profiles.pszSysName)))
     615        {
     616            if (arc = DosMove(szUserNew, Profiles.pszUserName))
     617            {
     618                if (pszFailingINI)
     619                    strcpy(pszFailingINI,
     620                           szUserNew);
     621            }
     622        }
     623        else
     624        {
     625            if (pszFailingINI)
     626                strcpy(pszFailingINI,
     627                       szSysNew);
     628        }
    458629    }
    459630
     
    468639// testing
    469640
    470 /* BOOL _Optlink fnCallback(ULONG ulUser, ULONG ulNow, ULONG ulMax)
     641#ifdef __BUILD_XPRF2_MAIN__
     642
     643BOOL _Optlink fnCallback(ULONG ulUser, ULONG ulNow, ULONG ulMax)
    471644{
    472645    printf("\r done %03d%%", ulNow * 100 / ulMax);
     
    476649int main(int argc, char* argv[])
    477650{
    478     if (argc != 3)
    479         printf("Syntax: xprf2 <source.ini> <target.ini>\n");
    480     else
    481     {
    482         HAB hab = WinInitialize(0);
    483 
    484         // HINI hiniSource = PrfOpenProfile(hab, argv[1]);
    485         // if (hiniSource)
    486         {
    487             APIRET arc = xprfCopyProfile(hiniSource,
    488                                          argv[2],
    489                                          fnCallback,
    490                                          0, 0, 0);
    491             xprfSaveProfiles(hab, NULL, 0);
    492 //             if (arc)
    493 
    494 
    495    //              printf("xprfCopyProfile returned %d.\n", arc);
    496         }
    497         // else
    498             // printf("Cannot open %s\n", argv[1]);
    499 
    500         WinTerminate(hab);
    501     }
    502 
    503     return (0);
    504 } */
    505 
     651    APIRET  arc = 2;
     652
     653    HAB     hab = WinInitialize(0);
     654
     655    CHAR    szFailingINI[CCHMAXPATH] = "",
     656            szFailingApp[CCHMAXPATH] = "",
     657            szFailingKey[CCHMAXPATH] = "";
     658
     659    arc = xprfSaveINIs(hab,
     660                       NULL,
     661                       0,
     662                       szFailingINI,
     663                       szFailingApp,
     664                       szFailingKey);
     665
     666    printf("xprfCopyProfile returned %d ('%s', '%s', '%s'.\n",
     667           arc,
     668           szFailingINI,
     669           szFailingApp,
     670           szFailingKey);
     671
     672    WinTerminate(hab);
     673
     674    return arc;
     675}
     676
     677#endif
     678
Note: See TracChangeset for help on using the changeset viewer.