diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index fa7eeb8..9ef1c4c 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -405,9 +405,9 @@ jobs: strategy: matrix: config: - - {vs: Visual Studio 16 2019, os: 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\", rx: "ON", upnp: "ON"} - - {vs: Visual Studio 16 2019, os: 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\", rx: "OFF", upnp: "ON"} - - {vs: Visual Studio 16 2019, os: 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\", rx: "OFF", upnp: "OFF"} + - {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "ON", upnp: "ON"} + - {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "ON"} + - {vs: Visual Studio 16 2019, os: 2019, vspath: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise", rx: "OFF", upnp: "OFF"} steps: - name: Checkout repository @@ -423,14 +423,22 @@ jobs: mkdir build cd build cmake .. -G "${{ matrix.config.vs }}" -DWITH_RANDOMX=${{ matrix.config.rx }} -DWITH_UPNP=${{ matrix.config.upnp }} - & "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Release p2pool.vcxproj + & "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Release p2pool.vcxproj + + - name: Check Windows 7 compatibility + shell: cmd + run: | + call "${{ matrix.config.vspath }}\\VC\\Auxiliary\\Build\\vcvarsall.bat" amd64 + dumpbin /IMPORTS build/Release/p2pool.exe > 1.txt + findstr /R /C:"^ *[0-9A-F][0-9A-F]* [a-zA-Z][a-zA-Z0-9]*$" 1.txt > 2.txt + python tests/src/check_win7.py 2.txt - name: Run RandomX tests if: matrix.config.rx == 'ON' run: | build/Release/p2pool.exe --test cd build/external/src/RandomX - & "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Release randomx-tests.vcxproj + & "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Release randomx-tests.vcxproj Release/randomx-tests.exe - name: Build tests @@ -439,7 +447,7 @@ jobs: mkdir build cd build cmake .. -G "${{ matrix.config.vs }}" - & "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Debug p2pool_tests.vcxproj + & "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool_tests.vcxproj - name: Run tests run: | @@ -450,7 +458,7 @@ jobs: - name: Archive binary uses: actions/upload-artifact@v3 with: - name: p2pool-msbuild-${{ matrix.config.os }}-randomx-${{ matrix.config.rx }}-upnp-${{ matrix.config.upnp }}.exe + name: p2pool-vs-${{ matrix.config.os }}-randomx-${{ matrix.config.rx }}-upnp-${{ matrix.config.upnp }}.exe path: build/Release/p2pool.exe build-macos: diff --git a/tests/src/check_win7.py b/tests/src/check_win7.py new file mode 100644 index 0000000..7a7371d --- /dev/null +++ b/tests/src/check_win7.py @@ -0,0 +1,281 @@ +# This file is part of the Monero P2Pool +# Copyright (c) 2021-2023 SChernykh +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, version 3. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import sys + +allowedAPIs = { + "getaddrinfo", + "freeaddrinfo", + "WSAPoll", + "WSACreateEvent", + "WSACloseEvent", + "WSARecvFrom", + "WSASend", + "WSARecv", + "WSADuplicateSocketW", + "WSASocketW", + "WSAIoctl", + "getnameinfo", + "WSASocketA", + "GetAdaptersAddresses", + "GetBestInterface", + "DnsFree", + "LoadLibraryExW", + "RtlPcToFileHeader", + "RtlUnwindEx", + "GetCPInfo", + "GetStringTypeW", + "GetDriveTypeW", + "DecodePointer", + "EncodePointer", + "FreeLibraryAndExitThread", + "SystemTimeToTzSpecificLocalTime", + "CreateThread", + "LCMapStringEx", + "ExitThread", + "GetModuleHandleExW", + "SetStdHandle", + "FlsFree", + "FlsSetValue", + "FlsGetValue", + "SetFilePointer", + "SetEndOfFile", + "UnmapViewOfFile", + "GetLastError", + "FlushViewOfFile", + "CreateFileA", + "CloseHandle", + "CreateFileMappingA", + "MapViewOfFile", + "FlushFileBuffers", + "GetStdHandle", + "WriteConsoleA", + "SetConsoleMode", + "GetConsoleMode", + "FormatMessageA", + "SetThreadPriority", + "GetCurrentThread", + "SetThreadPriorityBoost", + "IsDebuggerPresent", + "Sleep", + "RaiseException", + "InitializeCriticalSection", + "EnterCriticalSection", + "LeaveCriticalSection", + "DeleteCriticalSection", + "QueryPerformanceCounter", + "QueryPerformanceFrequency", + "GetTickCount", + "FreeLibrary", + "GetProcAddress", + "LoadLibraryA", + "SetHandleInformation", + "WaitForSingleObject", + "GetCurrentThreadId", + "TryEnterCriticalSection", + "GetCurrentProcessId", + "GetHandleInformation", + "SetLastError", + "CreateIoCompletionPort", + "GetQueuedCompletionStatusEx", + "InitializeSRWLock", + "ReleaseSRWLockExclusive", + "ReleaseSRWLockShared", + "AcquireSRWLockExclusive", + "AcquireSRWLockShared", + "InitOnceExecuteOnce", + "GetTickCount64", + "GetModuleHandleW", + "SetFileCompletionNotificationModes", + "WideCharToMultiByte", + "DuplicateHandle", + "TryAcquireSRWLockShared", + "InitializeConditionVariable", + "WakeConditionVariable", + "WakeAllConditionVariable", + "SleepConditionVariableCS", + "SetEvent", + "ReleaseSemaphore", + "CreateEventA", + "GetCurrentProcess", + "ResumeThread", + "TlsAlloc", + "TlsGetValue", + "TlsSetValue", + "TlsFree", + "GetNativeSystemInfo", + "CreateSemaphoreA", + "GetFileType", + "PostQueuedCompletionStatus", + "CreateFileW", + "ResetEvent", + "QueueUserWorkItem", + "GetFileAttributesExW", + "UnregisterWait", + "GetNumberOfConsoleInputEvents", + "ReadConsoleInputW", + "ReadConsoleW", + "WriteConsoleW", + "FillConsoleOutputCharacterW", + "FillConsoleOutputAttribute", + "GetConsoleCursorInfo", + "SetConsoleCursorInfo", + "GetConsoleScreenBufferInfo", + "SetConsoleCursorPosition", + "SetConsoleTextAttribute", + "WriteConsoleInputW", + "ReadFile", + "WriteFile", + "ConnectNamedPipe", + "SetNamedPipeHandleState", + "PeekNamedPipe", + "CreateNamedPipeW", + "CancelIoEx", + "CancelSynchronousIo", + "SwitchToThread", + "LocalFree", + "GetNamedPipeHandleStateA", + "GetNamedPipeClientProcessId", + "GetNamedPipeServerProcessId", + "MultiByteToWideChar", + "SetConsoleCtrlHandler", + "SetErrorMode", + "GetQueuedCompletionStatus", + "CreateDirectoryW", + "FindClose", + "FindFirstFileW", + "FindNextFileW", + "RtlUnwind", + "GetFileAttributesW", + "GetFileInformationByHandle", + "GetFileSizeEx", + "GetFinalPathNameByHandleW", + "GetFullPathNameW", + "RemoveDirectoryW", + "SetFilePointerEx", + "SetFileTime", + "DeviceIoControl", + "GetSystemInfo", + "GetSystemTimeAsFileTime", + "ReOpenFile", + "CopyFileW", + "MoveFileExW", + "CreateHardLinkW", + "GetFileInformationByHandleEx", + "CreateSymbolicLinkW", + "CancelIo", + "DebugBreak", + "GetCurrentDirectoryW", + "TerminateProcess", + "GetExitCodeProcess", + "UnregisterWaitEx", + "LCMapStringW", + "GetLongPathNameW", + "ReadDirectoryChangesW", + "GetEnvironmentStringsW", + "FreeEnvironmentStringsW", + "SetEnvironmentVariableW", + "GetModuleFileNameW", + "FileTimeToSystemTime", + "GetModuleHandleA", + "LoadLibraryExA", + "GetStartupInfoW", + "FormatMessageW", + "InitializeCriticalSectionEx", + "GetSystemDirectoryA", + "WaitForSingleObjectEx", + "GetEnvironmentVariableA", + "SleepEx", + "VerSetConditionMask", + "VerifyVersionInfoW", + "VirtualProtect", + "VirtualFree", + "VirtualAlloc", + "GetLargePageMinimum", + "HeapFree", + "HeapAlloc", + "GetProcessHeap", + "FlsAlloc", + "SleepConditionVariableSRW", + "GetExitCodeThread", + "InitializeSListHead", + "CreateEventW", + "InitializeCriticalSectionAndSpinCount", + "IsProcessorFeaturePresent", + "SetUnhandledExceptionFilter", + "UnhandledExceptionFilter", + "RtlVirtualUnwind", + "RtlLookupFunctionEntry", + "SetFileAttributesW", + "GetConsoleOutputCP", + "ExitProcess", + "GetCommandLineA", + "GetCommandLineW", + "GetDateFormatW", + "GetTimeFormatW", + "CompareStringW", + "GetLocaleInfoW", + "IsValidLocale", + "GetUserDefaultLCID", + "EnumSystemLocalesW", + "HeapReAlloc", + "HeapSize", + "FindFirstFileExW", + "IsValidCodePage", + "GetACP", + "GetOEMCP", + "GetTimeZoneInformation", + "RegisterWaitForSingleObject", + "GetDiskFreeSpaceW", + "RtlCaptureContext", + "GetMessageA", + "GetSystemMetrics", + "MapVirtualKeyW", + "DispatchMessageA", + "TranslateMessage", + "AdjustTokenPrivileges", + "LookupPrivilegeValueA", + "CryptDestroyHash", + "CryptHashData", + "CryptCreateHash", + "CryptGetHashParam", + "CryptReleaseContext", + "CryptAcquireContextA", + "SystemFunction036", + "OpenProcessToken", + "SetSecurityDescriptorDacl", + "InitializeSecurityDescriptor", + "BCryptGenRandom", + "GetConsoleCP", +} + +f = open(sys.argv[1], 'r') +lines = f.readlines() +f.close() + +exit_code = 0 +count = 0 + +for line in lines: + count += 1 + api = line[29:].strip() + if api not in allowedAPIs: + print('API call "{}" is not checked for Windows 7 compatibility. Check it and then add it to the list in tests/src/check_imports.py'.format(api)) + exit_code = 1 + +if exit_code == 0: + print('{} imports checked successfully'.format(count)) + +sys.exit(exit_code)