当前位置: 首页 > news >正文

企业网站 .networdpress portal

企业网站 .net,wordpress portal,如何做h5,建筑工程网络计划图中怎样算总工期DLL文件在CANoe的使用方法 DLL文件在诊断里面可以用在0x27秘钥服务里面#xff0c;对解密有帮助#xff0c;在下图位置加载。 DLL文件制作 vector公司本来就给了我们一个demo#xff0c;先拷贝一份下来#xff0c;别把原来的文件给改坏了。我这个是CANoe12#xff0c;de…DLL文件在CANoe的使用方法 DLL文件在诊断里面可以用在0x27秘钥服务里面对解密有帮助在下图位置加载。 DLL文件制作 vector公司本来就给了我们一个demo先拷贝一份下来别把原来的文件给改坏了。我这个是CANoe12demo代码的路径在C:\Users\Public\Documents\Vector\CANoe\Sample Configurations 12.0.75\CAN\Diagnostics\UDSSystem\SecurityAccess\Sources大家可以参考下把里面这个KeyGenDll_GenerateKeyEx文件夹复制一份出来当然你也可以用KeyGenDll_GenerateKeyExOpt待会打开源代码看得到是差不多的。 打开Visual Studio 2019将工程里面的工程文件GenerateKeyExImpl.vcproj拖进去就能打开工程。展开工程然后打开源文件GenerateKeyExImpl.cpp。 程序比较简单还有注释里面有很多空行我删了几行放在这里大家看看这个是工程KeyGenDll_GenerateKeyEx的源代码。 // KeyGeneration.cpp : Defines the entry point for the DLL application. #include windows.h #include KeyGenAlgoInterfaceEx.hBOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {return TRUE; }KEYGENALGO_API VKeyGenResultEx GenerateKeyEx(const unsigned char* iSeedArray, /* Array for the seed [in] */unsigned int iSeedArraySize, /* Length of the array for the seed [in] */const unsigned int iSecurityLevel, /* Security level [in] */const char* iVariant, /* Name of the active variant [in] */unsigned char* ioKeyArray, /* Array for the key [in, out] */unsigned int iKeyArraySize, /* Maximum length of the array for the key [in] */unsigned int oSize /* Length of the key [out] */) {if (iSeedArraySizeiKeyArraySize)return KGRE_BufferToSmall;for (unsigned int i0;iiSeedArraySize;i)ioKeyArray[i]~iSeedArray[i];oSizeiSeedArraySize;return KGRE_Ok; }这个是KeyGenDll_GenerateKeyExOpt工程的源代码GenerateKeyExOpt.cpp相对于KeyGenDll_GenerateKeyEx工程就是多了个选项作为入参高级用法才会用到我们一般都用不到所以这里就用KeyGenDll_GenerateKeyEx工程。 // /// Seed Key DLL with extended interface and options argument /// This is an example implementation for CANoe demo configuration UDSsim //#include windows.h #include GenerateKeyExOpt.hKEYGENALGO_API VKeyGenResultExOpt GenerateKeyExOpt(const unsigned char* ipSeedArray, // Array for the seed [in]unsigned int iSeedArraySize, // Length of the array for the seed [in]const unsigned int iSecurityLevel, // Security level [in]const char* ipVariant, // Name of the active variant [in]const char* ipOptions, // Optional parameter which might be used for OEM specific information [in]unsigned char* iopKeyArray, // Array for the key [in, out]unsigned int iMaxKeyArraySize, // Maximum length of the array for the key [in]unsigned int oActualKeyArraySize) // Length of the key [out] {// Check the input argumentsif( iSecurityLevel 0 || iSecurityLevel 10)return KGREO_SecurityLevelInvalid;if( iMaxKeyArraySize iSeedArraySize || 4 iSeedArraySize)return KGREO_BufferToSmall;if( !ipSeedArray || !iopKeyArray || !ipOptions || strlen( ipOptions) iSeedArraySize)return KGREO_UnspecifiedError;// Copy the input bytes to the output bytesmemcpy( iopKeyArray, ipSeedArray, iSeedArraySize);// As an example each byte in the options array will be added to each byte of the seed array securityLevel times.for( unsigned int l 0; l iSecurityLevel; l){for( unsigned int i 0; i iSeedArraySize; i)iopKeyArray[i] ipOptions[i];}oActualKeyArraySize iSeedArraySize;return KGREO_Ok; } 修改KeyGenDll_GenerateKeyEx工程源代码GenerateKeyExImpl.cpp里面做了注释。 KEYGENALGO_API VKeyGenResultEx GenerateKeyEx(unsigned char* iSeedArray, /* 种子数组 */unsigned int iSeedArraySize, /* 种子长度 */const unsigned int iSecurityLevel, /* 秘钥等级调试打印 */const char* iVariant, /* 激活状态调试打印 */unsigned char* ioKeyArray, /* 秘钥数组 */unsigned int iKeyArraySize, /* 秘钥长度 */unsigned int oSize /* 秘钥长度调试打印 */) {if (iSeedArraySizeiKeyArraySize)//秘钥长度大于种子长度的话就是长度错误return KGRE_BufferToSmall;……(这里是我的算法计算出来的秘钥放在iSeedArray[]数组)for (int i 0; i iKeyArraySize; i) {ioKeyArray[i] iSeedArray[i];}oSize iSeedArraySize;//这个其实没啥用长度是CDD里面定义的return KGRE_Ok; } 对着工程右键重新生成就行输出信息会告诉你把DLL文件生成到了哪里。 DLL文件检查 如果你很有自信一次写对那直接在CANoe里面直接加载就行。如果想谨慎点想要检查写得对不对就新建个控制台工程来调用DLL文件里面的函数进行验证。 把上面生成的DLL文件拷贝到控制台路径下。 调用代码如下 // CallDLL.cpp : 此文件包含 main 函数。程序执行将在此处开始并结束。 // #include iostream #include Windows.h #include tchar.husing namespace std; #define iSeedArraySize 16 const unsigned char SeedArray[iSeedArraySize] {0xD1,0x28,0xD2,0x7B,0x25,0xCE,0x78,0x22,0xCB,0x75,0x1E,0xC8,0x71,0x1B,0xC5,0x6E }; const unsigned int iSecurityLevel 1; const char iVariant 0;#define iKeyArraySize 16 unsigned char ioKeyArray[iSeedArraySize] { 0x0 };unsigned int oSize 0;int main() {HINSTANCE handle LoadLibrary(_T(SeednKey.dll));//加载dll ,需要加上头文件tchar.h并在调用时加上_T 由句柄指向dll文件cout Dll Adddr: handle endl;if (handle){typedef int(*GenerateKeyExOpt_API_Type)(const unsigned char*,unsigned int,const unsigned int,const char*,unsigned char*,unsigned int,unsigned int );GenerateKeyExOpt_API_Type GenerateKeyExOpt_API_Point (GenerateKeyExOpt_API_Type)GetProcAddress(handle, GenerateKeyEx); //GetProcAddress获取dll中的Add_Func函数用add_API_Point指向函数它cout dll 函数的句柄返回值: GenerateKeyExOpt_API_Point endl;//打印dll的函数句柄地址值,不为0就说明调用成功printf(\n);if (GenerateKeyExOpt_API_Point){int result (*GenerateKeyExOpt_API_Point)(SeedArray,iSeedArraySize, iSecurityLevel,iVariant, ioKeyArray, iKeyArraySize, oSize);for (int i 0; i iSeedArraySize; i) {/*打印种子*/printf(SeedArray[%d]: %2X\n, i, SeedArray[i]);}printf(\n);for (int j 0; j iKeyArraySize; j) {/*打印秘钥*/printf(ioKeyArray[%d]: %2X\n, j, ioKeyArray[j]);}cout oSize oSize endl;/*调试打印*/FreeLibrary(handle); //释放句柄}}return 0; }// Run program: Ctrl F5 or Debug Start Without Debugging menu // Debug program: F5 or Debug Start Debugging menu 对一下打印出来的结果是对的话就是验证通过。 CDD文件配置 0x27服务的长度是在CDD文件里面配置的单纯改代码是改不动的。 用CANdelaStudio打开CDD文件勾选这个把0x27服务带出来。 长度解密等级都在这里设置。 DLL文件使用 按照本文最上面的使用方法加载进去双击能发送。
http://www.sadfv.cn/news/63781/

相关文章:

  • 网站建设中最基本的决策江西住房和城乡建设厅网站
  • scratch编程网站讯美网站建设
  • 有哪个网站可以学做面条开面馆wordpress修改域名文件夹
  • 免费建站哪个网站最好深圳wordpress培训
  • 国外网站流量免费物流公司网站模板
  • 璧山集团网站建设电商平台运营公司
  • 深圳动力网站设计公司wordpress随机图片
  • 建设银行投资网站首页哈尔滨市建设安全监察网站
  • 外贸网站怎么做关键词建设电影网站赚钱
  • asp网站源码+access+机械建设银行亚洲网站
  • 网站建设一般要素太平洋建设集团有限公司
  • 网站建设报告书范文微商引流的最快方法是什么
  • 山东建设发展研究院网站软文推广收费
  • 网页及网站建设用什么软件免费查企业信息查询
  • 成都市住房和城乡建设厅官方网站天津整站
  • 四川省安监站网址汾阳网架公司
  • 网站制作有什么好的介绍文化投资的微网站怎么做
  • 装修上什么网站比较好郑州网站建设创新网络
  • 南京做网站优化哪家好宿迁房产网官网备案
  • 网站建设文章缩略图沈阳百度推广哪家好
  • 女做受视频网站网站建设自查维护报告
  • 上海微信网站开发精简wordpress博客程序
  • 紫川网站建设百度怎样发布作品
  • 中国城乡住房建设厅网站首页上海集团网站建设
  • asp网站开发wordpress给文章设置标签
  • 突泉建设局三务公开网站cfa一级看多久两分钟
  • 企业建设网站个人总结报告个人如何建立微信公众号
  • 网站代码在哪里看wordpress json ld
  • 长春做网站的公司有哪些怎样自己做网站卖钱
  • 网站底部关键词内链3分钟搞定网站seo优化外链建设