Permalink
Browse files

Added debug logging

  • Loading branch information...
sysprogs committed Sep 27, 2015
1 parent 6ff78f9 commit 782926f0d2ce39c22f45dd70ce248bcd1eac8eb8
@@ -1,37 +1,37 @@
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( VirtualAutorunDisabler )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( VirtualAutorunDisabler ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( VirtualAutorunDisabler )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( VirtualAutorunDisabler ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */
@@ -1,42 +1,52 @@
#include "StdAfx.h"
#include "ContextMenuBase.h"
HRESULT STDMETHODCALLTYPE ContextMenuBase::Initialize( /* [unique][in] */ __in_opt PCIDLIST_ABSOLUTE pidlFolder, /* [unique][in] */ __in_opt IDataObject *pdtobj, /* [unique][in] */ __in_opt HKEY hkeyProgID)
{
if (!pdtobj)
return E_INVALIDARG;
FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
STGMEDIUM stm;
HRESULT hR = pdtobj->GetData(&fe, &stm);
if (SUCCEEDED(hR))
{
HDROP hDrop = static_cast<HDROP>(GlobalLock(stm.hGlobal));
if (hDrop == NULL)
hR = E_FAIL;
else
{
UINT nFiles = DragQueryFile(hDrop, -1, NULL, 0);
if (nFiles != 1)
hR = E_INVALIDARG;
else
{
size_t done = DragQueryFile(hDrop, 0, m_FileName.PreAllocate(MAX_PATH, false), MAX_PATH);
if (done)
{
m_FileName.SetLength(done);
hR = S_OK;
}
else
hR = E_FAIL;
}
GlobalUnlock(stm.hGlobal);
}
ReleaseStgMedium(&stm);
}
return hR;
}
#include "StdAfx.h"
#include "ContextMenuBase.h"
#include "DebugLog.h"
HRESULT STDMETHODCALLTYPE ContextMenuBase::Initialize( /* [unique][in] */ __in_opt PCIDLIST_ABSOLUTE pidlFolder, /* [unique][in] */ __in_opt IDataObject *pdtobj, /* [unique][in] */ __in_opt HKEY hkeyProgID)
{
WINCDEMU_LOG_LINE(L"ContextMenuBase::Initialize(): %x", pdtobj);
if (!pdtobj)
return E_INVALIDARG;
FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
STGMEDIUM stm;
HRESULT hR = pdtobj->GetData(&fe, &stm);
WINCDEMU_LOG_LINE(L"pdtobj->GetData(): %x", hR);
if (SUCCEEDED(hR))
{
HDROP hDrop = static_cast<HDROP>(GlobalLock(stm.hGlobal));
WINCDEMU_LOG_LINE(L"GlobalLock(): %x", hDrop);
if (hDrop == NULL)
hR = E_FAIL;
else
{
UINT nFiles = DragQueryFile(hDrop, -1, NULL, 0);
WINCDEMU_LOG_LINE(L"DragQueryFile(-1): %d", nFiles);
if (nFiles != 1)
hR = E_INVALIDARG;
else
{
size_t done = DragQueryFile(hDrop, 0, m_FileName.PreAllocate(MAX_PATH, false), MAX_PATH);
WINCDEMU_LOG_LINE(L"DragQueryFile(0): %d, allocated=%d", done, m_FileName.GetAllocated());
if (done && done <= m_FileName.GetAllocated())
{
m_FileName.SetLength(done);
WINCDEMU_LOG_LINE(L"File name: %s", m_FileName.c_str());
hR = S_OK;
}
else
hR = E_FAIL;
}
WINCDEMU_LOG_LINE(L"Unlocking %x...", stm.hGlobal);
GlobalUnlock(stm.hGlobal);
}
WINCDEMU_LOG_LINE(L"Releasing medium");
ReleaseStgMedium(&stm);
}
return hR;
}
@@ -0,0 +1,13 @@
#pragma once
#ifdef ENABLE_DEBUG_LOGGING
#include <bzscore/file.h>
void LogDebugLine(BazisLib::DynamicString line);
#define WINCDEMU_LOG_LINE(...) LogDebugLine(BazisLib::String::sFormat(__VA_ARGS__))
#else
#define WINCDEMU_LOG_LINE(...)
#endif
Oops, something went wrong.

0 comments on commit 782926f

Please sign in to comment.