Browse by Tags

Tagged Content List
  • Blog Post: Reposting Information

    A number of people have asked me questions like "can I quote your blog in my blog?", "can I post your article in my wiki?", "can I use this information in my MSDN Magazine article?" and so on. It is nice of you to ask, particularly since there is practically nothing I can do to stop you should you...
  • Blog Post: deque.cs

    public interface IDeque<T> { T PeekLeft(); T PeekRight(); IDeque<T> EnqueueLeft(T value); IDeque<T> EnqueueRight(T value); IDeque<T> DequeueLeft(); IDeque<T> DequeueRight(); bool IsEmpty { get; } } public sealed class Deque<T> : IDeque<T> { private sealed...
  • Blog Post: Original: When Are You Required To Set Objects To Nothing?

    NOTE: I have significantly revised this article. What you are reading now is the archive of the original posting. The updated version is here http://blogs.msdn.com/ericlippert/archive/2004/04/28/122259.aspx It's getting into sailing/kite flying season in Seattle -- that is, it's light out after...
  • Blog Post: invoke.cpp

    #include "headers.h" HRESULT InvokeDispatch(IDispatch * pdisp, DISPID dispid, REFIID riid, LCID lcid, WORD flags, DISPPARAMS * pDispParams, VARIANT * pvarResult, EXCEPINFO * pExcepInfo, UINT * pError) { AssertReadPtr(pdisp); HRESULT hr; // We must addref the pointer before the invocation. Why...
  • Blog Post: invoke.h

    #ifndef INVOKE_H // { #define INVOKE_H extern HRESULT InvokeDispatch(IDispatch * pdisp, DISPID dispid, REFIID riid, LCID lcid, WORD flags, DISPPARAMS * pDispParams, VARIANT * pvarResult, EXCEPINFO * pExcepInfo, UINT * pError); extern BOOL IsValidDispatch(VARIANT * pvar); #endif // INVOKE_H ...
  • Blog Post: binder.cpp

    #include "headers.h" Binder::Binder() { DLLAddRef(); this->m_cref = 1; this->m_thread = GetCurrentThreadId(); } Binder::~Binder(void) { DLLRelease(); } HRESULT Binder::Create(Binder * * ppBinder) { AssertOutPtr(ppBinder); *ppBinder = new Binder(); if (NULL == *ppBinder) return E_OUTOFMEMORY;...
  • Blog Post: binder.h

    #ifndef BINDER_H // { #define BINDER_H class Binder : public IDispatch { protected: class Name { public: Name(); ~Name(); HRESULT SetValue(VARIANTARG * pvar); HRESULT GetValue(VARIANT * pvar); BOOL IsFunction(void); HRESULT ExecuteFunction(UINT cArgs, VARIANTARG * rgvarArgs, VARIANT * pvarResult...
  • Blog Post: nameditemlist.h

    #ifndef NAMEDITEMLIST_H // { #define NAMEDITEMLIST_H class NamedItemList { private: class NamedItem { private: NamedItem(); public: ~NamedItem(); static HRESULT Create(const WCHAR * pszName, NamedItem * * ppNamedItem); NamedItem * m_pNext; BSTR m_bstrName; DWORD m_flags; BOOL IsPersistent...
  • Blog Post: nameditemlist.cpp

    #include "headers.h" NamedItemList::NamedItemList() { this->m_cBuckets = 0; this->m_Buckets = NULL; this->m_pMutex = NULL; } NamedItemList::~NamedItemList() { this->Clear(); if (NULL != this->m_Buckets) delete[] this->m_Buckets; if (NULL != this->m_pMutex) delete this->m_pMutex;...
  • Blog Post: mutex.cpp

    #include "headers.h" Mutex::Mutex() { m_fInitialized = FALSE; } HRESULT Mutex::Create(Mutex * * ppMutex) { AssertOutPtr(ppMutex); HRESULT hr; BOOL fSuccess; DWORD error; Mutex * pMutex = NULL; pMutex = new Mutex(); if (NULL == pMutex) { hr = E_OUTOFMEMORY; goto LError; } fSuccess = InitializeCriticalSectionAndSpinCount...
  • Blog Post: mutex.h

    #ifndef MUTEX_H // { #define MUTEX_H class Mutex { private: CRITICAL_SECTION m_criticalsection; BOOL m_fInitialized; Mutex(); public: static HRESULT Create(Mutex * * ppMutex); ~Mutex(); void Enter(void); void Leave(void); }; #endif // MUTEX_H }
  • Blog Post: hash.h

    #ifndef HASH_H // { #define HASH_H extern ULONG ComputeHash(const WCHAR * psz); #endif // HASH_H }
  • Blog Post: hash.cpp

    #include "headers.h" ULONG ComputeHash(const WCHAR * psz) { AssertReadString(psz); ULONG hash = 0; while (*psz != '\0') { hash = 17 * hash + *psz; ++psz; } return hash; }
  • Blog Post: engine.h

    #ifndef ENGINE_H // { #define ENGINE_H const DWORD threadNone = 0xFFFFFFFF; // The error has been reported to the host via IActiveScriptSite::OnScriptError const HRESULT SCRIPT_E_REPORTED = 0x80020101L; class ScriptEngine : public IActiveScript, public IActiveScriptParse, public IActiveScriptParseProcedure2...
  • Blog Post: engine.cpp

    #include "headers.h" ScriptEngine::ScriptEngine() { DLLAddRef(); this->m_cref = 1; this->m_thread = threadNone; this->m_state = SCRIPTSTATE_UNINITIALIZED; this->m_psite = NULL; this->m_pNamedItemList = NULL; } ScriptEngine::~ScriptEngine() { Assert(this->m_cref == 0); if...
  • Blog Post: classfac.h

    #ifndef CLASSFAC_H #define CLASSFAC_H class ClassFactory : public IClassFactory { private: long m_cref; ClassFactory(); ~ClassFactory(); public: static HRESULT Create(ClassFactory * * ppFactory); // IUnknown STDMETHODIMP QueryInterface(REFIID riid, void** ppv); STDMETHODIMP_(ULONG) AddRef...
  • Blog Post: dllmain.h

    #ifndef DLLMAIN_H // { #define DLLMAIN_H extern void DLLAddRef(void); extern void DLLRelease(void); extern void DLLAddLock(void); extern void DLLReleaseLock(void); #endif // DLLMAIN_H }
  • Blog Post: classfac.cpp

    #include "headers.h" // ClassFactory ClassFactory::ClassFactory() { m_cref = 1; } ClassFactory::~ClassFactory() { } HRESULT ClassFactory::Create(ClassFactory * * ppFactory) { AssertOutPtr(ppFactory); *ppFactory = new ClassFactory(); if (NULL == *ppFactory) return E_OUTOFMEMORY; return S_OK;...
  • Blog Post: dllmain.cpp

    #include "headers.h" // // Helper methods // static long g_cReferences = 0; static long g_cLocks = 0; static HMODULE g_hmodule = NULL; static const WCHAR * pszEngineName = L"SimpleScript"; static const WCHAR * pszOLEScript = L"OLEScript"; static const WCHAR * pszCLSID = L"CLSID"; static const...
  • Blog Post: assert.cpp

    #include "headers.h" static BOOL IsGoodPtr(void * pv, ULONG cb, DWORD dwFlags) { DWORD dwSize; MEMORY_BASIC_INFORMATION meminfo; if (NULL == pv) return FALSE; memset(&meminfo, 0x00, sizeof meminfo); dwSize = VirtualQuery(pv, &meminfo, sizeof meminfo); // If pv is a kernel-mode address...
  • Blog Post: assert.h

    #ifndef ASSERT_H // { #define ASSERT_H extern BOOL Debugger(); extern BOOL AssertProc(const char *pszFile, long lwLine, const char *pszMsg); extern BOOL IsValidReadString(const WCHAR * psz); extern BOOL IsValidReadStringN(const WCHAR * psz); extern BOOL IsGoodReadPtr(void * pv, ULONG cb); extern BOOL...
  • Blog Post: guids.cpp

    #include <initguid.h> #include <activscp.h> #include "guids.h"
  • Blog Post: guids.h

    #ifndef GUIDS_H // { #define GUIDS_H DEFINE_GUID(CLSID_SimpleScript, 0x5ff86f82, 0x18fb, 0x4aff, 0x98, 0xba, 0x20, 0xfd, 0xf2, 0x48, 0xa9, 0x24); #endif // GUIDS_H }
  • Blog Post: headers.h

    #ifndef HEADERS_H // { #define HEADERS_H // InitializeCriticalSectionAndSpinCount requires WinNT 4.0 SP3 or better. // UNDONE: Add code to registration, etc, that verifies that we are on the // UNDONE: right OS. #define _WIN32_WINNT 0x0403 #include <windows.h> #include <objidl.h>...
  • Blog Post: SimpleScript.def

    LIBRARY SIMPLESCRIPT EXPORTS DllGetClassObject PRIVATE DllRegisterServer PRIVATE DllUnregisterServer PRIVATE DllCanUnloadNow PRIVATE
Page 1 of 1 (25 items)