Ignore:
Timestamp:
Sep 20, 2000, 11:32:58 PM (25 years ago)
Author:
hugh
Message:

Implemented Serial APIs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/HandleManager.cpp

    r4256 r4285  
    1 /* $Id: HandleManager.cpp,v 1.49 2000-09-13 21:10:56 sandervl Exp $ */
     1/* $Id: HandleManager.cpp,v 1.50 2000-09-20 21:32:50 hugh Exp $ */
    22
    33/*
     
    1212 */
    1313
    14 #undef DEBUG_LOCAL
    15 //#define DEBUG_LOCAL
     14//#undef DEBUG_LOCAL
     15#define DEBUG_LOCAL
    1616
    1717
     
    6363#include <vmutex.h>
    6464
    65 #define DBG_LOCALLOG    DBG_handlemanager
     65#define DBG_LOCALLOG  DBG_handlemanager
    6666#include "dbglocal.h"
    6767
     
    7878 *****************************************************************************/
    7979
     80typedef struct _HMDEVICE;
    8081
    8182typedef struct _HMHANDLE
     
    9293  LPSTR           pszDeviceName;       /* name or alias of the pseudo-device */
    9394  HMDeviceHandler *pDeviceHandler;         /* handler for this pseudo-device */
     95  VOID            *pDevData;         /* Pointer To Device data */
    9496} HMDEVICE, *PHMDEVICE;
    9597
     
    155157static ULONG            _Optlink _HMHandleQuery(HANDLE hHandle);
    156158
     159// Get GlobalDeviceData
     160static VOID *_HMDeviceGetData (LPSTR pszDeviceName);
    157161
    158162
     
    199203  return (HMGlobals.pHMOpen32);    /* haven't found anything, return default */
    200204}
    201 
     205/*****************************************************************************
     206 * Name      : static VOID *_HMDeviceGetData
     207 * Purpose   : obtain pointer to device data from the table by searching
     208 *             for a device name or alias
     209 * Parameters: PSZ pszDeviceName
     210 * Variables :
     211 * Result    : VOID * - pointer to the handlers device data
     212 * Remark    :
     213 * Status    :
     214 *
     215 * Author    : Markus Montkowski
     216 *****************************************************************************/
     217
     218static VOID *_HMDeviceGetData (LPSTR pszDeviceName)
     219{
     220  PHMDEVICE pHMDevice;                     /* iterator over the device table */
     221
     222  if (pszDeviceName != NULL)
     223    for (pHMDevice = TabWin32Devices;  /* loop over all devices in the table */
     224         pHMDevice != NULL;
     225         pHMDevice = pHMDevice->pNext)
     226    {
     227      if (stricmp(pHMDevice->pszDeviceName,       /* case-insensitive search */
     228                  pszDeviceName) == 0)
     229        return (pHMDevice->pDevData);    /* OK, we've found our device */
     230    }
     231
     232  return (NULL);    /* haven't found anything, return NULL */
     233}
    202234
    203235/*****************************************************************************
     
    227259                                                       /* free handle found ? */
    228260    if (INVALID_HANDLE_VALUE == TabWin32Handles[ulLoop].hmHandleData.hHMHandle) {
    229         TabWin32Handles[ulLoop].hmHandleData.dwUserData     = 0;
    230         TabWin32Handles[ulLoop].hmHandleData.dwInternalType = HMTYPE_UNKNOWN;
    231         handleMutex.leave();
    232         return (ulLoop);                    /* OK, then return it to the caller */
     261  TabWin32Handles[ulLoop].hmHandleData.dwUserData     = 0;
     262  TabWin32Handles[ulLoop].hmHandleData.dwInternalType = HMTYPE_UNKNOWN;
     263  TabWin32Handles[ulLoop].hmHandleData.lpDeviceData   = NULL;
     264      handleMutex.leave();
     265        return (ulLoop);                    /* OK, then return it to the caller */
    233266    }
    234267  }
     
    261294}
    262295
    263 
    264296/*****************************************************************************
    265297 * Name      : static int _HMHandleQuery
     
    301333 *****************************************************************************/
    302334
    303 DWORD   HMDeviceRegister(LPSTR           pszDeviceName,
    304                          HMDeviceHandler *pDeviceHandler)
     335DWORD   HMDeviceRegisterEx(LPSTR           pszDeviceName,
     336                           HMDeviceHandler *pDeviceHandler,
     337                           VOID            *pDevData)
    305338{
    306339  PHMDEVICE pHMDevice;                     /* our new device to be allocated */
     
    324357  pHMDevice->pDeviceHandler = pDeviceHandler;     /* store pointer to device */
    325358  pHMDevice->pNext = TabWin32Devices;                   /* establish linkage */
     359  pHMDevice->pDevData = pDevData;
    326360
    327361  TabWin32Devices = pHMDevice;        /* insert new node as root in the list */
     
    330364}
    331365
     366DWORD   HMDeviceRegister(LPSTR           pszDeviceName,
     367                         HMDeviceHandler *pDeviceHandler)
     368{
     369  return HMDeviceRegisterEx(pszDeviceName, pDeviceHandler, NULL);
     370}
    332371
    333372/*****************************************************************************
     
    355394    // fill handle table
    356395    for(ulIndex = 0; ulIndex < MAX_OS2_HMHANDLES; ulIndex++) {
    357         TabWin32Handles[ulIndex].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     396        TabWin32Handles[ulIndex].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    358397    }
    359398    handleMutex.leave();
     
    471510
    472511  if(ulHandle == 0) {
    473         ulHandle = 1; //SvL: Start searching from index 1
     512  ulHandle = 1; //SvL: Start searching from index 1
    474513  }
    475514  do
     
    478517    if (TabWin32Handles[ulHandle].hmHandleData.hHMHandle == INVALID_HANDLE_VALUE)
    479518    {
    480         *phHandle16 = ulHandle;
    481         TabWin32Handles[ulHandle].hmHandleData.hHMHandle = hHandleOS2;
    482         HMGlobals.ulHandleLast = ulHandle;          /* to shorten search times */
    483 
    484         handleMutex.leave();
    485         return (NO_ERROR);                                               /* OK */
     519      *phHandle16 = ulHandle;
     520        TabWin32Handles[ulHandle].hmHandleData.hHMHandle = hHandleOS2;
     521        TabWin32Handles[ulHandle].hmHandleData.lpDeviceData = NULL;
     522        HMGlobals.ulHandleLast = ulHandle;          /* to shorten search times */
     523
     524    handleMutex.leave();
     525        return (NO_ERROR);                                               /* OK */
    486526    }
    487527
     
    771811
    772812  if((fdwOdinOptions & DUPLICATE_ACCESS_READWRITE) == DUPLICATE_ACCESS_READWRITE) {
    773         pHMHandleData->dwAccess = GENERIC_READ | GENERIC_WRITE;
    774   }
    775   else 
     813  pHMHandleData->dwAccess = GENERIC_READ | GENERIC_WRITE;
     814  }
     815  else
    776816  if(fdwOdinOptions & DUPLICATE_ACCESS_READ) {
    777         pHMHandleData->dwAccess = GENERIC_READ;
     817  pHMHandleData->dwAccess = GENERIC_READ;
    778818  }
    779819
    780820  if(fdwOdinOptions & DUPLICATE_SHARE_READ) {
    781         pHMHandleData->dwShare = FILE_SHARE_READ;
    782   } 
     821  pHMHandleData->dwShare = FILE_SHARE_READ;
     822  }
    783823  else
    784824  if(fdwOdinOptions & DUPLICATE_SHARE_DENYNONE) {
    785         pHMHandleData->dwShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
     825  pHMHandleData->dwShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
    786826  }
    787827  else  pHMHandleData->dwShare = TabWin32Handles[srchandle].hmHandleData.dwShare;
     
    798838  TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = iIndexNew;
    799839  TabWin32Handles[iIndexNew].pDeviceHandler         = pDeviceHandler;
    800 
    801840                                                  /* call the device handler */
    802841  rc = pDeviceHandler->DuplicateHandle(&TabWin32Handles[iIndexNew].hmHandleData,
     
    854893  PHMHANDLEDATA   pHMHandleData;
    855894  HMHANDLEDATA    HMHandleTemp;          /* temporary buffer for handle data */
     895  VOID            *pDevData;
    856896
    857897  /* create new handle by either lpFileName or hTemplateFile */
     
    874914  {
    875915    pDeviceHandler = _HMDeviceFind((LPSTR)lpFileName);        /* find device */
    876 
    877916    if (NULL == pDeviceHandler)                /* this name is unknown to us */
    878917    {
     
    883922      pHMHandleData  = NULL;
    884923
     924    pDevData       = _HMDeviceGetData((LPSTR)lpFileName);
     925
    885926    if(pDeviceHandler == HMGlobals.pHMOpen32) {
    886         pDeviceHandler = HMGlobals.pHMFile;
     927  pDeviceHandler = HMGlobals.pHMFile;
    887928    }
    888929  }
     
    910951    HMHandleTemp.dwFlags    = dwFlagsAndAttributes;
    911952    HMHandleTemp.lpHandlerData = NULL;
     953    HMHandleTemp.lpDeviceData  = pDevData;
    912954  }
    913955
     
    918960  HMHandleTemp.hHMHandle                    = iIndexNew;
    919961  TabWin32Handles[iIndexNew].pDeviceHandler = pDeviceHandler;
    920 
    921962                                  /* now copy back our temporary handle data */
    922963  memcpy(&TabWin32Handles[iIndexNew].hmHandleData,
     
    10081049  int             iIndexNew;                  /* index into the handle table */
    10091050  HMDeviceHandler *pDeviceHandler;         /* device handler for this handle */
     1051  VOID            *pDevData;
    10101052  PHMHANDLEDATA   pHMHandleData;
    10111053  DWORD           rc;                                     /* API return code */
     
    10201062  else
    10211063    pHMHandleData  = NULL;
     1064
     1065  pDevData       = _HMDeviceGetData((LPSTR)lpFileName);
    10221066
    10231067  if(pDeviceHandler == HMGlobals.pHMOpen32) {
     
    10461090  pHMHandleData->dwFlags    = 0;
    10471091  pHMHandleData->lpHandlerData = NULL;
    1048 
     1092  pHMHandleData->lpDeviceData  = pDevData;
    10491093
    10501094      /* we've got to mark the handle as occupied here, since another device */
     
    10531097          /* write appropriate entry into the handle table if open succeeded */
    10541098  TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = iIndexNew;
    1055   TabWin32Handles[iIndexNew].pDeviceHandler       = pDeviceHandler;
     1099  TabWin32Handles[iIndexNew].pDeviceHandler         = pDeviceHandler;
    10561100
    10571101  rc = pDeviceHandler->OpenFile  (lpFileName,     /* call the device handler */
     
    10691113  if(rc != NO_ERROR)     /* oops, creation failed within the device handler */
    10701114  {
    1071         TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    1072         SetLastError(pOFStruct->nErrCode);
    1073         return (INVALID_HANDLE_VALUE);                           /* signal error */
     1115      TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     1116      SetLastError(pOFStruct->nErrCode);
     1117      return (INVALID_HANDLE_VALUE);                           /* signal error */
    10741118  }
    10751119  else {
    1076         if(fuMode & (OF_DELETE|OF_EXIST)) {
    1077                 //file handle already closed
    1078                 TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    1079                 return TRUE; //TODO: correct?
    1080         }
    1081         if(fuMode & OF_PARSE) {
    1082                 TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    1083                 return 0;
    1084         }
    1085         if(fuMode & OF_VERIFY) {
    1086                 TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    1087                 return 1; //TODO: correct?
    1088         }
     1120    if(fuMode & (OF_DELETE|OF_EXIST)) {
     1121    //file handle already closed
     1122        TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     1123    return TRUE; //TODO: correct?
     1124  }
     1125  if(fuMode & OF_PARSE) {
     1126        TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     1127    return 0;
     1128  }
     1129  if(fuMode & OF_VERIFY) {
     1130        TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     1131    return 1; //TODO: correct?
     1132  }
    10891133  }
    10901134
     
    10921136  dprintf(("KERNEL32/HandleManager: OpenFile(%s)=%08xh\n",
    10931137           lpFileName,
    1094            hResult));
     1138           iIndexNew));
    10951139#endif
    10961140
     
    18041848    dprintf(("KERNEL32: HandleManager:HMWaitForSingleObject(%08xh) passed on to Open32.\n",
    18051849             hObject));
    1806    
     1850
    18071851    // maybe handles from CreateProcess() ...
    18081852    dwResult = O32_WaitForSingleObject(hObject, dwTimeout);
     
    25762620  if (rc != NO_ERROR)     /* oops, creation failed within the device handler */
    25772621  {
    2578         TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    2579         SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
    2580         if(rc == ERROR_ALREADY_EXISTS) {
    2581                 return hOldMemMap; //return handle of existing file mapping
    2582         }
    2583         else    return (NULL);                                           /* signal error */
     2622      TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     2623      SetLastError(rc);          /* Hehe, OS/2 and NT are pretty compatible :) */
     2624    if(rc == ERROR_ALREADY_EXISTS) {
     2625    return hOldMemMap; //return handle of existing file mapping
     2626  }
     2627  else  return (NULL);                                           /* signal error */
    25842628  }
    25852629  else
     
    27582802               *pLoop1));
    27592803
    2760           *pLoop2 = *pLoop1;
     2804    *pLoop2 = *pLoop1;
    27612805////      O32_SetLastError(ERROR_INVALID_HANDLE);
    27622806////      return (WAIT_FAILED);
     
    28132857 *****************************************************************************/
    28142858
    2815 DWORD  HMMsgWaitForMultipleObjects  (DWORD                      nCount,
    2816                                      LPHANDLE                   pHandles,
    2817                                      BOOL                       fWaitAll,
    2818                                      DWORD                      dwMilliseconds,
    2819                                      DWORD                      dwWakeMask)
     2859DWORD  HMMsgWaitForMultipleObjects  (DWORD      nCount,
     2860                                     LPHANDLE       pHandles,
     2861                                     BOOL       fWaitAll,
     2862                                     DWORD      dwMilliseconds,
     2863                                     DWORD      dwWakeMask)
    28202864{
    28212865  ULONG   ulIndex;
     
    28292873  if (pArrayOfHandles == NULL)
    28302874  {
    2831         dprintf(("ERROR: HMMsgWaitForMultipleObjects: alloca failed to allocate %d handles", nCount));
    2832         O32_SetLastError(ERROR_NOT_ENOUGH_MEMORY);
    2833         return WAIT_FAILED;
     2875  dprintf(("ERROR: HMMsgWaitForMultipleObjects: alloca failed to allocate %d handles", nCount));
     2876      O32_SetLastError(ERROR_NOT_ENOUGH_MEMORY);
     2877      return WAIT_FAILED;
    28342878  }
    28352879  else
     
    28542898               *pLoop1));
    28552899
    2856           *pLoop2 = *pLoop1;
     2900    *pLoop2 = *pLoop1;
    28572901////      O32_SetLastError(ERROR_INVALID_HANDLE);
    28582902////      return (WAIT_FAILED);
     
    29102954
    29112955
    2912 /*****************************************************************************
    2913  * Name      : HMSetupComm
    2914  * Purpose   : router function for SetupComm
    2915  * Parameters:
    2916  * Variables :
    2917  * Result    :
    2918  * Remark    :
    2919  * Status    :
    2920  *
    2921  * Author    : Achim Hasenmueller [Sat, 1999/11/27 13:13]
    2922  *****************************************************************************/
    2923 
    2924 BOOL HMSetupComm(HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue)
     2956
     2957/*****************************************************************************
     2958 * Name      : HMCOMGetCommState
     2959 * Purpose   : router function for GetCommState
     2960 * Parameters:
     2961 * Variables :
     2962 * Result    :
     2963 * Remark    :
     2964 * Status    :
     2965 *
     2966 * Author    : Achim Hasenmueller [Sat, 1999/11/27 13:40]
     2967 *****************************************************************************/
     2968
     2969BOOL HMCommGetCommState(HANDLE hCommDev, LPDCB lpdcb)
    29252970{
    29262971  int       iIndex;                           /* index into the handle table */
     
    29292974
    29302975                                                          /* validate handle */
    2931   iIndex = _HMHandleQuery(hFile);              /* get the index */
     2976  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
    29322977  if (-1 == iIndex)                                               /* error ? */
    29332978  {
     
    29362981  }
    29372982
    2938   pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
    2939   bResult = pHMHandle->pDeviceHandler->SetupComm(&pHMHandle->hmHandleData,
    2940                                                  dwInQueue, dwOutQueue);
    2941 
    2942   return (bResult);                                  /* deliver return code */
    2943 }
    2944 
    2945 
    2946 /*****************************************************************************
    2947  * Name      : HMGetCommState
    2948  * Purpose   : router function for GetCommState
    2949  * Parameters:
    2950  * Variables :
    2951  * Result    :
    2952  * Remark    :
    2953  * Status    :
    2954  *
    2955  * Author    : Achim Hasenmueller [Sat, 1999/11/27 13:40]
    2956  *****************************************************************************/
    2957 
    2958 BOOL HMGetCommState(INT hCommDev, LPDCB lpdcb)
    2959 {
    2960   int       iIndex;                           /* index into the handle table */
    2961   BOOL      bResult;                /* result from the device handler's API */
    2962   PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
    2963 
    2964                                                           /* validate handle */
    2965   iIndex = _HMHandleQuery(hCommDev);              /* get the index */
    2966   if (-1 == iIndex)                                               /* error ? */
    2967   {
    2968     SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
    2969     return (NULL);                                         /* signal failure */
     2983  if(IsBadWritePtr(lpdcb,sizeof(DCB)))
     2984  {
     2985    SetLastError(ERROR_INVALID_PARAMETER);
     2986    return FALSE;
    29702987  }
    29712988
     
    29732990  bResult = pHMHandle->pDeviceHandler->GetCommState(&pHMHandle->hmHandleData,
    29742991                                                    lpdcb);
     2992
     2993  return (bResult);                                  /* deliver return code */
     2994}
     2995
     2996BOOL HMCommWaitCommEvent( HANDLE hCommDev,
     2997                          LPDWORD lpfdwEvtMask,
     2998                          LPOVERLAPPED lpo)
     2999{
     3000  int       iIndex;                           /* index into the handle table */
     3001  BOOL      bResult;                /* result from the device handler's API */
     3002  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3003
     3004                                                          /* validate handle */
     3005  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3006  if (-1 == iIndex)                                               /* error ? */
     3007  {
     3008    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3009    return FALSE;                                         /* signal failure */
     3010  }
     3011
     3012  if(NULL!=lpo && IsBadReadPtr(lpo,sizeof(OVERLAPPED)) )
     3013  {
     3014    SetLastError(ERROR_INVALID_PARAMETER);
     3015    return FALSE;
     3016  }
     3017
     3018  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3019  bResult = pHMHandle->pDeviceHandler->WaitCommEvent( &pHMHandle->hmHandleData,
     3020                                                      lpfdwEvtMask,
     3021                                                      lpo);
     3022
     3023  return (bResult);                                  /* deliver return code */
     3024}
     3025
     3026BOOL HMCommGetCommProperties( HANDLE hCommDev,
     3027                              LPCOMMPROP lpcmmp)
     3028{
     3029  int       iIndex;                           /* index into the handle table */
     3030  BOOL      bResult;                /* result from the device handler's API */
     3031  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3032
     3033                                                          /* validate handle */
     3034  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3035  if (-1 == iIndex)                                               /* error ? */
     3036  {
     3037    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3038    return (NULL);                                         /* signal failure */
     3039  }
     3040
     3041  if(IsBadWritePtr(lpcmmp,sizeof(COMMPROP)) )
     3042  {
     3043    SetLastError(ERROR_INVALID_PARAMETER);
     3044    return FALSE;
     3045  }
     3046
     3047  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3048  bResult = pHMHandle->pDeviceHandler->GetCommProperties( &pHMHandle->hmHandleData,
     3049                                                          lpcmmp);
     3050
     3051  return (bResult);                                  /* deliver return code */
     3052}
     3053
     3054BOOL HMCommGetCommMask( HANDLE hCommDev,
     3055                        LPDWORD lpfdwEvtMask)
     3056{
     3057  int       iIndex;                           /* index into the handle table */
     3058  BOOL      bResult;                /* result from the device handler's API */
     3059  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3060
     3061                                                          /* validate handle */
     3062  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3063  if (-1 == iIndex)                                               /* error ? */
     3064  {
     3065    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3066    return (NULL);                                         /* signal failure */
     3067  }
     3068
     3069  if(IsBadWritePtr(lpfdwEvtMask,sizeof(DWORD)) )
     3070  {
     3071    SetLastError(ERROR_INVALID_PARAMETER);
     3072    return FALSE;
     3073  }
     3074
     3075  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3076  bResult = pHMHandle->pDeviceHandler->GetCommMask( &pHMHandle->hmHandleData,
     3077                                                    lpfdwEvtMask);
     3078
     3079  return (bResult);                                  /* deliver return code */
     3080}
     3081
     3082BOOL HMCommSetCommMask( HANDLE hCommDev,
     3083                        DWORD fdwEvtMask)
     3084{
     3085  int       iIndex;                           /* index into the handle table */
     3086  BOOL      bResult;                /* result from the device handler's API */
     3087  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3088
     3089                                                          /* validate handle */
     3090  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3091  if (-1 == iIndex)                                               /* error ? */
     3092  {
     3093    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3094    return (NULL);                                         /* signal failure */
     3095  }
     3096
     3097  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3098  bResult = pHMHandle->pDeviceHandler->SetCommMask( &pHMHandle->hmHandleData,
     3099                                                    fdwEvtMask);
     3100
     3101  return (bResult);                                  /* deliver return code */
     3102}
     3103
     3104BOOL HMCommPurgeComm( HANDLE hCommDev,
     3105                      DWORD fdwAction)
     3106{
     3107  int       iIndex;                           /* index into the handle table */
     3108  BOOL      bResult;                /* result from the device handler's API */
     3109  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3110
     3111                                                          /* validate handle */
     3112  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3113  if (-1 == iIndex)                                               /* error ? */
     3114  {
     3115    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3116    return (NULL);                                         /* signal failure */
     3117  }
     3118
     3119
     3120  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3121  bResult = pHMHandle->pDeviceHandler->PurgeComm( &pHMHandle->hmHandleData,
     3122                                                  fdwAction);
     3123
     3124  return (bResult);                                  /* deliver return code */
     3125}
     3126
     3127BOOL HMCommClearCommError( HANDLE hCommDev,
     3128                           LPDWORD lpdwErrors,
     3129                           LPCOMSTAT lpcst)
     3130{
     3131  int       iIndex;                           /* index into the handle table */
     3132  BOOL      bResult;                /* result from the device handler's API */
     3133  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3134
     3135                                                          /* validate handle */
     3136  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3137  if (-1 == iIndex)                                               /* error ? */
     3138  {
     3139    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3140    return (NULL);                                         /* signal failure */
     3141  }
     3142
     3143  if(IsBadWritePtr(lpdwErrors,sizeof(DWORD)) ||
     3144     (NULL!=lpcst && IsBadWritePtr(lpcst,sizeof(COMSTAT)) ) )
     3145  {
     3146    SetLastError(ERROR_INVALID_PARAMETER);
     3147    return FALSE;
     3148  }
     3149
     3150  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3151  bResult = pHMHandle->pDeviceHandler->ClearCommError(&pHMHandle->hmHandleData,
     3152                                                      lpdwErrors,
     3153                                                      lpcst);
     3154
     3155  return (bResult);                                  /* deliver return code */
     3156}
     3157
     3158BOOL HMCommSetCommState( HANDLE hCommDev,
     3159                         LPDCB lpdcb)
     3160{
     3161  int       iIndex;                           /* index into the handle table */
     3162  BOOL      bResult;                /* result from the device handler's API */
     3163  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3164
     3165                                                          /* validate handle */
     3166  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3167  if (-1 == iIndex)                                               /* error ? */
     3168  {
     3169    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3170    return (NULL);                                         /* signal failure */
     3171  }
     3172
     3173  if(IsBadReadPtr(lpdcb,sizeof(DCB)) )
     3174  {
     3175    SetLastError(ERROR_INVALID_PARAMETER);
     3176    return FALSE;
     3177  }
     3178
     3179
     3180  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3181  bResult = pHMHandle->pDeviceHandler->SetCommState(&pHMHandle->hmHandleData,
     3182                                                    lpdcb);
     3183
     3184  return (bResult);                                  /* deliver return code */
     3185}
     3186
     3187
     3188BOOL HMCommGetCommTimeouts( HANDLE hCommDev,
     3189                            LPCOMMTIMEOUTS lpctmo)
     3190{
     3191  int       iIndex;                           /* index into the handle table */
     3192  BOOL      bResult;                /* result from the device handler's API */
     3193  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3194
     3195                                                          /* validate handle */
     3196  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3197  if (-1 == iIndex)                                               /* error ? */
     3198  {
     3199    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3200    return (NULL);                                         /* signal failure */
     3201  }
     3202
     3203  if(IsBadWritePtr(lpctmo,sizeof(COMMTIMEOUTS)) )
     3204  {
     3205    SetLastError(ERROR_INVALID_PARAMETER);
     3206    return FALSE;
     3207  }
     3208
     3209  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3210  bResult = pHMHandle->pDeviceHandler->GetCommTimeouts( &pHMHandle->hmHandleData,
     3211                                                        lpctmo);
     3212
     3213  return (bResult);                                  /* deliver return code */
     3214}
     3215BOOL HMCommGetCommModemStatus( HANDLE hCommDev,
     3216                               LPDWORD lpModemStat )
     3217{
     3218  int       iIndex;                           /* index into the handle table */
     3219  BOOL      bResult;                /* result from the device handler's API */
     3220  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3221
     3222                                                          /* validate handle */
     3223  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3224  if (-1 == iIndex)                                               /* error ? */
     3225  {
     3226    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3227    return (NULL);                                         /* signal failure */
     3228  }
     3229
     3230  if(IsBadWritePtr(lpModemStat,sizeof(DWORD)) )
     3231  {
     3232    SetLastError(ERROR_INVALID_PARAMETER);
     3233    return FALSE;
     3234  }
     3235
     3236  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3237  bResult = pHMHandle->pDeviceHandler->GetCommModemStatus( &pHMHandle->hmHandleData,
     3238                                                           lpModemStat);
     3239
     3240  return (bResult);                                  /* deliver return code */
     3241}
     3242
     3243BOOL HMCommSetCommTimeouts( HANDLE hCommDev,
     3244                            LPCOMMTIMEOUTS lpctmo)
     3245{
     3246  int       iIndex;                           /* index into the handle table */
     3247  BOOL      bResult;                /* result from the device handler's API */
     3248  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3249
     3250                                                          /* validate handle */
     3251  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3252  if (-1 == iIndex)                                               /* error ? */
     3253  {
     3254    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3255    return (NULL);                                         /* signal failure */
     3256  }
     3257
     3258  if(IsBadReadPtr(lpctmo,sizeof(COMMTIMEOUTS)) )
     3259  {
     3260    SetLastError(ERROR_INVALID_PARAMETER);
     3261    return FALSE;
     3262  }
     3263
     3264  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3265  bResult = pHMHandle->pDeviceHandler->SetCommTimeouts( &pHMHandle->hmHandleData,
     3266                                                        lpctmo);
     3267
     3268  return (bResult);                                  /* deliver return code */
     3269}
     3270
     3271BOOL HMCommTransmitCommChar( HANDLE hCommDev,
     3272                             CHAR cChar )
     3273{
     3274  int       iIndex;                           /* index into the handle table */
     3275  BOOL      bResult;                /* result from the device handler's API */
     3276  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3277
     3278                                                          /* validate handle */
     3279  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3280  if (-1 == iIndex)                                               /* error ? */
     3281  {
     3282    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3283    return (NULL);                                         /* signal failure */
     3284  }
     3285
     3286  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3287  bResult = pHMHandle->pDeviceHandler->TransmitCommChar( &pHMHandle->hmHandleData,
     3288                                                         cChar);
     3289
     3290  return (bResult);                                  /* deliver return code */
     3291}
     3292
     3293BOOL HMCommSetCommConfig( HANDLE hCommDev,
     3294                          LPCOMMCONFIG lpCC,
     3295                          DWORD dwSize )
     3296{
     3297  int       iIndex;                           /* index into the handle table */
     3298  BOOL      bResult;                /* result from the device handler's API */
     3299  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3300
     3301                                                          /* validate handle */
     3302  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3303  if (-1 == iIndex)                                               /* error ? */
     3304  {
     3305    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3306    return (NULL);                                         /* signal failure */
     3307  }
     3308
     3309  if( IsBadReadPtr(lpCC,sizeof(COMMCONFIG)) ||
     3310      dwSize < sizeof(COMMCONFIG) )
     3311  {
     3312    SetLastError(ERROR_INVALID_PARAMETER);
     3313    return FALSE;
     3314  }
     3315
     3316  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3317  bResult = pHMHandle->pDeviceHandler->SetCommConfig( &pHMHandle->hmHandleData,
     3318                                                      lpCC,
     3319                                                      dwSize);
     3320
     3321  return (bResult);                                  /* deliver return code */
     3322}
     3323
     3324BOOL HMCommSetCommBreak( HANDLE hCommDev )
     3325{
     3326  int       iIndex;                           /* index into the handle table */
     3327  BOOL      bResult;                /* result from the device handler's API */
     3328  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3329
     3330                                                          /* validate handle */
     3331  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3332  if (-1 == iIndex)                                               /* error ? */
     3333  {
     3334    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3335    return (NULL);                                         /* signal failure */
     3336  }
     3337
     3338  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3339  bResult = pHMHandle->pDeviceHandler->SetCommBreak( &pHMHandle->hmHandleData);
     3340
     3341  return (bResult);                                  /* deliver return code */
     3342}
     3343
     3344BOOL HMCommGetCommConfig( HANDLE hCommDev,
     3345                          LPCOMMCONFIG lpCC,
     3346                          LPDWORD lpdwSize )
     3347{
     3348  int       iIndex;                           /* index into the handle table */
     3349  BOOL      bResult;                /* result from the device handler's API */
     3350  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3351
     3352                                                          /* validate handle */
     3353  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3354  if (-1 == iIndex)                                               /* error ? */
     3355  {
     3356    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3357    return (NULL);                                         /* signal failure */
     3358  }
     3359
     3360  if(IsBadWritePtr(lpdwSize,sizeof(DWORD)) )
     3361  {
     3362    SetLastError(ERROR_INVALID_PARAMETER);
     3363    return FALSE;
     3364  }
     3365
     3366  if( IsBadWritePtr(lpCC,sizeof(COMMCONFIG)) ||
     3367      *lpdwSize< sizeof(COMMCONFIG) )
     3368  {
     3369    SetLastError(ERROR_INSUFFICIENT_BUFFER);
     3370    *lpdwSize= sizeof(COMMCONFIG);
     3371    return FALSE;
     3372  }
     3373
     3374  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3375  bResult = pHMHandle->pDeviceHandler->GetCommConfig( &pHMHandle->hmHandleData,
     3376                                                      lpCC,
     3377                                                      lpdwSize);
     3378
     3379  return (bResult);                                  /* deliver return code */
     3380}
     3381
     3382BOOL HMCommEscapeCommFunction( HANDLE hCommDev,
     3383                               UINT dwFunc )
     3384{
     3385  int       iIndex;                           /* index into the handle table */
     3386  BOOL      bResult;                /* result from the device handler's API */
     3387  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3388
     3389                                                          /* validate handle */
     3390  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3391  if (-1 == iIndex)                                               /* error ? */
     3392  {
     3393    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3394    return (NULL);                                         /* signal failure */
     3395  }
     3396
     3397  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3398
     3399  switch(dwFunc)
     3400  {
     3401    case CLRDTR:
     3402    case CLRRTS:
     3403    case SETDTR:
     3404    case SETRTS:
     3405    case SETXOFF:
     3406    case SETXON:
     3407      bResult = pHMHandle->pDeviceHandler->EscapeCommFunction( &pHMHandle->hmHandleData,
     3408                                                               dwFunc);
     3409      break;
     3410    case SETBREAK:
     3411      bResult = pHMHandle->pDeviceHandler->SetCommBreak(&pHMHandle->hmHandleData);
     3412      break;
     3413    case CLRBREAK:
     3414      bResult = pHMHandle->pDeviceHandler->ClearCommBreak(&pHMHandle->hmHandleData);
     3415      break;
     3416    default:
     3417      SetLastError(ERROR_INVALID_PARAMETER);
     3418      bResult = FALSE;
     3419  }
     3420
     3421
     3422  return (bResult);                                  /* deliver return code */
     3423}
     3424
     3425BOOL HMCommSetupComm( HANDLE hCommDev,
     3426                      DWORD dwInQueue,
     3427                      DWORD dwOutQueue)
     3428{
     3429  int       iIndex;                           /* index into the handle table */
     3430  BOOL      bResult;                /* result from the device handler's API */
     3431  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3432
     3433                                                          /* validate handle */
     3434  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3435  if (-1 == iIndex)                                               /* error ? */
     3436  {
     3437    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3438    return (NULL);                                         /* signal failure */
     3439  }
     3440
     3441  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3442  bResult = pHMHandle->pDeviceHandler->SetupComm(&pHMHandle->hmHandleData,
     3443                                                 dwInQueue,
     3444                                                 dwOutQueue);
     3445
     3446  return (bResult);                                  /* deliver return code */
     3447}
     3448
     3449BOOL HMCommClearCommBreak(HANDLE hCommDev)
     3450{
     3451  int       iIndex;                           /* index into the handle table */
     3452  BOOL      bResult;                /* result from the device handler's API */
     3453  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3454
     3455                                                          /* validate handle */
     3456  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3457  if (-1 == iIndex)                                               /* error ? */
     3458  {
     3459    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3460    return (NULL);                                         /* signal failure */
     3461  }
     3462
     3463  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3464  bResult = pHMHandle->pDeviceHandler->ClearCommBreak(&pHMHandle->hmHandleData);
     3465
     3466  return (bResult);                                  /* deliver return code */
     3467}
     3468
     3469BOOL HMCommSetDefaultCommConfig( HANDLE hCommDev,
     3470                                 LPCOMMCONFIG lpCC,
     3471                                 DWORD dwSize)
     3472{
     3473  int       iIndex;                           /* index into the handle table */
     3474  BOOL      bResult;                /* result from the device handler's API */
     3475  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3476
     3477                                                          /* validate handle */
     3478  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3479  if (-1 == iIndex)                                               /* error ? */
     3480  {
     3481    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3482    return (NULL);                                         /* signal failure */
     3483  }
     3484
     3485  if( (lpCC!=NULL) &&
     3486      ( IsBadReadPtr(lpCC,sizeof(COMMCONFIG)) ||
     3487        dwSize != sizeof(COMMCONFIG) ) )
     3488  {
     3489    SetLastError(ERROR_INVALID_PARAMETER);
     3490    return FALSE;
     3491  }
     3492
     3493  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3494  bResult = pHMHandle->pDeviceHandler->SetDefaultCommConfig(&pHMHandle->hmHandleData,
     3495                                                            lpCC,
     3496                                                            dwSize);
     3497
     3498  return (bResult);                                  /* deliver return code */
     3499}
     3500
     3501BOOL HMCommGetDefaultCommConfig( HANDLE hCommDev,
     3502                                 LPCOMMCONFIG lpCC,
     3503                                 LPDWORD lpdwSize)
     3504{
     3505  int       iIndex;                           /* index into the handle table */
     3506  BOOL      bResult;                /* result from the device handler's API */
     3507  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3508
     3509                                                          /* validate handle */
     3510  iIndex = _HMHandleQuery(hCommDev);              /* get the index */
     3511  if (-1 == iIndex)                                               /* error ? */
     3512  {
     3513    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3514    return (NULL);                                         /* signal failure */
     3515  }
     3516
     3517  if(IsBadWritePtr(lpdwSize,sizeof(DWORD)))
     3518  {
     3519    SetLastError(ERROR_INVALID_PARAMETER);
     3520    return FALSE;
     3521  }
     3522
     3523  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3524  bResult = pHMHandle->pDeviceHandler->GetDefaultCommConfig( &pHMHandle->hmHandleData,
     3525                                                             lpCC,
     3526                                                             lpdwSize);
    29753527
    29763528  return (bResult);                                  /* deliver return code */
     
    30063558  {
    30073559    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    3008     return ERROR_NOT_ENOUGH_MEMORY; 
     3560    return ERROR_NOT_ENOUGH_MEMORY;
    30093561  }
    30103562
     
    30363588  if (rc != NO_ERROR)     /* oops, creation failed within the device handler */
    30373589  {
    3038         TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    3039         return (rc);                                           /* signal error */
     3590      TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     3591  return (rc);                                           /* signal error */
    30403592  }
    30413593  else
     
    30743626  {
    30753627    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    3076     return ERROR_NOT_ENOUGH_MEMORY; 
     3628    return ERROR_NOT_ENOUGH_MEMORY;
    30773629  }
    30783630
     
    31043656  if (rc != NO_ERROR)     /* oops, creation failed within the device handler */
    31053657  {
    3106         TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    3107         return (rc);                                           /* signal error */
     3658      TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     3659  return (rc);                                           /* signal error */
    31083660  }
    31093661  else
     
    31463698  {
    31473699    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    3148     return 0; 
     3700    return 0;
    31493701  }
    31503702
     
    31763728  if (rc == 0)     /* oops, creation failed within the device handler */
    31773729  {
    3178         TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    3179         return 0;                                           /* signal error */
     3730      TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     3731  return 0;                                           /* signal error */
    31803732  }
    31813733
     
    34333985/*****************************************************************************
    34343986 * Name      : HMSetThreadTerminated
    3435  * Purpose   : 
     3987 * Purpose   :
    34363988 * Parameters:
    34373989 * Variables :
     
    34654017/*****************************************************************************
    34664018 * Name      : HMPeekNamedPipe
    3467  * Purpose   : 
     4019 * Purpose   :
    34684020 * Parameters:
    34694021 * Variables :
     
    34954047
    34964048  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
    3497   lpResult = pHMHandle->pDeviceHandler->PeekNamedPipe(&TabWin32Handles[iIndex].hmHandleData, 
     4049  lpResult = pHMHandle->pDeviceHandler->PeekNamedPipe(&TabWin32Handles[iIndex].hmHandleData,
    34984050                                                      lpvBuffer,
    34994051                                                      cbBuffer,
     
    35074059/*****************************************************************************
    35084060 * Name      : HMCreateNamedPipe
    3509  * Purpose   : 
     4061 * Purpose   :
    35104062 * Parameters:
    35114063 * Variables :
     
    35164068 * Author    : Przemyslaw Dobrowolski
    35174069 *****************************************************************************/
    3518 DWORD HMCreateNamedPipe(LPCTSTR lpName, 
    3519                       DWORD   dwOpenMode, 
     4070DWORD HMCreateNamedPipe(LPCTSTR lpName,
     4071                      DWORD   dwOpenMode,
    35204072                      DWORD   dwPipeMode,
    3521                       DWORD   nMaxInstances, 
     4073                      DWORD   nMaxInstances,
    35224074                      DWORD   nOutBufferSize,
    3523                       DWORD   nInBufferSize, 
     4075                      DWORD   nInBufferSize,
    35244076                      DWORD   nDefaultTimeOut,
    35254077                      LPSECURITY_ATTRIBUTES lpSecurityAttributes)
     
    35394091  {
    35404092    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    3541     return 0; 
     4093    return 0;
    35424094  }
    35434095
     
    35684120  if (rc == 0)     /* oops, creation failed within the device handler */
    35694121  {
    3570         TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    3571         return 0;                                           /* signal error */
     4122      TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     4123  return 0;                                           /* signal error */
    35724124  }
    35734125
     
    35794131/*****************************************************************************
    35804132 * Name      : HMConnectNamedPipe
    3581  * Purpose   : 
     4133 * Purpose   :
    35824134 * Parameters:
    35834135 * Variables :
     
    36044156
    36054157  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
    3606   lpResult = pHMHandle->pDeviceHandler->ConnectNamedPipe(&TabWin32Handles[iIndex].hmHandleData, 
     4158  lpResult = pHMHandle->pDeviceHandler->ConnectNamedPipe(&TabWin32Handles[iIndex].hmHandleData,
    36074159                                                         lpOverlapped);
    36084160
     
    36124164/*****************************************************************************
    36134165 * Name      : HMDisconnectNamedPipe
    3614  * Purpose   : 
     4166 * Purpose   :
    36154167 * Parameters:
    36164168 * Variables :
     
    36444196/*****************************************************************************
    36454197 * Name      : HMGetNamedPipeHandleState
    3646  * Purpose   : 
     4198 * Purpose   :
    36474199 * Parameters:
    36484200 * Variables :
     
    36894241/*****************************************************************************
    36904242 * Name      : HMGetNamedPipeInfo
    3691  * Purpose   : 
     4243 * Purpose   :
    36924244 * Parameters:
    36934245 * Variables :
     
    37294281/*****************************************************************************
    37304282 * Name      : HMTransactNamedPipe
    3731  * Purpose   : 
     4283 * Purpose   :
    37324284 * Parameters:
    37334285 * Variables :
     
    37734325/*****************************************************************************
    37744326 * Name      : HMSetNamedPipeHandleState
    3775  * Purpose   : 
     4327 * Purpose   :
    37764328 * Parameters:
    37774329 * Variables :
     
    38114363/*****************************************************************************
    38124364 * Name      : HMCreatePipe
    3813  * Purpose   : 
     4365 * Purpose   :
    38144366 * Parameters:
    38154367 * Variables :
     
    38224374BOOL HMCreatePipe(PHANDLE phRead,
    38234375                PHANDLE phWrite,
    3824                 LPSECURITY_ATTRIBUTES lpsa, 
     4376                LPSECURITY_ATTRIBUTES lpsa,
    38254377                DWORD                 cbPipe)
    38264378{
     
    38404392  {
    38414393    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    3842     return 0; 
     4394    return 0;
    38434395  }
    38444396
     
    38474399  {
    38484400    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
    3849     return 0; 
     4401    return 0;
    38504402  }
    38514403
     
    38914443  if (rc == 0)     /* oops, creation failed within the device handler */
    38924444  {
    3893         TabWin32Handles[iIndexNewRead].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    3894         TabWin32Handles[iIndexNewWrite].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
    3895         return FALSE;                                           /* signal error */
     4445      TabWin32Handles[iIndexNewRead].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     4446      TabWin32Handles[iIndexNewWrite].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     4447  return FALSE;                                           /* signal error */
    38964448  }
    38974449
Note: See TracChangeset for help on using the changeset viewer.