//**************************************************************************************************
//
// COMMON INCLUDE FOR "SHLProps" IMPLEMENTATION:
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// NativeLib DLL (for DotNetHelpers) | C+- (SysRoutine) | Author: Sergei Y.Kitáev
#include "SHLProps.api.h"
#include "SHLProps.PP.h"
namespace NativeLib {

//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// "SHLPropsHnd" INTERNAL STRUCTURE (HANDLE):
//
//==================================================================================================
struct SHLPropsHnd
{
public:
   bool                 FinalizerAccessed;
   IShellLink           *PSLInterface;
   IPersistFile         *PPersistFileInterface;
   IShellLinkDataList   *PSLDataListInterface;
public:
   bool Initialize() $null_on_failure $needs_finalize nl_last_error;
   void Finalize();
   bool SaveProperties($OA, PCWSTR filePath,
                            const NLShellLinkSpecialProps* specialPropsPtr $optional )
                            const nl_last_error;
private:
   static bool CantObtainInterface($A, PCWSTR interfaceName, HRESULT hResult ) $ret_false
                                                                               nl_last_error;
}; // SHLPropsHnd
typedef SHLPropsHnd*       PSHLPropsHnd;
typedef const SHLPropsHnd* PCSHLPropsHnd;
//==================================================================================================


//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//
// "SHLProps" STATIC CLASS (IMPLEMENTATION PART):
//
//==================================================================================================
class SHLProps
{
$STATIC_CLASS( SHLProps )
public:
   static bool CantExtractSLProperty($A, PCWSTR propertyName, HRESULT hResult ) $ret_false
                                                                                nl_last_error;
   static bool CantExtractSLProperty($A, PCWSTR propertyName, PCWSTR headerMessageEx $optional,
                                         HRESULT hResult ) $ret_false nl_last_error;
   static bool CantExtractSLPropertyFmt($A, PCWSTR propertyName, HRESULT hResult,
                                            PCWSTR messageFmt, ... ) $ret_false nl_last_error;
   static bool CantExtractSLPropertyFmtVA($A, PCWSTR propertyName, HRESULT hResult,
                                              PCWSTR messageFmt, va_list argList ) $ret_false
                                                                                   nl_last_error;

   static bool CantSetSLProperty($A, PCWSTR propertyName, HRESULT hResult ) $ret_false
                                                                            nl_last_error;
   static bool CantSetSLProperty($A, PCWSTR propertyName, PCWSTR headerMessageEx $optional,
                                     HRESULT hResult ) $ret_false nl_last_error;
   static bool CantSetSLPropertyFmt($A, PCWSTR propertyName, HRESULT hResult,
                                        PCWSTR messageFmt, ... ) $ret_false nl_last_error;
   static bool CantSetSLPropertyFmtVA($A, PCWSTR propertyName, HRESULT hResult,
                                          PCWSTR messageFmt, va_list argList ) $ret_false
                                                                               nl_last_error;
public:
   static bool CantExtractSLProperty($A, PCWSTR propertyName, PCWSTR message ) $ret_false
                                                                               nl_last_error;
   static bool CantExtractSLPropertyFmt($A, PCWSTR propertyName, PCWSTR messageFmt,
                                                                 ... ) $ret_false nl_last_error;
   static bool CantExtractSLPropertyFmtVA($A, PCWSTR propertyName, PCWSTR messageFmt,
                                                                   va_list argList ) $ret_false
                                                                                     nl_last_error;

   static bool CantSetSLProperty($A, PCWSTR propertyName, PCWSTR message ) $ret_false nl_last_error;
   static bool CantSetSLPropertyFmt($A, PCWSTR propertyName, PCWSTR messageFmt,
                                                             ... ) $ret_false nl_last_error;
   static bool CantSetSLPropertyFmtVA($A, PCWSTR propertyName, PCWSTR messageFmt,
                                                               va_list argList ) $ret_false
                                                                                 nl_last_error;
private:
   static PCWSTR CantExtractSLProperty_Fmt() $static_pointer;
   static PCWSTR CantSetSLProperty_Fmt() $static_pointer;

   static PCWSTR CantExtractDisplayNameValue_Message() $static_pointer;
   static PCWSTR CantSetDisplayNameValue_Message() $static_pointer;
}; // SHLProps
//==================================================================================================

} // NativeLib
