TCP window scaling on Windows - c++

I have to implement in C/C++ a software for FTP upload in Windows XP and Windows 7 with TCP window scaling disabled.
I know that in Windows 7 is possible to disable it globally with the command
'netsh interface tcp set global autotuning=disabled'
or in XP with the "Tcp1323Opts" registry parameter.
But these solutions works globally, and I need to change the behaviour only of my program.
I know that it's possible to do it because our customer has shown a program that executes the FTP upload disabling the TCP windows scaling (verified with wireshark), but I don't have the source code of that program.
Please anyone could help me?
Thanks

See WSAIoctl with SIO_SET_COMPATIBILITY_MODE in MSDN; link here: http://msdn.microsoft.com/en-us/library/windows/desktop/cc136103(v=vs.85).aspx
This lets you set the WsaBehaviorAutoTuning value which can be used to turn off auto tuning on the socket in question.

Related

Modifying windows TCP/IP responses

I have written a small program that returns a custom response to receiving SYN packets to some ports in Linux. This required me to make a minor edit to the Linux Kernel and recompile. I have tested this and i have the functionality i require in Linux.
I wish to have the same functionality in Windows XP/7. To achieve this i believe i would need to edit a driver/file/registry setting that controls tcpip functions. The goal would be to disable the default action of sending RST packets when a SYN is received on a closed port?
The research i have done so far has pointed me towards something like tcpip.sys or the tcpip settings in registry?
I am realistic that this may not be possible due to the drivers being unsigned if i modify them, but hopefully someone can put my mind at ease about the plausibility of this being possible?

Disable-Enable Ethernet Interface Connection using C++ or Qt in Window 7 64bit

I'm trying to come up with an easy solution to my "buggy" Ethernet camera. The thing is after establishing a TCP connection to reach faster FPS the camera ignores if someone is reading the socket buffer and blocks if the program unexpectedly stops without "sending end of connection" message. I come up with an stupid/easy solution. Disable and re-enable the Ethernet connection works. It works if the camera is directly connected to the computer. But now I have to program it.
I've found someone with similar problems but I want something more Qt like.
Programmatically disable/enable network interface
Does QT 5.4.0 have some API or Library to do it? Does C++ have something similar?
As the firs link says Microsoft suggested Win32_NetworkAdapter class but I have never used it. Will it work in QT with msvc 2010 used in a W7 64bit SO?
https://msdn.microsoft.com/en-us/library/aa394216%28VS.85%29.aspx
Thanks!

Bluetooth C++ Winapi Discoverable

I'm using source codes based from the following links w/my broadcom bluetooth device:
I want to make a bluetooth server that automatically starts and other devices can pair with it.
http://www.codeproject.com/Articles/252882/Bluetooth-Server-Programming-on-Windows
http://msdn.microsoft.com/en-us/library/windows/desktop/aa362932(v=vs.85).aspx
I can get the code to compile fine, allegedly the server starts, it tells me my local bluetooth device, the server port, but I cannot see the advertisement when I scan for bluetooth devices w/my iphone or ipad.
Device manager reports my bluetooth driver as functional. I'm doing this in a vm machine on win 7.
Both links say nothing about BluetoothEnableDiscovery() function. Would I need this? I tried but not sure how it works.
Everything looks ok, in the entire process I don't receive a single error. I just think I need to set it to discoverable some how or make it advertise so my other devices can see it and pair with it.
If you have any ideas, I would appreciate them. Thanks.
EDIT: Would anyone know how I can change between Secure Simple Pairing modes, or set a a 4/8 digit key for pairing in winapi c++?
With Microsoft BT stack (even with a Widcomm dongle), under Win7, your server has to expose a 'service' first.
it can be "Discoverable' but without any service exposed, no-one will "see" your server from the outside.
Check out WSASetService: https://msdn.microsoft.com/en-us/library/aa362921(v=vs.85).aspx
PS: the service will live during your app execution only...

How to change subnet mask and DHCP enabled flag in C++ and Windows XP

Does anyone know how to change the subnet mask and the DHCP enabled flag on Windows XP / Vista / 7 from a C++ program?
The Windows API has a GetAdaptersInfo() routine which will give you that information, but I need the counterpart SetAdaptersInfo() which doesn't seem to exist. I've looked all over MSDN and the web and don't see how to do it on newer-than-Windows-NT machines.
Any information is greatly appreciated.
You can change this with the IPHelp API, but you need to use the functions
AddIPAddress, DeleteIPAddress etc.

How to check if button is pressed and working on LPT port in C++

I have a button I got out of a random item around the house and I wanna hook it up to my LPT port and check if its pressed or not in C++ and if it is display a message.
Your best bet is to use the inpout32.dll which will enable you to read/write from/to the LPT port. The usage of direct addressing of hardware ports is restricted, the dll will enable you to get around the restriction as it executes an internal driver which is already built into the dll and therefore communicating with the driver in an indirect fashion. The dll can be downloaded from here, there is one available for x64bit platform here.
Hope this helps,
Best regards,
Tom.
If you want to learn about accessing the parallel port, here is a good resource: Lakeview Research