diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d5ae20b..b180254 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,9 @@ jobs: - {os: windows-latest, dc: ldc-1.9.0, config: select} - {os: windows-latest, dc: ldc-1.17.0} - {os: ubuntu-latest, dc: ldc-1.17.0} + include: + - {os: windows-latest, dc: ldc-latest, arch: x86, config: winapi} + - {os: windows-latest, dc: dmd-latest, arch: x86_mscoff, config: winapi} runs-on: ${{ matrix.os }} steps: diff --git a/dub.sdl b/dub.sdl index 40d503a..aae914f 100644 --- a/dub.sdl +++ b/dub.sdl @@ -36,27 +36,15 @@ configuration "kqueue" { } configuration "winapi" { - platforms "windows-x86_64" "windows-x86_mscoff" "windows-ldc" "windows-gdc" + platforms "windows" versions "EventcoreWinAPIDriver" } configuration "select" { - platforms "posix" "windows-x86_64" "windows-x86_mscoff" + platforms "posix" "windows" versions "EventcoreSelectDriver" } -configuration "winapi-optlink" { - platforms "windows-x86-dmd" - versions "EventcoreWinAPIDriver" - sourceFiles "lib/ws2_32.lib" "lib/kernel32.lib" -} - -configuration "select-optlink" { - platforms "windows-x86-dmd" - versions "EventcoreSelectDriver" - sourceFiles "lib/ws2_32.lib" "lib/kernel32.lib" -} - configuration "libasync" { dependency "libasync" version="~>0.8.2" versions "EventcoreLibasyncDriver" diff --git a/source/eventcore/drivers/threadedfile.d b/source/eventcore/drivers/threadedfile.d index 485fd83..728e959 100644 --- a/source/eventcore/drivers/threadedfile.d +++ b/source/eventcore/drivers/threadedfile.d @@ -225,25 +225,29 @@ final class ThreadedFileEventDriver(Events : EventDriverEvents) : EventDriverFil } on_finish(file, IOStatus.ok, 0); } else version (Windows) { - import core.sys.windows.windows : FILE_BEGIN, HANDLE, INVALID_HANDLE_VALUE, - LARGE_INTEGER, SetFilePointerEx, SetEndOfFile; - import core.stdc.stdio : _get_osfhandle; + version (Win64) { + import core.sys.windows.windows : FILE_BEGIN, HANDLE, INVALID_HANDLE_VALUE, + LARGE_INTEGER, SetFilePointerEx, SetEndOfFile; + import core.stdc.stdio : _get_osfhandle; - auto h = () @trusted { return cast(HANDLE)_get_osfhandle(cast(int)file); } (); - if (h == INVALID_HANDLE_VALUE) { + auto h = () @trusted { return cast(HANDLE)_get_osfhandle(cast(int)file); } (); + if (h == INVALID_HANDLE_VALUE) { + on_finish(file, IOStatus.error, 0); + return; + } + LARGE_INTEGER ls = { QuadPart: size }; + if (!() @trusted { return SetFilePointerEx(h, ls, null, FILE_BEGIN); } ()) { + on_finish(file, IOStatus.error, 0); + return; + } + if (!() @trusted { return SetEndOfFile(h); } ()) { + on_finish(file, IOStatus.error, 0); + return; + } + on_finish(file, IOStatus.ok, 0); + } else { on_finish(file, IOStatus.error, 0); - return; } - LARGE_INTEGER ls = { QuadPart: size }; - if (!() @trusted { return SetFilePointerEx(h, ls, null, FILE_BEGIN); } ()) { - on_finish(file, IOStatus.error, 0); - return; - } - if (!() @trusted { return SetEndOfFile(h); } ()) { - on_finish(file, IOStatus.error, 0); - return; - } - on_finish(file, IOStatus.ok, 0); } else { on_finish(file, IOStatus.error, 0); }