Creating A DLL Of An Application Using wxWidgets

本文介绍如何使用wxWidgets 2.6.2创建带有GUI支持的DLL应用程序,并提供了一个简单的示例,说明如何将对话框存储在DLL中,并在其他语言的应用程序中使用。

Creating A DLL Of An Application

From WxWiki

Jump to: navigation, search

Contents

[hide]
[ edit]

Creating a wxWidgets DLL application

Basically you need to define:

  • dllmain()

wxInitialize()(instead of wxEntry)

  • wxTheApp->OnExit()

wxUninitialize()


These functions may be found in app.cpp. There are 2 definitions based on the _WINDLL ifdef. Information may also be found by reading:

  • wx2/src/makefile.vc
  • wx2/src/makevc.env
  • wx2/src/msw/makefile.vc

Remember to use a .def-file or WXEXPORT with the classes/functions you need to export.

This did not work for me (mimo_at_gn.apc.org). Maybe you can add some more. I am trying to get hold of this guy -> Slavek who seems to have found a work around and planned to write a HOWTO. An example in this place would be very helpful.

[ edit]

Examples

wxjs is said to be a good example of how to make a wxWidgets DLL

A simple example is available here: fromdll.zip

The fromdll.zip example above is compatible with wxWidgets versions up to and excluding 2.5.4, follow the link below for an example of a DLL application which links to more recent versions of wxWidgets:

http://wxforum.shadonet.com/viewtopic.php?p=5964#5964

[ edit]

Problems

Problems are reported with wxThread internal initialisation.

Also the 2.5.2 release has wxEntry decleration issues. Get the fixed app.h files from CVS for now.

This appear to be broken in 2.5.3, could someone do a update with the proper way to do this now.

[ edit]

Creating a wxWidgets DLL application with wxWidgets 2.6.2, with GUI support

Here is a simple example which allows you to store some dialogs in a wxWidgets DLL application the 2.6.2 way, and use that DLL in any other language. That code is directly insipired from fromdll.zip example above.

Header file : wxWidgetsDLL.h


 #ifndef wxWidgetsDLLH
 #define wxWidgetsDLLH
 
 #pragma once
 
 /*This is the method i use to link the libs to my DLL project in c++ builder 6, not used with eg. mingw32/dev-cpp
   if anybody has a hint on c++ builder 6 linking, just tell me 
 */
 #ifdef CBUILDER
 #pragma link "wxzlib.lib" 
 #pragma link "wxmsw26.lib"
 #endif
 
 #include "wx/wx.h"
 
 #include <windows.h>
 #include <process.h>
 
 HANDLE ThreadId;
 
 class wxDLLApp : public wxApp
 {
 	bool OnInit();
 };
 
 #endif wxWidgetsDLLH 
 


Source file : wxWidgetsDLL.cpp

  
Creating A DLL Of An Application
From WxWiki
Jump to: navigation, search
Contents [hide]
1  Creating a wxWidgets DLL application 
2  Examples 
3  Problems 
4  Creating a wxWidgets DLL application with wxWidgets  2.6 . 2 , with GUI support 
 
[edit]Creating a wxWidgets DLL application 
Basically you need to define: 

dllmain() 
wxInitialize()(instead of wxEntry) 

wxTheApp
-> OnExit() 
wxUninitialize() 




These functions may be found 
in  app.cpp. There are  2  definitions based on the _WINDLL ifdef. Information may also be found by reading: 

wx2
/ src / makefile.vc 
wx2
/ src / makevc.env 
wx2
/ src / msw / makefile.vc 
Remember to use a .def
- file or WXEXPORT with the classes / functions you need to export. 

This did not work 
for  me (mimo_at_gn.apc.org). Maybe you can add some more. I am trying to  get  hold of  this  guy  ->  Slavek who seems to have found a work around and planned to write a HOWTO. An example  in   this  place would be very helpful. 

[edit]Examples 
wxjs 
is  said to be a good example of how to make a wxWidgets DLL 

A simple example 
is  available here: fromdll.zip 

The fromdll.zip example above 
is  compatible with wxWidgets versions up to and excluding  2.5 . 4 , follow the link below  for  an example of a DLL application which links to more recent versions of wxWidgets: 

http:
// wxforum.shadonet.com/viewtopic.php?p=5964#5964 

[edit]Problems 
Problems are reported with wxThread 
internal  initialisation. 

Also the 
2.5 . 2  release has wxEntry decleration issues. Get the  fixed  app.h files from CVS  for  now. 

This appear to be broken 
in   2.5 . 3 , could someone  do  a update with the proper way to  do   this  now. 

[edit]Creating a wxWidgets DLL application with wxWidgets 
2.6 . 2 , with GUI support 
Here 
is  a simple example which allows you to store some dialogs  in  a wxWidgets DLL application the  2.6 . 2  way, and use that DLL  in  any other language. That code  is  directly insipired from fromdll.zip example above. 

Header file : wxWidgetsDLL.h 




 #ifndef wxWidgetsDLLH
 
#define  wxWidgetsDLLH
 
 
#pragma  once
 
 
/* This is the method i use to link the libs to my DLL project in c++ builder 6, not used with eg. mingw32/dev-cpp
   if anybody has a hint on c++ builder 6 linking, just tell me 
 
*/
 #ifdef CBUILDER
 
#pragma  link "wxzlib.lib" 
 
#pragma  link "wxmsw26.lib"
 
#endif
 
 #include 
" wx/wx.h "
 
 #include 
< windows.h >
 #include 
< process.h >
 
 HANDLE ThreadId;
 
 
class  wxDLLApp :  public  wxApp
 {
     
bool  OnInit();
 };
 
 
#endif  wxWidgetsDLLH 
 

Source file : wxWidgetsDLL.cpp 

 #include 
" wx/wx.h "
 #include 
< process.h >  
 #include 
" Unit1.h "  
 
 IMPLEMENT_APP_NO_MAIN(wxDLLApp)
 
 DWORD WINAPI ThreadProc(LPVOID lpParameter)
 {
     wxApp::SetInstance(
new  wxDLLApp());
     wxEntry(GetModuleHandle(NULL),NULL,NULL,SW_SHOW);
     
return   true ;
 }
 
 BOOL APIENTRY DllMain(HANDLE hModule,
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
                       ) 
 {
     
switch  (ul_reason_for_call)
     { 
     
case  DLL_PROCESS_ATTACH:
         ThreadId 
=  CreateThread(NULL, 0 ,ThreadProc,NULL, 0 ,NULL);
         
break ;
     
case  DLL_THREAD_ATTACH:  break ;
     
case  DLL_THREAD_DETACH:  break ;
     
case  DLL_PROCESS_DETACH:
         wxEntryCleanup();
         
break
     }
 
     
return  TRUE;
 }
 
 
//  I could have #define MYEXPORT __stdcall __declspec(dllexport) but it works that way too... 
  extern   " C "  __stdcall __declspec(dllexport)  void  DLLFunction(HWND handle) 
 {
     wxDialog 
*  dlg  =   new  wxDialog(NULL, - 1 , " Hello World From DLL " ,wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE,wxDialogNameStr);
     dlg
-> Show();
 }
 
 
bool  wxDLLApp::OnInit()
 {
     
return   true ;
 }
I hope 
this  helps, actually it worked  for  me, i ran some tests with the dll linked with a Delphi application, and the dialog box shows up. But please note that there are some issues when linking your DLL statically with wxWidgets. What i did  is  linking my DLL dynamically with wxWidgets, it seemed to solve all application initialization errors, so don ' t forget to define WXUSINGDLL in your compiler ' s settings, and compile your wxWidgets libs dynamically, at least  for  making wxWidgets DLLs. 

Any feedback
/ comments : tomprod at wanadoo dot fr 

Retrieved from 
" http://www.wxwidgets.org/wiki/index.php/Creating_A_DLL_Of_An_Application "

I hope this helps, actually it worked for me, i ran some tests with the dll linked with a Delphi application, and the dialog box shows up. But please note that there are some issues when linking your DLL statically with wxWidgets. What i did is linking my DLL dynamically with wxWidgets, it seemed to solve all application initialization errors, so don't forget to define WXUSINGDLL in your compiler's settings, and compile your wxWidgets libs dynamically, at least for making wxWidgets DLLs.

Any feedback/comments : tomprod at wanadoo dot fr

内容概要:本文详细记录了对一个Android ARM64静态ELF文件中字符串加密机制的逆向分析过程。该ELF文件的所有字符串均被加密,无法通过常规strings命令或IDA直接识别。作者通过分析发现,加密字符串存储在.rodata段,其解密所需信息(包括密文地址、长度和16位密钥)保存在.data.rel.ro段的40字节描述符中。核心解密函数sub_10F408采用自反的双pass流密码算法,结合固定密钥KEY_TERM(由.data段24字节数据计算得出),实现字节级非线性、位置与长度相关的加密。文章还复现了完整的Python解密脚本,并揭示了该保护机制的本质为代码混淆而非强加密,最终成功批量解密全部956条字符串,暴露程序真实行为,如shell命令模板、设备标识篡改、网络重置等操作。此外,文中还提及未启用的自定义壳框架及其反dump设计。; 适合人群:具备逆向工程基础的安全研究人员、二进制分析人员及对ELF保护技术感兴趣的开发者。; 使用场景及目标:①学习ELF二进制中字符串加密的典型实现方式与逆向突破口;②掌握从结构识别、函数追踪到算法还原的完整逆向流程;③理解“绑定二进制”的完整性校验设计及其局限性;④实践编写IDAPython脚本自动化提取与解密敏感数据。; 阅读建议:此资源以实战案例驱动,不仅展示技术细节,更强调逆向思维与验证方法,建议读者结合IDA调试环境,逐步跟随文中步骤进行动态分析与算法验证,深入理解每一步的推理依据。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值