mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 17:42:45 +08:00

* dotnet sc * MD preview - C# app - working self-contained * Gcode preview - C# app * DevFiles preview - C# app * Fix passing path with spaces as cmd arg and monacocpp proj file * Pdf preview - C# app * Svg preview - C# app * Fix comment * Gcode thumbnail - C# app TODO: - installer - why IThumbnailProvider and IIntializeWithFile doesn't work? * Pdf thumbnail - C# app TODO: - installer - why IThumbnailProvider and IIntializeWithFile doesn't work? * Pdf thumbnail - C# app TODO: - installer - why IThumbnailProvider and IIntializeWithFile doesn't work? * Fix GcodeThumbnailProviderCpp.vcxproj * Svg thumbnail - C# app TODO: - installer - why IThumbnailProvider and IIntializeWithFile doesn't work? * Fix Svg tests * Thumbnail providers - installer * Self-contained Hosts and FileLocksmith * Fix hardcoded <RuntimeIdentifier> * Remove unneeded files * Try to fix Nuget in PR CI * Prefix new dlls with PowerToys. Sign new dlls and exes * Add new .exe files to ProcessList * ci: debug by listing all env vars * ci: try setting variable in the right ci file * Bring back hardcoded RuntimeIdentifier * ci: Add comment and remove debug action * Remove unneeded lib * [WIP] Platform conditional dotnet files & hardlinks * Cleanup * Update expect.txt * Test fix - ARM installer * Fix uninstall bug * Update docs * Fix failing test * Add dll details * Minor cleanup * Improve resizing * Add some logs * Test fix - release build * Remove InvokeOnControlThread * Test fix: logger initialization * Fix arm64 installer Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Dustin L. Howett <dustin@howett.net>
84 lines
1.4 KiB
C++
84 lines
1.4 KiB
C++
#include "pch.h"
|
|
#include "ClassFactory.h"
|
|
#include "GcodePreviewHandler.h"
|
|
|
|
#include <new>
|
|
#include <Shlwapi.h>
|
|
|
|
extern long g_cDllRef;
|
|
|
|
ClassFactory::ClassFactory() :
|
|
m_cRef(1)
|
|
{
|
|
InterlockedIncrement(&g_cDllRef);
|
|
}
|
|
|
|
ClassFactory::~ClassFactory()
|
|
{
|
|
InterlockedDecrement(&g_cDllRef);
|
|
}
|
|
|
|
//
|
|
// IUnknown
|
|
//
|
|
|
|
IFACEMETHODIMP ClassFactory::QueryInterface(REFIID riid, void **ppv)
|
|
{
|
|
static const QITAB qit[] = {
|
|
QITABENT(ClassFactory, IClassFactory),
|
|
{ 0 },
|
|
};
|
|
return QISearch(this, qit, riid, ppv);
|
|
}
|
|
|
|
IFACEMETHODIMP_(ULONG) ClassFactory::AddRef()
|
|
{
|
|
return InterlockedIncrement(&m_cRef);
|
|
}
|
|
|
|
IFACEMETHODIMP_(ULONG) ClassFactory::Release()
|
|
{
|
|
ULONG cRef = InterlockedDecrement(&m_cRef);
|
|
if (0 == cRef)
|
|
{
|
|
delete this;
|
|
}
|
|
return cRef;
|
|
}
|
|
|
|
//
|
|
// IClassFactory
|
|
//
|
|
|
|
IFACEMETHODIMP ClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv)
|
|
{
|
|
HRESULT hr = CLASS_E_NOAGGREGATION;
|
|
|
|
if (pUnkOuter == NULL)
|
|
{
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
GcodePreviewHandler* pExt = new (std::nothrow) GcodePreviewHandler();
|
|
if (pExt)
|
|
{
|
|
hr = pExt->QueryInterface(riid, ppv);
|
|
pExt->Release();
|
|
}
|
|
}
|
|
|
|
return hr;
|
|
}
|
|
|
|
IFACEMETHODIMP ClassFactory::LockServer(BOOL fLock)
|
|
{
|
|
if (fLock)
|
|
{
|
|
InterlockedIncrement(&g_cDllRef);
|
|
}
|
|
else
|
|
{
|
|
InterlockedDecrement(&g_cDllRef);
|
|
}
|
|
|
|
return S_OK;
|
|
} |