listen to mePlayDll.dll

小弟我得到一个LED的SDK,然后用他的DEMO都不成功,联系公司公司说叫小弟我看返回什么东东,小弟我该如何看.厂家老叫小弟我要告诉他SENDCONTROL返回的值如何看 - VB当前位置:& &&&小弟我得到一个LED的SDK,然后用他的DEMO都不成功,联小弟我得到一个LED的SDK,然后用他的DEMO都不成功,联系公司公司说叫小弟我看返回什么东东,小弟我该如何看.厂家老叫小弟我要告诉他SENDCONTROL返回的值如何看&&网友分享于:&&浏览:26次我得到一个LED的SDK,然后用他的DEMO都不成功,联系公司公司说叫我看返回什么错误,我该怎么看.厂家老叫我要告诉他SENDCONTROL返回的值怎么看.我得到一个LED的SDK,然后用他的DEMO都不成功,联系公司公司说叫我看返回什么错误,我该怎么看.厂家老叫我要告诉他SENDCONTROL返回的值这个我该怎么看。文档是这样写的:
SendControl(int PNO, int SendType,HWND hwnd) &
功能:发送数据 &
参数:PNO:屏号 &
SendType:发送模式1为普通 2为SD卡发送 &
Hwnd:窗口句柄 &
返回值: &
1:发送成功 &
2:通讯失败&
3:发送过程中出错我在模块这样定义的DLL:'7发送数据Public Declare Function SendControl Lib &ListenPlayDll.dll& (ByVal pno As Long, ByVal SendType As Long, ByVal hwnd As Long) As Long程序是这样掉用的:Private Sub Command3_Click()StartSend
'初始化xml文件AddControl 1, 2
单双色AddProgram 1, 1, 0
播放时间AddFileArea 1, 1, 1, 0, 0, 160, 256
'屏号 节目号 区域号 区域左上角顶点x坐标
区域左上角顶点y坐标 区域宽度 区域高度AddFile 1, 1, 1, 1, &1.rtf&, 160, 256, 32, 0, 10, 10, 1
'屏号 节目号 区域号 区域左上角顶点x坐标
区域左上角顶点y坐标 文件路径 区域宽度 区域高度
特技类型 退场方式 运行速度 停留时间 多行文本上下居中1为正常,2为上下居中SendControl 1, 1, 0
'屏号 发送模式1为普通 2为SD卡发送 Hwnd:窗口句柄'厂家老叫我要告诉他SENDCONTROL返回的值这个我该怎么看。End Sub------解决方案--------------------
如果愿意,你可以把DLL和SDK发到资源里面让大家研究一下。光这样猜测,太有难度。
------解决方案--------------------
要返回值而已,你这样用不就有返回值,i=SendControl( 1, 1, 0 '屏号 发送模式1为普通 2为SD卡发送 Hwnd:窗口句),i就是返回值啊!
------解决方案--------------------
dim ret as longret=SendControl(1, 1, 0)msgbox ret
12345678910
12345678910
12345678910 上一篇:下一篇:文章评论相关解决方案 12345678910 Copyright & &&版权所有How to set the java.library.path in intelliJ Idea - Stack Overflow
to customize your list.
Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
J it only takes a minute:
Could anyone please help how do I solve this error:
Native code library failed to load.
java.lang.UnsatisfiedLinkError: no ts-jni in java.library.path
I am using IDEA IDE as a first time, and have been using Resin_4.0.37 as a server to test my work.
As soon as I start my lcoal server in debug mode it stays for approximately 1-2 mins and then suddenly it drops down and get disconnected by giving me the above error.
I have set my Windows environmenta and have also did the following in my IDE intelliJ:
FILE-&Project Structure-&set Global Libraries-&a. Java path and b. Resin library path.
Can any one please suggest me, what am I doing wrong and how do I set native library in intelliJ IDEA to solve the mentioned error.
Any help would be appreciated. Also do correct me if I am doing something wrong.
4,55935107184
If you run your program from IntelliJ then you can set the java.library.path in the VM options input field in the Run/Debug Configurations dialog.
26.9k66390
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled2865人阅读
环境:VS2012+WIN8 64
类型:C++编写的WDM驱动程序
测试:VM WIN7
用途:主要用于驱动程序中得到WIN32 API地址,也可得到自定义的DLL中的函数导出地址,记录内核文件相关操作以便以后查看。
说明:此段代码来源于网络,经修改调试而成。
头文件 HelloWDM.h
#if __cplusplus
extern &C&
#include &wdm.h&
#include &windef.h&
#ifdef __cplusplus
//winnt.h中的定义 由于是WDM不能引用该文件 所以只有复制过来
#define SEC_IMAGE
//PE相关结构
typedef struct _SECTION_IMAGE_INFORMATION
PVOID TransferA
ULONG ZeroB
ULONG MaximumStackS
ULONG CommittedStackS
ULONG SubSystemT
WORD SubSystemMinorV
WORD SubSystemMajorV
ULONG SubSystemV
WORD ImageC
UCHAR ImageContainsC
UCHAR ImageF
ULONG ComPlusNativeReady: 1;
ULONG ComPlusILOnly: 1;
ULONG ImageDynamicallyRelocated: 1;
ULONG Reserved: 5;
ULONG LoaderF
ULONG ImageFileS
ULONG CheckS
} SECTION_IMAGE_INFORMATION, *PSECTION_IMAGE_INFORMATION;
typedef struct _IMAGE_DOS_HEADER {
// DOS .EXE header
// Magic number
// Bytes on last page of file
// Pages in file
// Relocations
// Size of header in paragraphs
// Minimum extra paragraphs needed
// Maximum extra paragraphs needed
// Initial (relative) SS value
// Initial SP value
// Checksum
// Initial IP value
// Initial (relative) CS value
// File address of relocation table
// Overlay number
// Reserved words
// OEM identifier (for e_oeminfo)
// OEM e_oemid specific
e_res2[10];
// Reserved words
// File address of new exe header
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
typedef struct _IMAGE_DATA_DIRECTORY {
} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
typedef struct _IMAGE_OPTIONAL_HEADER {
// Standard fields.
MajorLinkerV
MinorLinkerV
SizeOfInitializedD
SizeOfUninitializedD
AddressOfEntryP
// NT additional fields.
MajorOperatingSystemV
MinorOperatingSystemV
MajorImageV
MinorImageV
MajorSubsystemV
MinorSubsystemV
Win32VersionV
SizeOfStackR
SizeOfStackC
SizeOfHeapR
SizeOfHeapC
NumberOfRvaAndS
IMAGE_DATA_DIRECTORY DataDirectory[16];
} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
typedef struct _IMAGE_EXPORT_DIRECTORY {
AddressOfF
// RVA from base of image
AddressOfN
// RVA from base of image
AddressOfNameO
// RVA from base of image
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
HelloWDM.cpp文件
#include &HelloWDM.h&
//得到DLL中的指定函数地址 相当于应用层的GetProcAddress函数
DWORD GetDllFunctionAddress(PTSTR lpFunctionName, PTSTR pDllName)
&& &HANDLE hThread, hSection, hFile, hM
&& &SIZE_T size=0;
&& &NTSTATUS
&& &PVOID BaseAddress = NULL;
&& &//转换DLL名称
&& &UNICODE_STRING strDllN
&& &RtlInitUnicodeString(&strDllName, pDllName);
&& &OBJECT_ATTRIBUTES objectAttributes={0};
&& &IO_STATUS_BLOCK iosb={0};
&& &//初始化 objectAttributes
&& &InitializeObjectAttributes(&objectAttributes, &strDllName, OBJ_KERNEL_HANDLE, NULL, NULL);
&& &//打开文件
&& &status=ZwOpenFile(&hFile,& FILE_EXECUTE | SYNCHRONIZE, &objectAttributes, &iosb, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT);
&& &if(!NT_SUCCESS(status))
&& &objectAttributes.ObjectName = 0;
&& &//创建内存块
&& &status=ZwCreateSection(&hSection, SECTION_ALL_ACCESS, &objectAttributes, 0, PAGE_READONLY, SEC_IMAGE, hFile); //PAGE_READONLY页面保护属性,必须结合SEC_IMAGE属性
&& &if(!NT_SUCCESS(status))
&& &//内存映射文件
&& &status=ZwMapViewOfSection(hSection,
&& &&& &&& &&& &&& &&& &&& &ZwCurrentProcess(),
&& &&& &&& &&& &&& &&& &&& &&BaseAddress,
&& &&& &&& &&& &&& &&& &&& &0,
&& &&& &&& &&& &&& &&& &&& &1024,
&& &&& &&& &&& &&& &&& &&& &0,
&& &&& &&& &&& &&& &&& &&& &&size,
&& &&& &&& &&& &&& &&& &&& &ViewUnmap,
&& &&& &&& &&& &&& &&& &&& &MEM_LARGE_PAGES,&& &&& &//针对DLL文件较小是可以用MEM_TOP_DOWN 文件较大比如USER32.DLL时需要用MEM_LARGE_PAGES
&& &&& &&& &&& &&& &&& &&& &PAGE_READWRITE);&& &&& &
&& &if(!NT_SUCCESS(status))
&& &//关闭文件句柄
&& &ZwClose(hFile);
&& &//读取PE头信息
&& &IMAGE_DOS_HEADER*
&& &IMAGE_OPTIONAL_HEADER*
&& &IMAGE_EXPORT_DIRECTORY* pExportT
&& &PDWORD arrayOfFunctionAddresses, arrayOfFunctionN
&& &PWORD arrayOfFunctionO
&& &DWORD functionOrdinal, functionAddress=0;
&& &PSTR functionN
&& &ANSI_STRING anFunN
&& &UNICODE_STRING unFunctionName, unFunctionNameS
&& &//模块句柄
&& &hMod = BaseA
&& &//得到DOS头
&& &dosheader = (PIMAGE_DOS_HEADER)hM
&& &//得到PE选项头
&& &opthdr =(PIMAGE_OPTIONAL_HEADER) ((PBYTE)hMod+dosheader-&e_lfanew+24);
&& &//得到导出表
&& &pExportTable =(PIMAGE_EXPORT_DIRECTORY)((PBYTE) hMod + opthdr-&DataDirectory[0].VirtualAddress);
&& &//得到函数地址列表
&& &arrayOfFunctionAddresses = (PDWORD)( (PBYTE)hMod + pExportTable-&AddressOfFunctions);
&& &//得到函数名称列表
&& &arrayOfFunctionNames = (PDWORD)( (PBYTE)hMod + pExportTable-&AddressOfNames);
&& &//得到函数序号
&& &arrayOfFunctionOrdinals = (PWORD)( (PBYTE)hMod + pExportTable-&AddressOfNameOrdinals);
&& &//导出表基地址
&& &DWORD Base = pExportTable-&B
&& &//转换函数名
&& &RtlInitUnicodeString(&unFunctionNameSearch, lpFunctionName);
&& &//循环导出表
&& &for(DWORD x = 0; x & pExportTable-&NumberOfN x++)&& &&& &&& &//导出函数有名称 编号之分,导出函数总数=名称导出+编号导出,这里是循环导出名称的函数
&& &&& &//得到函数名
&& &&& &functionName = (PSTR)( (PBYTE)hMod + arrayOfFunctionNames[x]);
&& &&& &//转化为ANSI_STRING
&& &&& &RtlInitAnsiString(&anFunName, functionName);
&& &&& &//转化为UNICODE_STRING
&& &&& &RtlAnsiStringToUnicodeString(&unFunctionName, &anFunName, TRUE);
&& &&& &//打印调试信息
&& &&& &KdPrint((&%d/%d,FunName:%wZ\n&, x+1, pExportTable-&NumberOfNames, &unFunctionName));
&& &&& &//比较函数名称
&& &&& &if (RtlCompareUnicodeString(&unFunctionName, &unFunctionNameSearch, TRUE) == 0)
&& &&& &&& &//得到该函数地址
&& &&& &&& &functionOrdinal = arrayOfFunctionOrdinals[x] + Base - 1;
&& &&& &&& &functionAddress = (DWORD)( (PBYTE)hMod + arrayOfFunctionAddresses[functionOrdinal]);
&& &&& &&& &
&& &ZwClose(hSection);
&& &return functionA
以上代码虽可以运行但没有考虑到 ZwMapViewOfSection的资源释放问题 修改如下:
//HelloWDM.h
#if __cplusplus
extern &C&
#include &wdm.h&
#include &windef.h&
#ifdef __cplusplus
//定义设备扩展
typedef struct _DEVICE_EXTERSION
&& &PDEVICE_OBJECT
&& &PDEVICE_OBJECT NextStatckD
&& &UNICODE_STRING ustrDeviceN&& &&& &//设备名
&& &UNICODE_STRING ustrSymLinkN&& &&& &//符号链接名
&& &PVOID tmpP&& &&& &&& &&& &&& &&& &//记录临时指针
}DEVICE_EXTENSION, *PDEVICE_EXTENSION;
//全局变量
PDEVICE_EXTENSION gDevExt=NULL;
//winnt.h中的定义 由于是WDM不能引用该文件 所以只有复制过来
#define SEC_IMAGE
//PE相关结构
typedef struct _SECTION_IMAGE_INFORMATION
PVOID TransferA
ULONG ZeroB
ULONG MaximumStackS
ULONG CommittedStackS
ULONG SubSystemT
WORD SubSystemMinorV
WORD SubSystemMajorV
ULONG SubSystemV
WORD ImageC
UCHAR ImageContainsC
UCHAR ImageF
ULONG ComPlusNativeReady: 1;
ULONG ComPlusILOnly: 1;
ULONG ImageDynamicallyRelocated: 1;
ULONG Reserved: 5;
ULONG LoaderF
ULONG ImageFileS
ULONG CheckS
} SECTION_IMAGE_INFORMATION, *PSECTION_IMAGE_INFORMATION;
typedef struct _IMAGE_DOS_HEADER {
// DOS .EXE header
// Magic number
// Bytes on last page of file
// Pages in file
// Relocations
// Size of header in paragraphs
// Minimum extra paragraphs needed
// Maximum extra paragraphs needed
// Initial (relative) SS value
// Initial SP value
// Checksum
// Initial IP value
// Initial (relative) CS value
// File address of relocation table
// Overlay number
// Reserved words
// OEM identifier (for e_oeminfo)
// OEM e_oemid specific
e_res2[10];
// Reserved words
// File address of new exe header
} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
typedef struct _IMAGE_DATA_DIRECTORY {
} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
typedef struct _IMAGE_OPTIONAL_HEADER {
// Standard fields.
MajorLinkerV
MinorLinkerV
SizeOfInitializedD
SizeOfUninitializedD
AddressOfEntryP
// NT additional fields.
MajorOperatingSystemV
MinorOperatingSystemV
MajorImageV
MinorImageV
MajorSubsystemV
MinorSubsystemV
Win32VersionV
SizeOfStackR
SizeOfStackC
SizeOfHeapR
SizeOfHeapC
NumberOfRvaAndS
IMAGE_DATA_DIRECTORY DataDirectory[16];
} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
typedef struct _IMAGE_EXPORT_DIRECTORY {
AddressOfF
// RVA from base of image
AddressOfN
// RVA from base of image
AddressOfNameO
// RVA from base of image
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
//HelloWDM.cpp
//得到DLL中的指定函数地址 相当于应用层的GetProcAddress函数
DWORD GetDllFunctionAddress(PTSTR lpFunctionName, PTSTR pDllName)
HANDLE hSection=NULL, hFile=NULL;
SIZE_T size=0;
PVOID BaseAddress = NULL;
//转换DLL名称
UNICODE_STRING strDllN
RtlInitUnicodeString(&strDllName, pDllName);
OBJECT_ATTRIBUTES objectAttributes={0};
IO_STATUS_BLOCK iosb={0};
//初始化 objectAttributes
InitializeObjectAttributes(&objectAttributes, &strDllName, OBJ_KERNEL_HANDLE, NULL, NULL);
//打开文件
status=ZwOpenFile(&hFile,
FILE_EXECUTE | SYNCHRONIZE, &objectAttributes, &iosb, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_NONALERT);
if(!NT_SUCCESS(status))
objectAttributes.ObjectName = 0;
//创建内存块
status=ZwCreateSection(&hSection, SECTION_ALL_ACCESS, &objectAttributes, 0, PAGE_READONLY, SEC_IMAGE, hFile); //PAGE_READONLY页面保护属性,必须结合SEC_IMAGE属性
if(!NT_SUCCESS(status))
//内存映射文件
status=ZwMapViewOfSection(hSection,
ZwCurrentProcess(),
&BaseAddress,
ViewUnmap,
MEM_LARGE_PAGES,
//针对DLL文件较小是可以用MEM_TOP_DOWN 文件较大比如USER32.DLL时需要用MEM_LARGE_PAGES
PAGE_READWRITE);
if(hFile != NULL)
//关闭文件句柄
ZwClose(hFile);
if(!NT_SUCCESS(status) && hSection != NULL)
//关闭内存块
ZwClose(hSection);
//如果失败 直接返回
if(!NT_SUCCESS(status))
//读取PE头信息
IMAGE_DOS_HEADER*
IMAGE_OPTIONAL_HEADER*
IMAGE_EXPORT_DIRECTORY* pExportT
PDWORD arrayOfFunctionAddresses, arrayOfFunctionN
PWORD arrayOfFunctionO
DWORD functionOrdinal, functionAddress=0;
PSTR functionN
ANSI_STRING anFunN
UNICODE_STRING unFunctionName, unFunctionNameS
//模块句柄
HANDLE hMod = BaseA
//得到DOS头
dosheader = (PIMAGE_DOS_HEADER)hM
//得到PE选项头
opthdr =(PIMAGE_OPTIONAL_HEADER) ((PBYTE)hMod+dosheader-&e_lfanew+24);
//得到导出表
pExportTable =(PIMAGE_EXPORT_DIRECTORY)((PBYTE) hMod + opthdr-&DataDirectory[0].VirtualAddress);
//得到函数地址列表
arrayOfFunctionAddresses = (PDWORD)( (PBYTE)hMod + pExportTable-&AddressOfFunctions);
//得到函数名称列表
arrayOfFunctionNames = (PDWORD)( (PBYTE)hMod + pExportTable-&AddressOfNames);
//得到函数序号
arrayOfFunctionOrdinals = (PWORD)( (PBYTE)hMod + pExportTable-&AddressOfNameOrdinals);
//导出表基地址
DWORD Base = pExportTable-&B
//转换函数名
RtlInitUnicodeString(&unFunctionNameSearch, lpFunctionName);
//循环导出表
for(DWORD x = 0; x & pExportTable-&NumberOfN x++)
//导出函数有名称 编号之分,导出函数总数=名称导出+编号导出,这里是循环导出名称的函数
//得到函数名
functionName = (PSTR)( (PBYTE)hMod + arrayOfFunctionNames[x]);
//转化为ANSI_STRING
RtlInitAnsiString(&anFunName, functionName);
//转化为UNICODE_STRING
RtlAnsiStringToUnicodeString(&unFunctionName, &anFunName, TRUE);
//打印调试信息
KdPrint((&%d/%d,FunName:%wZ\n&, x+1, pExportTable-&NumberOfNames, &unFunctionName));
//比较函数名称
if (RtlCompareUnicodeString(&unFunctionName, &unFunctionNameSearch, TRUE) == 0)
//得到该函数地址
functionOrdinal = arrayOfFunctionOrdinals[x] + Base - 1;
functionAddress = (DWORD)( (PBYTE)hMod + arrayOfFunctionAddresses[functionOrdinal]);
//这里释放资源返回的地址将无效 所以先存放起来
//ZwUnmapViewOfSection (NtCurrentProcess(), BaseAddress);
gDevExt-&tmpPoint=BaseA
ZwClose(hSection);
return functionA
调用代码如下:
ULONG ulOriginalProcAddr=GetDllFunctionAddress(TEXT(&NtOpenProcess&), TEXT(&\\SystemRoot\\system32\\ntdll.dll&));
//释放GetDllFunctionAddress的内存块
if(gDevExt-&tmpPoint!=0)
&& &ZwUnmapViewOfSection (NtCurrentProcess(), gDevExt-&tmpPoint);
&& &gDevExt-&tmpPoint=0;
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:1541965次
积分:15152
积分:15152
排名:第542名
原创:29篇
转载:721篇
评论:157条
(1)(2)(13)(17)(5)(12)(2)(3)(17)(41)(31)(11)(8)(14)(12)(12)(6)(18)(10)(8)(17)(5)(2)(7)(7)(7)(10)(15)(23)(25)(5)(19)(9)(3)(9)(7)(10)(18)(19)(25)(13)(14)(7)(15)(36)(7)(3)(8)(17)(12)(32)(14)(4)(14)(26)(7)(15)(11)(16)(5)如何判断一个dll文件是32位还是64位?
1. 开发中经常会使用到VC的一个工具 Dependency Walker用depends.exe打开dll,文件名前有64标示的即为64位。
但是这个方式不是万能的,只能简单判断。很多都判断不出来。比如64位系统下
C:\Windows\System32\msvcrt.dll
2. 使用visual studio开发工具命令dumpbin一般位于vs安装目录bin子目录下,如C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64&dumpbin.exe使用命令 dumpbin /headers yourdll.dll |find "machine"
machine (x64) 标示该dll为 64位。否则为x86下面(PE32+) 也是标示该dll为 64位。否则为PE32
参考 /showthread.php?p=1369132
阅读(...) 评论()}

我要回帖

更多关于 listen to me 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信