amoeba commented on code in PR #44989:
URL: https://github.com/apache/arrow/pull/44989#discussion_r1936070571


##########
ci/rtools/aws_c_io_ep.patch:
##########
@@ -0,0 +1,88 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+diff --git a/source/windows/host_resolver.c b/source/windows/host_resolver.c
+index 59fbb85..ad4a99e 100644
+--- a/source/windows/host_resolver.c
++++ b/source/windows/host_resolver.c
+@@ -4,6 +4,7 @@
+  */
+
+ /* don't move this below the Windows.h include!!!!*/
++#define _WIN32_WINNT 0x0601
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+
+diff --git a/source/windows/iocp/iocp_event_loop.c 
b/source/windows/iocp/iocp_event_loop.c
+index 9ccce30..5cbbef7 100644
+--- a/source/windows/iocp/iocp_event_loop.c
++++ b/source/windows/iocp/iocp_event_loop.c
+@@ -12,6 +12,7 @@
+
+ #include <aws/io/logging.h>
+
++#define _WIN32_WINNT 0x0601
+ #include <Windows.h>
+
+ /* The next set of struct definitions are taken directly from the
+diff --git a/source/windows/secure_channel_tls_handler.c 
b/source/windows/secure_channel_tls_handler.c
+index 50caf02..29fe850 100644
+--- a/source/windows/secure_channel_tls_handler.c
++++ b/source/windows/secure_channel_tls_handler.c
+@@ -2,6 +2,7 @@
+  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+  * SPDX-License-Identifier: Apache-2.0.
+  */
++#define _WIN32_WINNT 0x0601
+ #define SECURITY_WIN32
+
+ #include <aws/io/tls_channel_handler.h>
+@@ -35,6 +36,25 @@
+ #    pragma warning(disable : 4306) /* Identifier is type cast to a larger 
pointer. */
+ #endif
+
++#ifndef SP_PROT_TLS1_0_SERVER
++#define SP_PROT_TLS1_0_SERVER SP_PROT_TLS1_SERVER
++#endif
++#ifndef SP_PROT_TLS1_0_CLIENT
++#define SP_PROT_TLS1_0_CLIENT SP_PROT_TLS1_CLIENT
++#endif
++#ifndef SP_PROT_TLS1_1_SERVER
++#define SP_PROT_TLS1_1_SERVER 0x00000100
++#endif
++#ifndef SP_PROT_TLS1_1_CLIENT
++#define SP_PROT_TLS1_1_CLIENT 0x00000200
++#endif
++#ifndef SCH_USE_STRONG_CRYPTO
++#define SCH_USE_STRONG_CRYPTO 0x00400000
++#endif
++#ifndef SECBUFFER_ALERT
++#define SECBUFFER_ALERT 0x11
++#endif
++
+ #define KB_1 1024
+ #define READ_OUT_SIZE (16 * KB_1)
+ #define READ_IN_SIZE READ_OUT_SIZE
+@@ -456,7 +476,7 @@ static int s_fillin_alpn_data(
+ 
+     *extension_length += sizeof(uint32_t) + sizeof(uint16_t);
+ 
+-    *extension_name = SecApplicationProtocolNegotiationExt_ALPN;
++    *extension_name = 2;

Review Comment:
   I still wasn't able to get this working and I'm not sure why. In a UCRT64 
Rtools40 prompt , I ran `gcc -v` to make sure I knew the include path,
   
   ```
   $ gcc -v
   Using built-in specs.
   COLLECT_GCC=C:\rtools40\ucrt64\bin\gcc.exe
   
COLLECT_LTO_WRAPPER=C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/lto-wrapper.exe
   Target: x86_64-w64-mingw32
   Configured with: ../gcc-10.3.0/configure --prefix=/ucrt64 
--with-local-prefix=/ucrt64/local --build=x86_64-w64-mingw32 
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 
--with-native-system-header-dir=/ucrt64/x86_64-w64-mingw32/include 
--libexecdir=/ucrt64/lib --enable-bootstrap --enable-checking=release 
--with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran 
--disable-shared --enable-static --enable-libatomic --enable-threads=posix 
--enable-graphite --enable-fully-dynamic-string 
--enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes 
--disable-libstdcxx-pch --disable-libstdcxx-debug --enable-lto --enable-libgomp 
--disable-multilib --disable-rpath --disable-win32-registry --disable-nls 
--disable-werror --disable-symvers --with-libiconv --with-system-zlib 
--with-gmp=/ucrt64 --with-mpfr=/ucrt64 --with-mpc=/ucrt64 --with-isl=/ucrt64 
--with-pkgversion='Built by Jeroen for the R-project' 
--with-bugurl=https://github.com/r-windows/rtools-packages/issues 
 --with-gnu-as --with-gnu-ld
   Thread model: posix
   Supported LTO compression algorithms: zlib zstd
   gcc version 10.3.0 (Built by Jeroen for the R-project)
   ```
   
   From the above, I assume the path inside 
`--with-native-system-header-dir=/ucrt64/x86_64-w64-mingw32/include` is where 
we're looking for headers.
   
   Then if I look in the version of `sspi.h` in 
C:\rtools40\ucrt64\x86_64-w64-mingw32/include`, I see the enum and I don't see 
it guarded by any ifdefs that would leave it undefined:
   
   ```
   $ grep -C 3 "SecApplicationProtocolNegotiationExt_ALPN" 
C:/rtools40/ucrt64/x86_64-w64-mingw32/include/sspi.h
     typedef enum _SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT {
       SecApplicationProtocolNegotiationExt_None,
       SecApplicationProtocolNegotiationExt_NPN,
       SecApplicationProtocolNegotiationExt_ALPN
     } 
SEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT,*PSEC_APPLICATION_PROTOCOL_NEGOTIATION_EXT;
   
     typedef struct _SEC_APPLICATION_PROTOCOL_LIST {
   ```
   
   I've tried changing the order of the sspi.h include within 
`secure_channel_tls_handler.cc` and haven't found a way that works. Any ideas 
@kou?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to