|
今天发现微软的MSCOMM32.OCX有限制,串口数最大只能到16。如果电脑串口大于16,则无法使用。
解除这一限制的方法如下:
Hi Guys
As some of you who use COM ports to communicate with may have found out, MSCOMM32.OCX only supports a max of 16 COM ports. Since it is just a wrapper to the API's I don't know why they put in that limitation.
So with that said it would be nice to remove this false limitation and really USE the OCX, by increasing the number of ports it will open.
If you are brave and a bit handy with a HEX editor you can do it. I have successfully gone upto port 50 but I suppose you can go higher upto 65K if you wanted to.
Basically you need to "overcome" the limitation of MSCOMM32.ocx with a bit of creative hacking. There are 2 places - search for the HEX strings (I use HEX edit) and patch them. Is this Legal? Don't ask me.
Does it work? Sure does.
Make a backup of MSCOMM32.ocx just in case you muck up 
Patch 1(Assembly)
*******
:21C1493B 56 push esi
:21C1493C 8B742408 mov esi, dword ptr [esp+08]
:21C14940 837E1C00 cmp dword ptr [esi+1C], 00000000
:21C14944 7530 jne 21C14976
:21C14946 668B44240C mov ax, word ptr [esp+0C]
:21C1494B 663D0100 cmp ax, 0001<--- is port set to < one
:21C1494F 7C3F jl 21C14990<--- Error: Invalid Port Number
:21C14951 663D1000 cmp ax, 0010<--- is port > 16 (hex 10)
:21C14955 7F39 jg 21C14990<---- Error: Invalid Port
:21C14957 663B4620 cmp ax, word ptr [esi+20]
:21C1495B 7415 je 21C14972
:21C1495D 6A04 push 00000004
:21C1495F 8D8E6CFFFFFF lea ecx, dword ptr [esi+FFFFFF6C]
SO Change the code at location :21C14951
663D1000 change to 663D3200 this will give you 50 ports (32h = 50 Dec) maybe be greedy and go up to FFFF?
Offsets: 16 进制
3F53: 7F 10
Patch 2
*******
* Reference To: KERNEL32.CreateFileA, Ord:0031h
|
:21C144AD FF15A010C121 Call dword ptr [21C110A0]
:21C144B3 83F8FF cmp eax, FFFFFFFF
:21C144B6 8986D8000000 mov dword ptr [esi+000000D8], eax
:21C144BC 0F840E1C0000 je 21C160D0<--- This jump raises an error so you need to bypass it!
:21C144C2 68FD010000 push 000001FD
:21C144C7 50 push eax
:21C144C8 89BE4C020000 mov dword ptr [esi+0000024C], edi
Change code at :21C144BC
0F840E1C0000 to 909090909090 (This is basically NOP so that the jump is NOT taken).
Now save your changes and Voila - 50 ports.
To search for these codes just enter the hexdigits into the hex editor.
eg: search for : 663D1000 Only 1 instance found, so make your changes.
Also there is a mob that have come up with a Virtual COM port driver. That too works exactly as advertised and is very useful for testing. Check it out at :
|
|