目录

Visual C++免注册调用大漠插件

Visual C++免注册调用大漠插件

1、 注册调用

一、下载大漠插件,并注册到系统

下载地址:https://pan.baidu.com/s/1nCc5jB4izcp_I2J6JLqEKA 提取码:tf1f

二、创建一个空项目

添加main.cppmain.h,导入插件中的obj.cppobj.h文件

三、修改obj.cpp中引入的头文件

#include "stdafx.h"去除 #include "main.h要放前面"

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NodWhlMTYz,size_16,color_FFFFFF,t_70.png

四、更改运行库为“多线程(/MT)”

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NodWhlMTYz,size_16,color_FFFFFF,t_70-20210916161452152.png

五、main.h

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#ifndef MAIN_H
#define MAIN_H

#include <afx.h>
#include <afxwin.h>
#include <afxext.h>
#include <atlbase.h>
#include <atlstr.h>
#include <afxdtctl.h>
#include <afxcmn.h>
#include <afxdisp.h>
#include "obj.h"

#endif

六、main.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "main.h"
#include "obj.h"
#include <iostream>

using namespace std;



int main()
{
	

	CoInitializeEx(NULL, 0);//初始化
	AfxWinInit(GetModuleHandle(NULL), NULL, GetCommandLine(), 0);
	dmsoft* pDm = new dmsoft;
	pDm->MoveTo(0, 0);	
	pDm->RunApp(L"notepad", 1);
	pDm->delay(3000);
	pDm->KeyPressStr(L"123456789011", 20);
	wcout << (LPCTSTR)(pDm->Ver())<< endl;
	
	return 0;

}

2、免注册调用

一、创建一个空项目

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NodWhlMTYz,size_16,color_FFFFFF,t_70-20210916161709596.png

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NodWhlMTYz,size_16,color_FFFFFF,t_70-20210916161730110.png

二、添加main.cpp

1
2
3
4
5
6
7
#include <iostream>
#import "dm.dll" no_namespace

int main()
{
	return 0;
}

三、添加dm.dll

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/20210117153813955.gif

四、生成解决方案

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/20210117154720405.gif

五、编译成功后会生成dm.tlh和dm.tli文件

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NodWhlMTYz,size_16,color_FFFFFF,t_70-20210916161835003.png

六、修改dm.tlh

修改前

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NodWhlMTYz,size_16,color_FFFFFF,t_70-20210916161848976.png

修改后

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NodWhlMTYz,size_16,color_FFFFFF,t_70-20210916161900152.png

七、main.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
//#import "dm.dll" no_namespace
#include "Debug\dm.tlh"
using namespace std;

Idmsoft* GetDmObject()
{
	Idmsoft* m_dm = NULL;
	bool m_bInit = false;
	//直接加载dll创建对象,避免进行注册文件
	typedef HRESULT(_stdcall* pfnGCO)(REFCLSID, REFIID, void**);
	pfnGCO fnGCO = NULL;
	HINSTANCE hdllInst = LoadLibrary(L"dm.dll");
	fnGCO = (pfnGCO)GetProcAddress(hdllInst, "DllGetClassObject");
	if (fnGCO != 0)
	{
		IClassFactory* pcf = NULL;
		HRESULT hr = (fnGCO)(__uuidof(dmsoft), IID_IClassFactory, (void**)&pcf);
		if (SUCCEEDED(hr) && (pcf != NULL))
		{
			hr = pcf->CreateInstance(NULL, __uuidof(Idmsoft), (void**)&m_dm);
			if ((SUCCEEDED(hr) && (m_dm != NULL)) == FALSE)
				return NULL;

		}
		pcf->Release();
		m_bInit = true;
	}
	else
		m_bInit = false;
	return m_dm;

}

int main()
{
	Idmsoft* pDm = GetDmObject();
	cout << pDm->Ver() << endl;
	//dm->Reg(L"注册码", L"dass");//收费版本需要注册后才能使用
	/*6.1538版本修改内存可直接调用*/
	DWORD pid = GetCurrentProcessId();
	int handle = (int)GetModuleHandle(L"dm.dll");
	cout << "进程ID:" << pid << "模块句柄:" << handle << endl;
	HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
	int value = 1;
	bool is = WriteProcessMemory(hProcess, LPVOID(handle + 1078240), &value, 1, NULL);
	/*调用大漠插件内函数*/
	pDm->MoveTo(0, 0);
	pDm->delay(3000);	
	pDm->KeyPressStr("1234567890", 10);

	return 0;

}

注册码

https://cdn.jsdelivr.net/gh/xinqinew/pic@main/img/image-20210916171905862.png

注册码:3093030f54fe75b8478f7c56fec81fc903841a9 附加码:Z3Ipwoyq5 注朋码:yiging123c12aba5b0179907a750692b023298f12"ww168168” 注册码: qq760471367f21b0879268408e5096b92cb022804da附加码vvv0000 注册码:zhangxuhvi2d3b98fcd75ac8ee163feadabc6191b85附加码7b666777

必要函数

​ CoInitializeEx(NULL, 0);//大漠所需 com组件在线程中调用的时候,需要初始化一下这个函数 。

​ CoUninitialize(); //大漠所需,析构时释放。