summaryrefslogtreecommitdiff
path: root/Dropper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Dropper.cpp')
-rw-r--r--Dropper.cpp81
1 files changed, 81 insertions, 0 deletions
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 <initguid.h>
+
+#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;
+}