ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2017
----- 2025 -----
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
526 discussions
Start a n
N
ew thread
[akhaldi] 74911: [ADVAPI32_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 14:57:35 2017 New Revision: 74911 URL:
http://svn.reactos.org/svn/reactos?rev=74911&view=rev
Log: [ADVAPI32_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/advapi32/crypt.c trunk/rostests/winetests/advapi32/eventlog.c trunk/rostests/winetests/advapi32/lsa.c trunk/rostests/winetests/advapi32/registry.c trunk/rostests/winetests/advapi32/security.c trunk/rostests/winetests/advapi32/service.c Modified: trunk/rostests/winetests/advapi32/crypt.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/crypt.…
============================================================================== --- trunk/rostests/winetests/advapi32/crypt.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/crypt.c [iso-8859-1] Sun Jun 4 14:57:35 2017 @@ -254,6 +254,9 @@ result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey); ok (result, "%d\n", GetLastError()); if (!result) return; + + result = pCryptDestroyKey(hKey); + ok (result, "%d\n", GetLastError()); result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey2); ok (result, "%d\n", GetLastError()); Modified: trunk/rostests/winetests/advapi32/eventlog.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/eventl…
============================================================================== --- trunk/rostests/winetests/advapi32/eventlog.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/eventlog.c [iso-8859-1] Sun Jun 4 14:57:35 2017 @@ -20,12 +20,15 @@ #include <stdarg.h> +#include "initguid.h" #include "windef.h" #include "winbase.h" #include "winerror.h" #include "winnt.h" #include "winreg.h" #include "sddl.h" +#include "wmistr.h" +#include "evntrace.h" #include "wine/test.h" @@ -909,6 +912,7 @@ /* Read all events from our created eventlog, one by one */ handle = OpenEventLogA(NULL, eventlogname); + ok(handle != NULL, "Failed to open Event Log, got %d\n", GetLastError()); i = 0; for (;;) { @@ -924,14 +928,13 @@ SetLastError(0xdeadbeef); ret = ReadEventLogA(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, 0, buf, sizeof(EVENTLOGRECORD), &read, &needed); - if (!ret && GetLastError() == ERROR_HANDLE_EOF) + ok(!ret, "Expected failure\n"); + if (!ret && GetLastError() != ERROR_INSUFFICIENT_BUFFER) { HeapFree(GetProcessHeap(), 0, buf); + ok(GetLastError() == ERROR_HANDLE_EOF, "record %d, got %d\n", i, GetLastError()); break; } - ok(!ret, "Expected failure\n"); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "Expected ERROR_INVALID_PARAMETER, got %d\n",GetLastError()); buf = HeapReAlloc(GetProcessHeap(), 0, buf, needed); ret = ReadEventLogA(handle, EVENTLOG_SEQUENTIAL_READ | EVENTLOG_FORWARDS_READ, @@ -1010,6 +1013,7 @@ /* Test clearing a real eventlog */ handle = OpenEventLogA(NULL, eventlogname); + ok(handle != NULL, "Failed to open Event Log, got %d\n", GetLastError()); SetLastError(0xdeadbeef); ret = ClearEventLogA(handle, NULL); @@ -1142,6 +1146,98 @@ ok(bret, "Expected MoveFileEx to succeed: %d\n", GetLastError()); } +static void test_start_trace(void) +{ + const char sessionname[] = "wine"; + const char filepath[] = "wine.etl"; + const char filepath2[] = "eniw.etl"; + EVENT_TRACE_PROPERTIES *properties; + TRACEHANDLE handle; + LONG buffersize; + LONG ret; + + buffersize = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(sessionname) + sizeof(filepath); + properties = (EVENT_TRACE_PROPERTIES *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buffersize); + properties->Wnode.BufferSize = buffersize; + properties->Wnode.Flags = WNODE_FLAG_TRACED_GUID; + properties->LogFileMode = EVENT_TRACE_FILE_MODE_NONE; + properties->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES); + properties->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(sessionname); + strcpy((char *)properties + properties->LogFileNameOffset, filepath); + + properties->Wnode.BufferSize = 0; + ret = StartTraceA(&handle, sessionname, properties); + todo_wine + ok(ret == ERROR_BAD_LENGTH || + ret == ERROR_INVALID_PARAMETER, /* XP and 2k3 */ + "Expected ERROR_BAD_LENGTH, got %d\n", ret); + properties->Wnode.BufferSize = buffersize; + + ret = StartTraceA(&handle, "this name is too long", properties); + todo_wine + ok(ret == ERROR_BAD_LENGTH, "Expected ERROR_BAD_LENGTH, got %d\n", ret); + + ret = StartTraceA(&handle, sessionname, NULL); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); + + ret = StartTraceA(NULL, sessionname, properties); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); + + properties->LogFileNameOffset = 1; + ret = StartTraceA(&handle, sessionname, properties); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); + properties->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(sessionname); + + properties->LoggerNameOffset = 1; + ret = StartTraceA(&handle, sessionname, properties); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); + properties->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES); + + properties->LogFileMode = EVENT_TRACE_FILE_MODE_SEQUENTIAL | EVENT_TRACE_FILE_MODE_CIRCULAR; + ret = StartTraceA(&handle, sessionname, properties); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); + properties->LogFileMode = EVENT_TRACE_FILE_MODE_NONE; + /* XP creates a file we can't delete, so change the filepath to something else */ + strcpy((char *)properties + properties->LogFileNameOffset, filepath2); + + properties->Wnode.Guid = SystemTraceControlGuid; + ret = StartTraceA(&handle, sessionname, properties); + todo_wine + ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); + properties->Wnode.Guid = (GUID){0}; + + properties->LogFileNameOffset = 0; + ret = StartTraceA(&handle, sessionname, properties); + todo_wine + ok(ret == ERROR_BAD_PATHNAME, "Expected ERROR_BAD_PATHNAME, got %d\n", ret); + properties->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) + sizeof(sessionname); + + ret = StartTraceA(&handle, sessionname, properties); + if (ret == ERROR_ACCESS_DENIED) + { + skip("need admin rights\n"); + goto done; + } + ok(ret == ERROR_SUCCESS, "Expected success, got %d\n", ret); + + ret = StartTraceA(&handle, sessionname, properties); + todo_wine + ok(ret == ERROR_ALREADY_EXISTS || + ret == ERROR_SHARING_VIOLATION, /* 2k3 */ + "Expected ERROR_ALREADY_EXISTS, got %d\n", ret); + + /* clean up */ + ControlTraceA(handle, sessionname, properties, EVENT_TRACE_CONTROL_STOP); +done: + HeapFree(GetProcessHeap(), 0, properties); + DeleteFileA(filepath); +} + START_TEST(eventlog) { SetLastError(0xdeadbeef); @@ -1171,4 +1267,7 @@ test_autocreation(); cleanup_eventlog(); } -} + + /* Trace tests */ + test_start_trace(); +} Modified: trunk/rostests/winetests/advapi32/lsa.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/lsa.c?…
============================================================================== --- trunk/rostests/winetests/advapi32/lsa.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/lsa.c [iso-8859-1] Sun Jun 4 14:57:35 2017 @@ -44,8 +44,10 @@ static NTSTATUS (WINAPI *pLsaOpenPolicy)(PLSA_UNICODE_STRING,PLSA_OBJECT_ATTRIBUTES,ACCESS_MASK,PLSA_HANDLE); static NTSTATUS (WINAPI *pLsaQueryInformationPolicy)(LSA_HANDLE,POLICY_INFORMATION_CLASS,PVOID*); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID,LPSTR*); +static BOOL (WINAPI *pConvertStringSidToSidA)(LPCSTR,PSID*); static NTSTATUS (WINAPI *pLsaLookupNames2)(LSA_HANDLE,ULONG,ULONG,PLSA_UNICODE_STRING,PLSA_REFERENCED_DOMAIN_LIST*,PLSA_TRANSLATED_SID2*); static NTSTATUS (WINAPI *pLsaLookupSids)(LSA_HANDLE,ULONG,PSID*,LSA_REFERENCED_DOMAIN_LIST**,LSA_TRANSLATED_NAME**); +static PVOID (WINAPI *pFreeSid)(PSID); static BOOL init(void) { @@ -57,10 +59,12 @@ pLsaOpenPolicy = (void*)GetProcAddress(hadvapi32, "LsaOpenPolicy"); pLsaQueryInformationPolicy = (void*)GetProcAddress(hadvapi32, "LsaQueryInformationPolicy"); pConvertSidToStringSidA = (void*)GetProcAddress(hadvapi32, "ConvertSidToStringSidA"); + pConvertStringSidToSidA = (void*)GetProcAddress(hadvapi32, "ConvertStringSidToSidA"); pLsaLookupNames2 = (void*)GetProcAddress(hadvapi32, "LsaLookupNames2"); pLsaLookupSids = (void*)GetProcAddress(hadvapi32, "LsaLookupSids"); - - if (pLsaClose && pLsaEnumerateAccountRights && pLsaFreeMemory && pLsaOpenPolicy && pLsaQueryInformationPolicy && pConvertSidToStringSidA) + pFreeSid = (void*)GetProcAddress(hadvapi32, "FreeSid"); + + if (pLsaClose && pLsaEnumerateAccountRights && pLsaFreeMemory && pLsaOpenPolicy && pLsaQueryInformationPolicy && pConvertSidToStringSidA && pConvertStringSidToSidA && pFreeSid) return TRUE; return FALSE; @@ -68,12 +72,22 @@ static void test_lsa(void) { + static WCHAR machineW[] = {'W','i','n','e','N','o','M','a','c','h','i','n','e',0}; + LSA_UNICODE_STRING machine; NTSTATUS status; LSA_HANDLE handle; LSA_OBJECT_ATTRIBUTES object_attributes; ZeroMemory(&object_attributes, sizeof(object_attributes)); object_attributes.Length = sizeof(object_attributes); + + machine.Buffer = machineW; + machine.Length = sizeof(machineW) - 2; + machine.MaximumLength = sizeof(machineW); + + status = pLsaOpenPolicy( &machine, &object_attributes, POLICY_LOOKUP_NAMES, &handle); + ok(status == RPC_NT_SERVER_UNAVAILABLE, + "LsaOpenPolicy(POLICY_LOOKUP_NAMES) for invalid machine returned 0x%08x\n", status); status = pLsaOpenPolicy( NULL, &object_attributes, POLICY_ALL_ACCESS, &handle); ok(status == STATUS_SUCCESS || status == STATUS_ACCESS_DENIED, @@ -407,6 +421,48 @@ ok(status == STATUS_SUCCESS, "got 0x%08x\n", status); } +static void test_LsaLookupSids_NullBuffers(void) +{ + LSA_REFERENCED_DOMAIN_LIST *list; + LSA_OBJECT_ATTRIBUTES attrs; + LSA_TRANSLATED_NAME *names; + LSA_HANDLE policy; + NTSTATUS status; + BOOL ret; + PSID sid; + + memset(&attrs, 0, sizeof(attrs)); + attrs.Length = sizeof(attrs); + + status = pLsaOpenPolicy(NULL, &attrs, POLICY_LOOKUP_NAMES, &policy); + ok(status == STATUS_SUCCESS, "got 0x%08x\n", status); + + ret = pConvertStringSidToSidA("S-1-1-0", &sid); + ok(ret == TRUE, "pConvertStringSidToSidA returned false\n"); + + status = pLsaLookupSids(policy, 1, &sid, &list, &names); + ok(status == STATUS_SUCCESS, "got 0x%08x\n", status); + + ok(list->Entries > 0, "got %d\n", list->Entries); + + if (list->Entries) + { + ok((char*)list->Domains - (char*)list > 0, "%p, %p\n", list, list->Domains); + ok((char*)list->Domains[0].Sid - (char*)list->Domains > 0, "%p, %p\n", list->Domains, list->Domains[0].Sid); + ok(list->Domains[0].Name.MaximumLength > list->Domains[0].Name.Length, "got %d, %d\n", list->Domains[0].Name.MaximumLength, + list->Domains[0].Name.Length); + ok(list->Domains[0].Name.Buffer != NULL, "domain[0] name buffer is null\n"); + } + + pLsaFreeMemory(names); + pLsaFreeMemory(list); + + pFreeSid(sid); + + status = pLsaClose(policy); + ok(status == STATUS_SUCCESS, "got 0x%08x\n", status); +} + START_TEST(lsa) { if (!init()) { @@ -417,4 +473,5 @@ test_lsa(); test_LsaLookupNames2(); test_LsaLookupSids(); -} + test_LsaLookupSids_NullBuffers(); +} Modified: trunk/rostests/winetests/advapi32/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/regist…
============================================================================== --- trunk/rostests/winetests/advapi32/registry.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/registry.c [iso-8859-1] Sun Jun 4 14:57:35 2017 @@ -30,6 +30,7 @@ #include "winbase.h" #include "wine/winternl.h" #include "winreg.h" +#include "winperf.h" #include "winsvc.h" #include "winerror.h" #include "aclapi.h" @@ -774,11 +775,10 @@ static void test_query_value_ex(void) { - DWORD ret; - DWORD size; - DWORD type; + DWORD ret, size, type; BYTE buffer[10]; - + + size = sizeof(buffer); ret = RegQueryValueExA(hkey_main, "TP1_SZ", NULL, &type, NULL, &size); ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret); ok(size == strlen(sTestpath1) + 1, "(%d,%d)\n", (DWORD)strlen(sTestpath1) + 1, size); @@ -1842,7 +1842,7 @@ ok(classbufferW[0] == 0x5555, "classbufferW[0] = 0x%x\n", classbufferW[0]); /* empty key */ - sdlen = 0; + sdlen = classlen =0; ret = RegQueryInfoKeyA(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite); ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(classlen == strlen(subkey_class), "classlen = %u\n", classlen); @@ -1856,7 +1856,7 @@ ok(lastwrite.dwLowDateTime != 0, "lastwrite.dwLowDateTime = %u\n", lastwrite.dwLowDateTime); ok(lastwrite.dwHighDateTime != 0, "lastwrite.dwHighDateTime = %u\n", lastwrite.dwHighDateTime); - sdlen = 0; + sdlen = classlen = 0; ret = RegQueryInfoKeyW(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite); ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(classlen == strlen(subkey_class), "classlen = %u\n", classlen); @@ -1877,7 +1877,7 @@ ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret); /* with subkey & default value */ - sdlen = 0; + sdlen = classlen = 0; ret = RegQueryInfoKeyA(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite); ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(classlen == strlen(subkey_class), "classlen = %u\n", classlen); @@ -1891,7 +1891,7 @@ ok(lastwrite.dwLowDateTime != 0, "lastwrite.dwLowDateTime = %u\n", lastwrite.dwLowDateTime); ok(lastwrite.dwHighDateTime != 0, "lastwrite.dwHighDateTime = %u\n", lastwrite.dwHighDateTime); - sdlen = 0; + sdlen = classlen = 0; ret = RegQueryInfoKeyW(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite); ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(classlen == strlen(subkey_class), "classlen = %u\n", classlen); @@ -1912,12 +1912,14 @@ ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret); /* with named value */ + classlen = 0; ret = RegQueryInfoKeyA(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite); ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(values == 3, "values = %u\n", values); ok(maxvaluenamelen == strlen("value one"), "maxvaluenamelen = %u\n", maxvaluenamelen); ok(maxvaluelen == sizeof("second value data") * sizeof(WCHAR), "maxvaluelen = %u\n", maxvaluelen); + classlen = 0; ret = RegQueryInfoKeyW(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite); ok(ret == ERROR_SUCCESS, "ret = %d\n", ret); ok(values == 3, "values = %u\n", values); @@ -3301,6 +3303,38 @@ RegCloseKey( hkey ); } +static void test_perflib_key(void) +{ + DWORD size; + LONG ret; + HKEY key; + + ret = RegOpenKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009", &key); + ok(ret == ERROR_SUCCESS, "RegOpenKeyA failed with error %u\n", ret); + + ret = RegQueryValueExA(key, "Counter", NULL, NULL, NULL, &size); + if (ret != ERROR_SUCCESS) + { + skip("Perflib\\009\\Counter does not exist, skipping perflib test\n"); + goto done; + } + ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed with error %u\n", ret); + + /* Windows only compares the first few characters of the value name. + * On Windows XP / 2003, it is sufficient to use "Cou", newer versions + * require a longer substring. */ + + ret = RegQueryValueExA(key, "Counters", NULL, NULL, NULL, &size); + ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed with error %u\n", ret); + ret = RegQueryValueExA(key, "Counter2", NULL, NULL, NULL, &size); + todo_wine ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed with error %u\n", ret); + ret = RegQueryValueExA(key, "CounterWine", NULL, NULL, NULL, &size); + todo_wine ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed with error %u\n", ret); + +done: + RegCloseKey(key); +} + static void test_deleted_key(void) { HKEY hkey, hkey2; @@ -3488,6 +3522,54 @@ RegCloseKey(key); CloseHandle(event); } + +static void test_RegQueryValueExPerformanceData(void) +{ + DWORD cbData, len; + BYTE *value; + DWORD dwret; + LONG limit = 6; + PERF_DATA_BLOCK *pdb; + + /* Test with data == NULL */ + dwret = RegQueryValueExA( HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, NULL, &cbData ); + todo_wine ok( dwret == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", dwret ); + + /* Test ERROR_MORE_DATA, start with small buffer */ + len = 10; + value = HeapAlloc(GetProcessHeap(), 0, len); + cbData = len; + dwret = RegQueryValueExA( HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, value, &cbData ); + todo_wine ok( dwret == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %d\n", dwret ); + while( dwret == ERROR_MORE_DATA && limit) + { + len = len * 10; + value = HeapReAlloc( GetProcessHeap(), 0, value, len ); + cbData = len; + dwret = RegQueryValueExA( HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, value, &cbData ); + limit--; + } + ok(limit > 0, "too many times ERROR_MORE_DATA returned\n"); + + todo_wine ok(dwret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", dwret); + + /* Check returned data */ + if (dwret == ERROR_SUCCESS) + { + todo_wine ok(len >= sizeof(PERF_DATA_BLOCK), "got size %d\n", len); + if (len >= sizeof(PERF_DATA_BLOCK)) { + pdb = (PERF_DATA_BLOCK*) value; + ok(pdb->Signature[0] == 'P', "expected Signature[0] = 'P', got 0x%x\n", pdb->Signature[0]); + ok(pdb->Signature[1] == 'E', "expected Signature[1] = 'E', got 0x%x\n", pdb->Signature[1]); + ok(pdb->Signature[2] == 'R', "expected Signature[2] = 'R', got 0x%x\n", pdb->Signature[2]); + ok(pdb->Signature[3] == 'F', "expected Signature[3] = 'F', got 0x%x\n", pdb->Signature[3]); + /* TODO: check other field */ + } + } + + HeapFree(GetProcessHeap(), 0, value); +} + START_TEST(registry) { @@ -3513,6 +3595,7 @@ test_classesroot(); test_classesroot_enum(); test_classesroot_mask(); + test_perflib_key(); test_reg_save_key(); test_reg_load_key(); test_reg_unload_key(); @@ -3524,6 +3607,7 @@ test_delete_key_value(); test_RegOpenCurrentUser(); test_RegNotifyChangeKeyValue(); + test_RegQueryValueExPerformanceData(); /* cleanup */ delete_key( hkey_main ); Modified: trunk/rostests/winetests/advapi32/security.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/securi…
============================================================================== --- trunk/rostests/winetests/advapi32/security.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/security.c [iso-8859-1] Sun Jun 4 14:57:35 2017 @@ -2,7 +2,7 @@ * Unit tests for security functions * * Copyright (c) 2004 Mike McCormack - * Copyright (c) 2011 Dmitry Timoshkov + * Copyright (c) 2011,2013,2014,2016 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -73,6 +73,7 @@ static BOOL (WINAPI *pAddAccessAllowedAceEx)(PACL, DWORD, DWORD, DWORD, PSID); static BOOL (WINAPI *pAddAccessDeniedAceEx)(PACL, DWORD, DWORD, DWORD, PSID); static BOOL (WINAPI *pAddAuditAccessAceEx)(PACL, DWORD, DWORD, DWORD, PSID, BOOL, BOOL); +static BOOL (WINAPI *pAddMandatoryAce)(PACL,DWORD,DWORD,DWORD,PSID); static VOID (WINAPI *pBuildTrusteeWithSidA)( PTRUSTEEA pTrustee, PSID pSid ); static VOID (WINAPI *pBuildTrusteeWithNameA)( PTRUSTEEA pTrustee, LPSTR pName ); static VOID (WINAPI *pBuildTrusteeWithObjectsAndNameA)( PTRUSTEEA pTrustee, @@ -141,18 +142,11 @@ static void (WINAPI *pRtlInitAnsiString)(PANSI_STRING,PCSZ); static NTSTATUS (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING); static PSID_IDENTIFIER_AUTHORITY (WINAPI *pGetSidIdentifierAuthority)(PSID); +static DWORD (WINAPI *pGetExplicitEntriesFromAclW)(PACL,PULONG,PEXPLICIT_ACCESSW*); static HMODULE hmod; static int myARGC; static char** myARGV; - -struct strsid_entry -{ - const char *str; - DWORD flags; -}; -#define STRSID_OK 0 -#define STRSID_OPT 1 #define SID_SLOTS 4 static char debugsid_str[SID_SLOTS][256]; @@ -183,12 +177,6 @@ return res; } -struct sidRef -{ - SID_IDENTIFIER_AUTHORITY auth; - const char *refStr; -}; - static void init(void) { HMODULE hntdll; @@ -207,6 +195,7 @@ pAddAccessAllowedAceEx = (void *)GetProcAddress(hmod, "AddAccessAllowedAceEx"); pAddAccessDeniedAceEx = (void *)GetProcAddress(hmod, "AddAccessDeniedAceEx"); pAddAuditAccessAceEx = (void *)GetProcAddress(hmod, "AddAuditAccessAceEx"); + pAddMandatoryAce = (void *)GetProcAddress(hmod, "AddMandatoryAce"); pCheckTokenMembership = (void *)GetProcAddress(hmod, "CheckTokenMembership"); pConvertStringSecurityDescriptorToSecurityDescriptorA = (void *)GetProcAddress(hmod, "ConvertStringSecurityDescriptorToSecurityDescriptorA" ); @@ -235,6 +224,8 @@ pGetAce = (void *)GetProcAddress(hmod, "GetAce"); pGetWindowsAccountDomainSid = (void *)GetProcAddress(hmod, "GetWindowsAccountDomainSid"); pGetSidIdentifierAuthority = (void *)GetProcAddress(hmod, "GetSidIdentifierAuthority"); + pGetExplicitEntriesFromAclW = (void *)GetProcAddress(hmod, "GetExplicitEntriesFromAclW"); + pDuplicateTokenEx = (void *)GetProcAddress(hmod, "DuplicateTokenEx"); myARGC = winetest_get_mainargs( &myARGV ); } @@ -305,7 +296,11 @@ static void test_sid(void) { - struct sidRef refs[] = { + static struct + { + SID_IDENTIFIER_AUTHORITY auth; + const char *refStr; + } refs[] = { { { {0x00,0x00,0x33,0x44,0x55,0x66} }, "S-1-860116326-1" }, { { {0x00,0x00,0x01,0x02,0x03,0x04} }, "S-1-16909060-1" }, { { {0x00,0x00,0x00,0x01,0x02,0x03} }, "S-1-66051-1" }, @@ -313,24 +308,60 @@ { { {0x00,0x00,0x00,0x00,0x00,0x02} }, "S-1-2-1" }, { { {0x00,0x00,0x00,0x00,0x00,0x0c} }, "S-1-12-1" }, }; - struct strsid_entry strsid_table[] = { - {"AO", STRSID_OK}, {"RU", STRSID_OK}, {"AN", STRSID_OK}, {"AU", STRSID_OK}, - {"BA", STRSID_OK}, {"BG", STRSID_OK}, {"BO", STRSID_OK}, {"BU", STRSID_OK}, - {"CA", STRSID_OPT}, {"CG", STRSID_OK}, {"CO", STRSID_OK}, {"DA", STRSID_OPT}, - {"DC", STRSID_OPT}, {"DD", STRSID_OPT}, {"DG", STRSID_OPT}, {"DU", STRSID_OPT}, - {"EA", STRSID_OPT}, {"ED", STRSID_OK}, {"WD", STRSID_OK}, {"PA", STRSID_OPT}, - {"IU", STRSID_OK}, {"LA", STRSID_OK}, {"LG", STRSID_OK}, {"LS", STRSID_OK}, - {"SY", STRSID_OK}, {"NU", STRSID_OK}, {"NO", STRSID_OK}, {"NS", STRSID_OK}, - {"PO", STRSID_OK}, {"PS", STRSID_OK}, {"PU", STRSID_OK}, {"RS", STRSID_OPT}, - {"RD", STRSID_OK}, {"RE", STRSID_OK}, {"RC", STRSID_OK}, {"SA", STRSID_OPT}, - {"SO", STRSID_OK}, {"SU", STRSID_OK}}; - + static const struct + { + const char *str; + WELL_KNOWN_SID_TYPE sid_type; + BOOL optional; + } strsid_table[] = { + /* Please keep the list sorted. */ + { "AC", WinBuiltinAnyPackageSid, TRUE }, + { "AN", WinAnonymousSid }, + { "AO", WinBuiltinAccountOperatorsSid }, + { "AU", WinAuthenticatedUserSid }, + { "BA", WinBuiltinAdministratorsSid }, + { "BG", WinBuiltinGuestsSid }, + { "BO", WinBuiltinBackupOperatorsSid }, + { "BU", WinBuiltinUsersSid }, + { "CA", WinAccountCertAdminsSid, TRUE}, + { "CG", WinCreatorGroupSid }, + { "CO", WinCreatorOwnerSid }, + { "DA", WinAccountDomainAdminsSid, TRUE}, + { "DC", WinAccountComputersSid, TRUE}, + { "DD", WinAccountControllersSid, TRUE}, + { "DG", WinAccountDomainGuestsSid, TRUE}, + { "DU", WinAccountDomainUsersSid, TRUE}, + { "EA", WinAccountEnterpriseAdminsSid, TRUE}, + { "ED", WinEnterpriseControllersSid }, + { "IU", WinInteractiveSid }, + { "LA", WinAccountAdministratorSid }, + { "LG", WinAccountGuestSid }, + { "LS", WinLocalServiceSid }, + { "NO", WinBuiltinNetworkConfigurationOperatorsSid }, + { "NS", WinNetworkServiceSid }, + { "NU", WinNetworkSid }, + { "PA", WinAccountPolicyAdminsSid, TRUE}, + { "PO", WinBuiltinPrintOperatorsSid }, + { "PS", WinSelfSid }, + { "PU", WinBuiltinPowerUsersSid }, + { "RC", WinRestrictedCodeSid }, + { "RD", WinBuiltinRemoteDesktopUsersSid }, + { "RE", WinBuiltinReplicatorSid }, + { "RS", WinAccountRasAndIasServersSid, TRUE }, + { "RU", WinBuiltinPreWindows2000CompatibleAccessSid }, + { "SA", WinAccountSchemaAdminsSid, TRUE }, + { "SO", WinBuiltinSystemOperatorsSid }, + { "SU", WinServiceSid }, + { "SY", WinLocalSystemSid }, + { "WD", WinWorldSid }, + }; + SID_IDENTIFIER_AUTHORITY domain_ident = { SECURITY_NT_AUTHORITY }; const char noSubAuthStr[] = "S-1-5"; unsigned int i; - PSID psid = NULL; + PSID psid, domain_sid; SID *pisid; BOOL r; - LPSTR str = NULL; + LPSTR str; if( !pConvertSidToStringSidA || !pConvertStringSidToSidA ) { @@ -410,7 +441,7 @@ } /* string constant format not supported before XP */ - r = pConvertStringSidToSidA(strsid_table[0].str, &psid); + r = pConvertStringSidToSidA("AN", &psid); if(!r) { win_skip("String constant format not supported\n"); @@ -418,25 +449,51 @@ } LocalFree(psid); + AllocateAndInitializeSid(&domain_ident, 4, SECURITY_NT_NON_UNIQUE, 0, 0, 0, 0, 0, 0, 0, &domain_sid); + for(i = 0; i < sizeof(strsid_table) / sizeof(strsid_table[0]); i++) { - char *temp; - SetLastError(0xdeadbeef); r = pConvertStringSidToSidA(strsid_table[i].str, &psid); - if (!(strsid_table[i].flags & STRSID_OPT)) + if (!(strsid_table[i].optional)) { ok(r, "%s: got %u\n", strsid_table[i].str, GetLastError()); } if (r) { - if ((winetest_debug > 1) && (pConvertSidToStringSidA(psid, &temp))) + char buf[SECURITY_MAX_SID_SIZE]; + char *sid_string, *well_known_sid_string; + DWORD n, size; + + /* zero out domain id before comparison to simplify things */ + if (strsid_table[i].sid_type == WinAccountAdministratorSid || + strsid_table[i].sid_type == WinAccountGuestSid) { - trace(" %s: %s\n", strsid_table[i].str, temp); - LocalFree(temp); + for (n = 1; n <= 3; n++) + *GetSidSubAuthority(psid, n) = 0; } + + r = pConvertSidToStringSidA(psid, &sid_string); + ok(r, "%s: ConvertSidToStringSid error %u\n", strsid_table[i].str, GetLastError()); + if (winetest_debug > 1) + trace("%s => %s\n", strsid_table[i].str, sid_string); + + size = sizeof(buf); + r = pCreateWellKnownSid(strsid_table[i].sid_type, domain_sid, buf, &size); + ok(r, "%u: CreateWellKnownSid(%u) error %u\n", i, strsid_table[i].sid_type, GetLastError()); + + r = pConvertSidToStringSidA(buf, &well_known_sid_string); + ok(r, "%u: ConvertSidToStringSi(%u) error %u\n", i, strsid_table[i].sid_type, GetLastError()); + if (winetest_debug > 1) + trace("%u => %s\n", strsid_table[i].sid_type, well_known_sid_string); + + ok(strcmp(sid_string, well_known_sid_string) == 0, + "%u: (%u) expected %s, got %s\n", i, strsid_table[i].sid_type, well_known_sid_string, sid_string); + + LocalFree(well_known_sid_string); + LocalFree(sid_string); LocalFree(psid); } else @@ -447,6 +504,8 @@ trace(" %s: couldn't be converted\n", strsid_table[i].str); } } + + LocalFree(domain_sid); } static void test_trustee(void) @@ -1384,6 +1443,12 @@ ok(AccessStatus && (Access == KEY_READ), "AccessCheck failed to grant access with error %d\n", GetLastError()); + ret = AccessCheck(SecurityDescriptor, Token, MAXIMUM_ALLOWED, &Mapping, + PrivSet, &PrivSetLen, &Access, &AccessStatus); + ok(ret, "AccessCheck failed with error %d\n", GetLastError()); + ok(AccessStatus && (Access == KEY_ALL_ACCESS), + "AccessCheck failed to grant access with error %d\n", + GetLastError()); /* sd with blank dacl */ ret = SetSecurityDescriptorDacl(SecurityDescriptor, TRUE, Acl, FALSE); @@ -1909,6 +1974,30 @@ HeapFree(GetProcessHeap(), 0, Dacl); CloseHandle(Token); +} + +static void test_GetTokenInformation(void) +{ + DWORD is_app_container, size; + HANDLE token; + BOOL ret; + + ret = OpenProcessToken(GetCurrentProcess(), MAXIMUM_ALLOWED, &token); + ok(ret, "OpenProcessToken failed: %u\n", GetLastError()); + + size = 0; + is_app_container = 0xdeadbeef; + ret = GetTokenInformation(token, TokenIsAppContainer, &is_app_container, + sizeof(is_app_container), &size); + ok(ret || broken(GetLastError() == ERROR_INVALID_PARAMETER || + GetLastError() == ERROR_INVALID_FUNCTION), /* pre-win8 */ + "GetTokenInformation failed: %u\n", GetLastError()); + if(ret) { + ok(size == sizeof(is_app_container), "size = %u\n", size); + ok(!is_app_container, "is_app_container = %x\n", is_app_container); + } + + CloseHandle(token); } typedef union _MAX_SID @@ -2263,7 +2352,7 @@ if (pCreateWellKnownSid && pConvertSidToStringSidA) { trace("Well Known SIDs:\n"); - for (i = 0; i <= 60; i++) + for (i = 0; i <= 84; i++) { size = SECURITY_MAX_SID_SIZE; if (pCreateWellKnownSid(i, NULL, &max_sid.sid, &size)) @@ -3037,7 +3126,6 @@ HKEY hkey; DWORD error; - pDuplicateTokenEx = (void *)GetProcAddress(hmod, "DuplicateTokenEx"); if( !pDuplicateTokenEx ) { win_skip("DuplicateTokenEx is not available\n"); return; @@ -3730,6 +3818,7 @@ ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %d\n", error); bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); ok(bret, "GetAclInformation failed\n"); + todo_wine ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%d != 0).\n", acl_size.AceCount); LocalFree(pSD); @@ -3816,7 +3905,6 @@ ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %d\n", error); bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size), AclSizeInformation); ok(bret, "GetAclInformation failed\n"); - todo_wine ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count (%d != 0).\n", acl_size.AceCount); LocalFree(pSD); @@ -4200,10 +4288,14 @@ ok(bret, "Failed to get Builtin Users ACE.\n"); flags = ((ACE_HEADER *)ace)->AceFlags; ok(flags == (INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE) - || broken(flags == (INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE|INHERITED_ACE)) /* w2k8 */, + || broken(flags == (INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE|INHERITED_ACE)) /* w2k8 */ + || broken(flags == (CONTAINER_INHERIT_ACE|INHERITED_ACE)) /* win 10 wow64 */ + || broken(flags == CONTAINER_INHERIT_ACE), /* win 10 */ "Builtin Users ACE has unexpected flags (0x%x != 0x%x)\n", flags, INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE); - ok(ace->Mask == GENERIC_READ, "Builtin Users ACE has unexpected mask (0x%x != 0x%x)\n", + ok(ace->Mask == GENERIC_READ + || broken(ace->Mask == KEY_READ), /* win 10 */ + "Builtin Users ACE has unexpected mask (0x%x != 0x%x)\n", ace->Mask, GENERIC_READ); } ok(admins_ace_id != -1, "Bultin Admins ACE not found.\n"); @@ -4215,7 +4307,9 @@ ok(flags == 0x0 || broken(flags == (INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE|INHERITED_ACE)) /* w2k8 */ || broken(flags == (OBJECT_INHERIT_ACE|CONTAINER_INHERIT_ACE)) /* win7 */ - || broken(flags == (INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE)), /* win8+ */ + || broken(flags == (INHERIT_ONLY_ACE|CONTAINER_INHERIT_ACE)) /* win8+ */ + || broken(flags == (CONTAINER_INHERIT_ACE|INHERITED_ACE)) /* win 10 wow64 */ + || broken(flags == CONTAINER_INHERIT_ACE), /* win 10 */ "Builtin Admins ACE has unexpected flags (0x%x != 0x0)\n", flags); ok(ace->Mask == KEY_ALL_ACCESS || broken(ace->Mask == GENERIC_ALL) /* w2k8 */, "Builtin Admins ACE has unexpected mask (0x%x != 0x%x)\n", ace->Mask, KEY_ALL_ACCESS); @@ -6395,6 +6489,276 @@ ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %d\n", GetLastError()); } +static void test_AddMandatoryAce(void) +{ + static SID low_level = {SID_REVISION, 1, {SECURITY_MANDATORY_LABEL_AUTHORITY}, + {SECURITY_MANDATORY_LOW_RID}}; + static SID medium_level = {SID_REVISION, 1, {SECURITY_MANDATORY_LABEL_AUTHORITY}, + {SECURITY_MANDATORY_MEDIUM_RID}}; + static SID high_level = {SID_REVISION, 1, {SECURITY_MANDATORY_LABEL_AUTHORITY}, + {SECURITY_MANDATORY_HIGH_RID}}; + SYSTEM_MANDATORY_LABEL_ACE *ace; + char buffer_sd[SECURITY_DESCRIPTOR_MIN_LENGTH]; + SECURITY_DESCRIPTOR *sd2, *sd = (SECURITY_DESCRIPTOR *)&buffer_sd; + SECURITY_ATTRIBUTES sa; + char buffer_acl[256]; + ACL *pAcl = (ACL *)&buffer_acl; + ACL *sAcl; + BOOL defaulted, present, ret, found, found2; + HANDLE handle; + DWORD index, size; + + if (!pAddMandatoryAce) + { + win_skip("AddMandatoryAce not supported, skipping test\n"); + return; + } + + ret = InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION); + ok(ret, "InitializeSecurityDescriptor failed with %u\n", GetLastError()); + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.lpSecurityDescriptor = sd; + sa.bInheritHandle = FALSE; + + handle = CreateEventA(&sa, TRUE, TRUE, "test_event"); + ok(handle != NULL, "CreateEventA failed with error %u\n", GetLastError()); + + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + sAcl = (void *)0xdeadbeef; + present = TRUE; + defaulted = TRUE; + ret = GetSecurityDescriptorSacl(sd2, &present, &sAcl, &defaulted); + ok(ret, "GetSecurityDescriptorSacl failed with %u\n", GetLastError()); + ok(!present, "sAcl is present\n"); + ok(sAcl == (void *)0xdeadbeef, "sAcl is set\n"); + todo_wine ok(!defaulted, "sAcl defaulted\n"); + + HeapFree(GetProcessHeap(), 0, sd2); + CloseHandle(handle); + + ret = InitializeAcl(pAcl, 256, ACL_REVISION); + ok(ret, "InitializeAcl failed with %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = pAddMandatoryAce(pAcl, ACL_REVISION, 0, 0x1234, &low_level); + ok(!ret, "AddMandatoryAce succeeded\n"); + ok(GetLastError() == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER got %u\n", GetLastError()); + + ret = pAddMandatoryAce(pAcl, ACL_REVISION, 0, SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, &low_level); + ok(ret, "AddMandatoryAce failed with %u\n", GetLastError()); + + index = 0; + found = FALSE; + while (pGetAce( pAcl, index++, (void **)&ace )) + { + if (ace->Header.AceType != SYSTEM_MANDATORY_LABEL_ACE_TYPE) continue; + ok(ace->Header.AceFlags == 0, "Expected flags 0, got %x\n", ace->Header.AceFlags); + ok(ace->Mask == SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, + "Expected mask SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, got %x\n", ace->Mask); + ok(EqualSid(&ace->SidStart, &low_level), "Expected low integrity level\n"); + found = TRUE; + } + ok(found, "Could not find mandatory label ace\n"); + + ret = SetSecurityDescriptorSacl(sd, TRUE, pAcl, FALSE); + ok(ret, "SetSecurityDescriptorSacl failed with %u\n", GetLastError()); + + handle = CreateEventA(&sa, TRUE, TRUE, "test_event"); + ok(handle != NULL, "CreateEventA failed with error %u\n", GetLastError()); + + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + sAcl = (void *)0xdeadbeef; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorSacl(sd2, &present, &sAcl, &defaulted); + ok(ret, "GetSecurityDescriptorSacl failed with %u\n", GetLastError()); + ok(present, "sAcl not present\n"); + ok(sAcl != (void *)0xdeadbeef, "sAcl not set\n"); + ok(!defaulted, "sAcl defaulted\n"); + + index = 0; + found = FALSE; + while (pGetAce( sAcl, index++, (void **)&ace )) + { + if (ace->Header.AceType == SYSTEM_MANDATORY_LABEL_ACE_TYPE) + { + found = TRUE; + ok(ace->Header.AceFlags == 0, "Expected 0 as flags, got %x\n", ace->Header.AceFlags); + ok(ace->Mask == SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, + "Expected SYSTEM_MANDATORY_LABEL_NO_WRITE_UP as flag, got %x\n", ace->Mask); + ok(EqualSid(&ace->SidStart, &low_level), "Expected low integrity level\n"); + } + } + ok(found, "Could not find mandatory label\n"); + + HeapFree(GetProcessHeap(), 0, sd2); + + ret = pAddMandatoryAce(pAcl, ACL_REVISION, 0, SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP, &medium_level); + ok(ret, "AddMandatoryAce failed with %u\n", GetLastError()); + + ret = SetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + sAcl = (void *)0xdeadbeef; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorSacl(sd2, &present, &sAcl, &defaulted); + ok(ret, "GetSecurityDescriptorSacl failed with %u\n", GetLastError()); + ok(present, "sAcl not present\n"); + ok(sAcl != (void *)0xdeadbeef, "sAcl not set\n"); + ok(sAcl->AceCount == 2, "Expected 2 ACEs, got %d\n", sAcl->AceCount); + ok(!defaulted, "sAcl defaulted\n"); + + index = 0; + found = found2 = FALSE; + while (pGetAce( sAcl, index++, (void **)&ace )) + { + if (ace->Header.AceType == SYSTEM_MANDATORY_LABEL_ACE_TYPE) + { + if (EqualSid(&ace->SidStart, &low_level)) + { + found = TRUE; + ok(ace->Header.AceFlags == 0, "Expected 0 as flags, got %x\n", ace->Header.AceFlags); + ok(ace->Mask == SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, + "Expected SYSTEM_MANDATORY_LABEL_NO_WRITE_UP as flag, got %x\n", ace->Mask); + } + if (EqualSid(&ace->SidStart, &medium_level)) + { + found2 = TRUE; + ok(ace->Header.AceFlags == 0, "Expected 0 as flags, got %x\n", ace->Header.AceFlags); + ok(ace->Mask == SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP, + "Expected SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP as flag, got %x\n", ace->Mask); + } + } + } + ok(found, "Could not find low mandatory label\n"); + ok(found2, "Could not find medium mandatory label\n"); + + HeapFree( GetProcessHeap(), 0, sd2); + + ret = SetSecurityDescriptorSacl(sd, FALSE, NULL, FALSE); + ok(ret, "SetSecurityDescriptorSacl failed with %u\n", GetLastError()); + + ret = SetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + sAcl = (void *)0xdeadbeef; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorSacl(sd2, &present, &sAcl, &defaulted); + ok(ret, "GetSecurityDescriptorSacl failed with %u\n", GetLastError()); + ok(present, "sAcl not present\n"); + ok(sAcl != (void *)0xdeadbeef, "sAcl not set\n"); + ok(sAcl->AceCount == 0, "Expected 0 ACEs, got %d\n", sAcl->AceCount); + ok(!defaulted, "sAcl defaulted\n"); + + HeapFree(GetProcessHeap(), 0, sd2); + + ret = InitializeAcl(pAcl, 256, ACL_REVISION); + ok(ret, "InitializeAcl failed with %u\n", GetLastError()); + + ret = pAddMandatoryAce(pAcl, ACL_REVISION3, 0, SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP, &medium_level); + ok(ret, "AddMandatoryAce failed with %u\n", GetLastError()); + + ret = SetSecurityDescriptorSacl(sd, TRUE, pAcl, FALSE); + ok(ret, "SetSecurityDescriptorSacl failed with %u\n", GetLastError()); + + ret = SetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + sAcl = (void *)0xdeadbeef; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorSacl(sd2, &present, &sAcl, &defaulted); + ok(ret, "GetSecurityDescriptorSacl failed with %u\n", GetLastError()); + ok(present, "sAcl not present\n"); + ok(sAcl != (void *)0xdeadbeef, "sAcl not set\n"); + ok(sAcl->AclRevision == ACL_REVISION3, "Expected revision 3, got %d\n", sAcl->AclRevision); + ok(!defaulted, "sAcl defaulted\n"); + + HeapFree(GetProcessHeap(), 0, sd2); + CloseHandle(handle); + + ret = OpenProcessToken(GetCurrentProcess(), READ_CONTROL, &handle); + ok(ret, "got %d with %d (expected TRUE)\n", ret, GetLastError()); + + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(handle, LABEL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + sAcl = (void *)0xdeadbeef; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorSacl(sd2, &present, &sAcl, &defaulted); + ok(ret, "GetSecurityDescriptorSacl failed with %u\n", GetLastError()); + ok(present, "sAcl not present\n"); + ok(sAcl != (void *)0xdeadbeef, "sAcl not set\n"); + ok(sAcl->AceCount == 1, "Expected 1 ACEs, got %d\n", sAcl->AceCount); + ok(!defaulted, "sAcl defaulted\n"); + + index = 0; + found = FALSE; + while (pGetAce( sAcl, index++, (void **)&ace )) + { + if (ace->Header.AceType == SYSTEM_MANDATORY_LABEL_ACE_TYPE && + (EqualSid(&ace->SidStart, &medium_level) || EqualSid(&ace->SidStart, &high_level))) + { + found = TRUE; + ok(ace->Header.AceFlags == 0, "Expected 0 as flags, got %x\n", ace->Header.AceFlags); + ok(ace->Mask == SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, + "Expected SYSTEM_MANDATORY_LABEL_NO_WRITE_UP as flag, got %x\n", ace->Mask); + } + } + ok(found, "Could not find medium/high mandatory label\n"); + + HeapFree(GetProcessHeap(), 0, sd2); + CloseHandle(handle); +} + static void test_system_security_access(void) { static const WCHAR testkeyW[] = @@ -6653,6 +7017,524 @@ "Expected ERROR_NO_TOKEN, got %u\n", GetLastError()); } +static void test_maximum_allowed(void) +{ + HANDLE (WINAPI *pCreateEventExA)(SECURITY_ATTRIBUTES *, LPCSTR, DWORD, DWORD); + char buffer_sd[SECURITY_DESCRIPTOR_MIN_LENGTH], buffer_acl[256]; + SECURITY_DESCRIPTOR *sd = (SECURITY_DESCRIPTOR *)&buffer_sd; + SECURITY_ATTRIBUTES sa; + ACL *acl = (ACL *)&buffer_acl; + HMODULE hkernel32 = GetModuleHandleA("kernel32.dll"); + ACCESS_MASK mask; + HANDLE handle; + BOOL ret; + + pCreateEventExA = (void *)GetProcAddress(hkernel32, "CreateEventExA"); + if (!pCreateEventExA) + { + win_skip("CreateEventExA is not available\n"); + return; + } + + ret = InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION); + ok(ret, "InitializeSecurityDescriptor failed with %u\n", GetLastError()); + ret = InitializeAcl(acl, 256, ACL_REVISION); + ok(ret, "InitializeAcl failed with %u\n", GetLastError()); + ret = SetSecurityDescriptorDacl(sd, TRUE, acl, FALSE); + ok(ret, "SetSecurityDescriptorDacl failed with %u\n", GetLastError()); + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.lpSecurityDescriptor = sd; + sa.bInheritHandle = FALSE; + + handle = pCreateEventExA(&sa, NULL, 0, MAXIMUM_ALLOWED | 0x4); + ok(handle != NULL, "CreateEventExA failed with error %u\n", GetLastError()); + mask = get_obj_access(handle); + ok(mask == EVENT_ALL_ACCESS, "Expected %x, got %x\n", EVENT_ALL_ACCESS, mask); + CloseHandle(handle); +} + +static void test_GetExplicitEntriesFromAclW(void) +{ + static const WCHAR wszCurrentUser[] = { 'C','U','R','R','E','N','T','_','U','S','E','R','\0'}; + SID_IDENTIFIER_AUTHORITY SIDAuthWorld = { SECURITY_WORLD_SID_AUTHORITY }; + SID_IDENTIFIER_AUTHORITY SIDAuthNT = { SECURITY_NT_AUTHORITY }; + PSID everyone_sid = NULL, users_sid = NULL; + EXPLICIT_ACCESSW access; + EXPLICIT_ACCESSW *access2; + PACL new_acl, old_acl = NULL; + ULONG count; + DWORD res; + + if (!pGetExplicitEntriesFromAclW) + { + win_skip("GetExplicitEntriesFromAclW is not available\n"); + return; + } + + if (!pSetEntriesInAclW) + { + win_skip("SetEntriesInAclW is not available\n"); + return; + } + + old_acl = HeapAlloc(GetProcessHeap(), 0, 256); + res = InitializeAcl(old_acl, 256, ACL_REVISION); + if(!res && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + win_skip("ACLs not implemented - skipping tests\n"); + HeapFree(GetProcessHeap(), 0, old_acl); + return; + } + ok(res, "InitializeAcl failed with error %d\n", GetLastError()); + + res = AllocateAndInitializeSid(&SIDAuthWorld, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &everyone_sid); + ok(res, "AllocateAndInitializeSid failed with error %d\n", GetLastError()); + + res = AllocateAndInitializeSid(&SIDAuthNT, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_USERS, 0, 0, 0, 0, 0, 0, &users_sid); + ok(res, "AllocateAndInitializeSid failed with error %d\n", GetLastError()); + + res = AddAccessAllowedAce(old_acl, ACL_REVISION, KEY_READ, users_sid); + ok(res, "AddAccessAllowedAce failed with error %d\n", GetLastError()); + + access2 = NULL; + res = pGetExplicitEntriesFromAclW(old_acl, &count, &access2); + ok(res == ERROR_SUCCESS, "GetExplicitEntriesFromAclW failed with error %d\n", GetLastError()); + ok(count == 1, "Expected count == 1, got %d\n", count); + ok(access2[0].grfAccessMode == GRANT_ACCESS, "Expected GRANT_ACCESS, got %d\n", access2[0].grfAccessMode); + ok(access2[0].grfAccessPermissions == KEY_READ, "Expected KEY_READ, got %d\n", access2[0].grfAccessPermissions); + ok(access2[0].Trustee.TrusteeForm == TRUSTEE_IS_SID, "Expected SID trustee, got %d\n", access2[0].Trustee.TrusteeForm); + ok(access2[0].grfInheritance == NO_INHERITANCE, "Expected NO_INHERITANCE, got %x\n", access2[0].grfInheritance); + ok(EqualSid(access2[0].Trustee.ptstrName, users_sid), "Expected equal SIDs\n"); + LocalFree(access2); + + access.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + access.Trustee.pMultipleTrustee = NULL; + + access.grfAccessPermissions = KEY_WRITE; + access.grfAccessMode = GRANT_ACCESS; + access.grfInheritance = NO_INHERITANCE; + access.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP; + access.Trustee.TrusteeForm = TRUSTEE_IS_SID; + access.Trustee.ptstrName = everyone_sid; + res = pSetEntriesInAclW(1, &access, old_acl, &new_acl); + ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); + ok(new_acl != NULL, "returned acl was NULL\n"); + + access2 = NULL; + res = pGetExplicitEntriesFromAclW(new_acl, &count, &access2); + ok(res == ERROR_SUCCESS, "GetExplicitEntriesFromAclW failed with error %d\n", GetLastError()); + ok(count == 2, "Expected count == 2, got %d\n", count); + ok(access2[0].grfAccessMode == GRANT_ACCESS, "Expected GRANT_ACCESS, got %d\n", access2[0].grfAccessMode); + ok(access2[0].grfAccessPermissions == KEY_WRITE, "Expected KEY_WRITE, got %d\n", access2[0].grfAccessPermissions); + ok(access2[0].Trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, + "Expected TRUSTEE_IS_UNKNOWN trustee type, got %d\n", access2[0].Trustee.TrusteeType); + ok(access2[0].Trustee.TrusteeForm == TRUSTEE_IS_SID, "Expected SID trustee, got %d\n", access2[0].Trustee.TrusteeForm); + ok(access2[0].grfInheritance == NO_INHERITANCE, "Expected NO_INHERITANCE, got %x\n", access2[0].grfInheritance); + ok(EqualSid(access2[0].Trustee.ptstrName, everyone_sid), "Expected equal SIDs\n"); + LocalFree(access2); + LocalFree(new_acl); + + access.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; + res = pSetEntriesInAclW(1, &access, old_acl, &new_acl); + ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); + ok(new_acl != NULL, "returned acl was NULL\n"); + + access2 = NULL; + res = pGetExplicitEntriesFromAclW(new_acl, &count, &access2); + ok(res == ERROR_SUCCESS, "GetExplicitEntriesFromAclW failed with error %d\n", GetLastError()); + ok(count == 2, "Expected count == 2, got %d\n", count); + ok(access2[0].grfAccessMode == GRANT_ACCESS, "Expected GRANT_ACCESS, got %d\n", access2[0].grfAccessMode); + ok(access2[0].grfAccessPermissions == KEY_WRITE, "Expected KEY_WRITE, got %d\n", access2[0].grfAccessPermissions); + ok(access2[0].Trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, + "Expected TRUSTEE_IS_UNKNOWN trustee type, got %d\n", access2[0].Trustee.TrusteeType); + ok(access2[0].Trustee.TrusteeForm == TRUSTEE_IS_SID, "Expected SID trustee, got %d\n", access2[0].Trustee.TrusteeForm); + ok(access2[0].grfInheritance == NO_INHERITANCE, "Expected NO_INHERITANCE, got %x\n", access2[0].grfInheritance); + ok(EqualSid(access2[0].Trustee.ptstrName, everyone_sid), "Expected equal SIDs\n"); + LocalFree(access2); + LocalFree(new_acl); + + access.Trustee.TrusteeForm = TRUSTEE_IS_NAME; + access.Trustee.ptstrName = (LPWSTR)wszCurrentUser; + res = pSetEntriesInAclW(1, &access, old_acl, &new_acl); + ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); + ok(new_acl != NULL, "returned acl was NULL\n"); + + access2 = NULL; + res = pGetExplicitEntriesFromAclW(new_acl, &count, &access2); + ok(res == ERROR_SUCCESS, "GetExplicitEntriesFromAclW failed with error %d\n", GetLastError()); + ok(count == 2, "Expected count == 2, got %d\n", count); + ok(access2[0].grfAccessMode == GRANT_ACCESS, "Expected GRANT_ACCESS, got %d\n", access2[0].grfAccessMode); + ok(access2[0].grfAccessPermissions == KEY_WRITE, "Expected KEY_WRITE, got %d\n", access2[0].grfAccessPermissions); + ok(access2[0].Trustee.TrusteeType == TRUSTEE_IS_UNKNOWN, + "Expected TRUSTEE_IS_UNKNOWN trustee type, got %d\n", access2[0].Trustee.TrusteeType); + ok(access2[0].Trustee.TrusteeForm == TRUSTEE_IS_SID, "Expected SID trustee, got %d\n", access2[0].Trustee.TrusteeForm); + ok(access2[0].grfInheritance == NO_INHERITANCE, "Expected NO_INHERITANCE, got %x\n", access2[0].grfInheritance); + LocalFree(access2); + LocalFree(new_acl); + + access.grfAccessMode = REVOKE_ACCESS; + access.Trustee.TrusteeForm = TRUSTEE_IS_SID; + access.Trustee.ptstrName = users_sid; + res = pSetEntriesInAclW(1, &access, old_acl, &new_acl); + ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); + ok(new_acl != NULL, "returned acl was NULL\n"); + + access2 = (void *)0xdeadbeef; + res = pGetExplicitEntriesFromAclW(new_acl, &count, &access2); + ok(res == ERROR_SUCCESS, "GetExplicitEntriesFromAclW failed with error %d\n", GetLastError()); + ok(count == 0, "Expected count == 0, got %d\n", count); + ok(access2 == NULL, "access2 was not NULL\n"); + LocalFree(new_acl); + + FreeSid(users_sid); + FreeSid(everyone_sid); + HeapFree(GetProcessHeap(), 0, old_acl); +} + +static void test_token_security_descriptor(void) +{ + static SID low_level = {SID_REVISION, 1, {SECURITY_MANDATORY_LABEL_AUTHORITY}, + {SECURITY_MANDATORY_LOW_RID}}; + ACCESS_ALLOWED_ACE *ace; + char buffer_sd[SECURITY_DESCRIPTOR_MIN_LENGTH]; + SECURITY_DESCRIPTOR *sd = (SECURITY_DESCRIPTOR *)&buffer_sd, *sd2; + char buffer_acl[256], buffer[MAX_PATH]; + ACL *pAcl = (ACL *)&buffer_acl, *pAcl2, *pAclChild; + BOOL defaulted, present, ret, found; + HANDLE token, token2, token3; + EXPLICIT_ACCESSW exp_access; + PROCESS_INFORMATION info; + SECURITY_ATTRIBUTES sa; + DWORD size, index, retd; + STARTUPINFOA startup; + PSID psid; + + if (!pDuplicateTokenEx || !pConvertStringSidToSidA || !pAddAccessAllowedAceEx || !pGetAce || !pSetEntriesInAclW) + { + win_skip("Some functions not available\n"); + return; + } + + /* Test whether we can create tokens with security descriptors */ + ret = OpenProcessToken(GetCurrentProcess(), MAXIMUM_ALLOWED, &token); + ok(ret, "OpenProcessToken failed with error %u\n", GetLastError()); + + ret = InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION); + ok(ret, "InitializeSecurityDescriptor failed with %u\n", GetLastError()); + + ret = InitializeAcl(pAcl, 256, ACL_REVISION); + ok(ret, "InitializeAcl failed with %u\n", GetLastError()); + + ret = pConvertStringSidToSidA("S-1-5-6", &psid); + ok(ret, "ConvertStringSidToSidA failed with %u\n", GetLastError()); + + ret = pAddAccessAllowedAceEx(pAcl, ACL_REVISION, NO_PROPAGATE_INHERIT_ACE, GENERIC_ALL, psid); + ok(ret, "AddAccessAllowedAceEx failed with %u\n", GetLastError()); + + ret = SetSecurityDescriptorDacl(sd, TRUE, pAcl, FALSE); + ok(ret, "SetSecurityDescriptorDacl failed with %u\n", GetLastError()); + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.lpSecurityDescriptor = sd; + sa.bInheritHandle = FALSE; + + ret = pDuplicateTokenEx(token, MAXIMUM_ALLOWED, &sa, SecurityImpersonation, TokenImpersonation, &token2); + ok(ret, "DuplicateTokenEx failed with %u\n", GetLastError()); + + ret = GetKernelObjectSecurity(token2, DACL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(token2, DACL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + pAcl2 = (void *)0xdeadbeef; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorDacl(sd2, &present, &pAcl2, &defaulted); + ok(ret, "GetSecurityDescriptorDacl failed with %u\n", GetLastError()); + ok(present, "pAcl2 not present\n"); + ok(pAcl2 != (void *)0xdeadbeef, "pAcl2 not set\n"); + ok(pAcl2->AceCount == 1, "Expected 1 ACEs, got %d\n", pAcl2->AceCount); + ok(!defaulted, "pAcl2 defaulted\n"); + + index = 0; + found = FALSE; + while (pGetAce( pAcl2, index++, (void **)&ace )) + { + if (ace->Header.AceType == ACCESS_ALLOWED_ACE_TYPE && EqualSid(&ace->SidStart, psid)) + { + found = TRUE; + ok(ace->Header.AceFlags == NO_PROPAGATE_INHERIT_ACE, + "Expected NO_PROPAGATE_INHERIT_ACE as flags, got %x\n", ace->Header.AceFlags); + } + } + ok(found, "Could not find access allowed ace\n"); + + HeapFree( GetProcessHeap(), 0, sd2); + + /* Duplicate token without security attributes. + * Tokens do not inherit the security descriptor when calling DuplicateToken, + * see
https://blogs.msdn.microsoft.com/oldnewthing/20160512-00/?p=93447
+ */ + ret = pDuplicateTokenEx(token2, MAXIMUM_ALLOWED, NULL, SecurityImpersonation, TokenImpersonation, &token3); + ok(ret, "DuplicateTokenEx failed with %u\n", GetLastError()); + + ret = GetKernelObjectSecurity(token3, DACL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(token3, DACL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + pAcl2 = (void *)0xdeadbeef; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorDacl(sd2, &present, &pAcl2, &defaulted); + ok(ret, "GetSecurityDescriptorDacl failed with %u\n", GetLastError()); + todo_wine + ok(present, "pAcl2 not present\n"); + ok(pAcl2 != (void *)0xdeadbeef, "pAcl2 not set\n"); + ok(!defaulted, "pAcl2 defaulted\n"); + + if (pAcl2) + { + index = 0; + found = FALSE; + while (pGetAce( pAcl2, index++, (void **)&ace )) + { + if (ace->Header.AceType == ACCESS_ALLOWED_ACE_TYPE && EqualSid(&ace->SidStart, psid)) + found = TRUE; + } + ok(!found, "Access allowed ace got inherited!\n"); + } + + HeapFree(GetProcessHeap(), 0, sd2); + + /* When creating a child process, the process does only inherit the + * Token of the parent, but not the DACL of the token. + */ + ret = GetKernelObjectSecurity(token, DACL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd2 = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(token, DACL_SECURITY_INFORMATION, sd2, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + pAcl2 = (void *)0xdeadbeef; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorDacl(sd2, &present, &pAcl2, &defaulted); + ok(ret, "GetSecurityDescriptorDacl failed with %u\n", GetLastError()); + ok(present, "pAcl2 not present\n"); + ok(pAcl2 != (void *)0xdeadbeef, "pAcl2 not set\n"); + ok(!defaulted, "pAcl2 defaulted\n"); + + /* check that the ace we add for testing does not already exist! */ + if (pAcl2) + { + index = 0; + found = FALSE; + while (pGetAce( pAcl2, index++, (void **)&ace )) + { + if (ace->Header.AceType == ACCESS_ALLOWED_ACE_TYPE && EqualSid(&ace->SidStart, psid)) + found = TRUE; + } + ok(!found, "Test ace does already exist!\n"); + } + + exp_access.grfAccessPermissions = GENERIC_ALL; + exp_access.grfAccessMode = GRANT_ACCESS; + exp_access.grfInheritance = NO_PROPAGATE_INHERIT_ACE; + exp_access.Trustee.pMultipleTrustee = NULL; + exp_access.Trustee.TrusteeForm = TRUSTEE_IS_SID; + exp_access.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + exp_access.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP; + exp_access.Trustee.ptstrName = (void*)psid; + + retd = pSetEntriesInAclW(1, &exp_access, pAcl2, &pAclChild); + ok(retd == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", retd); + + memset(sd, 0, sizeof(buffer_sd)); + ret = InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION); + ok(ret, "InitializeSecurityDescriptor failed with %u\n", GetLastError()); + + ret = SetSecurityDescriptorDacl(sd, TRUE, pAclChild, FALSE); + ok(ret, "SetSecurityDescriptorDacl failed with %u\n", GetLastError()); + + ret = SetKernelObjectSecurity(token, DACL_SECURITY_INFORMATION, sd); + ok(ret, "SetKernelObjectSecurity failed with %u\n", GetLastError()); + + /* The security label is also not inherited */ + if (pAddMandatoryAce) + { + ret = InitializeAcl(pAcl, 256, ACL_REVISION); + ok(ret, "InitializeAcl failed with %u\n", GetLastError()); + + ret = pAddMandatoryAce(pAcl, ACL_REVISION, 0, SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, &low_level); + ok(ret, "AddMandatoryAce failed with %u\n", GetLastError()); + + memset(sd, 0, sizeof(buffer_sd)); + ret = InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION); + ok(ret, "InitializeSecurityDescriptor failed with %u\n", GetLastError()); + + ret = SetSecurityDescriptorSacl(sd, TRUE, pAcl, FALSE); + ok(ret, "SetSecurityDescriptorSacl failed with %u\n", GetLastError()); + + ret = SetKernelObjectSecurity(token, LABEL_SECURITY_INFORMATION, sd); + ok(ret, "SetKernelObjectSecurity failed with %u\n", GetLastError()); + } + else + win_skip("SYSTEM_MANDATORY_LABEL not supported\n"); + + /* start child process with our modified token */ + memset(&startup, 0, sizeof(startup)); + startup.cb = sizeof(startup); + startup.dwFlags = STARTF_USESHOWWINDOW; + startup.wShowWindow = SW_SHOWNORMAL; + + sprintf(buffer, "%s tests/security.c test_token_sd", myARGV[0]); + ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info); + ok(ret, "CreateProcess failed with error %u\n", GetLastError()); + winetest_wait_child_process(info.hProcess); + CloseHandle(info.hProcess); + CloseHandle(info.hThread); + + LocalFree(pAclChild); + LocalFree(psid); + + CloseHandle(token3); + CloseHandle(token2); + CloseHandle(token); +} + +static void test_child_token_sd(void) +{ + static SID low_level = {SID_REVISION, 1, {SECURITY_MANDATORY_LABEL_AUTHORITY}, + {SECURITY_MANDATORY_LOW_RID}}; + SYSTEM_MANDATORY_LABEL_ACE *ace_label; + BOOL ret, present, defaulted, found; + ACCESS_ALLOWED_ACE *ace_acc; + SECURITY_DESCRIPTOR *sd; + DWORD size, index; + HANDLE token; + ACL *pAcl; + PSID psid; + + ret = pConvertStringSidToSidA("S-1-5-6", &psid); + ok(ret, "ConvertStringSidToSidA failed with %u\n", GetLastError()); + + ret = OpenProcessToken(GetCurrentProcess(), MAXIMUM_ALLOWED, &token); + ok(ret, "OpenProcessToken failed with error %u\n", GetLastError()); + + ret = GetKernelObjectSecurity(token, DACL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(token, DACL_SECURITY_INFORMATION, sd, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + pAcl = NULL; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorDacl(sd, &present, &pAcl, &defaulted); + ok(ret, "GetSecurityDescriptorSacl failed with %u\n", GetLastError()); + + index = 0; + found = FALSE; + if (present && pAcl) + { + ok(pAcl->AceCount > 0, "Expected at least one ACE\n"); + while (pGetAce( pAcl, index++, (void **)&ace_acc )) + { + if (ace_acc->Header.AceType == ACCESS_ALLOWED_ACE_TYPE && EqualSid(&ace_acc->SidStart, psid)) + found = TRUE; + } + } + ok(!found, "The ACE should not haven been inherited from the parent\n"); + + LocalFree(psid); + HeapFree(GetProcessHeap(), 0, sd); + + if (!pAddMandatoryAce) + { + win_skip("SYSTEM_MANDATORY_LABEL not supported\n"); + return; + } + + ret = GetKernelObjectSecurity(token, LABEL_SECURITY_INFORMATION, NULL, 0, &size); + ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "GetKernelObjectSecurity failed with %u\n", GetLastError()); + + sd = HeapAlloc(GetProcessHeap(), 0, size); + ret = GetKernelObjectSecurity(token, LABEL_SECURITY_INFORMATION, sd, size, &size); + ok(ret, "GetKernelObjectSecurity failed %u\n", GetLastError()); + + pAcl = NULL; + present = FALSE; + defaulted = TRUE; + ret = GetSecurityDescriptorSacl(sd, &present, &pAcl, &defaulted); + ok(ret, "GetSecurityDescriptorSacl failed with %u\n", GetLastError()); + + index = 0; + found = FALSE; + if (present && pAcl) + { + while (pGetAce( pAcl, index++, (void **)&ace_label )) + { + if (ace_label->Header.AceType == SYSTEM_MANDATORY_LABEL_ACE_TYPE && EqualSid(&ace_label->SidStart, &low_level)) + found = TRUE; + } + } + ok(!found, "Low integrity level should not have been inherited\n"); + + HeapFree(GetProcessHeap(), 0, sd); +} + +static void test_BuildSecurityDescriptorW(void) +{ + SECURITY_DESCRIPTOR old_sd, *new_sd, *rel_sd; + ULONG new_sd_size; + DWORD buf_size; + char buf[1024]; + BOOL success; + DWORD ret; + + InitializeSecurityDescriptor(&old_sd, SECURITY_DESCRIPTOR_REVISION); + + buf_size = sizeof(buf); + rel_sd = (SECURITY_DESCRIPTOR *)buf; + success = MakeSelfRelativeSD(&old_sd, rel_sd, &buf_size); + ok(success, "MakeSelfRelativeSD failed with %u\n", GetLastError()); + + new_sd = NULL; + new_sd_size = 0; + ret = BuildSecurityDescriptorW(NULL, NULL, 0, NULL, 0, NULL, NULL, &new_sd_size, (void **)&new_sd); + ok(ret == ERROR_SUCCESS, "BuildSecurityDescriptor failed with %u\n", ret); + ok(new_sd != NULL, "expected new_sd != NULL\n"); + ok(new_sd_size == sizeof(old_sd), "expected new_sd_size == sizeof(old_sd), got %u\n", new_sd_size); + LocalFree(new_sd); + + new_sd = (void *)0xdeadbeef; + ret = BuildSecurityDescriptorW(NULL, NULL, 0, NULL, 0, NULL, &old_sd, &new_sd_size, (void **)&new_sd); + ok(ret == ERROR_INVALID_SECURITY_DESCR, "expected ERROR_INVALID_SECURITY_DESCR, got %u\n", ret); + ok(new_sd == (void *)0xdeadbeef, "expected new_sd == 0xdeadbeef, got %p\n", new_sd); + + new_sd = NULL; + new_sd_size = 0; + ret = BuildSecurityDescriptorW(NULL, NULL, 0, NULL, 0, NULL, rel_sd, &new_sd_size, (void **)&new_sd); + ok(ret == ERROR_SUCCESS, "BuildSecurityDescriptor failed with %u\n", ret); + ok(new_sd != NULL, "expected new_sd != NULL\n"); + ok(new_sd_size == sizeof(old_sd), "expected new_sd_size == sizeof(old_sd), got %u\n", new_sd_size); + LocalFree(new_sd); +} + START_TEST(security) { init(); @@ -6660,7 +7542,10 @@ if (myARGC >= 3) { - test_process_security_child(); + if (!strcmp(myARGV[2], "test_token_sd")) + test_child_token_sd(); + else + test_process_security_child(); return; } test_kernel_objects_security(); @@ -6671,6 +7556,7 @@ test_FileSecurity(); test_AccessCheck(); test_token_attr(); + test_GetTokenInformation(); test_LookupAccountSid(); test_LookupAccountName(); test_security_descriptor(); @@ -6696,7 +7582,14 @@ test_default_dacl_owner_sid(); test_AdjustTokenPrivileges(); test_AddAce(); + test_AddMandatoryAce(); test_system_security_access(); test_GetSidIdentifierAuthority(); test_pseudo_tokens(); -} + test_maximum_allowed(); + test_GetExplicitEntriesFromAclW(); + test_BuildSecurityDescriptorW(); + + /* must be the last test, modifies process token */ + test_token_security_descriptor(); +} Modified: trunk/rostests/winetests/advapi32/service.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/servic…
============================================================================== --- trunk/rostests/winetests/advapi32/service.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/service.c [iso-8859-1] Sun Jun 4 14:57:35 2017 @@ -382,7 +382,7 @@ { svc_handle1 = CreateServiceA(scm_handle, servicename, display, 0, SERVICE_WIN32_OWN_PROCESS, SERVICE_DISABLED, 0, pathname, NULL, NULL, NULL, NULL, NULL); - ok(!svc_handle1, "Expected failure\n"); + ok(!svc_handle1, "Expected failure for display name '%s'\n", display); ok(GetLastError() == ERROR_DUPLICATE_SERVICE_NAME, "Expected ERROR_DUPLICATE_SERVICE_NAME, got %d\n", GetLastError()); } @@ -1404,7 +1404,7 @@ /* lpServiceName and lpDisplayName should always be filled */ ok(services[i].lpServiceName[0], "Expected a service name\n"); - ok(services[i].lpDisplayName[0], "Expected a display name\n"); + ok(services[i].lpDisplayName && services[i].lpDisplayName[0], "Expected a display name\n"); /* Decrement the counters to see if the functions calls return the same * numbers as the contents of these structures. @@ -1707,7 +1707,7 @@ /* lpServiceName and lpDisplayName should always be filled */ ok(exservices[i].lpServiceName[0], "Expected a service name\n"); - ok(exservices[i].lpDisplayName[0], "Expected a display name\n"); + ok(exservices[i].lpDisplayName && exservices[i].lpDisplayName[0], "Expected a display name\n"); /* Decrement the counters to see if the functions calls return the * same numbers as the contents of these structures.
7 years, 10 months
1
0
0
0
[ekohl] 74910: [NETAPI32] - Implement NetSessionDel, NetSessionEnum and NetSessionGetInfo. These functions call their counterparts in the server service.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Jun 4 14:34:27 2017 New Revision: 74910 URL:
http://svn.reactos.org/svn/reactos?rev=74910&view=rev
Log: [NETAPI32] - Implement NetSessionDel, NetSessionEnum and NetSessionGetInfo. These functions call their counterparts in the server service. Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec trunk/reactos/dll/win32/netapi32/share.c trunk/reactos/dll/win32/netapi32/srvsvc.c Modified: trunk/reactos/dll/win32/netapi32/netapi32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/netapi3…
============================================================================== --- trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/netapi32.spec [iso-8859-1] Sun Jun 4 14:34:27 2017 @@ -220,9 +220,9 @@ @ stub NetServiceEnum @ stub NetServiceGetInfo @ stub NetServiceInstall -@ stub NetSessionDel +@ stdcall NetSessionDel(wstr wstr wstr) @ stdcall NetSessionEnum(wstr wstr wstr long ptr long ptr ptr ptr) -@ stub NetSessionGetInfo +@ stdcall NetSessionGetInfo(wstr wstr wstr long ptr) @ stub NetSetPrimaryComputerName @ stdcall NetShareAdd(wstr long ptr ptr) @ stdcall NetShareCheck(wstr wstr ptr) Modified: trunk/reactos/dll/win32/netapi32/share.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/share.c…
============================================================================== --- trunk/reactos/dll/win32/netapi32/share.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/share.c [iso-8859-1] Sun Jun 4 14:34:27 2017 @@ -20,43 +20,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(share); /************************************************************ - * NetSessionEnum (NETAPI32.@) - * - * PARAMS - * servername [I] Pointer to a string with the name of the server - * UncClientName [I] Pointer to a string with the name of the session - * username [I] Pointer to a string with the name of the user - * level [I] Data information level - * bufptr [O] Buffer to the data - * prefmaxlen [I] Preferred maximum length of the data - * entriesread [O] Pointer to the number of entries enumerated - * totalentries [O] Pointer to the possible number of entries - * resume_handle [I/O] Pointer to a handle for subsequent searches - * - * RETURNS - * If successful, the function returns NERR_Success - * On failure it returns: - * ERROR_ACCESS_DENIED User has no access to the requested information - * ERROR_INVALID_LEVEL Value of 'level' is not correct - * ERROR_INVALID_PARAMETER Wrong parameter - * ERROR_MORE_DATA Need a larger buffer - * ERROR_NOT_ENOUGH_MEMORY Not enough memory - * NERR_ClientNameNotFound A session does not exist on a given computer - * NERR_InvalidComputer Invalid computer name - * NERR_UserNotFound User name could not be found. - */ -NET_API_STATUS WINAPI NetSessionEnum(LMSTR servername, LMSTR UncClientName, - LMSTR username, DWORD level, LPBYTE* bufptr, DWORD prefmaxlen, LPDWORD entriesread, - LPDWORD totalentries, LPDWORD resume_handle) -{ - FIXME("Stub (%s %s %s %d %p %d %p %p %p)\n", debugstr_w(servername), - debugstr_w(UncClientName), debugstr_w(username), - level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle); - - return NERR_Success; -} - -/************************************************************ * NetFileEnum (NETAPI32.@) */ NET_API_STATUS WINAPI NetFileEnum( Modified: trunk/reactos/dll/win32/netapi32/srvsvc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/netapi32/srvsvc.…
============================================================================== --- trunk/reactos/dll/win32/netapi32/srvsvc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/netapi32/srvsvc.c [iso-8859-1] Sun Jun 4 14:34:27 2017 @@ -100,132 +100,38 @@ NET_API_STATUS WINAPI -NetShareAdd( - _In_ LMSTR servername, - _In_ DWORD level, - _In_ LPBYTE buf, - _Out_ LPDWORD parm_err) -{ - NET_API_STATUS status; - - TRACE("NetShareAdd(%s %lu %p %p)\n", - debugstr_w(servername), level, buf, parm_err); - - if (level != 2 && level != 502 && level != 503) - return ERROR_INVALID_LEVEL; - - RpcTryExcept - { - status = NetrShareAdd(servername, - level, - (LPSHARE_INFO)&buf, - parm_err); - } - RpcExcept(EXCEPTION_EXECUTE_HANDLER) - { - status = I_RpcMapWin32Status(RpcExceptionCode()); - } - RpcEndExcept; - - return status; -} - - -NET_API_STATUS -WINAPI -NetShareCheck( - _In_ LMSTR servername, - _In_ LMSTR device, - _Out_ LPDWORD type) -{ - NET_API_STATUS status; - - TRACE("NetShareCheck(%s %s %p)\n", - debugstr_w(servername), debugstr_w(device), type); - - RpcTryExcept - { - status = NetrShareCheck(servername, - device, - type); - } - RpcExcept(EXCEPTION_EXECUTE_HANDLER) - { - status = I_RpcMapWin32Status(RpcExceptionCode()); - } - RpcEndExcept; - - return status; - -} - - -NET_API_STATUS -WINAPI -NetShareDel( - _In_ LMSTR servername, - _In_ LMSTR netname, - _In_ DWORD reserved) -{ - NET_API_STATUS status; - - TRACE("NetShareDel(%s %s %lu)\n", - debugstr_w(servername), debugstr_w(netname), reserved); - - if (netname == NULL || (*netname == 0) || reserved != 0) - return ERROR_INVALID_PARAMETER; - - RpcTryExcept - { - status = NetrShareDel(servername, - netname, - reserved); - } - RpcExcept(EXCEPTION_EXECUTE_HANDLER) - { - status = I_RpcMapWin32Status(RpcExceptionCode()); - } - RpcEndExcept; - - return status; -} - - -NET_API_STATUS -WINAPI -NetShareDelSticky( - _In_ LMSTR servername, - _In_ LMSTR netname, - _In_ DWORD reserved) -{ - NET_API_STATUS status; - - TRACE("NetShareDelSticky(%s %s %lu)\n", - debugstr_w(servername), debugstr_w(netname), reserved); - - if (netname == NULL || (*netname == 0) || reserved != 0) - return ERROR_INVALID_PARAMETER; - - RpcTryExcept - { - status = NetrShareDelSticky(servername, - netname, - reserved); - } - RpcExcept(EXCEPTION_EXECUTE_HANDLER) - { - status = I_RpcMapWin32Status(RpcExceptionCode()); - } - RpcEndExcept; - - return status; -} - - -NET_API_STATUS -WINAPI -NetShareEnum( - _In_ LMSTR servername, +NetSessionDel( + _In_ LMSTR servername, + _In_ LMSTR UncClientName, + _In_ LMSTR username) +{ + NET_API_STATUS status; + + TRACE("NetSessionDel(%s %s %s)\n", + debugstr_w(servername), debugstr_w(UncClientName), debugstr_w(username)); + + RpcTryExcept + { + status = NetrSessionDel(servername, + UncClientName, + username); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI +NetSessionEnum( + _In_ LMSTR servername, + _In_ LMSTR UncClientName, + _In_ LMSTR username, _In_ DWORD level, _Out_ LPBYTE *bufptr, _In_ DWORD prefmaxlen, @@ -233,83 +139,100 @@ _Out_ LPDWORD totalentries, _Inout_ LPDWORD resume_handle) { - SHARE_ENUM_STRUCT EnumStruct; - SHARE_INFO_0_CONTAINER Level0Container = {0, NULL}; - SHARE_INFO_1_CONTAINER Level1Container = {0, NULL}; - SHARE_INFO_2_CONTAINER Level2Container = {0, NULL}; - SHARE_INFO_502_CONTAINER Level502Container = {0, NULL}; - NET_API_STATUS status; - - TRACE("NetShareEnum(%s %lu %p %lu %p %p %p)\n", - debugstr_w(servername), level, bufptr, prefmaxlen, - entriesread, totalentries, resume_handle); - - if (level > 2 && level != 502) + SESSION_ENUM_STRUCT EnumStruct; + SESSION_INFO_0_CONTAINER Level0Container = {0, NULL}; + SESSION_INFO_1_CONTAINER Level1Container = {0, NULL}; + SESSION_INFO_2_CONTAINER Level2Container = {0, NULL}; + SESSION_INFO_10_CONTAINER Level10Container = {0, NULL}; + SESSION_INFO_502_CONTAINER Level502Container = {0, NULL}; + NET_API_STATUS status; + + FIXME("NetSessionEnum(%s %s %s %lu %p %lu %p %p %p)\n", + debugstr_w(servername), debugstr_w(UncClientName), debugstr_w(username), + level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle); + + if (level > 2 && level != 10 && level != 502) return ERROR_INVALID_LEVEL; + + if (UncClientName == NULL || username == NULL) + return ERROR_INVALID_PARAMETER; *bufptr = NULL; *entriesread = 0; - *totalentries = 0; EnumStruct.Level = level; switch (level) { case 0: - EnumStruct.ShareInfo.Level0 = &Level0Container; + EnumStruct.SessionInfo.Level0 = &Level0Container; break; case 1: - EnumStruct.ShareInfo.Level1 = &Level1Container; + EnumStruct.SessionInfo.Level1 = &Level1Container; break; case 2: - EnumStruct.ShareInfo.Level2 = &Level2Container; + EnumStruct.SessionInfo.Level2 = &Level2Container; + break; + + case 10: + EnumStruct.SessionInfo.Level10 = &Level10Container; break; case 502: - EnumStruct.ShareInfo.Level502 = &Level502Container; - break; - } - - RpcTryExcept - { - status = NetrShareEnum(servername, - &EnumStruct, - prefmaxlen, - totalentries, - resume_handle); + EnumStruct.SessionInfo.Level502 = &Level502Container; + break; + } + + RpcTryExcept + { + status = NetrSessionEnum(servername, + UncClientName, + username, + &EnumStruct, + prefmaxlen, + totalentries, + resume_handle); switch (level) { case 0: - if (EnumStruct.ShareInfo.Level0->Buffer != NULL) - { - *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level0->Buffer; - *entriesread = EnumStruct.ShareInfo.Level0->EntriesRead; + if (EnumStruct.SessionInfo.Level0->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level0->Buffer; + *entriesread = EnumStruct.SessionInfo.Level0->EntriesRead; } break; case 1: - if (EnumStruct.ShareInfo.Level1->Buffer != NULL) - { - *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level1->Buffer; - *entriesread = EnumStruct.ShareInfo.Level1->EntriesRead; + if (EnumStruct.SessionInfo.Level1->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level1->Buffer; + *entriesread = EnumStruct.SessionInfo.Level1->EntriesRead; } break; case 2: - if (EnumStruct.ShareInfo.Level2->Buffer != NULL) - { - *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level2->Buffer; - *entriesread = EnumStruct.ShareInfo.Level2->EntriesRead; + if (EnumStruct.SessionInfo.Level2->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level2->Buffer; + *entriesread = EnumStruct.SessionInfo.Level2->EntriesRead; + } + break; + + case 10: + if (EnumStruct.SessionInfo.Level10->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level10->Buffer; + *entriesread = EnumStruct.SessionInfo.Level10->EntriesRead; } break; case 502: - if (EnumStruct.ShareInfo.Level502->Buffer != NULL) - { - *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level502->Buffer; - *entriesread = EnumStruct.ShareInfo.Level502->EntriesRead; + if (EnumStruct.SessionInfo.Level502->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level502->Buffer; + *entriesread = EnumStruct.SessionInfo.Level502->EntriesRead; } break; } @@ -326,7 +249,222 @@ NET_API_STATUS WINAPI -NetShareEnumSticky( +NetSessionGetInfo( + _In_ LMSTR servername, + _In_ LMSTR UncClientName, + _In_ LMSTR username, + _In_ DWORD level, + _Out_ LPBYTE *bufptr) +{ + SESSION_ENUM_STRUCT EnumStruct; + SESSION_INFO_0_CONTAINER Level0Container = {0, NULL}; + SESSION_INFO_1_CONTAINER Level1Container = {0, NULL}; + SESSION_INFO_2_CONTAINER Level2Container = {0, NULL}; + SESSION_INFO_10_CONTAINER Level10Container = {0, NULL}; + DWORD dwTotalEntries; + NET_API_STATUS status; + + FIXME("NetSessionGetInfo(%s %s %s %lu %p)\n", + debugstr_w(servername), debugstr_w(UncClientName), + debugstr_w(username), level, bufptr); + + if (level > 2 && level != 10) + return ERROR_INVALID_LEVEL; + + if (UncClientName == NULL || username == NULL) + return ERROR_INVALID_PARAMETER; + + *bufptr = NULL; + + EnumStruct.Level = level; + switch (level) + { + case 0: + EnumStruct.SessionInfo.Level0 = &Level0Container; + break; + + case 1: + EnumStruct.SessionInfo.Level1 = &Level1Container; + break; + + case 2: + EnumStruct.SessionInfo.Level2 = &Level2Container; + break; + + case 10: + EnumStruct.SessionInfo.Level10 = &Level10Container; + break; + } + + RpcTryExcept + { + status = NetrSessionEnum(servername, + UncClientName, + username, + &EnumStruct, + MAX_PREFERRED_LENGTH, //(DWORD)-1, + &dwTotalEntries, + NULL); + + switch (level) + { + case 0: + if (EnumStruct.SessionInfo.Level0->Buffer != NULL) + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level0->Buffer; + break; + + case 1: + if (EnumStruct.SessionInfo.Level1->Buffer != NULL) + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level1->Buffer; + break; + + case 2: + if (EnumStruct.SessionInfo.Level2->Buffer != NULL) + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level2->Buffer; + break; + + case 10: + if (EnumStruct.SessionInfo.Level10->Buffer != NULL) + *bufptr = (LPBYTE)EnumStruct.SessionInfo.Level10->Buffer; + break; + } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI +NetShareAdd( + _In_ LMSTR servername, + _In_ DWORD level, + _In_ LPBYTE buf, + _Out_ LPDWORD parm_err) +{ + NET_API_STATUS status; + + TRACE("NetShareAdd(%s %lu %p %p)\n", + debugstr_w(servername), level, buf, parm_err); + + if (level != 2 && level != 502 && level != 503) + return ERROR_INVALID_LEVEL; + + RpcTryExcept + { + status = NetrShareAdd(servername, + level, + (LPSHARE_INFO)&buf, + parm_err); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI +NetShareCheck( + _In_ LMSTR servername, + _In_ LMSTR device, + _Out_ LPDWORD type) +{ + NET_API_STATUS status; + + TRACE("NetShareCheck(%s %s %p)\n", + debugstr_w(servername), debugstr_w(device), type); + + RpcTryExcept + { + status = NetrShareCheck(servername, + device, + type); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI +NetShareDel( + _In_ LMSTR servername, + _In_ LMSTR netname, + _In_ DWORD reserved) +{ + NET_API_STATUS status; + + TRACE("NetShareDel(%s %s %lu)\n", + debugstr_w(servername), debugstr_w(netname), reserved); + + if (netname == NULL || (*netname == 0) || reserved != 0) + return ERROR_INVALID_PARAMETER; + + RpcTryExcept + { + status = NetrShareDel(servername, + netname, + reserved); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI +NetShareDelSticky( + _In_ LMSTR servername, + _In_ LMSTR netname, + _In_ DWORD reserved) +{ + NET_API_STATUS status; + + TRACE("NetShareDelSticky(%s %s %lu)\n", + debugstr_w(servername), debugstr_w(netname), reserved); + + if (netname == NULL || (*netname == 0) || reserved != 0) + return ERROR_INVALID_PARAMETER; + + RpcTryExcept + { + status = NetrShareDelSticky(servername, + netname, + reserved); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI +NetShareEnum( _In_ LMSTR servername, _In_ DWORD level, _Out_ LPBYTE *bufptr, @@ -342,6 +480,108 @@ SHARE_INFO_502_CONTAINER Level502Container = {0, NULL}; NET_API_STATUS status; + TRACE("NetShareEnum(%s %lu %p %lu %p %p %p)\n", + debugstr_w(servername), level, bufptr, prefmaxlen, + entriesread, totalentries, resume_handle); + + if (level > 2 && level != 502) + return ERROR_INVALID_LEVEL; + + *bufptr = NULL; + *entriesread = 0; + *totalentries = 0; + + EnumStruct.Level = level; + switch (level) + { + case 0: + EnumStruct.ShareInfo.Level0 = &Level0Container; + break; + + case 1: + EnumStruct.ShareInfo.Level1 = &Level1Container; + break; + + case 2: + EnumStruct.ShareInfo.Level2 = &Level2Container; + break; + + case 502: + EnumStruct.ShareInfo.Level502 = &Level502Container; + break; + } + + RpcTryExcept + { + status = NetrShareEnum(servername, + &EnumStruct, + prefmaxlen, + totalentries, + resume_handle); + + switch (level) + { + case 0: + if (EnumStruct.ShareInfo.Level0->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level0->Buffer; + *entriesread = EnumStruct.ShareInfo.Level0->EntriesRead; + } + break; + + case 1: + if (EnumStruct.ShareInfo.Level1->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level1->Buffer; + *entriesread = EnumStruct.ShareInfo.Level1->EntriesRead; + } + break; + + case 2: + if (EnumStruct.ShareInfo.Level2->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level2->Buffer; + *entriesread = EnumStruct.ShareInfo.Level2->EntriesRead; + } + break; + + case 502: + if (EnumStruct.ShareInfo.Level502->Buffer != NULL) + { + *bufptr = (LPBYTE)EnumStruct.ShareInfo.Level502->Buffer; + *entriesread = EnumStruct.ShareInfo.Level502->EntriesRead; + } + break; + } + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + status = I_RpcMapWin32Status(RpcExceptionCode()); + } + RpcEndExcept; + + return status; +} + + +NET_API_STATUS +WINAPI +NetShareEnumSticky( + _In_ LMSTR servername, + _In_ DWORD level, + _Out_ LPBYTE *bufptr, + _In_ DWORD prefmaxlen, + _Out_ LPDWORD entriesread, + _Out_ LPDWORD totalentries, + _Inout_ LPDWORD resume_handle) +{ + SHARE_ENUM_STRUCT EnumStruct; + SHARE_INFO_0_CONTAINER Level0Container = {0, NULL}; + SHARE_INFO_1_CONTAINER Level1Container = {0, NULL}; + SHARE_INFO_2_CONTAINER Level2Container = {0, NULL}; + SHARE_INFO_502_CONTAINER Level502Container = {0, NULL}; + NET_API_STATUS status; + TRACE("NetShareEnumSticky(%s %lu %p %lu %p %p %p)\n", debugstr_w(servername), level, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
7 years, 10 months
1
0
0
0
[akhaldi] 74909: [USER32_WINETEST] Sync with Wine Staging 2.9 except win.c. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 14:34:15 2017 New Revision: 74909 URL:
http://svn.reactos.org/svn/reactos?rev=74909&view=rev
Log: [USER32_WINETEST] Sync with Wine Staging 2.9 except win.c. CORE-13362 Modified: trunk/rostests/winetests/user32/class.c trunk/rostests/winetests/user32/clipboard.c trunk/rostests/winetests/user32/combo.c trunk/rostests/winetests/user32/cursoricon.c trunk/rostests/winetests/user32/dce.c trunk/rostests/winetests/user32/dialog.c trunk/rostests/winetests/user32/input.c trunk/rostests/winetests/user32/menu.c trunk/rostests/winetests/user32/monitor.c trunk/rostests/winetests/user32/msg.c trunk/rostests/winetests/user32/resource.rc trunk/rostests/winetests/user32/sysparams.c trunk/rostests/winetests/user32/text.c trunk/rostests/winetests/user32/uitools.c trunk/rostests/winetests/user32/wsprintf.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/winetests/user32/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/class.c?…
Modified: trunk/rostests/winetests/user32/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/clipboar…
Modified: trunk/rostests/winetests/user32/combo.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/combo.c?…
Modified: trunk/rostests/winetests/user32/cursoricon.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/cursoric…
Modified: trunk/rostests/winetests/user32/dce.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/dce.c?re…
Modified: trunk/rostests/winetests/user32/dialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/dialog.c…
Modified: trunk/rostests/winetests/user32/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/input.c?…
Modified: trunk/rostests/winetests/user32/menu.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/menu.c?r…
Modified: trunk/rostests/winetests/user32/monitor.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/monitor.…
Modified: trunk/rostests/winetests/user32/msg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/msg.c?re…
Modified: trunk/rostests/winetests/user32/resource.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/resource…
Modified: trunk/rostests/winetests/user32/sysparams.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/sysparam…
Modified: trunk/rostests/winetests/user32/text.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/text.c?r…
Modified: trunk/rostests/winetests/user32/uitools.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/uitools.…
Modified: trunk/rostests/winetests/user32/wsprintf.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/wsprintf…
7 years, 10 months
1
0
0
0
[akhaldi] 74908: [KERNEL32_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 14:29:15 2017 New Revision: 74908 URL:
http://svn.reactos.org/svn/reactos?rev=74908&view=rev
Log: [KERNEL32_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/kernel32/actctx.c trunk/rostests/winetests/kernel32/codepage.c trunk/rostests/winetests/kernel32/console.c trunk/rostests/winetests/kernel32/debugger.c trunk/rostests/winetests/kernel32/directory.c trunk/rostests/winetests/kernel32/file.c trunk/rostests/winetests/kernel32/format_msg.c trunk/rostests/winetests/kernel32/heap.c trunk/rostests/winetests/kernel32/loader.c trunk/rostests/winetests/kernel32/locale.c trunk/rostests/winetests/kernel32/pipe.c trunk/rostests/winetests/kernel32/process.c trunk/rostests/winetests/kernel32/thread.c trunk/rostests/winetests/kernel32/version.c trunk/rostests/winetests/kernel32/virtual.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/winetests/kernel32/actctx.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/actctx…
Modified: trunk/rostests/winetests/kernel32/codepage.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/codepa…
Modified: trunk/rostests/winetests/kernel32/console.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/consol…
Modified: trunk/rostests/winetests/kernel32/debugger.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/debugg…
Modified: trunk/rostests/winetests/kernel32/directory.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/direct…
Modified: trunk/rostests/winetests/kernel32/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/file.c…
Modified: trunk/rostests/winetests/kernel32/format_msg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/format…
Modified: trunk/rostests/winetests/kernel32/heap.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/heap.c…
Modified: trunk/rostests/winetests/kernel32/loader.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/loader…
Modified: trunk/rostests/winetests/kernel32/locale.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/locale…
Modified: trunk/rostests/winetests/kernel32/pipe.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/pipe.c…
Modified: trunk/rostests/winetests/kernel32/process.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/proces…
Modified: trunk/rostests/winetests/kernel32/thread.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/thread…
Modified: trunk/rostests/winetests/kernel32/version.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/versio…
Modified: trunk/rostests/winetests/kernel32/virtual.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/virtua…
7 years, 10 months
1
0
0
0
[akhaldi] 74907: [PSDK] Add some missing PROC_THREAD_ATTRIBUTE_* definitions.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 14:27:51 2017 New Revision: 74907 URL:
http://svn.reactos.org/svn/reactos?rev=74907&view=rev
Log: [PSDK] Add some missing PROC_THREAD_ATTRIBUTE_* definitions. Modified: trunk/reactos/sdk/include/psdk/winbase.h Modified: trunk/reactos/sdk/include/psdk/winbase.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/winbase.h…
============================================================================== --- trunk/reactos/sdk/include/psdk/winbase.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/winbase.h [iso-8859-1] Sun Jun 4 14:27:51 2017 @@ -1342,6 +1342,33 @@ typedef RTL_CONDITION_VARIABLE CONDITION_VARIABLE, *PCONDITION_VARIABLE; #endif +typedef struct _PROC_THREAD_ATTRIBUTE_LIST *PPROC_THREAD_ATTRIBUTE_LIST, *LPPROC_THREAD_ATTRIBUTE_LIST; + +#define PROC_THREAD_ATTRIBUTE_NUMBER 0x0000ffff +#define PROC_THREAD_ATTRIBUTE_THREAD 0x00010000 +#define PROC_THREAD_ATTRIBUTE_INPUT 0x00020000 +#define PROC_THREAD_ATTRIBUTE_ADDITIVE 0x00040000 + +typedef enum _PROC_THREAD_ATTRIBUTE_NUM { + ProcThreadAttributeParentProcess = 0, + ProcThreadAttributeHandleList = 2, + ProcThreadAttributeGroupAffinity = 3, + ProcThreadAttributeIdealProcessor = 5, + ProcThreadAttributeUmsThread = 6, + ProcThreadAttributeMitigationPolicy = 7, + ProcThreadAttributeSecurityCapabilities = 9, + ProcThreadAttributeProtectionLevel = 11, + ProcThreadAttributeJobList = 13, + ProcThreadAttributeChildProcessPolicy = 14, + ProcThreadAttributeAllApplicationPackagesPolicy = 15, + ProcThreadAttributeWin32kFilter = 16, + ProcThreadAttributeSafeOpenPromptOriginClaim = 17, +} PROC_THREAD_ATTRIBUTE_NUM; + +#define PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR (ProcThreadAttributeIdealProcessor | PROC_THREAD_ATTRIBUTE_THREAD | PROC_THREAD_ATTRIBUTE_INPUT) +#define PROC_THREAD_ATTRIBUTE_HANDLE_LIST (ProcThreadAttributeHandleList | PROC_THREAD_ATTRIBUTE_INPUT) +#define PROC_THREAD_ATTRIBUTE_PARENT_PROCESS (ProcThreadAttributeParentProcess | PROC_THREAD_ATTRIBUTE_INPUT) + typedef DWORD (WINAPI *PFE_EXPORT_FUNC)( _In_reads_bytes_(ulLength) PBYTE pbData,
7 years, 10 months
1
0
0
0
[mjansen] 74906: [WIN32SS] Prevent accessing an unininitialized pointer when loading an invalid font. CORE-13364
by mjansen@svn.reactos.org
Author: mjansen Date: Sun Jun 4 14:03:25 2017 New Revision: 74906 URL:
http://svn.reactos.org/svn/reactos?rev=74906&view=rev
Log: [WIN32SS] Prevent accessing an unininitialized pointer when loading an invalid font. CORE-13364 Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c Modified: trunk/reactos/win32ss/gdi/ntgdi/freetype.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/freetype…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/freetype.c [iso-8859-1] Sun Jun 4 14:03:25 2017 @@ -814,7 +814,7 @@ IntUnLockFreeType; - if (FT_IS_SFNT(Face)) + if (!Error && FT_IS_SFNT(Face)) pLoadFont->IsTrueType = TRUE; if (Error || SharedFace == NULL)
7 years, 10 months
1
0
0
0
[akhaldi] 74905: [RPCRT4_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 14:02:01 2017 New Revision: 74905 URL:
http://svn.reactos.org/svn/reactos?rev=74905&view=rev
Log: [RPCRT4_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Modified: trunk/rostests/winetests/rpcrt4/rpc.c trunk/rostests/winetests/rpcrt4/server.c Modified: trunk/rostests/winetests/rpcrt4/rpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/rpc.c?re…
============================================================================== --- trunk/rostests/winetests/rpcrt4/rpc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/rpcrt4/rpc.c [iso-8859-1] Sun Jun 4 14:02:01 2017 @@ -250,10 +250,8 @@ ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status); status = RpcServerListen(1, 20, TRUE); -todo_wine { ok(status == RPC_S_ALREADY_LISTENING, "wrong RpcServerListen error (%u)\n", status); -} status = RpcStringBindingComposeA(NULL, ncacn_ip_tcp, address, endpoint, NULL, &binding); @@ -301,9 +299,7 @@ ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%u)\n", status); status = RpcMgmtWaitServerListen(); -todo_wine { ok(status == RPC_S_OK, "RpcMgmtWaitServerListen failed (%u)\n", status); -} status = RpcStringFreeA(&binding); ok(status == RPC_S_OK, "RpcStringFree failed (%u)\n", status); @@ -1150,7 +1146,7 @@ hr = INetFwPolicy_get_CurrentProfile( policy, &profile ); if (hr != S_OK) goto done; - INetFwProfile_get_AuthorizedApplications( profile, &apps ); + hr = INetFwProfile_get_AuthorizedApplications( profile, &apps ); ok( hr == S_OK, "got %08x\n", hr ); if (hr != S_OK) goto done; Modified: trunk/rostests/winetests/rpcrt4/server.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rpcrt4/server.c…
============================================================================== --- trunk/rostests/winetests/rpcrt4/server.c [iso-8859-1] (original) +++ trunk/rostests/winetests/rpcrt4/server.c [iso-8859-1] Sun Jun 4 14:02:01 2017 @@ -1752,10 +1752,42 @@ if (ret == WAIT_OBJECT_0) { status = RpcMgmtWaitServerListen(); - todo_wine { - ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status); - } - } + ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status); + } + + CloseHandle(stop_event); + stop_event = NULL; +} + +static void test_server_listening(void) +{ + static unsigned char np[] = "ncacn_np"; + static unsigned char pipe[] = PIPE "listen_test"; + RPC_STATUS status; + + status = RpcServerUseProtseqEpA(np, 0, pipe, NULL); + ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", status); + + status = RpcServerRegisterIf(s_IServer_v0_0_s_ifspec, NULL, NULL); + ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status); + + test_is_server_listening(NULL, RPC_S_NOT_LISTENING); + status = RpcServerListen(1, 20, TRUE); + ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status); + test_is_server_listening(NULL, RPC_S_OK); + + status = RpcServerListen(1, 20, TRUE); + ok(status == RPC_S_ALREADY_LISTENING, "RpcServerListen failed with status %d\n", status); + + status = RpcMgmtStopServerListening(NULL); + ok(status == RPC_S_OK, "RpcMgmtStopServerListening\n"); + test_is_server_listening(NULL, RPC_S_NOT_LISTENING); + + status = RpcMgmtWaitServerListen(); + ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status); + + status = RpcMgmtWaitServerListen(); + ok(status == RPC_S_NOT_LISTENING, "RpcMgmtWaitServerListening failed with status %d\n", status); } static BOOL is_process_elevated(void) @@ -1843,7 +1875,7 @@ hr = INetFwPolicy_get_CurrentProfile( policy, &profile ); if (hr != S_OK) goto done; - INetFwProfile_get_AuthorizedApplications( profile, &apps ); + hr = INetFwProfile_get_AuthorizedApplications( profile, &apps ); ok( hr == S_OK, "got %08x\n", hr ); if (hr != S_OK) goto done; @@ -1912,6 +1944,10 @@ trace("Exception %d\n", RpcExceptionCode()); } RpcEndExcept + } + else if (argc == 4) + { + test_server_listening(); } else { @@ -1926,6 +1962,7 @@ } } server(); + run_client("test listen"); if (firewall_enabled) set_firewall(APP_REMOVE); }
7 years, 10 months
1
0
0
0
[akhaldi] 74904: [RPCRT4] Sync with Wine Staging 2.9. CORE-13362 6b53b79 rpcrt4: Use HEAP_ZERO_MEMORY to alloc RpcServerProtseq objects. 28f865b rpcrt4: Add close_read implementation for TCP connec...
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 14:01:54 2017 New Revision: 74904 URL:
http://svn.reactos.org/svn/reactos?rev=74904&view=rev
Log: [RPCRT4] Sync with Wine Staging 2.9. CORE-13362 6b53b79 rpcrt4: Use HEAP_ZERO_MEMORY to alloc RpcServerProtseq objects. 28f865b rpcrt4: Add close_read implementation for TCP connections. 29f0b28 rpcrt4: Add close_read implementation for named pipe connections. 42ba4d7 rpcrt4: Introduce op for closing connection read end and use it when shutting down server. ef267f1 rpcrt4: Store all active connections in RpcServerProtseq. dae3065 rpcrt4: Remove connection from list in RPCRT4_ReleaseConnection. 812897c rpcrt4: Use HEAP_ZERO_MEMORY to alloc RpcConnection objects. 13d529a rpcrt4: Renamed connections list to listeners. c953763 rpcrt4: Remove no longer needed helpers. b548338 rpcrt4: Implement cancel_call for named pipes. 372c9e0 rpcrt4: Cache event handle in RpcConnection_np object. 6e7a297 rpcrt4: Use non-blocking listening on named pipes. 4f4ac8c rpcrt4: Use named pipe in overlapped mode. bd6f807 rpcrt4: Simplify rpcrt4_conn_np_read implementation. f62b9d6 rpcrt4: Simplify rpcrt4_conn_np_write implementation. 2035294 rpcrt4: Use standard Wine list to store connections in RpcServerProtseq. e621593 rpcrt4: Always use winsock for networking. d0ed6d1 rpcrt4: Get rid of manual_listen_count and use binary state instead. Modified: trunk/reactos/dll/win32/rpcrt4/rpc_binding.h trunk/reactos/dll/win32/rpcrt4/rpc_server.c trunk/reactos/dll/win32/rpcrt4/rpc_server.h trunk/reactos/dll/win32/rpcrt4/rpc_transport.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/rpcrt4/rpc_binding.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_bindi…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_binding.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_binding.h [iso-8859-1] Sun Jun 4 14:01:54 2017 @@ -86,7 +86,8 @@ /* The active interface bound to server. */ RPC_SYNTAX_IDENTIFIER ActiveInterface; USHORT NextCallId; - struct _RpcConnection* Next; + struct list protseq_entry; + struct _RpcServerProtseq *protseq; struct _RpcBinding *server_binding; } RpcConnection; @@ -99,6 +100,7 @@ int (*read)(RpcConnection *conn, void *buffer, unsigned int len); int (*write)(RpcConnection *conn, const void *buffer, unsigned int len); int (*close)(RpcConnection *conn); + void (*close_read)(RpcConnection *conn); void (*cancel_call)(RpcConnection *conn); RPC_STATUS (*is_server_listening)(const char *endpoint); int (*wait_for_incoming_data)(RpcConnection *conn); @@ -192,6 +194,11 @@ return Connection->ops->close(Connection); } +static inline void rpcrt4_conn_close_read(RpcConnection *connection) +{ + connection->ops->close_read(connection); +} + static inline void rpcrt4_conn_cancel_call(RpcConnection *Connection) { Connection->ops->cancel_call(Connection); Modified: trunk/reactos/dll/win32/rpcrt4/rpc_server.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_serve…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_server.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_server.c [iso-8859-1] Sun Jun 4 14:01:54 2017 @@ -79,11 +79,9 @@ /* whether the server is currently listening */ static BOOL std_listen; -/* number of manual listeners (calls to RpcServerListen) */ -static LONG manual_listen_count; /* total listeners including auto listeners */ static LONG listen_count; -/* event set once all listening is finished */ +/* event set once all manual listening is finished */ static HANDLE listen_done_event; static UUID uuid_nil; @@ -649,9 +647,12 @@ { /* cleanup */ cps->ops->free_wait_array(cps, objs); + EnterCriticalSection(&cps->cs); - for (conn = cps->conn; conn; conn = conn->Next) + LIST_FOR_EACH_ENTRY(conn, &cps->listeners, RpcConnection, protseq_entry) RPCRT4_CloseConnection(conn); + LIST_FOR_EACH_ENTRY(conn, &cps->connections, RpcConnection, protseq_entry) + rpcrt4_conn_close_read(conn); LeaveCriticalSection(&cps->cs); if (res == 0 && !std_listen) @@ -713,13 +714,16 @@ TRACE("\n"); EnterCriticalSection(&listen_cs); - if (auto_listen || (manual_listen_count++ == 0)) + if (auto_listen || !listen_done_event) { status = RPC_S_OK; + if(!auto_listen) + listen_done_event = CreateEventW(NULL, TRUE, FALSE, NULL); if (++listen_count == 1) std_listen = TRUE; } LeaveCriticalSection(&listen_cs); + if (status) return status; if (std_listen) { @@ -742,51 +746,53 @@ static RPC_STATUS RPCRT4_stop_listen(BOOL auto_listen) { + BOOL stop_listen = FALSE; RPC_STATUS status = RPC_S_OK; EnterCriticalSection(&listen_cs); - - if (!std_listen) + if (!std_listen && (auto_listen || !listen_done_event)) { status = RPC_S_NOT_LISTENING; - goto done; - } - - if (auto_listen || (--manual_listen_count == 0)) + } + else { - if (listen_count != 0 && --listen_count == 0) { - RpcServerProtseq *cps; - + stop_listen = listen_count != 0 && --listen_count == 0; + assert(listen_count >= 0); + if (stop_listen) std_listen = FALSE; + } + LeaveCriticalSection(&listen_cs); + + if (status) return status; + + if (stop_listen) { + RpcServerProtseq *cps; + LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry) + RPCRT4_sync_with_server_thread(cps); + } + + if (!auto_listen) + { + EnterCriticalSection(&listen_cs); + SetEvent( listen_done_event ); LeaveCriticalSection(&listen_cs); - - LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry) - RPCRT4_sync_with_server_thread(cps); - - EnterCriticalSection(&listen_cs); - if (listen_done_event) SetEvent( listen_done_event ); - listen_done_event = 0; - goto done; - } - assert(listen_count >= 0); - } - -done: - LeaveCriticalSection(&listen_cs); - return status; + } + return RPC_S_OK; } static BOOL RPCRT4_protseq_is_endpoint_registered(RpcServerProtseq *protseq, const char *endpoint) { RpcConnection *conn; + BOOL registered = FALSE; EnterCriticalSection(&protseq->cs); - for (conn = protseq->conn; conn; conn = conn->Next) - { - if (!endpoint || !strcmp(endpoint, conn->Endpoint)) + LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection, protseq_entry) { + if (!endpoint || !strcmp(endpoint, conn->Endpoint)) { + registered = TRUE; break; + } } LeaveCriticalSection(&protseq->cs); - return (conn != NULL); + return registered; } static RPC_STATUS RPCRT4_use_protseq(RpcServerProtseq* ps, const char *endpoint) @@ -835,7 +841,7 @@ count = 0; LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) { EnterCriticalSection(&ps->cs); - for (conn = ps->conn; conn; conn = conn->Next) + LIST_FOR_EACH_ENTRY(conn, &ps->listeners, RpcConnection, protseq_entry) count++; LeaveCriticalSection(&ps->cs); } @@ -848,7 +854,7 @@ count = 0; LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) { EnterCriticalSection(&ps->cs); - for (conn = ps->conn; conn; conn = conn->Next) { + LIST_FOR_EACH_ENTRY(conn, &ps->listeners, RpcConnection, protseq_entry) { RPCRT4_MakeBinding((RpcBinding**)&(*BindingVector)->BindingH[count], conn); count++; @@ -919,13 +925,10 @@ (*ps)->MaxCalls = MaxCalls; (*ps)->Protseq = RPCRT4_strdupA(Protseq); (*ps)->ops = ops; - (*ps)->MaxCalls = 0; - (*ps)->conn = NULL; + list_init(&(*ps)->listeners); + list_init(&(*ps)->connections); InitializeCriticalSection(&(*ps)->cs); (*ps)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcServerProtseq.cs"); - (*ps)->is_listening = FALSE; - (*ps)->mgr_mutex = NULL; - (*ps)->server_ready_event = NULL; list_add_head(&protseqs, &(*ps)->entry); @@ -1505,25 +1508,23 @@ TRACE("()\n"); EnterCriticalSection(&listen_cs); - - if (!std_listen) { - LeaveCriticalSection(&listen_cs); - return RPC_S_NOT_LISTENING; - } - if (listen_done_event) { - LeaveCriticalSection(&listen_cs); - return RPC_S_ALREADY_LISTENING; - } - event = CreateEventW( NULL, TRUE, FALSE, NULL ); - listen_done_event = event; - + event = listen_done_event; LeaveCriticalSection(&listen_cs); + + if (!event) + return RPC_S_NOT_LISTENING; TRACE( "waiting for server calls to finish\n" ); WaitForSingleObject( event, INFINITE ); TRACE( "done waiting\n" ); - CloseHandle( event ); + EnterCriticalSection(&listen_cs); + if (listen_done_event == event) + { + listen_done_event = NULL; + CloseHandle( event ); + } + LeaveCriticalSection(&listen_cs); return RPC_S_OK; } @@ -1649,7 +1650,7 @@ status = RPCRT4_IsServerListening(rpc_binding->Protseq, rpc_binding->Endpoint); }else { EnterCriticalSection(&listen_cs); - if (manual_listen_count > 0) status = RPC_S_OK; + if (listen_done_event && std_listen) status = RPC_S_OK; LeaveCriticalSection(&listen_cs); } Modified: trunk/reactos/dll/win32/rpcrt4/rpc_server.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_serve…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_server.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_server.h [iso-8859-1] Sun Jun 4 14:01:54 2017 @@ -32,7 +32,8 @@ LPSTR Protseq; /* RO */ UINT MaxCalls; /* RO */ /* list of listening connections */ - RpcConnection* conn; /* CS cs */ + struct list listeners; /* CS cs */ + struct list connections; /* CS cs */ CRITICAL_SECTION cs; /* is the server currently listening? */ Modified: trunk/reactos/dll/win32/rpcrt4/rpc_transport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rpcrt4/rpc_trans…
============================================================================== --- trunk/reactos/dll/win32/rpcrt4/rpc_transport.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rpcrt4/rpc_transport.c [iso-8859-1] Sun Jun 4 14:01:54 2017 @@ -25,57 +25,14 @@ #include "precomp.h" -#if defined(__MINGW32__) || defined (_MSC_VER) -# include <ws2tcpip.h> -# ifndef EADDRINUSE -# define EADDRINUSE WSAEADDRINUSE -# endif -# ifndef EAGAIN -# define EAGAIN WSAEWOULDBLOCK -# endif -# undef errno -# define errno WSAGetLastError() -#else -# include <errno.h> -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif -# include <fcntl.h> -# ifdef HAVE_SYS_SOCKET_H -# include <sys/socket.h> -# endif -# ifdef HAVE_NETINET_IN_H -# include <netinet/in.h> -# endif -# ifdef HAVE_NETINET_TCP_H -# include <netinet/tcp.h> -# endif -# ifdef HAVE_ARPA_INET_H -# include <arpa/inet.h> -# endif -# ifdef HAVE_NETDB_H -# include <netdb.h> -# endif -# ifdef HAVE_SYS_POLL_H -# include <sys/poll.h> -# endif -# ifdef HAVE_SYS_FILIO_H -# include <sys/filio.h> -# endif -# ifdef HAVE_SYS_IOCTL_H -# include <sys/ioctl.h> -# endif -# define closesocket close -# define ioctlsocket ioctl -#endif /* defined(__MINGW32__) || defined (_MSC_VER) */ +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include <ws2tcpip.h> #include <wininet.h> +#include <winioctl.h> #include "epm_towers.h" - -#ifndef SOL_TCP -# define SOL_TCP IPPROTO_TCP -#endif #define DEFAULT_NCACN_HTTP_TIMEOUT (60 * 1000) @@ -84,78 +41,53 @@ WINE_DEFAULT_DEBUG_CHANNEL(rpc); -static RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* OldConnection); +#ifdef __REACTOS__ /* FIXME: Inspect */ +BOOL WINAPI CancelIoEx(HANDLE handle, LPOVERLAPPED lpOverlapped) +{ + IO_STATUS_BLOCK io_status; + + NtCancelIoFile(handle, &io_status); + if (io_status.u.Status) + { + SetLastError( RtlNtStatusToDosError( io_status.u.Status ) ); + return FALSE; + } + return TRUE; +} +#endif + +static RpcConnection *rpcrt4_spawn_connection(RpcConnection *old_connection); /**** ncacn_np support ****/ typedef struct _RpcConnection_np { - RpcConnection common; - HANDLE pipe; - OVERLAPPED ovl; - BOOL listening; + RpcConnection common; + HANDLE pipe; + HANDLE listen_event; + IO_STATUS_BLOCK io_status; + HANDLE event_cache; + BOOL read_closed; } RpcConnection_np; static RpcConnection *rpcrt4_conn_np_alloc(void) { RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_np)); - if (npc) - { - npc->pipe = NULL; - memset(&npc->ovl, 0, sizeof(npc->ovl)); - npc->listening = FALSE; - } return &npc->common; } -static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc) -{ - if (npc->listening) - return RPC_S_OK; - - npc->listening = TRUE; - for (;;) - { - if (ConnectNamedPipe(npc->pipe, &npc->ovl)) - return RPC_S_OK; - - switch(GetLastError()) - { - case ERROR_PIPE_CONNECTED: - SetEvent(npc->ovl.hEvent); - return RPC_S_OK; - case ERROR_IO_PENDING: - /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */ - return RPC_S_OK; - case ERROR_NO_DATA_DETECTED: - /* client has disconnected, retry */ - DisconnectNamedPipe( npc->pipe ); - break; - default: - npc->listening = FALSE; - WARN("Couldn't ConnectNamedPipe (error was %d)\n", GetLastError()); - return RPC_S_OUT_OF_RESOURCES; - } - } -} - -#ifndef __REACTOS__ -static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc) -{ - if (npc->listening) - return RPC_S_OK; - - npc->listening = TRUE; - npc->listen_thread = CreateThread(NULL, 0, listen_thread, npc, 0, NULL); - if (!npc->listen_thread) - { - npc->listening = FALSE; - ERR("Couldn't create listen thread (error was %d)\n", GetLastError()); - return RPC_S_OUT_OF_RESOURCES; - } - return RPC_S_OK; -} -#endif +static HANDLE get_np_event(RpcConnection_np *connection) +{ + HANDLE event = InterlockedExchangePointer(&connection->event_cache, NULL); + return event ? event : CreateEventW(NULL, TRUE, FALSE, NULL); +} + +static void release_np_event(RpcConnection_np *connection, HANDLE event) +{ + event = InterlockedExchangePointer(&connection->event_cache, event); + if (event) + CloseHandle(event); +} static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pname) { @@ -173,9 +105,6 @@ else return RPC_S_CANT_CREATE_ENDPOINT; } - - memset(&npc->ovl, 0, sizeof(npc->ovl)); - npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); /* Note: we don't call ConnectNamedPipe here because it must be done in the * server thread as the thread must be alertable */ @@ -217,15 +146,12 @@ dwFlags |= SECURITY_CONTEXT_TRACKING; } pipe = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL, - OPEN_EXISTING, dwFlags, 0); + OPEN_EXISTING, dwFlags | FILE_FLAG_OVERLAPPED, 0); if (pipe != INVALID_HANDLE_VALUE) break; err = GetLastError(); if (err == ERROR_PIPE_BUSY) { TRACE("connection failed, error=%x\n", err); return RPC_S_SERVER_TOO_BUSY; - } else if (err == ERROR_BAD_NETPATH) { - TRACE("connection failed, error=%x\n", err); - return RPC_S_SERVER_UNAVAILABLE; } if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { err = GetLastError(); @@ -235,11 +161,9 @@ } /* success */ - memset(&npc->ovl, 0, sizeof(npc->ovl)); /* pipe is connected; change to message-read mode. */ dwMode = PIPE_READMODE_MESSAGE; SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL); - npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); npc->pipe = pipe; return RPC_S_OK; @@ -301,8 +225,8 @@ I_RpcFree(pname); EnterCriticalSection(&protseq->cs); - Connection->Next = protseq->conn; - protseq->conn = Connection; + list_add_head(&protseq->listeners, &Connection->protseq_entry); + Connection->protseq = protseq; LeaveCriticalSection(&protseq->cs); return r; @@ -322,64 +246,15 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection) { RpcConnection_np *npc = (RpcConnection_np *) Connection; - static const char prefix[] = "\\\\"; - static const char local[] = "."; - BOOL bUseLocalName = TRUE; - CHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1]; - DWORD bufLen = sizeof(ComputerName)/sizeof(ComputerName[0]); RPC_STATUS r; LPSTR pname; - LPSTR NetworkAddr; - INT size; /* already connected? */ if (npc->pipe) return RPC_S_OK; - /* protseq=ncacn_np: named pipes */ - size = strlen(prefix); - - if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0) - { - bUseLocalName = TRUE; - size += strlen(local); - } - else - { - NetworkAddr = Connection->NetworkAddr; - if (NetworkAddr[0] == '\\' && NetworkAddr[1] == '\\') - NetworkAddr += 2; - - if (GetComputerNameA(ComputerName, &bufLen)) - { - if (stricmp(ComputerName, NetworkAddr) == 0) - { - bUseLocalName = TRUE; - size += strlen(local); - } - else - { - bUseLocalName = FALSE; - size += strlen(NetworkAddr); - } - } - else - { - bUseLocalName = FALSE; - size += strlen(NetworkAddr); - } - } - - size += strlen(Connection->Endpoint) + 1; - - pname = I_RpcAllocate(size); - strcpy(pname, prefix); - if (bUseLocalName) - strcat(pname, local); - else - strcat(pname, NetworkAddr); - strcat(pname, Connection->Endpoint); - r = rpcrt4_conn_open_pipe(Connection, pname, TRUE); + pname = ncacn_pipe_name(Connection->Endpoint); + r = rpcrt4_conn_open_pipe(Connection, pname, FALSE); I_RpcFree(pname); return r; @@ -412,8 +287,8 @@ I_RpcFree(pname); EnterCriticalSection(&protseq->cs); - Connection->Next = protseq->conn; - protseq->conn = Connection; + list_add_head(&protseq->listeners, &Connection->protseq_entry); + Connection->protseq = protseq; LeaveCriticalSection(&protseq->cs); return r; @@ -421,14 +296,12 @@ static void rpcrt4_conn_np_handoff(RpcConnection_np *old_npc, RpcConnection_np *new_npc) { - /* because of the way named pipes work, we'll transfer the connected pipe - * to the child, then reopen the server binding to continue listening */ - - new_npc->pipe = old_npc->pipe; - new_npc->ovl = old_npc->ovl; - old_npc->pipe = 0; - memset(&old_npc->ovl, 0, sizeof(old_npc->ovl)); - old_npc->listening = FALSE; + /* because of the way named pipes work, we'll transfer the connected pipe + * to the child, then reopen the server binding to continue listening */ + + new_npc->pipe = old_npc->pipe; + old_npc->pipe = 0; + assert(!old_npc->listen_event); } static RPC_STATUS rpcrt4_ncacn_np_handoff(RpcConnection *old_conn, RpcConnection *new_conn) @@ -507,80 +380,103 @@ return status; } -static int rpcrt4_conn_np_read(RpcConnection *Connection, - void *buffer, unsigned int count) -{ - RpcConnection_np *npc = (RpcConnection_np *) Connection; - char *buf = buffer; - BOOL ret = TRUE; - unsigned int bytes_left = count; - OVERLAPPED ovl; - - ZeroMemory(&ovl, sizeof(ovl)); - ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - - while (bytes_left) - { - DWORD bytes_read; - ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &ovl); - if (!ret && GetLastError() == ERROR_IO_PENDING) - ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_read, TRUE); - if (!ret && GetLastError() == ERROR_MORE_DATA) - ret = TRUE; - if (!ret || !bytes_read) - break; - bytes_left -= bytes_read; - buf += bytes_read; - } - CloseHandle(ovl.hEvent); - return ret ? count : -1; -} - -static int rpcrt4_conn_np_write(RpcConnection *Connection, - const void *buffer, unsigned int count) -{ - RpcConnection_np *npc = (RpcConnection_np *) Connection; - const char *buf = buffer; - BOOL ret = TRUE; - unsigned int bytes_left = count; - OVERLAPPED ovl; - - ZeroMemory(&ovl, sizeof(ovl)); - ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - - while (bytes_left) - { - DWORD bytes_written; - ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &ovl); - if (!ret && GetLastError() == ERROR_IO_PENDING) - ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_written, TRUE); - if (!ret || !bytes_written) - break; - bytes_left -= bytes_written; - buf += bytes_written; - } - CloseHandle(ovl.hEvent); - return ret ? count : -1; -} - -static int rpcrt4_conn_np_close(RpcConnection *Connection) -{ - RpcConnection_np *npc = (RpcConnection_np *) Connection; - if (npc->pipe) { - FlushFileBuffers(npc->pipe); - CloseHandle(npc->pipe); - npc->pipe = 0; - } - if (npc->ovl.hEvent) { - CloseHandle(npc->ovl.hEvent); - npc->ovl.hEvent = 0; - } - return 0; -} - -static void rpcrt4_conn_np_cancel_call(RpcConnection *Connection) -{ - /* FIXME: implement when named pipe writes use overlapped I/O */ +static int rpcrt4_conn_np_read(RpcConnection *conn, void *buffer, unsigned int count) +{ + RpcConnection_np *connection = (RpcConnection_np *) conn; + HANDLE event; + NTSTATUS status; + + event = get_np_event(connection); + if (!event) + return -1; + + if (connection->read_closed) + status = STATUS_CANCELLED; + else + status = NtReadFile(connection->pipe, event, NULL, NULL, &connection->io_status, buffer, count, NULL, NULL); + if (status == STATUS_PENDING) + { + /* check read_closed again before waiting to avoid a race */ + if (connection->read_closed) + { + IO_STATUS_BLOCK io_status; +#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */ + NtCancelIoFile(connection->pipe, &io_status); +#else + NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status); +#endif + } + WaitForSingleObject(event, INFINITE); + status = connection->io_status.u.Status; + } + release_np_event(connection, event); + return status && status != STATUS_BUFFER_OVERFLOW ? -1 : connection->io_status.Information; +} + +static int rpcrt4_conn_np_write(RpcConnection *conn, const void *buffer, unsigned int count) +{ + RpcConnection_np *connection = (RpcConnection_np *) conn; + IO_STATUS_BLOCK io_status; + HANDLE event; + NTSTATUS status; + + event = get_np_event(connection); + if (!event) + return -1; + + status = NtWriteFile(connection->pipe, event, NULL, NULL, &io_status, buffer, count, NULL, NULL); + if (status == STATUS_PENDING) + { + WaitForSingleObject(event, INFINITE); + status = io_status.u.Status; + } + release_np_event(connection, event); + if (status) + return -1; + + assert(io_status.Information == count); + return count; +} + +static int rpcrt4_conn_np_close(RpcConnection *conn) +{ + RpcConnection_np *connection = (RpcConnection_np *) conn; + if (connection->pipe) + { + FlushFileBuffers(connection->pipe); + CloseHandle(connection->pipe); + connection->pipe = 0; + } + if (connection->listen_event) + { + CloseHandle(connection->listen_event); + connection->listen_event = 0; + } + if (connection->event_cache) + { + CloseHandle(connection->event_cache); + connection->event_cache = 0; + } + return 0; +} + +static void rpcrt4_conn_np_close_read(RpcConnection *conn) +{ + RpcConnection_np *connection = (RpcConnection_np*)conn; + IO_STATUS_BLOCK io_status; + + connection->read_closed = TRUE; +#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */ + NtCancelIoFile(connection->pipe, &io_status); +#else + NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status); +#endif +} + +static void rpcrt4_conn_np_cancel_call(RpcConnection *conn) +{ + RpcConnection_np *connection = (RpcConnection_np *)conn; + CancelIoEx(connection->pipe, NULL); } static int rpcrt4_conn_np_wait_for_incoming_data(RpcConnection *Connection) @@ -752,7 +648,7 @@ static RpcServerProtseq *rpcrt4_protseq_np_alloc(void) { - RpcServerProtseq_np *ps = HeapAlloc(GetProcessHeap(), 0, sizeof(*ps)); + RpcServerProtseq_np *ps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ps)); if (ps) ps->mgr_event = CreateEventW(NULL, FALSE, FALSE, NULL); return &ps->common; @@ -774,12 +670,35 @@ /* open and count connections */ *count = 1; - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); - while (conn) { - rpcrt4_conn_listen_pipe(conn); - if (conn->ovl.hEvent) - (*count)++; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); + LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_np, common.protseq_entry) + { + if (!conn->listen_event) + { + NTSTATUS status; + HANDLE event; + + event = get_np_event(conn); + if (!event) + continue; + + status = NtFsControlFile(conn->pipe, event, NULL, NULL, &conn->io_status, FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0); + switch (status) + { + case STATUS_SUCCESS: + case STATUS_PIPE_CONNECTED: + conn->io_status.u.Status = status; + SetEvent(event); + break; + case STATUS_PENDING: + break; + default: + ERR("pipe listen error %x\n", status); + continue; + } + + conn->listen_event = event; + } + (*count)++; } /* make array of connections */ @@ -796,11 +715,10 @@ objs[0] = npps->mgr_event; *count = 1; - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); - while (conn) { - if ((objs[*count] = conn->ovl.hEvent)) - (*count)++; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); + LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_np, common.protseq_entry) + { + if (conn->listen_event) + objs[(*count)++] = conn->listen_event; } LeaveCriticalSection(&protseq->cs); return objs; @@ -816,7 +734,7 @@ HANDLE b_handle; HANDLE *objs = wait_array; DWORD res; - RpcConnection *cconn; + RpcConnection *cconn = NULL; RpcConnection_np *conn; if (!objs) @@ -843,23 +761,27 @@ b_handle = objs[res - WAIT_OBJECT_0]; /* find which connection got a RPC */ EnterCriticalSection(&protseq->cs); - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); - while (conn) { - if (b_handle == conn->ovl.hEvent) break; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); - } - cconn = NULL; - if (conn) - RPCRT4_SpawnConnection(&cconn, &conn->common); - else + LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_np, common.protseq_entry) + { + if (b_handle == conn->listen_event) + { + release_np_event(conn, conn->listen_event); + conn->listen_event = NULL; + if (conn->io_status.u.Status == STATUS_SUCCESS || conn->io_status.u.Status == STATUS_PIPE_CONNECTED) + cconn = rpcrt4_spawn_connection(&conn->common); + else + ERR("listen failed %x\n", conn->io_status.u.Status); + break; + } + } + LeaveCriticalSection(&protseq->cs); + if (!cconn) + { ERR("failed to locate connection for handle %p\n", b_handle); - LeaveCriticalSection(&protseq->cs); - if (cconn) - { - RPCRT4_new_client(cconn); - return 1; - } - else return -1; + return -1; + } + RPCRT4_new_client(cconn); + return 1; } } @@ -1111,7 +1033,7 @@ in_addr.s_addr = ipv4_floor->ipv4addr; if (!inet_ntop(AF_INET, &in_addr, *networkaddr, INET_ADDRSTRLEN)) { - ERR("inet_ntop: %s\n", strerror(errno)); + ERR("inet_ntop: %u\n", WSAGetLastError()); I_RpcFree(*networkaddr); *networkaddr = NULL; if (endpoint) @@ -1130,74 +1052,9 @@ { RpcConnection common; int sock; -#ifdef HAVE_SOCKETPAIR - int cancel_fds[2]; -#else HANDLE sock_event; HANDLE cancel_event; -#endif } RpcConnection_tcp; - -#ifdef HAVE_SOCKETPAIR - -static BOOL rpcrt4_sock_wait_init(RpcConnection_tcp *tcpc) -{ - if (socketpair(PF_UNIX, SOCK_STREAM, 0, tcpc->cancel_fds) < 0) - { - ERR("socketpair() failed: %s\n", strerror(errno)); - return FALSE; - } - return TRUE; -} - -static BOOL rpcrt4_sock_wait_for_recv(RpcConnection_tcp *tcpc) -{ - struct pollfd pfds[2]; - pfds[0].fd = tcpc->sock; - pfds[0].events = POLLIN; - pfds[1].fd = tcpc->cancel_fds[0]; - pfds[1].events = POLLIN; - if (poll(pfds, 2, -1 /* infinite */) == -1 && errno != EINTR) - { - ERR("poll() failed: %s\n", strerror(errno)); - return FALSE; - } - if (pfds[1].revents & POLLIN) /* canceled */ - { - char dummy; - read(pfds[1].fd, &dummy, sizeof(dummy)); - return FALSE; - } - return TRUE; -} - -static BOOL rpcrt4_sock_wait_for_send(RpcConnection_tcp *tcpc) -{ - struct pollfd pfd; - pfd.fd = tcpc->sock; - pfd.events = POLLOUT; - if (poll(&pfd, 1, -1 /* infinite */) == -1 && errno != EINTR) - { - ERR("poll() failed: %s\n", strerror(errno)); - return FALSE; - } - return TRUE; -} - -static void rpcrt4_sock_wait_cancel(RpcConnection_tcp *tcpc) -{ - char dummy = 1; - - write(tcpc->cancel_fds[1], &dummy, 1); -} - -static void rpcrt4_sock_wait_destroy(RpcConnection_tcp *tcpc) -{ - close(tcpc->cancel_fds[0]); - close(tcpc->cancel_fds[1]); -} - -#else /* HAVE_SOCKETPAIR */ static BOOL rpcrt4_sock_wait_init(RpcConnection_tcp *tcpc) { @@ -1264,23 +1121,10 @@ } } -static void rpcrt4_sock_wait_cancel(RpcConnection_tcp *tcpc) -{ - SetEvent(tcpc->cancel_event); -} - -static void rpcrt4_sock_wait_destroy(RpcConnection_tcp *tcpc) -{ - CloseHandle(tcpc->sock_event); - CloseHandle(tcpc->cancel_event); -} - -#endif - static RpcConnection *rpcrt4_conn_tcp_alloc(void) { RpcConnection_tcp *tcpc; - tcpc = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcConnection_tcp)); + tcpc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_tcp)); if (tcpc == NULL) return NULL; tcpc->sock = -1; @@ -1347,20 +1191,20 @@ sock = socket(ai_cur->ai_family, ai_cur->ai_socktype, ai_cur->ai_protocol); if (sock == -1) { - WARN("socket() failed: %s\n", strerror(errno)); + WARN("socket() failed: %u\n", WSAGetLastError()); continue; } if (0>connect(sock, ai_cur->ai_addr, ai_cur->ai_addrlen)) { - WARN("connect() failed: %s\n", strerror(errno)); + WARN("connect() failed: %u\n", WSAGetLastError()); closesocket(sock); continue; } /* RPC depends on having minimal latency so disable the Nagle algorithm */ val = 1; - setsockopt(sock, SOL_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); + setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); nonblocking = 1; ioctlsocket(sock, FIONBIO, &nonblocking); @@ -1384,7 +1228,6 @@ struct addrinfo *ai; struct addrinfo *ai_cur; struct addrinfo hints; - RpcConnection *first_connection = NULL; TRACE("(%p, %s)\n", protseq, endpoint); @@ -1434,7 +1277,7 @@ sock = socket(ai_cur->ai_family, ai_cur->ai_socktype, ai_cur->ai_protocol); if (sock == -1) { - WARN("socket() failed: %s\n", strerror(errno)); + WARN("socket() failed: %u\n", WSAGetLastError()); status = RPC_S_CANT_CREATE_ENDPOINT; continue; } @@ -1442,9 +1285,9 @@ ret = bind(sock, ai_cur->ai_addr, ai_cur->ai_addrlen); if (ret < 0) { - WARN("bind failed: %s\n", strerror(errno)); + WARN("bind failed: %u\n", WSAGetLastError()); closesocket(sock); - if (errno == EADDRINUSE) + if (WSAGetLastError() == WSAEADDRINUSE) status = RPC_S_DUPLICATE_ENDPOINT; else status = RPC_S_CANT_CREATE_ENDPOINT; @@ -1454,7 +1297,7 @@ sa_len = sizeof(sa); if (getsockname(sock, (struct sockaddr *)&sa, &sa_len)) { - WARN("getsockname() failed: %s\n", strerror(errno)); + WARN("getsockname() failed: %u\n", WSAGetLastError()); closesocket(sock); status = RPC_S_CANT_CREATE_ENDPOINT; continue; @@ -1485,7 +1328,7 @@ ret = listen(sock, protseq->MaxCalls); if (ret < 0) { - WARN("listen failed: %s\n", strerror(errno)); + WARN("listen failed: %u\n", WSAGetLastError()); RPCRT4_ReleaseConnection(&tcpc->common); status = RPC_S_OUT_OF_RESOURCES; continue; @@ -1504,35 +1347,20 @@ continue; } - tcpc->common.Next = first_connection; - first_connection = &tcpc->common; + EnterCriticalSection(&protseq->cs); + list_add_tail(&protseq->listeners, &tcpc->common.protseq_entry); + tcpc->common.protseq = protseq; + LeaveCriticalSection(&protseq->cs); + + freeaddrinfo(ai); /* since IPv4 and IPv6 share the same port space, we only need one * successful bind to listen for both */ - break; - } - - freeaddrinfo(ai); - - /* if at least one connection was created for an endpoint then - * return success */ - if (first_connection) - { - RpcConnection *conn; - - /* find last element in list */ - for (conn = first_connection; conn->Next; conn = conn->Next) - ; - - EnterCriticalSection(&protseq->cs); - conn->Next = protseq->conn; - protseq->conn = first_connection; - LeaveCriticalSection(&protseq->cs); - TRACE("listening on %s\n", endpoint); return RPC_S_OK; } + freeaddrinfo(ai); ERR("couldn't listen on port %s\n", endpoint); return status; } @@ -1582,11 +1410,11 @@ return -1; else if (r > 0) bytes_read += r; - else if (errno == EINTR) + else if (WSAGetLastError() == WSAEINTR) continue; - else if (errno != EAGAIN) - { - WARN("recv() failed: %s\n", strerror(errno)); + else if (WSAGetLastError() != WSAEWOULDBLOCK) + { + WARN("recv() failed: %u\n", WSAGetLastError()); return -1; } else @@ -1609,9 +1437,9 @@ int r = send(tcpc->sock, (const char *)buffer + bytes_written, count - bytes_written, 0); if (r >= 0) bytes_written += r; - else if (errno == EINTR) + else if (WSAGetLastError() == WSAEINTR) continue; - else if (errno != EAGAIN) + else if (WSAGetLastError() != WSAEWOULDBLOCK) return -1; else { @@ -1623,24 +1451,33 @@ return bytes_written; } -static int rpcrt4_conn_tcp_close(RpcConnection *Connection) -{ - RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection; - - TRACE("%d\n", tcpc->sock); - - if (tcpc->sock != -1) - closesocket(tcpc->sock); - tcpc->sock = -1; - rpcrt4_sock_wait_destroy(tcpc); - return 0; -} - -static void rpcrt4_conn_tcp_cancel_call(RpcConnection *Connection) -{ - RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection; - TRACE("%p\n", Connection); - rpcrt4_sock_wait_cancel(tcpc); +static int rpcrt4_conn_tcp_close(RpcConnection *conn) +{ + RpcConnection_tcp *connection = (RpcConnection_tcp *) conn; + + TRACE("%d\n", connection->sock); + + if (connection->sock != -1) + closesocket(connection->sock); + connection->sock = -1; + CloseHandle(connection->sock_event); + CloseHandle(connection->cancel_event); + return 0; +} + +static void rpcrt4_conn_tcp_close_read(RpcConnection *conn) +{ + RpcConnection_tcp *connection = (RpcConnection_tcp *) conn; + shutdown(connection->sock, SD_RECEIVE); +} + +static void rpcrt4_conn_tcp_cancel_call(RpcConnection *conn) +{ + RpcConnection_tcp *connection = (RpcConnection_tcp *) conn; + + TRACE("%p\n", connection); + + SetEvent(connection->cancel_event); } static RPC_STATUS rpcrt4_conn_tcp_is_server_listening(const char *endpoint) @@ -1668,149 +1505,6 @@ EPM_PROTOCOL_TCP, endpoint); } -#ifdef HAVE_SOCKETPAIR - -typedef struct _RpcServerProtseq_sock -{ - RpcServerProtseq common; - int mgr_event_rcv; - int mgr_event_snd; -} RpcServerProtseq_sock; - -static RpcServerProtseq *rpcrt4_protseq_sock_alloc(void) -{ - RpcServerProtseq_sock *ps = HeapAlloc(GetProcessHeap(), 0, sizeof(*ps)); - if (ps) - { - int fds[2]; - if (!socketpair(PF_UNIX, SOCK_DGRAM, 0, fds)) - { - fcntl(fds[0], F_SETFL, O_NONBLOCK); - fcntl(fds[1], F_SETFL, O_NONBLOCK); - ps->mgr_event_rcv = fds[0]; - ps->mgr_event_snd = fds[1]; - } - else - { - ERR("socketpair failed with error %s\n", strerror(errno)); - HeapFree(GetProcessHeap(), 0, ps); - return NULL; - } - } - return &ps->common; -} - -static void rpcrt4_protseq_sock_signal_state_changed(RpcServerProtseq *protseq) -{ - RpcServerProtseq_sock *sockps = CONTAINING_RECORD(protseq, RpcServerProtseq_sock, common); - char dummy = 1; - write(sockps->mgr_event_snd, &dummy, sizeof(dummy)); -} - -static void *rpcrt4_protseq_sock_get_wait_array(RpcServerProtseq *protseq, void *prev_array, unsigned int *count) -{ - struct pollfd *poll_info = prev_array; - RpcConnection_tcp *conn; - RpcServerProtseq_sock *sockps = CONTAINING_RECORD(protseq, RpcServerProtseq_sock, common); - - EnterCriticalSection(&protseq->cs); - - /* open and count connections */ - *count = 1; - conn = (RpcConnection_tcp *)protseq->conn; - while (conn) { - if (conn->sock != -1) - (*count)++; - conn = (RpcConnection_tcp *)conn->common.Next; - } - - /* make array of connections */ - if (poll_info) - poll_info = HeapReAlloc(GetProcessHeap(), 0, poll_info, *count*sizeof(*poll_info)); - else - poll_info = HeapAlloc(GetProcessHeap(), 0, *count*sizeof(*poll_info)); - if (!poll_info) - { - ERR("couldn't allocate poll_info\n"); - LeaveCriticalSection(&protseq->cs); - return NULL; - } - - poll_info[0].fd = sockps->mgr_event_rcv; - poll_info[0].events = POLLIN; - *count = 1; - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_tcp, common); - while (conn) { - if (conn->sock != -1) - { - poll_info[*count].fd = conn->sock; - poll_info[*count].events = POLLIN; - (*count)++; - } - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_tcp, common); - } - LeaveCriticalSection(&protseq->cs); - return poll_info; -} - -static void rpcrt4_protseq_sock_free_wait_array(RpcServerProtseq *protseq, void *array) -{ - HeapFree(GetProcessHeap(), 0, array); -} - -static int rpcrt4_protseq_sock_wait_for_new_connection(RpcServerProtseq *protseq, unsigned int count, void *wait_array) -{ - struct pollfd *poll_info = wait_array; - int ret; - unsigned int i; - RpcConnection *cconn; - RpcConnection_tcp *conn; - - if (!poll_info) - return -1; - - ret = poll(poll_info, count, -1); - if (ret < 0) - { - ERR("poll failed with error %d\n", ret); - return -1; - } - - for (i = 0; i < count; i++) - if (poll_info[i].revents & POLLIN) - { - /* RPC server event */ - if (i == 0) - { - char dummy; - read(poll_info[0].fd, &dummy, sizeof(dummy)); - return 0; - } - - /* find which connection got a RPC */ - EnterCriticalSection(&protseq->cs); - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_tcp, common); - while (conn) { - if (poll_info[i].fd == conn->sock) break; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_tcp, common); - } - cconn = NULL; - if (conn) - RPCRT4_SpawnConnection(&cconn, &conn->common); - else - ERR("failed to locate connection for fd %d\n", poll_info[i].fd); - LeaveCriticalSection(&protseq->cs); - if (cconn) - RPCRT4_new_client(cconn); - else - return -1; - } - - return 1; -} - -#else /* HAVE_SOCKETPAIR */ - typedef struct _RpcServerProtseq_sock { RpcServerProtseq common; @@ -1819,7 +1513,7 @@ static RpcServerProtseq *rpcrt4_protseq_sock_alloc(void) { - RpcServerProtseq_sock *ps = HeapAlloc(GetProcessHeap(), 0, sizeof(*ps)); + RpcServerProtseq_sock *ps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ps)); if (ps) { static BOOL wsa_inited; @@ -1852,12 +1546,10 @@ /* open and count connections */ *count = 1; - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_tcp, common); - while (conn) + LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_tcp, common.protseq_entry) { if (conn->sock != -1) (*count)++; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_tcp, common); } /* make array of connections */ @@ -1874,8 +1566,7 @@ objs[0] = sockps->mgr_event; *count = 1; - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_tcp, common); - while (conn) + LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_tcp, common.protseq_entry) { if (conn->sock != -1) { @@ -1888,7 +1579,6 @@ (*count)++; } } - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_tcp, common); } LeaveCriticalSection(&protseq->cs); return objs; @@ -1904,7 +1594,7 @@ HANDLE b_handle; HANDLE *objs = wait_array; DWORD res; - RpcConnection *cconn; + RpcConnection *cconn = NULL; RpcConnection_tcp *conn; if (!objs) @@ -1921,38 +1611,34 @@ if (res == WAIT_OBJECT_0) return 0; - else if (res == WAIT_FAILED) + if (res == WAIT_FAILED) { ERR("wait failed with error %d\n", GetLastError()); return -1; } - else - { - b_handle = objs[res - WAIT_OBJECT_0]; - /* find which connection got a RPC */ - EnterCriticalSection(&protseq->cs); - conn = CONTAINING_RECORD(protseq->conn, RpcConnection_tcp, common); - while (conn) - { - if (b_handle == conn->sock_event) break; - conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_tcp, common); - } - cconn = NULL; - if (conn) - RPCRT4_SpawnConnection(&cconn, &conn->common); - else - ERR("failed to locate connection for handle %p\n", b_handle); - LeaveCriticalSection(&protseq->cs); - if (cconn) - { - RPCRT4_new_client(cconn); - return 1; - } - else return -1; - } -} - -#endif /* HAVE_SOCKETPAIR */ + + b_handle = objs[res - WAIT_OBJECT_0]; + + /* find which connection got a RPC */ + EnterCriticalSection(&protseq->cs); + LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_tcp, common.protseq_entry) + { + if (b_handle == conn->sock_event) + { + cconn = rpcrt4_spawn_connection(&conn->common); + break; + } + } + LeaveCriticalSection(&protseq->cs); + if (!cconn) + { + ERR("failed to locate connection for handle %p\n", b_handle); + return -1; + } + + RPCRT4_new_client(cconn); + return 1; +} static RPC_STATUS rpcrt4_ncacn_ip_tcp_parse_top_of_tower(const unsigned char *tower_data, size_t tower_size, @@ -2085,7 +1771,6 @@ httpc->cancel_event = CreateEventW(NULL, FALSE, FALSE, NULL); httpc->async_data->refs = 1; httpc->async_data->inet_buffers.dwStructSize = sizeof(INTERNET_BUFFERSW); - httpc->async_data->inet_buffers.lpvBuffer = NULL; InitializeCriticalSection(&httpc->async_data->cs); httpc->async_data->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcHttpAsyncData.cs"); return &httpc->common; @@ -3411,6 +3096,11 @@ return 0; } +static void rpcrt4_ncacn_http_close_read(RpcConnection *conn) +{ + rpcrt4_ncacn_http_close(conn); /* FIXME */ +} + static void rpcrt4_ncacn_http_cancel_call(RpcConnection *Connection) { RpcConnection_http *httpc = (RpcConnection_http *) Connection; @@ -3464,6 +3154,7 @@ rpcrt4_conn_np_read, rpcrt4_conn_np_write, rpcrt4_conn_np_close, + rpcrt4_conn_np_close_read, rpcrt4_conn_np_cancel_call, rpcrt4_ncacn_np_is_server_listening, rpcrt4_conn_np_wait_for_incoming_data, @@ -3485,6 +3176,7 @@ rpcrt4_conn_np_read, rpcrt4_conn_np_write, rpcrt4_conn_np_close, + rpcrt4_conn_np_close_read, rpcrt4_conn_np_cancel_call, rpcrt4_ncalrpc_np_is_server_listening, rpcrt4_conn_np_wait_for_incoming_data, @@ -3506,6 +3198,7 @@ rpcrt4_conn_tcp_read, rpcrt4_conn_tcp_write, rpcrt4_conn_tcp_close, + rpcrt4_conn_tcp_close_read, rpcrt4_conn_tcp_cancel_call, rpcrt4_conn_tcp_is_server_listening, rpcrt4_conn_tcp_wait_for_incoming_data, @@ -3527,6 +3220,7 @@ rpcrt4_ncacn_http_read, rpcrt4_ncacn_http_write, rpcrt4_ncacn_http_close, + rpcrt4_ncacn_http_close_read, rpcrt4_ncacn_http_cancel_call, rpcrt4_ncacn_http_is_server_listening, rpcrt4_ncacn_http_wait_for_incoming_data, @@ -3631,8 +3325,6 @@ NewConnection = ops->alloc(); NewConnection->ref = 1; - NewConnection->Next = NULL; - NewConnection->server_binding = NULL; NewConnection->server = server; NewConnection->ops = ops; NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr); @@ -3640,22 +3332,17 @@ NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions); NewConnection->CookieAuth = RPCRT4_strdupW(CookieAuth); NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE; - memset(&NewConnection->ActiveInterface, 0, sizeof(NewConnection->ActiveInterface)); NewConnection->NextCallId = 1; SecInvalidateHandle(&NewConnection->ctx); - memset(&NewConnection->exp, 0, sizeof(NewConnection->exp)); - NewConnection->attr = 0; if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo); NewConnection->AuthInfo = AuthInfo; NewConnection->auth_context_id = InterlockedIncrement( &next_id ); - NewConnection->encryption_auth_len = 0; - NewConnection->signature_auth_len = 0; if (QOS) RpcQualityOfService_AddRef(QOS); NewConnection->QOS = QOS; list_init(&NewConnection->conn_pool_entry); - NewConnection->async_state = NULL; + list_init(&NewConnection->protseq_entry); TRACE("connection: %p\n", NewConnection); *Connection = NewConnection; @@ -3663,16 +3350,26 @@ return RPC_S_OK; } -static RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* OldConnection) -{ - RPC_STATUS err; - - err = RPCRT4_CreateConnection(Connection, OldConnection->server, rpcrt4_conn_get_name(OldConnection), - OldConnection->NetworkAddr, OldConnection->Endpoint, NULL, - OldConnection->AuthInfo, OldConnection->QOS, OldConnection->CookieAuth); - if (err == RPC_S_OK) - rpcrt4_conn_handoff(OldConnection, *Connection); - return err; +static RpcConnection *rpcrt4_spawn_connection(RpcConnection *old_connection) +{ + RpcConnection *connection; + RPC_STATUS err; + + err = RPCRT4_CreateConnection(&connection, old_connection->server, rpcrt4_conn_get_name(old_connection), + old_connection->NetworkAddr, old_connection->Endpoint, NULL, + old_connection->AuthInfo, old_connection->QOS, old_connection->CookieAuth); + if (err != RPC_S_OK) + return NULL; + + rpcrt4_conn_handoff(old_connection, connection); + if (old_connection->protseq) + { + EnterCriticalSection(&old_connection->protseq->cs); + connection->protseq = old_connection->protseq; + list_add_tail(&old_connection->protseq->connections, &connection->protseq_entry); + LeaveCriticalSection(&old_connection->protseq->cs); + } + return connection; } RpcConnection *RPCRT4_GrabConnection( RpcConnection *conn ) @@ -3697,6 +3394,13 @@ /* server-only */ if (Connection->server_binding) RPCRT4_ReleaseBinding(Connection->server_binding); + + if (Connection->protseq) + { + EnterCriticalSection(&Connection->protseq->cs); + list_remove(&Connection->protseq_entry); + LeaveCriticalSection(&Connection->protseq->cs); + } HeapFree(GetProcessHeap(), 0, Connection); return RPC_S_OK; Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 4 14:01:54 2017 @@ -160,7 +160,7 @@ reactos/dll/win32/resutils # Synced to WineStaging-1.9.11 reactos/dll/win32/riched20 # Synced to WineStaging-2.9 reactos/dll/win32/riched32 # Synced to WineStaging-1.9.11 -reactos/dll/win32/rpcrt4 # Synced to WineStaging-2.2 +reactos/dll/win32/rpcrt4 # Synced to WineStaging-2.9 reactos/dll/win32/rsabase # Synced to WineStaging-1.9.11 reactos/dll/win32/rsaenh # Synced to WineStaging-2.9 reactos/dll/win32/sccbase # Synced to WineStaging-1.9.11
7 years, 10 months
1
0
0
0
[akhaldi] 74903: [COMCTL32_WINETEST] Sync with Wine Staging 2.9. CORE-13362
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 12:53:30 2017 New Revision: 74903 URL:
http://svn.reactos.org/svn/reactos?rev=74903&view=rev
Log: [COMCTL32_WINETEST] Sync with Wine Staging 2.9. CORE-13362 Added: trunk/rostests/winetests/comctl32/taskdialog.c (with props) Modified: trunk/rostests/winetests/comctl32/CMakeLists.txt trunk/rostests/winetests/comctl32/animate.c trunk/rostests/winetests/comctl32/button.c trunk/rostests/winetests/comctl32/comboex.c trunk/rostests/winetests/comctl32/datetime.c trunk/rostests/winetests/comctl32/header.c trunk/rostests/winetests/comctl32/imagelist.c trunk/rostests/winetests/comctl32/listview.c trunk/rostests/winetests/comctl32/misc.c trunk/rostests/winetests/comctl32/monthcal.c trunk/rostests/winetests/comctl32/msg.h trunk/rostests/winetests/comctl32/pager.c trunk/rostests/winetests/comctl32/propsheet.c trunk/rostests/winetests/comctl32/syslink.c trunk/rostests/winetests/comctl32/tab.c trunk/rostests/winetests/comctl32/testlist.c trunk/rostests/winetests/comctl32/toolbar.c trunk/rostests/winetests/comctl32/trackbar.c trunk/rostests/winetests/comctl32/treeview.c trunk/rostests/winetests/comctl32/updown.c Modified: trunk/rostests/winetests/comctl32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/CMakeL…
============================================================================== --- trunk/rostests/winetests/comctl32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/CMakeLists.txt [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -24,6 +24,7 @@ subclass.c syslink.c tab.c + taskdialog.c toolbar.c tooltips.c trackbar.c Modified: trunk/rostests/winetests/comctl32/animate.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/animat…
============================================================================== --- trunk/rostests/winetests/comctl32/animate.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/animate.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -160,8 +160,9 @@ SetLastError(0xdeadbeef); res = SendMessageA(hAnimateWnd, ACM_PLAY, (WPARAM) -1, MAKELONG(0, -1)); + err = GetLastError(); ok(res == 0, "Play should have failed\n"); - ok(err == ERROR_RESOURCE_NAME_NOT_FOUND, "Expected 1814, got %u\n", err); + ok(err == 0xdeadbeef, "Expected 0xdeadbeef, got %u\n", err); destroy_animate(); create_animate(0, 0); Modified: trunk/rostests/winetests/comctl32/button.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/button…
============================================================================== --- trunk/rostests/winetests/comctl32/button.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/button.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -124,8 +124,8 @@ static LRESULT CALLBACK button_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, UINT_PTR id, DWORD_PTR ref_data) { static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; if (ignore_message( message )) return pDefSubclassProc(hwnd, message, wParam, lParam); @@ -160,8 +160,8 @@ { static LONG defwndproc_counter = 0; static LONG beginpaint_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; if (ignore_message( message )) return 0; @@ -171,17 +171,6 @@ message == WM_DRAWITEM || message == WM_COMMAND || message == WM_IME_SETCONTEXT) { - switch (message) - { - /* ignore */ - case WM_NCHITTEST: - return HTCLIENT; - case WM_SETCURSOR: - case WM_MOUSEMOVE: - case WM_NCMOUSEMOVE: - return 0; - } - msg.message = message; msg.flags = sent|parent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; Modified: trunk/rostests/winetests/comctl32/comboex.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/comboe…
============================================================================== --- trunk/rostests/winetests/comctl32/comboex.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/comboex.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -90,8 +90,8 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; Modified: trunk/rostests/winetests/comctl32/datetime.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/dateti…
============================================================================== --- trunk/rostests/winetests/comctl32/datetime.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/datetime.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -142,15 +142,14 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, DATETIME_SEQ_INDEX, &msg); defwndproc_counter++; Modified: trunk/rostests/winetests/comctl32/header.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/header…
============================================================================== --- trunk/rostests/winetests/comctl32/header.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/header.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -394,7 +394,7 @@ static char *str_items[] = {pszFirstItem, pszSecondItem, pszThirdItem, pszFourthItem, pszReplaceItem, pszOutOfRangeItem}; - + static char pszUniTestA[] = "TST"; static WCHAR pszUniTestW[] = {'T','S','T',0}; @@ -414,15 +414,14 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, HEADER_SEQ_INDEX, &msg); defwndproc_counter++; @@ -1572,7 +1571,6 @@ { hdi.lParam = i; SendMessageA(hWndHeader, HDM_INSERTITEMA, rand1[i], (LPARAM)&hdi); - rand(); } check_order(ids1, ord1, 5, "insert without iOrder"); @@ -1582,7 +1580,6 @@ hdi.lParam = i + 5; hdi.iOrder = rand2[i]; SendMessageA(hWndHeader, HDM_INSERTITEMA, rand3[i], (LPARAM)&hdi); - rand(); rand(); } check_order(ids2, ord2, 10, "insert with order"); @@ -1591,7 +1588,6 @@ { hdi.iOrder = rand5[i]; SendMessageA(hWndHeader, HDM_SETITEMA, rand4[i], (LPARAM)&hdi); - rand(); rand(); } check_order(ids2, ord3, 10, "setitems changing order"); Modified: trunk/rostests/winetests/comctl32/imagelist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/imagel…
============================================================================== --- trunk/rostests/winetests/comctl32/imagelist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/imagelist.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -922,36 +922,34 @@ char *data; HRESULT hr; - trace("%s\n", comment); - ret = ImageList_GetImageCount(himl); - ok(ret == cur, "expected image count %d got %d\n", cur, ret); + ok(ret == cur, "%s: expected image count %d got %d\n", comment, cur, ret); ret = ImageList_GetIconSize(himl, &cxx, &cyy); ok(ret, "ImageList_GetIconSize failed\n"); - ok(cxx == cx, "wrong cx %d (expected %d)\n", cxx, cx); - ok(cyy == cy, "wrong cy %d (expected %d)\n", cyy, cy); + ok(cxx == cx, "%s: wrong cx %d (expected %d)\n", comment, cxx, cx); + ok(cyy == cy, "%s: wrong cy %d (expected %d)\n", comment, cyy, cy); init_memstream(&stream); ret = ImageList_Write(himl, &stream.IStream_iface); - ok(ret, "ImageList_Write failed\n"); + ok(ret, "%s: ImageList_Write failed\n", comment); hr = GetHGlobalFromStream(stream.stream, &hglobal); - ok(hr == S_OK, "Failed to get hglobal, %#x\n", hr); + ok(hr == S_OK, "%s: Failed to get hglobal, %#x\n", comment, hr); IStream_Stat(stream.stream, &stat, STATFLAG_NONAME); data = GlobalLock(hglobal); - ok(data != 0, "ImageList_Write didn't write any data\n"); - ok(stat.cbSize.LowPart > sizeof(ILHEAD), "ImageList_Write wrote not enough data\n"); + ok(data != 0, "%s: ImageList_Write didn't write any data\n", comment); + ok(stat.cbSize.LowPart > sizeof(ILHEAD), "%s: ImageList_Write wrote not enough data\n", comment); check_ilhead_data(data, cx, cy, cur, max, grow, flags); size = check_bitmap_data(data + sizeof(ILHEAD), stat.cbSize.LowPart - sizeof(ILHEAD), width, height, flags & 0xfe, comment); if (size < stat.cbSize.LowPart - sizeof(ILHEAD)) /* mask is present */ { - ok( flags & ILC_MASK, "extra data %u/%u but mask not expected\n", stat.cbSize.LowPart, size ); + ok( flags & ILC_MASK, "%s: extra data %u/%u but mask not expected\n", comment, stat.cbSize.LowPart, size ); check_bitmap_data(data + sizeof(ILHEAD) + size, stat.cbSize.LowPart - sizeof(ILHEAD) - size, width, height, 1, comment); } @@ -960,7 +958,7 @@ mv.QuadPart = 0; IStream_Seek(stream.stream, mv, STREAM_SEEK_SET, NULL); himl2 = ImageList_Read(&stream.IStream_iface); - ok(himl2 != NULL, "Failed to deserialize imagelist\n"); + ok(himl2 != NULL, "%s: Failed to deserialize imagelist\n", comment); ImageList_Destroy(himl2); GlobalUnlock(hglobal); @@ -2220,6 +2218,29 @@ ImageList_Destroy(himl); } +static void test_copy(void) +{ + HIMAGELIST dst, src; + BOOL ret; + int count; + + dst = ImageList_Create(5, 11, ILC_COLOR, 1, 1); + count = ImageList_GetImageCount(dst); + ok(!count, "ImageList not empty.\n"); + src = createImageList(7, 13); + count = ImageList_GetImageCount(src); + ok(count > 2, "Tests need an ImageList with more than 2 images\n"); + + /* ImageList_Copy() cannot copy between two ImageLists */ + ret = ImageList_Copy(dst, 0, src, 2, ILCF_MOVE); + ok(!ret, "ImageList_Copy() should have returned FALSE\n"); + count = ImageList_GetImageCount(dst); + ok(count == 0, "Expected no image in dst ImageList, got %d\n", count); + + ImageList_Destroy(dst); + ImageList_Destroy(src); +} + static void test_IImageList_Clone(void) { IImageList *imgl, *imgl2; @@ -2370,6 +2391,7 @@ test_iconsize(); test_color_table(ILC_COLOR4); test_color_table(ILC_COLOR8); + test_copy(); FreeLibrary(hComCtl32); Modified: trunk/rostests/winetests/comctl32/listview.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/listvi…
============================================================================== --- trunk/rostests/winetests/comctl32/listview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/listview.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -710,8 +710,8 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; @@ -744,15 +744,14 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; /* all we need is sizing */ if (message == WM_WINDOWPOSCHANGING || @@ -5076,12 +5075,30 @@ fi.psz = f; r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); expect(0, r); + + fi.flags = LVFI_STRING | LVFI_PARTIAL; + r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(0, r); + + fi.flags = LVFI_PARTIAL; + r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(0, r); + /* partial string search, inserted text was "foo" */ strcpy(f, "fo"); fi.flags = LVFI_STRING | LVFI_PARTIAL; fi.psz = f; r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); expect(0, r); + + fi.flags = LVFI_STRING; + r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(-1, r); + + fi.flags = LVFI_PARTIAL; + r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(0, r); + /* partial string search, part after start char */ strcpy(f, "oo"); fi.flags = LVFI_STRING | LVFI_PARTIAL; @@ -5112,9 +5129,19 @@ r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); expect(-1, r); + strcpy(f, "o"); + fi.flags = LVFI_SUBSTRING | LVFI_PARTIAL; + fi.psz = f; + r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(-1, r); + strcpy(f, "f"); fi.flags = LVFI_SUBSTRING | LVFI_STRING; fi.psz = f; + r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); + expect(0, r); + + fi.flags = LVFI_SUBSTRING | LVFI_PARTIAL; r = SendMessageA(hwnd, LVM_FINDITEMA, -1, (LPARAM)&fi); expect(0, r); @@ -5547,6 +5574,43 @@ expect(TRUE, ret); DestroyWindow(hwnd); +} + +static void test_LVM_REDRAWITEMS(void) +{ + HWND list; + DWORD ret; + + list = create_listview_control(LVS_ICON); + ok(list != NULL, "failed to create listview window\n"); + + ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 0); + expect(TRUE, ret); + + insert_item(list, 0); + + ret = SendMessageA(list, LVM_REDRAWITEMS, -1, 0); + expect(TRUE, ret); + + ret = SendMessageA(list, LVM_REDRAWITEMS, 0, -1); + expect(TRUE, ret); + + ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 0); + expect(TRUE, ret); + + ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 1); + expect(TRUE, ret); + + ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 2); + expect(TRUE, ret); + + ret = SendMessageA(list, LVM_REDRAWITEMS, 1, 0); + expect(TRUE, ret); + + ret = SendMessageA(list, LVM_REDRAWITEMS, 2, 3); + expect(TRUE, ret); + + DestroyWindow(list); } static void test_imagelists(void) @@ -5923,6 +5987,7 @@ test_createdragimage(); test_dispinfo(); test_LVM_SETITEMTEXT(); + test_LVM_REDRAWITEMS(); test_imagelists(); test_deleteitem(); test_insertitem(); Modified: trunk/rostests/winetests/comctl32/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/misc.c…
============================================================================== --- trunk/rostests/winetests/comctl32/misc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/misc.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -202,29 +202,6 @@ ok(res == TRUE, "Expected TRUE, got %d\n", res); } -static void test_TaskDialogIndirect(void) -{ - HINSTANCE hinst; - void *ptr, *ptr2; - - hinst = LoadLibraryA("comctl32.dll"); - - ptr = GetProcAddress(hinst, "TaskDialogIndirect"); - if (!ptr) - { -#ifdef __REACTOS__ - /* Skipped on 2k3 */ - skip("TaskDialogIndirect not exported by name\n"); -#else - win_skip("TaskDialogIndirect not exported by name\n"); -#endif - return; - } - - ptr2 = GetProcAddress(hinst, (const CHAR*)345); - ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr); -} - static void test_LoadIconWithScaleDown(void) { static const WCHAR nonexisting_fileW[] = {'n','o','n','e','x','i','s','t','i','n','g','.','i','c','o',0}; @@ -413,7 +390,6 @@ return; test_builtin_classes(); - test_TaskDialogIndirect(); test_LoadIconWithScaleDown(); unload_v6_module(ctx_cookie, hCtx); Modified: trunk/rostests/winetests/comctl32/monthcal.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/monthc…
============================================================================== --- trunk/rostests/winetests/comctl32/monthcal.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/monthcal.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -624,15 +624,14 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, MONTHCAL_SEQ_INDEX, &msg); /* some debug output for style changing */ Modified: trunk/rostests/winetests/comctl32/msg.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/msg.h?…
============================================================================== --- trunk/rostests/winetests/comctl32/msg.h [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/msg.h [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -371,7 +371,7 @@ if(todo && !failcount) /* succeeded yet marked todo */ { - dump++; + if (!strcmp(winetest_platform, "wine")) dump++; todo_wine { ok_(file, line)(TRUE, "%s: marked \"todo_wine\" but succeeds\n", context); Modified: trunk/rostests/winetests/comctl32/pager.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/pager.…
============================================================================== --- trunk/rostests/winetests/comctl32/pager.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/pager.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -30,7 +30,10 @@ #define NUM_MSG_SEQUENCES 1 #define PAGER_SEQ_INDEX 0 -static HWND parent_wnd; +static HWND parent_wnd, child1_wnd, child2_wnd; + +#define CHILD1_ID 1 +#define CHILD2_ID 2 static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR); @@ -42,6 +45,29 @@ { WM_NCCALCSIZE, sent|wparam, TRUE }, { WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE }, { WM_WINDOWPOSCHANGED, sent }, + { WM_WINDOWPOSCHANGING, sent|id, 0, 0, CHILD1_ID }, + { WM_NCCALCSIZE, sent|wparam|id|optional, TRUE, 0, CHILD1_ID }, + { WM_CHILDACTIVATE, sent|id, 0, 0, CHILD1_ID }, + { WM_WINDOWPOSCHANGED, sent|id, 0, 0, CHILD1_ID }, + { WM_SIZE, sent|id|defwinproc|optional, 0, 0, CHILD1_ID }, + { 0 } +}; + +/* This differs from the above message list only in the child window that is + * expected to receive the child messages. No message is sent to the old child. + * Also child 2 is hidden while child 1 is visible. The pager does not make the + * hidden child visible. */ +static const struct message switch_child_seq[] = { + { PGM_SETCHILD, sent }, + { WM_WINDOWPOSCHANGING, sent }, + { WM_NCCALCSIZE, sent|wparam, TRUE }, + { WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE }, + { WM_WINDOWPOSCHANGED, sent }, + { WM_WINDOWPOSCHANGING, sent|id, 0, 0, CHILD2_ID }, + { WM_NCCALCSIZE, sent|wparam|id, TRUE, 0, CHILD2_ID }, + { WM_CHILDACTIVATE, sent|id, 0, 0, CHILD2_ID }, + { WM_WINDOWPOSCHANGED, sent|id, 0, 0, CHILD2_ID }, + { WM_SIZE, sent|id|defwinproc, 0, 0, CHILD2_ID }, { 0 } }; @@ -52,7 +78,20 @@ { WM_NOTIFY, sent|id|parent, 0, 0, PGN_CALCSIZE }, { WM_WINDOWPOSCHANGED, sent }, { WM_MOVE, sent|optional }, + /* The WM_SIZE handler sends WM_WINDOWPOSCHANGING, WM_CHILDACTIVATE + * and WM_WINDOWPOSCHANGED (which sends WM_MOVE) to the child. + * Another WM_WINDOWPOSCHANGING is sent afterwards. + * + * The 2nd WM_WINDOWPOSCHANGING is unconditional, but the comparison + * function is too simple to roll back an accepted message, so we have + * to mark the 2nd message optional. */ { WM_SIZE, sent|optional }, + { WM_WINDOWPOSCHANGING, sent|id, 0, 0, CHILD1_ID }, /* Actually optional. */ + { WM_CHILDACTIVATE, sent|id, 0, 0, CHILD1_ID }, /* Actually optional. */ + { WM_WINDOWPOSCHANGED, sent|id|optional, TRUE, 0, CHILD1_ID}, + { WM_MOVE, sent|id|optional|defwinproc, 0, 0, CHILD1_ID }, + { WM_WINDOWPOSCHANGING, sent|id|optional, 0, 0, CHILD1_ID }, /* Actually not optional. */ + { WM_CHILDACTIVATE, sent|id|optional, 0, 0, CHILD1_ID }, /* Actually not optional. */ { 0 } }; @@ -145,13 +184,12 @@ static LRESULT WINAPI pager_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); - struct message msg; + struct message msg = { 0 }; msg.message = message; msg.flags = sent|wparam|lparam; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, PAGER_SEQ_INDEX, &msg); return CallWindowProcA(oldproc, hwnd, message, wParam, lParam); } @@ -170,9 +208,55 @@ return hwnd; } +static LRESULT WINAPI child_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + static LONG defwndproc_counter; + struct message msg = { 0 }; + LRESULT ret; + + msg.message = message; + msg.flags = sent | wparam | lparam; + if (defwndproc_counter) + msg.flags |= defwinproc; + msg.wParam = wParam; + msg.lParam = lParam; + + if (hwnd == child1_wnd) + msg.id = CHILD1_ID; + else if (hwnd == child2_wnd) + msg.id = CHILD2_ID; + else + msg.id = 0; + + add_message(sequences, PAGER_SEQ_INDEX, &msg); + + defwndproc_counter++; + ret = DefWindowProcA(hwnd, message, wParam, lParam); + defwndproc_counter--; + + return ret; +} + +static BOOL register_child_wnd_class(void) +{ + WNDCLASSA cls; + + cls.style = 0; + cls.lpfnWndProc = child_proc; + cls.cbClsExtra = 0; + cls.cbWndExtra = 0; + cls.hInstance = GetModuleHandleA(NULL); + cls.hIcon = 0; + cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW); + cls.hbrBackground = GetStockObject(WHITE_BRUSH); + cls.lpszMenuName = NULL; + cls.lpszClassName = "Pager test child class"; + return RegisterClassA(&cls); +} + static void test_pager(void) { - HWND pager, child; + HWND pager; RECT rect, rect2; pager = create_pager_control( PGS_HORZ ); @@ -181,15 +265,35 @@ win_skip( "Pager control not supported\n" ); return; } - child = CreateWindowA( "BUTTON", "button", WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 300, 300, + + register_child_wnd_class(); + + child1_wnd = CreateWindowA( "Pager test child class", "button", WS_CHILD | WS_BORDER | WS_VISIBLE, 0, 0, 300, 300, pager, 0, GetModuleHandleA(0), 0 ); + child2_wnd = CreateWindowA("Pager test child class", "button", WS_CHILD | WS_BORDER, 0, 0, 300, 300, + pager, 0, GetModuleHandleA(0), 0); flush_sequences( sequences, NUM_MSG_SEQUENCES ); - SendMessageA( pager, PGM_SETCHILD, 0, (LPARAM)child ); - ok_sequence(sequences, PAGER_SEQ_INDEX, set_child_seq, "set child", TRUE); + SendMessageA( pager, PGM_SETCHILD, 0, (LPARAM)child1_wnd ); + ok_sequence(sequences, PAGER_SEQ_INDEX, set_child_seq, "set child", FALSE); GetWindowRect( pager, &rect ); ok( rect.right - rect.left == 100 && rect.bottom - rect.top == 100, "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top ); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(pager, PGM_SETCHILD, 0, (LPARAM)child2_wnd); + ok_sequence(sequences, PAGER_SEQ_INDEX, switch_child_seq, "switch to invisible child", FALSE); + GetWindowRect(pager, &rect); + ok(rect.right - rect.left == 100 && rect.bottom - rect.top == 100, + "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top); + ok(!IsWindowVisible(child2_wnd), "Child window 2 is visible\n"); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(pager, PGM_SETCHILD, 0, (LPARAM)child1_wnd); + ok_sequence(sequences, PAGER_SEQ_INDEX, set_child_seq, "switch to visible child", FALSE); + GetWindowRect(pager, &rect); + ok(rect.right - rect.left == 100 && rect.bottom - rect.top == 100, + "pager resized %dx%d\n", rect.right - rect.left, rect.bottom - rect.top); flush_sequences( sequences, NUM_MSG_SEQUENCES ); SendMessageA( pager, PGM_SETPOS, 0, 10 ); Modified: trunk/rostests/winetests/comctl32/propsheet.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/propsh…
============================================================================== --- trunk/rostests/winetests/comctl32/propsheet.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/propsheet.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -713,7 +713,7 @@ static void save_message(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, INT receiver) { - struct message msg; + struct message msg = { 0 }; if (message < WM_USER && message != WM_GETICON && @@ -990,6 +990,141 @@ DestroyWindow(hdlg); } +struct custom_proppage +{ + union + { + PROPSHEETPAGEA pageA; + PROPSHEETPAGEW pageW; + } u; + unsigned int addref_called; + unsigned int release_called; +}; + +static UINT CALLBACK proppage_callback_a(HWND hwnd, UINT msg, PROPSHEETPAGEA *psp) +{ + struct custom_proppage *cpage = (struct custom_proppage *)psp->lParam; + PROPSHEETPAGEA *psp_orig = &cpage->u.pageA; + + ok(hwnd == NULL, "Expected NULL hwnd, got %p\n", hwnd); + + ok(psp->lParam && psp->lParam != (LPARAM)psp, "Expected newly allocated page description, got %lx, %p\n", + psp->lParam, psp); + ok(psp_orig->pszTitle == psp->pszTitle, "Expected same page title pointer\n"); + ok(!lstrcmpA(psp_orig->pszTitle, psp->pszTitle), "Expected same page title string\n"); + + switch (msg) + { + case PSPCB_ADDREF: + ok(psp->dwSize > PROPSHEETPAGEA_V1_SIZE, "Expected ADDREF for V2+ only, got size %u\n", psp->dwSize); + cpage->addref_called++; + break; + case PSPCB_RELEASE: + ok(psp->dwSize >= PROPSHEETPAGEA_V1_SIZE, "Unexpected RELEASE, got size %u\n", psp->dwSize); + cpage->release_called++; + break; + default: + ok(0, "Unexpected message %u\n", msg); + } + + return 1; +} + +static UINT CALLBACK proppage_callback_w(HWND hwnd, UINT msg, PROPSHEETPAGEW *psp) +{ + struct custom_proppage *cpage = (struct custom_proppage *)psp->lParam; + PROPSHEETPAGEW *psp_orig = &cpage->u.pageW; + + ok(hwnd == NULL, "Expected NULL hwnd, got %p\n", hwnd); + ok(psp->lParam && psp->lParam != (LPARAM)psp, "Expected newly allocated page description, got %lx, %p\n", + psp->lParam, psp); + ok(psp_orig->pszTitle == psp->pszTitle, "Expected same page title pointer\n"); + ok(!lstrcmpW(psp_orig->pszTitle, psp->pszTitle), "Expected same page title string\n"); + + switch (msg) + { + case PSPCB_ADDREF: + ok(psp->dwSize > PROPSHEETPAGEW_V1_SIZE, "Expected ADDREF for V2+ only, got size %u\n", psp->dwSize); + cpage->addref_called++; + break; + case PSPCB_RELEASE: + ok(psp->dwSize >= PROPSHEETPAGEW_V1_SIZE, "Unexpected RELEASE, got size %u\n", psp->dwSize); + cpage->release_called++; + break; + default: + ok(0, "Unexpected message %u\n", msg); + } + + return 1; +} + +static void test_CreatePropertySheetPage(void) +{ + static const WCHAR titleW[] = {'T','i','t','l','e',0}; + struct custom_proppage page; + HPROPSHEETPAGE hpsp; + BOOL ret; + + memset(&page.u.pageA, 0, sizeof(page.u.pageA)); + page.u.pageA.dwFlags = PSP_USECALLBACK; + page.u.pageA.pfnDlgProc = page_dlg_proc_messages; + page.u.pageA.pfnCallback = proppage_callback_a; + page.u.pageA.lParam = (LPARAM)&page; + page.u.pageA.pszTitle = "Title"; + + /* Only minimal size validation is performed */ + for (page.u.pageA.dwSize = PROPSHEETPAGEA_V1_SIZE - 1; page.u.pageA.dwSize <= PROPSHEETPAGEA_V4_SIZE + 1; page.u.pageA.dwSize++) + { + page.addref_called = 0; + hpsp = CreatePropertySheetPageA(&page.u.pageA); + + if (page.u.pageA.dwSize < PROPSHEETPAGEA_V1_SIZE) + ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageA.dwSize); + else + { + ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageA.dwSize); + ok(page.addref_called == (page.u.pageA.dwSize > PROPSHEETPAGEA_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n"); + } + + if (hpsp) + { + page.release_called = 0; + ret = DestroyPropertySheetPage(hpsp); + ok(ret, "Failed to destroy a page\n"); + ok(page.release_called == 1, "Expected RELEASE callback message\n"); + } + } + + memset(&page.u.pageW, 0, sizeof(page.u.pageW)); + page.u.pageW.dwFlags = PSP_USECALLBACK; + page.u.pageW.pfnDlgProc = page_dlg_proc_messages; + page.u.pageW.pfnCallback = proppage_callback_w; + page.u.pageW.lParam = (LPARAM)&page; + page.u.pageW.pszTitle = titleW; + + for (page.u.pageW.dwSize = PROPSHEETPAGEW_V1_SIZE - 1; page.u.pageW.dwSize <= PROPSHEETPAGEW_V4_SIZE + 1; page.u.pageW.dwSize++) + { + page.addref_called = 0; + hpsp = CreatePropertySheetPageW(&page.u.pageW); + + if (page.u.pageW.dwSize < PROPSHEETPAGEW_V1_SIZE) + ok(hpsp == NULL, "Expected failure, size %u\n", page.u.pageW.dwSize); + else + { + ok(hpsp != NULL, "Failed to create a page, size %u\n", page.u.pageW.dwSize); + ok(page.addref_called == (page.u.pageW.dwSize > PROPSHEETPAGEW_V1_SIZE) ? 1 : 0, "Expected ADDREF callback message\n"); + } + + if (hpsp) + { + page.release_called = 0; + ret = DestroyPropertySheetPage(hpsp); + ok(ret, "Failed to destroy a page\n"); + ok(page.release_called == 1, "Expected RELEASE callback message\n"); + } + } +} + START_TEST(propsheet) { test_title(); @@ -1001,4 +1136,5 @@ test_messages(); test_PSM_ADDPAGE(); test_PSM_INSERTPAGE(); -} + test_CreatePropertySheetPage(); +} Modified: trunk/rostests/winetests/comctl32/syslink.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/syslin…
============================================================================== --- trunk/rostests/winetests/comctl32/syslink.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/syslink.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -146,15 +146,14 @@ static LRESULT WINAPI syslink_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, SYSLINK_SEQ_INDEX, &msg); defwndproc_counter++; Modified: trunk/rostests/winetests/comctl32/tab.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/tab.c?…
============================================================================== --- trunk/rostests/winetests/comctl32/tab.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/tab.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -304,8 +304,8 @@ static LRESULT WINAPI parentWindowProcess(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; /* do not log painting messages */ if (message != WM_PAINT && @@ -321,7 +321,6 @@ if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, PARENT_SEQ_INDEX, &msg); } @@ -367,8 +366,8 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; /* do not log painting messages */ if (message != WM_PAINT && @@ -384,7 +383,6 @@ if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, TAB_SEQ_INDEX, &msg); } Added: trunk/rostests/winetests/comctl32/taskdialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/taskdi…
============================================================================== --- trunk/rostests/winetests/comctl32/taskdialog.c (added) +++ trunk/rostests/winetests/comctl32/taskdialog.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -0,0 +1,58 @@ +/* Unit tests for the task dialog control. + * + * Copyright 2017 Fabian Maurer for the Wine project + * + * 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 "winuser.h" +#include "commctrl.h" + +#include "wine/test.h" +#include "v6util.h" + +static HRESULT (WINAPI *pTaskDialogIndirect)(const TASKDIALOGCONFIG *, int *, int *, BOOL *); + +START_TEST(taskdialog) +{ + ULONG_PTR ctx_cookie; + void *ptr_ordinal; + HINSTANCE hinst; + HANDLE hCtx; + + if (!load_v6_module(&ctx_cookie, &hCtx)) + return; + + /* Check if task dialogs are available */ + hinst = LoadLibraryA("comctl32.dll"); + + pTaskDialogIndirect = (void *)GetProcAddress(hinst, "TaskDialogIndirect"); + if (!pTaskDialogIndirect) + { + win_skip("TaskDialogIndirect not exported by name\n"); + unload_v6_module(ctx_cookie, hCtx); + return; + } + + ptr_ordinal = GetProcAddress(hinst, (const char *)345); + ok(pTaskDialogIndirect == ptr_ordinal, "got wrong pointer for ordinal 345, %p expected %p\n", + ptr_ordinal, pTaskDialogIndirect); + + unload_v6_module(ctx_cookie, hCtx); +} Propchange: trunk/rostests/winetests/comctl32/taskdialog.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/winetests/comctl32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/testli…
============================================================================== --- trunk/rostests/winetests/comctl32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/testlist.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -23,6 +23,7 @@ extern void func_subclass(void); extern void func_syslink(void); extern void func_tab(void); +extern void func_taskdialog(void); extern void func_toolbar(void); extern void func_tooltips(void); extern void func_trackbar(void); @@ -51,6 +52,7 @@ { "subclass", func_subclass }, { "syslink", func_syslink }, { "tab", func_tab }, + { "taskdialog", func_taskdialog }, { "toolbar", func_toolbar }, { "tooltips", func_tooltips }, { "trackbar", func_trackbar }, Modified: trunk/rostests/winetests/comctl32/toolbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/toolba…
============================================================================== --- trunk/rostests/winetests/comctl32/toolbar.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/toolbar.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -2276,7 +2276,8 @@ { HWND wnd = NULL; TBSAVEPARAMSW params; - static const WCHAR subkey[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','T','e','s','t',0}; + static const WCHAR subkey[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e','\\', + 'W','i','n','e','T','e','s','t',0}; static const WCHAR value[] = {'t','o','o','l','b','a','r','t','e','s','t',0}; LONG res; HKEY key; Modified: trunk/rostests/winetests/comctl32/trackbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/trackb…
============================================================================== --- trunk/rostests/winetests/comctl32/trackbar.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/trackbar.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -442,15 +442,14 @@ static LRESULT WINAPI trackbar_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, TRACKBAR_SEQ_INDEX, &msg); defwndproc_counter++; Modified: trunk/rostests/winetests/comctl32/treeview.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/treevi…
============================================================================== --- trunk/rostests/winetests/comctl32/treeview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/treeview.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -53,6 +53,21 @@ static struct msg_sequence *sequences[NUM_MSG_SEQUENCES]; static struct msg_sequence *item_sequence[1]; + +static void flush_events(void) +{ + MSG msg; + int diff = 200; + int min_timeout = 100; + DWORD time = GetTickCount() + diff; + + while (diff > 0) + { + if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT) break; + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + diff = time - GetTickCount(); + } +} static const struct message FillRootSeq[] = { { TVM_INSERTITEMA, sent }, @@ -201,6 +216,13 @@ { 0 } }; +static const struct message test_right_click_seq[] = { + { WM_RBUTTONDOWN, sent|wparam, MK_RBUTTON }, + { WM_CAPTURECHANGED, sent|defwinproc }, + { TVM_GETNEXTITEM, sent|wparam|lparam|defwinproc, TVGN_CARET, 0 }, + { 0 } +}; + static const struct message parent_expand_seq[] = { { WM_NOTIFY, sent|id, 0, 0, TVN_ITEMEXPANDINGA }, { WM_NOTIFY, sent|id, 0, 0, TVN_ITEMEXPANDEDA }, @@ -339,6 +361,12 @@ { WM_NOTIFY, sent|id, 0, 0, TVN_KEYDOWN }, { WM_NOTIFY, sent|id, 0, 0, NM_RETURN }, { WM_CHANGEUISTATE, sent|optional }, + { 0 } +}; + +static const struct message parent_right_click_seq[] = { + { WM_NOTIFY, sent|id, 0, 0, NM_RCLICK }, + { WM_CONTEXTMENU, sent }, { 0 } }; @@ -383,15 +411,14 @@ { static LONG defwndproc_counter = 0; LRESULT ret; - struct message msg; WNDPROC lpOldProc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); + struct message msg = { 0 }; msg.message = message; msg.flags = sent|wparam|lparam; if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, TREEVIEW_SEQ_INDEX, &msg); defwndproc_counter++; @@ -1099,7 +1126,7 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; - struct message msg; + struct message msg = { 0 }; LRESULT ret; RECT rect; HTREEITEM visibleItem; @@ -1111,8 +1138,6 @@ msg.lParam = lParam; if (message == WM_NOTIFY && lParam) msg.id = ((NMHDR*)lParam)->code; - else - msg.id = 0; /* log system messages, except for painting */ if (message < WM_USER && @@ -1297,6 +1322,13 @@ default: ; } + break; + } + case NM_RCLICK: + { + HTREEITEM selected = (HTREEITEM)SendMessageA(((NMHDR *)lParam)->hwndFrom, + TVM_GETNEXTITEM, TVGN_CARET, 0); + ok(selected == hChild, "child item should still be selected\n"); break; } } @@ -2395,6 +2427,238 @@ ok(style & TVS_FULLROWSELECT, "got style 0x%08x\n", style); DestroyWindow(hwnd); +} + +static void get_item_names_string(HWND hwnd, HTREEITEM item, char *str) +{ + TVITEMA tvitem = { 0 }; + HTREEITEM child; + char name[16]; + + if (!item) + { + item = (HTREEITEM)SendMessageA(hwnd, TVM_GETNEXTITEM, TVGN_ROOT, 0); + str[0] = 0; + } + + child = (HTREEITEM)SendMessageA(hwnd, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)item); + + tvitem.mask = TVIF_TEXT; + tvitem.hItem = item; + tvitem.pszText = name; + tvitem.cchTextMax = sizeof(name); + SendMessageA(hwnd, TVM_GETITEMA, 0, (LPARAM)&tvitem); + strcat(str, tvitem.pszText); + + while (child != NULL) + { + get_item_names_string(hwnd, child, str); + child = (HTREEITEM)SendMessageA(hwnd, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)child); + } +} + +static void fill_treeview_sort_test(HWND hwnd) +{ + static const char *itemnames[] = + { + "root", "Wasp", "Caribou", "Vacuum", + "Ocelot", "Newspaper", "Litter bin" + }; + + HTREEITEM root, children[2]; + TVINSERTSTRUCTA ins; + unsigned i = 0; + + SendMessageA(hwnd, TVM_DELETEITEM, 0, 0); + + /* root, two children, with two children each */ + ins.hParent = TVI_ROOT; + ins.hInsertAfter = TVI_ROOT; + U(ins).item.mask = TVIF_TEXT; + U(ins).item.pszText = (char *)itemnames[i++]; + root = (HTREEITEM)SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + + ins.hParent = root; + ins.hInsertAfter = TVI_LAST; + U(ins).item.mask = TVIF_TEXT; + U(ins).item.pszText = (char *)itemnames[i++]; + children[0] = (HTREEITEM)SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + + U(ins).item.pszText = (char *)itemnames[i++]; + children[1] = (HTREEITEM)SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + + ins.hParent = children[0]; + U(ins).item.pszText = (char *)itemnames[i++]; + SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + + U(ins).item.pszText = (char *)itemnames[i++]; + SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + + ins.hParent = children[1]; + U(ins).item.pszText = (char *)itemnames[i++]; + SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + + U(ins).item.pszText = (char *)itemnames[i++]; + SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); +} + +static void test_TVM_SORTCHILDREN(void) +{ + static const char *initial_order = "rootWaspVacuumOcelotCaribouNewspaperLitter bin"; + static const char *sorted_order = "rootCaribouNewspaperLitter binWaspVacuumOcelot"; + TVINSERTSTRUCTA ins; + char buff[256]; + HTREEITEM root; + HWND hwnd; + BOOL ret; + + hwnd = create_treeview_control(0); + + /* call on empty tree */ + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, 0, 0); + ok(!ret, "Unexpected ret value %d\n", ret); + + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, 0, (LPARAM)TVI_ROOT); + ok(!ret, "Unexpected ret value %d\n", ret); + + /* add only root, sort from it */ + ins.hParent = TVI_ROOT; + ins.hInsertAfter = TVI_ROOT; + U(ins).item.mask = TVIF_TEXT; + U(ins).item.pszText = (char *)"root"; + root = (HTREEITEM)SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + ok(root != NULL, "Expected root node\n"); + + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, 0, (LPARAM)root); + ok(!ret, "Unexpected ret value %d\n", ret); + + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, TRUE, (LPARAM)root); + ok(!ret, "Unexpected ret value %d\n", ret); + + /* root, two children, with two children each */ + fill_treeview_sort_test(hwnd); + get_item_names_string(hwnd, NULL, buff); + ok(!strcmp(buff, initial_order), "Wrong initial order %s, expected %s\n", buff, initial_order); + + /* with NULL item nothing is sorted */ + fill_treeview_sort_test(hwnd); + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, 0, 0); +todo_wine + ok(ret, "Unexpected ret value %d\n", ret); + get_item_names_string(hwnd, NULL, buff); + ok(!strcmp(buff, initial_order), "Wrong sorted order %s, expected %s\n", buff, initial_order); + + /* TVI_ROOT as item */ + fill_treeview_sort_test(hwnd); + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, 0, (LPARAM)TVI_ROOT); +todo_wine + ok(ret, "Unexpected ret value %d\n", ret); + get_item_names_string(hwnd, NULL, buff); + ok(!strcmp(buff, initial_order), "Wrong sorted order %s, expected %s\n", buff, initial_order); + + /* zero WPARAM, item is specified */ + fill_treeview_sort_test(hwnd); + root = (HTREEITEM)SendMessageA(hwnd, TVM_GETNEXTITEM, TVGN_ROOT, 0); + ok(root != NULL, "Failed to get root item\n"); + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, 0, (LPARAM)root); + ok(ret, "Unexpected ret value %d\n", ret); + get_item_names_string(hwnd, NULL, buff); + ok(!strcmp(buff, sorted_order), "Wrong sorted order %s, expected %s\n", buff, sorted_order); + + /* non-zero WPARAM, NULL item */ + fill_treeview_sort_test(hwnd); + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, TRUE, 0); +todo_wine + ok(ret, "Unexpected ret value %d\n", ret); + get_item_names_string(hwnd, NULL, buff); + ok(!strcmp(buff, initial_order), "Wrong sorted order %s, expected %s\n", buff, sorted_order); + + /* TVI_ROOT as item */ + fill_treeview_sort_test(hwnd); + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, TRUE, (LPARAM)TVI_ROOT); +todo_wine + ok(ret, "Unexpected ret value %d\n", ret); + get_item_names_string(hwnd, NULL, buff); + ok(!strcmp(buff, initial_order), "Wrong sorted order %s, expected %s\n", buff, sorted_order); + + /* non-zero WPARAM, item is specified */ + fill_treeview_sort_test(hwnd); + root = (HTREEITEM)SendMessageA(hwnd, TVM_GETNEXTITEM, TVGN_ROOT, 0); + ok(root != NULL, "Failed to get root item\n"); + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, TRUE, (LPARAM)root); + ok(ret, "Unexpected ret value %d\n", ret); + get_item_names_string(hwnd, NULL, buff); + ok(!strcmp(buff, sorted_order), "Wrong sorted order %s, expected %s\n", buff, sorted_order); + + /* case insensitive comparison */ + SendMessageA(hwnd, TVM_DELETEITEM, 0, 0); + + ins.hParent = TVI_ROOT; + ins.hInsertAfter = TVI_ROOT; + U(ins).item.mask = TVIF_TEXT; + U(ins).item.pszText = (char *)"root"; + root = (HTREEITEM)SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + ok(root != NULL, "Expected root node\n"); + + ins.hParent = root; + ins.hInsertAfter = TVI_LAST; + U(ins).item.pszText = (char *)"I1"; + SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + + ins.hParent = root; + ins.hInsertAfter = TVI_LAST; + U(ins).item.pszText = (char *)"i1"; + SendMessageA(hwnd, TVM_INSERTITEMA, 0, (LPARAM)&ins); + + ret = SendMessageA(hwnd, TVM_SORTCHILDREN, TRUE, (LPARAM)root); + ok(ret, "Unexpected ret value %d\n", ret); + get_item_names_string(hwnd, NULL, buff); + ok(!strcmp(buff, "rootI1i1"), "Wrong sorted order %s\n", buff); + + DestroyWindow(hwnd); +} + +static void test_right_click(void) +{ + HWND hTree; + HTREEITEM selected; + RECT rc; + LRESULT result; + POINT pt; + + hTree = create_treeview_control(0); + fill_tree(hTree); + + SendMessageA(hTree, TVM_ENSUREVISIBLE, 0, (LPARAM)hChild); + SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hChild); + selected = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CARET, 0); + ok(selected == hChild, "child item not selected\n"); + + *(HTREEITEM *)&rc = hRoot; + result = SendMessageA(hTree, TVM_GETITEMRECT, TRUE, (LPARAM)&rc); + ok(result, "TVM_GETITEMRECT failed\n"); + + flush_events(); + + pt.x = (rc.left + rc.right) / 2; + pt.y = (rc.top + rc.bottom) / 2; + ClientToScreen(hMainWnd, &pt); + + flush_events(); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + PostMessageA(hTree, WM_RBUTTONDOWN, MK_RBUTTON, MAKELPARAM(pt.x, pt.y)); + PostMessageA(hTree, WM_RBUTTONUP, 0, MAKELPARAM(pt.x, pt.y)); + + flush_events(); + + ok_sequence(sequences, TREEVIEW_SEQ_INDEX, test_right_click_seq, "right click sequence", FALSE); + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_right_click_seq, "parent right click sequence", FALSE); + + selected = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CARET, 0); + ok(selected == hChild, "child item should still be selected\n"); + + DestroyWindow(hTree); } START_TEST(treeview) @@ -2473,6 +2737,8 @@ test_customdraw(); test_WM_KEYDOWN(); test_TVS_FULLROWSELECT(); + test_TVM_SORTCHILDREN(); + test_right_click(); if (!load_v6_module(&ctx_cookie, &hCtx)) { Modified: trunk/rostests/winetests/comctl32/updown.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/updown…
============================================================================== --- trunk/rostests/winetests/comctl32/updown.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/updown.c [iso-8859-1] Sun Jun 4 12:53:30 2017 @@ -169,8 +169,8 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; /* log system messages, except for painting */ if (message < WM_USER && @@ -187,7 +187,6 @@ if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; - msg.id = 0; add_message(sequences, PARENT_SEQ_INDEX, &msg); } @@ -232,8 +231,8 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam; @@ -272,8 +271,8 @@ { WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); static LONG defwndproc_counter = 0; + struct message msg = { 0 }; LRESULT ret; - struct message msg; msg.message = message; msg.flags = sent|wparam|lparam;
7 years, 10 months
1
0
0
0
[akhaldi] 74902: [COMCTL32] Sync with Wine Staging 2.9. CORE-13362 9abd3d1 comctl32: fix buttons becoming unthemed when pressed/released 8967e87 comctl32/taskdialog: Display content text label. 65d...
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sun Jun 4 12:53:17 2017 New Revision: 74902 URL:
http://svn.reactos.org/svn/reactos?rev=74902&view=rev
Log: [COMCTL32] Sync with Wine Staging 2.9. CORE-13362 9abd3d1 comctl32: fix buttons becoming unthemed when pressed/released 8967e87 comctl32/taskdialog: Display content text label. 65d64e1 comctl32/listview: Simplify a couple of conditions that are using LVFI_PARTIAL. 407a3c0 comctl32/listview: Search through all items in LVFI_NEARESTXY mode. 5fe4493 comctl32/listview: When adding a scrollbar, update the other one. 8ef79b0 comctl32/listview: Convert item text once when looking for insertion point. 791924a comctl32/listview: Remove internal autoarrange flag, it breaks positioning. b1d46e0 comctl32/taskdialog: Remove superfluous title pointer check (Coverity). 48c4edd comctl32/pager: Prevent excessive PGN_CALCSIZE notifications during PGM_SETCHILD. d6a6055 comctl32: Improve right-click handling in treeview controls. 6926564 comctl32: Don't touch the new child twice in PGM_SETCHILD. 995b690 comctl32/taskdialog: Initial implementation of a minimal task dialog. e2245bc comctl32/taskdialog: Move TaskDialogIndirect and its tests into own source files. 429705e comctl32/propsheet: Implement PSPCB_ADDREF/PSPCB_RELEASE notifications. a3aa217 comctl32/propsheet: Enforce minimal PROPSHEETPAGE structure size when creating a page. b7cc440 comctl32: Update the tooltip rectangle when a tool button is hidden. 690022c comctl32: Return TRUE from LVM_REDRAWITEMS with bad indices. Added: trunk/reactos/dll/win32/comctl32/taskdialog.c (with props) Modified: trunk/reactos/dll/win32/comctl32/CMakeLists.txt trunk/reactos/dll/win32/comctl32/comctl32.h trunk/reactos/dll/win32/comctl32/commctrl.c trunk/reactos/dll/win32/comctl32/lang/comctl_Bg.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Cs.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Da.rc trunk/reactos/dll/win32/comctl32/lang/comctl_De.rc trunk/reactos/dll/win32/comctl32/lang/comctl_El.rc trunk/reactos/dll/win32/comctl32/lang/comctl_En.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Eo.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Es.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Fr.rc trunk/reactos/dll/win32/comctl32/lang/comctl_He.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Hu.rc trunk/reactos/dll/win32/comctl32/lang/comctl_It.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Ja.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Ko.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Lt.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Nl.rc trunk/reactos/dll/win32/comctl32/lang/comctl_No.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Pl.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Pt.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Ro.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Ru.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Si.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Sk.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Sq.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Sr.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Sv.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Th.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Tr.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Tw.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Uk.rc trunk/reactos/dll/win32/comctl32/lang/comctl_Zh.rc trunk/reactos/dll/win32/comctl32/listview.c trunk/reactos/dll/win32/comctl32/pager.c trunk/reactos/dll/win32/comctl32/propsheet.c trunk/reactos/dll/win32/comctl32/resource.h trunk/reactos/dll/win32/comctl32/syslink.c trunk/reactos/dll/win32/comctl32/theme_button.c trunk/reactos/dll/win32/comctl32/theme_edit.c trunk/reactos/dll/win32/comctl32/theme_listbox.c trunk/reactos/dll/win32/comctl32/theming.c trunk/reactos/dll/win32/comctl32/treeview.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/comctl32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/comctl32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/CMakeLists.txt [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -37,6 +37,7 @@ string.c syslink.c tab.c + taskdialog.c theme_button.c theme_combo.c theme_dialog.c Modified: trunk/reactos/dll/win32/comctl32/comctl32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl3…
============================================================================== --- trunk/reactos/dll/win32/comctl32/comctl32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/comctl32.h [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -45,8 +45,9 @@ #include <uxtheme.h> #include <vssym32.h> +#include <wine/debug.h> +#include <wine/list.h> #include <wine/unicode.h> -#include <wine/debug.h> #include "resource.h" Modified: trunk/reactos/dll/win32/comctl32/commctrl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/commctr…
============================================================================== --- trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -59,6 +59,7 @@ #include <shlwapi.h> WINE_DEFAULT_DEBUG_CHANNEL(commctrl); + static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -1950,45 +1951,6 @@ } /*********************************************************************** - * TaskDialogIndirect [COMCTL32.@] - */ -HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton, - int *pnRadioButton, BOOL *pfVerificationFlagChecked) -{ - UINT uType = 0; - INT ret; - FIXME("%p, %p, %p, %p\n", pTaskConfig, pnButton, pnRadioButton, pfVerificationFlagChecked); - - if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) - uType |= MB_YESNOCANCEL; - else - if (pTaskConfig->dwCommonButtons & TDCBF_YES_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_NO_BUTTON) - uType |= MB_YESNO; - else - if (pTaskConfig->dwCommonButtons & TDCBF_RETRY_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) - uType |= MB_RETRYCANCEL; - else - if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON && - pTaskConfig->dwCommonButtons & TDCBF_CANCEL_BUTTON) - uType |= MB_OKCANCEL; - else - if (pTaskConfig->dwCommonButtons & TDCBF_OK_BUTTON) - uType |= MB_OK; - ret = MessageBoxW(pTaskConfig->hwndParent, pTaskConfig->pszMainInstruction, - pTaskConfig->pszWindowTitle, uType); - FIXME("dwCommonButtons=%x uType=%x ret=%x\n", pTaskConfig->dwCommonButtons, uType, ret); - - if (pnButton) *pnButton = ret; - if (pnRadioButton) *pnRadioButton = pTaskConfig->nDefaultButton; - if (pfVerificationFlagChecked) *pfVerificationFlagChecked = TRUE; - return S_OK; -} - -/*********************************************************************** * LoadIconWithScaleDown [COMCTL32.@] */ HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, const WCHAR *name, int cx, int cy, HICON *icon) Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Bg.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Bg.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Bg.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "ÐиÑо" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Cs.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Cs.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Cs.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Žádný" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Da.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Da.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Da.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Ingen" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_De.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_De.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_De.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Kein" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_El.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_El.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_El.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "ÎανÎνα" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_En.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_En.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "None" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Eo.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Eo.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Eo.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Neniu" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Es.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Es.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Es.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -41,6 +41,16 @@ STRINGTABLE { HKY_NONE "Ninguno" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Fr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Fr.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Fr.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Aucune" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_He.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_He.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_He.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -42,6 +42,16 @@ STRINGTABLE { HKY_NONE "×××" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Hu.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Hu.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Hu.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Semmi" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_It.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_It.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_It.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Nessuno" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Ja.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Ja.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Ja.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "ãªã" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Ko.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Ko.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "ìì" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Lt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Lt.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Lt.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Joks" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Nl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Nl.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Nl.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Geen" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_No.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_No.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_No.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Ingen" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Pl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Pl.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Pl.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Brak" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Pt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Pt.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Pt.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Nenhuma" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Ro.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Ro.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Ro.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -42,6 +42,16 @@ STRINGTABLE { HKY_NONE "Niciuna" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Ru.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Ru.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Ru.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "ÐеÑ" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Si.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Si.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Si.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Brez" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Sk.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Sk.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Sk.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Žiadne" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Sq.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Sq.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Sq.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -43,6 +43,16 @@ STRINGTABLE { HKY_NONE "Asnje" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Sr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Sr.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Sr.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Nista" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Sv.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Sv.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Sv.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "Ingen" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Th.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Th.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Th.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "à¹à¸¡à¹à¸¡à¸µà¹à¸¥à¸¢" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Tr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Tr.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Tr.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -39,6 +39,16 @@ STRINGTABLE { HKY_NONE "Yok" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Tw.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Tw.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Tw.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "ç¡" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Uk.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Uk.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Uk.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "ÐемаÑ" +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/lang/comctl_Zh.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/lang/co…
============================================================================== --- trunk/reactos/dll/win32/comctl32/lang/comctl_Zh.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/lang/comctl_Zh.rc [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -40,6 +40,16 @@ STRINGTABLE { HKY_NONE "æ " +} + +STRINGTABLE +{ + IDS_BUTTON_YES "&Yes" + IDS_BUTTON_NO "&No" + IDS_BUTTON_RETRY "&Retry" + IDS_BUTTON_OK "OK" + IDS_BUTTON_CANCEL "Cancel" + IDS_BUTTON_CLOSE "&Close" } IDD_PROPSHEET DIALOGEX 0, 0, 220, 140 Modified: trunk/reactos/dll/win32/comctl32/listview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/listvie…
============================================================================== --- trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -230,7 +230,6 @@ RANGES selectionRanges; INT nSelectionMark; /* item to start next multiselection from */ INT nHotItem; - BOOL bAutoarrange; /* Autoarrange flag when NOT in LVS_AUTOARRANGE */ /* columns */ HDPA hdpaColumns; /* array of COLUMN_INFO pointers */ @@ -1568,8 +1567,8 @@ static inline BOOL is_autoarrange(const LISTVIEW_INFO *infoPtr) { - return ((infoPtr->dwStyle & LVS_AUTOARRANGE) || infoPtr->bAutoarrange) && - (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON); + return (infoPtr->dwStyle & LVS_AUTOARRANGE) && + (infoPtr->uView == LV_VIEW_ICON || infoPtr->uView == LV_VIEW_SMALLICON); } static void toggle_checkbox_state(LISTVIEW_INFO *infoPtr, INT nItem) @@ -2016,23 +2015,10 @@ SWP_NOZORDER | SWP_NOACTIVATE); } -/*** - * DESCRIPTION: - * Update the scrollbars. This functions should be called whenever - * the content, size or view changes. - * - * PARAMETER(S): - * [I] infoPtr : valid pointer to the listview structure - * - * RETURN: - * None - */ -static void LISTVIEW_UpdateScroll(const LISTVIEW_INFO *infoPtr) -{ - SCROLLINFO horzInfo, vertInfo; - INT dx, dy; - - if ((infoPtr->dwStyle & LVS_NOSCROLL) || !is_redrawing(infoPtr)) return; +static INT LISTVIEW_UpdateHScroll(LISTVIEW_INFO *infoPtr) +{ + SCROLLINFO horzInfo; + INT dx; ZeroMemory(&horzInfo, sizeof(SCROLLINFO)); horzInfo.cbSize = sizeof(SCROLLINFO); @@ -2084,10 +2070,22 @@ dx -= SetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo, TRUE); TRACE("horzInfo=%s\n", debugscrollinfo(&horzInfo)); - /* Setting the horizontal scroll can change the listview size - * (and potentially everything else) so we need to recompute - * everything again for the vertical scroll - */ + /* Update the Header Control */ + if (infoPtr->hwndHeader) + { + horzInfo.fMask = SIF_POS; + GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo); + LISTVIEW_UpdateHeaderSize(infoPtr, horzInfo.nPos); + } + + LISTVIEW_UpdateSize(infoPtr); + return dx; +} + +static INT LISTVIEW_UpdateVScroll(LISTVIEW_INFO *infoPtr) +{ + SCROLLINFO vertInfo; + INT dy; ZeroMemory(&vertInfo, sizeof(SCROLLINFO)); vertInfo.cbSize = sizeof(SCROLLINFO); @@ -2117,6 +2115,37 @@ dy -= SetScrollInfo(infoPtr->hwndSelf, SB_VERT, &vertInfo, TRUE); TRACE("vertInfo=%s\n", debugscrollinfo(&vertInfo)); + LISTVIEW_UpdateSize(infoPtr); + return dy; +} + +/*** + * DESCRIPTION: + * Update the scrollbars. This function should be called whenever + * the content, size or view changes. + * + * PARAMETER(S): + * [I] infoPtr : valid pointer to the listview structure + * + * RETURN: + * None + */ +static void LISTVIEW_UpdateScroll(LISTVIEW_INFO *infoPtr) +{ + INT dx, dy, pass; + + if ((infoPtr->dwStyle & LVS_NOSCROLL) || !is_redrawing(infoPtr)) return; + + /* Setting the horizontal scroll can change the listview size + * (and potentially everything else) so we need to recompute + * everything again for the vertical scroll and vice-versa + */ + for (dx = 0, dy = 0, pass = 0; pass <= 1; pass++) + { + dx += LISTVIEW_UpdateHScroll(infoPtr); + dy += LISTVIEW_UpdateVScroll(infoPtr); + } + /* Change of the range may have changed the scroll pos. If so move the content */ if (dx != 0 || dy != 0) { @@ -2124,14 +2153,6 @@ listRect = infoPtr->rcList; ScrollWindowEx(infoPtr->hwndSelf, dx, dy, &listRect, &listRect, 0, 0, SW_ERASE | SW_INVALIDATE); - } - - /* Update the Header Control */ - if (infoPtr->hwndHeader) - { - horzInfo.fMask = SIF_POS; - GetScrollInfo(infoPtr->hwndSelf, SB_HORZ, &horzInfo); - LISTVIEW_UpdateHeaderSize(infoPtr, horzInfo.nPos); } } @@ -2782,7 +2803,6 @@ default: return FALSE; } - infoPtr->bAutoarrange = TRUE; infoPtr->currIconPos.x = infoPtr->currIconPos.y = 0; for (i = 0; i < infoPtr->nItemCount; i++) { @@ -6331,8 +6351,7 @@ if (!lpFindInfo || nItem < 0) return -1; lvItem.mask = 0; - if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL) || - lpFindInfo->flags & LVFI_SUBSTRING) + if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL | LVFI_SUBSTRING)) { lvItem.mask |= LVIF_TEXT; lvItem.pszText = szDispText; @@ -6379,6 +6398,8 @@ lvItem.mask &= ~LVIF_TEXT; } + nItem = bNearest ? -1 : nStart + 1; + again: for (; nItem < nLast; nItem++) { @@ -6454,14 +6475,13 @@ static INT LISTVIEW_FindItemA(const LISTVIEW_INFO *infoPtr, INT nStart, const LVFINDINFOA *lpFindInfo) { - BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL) || - lpFindInfo->flags & LVFI_SUBSTRING; LVFINDINFOW fiw; INT res; LPWSTR strW = NULL; memcpy(&fiw, lpFindInfo, sizeof(fiw)); - if (hasText) fiw.psz = strW = textdupTtoW((LPCWSTR)lpFindInfo->psz, FALSE); + if (lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL | LVFI_SUBSTRING)) + fiw.psz = strW = textdupTtoW((LPCWSTR)lpFindInfo->psz, FALSE); res = LISTVIEW_FindItemW(infoPtr, nStart, &fiw); textfreeT(strW, FALSE); return res; @@ -7833,18 +7853,24 @@ HDPA hItem; ITEM_INFO *item_s; INT i = 0, cmpv; + WCHAR *textW; + + textW = textdupTtoW(lpLVItem->pszText, isW); while (i < infoPtr->nItemCount) { hItem = DPA_GetPtr( infoPtr->hdpaItems, i); item_s = DPA_GetPtr(hItem, 0); - cmpv = textcmpWT(item_s->hdr.pszText, lpLVItem->pszText, isW); + cmpv = textcmpWT(item_s->hdr.pszText, textW, TRUE); if (infoPtr->dwStyle & LVS_SORTDESCENDING) cmpv *= -1; if (cmpv >= 0) break; i++; } + + textfreeT(textW, isW); + nItem = i; } else @@ -7996,12 +8022,8 @@ static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast) { INT i; - - if (nLast < nFirst || min(nFirst, nLast) < 0 || - max(nFirst, nLast) >= infoPtr->nItemCount) - return FALSE; - - for (i = nFirst; i <= nLast; i++) + + for (i = max(nFirst, 0); i <= min(nLast, infoPtr->nItemCount - 1); i++) LISTVIEW_InvalidateItem(infoPtr, i); return TRUE; @@ -8949,8 +8971,6 @@ } Pt.x -= Origin.x; Pt.y -= Origin.y; - - infoPtr->bAutoarrange = FALSE; return LISTVIEW_MoveIconTo(infoPtr, nItem, &Pt, FALSE); } @@ -10637,10 +10657,15 @@ CombineRgn (cliprgn, cliprgn, region, RGN_AND); OffsetRect(&r, -r.left, -r.top); +#ifdef __REACTOS__ /* r73789 */ dc = GetWindowDC(infoPtr->hwndSelf); /* Exclude client part */ ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge, r.right - cxEdge, r.bottom -cyEdge); +#else + dc = GetDCEx(infoPtr->hwndSelf, region, DCX_WINDOW|DCX_INTERSECTRGN); + OffsetRect(&r, -r.left, -r.top); +#endif if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0)) DrawThemeParentBackground(infoPtr->hwndSelf, dc, &r); Modified: trunk/reactos/dll/win32/comctl32/pager.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/pager.c…
============================================================================== --- trunk/reactos/dll/win32/comctl32/pager.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/pager.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -239,10 +239,9 @@ TRACE("[%p] SWP %dx%d at (%d,%d)\n", infoPtr->hwndSelf, infoPtr->nWidth, infoPtr->nHeight, -nPos, 0); - SetWindowPos(infoPtr->hwndChild, 0, + SetWindowPos(infoPtr->hwndChild, HWND_TOP, -nPos, 0, - infoPtr->nWidth, infoPtr->nHeight, - SWP_NOZORDER); + infoPtr->nWidth, infoPtr->nHeight, 0); } else { @@ -253,10 +252,9 @@ TRACE("[%p] SWP %dx%d at (%d,%d)\n", infoPtr->hwndSelf, infoPtr->nWidth, infoPtr->nHeight, 0, -nPos); - SetWindowPos(infoPtr->hwndChild, 0, + SetWindowPos(infoPtr->hwndChild, HWND_TOP, 0, -nPos, - infoPtr->nWidth, infoPtr->nHeight, - SWP_NOZORDER); + infoPtr->nWidth, infoPtr->nHeight, 0); } InvalidateRect(infoPtr->hwndChild, NULL, TRUE); @@ -264,7 +262,7 @@ } static INT -PAGER_GetScrollRange(PAGER_INFO* infoPtr) +PAGER_GetScrollRange(PAGER_INFO* infoPtr, BOOL calc_size) { INT scrollRange = 0; @@ -274,7 +272,8 @@ RECT wndRect; GetWindowRect(infoPtr->hwndSelf, &wndRect); - PAGER_CalcSize(infoPtr); + if (calc_size) + PAGER_CalcSize(infoPtr); if (infoPtr->dwStyle & PGS_HORZ) { wndSize = wndRect.right - wndRect.left; @@ -355,9 +354,9 @@ } static LRESULT -PAGER_SetPos(PAGER_INFO* infoPtr, INT newPos, BOOL fromBtnPress) -{ - INT scrollRange = PAGER_GetScrollRange(infoPtr); +PAGER_SetPos(PAGER_INFO* infoPtr, INT newPos, BOOL fromBtnPress, BOOL calc_size) +{ + INT scrollRange = PAGER_GetScrollRange(infoPtr, calc_size); INT oldPos = infoPtr->nPos; if ((scrollRange <= 0) || (newPos < 0)) @@ -398,12 +397,12 @@ if (infoPtr->hwndChild) { - INT scrollRange = PAGER_GetScrollRange(infoPtr); + INT scrollRange = PAGER_GetScrollRange(infoPtr, TRUE); if (scrollRange <= 0) { infoPtr->nPos = -1; - PAGER_SetPos(infoPtr, 0, FALSE); + PAGER_SetPos(infoPtr, 0, FALSE, TRUE); } else PAGER_PositionChildWnd(infoPtr); @@ -472,13 +471,8 @@ SetWindowPos(infoPtr->hwndSelf, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - /* position child within the page scroller */ - SetWindowPos(infoPtr->hwndChild, HWND_TOP, - 0,0,0,0, - SWP_SHOWWINDOW | SWP_NOSIZE); /* native is 0 */ - infoPtr->nPos = -1; - PAGER_SetPos(infoPtr, 0, FALSE); + PAGER_SetPos(infoPtr, 0, FALSE, FALSE); } return 0; @@ -523,9 +517,9 @@ infoPtr->direction = dir; if (dir == PGF_SCROLLLEFT || dir == PGF_SCROLLUP) - PAGER_SetPos(infoPtr, infoPtr->nPos - nmpgScroll.iScroll, TRUE); + PAGER_SetPos(infoPtr, infoPtr->nPos - nmpgScroll.iScroll, TRUE, TRUE); else - PAGER_SetPos(infoPtr, infoPtr->nPos + nmpgScroll.iScroll, TRUE); + PAGER_SetPos(infoPtr, infoPtr->nPos + nmpgScroll.iScroll, TRUE, TRUE); } else infoPtr->direction = -1; @@ -1045,7 +1039,7 @@ return PAGER_SetChild (infoPtr, (HWND)lParam); case PGM_SETPOS: - return PAGER_SetPos(infoPtr, (INT)lParam, FALSE); + return PAGER_SetPos(infoPtr, (INT)lParam, FALSE, TRUE); case WM_CREATE: return PAGER_Create (hwnd, (LPCREATESTRUCTW)lParam); Modified: trunk/reactos/dll/win32/comctl32/propsheet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/propshe…
============================================================================== --- trunk/reactos/dll/win32/comctl32/propsheet.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/propsheet.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -2973,11 +2973,25 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA( LPCPROPSHEETPAGEA lpPropSheetPage) { - PROPSHEETPAGEW* ppsp = Alloc(sizeof(PROPSHEETPAGEW)); - - memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEA))); - - ppsp->dwFlags &= ~ PSP_INTERNAL_UNICODE; + PROPSHEETPAGEW *ppsp; + + if (lpPropSheetPage->dwSize < PROPSHEETPAGEA_V1_SIZE) + return NULL; + + /* original data is used for callback notifications */ + if ((lpPropSheetPage->dwFlags & PSP_USECALLBACK) && lpPropSheetPage->pfnCallback) + { + ppsp = Alloc(2 * sizeof(*ppsp)); + memcpy(ppsp, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEA))); + memcpy(ppsp + 1, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEA))); + } + else + { + ppsp = Alloc(sizeof(*ppsp)); + memcpy(ppsp, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEA))); + } + + ppsp->dwFlags &= ~PSP_INTERNAL_UNICODE; if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) ) { @@ -3029,8 +3043,8 @@ else ppsp->pszHeaderSubTitle = NULL; - if ((ppsp->dwFlags & PSH_USECALLBACK) && ppsp->pfnCallback) - ppsp->pfnCallback(0, PSPCB_ADDREF, ppsp); + if ((ppsp->dwFlags & PSP_USECALLBACK) && ppsp->dwSize > PROPSHEETPAGEA_V1_SIZE && ppsp->pfnCallback) + ppsp->pfnCallback(0, PSPCB_ADDREF, ppsp + 1); return (HPROPSHEETPAGE)ppsp; } @@ -3042,11 +3056,25 @@ */ HPROPSHEETPAGE WINAPI CreatePropertySheetPageW(LPCPROPSHEETPAGEW lpPropSheetPage) { - PROPSHEETPAGEW* ppsp = Alloc(sizeof(PROPSHEETPAGEW)); - - memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEW))); - - ppsp->dwFlags |= PSP_INTERNAL_UNICODE; + PROPSHEETPAGEW *ppsp; + + if (lpPropSheetPage->dwSize < PROPSHEETPAGEW_V1_SIZE) + return NULL; + + /* original data is used for callback notifications */ + if ((lpPropSheetPage->dwFlags & PSP_USECALLBACK) && lpPropSheetPage->pfnCallback) + { + ppsp = Alloc(2 * sizeof(*ppsp)); + memcpy(ppsp, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEW))); + memcpy(ppsp + 1, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEW))); + } + else + { + ppsp = Alloc(sizeof(*ppsp)); + memcpy(ppsp, lpPropSheetPage, min(lpPropSheetPage->dwSize, sizeof(PROPSHEETPAGEW))); + } + + ppsp->dwFlags |= PSP_INTERNAL_UNICODE; if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) ) { @@ -3078,8 +3106,8 @@ else ppsp->pszHeaderSubTitle = NULL; - if ((ppsp->dwFlags & PSH_USECALLBACK) && ppsp->pfnCallback) - ppsp->pfnCallback(0, PSPCB_ADDREF, ppsp); + if ((ppsp->dwFlags & PSP_USECALLBACK) && ppsp->dwSize > PROPSHEETPAGEW_V1_SIZE && ppsp->pfnCallback) + ppsp->pfnCallback(0, PSPCB_ADDREF, ppsp + 1); return (HPROPSHEETPAGE)ppsp; } @@ -3102,8 +3130,8 @@ if (!psp) return FALSE; - if ((psp->dwFlags & PSH_USECALLBACK) && psp->pfnCallback) - psp->pfnCallback(0, PSPCB_RELEASE, psp); + if ((psp->dwFlags & PSP_USECALLBACK) && psp->pfnCallback) + psp->pfnCallback(0, PSPCB_RELEASE, psp + 1); if (!(psp->dwFlags & PSP_DLGINDIRECT) && !IS_INTRESOURCE( psp->u.pszTemplate )) Free ((LPVOID)psp->u.pszTemplate); @@ -3393,7 +3421,7 @@ (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) && #ifdef __REACTOS__ (psInfo->ppshheader.dwFlags & PSH_WATERMARK) && - (psInfo->ppshheader.u4.hbmWatermark) ) + (psInfo->ppshheader.u4.hbmWatermark) ) #else (psInfo->ppshheader.dwFlags & PSH_WATERMARK) ) #endif Modified: trunk/reactos/dll/win32/comctl32/resource.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/resourc…
============================================================================== --- trunk/reactos/dll/win32/comctl32/resource.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/resource.h [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -59,6 +59,14 @@ #define IDI_TT_WARN_SM 25 #define IDI_TT_ERROR_SM 28 +/* Taskdialog strings */ +#define IDS_BUTTON_YES 3000 +#define IDS_BUTTON_NO 3001 +#define IDS_BUTTON_RETRY 3002 +#define IDS_BUTTON_OK 3003 +#define IDS_BUTTON_CANCEL 3004 +#define IDS_BUTTON_CLOSE 3005 + // This is really ComCtl32 v5.82, the last one not supporting SxS #undef COMCTL32_VERSION // Undefines what the PSDK gave to us #define COMCTL32_VERSION 5 Modified: trunk/reactos/dll/win32/comctl32/syslink.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/syslink…
============================================================================== --- trunk/reactos/dll/win32/comctl32/syslink.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/syslink.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -28,8 +28,6 @@ */ #include "comctl32.h" - -#include <wine/list.h> WINE_DEFAULT_DEBUG_CHANNEL(syslink); Added: trunk/reactos/dll/win32/comctl32/taskdialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/taskdia…
============================================================================== --- trunk/reactos/dll/win32/comctl32/taskdialog.c (added) +++ trunk/reactos/dll/win32/comctl32/taskdialog.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -0,0 +1,373 @@ +/* + * Task dialog control + * + * Copyright 2017 Fabian Maurer + * + * 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 "comctl32.h" + +WINE_DEFAULT_DEBUG_CHANNEL(taskdialog); + +#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align))&~(_Align)) +#define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align)) +#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align) +#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align) + +static const UINT DIALOG_MIN_WIDTH = 180; +static const UINT DIALOG_SPACING = 5; +static const UINT DIALOG_BUTTON_WIDTH = 50; +static const UINT DIALOG_BUTTON_HEIGHT = 14; + +static const UINT ID_MAIN_INSTRUCTION = 0xf000; +static const UINT ID_CONTENT = 0xf001; + +struct taskdialog_control +{ + struct list entry; + DLGITEMTEMPLATE *template; + unsigned int template_size; +}; + +struct taskdialog_template_desc +{ + const TASKDIALOGCONFIG *taskconfig; + unsigned int dialog_height; + unsigned int dialog_width; + struct list controls; + WORD control_count; + LONG x_baseunit; + LONG y_baseunit; + HFONT font; +}; + +static void pixels_to_dialogunits(const struct taskdialog_template_desc *desc, LONG *width, LONG *height) +{ + if (width) + *width = MulDiv(*width, 4, desc->x_baseunit); + if (height) + *height = MulDiv(*height, 8, desc->y_baseunit); +} + +static void dialogunits_to_pixels(const struct taskdialog_template_desc *desc, LONG *width, LONG *height) +{ + if (width) + *width = MulDiv(*width, desc->x_baseunit, 4); + if (height) + *height = MulDiv(*height, desc->y_baseunit, 8); +} + +static void template_write_data(char **ptr, const void *src, unsigned int size) +{ + memcpy(*ptr, src, size); + *ptr += size; +} + +static unsigned int taskdialog_add_control(struct taskdialog_template_desc *desc, WORD id, const WCHAR *class, + HINSTANCE hInstance, const WCHAR *text, short x, short y, short cx, short cy) +{ + struct taskdialog_control *control = Alloc(sizeof(*control)); + unsigned int size, class_size, text_size; + DLGITEMTEMPLATE *template; + static const WCHAR nulW; + const WCHAR *textW; + char *ptr; + + class_size = (strlenW(class) + 1) * sizeof(WCHAR); + + if (IS_INTRESOURCE(text)) + text_size = LoadStringW(hInstance, (UINT_PTR)text, (WCHAR *)&textW, 0) * sizeof(WCHAR); + else + { + textW = text; + text_size = strlenW(textW) * sizeof(WCHAR); + } + + size = sizeof(DLGITEMTEMPLATE); + size += class_size; + size += text_size + sizeof(WCHAR); + size += sizeof(WORD); /* creation data */ + + control->template = template = Alloc(size); + control->template_size = size; + + template->style = WS_VISIBLE; + template->dwExtendedStyle = 0; + template->x = x; + template->y = y; + template->cx = cx; + template->cy = cy; + template->id = id; + ptr = (char *)(template + 1); + template_write_data(&ptr, class, class_size); + template_write_data(&ptr, textW, text_size); + template_write_data(&ptr, &nulW, sizeof(nulW)); + + list_add_tail(&desc->controls, &control->entry); + desc->control_count++; + return ALIGNED_LENGTH(size, 3); +} + +static unsigned int taskdialog_add_static_label(struct taskdialog_template_desc *desc, WORD id, const WCHAR *str) +{ + RECT rect = { 0, 0, desc->dialog_width - DIALOG_SPACING * 2, 0}; /* padding left and right of the control */ + const WCHAR *textW = NULL; + unsigned int size, length; + HFONT oldfont; + HDC hdc; + + if (!str) + return 0; + + if (IS_INTRESOURCE(str)) + { + if (!(length = LoadStringW(desc->taskconfig->hInstance, (UINT_PTR)str, (WCHAR *)&textW, 0))) + { + WARN("Failed to load static text %s, id %#x\n", debugstr_w(str), id); + return 0; + } + } + else + { + textW = str; + length = strlenW(textW); + } + + hdc = GetDC(0); + oldfont = SelectObject(hdc, desc->font); + + dialogunits_to_pixels(desc, &rect.right, NULL); + DrawTextW(hdc, textW, length, &rect, DT_LEFT | DT_EXPANDTABS | DT_CALCRECT | DT_WORDBREAK); + pixels_to_dialogunits(desc, &rect.right, &rect.bottom); + + SelectObject(hdc, oldfont); + ReleaseDC(0, hdc); + + desc->dialog_height += DIALOG_SPACING; + size = taskdialog_add_control(desc, id, WC_STATICW, desc->taskconfig->hInstance, str, DIALOG_SPACING, + desc->dialog_height, rect.right, rect.bottom); + desc->dialog_height += rect.bottom; + return size; +} + +static unsigned int taskdialog_add_main_instruction(struct taskdialog_template_desc *desc) +{ + return taskdialog_add_static_label(desc, ID_MAIN_INSTRUCTION, desc->taskconfig->pszMainInstruction); +} + +static unsigned int taskdialog_add_content(struct taskdialog_template_desc *desc) +{ + return taskdialog_add_static_label(desc, ID_CONTENT, desc->taskconfig->pszContent); +} + +static unsigned int taskdialog_add_common_buttons(struct taskdialog_template_desc *desc) +{ + short button_x = desc->dialog_width - DIALOG_BUTTON_WIDTH - DIALOG_SPACING; + DWORD flags = desc->taskconfig->dwCommonButtons; + unsigned int size = 0; + +#define TASKDIALOG_ADD_COMMON_BUTTON(id) \ + do { \ + size += taskdialog_add_control(desc, ID##id, WC_BUTTONW, COMCTL32_hModule, MAKEINTRESOURCEW(IDS_BUTTON_##id), \ + button_x, desc->dialog_height + DIALOG_SPACING, DIALOG_BUTTON_WIDTH, DIALOG_BUTTON_HEIGHT); \ + button_x -= DIALOG_BUTTON_WIDTH + DIALOG_SPACING; \ + } while(0) + if (flags & TDCBF_CLOSE_BUTTON) + TASKDIALOG_ADD_COMMON_BUTTON(CLOSE); + if (flags & TDCBF_CANCEL_BUTTON) + TASKDIALOG_ADD_COMMON_BUTTON(CANCEL); + if (flags & TDCBF_RETRY_BUTTON) + TASKDIALOG_ADD_COMMON_BUTTON(RETRY); + if (flags & TDCBF_NO_BUTTON) + TASKDIALOG_ADD_COMMON_BUTTON(NO); + if (flags & TDCBF_YES_BUTTON) + TASKDIALOG_ADD_COMMON_BUTTON(YES); + if (flags & TDCBF_OK_BUTTON) + TASKDIALOG_ADD_COMMON_BUTTON(OK); + /* Always add OK button */ + if (list_empty(&desc->controls)) + TASKDIALOG_ADD_COMMON_BUTTON(OK); +#undef TASKDIALOG_ADD_COMMON_BUTTON + + /* make room for common buttons row */ + desc->dialog_height += DIALOG_BUTTON_HEIGHT + 2 * DIALOG_SPACING; + return size; +} + +static void taskdialog_clear_controls(struct list *controls) +{ + struct taskdialog_control *control, *control2; + + LIST_FOR_EACH_ENTRY_SAFE(control, control2, controls, struct taskdialog_control, entry) + { + list_remove(&control->entry); + Free(control->template); + Free(control); + } +} + +static unsigned int taskdialog_get_reference_rect(const struct taskdialog_template_desc *desc, RECT *ret) +{ + HMONITOR monitor = MonitorFromWindow(desc->taskconfig->hwndParent ? desc->taskconfig->hwndParent : GetActiveWindow(), + MONITOR_DEFAULTTOPRIMARY); + MONITORINFO info; + + info.cbSize = sizeof(info); + GetMonitorInfoW(monitor, &info); + + if (desc->taskconfig->dwFlags & TDF_POSITION_RELATIVE_TO_WINDOW && desc->taskconfig->hwndParent) + GetWindowRect(desc->taskconfig->hwndParent, ret); + else + *ret = info.rcWork; + + pixels_to_dialogunits(desc, &ret->left, &ret->top); + pixels_to_dialogunits(desc, &ret->right, &ret->bottom); + + pixels_to_dialogunits(desc, &info.rcWork.left, &info.rcWork.top); + pixels_to_dialogunits(desc, &info.rcWork.right, &info.rcWork.bottom); + return info.rcWork.right - info.rcWork.left; +} + +static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfig) +{ + struct taskdialog_control *control, *control2; + unsigned int size, title_size, screen_width; + struct taskdialog_template_desc desc; + static const WORD fontsize = 0x7fff; + static const WCHAR emptyW[] = { 0 }; + const WCHAR *titleW = NULL; + DLGTEMPLATE *template; + NONCLIENTMETRICSW ncm; + RECT ref_rect; + char *ptr; + HDC hdc; + + /* Window title */ + if (!taskconfig->pszWindowTitle) + FIXME("use executable name for window title\n"); + else if (IS_INTRESOURCE(taskconfig->pszWindowTitle)) + FIXME("load window title from resources\n"); + else + titleW = taskconfig->pszWindowTitle; + if (!titleW) + titleW = emptyW; + title_size = (strlenW(titleW) + 1) * sizeof(WCHAR); + + size = sizeof(DLGTEMPLATE) + 2 * sizeof(WORD); + size += title_size; + size += 2; /* font size */ + + list_init(&desc.controls); + desc.taskconfig = taskconfig; + desc.control_count = 0; + + ncm.cbSize = sizeof(ncm); + SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); + desc.font = CreateFontIndirectW(&ncm.lfMessageFont); + + hdc = GetDC(0); + SelectObject(hdc, desc.font); + desc.x_baseunit = GdiGetCharDimensions(hdc, NULL, &desc.y_baseunit); + ReleaseDC(0, hdc); + + screen_width = taskdialog_get_reference_rect(&desc, &ref_rect); + + desc.dialog_height = 0; + desc.dialog_width = max(taskconfig->cxWidth, DIALOG_MIN_WIDTH); + desc.dialog_width = min(desc.dialog_width, screen_width); + + size += taskdialog_add_main_instruction(&desc); + size += taskdialog_add_content(&desc); + size += taskdialog_add_common_buttons(&desc); + + template = Alloc(size); + if (!template) + { + taskdialog_clear_controls(&desc.controls); + DeleteObject(desc.font); + return NULL; + } + + template->style = DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_SYSMENU; + template->cdit = desc.control_count; + template->x = (ref_rect.left + ref_rect.right + desc.dialog_width) / 2; + template->y = (ref_rect.top + ref_rect.bottom + desc.dialog_height) / 2; + template->cx = desc.dialog_width; + template->cy = desc.dialog_height; + + ptr = (char *)(template + 1); + ptr += 2; /* menu */ + ptr += 2; /* class */ + template_write_data(&ptr, titleW, title_size); + template_write_data(&ptr, &fontsize, sizeof(fontsize)); + + /* write control entries */ + LIST_FOR_EACH_ENTRY_SAFE(control, control2, &desc.controls, struct taskdialog_control, entry) + { + ALIGN_POINTER(ptr, 3); + + template_write_data(&ptr, control->template, control->template_size); + + /* list item won't be needed later */ + list_remove(&control->entry); + Free(control->template); + Free(control); + } + + DeleteObject(desc.font); + return template; +} + +static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + TRACE("hwnd=%p msg=0x%04x wparam=%lx lparam=%lx\n", hwnd, msg, wParam, lParam); + + switch (msg) + { + case WM_COMMAND: + if (HIWORD(wParam) == BN_CLICKED) + { + WORD command_id = LOWORD(wParam); + EndDialog(hwnd, command_id); + return TRUE; + } + break; + } + return FALSE; +} + +/*********************************************************************** + * TaskDialogIndirect [COMCTL32.@] + */ +HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *taskconfig, int *button, + int *radio_button, BOOL *verification_flag_checked) +{ + DLGTEMPLATE *template; + INT ret; + + TRACE("%p, %p, %p, %p\n", taskconfig, button, radio_button, verification_flag_checked); + + template = create_taskdialog_template(taskconfig); + ret = DialogBoxIndirectParamW(taskconfig->hInstance, template, taskconfig->hwndParent, taskdialog_proc, 0); + Free(template); + + if (button) *button = ret; + if (radio_button) *radio_button = taskconfig->nDefaultButton; + if (verification_flag_checked) *verification_flag_checked = TRUE; + + return S_OK; +} Propchange: trunk/reactos/dll/win32/comctl32/taskdialog.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/comctl32/theme_button.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theme_b…
============================================================================== --- trunk/reactos/dll/win32/comctl32/theme_button.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/theme_button.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -34,8 +34,13 @@ STATE_DEFAULTED } ButtonState; +#ifdef __REACTOS__ /* r73885 */ typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag); - +#else +typedef void (*pfThemedPaint)(HTHEME theme, HWND hwnd, HDC hdc, ButtonState drawState, UINT dtFlags, BOOL focused); +#endif + +#ifdef __REACTOS__ /* r73885 & r73907 */ static inline LONG get_button_state( HWND hwnd ) { return _GetButtonData(hwnd)->state; @@ -50,6 +55,7 @@ { return _GetButtonData(hwnd)->image; } +#endif static UINT get_drawtext_flags(DWORD style, DWORD ex_style) { @@ -102,36 +108,54 @@ return text; } +#ifdef __REACTOS__ /* r73885 */ static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag) +#else +static void PB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused) +#endif { static const int states[] = { PBS_NORMAL, PBS_DISABLED, PBS_HOT, PBS_PRESSED, PBS_DEFAULTED }; RECT bgRect, textRect; +#ifdef __REACTOS__ /* r73885 */ HFONT font = get_button_font(hwnd); +#else + HFONT font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0); +#endif HFONT hPrevFont = font ? SelectObject(hDC, font) : NULL; int state = states[ drawState ]; WCHAR *text = get_button_text(hwnd); +#ifdef __REACTOS__ /* r74012 & r74406 */ PBUTTON_DATA pdata = _GetButtonData(hwnd); SIZE ImageSize; HWND parent; HBRUSH hBrush; +#endif GetClientRect(hwnd, &bgRect); GetThemeBackgroundContentRect(theme, hDC, BP_PUSHBUTTON, state, &bgRect, &textRect); +#ifdef __REACTOS__ /* r73885 & r74149 */ if (prfFlag == 0) { if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state)) DrawThemeParentBackground(hwnd, hDC, NULL); } - +#else + if (IsThemeBackgroundPartiallyTransparent(theme, BP_PUSHBUTTON, state)) + DrawThemeParentBackground(hwnd, hDC, NULL); +#endif + +#ifdef __REACTOS__ /* r74406 */ parent = GetParent(hwnd); if (!parent) parent = hwnd; hBrush = (HBRUSH)SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd ); FillRect( hDC, &bgRect, hBrush ); +#endif DrawThemeBackground(theme, hDC, BP_PUSHBUTTON, state, &bgRect, NULL); +#ifdef __REACTOS__ /* r74012 */ if (pdata->imlData.himl && ImageList_GetIconSize(pdata->imlData.himl, &ImageSize.cx, &ImageSize.cy)) { int left = textRect.left + pdata->imlData.margin.left; @@ -139,6 +163,7 @@ textRect.left += pdata->imlData.margin.left + pdata->imlData.margin.right + ImageSize.cy; ImageList_Draw(pdata->imlData.himl, 0, hDC, left, top, 0); } +#endif if (text) { @@ -164,7 +189,11 @@ if (hPrevFont) SelectObject(hDC, hPrevFont); } +#ifdef __REACTOS__ /* r73885 */ static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag) +#else +static void CB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused) +#endif { static const int cb_states[3][5] = { @@ -182,7 +211,11 @@ SIZE sz; RECT bgRect, textRect; HFONT font, hPrevFont = NULL; +#ifdef __REACTOS__ /* r73885 */ LRESULT checkState = get_button_state(hwnd) & 3; +#else + LRESULT checkState = SendMessageW(hwnd, BM_GETCHECK, 0, 0); +#endif DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE); int part = ((dwStyle & BUTTON_TYPE) == BS_RADIOBUTTON) || ((dwStyle & BUTTON_TYPE) == BS_AUTORADIOBUTTON) ? BP_RADIOBUTTON @@ -193,8 +226,10 @@ WCHAR *text = get_button_text(hwnd); LOGFONTW lf; BOOL created_font = FALSE; +#ifdef __REACTOS__ /* r74406 */ HWND parent; HBRUSH hBrush; +#endif HRESULT hr = GetThemeFont(theme, hDC, part, state, TMT_FONT, &lf); if (SUCCEEDED(hr)) { @@ -207,7 +242,11 @@ created_font = TRUE; } } else { +#ifdef __REACTOS__ /* r73885 */ font = get_button_font(hwnd); +#else + font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0); +#endif hPrevFont = SelectObject(hDC, font); } @@ -216,6 +255,7 @@ GetClientRect(hwnd, &bgRect); +#ifdef __REACTOS__ /* r73885, r74149 and r74406 */ if (prfFlag == 0) { DrawThemeParentBackground(hwnd, hDC, NULL); @@ -229,6 +269,7 @@ hBrush = (HBRUSH)DefWindowProcW(parent, WM_CTLCOLORSTATIC, (WPARAM)hDC, (LPARAM)hwnd ); FillRect( hDC, &bgRect, hBrush ); +#endif GetThemeBackgroundContentRect(theme, hDC, part, state, &bgRect, &textRect); @@ -240,6 +281,10 @@ bgRect.right = bgRect.left + sz.cx; textRect.left = bgRect.right + 6; +#ifndef __REACTOS__ /* r74406 */ + DrawThemeParentBackground(hwnd, hDC, NULL); +#endif + DrawThemeBackground(theme, hDC, part, state, &bgRect, NULL); if (text) { @@ -266,7 +311,11 @@ if (hPrevFont) SelectObject(hDC, hPrevFont); } +#ifdef __REACTOS__ /* r73885 */ static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused, LPARAM prfFlag) +#else +static void GB_draw(HTHEME theme, HWND hwnd, HDC hDC, ButtonState drawState, UINT dtFlags, BOOL focused) +#endif { static const int states[] = { GBS_NORMAL, GBS_DISABLED, GBS_NORMAL, GBS_NORMAL, GBS_NORMAL }; @@ -276,9 +325,11 @@ LOGFONTW lf; HFONT font, hPrevFont = NULL; BOOL created_font = FALSE; +#ifdef __REACTOS__ /* r74406 */ HWND parent; HBRUSH hBrush; RECT clientRect; +#endif HRESULT hr = GetThemeFont(theme, hDC, BP_GROUPBOX, state, TMT_FONT, &lf); if (SUCCEEDED(hr)) { @@ -290,7 +341,11 @@ created_font = TRUE; } } else { +#ifdef __REACTOS__ /* r73885 */ font = get_button_font(hwnd); +#else + font = (HFONT)SendMessageW(hwnd, WM_GETFONT, 0, 0); +#endif hPrevFont = SelectObject(hDC, font); } @@ -312,12 +367,18 @@ GetThemeBackgroundContentRect(theme, hDC, BP_GROUPBOX, state, &bgRect, &contentRect); ExcludeClipRect(hDC, contentRect.left, contentRect.top, contentRect.right, contentRect.bottom); +#ifdef __REACTOS__ /* r73885 & r74149 */ if (prfFlag == 0) { if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state)) DrawThemeParentBackground(hwnd, hDC, NULL); } - +#else + if (IsThemeBackgroundPartiallyTransparent(theme, BP_GROUPBOX, state)) + DrawThemeParentBackground(hwnd, hDC, NULL); +#endif + +#ifdef __REACTOS__ /* r74406 */ parent = GetParent(hwnd); if (!parent) parent = hwnd; hBrush = (HBRUSH)SendMessageW(parent, WM_CTLCOLORSTATIC, @@ -327,6 +388,7 @@ (WPARAM)hDC, (LPARAM)hwnd ); GetClientRect(hwnd, &clientRect); FillRect( hDC, &clientRect, hBrush ); +#endif DrawThemeBackground(theme, hDC, BP_GROUPBOX, state, &bgRect, NULL); @@ -363,14 +425,28 @@ NULL, /* Not defined */ }; +#ifdef __REACTOS__ /* r73873 */ BOOL BUTTON_PaintWithTheme(HTHEME theme, HWND hwnd, HDC hParamDC, LPARAM prfFlag) -{ +#else +static BOOL BUTTON_Paint(HTHEME theme, HWND hwnd, HDC hParamDC) +#endif +{ +#ifdef __REACTOS__ /* r73873, r73897 and r74120 */ DWORD dwStyle; DWORD dwStyleEx; DWORD type; UINT dtFlags; int state; +#else + PAINTSTRUCT ps; + HDC hDC; + DWORD dwStyle = GetWindowLongW(hwnd, GWL_STYLE); + DWORD dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE); + UINT dtFlags = get_drawtext_flags(dwStyle, dwStyleEx); + int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0); +#endif ButtonState drawState; +#ifdef __REACTOS__ /* r73873, r73897, r73907 and r74120 */ pfThemedPaint paint; dwStyle = GetWindowLongW(hwnd, GWL_STYLE); @@ -389,6 +465,9 @@ dwStyleEx = GetWindowLongW(hwnd, GWL_EXSTYLE); dtFlags = get_drawtext_flags(dwStyle, dwStyleEx); state = get_button_state(hwnd); +#else + pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ]; +#endif if(IsWindowEnabled(hwnd)) { @@ -399,11 +478,118 @@ } else drawState = STATE_DISABLED; +#ifndef __REACTOS__ /* r73873 */ + hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps); + if (paint) paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS); + if (!hParamDC) EndPaint(hwnd, &ps); +#endif + +#ifdef __REACTOS__ /* r74074 & r74120 */ if (drawState == STATE_NORMAL && type == BS_DEFPUSHBUTTON) { drawState = STATE_DEFAULTED; } +#endif paint(theme, hwnd, hParamDC, drawState, dtFlags, state & BST_FOCUS, prfFlag); return TRUE; } + +#ifndef __REACTOS__ /* r73873 */ +/********************************************************************** + * The button control subclass window proc. + */ +LRESULT CALLBACK THEMING_ButtonSubclassProc(HWND hwnd, UINT msg, + WPARAM wParam, LPARAM lParam, + ULONG_PTR dwRefData) +{ + const WCHAR* themeClass = WC_BUTTONW; + HTHEME theme; + LRESULT result; + + switch (msg) + { + case WM_CREATE: + result = THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); + OpenThemeData(hwnd, themeClass); + return result; + + case WM_DESTROY: + theme = GetWindowTheme(hwnd); + CloseThemeData (theme); + return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); + + case WM_THEMECHANGED: + theme = GetWindowTheme(hwnd); + CloseThemeData (theme); + OpenThemeData(hwnd, themeClass); + break; + + case WM_SYSCOLORCHANGE: + theme = GetWindowTheme(hwnd); + if (!theme) return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); + /* Do nothing. When themed, a WM_THEMECHANGED will be received, too, + * which will do the repaint. */ + break; + + case WM_PAINT: + theme = GetWindowTheme(hwnd); + if (theme && BUTTON_Paint(theme, hwnd, (HDC)wParam)) + return 0; + else + return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); + + case WM_ENABLE: + theme = GetWindowTheme(hwnd); + if (theme) { + RedrawWindow(hwnd, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW); + return 0; + } else + return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); + + case WM_MOUSEMOVE: + { + TRACKMOUSEEVENT mouse_event; + mouse_event.cbSize = sizeof(TRACKMOUSEEVENT); + mouse_event.dwFlags = TME_QUERY; + if(!TrackMouseEvent(&mouse_event) || !(mouse_event.dwFlags&(TME_HOVER|TME_LEAVE))) + { + mouse_event.dwFlags = TME_HOVER|TME_LEAVE; + mouse_event.hwndTrack = hwnd; + mouse_event.dwHoverTime = 1; + TrackMouseEvent(&mouse_event); + } + break; + } + + case WM_MOUSEHOVER: + { + int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0); + SetWindowLongW(hwnd, 0, state|BST_HOT); + InvalidateRect(hwnd, NULL, FALSE); + break; + } + + case WM_MOUSELEAVE: + { + int state = (int)SendMessageW(hwnd, BM_GETSTATE, 0, 0); + SetWindowLongW(hwnd, 0, state&(~BST_HOT)); + InvalidateRect(hwnd, NULL, FALSE); + break; + } + + case BM_SETCHECK: + case BM_SETSTATE: + theme = GetWindowTheme(hwnd); + if (theme) { + InvalidateRect(hwnd, NULL, FALSE); + } + return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); + + default: + /* Call old proc */ + return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); + } + return 0; +} +#endif /* !__REACTOS__ */ Modified: trunk/reactos/dll/win32/comctl32/theme_edit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theme_e…
============================================================================== --- trunk/reactos/dll/win32/comctl32/theme_edit.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/theme_edit.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -52,11 +52,16 @@ CombineRgn (cliprgn, cliprgn, region, RGN_AND); OffsetRect(&r, -r.left, -r.top); +#ifdef __REACTOS__ /* r73789 */ dc = GetWindowDC(hwnd); /* Exclude client part */ ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge, r.right - cxEdge, r.bottom -cyEdge); - +#else + dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN); + OffsetRect(&r, -r.left, -r.top); +#endif + if (IsThemeBackgroundPartiallyTransparent (theme, part, state)) DrawThemeParentBackground(hwnd, dc, &r); DrawThemeBackground (theme, dc, part, state, &r, 0); Modified: trunk/reactos/dll/win32/comctl32/theme_listbox.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theme_l…
============================================================================== --- trunk/reactos/dll/win32/comctl32/theme_listbox.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/theme_listbox.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -42,11 +42,16 @@ CombineRgn (cliprgn, cliprgn, region, RGN_AND); OffsetRect(&r, -r.left, -r.top); +#ifdef __REACTOS__ /* r73789 */ dc = GetWindowDC(hwnd); /* Exclude client part */ ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge, r.right - cxEdge, r.bottom -cyEdge); - +#else + dc = GetDCEx(hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN); + OffsetRect(&r, -r.left, -r.top); +#endif + if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0)) DrawThemeParentBackground(hwnd, dc, &r); DrawThemeBackground (theme, dc, 0, 0, &r, 0); Modified: trunk/reactos/dll/win32/comctl32/theming.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theming…
============================================================================== --- trunk/reactos/dll/win32/comctl32/theming.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/theming.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -26,8 +26,16 @@ typedef LRESULT (CALLBACK* THEMING_SUBCLASSPROC)(HWND, UINT, WPARAM, LPARAM, ULONG_PTR); +#ifndef __REACTOS__ /* r73871 */ +extern LRESULT CALLBACK THEMING_ButtonSubclassProc (HWND, UINT, WPARAM, LPARAM, + ULONG_PTR) DECLSPEC_HIDDEN; +#endif extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM, ULONG_PTR) DECLSPEC_HIDDEN; +#ifndef __REACTOS__ /* r73803 */ +extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM, + ULONG_PTR) DECLSPEC_HIDDEN; +#endif extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM, ULONG_PTR) DECLSPEC_HIDDEN; extern LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND, UINT, WPARAM, LPARAM, @@ -44,6 +52,10 @@ THEMING_SUBCLASSPROC subclassProc; } subclasses[] = { /* Note: list must be sorted by class name */ +#ifndef __REACTOS__ /* r73803 & r73871 */ + {dialogClass, THEMING_DialogSubclassProc}, + {WC_BUTTONW, THEMING_ButtonSubclassProc}, +#endif {WC_COMBOBOXW, THEMING_ComboSubclassProc}, {comboLboxClass, THEMING_ListBoxSubclassProc}, {WC_EDITW, THEMING_EditSubclassProc}, @@ -83,13 +95,23 @@ MAKE_SUBCLASS_PROC(2) MAKE_SUBCLASS_PROC(3) MAKE_SUBCLASS_PROC(4) +#ifndef __REACTOS__ /* r73803 & r73871 */ +MAKE_SUBCLASS_PROC(5) +MAKE_SUBCLASS_PROC(6) +#endif static const WNDPROC subclassProcs[NUM_SUBCLASSES] = { subclass_proc0, subclass_proc1, subclass_proc2, subclass_proc3, +#ifdef __REACTOS__ /* r73871 */ subclass_proc4 +#else + subclass_proc4, + subclass_proc5, + subclass_proc6 +#endif }; /*********************************************************************** @@ -98,15 +120,23 @@ * Register classes for standard controls that will shadow the system * classes. */ -void THEMING_Initialize (HANDLE hActCtx5, HANDLE hActCtx6) +#ifdef __REACTOS__ /* r73803 */ +void THEMING_Initialize(HANDLE hActCtx5, HANDLE hActCtx6) +#else +void THEMING_Initialize (void) +#endif { unsigned int i; static const WCHAR subclassPropName[] = { 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 }; static const WCHAR refDataPropName[] = { 'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0 }; +#ifdef __REACTOS__ /* r73803 */ ULONG_PTR ulCookie; BOOL ret, bActivated; +#else + if (!IsThemeActive()) return; +#endif atSubclassProp = GlobalAddAtomW (subclassPropName); atRefDataProp = GlobalAddAtomW (refDataPropName); @@ -117,12 +147,16 @@ class.cbSize = sizeof(class); +#ifdef __REACTOS__ /* r73803 */ bActivated = ActivateActCtx(hActCtx5, &ulCookie); ret = GetClassInfoExW (NULL, subclasses[i].className, &class); if (bActivated) DeactivateActCtx(0, ulCookie); if (!ret) +#else + if (!GetClassInfoExW (NULL, subclasses[i].className, &class)) +#endif { ERR("Could not retrieve information for class %s\n", debugstr_w (subclasses[i].className)); @@ -130,9 +164,11 @@ } originalProcs[i] = class.lpfnWndProc; class.lpfnWndProc = subclassProcs[i]; +#ifdef __REACTOS__ /* r73803 */ class.style |= CS_GLOBALCLASS; class.hInstance = COMCTL32_hModule; - +#endif + if (!class.lpfnWndProc) { ERR("Missing proc for class %s\n", @@ -140,11 +176,16 @@ continue; } +#ifdef __REACTOS__ /* r73803 */ bActivated = ActivateActCtx(hActCtx6, &ulCookie); - +#endif if (!RegisterClassExW (&class)) { +#ifdef __REACTOS__ /* r73803 */ WARN("Could not re-register class %s: %x\n", +#else + ERR("Could not re-register class %s: %x\n", +#endif debugstr_w (subclasses[i].className), GetLastError ()); } else @@ -153,8 +194,10 @@ debugstr_w (subclasses[i].className)); } +#ifdef __REACTOS__ /* r73803 */ if (bActivated) DeactivateActCtx(0, ulCookie); +#endif } } Modified: trunk/reactos/dll/win32/comctl32/treeview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/treevie…
============================================================================== --- trunk/reactos/dll/win32/comctl32/treeview.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/treeview.c [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -4333,7 +4333,12 @@ ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); - TREEVIEW_HitTest(infoPtr, &ht); + if (TREEVIEW_HitTest(infoPtr, &ht)) + { + infoPtr->focusedItem = ht.hItem; + TREEVIEW_InvalidateItem(infoPtr, infoPtr->focusedItem); + TREEVIEW_InvalidateItem(infoPtr, infoPtr->selectedItem); + } if (TREEVIEW_TrackMouse(infoPtr, ht.pt)) { @@ -4352,6 +4357,13 @@ SendMessageW(infoPtr->hwndNotify, WM_CONTEXTMENU, (WPARAM)infoPtr->hwnd, (LPARAM)GetMessagePos()); } + } + + if (ht.hItem) + { + TREEVIEW_InvalidateItem(infoPtr, infoPtr->focusedItem); + infoPtr->focusedItem = infoPtr->selectedItem; + TREEVIEW_InvalidateItem(infoPtr, infoPtr->focusedItem); } return 0; @@ -5434,10 +5446,15 @@ CombineRgn (cliprgn, cliprgn, region, RGN_AND); OffsetRect(&r, -r.left, -r.top); +#ifdef __REACTOS__ /* r73789 */ dc = GetWindowDC(infoPtr->hwnd); /* Exclude client part */ ExcludeClipRect(dc, r.left + cxEdge, r.top + cyEdge, r.right - cxEdge, r.bottom -cyEdge); +#else + dc = GetDCEx(infoPtr->hwnd, region, DCX_WINDOW|DCX_INTERSECTRGN); + OffsetRect(&r, -r.left, -r.top); +#endif if (IsThemeBackgroundPartiallyTransparent (theme, 0, 0)) DrawThemeParentBackground(infoPtr->hwnd, dc, &r); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sun Jun 4 12:53:17 2017 @@ -54,7 +54,7 @@ reactos/dll/win32/cabinet # Synced to WineStaging-2.2 reactos/dll/win32/clusapi # Synced to WineStaging-1.9.11 reactos/dll/win32/comcat # Synced to WineStaging-1.9.11 -reactos/dll/win32/comctl32 # Synced to WineStaging-2.2 +reactos/dll/win32/comctl32 # Synced to WineStaging-2.9 reactos/dll/win32/comdlg32 # Synced to WineStaging-2.9 reactos/dll/win32/compstui # Synced to WineStaging-2.2 reactos/dll/win32/credui # Synced to WineStaging-2.9
7 years, 10 months
1
0
0
0
← Newer
1
...
32
33
34
35
36
37
38
...
53
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Results per page:
10
25
50
100
200