仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1029|回复: 8
打印 上一主题 下一主题

[学习教程] MSSQL网页编程之怎样挪用NetMessageBufferSend发送动静...

[复制链接]
冷月葬花魂 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 22:39:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
InnoDB事务型数据库的首选引擎,支持ACID事务,支持行级锁定
怎样挪用NetMessageBufferSend发送动静?

成绩形貌:

怎样挪用WINNT/2K/XP下的API函数NetMessageBufferSend摹拟netsend命令来发送动静?

办理计划:

上面代码已测试乐成,间接导进PBL便可



$PBExportHeader$w_main.srw

forward

globaltypew_mainfromWindow

endtype

typemle_1frommultilineeditwithinw_main

endtype

typecb_1fromcommandbuttonwithinw_main

endtype

typesle_1fromsinglelineeditwithinw_main

endtype

typest_2fromstatictextwithinw_main

endtype

typest_1fromstatictextwithinw_main

endtype

endforward



typeicmp_echo_replyfromstructure

unsignedlongaddress

unsignedlongstatus

unsignedlongroundtriptime

unsignedlongdatasize

unsignedlongreserved[3]

characterdata[250]

endtype

globaltypew_mainfromWindow

intX=1056

intY=484

intWidth=1531

intHeight=1152

booleanTitleBar=true

stringTitle="NETMESSAGESEND"

longBackColor=80269524

booleanControlMenu=true

booleanMinBox=true

booleanResizable=true

mle_1mle_1

cb_1cb_1

sle_1sle_1

st_2st_2

st_1st_1

endtype

globalw_mainw_main



typeprototypes

FunctionulongNetMessageBufferSend(ulongservername,refcharmsgname[],ulongfromname,refcharbuf[],ulongbuflen)Library"netapi32.dll"Aliasfor"NetMessageBufferSend"

FunctionulongIcmpCreateFile()Library"icmp.dll"

FunctionlongIcmpSendEcho(ulongIcmpHandle,ulongDestinationAddress,stringRequestData,longRequestSize,longRequestOptions,Reficmp_echo_replyReplyBuffer,longReplySize,longTimeout)Library"icmp.dll"Aliasfor"IcmpSendEcho"

FunctionlongIcmpCloseHandle(ulongIcmpHandle)Library"icmp.dll"

Functionulonginet_addr(stringcp)Library"ws2_32.dll"Aliasfor"inet_addr"

endprototypes

typevariables

CONSTANTulongNERR_Success=0

endvariables

forwardprototypes

publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[])

publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[])

publicfunctionbooleanwf_netmessagebuffersend(stringas_sendto,stringas_msgtext)

publicfunctionbooleanwf_ping(stringas_ipaddress,stringas_echomsg)

endprototypes



publicsubroutinewf_string_to_unicode(stringas_string,refcharacterac_unicode[]);Integerli_loop,li_len,li_uni



li_len=Len(as_string)



FORli_loop=1TOli_len

li_uni=li_uni+1

ac_unicode[li_uni]=Mid(as_string,li_loop,1)

li_uni=li_uni+1

ac_unicode[li_uni]=Char(0)

NEXT



li_uni=li_uni+1

ac_unicode[li_uni]=Char(0)

li_uni=li_uni+1

ac_unicode[li_uni]=Char(0)



endsubroutine

publicfunctionbooleanwf_netmessagebuffersend(stringas_sendto,stringas_msgtext);Ulonglul_result,lul_buflen

Charlc_msgname[],lc_msgtext[]



wf_string_to_unicode(as_sendto,lc_msgname)

wf_string_to_unicode(as_msgtext,lc_msgtext)



lul_buflen=UpperBound(lc_msgtext)



lul_result=NetMessageBufferSend(0,lc_msgname,0,lc_msgtext,lul_buflen)



Iflul_result=NERR_SuccessThen

ReturnTrue

Else

ReturnFalse

EndIf

endfunction

publicfunctionbooleanwf_ping(stringas_ipaddress,stringas_echomsg);ULonglul_address,lul_handle

Longll_rc,ll_size

Stringls_reply

icmp_echo_replylstr_reply



lul_address=inet_addr(as_ipaddress)

Iflul_address>0Then

lul_handle=IcmpCreateFile()

ll_size=Len(as_echomsg)

ll_rc=IcmpSendEcho(lul_handle,lul_address,&

as_echomsg,ll_size,0,&

lstr_reply,278,200)

IcmpCloseHandle(lul_handle)

Ifll_rc0Then

Iflstr_reply.Status=0Then

ls_reply=String(lstr_reply.Data)

Ifls_reply=as_echomsgThen

ReturnTrue

EndIf

EndIf

EndIf

EndIf



ReturnFalse



endfunction

onw_main.create

this.mle_1=createmle_1

this.cb_1=createcb_1

this.sle_1=createsle_1

this.st_2=createst_2

this.st_1=createst_1

this.Control[]={this.mle_1,&

this.cb_1,&

this.sle_1,&

this.st_2,&

this.st_1}

endon



onw_main.destroy

destroy(this.mle_1)

destroy(this.cb_1)

destroy(this.sle_1)

destroy(this.st_2)

destroy(this.st_1)

endon



typemle_1frommultilineeditwithinw_main

intX=27

intY=264

intWidth=1399

intHeight=604

intTabOrder=20

BorderStyleBorderStyle=StyleLowered!

longTextColor=33554432

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype



typecb_1fromcommandbuttonwithinw_main

intX=1070

intY=904

intWidth=357

intHeight=108

intTabOrder=30

stringText="发送(&S)"

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype



eventclicked;ifnotwf_ping(trim(sle_1.text),"")then

messagebox("提醒","指定方针地点不存在或欠亨!")

return

endif



ifwf_NetMessageBufferSend(trim(sle_1.text),trim(mle_1.text))then

messagebox("提醒","发送乐成!")

else

messagebox("提醒","发送失利!")

endif

endevent

typesle_1fromsinglelineeditwithinw_main

intX=430

intY=48

intWidth=997

intHeight=92

intTabOrder=10

BorderStyleBorderStyle=StyleLowered!

booleanAutoHScroll=false

longTextColor=33554432

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype



typest_2fromstatictextwithinw_main

intX=14

intY=172

intWidth=379

intHeight=76

booleanEnabled=false

stringText="发送内容:"

booleanFocusRectangle=false

longTextColor=33554432

longBackColor=67108864

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype



typest_1fromstatictextwithinw_main

intX=14

intY=52

intWidth=379

intHeight=76

booleanEnabled=false

stringText="方针地点:"

booleanFocusRectangle=false

longTextColor=33554432

longBackColor=67108864

intTextSize=-10

intWeight=400

stringFaceName="朴直姚体"

FontCharSetFontCharSet=GB2312CharSet!

FontPitchFontPitch=Variable!

endtype


使为了数据安全,我们搭建了主从。但实时主从备份只能防止硬件问题,比如主库的硬盘损坏。但对于误操作,则无能为力。比如在主库误删一张表,或者一个update语句没有指定where条件,导致全表被更新。
简单生活 该用户已被删除
沙发
发表于 2015-1-19 20:37:07 | 只看该作者
个人感觉没有case直观。而且默认的第三字段(还可能更多)作为groupby字段很容易造成新手的错误。
飘飘悠悠 该用户已被删除
板凳
发表于 2015-1-25 21:30:05 | 只看该作者
而SQLServer如果能像Oracle一样可以为登陆分配如:5%的cpu,10%的内存。就可以解决这个漏洞。
乐观 该用户已被删除
地板
发表于 2015-2-4 02:43:50 | 只看该作者
是要和操作系统进行Socket通讯的场景。否则建议慎重!
小妖女 该用户已被删除
5#
发表于 2015-2-9 11:47:53 | 只看该作者
对一张百万级别的表建游标,同时又没有什么过滤条件,取得游标效率是如果直接SQL查询百万条数据;如果再对每条记录做处理,耗时将更长。
蒙在股里 该用户已被删除
6#
发表于 2015-2-27 05:50:11 | 只看该作者
一个百万级别的基本信息表A,一个百万级别的详细记录表B,A中有个身份证id,B中也有身份id;先要找出A中在B的详细记录。
分手快乐 该用户已被删除
7#
发表于 2015-3-8 22:41:30 | 只看该作者
作了些试验,发现使用CLR的存储过程或函数在达到一定的阀值的时候,系统性能会呈指数级下滑!这是非常危险的!只使用几个可能没有问题,当一旦大规模使用会造成严重的系统性能问题!
海妖 该用户已被删除
8#
发表于 2015-3-16 16:29:34 | 只看该作者
另一个是把SQL语句写到服务器端,就是所谓的SP(存储过程);
变相怪杰 该用户已被删除
9#
发表于 2015-3-22 23:41:42 | 只看该作者
习惯敲命令行的朋友可能会爽一些。但是功能有限。适合机器跑不动SQLServerManagementStudio的朋友使用。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-8 11:40

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表