Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mscomm port number limitation
Message
From
07/11/2005 11:45:20
 
 
To
31/10/2005 17:51:56
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01063851
Message ID:
01066033
Views:
23
>Uisng MScomm activex control I can control up to 16 ports. How can I control more then that? The control simply does not accept anything greater then 16.
>
>Thanks

Hi Mark

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.

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.

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)



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.



Enjoy!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform