summaryrefslogtreecommitdiff
path: root/Dropper.cpp
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2003-09-16 13:44:06 +0000
committerStef Walter <stef@thewalter.net>2003-09-16 13:44:06 +0000
commit5c521d256815161f4af9066bc4bb9fea7fa1accb (patch)
tree56ca291cd06833f053f047dc7bb00484f3129a2f /Dropper.cpp
parentb0b7ef8d60e3603d6bcc9af45cd9ef0d6094fb9d (diff)
Initial ImportHEADmaster
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;
+}