// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "stdafx.h"
#include "rxregsvc.h"
#include "aced.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
class EmrReactor:public AcEditorReactor
{
struct Data
{
virtual~Data()
{
}
Data* m_pData;
};
virtual void dwgFileOpened(AcDbDatabase*pDb, ACHAR* fileName)
{
#ifdef _WIN64
CONTEXT con;
RtlCaptureContext(&con);
#else
#endif
if(pDb->isEMR())
{
#ifdef _WIN64
int iOff=GetEmrOff(con.Rip);
#else
typedef bool (AcDbDatabase::*FunEmr)()const;
FunEmr *pFun= &(&AcDbDatabase::isEMR);
int iOff=GetEmrOff(*((int*)((int*) pFun )));
#endif
Data *pData=reinterpret_cast<Data *>(pDb);
char *cVal=reinterpret_cast<char *>(pData->m_pData);
int*iVal=(int*)&(cVal[iOff]);
iVal[0]=0;
if(pDb->isEMR())
{
abort();
}
else
OutputDebugString(TEXT("Ok\n"));
}
}
#ifdef _WIN64
int GetEmrOff(INT_PTR iEmr)
{
iEmr += 0x9;
int iOff=((int*)iEmr)[0];
iEmr += iOff+4;//得到import的isEMR
iOff=((int*)&((char*)iEmr)[2])[0];
iEmr+=iOff+0x6;
INT_PTR iAddr=((INT_PTR*)iEmr)[0];//得到data的isEMR
iAddr+=0x5;
iOff=((int*)iAddr)[0];
iAddr+=iOff+4;
iOff=((int*)iAddr+1)[0];
return iOff;
}
#else
int GetEmrOff(int iEmr)
{
int iOff=((int*)&((char*)iEmr)[2])[0];
INT_PTR iAddr=((int*)iOff)[0]; //得到data的isEMR
iAddr+=0x4;
iOff=((int*)iAddr)[0];
iAddr+=iOff+4;
iOff=((int*)iAddr+1)[0];
return iOff;
}
#endif
};
EmrReactor *pActor=NULL;
extern "C" __declspec( dllexport )
AcRx::AppRetCode acrxEntryPoint( AcRx::AppMsgCode msg, void *appId )
{
switch(msg)
{
case AcRx::kInitAppMsg:
acrxDynamicLinker->unlockApplication(appId);
acrxDynamicLinker->registerAppMDIAware(appId);
pActor=new EmrReactor;
acedEditor->addReactor(pActor);
break;
case AcRx::kUnloadAppMsg:
acedEditor->removeReactor(pActor);
break;
}
return AcRx::kRetOK;
}
没有合适的资源?快使用搜索试试~ 我知道了~
消除AutoCAD dwg教育版标记
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共9个文件
cpp:3个
h:2个
arx:1个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 17 1 下载量 83 浏览量
2022-10-02
16:50:07
上传
评论
收藏 42KB ZIP 举报
温馨提示
virtual void dwgFileOpened(AcDbDatabase*pDb, ACHAR* fileName) { #ifdef _WIN64 CONTEXT con; RtlCaptureContext(&con); #else #endif if(pDb->isEMR()) { #ifdef _WIN64 int iOff=GetEmrOff(con.Rip); #else typedef bool (AcDbDatabase::*FunEmr)()const; FunEmr *pFun= &(&AcDbDatabase::isEMR); int iOff=GetEmrOff(*((int*)((int*) pFun ))); #endif Data *pData=reinterpret_cast<Data *>(pDb); char *cVal=reinterpret_cast<char *>(pData->m_pData); int*iVal=(int*)&(cVal[iOff]);
资源详情
资源评论
资源推荐
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 9 条
- 1
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![png](https://img-home.csdnimg.cn/images/20210720083516.png)
![application/x-zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![text/rtf](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
i-smith
- 粉丝: 3
- 资源: 1
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论0