Initial commit: Complete open-source Decal rebuild

All 5 phases of the open-source Decal rebuild:

Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil)
Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs
  - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters
  - Decal.Core, DecalControls, DecalRender, D3DService
Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL
Phase 4: DenAgent WinForms tray application
Phase 5: WiX installer and build script

25 C# projects building with 0 errors.
Native C++ projects require VS 2022 + Windows SDK (x86).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erik 2026-02-08 18:27:56 +01:00
commit d1442e3747
1382 changed files with 170725 additions and 0 deletions

View file

@ -0,0 +1,687 @@
// AddRemoveDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DenAgent.h"
#include "AddRemoveDlg.h"
#include "DownloadDlg.h"
#include "..\Inject\Inject.h"
#include "..\Inject\Inject_i.c"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// cAddRemoveDlg dialog
cAddRemoveDlg::cAddRemoveDlg(CWnd* pParent /*=NULL*/)
: CDialog(cAddRemoveDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(cAddRemoveDlg)
//}}AFX_DATA_INIT
}
void cAddRemoveDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(cAddRemoveDlg)
DDX_Control(pDX, IDC_PLUGINS, m_wndPlugins);
//}}AFX_DATA_MAP
}
void cAddRemoveDlg::convertVersion( LPTSTR szVersion, DWORD &dwVersionMajor, DWORD &dwVersionMinor )
{
int wVersionParts[ 4 ],
*i_ver = wVersionParts;
for( TCHAR *szVersionPart = ::_tcstok( szVersion, _T( "." ) ); szVersionPart != NULL; szVersionPart = ::_tcstok( NULL, _T( "." ) ), ++ i_ver )
::_stscanf( szVersionPart, _T( "%i" ), i_ver );
dwVersionMajor = MAKELONG( wVersionParts[ 1 ], wVersionParts[ 0 ] );
dwVersionMinor = MAKELONG( wVersionParts[ 3 ], wVersionParts[ 2 ] );
}
void cAddRemoveDlg::loadListing()
{
USES_CONVERSION;
// Clear old data
m_wndPlugins.SetRedraw( FALSE );
m_wndPlugins.DeleteAllItems();
m_plugins.clear();
if (m_pDoc->load("decalplugins.xml") == VARIANT_FALSE)
return;
MSXML::IXMLDOMNodeListPtr pPlugins = m_pDoc->selectNodes( _T( "/decal/plugin" ) );
for( MSXML::IXMLDOMElementPtr pPlugin = pPlugins->nextNode(); pPlugin.GetInterfacePtr() != NULL; pPlugin = pPlugins->nextNode() )
{
_variant_t vClsid = pPlugin->getAttribute( _T( "clsid" ) ),
vCodebase = pPlugin->getAttribute( _T( "codebase" ) ),
vVersion = pPlugin->getAttribute( _T( "version" ) ),
vName = pPlugin->getAttribute( _T( "name" ) );
cPlugin p;
::CLSIDFromString( vClsid.bstrVal, &p.m_clsid );
convertVersion( OLE2T( vVersion.bstrVal ), p.m_dwMajor, p.m_dwMinor );
::wcscpy( p.m_szURL, OLE2W( vCodebase.bstrVal ) );
CString csurl(p.m_szURL);
if((-1!=csurl.Find(".exe", 0)) || (-1!=csurl.Find(".msi", 0)) || (-1!=csurl.Find(".dll", 0)) || (-1!=csurl.Find(".zip", 0)) || (-1!=csurl.Find(".js", 0)) || (-1!=csurl.Find(".vbs", 0)))
p.m_bBinary = TRUE;
else
p.m_bBinary = FALSE;
// Now get matching info from the registry - if available
RegKey keyPlugin;
CString csVersion;
CString decalPluginKey;
// See if this plugin is installed in the Decal plugin list
decalPluginKey.Format("SOFTWARE\\Decal\\Plugins\\%s", OLE2T(vClsid.bstrVal));
if (keyPlugin.Open(HKEY_LOCAL_MACHINE, _T(decalPluginKey), KEY_READ) == ERROR_SUCCESS)
{
CString szDllName;
keyPlugin.Close();
// It is! Get the DLL for the CLSID
if (!CDenAgentApp::getCOMObjectDLL(p.m_clsid, szDllName))
goto NotInstalled;
int iMajor, iMinor, iBuildMajor, iBuildMinor;
// Now get the version from the DLL
if (!CDenAgentApp::getVersionInfo(szDllName, iMajor, iMinor, iBuildMajor, iBuildMinor))
goto NotInstalled;
// Setup the installed data by shifting the majors into the HIWORDs, minors into the LOWORDs
p.m_dwInstalledMajor = (iMajor << 16) | iMinor;
p.m_dwInstalledMinor = (iBuildMajor << 16) | iBuildMinor;
// Format a version string
csVersion.Format("%d.%d.%d.%d", iMajor, iMinor, iBuildMajor, iBuildMinor);
p.m_bInstalled = true;
}
else
{
NotInstalled:
p.m_bInstalled = false;
p.m_dwInstalledMajor = 0;
p.m_dwInstalledMinor = 0;
}
m_plugins.push_back( p );
// Next, load this data into the listbox
int nIndex = m_wndPlugins.InsertItem( m_wndPlugins.GetItemCount(), OLE2T( vName.bstrVal ) );
m_wndPlugins.SetItemData( nIndex, reinterpret_cast< DWORD >( &m_plugins.back() ) );
m_wndPlugins.SetItemText( nIndex, 1, OLE2T( vVersion.bstrVal ) );
if( p.m_bInstalled )
m_wndPlugins.SetItemText( nIndex, 2, csVersion );
else
m_wndPlugins.SetItemText( nIndex, 2, _T( "Not Installed" ) );
// Set the proper image indicator
int nImage = 0;
if (p.m_bInstalled)
{
CString szInstalled, szKnown;
// Write them out, padded with lots of zeroes
szInstalled.Format(_T("%.10d.%.10d.%.10d.%.10d"),
HIWORD(p.m_dwInstalledMajor), LOWORD(p.m_dwInstalledMajor),
HIWORD(p.m_dwInstalledMinor), LOWORD(p.m_dwInstalledMinor));
szKnown.Format(_T("%.10d.%.10d.%.10d.%.10d"),
HIWORD(p.m_dwMajor), LOWORD(p.m_dwMajor),
HIWORD(p.m_dwMinor), LOWORD(p.m_dwMinor));
// Determine the image
if (szInstalled == szKnown)
{
nImage = 2;
}
else if (szInstalled > szKnown)
{
nImage = 3;
}
else if (szInstalled < szKnown)
{
nImage = 1;
}
}
m_wndPlugins.SetItem(nIndex, 0, LVIF_IMAGE, 0, nImage, 0, 0, 0);
}
if(!m_SortInfo.pListControl)
{
m_SortInfo.nAscendingSortOrder = TRUE;
m_SortInfo.nColumnNo = 2;
m_SortInfo.pListControl = &m_wndPlugins;
}
m_wndPlugins.SortItems(ComparePlugins, (DWORD)&m_SortInfo);
m_wndPlugins.SetRedraw( TRUE );
}
BEGIN_MESSAGE_MAP(cAddRemoveDlg, CDialog)
//{{AFX_MSG_MAP(cAddRemoveDlg)
ON_BN_CLICKED(IDC_CHANGE_DIR, OnChangeDir)
ON_BN_CLICKED(IDC_INSTALL, OnInstall)
ON_NOTIFY(NM_DBLCLK, IDC_PLUGINS, OnDblclkPlugins)
ON_BN_CLICKED(IDC_UPGRADE, OnUpgrade)
ON_NOTIFY(LVN_COLUMNCLICK, IDC_PLUGINS, OnColumnclickPlugins)
ON_NOTIFY(LVN_GETINFOTIP, IDC_PLUGINS, OnInfoTip)
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
ON_BN_CLICKED(IDC_REFRESH, OnRefresh)
ON_NOTIFY(LVN_ITEMCHANGED, IDC_PLUGINS, OnSelChanged)
ON_NOTIFY(NM_CLICK, IDC_PLUGINS, OnSelChanged)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// cAddRemoveDlg message handlers
void cAddRemoveDlg::OnChangeDir()
{
// TODO: Add your control notification handler code here
}
void cAddRemoveDlg::OnInstall()
{
// cDownloadDlg dlg( this );
// TODO: Get the currently selected item
cPlugin *pPlugin = reinterpret_cast< cPlugin * >( m_wndPlugins.GetItemData( m_wndPlugins.GetSelectionMark() ) );
if(pPlugin==NULL)
return;
/* dlg.m_clsid = pPlugin->m_clsid;
dlg.m_dwMajor = pPlugin->m_dwMajor;
dlg.m_dwMinor = pPlugin->m_dwMinor;
dlg.m_strURL = pPlugin->m_szURL;
dlg.m_bDownloadPlugin = true;
if( dlg.DoModal() != IDOK )
return;
// The download was successful - try and create an instance
CComPtr< IPlugin > pPluginObj;
HRESULT hRes = dlg.m_pFactory->CreateInstance( NULL, __uuidof( IPlugin ), reinterpret_cast< void ** >( &pPluginObj ) );
if( FAILED( hRes ) )
// Something isn't right
AfxMessageBox( _T( "The newly downloaded plugin dosen't appear to work." ), MB_ICONERROR | MB_OK, 0 );
dlg.m_pFactory->LockServer( FALSE );
// Refresh the view
loadListing();
*/
CString url(pPlugin->m_szURL);
ShellExecute(m_hWnd,"open",url,0,0,0);
}
void cAddRemoveDlg::OnDblclkPlugins(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
}
void cAddRemoveDlg::OnUpgrade()
{
OnInstall();
}
BOOL cAddRemoveDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Load the string
RegKey keyAgent;
if( keyAgent.Open( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Agent" )) != ERROR_SUCCESS )
{
::AfxMessageBox( _T( "Critical registry keys are missing, this installation is broken.\r\nRepair the installation." ), MB_ICONERROR | MB_OK, 0 );
EndDialog( IDCANCEL );
return FALSE;
}
// Make it look nicer
m_wndPlugins.SetExtendedStyle( m_wndPlugins.GetExtendedStyle() | LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_INFOTIP);
// Create and assign the image list
//m_ImageList.Create(IDR_VERSION_STATES, 21, 0, RGB(255, 255, 255));
m_ImageList.Create(IDB_IMAGES, 16, 0, RGB(255,0,255));
m_wndPlugins.SetImageList(&m_ImageList, LVSIL_SMALL);
// Setup the columns in the list control
m_wndPlugins.InsertColumn( 0, _T( "Plugin Name" ), LVCFMT_LEFT, 175 );
m_wndPlugins.InsertColumn( 1, _T( "Version" ), LVCFMT_LEFT, 75, 1 );
m_wndPlugins.InsertColumn( 2, _T( "Installed" ), LVCFMT_LEFT, 75, 2 );
m_wndPlugins.m_pAddRemoveDlg = this;
m_pDoc.CreateInstance( __uuidof( MSXML::DOMDocument ) );
m_pDoc->async = false;
m_SortInfo.pListControl = NULL;
loadListing();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void cAddRemoveDlg::OnColumnclickPlugins(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if (pNMListView->iSubItem == m_SortInfo.nColumnNo)
m_SortInfo.nAscendingSortOrder = !m_SortInfo.nAscendingSortOrder;
else
m_SortInfo.nAscendingSortOrder = TRUE;
m_SortInfo.nColumnNo = pNMListView->iSubItem;
m_SortInfo.pListControl = &m_wndPlugins;
m_wndPlugins.SortItems( ComparePlugins, (DWORD)&m_SortInfo );
*pResult = 0;
}
int CALLBACK cAddRemoveDlg::ComparePlugins(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
SortInfo *pSortInfo = (SortInfo *) lParamSort;
CListCtrl *pListControl = pSortInfo->pListControl;
int lFirstData = -1, lSecondData = -1;
LV_FINDINFO FindInfo;
FindInfo.flags = LVFI_PARAM | LVFI_WRAP;
FindInfo.lParam = lParam1;
lFirstData = pListControl->FindItem(&FindInfo);
FindInfo.lParam = lParam2;
lSecondData = pListControl->FindItem(&FindInfo,lFirstData);
ASSERT(lFirstData != -1); ASSERT(lSecondData != -1);
CString FirstText = pListControl->GetItemText(lFirstData,pSortInfo->nColumnNo);
CString SecondText = pListControl->GetItemText(lSecondData,pSortInfo->nColumnNo);
return FirstText.CompareNoCase(SecondText) * ((pSortInfo->nAscendingSortOrder)?1:-1);
}
void cAddRemoveDlg::OnInfoTip( NMHDR *pNMHDR, LRESULT *pResult )
{
NMLVGETINFOTIP *pInfoTip = reinterpret_cast<NMLVGETINFOTIP*>(pNMHDR);
cPlugin *pPlugin = reinterpret_cast< cPlugin * >( m_wndPlugins.GetItemData( pInfoTip->iItem ) );
if(pPlugin==NULL)
return;
CString strTipText(pPlugin->m_szURL);
lstrcpy(pInfoTip->pszText, strTipText);
*pResult = 0;
}
void cAddRemoveDlg::DisplayError(HRESULT hr)
{
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,NULL,hr, MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),(LPTSTR)&lpMsgBuf, 0, NULL );
char szTemp[100];
wsprintf(szTemp, "%s\n", lpMsgBuf);
MessageBox(szTemp, "Decal Plugin Registration" , MB_ICONEXCLAMATION);
}
bool cAddRemoveDlg::ReadTypeLib(CString cstrDll, bool bMultipleFiles)
{
USES_CONVERSION;
bool bRegedDLL = false;
HINSTANCE hDLL = LoadLibrary(cstrDll);
if(hDLL)
{
DLLREG DllReg = (DLLREG)GetProcAddress(hDLL, "DllRegisterServer");
if(DllReg!=NULL)
{
DllReg();
bRegedDLL = true;
}
FreeLibrary(hDLL);
}
ITypeLib *pTypeLib = NULL;
ITypeInfo *pTypeInfo = NULL;
TYPEATTR *pTypeAttr = NULL;
bool bSuccess = false;
HRESULT hr;
WCHAR* pwszClassID = NULL;
int i;
UINT iCount;
hr = LoadTypeLib(A2OLE(cstrDll),&pTypeLib);
if ( FAILED(hr))
{
goto _cleanup;
DisplayError(hr);
}
iCount = pTypeLib->GetTypeInfoCount();
for (i=0; i < iCount ; i++)
{
if (FAILED(hr = (pTypeLib->GetTypeInfo(i, &pTypeInfo))))
{
DisplayError(hr);
goto _cleanup;
}
if (FAILED(hr = (pTypeInfo->GetTypeAttr(&pTypeAttr))))
{
DisplayError(hr);
goto _cleanup;
}
if (TKIND_COCLASS == pTypeAttr->typekind)
{
HREFTYPE hRefType;
ITypeInfo *pTInfoImpl;
TYPEATTR *pTAttr = NULL;
CComBSTR bstrName;
for( int j = 0 ; j < pTypeAttr->cImplTypes ; ++j )
{
hr = pTypeInfo->GetRefTypeOfImplType( j, &hRefType );
if( SUCCEEDED( hr ) )
{
hr = pTypeInfo->GetRefTypeInfo( hRefType, &pTInfoImpl );
if( SUCCEEDED( hr ) )
{
hr = pTInfoImpl->GetDocumentation( -1, &bstrName, NULL, NULL, NULL );
hr = pTInfoImpl->GetTypeAttr(&pTAttr);
if( SUCCEEDED( hr ) )
{
if((pTAttr->guid==IID_IPlugin) && (bstrName == CComBSTR("IPlugin")))
{
StringFromCLSID(pTypeAttr->guid, &pwszClassID);
RegKey key;
if( key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Plugins" )) == ERROR_SUCCESS )
if(key.SetDWORDValue(OLE2A(pwszClassID), (DWORD)0x1) == ERROR_SUCCESS)
bSuccess = true;
CoTaskMemFree(pwszClassID);
}
pTInfoImpl->ReleaseTypeAttr(pTAttr);
}
bstrName.Empty();
pTInfoImpl->Release();
}
}
}
}
pTypeInfo->ReleaseTypeAttr(pTypeAttr);
pTypeInfo->Release();
}
_cleanup:
if (pTypeAttr)
pTypeInfo->ReleaseTypeAttr(pTypeAttr);
if (pTypeInfo)
pTypeInfo->Release();
if(pTypeLib)
pTypeLib->Release();
if(bSuccess)
{
MessageBox(CString("Decal Plugin: ") + cstrDll + " was sucessfully registered.", "Decal Plugin Registration", MB_ICONINFORMATION );
return true;
}
else if(bRegedDLL)
{
MessageBox(CString("File: ") + cstrDll + " was sucessfully registered.\n\nHowever, Decal was unable to determine if the DLL was a Decal Plugin.\n\nIf it was, it should appear in the Plugin List, otherwise it wasn't.", "Decal Plugin Registration", MB_ICONINFORMATION );
return true;
}
else if(!bMultipleFiles)
MessageBox("Registration failed. Dll might not be a Decal Plugin.", "Decal Plugin Registration", MB_ICONEXCLAMATION);
return false;
}
struct cFileType
{
CString m_strExt;
CComPtr< IDecalFileSurrogate > m_pFile;
};
typedef std::list< cFileType > cFileTypeList;
void cAddRemoveDlg::OnBrowse()
{
USES_CONVERSION;
// Walk through the list of surrogates and build up a string
CComPtr< IDecalEnum > pEnum;
m_pDecal->get_Configuration( CComBSTR( _T( "Surrogates" ) ), GUID_NULL, &pEnum );
CString strOpen = _T( "Decal Components (" );
cFileTypeList filetypes;
std::string ssTemp;
std::list<std::string> vExtensions;
while( pEnum->Next() == S_OK )
{
CComPtr< IDecalFileSurrogate > pFileSurrogate;
if( FAILED( pEnum->CreateInstance( __uuidof( IDecalFileSurrogate ), reinterpret_cast< void ** >( &pFileSurrogate ) ) ) )
// This surrogate did not support files, move on
continue;
CComBSTR strExt, strDescription;
pFileSurrogate->get_Extension( &strExt );
pFileSurrogate->get_Description( &strDescription );
TCHAR szItem[ 255 ];
LPTSTR szExt = OLE2T( strExt ),
szDesc = OLE2T( strDescription );
::_stprintf( szItem, _T( "*.%s," ), szExt );
//::_stprintf( szItem, _T( "%s (*.%s)|*.%s|" ), szDesc, szExt, szExt );
strOpen += szItem;
ssTemp = szExt;
vExtensions.push_back( ssTemp );
cFileType ft;
ft.m_strExt = szExt;
ft.m_pFile = pFileSurrogate;
filetypes.push_back( ft );
}
strOpen.Delete( strOpen.GetLength() - 1, 1 ); // Remove that last ","
strOpen += _T( ") |" );
for( std::list<std::string>::iterator z = vExtensions.begin(); z != vExtensions.end(); z++ )
{
TCHAR szExtension[ 15 ];
::_stprintf( szExtension, _T( "*.%s;" ), z->data() );
strOpen += szExtension;
}
strOpen += _T( "|" );
// Changed fd( TRUE, NULL, NULL, (etc) to NULL, NULL, NULL - removes open as readonly checkbox
CFileDialog fd( NULL, NULL, NULL, OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST, strOpen, this );
if( fd.DoModal() != IDOK )
return;
CString strExt = fd.GetFileExt();
// Find the matching file type
for( cFileTypeList::iterator i = filetypes.begin(); i != filetypes.end(); ++ i )
{
if( i->m_strExt.CompareNoCase( strExt ) == 0 )
{
// Found our match
HRESULT hRes = i->m_pFile->Register( CComBSTR( fd.GetPathName() ) );
if( FAILED( hRes ) )
AfxMessageBox( _T( "Failed to register plugin." ) );
break;
}
}
// Dump the proxy libraries
::CoFreeUnusedLibraries();
}
BEGIN_MESSAGE_MAP(CListViewSC, CListCtrl)
//{{AFX_MSG_MAP(CListViewSC)
ON_WM_DROPFILES()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CListViewSC::OnDropFiles( HDROP dropInfo )
{
char szTemp[MAX_PATH+1];
m_bGotAFile = false;
int iTotal = DragQueryFile(dropInfo, 0xFFFFFFFF, NULL, NULL);
for(int i = 0; i<iTotal; i++)
{
DragQueryFile(dropInfo, i, szTemp, sizeof(szTemp));
if(~FILE_ATTRIBUTE_DIRECTORY & GetFileAttributes(szTemp))
{
LPTSTR pszFileExt = PathFindExtension(szTemp);
if(CString(pszFileExt).CompareNoCase(".dll") == 0)
{
m_pAddRemoveDlg->ReadTypeLib(szTemp, false);
m_bGotAFile = true;
}
else if( iTotal == 1 )
{
m_pAddRemoveDlg->MessageBox("Invalid Decal Plugin.", "Decal Plugin Registration", MB_ICONEXCLAMATION);
m_bGotAFile = true;
}
}
else if(FILE_ATTRIBUTE_DIRECTORY & GetFileAttributes(szTemp))
SearchDirectory(szTemp);
}
if(!m_bGotAFile)
MessageBox("Could not locate any Decal Plugins.", "Decal Plugin Registration", MB_ICONEXCLAMATION);
m_pAddRemoveDlg->loadListing();
return;
}
bool CListViewSC::SearchDirectory(char *szDirectory)
{
WIN32_FIND_DATA finder;
HANDLE session;
char buffer[MAX_PATH+1];
SetCurrentDirectory(szDirectory);
GetCurrentDirectory(_MAX_PATH, buffer);
session = FindFirstFile("*", &finder);
if(session==INVALID_HANDLE_VALUE)
return false;
do
{
if((~finder.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
if(CString(PathFindExtension(finder.cFileName)).CompareNoCase(".dll") == 0 )
{
GetCurrentDirectory(_MAX_PATH, buffer);
if(buffer[strlen(buffer)-1]=='\\')
wsprintf(buffer, "%s%s", buffer, finder.cFileName);
else
wsprintf(buffer, "%s\\%s", buffer, finder.cFileName);
if(m_pAddRemoveDlg->ReadTypeLib(buffer, true))
m_bGotAFile = true;
}
}
else if(finder.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if(*finder.cFileName!='.')
{
SearchDirectory(finder.cFileName);
SetCurrentDirectory("..");
GetCurrentDirectory(_MAX_PATH, buffer);
}
}
}
while(FindNextFile(session, &finder));
FindClose(session);
return true;
}
void cAddRemoveDlg::OnRefresh()
{
loadListing();
}
void cAddRemoveDlg::OnSelChanged(NMHDR* pNMHDR, LRESULT* pResult)
{
int nSelectionMark = m_wndPlugins.GetSelectionMark();
if ( nSelectionMark == -1 )
return;
cPlugin *pPlugin = reinterpret_cast<cPlugin *>(m_wndPlugins.GetItemData( nSelectionMark ));
if (pPlugin == NULL)
return;
if (pPlugin->m_bBinary)
SetDlgItemText(IDC_INSTALL, "Download");
else
SetDlgItemText(IDC_INSTALL, "Visit Website");
*pResult = 0;
}

View file

@ -0,0 +1,114 @@
#if !defined(AFX_ADDREMOVEDLG_H__CA058B98_7B3E_4315_BB99_0D8D582335BA__INCLUDED_)
#define AFX_ADDREMOVEDLG_H__CA058B98_7B3E_4315_BB99_0D8D582335BA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// AddRemoveDlg.h : header file
//
#include <Decal.h>
/////////////////////////////////////////////////////////////////////////////
// cAddRemoveDlg dialog
typedef struct tagSortInfo
{
CListCtrl *pListControl;
int nColumnNo;
bool nAscendingSortOrder;
} SortInfo;
typedef CRuntimeClass * (*DLLREG)();
class CListViewSC : public CListCtrl
{
friend class cAddRemoveDlg;
public:
CListViewSC(){};
cAddRemoveDlg *m_pAddRemoveDlg;
bool SearchDirectory(char *szDirectory);
bool m_bGotAFile;
protected:
//{{AFX_MSG(CListViewSC)
afx_msg void OnDropFiles(HDROP dropInfo);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
CListViewSC& operator=(const CListViewSC& x);
CListViewSC(const CListViewSC& x);
};
class cAddRemoveDlg : public CDialog
{
// Construction
public:
cAddRemoveDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(cAddRemoveDlg)
enum { IDD = IDD_ADDREMOVE };
CListViewSC m_wndPlugins;
//}}AFX_DATA
struct cPlugin
{
CLSID m_clsid;
WCHAR m_szURL[ 1024 ];
DWORD m_dwMajor;
DWORD m_dwMinor;
bool m_bInstalled;
DWORD m_dwInstalledMajor;
DWORD m_dwInstalledMinor;
bool m_bBinary;
};
CImageList m_ImageList;
SortInfo m_SortInfo;
bool m_bHide;
typedef std::list< cPlugin > cPluginList;
cPluginList m_plugins;
IDecal *m_pDecal;
MSXML::IXMLDOMDocumentPtr m_pDoc;
void DisplayError(HRESULT hr);
void convertVersion( LPTSTR szVersion, DWORD &dwVersionMajor, DWORD &dwVersionMinor );
void loadListing();
bool ReadTypeLib(CString cstrDll, bool bMultipleFiles);
static int CALLBACK ComparePlugins(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(cAddRemoveDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(cAddRemoveDlg)
afx_msg void OnChangeDir();
afx_msg void OnInstall();
afx_msg void OnDblclkPlugins(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnUpgrade();
virtual BOOL OnInitDialog();
afx_msg void OnColumnclickPlugins(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnInfoTip( NMHDR * pNMHDR, LRESULT * pResult );
afx_msg void OnBrowse();
afx_msg void OnRefresh();
afx_msg void OnSelChanged(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ADDREMOVEDLG_H__CA058B98_7B3E_4315_BB99_0D8D582335BA__INCLUDED_)

View file

@ -0,0 +1,527 @@
#include "stdafx.h"
#include <string>
#include "DenAgent.h"
#include "DownloaderDlg.h"
#include "AutoUpdate.h"
static LPCSTR updateList = "updatelist.xml" ;
// DownloadAgent
/* static */ bool DownloadAgent::downloadFile(std::string remoteFile, std::string localFile) {
// Perform a direct, one time download of a file
cDownloaderDlg dlg;
dlg.addFile(remoteFile, localFile);
dlg.DoModal();
return (dlg.GetDownloadStatus() == cDownloaderDlg::DownloadStatus::DOWNLOAD_SUCCEEDED);
}
DownloadAgent::DownloadAgent() {
m_ScheduledDownloads.clear();
}
void DownloadAgent::scheduleDownload(std::string remoteFile, std::string localFile) {
// Encapsulate this download in a download slot, and add it to the schedule list
DownloadSlot slot;
slot.remoteFile = remoteFile;
slot.localFile = localFile;
m_ScheduledDownloads.push_back(slot);
}
bool DownloadAgent::runDownloads() {
if (!m_ScheduledDownloads.size())
return false;
cDownloaderDlg dlg;
// Add each schduled download to our downloader
std::list<DownloadSlot>::iterator it;
for (it = m_ScheduledDownloads.begin(); it != m_ScheduledDownloads.end(); ++it) {
DownloadSlot slot = *it;
dlg.addFile(slot.remoteFile, slot.localFile);
}
// And run them
dlg.DoModal();
return (dlg.GetDownloadStatus() == cDownloaderDlg::DownloadStatus::DOWNLOAD_SUCCEEDED);
}
// AutoUpdateSource
AutoUpdateSource::AutoUpdateSource(std::string decalDir, AutoUpdateType type, std::string localTarget, std::string remoteSource, std::string requiredVersion)
: m_DecalDir(decalDir)
, m_LocalTarget(localTarget)
, m_RequiredVersion(requiredVersion)
, m_RemoteSource(remoteSource)
, m_Type(type)
{
}
bool AutoUpdateSource::needsUpdating() {
USES_CONVERSION;
// Get the version of the local file
// Make sure the file exists
OFSTRUCT targetFile;
std::string localTarget = m_DecalDir + "/" + m_LocalTarget;
if (OpenFile(localTarget.c_str(), &targetFile, OF_EXIST) == HFILE_ERROR) {
// It didn't exist, we must update
return true;
}
if (m_RequiredVersion.length() == 0) {
// If we don't have a remote version, assume we want to update
return true;
}
int reqMajor(0), reqMinor(0), reqPatch(0), reqBuild(0) ;
sscanf(m_RequiredVersion.c_str(), "%i.%i.%i.%i", &reqMajor, &reqMinor, &reqPatch, &reqBuild);
if (m_Type == AU_TYPE_XML) {
// Extract the version node from an XML document
MSXML::IXMLDOMDocumentPtr pDoc;
try {
pDoc.CreateInstance (__uuidof(MSXML::DOMDocument), NULL, CLSCTX_INPROC_SERVER);
pDoc->async = false;
// Construct a list of update targets based on the XML contents
if (pDoc->load(static_cast<LPCTSTR>(localTarget.c_str()))) {
// Read the autoupdate version string
// MSXML::IXMLDOMNodePtr pVersionNode = pDoc->selectSingleNode ( _T( "/*/@version" ) );
MSXML::IXMLDOMElementPtr pVersionNode = pDoc->selectSingleNode ("//revision");
if (pVersionNode != NULL) {
// _variant_t vXMLVer = pVersionNode->text;
_variant_t vXMLVer = pVersionNode->getAttribute("version") ;
if (vXMLVer.vt == VT_BSTR) {
int locMajor(0), locMinor(0), locPatch(0), locBuild(0) ;
sscanf(OLE2T(vXMLVer.bstrVal), "%i.%i.%i.%i", &locMajor, &locMinor, &locPatch, &locBuild);
if (locMajor==reqMajor) {
if (locMinor==reqMinor) {
if (locPatch==reqPatch) {
return locBuild<reqBuild ;
} else {
return locPatch<reqPatch ;
}
} else {
return locMinor<reqMinor ;
}
} else {
return locMajor<reqMajor ;
}
}
}
}
} catch (...) {
return true ; // if error reading xml, assume needs updating
}
} else if (m_Type == AU_TYPE_DLL || m_Type == AU_TYPE_BETADLL) {
// Check to see if the file itself needs updating
if (isOutDatedVersion(localTarget, reqMajor, reqMinor, reqPatch, reqBuild))
{
// File is outdated, check requirements
std::vector<UpdateRequirement>::iterator it;
for (it = m_Requirements.begin(); it != m_Requirements.end(); ++it)
{
UpdateRequirement ur = *it;
localTarget = m_DecalDir + "/" + ur.sFile;
sscanf(ur.sVers.c_str(), "%i.%i.%i.%i", &reqMajor, &reqMinor, &reqPatch, &reqBuild);
if (isOutDatedVersion(localTarget, reqMajor, reqMinor, reqPatch, reqBuild))
{
std::string sMsg = m_LocalTarget + " cannot be updated because one or more dependencies is outdated";
::MessageBox(0, _T(sMsg.c_str()), NULL, S_OK);
return false;
}
}
return true;
}
else // File is newer, ignore requirements and exit
{
return false;
}
}
// if anything went wrong or we were unable to tell whether it should be updated
// or not...assume it needs updating.
return true ;
}
std::string AutoUpdateSource::getSource() {
return m_RemoteSource;
}
std::string AutoUpdateSource::getDestination() {
return m_LocalTarget;
}
AutoUpdateType AutoUpdateSource::getType() {
return m_Type;
}
bool AutoUpdateSource::isOutDatedVersion(std::string sFile, int nMajor, int nMinor, int nPatch, int nBuild)
{
// Extract the DLL version
DWORD dwDummy, dwVerSize;
dwVerSize = ::GetFileVersionInfoSize(const_cast<LPTSTR>(sFile.c_str()), &dwDummy);
if( dwVerSize == 0 )
return true; // if file vsn not available, assume needs updating
else
{
BYTE *pbVersionInfo = reinterpret_cast< BYTE * >(::_alloca(dwVerSize));
::GetFileVersionInfo(const_cast<LPTSTR>(sFile.c_str()), 0, dwVerSize, pbVersionInfo);
VS_FIXEDFILEINFO *vffi;
UINT nLength = sizeof(VS_FIXEDFILEINFO);
if( ::VerQueryValue( pbVersionInfo, _T("\\"), reinterpret_cast< LPVOID * >( &vffi ), &nLength ) )
{
// Got it, so format it
int locMajor(0), locMinor(0), locPatch(0), locBuild(0);
locMajor = static_cast< int >( HIWORD( vffi->dwFileVersionMS ) );
locMinor = static_cast< int >( LOWORD( vffi->dwFileVersionMS ) );
locPatch = static_cast< int >( HIWORD( vffi->dwFileVersionLS ) );
locBuild = static_cast< int >( LOWORD( vffi->dwFileVersionLS ) );
if( locMajor == nMajor )
{
if( locMinor == nMinor )
{
if( locPatch == nPatch )
return locBuild < nBuild;
else
return locPatch < nPatch;
}
else
return locMinor < nMinor ;
}
else
return locMajor < nMajor ;
}
// problem with VerQueryValue... maybe updating will fix it.
else
return true;
}
}
void AutoUpdateSource::AddRequirement(UpdateRequirement reqUpdate)
{
m_Requirements.push_back(reqUpdate);
}
// AutoUpdate
AutoUpdate::AutoUpdate(std::string decalDir) {
m_DecalDir = decalDir;
m_LocalXML = "";
m_RemoteSources.clear();
}
bool AutoUpdate::initialiseFromXML(std::string remoteXML) {
USES_CONVERSION;
m_RemoteXML = remoteXML + "/" + updateList ;
// Download the remote XML document to a local file
if (!DownloadAgent::downloadFile(m_RemoteXML, m_DecalDir + "/" + updateList))
{
// We couldn't download the update list. We must bail here, or suffer!
::MessageBox(NULL, "Could not obtain updatelist.xml. Cannot update - Hosting server down?", NULL, MB_OK);
return false;
}
// Parse it as an XML document
MSXML::IXMLDOMDocumentPtr pDoc;
// try {
pDoc.CreateInstance (__uuidof(MSXML::DOMDocument), NULL, CLSCTX_INPROC_SERVER);
pDoc->async = false;
// Construct a list of update targets based on the XML contents
std::string localXML = m_DecalDir + "/" + updateList ;
if (!pDoc->load( static_cast<LPCTSTR>(localXML.c_str())))
return false;
// Read the autoupdate version string
MSXML::IXMLDOMNodePtr pVersionNode = pDoc->selectSingleNode ( _T( "/*/@version" ) );
if (pVersionNode == NULL) {
::MessageBox(NULL,"No version information in updatelist.xml. Cannot update",NULL,MB_OK) ;
return false;
}
// Check to make sure we understand this version
char *version = OLE2T(pVersionNode->text);
if (strcmp(version,"1.0.0.0")) {
::MessageBox(NULL,"Unknown version type in updatelist.xml. Cannot update",NULL,MB_OK) ;
return false ;
}
// Now iterate over the Files entries, creating an AutoUpdateSource for each
MSXML::IXMLDOMNodeListPtr xmlFiles = pDoc->selectNodes(_T("/updatelist/file"));
if (xmlFiles.GetInterfacePtr() == NULL)
return false;
for (MSXML::IXMLDOMElementPtr xmlFile = xmlFiles->nextNode(); xmlFile.GetInterfacePtr() != NULL; xmlFile = xmlFiles->nextNode()) {
std::string localFile, remoteFile, version;
AutoUpdateType type;
BSTR bResult;
_variant_t vResult;
// Read the type
vResult = xmlFile->getAttribute("type");
if (vResult.vt != VT_BSTR)
continue;
bResult = vResult.bstrVal;
char *cType = OLE2T(bResult);
if (strcmp(cType, "xml") == 0) {
type = AU_TYPE_XML;
} else if (strcmp(cType, "dll") == 0) {
type = AU_TYPE_DLL;
} else if (strcmp(cType, "beta") == 0) {
type = AU_TYPE_BETADLL ;
} else {
continue;
}
// Local name
vResult = xmlFile->getAttribute("localname");
if (vResult.vt != VT_BSTR)
continue;
bResult = vResult.bstrVal;
localFile = OLE2T(bResult);
// Remote name
vResult = xmlFile->getAttribute("remotename");
if (vResult.vt != VT_BSTR)
continue;
bResult = vResult.bstrVal;
remoteFile = OLE2T(bResult);
// And version
vResult = xmlFile->getAttribute("version");
if (vResult.vt != VT_BSTR)
continue;
bResult = vResult.bstrVal;
version = OLE2T(bResult);
AutoUpdateSource aUSource(m_DecalDir, type, localFile, remoteFile, version);
//if the source is dll || beta check for requirements
if (type == AU_TYPE_DLL || type == AU_TYPE_BETADLL)
{
MSXML::IXMLDOMNodeListPtr xmlReqs = NULL;//xmlFile->selectNodes(_T("requirement")); //pDoc->selectNodes(_T("/updatelist/file"));
xmlReqs = xmlFile->getElementsByTagName(_T("requirement"));
if (xmlReqs.GetInterfacePtr() == NULL)
continue;
for (MSXML::IXMLDOMElementPtr xmlNode = xmlReqs->nextNode(); xmlNode.GetInterfacePtr() != NULL; xmlNode = xmlReqs->nextNode())
{
std::string sLocalFile, sVersion;
// Read the file name
vResult = xmlNode->getAttribute("file");
if (vResult.vt != VT_BSTR)
continue;
bResult = vResult.bstrVal;
sLocalFile = OLE2T(bResult);
// Read the version
vResult = xmlNode->getAttribute("version");
if (vResult.vt != VT_BSTR)
continue;
bResult = vResult.bstrVal;
sVersion = OLE2T(bResult);
UpdateRequirement uReq(sLocalFile, sVersion);
aUSource.AddRequirement(uReq);
}
}
// Add the source to the cache
m_RemoteSources.push_back(aUSource);
}
// } catch (...) {
// return false;
// }
return true;
}
bool AutoUpdate::needsUpdate() {
// Ask all the dependancies if they want to update themselves
// Check the versions of all our local XML documents to see if we need an update
std::list<AutoUpdateSource>::iterator it;
for (it = m_RemoteSources.begin(); it != m_RemoteSources.end(); ++it) {
AutoUpdateSource aUSource = *it;
if (aUSource.needsUpdating())
return true;
}
// Nothing needed updating
return false;
}
bool AutoUpdate::performUpdate() {
// Construct a list of all the remote components that need updating
std::list<AutoUpdateSource> updateList;
DownloadAgent dlAgent;
bool DllUpdate = false ;
bool BetaUpdate = false ;
std::list<AutoUpdateSource>::iterator itRemote = m_RemoteSources.begin();;
while (itRemote != m_RemoteSources.end()) {
AutoUpdateSource aUSource = *itRemote++;
if (aUSource.needsUpdating()) {
switch(aUSource.getType()) {
case AU_TYPE_DLL: DllUpdate = true ; break ;
case AU_TYPE_BETADLL: BetaUpdate = true ; break ;
}
if (aUSource.getType()==AU_TYPE_BETADLL) {
BetaUpdate = true ;
}
updateList.push_back(aUSource);
}
}
if (DllUpdate) {
if ( MessageBox(NULL,
"Updates to the Decal program are available.\n\n"
"These are supported updates to the current release\n"
"version of Decal.\n"
"Installation of these updates is recommended.\n\n"
"Do you wish to install these updates now?",
"Decal Program Updates Available",
MB_YESNO) == IDNO
){
DllUpdate = false ;
}
}
if (BetaUpdate) {
if (MessageBox(NULL,
"Decal Beta updates are available.\n\n"
"NOTE: Beta versions are not supported and have NOT\n"
"been tested extensively.\n"
" They can crash your system, and require a full\n"
"re-install of the original Decal program.\n\n"
"Do you wish to install these unsupported Beta updates?",
"Beta program updates available",
MB_YESNO|MB_DEFBUTTON2) == IDNO
) {
BetaUpdate = false ;
}
}
// Schedule downloads and processing for all selected types
std::list<AutoUpdateSource>::iterator itUpdates = updateList.begin();;
while (itUpdates != updateList.end()) {
AutoUpdateSource source = *itUpdates++ ;
if ( (source.getType() == AU_TYPE_DLL && !DllUpdate)
|| (source.getType() == AU_TYPE_BETADLL && !BetaUpdate)
){
continue ;
}
dlAgent.scheduleDownload(source.getSource(), m_DecalDir + "\\" + source.getDestination() + ".tmp");
}
// Download them to the local cache
if (!dlAgent.runDownloads()) {
// Something went horribly wrong
return false;
}
// Delete the destinations and move the cached objects to their new homes
itUpdates = updateList.begin() ;
while (itUpdates != updateList.end()) {
AutoUpdateSource aUSource = *itUpdates++;
if ( (aUSource.getType() == AU_TYPE_DLL && !DllUpdate)
|| (aUSource.getType() == AU_TYPE_BETADLL && !BetaUpdate)
){
continue ;
}
std::string newFile = (m_DecalDir + "\\" + aUSource.getDestination());
std::string tmpFile = (m_DecalDir + "\\" + aUSource.getDestination() + ".tmp");
BOOL bResult = ::DeleteFile (newFile.c_str ());
DWORD dwLastError = 0;
if (!bResult)
{
dwLastError = ::GetLastError ();
}
if (bResult || dwLastError == ERROR_FILE_NOT_FOUND)
{
MoveFile(tmpFile.c_str(), newFile.c_str());
// We may have to register DLLs
if (aUSource.getType() == AU_TYPE_DLL || aUSource.getType() == AU_TYPE_BETADLL )
{
HINSTANCE hDLL = LoadLibrary(newFile.c_str());
if (hDLL) {
typedef CRuntimeClass * (*DLLREG)();
DLLREG DllReg = (DLLREG)GetProcAddress(hDLL, "DllRegisterServer");
if (DllReg != NULL)
DllReg();
FreeLibrary(hDLL);
}
}
}
// Delete failed - file is in use
else
{
MessageBox(NULL, "A file being updated is in use - close programs and try again.", "Decal", MB_OK);
}
}
if (updateList.size() > 0) {
MessageBox(NULL, "Your Decal components have been updated", "Decal", MB_OK);
} else {
MessageBox(NULL, "Your Decal components are already up to date", "Decal", MB_OK);
}
return true;
}

View file

@ -0,0 +1,70 @@
#ifndef __AUTOUPDATE_H__
#define __AUTOUPDATE_H__
class DownloadAgent {
public:
static bool downloadFile(std::string remoteFile, std::string localFile);
DownloadAgent();
void scheduleDownload(std::string remoteFile, std::string localFile);
bool runDownloads();
private:
struct DownloadSlot {
std::string remoteFile, localFile;
};
std::list<DownloadSlot> m_ScheduledDownloads;
};
enum AutoUpdateType {
AU_TYPE_XML,
AU_TYPE_DLL,
AU_TYPE_BETADLL
};
class UpdateRequirement
{
public:
UpdateRequirement(std::string File, std::string Version):
sFile(File), sVers(Version) { }
std::string sFile;
std::string sVers;
};
class AutoUpdateSource {
public:
AutoUpdateSource(std::string decalPath, AutoUpdateType type, std::string localTarget, std::string remoteSource, std::string requiredVersion);
bool needsUpdating();
std::string getSource();
std::string getDestination();
AutoUpdateType getType();
bool isOutDatedVersion(std::string sFile, int nMajor, int nMinor, int nPatch, int nBuild);
void AddRequirement(UpdateRequirement reqUpdate);
private:
std::string m_LocalTarget;
std::string m_RemoteSource;
std::string m_RequiredVersion;
std::string m_DecalDir;
AutoUpdateType m_Type;
std::vector<UpdateRequirement> m_Requirements;
};
class AutoUpdate {
public:
AutoUpdate(std::string decalDir);
bool initialiseFromXML(std::string remoteXML);
bool needsUpdate();
bool performUpdate();
private:
std::string m_LocalXML, m_RemoteXML;
std::string m_DecalDir;
std::list<AutoUpdateSource> m_RemoteSources;
};
#endif

View file

@ -0,0 +1,125 @@
#include "stdafx.h"
#include "DownloadDlg.h"
#include "BindStatusCallback.h"
#include <shlwapi.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
STDMETHODIMP CCallback::OnProgress ( ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR wszStatusText )
{
static CString sIEStatusMsg;
static TCHAR szCustomStatusMsg [256];
static TCHAR szAmtDownloaded [256], szTotalSize [256];
UNREFERENCED_PARAMETER(ulStatusCode);
if ( 0 != g_fAbortDownload )
return E_ABORT;
if ( m_bUseTimeout && CTime::GetCurrentTime() > m_timeToStop )
return E_ABORT;
if ( NULL != wszStatusText )
sIEStatusMsg = wszStatusText;
else
sIEStatusMsg.Empty();
StrFormatByteSize ( ulProgress, szAmtDownloaded, 256 );
StrFormatByteSize ( ulProgressMax, szTotalSize, 256 );
if ( 0 != ulProgressMax )
wsprintf ( szCustomStatusMsg, _T("Downloaded %s of %s"), szAmtDownloaded, szTotalSize );
else
wsprintf ( szCustomStatusMsg, _T("Downloaded %s (total size unknown)"), szAmtDownloaded );
if ( 0 != ulProgressMax )
m_pDlg->ProgressUpdate ( sIEStatusMsg, szCustomStatusMsg, int( 100.0 * ulProgress / ulProgressMax) );
else
m_pDlg->ProgressUpdate ( sIEStatusMsg, szCustomStatusMsg, 0 );
return(NOERROR);
}
CCallback::CCallback()
{
m_pbinding = NULL;
m_pstm = NULL;
m_cRef = 1;
m_cbOld = 0;
m_bUseTimeout = FALSE;
m_pDlg = NULL;
}
CCallback::~CCallback()
{
if (m_pstm)
m_pstm->Release();
if (m_pbinding)
m_pbinding->Release();
}
STDMETHODIMP CCallback::QueryInterface(REFIID riid, void** ppv)
{
*ppv = NULL;
if (riid==IID_IUnknown || riid==IID_IBindStatusCallback)
{
*ppv = this;
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
STDMETHODIMP CCallback::OnStartBinding(DWORD grfBSCOption, IBinding* pbinding)
{
if(NULL != pbinding)
{
pbinding->AddRef();
m_pbinding = pbinding;
}
return(NOERROR);
}
STDMETHODIMP CCallback::OnStopBinding(HRESULT hrStatus, LPCWSTR pszError)
{
if(NULL != m_pbinding)
{
m_pbinding->Release();
m_pbinding = NULL;
}
return(NOERROR);
}
STDMETHODIMP CCallback::GetPriority(LONG* pnPriority)
{
return(NOERROR);
}
STDMETHODIMP CCallback::OnLowResource(DWORD dwReserved)
{
return(NOERROR);
}
STDMETHODIMP CCallback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindInfo)
{
return (NOERROR);
}
STDMETHODIMP CCallback::OnDataAvailable(DWORD grfBSCF,
DWORD dwSize, FORMATETC* pfmtetc, STGMEDIUM* pstgmed)
{
return(NOERROR);
}
STDMETHODIMP CCallback::OnObjectAvailable(REFIID riid, IUnknown* punk)
{
return(NOERROR);
}

View file

@ -0,0 +1,36 @@
#include "resource.h"
#include "downloaderdlg.h"
class CCallback : public IBindStatusCallback
{
public:
// IUnknown methods
STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
STDMETHODIMP_(ULONG) AddRef() { return m_cRef++; }
STDMETHODIMP_(ULONG) Release() { if (--m_cRef == 0) { delete this; return 0; } return m_cRef; }
// IBindStatusCallback methods
STDMETHODIMP OnStartBinding(DWORD grfBSCOption, IBinding* pbinding);
STDMETHODIMP GetPriority(LONG* pnPriority);
STDMETHODIMP OnLowResource(DWORD dwReserved);
STDMETHOD(OnProgress)( /* [in] */ ULONG ulProgress,/* [in] */ ULONG ulProgressMax,/* [in] */ ULONG ulStatusCode,/* [in] */ LPCWSTR szStatusText);
STDMETHODIMP OnStopBinding(HRESULT hrResult, LPCWSTR szError);
STDMETHODIMP GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo);
STDMETHODIMP OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC *pfmtetc, STGMEDIUM* pstgmed);
STDMETHODIMP OnObjectAvailable(REFIID riid, IUnknown* punk);
// constructors/destructors
CCallback();
~CCallback();
// data members
DWORD m_cRef;
IBinding* m_pbinding;
IStream* m_pstm;
DWORD m_cbOld;
cDownloaderDlg* m_pDlg;
BOOL m_bUseTimeout;
CTime m_timeToStop;
};

View file

@ -0,0 +1,81 @@
// cChangePluginDirectory.cpp : implementation file
//
#include "stdafx.h"
#include "DenAgent.h"
#include "ChangePluginDirectory.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// cChangePluginDirectory dialog
cChangePluginDirectory::cChangePluginDirectory(CWnd* pParent /*=NULL*/)
: CDialog(cChangePluginDirectory::IDD, pParent)
{
//{{AFX_DATA_INIT(cChangePluginDirectory)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void cChangePluginDirectory::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(cChangePluginDirectory)
DDX_Control(pDX, IDC_NEWURL, m_NewUrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(cChangePluginDirectory, CDialog)
//{{AFX_MSG_MAP(cChangePluginDirectory)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// cChangePluginDirectory message handlers
void cChangePluginDirectory::OnOK()
{
// TODO: Add extra validation here
RegKey keyAgent;
if( keyAgent.Open( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Agent" )) == ERROR_SUCCESS )
{
CString csu;
m_NewUrl.GetWindowText(csu);
keyAgent.SetStringValue("DecalDirectory", csu);
keyAgent.Close();
}
CDialog::OnOK();
}
BOOL cChangePluginDirectory::OnInitDialog()
{
CDialog::OnInitDialog();
RegKey keyAgent;
if( keyAgent.Open( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Agent" )) != ERROR_SUCCESS )
{
::AfxMessageBox( _T( "Critical registry keys are missing, this installation is broken.\r\nRepair the installation." ), MB_ICONERROR | MB_OK, 0 );
EndDialog( IDCANCEL );
return FALSE;
}
TCHAR szUrl[ 1024 ];
DWORD dwSize = 1024;
keyAgent.QueryStringValue(_T("DecalDirectory"), szUrl, &dwSize);
m_NewUrl.SetWindowText(szUrl);
keyAgent.Close();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

View file

@ -0,0 +1,691 @@
// DenAgent.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "DenAgent.h"
#include "DenAgentDlg.h"
#include "TrayWnd.h"
#include <initguid.h>
#include "DenAgent_i.c"
#include "..\Inject\Inject.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//FILELIST g_FileList[] = { { "messages.xml", "messages.dlc" }, { "memlocs.xml", "messages.dlc" }, { "decalplugins.xml", "messages.dlc" } };
/////////////////////////////////////////////////////////////////////////////
// CDenAgentApp
BEGIN_MESSAGE_MAP(CDenAgentApp, CWinApp)
//{{AFX_MSG_MAP(CDenAgentApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDenAgentApp construction
CDenAgentApp::CDenAgentApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CDenAgentApp object
CDenAgentApp theApp;
LONG g_fAbortDownload;
/////////////////////////////////////////////////////////////////////////////
// CDenAgentApp initialization
bool CheckForHardwareMode ()
{
RegKey key;
if (key.Open (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Microsoft Games\\Asheron's Call\\1.00", KEY_READ) != ERROR_SUCCESS)
{
return false;
}
DWORD dwValue = 0;
if (key.QueryDWORDValue ("UseHardware", dwValue) != ERROR_SUCCESS)
{
return false;
}
return dwValue ? true : false;
}
bool CheckForIE5OrLater ()
{
RegKey key;
if (key.Open (HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Internet Explorer", KEY_READ) != ERROR_SUCCESS)
return false;
DWORD dwValue = 0;
TCHAR szVersionBuffer[256];
DWORD dwSize = sizeof (szVersionBuffer);
if (key.QueryStringValue("Version", szVersionBuffer, &dwSize) != ERROR_SUCCESS)
return false;
DWORD dwMajor = 0, dwMinor = 0, dwBuild1 = 0, dwBuild2 = 0;
if (::_stscanf (szVersionBuffer, _T("%ld.%ld.%ld.%ld"), &dwMajor, &dwMinor, &dwBuild1, &dwBuild2) != 4)
return false;
// IE 5.01 is build: 5.00.2919.6307
return !( dwMajor < 5 || ( dwMajor == 5 && dwMinor == 0 ) && ( ( dwBuild1 < 2919 ) || ( dwBuild1 == 2919 && dwBuild2 < 6307 ) ) );
}
bool CDenAgentApp::getVersionString ( LPCTSTR szFilename, CString &strVersion )
{
DWORD dwDummy,
dwVerSize = ::GetFileVersionInfoSize( const_cast< LPTSTR > ( szFilename ), &dwDummy );
if( dwVerSize == 0 )
return false;
BYTE *pbVersionInfo = reinterpret_cast< BYTE * >( ::_alloca( dwVerSize ) );
::GetFileVersionInfo( const_cast< LPTSTR > ( szFilename ), 0, dwVerSize, pbVersionInfo );
VS_FIXEDFILEINFO *vffi;
UINT nLength = sizeof( VS_FIXEDFILEINFO );
if( !::VerQueryValue( pbVersionInfo, _T( "\\" ), reinterpret_cast< LPVOID * >( &vffi ), &nLength ) )
return false;
// Got it, so format it
strVersion.FormatMessage ( IDS_VERSIONTEMPLATE, static_cast< int > ( HIWORD ( vffi->dwFileVersionMS ) ),
static_cast< int > ( LOWORD ( vffi->dwFileVersionMS ) ), static_cast< int > ( HIWORD ( vffi->dwFileVersionLS ) ),
static_cast< int > ( LOWORD ( vffi->dwFileVersionLS ) ) );
return true;
}
bool CDenAgentApp::getVersionInfo ( LPCTSTR szFilename, int &iReleaseMajor, int &iReleaseMinor, int &iBuildMajor, int &iBuildMinor )
{
DWORD dwDummy,
dwVerSize = ::GetFileVersionInfoSize( const_cast< LPTSTR > ( szFilename ), &dwDummy );
if( dwVerSize == 0 )
return false;
BYTE *pbVersionInfo = reinterpret_cast< BYTE * >( ::_alloca( dwVerSize ) );
::GetFileVersionInfo( const_cast< LPTSTR > ( szFilename ), 0, dwVerSize, pbVersionInfo );
VS_FIXEDFILEINFO *vffi;
UINT nLength = sizeof( VS_FIXEDFILEINFO );
if( !::VerQueryValue( pbVersionInfo, _T( "\\" ), reinterpret_cast< LPVOID * >( &vffi ), &nLength ) )
return false;
// Got it, so format it
iReleaseMajor = static_cast< int > ( HIWORD ( vffi->dwFileVersionMS ) );
iReleaseMinor = static_cast< int > ( LOWORD ( vffi->dwFileVersionMS ) );
iBuildMajor = static_cast< int > ( HIWORD ( vffi->dwFileVersionLS ) );
iBuildMinor = static_cast< int > ( LOWORD ( vffi->dwFileVersionLS ) );
return true;
}
bool CDenAgentApp::getACVersionString ( CString &strVersion )
{
RegKey rk;
if ( rk.Open ( HKEY_LOCAL_MACHINE, _T( "Software\\Microsoft\\Microsoft Games\\Asheron's Call\\1.00" ) ) != ERROR_SUCCESS )
{
::AfxMessageBox ( IDE_NOCLIENTEXE, MB_ICONWARNING );
return false;
}
TCHAR szClientPath[ MAX_PATH ];
DWORD dwPathLength = MAX_PATH;
if ( rk.QueryStringValue ( _T( "path" ), szClientPath, &dwPathLength ) != ERROR_SUCCESS )
{
::AfxMessageBox ( IDE_NOCLIENTEXE, MB_ICONWARNING );
return false;
}
::_tcscpy ( szClientPath + ( dwPathLength - 1 ), _T( "\\client.exe" ) );
bool bHasVersion = getVersionString ( szClientPath, strVersion );
if ( !bHasVersion )
::AfxMessageBox ( IDE_NOCLIENTVER, MB_ICONWARNING );
return bHasVersion;
}
bool CDenAgentApp::getCOMObjectDLL ( REFCLSID rclsid, CString &strFilename )
{
USES_CONVERSION;
LPOLESTR oclsid;
HRESULT hRes = ::StringFromCLSID ( rclsid, &oclsid );
_ASSERTE ( SUCCEEDED ( hRes ) );
LPCTSTR clsidName = OLE2T ( oclsid );
::CoTaskMemFree ( oclsid );
TCHAR keyName[ MAX_PATH ];
::_stprintf ( keyName, _T( "CLSID\\%s\\InprocServer32" ), clsidName );
RegKey rk;
if ( rk.Open ( HKEY_CLASSES_ROOT, keyName ) != ERROR_SUCCESS )
return false;
DWORD dwPathSize = MAX_PATH;
long regResult = rk.QueryStringValue ( NULL, strFilename.GetBuffer ( MAX_PATH ), &dwPathSize );
strFilename.ReleaseBuffer();
if (regResult != ERROR_SUCCESS)
return false;
// Check to see if the default KeyValue points to the MS.NET core DLL
const char *dotNetProxy = "mscoree.dll";
CString dotNetMatchString = strFilename.Right(strlen(dotNetProxy));
if (dotNetMatchString.CompareNoCase(dotNetProxy) == 0)
{
// Get CodeBase KeyValue - Should point to the Plugin DLL
dwPathSize = MAX_PATH;
if (rk.QueryStringValue ( "CodeBase", strFilename.GetBuffer ( MAX_PATH ), &dwPathSize ) == ERROR_SUCCESS)
{
// Release extra buffer (Not doing this seem to cause the Left() and Delete() funcs to fail)
strFilename.ReleaseBuffer();
// Check for garbage in KeyValue and delete it
if (strFilename.Left(8) == "file:///")
strFilename.Delete(0,8);
}
else
{
// CodeBase isn't accessable - Possible that plugin is in GAC
// Return Path to MS.NET core DLL
dwPathSize = MAX_PATH;
if (rk.QueryStringValue ( NULL, strFilename.GetBuffer ( MAX_PATH ), &dwPathSize ) != ERROR_SUCCESS)
{
rk.Close();
strFilename.ReleaseBuffer();
return false;
}
}
}
rk.Close();
return true;
}
bool CDenAgentApp::getAgentPath ( LPCTSTR szFilename, CString &strPath )
{
TCHAR *szAgentPath = strPath.GetBuffer ( MAX_PATH );
::GetModuleFileName ( NULL, szAgentPath, MAX_PATH );
TCHAR *filePath = ::_tcsrchr ( szAgentPath, _T( '\\' ) );
::strcpy ( filePath + 1, szFilename );
return true;
}
bool CDenAgentApp::checkXMLVersion ( CString &strClientVersion, CString &strXMLFile, CTrayWnd* pTrayWnd )
{
MSXML::IXMLDOMDocumentPtr pDoc;
try
{
pDoc.CreateInstance ( __uuidof ( MSXML::DOMDocument ), NULL, CLSCTX_INPROC_SERVER );
pDoc->async = false;
BOOL bSuccess = pDoc->load( static_cast< LPCTSTR > ( strXMLFile ) );
if( !bSuccess )
{
std::string szXML;
DecryptXML( static_cast< LPCSTR >( strXMLFile ), szXML );
if( szXML != "" )
bSuccess = pDoc->loadXML( _bstr_t( szXML.c_str() ) );
}
if( ! bSuccess )
{
CString strMessage;
strMessage.FormatMessage ( IDE_NOXMLDOC, static_cast< LPCTSTR > ( strXMLFile ) );
CString strUpdate;
strUpdate.LoadString( IDE_UPDATETEXT );
strMessage += strUpdate;
if ( ::AfxMessageBox ( strMessage, MB_YESNO | MB_ICONERROR ) == IDYES )
pTrayWnd->UpdateXMLFiles( );
return false;
}
// Read the client version string
MSXML::IXMLDOMNodePtr pVersionNode = pDoc->selectSingleNode ( _T( "/*/@version" ) );
if ( pVersionNode == NULL )
{
CString strError;
strError.FormatMessage ( IDE_NOXMLVER, static_cast< LPCTSTR > ( strXMLFile ) );
::AfxMessageBox ( strError, MB_ICONWARNING );
return false;
}
_variant_t vXMLVer = pVersionNode->text;
if ( vXMLVer.vt != VT_BSTR )
{
CString strError;
strError.FormatMessage ( IDE_NOXMLVER, static_cast< LPCTSTR > ( strXMLFile ) );
::AfxMessageBox ( strError, MB_ICONWARNING );
return false;
}
CString strXMLVer ( vXMLVer.bstrVal );
if ( strClientVersion.Compare ( strXMLVer ) != 0 )
{
CString str;
str.FormatMessage ( IDE_XMLCLIENTVERSIONMISMATCH, static_cast< LPCTSTR > ( strXMLFile ),
static_cast< LPCTSTR > ( strClientVersion ), static_cast< LPCTSTR > ( strXMLVer ) );
CString strUpdate;
strUpdate.LoadString( IDE_UPDATETEXT );
str += strUpdate;
if ( ::AfxMessageBox ( str, MB_YESNO | MB_ICONWARNING ) == IDYES )
pTrayWnd->UpdateXMLFiles( );
return false;
}
return true;
}
catch ( _com_error & )
{
CString strMessage;
strMessage.FormatMessage ( IDE_NOXMLDOC, static_cast< LPCTSTR > ( strXMLFile ) );
::AfxMessageBox ( strMessage, MB_ICONERROR );
}
return true;
}
void CDenAgentApp::DecryptXML( const char *szPath, std::string &szXML )
{
if( szPath == NULL )
{
szXML = "";
return;
}
FILE *f = fopen( szPath, "rb" );
if( f == NULL )
{
szXML = "";
return;
}
szXML.clear();
unsigned char szBuffer[1025];
try
{
CCryptProv crypt;
if( crypt.Initialize( PROV_RSA_FULL, "Decal_Memlocs", MS_DEF_PROV ) == NTE_BAD_KEYSET )
crypt.Initialize( PROV_RSA_FULL, "Decal_Memlocs", MS_DEF_PROV, CRYPT_NEWKEYSET );
CCryptMD5Hash hash;
hash.Initialize( crypt );
hash.AddString( DECAL_KEY );
CCryptDerivedKey key;
key.Initialize( crypt, hash );
DWORD dwDecLen = 0;
while( ! feof(f) )
{
memset( szBuffer, 0, sizeof( szBuffer ) );
dwDecLen = fread( szBuffer, 1, 1024, f );
key.Decrypt( feof(f), (BYTE *) szBuffer, &dwDecLen );
szXML += (char *)szBuffer;
}
key.Destroy();
hash.Destroy();
crypt.Release();
}
catch( ... )
{
// crap...
szXML = "";
}
fclose( f );
}
bool CDenAgentApp::checkXMLVersions ( CTrayWnd* pTrayWnd )
{
bool bOK = true;
// Check the versions of the XML files
CString strClientVersion;
if ( getACVersionString ( strClientVersion ) )
{
CString strXMLFile;
if ( getAgentPath ( _T( "memlocs.xml" ), strXMLFile ) )
bOK = bOK && checkXMLVersion ( strClientVersion, strXMLFile, pTrayWnd );
//if ( getAgentPath ( _T( "messages.xml" ), strXMLFile ) )
//bOK = bOK && checkXMLVersion ( strClientVersion, strXMLFile );
}
return bOK;
}
void CDenAgentApp::getXMLBuilds ( cXMLBuild *pFirst, cXMLBuild *pLast )
{
MSXML::IXMLDOMDocumentPtr pDoc;
pDoc.CreateInstance ( __uuidof ( MSXML::DOMDocument ), NULL, CLSCTX_INPROC_SERVER );
pDoc->async = false;
for ( ; pFirst != pLast; ++ pFirst )
{
CString strPath;
getAgentPath ( pFirst->XMLFile, strPath );
try
{
BOOL bSuccess = pDoc->load( static_cast< LPCTSTR > ( pFirst->XMLFile ) );
if( ! bSuccess )
{
std::string szXML;
DecryptXML( static_cast< LPCSTR >( pFirst->XMLFile ), szXML );
if( szXML != "" )
bSuccess = pDoc->loadXML( _bstr_t( szXML.c_str() ) );
}
if( ! bSuccess )
{
CString strMessage;
strMessage.FormatMessage( IDE_NOXMLDOC, pFirst->XMLFile );
::AfxMessageBox ( strMessage, MB_ICONERROR );
pFirst->build = 0;
continue;
}
// Read the client version string
MSXML::IXMLDOMNodePtr pBuildNode = pDoc->selectSingleNode ( _T( "/*/@build" ) );
if ( pBuildNode == NULL )
{
pFirst->build = 0;
continue;
}
pFirst->build = pBuildNode->GetnodeValue ();
}
catch ( _com_error & )
{
pFirst->build = 0;
}
}
}
BOOL CDenAgentApp::InitInstance()
{
HWND hDenAgent = FindWindow(NULL, "Decal Agent");
if(hDenAgent)
{
::MessageBox(hDenAgent, "Decal is already running!", "Decal", 0);
return FALSE;
}
if (!CheckForHardwareMode ())
{
::MessageBox
(
NULL,
_T("Decal requires Asheron's Call to be installed with hardware 3d acceleration enabled! Decal will run, but will be unable to display any UI in-game."),
_T("Decal Agent Startup Warning"),
MB_OK
);
}
if (!CheckForIE5OrLater ())
{
::MessageBox
(
NULL,
"Decal requires Internet Explorer 5.01 or later!",
"Decal Agent Startup Error",
MB_OK
);
return FALSE;
}
if (!InitATL())
return FALSE;
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
{
return TRUE;
}
// Set our current directory to the path of DenAgent.exe
// TODO: Fix all the code so that it doesn't rely on the current directory
TCHAR szAppPath[MAX_PATH];
::memset (szAppPath, 0, sizeof (szAppPath));
::GetModuleFileName (0, szAppPath, MAX_PATH);
TCHAR *szLastSlash = ::_tcsrchr (szAppPath, _T('\\'));
if (szLastSlash)
{
*szLastSlash = 0;
::SetCurrentDirectory (szAppPath);
}
// Move V1 plugins into the V2 registry format
importV1Plugins ();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
m_pTrayWnd = new CTrayWnd;
m_pMainWnd = m_pTrayWnd;
m_pTrayWnd->CreateEx( 0, ::AfxRegisterWndClass( 0, NULL, NULL, NULL ), _T( "Decal Agent" ), WS_POPUP, 0, 0, 0, 0, NULL, NULL, NULL );
checkXMLVersions ( m_pTrayWnd );
return TRUE;
}
CDenAgentModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP()
LONG CDenAgentModule::Unlock()
{
AfxOleUnlockApp();
return 0;
}
LONG CDenAgentModule::Lock()
{
AfxOleLockApp();
return 1;
}
LPCTSTR CDenAgentModule::FindOneOf(LPCTSTR p1, LPCTSTR p2)
{
while (*p1 != NULL)
{
LPCTSTR p = p2;
while (*p != NULL)
{
if (*p1 == *p)
return CharNext(p1);
p = CharNext(p);
}
p1++;
}
return NULL;
}
int CDenAgentApp::ExitInstance()
{
delete m_pTrayWnd;
if (m_bATLInited)
{
_Module.RevokeClassObjects();
_Module.Term();
CoUninitialize();
}
return CWinApp::ExitInstance();
}
void CDenAgentApp::importV1Plugins ()
{
USES_CONVERSION;
RegKey hkGroup;
if ( hkGroup.Open ( HKEY_LOCAL_MACHINE, _T ( "Software\\Decal\\Plugins" ) ) != ERROR_SUCCESS )
// No plugins - no problem
return;
DWORD dwValues = 0;
::RegQueryInfoKey ( hkGroup, NULL, NULL, NULL, NULL, NULL, NULL, &dwValues, NULL, NULL, NULL, NULL );
// Now - iterate through the values backwards
for ( int i = dwValues - 1; i >= 0; -- i )
{
TCHAR szCLSID[ 64 ];
DWORD dwCLSID = sizeof ( szCLSID );
DWORD dwEnabled;
DWORD dwEnabledSize = sizeof ( dwEnabled );
if ( ::RegEnumValue ( hkGroup, i, szCLSID, &dwCLSID, NULL, NULL, reinterpret_cast< BYTE * > ( &dwEnabled ), &dwEnabledSize ) != ERROR_SUCCESS )
continue;
// Try and convert the name to a CLSID
CLSID clsidPlugin;
HRESULT hRes = ::CLSIDFromString ( T2OLE ( szCLSID ), &clsidPlugin );
if ( FAILED ( hRes ) )
continue;
// Delete the value and ask questions later
hkGroup.DeleteValue ( szCLSID );
// Try and create a key to extract the friendly name
CComPtr< IPlugin > pPlugin;
hRes = ::CoCreateInstance ( clsidPlugin, NULL, CLSCTX_INPROC_SERVER, __uuidof ( IPlugin ),
reinterpret_cast< LPVOID * > ( &pPlugin ) );
if ( FAILED ( hRes ) )
// Bad plugin - skip
continue;
CComBSTR strName;
pPlugin->get_FriendlyName ( &strName );
// Create the Real registry key
// Key configuration copied from Decal/cActiveXSurrogate::Register
RegKey hkeyItem;
if ( hkeyItem.Create ( hkGroup, szCLSID ) != ERROR_SUCCESS )
continue;
// Friendly name
hkeyItem.SetStringValue( NULL, OLE2T( strName ) );
// Enabled by default
hkeyItem.SetDWORDValue( _T( "Enabled" ), dwEnabled );
// The V1 surrogate
hkeyItem.SetStringValue( _T( "Surrogate" ), _T( "{3D837F6E-B5CA-4604-885F-7AB45FCFA62A}" ) );
hkeyItem.Close();
}
}
BOOL CDenAgentApp::InitATL()
{
m_bATLInited = TRUE;
HRESULT hRes = CoInitialize(NULL);
if (FAILED(hRes))
{
m_bATLInited = FALSE;
return FALSE;
}
_Module.Init(ObjectMap, AfxGetInstanceHandle());
_Module.dwThreadID = GetCurrentThreadId();
LPTSTR lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT
TCHAR szTokens[] = _T("-/");
BOOL bRun = TRUE;
LPCTSTR lpszToken = _Module.FindOneOf(lpCmdLine, szTokens);
while (lpszToken != NULL)
{
if (lstrcmpi(lpszToken, _T("UnregServer"))==0)
{
_Module.UpdateRegistryFromResource(IDR_DENAGENT, FALSE);
_Module.UnregisterServer(TRUE); //TRUE means typelib is unreg'd
bRun = FALSE;
break;
}
if (lstrcmpi(lpszToken, _T("RegServer"))==0)
{
_Module.UpdateRegistryFromResource(IDR_DENAGENT, TRUE);
_Module.RegisterServer(TRUE);
bRun = FALSE;
break;
}
lpszToken = _Module.FindOneOf(lpszToken, szTokens);
}
if (!bRun)
{
m_bATLInited = FALSE;
_Module.Term();
CoUninitialize();
return FALSE;
}
hRes = _Module.RegisterClassObjects(CLSCTX_LOCAL_SERVER,
REGCLS_MULTIPLEUSE);
if (FAILED(hRes))
{
m_bATLInited = FALSE;
CoUninitialize();
return FALSE;
}
return TRUE;
}

View file

@ -0,0 +1,260 @@
# Microsoft Developer Studio Project File - Name="DenAgent" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=DenAgent - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "DenAgent.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "DenAgent.mak" CFG="DenAgent - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "DenAgent - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "DenAgent - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "DenAgent - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /Zi /Oa /Og /Oi /Os /Oy /Ob1 /I "..\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /I "..\Include" /D "NDEBUG" /Oicf /win32
# ADD BASE RSC /l 0x1009 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x1009 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 ..\Release\Inject.lib version.lib shlwapi.lib ..\include\forcelibrary.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"..\Release"
!ELSEIF "$(CFG)" == "DenAgent - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /I "..\Include" /D "_DEBUG" /Oicf /win32
# ADD BASE RSC /l 0x1009 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x1009 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ..\debug\Inject.lib version.lib shlwapi.lib ..\include\forcelibrary.lib /nologo /subsystem:windows /debug /machine:I386
!ENDIF
# Begin Target
# Name "DenAgent - Win32 Release"
# Name "DenAgent - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\AddRemoveDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\AutoUpdate.cpp
# End Source File
# Begin Source File
SOURCE=.\BindStatusCallback.cpp
# End Source File
# Begin Source File
SOURCE=.\ChangePluginDirectory.cpp
# End Source File
# Begin Source File
SOURCE=.\DenAgent.cpp
# End Source File
# Begin Source File
SOURCE=.\DenAgent.idl
# ADD MTL /h "DenAgent_i.h" /iid "DenAgent_i.c" /Oicf
# End Source File
# Begin Source File
SOURCE=.\DenAgent.rc
# End Source File
# Begin Source File
SOURCE=.\DenAgentDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\DownloadDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\DownloaderDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\OptionsDlg.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\TrayWnd.cpp
# End Source File
# Begin Source File
SOURCE=.\URLCallback.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\AddRemoveDlg.h
# End Source File
# Begin Source File
SOURCE=.\AutoUpdate.h
# End Source File
# Begin Source File
SOURCE=.\BindStatusCallback.h
# End Source File
# Begin Source File
SOURCE=.\ChangePluginDirectory.h
# End Source File
# Begin Source File
SOURCE=.\DenAgent.h
# End Source File
# Begin Source File
SOURCE=.\DenAgentDlg.h
# End Source File
# Begin Source File
SOURCE=.\DownloadDlg.h
# End Source File
# Begin Source File
SOURCE=.\DownloaderDlg.h
# End Source File
# Begin Source File
SOURCE=.\OptionsDlg.h
# End Source File
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\TrayWnd.h
# End Source File
# Begin Source File
SOURCE=.\URLCallback.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\res\bitmap1.bmp
# End Source File
# Begin Source File
SOURCE=.\res\cursor1.cur
# End Source File
# Begin Source File
SOURCE=.\res\DenAgent.ico
# End Source File
# Begin Source File
SOURCE=.\res\DenAgent.rc2
# End Source File
# Begin Source File
SOURCE=.\DenAgent.rgs
# End Source File
# Begin Source File
SOURCE=.\res\groups.bmp
# End Source File
# Begin Source File
SOURCE=.\res\idr_tray.ico
# End Source File
# Begin Source File
SOURCE=.\Images.bmp
# End Source File
# Begin Source File
SOURCE=.\ImagesMask.bmp
# End Source File
# Begin Source File
SOURCE=.\res\version_.bmp
# End Source File
# End Group
# Begin Source File
SOURCE=.\ReadMe.txt
# End Source File
# End Target
# End Project
# Section DenAgent : {0050004F-0045-0052-5400-59005F005200}
# 1:12:IDR_DENAGENT:103
# End Section

View file

@ -0,0 +1,87 @@
// DenAgent.h : main header file for the DENAGENT application
//
#if !defined(AFX_DENAGENT_H__A4F37F75_E088_4616_9AC5_3B39579BC3BB__INCLUDED_)
#define AFX_DENAGENT_H__A4F37F75_E088_4616_9AC5_3B39579BC3BB__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#include "DenAgent_i.h"
class CTrayWnd;
// the public key to unencrypt xmls
#include "..\include\DecalKey.h"
/////////////////////////////////////////////////////////////////////////////
// CDenAgentApp:
// See DenAgent.cpp for the implementation of this class
//
class CDenAgentApp : public CWinApp
{
public:
CDenAgentApp();
// Returns the formatted string of the AC version
static bool getVersionString ( LPCTSTR szFilename, CString &strVersion );
static bool getVersionInfo ( LPCTSTR szFilename, int &iReleaseMajor, int &iReleaseMinor, int &iBuildMajor, int &iBuildMinor );
static bool getACVersionString ( CString &strVersion );
static bool getCOMObjectDLL ( REFCLSID rclsid, CString &strFilename );
// decrypts xml file
static void DecryptXML( const char *szPath, std::string &szXML );
// Prepends the agent path to a filename
static bool getAgentPath ( LPCTSTR szFilename, CString &strPath );
static bool checkXMLVersion ( CString &strClientVersion, CString &strXMLFile, CTrayWnd* pTrayWnd );
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDenAgentApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
// Implementation
static void importV1Plugins ();
// Helper functions
static bool checkXMLVersions ( CTrayWnd* pTrayWnd );
struct cXMLBuild
{
LPCTSTR XMLFile;
long build;
};
static void getXMLBuilds ( cXMLBuild *pFirst, cXMLBuild *pLast );
//{{AFX_MSG(CDenAgentApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
BOOL m_bATLInited;
private:
BOOL InitATL();
CTrayWnd* m_pTrayWnd;
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DENAGENT_H__A4F37F75_E088_4616_9AC5_3B39579BC3BB__INCLUDED_)

View file

@ -0,0 +1,29 @@
// DenAgent.idl : IDL source for DenAgent.exe
//
// This file will be processed by the MIDL tool to
// produce the type library (DenAgent.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(13B57D9E-F277-4014-B6A9-17CD90B4FFAB),
helpstring("IURLCallback Interface"),
pointer_default(unique)
]
interface IURLCallback : IUnknown
{
};
[
uuid(5504FC1C-B2A3-43F6-B9CE-E3B3282273B7),
version(1.0),
helpstring("DenAgent 1.0 Type Library")
]
library DenAgentLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface IURLCallback;
};

576
Native/DenAgent/DenAgent.rc Normal file
View file

@ -0,0 +1,576 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "../Include/DecalVersion.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Neutral (Default) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_TRAYICON ICON "res\\idr_tray.ico"
#endif // Neutral (Default) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON "res\\DenAgent.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_DENAGENT_DIALOG DIALOGEX 0, 0, 265, 215
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION |
WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "Decal Agent"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "Close",IDOK,208,194,50,14
LTEXT "Choose the Plugins you'd like to run. Click update to download the latest Messages and MemLocs files from the web.",
IDC_STATIC,7,7,251,17
PUSHBUTTON "Refresh List",IDC_REFRESH,208,176,50,14
PUSHBUTTON "Add",IDC_ADDREMOVE,208,65,50,14
PUSHBUTTON "Update",IDC_UPDATE,208,30,50,14
PUSHBUTTON "Options",IDC_OPTIONS,208,48,50,14
LTEXT "messages",IDC_MESSAGES_TEXT,74,175,127,8
LTEXT "memlocs",IDC_MEMLOCS_TEXT,74,187,127,8
LTEXT "decalplugins",IDC_DECALPLUGINS_TEXT,74,200,127,8
LTEXT "Messages:",IDC_STATIC,7,175,35,8
LTEXT "Memory Locations:",IDC_STATIC,7,187,60,8
LTEXT "Decal Plugins List:",IDC_STATIC,7,200,59,8
CONTROL "List1",IDC_PLUGINS,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS |
LVS_NOCOLUMNHEADER | WS_TABSTOP,7,30,194,140,
WS_EX_CLIENTEDGE
PUSHBUTTON "Remove",IDC_DELETE,208,83,50,14
PUSHBUTTON "Export",IDC_EXPORT,208,128,50,16
END
IDD_ADDREMOVE DIALOGEX 0, 0, 301, 171
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Add/Remove Plugins"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "Close",IDOK,244,7,50,14
CONTROL "List1",IDC_PLUGINS,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_TABSTOP,7,7,230,
157,WS_EX_ACCEPTFILES | WS_EX_CLIENTEDGE
PUSHBUTTON "Visit Website",IDC_INSTALL,244,28,50,14
PUSHBUTTON "Upgrade",IDC_UPGRADE,245,150,50,14,NOT WS_VISIBLE |
WS_DISABLED
PUSHBUTTON "Browse",IDC_BROWSE,244,71,50,14
PUSHBUTTON "Refresh",IDC_REFRESH,244,50,50,14
END
IDD_DOWNLOAD DIALOG 0, 0, 203, 71
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Downloading Component"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Cancel",IDC_STOPDOWNLOAD,146,50,50,14,WS_DISABLED
LTEXT "Status Text",IDC_STATUSTEXT,7,7,189,8
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,18,
189,14
LTEXT "Status Text",IDC_CUSTOMSTATUS,7,35,189,8
END
IDD_CHANGEDIR DIALOG 0, 0, 236, 49
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Change Decal URL"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,179,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,179,28,50,14
EDITTEXT IDC_NEWURL,7,28,165,14,ES_AUTOHSCROLL
LTEXT "Type the full URL of the new Decal XML Directory",
IDC_STATIC,7,7,165,14,SS_CENTERIMAGE
END
IDD_OPTIONS DIALOGEX 0, 0, 271, 221
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Decal Options"
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
DEFPUSHBUTTON "OK",IDOK,155,200,50,14
PUSHBUTTON "Cancel",IDCANCEL,214,200,50,14
EDITTEXT IDC_BARALPHA,59,16,45,14,ES_CENTER | ES_AUTOHSCROLL |
ES_NUMBER | WS_GROUP
CONTROL "",IDC_BARALPHA_SPIN,"msctls_updown32",UDS_SETBUDDYINT |
UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,93,16,11,
14
EDITTEXT IDC_VIEWALPHA,59,31,45,14,ES_CENTER | ES_AUTOHSCROLL |
ES_NUMBER
CONTROL "Spin2",IDC_VIEWALPHA_SPIN,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,93,31,11,14
GROUPBOX "View Options",IDC_STATIC,7,7,257,157
CTEXT "Bar Alpha",IDC_STATIC,17,20,35,8,SS_CENTERIMAGE | NOT
WS_GROUP
CTEXT "View Alpha",IDC_STATIC,19,34,35,8,SS_CENTERIMAGE | NOT
WS_GROUP
CTEXT "0 is Transparent - 255 is Opaque",IDC_STATIC,21,46,106,
9
CONTROL "Use Hardware Mode",IDC_BLENDINGGDIPLUS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,144,16,114,9
CONTROL "Multiple Views",IDC_VIEWMULTI,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,144,26,114,9
CONTROL "Adjust Bar for Radar",IDC_RADARYES,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,144,36,114,9
CONTROL "Use Old Injection Method",IDC_OLDINJECT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,144,46,114,10
GROUPBOX "Font Options",IDC_STATIC,14,66,244,28
CONTROL "Default",IDC_DEFAULT_FONT_RADIO,"Button",
BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,21,78,39,10
CONTROL "AC Client",IDC_CLIENT_FONT_RADIO,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,64,78,45,10
CONTROL "Custom",IDC_CUSTOM_FONT_RADIO,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,111,78,39,10
EDITTEXT IDC_CUSTOM_FONT_EDIT,151,76,98,12,ES_AUTOHSCROLL
GROUPBOX "Time Stamping",IDC_STATIC,14,95,244,27
CONTROL "Enabled",IDC_TIMESTAMPON,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,21,108,44,9,WS_EX_RIGHT | WS_EX_RTLREADING
LTEXT "Color",IDC_STATIC,71,108,19,11
COMBOBOX IDC_FORMATCLR,92,105,29,67,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "Format",IDC_STATIC,123,108,25,9
EDITTEXT IDC_FORMATSTR,151,105,88,12,ES_AUTOHSCROLL
PUSHBUTTON "?",IDC_FORMATHELP,244,105,7,12
GROUPBOX "Client Patches",IDC_STATIC,14,122,139,35
CONTROL "Dual Log",IDC_DUALLOG,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,21,131,44,11
CONTROL "Windowed Mode",IDC_WINDOWED,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,21,143,71,11
CONTROL "No Movies",IDC_NOMOVIES,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,91,130,47,11
CONTROL "No Logos",IDC_NOLOGOS,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,91,142,45,11
PUSHBUTTON "?",IDC_PATCHHELP,139,135,10,15
GROUPBOX "Decal Bar Docking Position",IDC_STATIC,155,122,103,35
COMBOBOX IDC_DOCKPOS,159,135,92,43,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
GROUPBOX "Decal Update URL",IDC_STATIC,7,166,257,28
LTEXT "http://decal.acdev.org",IDC_PLUGINDIR,14,178,169,8,
SS_CENTERIMAGE
PUSHBUTTON "Change",IDC_CHANGE_DIR,208,175,50,14
CONTROL "Start on Bootup",IDC_CHECK_AUTOSTART,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,14,202,63,12
PUSHBUTTON "Reset Bar Position",IDC_BTN_RESET,81,200,68,14
END
IDD_DOWNLOADER DIALOG 0, 0, 202, 86
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Downloading Components"
FONT 8, "MS Sans Serif"
BEGIN
PUSHBUTTON "Cancel",IDC_STOPDOWNLOAD,145,65,50,14
LTEXT "Status Text",IDC_STATUSTEXT,5,5,189,8
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,5,16,
189,14
LTEXT "Status Text",IDC_CUSTOMSTATUS,5,33,189,8
CONTROL "Progress1",IDC_PROGRESSTOTAL,"msctls_progress32",0x0,5,
45,189,14
LTEXT "Dowloading File 1 of 3",IDC_STATUSTOTAL,55,67,80,8
LTEXT "Total Progress:",IDC_STATUST,5,67,50,8
END
IDD_EXPORT DIALOGEX 0, 0, 231, 186
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Export Decal List"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
GROUPBOX "Export",IDC_STATIC,7,7,140,26
CONTROL "Enabled",IDC_CHKENABLED,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,17,17,41,8
CONTROL "Location",IDC_CHKLOC,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,61,17,41,8
CONTROL "CLSID",IDC_CHKCLSID,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,106,17,34,8
PUSHBUTTON "&Export",IDC_BTNEXPORT,151,11,69,20
EDITTEXT IDC_EDITEXPORT,7,37,217,142,ES_MULTILINE |
ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN |
WS_VSCROLL | WS_HSCROLL
END
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
PRODUCTVERSION DECAL_MAJOR, DECAL_MINOR, DECAL_BUGFIX, DECAL_RELEASE
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "DenAgent is the program that manages Decal settings"
VALUE "FileDescription", "DenAgent MFC Application"
VALUE "FileVersion", DECAL_VERSION_STRING
VALUE "InternalName", "DenAgent"
VALUE "LegalCopyright", "Copyright (C) 2000, 2001"
VALUE "OriginalFilename", "DenAgent.EXE"
VALUE "ProductName", "DenAgent Application"
VALUE "ProductVersion", DECAL_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DENAGENT_DIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 258
VERTGUIDE, 67
VERTGUIDE, 74
VERTGUIDE, 201
VERTGUIDE, 208
TOPMARGIN, 7
BOTTOMMARGIN, 208
HORZGUIDE, 24
HORZGUIDE, 30
HORZGUIDE, 44
HORZGUIDE, 48
HORZGUIDE, 90
HORZGUIDE, 113
HORZGUIDE, 144
HORZGUIDE, 170
HORZGUIDE, 175
END
IDD_ADDREMOVE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 294
VERTGUIDE, 237
VERTGUIDE, 244
TOPMARGIN, 7
BOTTOMMARGIN, 164
HORZGUIDE, 21
HORZGUIDE, 28
END
IDD_DOWNLOAD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 196
TOPMARGIN, 7
BOTTOMMARGIN, 64
HORZGUIDE, 43
HORZGUIDE, 50
END
IDD_CHANGEDIR, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 229
VERTGUIDE, 172
VERTGUIDE, 179
TOPMARGIN, 7
BOTTOMMARGIN, 42
HORZGUIDE, 21
HORZGUIDE, 28
END
IDD_OPTIONS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 264
VERTGUIDE, 14
VERTGUIDE, 258
TOPMARGIN, 7
BOTTOMMARGIN, 214
END
IDD_DOWNLOADER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 195
TOPMARGIN, 7
BOTTOMMARGIN, 79
END
IDD_EXPORT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 224
TOPMARGIN, 7
BOTTOMMARGIN, 179
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_POPUPS MENU
BEGIN
POPUP "SYSTRAY"
BEGIN
MENUITEM "Configure", ID_SYSTRAY_CONFIGURE
MENUITEM "Exit", ID_SYSTRAY_EXIT
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Toolbar
//
IDR_VERSION_STATES TOOLBAR 21, 20
BEGIN
BUTTON IDC_STATIC
BUTTON IDC_STATIC
BUTTON IDC_STATIC
BUTTON IDC_STATIC
END
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDR_VERSION_STATES BITMAP "res\\version_.bmp"
IDB_IMAGES BITMAP "Images.bmp"
IDB_BITMAP1 BITMAP "res\\bitmap1.bmp"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog Info
//
IDD_OPTIONS DLGINIT
BEGIN
IDC_FORMATCLR, 0x403, 2, 0
0x002d,
IDC_FORMATCLR, 0x403, 2, 0
0x0030,
IDC_FORMATCLR, 0x403, 2, 0
0x0031,
IDC_FORMATCLR, 0x403, 2, 0
0x0032,
IDC_FORMATCLR, 0x403, 2, 0
0x0033,
IDC_FORMATCLR, 0x403, 2, 0
0x0034,
IDC_FORMATCLR, 0x403, 2, 0
0x0035,
IDC_FORMATCLR, 0x403, 2, 0
0x0036,
IDC_FORMATCLR, 0x403, 2, 0
0x0037,
IDC_FORMATCLR, 0x403, 2, 0
0x0038,
IDC_FORMATCLR, 0x403, 2, 0
0x0039,
IDC_FORMATCLR, 0x403, 3, 0
0x3031, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3131, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3231, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3331, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3431, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3531, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3631, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3731, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3831, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3931, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3032, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3132, "\000"
IDC_FORMATCLR, 0x403, 3, 0
0x3232, "\000"
IDC_DOCKPOS, 0x403, 4, 0
0x6f54, 0x0070,
IDC_DOCKPOS, 0x403, 5, 0
0x654c, 0x7466, "\000"
IDC_DOCKPOS, 0x403, 6, 0
0x6952, 0x6867, 0x0074,
0
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (Canada) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_GROUPS BITMAP "res\\groups.bmp"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\DenAgent.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_DENAGENT REGISTRY "DenAgent.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDE_NOCLIENTEXE "Could not locate client.exe"
IDE_NOCLIENTVER "Could not extract version information from client.exe"
IDS_VERSIONTEMPLATE "%1!d!.%2!d!.%3!d!.%4!d!"
IDE_NOXMLDOC "Could not load the xml document: %1 - it may be missing or malformed."
IDE_NOXMLVER "Could not locate the version in the XML document.\r\n(xml doc=%1)"
IDE_XMLCLIENTVERSIONMISMATCH
"The client version does not match the XML version, this may cause some plugins to malfunction.\r\n(xmldoc=%1 client version=%2 xml version=%3)"
IDE_UPDATETEXT "\r\n\r\nUpdating your XML files will correct this problem. Would you like to update now?"
END
#endif // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\DenAgent.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View file

@ -0,0 +1,11 @@
HKCR
{
NoRemove AppID
{
{19A473FE-ED5F-4A68-8920-DD5D0D3E4B41} = s 'DenAgent'
'DenAgent.EXE'
{
val AppID = s {19A473FE-ED5F-4A68-8920-DD5D0D3E4B41}
}
}
}

View file

@ -0,0 +1,536 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="DenAgent"
SccProjectName=""
SccLocalPath=""
Keyword="MFCProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\..\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="4"
GlobalOptimizations="TRUE"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="2"
OmitFramePointers="TRUE"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Release/DenAgent.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib shlwapi.lib forcelibrary.lib"
OutputFile=".\..\Release/DenAgent.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Include"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Release/DenAgent.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Release/DenAgent.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\..\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\Include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/DenAgent.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
IgnoreImportLibrary="TRUE"
AdditionalDependencies="version.lib shlwapi.lib forcelibrary.lib"
OutputFile=".\..\Debug/DenAgent.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\Include"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\..\Debug/DenAgent.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
AdditionalIncludeDirectories="..\Include"
SuppressStartupBanner="TRUE"
TargetEnvironment="1"
GenerateStublessProxies="TRUE"
TypeLibraryName=".\..\Debug/DenAgent.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="4105"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="AddRemoveDlg.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="AutoUpdate.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="BindStatusCallback.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="ChangePluginDirectory.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="DenAgent.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="DenAgent.idl">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories=""
TargetEnvironment="1"
HeaderFileName="DenAgent_i.h"
InterfaceIdentifierFileName="DenAgent_i.c"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories=""
TargetEnvironment="1"
HeaderFileName="DenAgent_i.h"
InterfaceIdentifierFileName="DenAgent_i.c"/>
</FileConfiguration>
</File>
<File
RelativePath="DenAgent.rc">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
</File>
<File
RelativePath="DenAgentDlg.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="DownloadDlg.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="DownloaderDlg.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath=".\ExportDlg.cpp">
</File>
<File
RelativePath="OptionsDlg.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
<File
RelativePath="TrayWnd.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
<File
RelativePath="URLCallback.cpp">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="AddRemoveDlg.h">
</File>
<File
RelativePath="AutoUpdate.h">
</File>
<File
RelativePath="BindStatusCallback.h">
</File>
<File
RelativePath="ChangePluginDirectory.h">
</File>
<File
RelativePath="DenAgent.h">
</File>
<File
RelativePath="DenAgentDlg.h">
</File>
<File
RelativePath="DownloadDlg.h">
</File>
<File
RelativePath="DownloaderDlg.h">
</File>
<File
RelativePath=".\ExportDlg.h">
</File>
<File
RelativePath="OptionsDlg.h">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
<File
RelativePath="TrayWnd.h">
</File>
<File
RelativePath="URLCallback.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath="res\bitmap1.bmp">
</File>
<File
RelativePath="res\cursor1.cur">
</File>
<File
RelativePath="res\DenAgent.ico">
</File>
<File
RelativePath="res\DenAgent.rc2">
</File>
<File
RelativePath="DenAgent.rgs">
</File>
<File
RelativePath="res\groups.bmp">
</File>
<File
RelativePath="res\idr_tray.ico">
</File>
<File
RelativePath="Images.bmp">
</File>
<File
RelativePath="ImagesMask.bmp">
</File>
<File
RelativePath="res\version_.bmp">
</File>
</Filter>
<File
RelativePath="ReadMe.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,844 @@
// DenAgentDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DenAgent.h"
#include "DenAgentDlg.h"
#include "DownloaderDlg.h"
#include "OptionsDlg.h"
#include "ExportDlg.h"
#include "TrayWnd.h"
#include "AutoUpdate.h"
#include "..\Inject\InjectApi.h"
#include "AddRemoveDlg.h"
#include ".\denagentdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDenAgentDlg dialog
CDenAgentDlg::CDenAgentDlg(CWnd* pParent /*=NULL*/)
: CDialog(CDenAgentDlg::IDD, pParent),
m_pCurrentDrag ( NULL ), m_bDoingUpdate( false ), m_bDoUpdate( false )
{
//{{AFX_DATA_INIT(CDenAgentDlg)
//}}AFX_DATA_INIT
// Load the icon, unload will be done automagically
m_hIcon = AfxGetApp()->LoadIcon(IDR_TRAYICON);
}
void CDenAgentDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDenAgentDlg)
DDX_Control(pDX, IDC_PLUGINS, m_wndPlugins);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDenAgentDlg, CDialog)
//{{AFX_MSG_MAP(CDenAgentDlg)
ON_BN_CLICKED(IDC_REFRESH, OnRefresh)
ON_BN_CLICKED(IDC_ADDREMOVE, OnAddremove)
ON_BN_CLICKED(IDC_UPDATE, OnUpdate)
ON_BN_CLICKED(IDC_OPTIONS, OnOptions)
ON_NOTIFY(LVN_DELETEITEM, IDC_PLUGINS, OnDeleteitemPlugins)
ON_NOTIFY(NM_CLICK, IDC_PLUGINS, OnClickPlugins)
ON_NOTIFY(LVN_BEGINDRAG, IDC_PLUGINS, OnBegindragPlugins)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_DELETE, OnBnClickedDelete)
ON_BN_CLICKED(IDC_EXPORT, OnBnClickedExport)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDenAgentDlg message handlers
BOOL CDenAgentDlg::OnInitDialog()
{
CDialog::OnInitDialog();
SetForegroundWindow();
BringWindowToTop();
// Create the decal object
HRESULT hRes = ::CoCreateInstance ( __uuidof ( Decal ), NULL, CLSCTX_INPROC_SERVER, __uuidof ( IDecal ),
reinterpret_cast< LPVOID * > ( &m_pDecal ) );
// Set up the list control and image list
m_groups.Create ( IDB_GROUPS, 16, 0, RGB(255,0,255));
m_wndPlugins.SetImageList ( &m_groups, LVSIL_SMALL );
// Prepare the column list
CRect rcListClient;
m_wndPlugins.GetClientRect ( rcListClient );
CClientDC dcList ( &m_wndPlugins );
dcList.SelectObject ( m_wndPlugins.GetFont () );
int nVersionWidth = dcList.GetTextExtent ( CString ( _T( "100.00.00.00001" ) ) ).cx;
m_wndPlugins.InsertColumn ( 0, _T( "Component" ), LVCFMT_LEFT, rcListClient.Width () - nVersionWidth - 16, 0 );
m_wndPlugins.InsertColumn ( 1, _T( "Version" ), LVCFMT_RIGHT, nVersionWidth, 1 );
m_wndPlugins.SetExtendedStyle ( LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP );
if ( FAILED ( hRes ) )
{
AfxMessageBox ( _T( "Failed to create Decal Object." ) );
EndDialog ( IDCANCEL );
return FALSE;
}
loadPluginList ();
// Set the icon into the window for runtime
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
TCHAR szModule[ MAX_PATH ];
::GetModuleFileName ( NULL, szModule, MAX_PATH );
CString strVersion;
CDenAgentApp::getVersionString ( szModule, strVersion );
CDenAgentApp::getVersionInfo ( szModule, iReleaseMajor, iReleaseMinor, iBuildMajor, iBuildMinor );
SetWindowText( CString("Decal Agent ") + strVersion );
updateFileInfo();
return TRUE; // return TRUE unless you set the focus to a control
}
void CDenAgentDlg::OnRefresh()
{
loadPluginList ();
}
void CDenAgentDlg::OnAddremove()
{
CFile cf;
CFileStatus cfs;
RegKey key;
CString strDecalPlugins("decalplugins.xml");
if( key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Agent" )) == ERROR_SUCCESS )
{
TCHAR szDecalDirectory[ MAX_PATH + 1];
DWORD dwSize = MAX_PATH;
if(key.QueryStringValue( _T( "AgentPath" ), szDecalDirectory, &dwSize )==ERROR_SUCCESS)
{
strDecalPlugins = CString(szDecalDirectory) + "\\decalplugins.xml";
}
}
if(!cf.GetStatus(strDecalPlugins, cfs))
{
if(MessageBox("Your list of Decal Components is missing.\n\nWould like to Download them?", NULL, MB_YESNO)==IDYES)
OnUpdate();
}
else
{
CTime modification_time = cfs.m_mtime;
CTime now = CTime::GetCurrentTime ();
if((modification_time.GetDay() < now.GetDay()) && (modification_time.GetMonth() <= now.GetMonth()) && (modification_time.GetYear() <= now.GetYear()))
if(MessageBox("Your list of Decal Components are outdated.\n\nWould you like to Update?", NULL, MB_YESNO)==IDYES)
{
m_bDoingUpdate = true;
OnUpdate();
}
}
cAddRemoveDlg dlg( this );
dlg.m_pDecal = m_pDecal;
dlg.DoModal ();
loadPluginList ();
}
int CDenAgentDlg::getDragInsertBefore ( CPoint &ptClient )
{
_ASSERTE ( m_pCurrentDrag != NULL );
CRect rc;
m_wndPlugins.GetWindowRect ( rc );
ScreenToClient ( rc );
ptClient.x = ptClient.x - rc.left;
ptClient.y = ptClient.y - rc.top;
int nItemHit = m_wndPlugins.HitTest ( ptClient );
if ( nItemHit != -1 )
{
cPlugin *pPlugin = reinterpret_cast< cPlugin * > ( m_wndPlugins.GetItemData ( nItemHit ) );
if ( pPlugin != NULL && pPlugin->m_dragimage == m_pCurrentDrag->m_dragimage )
return nItemHit;
}
return -1;
}
/////////////////////////////////////////////////////////////////////////////
// Tries to update the local copy of decal
/////////////////////////////////////////////////////////////////////////////
void CDenAgentDlg::updateDecal(_variant_t vCodeBase) {
USES_CONVERSION;
if (MessageBox("A New Version of Decal exists.\n\nWould you like to Update?",NULL, MB_ICONQUESTION | MB_YESNO) == IDYES) {
ShellExecute(m_hWnd,"open",OLE2A(vCodeBase.bstrVal),0,0,0);
EndDialog(0);
GetParent()->DestroyWindow();
PostQuitMessage(0);
}
}
struct cPluginGroup
{
LPCTSTR m_groupName,
m_groupKey;
int m_iconIndex;
};
void CDenAgentDlg::loadPluginList ()
{
m_wndPlugins.SetRedraw ( FALSE );
int nTop = m_wndPlugins.GetTopIndex ();
// Save the original selection
GUID idSelected = GUID_NULL;
{
POSITION pos = m_wndPlugins.GetFirstSelectedItemPosition ();
if ( pos != NULL )
{
int nSelected = m_wndPlugins.GetNextSelectedItem ( pos );
cPlugin *pPlugin = reinterpret_cast< cPlugin * > ( m_wndPlugins.GetItemData ( nSelected ) );
if ( pPlugin != NULL )
idSelected = pPlugin->m_id;
}
}
// Erase the contents of the list and collection
m_wndPlugins.DeleteAllItems ();
CDenAgentApp::importV1Plugins ();
USES_CONVERSION;
static cPluginGroup _groups[] = {
{ _T( "Plugins" ), _T( "Plugins" ), 4 },
{ _T( "Network Filters" ), _T( "NetworkFilters" ), 1 },
{ _T( "File Filters" ), _T( "FileFilters" ), 1 },
{ _T( "Services" ), _T( "Services" ), 0 },
{ _T( "Surrogates" ), _T( "Surrogates" ), 3 },
{ _T( "Input Actions" ), _T( "InputActions" ), 2 } },
*_end_groups = _groups + sizeof ( _groups ) / sizeof ( cPluginGroup );
int nCount = 0;
for ( cPluginGroup *i = _groups; i != _end_groups; ++ i )
{
int nGroup = m_wndPlugins.InsertItem ( LVIF_IMAGE | LVIF_TEXT, nCount ++, i->m_groupName, 0,
0, i->m_iconIndex, 0 );
CComPtr<IDecalEnum> pEnum;
HRESULT hRes = m_pDecal->get_Configuration ( _bstr_t ( i->m_groupKey ), GUID_NULL, &pEnum );
_ASSERTE( SUCCEEDED ( hRes ) );
while ( pEnum->Next () == S_OK )
{
CLSID clsid;
hRes = pEnum->get_ComClass ( &clsid );
_ASSERTE ( SUCCEEDED ( hRes ) );
VARIANT_BOOL bEnabled;
hRes = pEnum->get_Enabled ( &bEnabled );
_ASSERTE ( SUCCEEDED ( hRes ) );
int nState = ( clsid == idSelected ) ? LVIS_SELECTED | LVIS_FOCUSED : 0;
LVITEM lvi = { LVIF_STATE | LVIF_IMAGE | LVIF_INDENT | LVIF_PARAM | LVIF_TEXT, nCount ++, 0,
nState, nState, NULL, -1, ( bEnabled ) ? 6 : 5, reinterpret_cast< LPARAM > ( new cPlugin ( clsid, i->m_groupKey, !!bEnabled, i->m_iconIndex ) ), 1 };
CComBSTR strName;
if ( SUCCEEDED ( pEnum->get_FriendlyName( &strName ) ) )
lvi.pszText = OLE2T ( strName );
else
{
LPOLESTR szProgID;
if ( FAILED ( ::ProgIDFromCLSID ( clsid, &szProgID ) ) )
{
hRes = ::StringFromCLSID ( clsid, &szProgID );
_ASSERTE ( SUCCEEDED ( hRes ) );
}
// This *must* succeed
lvi.pszText = OLE2T ( szProgID );
::CoTaskMemFree ( szProgID );
}
lvi.cchTextMax = ::_tcslen ( lvi.pszText );
int nItem = m_wndPlugins.InsertItem ( &lvi );
// Load the version info
CString strDLL;
if ( !CDenAgentApp::getCOMObjectDLL ( clsid, strDLL ) )
{
m_wndPlugins.SetItemText ( nItem, 1, _T( "<No DLL>" ) );
continue;
}
CString strDLLVersion;
if ( !CDenAgentApp::getVersionString ( strDLL, strDLLVersion ) )
m_wndPlugins.SetItemText ( nItem, 1, _T( "<No Version>" ) );
else
m_wndPlugins.SetItemText ( nItem, 1, strDLLVersion );
}
}
m_wndPlugins.SetRedraw ( TRUE );
m_wndPlugins.Invalidate ();
// Scroll back to the top index of before
RECT rc;
m_wndPlugins.GetItemRect ( 0, &rc, LVIR_BOUNDS );
m_wndPlugins.Scroll ( CSize ( 0, ( rc.bottom - rc.top ) * nTop ) );
}
void CDenAgentDlg::OnUpdate()
{
USES_CONVERSION;
// Release Decal object so it can be updated.
m_pDecal.Release();
m_pDecal = NULL;
CoFreeUnusedLibraries();
RegKey key;
cDownloaderDlg dlg;
bool bUpdates = false;
if (key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Agent" )) != ERROR_SUCCESS)
return;
TCHAR szURLDirectory[1024];
TCHAR szDecalDirectory[MAX_PATH + 1];
DWORD dwSize = 1024;
if (key.QueryStringValue( _T( "DecalDirectory" ), szURLDirectory, &dwSize ) != ERROR_SUCCESS)
{
::_tcscpy(szURLDirectory, "http://decal.acdev.org");
key.SetStringValue("DecalDirectory", "http://decal.acdev.org");
}
dwSize = MAX_PATH;
if (key.QueryStringValue( _T( "AgentPath" ), szDecalDirectory, &dwSize ) == ERROR_SUCCESS) {
// Gouru: szDecalDirectory may have trailing slash in registry, all following
// code assumes it does not, and adds another one. Since this could potentially
// cause path problems, the extra slash (if extant) is removed here
if ( szDecalDirectory[strlen(szDecalDirectory)-1] == '/'
|| szDecalDirectory[strlen(szDecalDirectory)-1] == '\\'
){
szDecalDirectory[strlen(szDecalDirectory)-1] = 0 ;
}
AutoUpdate aUpdate(szDecalDirectory);
aUpdate.initialiseFromXML(std::string(szURLDirectory));
if (!aUpdate.performUpdate())
MessageBox("Decal component update failed!");
} else {
return;
}
MSXML::IXMLDOMDocumentPtr pDPDoc;
pDPDoc.CreateInstance( __uuidof( MSXML::DOMDocument ) );
pDPDoc->async = false;
VARIANT_BOOL bSuccess = pDPDoc->load( "decalplugins.xml" );
if(bSuccess)
{
MSXML::IXMLDOMElementPtr pNode = pDPDoc->selectSingleNode( _T("decal") );
_variant_t vVersion = pNode->getAttribute( _T( "version" ) ), vCodeBase = pNode->getAttribute( _T( "codebase" ) );
char *sVersion = OLE2A(vVersion.bstrVal);
int iRemoteReleaseMajor, iRemoteReleaseMinor;
int iRemoteBuildMajor, iRemoteBuildMinor;
sscanf(sVersion, "%d.%d.%d.%d", &iRemoteReleaseMajor, &iRemoteReleaseMinor, &iRemoteBuildMajor, &iRemoteBuildMinor);
if (iReleaseMajor == iRemoteReleaseMajor)
{
if (iReleaseMinor == iRemoteReleaseMinor)
{
if (iBuildMajor == iRemoteBuildMajor)
{
if (iBuildMinor < iRemoteBuildMinor)
updateDecal(vCodeBase);
}
else if (iBuildMajor < iRemoteBuildMajor)
updateDecal(vCodeBase);
}
else if (iReleaseMinor < iRemoteReleaseMinor)
updateDecal(vCodeBase);
}
else if (iReleaseMajor < iRemoteReleaseMajor)
updateDecal(vCodeBase);
MSXML::IXMLDOMNodeListPtr pPlugins = pDPDoc->selectNodes( _T( "/decal/plugin" ) );
for( MSXML::IXMLDOMElementPtr pPlugin = pPlugins->nextNode(); pPlugin.GetInterfacePtr() != NULL; pPlugin = pPlugins->nextNode() )
{
_variant_t vClsid = pPlugin->getAttribute( _T( "clsid" ) ),
vCodebase = pPlugin->getAttribute( _T( "codebase" ) ),
vVersion = pPlugin->getAttribute( _T( "version" ) ),
vName = pPlugin->getAttribute( _T( "name" ) );
DWORD dwMajor;
DWORD dwMinor;
convertVersion( OLE2T( vVersion.bstrVal ), dwMajor, dwMinor );
RegKey keyPlugin;
if( keyPlugin.Open( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Plugins\\" ), KEY_READ ) == ERROR_SUCCESS )
{
keyPlugin.Close();
if( keyPlugin.Open( HKEY_CLASSES_ROOT, CString(_T("\\CLSID\\")) + OLE2T(vClsid.bstrVal) + _T("\\InprocServer32"), KEY_READ ) != ERROR_SUCCESS ) continue;
DWORD dwSize = MAX_PATH;
TCHAR szDllName[MAX_PATH];
if(keyPlugin.QueryStringValue("", szDllName, &dwSize) != ERROR_SUCCESS) continue;
keyPlugin.Close();
DWORD dwHandle;
DWORD dwVerInfoSize = GetFileVersionInfoSize(szDllName,&dwHandle);
if(!dwVerInfoSize) continue;
LPBYTE pVersionData = NULL;
pVersionData = new BYTE[dwVerInfoSize];
if(!GetFileVersionInfo(szDllName, dwHandle, dwVerInfoSize, pVersionData))
{
delete [] pVersionData;
continue;
}
VS_FIXEDFILEINFO* pFixedFileInfo;
UINT uFixedInfoSize;
if(!VerQueryValue(pVersionData, "\\", (void**) &pFixedFileInfo, &uFixedInfoSize))
{
delete [] pVersionData;
continue;
}
if (HIWORD(pFixedFileInfo->dwFileVersionMS) == HIWORD(dwMajor))
{
if (LOWORD(pFixedFileInfo->dwFileVersionMS) == LOWORD(dwMajor))
{
if (HIWORD(pFixedFileInfo->dwFileVersionLS) == HIWORD(dwMinor))
{
if (LOWORD(pFixedFileInfo->dwFileVersionLS) < LOWORD(dwMinor))
bUpdates = true;
}
else if (HIWORD(pFixedFileInfo->dwFileVersionLS) < HIWORD(dwMinor))
bUpdates = true;
}
else if (LOWORD(pFixedFileInfo->dwFileVersionMS) < LOWORD(dwMajor))
bUpdates = true;
}
else if (HIWORD(pFixedFileInfo->dwFileVersionMS) < HIWORD(dwMajor))
bUpdates = true;
delete [] pVersionData;
}
}
if((bUpdates) && (!m_bDoingUpdate))
{
if (MessageBox("Decal has detected that one or more of your plugins are out of date.\n\nWould you like to view the plugin list?",NULL, MB_ICONQUESTION | MB_YESNO) == IDYES)
{
HRESULT hRes = ::CoCreateInstance ( __uuidof ( Decal ), NULL, CLSCTX_INPROC_SERVER, __uuidof ( IDecal ),
reinterpret_cast< LPVOID * > ( &m_pDecal ) );
cAddRemoveDlg ardlg( this );
ardlg.m_pDecal = m_pDecal;
ardlg.DoModal();
loadPluginList();
}
}
}
m_bDoingUpdate = false;
updateFileInfo ();
HRESULT hRes = ::CoCreateInstance ( __uuidof ( Decal ), NULL, CLSCTX_INPROC_SERVER, __uuidof ( IDecal ),
reinterpret_cast< LPVOID * > ( &m_pDecal ) );
}
void CDenAgentDlg::OnOptions()
{
cOptionsDlg dlg;
dlg.DoModal();
}
void CDenAgentDlg::convertVersion( LPTSTR szVersion, DWORD &dwVersionMajor, DWORD &dwVersionMinor )
{
int wVersionParts[ 4 ],
*i_ver = wVersionParts;
for( TCHAR *szVersionPart = ::_tcstok( szVersion, _T( "." ) ); szVersionPart != NULL; szVersionPart = ::_tcstok( NULL, _T( "." ) ), ++ i_ver )
::_stscanf( szVersionPart, _T( "%i" ), i_ver );
dwVersionMajor = MAKELONG( wVersionParts[ 1 ], wVersionParts[ 0 ] );
dwVersionMinor = MAKELONG( wVersionParts[ 3 ], wVersionParts[ 2 ] );
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void CDenAgentDlg::updateFileInfo(void)
{
struct cFiles
{
LPCTSTR szFilename;
LPCTSTR szRootElement;
LPCTSTR szVElement;
UINT nDlgID;
};
static cFiles files[] = {
{ _T( "messages.xml" ), _T("schema"), _T("revision"), IDC_MESSAGES_TEXT },
{ _T( "memlocs.xml" ), _T(""), _T("locations"), IDC_MEMLOCS_TEXT },
{ _T( "decalplugins.xml" ), _T(""), _T(""), IDC_DECALPLUGINS_TEXT } },
*end_files = files + sizeof ( files ) / sizeof ( cFiles );
for ( cFiles *i = files; i != end_files; ++ i )
{
CString strFileInfo;
GetFileInfoBase ( i->szFilename, i->szRootElement, i->szVElement, strFileInfo );
SetDlgItemText ( i->nDlgID, strFileInfo );
}
}
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
void CDenAgentDlg::GetFileInfoBase(LPCTSTR pszFilename, LPCTSTR pszRootElement, LPCTSTR pszVElement, CString &szFileInfo)
{
USES_CONVERSION;
RegKey key;
TCHAR szVal[MAX_PATH+1];
DWORD dwSize = MAX_PATH;
static BOOL bAlreadyBuggedUser = false;
szFileInfo = _T("file not found");
// Open the registry key
if(key.Open(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Decal\\Agent")) == ERROR_SUCCESS)
{
// Determine the agent path
if (key.QueryStringValue(_T("AgentPath"), szVal, &dwSize) == ERROR_SUCCESS)
{
CString szFilename, szAgentPath(szVal);
// Create the filename
szFilename.Format(_T("%s%s%s"),
szAgentPath,
(szAgentPath.Right(1) != _T("\\")) ? _T("\\") : _T(""),
pszFilename);
// Look for the data file
CFileStatus FileStatus;
if (CFile::GetStatus((LPCTSTR)szFilename, FileStatus))
{
if (strlen(pszVElement)) {
MSXML::IXMLDOMDocumentPtr m_pDoc;
MSXML::IXMLDOMElementPtr pVersionElement;
m_pDoc.CreateInstance( __uuidof( MSXML::DOMDocument ) );
m_pDoc->async = false;
BOOL bSuccess = m_pDoc->load( _bstr_t(szFilename) );
if( !bSuccess )
{
std::string szXML;
CDenAgentApp::DecryptXML( static_cast< LPCSTR >( szFilename ), szXML );
if( szXML != "" )
bSuccess = m_pDoc->loadXML( _bstr_t( szXML.c_str() ) );
szXML = " ";
for( int i = 0; i < 2500; ++i )
szXML += "DIRL";
}
if( !bSuccess )
return;
if (strlen(pszRootElement)) {
MSXML::IXMLDOMElementPtr pRootElement = m_pDoc->selectSingleNode(_T(pszRootElement));
pVersionElement = pRootElement->selectSingleNode(_T(pszVElement));
} else {
pVersionElement = m_pDoc->selectSingleNode(_T(pszVElement));
}
if (pVersionElement) {
_variant_t vVersion = pVersionElement->getAttribute(_T("version"));
szFileInfo.Format(_T("%d bytes, Version %s"), (DWORD) FileStatus.m_size, OLE2T(vVersion.bstrVal));
} else {
CString szDateTime = FileStatus.m_mtime.Format(_T("%#m/%#d/%Y %#I:%M %p"));
szFileInfo.Format(_T("%d bytes, %s"), (DWORD) FileStatus.m_size, szDateTime);
}
} else {
CString szDateTime = FileStatus.m_mtime.Format(_T("%#m/%#d/%Y %#I:%M %p"));
szFileInfo.Format(_T("%d bytes, %s"), (DWORD) FileStatus.m_size, szDateTime);
}
}
}
}
// This is mainly to protect me from myself :) Yes, I did almost post a bug report
// because I didn't have XML files in and AC was crashing. --elph
if( m_bDoUpdate )
{
m_bDoUpdate = false;
OnUpdate( );
}
else if (szFileInfo == _T("file not found") && !bAlreadyBuggedUser) {
::MessageBox(NULL, "One or more of your XML files were not found!\nPlease click the Update button to ensure that Decal works correctly!", "Decal", MB_OK|MB_ICONERROR);
bAlreadyBuggedUser = true;
}
}
void CDenAgentDlg::OnDeleteitemPlugins(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// Clear the plugin
delete reinterpret_cast< cPlugin * > ( pNMListView->lParam );
*pResult = 0;
}
void CDenAgentDlg::OnClickPlugins(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
LPNMITEMACTIVATE pItemActivate = reinterpret_cast< LPNMITEMACTIVATE > ( pNMHDR );
if ( pItemActivate->iItem == -1 || pItemActivate->lParam == 0 )
// A plugin item was not hit
return;
// Hit test to see if the icon was hit (checkbox)
if ( pItemActivate->ptAction.x < 16 || pItemActivate->ptAction.x > 32 )
return;
// Invert the check
cPlugin *pPlugin = reinterpret_cast< cPlugin * > ( m_wndPlugins.GetItemData ( pItemActivate->iItem ) );
CComPtr< IDecalEnum > pEnum;
if (pPlugin && SUCCEEDED ( m_pDecal->get_Configuration ( _bstr_t ( pPlugin->m_group ), pPlugin->m_id, &pEnum ) ) )
{
pPlugin->m_bEnabled = !pPlugin->m_bEnabled;
// Write the registry and the icons
pEnum->put_Enabled ( ( pPlugin->m_bEnabled ) ? VARIANT_TRUE : VARIANT_FALSE );
LVITEM lvi = { LVIF_IMAGE, pItemActivate->iItem, 0, 0, 0, NULL, 0,
( pPlugin->m_bEnabled ) ? 6 : 5, };
m_wndPlugins.SetItem ( &lvi );
}
else
// Bad data in the list - refresh
loadPluginList ();
}
void CDenAgentDlg::OnBegindragPlugins(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
// Check if this item is valid for dragging
if ( pNMListView->iItem == -1 )
return;
cPlugin *pPlugin = reinterpret_cast< cPlugin * > ( m_wndPlugins.GetItemData ( pNMListView->iItem ) );
if ( pPlugin == NULL )
return;
m_wndPlugins.SetItemState ( pNMListView->iItem, LVIS_SELECTED, LVIS_SELECTED );
m_hDragImage = ListView_CreateDragImage ( m_wndPlugins.m_hWnd, pNMListView->iItem, &CPoint ( 0, 0 ) );
CRect rcItem;
m_wndPlugins.GetItemRect ( pNMListView->iItem, rcItem, LVIR_BOUNDS );
ImageList_BeginDrag ( m_hDragImage, 0, pNMListView->ptAction.x - rcItem.left, pNMListView->ptAction.y - rcItem.top );
ImageList_DragEnter ( m_wndPlugins.m_hWnd, pNMListView->ptAction.x, pNMListView->ptAction.y );
m_pCurrentDrag = pPlugin;
SetCapture ();
}
void CDenAgentDlg::OnMouseMove(UINT nFlags, CPoint point)
{
if ( m_pCurrentDrag != NULL )
{
SetCursor ( ::LoadCursor ( NULL, ( getDragInsertBefore ( point ) == -1 ) ? IDC_NO : IDC_ARROW ) );
ImageList_DragMove ( point.x, point.y );
}
CDialog::OnMouseMove(nFlags, point);
}
void CDenAgentDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
if ( m_pCurrentDrag != NULL )
{
ImageList_DragLeave ( m_wndPlugins.m_hWnd );
ImageList_EndDrag ();
ImageList_Destroy ( m_hDragImage );
ReleaseCapture ();
int nInsertBefore = getDragInsertBefore ( point );
if ( nInsertBefore != -1 )
{
{
CComPtr< IDecalEnum > pEnum;
if ( SUCCEEDED ( m_pDecal->get_Configuration ( _bstr_t ( m_pCurrentDrag->m_group ), GUID_NULL, &pEnum ) ) )
{
if ( SUCCEEDED ( pEnum->Skip ( m_pCurrentDrag->m_id ) ) )
pEnum->MoveBefore ( reinterpret_cast< cPlugin * > ( m_wndPlugins.GetItemData ( nInsertBefore ) )->m_id );
}
}
loadPluginList ();
}
m_pCurrentDrag = NULL;
}
CDialog::OnLButtonUp(nFlags, point);
}
void CDenAgentDlg::OnBnClickedDelete()
{
/*
HOW TO USE THIS FEATURE
create a string value under your plugin key called "Uninstaller"
the value of this key should be the name of your uninstaller program,
as listed under HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\
for MSI installers the name will be a GUID, for others it may be a GUID or plain text
that's it
-para
*/
USES_CONVERSION;
int nSelMark = m_wndPlugins.GetSelectionMark();
if ( nSelMark == -1 )
return;
cPlugin *pPlugin = reinterpret_cast< cPlugin * >(m_wndPlugins.GetItemData( nSelMark ));
if ( pPlugin == NULL )
return;
//ask permission MB_OKCANCEL | MB_ICONEXCLAMATION = IDOK
//_snprintf(szMsg, 512, "You are about to remove %s\nPress OK to continue", stuff)
if ( ::MessageBox(NULL, _T("You are about to remove this plugin.\nPress OK to continue"), _T("Remove Plugin"), MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK )
return;
//load up the decal registry and remove this entry
RegKey keyPlugin;
CString decalPluginKey;
BSTR sClsid;
StringFromCLSID(pPlugin->m_id, &sClsid);
if ((stricmp(pPlugin->m_group, "plugins") == 0) || (stricmp(pPlugin->m_group, "networkfilters") == 0))
{
decalPluginKey.Format("SOFTWARE\\Decal\\%s", pPlugin->m_group);
if (keyPlugin.Open(HKEY_LOCAL_MACHINE, _T(decalPluginKey), KEY_ALL_ACCESS) == ERROR_SUCCESS)
{
RegKey keySub;
if (keySub.Open(keyPlugin.m_hKey, OLE2T(sClsid), KEY_READ) == ERROR_SUCCESS)
{
//read the uninstaller string and fire it off
TCHAR sUninstall[512];
DWORD dwSize = 512;
if (keySub.QueryStringValue(_T("Uninstaller"), sUninstall, &dwSize) == ERROR_SUCCESS)
{
RegKey keyUninstall;
CString sUninstallKey;
sUninstallKey.Format("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s", sUninstall);
if (keyUninstall.Open(HKEY_LOCAL_MACHINE, _T(sUninstallKey), KEY_READ) == ERROR_SUCCESS)
{
TCHAR sUninstallPath[512];
dwSize = 512;
keyUninstall.QueryStringValue(_T("UninstallString"), sUninstallPath, &dwSize);
keyUninstall.Close();
//execute!
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi));
si.cb = sizeof(si);
CreateProcess(NULL, sUninstallPath, NULL, NULL, false, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pi);
}
} else {
::MessageBox(NULL, _T("There was no uninstaller key defined for this object\nYou will have to uninstall it manually"), _T("Decal Error"), MB_ICONEXCLAMATION);
}
keySub.Close();
}
keyPlugin.DeleteSubKey(OLE2T(sClsid));
keyPlugin.Close();
}
else
::MessageBox(NULL, _T("Unable to open registry"), _T("Decal Error"), MB_ICONEXCLAMATION);
//refresh
loadPluginList();
}
}
void CDenAgentDlg::OnBnClickedExport()
{
cExportDlg dlg;
dlg.SetDecal(m_pDecal);
dlg.DoModal();
}

View file

@ -0,0 +1,100 @@
// DenAgentDlg.h : header file
//
#if !defined(AFX_DENAGENTDLG_H__2E961411_B570_4DAA_B5F1_89B9714C39EC__INCLUDED_)
#define AFX_DENAGENTDLG_H__2E961411_B570_4DAA_B5F1_89B9714C39EC__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <Decal.h>
/////////////////////////////////////////////////////////////////////////////
// CDenAgentDlg dialog
class CDenAgentDlg : public CDialog
{
// Construction
public:
CDenAgentDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDenAgentDlg)
enum { IDD = IDD_DENAGENT_DIALOG };
CListCtrl m_wndPlugins;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDenAgentDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
struct cPlugin
{
CLSID m_id;
LPCTSTR m_group;
bool m_bEnabled;
int m_dragimage;
cPlugin ( REFCLSID clsid, LPCTSTR group, bool bEnabled, int dragimage )
: m_id ( clsid ),
m_group ( group ),
m_bEnabled ( bEnabled ),
m_dragimage ( dragimage )
{
}
};
HIMAGELIST m_hDragImage;
cPlugin *m_pCurrentDrag;
int getDragInsertBefore ( CPoint &ptClient );
void updateDecal(_variant_t vCodeBase);
void loadPluginList ();
void GetFileInfoBase(LPCTSTR pszFilename, LPCTSTR pszRootElement, LPCTSTR pszVElement, CString &szFileInfo);
void updateFileInfo();
public:
bool m_bDoingUpdate;
bool m_bDoUpdate;
CImageList m_groups;
void convertVersion( LPTSTR szVersion, DWORD &dwVersionMajor, DWORD &dwVersionMinor );
int iReleaseMajor, iReleaseMinor;
int iBuildMajor, iBuildMinor;
CComPtr<IDecal> m_pDecal;
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CDenAgentDlg)
virtual BOOL OnInitDialog();
afx_msg void OnRefresh();
afx_msg void OnAddremove();
afx_msg void OnUpdate();
afx_msg void OnOptions();
afx_msg void OnDeleteitemPlugins(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnClickPlugins(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnBegindragPlugins(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedDelete();
afx_msg void OnBnClickedExport();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DENAGENTDLG_H__2E961411_B570_4DAA_B5F1_89B9714C39EC__INCLUDED_)

View file

@ -0,0 +1,77 @@
// DownloadDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DenAgent.h"
#include "DownloadDlg.h"
#include "URLCallback.h"
#include "BindStatusCallback.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// cDownloadDlg dialog
cDownloadDlg::cDownloadDlg(CWnd* pParent /*=NULL*/)
: CDialog(cDownloadDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(cDownloadDlg)
//}}AFX_DATA_INIT
}
void cDownloadDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(cDownloadDlg)
DDX_Control(pDX, IDC_STATUSTEXT, m_stIEMsg);
DDX_Control(pDX, IDC_CUSTOMSTATUS, m_stCustomMsg);
DDX_Control(pDX, IDC_STOPDOWNLOAD, m_wndStop);
DDX_Control(pDX, IDC_PROGRESS, m_wndProgress);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(cDownloadDlg, CDialog)
//{{AFX_MSG_MAP(cDownloadDlg)
ON_BN_CLICKED(IDC_STOPDOWNLOAD, OnStopdownload)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// cDownloadDlg message handlers
void cDownloadDlg::OnStopdownload()
{
m_pCallback->stop();
}
BOOL cDownloadDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Create the URL Bind Context
CComObject< cURLCallback > *pCallback;
CComObject< cURLCallback >::CreateInstance( &pCallback );
m_pCallback = pCallback;
m_pCallback->AddRef();
m_pCallback->m_pDlg = this;
m_pCallback->start( m_clsid, m_strURL, m_dwMajor, m_dwMinor );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void cDownloadDlg::OnDestroy()
{
m_pCallback->Release();
CDialog::OnDestroy();
}

View file

@ -0,0 +1,62 @@
#if !defined(AFX_DOWNLOADDLG_H__E5094CC4_4B01_46AF_9C32_5DBECF5C11D6__INCLUDED_)
#define AFX_DOWNLOADDLG_H__E5094CC4_4B01_46AF_9C32_5DBECF5C11D6__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DownloadDlg.h : header file
//
#include "resource.h"
class cURLCallback;
/////////////////////////////////////////////////////////////////////////////
// cDownloadDlg dialog
class cDownloadDlg : public CDialog
{
// Construction
public:
cDownloadDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(cDownloadDlg)
enum { IDD = IDD_DOWNLOAD };
CStatic m_stIEMsg;
CStatic m_stCustomMsg;
CButton m_wndStop;
CProgressCtrl m_wndProgress;
//}}AFX_DATA
cURLCallback *m_pCallback;
CLSID m_clsid;
LPCWSTR m_strURL;
DWORD m_dwMajor;
DWORD m_dwMinor;
CComPtr< IClassFactory > m_pFactory;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(cDownloadDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(cDownloadDlg)
afx_msg void OnStopdownload();
virtual BOOL OnInitDialog();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DOWNLOADDLG_H__E5094CC4_4B01_46AF_9C32_5DBECF5C11D6__INCLUDED_)

View file

@ -0,0 +1,246 @@
// DownloaderDlg.cpp : implementation file
//
#include "stdafx.h"
#include "denagent.h"
#include "DownloaderDlg.h"
#include "BindStatusCallback.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// cDownloaderDlg dialog
cDownloaderDlg::cDownloaderDlg(CWnd* pParent /*=NULL*/)
: CDialog(cDownloaderDlg::IDD, pParent), m_bDownloadSucceeded(false)
{
//{{AFX_DATA_INIT(cDownloaderDlg)
//}}AFX_DATA_INIT
}
void cDownloaderDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(cDownloaderDlg)
DDX_Control(pDX, IDC_STATUSTOTAL, m_stStatusTotal);
DDX_Control(pDX, IDC_STOPDOWNLOAD, m_wndStop);
DDX_Control(pDX, IDC_PROGRESS, m_wndProgress);
DDX_Control(pDX, IDC_PROGRESSTOTAL, m_wndProgressTotal);
DDX_Control(pDX, IDC_STATUSTEXT, m_stIEMsg);
DDX_Control(pDX, IDC_CUSTOMSTATUS, m_stCustomMsg);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(cDownloaderDlg, CDialog)
//{{AFX_MSG_MAP(cDownloaderDlg)
ON_BN_CLICKED(IDC_STOPDOWNLOAD, OnStopdownload)
ON_WM_DESTROY()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_USER+1, OnEndDownload)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// cDownloaderDlg message handlers
void cDownloaderDlg::OnStopdownload()
{
if(!m_bThreadDone)
InterlockedExchange ( &g_fAbortDownload, 1 );
else
EndDialog(IDOK);
}
UINT gThreadProc ( void* pv )
{
cDownloaderDlg* cDDlg = (cDownloaderDlg*)pv;
cDDlg->WorkerThreadProc();
return 0;
}
//FILELIST g_FileList[] = { { "messages.xml", "messages.dlc" }, { "memlocs.xml", "messages.dlc" }, { "decalplugins.xml", "messages.dlc" } };
void cDownloaderDlg::addFile(std::string remoteFile, std::string localFile) {
FILELIST tmpFile;
tmpFile.strFile = const_cast<char *>(remoteFile.c_str());
tmpFile.strLFile = const_cast<char *>(localFile.c_str());
m_FileList.push_back(tmpFile);
}
void cDownloaderDlg::WorkerThreadProc()
{
//srand((unsigned int) time( NULL ) );
OLECHAR olestr[1024];
GUID pGuid;
CoCreateGuid(&pGuid);
StringFromGUID2(pGuid, olestr, 1024);
HRESULT hr;
CString strFile;
//TCHAR lpFileName[MAX_PATH];
int fileListSize = m_FileList.size();
for(int i=0; i < fileListSize; i++)
{
CString st;
st.Format("Downloading File %d of %d.", i + 1, fileListSize);
m_stStatusTotal.SetWindowText(st);
CCallback callback;
callback.m_pDlg = this;
CString strFullURL = m_FileList[i].strFile;
m_stIEMsg.SetWindowText ( strFullURL );
hr = URLDownloadToFile( NULL, strFullURL + CString("?") + CString(olestr), m_FileList[i].strLFile, 0, &callback );
if ( FAILED(hr) )
{
if(!g_fAbortDownload )
{
LPTSTR lpszErrorMessage;
CString sMsg;
if(FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hr, MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ), (LPTSTR) &lpszErrorMessage, 0, NULL ))
{
sMsg.Format ( _T("Download failed. \n\n%s"), lpszErrorMessage );
LocalFree ( lpszErrorMessage );
}
else
sMsg.Format ( _T("Download failed."), (DWORD) hr );
m_bDownloadSucceeded = false;
AfxMessageBox ( sMsg );
PostMessage(WM_USER+1, 1, NULL);
}
else
{
m_bDownloadSucceeded = false;
PostMessage(WM_USER+1, IDCANCEL, NULL);
AfxEndThread(0);
}
} else {
m_bDownloadSucceeded = true;
OFSTRUCT targetFile;
OFSTRUCT sourceFile;
// Make sure we really got a source file
if (OpenFile(m_FileList[i].strLFile, &sourceFile, OF_EXIST) != HFILE_ERROR)
{
if (OpenFile(m_FileList[i].strFile, &targetFile, OF_EXIST) != HFILE_ERROR)
DeleteFile(m_FileList[i].strFile);
MoveFile(m_FileList[i].strLFile, m_FileList[i].strFile);
}
}
if(g_fAbortDownload)
{
m_bDownloadSucceeded = false;
PostMessage(WM_USER+1, IDCANCEL, NULL);
AfxEndThread(0);
}
}
PostMessage(WM_USER+1, 0, NULL);
AfxEndThread(0);
}
void cDownloaderDlg::OnDestroy()
{
if(m_bThreadDone)
CDialog::OnDestroy();
else
InterlockedExchange ( &g_fAbortDownload, 1 );
}
BOOL cDownloaderDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_bThreadDone = false;
g_fAbortDownload = 0;
SetWindowText("Updating Decal Components");
m_pWorkerThread = AfxBeginThread ( gThreadProc, this, THREAD_PRIORITY_NORMAL, 0, 0 );
m_wndProgressTotal.SetRange(0, m_FileList.size() * 100);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void cDownloaderDlg::ProgressUpdate ( LPCTSTR szIEMsg, LPCTSTR szCustomMsg, const int nPercentDone )
{
ASSERT ( AfxIsValidString ( szIEMsg ));
ASSERT ( AfxIsValidString ( szCustomMsg ));
ASSERT ( nPercentDone >= 0 && nPercentDone <= 100 );
static int nPercentOld = nPercentDone;
if(nPercentOld > nPercentDone)
nPercentOld = nPercentDone;
//m_stIEMsg.SetWindowText ( szIEMsg );
m_stCustomMsg.SetWindowText ( szCustomMsg );
m_wndProgress.SetPos ( nPercentDone );
m_wndProgressTotal.SetPos( m_wndProgressTotal.GetPos() + (nPercentDone-nPercentOld));
nPercentOld = nPercentDone;
static TCHAR szMsg [256];
StrFormatByteSize ( m_ulTotalData, szMsg, 256 );
}
void cDownloaderDlg::OnClose()
{
// TODO: Add your message handler code here and/or call default
if(m_bThreadDone)
CDialog::OnClose();
else
InterlockedExchange ( &g_fAbortDownload, 1 );
}
LRESULT cDownloaderDlg::OnEndDownload(WPARAM nID, LPARAM uMsg)
{
m_bThreadDone = true;
if((nID!=0) && (nID!=1))
EndDialog(nID);
else
{
CDialog::OnOK();
}
return 0;
}
cDownloaderDlg::DownloadStatus cDownloaderDlg::GetDownloadStatus()
{
if (m_bDownloadSucceeded)
return DownloadStatus::DOWNLOAD_SUCCEEDED;
else
return DownloadStatus::DOWNLOAD_FAILED;
}

View file

@ -0,0 +1,79 @@
#if !defined(AFX_DOWNLOADERDLG_H__EF5E9E0B_873E_4AFC_85D8_8F210D77AD79__INCLUDED_)
#define AFX_DOWNLOADERDLG_H__EF5E9E0B_873E_4AFC_85D8_8F210D77AD79__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DownloaderDlg.h : header file
//
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// cDownloaderDlg dialog
class cDownloaderDlg : public CDialog
{
// Construction
public:
enum DownloadStatus
{
DOWNLOAD_SUCCEEDED,
DOWNLOAD_FAILED
};
cDownloaderDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(cDownloaderDlg)
enum { IDD = IDD_DOWNLOADER };
CStatic m_stStatusTotalData;
CStatic m_stStatusTotal;
CButton m_wndStop;
CProgressCtrl m_wndProgress;
CProgressCtrl m_wndProgressTotal;
CStatic m_stIEMsg;
CStatic m_stCustomMsg;
//}}AFX_DATA
CLSID m_clsid;
CWinThread* m_pWorkerThread;
bool m_bThreadDone;
DownloadStatus GetDownloadStatus();
unsigned long m_ulTotalData;
void cDownloaderDlg::addFile(std::string remoteFile, std::string localFile);
void ProgressUpdate ( LPCTSTR szIEMsg, LPCTSTR szCustomMsg, const int nPercentDone );
void WorkerThreadProc();
LRESULT OnEndDownload(WPARAM nID, LPARAM uMsg);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(cDownloaderDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(cDownloaderDlg)
afx_msg void OnStopdownload();
afx_msg void OnDestroy();
virtual BOOL OnInitDialog();
afx_msg void OnClose();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
std::vector<FILELIST> m_FileList;
bool m_bDownloadSucceeded;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DOWNLOADERDLG_H__EF5E9E0B_873E_4AFC_85D8_8F210D77AD79__INCLUDED_)

View file

@ -0,0 +1,750 @@
// ExportDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DenAgent.h"
#include "ExportDlg.h"
#include "DenAgentDlg.h"
#include <strstream>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// cExportDlg dialog
cExportDlg::cExportDlg(CWnd* pParent /*=NULL*/)
: CDialog(cExportDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(cExportDlg)
//}}AFX_DATA_INIT
}
cExportDlg::~cExportDlg()
{
m_pDecal.Release();
}
void cExportDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(cExportDlg, CDialog)
//{{AFX_MSG_MAP(cExportDlg)
ON_BN_CLICKED(IDC_BTNEXPORT, OnBnClickedBtnexport)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// cExportDlg message handlers
BOOL cExportDlg::OnInitDialog()
{
CDialog::OnInitDialog();
::SendMessage( GetDlgItem( IDC_CHKENABLED )->m_hWnd, BM_SETCHECK, TRUE, 0 );
::SendMessage( GetDlgItem( IDC_CHKLOC )->m_hWnd, BM_SETCHECK, FALSE, 0 );
::SendMessage( GetDlgItem( IDC_CHKCLSID )->m_hWnd, BM_SETCHECK, TRUE, 0 );
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
struct cPluginGroup
{
LPCTSTR m_groupName,
m_groupKey;
int m_iconIndex;
};
void cExportDlg::AppendExportText(const char *szNewText)
{
int dwOldTextLength =::SendMessage(GetDlgItem(IDC_EDITEXPORT)->m_hWnd, WM_GETTEXTLENGTH, 0, 0) + 1;
int dwNewTextLength = strlen(szNewText) + 1;
char *szOldText = new char[dwOldTextLength];
memset(szOldText, 0, dwOldTextLength);
char *szBuffer = new char[dwOldTextLength + dwNewTextLength];
memset(szBuffer, 0, dwOldTextLength + dwNewTextLength);
::SendMessage(GetDlgItem(IDC_EDITEXPORT)->m_hWnd, WM_GETTEXT, dwOldTextLength, (LPARAM) szOldText);
if(dwOldTextLength > 0)
sprintf(szBuffer, "%s%s", szOldText, szNewText);
else
sprintf(szBuffer, "%s", szNewText);
::SendMessage(GetDlgItem(IDC_EDITEXPORT)->m_hWnd, WM_SETTEXT, 0, (LPARAM) szBuffer);
delete[]szBuffer;
delete[]szOldText;
}
void cExportDlg::OnBnClickedBtnexport()
{
USES_CONVERSION;
std::string szDelim = ", ";
// Set Cursor
HCURSOR hCurDefault = GetCursor();
HCURSOR hCurWaiting = LoadCursor(NULL, IDC_WAIT);
SetCursor(hCurWaiting);
// Drakier: Get plugins/filters/services/etc from decal
cPluginGroup _groups[] = {
{ _T( "Plugins" ), _T( "Plugins" ), 4 },
{ _T( "Network Filters" ), _T( "NetworkFilters" ), 1 },
{ _T( "File Filters" ), _T( "FileFilters" ), 1 },
{ _T( "Services" ), _T( "Services" ), 0 },
{ _T( "Surrogates" ), _T( "Surrogates" ), 3 },
{ _T( "Input Actions" ), _T( "InputActions" ), 2 } },
*_end_groups = _groups + sizeof ( _groups ) / sizeof ( cPluginGroup );
int nCount = 0;
std::string szOutput;
szOutput = "";
::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd,WM_SETTEXT, 0, (LPARAM)szOutput.c_str());
szOutput += "type, ";
if ( ::SendMessage( GetDlgItem( IDC_CHKENABLED )->m_hWnd, BM_GETCHECK, 0, 0 ) )
szOutput += "enabled, ";
szOutput += "name, version, ";
if ( ::SendMessage( GetDlgItem( IDC_CHKLOC )->m_hWnd, BM_GETCHECK, 0, 0 ) )
szOutput += "location, ";
if ( ::SendMessage( GetDlgItem( IDC_CHKCLSID )->m_hWnd, BM_GETCHECK, 0, 0 ) )
szOutput += "clsid";
szOutput += "\r\n";
AppendExportText(szOutput.c_str());
// Go through all the groups exporting their sub-lists
for ( cPluginGroup *i = _groups; i != _end_groups; ++ i )
{
CComPtr<IDecalEnum> pEnum;
HRESULT hRes = m_pDecal->get_Configuration ( _bstr_t ( i->m_groupKey ), GUID_NULL, &pEnum );
_ASSERTE( SUCCEEDED ( hRes ) );
// enum through all items in a group
while ( pEnum->Next () == S_OK )
{
szOutput = "";
CLSID clsid;
CComBSTR strName;
CString strDLL = "";
CString strDLLVersion = "";
LPOLESTR szCLSID;
hRes = pEnum->get_ComClass ( &clsid );
_ASSERTE ( SUCCEEDED ( hRes ) );
if (hRes == S_OK)
{
if ( CDenAgentApp::getCOMObjectDLL ( clsid, strDLL ) )
{
if ( !CDenAgentApp::getVersionString ( strDLL, strDLLVersion ) )
strDLLVersion = _T( "<No Version>" );
}
else
strDLL = _T( "<No DLL>" );
}
szOutput += i->m_groupName;
if ( ::SendMessage( GetDlgItem( IDC_CHKENABLED )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
VARIANT_BOOL bEnabled;
hRes = pEnum->get_Enabled ( &bEnabled );
_ASSERTE ( SUCCEEDED ( hRes ) );
szOutput += szDelim;
szOutput += bEnabled?"1":"0";
}
hRes = pEnum->get_FriendlyName( &strName );
_ASSERTE ( SUCCEEDED ( hRes ) );
szOutput += szDelim;
if (hRes == S_OK)
szOutput += OLE2T ( strName );
else
szOutput += "<No Name>";
szOutput += szDelim;
szOutput += strDLLVersion;
if ( ::SendMessage( GetDlgItem( IDC_CHKLOC )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
szOutput += szDelim;
szOutput += strDLL;
}
if ( ::SendMessage( GetDlgItem( IDC_CHKCLSID )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
szOutput += szDelim;
if ( StringFromCLSID(clsid, &szCLSID) == S_OK )
{
szOutput += OLE2T(szCLSID);
::CoTaskMemFree ( szCLSID );
}
else
szOutput += "<No CLSID>";
}
szOutput += "\r\n";
AppendExportText(szOutput.c_str());
}
}
// Drakier: Get the OS Version
szOutput = "\r\nOperating System:\r\n";
const int BUFSIZE = 80;
OSVERSIONINFOEX osvi;
BOOL bOsVersionInfoEx;
// Try calling GetVersionEx using the OSVERSIONINFOEX structure.
// If that fails, try using the OSVERSIONINFO structure.
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) )
{
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
GetVersionEx ( (OSVERSIONINFO *) &osvi);
}
switch (osvi.dwPlatformId)
{
// Test for the Windows NT product family.
case VER_PLATFORM_WIN32_NT:
// Test for the specific product family.
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
szOutput += "Microsoft Windows Server 2003 family, ";
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 )
szOutput += "Microsoft Windows XP ";
if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
szOutput += "Microsoft Windows 2000 ";
if ( osvi.dwMajorVersion <= 4 )
szOutput += "Microsoft Windows NT ";
// Test for specific product on Windows NT 4.0 SP6 and later.
if( bOsVersionInfoEx )
{
// Test for the workstation type.
if ( osvi.wProductType == VER_NT_WORKSTATION )
{
if( osvi.dwMajorVersion == 4 )
szOutput += "Workstation 4.0 ";
else if( osvi.wSuiteMask & VER_SUITE_PERSONAL )
szOutput += "Home Edition ";
else
szOutput += "Professional ";
}
// Test for the server type.
else if ( osvi.wProductType == VER_NT_SERVER )
{
if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
szOutput += "Datacenter Edition ";
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
szOutput += "Enterprise Edition ";
else if ( osvi.wSuiteMask == VER_SUITE_BLADE )
szOutput += "Web Edition ";
else
szOutput += "Standard Edition ";
}
else if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 )
{
if( osvi.wSuiteMask & VER_SUITE_DATACENTER )
szOutput += "Datacenter Server ";
else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
szOutput += "Advanced Server ";
else
szOutput += "Server ";
}
else // Windows NT 4.0
{
if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE )
szOutput += "Server 4.0, Enterprise Edition ";
else
szOutput += "Server 4.0 ";
}
}
}
else // Test for specific product on Windows NT 4.0 SP5 and earlier
{
HKEY hKey;
char szProductType[BUFSIZE];
DWORD dwBufLen=BUFSIZE;
LONG lRet;
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
0, KEY_QUERY_VALUE, &hKey );
if( lRet == ERROR_SUCCESS )
{
lRet = RegQueryValueEx( hKey, "ProductType", NULL, NULL,
(LPBYTE) szProductType, &dwBufLen);
if( (lRet == ERROR_SUCCESS) && (dwBufLen <= BUFSIZE) )
{
RegCloseKey( hKey );
if ( lstrcmpi( "WINNT", szProductType) == 0 )
szOutput += "Workstation ";
if ( lstrcmpi( "LANMANNT", szProductType) == 0 )
szOutput += "Server ";
if ( lstrcmpi( "SERVERNT", szProductType) == 0 )
szOutput += "Advanced Server ";
szOutput += (char)osvi.dwMajorVersion;
szOutput += ".";
szOutput += (char)osvi.dwMinorVersion;
}
}
}
// Display service pack (if any) and build number.
if( osvi.dwMajorVersion == 4 &&
lstrcmpi( osvi.szCSDVersion, "Service Pack 6" ) == 0 )
{
HKEY hKey;
LONG lRet;
// Test for SP6 versus SP6a.
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009",
0, KEY_QUERY_VALUE, &hKey );
if( lRet == ERROR_SUCCESS )
{
char szBuild[6]; //might make it a bit longer
memset(szBuild, 0, 6);
ltoa(osvi.dwBuildNumber & 0xFFFF, szBuild, 10);
szOutput += "Service Pack 6a (Build ";
szOutput += szBuild;
szOutput += ")\r\n";
}
else // Windows NT 4.0 prior to SP6a
{
char szBuild[6]; //might make it a bit longer
memset(szBuild, 0, 6);
ltoa(osvi.dwBuildNumber & 0xFFFF, szBuild, 10);
szOutput += osvi.szCSDVersion;
szOutput += " (Build ";
szOutput += szBuild;
szOutput += ")\r\n";
}
RegCloseKey( hKey );
}
else // Windows NT 3.51 and earlier or Windows 2000 and later
{
char szBuild[6]; //might make it a bit longer
memset(szBuild, 0, 6);
ltoa(osvi.dwBuildNumber & 0xFFFF, szBuild, 10);
szOutput += osvi.szCSDVersion;
szOutput += " (Build ";
szOutput += szBuild;
szOutput += ")\r\n";
}
break;
// Test for the Windows 95 product family.
case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
{
szOutput += "Microsoft Windows 95 ";
if ( osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B' )
szOutput += "OSR2 ";
}
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
{
szOutput += "Microsoft Windows 98 ";
if ( osvi.szCSDVersion[1] == 'A' )
szOutput += "SE ";
}
if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
{
szOutput += "Microsoft Windows Millennium Edition\r\n";
}
break;
case VER_PLATFORM_WIN32s:
szOutput += "Microsoft Win32s\r\n";
break;
}
AppendExportText(szOutput.c_str());
// Drakier: Check the Protected Storage
RegKey key;
if ( key.Open( HKEY_LOCAL_MACHINE, _T( "SYSTEM\\CurrentControlSet\\Services\\ProtectedStorage" ) ) == ERROR_SUCCESS )
{
DWORD dwStartMode;
szOutput = "\r\n[Protected Storage Service] : ";
if ( key.QueryDWORDValue( "Start", dwStartMode ) == ERROR_SUCCESS )
{
switch (dwStartMode)
{
case 2: //automatic
szOutput += "Automatic\r\n";
break;
case 3: // manual
szOutput += "Manual\r\n";
break;
case 4: // disabled
szOutput += "Disabled\r\n";
break;
}
}
key.Close();
AppendExportText(szOutput.c_str());
}
// Drakier: Get the Injection Mode
if( key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" )) == ERROR_SUCCESS )
{
DWORD dwViewMode;
szOutput = "\r\n[Injection Method] : ";
if( key.QueryDWORDValue( "OldInjection", dwViewMode )== ERROR_SUCCESS )
{
if (dwViewMode == 1)
{
szOutput += "OLD\r\n";
}
else
{
szOutput += "NEW\r\n";
}
}
else
szOutput += "Error Reading Key";
key.Close();
AppendExportText(szOutput.c_str());
}
// Drakier: Get the Runtime versions (if installed).
szOutput = "\r\nRuntime Libraries\r\n";
AppendExportText(szOutput.c_str());
// Visual Basic 6 Runtimes
szOutput = "[msvbvm60.dll]\t: ";
HMODULE hLib = ::LoadLibrary( "msvbvm60.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// msvcp 7.0 Runtime
szOutput = "[msvcr70.dll]\t: ";
hLib = ::LoadLibrary( "msvcr70.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// msvcr 7.0 Runtime
szOutput = "[msvcp70.dll]\t: ";
hLib = ::LoadLibrary( "msvcp70.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// msvcp 7.1 Runtime
szOutput = "[msvcr71.dll]\t: ";
hLib = ::LoadLibrary( "msvcr71.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// msvcr 7.1 Runtime
szOutput = "[msvcp71.dll]\t: ";
hLib = ::LoadLibrary( "msvcp71.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// Haz - mfc+atl
// mfc 7.0 runtime
szOutput = "[mfc70.dll]\t: ";
hLib = ::LoadLibrary( "mfc70.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// mfc 7.1 runtime
szOutput = "[mfc71.dll]\t: ";
hLib = ::LoadLibrary( "mfc71.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// atl 7.0 runtime
szOutput = "[atl70.dll]\t\t: ";
hLib = ::LoadLibrary( "atl70.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// atl 7.1 runtime
szOutput = "[atl71.dll]\t\t: ";
hLib = ::LoadLibrary( "atl71.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// Drakier: Get the MSXML Versions
szOutput = "\r\nMicrosoft XML Libraries\r\n";
AppendExportText(szOutput.c_str());
// msxml3
szOutput = "[msxml3.dll]\t: ";
hLib = ::LoadLibrary( "msxml3.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// msxml4
szOutput = "[msxml4.dll]\t: ";
hLib = ::LoadLibrary( "msxml4.dll" );
if( hLib == NULL )
szOutput += "Not Installed\r\n";
else
{
char strDllFilePath[MAX_PATH] = {""};
CString strDLLVersion = "";
GetModuleFileName(hLib, strDllFilePath, MAX_PATH);
if ( !CDenAgentApp::getVersionString ( strDllFilePath, strDLLVersion ) )
strDLLVersion = _T( "(No Version)" );
else
{
szOutput += "Installed (";
szOutput += strDLLVersion;
szOutput += ")\r\n";
}
}
::FreeLibrary(hLib);
AppendExportText(szOutput.c_str());
// Drakier: Get the Compat Mode Layers and display them.
if (key.Open( HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers" ) == ERROR_SUCCESS)
{
RegKey hkItem;
DWORD dwIndex = 0;
DWORD dwValues = NULL;
BOOL bTitle = FALSE;
// Enum regkey for AppCompatFlags checking for client.exe
::RegQueryInfoKey(key, NULL, NULL, NULL, NULL, NULL, NULL, &dwValues, NULL, NULL, NULL, NULL);
if (dwValues)
{
HRESULT retCode = ERROR_SUCCESS;
for (dwIndex = 0; dwIndex < dwValues; dwIndex++)
{
DWORD dwValueNameLen = 255;
DWORD dwValueDataLen = 10;
TCHAR szValueName[255];
BYTE szValueData[10];
//TCHAR szValueData[10];
DWORD dwType;
retCode = ::RegEnumValue ( key, dwIndex, szValueName, &dwValueNameLen, NULL, &dwType, szValueData, &dwValueDataLen );
if ( retCode == ERROR_SUCCESS)
{
if ( strstr(szValueName, "client.exe") != NULL )
{
if (!bTitle)
szOutput = "\r\nApplication Compatibility\r\n";
bTitle = TRUE;
szOutput += szValueName;
szOutput += ": ";
szOutput += (char *)szValueData;
szOutput += "\r\n";
}
}
}
AppendExportText(szOutput.c_str());
}
}
key.Close();
// Set Cursor back...
SetCursor(hCurDefault);
// Display information
if (::MessageBox(NULL, "Would you like to export the data to the clipboard?", "Export Data...", MB_YESNO | MB_ICONQUESTION) == IDYES )
{
if(OpenClipboard())
{
DWORD dwTextLength = ::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_GETTEXTLENGTH, 0, 0) + 1;
char *szCBText = new char[dwTextLength];
memset(szCBText, 0, dwTextLength);
::SendMessage( GetDlgItem( IDC_EDITEXPORT )->m_hWnd, WM_GETTEXT, dwTextLength, (LPARAM)szCBText );
HGLOBAL hData;
LPVOID pData;
EmptyClipboard();
hData = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE,strlen(szCBText) + 1);
pData = GlobalLock(hData);
strcpy((LPSTR)pData, szCBText);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
CloseClipboard();
delete[] szCBText;
}
else
::MessageBox(NULL, "Error opening clipboard!", "Error...", MB_OK | MB_ICONERROR);
}
}
void cExportDlg::SetDecal(IDecal* pDecal)
{
m_pDecal = pDecal;
}

View file

@ -0,0 +1,56 @@
#include "afxwin.h"
#if !defined(AFX_EXPORTDLG_H__F2DBFC10_6835_494D_9A03_B97D9068BAF9__INCLUDED_)
#define AFX_EXPORTDLG_H__F2DBFC10_6835_494D_9A03_B97D9068BAF9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <Decal.h>
// ExportDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// cExportDlg dialog
class cExportDlg : public CDialog
{
// Construction
public:
cExportDlg(CWnd* pParent = NULL); // standard constructor
~cExportDlg();
// Dialog Data
//{{AFX_DATA(cExportDlg)
enum { IDD = IDD_EXPORT };
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(cExportDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(cExportDlg)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
void SetDecal(IDecal* pDecal);
void AppendExportText(const char* szNewText);
CComPtr<IDecal> m_pDecal;
afx_msg void OnBnClickedBtnexport();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ExportDlg_H__F2DBFC10_6835_494D_9A03_B97D9068BAF9__INCLUDED_)

BIN
Native/DenAgent/Images.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -0,0 +1,553 @@
// OptionsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DenAgent.h"
#include "OptionsDlg.h"
#include "ChangePluginDirectory.h"
#include <strstream>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// cOptionsDlg dialog
cOptionsDlg::cOptionsDlg(CWnd* pParent /*=NULL*/)
: CDialog(cOptionsDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(cOptionsDlg)
m_nBarAlpha = 0;
m_nViewAlpha = 0;
m_nFontChoice = 0;
m_szCustomFont = _T("");
//}}AFX_DATA_INIT
// Default Decal and AC Client Font
m_szDefaultFont = "Times New Roman";
m_szACClientFont = "Times New Roman";
}
void cOptionsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(cOptionsDlg)
DDX_Control(pDX, IDC_CUSTOM_FONT_EDIT, m_CustomFontEdit);
DDX_Control(pDX, IDC_VIEWALPHA_SPIN, m_ViewAlphaSpin);
DDX_Control(pDX, IDC_BARALPHA_SPIN, m_BarAlphaSpin);
DDX_Control(pDX, IDC_BARALPHA, m_BarAlpha);
DDX_Control(pDX, IDC_VIEWALPHA, m_ViewAlpha);
DDX_Control(pDX, IDC_PLUGINDIR, m_Url);
DDX_Text(pDX, IDC_BARALPHA, m_nBarAlpha);
DDV_MinMaxInt(pDX, m_nBarAlpha, 0, 255);
DDX_Text(pDX, IDC_VIEWALPHA, m_nViewAlpha);
DDV_MinMaxInt(pDX, m_nViewAlpha, 0, 255);
DDX_Radio(pDX, IDC_DEFAULT_FONT_RADIO, m_nFontChoice);
DDX_Text(pDX, IDC_CUSTOM_FONT_EDIT, m_szCustomFont);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(cOptionsDlg, CDialog)
//{{AFX_MSG_MAP(cOptionsDlg)
ON_BN_CLICKED(IDC_CHANGE_DIR, OnChangeDir)
ON_BN_CLICKED(IDC_BTN_RESET, OnReset)
ON_BN_CLICKED(IDC_DEFAULT_FONT_RADIO, OnDefaultFontRadio)
ON_BN_CLICKED(IDC_CLIENT_FONT_RADIO, OnClientFontRadio)
ON_BN_CLICKED(IDC_CUSTOM_FONT_RADIO, OnCustomFontRadio)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_OLDINJECT, OnBnClickedOldInject)
ON_BN_CLICKED(IDC_TIMESTAMPON, OnBnClickedTimestampon)
ON_BN_CLICKED(IDC_FORMATHELP, OnBnClickedFormathelp)
ON_BN_CLICKED(IDC_PATCHHELP, OnBnClickedPatchHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// cOptionsDlg message handlers
BOOL cOptionsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_bClientPatchesEnabled = true;
// TODO: Add extra initialization here
RegKey key;
if( key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" )) != ERROR_SUCCESS )
return TRUE;
// Force spin ranges
m_ViewAlphaSpin.SetRange(0, 255);
m_BarAlphaSpin.SetRange(0, 255);
DWORD alpha;
if(key.QueryDWORDValue("BarAlpha", alpha)==ERROR_SUCCESS)
{
m_nBarAlpha = alpha;
//CString csa;
//csa.Format("%d", alpha);
//m_BarAlpha.SetWindowText(csa);
}
else
m_nBarAlpha = 255;
//m_BarAlpha.SetWindowText("255");
if(key.QueryDWORDValue("ViewAlpha", alpha)==ERROR_SUCCESS)
{
m_nViewAlpha = alpha;
//CString csa;
//csa.Format("%d", alpha);
//m_ViewAlpha.SetWindowText(csa);
}
else
m_nViewAlpha = 255;
//m_ViewAlpha.SetWindowText("255");
DWORD dwRadarDraw = 1;
key.QueryDWORDValue( "BarRadarDraw", dwRadarDraw );
//::SendMessage( GetDlgItem( IDC_RADARNO )->m_hWnd, BM_SETCHECK, !dwRadarDraw, 0 );
::SendMessage( GetDlgItem( IDC_RADARYES )->m_hWnd, BM_SETCHECK, !dwRadarDraw, 0 );
DWORD dwTimestamp = 0;
key.QueryDWORDValue( "Timestamp", dwTimestamp );
//::SendMessage( GetDlgItem( IDC_TIMESTAMPOFF )->m_hWnd, BM_SETCHECK, !dwTimestamp, 0 );
::SendMessage( GetDlgItem( IDC_TIMESTAMPON )->m_hWnd, BM_SETCHECK, dwTimestamp, 0 );
//setup timestamp options
::SendMessage( GetDlgItem( IDC_FORMATSTR )->m_hWnd, EM_SETLIMITTEXT, MAX_PATH - 1, 0 );
::EnableWindow( GetDlgItem( IDC_FORMATSTR )->m_hWnd, dwTimestamp );
::EnableWindow( GetDlgItem( IDC_FORMATCLR )->m_hWnd, dwTimestamp );
DWORD dwTSColor = 12;
key.QueryDWORDValue( "TimestampColor", dwTSColor );
::SendMessage( GetDlgItem( IDC_FORMATCLR )->m_hWnd, CB_SETCURSEL, ++dwTSColor, 0 );
DWORD dwDockPos = 0;
key.QueryDWORDValue( "BarDock", dwDockPos );
::SendMessage( GetDlgItem( IDC_DOCKPOS )->m_hWnd, CB_SETCURSEL, dwDockPos, 0 );
char szFormat[MAX_PATH];
DWORD dwFormatLen = MAX_PATH;
if( key.QueryStringValue( "TimestampFormat", szFormat, &dwFormatLen ) != ERROR_SUCCESS ) //just thieved from achooks
memset( szFormat, 0, sizeof(szFormat) ), strncpy( szFormat, "[%H:%M]", sizeof( szFormat ) );
::SendMessage( GetDlgItem( IDC_FORMATSTR )->m_hWnd, WM_SETTEXT, 0, (LPARAM)szFormat );
// Get font type
DWORD dwFontType;
if (key.QueryDWORDValue("FontType", dwFontType) == ERROR_SUCCESS)
{
m_nFontChoice = (int) dwFontType;
}
// Get the custom font name (might not be enabled)
TCHAR szFontName[512];
DWORD dwCount = 512;
if (key.QueryStringValue("FontName", szFontName, &dwCount) == ERROR_SUCCESS)
{
m_szCustomFont = szFontName;
}
DWORD dwAlphaBlendMode;
// para - dialog clean up
if(key.QueryDWORDValue("AlphaBlendMode", dwAlphaBlendMode)==ERROR_SUCCESS)
if(dwAlphaBlendMode==0x2)
::SendMessage(GetDlgItem(IDC_BLENDINGGDIPLUS)->m_hWnd, BM_SETCHECK, 1, 0);
DWORD dwViewMode;
// para - dialog clean up
if( key.QueryDWORDValue( "ViewMode", dwViewMode )== ERROR_SUCCESS )
if( dwViewMode == 1 )
::SendMessage( GetDlgItem( IDC_VIEWMULTI )->m_hWnd, BM_SETCHECK, 1, 0 );
if( key.QueryDWORDValue( "AllowWindowed", dwViewMode )== ERROR_SUCCESS )
if( dwViewMode == 1 )
{
::SendMessage( GetDlgItem( IDC_WINDOWED )->m_hWnd, BM_SETCHECK, 1, 0 );
}
if( key.QueryDWORDValue( "AllowDualLog", dwViewMode )== ERROR_SUCCESS )
if( dwViewMode == 1 )
{
::SendMessage( GetDlgItem( IDC_DUALLOG )->m_hWnd, BM_SETCHECK, 1, 0 );
}
if( key.QueryDWORDValue( "NoMovies", dwViewMode )== ERROR_SUCCESS )
if( dwViewMode == 1 )
{
::SendMessage( GetDlgItem( IDC_NOMOVIES )->m_hWnd, BM_SETCHECK, 1, 0 );
}
if( key.QueryDWORDValue( "NoSplash", dwViewMode )== ERROR_SUCCESS )
if( dwViewMode == 1 )
{
::SendMessage( GetDlgItem( IDC_NOLOGOS )->m_hWnd, BM_SETCHECK, 1, 0 );
}
if( key.QueryDWORDValue( "OldInjection", dwViewMode )== ERROR_SUCCESS )
if( dwViewMode == 1 )
{
::SendMessage( GetDlgItem( IDC_OLDINJECT )->m_hWnd, BM_SETCHECK, 1, 0 );
m_bClientPatchesEnabled = true;
::EnableWindow( GetDlgItem( IDC_WINDOWED )->m_hWnd, FALSE );
::EnableWindow( GetDlgItem( IDC_DUALLOG )->m_hWnd, FALSE );
}
key.Close();
if( key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Agent" )) != ERROR_SUCCESS )
return TRUE;
TCHAR szURLDirectory[ 1024 ];
DWORD dwSize = 1024;
if(key.QueryStringValue( _T( "DecalDirectory" ), szURLDirectory, &dwSize )==ERROR_SUCCESS)
m_Url.SetWindowText(szURLDirectory);
else
{
key.SetStringValue("DecalDirectory", "http://decal.acdev.org");
m_Url.SetWindowText("http://decal.acdev.org");
}
RegKey k;
k.Create(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"));
TCHAR szPath[ MAX_PATH ];
DWORD dwPathSize = MAX_PATH;
if (k.QueryStringValue("Decal", szPath, &dwPathSize) == ERROR_SUCCESS) {
::SendMessage(GetDlgItem(IDC_CHECK_AUTOSTART)->m_hWnd, BM_SETCHECK, 1, 0);
}
k.Close();
// Get the AC Client font
k.Create(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Microsoft\\Microsoft Games\\Asheron's Call\\1.00"));
dwCount = 512;
if (k.QueryStringValue("Font", szFontName, &dwCount) == ERROR_SUCCESS)
{
m_szACClientFont = szFontName;
}
k.Close();
UpdateData(FALSE);
UpdateCustomEdit();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void cOptionsDlg::OnOK()
{
UpdateData(TRUE);
RegKey key;
key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" ) );
CString csa;
m_BarAlpha.GetWindowText(csa);
DWORD alpha = atoi(csa);
if((alpha<0) || (alpha>255))
alpha = 255;
key.SetDWORDValue("BarAlpha", alpha);
m_ViewAlpha.GetWindowText(csa);
alpha = atoi(csa);
if((alpha<0) || (alpha>255))
alpha = 255;
key.SetDWORDValue("ViewAlpha", alpha);
DWORD dwRadarDraw = 1;
key.QueryDWORDValue( "BarRadarDraw", dwRadarDraw );
if( ::SendMessage( GetDlgItem( IDC_RADARYES )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
key.SetDWORDValue( "BarRadarDraw", (DWORD)0 );
// Drakier: No longer need BarDelta
//if( dwRadarDraw )
//key.SetDWORDValue( "BarDelta", (DWORD)0 );
}
else
{
key.SetDWORDValue( "BarRadarDraw", (DWORD)1 );
// Drakier: No longer need BarDelta
//if( !dwRadarDraw )
//key.SetDWORDValue( "BarDelta", (DWORD)0 );
}
DWORD dwTimestamp = 1;
key.QueryDWORDValue( "Timestamp", dwTimestamp );
if( ::SendMessage( GetDlgItem( IDC_TIMESTAMPON )->m_hWnd, BM_GETCHECK, 0, 0 ) )
key.SetDWORDValue( "Timestamp", (DWORD)1 );
else
key.SetDWORDValue( "Timestamp", (DWORD)0 );
DWORD dwColor = ::SendMessage(GetDlgItem(IDC_FORMATCLR)->m_hWnd, CB_GETCURSEL, 0, 0);
key.SetDWORDValue( "TimestampColor", --dwColor );
DWORD dwDockPos = ::SendMessage(GetDlgItem(IDC_DOCKPOS)->m_hWnd, CB_GETCURSEL, 0, 0);
key.SetDWORDValue( "BarDock", dwDockPos);
char szFormat[MAX_PATH];
::SendMessage( GetDlgItem(IDC_FORMATSTR)->m_hWnd, WM_GETTEXT, MAX_PATH, (LPARAM)szFormat);
key.SetStringValue( "TimestampFormat", szFormat );
if(::SendMessage(GetDlgItem(IDC_BLENDINGGDIPLUS)->m_hWnd, BM_GETCHECK, 0, 0))
key.SetDWORDValue("AlphaBlendMode", 0x2L);
else
key.SetDWORDValue("AlphaBlendMode", 0x1L);
bool bMessage = false;
DWORD dwViewMode = 0;
if( ::SendMessage( GetDlgItem( IDC_WINDOWED )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
// enabled, but old inject is on
if( ! m_bClientPatchesEnabled )
MessageBox( "One drawback of the old injection method is that Decal is not loaded before Asheron's Call.\nThis means any client patches will not work.", "Decal Agent", MB_OK ), bMessage = true;
key.SetDWORDValue( "AllowWindowed", 0x1L );
}
else
key.SetDWORDValue( "AllowWindowed", 0x0L );
if( ::SendMessage( GetDlgItem( IDC_DUALLOG )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
// enabled, but old inject is on
if( ! m_bClientPatchesEnabled )
if( ! bMessage )
MessageBox( "One drawback of the old injection method is that Decal is not loaded before Asheron's Call.\nThis means any client patches will not work.", "Decal Agent", MB_OK ), bMessage = true;
key.SetDWORDValue( "AllowDualLog", 0x1L );
}
else
key.SetDWORDValue( "AllowDualLog", 0x0L );
if( ::SendMessage( GetDlgItem( IDC_NOLOGOS )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
// enabled, but old inject is on
if( ! m_bClientPatchesEnabled )
if( ! bMessage )
MessageBox( "One drawback of the old injection method is that Decal is not loaded before Asheron's Call.\nThis means any client patches will not work.", "Decal Agent", MB_OK ), bMessage = true;
key.SetDWORDValue( "NoMovies", 0x1L );
}
else
key.SetDWORDValue( "NoMovies", 0x0L );
if( ::SendMessage( GetDlgItem( IDC_NOLOGOS )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
// enabled, but old inject is on
if( ! m_bClientPatchesEnabled )
if( ! bMessage )
MessageBox( "One drawback of the old injection method is that Decal is not loaded before Asheron's Call.\nThis means any client patches will not work.", "Decal Agent", MB_OK ), bMessage = true;
key.SetDWORDValue( "NoSplash", 0x1L );
}
else
key.SetDWORDValue( "NoSplash", 0x0L );
// cbt hook injection
if( ::SendMessage(GetDlgItem(IDC_OLDINJECT)->m_hWnd, BM_GETCHECK, 0, 0) )
{
if( key.QueryDWORDValue( "OldInjection", dwViewMode ) == ERROR_SUCCESS )
{
if( dwViewMode != 1 )
{
key.SetDWORDValue("OldInjection", 0x1L);
MessageBox( "You must restart DenAgent for injection method changes to take effect!", "DenAgent", MB_OK );
}
}
else
{
key.SetDWORDValue("OldInjection", 0x1L);
MessageBox( "You must restart DenAgent for injection method changes to take effect!", "DenAgent", MB_OK );
}
}
else
{
if( key.QueryDWORDValue( "OldInjection", dwViewMode ) == ERROR_SUCCESS )
if( dwViewMode != 0 )
{
key.SetDWORDValue("OldInjection", 0x0L);
MessageBox( "You must restart DenAgent for injection method changes to take effect!", "DenAgent", MB_OK );
}
}
// para - dropped viewsingle, switched around
if( ::SendMessage( GetDlgItem( IDC_VIEWMULTI )->m_hWnd, BM_GETCHECK, 0, 0 ) )
key.SetDWORDValue( "ViewMode", (DWORD) 1L );
else
key.SetDWORDValue( "ViewMode", 0L );
// Set the font info
key.SetDWORDValue("FontType", (DWORD)m_nFontChoice);
key.SetStringValue("FontName", (LPCTSTR)m_szCustomFont);
key.Close();
// Auto-Start on Bootup
RegKey k;
k.Create(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"));
if (::SendMessage(GetDlgItem(IDC_CHECK_AUTOSTART)->m_hWnd, BM_GETCHECK, 0, 0)) {
std::string szCmdLine = GetCommandLine();
if (szCmdLine[0] == '\"' && szCmdLine[szCmdLine.length() - 2] == '\"') {
szCmdLine.erase((int)0, 1); // STL is odd
szCmdLine.erase(szCmdLine.length() - 2, 1);
}
k.SetStringValue("Decal", szCmdLine.data());
}
else {
k.DeleteValue("Decal");
}
k.Close();
CDialog::OnOK();
}
void cOptionsDlg::OnChangeDir()
{
// TODO: Add your control notification handler code here
cChangePluginDirectory cpddlg(this);
if(cpddlg.DoModal() == IDOK )
{
RegKey keyAgent;
if( keyAgent.Open( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Agent" ), KEY_READ ) == ERROR_SUCCESS )
{
TCHAR szURLDirectory[ 1024 ];
DWORD dwSize = 1024;
keyAgent.QueryStringValue( _T( "DecalDirectory" ), szURLDirectory, &dwSize );
m_Url.SetWindowText(szURLDirectory);
}
}
}
void cOptionsDlg::OnReset()
{
RegKey key;
if( key.Create( HKEY_LOCAL_MACHINE, "Software\\Decal", REG_NONE, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS ) != ERROR_SUCCESS )
return;
//key.DeleteValue( _T( "BarDelta" ) );
// Drakier: New Bar stuff
key.DeleteValue( _T( "BarLength" ) );
key.DeleteValue( _T( "BarStart" ) );
::AfxMessageBox( _T( "The Decal bar's position has been reset." ), MB_ICONINFORMATION | MB_OK, 0 );
}
void cOptionsDlg::UpdateCustomEdit(void)
{
UpdateData(TRUE);
// Enable for editing only for custom font only
m_CustomFontEdit.SetReadOnly(m_nFontChoice != 2);
// Update the font name as needed
switch (m_nFontChoice)
{
case 0: // Default Font
{
m_szCustomFont = m_szDefaultFont;
}
break;
case 1: // Current AC Client Font
{
m_szCustomFont = m_szACClientFont;
}
break;
}
UpdateData(FALSE);
}
void cOptionsDlg::OnDefaultFontRadio()
{
UpdateCustomEdit();
}
void cOptionsDlg::OnClientFontRadio()
{
UpdateCustomEdit();
}
void cOptionsDlg::OnCustomFontRadio()
{
UpdateCustomEdit();
}
void cOptionsDlg::OnBnClickedOldInject()
{
if( ::SendMessage( GetDlgItem( IDC_OLDINJECT )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
::EnableWindow( GetDlgItem( IDC_WINDOWED )->m_hWnd, FALSE );
::EnableWindow( GetDlgItem( IDC_DUALLOG )->m_hWnd, FALSE );
::EnableWindow( GetDlgItem( IDC_NOMOVIES )->m_hWnd, FALSE );
::EnableWindow( GetDlgItem( IDC_NOLOGOS )->m_hWnd, FALSE );
m_bClientPatchesEnabled = false;
}
else
{
::EnableWindow( GetDlgItem( IDC_WINDOWED )->m_hWnd, TRUE );
::EnableWindow( GetDlgItem( IDC_DUALLOG )->m_hWnd, TRUE );
::EnableWindow( GetDlgItem( IDC_NOMOVIES )->m_hWnd, TRUE );
::EnableWindow( GetDlgItem( IDC_NOLOGOS )->m_hWnd, TRUE );
m_bClientPatchesEnabled = true;
}
}
void cOptionsDlg::OnBnClickedTimestampon()
{
//we need to activate the options when this is enabled
if( ::SendMessage( GetDlgItem( IDC_TIMESTAMPON )->m_hWnd, BM_GETCHECK, 0, 0 ) )
{
::EnableWindow( GetDlgItem( IDC_FORMATSTR )->m_hWnd, true );
::EnableWindow( GetDlgItem( IDC_FORMATCLR )->m_hWnd, true );
}
else
{
::EnableWindow( GetDlgItem( IDC_FORMATSTR )->m_hWnd, false );
::EnableWindow( GetDlgItem( IDC_FORMATCLR )->m_hWnd, false );
}
}
void cOptionsDlg::OnBnClickedFormathelp()
{
//open up ie and point at.... <Heyus> TimestampFormat.htm
ShellExecute(m_hWnd, _T("open"), _T("http://decal.acdev.org/TimestampFormat.htm"), 0, 0, 0);
}
void cOptionsDlg::OnBnClickedPatchHelp()
{
ShellExecute(m_hWnd, _T("open"), _T("http://decal.acdev.org/clientpatchinfo.html"), 0, 0, 0);
}

View file

@ -0,0 +1,74 @@
#include "afxwin.h"
#if !defined(AFX_OPTIONSDLG_H__F2DBFC10_6835_494D_9A03_B97D9068BAF9__INCLUDED_)
#define AFX_OPTIONSDLG_H__F2DBFC10_6835_494D_9A03_B97D9068BAF9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// OptionsDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// cOptionsDlg dialog
class cOptionsDlg : public CDialog
{
// Construction
public:
cOptionsDlg(CWnd* pParent = NULL); // standard constructor
void UpdateCustomEdit(void);
CString m_szDefaultFont;
CString m_szACClientFont;
// Dialog Data
//{{AFX_DATA(cOptionsDlg)
enum { IDD = IDD_OPTIONS };
CEdit m_CustomFontEdit;
CSpinButtonCtrl m_ViewAlphaSpin;
CSpinButtonCtrl m_BarAlphaSpin;
CEdit m_BarAlpha;
CEdit m_ViewAlpha;
CStatic m_Url;
int m_nBarAlpha;
int m_nViewAlpha;
int m_nFontChoice;
CString m_szCustomFont;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(cOptionsDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
bool m_bClientPatchesEnabled;
// Generated message map functions
//{{AFX_MSG(cOptionsDlg)
virtual BOOL OnInitDialog();
virtual void OnOK();
afx_msg void OnChangeDir();
afx_msg void OnReset();
afx_msg void OnDefaultFontRadio();
afx_msg void OnClientFontRadio();
afx_msg void OnCustomFontRadio();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedOldInject();
afx_msg void OnBnClickedCheckAutostart();
afx_msg void OnBnClickedTimestampon();
afx_msg void OnBnClickedFormathelp();
afx_msg void OnBnClickedPatchHelp();
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_OPTIONSDLG_H__F2DBFC10_6835_494D_9A03_B97D9068BAF9__INCLUDED_)

View file

@ -0,0 +1,88 @@
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : DenAgent
========================================================================
AppWizard has created this DenAgent application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your DenAgent application.
DenAgent.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
DenAgent.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CDenAgentApp application class.
DenAgent.cpp
This is the main application source file that contains the application
class CDenAgentApp.
DenAgent.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Visual C++.
DenAgent.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
res\DenAgent.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file DenAgent.rc.
res\DenAgent.rc2
This file contains resources that are not edited by Microsoft
Visual C++. You should place all resources not editable by
the resource editor in this file.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one dialog class:
DenAgentDlg.h, DenAgentDlg.cpp - the dialog
These files contain your CDenAgentDlg class. This class defines
the behavior of your application's main dialog. The dialog's
template is in DenAgent.rc, which can be edited in Microsoft
Visual C++.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named DenAgent.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Visual C++ reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC42XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC42DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////

View file

View file

@ -0,0 +1,5 @@
// stdafx.cpp : source file that includes just the standard includes
// DenAgent.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

64
Native/DenAgent/StdAfx.h Normal file
View file

@ -0,0 +1,64 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__017FA8D0_FE44_43D6_956B_FB615165AF2B__INCLUDED_)
#define AFX_STDAFX_H__017FA8D0_FE44_43D6_956B_FB615165AF2B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WINVER 0x0410
#define _WIN32_DCOM
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#pragma warning(disable:4530)
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <vector>
#include <atlbase.h>
#include <comdef.h>
#include <atlcrypt.h>
#define _ATL_APARTMENT_THREADED
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
class CDenAgentModule : public CComModule
{
public:
LONG Unlock();
LONG Lock();
LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2);
DWORD dwThreadID;
};
extern CDenAgentModule _Module;
#include <atlcom.h>
#import <msxml.dll>
#include <list>
#include <string>
#include "../include/Helpers.h"
extern LONG g_fAbortDownload;
struct FILELIST { CString strFile; CString strLFile; };
//extern FILELIST g_FileList[3];
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__017FA8D0_FE44_43D6_956B_FB615165AF2B__INCLUDED_)

507
Native/DenAgent/TrayWnd.cpp Normal file
View file

@ -0,0 +1,507 @@
// TrayWnd.cpp : implementation file
//
#include "stdafx.h"
#include "DenAgent.h"
#include "TrayWnd.h"
#include "..\Inject\InjectApi.h"
#include "forcelib.h"
#include "DenAgentDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define ID_SYSTRAY 1
#define NM_SYSTRAY ( WM_USER + 1000 )
const UINT s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated"));
bool g_bOldInject;
// Inject Enable/Inject Disable function pointers
typedef void (*VoidNoParams)();
VoidNoParams InjEnable = NULL;
VoidNoParams InjDisable = NULL;
// HMODULE for Inject dll
HMODULE g_hInj = NULL;
// This is for our windows enumeration process
BOOL CALLBACK EnumerationCallbackProc( HWND, LPARAM );
CTrayWnd* CTrayWnd::s_pWnd = NULL;
/////////////////////////////////////////////////////////////////////////////
// CTrayWnd
CTrayWnd::CTrayWnd()
: m_pDialog( NULL ), m_uiTimer( NULL )
{
s_pWnd = this;
}
CTrayWnd::~CTrayWnd()
{
s_pWnd = NULL;
}
BEGIN_MESSAGE_MAP(CTrayWnd, CWnd)
//{{AFX_MSG_MAP(CTrayWnd)
ON_WM_CREATE()
ON_WM_DESTROY()
ON_WM_TIMER()
ON_COMMAND(ID_SYSTRAY_CONFIGURE, OnSystrayConfigure)
ON_COMMAND(ID_SYSTRAY_EXIT, OnSystrayExit)
ON_REGISTERED_MESSAGE(s_uTaskbarRestart, OnTaskbarRestart)
//}}AFX_MSG_MAP
ON_MESSAGE(NM_SYSTRAY, OnSysTray)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTrayWnd message handlers
LRESULT CTrayWnd::OnTaskbarRestart(WPARAM, LPARAM)
{
NOTIFYICONDATA nid;
::memset( &nid, 0, sizeof( NOTIFYICONDATA ) );
nid.cbSize = sizeof( NOTIFYICONDATA );
nid.hWnd = m_hWnd;
nid.uID = ID_SYSTRAY;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = NM_SYSTRAY;
nid.hIcon = AfxGetApp()->LoadIcon( IDR_TRAYICON );
::_tcscpy( nid.szTip, _T( "Decal Agent" ) );
::Shell_NotifyIcon( NIM_DELETE, &nid );
::Shell_NotifyIcon( NIM_ADD, &nid );
DestroyIcon(nid.hIcon);
return TRUE;
}
void CTrayWnd::showDialog()
{
if( m_pDialog == NULL )
{
CDenAgentDlg dlg;
m_pDialog = &dlg;
dlg.DoModal();
m_pDialog = NULL;
}
else
{
m_pDialog->SetForegroundWindow();
m_pDialog->BringWindowToTop();
}
}
int CTrayWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
::CoInitialize( NULL );
// Check if asheron's call is already running
HWND wndAC = ::FindWindowEx( NULL, NULL, _T( "Asheron's Call" ), _T( "Asheron's Call" ) );
bEnabled = ( wndAC == NULL );
if( wndAC != NULL )
{
::AfxMessageBox( _T( "Asheron's Call was started before the Agent.\r\nNo plugins will be installed until Asheron's Call and the agent are exited and restarted.\r\n\r\nThe Agent must be run before Asheron's Call to properly install plugins." ), MB_ICONERROR | MB_OK );
::PostQuitMessage( 0 );
}
else
{
RegKey key;
DWORD dwOldInj;
if( key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" )) != ERROR_SUCCESS )
{
g_bOldInject = false;
m_uiTimer = SetTimer (1, 1000, NULL);
}
else
{
if( key.QueryDWORDValue( "OldInjection", dwOldInj ) == ERROR_SUCCESS )
{
if( dwOldInj == 1 )
{
g_bOldInject = true;
TCHAR szInjectDll[ MAX_PATH ];
memset( szInjectDll, 0, sizeof( szInjectDll ) / sizeof( szInjectDll[0] ) );
// Open the COM CoClass for IPager to get Inject.dll path
if( key.Open( HKEY_CLASSES_ROOT, _T( "CLSID\\{C79E2F76-06F8-4CD0-A613-4829237D297D}\\InprocServer32" ), KEY_READ ) == ERROR_SUCCESS )
{
DWORD dwChars = MAX_PATH - 1;
if( key.QueryStringValue( NULL, szInjectDll, &dwChars ) != ERROR_SUCCESS )
{
::AfxMessageBox( _T( "There is a serious problem with the Decal Agent registry settings!!\n\nExiting." ), MB_ICONERROR | MB_OK );
::PostQuitMessage( 0 );
}
}
g_hInj = LoadLibrary( szInjectDll );
InjEnable = (VoidNoParams) GetProcAddress( g_hInj, (LPCSTR) 0x00000012 );
InjDisable = (VoidNoParams) GetProcAddress( g_hInj, (LPCSTR) 0x00000011 );
if( !InjEnable || !InjDisable )
{
::AfxMessageBox( _T( "Can't load Inject.dll. Please turn off old style injection." ), MB_ICONERROR | MB_OK );
g_bOldInject = false;
}
else
::InjEnable();
}
else
{
g_bOldInject = false;
m_uiTimer = SetTimer( 1, 1000, NULL );
}
}
else
{
g_bOldInject = false;
m_uiTimer = SetTimer( 1, 1000, NULL );
}
}
}
// Create the system tray icon
NOTIFYICONDATA nid;
::memset( &nid, 0, sizeof( NOTIFYICONDATA ) );
nid.cbSize = sizeof( NOTIFYICONDATA );
nid.hWnd = m_hWnd;
nid.uID = ID_SYSTRAY;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = NM_SYSTRAY;
nid.hIcon = AfxGetApp()->LoadIcon( IDR_TRAYICON );
::_tcscpy( nid.szTip, _T( "Decal Agent" ) );
::Shell_NotifyIcon( NIM_ADD, &nid );
DestroyIcon(nid.hIcon);
// Get the image path (path of parent executable)
TCHAR szImagePath[ MAX_PATH ];
::GetModuleFileName( NULL, szImagePath, MAX_PATH );
LPTSTR strProcessName = ::_tcsrchr( szImagePath, _T( '\\' ) );
*( strProcessName + 1 ) = _T( '\0' );
RegKey key;
key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal\\Agent" ) );
key.SetStringValue( _T( "AgentPath" ), szImagePath );
return 0;
}
void CTrayWnd::OnDestroy()
{
CWnd::OnDestroy();
NOTIFYICONDATA nid;
::memset( &nid, 0, sizeof( NOTIFYICONDATA ) );
nid.cbSize = sizeof( NOTIFYICONDATA );
nid.hWnd = m_hWnd;
nid.uID = ID_SYSTRAY;
::Shell_NotifyIcon( NIM_DELETE, &nid );
if( g_bOldInject )
{
if( bEnabled )
::InjDisable();
InjEnable = NULL;
InjDisable = NULL;
FreeLibrary( g_hInj );
}
else
if( m_uiTimer )
{
KillTimer (m_uiTimer);
m_uiTimer = 0;
}
::CoUninitialize();
}
void CTrayWnd::OnTimer (UINT_PTR nIDEvent)
{
::EnumWindows( EnumerationCallbackProc, (LPARAM) NULL );
}
BOOL CALLBACK EnumerationCallbackProc( HWND hwnd, LPARAM lParam )
{
TCHAR szClassName[64];
memset( szClassName, 0, sizeof( szClassName ) / sizeof( szClassName[0] ) );
GetClassName( hwnd, szClassName, 64 );
if( _tcsicmp( _T( "ZoneLobbyWindow" ), szClassName ) != 0 )
{
return TRUE;
}
if( CTrayWnd::s_pWnd != NULL )
return CTrayWnd::s_pWnd->OnEnum( hwnd );
else
return FALSE;
}
BOOL CTrayWnd::OnEnum( HWND hWndLobby )
{
if( hWndLobby != NULL )
{
DWORD dwProcessId = 0;
GetWindowThreadProcessId( hWndLobby, &dwProcessId );
if( dwProcessId != 0 )
{
TCHAR tszBuffer [256];
::_stprintf (tszBuffer, _T("__LOBBYHOOK_%d"), dwProcessId);
HANDLE hLobbySemaphore = ::CreateSemaphore (NULL, 0, 1, tszBuffer);
DWORD dwLastError = ::GetLastError ();
if (hLobbySemaphore)
{
::CloseHandle (hLobbySemaphore);
if (dwLastError == ERROR_ALREADY_EXISTS)
{
// The lobbyhook has already been injected, we know because it created the semaphore.
return TRUE;
}
}
RegKey key;
TCHAR szDll[ MAX_PATH ];
TCHAR szDllPath[ MAX_PATH ];
memset( szDllPath, 0, sizeof( szDllPath ) / sizeof( szDllPath[0] ) );
if( key.Open( HKEY_LOCAL_MACHINE, _T( "Software\\Decal\\Agent" ), KEY_READ ) == ERROR_SUCCESS )
{
DWORD dwChars = MAX_PATH - 1;
if( key.QueryStringValue( _T( "AgentPath" ), szDllPath, &dwChars ) == ERROR_SUCCESS )
{
lstrcpy( szDll, szDllPath );
lstrcat( szDll, _T( "\\ForceLibrary.dll" ) );
}
else
{
DWORD dwError = GetLastError();
char szBuffer[256];
_snprintf( szBuffer, sizeof( szBuffer ), "Couldn't query AgentPath value: 0x%08lx", dwError );
::MessageBox( NULL, szBuffer, _T( "DenAgent" ), MB_OK );
}
}
else
{
DWORD dwError = GetLastError();
char szBuffer[256];
_snprintf( szBuffer, sizeof( szBuffer ), "Couldn't open HKLM\\Software\\Decal\\Agent key: 0x%08lx", dwError );
::MessageBox( NULL, szBuffer, _T( "DenAgent" ), MB_OK );
}
if( szDllPath[0] )
{
HMODULE hLib = (HMODULE) ForceLibraryNow( dwProcessId, szDll );
if( hLib == NULL )
{
DWORD dwError = GetLastError();
char szBuffer[256];
_snprintf( szBuffer, sizeof( szBuffer ), "ForceLibraryNow (LobbyHook.dll) has failed( 0x%08lx )\nDo you want to switch to old style injection?\nIf Decal is loading in AC properly answer no.", dwError );
// Kill timer to avoid 1000 popups
KillTimer( m_uiTimer );
m_uiTimer = 0;
int iRet = ::MessageBox( NULL, szBuffer, _T( "DenAgent" ), MB_YESNO );
if( iRet == IDYES )
{
RegKey key;
key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" ) );
key.SetDWORDValue("OldInjection", 0x1L);
g_bOldInject = true;
TCHAR szInjectDll[ MAX_PATH ];
memset( szInjectDll, 0, sizeof( szInjectDll ) / sizeof( szInjectDll[0] ) );
// Open the COM CoClass for IPager to get Inject.dll path
if( key.Open( HKEY_CLASSES_ROOT, _T( "CLSID\\{C79E2F76-06F8-4CD0-A613-4829237D297D}\\InprocServer32" ), KEY_READ ) == ERROR_SUCCESS )
{
DWORD dwChars = MAX_PATH - 1;
if( key.QueryStringValue( NULL, szInjectDll, &dwChars ) != ERROR_SUCCESS )
{
::AfxMessageBox( _T( "There is a serious problem with the Decal Agent registry settings!!\n\nExiting." ), MB_ICONERROR | MB_OK );
::PostQuitMessage( 0 );
}
}
g_hInj = LoadLibrary( szInjectDll );
InjEnable = (VoidNoParams) GetProcAddress( g_hInj, (LPCSTR) 0x00000012 );
InjDisable = (VoidNoParams) GetProcAddress( g_hInj, (LPCSTR) 0x00000011 );
::InjEnable();
}
else // no
{
_snprintf( szBuffer, sizeof( szBuffer ), "Lobby Injection halted... restart DenAgent to try again." );
::MessageBox( NULL, szBuffer, _T( "DenAgent" ), MB_OK );
}
}
lstrcpy( szDll, szDllPath );
lstrcat( szDll, _T( "\\LobbyHook.dll" ) );
hLib = (HMODULE) ForceLibraryNow( dwProcessId, szDll );
if( hLib == NULL )
{
DWORD dwError = GetLastError();
char szBuffer[256];
_snprintf( szBuffer, sizeof( szBuffer ), "ForceLibraryNow (LobbyHook.dll) has failed( 0x%08lx )\nDo you want to switch to old style injection?\nIf Decal is loading in AC properly answer no.", dwError );
// Kill timer
KillTimer( m_uiTimer );
m_uiTimer = 0;
int iRet = ::MessageBox( NULL, szBuffer, _T( "DenAgent" ), MB_YESNO );
if( iRet == IDYES )
{
RegKey key;
key.Create( HKEY_LOCAL_MACHINE, _T( "SOFTWARE\\Decal" ) );
key.SetDWORDValue("OldInjection", 0x1L);
g_bOldInject = true;
TCHAR szInjectDll[ MAX_PATH ];
memset( szInjectDll, 0, sizeof( szInjectDll ) / sizeof( szInjectDll[0] ) );
// Open the COM CoClass for IPager to get Inject.dll path
if( key.Open( HKEY_CLASSES_ROOT, _T( "CLSID\\{C79E2F76-06F8-4CD0-A613-4829237D297D}\\InprocServer32" ), KEY_READ ) == ERROR_SUCCESS )
{
DWORD dwChars = MAX_PATH - 1;
if( key.QueryStringValue( NULL, szInjectDll, &dwChars ) != ERROR_SUCCESS )
{
::AfxMessageBox( _T( "There is a serious problem with the Decal Agent registry settings!!\n\nExiting." ), MB_ICONERROR | MB_OK );
::PostQuitMessage( 0 );
}
}
g_hInj = LoadLibrary( szInjectDll );
InjEnable = (VoidNoParams) GetProcAddress( g_hInj, (LPCSTR) 0x00000012 );
InjDisable = (VoidNoParams) GetProcAddress( g_hInj, (LPCSTR) 0x00000011 );
::InjEnable();
}
else // no
{
_snprintf( szBuffer, sizeof( szBuffer ), "Lobby Injection halted... restart DenAgent to try again." );
::MessageBox( NULL, szBuffer, _T( "DenAgent" ), MB_OK );
}
}
}
else
{
DWORD dwError = GetLastError();
char szBuffer[256];
_snprintf( szBuffer, sizeof( szBuffer ), "DLL path was blank: 0x%08lx", dwError );
::MessageBox( NULL, szBuffer, _T( "DenAgent" ), MB_OK );
}
}
else
{
DWORD dwError = GetLastError();
char szBuffer[256];
_snprintf( szBuffer, sizeof( szBuffer ), "Couldn't get process id: 0x%08lx", dwError );
::MessageBox( NULL, szBuffer, _T( "DenAgent" ), MB_OK );
}
}
return TRUE;
}
LRESULT CTrayWnd::OnSysTray(WPARAM nID, LPARAM uMsg)
{
// We should only receive message for the one systray we register
ASSERT( nID == ID_SYSTRAY );
switch( uMsg )
{
case WM_RBUTTONUP:
{
POINT pt;
::GetCursorPos( &pt );
CMenu menu;
menu.LoadMenu( IDR_POPUPS );
CMenu *pSystray = menu.GetSubMenu( 0 );
pSystray->SetDefaultItem( 0, TRUE );
SetForegroundWindow();
pSystray->TrackPopupMenu( TPM_RIGHTALIGN | TPM_RIGHTBUTTON, pt.x, pt.y, this );
}
break;
case WM_LBUTTONUP:
showDialog();
break;
}
return 0;
}
void CTrayWnd::OnSystrayConfigure()
{
showDialog();
}
void CTrayWnd::OnSystrayExit()
{
DestroyWindow();
::PostQuitMessage( 0 );
}
void CTrayWnd::UpdateXMLFiles()
{
CDenAgentDlg dlg;
m_pDialog = &dlg;
dlg.m_bDoUpdate = true;
dlg.DoModal( );
m_pDialog = NULL;
}

67
Native/DenAgent/TrayWnd.h Normal file
View file

@ -0,0 +1,67 @@
#if !defined(AFX_TRAYWND_H__6CE1FB59_8D19_44C1_8064_0AEE1B3AA745__INCLUDED_)
#define AFX_TRAYWND_H__6CE1FB59_8D19_44C1_8064_0AEE1B3AA745__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TrayWnd.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CTrayWnd window
class CTrayWnd : public CWnd
{
// Construction
public:
CTrayWnd();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTrayWnd)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CTrayWnd();
bool bEnabled;
CWnd *m_pDialog;
UINT_PTR m_uiTimer;
void showDialog();
void UpdateXMLFiles();
BOOL OnEnum( HWND hWndLobby );
static CTrayWnd* s_pWnd;
// Generated message map functions
protected:
//{{AFX_MSG(CTrayWnd)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnSystrayConfigure();
afx_msg void OnSystrayExit();
afx_msg LRESULT OnTaskbarRestart(WPARAM, LPARAM);
//}}AFX_MSG
afx_msg LRESULT OnSysTray(WPARAM, LPARAM);
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_TRAYWND_H__6CE1FB59_8D19_44C1_8064_0AEE1B3AA745__INCLUDED_)

View file

@ -0,0 +1,123 @@
// URLCallback.cpp : Implementation of cURLCallback
#include "stdafx.h"
#include "DenAgent.h"
#include "URLCallback.h"
#include "DownloadDlg.h"
/////////////////////////////////////////////////////////////////////////////
// cURLCallback
void cURLCallback::start( REFCLSID clsid, LPCWSTR szURL, DWORD dwMajor, DWORD dwMinor )
{
// Create the bind context
CComPtr< IBindCtx > pBindCtx;
::CreateAsyncBindCtx( 0, this, NULL, &pBindCtx );
HRESULT hRes = ::CoCreateInstance( CLSID_InternetZoneManager, NULL, CLSCTX_SERVER, IID_IInternetZoneManager,
reinterpret_cast< void ** >( &m_pZone ) );
_ASSERTE( SUCCEEDED( hRes ) );
m_pZone->GetZoneActionPolicy( URLZONE_INTERNET, URLACTION_DOWNLOAD_UNSIGNED_ACTIVEX, reinterpret_cast< BYTE * >( &m_dwOldPolicy ),
sizeof( DWORD ), URLZONEREG_HKCU );
DWORD dwPolicy = URLPOLICY_QUERY;
m_pZone->SetZoneActionPolicy( URLZONE_INTERNET, URLACTION_DOWNLOAD_UNSIGNED_ACTIVEX, reinterpret_cast< BYTE * >( &dwPolicy ),
sizeof( DWORD ), URLZONEREG_HKCU );
hRes = ::CoGetClassObjectFromURL( clsid, szURL, 0xFFFFFFFF, 0xFFFFFFFF, L"application/x-oleobject",
pBindCtx, CLSCTX_INPROC_SERVER, NULL, IID_IClassFactory, reinterpret_cast< void ** >( &m_pDlg->m_pFactory ) );
if( FAILED( hRes ) )
{
m_pDlg->EndDialog( IDCANCEL );
resetZone();
}
else if( hRes == S_OK )
{
m_pDlg->m_pFactory->LockServer( TRUE );
m_pDlg->EndDialog( IDOK );
resetZone();
}
// Otherwise, we'll assume that we're hapilly downloading asynchronously
}
void cURLCallback::stop()
{
m_pDlg->m_wndStop.EnableWindow( FALSE );
m_pBinding->Abort();
}
void cURLCallback::resetZone()
{
m_pZone->SetZoneActionPolicy( URLZONE_INTERNET, URLACTION_DOWNLOAD_UNSIGNED_ACTIVEX, reinterpret_cast< BYTE * >( &m_dwOldPolicy ),
sizeof( DWORD ), URLZONEREG_HKCU );
m_pZone.Release();
}
STDMETHODIMP cURLCallback::GetBindInfo( DWORD *pgrfBINF, BINDINFO *pbindinfo )
{
*pgrfBINF = BINDF_ASYNCHRONOUS | BINDF_GETNEWESTVERSION | BINDF_FROMURLMON | BINDF_IGNORESECURITYPROBLEM;
// Not changing the defaults in pbindinfo
return S_OK;
}
STDMETHODIMP cURLCallback::OnObjectAvailable( REFIID iid, IUnknown *pUnk )
{
// Save the object pointer
_ASSERTE( iid == IID_IClassFactory );
m_pDlg->m_pFactory = static_cast< IClassFactory * >( pUnk );
m_pDlg->m_pFactory->LockServer( TRUE );
return S_OK;
}
STDMETHODIMP cURLCallback::OnProgress( ULONG ulProgress, ULONG ulProgressMax, ULONG, LPCWSTR szStatusText )
{
USES_CONVERSION;
// Update the status in the dialog
m_pDlg->SetDlgItemText( IDC_STATUSTEXT, W2T( szStatusText ) );
m_pDlg->m_wndProgress.SetRange32( 0, ulProgressMax );
m_pDlg->m_wndProgress.SetPos( ulProgress );
return S_OK;
}
STDMETHODIMP cURLCallback::OnStartBinding( DWORD, IBinding *pBinding )
{
m_pBinding = pBinding;
m_pDlg->m_wndStop.EnableWindow();
return S_OK;
}
STDMETHODIMP cURLCallback::OnStopBinding( HRESULT hr, LPCWSTR strError )
{
USES_CONVERSION;
if( SUCCEEDED( hr ) )
m_pDlg->EndDialog( IDOK );
else
{
::AfxMessageBox( W2T( strError ), MB_ICONERROR | MB_OK, 0 );
m_pDlg->EndDialog( IDCANCEL );
}
resetZone();
m_pBinding.Release();
return S_OK;
}
STDMETHODIMP cURLCallback::GetWindow( REFGUID rguidReason, HWND *phwnd )
{
*phwnd = m_pDlg->m_hWnd;
return S_OK;
}

View file

@ -0,0 +1,203 @@
// URLCallback.h : Declaration of the cURLCallback
#ifndef __URLCALLBACK_H_
#define __URLCALLBACK_H_
#include "resource.h" // main symbols
#include "DownloadDlg.h"
/////////////////////////////////////////////////////////////////////////////
// cURLCallback
class ATL_NO_VTABLE cURLCallback :
public CComObjectRootEx<CComSingleThreadModel>,
public IBindStatusCallback,
public IServiceProvider,
public IInternetSecurityManager,
public IInternetHostSecurityManager,
public ICodeInstall
{
public:
cURLCallback()
{
}
~cURLCallback()
{
}
BEGIN_COM_MAP(cURLCallback)
COM_INTERFACE_ENTRY(IBindStatusCallback)
COM_INTERFACE_ENTRY(IServiceProvider)
COM_INTERFACE_ENTRY(IInternetSecurityManager)
COM_INTERFACE_ENTRY(IInternetHostSecurityManager)
COM_INTERFACE_ENTRY(ICodeInstall)
COM_INTERFACE_ENTRY(IWindowForBindingUI)
END_COM_MAP()
CComPtr< IBinding > m_pBinding;
CComPtr< IInternetZoneManager > m_pZone;
DWORD m_dwOldPolicy;
cDownloadDlg *m_pDlg;
// Helper functions for setting up a transfer
void start( REFCLSID clsid, LPCWSTR szURL, DWORD dwMajor, DWORD dwMinor );
void stop();
void resetZone();
public:
// IBindStatusCallback
STDMETHOD(GetBindInfo)( DWORD *pgrfBINDF, BINDINFO *pbindinfo );
STDMETHOD(GetPriority)( LONG *pnPriority )
{
*pnPriority = THREAD_PRIORITY_NORMAL;
return S_OK;
}
STDMETHOD(OnDataAvailable)( DWORD, DWORD, FORMATETC *, STGMEDIUM * )
{
return E_NOTIMPL;
}
STDMETHOD(OnLowResource)(DWORD)
{
return E_NOTIMPL;
}
STDMETHOD(OnObjectAvailable)( REFIID iid, IUnknown *pUnk );
STDMETHOD(OnProgress)( ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText );
STDMETHOD(OnStartBinding)( DWORD dwReserved, IBinding *pBinding );
STDMETHOD(OnStopBinding)( HRESULT hr, LPCWSTR szStatusText );
// IServiceProvider
STDMETHOD(QueryService)(REFGUID sid,REFIID iid,void **ppvItf)
{
return static_cast< IServiceProvider * >( this )->QueryInterface( iid, ppvItf );
}
// IInternetSecurityManager
CComPtr< IInternetSecurityMgrSite > m_pSecuritySite;
STDMETHOD(SetSecuritySite)(IInternetSecurityMgrSite*pSite)
{
m_pSecuritySite = pSite;
return S_OK;
}
STDMETHOD(GetSecuritySite)(IInternetSecurityMgrSite **ppSite)
{
return m_pSecuritySite->QueryInterface( ppSite );
}
STDMETHOD(MapUrlToZone)(LPCWSTR,DWORD*pdwZone,DWORD)
{
// All URLs are on the local machine - most trusted
*pdwZone = URLZONE_LOCAL_MACHINE;
return S_OK;
}
STDMETHOD(GetSecurityId)(LPCWSTR,BYTE*,DWORD*,DWORD)
{
return INET_E_DEFAULT_ACTION;
}
STDMETHOD(ProcessUrlAction)(
/* [in] */ LPCWSTR pwszUrl,
/* [in] */ DWORD dwAction,
/* [size_is][out] */ BYTE *pPolicy,
/* [in] */ DWORD cbPolicy,
/* [in] */ BYTE *pContext,
/* [in] */ DWORD cbContext,
/* [in] */ DWORD dwFlags,
/* [in] */ DWORD dwReserved = 0)
{
if( cbPolicy == sizeof( DWORD ) )
{
// Set everything to allow
*reinterpret_cast< DWORD * >( pPolicy ) = URLPOLICY_ALLOW;
return S_OK;
}
return INET_E_DEFAULT_ACTION;
}
STDMETHOD(QueryCustomPolicy)(LPCWSTR,REFGUID,BYTE**,DWORD*,BYTE*,DWORD,DWORD)
{
return INET_E_DEFAULT_ACTION;
}
STDMETHOD(SetZoneMapping)(DWORD,LPCWSTR,DWORD)
{
return INET_E_DEFAULT_ACTION;
}
STDMETHOD(GetZoneMappings)(DWORD,IEnumString**,DWORD)
{
return INET_E_DEFAULT_ACTION;
}
// IInternetHostSecurityManager
STDMETHOD(GetSecurityId)( BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
{
static LPCTSTR strSecurity = _T( "None:localhost+My Computer" );
::strcpy( reinterpret_cast< char * >( pbSecurityId ), strSecurity );
*pcbSecurityId = ::_tcslen( strSecurity );
return S_OK;
}
STDMETHOD(ProcessUrlAction)(
/* [in] */ DWORD dwAction,
/* [size_is][out] */ BYTE __RPC_FAR *pPolicy,
/* [in] */ DWORD cbPolicy,
/* [in] */ BYTE __RPC_FAR *pContext,
/* [in] */ DWORD cbContext,
/* [in] */ DWORD dwFlags,
/* [in] */ DWORD dwReserved)
{
switch( dwAction )
{
case URLACTION_DOWNLOAD_UNSIGNED_ACTIVEX:
*reinterpret_cast< DWORD * >( pPolicy ) = URLPOLICY_QUERY;
return S_OK;
}
if( cbPolicy == sizeof( DWORD ) )
{
// Set everything to allow
*reinterpret_cast< DWORD * >( pPolicy ) = URLPOLICY_ALLOW;
return S_OK;
}
return INET_E_DEFAULT_ACTION;
}
virtual HRESULT STDMETHODCALLTYPE QueryCustomPolicy(
/* [in] */ REFGUID guidKey,
/* [size_is][size_is][out] */ BYTE __RPC_FAR *__RPC_FAR *ppPolicy,
/* [out] */ DWORD __RPC_FAR *pcbPolicy,
/* [in] */ BYTE __RPC_FAR *pContext,
/* [in] */ DWORD cbContext,
/* [in] */ DWORD dwReserved)
{
return INET_E_DEFAULT_ACTION;
}
// ICodeInstall
virtual HRESULT STDMETHODCALLTYPE OnCodeInstallProblem(
/* [in] */ ULONG ulStatusCode,
/* [unique][in] */ LPCWSTR szDestination,
/* [unique][in] */ LPCWSTR szSource,
/* [in] */ DWORD dwReserved)
{
return S_OK;
}
// IWindowForBindingUI
virtual HRESULT STDMETHODCALLTYPE GetWindow(
/* [in] */ REFGUID rguidReason,
/* [out] */ HWND __RPC_FAR *phwnd);
};
#endif //__URLCALLBACK_H_

View file

@ -0,0 +1,23 @@
HKCR
{
DenAgent.URLCallback.1 = s 'URLCallback Class'
{
CLSID = s '{2935B913-CCF9-4145-ADE2-8F024E75BAB2}'
}
DenAgent.URLCallback = s 'URLCallback Class'
{
CLSID = s '{2935B913-CCF9-4145-ADE2-8F024E75BAB2}'
CurVer = s 'DenAgent.URLCallback.1'
}
NoRemove CLSID
{
ForceRemove {2935B913-CCF9-4145-ADE2-8F024E75BAB2} = s 'URLCallback Class'
{
ProgID = s 'DenAgent.URLCallback.1'
VersionIndependentProgID = s 'DenAgent.URLCallback'
LocalServer32 = s '%MODULE%'
val AppID = s '{19A473FE-ED5F-4A68-8920-DD5D0D3E4B41}'
'TypeLib' = s '{5504FC1C-B2A3-43F6-B9CE-E3B3282273B7}'
}
}
}

View file

@ -0,0 +1,47 @@
#if !defined(AFX_CCHANGEPLUGINDIRECTORY_H__3AB22538_1DA2_48AB_A4E8_CFD30AD52A75__INCLUDED_)
#define AFX_CCHANGEPLUGINDIRECTORY_H__3AB22538_1DA2_48AB_A4E8_CFD30AD52A75__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// cChangePluginDirectory.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// cChangePluginDirectory dialog
class cChangePluginDirectory : public CDialog
{
// Construction
public:
cChangePluginDirectory(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(cChangePluginDirectory)
enum { IDD = IDD_CHANGEDIR };
CEdit m_NewUrl;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(cChangePluginDirectory)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(cChangePluginDirectory)
virtual void OnOK();
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CCHANGEPLUGINDIRECTORY_H__3AB22538_1DA2_48AB_A4E8_CFD30AD52A75__INCLUDED_)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

@ -0,0 +1,13 @@
//
// DENAGENT.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,014 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

110
Native/DenAgent/resource.h Normal file
View file

@ -0,0 +1,110 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by DenAgent.rc
//
#define IDE_NOCLIENTEXE 1
#define IDC_WEBSITE 2
#define IDE_NOCLIENTVER 2
#define IDS_VERSIONTEMPLATE 3
#define IDE_NOXMLDOC 4
#define IDE_NOXMLVER 5
#define IDE_XMLCLIENTVERSIONMISMATCH 6
#define IDS_UPDATETEXT 7
#define IDE_UPDATETEXT 7
#define IDR_TRAYICON 101
#define IDD_DENAGENT_DIALOG 102
#define IDR_DENAGENT 103
#define IDR_MAINFRAME 128
#define IDR_POPUPS 129
#define IDD_ADDREMOVE 130
#define IDD_DOWNLOAD 131
#define IDD_CHANGEDIR 134
#define IDD_OPTIONS 135
#define IDR_VERSION_STATES 136
#define IDB_IMAGES 141
#define IDB_BITMAP1 142
#define IDD_DOWNLOADER 143
#define IDB_GROUPS 145
#define IDC_CURSOR1 147
#define IDD_EXPORT 152
#define IDC_PLUGINS 1001
#define IDC_REFRESH 1002
#define IDC_CHANGE_DIR 1005
#define IDC_PLUGINDIR 1006
#define IDC_INSTALL 1007
#define IDC_UPGRADE 1008
#define IDC_REMOVE 1009
#define IDC_BROWSE 1009
#define IDC_PROGRESS 1011
#define IDC_STATUSTEXT 1012
#define IDC_STOPDOWNLOAD 1013
#define IDC_ADDREMOVE 1014
#define IDC_CUSTOMSTATUS 1014
#define IDC_UP 1015
#define IDC_PROGRESSTOTAL 1015
#define IDC_DOWN 1016
#define IDC_STATUSTOTAL 1016
#define IDC_REORDER 1017
#define IDC_UPDATE 1017
#define IDC_STATUST 1017
#define IDC_BARALPHA 1018
#define IDC_OPTIONS 1018
#define IDC_VIEWALPHA 1019
#define IDC_NEWURL 1022
#define IDC_BARALPHA_SPIN 1023
#define IDC_VIEWALPHA_SPIN 1024
#define IDC_EDIT1 1028
#define IDC_CUSTOM_FONT_EDIT 1028
#define IDC_EDITEXPORT 1028
#define IDC_BLENDINGSOFTWARE 1030
#define IDC_BLENDINGGDIPLUS 1031
#define IDC_MESSAGES_TEXT 1031
#define IDC_MEMLOCS_TEXT 1032
#define IDC_DECALPLUGINS_TEXT 1033
#define IDC_CHECK_AUTOSTART 1035
#define IDC_BTN_RESET 1036
#define IDC_VIEWMULTI 1037
#define IDC_VIEWSINGLE 1038
#define IDC_DEFAULT_FONT_RADIO 1039
#define IDC_CLIENT_FONT_RADIO 1040
#define IDC_CUSTOM_FONT_RADIO 1041
#define IDC_RADARYES 1042
#define IDC_RADIO2 1043
#define IDC_RADARNO 1043
#define IDC_RADIO1 1044
#define IDC_TIMESTAMPON 1044
#define IDC_TIMESTAMPOFF 1045
#define IDC_DELETE 1050
#define IDC_BUTTON1 1051
#define IDC_FORMATHELP 1051
#define IDC_BTNEXPORT 1051
#define IDC_EXPORT 1051
#define IDC_COMBO 1052
#define IDC_FORMATCLR 1052
#define IDC_FORMATSTR 1053
#define IDC_CHECK1 1054
#define IDC_OLDINJECT 1054
#define IDC_CHKENABLED 1054
#define IDC_DUALLOG 1055
#define IDC_CHKLOC 1055
#define IDC_WINDOWED 1056
#define IDC_CHKCLSID 1056
#define IDC_BUTTON2 1057
#define IDC_PATCHHELP 1057
#define IDC_NOMOVIES 1058
#define IDC_NOMOVIES2 1059
#define IDC_NOLOGOS 1059
#define IDC_DOCKPOS 1060
#define ID_SYSTRAY_CONFIGURE 32771
#define ID_SYSTRAY_EXIT 32772
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 153
#define _APS_NEXT_COMMAND_VALUE 32776
#define _APS_NEXT_CONTROL_VALUE 1061
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif