Changeset 3819 for trunk/src


Ignore:
Timestamp:
Jul 12, 2000, 8:21:45 PM (25 years ago)
Author:
sandervl
Message:

PD: added handlemanager support for named & unnamed pipes

Location:
trunk/src/kernel32
Files:
2 added
10 edited

Legend:

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

    r3678 r3819  
    1 /* $Id: HandleManager.cpp,v 1.41 2000-06-08 18:08:54 sandervl Exp $ */
     1/* $Id: HandleManager.cpp,v 1.42 2000-07-12 18:21:40 sandervl Exp $ */
    22
    33/*
     
    5959#include "HMToken.h"
    6060#include "HMThread.h"
     61#include "HMNPipe.h"
    6162#include <vmutex.h>
    6263
     
    133134  HMDeviceHandler        *pHMToken;         /* security tokens */
    134135  HMDeviceHandler        *pHMThread;
     136  HMDeviceHandler        *pHMNamedPipe;
    135137
    136138  ULONG         ulHandleLast;                   /* index of last used handle */
     
    363365    HMGlobals.pHMToken      = new HMDeviceTokenClass("\\\\TOKEN\\");
    364366    HMGlobals.pHMThread     = new HMDeviceThreadClass("\\\\THREAD\\");
     367    HMGlobals.pHMNamedPipe  = new HMDeviceNamedPipeClass("\\\\PIPE\\");
    365368  }
    366369  return (NO_ERROR);
     
    34083411  return (lpResult);                                  /* deliver return code */
    34093412}
     3413
     3414/*****************************************************************************
     3415 * Name      : HMPeekNamedPipe
     3416 * Purpose   :
     3417 * Parameters:
     3418 * Variables :
     3419 * Result    :
     3420 * Remark    :
     3421 * Status    :
     3422 *
     3423 * Author    : Przemyslaw Dobrowolski
     3424 *****************************************************************************/
     3425BOOL   HMPeekNamedPipe(HANDLE hPipe,
     3426                       LPVOID  lpvBuffer,
     3427                       DWORD   cbBuffer,
     3428                       LPDWORD lpcbRead,
     3429                       LPDWORD lpcbAvail,
     3430                       LPDWORD lpcbMessage)
     3431{
     3432  int       iIndex;                           /* index into the handle table */
     3433  BOOL      lpResult;                /* result from the device handler's API */
     3434  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3435
     3436  SetLastError(ERROR_SUCCESS);
     3437                                                          /* validate handle */
     3438  iIndex = _HMHandleQuery(hPipe);              /* get the index */
     3439  if (-1 == iIndex)                                               /* error ? */
     3440  {
     3441    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3442    return FALSE;                                         /* signal failure */
     3443  }
     3444
     3445  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3446  lpResult = pHMHandle->pDeviceHandler->PeekNamedPipe(&TabWin32Handles[iIndex].hmHandleData,
     3447                                                      lpvBuffer,
     3448                                                      cbBuffer,
     3449                                                      lpcbRead,
     3450                                                      lpcbAvail,
     3451                                                      lpcbMessage);
     3452
     3453  return (lpResult);                                  /* deliver return code */
     3454}
     3455
     3456/*****************************************************************************
     3457 * Name      : HMCreateNamedPipe
     3458 * Purpose   :
     3459 * Parameters:
     3460 * Variables :
     3461 * Result    :
     3462 * Remark    :
     3463 * Status    :
     3464 *
     3465 * Author    : Przemyslaw Dobrowolski
     3466 *****************************************************************************/
     3467DWORD HMCreateNamedPipe(LPCTSTR lpName,
     3468                      DWORD   dwOpenMode,
     3469                      DWORD   dwPipeMode,
     3470                      DWORD   nMaxInstances,
     3471                      DWORD   nOutBufferSize,
     3472                      DWORD   nInBufferSize,
     3473                      DWORD   nDefaultTimeOut,
     3474                      LPSECURITY_ATTRIBUTES lpSecurityAttributes)
     3475{
     3476  int             iIndex;                     /* index into the handle table */
     3477  int             iIndexNew;                  /* index into the handle table */
     3478  HMDeviceHandler *pDeviceHandler;         /* device handler for this handle */
     3479  PHMHANDLEDATA   pHMHandleData;
     3480  HANDLE          rc;                                     /* API return code */
     3481
     3482  SetLastError(ERROR_SUCCESS);
     3483
     3484  pDeviceHandler = HMGlobals.pHMNamedPipe;         /* device is predefined */
     3485
     3486  iIndexNew = _HMHandleGetFree();                         /* get free handle */
     3487  if (-1 == iIndexNew)                            /* oops, no free handles ! */
     3488  {
     3489    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
     3490    return 0;
     3491  }
     3492
     3493  /* initialize the complete HMHANDLEDATA structure */
     3494  pHMHandleData = &TabWin32Handles[iIndexNew].hmHandleData;
     3495  pHMHandleData->dwType     = FILE_TYPE_PIPE;
     3496  pHMHandleData->dwAccess   = 0;
     3497  pHMHandleData->dwShare    = 0;
     3498  pHMHandleData->dwCreation = 0;
     3499  pHMHandleData->dwFlags    = 0;
     3500  pHMHandleData->lpHandlerData = NULL;
     3501
     3502  /* we've got to mark the handle as occupied here, since another device */
     3503  /* could be created within the device handler -> deadlock */
     3504
     3505  /* write appropriate entry into the handle table if open succeeded */
     3506  TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = iIndexNew;
     3507  TabWin32Handles[iIndexNew].pDeviceHandler         = pDeviceHandler;
     3508
     3509  /* call the device handler */
     3510
     3511  rc = pDeviceHandler->CreateNamedPipe(&TabWin32Handles[iIndexNew].hmHandleData,
     3512                                       lpName,dwOpenMode,
     3513                                       dwPipeMode,nMaxInstances,
     3514                                       nOutBufferSize,nInBufferSize,
     3515                                       nDefaultTimeOut,lpSecurityAttributes);
     3516
     3517  if (rc == 0)     /* oops, creation failed within the device handler */
     3518  {
     3519        TabWin32Handles[iIndexNew].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     3520        return 0;                                           /* signal error */
     3521  }
     3522
     3523  dprintf(("Win32 Handle -> %08x",iIndexNew));
     3524
     3525  return iIndexNew;
     3526}
     3527
     3528/*****************************************************************************
     3529 * Name      : HMConnectNamedPipe
     3530 * Purpose   :
     3531 * Parameters:
     3532 * Variables :
     3533 * Result    :
     3534 * Remark    :
     3535 * Status    :
     3536 *
     3537 * Author    : Przemyslaw Dobrowolski
     3538 *****************************************************************************/
     3539BOOL HMConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED lpOverlapped)
     3540{
     3541  int       iIndex;                           /* index into the handle table */
     3542  BOOL      lpResult;                /* result from the device handler's API */
     3543  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3544
     3545  SetLastError(ERROR_SUCCESS);
     3546                                                          /* validate handle */
     3547  iIndex = _HMHandleQuery(hPipe);              /* get the index */
     3548  if (-1 == iIndex)                                               /* error ? */
     3549  {
     3550    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3551    return FALSE;                                         /* signal failure */
     3552  }
     3553
     3554  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3555  lpResult = pHMHandle->pDeviceHandler->ConnectNamedPipe(&TabWin32Handles[iIndex].hmHandleData,
     3556                                                         lpOverlapped);
     3557
     3558  return (lpResult);                                  /* deliver return code */
     3559}
     3560
     3561/*****************************************************************************
     3562 * Name      : HMDisconnectNamedPipe
     3563 * Purpose   :
     3564 * Parameters:
     3565 * Variables :
     3566 * Result    :
     3567 * Remark    :
     3568 * Status    :
     3569 *
     3570 * Author    : Przemyslaw Dobrowolski
     3571 *****************************************************************************/
     3572BOOL HMDisconnectNamedPipe(HANDLE hPipe)
     3573{
     3574  int       iIndex;                           /* index into the handle table */
     3575  BOOL      lpResult;                /* result from the device handler's API */
     3576  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3577
     3578  SetLastError(ERROR_SUCCESS);
     3579                                                          /* validate handle */
     3580  iIndex = _HMHandleQuery(hPipe);              /* get the index */
     3581  if (-1 == iIndex)                                               /* error ? */
     3582  {
     3583    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3584    return FALSE;                                         /* signal failure */
     3585  }
     3586
     3587  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3588  lpResult = pHMHandle->pDeviceHandler->DisconnectNamedPipe(&TabWin32Handles[iIndex].hmHandleData);
     3589
     3590  return (lpResult);                                  /* deliver return code */
     3591}
     3592
     3593/*****************************************************************************
     3594 * Name      : HMGetNamedPipeHandleState
     3595 * Purpose   :
     3596 * Parameters:
     3597 * Variables :
     3598 * Result    :
     3599 * Remark    :
     3600 * Status    :
     3601 *
     3602 * Author    : Przemyslaw Dobrowolski
     3603 *****************************************************************************/
     3604BOOL HMGetNamedPipeHandleState(HANDLE hPipe,
     3605                               LPDWORD lpState,
     3606                               LPDWORD lpCurInstances,
     3607                               LPDWORD lpMaxCollectionCount,
     3608                               LPDWORD lpCollectDataTimeout,
     3609                               LPTSTR  lpUserName,
     3610                               DWORD   nMaxUserNameSize)
     3611{
     3612  int       iIndex;                           /* index into the handle table */
     3613  BOOL      lpResult;                /* result from the device handler's API */
     3614  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3615
     3616  SetLastError(ERROR_SUCCESS);
     3617                                                          /* validate handle */
     3618  iIndex = _HMHandleQuery(hPipe);              /* get the index */
     3619  if (-1 == iIndex)                                               /* error ? */
     3620  {
     3621    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3622    return FALSE;                                         /* signal failure */
     3623  }
     3624
     3625  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3626  lpResult = pHMHandle->pDeviceHandler->GetNamedPipeHandleState(&TabWin32Handles[iIndex].hmHandleData,
     3627                                                                lpState,
     3628                                                                lpCurInstances,
     3629                                                                lpMaxCollectionCount,
     3630                                                                lpCollectDataTimeout,
     3631                                                                lpUserName,
     3632                                                                nMaxUserNameSize);
     3633
     3634
     3635  return (lpResult);                                  /* deliver return code */
     3636}
     3637
     3638/*****************************************************************************
     3639 * Name      : HMGetNamedPipeInfo
     3640 * Purpose   :
     3641 * Parameters:
     3642 * Variables :
     3643 * Result    :
     3644 * Remark    :
     3645 * Status    :
     3646 *
     3647 * Author    : Przemyslaw Dobrowolski
     3648 *****************************************************************************/
     3649BOOL HMGetNamedPipeInfo(HANDLE hPipe,
     3650                        LPDWORD lpFlags,
     3651                        LPDWORD lpOutBufferSize,
     3652                        LPDWORD lpInBufferSize,
     3653                        LPDWORD lpMaxInstances)
     3654{
     3655  int       iIndex;                           /* index into the handle table */
     3656  BOOL      lpResult;                /* result from the device handler's API */
     3657  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3658
     3659  SetLastError(ERROR_SUCCESS);
     3660                                                          /* validate handle */
     3661  iIndex = _HMHandleQuery(hPipe);              /* get the index */
     3662  if (-1 == iIndex)                                               /* error ? */
     3663  {
     3664    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3665    return FALSE;                                         /* signal failure */
     3666  }
     3667
     3668  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3669  lpResult = pHMHandle->pDeviceHandler->GetNamedPipeInfo(&TabWin32Handles[iIndex].hmHandleData,
     3670                                                         lpFlags,
     3671                                                         lpOutBufferSize,
     3672                                                         lpInBufferSize,
     3673                                                         lpMaxInstances);
     3674
     3675  return (lpResult);                                  /* deliver return code */
     3676}
     3677
     3678/*****************************************************************************
     3679 * Name      : HMTransactNamedPipe
     3680 * Purpose   :
     3681 * Parameters:
     3682 * Variables :
     3683 * Result    :
     3684 * Remark    :
     3685 * Status    :
     3686 *
     3687 * Author    : Przemyslaw Dobrowolski
     3688 *****************************************************************************/
     3689DWORD HMTransactNamedPipe(HANDLE hPipe,
     3690                          LPVOID       lpvWriteBuf,
     3691                          DWORD        cbWriteBuf,
     3692                          LPVOID       lpvReadBuf,
     3693                          DWORD        cbReadBuf,
     3694                          LPDWORD      lpcbRead,
     3695                          LPOVERLAPPED lpo)
     3696{
     3697  int       iIndex;                           /* index into the handle table */
     3698  DWORD     lpResult;                /* result from the device handler's API */
     3699  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3700
     3701  SetLastError(ERROR_SUCCESS);
     3702                                                          /* validate handle */
     3703  iIndex = _HMHandleQuery(hPipe);              /* get the index */
     3704  if (-1 == iIndex)                                               /* error ? */
     3705  {
     3706    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3707    return FALSE;                                         /* signal failure */
     3708  }
     3709
     3710  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3711  lpResult = pHMHandle->pDeviceHandler->TransactNamedPipe(&TabWin32Handles[iIndex].hmHandleData,
     3712                                                          lpvWriteBuf,
     3713                                                          cbWriteBuf,
     3714                                                          lpvReadBuf,
     3715                                                          cbReadBuf,
     3716                                                          lpcbRead,
     3717                                                          lpo);
     3718
     3719  return (lpResult);                                  /* deliver return code */
     3720}
     3721
     3722/*****************************************************************************
     3723 * Name      : HMSetNamedPipeHandleState
     3724 * Purpose   :
     3725 * Parameters:
     3726 * Variables :
     3727 * Result    :
     3728 * Remark    :
     3729 * Status    :
     3730 *
     3731 * Author    : Przemyslaw Dobrowolski
     3732 *****************************************************************************/
     3733BOOL HMSetNamedPipeHandleState(HANDLE  hPipe,
     3734                               LPDWORD lpdwMode,
     3735                               LPDWORD lpcbMaxCollect,
     3736                               LPDWORD lpdwCollectDataTimeout)
     3737{
     3738  int       iIndex;                           /* index into the handle table */
     3739  BOOL      lpResult;                /* result from the device handler's API */
     3740  PHMHANDLE pHMHandle;       /* pointer to the handle structure in the table */
     3741
     3742  SetLastError(ERROR_SUCCESS);
     3743                                                          /* validate handle */
     3744  iIndex = _HMHandleQuery(hPipe);              /* get the index */
     3745  if (-1 == iIndex)                                               /* error ? */
     3746  {
     3747    SetLastError(ERROR_INVALID_HANDLE);       /* set win32 error information */
     3748    return FALSE;                                         /* signal failure */
     3749  }
     3750
     3751  pHMHandle = &TabWin32Handles[iIndex];               /* call device handler */
     3752  lpResult = pHMHandle->pDeviceHandler->SetNamedPipeHandleState(&TabWin32Handles[iIndex].hmHandleData,
     3753                                                                lpdwMode,
     3754                                                                lpcbMaxCollect,
     3755                                                                lpdwCollectDataTimeout);
     3756
     3757  return (lpResult);                                  /* deliver return code */
     3758}
     3759
     3760/*****************************************************************************
     3761 * Name      : HMCreatePipe
     3762 * Purpose   :
     3763 * Parameters:
     3764 * Variables :
     3765 * Result    :
     3766 * Remark    :
     3767 * Status    : NOT TESTED!
     3768 *
     3769 * Author    : Przemyslaw Dobrowolski
     3770 *****************************************************************************/
     3771BOOL HMCreatePipe(PHANDLE phRead,
     3772                PHANDLE phWrite,
     3773                LPSECURITY_ATTRIBUTES lpsa,
     3774                DWORD                 cbPipe)
     3775{
     3776  int             iIndex;                     /* index into the handle table */
     3777  int             iIndexNewRead;              /* index into the handle table */
     3778  int             iIndexNewWrite;             /* index into the handle table */
     3779  HMDeviceHandler *pDeviceHandler;            /* device handler for this handle */
     3780  PHMHANDLEDATA   pHMHandleData;
     3781  HANDLE          rc;                                     /* API return code */
     3782
     3783  SetLastError(ERROR_SUCCESS);
     3784
     3785  pDeviceHandler = HMGlobals.pHMNamedPipe;         /* device is predefined */
     3786
     3787  iIndexNewRead = _HMHandleGetFree();              /* get free handle */
     3788  if (-1 == iIndexNewRead)                         /* oops, no free handles ! */
     3789  {
     3790    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
     3791    return 0;
     3792  }
     3793
     3794  iIndexNewWrite = _HMHandleGetFree();              /* get free handle */
     3795  if (-1 == iIndexNewWrite)                         /* oops, no free handles ! */
     3796  {
     3797    SetLastError(ERROR_NOT_ENOUGH_MEMORY);      /* use this as error message */
     3798    return 0;
     3799  }
     3800
     3801
     3802  /* initialize the complete HMHANDLEDATA structure */
     3803  pHMHandleData = &TabWin32Handles[iIndexNewRead].hmHandleData;
     3804  pHMHandleData->dwType     = FILE_TYPE_PIPE;
     3805  pHMHandleData->dwAccess   = 0;
     3806  pHMHandleData->dwShare    = 0;
     3807  pHMHandleData->dwCreation = 0;
     3808  pHMHandleData->dwFlags    = 0;
     3809  pHMHandleData->lpHandlerData = NULL;
     3810
     3811  /* we've got to mark the handle as occupied here, since another device */
     3812  /* could be created within the device handler -> deadlock */
     3813
     3814  /* write appropriate entry into the handle table if open succeeded */
     3815  TabWin32Handles[iIndexNewRead].hmHandleData.hHMHandle = iIndexNewRead;
     3816  TabWin32Handles[iIndexNewRead].pDeviceHandler         = pDeviceHandler;
     3817
     3818  /* initialize the complete HMHANDLEDATA structure */
     3819  pHMHandleData = &TabWin32Handles[iIndexNewWrite].hmHandleData;
     3820  pHMHandleData->dwType     = FILE_TYPE_PIPE;
     3821  pHMHandleData->dwAccess   = 0;
     3822  pHMHandleData->dwShare    = 0;
     3823  pHMHandleData->dwCreation = 0;
     3824  pHMHandleData->dwFlags    = 0;
     3825  pHMHandleData->lpHandlerData = NULL;
     3826
     3827  /* we've got to mark the handle as occupied here, since another device */
     3828  /* could be created within the device handler -> deadlock */
     3829
     3830  /* write appropriate entry into the handle table if open succeeded */
     3831  TabWin32Handles[iIndexNewWrite].hmHandleData.hHMHandle = iIndexNewWrite;
     3832  TabWin32Handles[iIndexNewWrite].pDeviceHandler         = pDeviceHandler;
     3833  /* call the device handler */
     3834
     3835  rc = pDeviceHandler->CreatePipe(&TabWin32Handles[iIndexNewRead].hmHandleData,
     3836                                  &TabWin32Handles[iIndexNewWrite].hmHandleData,
     3837                                  lpsa,
     3838                                  cbPipe);
     3839
     3840  if (rc == 0)     /* oops, creation failed within the device handler */
     3841  {
     3842        TabWin32Handles[iIndexNewRead].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     3843        TabWin32Handles[iIndexNewWrite].hmHandleData.hHMHandle = INVALID_HANDLE_VALUE;
     3844        return FALSE;                                           /* signal error */
     3845  }
     3846
     3847  *phRead  = iIndexNewRead;
     3848  *phWrite = iIndexNewWrite;
     3849
     3850  return TRUE;
     3851}
  • trunk/src/kernel32/dbglocal.cpp

    r3642 r3819  
    1 /* $Id: dbglocal.cpp,v 1.8 2000-06-01 11:28:44 sandervl Exp $ */
     1/* $Id: dbglocal.cpp,v 1.9 2000-07-12 18:21:41 sandervl Exp $ */
    22
    33/*
     
    119119"vsemaphore",
    120120"exceptstackdump",
    121 "hmfile"
     121"hmfile",
     122"hmnpipe"
    122123};
    123124//******************************************************************************
  • trunk/src/kernel32/dbglocal.h

    r3642 r3819  
    1 /* $Id: dbglocal.h,v 1.8 2000-06-01 11:28:44 sandervl Exp $ */
     1/* $Id: dbglocal.h,v 1.9 2000-07-12 18:21:42 sandervl Exp $ */
    22
    33/*
     
    119119#define DBG_exceptstackdump 97
    120120#define DBG_hmfile         98
    121 #define DBG_MAXFILES       99
     121#define DBG_hmnpipe        99
     122#define DBG_MAXFILES       100
    122123
    123124extern USHORT DbgEnabled[DBG_MAXFILES];
  • trunk/src/kernel32/hmdevice.cpp

    r3642 r3819  
    1 /* $Id: hmdevice.cpp,v 1.20 2000-06-01 11:28:45 sandervl Exp $ */
     1/* $Id: hmdevice.cpp,v 1.21 2000-07-12 18:21:42 sandervl Exp $ */
    22
    33/*
     
    14461446    return FALSE;
    14471447}
     1448
     1449/*****************************************************************************
     1450 * Name      : DWORD HMDeviceHandler::PeekNamedPipe
     1451 * Purpose   :
     1452 * Variables :
     1453 * Result    :
     1454 * Remark    :
     1455 * Status    :
     1456 *
     1457 * Author    : Przemyslaw Dobrowolski
     1458 *****************************************************************************/
     1459BOOL HMDeviceHandler::PeekNamedPipe(PHMHANDLEDATA pHMHandleData,
     1460                                      LPVOID lpvBuffer,
     1461                                      DWORD   cbBuffer,
     1462                                      LPDWORD lpcbRead,
     1463                                      LPDWORD lpcbAvail,
     1464                                      LPDWORD lpcbMessage)
     1465{
     1466  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::PeekNamedPipe (%08x)\n",
     1467           pHMHandleData->hHMHandle));
     1468
     1469  return (FALSE);
     1470}
     1471
     1472/*****************************************************************************
     1473 * Name      : DWORD HMDeviceHandler::CreateNamedPipe
     1474 * Purpose   :
     1475 * Variables :
     1476 * Result    :
     1477 * Remark    :
     1478 * Status    :
     1479 *
     1480 * Author    : Przemyslaw Dobrowolski
     1481 *****************************************************************************/
     1482DWORD HMDeviceHandler::CreateNamedPipe(PHMHANDLEDATA pHMHandleData,
     1483                                         LPCTSTR lpName,
     1484                                         DWORD  dwOpenMode,
     1485                                         DWORD  dwPipeMode,
     1486                                         DWORD  nMaxInstances,
     1487                                         DWORD  nOutBufferSize,
     1488                                         DWORD  nInBufferSize, 
     1489                                         DWORD  nDefaultTimeOut,
     1490                                         LPSECURITY_ATTRIBUTES lpSecurityAttributes)
     1491{
     1492  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::CreateNamedPipe (%s)\n",
     1493           lpName));
     1494
     1495  return ERROR_INVALID_HANDLE;
     1496}
     1497
     1498/*****************************************************************************
     1499 * Name      : BOOL HMDeviceHandler::ConnectNamedPipe
     1500 * Purpose   :
     1501 * Variables :
     1502 * Result    :
     1503 * Remark    :
     1504 * Status    :
     1505 *
     1506 * Author    : Przemyslaw Dobrowolski
     1507 *****************************************************************************/
     1508BOOL HMDeviceHandler::ConnectNamedPipe( PHMHANDLEDATA pHMHandleData,
     1509                                          LPOVERLAPPED lpOverlapped)
     1510{
     1511  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::ConnectNamedPipe (%08x)\n",
     1512           pHMHandleData->hHMHandle));
     1513
     1514  return FALSE;
     1515}
     1516
     1517/*****************************************************************************
     1518 * Name      : BOOL HMDeviceHandler::DisconnectNamedPipe
     1519 * Purpose   :
     1520 * Variables :
     1521 * Result    :
     1522 * Remark    :
     1523 * Status    :
     1524 *
     1525 * Author    : Przemyslaw Dobrowolski
     1526 *****************************************************************************/
     1527BOOL HMDeviceHandler::DisconnectNamedPipe(PHMHANDLEDATA pHMHandleData)
     1528{
     1529  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::DisconnectNamedPipe (%08x)\n",
     1530           pHMHandleData->hHMHandle));
     1531
     1532  return FALSE;
     1533}
     1534
     1535/*****************************************************************************
     1536 * Name      : BOOL HMDeviceHandler::GetNamedPipeHandleState
     1537 * Purpose   :
     1538 * Variables :
     1539 * Result    :
     1540 * Remark    :
     1541 * Status    :
     1542 *
     1543 * Author    : Przemyslaw Dobrowolski
     1544 *****************************************************************************/
     1545BOOL HMDeviceHandler::GetNamedPipeHandleState(PHMHANDLEDATA pHMHandleData,
     1546                                                LPDWORD lpState,
     1547                                                LPDWORD lpCurInstances,
     1548                                                LPDWORD lpMaxCollectionCount,
     1549                                                LPDWORD lpCollectDataTimeout,
     1550                                                LPTSTR  lpUserName,
     1551                                                DWORD   nMaxUserNameSize)
     1552{
     1553  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::GetNamedPipeHandleState (%08x)\n",
     1554           pHMHandleData->hHMHandle));
     1555
     1556  return FALSE;
     1557}
     1558
     1559/*****************************************************************************
     1560 * Name      : BOOL HMDeviceHandler::GetNamedPipeInfo
     1561 * Purpose   :
     1562 * Variables :
     1563 * Result    :
     1564 * Remark    :
     1565 * Status    :
     1566 *
     1567 * Author    : Przemyslaw Dobrowolski
     1568 *****************************************************************************/
     1569BOOL HMDeviceHandler::GetNamedPipeInfo(PHMHANDLEDATA pHMHandleData,
     1570                                LPDWORD lpFlags,
     1571                                LPDWORD lpOutBufferSize,
     1572                                LPDWORD lpInBufferSize,
     1573                                LPDWORD lpMaxInstances)
     1574{
     1575  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::GetNamedPipeInfo (%08x)\n",
     1576           pHMHandleData->hHMHandle));
     1577
     1578  return FALSE;
     1579}
     1580
     1581/*****************************************************************************
     1582 * Name      : DWORD HMDeviceHandler::TransactNamedPipe
     1583 * Purpose   :
     1584 * Variables :
     1585 * Result    :
     1586 * Remark    :
     1587 * Status    :
     1588 *
     1589 * Author    : Przemyslaw Dobrowolski
     1590 *****************************************************************************/
     1591DWORD HMDeviceHandler::TransactNamedPipe(PHMHANDLEDATA pHMHandleData,
     1592                                           LPVOID        lpvWriteBuf,
     1593                                           DWORD         cbWriteBuf,
     1594                                           LPVOID        lpvReadBuf,
     1595                                           DWORD         cbReadBuf,
     1596                                           LPDWORD       lpcbRead,
     1597                                           LPOVERLAPPED  lpo)
     1598{
     1599  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::TransactNamedPipe (%08x)\n",
     1600           pHMHandleData->hHMHandle));
     1601
     1602  return FALSE;
     1603}
     1604
     1605/*****************************************************************************
     1606 * Name      : BOOL HMDeviceHandler::SetNamedPipeHandleState
     1607 * Purpose   :
     1608 * Variables :
     1609 * Result    :
     1610 * Remark    :
     1611 * Status    :
     1612 *
     1613 * Author    : Przemyslaw Dobrowolski
     1614 *****************************************************************************/
     1615BOOL HMDeviceHandler::SetNamedPipeHandleState(PHMHANDLEDATA pHMHandleData,
     1616                                                LPDWORD lpdwMode,
     1617                                                LPDWORD lpcbMaxCollect,
     1618                                                LPDWORD lpdwCollectDataTimeout)
     1619{
     1620  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::SetNamedPipeHandleState (%08x)\n",
     1621           pHMHandleData->hHMHandle));
     1622
     1623  return FALSE;
     1624}
     1625
     1626/*****************************************************************************
     1627 * Name      : BOOL HMDeviceHandler::CreatePipe
     1628 * Purpose   :
     1629 * Variables :
     1630 * Result    :
     1631 * Remark    :
     1632 * Status    :
     1633 *
     1634 * Author    : Przemyslaw Dobrowolski
     1635 *****************************************************************************/
     1636BOOL HMDeviceHandler::CreatePipe(PHMHANDLEDATA pHMHandleDataRead,
     1637                                 PHMHANDLEDATA pHMHandleDataWrite,
     1638                                 LPSECURITY_ATTRIBUTES lpsa,
     1639                                 DWORD         cbPipe)
     1640{
     1641  dprintf(("KERNEL32: ERROR: HandleManager::DeviceHandler::CreatePipe (%08x,%08x)\n",
     1642           pHMHandleDataRead->hHMHandle,pHMHandleDataWrite->hHMHandle));
     1643
     1644    return(FALSE);
     1645}
  • trunk/src/kernel32/hmdevice.h

    r3765 r3819  
    1 /* $Id: hmdevice.h,v 1.20 2000-06-28 18:08:34 sandervl Exp $ */
     1/* $Id: hmdevice.h,v 1.21 2000-07-12 18:21:42 sandervl Exp $ */
    22
    33/*
     
    3131#define HMTYPE_THREADTOKEN      4
    3232#define HMTYPE_THREAD           5
    33 
     33#define HMTYPE_PIPE             6
    3434//.....
    3535
     
    343343
    344344 virtual BOOL   GetExitCodeThread(PHMHANDLEDATA pHMHandleData, LPDWORD lpExitCode);
     345
     346 /* Named pipes */
     347  virtual BOOL  PeekNamedPipe(PHMHANDLEDATA pHMHandleData,
     348                              LPVOID lpvBuffer,
     349                              DWORD   cbBuffer,
     350                              LPDWORD lpcbRead,
     351                              LPDWORD lpcbAvail,
     352                              LPDWORD lpcbMessage);
     353
     354  virtual DWORD CreateNamedPipe(PHMHANDLEDATA pHMHandleData, LPCTSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode,
     355                                DWORD  nMaxInstances, DWORD  nOutBufferSize,
     356                                DWORD  nInBufferSize, DWORD  nDefaultTimeOut,
     357                                LPSECURITY_ATTRIBUTES lpSecurityAttributes);
     358
     359  virtual BOOL ConnectNamedPipe(PHMHANDLEDATA pHMHandleData, LPOVERLAPPED lpOverlapped);
     360
     361  virtual BOOL DisconnectNamedPipe(PHMHANDLEDATA pHMHandleData);
     362
     363  virtual BOOL GetNamedPipeHandleState(PHMHANDLEDATA pHMHandleData,
     364                                        LPDWORD lpState,
     365                                        LPDWORD lpCurInstances,
     366                                        LPDWORD lpMaxCollectionCount,
     367                                        LPDWORD lpCollectDataTimeout,
     368                                        LPTSTR  lpUserName,
     369                                        DWORD   nMaxUserNameSize);
     370
     371  virtual BOOL GetNamedPipeInfo(PHMHANDLEDATA pHMHandleData,
     372                                LPDWORD lpFlags,
     373                                LPDWORD lpOutBufferSize,
     374                                LPDWORD lpInBufferSize,
     375                                LPDWORD lpMaxInstances);
     376
     377
     378  virtual DWORD TransactNamedPipe(PHMHANDLEDATA pHMHandleData,
     379                                  LPVOID lpvWriteBuf,
     380                                  DWORD cbWriteBuf,
     381                                  LPVOID lpvReadBuf,
     382                                  DWORD cbReadBuf,
     383                                  LPDWORD lpcbRead,
     384                                  LPOVERLAPPED lpo);
     385
     386  virtual BOOL SetNamedPipeHandleState(PHMHANDLEDATA pHMHandleData,
     387                                      LPDWORD lpdwMode,
     388                                      LPDWORD lpcbMaxCollect,
     389                                      LPDWORD lpdwCollectDataTimeout);
     390
     391  virtual BOOL  CreatePipe(PHMHANDLEDATA pHMHandleDataRead,
     392                           PHMHANDLEDATA pHMHandleDataWrite,
     393                           LPSECURITY_ATTRIBUTES lpsa,
     394                           DWORD         cbPipe);
     395
    345396};
    346397
  • trunk/src/kernel32/hmfile.cpp

    r3804 r3819  
    1 /* $Id: hmfile.cpp,v 1.10 2000-07-06 21:18:42 sandervl Exp $ */
     1/* $Id: hmfile.cpp,v 1.11 2000-07-12 18:21:43 sandervl Exp $ */
    22
    33/*
     
    7070           pHMHandleDataTemplate));
    7171
    72   if (strncmp(lpFileName,       // "support" for local unc names
    73               "\\\\.\\",
    74               4) == 0)
     72  if(strncmp(lpFileName,       // "support" for local unc names
     73             "\\\\.\\",
     74             4) == 0)
    7575  {
    76         lpFileName+=4;
    77   }
     76        // check the named pipes
     77        if (strnicmp("\\\\.\\PIPE",lpFileName,8)==0)
     78                lpFileName+=3;
     79        else
     80                lpFileName+=4;
     81  }
     82
    7883
    7984  // create from template
  • trunk/src/kernel32/makefile

    r3642 r3819  
    1 # $Id: makefile,v 1.95 2000-06-01 11:28:47 sandervl Exp $
     1# $Id: makefile,v 1.96 2000-07-12 18:21:44 sandervl Exp $
    22
    33#
     
    125125$(OBJDIR)\queue.obj \
    126126$(OBJDIR)\hmthread.obj \
     127$(OBJDIR)\hmnpipe.obj \
    127128!ifdef DEBUG
    128129$(OBJDIR)\exceptstackdump.obj \
  • trunk/src/kernel32/npipe.cpp

    r3768 r3819  
    1 /* $Id: npipe.cpp,v 1.8 2000-06-28 21:05:56 phaller Exp $ */
     1/* $Id: npipe.cpp,v 1.9 2000-07-12 18:21:44 sandervl Exp $ */
    22/*
    33 * Win32 Named pipes API
     
    1515#include <heapstring.h>
    1616#include <options.h>
     17#include <HandleManager.h>
    1718#include "debugtools.h"
    1819#include "oslibdos.h"
     20
    1921
    2022#define DBG_LOCALLOG    DBG_npipe
     
    3234                                 LPDWORD,lpcbMessage)
    3335{
    34   return(OSLibDosPeekNamedPipe(hPipe,lpvBuffer,cbBuffer,lpcbRead,lpcbAvail,lpcbMessage));
     36  return (HMPeekNamedPipe(hPipe,lpvBuffer,cbBuffer,lpcbRead,lpcbAvail,lpcbMessage));
    3537}
    3638//******************************************************************************
     
    4345              DWORD,                cbPipe)
    4446{
    45   // @@@PH Note: HandleManager support is missing!
    46  
    47   if(!OSLibDosCreatePipe(phRead,
    48                           phWrite,
    49                           lpsa,
    50                           cbPipe))
    51     return TRUE;
    52   else
    53     return(FALSE);
     47  return (HMCreatePipe(phRead,phWrite,lpsa,cbPipe));
    5448}
    5549
     
    6054                                     DWORD, nMaxInstances, DWORD, nOutBufferSize,
    6155                                     DWORD, nInBufferSize, DWORD, nDefaultTimeOut,
    62                                      void*, lpSecurityAttributes)
    63 
    64 {
    65   HANDLE hPipe;
    66 
    67   hPipe = OSLibDosCreateNamedPipe(lpName,
    68                                   dwOpenMode,
    69                                   dwPipeMode,
    70                                   nMaxInstances,
    71                                   nOutBufferSize,
    72                                   nInBufferSize,
    73                                   nDefaultTimeOut,
    74                                   lpSecurityAttributes);
    75 
    76   return hPipe;
     56                                     LPSECURITY_ATTRIBUTES, lpSecurityAttributes)
     57
     58{
     59  return (HMCreateNamedPipe(lpName,
     60                            dwOpenMode,
     61                            dwPipeMode,
     62                            nMaxInstances,
     63                            nOutBufferSize,
     64                            nInBufferSize,
     65                            nDefaultTimeOut,
     66                            lpSecurityAttributes));
    7767
    7868}
     
    8272                                     DWORD, nMaxInstances, DWORD, nOutBufferSize,
    8373                                     DWORD, nInBufferSize, DWORD, nDefaultTimeOut,
    84                                      void *,lpSecurityAttributes)
     74                                     LPSECURITY_ATTRIBUTES,lpSecurityAttributes)
    8575{
    8676  char *asciiname;
     
    8979  asciiname  = UnicodeToAsciiString((LPWSTR)lpName);
    9080
    91   hPipe=OSLibDosCreateNamedPipe(asciiname,
    92                            dwOpenMode,
    93                            dwPipeMode,
    94                            nMaxInstances,
    95                            nOutBufferSize,
    96                            nInBufferSize,
    97                            nDefaultTimeOut,
    98                            lpSecurityAttributes);
     81  hPipe=HMCreateNamedPipe(asciiname,
     82                          dwOpenMode,
     83                          dwPipeMode,
     84                          nMaxInstances,
     85                          nOutBufferSize,
     86                          nInBufferSize,
     87                          nDefaultTimeOut,
     88                          lpSecurityAttributes);
    9989
    10090  FreeAsciiString(asciiname);
     
    123113 * Author    : Przemyslaw Dobrowolski [Sun, 2000/01/02 12:48]
    124114 *****************************************************************************/
    125 
    126115ODINFUNCTION2(BOOL,ConnectNamedPipe,HANDLE,hNamedPipe, LPOVERLAPPED,lpOverlapped)
    127116{
    128   return (OSLibDosConnectNamedPipe(hNamedPipe,lpOverlapped));
     117  return (HMConnectNamedPipe(hNamedPipe,lpOverlapped));
    129118}
    130119
     
    238227  return(rc);
    239228}
     229
    240230/*****************************************************************************
    241231 * Name      : BOOL WIN32API DisconnectNamedPipe
     
    254244ODINFUNCTION1(BOOL,DisconnectNamedPipe,HANDLE,hNamedPipe)
    255245{
    256   return (OSLibDosDisconnectNamedPipe(hNamedPipe));
     246  return (HMDisconnectNamedPipe(hNamedPipe));
    257247}
    258248
     
    285275                                          DWORD   nMaxUserNameSize)
    286276{
    287   dprintf(("KERNEL32: GetNamedPipeHandleStateA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented (yet)\n",
    288            hNamedPipe,
    289            lpState,
    290            lpCurInstances,
    291            lpMaxCollectionCount,
    292            lpCollectDataTimeout,
    293            lpUserName,
    294            nMaxUserNameSize));
    295 
    296   return (FALSE);
     277  // Not implemented but waiting to implementation in hmnpipe.cpp
     278  return ( HMGetNamedPipeHandleState( hNamedPipe,
     279                                       lpState,
     280                                       lpCurInstances,
     281                                       lpMaxCollectionCount,
     282                                       lpCollectDataTimeout,
     283                                       lpUserName,
     284                                       nMaxUserNameSize));
    297285}
    298286
     
    326314                                          DWORD   nMaxUserNameSize)
    327315{
    328   dprintf(("KERNEL32: GetNamedPipeHandleStateW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented\n",
    329            hNamedPipe,
    330            lpState,
    331            lpCurInstances,
    332            lpMaxCollectionCount,
    333            lpCollectDataTimeout,
    334            lpUserName,
    335            nMaxUserNameSize));
    336 
    337   return (FALSE);
     316  char *asciiname;
     317  BOOL rc;
     318
     319  asciiname  = UnicodeToAsciiString((LPWSTR)lpUserName);
     320
     321  // Not implemented but waiting to implementation in hmnpipe.cpp
     322  rc= HMGetNamedPipeHandleState( hNamedPipe,
     323                                  lpState,
     324                                  lpCurInstances,
     325                                  lpMaxCollectionCount,
     326                                  lpCollectDataTimeout,
     327                                  asciiname,
     328                                  nMaxUserNameSize);
     329
     330
     331  FreeAsciiString(asciiname);
     332
     333  return (rc);
    338334}
    339335
     
    361357                                  LPDWORD lpMaxInstances)
    362358{
    363   dprintf(("KERNEL32: GetNamedPipeInfo(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented\n",
    364            hNamedPipe,
    365            lpFlags,
    366            lpOutBufferSize,
    367            lpInBufferSize,
    368            lpMaxInstances));
    369 
    370   return (FALSE);
     359  // Not implemented but waiting to implementation in hmnpipe.cpp
     360  return ( HMGetNamedPipeInfo( hNamedPipe,
     361                               lpFlags,
     362                               lpOutBufferSize,
     363                               lpInBufferSize,
     364                               lpMaxInstances));
     365
    371366}
    372367
     
    395390                                      LPDWORD lpdwCollectDataTimeout)
    396391{
    397   dprintf(("KERNEL32: SetNamedPipeHandleState(%08xh,%08xh,%08xh,%08xh) not implemented.\n",
    398            hNamedPipe,
    399            lpdwMode,
    400            lpcbMaxCollect,
    401            lpdwCollectDataTimeout));
    402 
    403   return (FALSE);
     392  // Not implemented but waiting to implementation in hmnpipe.cpp
     393  return ( HMSetNamedPipeHandleState( hNamedPipe,
     394                               lpdwMode,
     395                               lpcbMaxCollect,
     396                               lpdwCollectDataTimeout));
    404397}
    405398
     
    432425                                      LPOVERLAPPED,lpo)
    433426{
    434   return(OSLibDosTransactNamedPipe( hNamedPipe,
    435                                     lpvWriteBuf,
    436                                     cbWriteBuf,
    437                                     lpvReadBuf,
    438                                     cbReadBuf,
    439                                     lpcbRead,
    440                                     lpo));
    441 
     427  return(HMTransactNamedPipe( hNamedPipe,
     428                              lpvWriteBuf,
     429                              cbWriteBuf,
     430                              lpvReadBuf,
     431                              cbReadBuf,
     432                              lpcbRead,
     433                              lpo));
    442434}
    443435
  • trunk/src/kernel32/oslibdos.cpp

    r3804 r3819  
    1 /* $Id: oslibdos.cpp,v 1.34 2000-07-06 21:18:44 sandervl Exp $ */
     1/* $Id: oslibdos.cpp,v 1.35 2000-07-12 18:21:45 sandervl Exp $ */
    22/*
    33 * Wrappers for OS/2 Dos* API
     
    13391339                               DWORD   nInBufferSize,
    13401340                               DWORD   nDefaultTimeOut,
    1341                                void*  lpSecurityAttributes)
     1341                               LPSECURITY_ATTRIBUTES lpSecurityAttributes)
    13421342{  DWORD dwOS2Mode     = 0;
    13431343   DWORD dwOS2PipeMode = 0;
     
    19121912BOOL OSLibDosCreatePipe(PHANDLE phfRead,
    19131913                        PHANDLE phfWrite,
    1914                         void*  lpsa,
     1914                        LPSECURITY_ATTRIBUTES lpsa,
    19151915                        DWORD   dwSize)
    19161916{
  • trunk/src/kernel32/oslibdos.h

    r3768 r3819  
    1 /* $Id: oslibdos.h,v 1.19 2000-06-28 21:05:57 phaller Exp $ */
     1/* $Id: oslibdos.h,v 1.20 2000-07-12 18:21:45 sandervl Exp $ */
    22
    33/*
     
    161161                              DWORD   nInBufferSize,
    162162                              DWORD   nDefaultTimeOut,
    163                               void* lpSecurityAttributes);
     163                              LPSECURITY_ATTRIBUTES lpSecurityAttributes);
    164164
    165165BOOL OSLibDosWaitNamedPipe(LPCSTR lpszNamedPipeName,
     
    170170BOOL OSLibDosCreatePipe(PHANDLE phfRead,
    171171                        PHANDLE phfWrite,
    172                         void*  lpsa,
     172                        LPSECURITY_ATTRIBUTES lpsa,
    173173                        DWORD   dwSize);
    174174
Note: See TracChangeset for help on using the changeset viewer.