Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/7.7' into 7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
blackxfiied committed Nov 8, 2024
2 parents a3674ee + cefdfd7 commit 6284a1f
Show file tree
Hide file tree
Showing 36 changed files with 927 additions and 127 deletions.
4 changes: 4 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ enable_avicap32
enable_avifil32
enable_avrt
enable_bcrypt
enable_bcryptprimitives
enable_bluetoothapis
enable_browseui
enable_bthprops_cpl
Expand Down Expand Up @@ -1218,6 +1219,7 @@ enable_msimtf
enable_msisip
enable_msisys_ocx
enable_msls31
enable_msmpeg2vdec
enable_msnet32
enable_mspatcha
enable_msports
Expand Down Expand Up @@ -21837,6 +21839,7 @@ wine_fn_config_makefile dlls/avifile.dll16 enable_win16
wine_fn_config_makefile dlls/avrt enable_avrt
wine_fn_config_makefile dlls/bcrypt enable_bcrypt
wine_fn_config_makefile dlls/bcrypt/tests enable_tests
wine_fn_config_makefile dlls/bcryptprimitives enable_bcryptprimitives
wine_fn_config_makefile dlls/bluetoothapis enable_bluetoothapis
wine_fn_config_makefile dlls/browseui enable_browseui
wine_fn_config_makefile dlls/browseui/tests enable_tests
Expand Down Expand Up @@ -22225,6 +22228,7 @@ wine_fn_config_makefile dlls/msimtf enable_msimtf
wine_fn_config_makefile dlls/msisip enable_msisip
wine_fn_config_makefile dlls/msisys.ocx enable_msisys_ocx
wine_fn_config_makefile dlls/msls31 enable_msls31
wine_fn_config_makefile dlls/msmpeg2vdec enable_msmpeg2vdec
wine_fn_config_makefile dlls/msnet32 enable_msnet32
wine_fn_config_makefile dlls/mspatcha enable_mspatcha
wine_fn_config_makefile dlls/mspatcha/tests enable_tests
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2455,6 +2455,7 @@ WINE_CONFIG_MAKEFILE(dlls/avifile.dll16,enable_win16)
WINE_CONFIG_MAKEFILE(dlls/avrt)
WINE_CONFIG_MAKEFILE(dlls/bcrypt)
WINE_CONFIG_MAKEFILE(dlls/bcrypt/tests)
WINE_CONFIG_MAKEFILE(dlls/bcryptprimitives)
WINE_CONFIG_MAKEFILE(dlls/bluetoothapis)
WINE_CONFIG_MAKEFILE(dlls/browseui)
WINE_CONFIG_MAKEFILE(dlls/browseui/tests)
Expand Down Expand Up @@ -2843,6 +2844,7 @@ WINE_CONFIG_MAKEFILE(dlls/msimtf)
WINE_CONFIG_MAKEFILE(dlls/msisip)
WINE_CONFIG_MAKEFILE(dlls/msisys.ocx)
WINE_CONFIG_MAKEFILE(dlls/msls31)
WINE_CONFIG_MAKEFILE(dlls/msmpeg2vdec)
WINE_CONFIG_MAKEFILE(dlls/msnet32)
WINE_CONFIG_MAKEFILE(dlls/mspatcha)
WINE_CONFIG_MAKEFILE(dlls/mspatcha/tests)
Expand Down
5 changes: 5 additions & 0 deletions dlls/bcryptprimitives/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MODULE = bcryptprimitives.dll
IMPORTS = advapi32

C_SRCS = \
main.c
1 change: 1 addition & 0 deletions dlls/bcryptprimitives/bcryptprimitives.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@ stdcall ProcessPrng(ptr long)
27 changes: 27 additions & 0 deletions dlls/bcryptprimitives/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2023 Christopher S. Denton
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/

#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "ntsecapi.h"

BOOL WINAPI ProcessPrng(BYTE *data, SIZE_T size)
{
return RtlGenRandom(data, size);
}
1 change: 1 addition & 0 deletions dlls/dwmapi/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
MODULE = dwmapi.dll
IMPORTS = user32
IMPORTLIB = dwmapi

EXTRADLLFLAGS = -Wb,--prefer-native
Expand Down
81 changes: 76 additions & 5 deletions dlls/dwmapi/dwmapi_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,46 @@ BOOL WINAPI DwmDefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam,
*/
HRESULT WINAPI DwmGetWindowAttribute(HWND hwnd, DWORD attribute, PVOID pv_attribute, DWORD size)
{
FIXME("(%p %ld %p %ld) stub\n", hwnd, attribute, pv_attribute, size);

return E_NOTIMPL;
BOOL enabled = FALSE;
HRESULT hr;

TRACE("(%p %ld %p %ld)\n", hwnd, attribute, pv_attribute, size);

if (DwmIsCompositionEnabled(&enabled) == S_OK && !enabled)
return E_HANDLE;
if (!IsWindow(hwnd))
return E_HANDLE;

switch (attribute) {
case DWMWA_EXTENDED_FRAME_BOUNDS:
{
RECT *rect = (RECT *)pv_attribute;
DPI_AWARENESS_CONTEXT context;

if (!rect)
return E_INVALIDARG;
if (size < sizeof(*rect))
return E_NOT_SUFFICIENT_BUFFER;
if (GetWindowLongW(hwnd, GWL_STYLE) & WS_CHILD)
return E_HANDLE;

/* DWM frame bounds are always in physical coords */
context = SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);
if (GetWindowRect(hwnd, rect))
hr = S_OK;
else
hr = HRESULT_FROM_WIN32(GetLastError());

SetThreadDpiAwarenessContext(context);
break;
}
default:
FIXME("attribute %ld not implemented.\n", attribute);
hr = E_NOTIMPL;
break;
}

return hr;
}

/**********************************************************************
Expand All @@ -212,16 +249,50 @@ HRESULT WINAPI DwmRegisterThumbnail(HWND dest, HWND src, PHTHUMBNAIL thumbnail_i
return E_NOTIMPL;
}

static int get_display_frequency(void)
{
DEVMODEA mode;

memset(&mode, 0, sizeof(mode));
mode.dmSize = sizeof(mode);
if (EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &mode))
return mode.dmDisplayFrequency;
else
{
WARN("Failed to query display frequency, returning a fallback value.\n");
return 60;
}
}

/**********************************************************************
* DwmGetCompositionTimingInfo (DWMAPI.@)
*/
HRESULT WINAPI DwmGetCompositionTimingInfo(HWND hwnd, DWM_TIMING_INFO *info)
{
static int i;
LARGE_INTEGER performance_frequency;
static int i, display_frequency;

if (!info)
return E_INVALIDARG;

if (info->cbSize != sizeof(DWM_TIMING_INFO))
return MILERR_MISMATCHED_SIZE;

if(!i++) FIXME("(%p %p)\n", hwnd, info);

return E_NOTIMPL;
memset(info, 0, info->cbSize);
info->cbSize = sizeof(DWM_TIMING_INFO);

display_frequency = get_display_frequency();
info->rateRefresh.uiNumerator = display_frequency;
info->rateRefresh.uiDenominator = 1;
info->rateCompose.uiNumerator = display_frequency;
info->rateCompose.uiDenominator = 1;

QueryPerformanceFrequency(&performance_frequency);
info->qpcRefreshPeriod = performance_frequency.QuadPart / display_frequency;

return S_OK;
}

/**********************************************************************
Expand Down
2 changes: 1 addition & 1 deletion dlls/dwmapi/tests/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TESTDLL = dwmapi.dll
IMPORTS = dwmapi
IMPORTS = dwmapi user32

C_SRCS = \
dwmapi.c
109 changes: 109 additions & 0 deletions dlls/dwmapi/tests/dwmapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,116 @@ static void test_DwmIsCompositionEnabled(void)
ok(enabled == TRUE || enabled == FALSE, "Got unexpected %#x.\n", enabled);
}

static void test_DwmGetCompositionTimingInfo(void)
{
LARGE_INTEGER performance_frequency;
int result, display_frequency;
DWM_TIMING_INFO timing_info;
QPC_TIME refresh_period;
DEVMODEA mode;
BOOL enabled;
HRESULT hr;

enabled = FALSE;
hr = DwmIsCompositionEnabled(&enabled);
ok(hr == S_OK, "Got hr %#lx.\n", hr);

if (!enabled)
{
skip("DWM is disabled.\n");
return;
}

hr = DwmGetCompositionTimingInfo(NULL, NULL);
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);

memset(&timing_info, 0, sizeof(timing_info));
hr = DwmGetCompositionTimingInfo(NULL, &timing_info);
ok(hr == MILERR_MISMATCHED_SIZE, "Got hr %#lx.\n", hr);

memset(&mode, 0, sizeof(mode));
mode.dmSize = sizeof(mode);
result = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &mode);
ok(!!result, "Failed to get display mode %#lx.\n", GetLastError());
display_frequency = mode.dmDisplayFrequency;
ok(!!QueryPerformanceFrequency(&performance_frequency), "Failed to get performance counter frequency.\n");
refresh_period = performance_frequency.QuadPart / display_frequency;

timing_info.cbSize = sizeof(timing_info);
hr = DwmGetCompositionTimingInfo(NULL, &timing_info);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(timing_info.cbSize == sizeof(timing_info), "Got wrong struct size %d.\n", timing_info.cbSize);
ok(timing_info.rateRefresh.uiDenominator == 1 && timing_info.rateRefresh.uiNumerator == display_frequency,
"Got wrong monitor refresh rate %d/%d.\n", timing_info.rateRefresh.uiDenominator,
timing_info.rateRefresh.uiNumerator);
ok(timing_info.rateCompose.uiDenominator == 1 && timing_info.rateCompose.uiNumerator == display_frequency,
"Got wrong composition rate %d/%d.\n", timing_info.rateCompose.uiDenominator,
timing_info.rateCompose.uiNumerator);
ok(timing_info.qpcRefreshPeriod == refresh_period
|| broken(timing_info.qpcRefreshPeriod == display_frequency), /* win10 v1507 */
"Got wrong monitor refresh period %s.\n", wine_dbgstr_longlong(timing_info.qpcRefreshPeriod));
}

static void test_DWMWA_EXTENDED_FRAME_BOUNDS(void)
{
DPI_AWARENESS_CONTEXT (WINAPI *pSetThreadDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
DPI_AWARENESS_CONTEXT old_context = NULL;
BOOL enabled;
HRESULT hr;
RECT rect, window_rect, intersection;
HWND hwnd, child;

pSetThreadDpiAwarenessContext = (void *)GetProcAddress(GetModuleHandleA("user32.dll"),
"SetThreadDpiAwarenessContext");
if (pSetThreadDpiAwarenessContext)
old_context = pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);

hwnd = CreateWindowW(L"static", L"static", WS_OVERLAPPEDWINDOW | WS_POPUP | WS_VISIBLE, 10, 10, 200, 200, NULL, NULL, NULL, NULL);
child = CreateWindowW(L"edit", L"edit", WS_CHILD | WS_VISIBLE, 0, 0, 50, 50, hwnd, NULL, NULL, NULL);

DwmIsCompositionEnabled(&enabled);
hr = DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &rect, sizeof(rect));
if (!enabled) {
ok(hr == E_HANDLE, "Got hr %#lx.\n", hr);
skip("DWM is disabled.\n");
goto cleanup;
}

hr = DwmGetWindowAttribute(NULL, DWMWA_EXTENDED_FRAME_BOUNDS, &rect, sizeof(rect));
ok(hr == E_HANDLE, "Got hr %#lx.\n", hr);
hr = DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &enabled, sizeof(enabled));
ok(hr == E_NOT_SUFFICIENT_BUFFER, "Got hr %#lx.\n", hr);
hr = DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, NULL, 0);
ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
hr = DwmGetWindowAttribute(child, DWMWA_EXTENDED_FRAME_BOUNDS, &rect, sizeof(rect));
ok(hr == E_HANDLE, "Got hr %#lx.\n", hr);
hr = DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &rect, sizeof(rect));
ok(hr == S_OK, "Got hr %#lx.\n", hr);

/* Window rectangle covers extended frame */
GetWindowRect(hwnd, &window_rect);
IntersectRect(&intersection, &window_rect, &rect);
ok(EqualRect(&intersection, &rect), "Got wrong frame %s, window %s.\n", wine_dbgstr_rect(&rect), wine_dbgstr_rect(&window_rect));

/* Extended frame bounds aren't adjusted for DPI */
if (pSetThreadDpiAwarenessContext) {
RECT unaware_rect;
pSetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
hr = DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &unaware_rect, sizeof(unaware_rect));
ok(hr == S_OK, "Got hr %#lx.\n", hr);
ok(EqualRect(&rect, &unaware_rect), "Expected %s, got %s.\n", wine_dbgstr_rect(&rect), wine_dbgstr_rect(&unaware_rect));
}

cleanup:
if (pSetThreadDpiAwarenessContext)
pSetThreadDpiAwarenessContext(old_context);
DestroyWindow(child);
DestroyWindow(hwnd);
}

START_TEST(dwmapi)
{
test_DwmIsCompositionEnabled();
test_DwmGetCompositionTimingInfo();
test_DWMWA_EXTENDED_FRAME_BOUNDS();
}
2 changes: 2 additions & 0 deletions dlls/kernel32/kernel32.spec
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@
@ stdcall -import GetFinalPathNameByHandleW(long ptr long long)
@ stdcall GetFirmwareEnvironmentVariableA(str str ptr long)
@ stdcall GetFirmwareEnvironmentVariableW(wstr wstr ptr long)
@ stdcall GetFirmwareType(ptr)
@ stdcall -import GetFullPathNameA(str long ptr ptr)
# @ stub GetFullPathNameTransactedA
# @ stub GetFullPathNameTransactedW
Expand Down Expand Up @@ -1448,6 +1449,7 @@
@ stdcall SetProcessAffinityMask(long long)
@ stdcall -import SetProcessAffinityUpdateMode(long long)
@ stdcall SetProcessDEPPolicy(long)
@ stdcall -import SetProcessInformation(long long ptr long)
@ stdcall -import SetProcessMitigationPolicy(long ptr long)
@ stdcall -import SetProcessPreferredUILanguages(long ptr ptr)
@ stdcall -import SetProcessPriorityBoost(long long)
Expand Down
12 changes: 12 additions & 0 deletions dlls/kernel32/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,18 @@ BOOL WINAPI SetFirmwareEnvironmentVariableW(const WCHAR *name, const WCHAR *guid
return FALSE;
}

/***********************************************************************
* GetFirmwareType (KERNEL32.@)
*/
BOOL WINAPI GetFirmwareType(FIRMWARE_TYPE *type)
{
if (!type)
return FALSE;

*type = FirmwareTypeUnknown;
return TRUE;
}

/**********************************************************************
* GetNumaNodeProcessorMask (KERNEL32.@)
*/
Expand Down
3 changes: 2 additions & 1 deletion dlls/kernel32/tests/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -3727,7 +3727,7 @@ static void test_process_info(HANDLE hproc)
0 /* FIXME: sizeof(?) ProcessTlsInformation */,
sizeof(ULONG) /* ProcessCookie */,
sizeof(SECTION_IMAGE_INFORMATION) /* ProcessImageInformation */,
0 /* FIXME: sizeof(PROCESS_CYCLE_TIME_INFORMATION) ProcessCycleTime */,
sizeof(PROCESS_CYCLE_TIME_INFORMATION) /* ProcessCycleTime */,
sizeof(ULONG) /* ProcessPagePriority */,
40 /* ProcessInstrumentationCallback */,
0 /* FIXME: sizeof(PROCESS_STACK_ALLOCATION_INFORMATION) ProcessThreadStackAllocation */,
Expand Down Expand Up @@ -3797,6 +3797,7 @@ static void test_process_info(HANDLE hproc)
case ProcessHandleCount:
case ProcessImageFileName:
case ProcessImageInformation:
case ProcessCycleTime:
case ProcessPagePriority:
case ProcessImageFileNameWin32:
ok(status == STATUS_SUCCESS, "for info %lu expected STATUS_SUCCESS, got %08lx (ret_len %lu)\n", i, status, ret_len);
Expand Down
Loading

0 comments on commit 6284a1f

Please sign in to comment.