From 5c521d256815161f4af9066bc4bb9fea7fa1accb Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 16 Sep 2003 13:44:06 +0000 Subject: Initial Import --- DropDlg.cpp | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++ DropDlg.h | 63 +++++++++++ Dropper.cpp | 81 ++++++++++++++ Dropper.dsp | 336 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Dropper.dsw | 29 +++++ Dropper.h | 1 + Dropper.idl | 20 ++++ Dropper.rc | 175 ++++++++++++++++++++++++++++++ Dropper.rgs | 16 +++ Dropperps.def | 11 ++ Dropperps.mk | 16 +++ StdAfx.cpp | 12 +++ StdAfx.h | 34 ++++++ icon1.ico | Bin 0 -> 1078 bytes initial.tmp | 0 resource.h | 23 ++++ 16 files changed, 1117 insertions(+) create mode 100644 DropDlg.cpp create mode 100644 DropDlg.h create mode 100644 Dropper.cpp create mode 100644 Dropper.dsp create mode 100644 Dropper.dsw create mode 100644 Dropper.h create mode 100644 Dropper.idl create mode 100644 Dropper.rc create mode 100644 Dropper.rgs create mode 100644 Dropperps.def create mode 100644 Dropperps.mk create mode 100644 StdAfx.cpp create mode 100644 StdAfx.h create mode 100644 icon1.ico delete mode 100644 initial.tmp create mode 100644 resource.h diff --git a/DropDlg.cpp b/DropDlg.cpp new file mode 100644 index 0000000..e3517f7 --- /dev/null +++ b/DropDlg.cpp @@ -0,0 +1,300 @@ +// DropDlg.cpp : Implementation of CDropDlg +#include "stdafx.h" +#include "DropDlg.h" + +///////////////////////////////////////////////////////////////////////////// +// CDropDlg + +const TCHAR* kLastBatch = _T("Batch"); + +CDropDlg::CDropDlg() : + m_settings(HKEY_CURRENT_USER, _T("SOFTWARE\\WS\\Dropper\\")), + CPersistPosWindow("Window") +{ + m_isRunning = false; + m_isCancelled = false; +} + +void AddBatches(const string& wildcard, CComboBox& ctlBatch) +{ + WIN32_FIND_DATA findData; + + HANDLE hFindFile = FindFirstFile(wildcard, &findData); + + if(hFindFile != INVALID_HANDLE_VALUE) + { + do + { + // Get first part of the file + string name = findData.cFileName; + name = name.substr(0, name.find_last_of('.')); + + ctlBatch.AddString(name); + } + while(FindNextFile(hFindFile, &findData)); + } + + FindClose(hFindFile); +} + + + +LRESULT CDropDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + m_ctlLog = GetDlgItem(IDC_LOG); + + m_baseDir = GetModuleFolder(_Module.GetModuleInstance()); + CleanFolder(m_baseDir); + + CComboBox ctlBatch = GetDlgItem(IDC_BATCH); + + AddBatches(m_baseDir + _T("*.cmd"), ctlBatch); + AddBatches(m_baseDir + _T("*.bat"), ctlBatch); + + SetMin(IDC_MINSIZE); + SetControlSizing(IDC_LOG, SD_HORZ | SD_VERT | SD_SIZING); + SetControlSizing(IDC_RUN, SD_HORZ | SD_MOVING); + SetControlSizing(IDC_BATCH, SD_HORZ | SD_SIZING); + + // Select last used batch + ctlBatch.SelectString(-1, m_settings.GetString(kLastBatch)); + + SetRunMode(false); + + // Center it + CenterWindow(); + + LoadPosition(m_settings); + + SetIcon((HICON)LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, 32, 32, LR_SHARED), TRUE); + SetIcon((HICON)LoadImage(_Module.GetResourceInstance(), MAKEINTRESOURCE(IDI_MAIN), IMAGE_ICON, 16, 16, LR_SHARED), FALSE); + + return 1; // Let the system set the focus +} + +LRESULT CDropDlg::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + SavePosition(m_settings); + return 1; +} + + +void CDropDlg::SetRunMode(bool isRunning) +{ + m_isRunning = isRunning; + + if(isRunning) + m_isCancelled = false; + + DragAcceptFiles(isRunning ? FALSE : TRUE); + ::EnableWindow(GetDlgItem(IDC_BATCH), isRunning ? FALSE : TRUE); + ::EnableWindow(GetDlgItem(IDC_RUN), TRUE); + + SetDlgItemText(IDC_RUN, isRunning ? _T("Cancel") : _T("Run")); +} + +void CDropDlg::ReportError(HRESULT hr) +{ + MessageBox(FormatHR(hr), _T("Dropper"), MB_ICONSTOP | MB_OK); +} + + +string CDropDlg::CleanFolder(const string& folderName) +{ + if(folderName.at(folderName.length() - 1) != _T('\\')) + return folderName + _T("\\"); + + return folderName; +} + +bool CDropDlg::IsDots(const string& fileName) +{ + return fileName == _T(".") || fileName == _T(".."); +} + + +LRESULT CDropDlg::OnDropFiles(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + HDROP hDrop = (HDROP)wParam; + HRESULT hr = S_OK; + string fileName; + string batchName = GetCurBatch(); + + SetRunMode(true); + + SetDlgItemText(IDC_LOG, _T("")); + + UINT numFiles = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0); + + for(int i = 0; i < numFiles; i++) + { + if(DragQueryFile(hDrop, i, fileName.get_buffer(MAX_PATH), MAX_PATH)) + { + fileName.release_buffer(); + hr = RunWithFile(batchName, fileName); + if(FAILED(hr)) + { + ReportError(hr); + break; + } + } + } + + DragFinish(hDrop); + + SetRunMode(false); + + return 0; +} + +LRESULT CDropDlg::OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + if(!m_isRunning) + { + string batchName; + GetDlgItemText(IDC_BATCH, batchName.get_buffer(MAX_PATH), MAX_PATH); + batchName.release_buffer(); + + m_settings.WriteString(kLastBatch, batchName); + + EndDialog(wID); + } + else + { + m_isCancelled = true; + } + + return 0; +} + + +LRESULT CDropDlg::OnRun(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) +{ + if(m_isRunning) + { + // It's a cancel button now + m_isCancelled = true; + ::EnableWindow(GetDlgItem(IDC_RUN), FALSE); + } + else + { + // It's a run button + + SetRunMode(true); + + SetDlgItemText(IDC_LOG, _T("")); + + HRESULT hr = RunWithFile(GetCurBatch(), _T("")); + if(FAILED(hr)) + ReportError(hr); + + SetRunMode(false); + } + + return 0; +} + +string CDropDlg::GetCurBatch() +{ + string sBatch; + GetDlgItemText(IDC_BATCH, sBatch.get_buffer(MAX_PATH), MAX_PATH); + sBatch.release_buffer(); + return sBatch; +} + +HRESULT CDropDlg::RunWithFolder(const string& batch, const string& folderName) +{ + string wildcard = folderName + _T("*.*"); + WIN32_FIND_DATA findData; + HRESULT hr = S_OK; + + HANDLE hFindFile = FindFirstFile(wildcard, &findData); + + if(hFindFile != INVALID_HANDLE_VALUE) + { + do + { + if(!IsDots(findData.cFileName)) + { + string fileName = folderName + findData.cFileName; + hr = RunWithFile(batch, fileName); + if(FAILED(hr)) return hr; + } + + if(m_isCancelled) + { + ::SetLastError(ERROR_SUCCESS); + break; + } + } + while(FindNextFile(hFindFile, &findData)); + } + + if(GetLastError() != 0 && GetLastError() != ERROR_NO_MORE_FILES) + return HRESULT_FROM_WIN32(::GetLastError()); + + return S_OK; +} + +HRESULT CDropDlg::RunWithFile(const string& batch, const string& path) +{ + if(path.size() > 0) + { + DWORD fileAttrib = GetFileAttributes(path); + if(fileAttrib & FILE_ATTRIBUTE_DIRECTORY) + { + return RunWithFolder(batch, CleanFolder(path)); + } + } + + + string cmdLine = _T("\"") + m_baseDir + batch + + _T(".bat\""); + + HRESULT hr = S_OK; + + if(path.size() > 0) + { + cmdLine += _T(" \"") + path + _T("\""); + + size_t pos = path.find_last_of(_T("\\/")); + string file, dir; + + if(pos != string::npos) + { + pos++; + file = path.substr(pos); + dir = path.substr(0, pos); + } + else + { + file = path; + } + + SetEnvironmentVariable(_T("DROPPED_FILE"), file); + SetEnvironmentVariable(_T("DROPPED_DIR"), dir); + SetEnvironmentVariable(_T("DROPPED_PATH"), path); + + } + + if(!CreateProcessOutput(NULL, (LPTSTR)(LPCTSTR)cmdLine, NULL, NULL, TRUE, + 0, NULL, m_baseDir, OutputString, (LPVOID)this)) + { + hr = HRESULT_FROM_WIN32(::GetLastError()); + } + + // Do an extra line + OutputString(_T("\r\n"), (LPVOID)this); + + return S_OK; +} + +BOOL CDropDlg::OutputString(LPCTSTR data, LPVOID param) +{ + CDropDlg* pDlg = (CDropDlg*)param; + pDlg->m_ctlLog.AppendText(data); + + // TODO: Provide some way to cancel + return TRUE; +} + diff --git a/DropDlg.h b/DropDlg.h new file mode 100644 index 0000000..ac6613c --- /dev/null +++ b/DropDlg.h @@ -0,0 +1,63 @@ +// DropDlg.h : Declaration of the CDropDlg + +#ifndef __DROPDLG_H_ +#define __DROPDLG_H_ + +#include "resource.h" // main symbols +#include + +///////////////////////////////////////////////////////////////////////////// +// CDropDlg +class CDropDlg : + public CDialogImpl, + public CSizingDialog, + public CPersistPosWindow +{ +public: + CDropDlg(); + + enum { IDD = IDD_DROPDLG }; + +BEGIN_MSG_MAP(CDropDlg) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) + MESSAGE_HANDLER(WM_DROPFILES, OnDropFiles) + COMMAND_ID_HANDLER(IDC_RUN, OnRun) + COMMAND_ID_HANDLER(IDOK, OnClose) + COMMAND_ID_HANDLER(IDCANCEL, OnClose) + CHAIN_MSG_MAP(CSizingDialog) +END_MSG_MAP() + +// Handler prototypes: +// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); +// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); +// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled); + + LRESULT OnRun(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + LRESULT OnDropFiles(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); + LRESULT OnClose(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled); + +protected: + void SetRunMode(bool isRunning); + void ReportError(HRESULT hr); + + string GetCurBatch(); + HRESULT RunWithFolder(const string& batch, const string& folderName); + HRESULT RunWithFile(const string& batch, const string& fileName); + + static BOOL WINAPI OutputString(LPCTSTR data, LPVOID param); + static string CleanFolder(const string& folderName); + static bool IsDots(const string& fileName); + + CEdit m_ctlLog; + CComboBox m_ctlBatch; + string m_baseDir; + CRegSettings m_settings; // Our registry key + + bool m_isRunning; + bool m_isCancelled; +}; + +#endif //__DROPDLG_H_ diff --git a/Dropper.cpp b/Dropper.cpp new file mode 100644 index 0000000..78f9708 --- /dev/null +++ b/Dropper.cpp @@ -0,0 +1,81 @@ +// Dropper.cpp : Implementation of WinMain + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f Dropperps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include + +#include "dropdlg.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +END_OBJECT_MAP() + + +LPCTSTR FindOneOf(LPCTSTR p1, LPCTSTR p2) +{ + while (p1 != NULL && *p1 != NULL) + { + LPCTSTR p = p2; + while (p != NULL && *p != NULL) + { + if (*p1 == *p) + return CharNext(p1); + p = CharNext(p); + } + p1 = CharNext(p1); + } + return NULL; +} + +///////////////////////////////////////////////////////////////////////////// +// +extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, + HINSTANCE /*hPrevInstance*/, LPTSTR lpCmdLine, int /*nShowCmd*/) +{ + lpCmdLine = GetCommandLine(); //this line necessary for _ATL_MIN_CRT + +#if _WIN32_WINNT >= 0x0400 & defined(_ATL_FREE_THREADED) + HRESULT hRes = CoInitializeEx(NULL, COINIT_MULTITHREADED); +#else + HRESULT hRes = CoInitialize(NULL); +#endif + _ASSERTE(SUCCEEDED(hRes)); + _Module.Init(ObjectMap, hInstance, NULL); + TCHAR szTokens[] = _T("-/"); + + int nRet = 0; + BOOL bRun = TRUE; + LPCTSTR lpszToken = FindOneOf(lpCmdLine, szTokens); + while (lpszToken != NULL) + { + if (lstrcmpi(lpszToken, _T("UnregServer"))==0) + { + _Module.UpdateRegistryFromResource(IDR_Dropper, FALSE); + bRun = FALSE; + break; + } + if (lstrcmpi(lpszToken, _T("RegServer"))==0) + { + _Module.UpdateRegistryFromResource(IDR_Dropper, TRUE); + bRun = FALSE; + break; + } + lpszToken = FindOneOf(lpszToken, szTokens); + } + + if (bRun) + { + CDropDlg dlg; + dlg.DoModal(); + } + + _Module.Term(); + CoUninitialize(); + return nRet; +} diff --git a/Dropper.dsp b/Dropper.dsp new file mode 100644 index 0000000..5a77745 --- /dev/null +++ b/Dropper.dsp @@ -0,0 +1,336 @@ +# Microsoft Developer Studio Project File - Name="Dropper" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +CFG=Dropper - 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 "Dropper.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 "Dropper.mak" CFG="Dropper - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Dropper - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "Dropper - Win32 Unicode Debug" (based on "Win32 (x86) Application") +!MESSAGE "Dropper - Win32 Release MinSize" (based on "Win32 (x86) Application") +!MESSAGE "Dropper - Win32 Release MinDependency" (based on "Win32 (x86) Application") +!MESSAGE "Dropper - Win32 Unicode Release MinSize" (based on "Win32 (x86) Application") +!MESSAGE "Dropper - Win32 Unicode Release MinDependency" (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)" == "Dropper - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\Debug +TargetPath=.\Debug\Dropper.exe +InputPath=.\Debug\Dropper.exe +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + "$(TargetPath)" /RegServer + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + echo Server registration done! + +# End Custom Build + +!ELSEIF "$(CFG)" == "Dropper - Win32 Unicode Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "DebugU" +# PROP BASE Intermediate_Dir "DebugU" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "DebugU" +# PROP Intermediate_Dir "DebugU" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"wWinMainCRTStartup" /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"wWinMainCRTStartup" /subsystem:windows /debug /machine:I386 /pdbtype:sept +# Begin Custom Build - Performing registration +OutDir=.\DebugU +TargetPath=.\DebugU\Dropper.exe +InputPath=.\DebugU\Dropper.exe +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + "$(TargetPath)" /RegServer + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + echo Server registration done! + goto end + :NOTNT + echo Warning : Cannot register Unicode EXE on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "Dropper - Win32 Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinSize" +# PROP BASE Intermediate_Dir "ReleaseMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinSize" +# PROP Intermediate_Dir "ReleaseMinSize" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O1 /D "_MBCS" /D "_ATL_DLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinSize +TargetPath=.\ReleaseMinSize\Dropper.exe +InputPath=.\ReleaseMinSize\Dropper.exe +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + "$(TargetPath)" /RegServer + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + echo Server registration done! + +# End Custom Build + +!ELSEIF "$(CFG)" == "Dropper - Win32 Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseMinDependency" +# PROP BASE Intermediate_Dir "ReleaseMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseMinDependency" +# PROP Intermediate_Dir "ReleaseMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O1 /D "_MBCS" /D "_ATL_STATIC_REGISTRY" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /opt:nowin98 +# SUBTRACT LINK32 /pdb:none +# Begin Custom Build - Performing registration +OutDir=.\ReleaseMinDependency +TargetPath=.\ReleaseMinDependency\Dropper.exe +InputPath=.\ReleaseMinDependency\Dropper.exe +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + "$(TargetPath)" /RegServer + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + echo Server registration done! + +# End Custom Build + +!ELSEIF "$(CFG)" == "Dropper - Win32 Unicode Release MinSize" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinSize" +# PROP BASE Intermediate_Dir "ReleaseUMinSize" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinSize" +# PROP Intermediate_Dir "ReleaseUMinSize" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O1 /D "_UNICODE" /D "_ATL_DLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinSize +TargetPath=.\ReleaseUMinSize\Dropper.exe +InputPath=.\ReleaseUMinSize\Dropper.exe +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + "$(TargetPath)" /RegServer + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + echo Server registration done! + goto end + :NOTNT + echo Warning : Cannot register Unicode EXE on Windows 95 + :end + +# End Custom Build + +!ELSEIF "$(CFG)" == "Dropper - Win32 Unicode Release MinDependency" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "ReleaseUMinDependency" +# PROP BASE Intermediate_Dir "ReleaseUMinDependency" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "ReleaseUMinDependency" +# PROP Intermediate_Dir "ReleaseUMinDependency" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O1 /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# Begin Custom Build - Performing registration +OutDir=.\ReleaseUMinDependency +TargetPath=.\ReleaseUMinDependency\Dropper.exe +InputPath=.\ReleaseUMinDependency\Dropper.exe +SOURCE="$(InputPath)" + +"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + if "%OS%"=="" goto NOTNT + if not "%OS%"=="Windows_NT" goto NOTNT + "$(TargetPath)" /RegServer + echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" + echo Server registration done! + goto end + :NOTNT + echo Warning : Cannot register Unicode EXE on Windows 95 + :end + +# End Custom Build + +!ENDIF + +# Begin Target + +# Name "Dropper - Win32 Debug" +# Name "Dropper - Win32 Unicode Debug" +# Name "Dropper - Win32 Release MinSize" +# Name "Dropper - Win32 Release MinDependency" +# Name "Dropper - Win32 Unicode Release MinSize" +# Name "Dropper - Win32 Unicode Release MinDependency" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\Include\src\appmisc.cpp +# End Source File +# Begin Source File + +SOURCE=.\DropDlg.cpp +# End Source File +# Begin Source File + +SOURCE=.\Dropper.cpp +# End Source File +# Begin Source File + +SOURCE=.\Dropper.rc +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\DropDlg.h +# End Source File +# Begin Source File + +SOURCE=.\Resource.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.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=.\Dropper.rgs +# End Source File +# Begin Source File + +SOURCE=.\icon1.ico +# End Source File +# End Group +# End Target +# End Project +# Section Dropper : {00000000-0000-0000-0000-800000800000} +# 1:11:IDD_DROPDLG:101 +# End Section diff --git a/Dropper.dsw b/Dropper.dsw new file mode 100644 index 0000000..251d055 --- /dev/null +++ b/Dropper.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "Dropper"=.\Dropper.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/Dropper.h b/Dropper.h new file mode 100644 index 0000000..1ef92a3 --- /dev/null +++ b/Dropper.h @@ -0,0 +1 @@ +/* MIDL: this ALWAYS GENERATED file contains the definitions for the interfaces */ diff --git a/Dropper.idl b/Dropper.idl new file mode 100644 index 0000000..cdf89c3 --- /dev/null +++ b/Dropper.idl @@ -0,0 +1,20 @@ +// Dropper.idl : IDL source for Dropper.dll +// + +// This file will be processed by the MIDL tool to +// produce the type library (Dropper.tlb) and marshalling code. + +import "oaidl.idl"; +import "ocidl.idl"; + +[ + uuid(83D2653F-81BA-4E24-B420-EB5CC9A94912), + version(1.0), + helpstring("Dropper 1.0 Type Library") +] +library DROPPERLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + +}; diff --git a/Dropper.rc b/Dropper.rc new file mode 100644 index 0000000..2e13ba7 --- /dev/null +++ b/Dropper.rc @@ -0,0 +1,175 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// 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 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "\0" + VALUE "FileDescription", "Dropper Module\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "Dropper\0" + VALUE "LegalCopyright", "Copyright 2001\0" + VALUE "OriginalFilename", "Dropper.EXE\0" + VALUE "ProductName", "Dropper Module\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "OLESelfRegister", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_Dropper REGISTRY MOVEABLE PURE "Dropper.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DROPDLG DIALOG DISCARDABLE 0, 0, 280, 198 +STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +CAPTION "Dropper" +FONT 8, "Tahoma" +BEGIN + EDITTEXT IDC_LOG,4,48,272,146,ES_MULTILINE | ES_AUTOHSCROLL | + ES_READONLY | WS_VSCROLL + COMBOBOX IDC_BATCH,30,26,200,135,CBS_DROPDOWNLIST | CBS_SORT | + WS_VSCROLL | WS_TABSTOP + LTEXT "Script:",IDC_STATIC,4,28,22,8 + PUSHBUTTON "Run",IDC_RUN,237,26,39,14 + LTEXT "Drop files onto this window to run the batch file selected below.", + IDC_STATIC,29,7,247,9 + CONTROL "",IDC_MINSIZE,"Static",SS_BLACKRECT | NOT WS_VISIBLE,0, + 0,240,145 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_DROPDLG, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 276 + TOPMARGIN, 4 + BOTTOMMARGIN, 194 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MAIN ICON DISCARDABLE "icon1.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "Dropper" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Dropper.rgs b/Dropper.rgs new file mode 100644 index 0000000..068205c --- /dev/null +++ b/Dropper.rgs @@ -0,0 +1,16 @@ +HKCR +{ + NoRemove Microsoft + { + NoRemove Windows + { + NoRemove CurrentVersion + { + NoRemove App Paths + { + Dropper.exe = s '%MODULE%' + } + } + } + } +} diff --git a/Dropperps.def b/Dropperps.def new file mode 100644 index 0000000..cf03880 --- /dev/null +++ b/Dropperps.def @@ -0,0 +1,11 @@ + +LIBRARY "DropperPS" + +DESCRIPTION 'Proxy/Stub DLL' + +EXPORTS + DllGetClassObject @1 PRIVATE + DllCanUnloadNow @2 PRIVATE + GetProxyDllInfo @3 PRIVATE + DllRegisterServer @4 PRIVATE + DllUnregisterServer @5 PRIVATE diff --git a/Dropperps.mk b/Dropperps.mk new file mode 100644 index 0000000..caa5088 --- /dev/null +++ b/Dropperps.mk @@ -0,0 +1,16 @@ + +Dropperps.dll: dlldata.obj Dropper_p.obj Dropper_i.obj + link /dll /out:Dropperps.dll /def:Dropperps.def /entry:DllMain dlldata.obj Dropper_p.obj Dropper_i.obj \ + kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \ + +.c.obj: + cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \ + $< + +clean: + @del Dropperps.dll + @del Dropperps.lib + @del Dropperps.exp + @del dlldata.obj + @del Dropper_p.obj + @del Dropper_i.obj diff --git a/StdAfx.cpp b/StdAfx.cpp new file mode 100644 index 0000000..a5eea17 --- /dev/null +++ b/StdAfx.cpp @@ -0,0 +1,12 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +#include +#include +#endif + +#include diff --git a/StdAfx.h b/StdAfx.h new file mode 100644 index 0000000..e2ffa16 --- /dev/null +++ b/StdAfx.h @@ -0,0 +1,34 @@ +// 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__BE1366E9_02FB_41B5_8CAC_F1859E57CA1E__INCLUDED_) +#define AFX_STDAFX_H__BE1366E9_02FB_41B5_8CAC_F1859E57CA1E__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define STRICT +#define _WIN32_WINNT 0x0400 +#define WINVER 0x0400 +#define _ATL_APARTMENT_THREADED + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module + +extern CComModule _Module; +#include +#include +#include +#include + +#include +#include +#include + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__BE1366E9_02FB_41B5_8CAC_F1859E57CA1E__INCLUDED) diff --git a/icon1.ico b/icon1.ico new file mode 100644 index 0000000..7129199 Binary files /dev/null and b/icon1.ico differ diff --git a/initial.tmp b/initial.tmp deleted file mode 100644 index e69de29..0000000 diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..eda2d5d --- /dev/null +++ b/resource.h @@ -0,0 +1,23 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Dropper.rc +// +#define IDS_PROJNAME 100 +#define IDR_Dropper 100 +#define IDD_DROPDLG 101 +#define IDC_LOG 201 +#define IDI_MAIN 201 +#define IDC_BATCH 203 +#define IDC_RUN 204 +#define IDC_MINSIZE 205 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 202 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 206 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif -- cgit v1.2.3