用拷贝钩子实现对文件夹的监控
作者 佚名技术
来源 程序设计
浏览
发布时间 2012-06-30
e Project1Module; TComModule &_Module = Project1Module; // 这是要添加到注册表中的项,注意如果你要使用这段代码,应该用UUIDGEN.exe生成一 // 个新的CLSID。 const char* szRegTable[][3]= { {"CLSID\\{7e10a039-fe03-4f9c-b7e1-c5eeeaf53735}", 0, "CopyHook"}, {"CLSID\\{7e10a039-fe03-4f9c-b7e1-c5eeeaf53735}\\InProcServer32", 0, (const char*)-1}, {"CLSID\\{7e10a039-fe03-4f9c-b7e1-c5eeeaf53735}\\InProcServer32", "ThreadingModel", "Apartment"}, {"CLSID\\{7e10a039-fe03-4f9c-b7e1-c5eeeaf53735}\\ProgID", 0, "webber84.CopyHook.1"}, {"webber84.CopyHook.1", 0, "CopyHook"}, {"webber84.CopyHook.1\\CLSID", 0, "{7e10a039-fe03-4f9c-b7e1-c5eeeaf53735}"} }; HMODULE hInstance = NULL; LONG nLocks = 0; //--------------------------------------------------------------------------- // The ATL Object map holds an array of _ATL_OBJMAP_ENTRY structures that // described the objects of your OLE server. The MAP is handed to your // project''s CComModule-derived _Module object via the Init method. BEGIN_OBJECT_MAP(ObjectMap) END_OBJECT_MAP() //--------------------------------------------------------------------------- // Entry point of your Server invoked by Windows for processes or threads are // initialized or terminated. int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { if(reason == DLL_PROCESS_ATTACH) hInstance = (HMODULE)hinst; return TRUE; } //--------------------------------------------------------------------------- // _Module.Term is typically invoked from the DLL_PROCESS_DETACH of your // DllEntryPoint. However, this may result in an incorrect shutdown sequence. // Instead an Exit routine is setup to invoke the cleanup routine // CComModule::Term. void ModuleTerm(void) { _Module.Term(); } #pragma exit ModuleTerm 63 //--------------------------------------------------------------------------- // Entry point of your Server invoked to inquire whether the DLL is no // longer in use and should be unloaded. STDAPI __export DllCanUnloadNow(void) { return nLocks == 0? S_OK: S_FALSE; } //--------------------------------------------------------------------------- // Entry point of your Server allowing OLE to retrieve a class object from // your Server STDAPI __export DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { HRESULT hr = E_OUTOFMEMORY; *ppv = NULL; TClassFactory *pClassFactory = new TClassFactory; if(pClassFactory != NULL) hr = pClassFactory->QueryInterface(riid, ppv); return hr; } //--------------------------------------------------------------------------- // Entry point of your Server invoked to instruct the server to create // registry entries for all classes supported by the module STDAPI __export DllRegisterServer(void) { HRESULT hr = S_OK; int nItems = sizeof(szRegTable) / sizeof(szRegTable[0]); char szDllPath[MAX_PATH]; GetModuleFileName(hInstance, szDllPath, MAX_ |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
上一篇: 关于PE可执行文件的修改下一篇: 歓sdk幹秀嬬俊辺猟周溶慧議完悶
关于用拷贝钩子实现对文件夹的监控的所有评论