Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <Windows.h>
- #define DEVCON_EXE "\"C:\\Program Files (x86)\\Windows Kits\\10\\Tools\\x64\\devcon.exe\""
- #define CARD_HWID "PCI\\VEN_10EC"
- #define RESTART_CMD DEVCON_EXE " restart " CARD_HWID
- int main() {
- for (int i = 0; i < 7; i++) {
- printf("Testing the connection...");
- // Find returns 0 if it has found the string TTL in the ping output.
- // ping outputs TTL if and only if the connection works.
- if (!system("ping 8.8.8.8 | find \"TTL\""))
- return 1;
- printf("\nRestarting the network card...\n");
- system(RESTART_CMD);
- printf("\nWaiting..\n");
- Sleep(10000);
- }
- printf("\nFailed to get the connection working.\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment