首页 > 其他分享 >Dll代理

Dll代理

时间:2023-11-03 12:22:24浏览次数:32  
标签:USE 代理 DLL API fun Dll szSysDll define

#include "Common/NSimple.h"
#include <list>
#include <string>
#include "DllProxyLink.h"

using std::list;
using std::string;

#define DLL_Name	"winmm.dll"

#define DLL_API_LIST()								\
	DLL_API_USE(CloseDriver)	\
	DLL_API_USE(DefDriverProc)	\
	DLL_API_USE(DriverCallback)	\
	DLL_API_USE(DrvGetModuleHandle)	\
	DLL_API_USE(GetDriverModuleHandle)	\
	DLL_API_USE(NotifyCallbackData)	\
	DLL_API_USE(OpenDriver)	\
	DLL_API_USE(PlaySound)	\
	DLL_API_USE(PlaySoundA)	\
	DLL_API_USE(PlaySoundW)	\
	DLL_API_USE(SendDriverMessage)	\
	DLL_API_USE(WOW32DriverCallback)	\
	DLL_API_USE(WOW32ResolveMultiMediaHandle)	\
	DLL_API_USE(WOWAppExit)	\
	DLL_API_USE(aux32Message)	\
	DLL_API_USE(auxGetDevCapsA)	\
	DLL_API_USE(auxGetDevCapsW)	\
	DLL_API_USE(auxGetNumDevs)	\
	DLL_API_USE(auxGetVolume)	\
	DLL_API_USE(auxOutMessage)	\
	DLL_API_USE(auxSetVolume)	\
	DLL_API_USE(joy32Message)	\
	DLL_API_USE(joyConfigChanged)	\
	DLL_API_USE(joyGetDevCapsA)	\
	DLL_API_USE(joyGetDevCapsW)	\
	DLL_API_USE(joyGetNumDevs)	\
	DLL_API_USE(joyGetPos)	\
	DLL_API_USE(joyGetPosEx)	\
	DLL_API_USE(joyGetThreshold)	\
	DLL_API_USE(joyReleaseCapture)	\
	DLL_API_USE(joySetCapture)	\
	DLL_API_USE(joySetThreshold)	\
	DLL_API_USE(mci32Message)	\
	DLL_API_USE(mciDriverNotify)	\
	DLL_API_USE(mciDriverYield)	\
	DLL_API_USE(mciExecute)	\
	DLL_API_USE(mciFreeCommandResource)	\
	DLL_API_USE(mciGetCreatorTask)	\
	DLL_API_USE(mciGetDeviceIDA)	\
	DLL_API_USE(mciGetDeviceIDFromElementIDA)	\
	DLL_API_USE(mciGetDeviceIDFromElementIDW)	\
	DLL_API_USE(mciGetDeviceIDW)	\
	DLL_API_USE(mciGetDriverData)	\
	DLL_API_USE(mciGetErrorStringA)	\
	DLL_API_USE(mciGetErrorStringW)	\
	DLL_API_USE(mciGetYieldProc)	\
	DLL_API_USE(mciLoadCommandResource)	\
	DLL_API_USE(mciSendCommandA)	\
	DLL_API_USE(mciSendCommandW)	\
	DLL_API_USE(mciSendStringA)	\
	DLL_API_USE(mciSendStringW)	\
	DLL_API_USE(mciSetDriverData)	\
	DLL_API_USE(mciSetYieldProc)	\
	DLL_API_USE(mid32Message)	\
	DLL_API_USE(midiConnect)	\
	DLL_API_USE(midiDisconnect)	\
	DLL_API_USE(midiInAddBuffer)	\
	DLL_API_USE(midiInClose)	\
	DLL_API_USE(midiInGetDevCapsA)	\
	DLL_API_USE(midiInGetDevCapsW)	\
	DLL_API_USE(midiInGetErrorTextA)	\
	DLL_API_USE(midiInGetErrorTextW)	\
	DLL_API_USE(midiInGetID)	\
	DLL_API_USE(midiInGetNumDevs)	\
	DLL_API_USE(midiInMessage)	\
	DLL_API_USE(midiInOpen)	\
	DLL_API_USE(midiInPrepareHeader)	\
	DLL_API_USE(midiInReset)	\
	DLL_API_USE(midiInStart)	\
	DLL_API_USE(midiInStop)	\
	DLL_API_USE(midiInUnprepareHeader)	\
	DLL_API_USE(midiOutCacheDrumPatches)	\
	DLL_API_USE(midiOutCachePatches)	\
	DLL_API_USE(midiOutClose)	\
	DLL_API_USE(midiOutGetDevCapsA)	\
	DLL_API_USE(midiOutGetDevCapsW)	\
	DLL_API_USE(midiOutGetErrorTextA)	\
	DLL_API_USE(midiOutGetErrorTextW)	\
	DLL_API_USE(midiOutGetID)	\
	DLL_API_USE(midiOutGetNumDevs)	\
	DLL_API_USE(midiOutGetVolume)	\
	DLL_API_USE(midiOutLongMsg)	\
	DLL_API_USE(midiOutMessage)	\
	DLL_API_USE(midiOutOpen)	\
	DLL_API_USE(midiOutPrepareHeader)	\
	DLL_API_USE(midiOutReset)	\
	DLL_API_USE(midiOutSetVolume)	\
	DLL_API_USE(midiOutShortMsg)	\
	DLL_API_USE(midiOutUnprepareHeader)	\
	DLL_API_USE(midiStreamClose)	\
	DLL_API_USE(midiStreamOpen)	\
	DLL_API_USE(midiStreamOut)	\
	DLL_API_USE(midiStreamPause)	\
	DLL_API_USE(midiStreamPosition)	\
	DLL_API_USE(midiStreamProperty)	\
	DLL_API_USE(midiStreamRestart)	\
	DLL_API_USE(midiStreamStop)	\
	DLL_API_USE(mixerClose)	\
	DLL_API_USE(mixerGetControlDetailsA)	\
	DLL_API_USE(mixerGetControlDetailsW)	\
	DLL_API_USE(mixerGetDevCapsA)	\
	DLL_API_USE(mixerGetDevCapsW)	\
	DLL_API_USE(mixerGetID)	\
	DLL_API_USE(mixerGetLineControlsA)	\
	DLL_API_USE(mixerGetLineControlsW)	\
	DLL_API_USE(mixerGetLineInfoA)	\
	DLL_API_USE(mixerGetLineInfoW)	\
	DLL_API_USE(mixerGetNumDevs)	\
	DLL_API_USE(mixerMessage)	\
	DLL_API_USE(mixerOpen)	\
	DLL_API_USE(mixerSetControlDetails)	\
	DLL_API_USE(mmDrvInstall)	\
	DLL_API_USE(mmGetCurrentTask)	\
	DLL_API_USE(mmTaskBlock)	\
	DLL_API_USE(mmTaskCreate)	\
	DLL_API_USE(mmTaskSignal)	\
	DLL_API_USE(mmTaskYield)	\
	DLL_API_USE(mmioAdvance)	\
	DLL_API_USE(mmioAscend)	\
	DLL_API_USE(mmioClose)	\
	DLL_API_USE(mmioCreateChunk)	\
	DLL_API_USE(mmioDescend)	\
	DLL_API_USE(mmioFlush)	\
	DLL_API_USE(mmioGetInfo)	\
	DLL_API_USE(mmioInstallIOProcA)	\
	DLL_API_USE(mmioInstallIOProcW)	\
	DLL_API_USE(mmioOpenA)	\
	DLL_API_USE(mmioOpenW)	\
	DLL_API_USE(mmioRead)	\
	DLL_API_USE(mmioRenameA)	\
	DLL_API_USE(mmioRenameW)	\
	DLL_API_USE(mmioSeek)	\
	DLL_API_USE(mmioSendMessage)	\
	DLL_API_USE(mmioSetBuffer)	\
	DLL_API_USE(mmioSetInfo)	\
	DLL_API_USE(mmioStringToFOURCCA)	\
	DLL_API_USE(mmioStringToFOURCCW)	\
	DLL_API_USE(mmioWrite)	\
	DLL_API_USE(mmsystemGetVersion)	\
	DLL_API_USE(mod32Message)	\
	DLL_API_USE(mxd32Message)	\
	DLL_API_USE(sndPlaySoundA)	\
	DLL_API_USE(sndPlaySoundW)	\
	DLL_API_USE(tid32Message)	\
	DLL_API_USE(timeBeginPeriod)	\
	DLL_API_USE(timeEndPeriod)	\
	DLL_API_USE(timeGetDevCaps)	\
	DLL_API_USE(timeGetSystemTime)	\
	DLL_API_USE(timeGetTime)	\
	DLL_API_USE(timeKillEvent)	\
	DLL_API_USE(timeSetEvent)	\
	DLL_API_USE(waveInAddBuffer)	\
	DLL_API_USE(waveInClose)	\
	DLL_API_USE(waveInGetDevCapsA)	\
	DLL_API_USE(waveInGetDevCapsW)	\
	DLL_API_USE(waveInGetErrorTextA)	\
	DLL_API_USE(waveInGetErrorTextW)	\
	DLL_API_USE(waveInGetID)	\
	DLL_API_USE(waveInGetNumDevs)	\
	DLL_API_USE(waveInGetPosition)	\
	DLL_API_USE(waveInMessage)	\
	DLL_API_USE(waveInOpen)	\
	DLL_API_USE(waveInPrepareHeader)	\
	DLL_API_USE(waveInReset)	\
	DLL_API_USE(waveInStart)	\
	DLL_API_USE(waveInStop)	\
	DLL_API_USE(waveInUnprepareHeader)	\
	DLL_API_USE(waveOutBreakLoop)	\
	DLL_API_USE(waveOutClose)	\
	DLL_API_USE(waveOutGetDevCapsA)	\
	DLL_API_USE(waveOutGetDevCapsW)	\
	DLL_API_USE(waveOutGetErrorTextA)	\
	DLL_API_USE(waveOutGetErrorTextW)	\
	DLL_API_USE(waveOutGetID)	\
	DLL_API_USE(waveOutGetNumDevs)	\
	DLL_API_USE(waveOutGetPitch)	\
	DLL_API_USE(waveOutGetPlaybackRate)	\
	DLL_API_USE(waveOutGetPosition)	\
	DLL_API_USE(waveOutGetVolume)	\
	DLL_API_USE(waveOutMessage)	\
	DLL_API_USE(waveOutOpen)	\
	DLL_API_USE(waveOutPause)	\
	DLL_API_USE(waveOutPrepareHeader)	\
	DLL_API_USE(waveOutReset)	\
	DLL_API_USE(waveOutRestart)	\
	DLL_API_USE(waveOutSetPitch)	\
	DLL_API_USE(waveOutSetPlaybackRate)	\
	DLL_API_USE(waveOutSetVolume)	\
	DLL_API_USE(waveOutUnprepareHeader)	\
	DLL_API_USE(waveOutWrite)	\
	DLL_API_USE(wid32Message)	\
	DLL_API_USE(wod32Message)	\



#define DLL_API					extern "C" 
#define DLL_API_Def(fun)		static	void *	__##fun = NULL;
#define DLL_API_Fun(fun)		DLL_API __declspec(naked)	void *	_##fun()	\
	{						\
		__asm jmp __##fun	\
	}						
#define DLL_API_Get(fun)		__##fun = (void *)GetProcAddress(hSysMod, #fun);
#define DLL_API_Export(fun)		AddLinkHead(funList, #fun);


#undef DLL_API_USE
#define DLL_API_USE DLL_API_Def
DLL_API_LIST()

#undef DLL_API_USE
#define DLL_API_USE DLL_API_Fun
DLL_API_LIST()


BOOL	CreateLinkHead();


static	HMODULE		hSysMod = NULL;

BOOL	DllProxyInit()
{
	CHAR		szSysDll[520];

	GetSystemDirectoryA(szSysDll, sizeof(szSysDll));
	strcat_s(szSysDll, sizeof(szSysDll), "\\");
	strcat_s(szSysDll, sizeof(szSysDll), DLL_Name);
	hSysMod = LoadLibraryA(szSysDll);

#undef DLL_API_USE
#define DLL_API_USE DLL_API_Get
DLL_API_LIST()

	CreateLinkHead();
	return TRUE;
}

BOOL	AddLinkHead(list<string> &funList, CHAR *pName)
{
	funList.push_back(pName);
	return TRUE;
}

BOOL	CreateLinkHead()
{
	list<string>::iterator	Iter;
	list<string>		funList;
	string				sFullText;
	CHAR				szItem[1024], szDir[MAXPATH], szPath[MAXPATH];
	CHAR				*pName;

#ifndef _DEBUG
	return TRUE;
#endif

	#undef DLL_API_USE
	#define DLL_API_USE DLL_API_Export
	DLL_API_LIST()

	sFullText = "";
	for(Iter = funList.begin();
		Iter != funList.end();
		Iter ++)
	{
		pName = (CHAR *)Iter->data();
		sprintf_s(szItem, sizeof(szItem), 
			"#pragma comment(linker, \"/EXPORT:%s=__%s,PRIVATE\")",
			pName, pName);
		sFullText += szItem;
		sFullText += "\r\n";
	}

	NFile::SpliteFilePath(__FILE__, szDir, NULL);
	sprintf_s(szPath, sizeof(szPath), "%s\\%s", szDir, "DllProxyLink.h");
	if(NFile::FileExist(szPath) == FALSE)
		return FALSE;

	NFile::DumpToFileCheck(szPath, sFullText.data(), sFullText.size());
	return TRUE;
}


DLL_API	BOOL	TestExport()
{
	return TRUE;
}

标签:USE,代理,DLL,API,fun,Dll,szSysDll,define
From: https://www.cnblogs.com/zzz3265/p/17807363.html

相关文章

  • 小模型如何比肩大模型,北理工发布明德大模型MindLLM,小模型潜力巨大
    前言 北京理工大学发布双语轻量级语言模型,明德大模型—MindLLM。本文转载自机器之心仅用于学术分享,若侵权请联系删除欢迎关注公众号CV技术指南,专注于计算机视觉的技术总结、最新技术跟踪、经典论文解读、CV招聘信息。CV各大方向专栏与各个部署框架最全教程整理【CV技术指南......
  • 安装MySQL初始化问题由于找不到VCRUNTIME140_1.dll,无法继续执行代码。重新安装程序可
    1.关于安装MySQL初始化遇到的问题出现的是如下图错误 这是安装mysql-8.0.25初始化的时候我遇到的报错解决方法如下:安装微软常用运行库合集[下载地址,没有积分的可以评论区联系我](https://download.csdn.net/download/qq_42603590/19686518)安装好之后就不会报错了好了之......
  • 全局代理和局部代理的区别
    在计算机领域中,代理是一种常见的网络技术,它可以帮助用户更好地控制网络访问和数据传输。代理可以分为全局代理和局部代理两种,它们有着不同的作用和适用场景。一、全局代理全局代理指的是在系统级别设置的代理,它可以代理所有网络请求,包括浏览器、邮件客户端、FTP客户端等。全局代理......
  • 代理工具 Mitmproxy(二)
    这一节教大家编写Mitmproxy自定义脚本,这才是Mitmproxy真正强大的在方。Mitmproxy官方给了很多例子:https://docs.mitmproxy.org/stable/addons-examples/我们演示一个简单的例子http-add-header.py,为每一个response中增一个数字,标明是当前是第几个请求。"""AddanHTTPhead......
  • 代理工具 Mitmproxy (一)
    你在用哪款代理/抓包工具?你可能会回答fiddler,charles等HTTP/HTTPS抓包工具,或者是网卡级的wireshark工具。这里再推荐一款代理工具mitmproxy,前些天公司项目中有用到,这里做个简单的介绍。mitmproxy是一个免费开源的交互式HTTPS代理。github地址:https://github.com/mitmproxy/m......
  • 22. 从零用Rust编写正反向代理,一个数据包的神奇HTTP历险记!
    wmproxywmproxy已用Rust实现http/https代理,socks5代理,反向代理,静态文件服务器,四层TCP/UDP转发,内网穿透,后续将实现websocket代理等,会将实现过程分享出来,感兴趣的可以一起造个轮子项目地址国内:https://gitee.com/tickbh/wmproxygithub:https://github.com/tickbh/wmpro......
  • python爬虫利用代理IP分析大数据
    前言随着互联网快速发展和普及,数据已经成为企业和个人决策的重要依据。而爬虫技术正是获取数据的重要手段,而代理IP则是爬虫技术中非常重要的一个环节。通过使用代理IP,可以突破网站的限制,获取更多的信息。本文将介绍如何使用Python爬虫利用代理IP分析大数据,同时提供代码案例。一、什......
  • NPS+Proxifiler配置socks5代理
    1.部署NPSdockerrun-d--namenps--net=host-v/data/nps/conf:/confffdfgdfg/nps:v0.26.10服务端配置文件nps.conf主要配置项##bridgebridge_type=tcpbridge_port=15081bridge_ip=0.0.0.0#webweb_host=xxx.xxx.xxxweb_username=adminweb_password=123web_port=1......
  • api-ms-win-core-path-l1-1-0.dll下载(win7-32位)
      下载 api-ms-win-core-path-l1-1-0.dll 后拷贝到文件夹:32位系统 c:\windows\system32  下载链接: https://www.dll-files.com/api-ms-win-core-path-l1-1-0.dll.html ......
  • nginx反向代理的重定向
    bi.kailinjt.com.confserver{listen80;server_namebi.kailinjt.com;location=/{return302$scheme://$host/webroot/login.html;}location/{#return302......