From ac3ebcc827983aa54f3d7e3a45e9bf55b89b24aa Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 8 May 2022 08:33:53 +0100 Subject: [PATCH] Fixes for Winelib builds. In Winelib, you have to be careful not to say 'unsigned long' where the API expects ULONG, because Winelib doesn't have the Windows LLP64 nature - its unsigned long is 64 bits, whereas ULONG is 32. Also, my local Winelib has (used in the new demo-screenshot system), but doesn't contain some of the definitions inside it. So I've expanded the cmake test of HAVE_DWMAPI_H so that it actually checks the things we need, instead of just the existence of the containing header. --- cmake/platforms/windows.cmake | 17 +++++++++++++++-- windows/gss.c | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cmake/platforms/windows.cmake b/cmake/platforms/windows.cmake index e1da07dc..607506e9 100644 --- a/cmake/platforms/windows.cmake +++ b/cmake/platforms/windows.cmake @@ -49,14 +49,27 @@ check_symbol_exists(GetNamedPipeClientProcessId "windows.h" HAVE_GETNAMEDPIPECLIENTPROCESSID) check_symbol_exists(CreatePseudoConsole "windows.h" HAVE_CONPTY) -check_include_files("windows.h;dwmapi.h" HAVE_DWMAPI_H) - check_c_source_compiles(" #include GCP_RESULTSW gcpw; int main(void) { return 0; } " HAVE_GCP_RESULTSW) +function(dwmapi_test_wrapper) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dwmapi.lib) + check_c_source_compiles(" +#include +#include +volatile HWND hwnd; +int main(void) { + RECT r; + DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &r, sizeof(r)); +} +" HAVE_DWMAPI_H) + set(HAVE_DWMAPI_H ${HAVE_DWMAPI_H} PARENT_SCOPE) +endfunction() +dwmapi_test_wrapper() + set(NO_SECURITY ${PUTTY_NO_SECURITY}) add_compile_definitions( diff --git a/windows/gss.c b/windows/gss.c index ebe5698d..cadb1d5b 100644 --- a/windows/gss.c +++ b/windows/gss.c @@ -465,7 +465,7 @@ static Ssh_gss_stat ssh_sspi_init_sec_context(struct ssh_gss_library *lib, SecBufferDesc input_desc ={SECBUFFER_VERSION,1,&wrecv_tok}; unsigned long flags=ISC_REQ_MUTUAL_AUTH|ISC_REQ_REPLAY_DETECT| ISC_REQ_CONFIDENTIALITY|ISC_REQ_ALLOCATE_MEMORY; - unsigned long ret_flags=0; + ULONG ret_flags=0; TimeStamp localexp; /* check if we have to delegate ... */