Changeset 4 for trunk/common_functions


Ignore:
Timestamp:
Jul 13, 2017, 5:17:57 AM (8 years ago)
Author:
stevenhl
Message:

Import modifications from cwmm-0_2_9-work-01_10_2006.zip dated 2006-08-27

Location:
trunk/common_functions
Files:
4 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/common_functions/helper.c

    r2 r4  
    7070void HlpWriteToTrapLog(const char* chrFormat, ...);
    7171
    72 #if 0
    73 /****************************************************
    74  *                                                  *
    75  * This funktion returns the running OS version:    *
    76  *                                                  *
    77  * 30: Warp 3, 40 Warp 4                            *
    78  *                                                  *
    79  ****************************************************/
    80 ULONG cwQueryOSRelease()
    81 {
    82   static ULONG ulVersionMinor=0;
    83 
    84   if(!ulVersionMinor)
    85     if(DosQuerySysInfo(QSV_VERSION_MINOR, QSV_VERSION_MINOR, &ulVersionMinor, sizeof(ulVersionMinor)))
    86       ulVersionMinor=30;/* Default Warp 3 */
    87 
    88   return ulVersionMinor;
    89 
    90 }
    91 #endif
    9272
    9373void removeLog(void)
     
    564544}
    565545#endif
    566 
     546#if 0
     547if(SysQueryHomeDir(chrHomeDir, sizeof(chrHomeDir))) {
     548    strcpy(chrPath, chrHomeDir);
     549    strncat(chrPath, "\\WPSWIZZ.INI", size-strlen(chrPath)-1);/* Default is INI file in users home dir */
     550    return;
     551  }
     552
     553  strcpy(chrPath, queryHelpPath());
     554  if((ptrChar=strrchr(chrPath, '\\'))!=NULLHANDLE) {
     555    *ptrChar=0;
     556    if((ptrChar=strrchr(chrPath, '\\'))!=NULLHANDLE)
     557      *ptrChar=0;
     558  }
     559  strncat(chrPath, "\\WPSWIZZ.INI", size-strlen(chrPath)-1);
     560  chrPath[size-1]=0;
     561#endif
     562
     563/*
     564  Query the path to the INI file used by the MM progs to store the private data.
     565  If a home dir exists on the users system the INI file will be create there otherwise
     566  in the directory where the calling EXE is located.
     567 */
    567568BOOL HlpBuildMMProgIniFileName(char* chrProgname, char * chrBuffer, ULONG ulBufferSize)
    568569{
    569570  char * chrPtr; 
    570   strncpy(chrBuffer, chrProgname,ulBufferSize);
    571   chrBuffer[ulBufferSize-1]=0;
     571
     572  /* Default is INI file in users home dir */
     573  if(SysQueryHomeDir(chrBuffer, ulBufferSize)) {
     574    strlcat(chrBuffer, MMCLS_INI_FILE_NAME, ulBufferSize); /* MMCLS_INI_FILE_NAME = "\\CWMM.INI" */
     575    return TRUE;
     576  }
     577
     578  /* No HOME dir for some reason */
     579  strlcpy(chrBuffer, chrProgname, ulBufferSize);
    572580
    573581  if((chrPtr=strrchr(chrBuffer,'\\'))==NULLHANDLE)
    574     return FALSE;
     582    return FALSE; // This shouldn't happen!
    575583
    576584  *chrPtr=0;
    577   strncat(chrBuffer,INI_FILE_NAME, ulBufferSize-strlen(chrBuffer)-1);
     585  strlcat(chrBuffer, MMCLS_INI_FILE_NAME, ulBufferSize);
    578586
    579587  return TRUE;
  • trunk/common_functions/img_funcs.c

    r2 r4  
    22  This file conatins functions for loading image files.
    33 */
     4
    45#define  INCL_PM
     6#define INCL_OS2MM
    57#define  INCL_MMIOOS2
    68
     
    1820/* This function loads a supported image file.      */
    1921/* Every format for which MMOS2 has an IO procedure */
    20 /* may be used here.                                */
     22/* may be used here. In contrast to                 */
     23/* ImgLoadImageFile() a provided BMPINFOHEADER2     */
     24/* structure is filled with data.                   */
     25/*                                                  */
    2126/*                                                  */
    2227/* @@RETURNS                                        */
     
    2429/* HBITMAP hBitmap                                  */
    2530/*                                                  */
    26 /* HAndle to the bitmap of NULL.                    */
     31/* Handle to the bitmap or NULL.                    */
     32/*                                                  */
     33/* @@PARAM                                          */
     34/*                                                  */
     35/* PSZ pszFileName input                            */
     36/*                                                  */
     37/* Name of the image file to load.                  */
     38/*                                                  */
     39/* @@PARAM                                          */
     40/*                                                  */
     41/* PBITMAPINFOHEADER2 pBMPInfoHeader2 in/out        */
     42/*                                                  */
     43/* Pointer to a BITMAPINFOHEADER2 structure.        */
     44/*                                                  */
     45/*                                                  */
     46/* @@REMARKS                                        */
     47/*                                                  */
     48/* The caller must free the bitmap handle after     */
     49/* use.                                             */
    2750/*                                                  */
    2851/*!!*************************************************/
    29 HBITMAP ImgLoadImageFile (  PSZ pszFileName )
     52HBITMAP ImgLoadImageFileAndHeader( PSZ pszFileName, PBITMAPINFOHEADER2 pBMPInfoHeader2)
    3053{
    3154    HBITMAP       hbm;
    32     HBITMAP       hbmTarget;
    3355    MMIOINFO      mmioinfo;
    34         MMFORMATINFO  mmFormatInfo;
     56    MMFORMATINFO  mmFormatInfo;
    3557    HMMIO         hmmio;
    36         ULONG         ulImageHeaderLength;
    37         MMIMAGEHEADER mmImgHdr;
     58    ULONG         ulImageHeaderLength;
     59    MMIMAGEHEADER mmImgHdr;
    3860    ULONG         ulBytesRead;
    3961    ULONG         dwNumRowBytes;
     
    131153            return (0L);
    132154    }
    133     /*
    134     memcpy(pBMPInfoHeader2, &mmImgHdr.mmXDIBHeader.BMPInfoHeader2,
    135            sizeof(BITMAPINFOHEADER2)+256*sizeof(RGB2) );
    136            */
     155
    137156    /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
     157    *pBMPInfoHeader2=mmImgHdr.mmXDIBHeader.BMPInfoHeader2;
    138158
    139159    /*
     
    226246                            NULL);
    227247
    228 #if 0
    229     hbm = GpiCreateBitmap ( hps,
    230                             pBMPInfoHeader2,
    231                             0L,
    232                             NULL,
    233                             NULL);
    234 #endif
    235 
    236248    if ( !hbm )
    237249    {
     
    250262      return(0L);
    251263    }
    252     /*
    253     // ***************************************************
    254     // Select the bitmap into the memory device context.
    255     // ***************************************************/
     264    /****************************************************
     265      Select the bitmap into the memory device context.
     266      ***************************************************/
    256267    hbReturnCode = GpiSetBitmap ( hps,
    257268                                  hbm );
    258     /*
    259     //***************************************************************
    260     //  LOAD THE BITMAP DATA FROM THE FILE
    261     //      One line at a time, starting from the BOTTOM
    262     //*************************************************************** */
     269    /***************************************************************
     270      LOAD THE BITMAP DATA FROM THE FILE
     271      One line at a time, starting from the BOTTOM
     272      ****************************************************************/
    263273
    264274    for ( dwRowCount = 0; dwRowCount < dwHeight; dwRowCount++ )
     
    294304
    295305
    296 BOOL ImgGetBmpInfoHeader(PBITMAPINFOHEADER2  bmpih2, PSZ pszFileName /*, char* procName, ULONG ulLength*/)
     306/*!**************************************************/
     307/*                                                  */
     308/* @@DESC                                           */
     309/*                                                  */
     310/* This function loads a supported image file.      */
     311/* Every format for which MMOS2 has an IO procedure */
     312/* may be used here.                                */
     313/*                                                  */
     314/* @@PARAM                                          */
     315/*                                                  */
     316/* PSZ pszFileName input                            */
     317/*                                                  */
     318/* Name of the image file to load.                  */
     319/*                                                  */
     320/* @@RETURNS                                        */
     321/*                                                  */
     322/* HBITMAP hBitmap                                  */
     323/*                                                  */
     324/* Handle to the bitmap of NULL.                    */
     325/*                                                  */
     326/*!!*************************************************/
     327HBITMAP ImgLoadImageFile (  PSZ pszFileName )
     328{
     329  BITMAPINFOHEADER2  bmpih2;
     330
     331  return ImgLoadImageFileAndHeader ( pszFileName, &bmpih2 );
     332}
     333
     334
     335
     336/*!**************************************************/
     337/*                                                  */
     338/* @@DESC                                           */
     339/*                                                  */
     340/* Build a BITMAPINFOHEADER2 for the given file.    */
     341/*                                                  */
     342/* @@PARAM                                          */
     343/*                                                  */
     344/* PSZ pszFileName input                            */
     345/*                                                  */
     346/* Name of the image file.                          */
     347/*                                                  */
     348/* @@PARAM                                          */
     349/*                                                  */
     350/* PBITMAPINFOHEADER2 pBMPInfoHeader2 in/out        */
     351/*                                                  */
     352/* Pointer to a BITMAPINFOHEADER2 structure.        */
     353/*                                                  */
     354/* @@RETURNS                                        */
     355/*                                                  */
     356/* TRUE on success, FALSE otherwise                 */
     357/*                                                  */
     358/*!!*************************************************/
     359BOOL ImgGetBmpInfoHeader(PSZ pszFileName, PBITMAPINFOHEADER2  bmpih2)
    297360{
    298361    MMIOINFO      mmioinfo;
     
    305368    ULONG         ulReturnCode;
    306369    ULONG ulBytesRead;
    307     char *pName;
    308370   
    309     //  if(procName)
    310     //   procName[0]=0;
    311 
    312371    /* Check file size */
    313372    if(SysQueryFileSize(pszFileName)==0)
  • trunk/common_functions/include/img_funcs.h

    r2 r4  
    33
    44HBITMAP ImgLoadImageFile (  PSZ pszFileName );
    5 BOOL ImgGetBmpInfoHeader(PBITMAPINFOHEADER2  bmpih2, PSZ pszFileName /*, char* procName, ULONG ulLength*/);
     5HBITMAP ImgLoadImageFileAndHeader (  PSZ pszFileName, PBITMAPINFOHEADER2 pBMPInfoHeader2);
     6BOOL ImgGetBmpInfoHeader(PSZ pszFileName, PBITMAPINFOHEADER2  bmpih2 /*, char* procName, ULONG ulLength*/);
    67
    78#endif
  • trunk/common_functions/include/ini_funcs.h

    r2 r4  
    66#endif
    77
    8 BOOL IniSaveWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd);
    9 BOOL IniRestoreWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd, ULONG fSize);
     8BOOL PrfSaveWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd);
     9BOOL PrfRestoreWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd, ULONG fSize);
     10BOOL PrfWriteString(HINI hini, char * iniFile, char* chrApp, char *chrKey, char* chrString);
     11BOOL PrfQueryString(HINI hini, char * iniFile, char* chrApp, char *chrKey, char* chrDefault, char* chrBuffer, ULONG ulSize);
    1012
    1113#if __cplusplus
  • trunk/common_functions/include/message_funcs.h

    r2 r4  
    99                  char* title, ULONG ulTitleID, LONG lSizeTitle,
    1010                  HMODULE hResource, HWND hwnd, ULONG ulFlags);
    11 ULONG showMessageBox2(HWND hwnd, ULONG ulIDTitle, ULONG ulIDText, HMODULE hModule, ULONG ulFlag);
     11ULONG MsgShowMessageBox(HWND hwnd, ULONG ulIDTitle, ULONG ulIDText, HMODULE hModule, ULONG ulFlag);
    1212BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd);
    1313BOOL MsgGetMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd);
     14
     15#if 0
     16ULONG showMessageBox2(HWND hwnd, ULONG ulIDTitle, ULONG ulIDText, HMODULE hModule, ULONG ulFlag);
     17#endif
     18
    1419#ifdef __CPLUSPLUS__
    1520}
  • trunk/common_functions/include/sys_funcs.h

    r2 r4  
    2828ULONG SysQueryDriveType(ULONG ulDriveNum);
    2929ULONG SysQueryFreeDriveSpace(ULONG ulDriveNum, ULONG *ulTotal, ULONG * ulFree, ULONG* ulBytesUnit);
    30 ULONG SysQueryDiskName(ULONG ulDriveNum, ULONG ulSize, char *chrBuffer);
     30ULONG SysQueryDiskName(ULONG ulDriveNum, char *chrBuffer, ULONG ulSize);
    3131BOOL SysQueryHomeDir(char* chrBuf, ULONG ulSize);
    3232
  • trunk/common_functions/ini_funcs.c

    r2 r4  
    11/*
    2  * This file is (C) Chris Wohlgemuth 2001-2004
     2 * This file is (C) Chris Wohlgemuth 2001-2005
    33 */
    4 
    54#define INCL_WIN
    65
    76#include <os2.h>
    87
    9 /*
    10   hini may be NULL. Then the filename is used to open the ini file.
    11  */
    12 /*!**************************************************/
     8/*!**************************************************/
     9/*                                                  */
     10/* @@MODULE                                         */
     11/*                                                  */
     12/* Profile functions                                */
    1313/*                                                  */
    1414/* @@DESC                                           */
     
    3131/*                                                  */
    3232/*!!*************************************************/
    33 BOOL IniSaveWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd)
     33BOOL PrfSaveWindowPos(HINI hini, char* iniFile, char* chrApp, char* chrKey, HWND hwnd)
    3434{
    3535  BOOL bError=FALSE;
     
    6565/*!**************************************************/
    6666/*                                                  */
     67/* @@MODULE                                         */
     68/*                                                  */
     69/* Profile functions                                */
     70/*                                                  */
    6771/* @@DESC                                           */
    6872/*                                                  */
     
    8589/*                                                  */
    8690/*!!*************************************************/
    87 BOOL IniRestoreWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd, ULONG fSize)
     91BOOL PrfRestoreWindowPos(HINI hini, char * iniFile, char* chrApp, char *chrKey, HWND hwnd, ULONG fSize)
    8892{
    8993  HINI hiniPriv=hini;
     
    115119}
    116120
    117 
    118 
     121/*!**************************************************/
     122/*                                                  */
     123/* @@MODULE                                         */
     124/*                                                  */
     125/* Profile functions                                */
     126/*                                                  */
     127/* @@DESC                                           */
     128/*                                                  */
     129/* Save a string in an INI file.                    */
     130/*                                                  */
     131/*            .                                     */
     132/*                                                  */
     133/* @@REMARKS                                        */
     134/*                                                  */
     135/* If hini is NULL the given file name will be used */
     136/* for opening the INI file. If hini is not NULL    */
     137/* the file name is ignored.                        */
     138/*                                                  */
     139/* @@RETURNS                                        */
     140/*                                                  */
     141/* BOOL fSuccess                                    */
     142/*                                                  */
     143/* TRUE: Function succeeded.                        */
     144/* FALSE: Error occurred                            */
     145/*                                                  */
     146/*!!*************************************************/
     147BOOL PrfWriteString(HINI hini, char * iniFile, char* chrApp, char *chrKey, char* chrString)
     148{
     149  BOOL bError=FALSE;
     150  HINI hiniPriv=hini;
     151
     152  if(!hini && !iniFile)
     153    return FALSE;
     154
     155  do {
     156    if(!hiniPriv) {
     157      /* Open ini-file */
     158      if((hiniPriv=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),(unsigned char *)iniFile))
     159         ==NULLHANDLE)
     160        break;
     161    }/* end of if(!hiniPriv) */
     162
     163    if(!PrfWriteProfileString(hiniPriv, chrApp, chrKey, chrString))
     164      bError=TRUE;
     165
     166    if(hiniPriv && !hini)
     167      PrfCloseProfile(hiniPriv);
     168   
     169    if(bError)
     170      break;
     171    return TRUE;
     172  } while(TRUE);
     173  return FALSE;
     174}
     175
     176/*!**************************************************/
     177/*                                                  */
     178/* @@MODULE                                         */
     179/*                                                  */
     180/* Profile functions                                */
     181/*                                                  */
     182/* @@DESC                                           */
     183/*                                                  */
     184/* Get a string from an INI file.                   */
     185/*                                                  */
     186/*            .                                     */
     187/*                                                  */
     188/* @@REMARKS                                        */
     189/*                                                  */
     190/* If hini is NULL the given file name will be used */
     191/* for opening the INI file. If hini is not NULL    */
     192/* the file name is ignored.                        */
     193/*                                                  */
     194/* @@RETURNS                                        */
     195/*                                                  */
     196/* ULONG ulLength                                   */
     197/*                                                  */
     198/* TRUE: Function succeeded.                        */
     199/* FALSE: Error occurred                            */
     200/*                                                  */
     201/*!!*************************************************/
     202BOOL PrfQueryString(HINI hini, char * iniFile, char* chrApp, char *chrKey, char* chrDefault, char* chrBuffer, ULONG ulSize)
     203{
     204  HINI hiniPriv=hini;
     205  ULONG ulRC=0;
     206
     207  do{
     208    if(!hiniPriv) {
     209      if((hiniPriv=PrfOpenProfile(WinQueryAnchorBlock(HWND_DESKTOP),(unsigned char *)iniFile))
     210         ==NULLHANDLE)
     211        break;
     212    }/* end of if(!hini) */
     213
     214    ulRC=PrfQueryProfileString(hiniPriv, chrApp, chrKey, chrDefault, chrBuffer, ulSize);
     215
     216    if(hiniPriv && !hini)
     217      PrfCloseProfile(hiniPriv);
     218   
     219      break;
     220  } while(TRUE);
     221  return ulRC;
     222}
     223
     224
  • trunk/common_functions/listbox_funcs.c

    r2 r4  
    1414#endif
    1515
     16/*!***********************************************************/
     17/*                                                           */
     18/* @@DESC                                                    */
     19/*                                                           */
     20/* To be written...                                          */
     21/*                                                           */
     22/*!!**********************************************************/
    1623SHORT LBFindMatch(HWND hwndLB, char *chrMatchText)
    1724{
  • trunk/common_functions/menu_funcs.c

    r2 r4  
    7676}
    7777
     78/*!***********************************************************/
     79/*                                                           */
     80/* @@DESC                                                    */
     81/*                                                           */
     82/* To be written...                                          */
     83/*                                                           */
     84/*!!**********************************************************/
    7885SHORT menuQueryItemCount(HWND hwndMenu)
    7986{
     
    8289}
    8390
     91/*!***********************************************************/
     92/*                                                           */
     93/* @@DESC                                                    */
     94/*                                                           */
     95/* To be written...                                          */
     96/*                                                           */
     97/*!!**********************************************************/
    8498MRESULT menuCheckItem(HWND hwndMenu, USHORT usID, BOOL fIncludeSubMenu, BOOL fCheck)
    8599{
     
    88102}
    89103
     104/*!***********************************************************/
     105/*                                                           */
     106/* @@DESC                                                    */
     107/*                                                           */
     108/* To be written...                                          */
     109/*                                                           */
     110/*!!**********************************************************/
    90111MRESULT menuRemoveItem(HWND hwndMenu, USHORT usID, BOOL fIncludeSubMenu)
    91112{
     
    94115}
    95116
     117/*!***********************************************************/
     118/*                                                           */
     119/* @@DESC                                                    */
     120/*                                                           */
     121/* To be written...                                          */
     122/*                                                           */
     123/*!!**********************************************************/
    96124MRESULT menuCheckForItem(HWND hwndMenu, USHORT usID, BOOL fIncludeSubMenu)
    97125{
  • trunk/common_functions/message.c

    r2 r4  
    44#include <os2.h>
    55#include <stdio.h>
     6#include <stdlib.h>
    67#include <string.h>
    78
     
    4445/* ULONG ulResult                                   */
    4546/*                                                  */
    46 /* MBID_ERROR is case of an error.                  */
     47/* MBID_ERROR in case of an error.                  */
    4748/* :p.                                              */
    4849/* Result code from WinMessageBox().                */
     
    8283}
    8384
     85#if 0
    8486/*!**************************************************/
    8587/*                                                  */
     
    8991/* the resource DLL or the EXE file.                */
    9092/* Unlike messagebox no buffers must be given but   */
    91 /* only the string IDs. MAx title length is 100,    */
     93/* only the string IDs. Max title length is 256,    */
    9294/* max text length 256.                             */
     95/* :p.                                              */
     96/*                                                  */
     97/* This function is obsolete.                       */
     98/* Use MsgShowMessageBox() instead.                 */
    9399/*                                                  */
    94100/* @@RETURNS                                        */
     
    96102/* ULONG ulResult                                   */
    97103/*                                                  */
    98 /* MBID_ERROR is case of an error.                  */
     104/* MBID_ERROR in case of an error.                  */
    99105/* :p.                                              */
    100106/* Result code from WinMessageBox().                */
    101107/*                                                  */
     108/* @@REMARKS                                        */
     109/*                                                  */
     110/* This function is obsolete.                       */
     111/* Use MsgShowMessageBox() instead.                 */
    102112/*                                                  */
    103113/*!!*************************************************/
     
    105115{
    106116  char text[256];
    107   char title[100];
     117  char title[256];
    108118
    109119  return mBox(  text, ulIDText , sizeof(text),
     
    111121               hModule, hwnd, ulFlag);
    112122};
     123#endif
     124
     125/*!**************************************************/
     126/*                                                  */
     127/* @@DESC                                           */
     128/*                                                  */
     129/* Show a message box with text strings loaded from */
     130/* the resource DLL or the EXE file.                */
     131/* Unlike messagebox() no buffers must be given but */
     132/* only the string IDs. Max title length is 256,    */
     133/* max text length 256.                             */
     134/*                                                  */
     135/* @@PARAM                                          */
     136/*                                                  */
     137/* HWND hwnd input                                  */
     138/*                                                  */
     139/* Handle to a window. This will be the owner of    */
     140/* the message box.                                 */
     141/*                                                  */
     142/* @@PARAM                                          */
     143/*                                                  */
     144/* ULONG ulIDTitle input                            */
     145/*                                                  */
     146/* ID of the string to be used as the title.        */
     147/*                                                  */
     148/* @@PARAM                                          */
     149/*                                                  */
     150/* ULONG ulIDText input                             */
     151/*                                                  */
     152/* ID of the string to be used as the text.         */
     153/*                                                  */
     154/* @@PARAM                                          */
     155/*                                                  */
     156/* HMODULE hModule input                            */
     157/*                                                  */
     158/* Handle to a ressource DLL or NULLHANDLE. If      */
     159/* this parameter is null the strings will be       */
     160/* taken from ressources bound to the executable.   */
     161/*                                                  */
     162/* @@PARAM                                          */
     163/*                                                  */
     164/* ULONG ulFlags input                              */
     165/*                                                  */
     166/* Flags specifying the appearance of the message   */
     167/* box. See WinMessageBox() for more information.   */
     168/*                                                  */
     169/* @@RETURNS                                        */
     170/*                                                  */
     171/* ULONG ulResult                                   */
     172/*                                                  */
     173/* MBID_ERROR in case of an error. This may be      */
     174/* for example if the ressources can't be found.    */
     175/* :p.                                              */
     176/* Result code from WinMessageBox().                */
     177/*                                                  */
     178/* @@REMARKS                                        */
     179/*                                                  */
     180/* The parent of the message box is HWND_DESKTOP.   */
     181/*                                                  */
     182/*!!*************************************************/
     183ULONG MsgShowMessageBox(HWND hwnd, ULONG ulIDTitle, ULONG ulIDText, HMODULE hModule, ULONG ulFlag)
     184{
     185  char* pText;
     186  char* pTitle;
     187  ULONG rc;
     188
     189#define TLENGTH 256L
     190
     191  if(NULLHANDLE==(pText=malloc(TLENGTH*2*sizeof(char))))
     192    return MBID_ERROR;
     193
     194  pTitle=pText+TLENGTH*sizeof(char);
     195
     196  rc=mBox( pText, ulIDText , TLENGTH,
     197           pTitle, ulIDTitle, TLENGTH,
     198           hModule, hwnd, ulFlag);
     199
     200  free(pText);
     201  return rc;
     202};
     203
    113204
    114205/*!**************************************************/
     
    125216/* TRUE if string was found in the resource DLL or  */
    126217/* EXE file. FALSE otherwise.                       */
     218/*                                                  */
     219/* @@REMARKS                                        */
     220/*                                                  */
     221/* This function is obsolete.                       */
     222/* Use MsgGetMessage() instead.                     */
    127223/*                                                  */
    128224/*!!*************************************************/
     
    136232}
    137233
     234/*!***********************************************************/
     235/*                                                           */
     236/* Load a message string from a resource DLL or the          */
     237/* EXE file.                                                 */
     238/*                                                           */
     239/* @@RETURNS                                                 */
     240/*                                                           */
     241/* BOOL rc                                                   */
     242/*                                                           */
     243/* TRUE if string was found in the resource DLL or           */
     244/* EXE file. FALSE otherwise.                                */
     245/*                                                           */
     246/* @@REMARKS                                                 */
     247/*                                                           */
     248/* If an error occurs an empty string is placed in the       */
     249/* buffer.                                                   */
     250/*                                                           */
     251/*!!**********************************************************/
    138252BOOL MsgGetMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd)
    139253{
  • trunk/common_functions/rexx_funcs.c

    r2 r4  
    2525 } RXSTEMDATA;
    2626
     27/*!**************************************************/
     28/*                                                  */
     29/* @@DESC                                           */
     30/*                                                  */
     31/* To be written...                                 */
     32/*                                                  */
     33/*!!*************************************************/
    2734LONG RxGetLongFromStemWithoutNumber(RXSTRING args, char * chrTail, ULONG* ulError)
    2835{
     
    7481}
    7582
    76 /*************************************************************/
     83/*!***********************************************************/
     84/*                                                           */
     85/* @@DESC                                                    */
    7786/*                                                           */
    7887/* This function returns a string from a stem. The caller    */
    7988/* must free the returned string with free()                 */
    8089/*                                                           */
    81 /*************************************************************/
     90/*!!**********************************************************/
    8291PSZ RxGetStringFromStemWithoutNumber(RXSTRING args, char *chrTail, ULONG* ulError)
    8392{
     
    125134}
    126135
    127 /*************************************************************/
     136/*!***********************************************************/
     137/*                                                           */
     138/* @@DESC                                                    */
    128139/*                                                           */
    129140/* This function returns a long from a REXX var.             */
    130141/*                                                           */
    131 /*************************************************************/
     142/*!!**********************************************************/
    132143LONG RxGetLongFromVar(char * chrVar, ULONG* ulError)
    133144{
     
    175186}
    176187
     188/*!***********************************************************/
     189/*                                                           */
     190/* @@DESC                                                    */
     191/*                                                           */
     192/* To be written...                                          */
     193/*                                                           */
     194/*!!**********************************************************/
    177195LONG RxSetLongInRexxVar(char* chrVar, ULONG ulVal)
    178196{
  • trunk/common_functions/sys_funcs.c

    r2 r4  
    2222#endif
    2323 
    24   /**!**************************************************/
    25   /*                                                  */
    26   /* @@DESC                                           */
    27   /*                                                  */
    28   /* This funktion returns the drive letter of the    */
    29   /* boot partition.                                  */
    30   /*                                                  */
    31   /* @@RETURNS                                        */
    32   /*                                                  */
    33   /* char chrDrive                                    */
    34   /*                                                  */
    35   /* Drive from which the system was booted.          */
    36   /*                                                  */
    37   /**!!*************************************************/
     24/*!**************************************************/
     25/*                                                  */
     26/* @@DESC                                           */
     27/*                                                  */
     28/* This funktion returns the drive letter of the    */
     29/* boot partition.                                  */
     30/*                                                  */
     31/* @@RETURNS                                        */
     32/*                                                  */
     33/* char chrDrive                                    */
     34/*                                                  */
     35/* Drive from which the system was booted.          */
     36/*                                                  */
     37/*!!*************************************************/
    3838char SysQueryBootDriveLetter(void)
    3939{
     
    7373}
    7474
    75 /**!**************************************************/
     75/*
     76   Documentation script can't handle the const keyword yet!!!!
     77*/
     78/*--->!**************************************************/
    7679/*                                                  */
    7780/* @@DESC                                           */
     
    8790/* !parsing is broken at the moment because of const and (...)              */
    8891/*                                                  */
    89 /**!!*************************************************/
     92/*!!*************************************************/
    9093void SysWriteToTrapLog(const char* chrFormat, ...)
    9194{
     
    143146/* Size of the file.                                */
    144147/*                                                  */
     148/* @@REMARKS                                        */
     149/*                                                  */
     150/* In case of a nonexistant file 0 is returned. So  */
     151/* it's necessary to first check if the file exists.*/
     152/*                                                  */
    145153/*!!*************************************************/
    146154ULONG SysQueryFileSize(char* chrFileName)
     
    179187}
    180188
     189/*!**************************************************/
     190/*                                                  */
     191/* @@DESC                                           */
     192/*                                                  */
     193/* To be written...                                 */
     194/*                                                  */
     195/*!!*************************************************/
    181196ULONG SysQueryDriveType(ULONG ulDriveNum)
    182197{
     
    215230     
    216231      //      SysWriteToTrapLog("Drive nr.: %d, rc for DSK_BLOCKREMOVABLE-> ERROR_NOT_SUPPORTED\n", ulDriveNum);
    217       sprintf(chrDev, "%c:", 'a'+ulDriveNum-1);
     232      sprintf(chrDev, "%c:", 'a'+(char)(ulDriveNum-1));
    218233      cbBuf=sizeof(buf);
    219234     
     
    350365#endif
    351366
     367/*!**************************************************/
     368/*                                                  */
     369/* @@DESC                                           */
     370/*                                                  */
     371/* To be written...                                 */
     372/*                                                  */
     373/*!!*************************************************/
    352374ULONG SysQueryFreeDriveSpace(ULONG ulDriveNum, ULONG *ulTotal, ULONG * ulFree, ULONG* ulBytesUnit)
    353375{
     
    371393}
    372394
    373 /*
    374   The returned volname is always terminated by zero.
    375   ulDriveNum:  1...26
    376  */
    377 ULONG SysQueryDiskName(ULONG ulDriveNum, ULONG ulSize, char *chrBuffer)
     395/*!**************************************************/
     396/*                                                  */
     397/* @@DESC                                           */
     398/*                                                  */
     399/* This function returns the home directory of the  */
     400/* current user.                                    */
     401/*                                                  */
     402/* @@RETURNS                                        */
     403/*                                                  */
     404/* ULONG rc                                         */
     405/*                                                  */
     406/* NO_ERROR is returned if the function succeeds.   */
     407/*                                                  */
     408/* @@PARAM                                          */
     409/*                                                  */
     410/* ULONG ulDriveNum input                           */
     411/*                                                  */
     412/* The number of the drive to be queried (1-26).    */
     413/*                                                  */
     414/* @@PARAM                                          */
     415/*                                                  */
     416/* char* chrBuffer in/out                           */
     417/*                                                  */
     418/* Pointer to a buffer where the volume name will   */
     419/* be placed.                                       */
     420/*                                                  */
     421/* @@PARAM                                          */
     422/*                                                  */
     423/* ULONG ulSize input                               */
     424/*                                                  */
     425/* Size of the name buffer.                         */
     426/*                                                  */
     427/* @@REMARKS                                        */
     428/*                                                  */
     429/* The returned name is always terminated by zero.  */
     430/*                                                  */
     431/*!!*************************************************/
     432
     433ULONG SysQueryDiskName(ULONG ulDriveNum, char *chrBuffer, ULONG ulSize)
    378434{
    379435  FSINFO fsIBuf;
     
    394450}
    395451
     452/*!**************************************************/
     453/*                                                  */
     454/* @@DESC                                           */
     455/*                                                  */
     456/* This function returns the home directory of the  */
     457/* current user.                                    */
     458/*                                                  */
     459/* @@RETURNS                                        */
     460/*                                                  */
     461/* BOOL fSuccess                                    */
     462/*                                                  */
     463/* TRUE if the home dir is specified and does exist */
     464/*                                                  */
     465/* @@PARAM                                          */
     466/*                                                  */
     467/* char* chrBuf in/out                              */
     468/*                                                  */
     469/* Pointer to a buffer where the home directory     */
     470/* name will be placed.                             */
     471/*                                                  */
     472/* @@PARAM                                          */
     473/*                                                  */
     474/* ULONG ulSize input                               */
     475/*                                                  */
     476/* Size of the name buffer.                         */
     477/*                                                  */
     478/* @@REMARKS                                        */
     479/*                                                  */
     480/* The returned string is always terminated by zero.*/
     481/* .p:                                              */
     482/* If a directory is specified in the HOME          */
     483/* environment variable but doesn't exist FALSE is  */
     484/* returned and a message is written to the apps    */
     485/* exception log.                                   */
     486/*                                                  */
     487/*!!*************************************************/
    396488BOOL SysQueryHomeDir(char* chrBuf, ULONG ulSize)
    397489{
     
    400492  if(!chrHome || !chrBuf)
    401493    return FALSE;
    402 
    403 #if 0
    404   SysWriteToTrapLog("r:\\temp: %d , r:\\bla: %d \n",
    405                     SysCheckFileExists("r:\\temp"), SysCheckFileExists("r:\\bla"));
    406 #endif
    407494
    408495  if(strlcpy(chrBuf, chrHome, ulSize)>=ulSize) {
  • trunk/common_functions/uptime.c

    r2 r4  
    257257}
    258258
     259/*!***********************************************************/
     260/*                                                           */
     261/* @@DESC                                                    */
     262/*                                                           */
     263/* To be written...                                          */
     264/*                                                           */
     265/*!!**********************************************************/
    259266ULONG SysGetUptimeSecs(BOOL fUseTimer)
    260267{
     
    265272}
    266273
     274/*!***********************************************************/
     275/*                                                           */
     276/* @@DESC                                                    */
     277/*                                                           */
     278/* To be written...                                          */
     279/*                                                           */
     280/*!!**********************************************************/
    267281char* SysGetUptimeString(BOOL fUseTimer, char * chrBuffer, ULONG ulSize)
    268282{
Note: See TracChangeset for help on using the changeset viewer.