mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-25 12:06:26 +03:00
refactored logging for synwinxt, and added version number.
This commit is contained in:
parent
b3a28139ad
commit
64248beb4e
@ -21,27 +21,27 @@
|
|||||||
#include <Shlwapi.h>
|
#include <Shlwapi.h>
|
||||||
|
|
||||||
extern LONG g_refCount;
|
extern LONG g_refCount;
|
||||||
extern void outputDebugStringF(const char *str, ...);
|
extern void log(const char *str, ...);
|
||||||
|
|
||||||
CClassFactory::CClassFactory() :
|
CClassFactory::CClassFactory() :
|
||||||
m_refCount(1)
|
m_refCount(1)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CClassFactory::ctor, g_refCount=%d\n", g_refCount);
|
log("> CClassFactory::ctor, g_refCount=%d", g_refCount);
|
||||||
InterlockedIncrement(&g_refCount);
|
InterlockedIncrement(&g_refCount);
|
||||||
outputDebugStringF("synwinxt: < CClassFactory::ctor, g_refCount=%d\n", g_refCount);
|
log("< CClassFactory::ctor, g_refCount=%d", g_refCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
CClassFactory::~CClassFactory()
|
CClassFactory::~CClassFactory()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CClassFactory::dtor, g_refCount=%d\n", g_refCount);
|
log("> CClassFactory::dtor, g_refCount=%d", g_refCount);
|
||||||
InterlockedDecrement(&g_refCount);
|
InterlockedDecrement(&g_refCount);
|
||||||
outputDebugStringF("synwinxt: < CClassFactory::dtor, g_refCount=%d\n", g_refCount);
|
log("< CClassFactory::dtor, g_refCount=%d", g_refCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE
|
HRESULT STDMETHODCALLTYPE
|
||||||
CClassFactory::QueryInterface(REFIID riid, void **ppvObject)
|
CClassFactory::QueryInterface(REFIID riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CClassFactory::QueryInterface\n");
|
log("> CClassFactory::QueryInterface");
|
||||||
static const QITAB qit[] =
|
static const QITAB qit[] =
|
||||||
{
|
{
|
||||||
QITABENT(CClassFactory, IClassFactory),
|
QITABENT(CClassFactory, IClassFactory),
|
||||||
@ -49,36 +49,36 @@ CClassFactory::QueryInterface(REFIID riid, void **ppvObject)
|
|||||||
};
|
};
|
||||||
HRESULT hr = QISearch(this, qit, riid, ppvObject);
|
HRESULT hr = QISearch(this, qit, riid, ppvObject);
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < CClassFactory::QueryInterface, hr=%d\n", hr);
|
log("< CClassFactory::QueryInterface, hr=%d", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG STDMETHODCALLTYPE
|
ULONG STDMETHODCALLTYPE
|
||||||
CClassFactory::AddRef()
|
CClassFactory::AddRef()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CClassFactory::AddRef, m_refCount=%d\n", m_refCount);
|
log("> CClassFactory::AddRef, m_refCount=%d", m_refCount);
|
||||||
LONG r = InterlockedIncrement(&m_refCount);
|
LONG r = InterlockedIncrement(&m_refCount);
|
||||||
outputDebugStringF("synwinxt: < CClassFactory::AddRef, r=%d, m_refCount=%d\n", r, m_refCount);
|
log("< CClassFactory::AddRef, r=%d, m_refCount=%d", r, m_refCount);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG STDMETHODCALLTYPE
|
ULONG STDMETHODCALLTYPE
|
||||||
CClassFactory::Release()
|
CClassFactory::Release()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CClassFactory::Release, m_refCount=%d\n", m_refCount);
|
log("> CClassFactory::Release, m_refCount=%d", m_refCount);
|
||||||
LONG r = InterlockedDecrement(&m_refCount);
|
LONG r = InterlockedDecrement(&m_refCount);
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < CClassFactory::Release, r=%d\n", r);
|
log("< CClassFactory::Release, r=%d", r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE
|
HRESULT STDMETHODCALLTYPE
|
||||||
CClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
|
CClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CClassFactory::CreateInstance\n");
|
log("> CClassFactory::CreateInstance");
|
||||||
if (pUnkOuter != NULL) {
|
if (pUnkOuter != NULL) {
|
||||||
return CLASS_E_NOAGGREGATION;
|
return CLASS_E_NOAGGREGATION;
|
||||||
}
|
}
|
||||||
@ -89,20 +89,20 @@ CClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppvObject
|
|||||||
delete pExtension;
|
delete pExtension;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < CClassFactory::CreateInstance, hr=%d\n", hr);
|
log("< CClassFactory::CreateInstance, hr=%d", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE
|
HRESULT STDMETHODCALLTYPE
|
||||||
CClassFactory::LockServer(BOOL fLock)
|
CClassFactory::LockServer(BOOL fLock)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CClassFactory::LockServer, g_refCount=%d\n", g_refCount);
|
log("> CClassFactory::LockServer, g_refCount=%d", g_refCount);
|
||||||
if (fLock) {
|
if (fLock) {
|
||||||
InterlockedIncrement(&g_refCount);
|
InterlockedIncrement(&g_refCount);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
InterlockedDecrement(&g_refCount);
|
InterlockedDecrement(&g_refCount);
|
||||||
}
|
}
|
||||||
outputDebugStringF("synwinxt: < CClassFactory::LockServer, g_refCount=%d\n", g_refCount);
|
log("< CClassFactory::LockServer, g_refCount=%d", g_refCount);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -24,27 +24,27 @@
|
|||||||
extern LONG g_refCount;
|
extern LONG g_refCount;
|
||||||
extern GUID g_CLSID;
|
extern GUID g_CLSID;
|
||||||
extern void setDraggingFilename(const char* str);
|
extern void setDraggingFilename(const char* str);
|
||||||
extern void outputDebugStringF(const char* str, ...);
|
extern void log(const char* str, ...);
|
||||||
|
|
||||||
CDataHandlerExtension::CDataHandlerExtension() :
|
CDataHandlerExtension::CDataHandlerExtension() :
|
||||||
m_refCount(1)
|
m_refCount(1)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CDataHandlerExtension::ctor, g_refCount=%d\n", g_refCount);
|
log("> CDataHandlerExtension::ctor, g_refCount=%d", g_refCount);
|
||||||
InterlockedIncrement(&g_refCount);
|
InterlockedIncrement(&g_refCount);
|
||||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::ctor, g_refCount=%d\n", g_refCount);
|
log("< CDataHandlerExtension::ctor, g_refCount=%d", g_refCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
CDataHandlerExtension::~CDataHandlerExtension()
|
CDataHandlerExtension::~CDataHandlerExtension()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CDataHandlerExtension::dtor, g_refCount=%d\n", g_refCount);
|
log("> CDataHandlerExtension::dtor, g_refCount=%d", g_refCount);
|
||||||
InterlockedDecrement(&g_refCount);
|
InterlockedDecrement(&g_refCount);
|
||||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::dtor, g_refCount=%d\n", g_refCount);
|
log("< CDataHandlerExtension::dtor, g_refCount=%d", g_refCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE
|
HRESULT STDMETHODCALLTYPE
|
||||||
CDataHandlerExtension::QueryInterface(REFIID riid, void **ppvObject)
|
CDataHandlerExtension::QueryInterface(REFIID riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CDataHandlerExtension::QueryInterface\n");
|
log("> CDataHandlerExtension::QueryInterface");
|
||||||
static const QITAB qit[] =
|
static const QITAB qit[] =
|
||||||
{
|
{
|
||||||
QITABENT(CDataHandlerExtension, IPersistFile),
|
QITABENT(CDataHandlerExtension, IPersistFile),
|
||||||
@ -54,10 +54,10 @@ CDataHandlerExtension::QueryInterface(REFIID riid, void **ppvObject)
|
|||||||
HRESULT hr = QISearch(this, qit, riid, ppvObject);
|
HRESULT hr = QISearch(this, qit, riid, ppvObject);
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::QueryInterface, hr=FAILED\n");
|
log("< CDataHandlerExtension::QueryInterface, hr=FAILED");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::QueryInterface, hr=%d\n", hr);
|
log("< CDataHandlerExtension::QueryInterface, hr=%d", hr);
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
@ -65,39 +65,39 @@ CDataHandlerExtension::QueryInterface(REFIID riid, void **ppvObject)
|
|||||||
ULONG STDMETHODCALLTYPE
|
ULONG STDMETHODCALLTYPE
|
||||||
CDataHandlerExtension::AddRef()
|
CDataHandlerExtension::AddRef()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CDataHandlerExtension::AddRef, m_refCount=%d\n", m_refCount);
|
log("> CDataHandlerExtension::AddRef, m_refCount=%d", m_refCount);
|
||||||
LONG r = InterlockedIncrement(&m_refCount);
|
LONG r = InterlockedIncrement(&m_refCount);
|
||||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::AddRef, r=%d, m_refCount=%d\n", r, m_refCount);
|
log("< CDataHandlerExtension::AddRef, r=%d, m_refCount=%d", r, m_refCount);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG STDMETHODCALLTYPE
|
ULONG STDMETHODCALLTYPE
|
||||||
CDataHandlerExtension::Release()
|
CDataHandlerExtension::Release()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CDataHandlerExtension::Release, m_refCount=%d\n", m_refCount);
|
log("> CDataHandlerExtension::Release, m_refCount=%d", m_refCount);
|
||||||
LONG r = InterlockedDecrement(&m_refCount);
|
LONG r = InterlockedDecrement(&m_refCount);
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::Release, r=%d\n", r);
|
log("< CDataHandlerExtension::Release, r=%d", r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE
|
HRESULT STDMETHODCALLTYPE
|
||||||
CDataHandlerExtension::Load(__RPC__in LPCOLESTR pszFileName, DWORD dwMode)
|
CDataHandlerExtension::Load(__RPC__in LPCOLESTR pszFileName, DWORD dwMode)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CDataHandlerExtension::Load\n");
|
log("> CDataHandlerExtension::Load");
|
||||||
std::string fileName = _bstr_t(pszFileName);
|
std::string fileName = _bstr_t(pszFileName);
|
||||||
setDraggingFilename(fileName.c_str());
|
setDraggingFilename(fileName.c_str());
|
||||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::Load\n");
|
log("< CDataHandlerExtension::Load");
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE
|
HRESULT STDMETHODCALLTYPE
|
||||||
CDataHandlerExtension::GetClassID(__RPC__out CLSID *pClassID)
|
CDataHandlerExtension::GetClassID(__RPC__out CLSID *pClassID)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > CDataHandlerExtension::GetClassID\n");
|
log("> CDataHandlerExtension::GetClassID");
|
||||||
*pClassID = g_CLSID;
|
*pClassID = g_CLSID;
|
||||||
outputDebugStringF("synwinxt: < CDataHandlerExtension::GetClassID\n");
|
log("< CDataHandlerExtension::GetClassID");
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#pragma comment(lib, "Shlwapi.lib")
|
#pragma comment(lib, "Shlwapi.lib")
|
||||||
|
|
||||||
@ -46,21 +47,23 @@ HRESULT unregisterShellExtDataHandler(CHAR* fileType, const CLSID& clsid);
|
|||||||
HRESULT unregisterInprocServer(const CLSID& clsid);
|
HRESULT unregisterInprocServer(const CLSID& clsid);
|
||||||
|
|
||||||
void
|
void
|
||||||
outputDebugStringF(const char* str, ...)
|
log(const char* str, ...)
|
||||||
{
|
{
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
|
||||||
va_list ptr;
|
va_list ptr;
|
||||||
va_start(ptr,str);
|
va_start(ptr, str);
|
||||||
vsprintf_s(buf,str,ptr);
|
vsprintf_s(buf, str, ptr);
|
||||||
|
|
||||||
OutputDebugStringA(buf);
|
std::stringstream ss;
|
||||||
|
ss << "synwinxt-" << VERSION << ": " << buf << std::endl;
|
||||||
|
OutputDebugStringA(ss.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL APIENTRY
|
BOOL APIENTRY
|
||||||
DllMain(HMODULE module, DWORD reason, LPVOID reserved)
|
DllMain(HMODULE module, DWORD reason, LPVOID reserved)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > DllMain, reason=%d\n", reason);
|
log("> DllMain, reason=%d", reason);
|
||||||
|
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
@ -76,14 +79,15 @@ DllMain(HMODULE module, DWORD reason, LPVOID reserved)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < DllMain\n");
|
log("< DllMain");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#pragma comment(linker, "/export:DllGetClassObject,PRIVATE")
|
||||||
STDAPI
|
STDAPI
|
||||||
DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppvObj)
|
DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppvObj)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > DllGetClassObject\n");
|
log("> DllGetClassObject");
|
||||||
|
|
||||||
HRESULT hr = E_OUTOFMEMORY;
|
HRESULT hr = E_OUTOFMEMORY;
|
||||||
*ppvObj = NULL;
|
*ppvObj = NULL;
|
||||||
@ -94,29 +98,32 @@ DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppvObj)
|
|||||||
classFactory->Release();
|
classFactory->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < DllGetClassObject, hr=%d\n", hr);
|
log("< DllGetClassObject, hr=%d", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#pragma comment(linker, "/export:DllCanUnloadNow,PRIVATE")
|
||||||
STDAPI
|
STDAPI
|
||||||
DllCanUnloadNow()
|
DllCanUnloadNow()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > DllCanUnloadNow, g_refCount=%d\n", g_refCount);
|
log("> DllCanUnloadNow, g_refCount=%d", g_refCount);
|
||||||
int r = g_refCount > 0 ? S_FALSE : S_OK;
|
int r = g_refCount > 0 ? S_FALSE : S_OK;
|
||||||
outputDebugStringF("synwinxt: < DllCanUnloadNow, g_refCount=%d, r=%d\n", g_refCount, r);
|
log("< DllCanUnloadNow, g_refCount=%d, r=%d", g_refCount, r);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#pragma comment(linker, "/export:DllRegisterServer,PRIVATE")
|
||||||
STDAPI
|
STDAPI
|
||||||
DllRegisterServer()
|
DllRegisterServer()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > DllRegisterServer\n");
|
log("> DllRegisterServer");
|
||||||
|
|
||||||
HRESULT hr;
|
/*HRESULT hr;
|
||||||
|
|
||||||
CHAR module[MAX_PATH];
|
CHAR module[MAX_PATH];
|
||||||
if (GetModuleFileName(g_instance, module, ARRAYSIZE(module)) == 0) {
|
if (GetModuleFileName(g_instance, module, ARRAYSIZE(module)) == 0) {
|
||||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
outputDebugStringF("synwinxt: < DllRegisterServer, hr=%d\n", hr);
|
log("< DllRegisterServer, hr=%d", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,21 +138,25 @@ DllRegisterServer()
|
|||||||
g_CLSID);
|
g_CLSID);
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < DllRegisterServer, hr=%d\n", hr);
|
log("< DllRegisterServer, hr=%d", hr);
|
||||||
return hr;
|
*/
|
||||||
|
|
||||||
|
log("< DllRegisterServer");
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#pragma comment(linker, "/export:DllUnregisterServer,PRIVATE")
|
||||||
STDAPI
|
STDAPI
|
||||||
DllUnregisterServer()
|
DllUnregisterServer()
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > DllUnregisterServer\n");
|
log("> DllUnregisterServer");
|
||||||
|
/*
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
CHAR module[MAX_PATH];
|
CHAR module[MAX_PATH];
|
||||||
if (GetModuleFileName(g_instance, module, ARRAYSIZE(module)) == 0) {
|
if (GetModuleFileName(g_instance, module, ARRAYSIZE(module)) == 0) {
|
||||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||||
outputDebugStringF("synwinxt: < DllRegisterServer, hr=%d\n", hr);
|
log("< DllRegisterServer, hr=%d", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,14 +165,16 @@ DllUnregisterServer()
|
|||||||
hr = unregisterShellExtDataHandler("*", g_CLSID);
|
hr = unregisterShellExtDataHandler("*", g_CLSID);
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < DllUnregisterServer, hr=%d\n", hr);
|
log("< DllUnregisterServer, hr=%d", hr);*/
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
log("< DllUnregisterServer");
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
/*
|
||||||
HRESULT
|
HRESULT
|
||||||
registerInprocServer(CHAR* module, const CLSID& clsid, CHAR* threadModel)
|
registerInprocServer(CHAR* module, const CLSID& clsid, CHAR* threadModel)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > registerInprocServer\n");
|
log("> registerInprocServer");
|
||||||
|
|
||||||
if (module == NULL || threadModel == NULL) {
|
if (module == NULL || threadModel == NULL) {
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
@ -191,14 +204,14 @@ registerInprocServer(CHAR* module, const CLSID& clsid, CHAR* threadModel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < registerInprocServer, hr=%d\n", hr);
|
log("< registerInprocServer, hr=%d", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
unregisterInprocServer(const CLSID& clsid)
|
unregisterInprocServer(const CLSID& clsid)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > unregisterInprocServer\n");
|
log("> unregisterInprocServer");
|
||||||
|
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
@ -216,10 +229,10 @@ unregisterInprocServer(const CLSID& clsid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
outputDebugStringF("synwinxt: < unregisterInprocServer, hr=FAILED\n");
|
log("< unregisterInprocServer, hr=FAILED");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
outputDebugStringF("synwinxt: < unregisterInprocServer, hr=%d\n", hr);
|
log("< unregisterInprocServer, hr=%d", hr);
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
@ -227,7 +240,7 @@ unregisterInprocServer(const CLSID& clsid)
|
|||||||
HRESULT
|
HRESULT
|
||||||
registerShellExtDataHandler(CHAR* fileType, const CLSID& clsid)
|
registerShellExtDataHandler(CHAR* fileType, const CLSID& clsid)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > registerShellExtDataHandler\n");
|
log("> registerShellExtDataHandler");
|
||||||
|
|
||||||
if (fileType == NULL) {
|
if (fileType == NULL) {
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
@ -250,14 +263,14 @@ registerShellExtDataHandler(CHAR* fileType, const CLSID& clsid)
|
|||||||
CArchMiscWindows::setValue(key, NULL, CLASSID);
|
CArchMiscWindows::setValue(key, NULL, CLASSID);
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < registerShellExtDataHandler, hr=%d\n", hr);
|
log("< registerShellExtDataHandler, hr=%d", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT
|
HRESULT
|
||||||
unregisterShellExtDataHandler(CHAR* fileType, const CLSID& clsid)
|
unregisterShellExtDataHandler(CHAR* fileType, const CLSID& clsid)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > unregisterShellExtDataHandler\n");
|
log("> unregisterShellExtDataHandler");
|
||||||
|
|
||||||
if (fileType == NULL) {
|
if (fileType == NULL) {
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
@ -278,10 +291,10 @@ unregisterShellExtDataHandler(CHAR* fileType, const CLSID& clsid)
|
|||||||
hr = HRESULT_FROM_WIN32(RegDeleteTree(HKEY_CLASSES_ROOT, subkey));
|
hr = HRESULT_FROM_WIN32(RegDeleteTree(HKEY_CLASSES_ROOT, subkey));
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < unregisterShellExtDataHandler, hr=%d\n", hr);
|
log("< unregisterShellExtDataHandler, hr=%d", hr);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
std::string
|
std::string
|
||||||
getFileExt(const char* filenameCStr)
|
getFileExt(const char* filenameCStr)
|
||||||
{
|
{
|
||||||
@ -296,7 +309,7 @@ getFileExt(const char* filenameCStr)
|
|||||||
void
|
void
|
||||||
setDraggingFilename(const char* filename)
|
setDraggingFilename(const char* filename)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > setDraggingFilename, filename=%s\n", filename);
|
log("> setDraggingFilename, filename=%s", filename);
|
||||||
|
|
||||||
// HACK: only handle files that are not .exe or .lnk
|
// HACK: only handle files that are not .exe or .lnk
|
||||||
// dragging anything, including a selection marquee, from a program
|
// dragging anything, including a selection marquee, from a program
|
||||||
@ -308,23 +321,23 @@ setDraggingFilename(const char* filename)
|
|||||||
memcpy(g_draggingFilename, filename, MAX_PATH);
|
memcpy(g_draggingFilename, filename, MAX_PATH);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
outputDebugStringF(
|
log(
|
||||||
"synwinxt: ignoring filename=%s, ext=%s\n",
|
"ignoring filename=%s, ext=%s",
|
||||||
filename, ext.c_str());
|
filename, ext.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < setDraggingFilename, g_draggingFilename=%s\n", g_draggingFilename);
|
log("< setDraggingFilename, g_draggingFilename=%s", g_draggingFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
getDraggingFilename(char* filename)
|
getDraggingFilename(char* filename)
|
||||||
{
|
{
|
||||||
outputDebugStringF("synwinxt: > getDraggingFilename\n");
|
log("> getDraggingFilename");
|
||||||
memcpy(filename, g_draggingFilename, MAX_PATH);
|
memcpy(filename, g_draggingFilename, MAX_PATH);
|
||||||
|
|
||||||
// mark string as empty once used, so we can't accidentally copy
|
// mark string as empty once used, so we can't accidentally copy
|
||||||
// the same file more than once unless the user does this on purpose.
|
// the same file more than once unless the user does this on purpose.
|
||||||
g_draggingFilename[0] = NULL;
|
g_draggingFilename[0] = NULL;
|
||||||
|
|
||||||
outputDebugStringF("synwinxt: < getDraggingFilename, filename=%s\n", filename);
|
log("< getDraggingFilename, filename=%s", filename);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user