There is such code:
#include <ras.h> #include <raserror.h> #include <stdio.h> #include <windows.h> int main(int argc, char** argv) { DWORD dwEntryInfoSize = 0; DWORD dwDeviceInfoSize = 0; DWORD dwRet = 0; LPRASENTRY lpRasEntry = NULL; LPBYTE lpDeviceInfo = NULL; /** * Create RAS connection * * Get buffer sizing information for a default phonebook entry */ if ((dwRet = RasGetEntryProperties(NULL, "", NULL, &dwEntryInfoSize, NULL, &dwDeviceInfoSize)) != ERROR_SUCCESS) { if (dwRet != ERROR_BUFFER_TOO_SMALL) { printf("RasGetEntryProperties error: %s\n", GetLastError()); return EXIT_FAILURE; } } if (dwEntryInfoSize == 0) { printf("Entry info size error: %s\n", GetLastError()); return EXIT_FAILURE; } lpRasEntry = (LPRASENTRY) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwEntryInfoSize); if (lpRasEntry == NULL) { printf("HeapAlloc RasEntry error: %s\n", GetLastError()); return EXIT_FAILURE; } if (dwDeviceInfoSize) { lpDeviceInfo = (LPBYTE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwDeviceInfoSize); } lpRasEntry->dwSize = sizeof(RASENTRY); // Вот здесь возникает ошибка: Overlapped I/O operation is in progress. // Кстати, ошибка возникает в Windows XP а в Windows 10 все работает // прекрасно. Мне нужно чтобы этот код работал именно в XP if ((dwRet = RasGetEntryProperties(NULL, "", lpRasEntry, &dwEntryInfoSize, lpDeviceInfo, &dwDeviceInfoSize)) != ERROR_SUCCESS) { printf("RasGetEntryProperties error: %s\n", GetLastError()); return EXIT_FAILURE; } // Validate new phonebook name "TestEntry" if ((dwRet = RasValidateEntryName(NULL, "TestEntry")) != ERROR_SUCCESS) { printf("RasValidateEntryName error: %s\n", GetLastError()); return EXIT_FAILURE; } // Install a new phonebook entry, "TestEntry", using default properties if ((dwRet = RasSetEntryProperties(NULL, "TestEntry", lpRasEntry, dwEntryInfoSize, lpDeviceInfo, dwDeviceInfoSize)) != ERROR_SUCCESS) { printf("RasSetEntryProperties error: %s\n", GetLastError()); return EXIT_FAILURE; } // Deallocate memory for the connection buffer HeapFree(GetProcessHeap(), 0, lpRasEntry); lpRasEntry = NULL; return EXIT_SUCCESS; } This code creates a normal dial-up connection. And I'm stuck on this bug.
