//**************************************************************************************************
//
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//
// "SHELL"-CLASSES (IN-HEADER IMPLEMENTATION):
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#pragma once
#ifndef COMMON_HELPERS_H
   #error "This header file requires 'CommonHelpers.h' to be priory included."
#endif
#define HSHELL_H

#include "HCOM.h"
#include <ShlObj.h>

namespace CommonHelpers {

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// "IFileSystemBindData" DUMMY INTERFACE:
//
//==================================================================================================
class HTCOMEmptyFileSystemBindData: public IFileSystemBindData {
//--------------------------------------------------------------------------------------------------
public:
   HTCOMEmptyFileSystemBindData()
   {
      InterlockedExchange( &_RefCount_, 1 );
   }

// === "IUnknown" methods: ===

   STDMETHODIMP_($UINT) AddRef()
   {
      return ::InterlockedIncrement( &_RefCount_ );
   }

   STDMETHODIMP_($UINT) Release()
   {
      $UINT refCount = ::InterlockedDecrement( &_RefCount_ );
      if ( !refCount )
         delete this;
      return refCount;
   }

   STDMETHODIMP QueryInterface( REFIID riid, $PPVOID ppvObject )
   {
      if ( IsEqualIID( riid, IID_IFileSystemBindData ) ||
           IsEqualIID( riid, IID_IUnknown ) )
      {
         AddRef();
         HUnsafePtr::_InterlockedExchange( ppvObject, this );
         return S_OK;
      }
      HUnsafePtr::_InterlockedExchange( ppvObject, NULL );
      return E_NOINTERFACE;
   }

// === "IFileSystemBindData" methods: ===

   STDMETHODIMP_(HRESULT) GetFindData($OUT WIN32_FIND_DATA* pFindData)
   {
      //*pFindData = {};
      HTMemory::Clear( pFindData ); return S_OK;
   }

   STDMETHODIMP_(HRESULT) SetFindData($IN const WIN32_FIND_DATA* pcFindData)
   {
      return S_OK;
   }

private:
   $INT volatile _RefCount_;
//--------------------------------------------------------------------------------------------------
}; // HTCOMEmptyFileSystemBindData
//==================================================================================================

} // CommonHelpers
