home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / interfac / ilockbyt.cpp < prev    next >
C/C++ Source or Header  |  1996-05-21  |  4KB  |  229 lines

  1. /*
  2.  * ILOCKBYT.H
  3.  *
  4.  * Template ILockBytes interface implementation.
  5.  *
  6.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  7.  *
  8.  * Kraig Brockschmidt, Microsoft
  9.  * Internet  :  kraigb@microsoft.com
  10.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  11.  */
  12.  
  13.  
  14. #include "ilockbyt.h"
  15.  
  16.  
  17. /*
  18.  * CImpILockBytes::CImpILockBytes
  19.  * CImpILockBytes::~CImpILockBytes
  20.  *
  21.  * Parameters (Constructor):
  22.  *  pObj            LPVOID of the object we're in.
  23.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  24.  */
  25.  
  26. CImpILockBytes::CImpILockBytes(LPVOID pObj, LPUNKNOWN pUnkOuter)
  27.     {
  28.     m_cRef=0;
  29.     m_pObj=pObj;
  30.     m_pUnkOuter=pUnkOuter;
  31.     return;
  32.     }
  33.  
  34. CImpILockBytes::~CImpILockBytes(void)
  35.     {
  36.     return;
  37.     }
  38.  
  39.  
  40.  
  41. /*
  42.  * CImpILockBytes::QueryInterface
  43.  * CImpILockBytes::AddRef
  44.  * CImpILockBytes::Release
  45.  *
  46.  * Purpose:
  47.  *  Delegating IUnknown members for CImpILockBytes.
  48.  */
  49.  
  50. STDMETHODIMP CImpILockBytes::QueryInterface(REFIID riid
  51.     , LPVOID *ppv)
  52.     {
  53.     return m_pUnkOuter->QueryInterface(riid, ppv);
  54.     }
  55.  
  56. STDMETHODIMP_(ULONG) CImpILockBytes::AddRef(void)
  57.     {
  58.     ++m_cRef;
  59.     return m_pUnkOuter->AddRef();
  60.     }
  61.  
  62. STDMETHODIMP_(ULONG) CImpILockBytes::Release(void)
  63.     {
  64.     --m_cRef;
  65.     return m_pUnkOuter->Release();
  66.     }
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. /*
  75.  * CImpILockBytes::ReadAt
  76.  *
  77.  * Purpose:
  78.  *  Reads bytes from the byte array starting at a specific position.
  79.  *
  80.  * Parameters:
  81.  *  ulOffset        ULARGE_INTEGER specifying the offset at which
  82.  *                  to read.
  83.  *  pv              void HUGEP * into which to read the information.
  84.  *  cb              ULONG number of bytes to read
  85.  *  pcbRead         ULONG * in which to store the number of bytes
  86.  *                  read
  87.  */
  88.  
  89. STDMETHODIMP ReadAt(ULARGE_INTEGER ulOffset, VOID HUGEP *pv
  90.     , ULONG cb, ULONG *pcbRead)
  91.     {
  92.     return ResultFromScode(E_NOTIMPL);
  93.     }
  94.  
  95.  
  96.  
  97.  
  98.  
  99. /*
  100.  * CImpILockBytes::WriteAt
  101.  *
  102.  * Purpose:
  103.  *  Writes bytes into the byte array starting at a specific position.
  104.  *
  105.  * Parameters:
  106.  *  ulOffset        ULARGE_INTEGER specifying the offset at which
  107.  *                  to write.
  108.  *  pv              void HUGEP * to the information to write.
  109.  *  cb              ULONG number of bytes to write
  110.  *  pcbWritten      ULONG * in which to store the number of bytes
  111.  *                  written.
  112.  */
  113.  
  114. STDMETHODIMP WriteAt(ULARGE_INTEGER ulOffset, VOID HUGEP *pv
  115.     , ULONG cb, ULONG *pcbWritten)
  116.     {
  117.     return ResultFromScode(E_NOTIMPL);
  118.     }
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126. /*
  127.  * CImpILockBytes::Flush
  128.  *
  129.  * Purpose:
  130.  *  Insures that any internal buffers are written to the underlying
  131.  *  storage.
  132.  *
  133.  * Parameters:
  134.  *  None
  135.  */
  136.  
  137. STDMETHODIMP Flush(void)
  138.     {
  139.     return ResultFromScode(E_NOTIMPL);
  140.     }
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147. /*
  148.  * CImpILockBytes::SetSize
  149.  *
  150.  * Purpose:
  151.  *  Changes the size of the byte array.
  152.  *
  153.  * Parameters:
  154.  *  cb              ULARGE_INTEGER specifying the size to set.
  155.  */
  156.  
  157. STDMETHODIMP SetSize(ULARGE_INTEGER cb)
  158.     {
  159.     return ResultFromScode(E_NOTIMPL);
  160.     }
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167. /*
  168.  * CImpILockBytes::LockRegion
  169.  *
  170.  * Purpose:
  171.  *  Locks a range of bytes in the byte array.
  172.  *
  173.  * Parameters:
  174.  *  libOffset       ULARGE_INTEGER at which to start the lock.
  175.  *  cb              ULARGE_INTEGER number of bytes to lock.
  176.  *  dwLockType      DWORD the type of lock access.
  177.  */
  178.  
  179. STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb
  180.     , DWORD dwLockType)
  181.     {
  182.     return ResultFromScode(E_NOTIMPL);
  183.     }
  184.  
  185.  
  186.  
  187.  
  188.  
  189. /*
  190.  * CImpILockBytes::UnlockRegion
  191.  *
  192.  * Purpose:
  193.  *  Unlocks a range of bytes in the byte array.
  194.  *
  195.  * Parameters:
  196.  *  libOffset       ULARGE_INTEGER at which to start the unlock.
  197.  *  cb              ULARGE_INTEGER number of bytes to unlock.
  198.  *  dwLockType      DWORD the type of lock access.
  199.  */
  200.  
  201.  
  202. STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb
  203.     , DWORD dwLockType)
  204.     {
  205.     return ResultFromScode(E_NOTIMPL);
  206.     }
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213. /*
  214.  * CImpILockBytes::Stat
  215.  *
  216.  * Purpose:
  217.  *  Returns relevant statistics about the byte array.
  218.  *
  219.  * Parameters:
  220.  *  pstatstg        LPSTATSTG in which to store the statistics.
  221.  *  grfStatFlag     DWORD specifying the level of information
  222.  *                  requested.
  223.  */
  224.  
  225. STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag)
  226.     {
  227.     return ResultFromScode(E_NOTIMPL);
  228.     }
  229.