Ignore:
Timestamp:
Jan 3, 2000, 10:36:11 PM (26 years ago)
Author:
sandervl
Message:

THDB hab & hmq values set + named pipe updates

File:
1 edited

Legend:

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

    r2301 r2311  
    1 /* $Id: oslibdos.cpp,v 1.14 2000-01-02 22:51:39 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.15 2000-01-03 21:36:11 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    619619  dwOS2PipeMode |= nMaxInstances;
    620620
    621   // we must delete string \.\ because
    622   // in Windows named pipes scheme is a \.\PIPE\pipename
    623   // but in OS/2 only \PIPE\pipename
    624   lpOS2Name = (LPSTR)lpName + 3;
    625 
     621  if (strstr(lpName,"\\\\."))
     622  {
     623    // If pipe is created on the local machine
     624    // we must delete string \\. because
     625    // in Windows named pipes scheme is a \\.\PIPE\pipename
     626    // but in OS/2 only \PIPE\pipename
     627    lpOS2Name = (LPSTR)lpName + 3;
     628  }
     629  else lpOS2Name = (LPSTR)lpName;
    626630
    627631  dprintf(("DosCreateNPipe(%s,%x,%x,%x,%x,%x)",lpOS2Name,dwOS2Mode,dwOS2PipeMode,nInBufferSize,nOutBufferSize,nDefaultTimeOut));
     
    691695  LPSTR lpOS2Name;
    692696  DWORD rc;
    693   // we must delete string \.\ because
    694   // in Windows named pipes scheme is a \.\PIPE\pipename
    695   // but in OS/2 only \PIPE\pipename
    696   lpOS2Name = (LPSTR)lpNamedPipeName + 3;
     697
     698  if (strstr(lpNamedPipeName,"\\\\."))
     699  {
     700    // If pipe is created on the local machine
     701    // we must delete string \\. because
     702    // in Windows named pipes scheme is a \\.\PIPE\pipename
     703    // but in OS/2 only \PIPE\pipename
     704    lpOS2Name = (LPSTR)lpNamedPipeName + 3;
     705  }
     706  else lpOS2Name = (LPSTR)lpNamedPipeName;
    697707
    698708  rc=DosCallNPipe(lpOS2Name,
     
    751761                      lpBytesRead);
    752762
     763  dprintf(("DosTransactNPipe returned rc=%d");)
    753764  if (!rc) return (TRUE);
    754765   else
     
    770781  SetLastError(ERROR_PIPE_NOT_CONNECTED_W);
    771782
    772   return FALSE;
    773 }
     783  return (FALSE);
     784}
     785
     786//******************************************************************************
     787//******************************************************************************
     788BOOL OSLibDosPeekNamedPipe(DWORD   hPipe,
     789                        LPVOID  lpvBuffer,
     790                        DWORD   cbBuffer,
     791                        LPDWORD lpcbRead,
     792                        LPDWORD lpcbAvail,
     793                        LPDWORD lpcbMessage)
     794{
     795  DWORD     rc;
     796  AVAILDATA availData ={0};
     797  ULONG     ulDummy;
     798
     799  rc=DosPeekNPipe(hPipe,lpvBuffer,cbBuffer,lpcbRead,&availData,&ulDummy);
     800 
     801  dprintf(("DosPeekNPipe returned rc=%d",rc));
     802
     803  if (!rc)
     804  {
     805    *lpcbAvail   = availData.cbpipe;
     806    *lpcbMessage = availData.cbmessage;
     807    return (TRUE);
     808  }
     809   else
     810  if ( rc==ERROR_ACCESS_DENIED      ) SetLastError(ERROR_ACCESS_DENIED_W);   
     811    else
     812  if ( rc==ERROR_PIPE_BUSY          ) SetLastError(ERROR_PIPE_BUSY_W);   
     813    else
     814  if ( rc==ERROR_BAD_PIPE           ) SetLastError(ERROR_BAD_PIPE_W);
     815    else
     816  if ( rc==ERROR_PIPE_NOT_CONNECTED ) SetLastError(ERROR_PIPE_NOT_CONNECTED_W);
     817    else
     818  // Unknown error
     819  SetLastError(ERROR_PIPE_NOT_CONNECTED_W);
     820
     821  return (FALSE);
     822}
     823//******************************************************************************
     824//******************************************************************************
     825BOOL OSLibDosDisconnectNamedPipe(DWORD hPipe)
     826{
     827  DWORD     rc;
     828
     829  rc=DosDisConnectNPipe(hPipe);
     830
     831  dprintf(("DosDisConnectNPipe returned rc=%d",rc));
     832
     833  if (!rc) return TRUE;
     834    else
     835  if ( rc==ERROR_BROKEN_PIPE        ) SetLastError(ERROR_BROKEN_PIPE_W);   
     836    else
     837  if ( rc==ERROR_BAD_PIPE           ) SetLastError(ERROR_BAD_PIPE_W);
     838    else
     839     // Unknown error
     840     SetLastError(ERROR_PIPE_NOT_CONNECTED_W); // Maybe another?
     841
     842  return (FALSE);
     843}
     844//******************************************************************************
     845//******************************************************************************
     846BOOL OSLibDosWaitNamedPipe(LPCSTR lpszNamedPipeName,
     847                            DWORD   dwTimeout)
     848{
     849  LPSTR lpOS2Name;
     850  DWORD rc;
     851
     852  if (strstr(lpszNamedPipeName,"\\\\."))
     853  {
     854    // If pipe is created on the local machine
     855    // we must delete string \\. because
     856    // in Windows named pipes scheme is a \\.\PIPE\pipename
     857    // but in OS/2 only \PIPE\pipename
     858    lpOS2Name = (LPSTR)lpszNamedPipeName + 3;
     859  }
     860  else lpOS2Name = (LPSTR)lpszNamedPipeName;
     861
     862  rc=DosWaitNPipe(lpOS2Name,dwTimeout);
     863
     864  dprintf(("DosWaitNPipe returned rc=%d",rc));
     865
     866  if (!rc) return TRUE;
     867    else
     868  if ( rc == ERROR_PATH_NOT_FOUND ) SetLastError(ERROR_PATH_NOT_FOUND_W);
     869    else
     870  if ( rc==ERROR_BAD_PIPE         ) SetLastError(ERROR_BAD_PIPE_W);
     871    else
     872  if ( rc == ERROR_PIPE_BUSY      ) SetLastError(ERROR_PIPE_BUSY_W);
     873    else
     874  if ( rc == ERROR_SEM_TIMEOUT_W  ) SetLastError(ERROR_SEM_TIMEOUT_W);
     875    else
     876  // TODO: Implemnt this using Windows Errors
     877  // if (rc==ERROR_INTERRUPT)
     878  SetLastError(ERROR_PIPE_NOT_CONNECTED_W);
     879
     880  return (FALSE);
     881}
Note: See TracChangeset for help on using the changeset viewer.