Skip to content

Commit 300e8b4

Browse files
Fix win build when lean and mean specified (#755)
1 parent 8d7a201 commit 300e8b4

File tree

4 files changed

+36
-8
lines changed

4 files changed

+36
-8
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@ jobs:
172172
python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
173173
python builder.pyz build -p ${{ env.PACKAGE_NAME }}
174174
175+
windows-lean:
176+
runs-on: windows-2025 # latest
177+
env:
178+
CFLAGS: "-DWIN32_LEAN_AND_MEAN"
179+
steps:
180+
- uses: aws-actions/configure-aws-credentials@v4
181+
with:
182+
role-to-assume: ${{ env.CRT_CI_ROLE }}
183+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
184+
- name: Build ${{ env.PACKAGE_NAME }} + consumers
185+
run: |
186+
python -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder.pyz')"
187+
python builder.pyz build -p ${{ env.PACKAGE_NAME }}
188+
175189
windows-debug:
176190
runs-on: windows-2025 # latest
177191
steps:

include/aws/io/private/pki_utils.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@
99
#ifdef _WIN32
1010
/* It's ok to include external headers because this is a PRIVATE header file
1111
* (it is usually a crime to include windows.h from header file) */
12+
# define NOMINMAX
13+
# define NOCRYPT
1214
# include <windows.h>
15+
16+
/* Note: we need defs for crypto definitions, we can get them from windows.h, but
17+
* with lean an mean on they will be missing from windows.h.
18+
* So instead lets have a proper dependency on the header that defines them, and force them
19+
* to not be included in windows.h.
20+
*/
21+
# include <wincrypt.h>
1322
#endif /* _WIN32 */
1423

1524
#ifdef AWS_OS_APPLE

source/windows/iocp/iocp_event_loop.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
#include <aws/io/logging.h>
1414
#include <aws/io/private/event_loop_impl.h>
1515

16+
/*
17+
* Note: windows.h does not include ntstatus when compiled lean and mean.
18+
* winternl is the proper place to pickup ntstatus
19+
*/
1620
#include <windows.h>
21+
#include <winternl.h>
1722

1823
/* The next set of struct definitions are taken directly from the
1924
windows documentation. We can't include the header files directly

tests/socket_test.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,14 +2675,14 @@ static int s_test_parse_ipv4_valid_addresses(struct aws_allocator *allocator, vo
26752675
const char *input;
26762676
uint32_t expected_network_order;
26772677
} test_cases[] = {
2678-
{"127.0.0.1", htonl(0x7F000001)}, /* localhost */
2679-
{"0.0.0.0", htonl(0x00000000)}, /* any address */
2680-
{"255.255.255.255", htonl(0xFFFFFFFF)}, /* broadcast */
2681-
{"192.168.1.1", htonl(0xC0A80101)}, /* common private IP */
2682-
{"10.0.0.1", htonl(0x0A000001)}, /* private IP */
2683-
{"172.16.0.1", htonl(0xAC100001)}, /* private IP */
2684-
{"8.8.8.8", htonl(0x08080808)}, /* Google DNS */
2685-
{"1.2.3.4", htonl(0x01020304)}, /* simple test case */
2678+
{"127.0.0.1", aws_hton32(0x7F000001)}, /* localhost */
2679+
{"0.0.0.0", aws_hton32(0x00000000)}, /* any address */
2680+
{"255.255.255.255", aws_hton32(0xFFFFFFFF)}, /* broadcast */
2681+
{"192.168.1.1", aws_hton32(0xC0A80101)}, /* common private IP */
2682+
{"10.0.0.1", aws_hton32(0x0A000001)}, /* private IP */
2683+
{"172.16.0.1", aws_hton32(0xAC100001)}, /* private IP */
2684+
{"8.8.8.8", aws_hton32(0x08080808)}, /* Google DNS */
2685+
{"1.2.3.4", aws_hton32(0x01020304)}, /* simple test case */
26862686
};
26872687

26882688
for (size_t i = 0; i < AWS_ARRAY_SIZE(test_cases); i++) {

0 commit comments

Comments
 (0)