VBGood网站全文搜索 Google

搜索VBGood全站网页(全文搜索)

VB爱好者乐园(VBGood)

 找回密码
 立即注册
搜索
楼主: download

[原创]全球首创? 再次突破VB极限!VB真正稳定多线程(第二季,可以用Msgbox了)

  [复制链接]
 楼主| 发表于 2010-5-6 17:34:36 | 显示全部楼层
22# download

I am here ... so code for get VBHeader I found somewhere on the net sometimes ago:
1) I have problem to use it, bec ...
izero 发表于 2010-5-6 16:30

0) just exe.PE header->EntryPoint(EP)->first push,blah blah...
when you pack a vb exe. the EP be moved and encrypt. so can't get it.
//search the VBHeader in exe, and patch it. hehe. and then change the Magic of VBHeader("VB5!"). after all, packing....

1) ...you can get them from VB API Viewer.

2) I'm not sure. it like a VBA object.(in IE, it's VBScript object)
when you run the exe , the expsvr.dll didnt load into the module lists. so...
回复 支持 反对

使用道具 举报

发表于 2010-5-6 17:37:36 | 显示全部楼层
在IDE中试了下BYTE固定数组,没崩。

在MsgBox "Thread OK", vbInformation, ""之后,加入:
    Dim strData As String
    Dim abc(3) As Byte

    Dim strData As String ,abc(3) As Byte

都没问题。 ...
wolf3t 发表于 2010-5-6 17:14


是么?你编译出来试试看。我一直以为多线程不能在IDE下运行的。
回复 支持 反对

使用道具 举报

发表于 2010-5-6 17:41:47 | 显示全部楼层
刚才又测试了一下,IDE下dim固定大小数组的确不会整个IDE崩掉,不过其实线程已经悄悄的崩了!不过如果代码没问题的话这个第二版居然可以正常运行在IDE下面。而且也不会出现那个多余的窗体。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-5-6 17:44:09 | 显示全部楼层
22# download

I am here ... so code for get VBHeader I found somewhere on the net sometimes ago:

look at: http://vb-decompiler.com/viewtopic.php?f=2&t=1799

izero 发表于 2010-5-6 16:30

maybe the location for VBheader is only one place in exe?

If mInfo.EntryPoint Then
      RtlMoveMemory ExeVBHeader, ByVal mInfo.EntryPoint + 1, 4
      End If



EP+1 means, after the first PUSH that I mentioned yesterday.
the struction of Vb-EXE:
---------->
MZ-> PE->EP->first PUSH: VBHeader, call vbvmDLL#100.
<----------

this is VB-DLL(activex), we're EXEs.
  1.    If dllHandle Then
  2.       pVBH = GetProcAddress(myHandle, "DllRegisterServer") + 2
  3.       RtlMoveMemory DllVBheader, ByVal pVBH, 4
  4.       End If
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-5-6 17:47:43 | 显示全部楼层
是么?你编译出来试试看。我一直以为多线程不能在IDE下运行的。
yimins 发表于 2010-5-6 17:37

...原来是在IDE...在IDE己经初始化了,所以怎么调用都可以


在IDE的话如果子线程没退出,主线程关闭的话. IDE就被废了,没有自动关闭线程的功能.(AX的COM线程除外)
回复 支持 反对

使用道具 举报

发表于 2010-5-6 18:07:31 | 显示全部楼层
31# download

1/ I got it, but app crash when I paste it to declaration section (module, form, anywhere) :)   otherwise, sample with openprocess above not working for me too ... an obscure problem on my side

2/ I am sure it is expression server not IE sever object ;) yes, it is for VBA, this function is implemented in some others dll like expsrv.dll, vbar332.dll .. but this is not important for us for now ;)

3/ If I understand Google translator :)... in openproces sample above you have problem that new form is showed ... we can use Sub main as you describe above, or make an copy of VBHeader (it is about 104 bytes long) and patch &H2C byte, where is stored info about what is loaded on startup ... look at http://www.vb-decompiler.com/viewtopic.php?f=2&t=2&p=2&hilit=vbheader#p2 for vbheader structure ;)
回复 支持 反对

使用道具 举报

发表于 2010-5-6 18:31:51 | 显示全部楼层
本帖最后由 wolf3t 于 2010-5-6 18:35 编辑
是么?你编译出来试试看。我一直以为多线程不能在IDE下运行的。
yimins 发表于 2010-5-6 17:37

定义静态数组编译后,崩了.
使用动态数组在IDE或编译后都没问题.
    Dim strData As String, abc() As Byte
    ReDim abc(3) As Byte
    abc(0) = 97: abc(1) = 98: abc(2) = 99: abc(3) = 100
    MsgBox StrConv(abc(), vbUnicode)
回复 支持 反对

使用道具 举报

发表于 2010-5-6 18:38:06 | 显示全部楼层
好快啊,第二季又出来了.
回复 支持 反对

使用道具 举报

发表于 2010-5-6 18:51:20 | 显示全部楼层
34# download

maybe I don't undestand ... vbheader is pushed to thunhrtmain (ordinal export #100), EP + 1 return address to VBheader ... vbExe allway start this way .. it is not vbheader that we want? maybe our problem is that UserDllMain and GetClassObject is for DLL loading and looking for DLL header on another place as EP + 1, so, our solution to bypas dll loading is high untraditionally :)(but working ;) )
回复 支持 反对

使用道具 举报

发表于 2010-5-6 19:35:58 | 显示全部楼层
31# download

(it is about 104 bytes long) and patch &H2C byte, where is stored info about what is loaded on startup
izero 发表于 2010-5-6 18:07

when I patch &H2c with a fake main. with no result. the main form show itself again. so , this isn't the key.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

文字版|手机版|小黑屋|VBGood  

GMT+8, 2022-7-3 15:50

VB爱好者乐园(VBGood)
快速回复 返回顶部 返回列表