diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b85c32934b..90f3e629ede 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,9 @@ add_subdirectory(drivers) #add_subdirectory(dxtest) add_subdirectory(kmtests) #add_subdirectory(regtests) -add_subdirectory(rosautotest) +if(NOT MSVC) # FIXME: msvc build + add_subdirectory(rosautotest) +endif() add_subdirectory(tests) add_subdirectory(win32) add_subdirectory(winetests) diff --git a/apitests/ntdll/CMakeLists.txt b/apitests/ntdll/CMakeLists.txt index 71dc759aa4d..46bbba744d8 100644 --- a/apitests/ntdll/CMakeLists.txt +++ b/apitests/ntdll/CMakeLists.txt @@ -2,6 +2,7 @@ add_definitions(-D_DLL -D__USE_CRTIMP) list(APPEND SOURCE + NtFreeVirtualMemory.c RtlInitializeBitMap.c ZwContinue.c testlist.c) diff --git a/apitests/ntdll/NtFreeVirtualMemory.c b/apitests/ntdll/NtFreeVirtualMemory.c new file mode 100644 index 00000000000..416e54b6e2d --- /dev/null +++ b/apitests/ntdll/NtFreeVirtualMemory.c @@ -0,0 +1,172 @@ +#define WIN32_NO_STATUS +#include +#include +#include + +static void Test_NtFreeVirtualMemory(void) +{ + PVOID Buffer = NULL, Buffer2; + SIZE_T Length = PAGE_SIZE; + NTSTATUS Status; + + Status = NtAllocateVirtualMemory(NtCurrentProcess(), + &Buffer, + 0, + &Length, + MEM_RESERVE, + PAGE_READWRITE); + ok(NT_SUCCESS(Status), "NtAllocateVirtualMemory failed : 0x%08x\n", Status); + ok(Length == PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(((ULONG_PTR)Buffer % PAGE_SIZE) == 0, "The buffer is not aligned to PAGE_SIZE.\n"); + + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer, + &Length, + MEM_DECOMMIT); + ok(Status == STATUS_SUCCESS, "NtFreeVirtualMemory failed : 0x%08x\n", Status); + + /* Now try to free more than we got */ + Length++; + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer, + &Length, + MEM_DECOMMIT); + ok(Status == STATUS_UNABLE_TO_FREE_VM, "NtFreeVirtualMemory returned status : 0x%08x\n", Status); + + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer, + &Length, + MEM_RELEASE); + ok(Status == STATUS_UNABLE_TO_FREE_VM, "NtFreeVirtualMemory returned status : 0x%08x\n", Status); + + /* Free out of bounds from the wrong origin */ + Length = PAGE_SIZE; + Buffer2 = (PVOID)((ULONG_PTR)Buffer+1); + + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_DECOMMIT); + ok(Status == STATUS_UNABLE_TO_FREE_VM, "NtFreeVirtualMemory returned status : 0x%08x\n", Status); + + Buffer2 = (PVOID)((ULONG_PTR)Buffer+1); + Length = PAGE_SIZE; + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_RELEASE); + ok(Status == STATUS_UNABLE_TO_FREE_VM, "NtFreeVirtualMemory returned status : 0x%08x\n", Status); + + /* Same but in bounds */ + Length = PAGE_SIZE - 1; + Buffer2 = (PVOID)((ULONG_PTR)Buffer+1); + + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_DECOMMIT); + ok(Status == STATUS_SUCCESS, "NtFreeVirtualMemory returned status : 0x%08x\n", Status); + ok(Buffer2 == Buffer, "NtFreeVirtualMemory set wrong buffer.\n"); + ok(Length == PAGE_SIZE, "NtFreeVirtualMemory did not round Length to PAGE_SIZE.\n"); + + Buffer2 = (PVOID)((ULONG_PTR)Buffer+1); + Length = PAGE_SIZE-1; + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_RELEASE); + ok(Status == STATUS_SUCCESS, "NtFreeVirtualMemory returned status : 0x%08x\n", Status); + ok(Buffer2 == Buffer, "NtFreeVirtualMemory set wrong buffer.\n"); + ok(Length == PAGE_SIZE, "NtFreeVirtualMemory did not round Length to PAGE_SIZE.\n"); + + /* Now allocate two pages and try to free them one after the other */ + Length = 2*PAGE_SIZE; + Status = NtAllocateVirtualMemory(NtCurrentProcess(), + &Buffer, + 0, + &Length, + MEM_RESERVE, + PAGE_READWRITE); + ok(NT_SUCCESS(Status), "NtAllocateVirtualMemory failed : 0x%08x\n", Status); + ok(Length == 2*PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(((ULONG_PTR)Buffer % PAGE_SIZE) == 0, "The buffer is not aligned to PAGE_SIZE.\n"); + + Buffer2 = Buffer; + Length = PAGE_SIZE; + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_RELEASE); + ok(NT_SUCCESS(Status), "NtAllocateVirtualMemory failed : 0x%08x\n", Status); + ok(Length == PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(Buffer2 == Buffer, "The buffer is not aligned to PAGE_SIZE.\n"); + + Buffer2 = (PVOID)((ULONG_PTR)Buffer+PAGE_SIZE); + Length = PAGE_SIZE; + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_RELEASE); + ok(NT_SUCCESS(Status), "NtFreeVirtualMemory failed : 0x%08x\n", Status); + ok(Length == PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(Buffer2 == (PVOID)((ULONG_PTR)Buffer+PAGE_SIZE), "The buffer is not aligned to PAGE_SIZE.\n"); + + /* Same, but try to free the second page before the first one */ + Length = 2*PAGE_SIZE; + Status = NtAllocateVirtualMemory(NtCurrentProcess(), + &Buffer, + 0, + &Length, + MEM_RESERVE, + PAGE_READWRITE); + ok(NT_SUCCESS(Status), "NtAllocateVirtualMemory failed : 0x%08x\n", Status); + ok(Length == 2*PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(((ULONG_PTR)Buffer % PAGE_SIZE) == 0, "The buffer is not aligned to PAGE_SIZE.\n"); + + Buffer2 = (PVOID)((ULONG_PTR)Buffer+PAGE_SIZE); + Length = PAGE_SIZE; + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_RELEASE); + ok(NT_SUCCESS(Status), "NtAllocateVirtualMemory failed : 0x%08x\n", Status); + ok(Length == PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(Buffer2 == (PVOID)((ULONG_PTR)Buffer+PAGE_SIZE), "The buffer is not aligned to PAGE_SIZE.\n"); + + Buffer2 = Buffer; + Length = PAGE_SIZE; + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_RELEASE); + ok(NT_SUCCESS(Status), "NtFreeVirtualMemory failed : 0x%08x\n", Status); + ok(Length == PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(Buffer2 == Buffer, "The buffer is not aligned to PAGE_SIZE.\n"); + + /* Now allocate two pages and try to free them in the middle */ + Length = 2*PAGE_SIZE; + Status = NtAllocateVirtualMemory(NtCurrentProcess(), + &Buffer, + 0, + &Length, + MEM_RESERVE, + PAGE_READWRITE); + ok(NT_SUCCESS(Status), "NtAllocateVirtualMemory failed : 0x%08x\n", Status); + ok(Length == 2*PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(((ULONG_PTR)Buffer % PAGE_SIZE) == 0, "The buffer is not aligned to PAGE_SIZE.\n"); + + Buffer2 = (PVOID)((ULONG_PTR)Buffer+1); + Length = PAGE_SIZE; + Status = NtFreeVirtualMemory(NtCurrentProcess(), + &Buffer2, + &Length, + MEM_RELEASE); + ok(NT_SUCCESS(Status), "NtAllocateVirtualMemory failed : 0x%08x\n", Status); + ok(Length == 2*PAGE_SIZE, "Length mismatch : 0x08x\n", Length); + ok(Buffer2 == Buffer, "The buffer is not aligned to PAGE_SIZE.\n"); +} + +START_TEST(NtFreeVirtualMemory) +{ + Test_NtFreeVirtualMemory(); +} \ No newline at end of file diff --git a/apitests/ntdll/ntdll_apitest.rbuild b/apitests/ntdll/ntdll_apitest.rbuild index bde4c9e105b..b62e1263d33 100644 --- a/apitests/ntdll/ntdll_apitest.rbuild +++ b/apitests/ntdll/ntdll_apitest.rbuild @@ -1,13 +1,15 @@ - + . wine ntdll pseh testlist.c + NtFreeVirtualMemory.c RtlInitializeBitMap.c ZwContinue.c diff --git a/apitests/ntdll/testlist.c b/apitests/ntdll/testlist.c index 29c2002361a..0674e16b4aa 100644 --- a/apitests/ntdll/testlist.c +++ b/apitests/ntdll/testlist.c @@ -7,11 +7,13 @@ extern void func_RtlInitializeBitMap(void); extern void func_ZwContinue(void); +extern void func_NtFreeVirtualMemory(void); const struct test winetest_testlist[] = { { "RtlInitializeBitMap", func_RtlInitializeBitMap }, { "ZwContinue", func_ZwContinue }, + { "NtFreeVirtualMemory", func_NtFreeVirtualMemory }, { 0, 0 } }; diff --git a/rosautotest/CMakeLists.txt b/rosautotest/CMakeLists.txt index b1fc9fc8019..a0a4795299e 100644 --- a/rosautotest/CMakeLists.txt +++ b/rosautotest/CMakeLists.txt @@ -19,12 +19,10 @@ list(APPEND SOURCE shutdown.cpp tools.cpp) -add_executable(rosautotest -#${CMAKE_CURRENT_BINARY_DIR}/rosautotest_precomp.h.gch -${SOURCE}) +add_executable(rosautotest ${SOURCE}) -#add_pch(rosautotest ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) set_module_type(rosautotest win32cui) add_importlibs(rosautotest advapi32 shell32 user32 wininet msvcrt kernel32 ntdll) +add_pch(rosautotest precomp.h) add_cd_file(TARGET rosautotest DESTINATION reactos/system32 FOR all) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 6b2fdd7d7a3..93b5020f9a3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,2 +1,4 @@ add_subdirectory(mmixer_test) -add_subdirectory(pseh2) +if (NOT MSVC) + add_subdirectory(pseh2) +endif() diff --git a/winetests/CMakeLists.txt b/winetests/CMakeLists.txt index dec178f6723..40cffd8be17 100644 --- a/winetests/CMakeLists.txt +++ b/winetests/CMakeLists.txt @@ -3,7 +3,9 @@ add_definitions(-D__ROS_LONG64__) add_subdirectory(advapi32) add_subdirectory(advpack) -add_subdirectory(amstream) +if(NOT MSVC) + add_subdirectory(amstream) # FIXME: msvc build. +endif() add_subdirectory(atl) add_subdirectory(avifil32) add_subdirectory(browseui) @@ -20,9 +22,13 @@ add_subdirectory(dsound) add_subdirectory(fusion) add_subdirectory(gdi32) add_subdirectory(gdiplus) -add_subdirectory(hlink) +if(NOT MSVC) + add_subdirectory(hlink) # FIXME: msvc build. +endif() add_subdirectory(icmp) -add_subdirectory(imagehlp) +if(NOT MSVC) + add_subdirectory(imagehlp) # FIXME: msvc build. +endif() add_subdirectory(imm32) add_subdirectory(inetcomm) add_subdirectory(inetmib1) @@ -38,13 +44,18 @@ add_subdirectory(mlang) add_subdirectory(msacm32) add_subdirectory(mscms) add_subdirectory(msctf) -add_subdirectory(mshtml) -add_subdirectory(msi) +if(NOT MSVC) + # FIXME: msvc build. + add_subdirectory(mshtml) + add_subdirectory(msi) +endif() add_subdirectory(mstask) add_subdirectory(msvcrt) add_subdirectory(msvcrtd) add_subdirectory(msvfw32) -add_subdirectory(msxml3) +if(NOT MSVC) + add_subdirectory(msxml3) # FIXME: msvc build. +endif() add_subdirectory(netapi32) add_subdirectory(ntdll) add_subdirectory(ntdsapi) @@ -52,7 +63,9 @@ add_subdirectory(ntprint) add_subdirectory(odbccp32) add_subdirectory(ole32) add_subdirectory(oleacc) -add_subdirectory(oleaut32) +if(NOT MSVC) + add_subdirectory(oleaut32) # FIXME: msvc build. +endif() add_subdirectory(opengl32) add_subdirectory(pdh) add_subdirectory(powrprof) @@ -62,7 +75,9 @@ add_subdirectory(quartz) add_subdirectory(rasapi32) add_subdirectory(riched20) add_subdirectory(riched32) -add_subdirectory(rpcrt4) +if(NOT MSVC) + add_subdirectory(rpcrt4) # FIXME: msvc build. +endif() add_subdirectory(rsabase) add_subdirectory(rsaenh) add_subdirectory(schannel) @@ -75,7 +90,9 @@ add_subdirectory(shlwapi) add_subdirectory(snmpapi) add_subdirectory(spoolss) add_subdirectory(twain_32) -add_subdirectory(urlmon) +if(NOT MSVC) + add_subdirectory(urlmon) # FIXME: msvc build. +endif() add_subdirectory(user32) add_subdirectory(userenv) add_subdirectory(usp10) diff --git a/winetests/comctl32/CMakeLists.txt b/winetests/comctl32/CMakeLists.txt index bf296424036..78aa89973dc 100644 --- a/winetests/comctl32/CMakeLists.txt +++ b/winetests/comctl32/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) @@ -38,6 +36,11 @@ list(APPEND SOURCE add_executable(comctl32_winetest ${SOURCE}) target_link_libraries(comctl32_winetest wine) + +if(MSVC) + target_link_libraries(comctl32_winetest uuid) +endif() + set_module_type(comctl32_winetest win32cui) add_importlibs(comctl32_winetest comctl32 ole32 user32 gdi32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET comctl32_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/comdlg32/CMakeLists.txt b/winetests/comdlg32/CMakeLists.txt index 838e53a3a9f..f392cd46bd8 100644 --- a/winetests/comdlg32/CMakeLists.txt +++ b/winetests/comdlg32/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) list(APPEND SOURCE filedlg.c @@ -12,6 +10,11 @@ list(APPEND SOURCE add_executable(comdlg32_winetest ${SOURCE}) target_link_libraries(comdlg32_winetest wine) + +if(MSVC) + target_link_libraries(comdlg32_winetest uuid) +endif() + set_module_type(comdlg32_winetest win32cui) add_importlibs(comdlg32_winetest comdlg32 winspool user32 gdi32 msvcrt kernel32 ntdll) add_cd_file(TARGET comdlg32_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/inetcomm/CMakeLists.txt b/winetests/inetcomm/CMakeLists.txt index eda1edf77c8..2e07f3ddff3 100644 --- a/winetests/inetcomm/CMakeLists.txt +++ b/winetests/inetcomm/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) list(APPEND SOURCE mimeintl.c @@ -10,6 +8,11 @@ list(APPEND SOURCE add_executable(inetcomm_winetest ${SOURCE}) target_link_libraries(inetcomm_winetest wine) + +if(MSVC) + target_link_libraries(inetcomm_winetest uuid) +endif() + set_module_type(inetcomm_winetest win32cui) add_importlibs(inetcomm_winetest inetcomm oleaut32 ole32 msvcrt kernel32 ntdll) add_cd_file(TARGET inetcomm_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/itss/CMakeLists.txt b/winetests/itss/CMakeLists.txt index 2e8c15fcf84..785fbabe468 100644 --- a/winetests/itss/CMakeLists.txt +++ b/winetests/itss/CMakeLists.txt @@ -1,12 +1,15 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) set_rc_compiler() add_executable(itss_winetest protocol.c testlist.c rsrc.rc) target_link_libraries(itss_winetest wine) + +if(MSVC) + target_link_libraries(itss_winetest uuid) +endif() + set_module_type(itss_winetest win32cui) add_importlibs(itss_winetest ole32 msvcrt kernel32 ntdll) add_cd_file(TARGET itss_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/jscript/CMakeLists.txt b/winetests/jscript/CMakeLists.txt index 72afc6d71fe..d6b9a256048 100644 --- a/winetests/jscript/CMakeLists.txt +++ b/winetests/jscript/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) set_rc_compiler() @@ -14,6 +12,11 @@ list(APPEND SOURCE add_executable(jscript_winetest ${SOURCE}) target_link_libraries(jscript_winetest wine) + +if(MSVC) + target_link_libraries(jscript_winetest uuid) +endif() + set_module_type(jscript_winetest win32cui) add_importlibs(jscript_winetest ole32 oleaut32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET jscript_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/msctf/CMakeLists.txt b/winetests/msctf/CMakeLists.txt index 04eda0db014..ee7ecd03690 100644 --- a/winetests/msctf/CMakeLists.txt +++ b/winetests/msctf/CMakeLists.txt @@ -1,10 +1,13 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) add_executable(msctf_winetest inputprocessor.c testlist.c) target_link_libraries(msctf_winetest wine) + +if(MSVC) + target_link_libraries(msctf_winetest uuid) +endif() + set_module_type(msctf_winetest win32cui) add_importlibs(msctf_winetest ole32 user32 msvcrt kernel32 ntdll) add_cd_file(TARGET msctf_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/mstask/CMakeLists.txt b/winetests/mstask/CMakeLists.txt index 785e272d824..e030eb2edfa 100644 --- a/winetests/mstask/CMakeLists.txt +++ b/winetests/mstask/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) list(APPEND SOURCE task.c @@ -11,6 +9,11 @@ list(APPEND SOURCE add_executable(mstask_winetest ${SOURCE}) target_link_libraries(mstask_winetest wine) + +if(MSVC) + target_link_libraries(mstask_winetest uuid) +endif() + set_module_type(mstask_winetest win32cui) add_importlibs(mstask_winetest ole32 msvcrt kernel32 ntdll) add_cd_file(TARGET mstask_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/msvcrt/CMakeLists.txt b/winetests/msvcrt/CMakeLists.txt index 6e1a4a59bd1..f68840bd687 100644 --- a/winetests/msvcrt/CMakeLists.txt +++ b/winetests/msvcrt/CMakeLists.txt @@ -1,8 +1,7 @@ add_definitions( -D__ROS_LONG64__ - -D_CRT_NONSTDC_NO_DEPRECATE - -D_DLL -D__USE_CRTIMP) + -D_CRT_NONSTDC_NO_DEPRECATE) list(APPEND SOURCE cpp.c @@ -22,6 +21,11 @@ list(APPEND SOURCE time.c) add_executable(msvcrt_winetest ${SOURCE}) + +if(MSVC) + target_link_libraries(msvcrt_winetest oldnames) +endif() + set_module_type(msvcrt_winetest win32cui) add_importlibs(msvcrt_winetest msvcrt kernel32 ntdll) add_cd_file(TARGET msvcrt_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/oleaut32/olepicture.c b/winetests/oleaut32/olepicture.c index af0fe57c5b0..9ed87008544 100644 --- a/winetests/oleaut32/olepicture.c +++ b/winetests/oleaut32/olepicture.c @@ -578,6 +578,11 @@ static void test_enhmetafile(void) BOOL keep; short type; + if(!winetest_interactive) { + skip("Bug 5000: oleaut_winetest:olepicture crashes with Page Fault.\n"); + return; + } + hglob = GlobalAlloc (0, sizeof(enhmetafile)); data = GlobalLock(hglob); memcpy(data, enhmetafile, sizeof(enhmetafile)); diff --git a/winetests/qmgr/CMakeLists.txt b/winetests/qmgr/CMakeLists.txt index 8fcf59efa5b..06e6baead15 100644 --- a/winetests/qmgr/CMakeLists.txt +++ b/winetests/qmgr/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) list(APPEND SOURCE enum_files.c @@ -13,6 +11,11 @@ list(APPEND SOURCE add_executable(qmgr_winetest ${SOURCE}) target_link_libraries(qmgr_winetest wine) + +if(MSVC) + target_link_libraries(qmgr_winetest uuid) +endif() + set_module_type(qmgr_winetest win32cui) add_importlibs(qmgr_winetest ole32 shlwapi user32 msvcrt kernel32 ntdll) add_cd_file(TARGET qmgr_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/quartz/CMakeLists.txt b/winetests/quartz/CMakeLists.txt index 5fa76b3f57c..fae39d3708d 100644 --- a/winetests/quartz/CMakeLists.txt +++ b/winetests/quartz/CMakeLists.txt @@ -15,7 +15,7 @@ list(APPEND SOURCE testlist.c) add_executable(quartz_winetest ${SOURCE}) -target_link_libraries(quartz_winetest wine) +target_link_libraries(quartz_winetest wine uuid) set_module_type(quartz_winetest win32cui) add_importlibs(quartz_winetest ole32 oleaut32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET quartz_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/rpcrt4/CMakeLists.txt b/winetests/rpcrt4/CMakeLists.txt index ddf5b58aeda..d28a9e1ea1b 100644 --- a/winetests/rpcrt4/CMakeLists.txt +++ b/winetests/rpcrt4/CMakeLists.txt @@ -6,7 +6,8 @@ add_definitions( -D__ROS_LONG64__ -D_DLL -D__USE_CRTIMP) -add_rpc_library(serverrpc server.idl) +add_rpc_files(client server.idl) +add_rpc_files(server server.idl) list(APPEND SOURCE cstub.c @@ -16,13 +17,14 @@ list(APPEND SOURCE rpc_async.c rpc_protseq.c server.c - testlist.c) + testlist.c + ${CMAKE_CURRENT_BINARY_DIR}/server_c.c + ${CMAKE_CURRENT_BINARY_DIR}/server_s.c) add_executable(rpcrt4_winetest ${SOURCE}) target_link_libraries(rpcrt4_winetest uuid wine - serverrpc ${PSEH_LIB}) set_module_type(rpcrt4_winetest win32cui) diff --git a/winetests/rpcrt4/cstub.c b/winetests/rpcrt4/cstub.c index c1b4b37e5b0..7882e20b900 100644 --- a/winetests/rpcrt4/cstub.c +++ b/winetests/rpcrt4/cstub.c @@ -691,10 +691,15 @@ static IUnknownVtbl create_stub_test_fail_vtbl = struct dummy_unknown { - const IUnknownVtbl *vtbl; + IUnknown IUnknown_iface; LONG ref; }; +static inline struct dummy_unknown *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, struct dummy_unknown, IUnknown_iface); +} + static HRESULT WINAPI dummy_QueryInterface(IUnknown *This, REFIID iid, void **ppv) { *ppv = NULL; @@ -703,13 +708,13 @@ static HRESULT WINAPI dummy_QueryInterface(IUnknown *This, REFIID iid, void **pp static ULONG WINAPI dummy_AddRef(LPUNKNOWN iface) { - struct dummy_unknown *this = (struct dummy_unknown *)iface; + struct dummy_unknown *this = impl_from_IUnknown(iface); return InterlockedIncrement( &this->ref ); } static ULONG WINAPI dummy_Release(LPUNKNOWN iface) { - struct dummy_unknown *this = (struct dummy_unknown *)iface; + struct dummy_unknown *this = impl_from_IUnknown(iface); return InterlockedDecrement( &this->ref ); } @@ -719,7 +724,7 @@ static IUnknownVtbl dummy_unknown_vtbl = dummy_AddRef, dummy_Release }; -static struct dummy_unknown dummy_unknown = { &dummy_unknown_vtbl, 0 }; +static struct dummy_unknown dummy_unknown = { { &dummy_unknown_vtbl }, 0 }; static void create_proxy_test( IPSFactoryBuffer *ppsf, REFIID iid, const void *expected_vtbl ) { @@ -737,7 +742,8 @@ static void create_proxy_test( IPSFactoryBuffer *ppsf, REFIID iid, const void *e ok( count == 0, "wrong refcount %u\n", count ); dummy_unknown.ref = 4; - r = IPSFactoryBuffer_CreateProxy(ppsf, (IUnknown *)&dummy_unknown, iid, &proxy, (void **)&iface); + r = IPSFactoryBuffer_CreateProxy(ppsf, &dummy_unknown.IUnknown_iface, iid, &proxy, + (void **)&iface); ok( r == S_OK, "IPSFactoryBuffer_CreateProxy failed %x\n", r ); ok( dummy_unknown.ref == 5, "wrong refcount %u\n", dummy_unknown.ref ); ok( *(void **)iface == expected_vtbl, "wrong iface pointer %p/%p\n", *(void **)iface, expected_vtbl ); @@ -775,6 +781,7 @@ static void test_CreateStub(IPSFactoryBuffer *ppsf) vtbl = &create_stub_test_fail_vtbl; pstub = create_stub(ppsf, &IID_if1, obj, E_NOINTERFACE); + ok(pstub == S_OK, "create_stub failed: %u\n", GetLastError()); } @@ -892,6 +899,7 @@ static void test_Connect(IPSFactoryBuffer *ppsf) obj = (IUnknown*)&new_vtbl; r = IRpcStubBuffer_Connect(pstub, obj); + ok(r == S_OK, "r %08x\n", r); ok(connect_test_base_Connect_called == 1, "connect_test_bsae_Connect called %d times\n", connect_test_base_Connect_called); ok(connect_test_orig_release_called == 3, "release called %d\n", connect_test_orig_release_called); diff --git a/winetests/rpcrt4/ndr_marshall.c b/winetests/rpcrt4/ndr_marshall.c index 569bd2046d5..549d09ee87d 100644 --- a/winetests/rpcrt4/ndr_marshall.c +++ b/winetests/rpcrt4/ndr_marshall.c @@ -1543,6 +1543,9 @@ static void test_conformant_string(void) my_alloc_called = 0; StubMsg.Buffer = StubMsg.BufferStart; mem = mem_orig = HeapAlloc(GetProcessHeap(), 0, sizeof(memsrc)); + /* Windows apparently checks string length on the output buffer to determine its size... */ + memset( mem, 'x', sizeof(memsrc) - 1 ); + mem[sizeof(memsrc) - 1] = 0; NdrPointerUnmarshall( &StubMsg, &mem, fmtstr_conf_str, 0); ok(mem == mem_orig, "mem not alloced\n"); ok(my_alloc_called == 0, "alloc called %d\n", my_alloc_called); diff --git a/winetests/rpcrt4/rpc.c b/winetests/rpcrt4/rpc.c index eb882b4273e..fdf91d18c8b 100644 --- a/winetests/rpcrt4/rpc.c +++ b/winetests/rpcrt4/rpc.c @@ -120,13 +120,9 @@ static void UuidConversionAndComparison(void) { for (i1 = 0; i1 < 10; i1++) { Uuid1 = Uuid_Table[i1]; rslt=UuidToStringW(&Uuid1, &wstr); - if (rslt==RPC_S_CANNOT_SUPPORT) { - /* Must be Win9x (no Unicode support), skip the tests */ - break; - } - ok( (rslt == RPC_S_OK), "Simple UUID->WString copy\n" ); - ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String\n" ); - ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform\n" ); + ok( (rslt == RPC_S_OK), "Simple UUID->WString copy\n" ); + ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String\n" ); + ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform\n" ); /* invalid uuid tests -- size of valid UUID string=36 */ for (i2 = 0; i2 < 36; i2++) { wx = wstr[i2]; @@ -266,8 +262,7 @@ todo_wine { status = RpcBindingSetAuthInfo(IFoo_IfHandle, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME); - ok(status == RPC_S_OK || broken(status == RPC_S_UNKNOWN_AUTHN_SERVICE), /* win9x */ - "RpcBindingSetAuthInfo failed (%u)\n", status); + ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%u)\n", status); status = RpcBindingInqAuthInfo(IFoo_IfHandle, NULL, NULL, NULL, NULL, NULL); ok(status == RPC_S_BINDING_HAS_NO_AUTH, "RpcBindingInqAuthInfo failed (%u)\n", @@ -277,10 +272,6 @@ todo_wine { RPC_C_AUTHN_WINNT, NULL, RPC_C_AUTHZ_NAME); ok(status == RPC_S_OK, "RpcBindingSetAuthInfo failed (%u)\n", status); -if(1) - skip("bug 5778: this test part needs rpcrt4 sync >= 1.2rc6\n"); -else -{ level = authnsvc = authzsvc = 0; principal = (unsigned char *)0xdeadbeef; identity = (RPC_AUTH_IDENTITY_HANDLE *)0xdeadbeef; @@ -288,14 +279,14 @@ else &identity, &authzsvc); ok(status == RPC_S_OK, "RpcBindingInqAuthInfo failed (%u)\n", status); - ok(identity == NULL, "expected NULL identity\n"); - ok(principal != (unsigned char *)0xdeadbeef, "expected valid principal\n"); - ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "expected RPC_C_AUTHN_LEVEL_PKT_PRIVACY\n"); - ok(authnsvc == RPC_C_AUTHN_WINNT, "expected RPC_C_AUTHN_WINNT\n"); - todo_wine ok(authzsvc == RPC_C_AUTHZ_NAME, "expected RPC_C_AUTHZ_NAME\n"); + ok(identity == NULL, "expected NULL identity, got %p\n", identity); + ok(principal != (unsigned char *)0xdeadbeef, "expected valid principal, got %p\n", principal); + ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "expected RPC_C_AUTHN_LEVEL_PKT_PRIVACY, got %d\n", level); + ok(authnsvc == RPC_C_AUTHN_WINNT, "expected RPC_C_AUTHN_WINNT, got %d\n", authnsvc); + todo_wine ok(authzsvc == RPC_C_AUTHZ_NAME, "expected RPC_C_AUTHZ_NAME, got %d\n", authzsvc); RpcStringFree(&principal); -} + status = RpcMgmtStopServerListening(NULL); ok(status == RPC_S_OK, "RpcMgmtStopServerListening failed (%u)\n", status); @@ -441,14 +432,8 @@ static void test_I_RpcMapWin32Status(void) { LONG win32status; RPC_STATUS rpc_status; - BOOL on_win9x = FALSE; BOOL w2k3_up = FALSE; - /* Win9x always returns the given status */ - win32status = I_RpcMapWin32Status(ERROR_ACCESS_DENIED); - if (win32status == ERROR_ACCESS_DENIED) - on_win9x = TRUE; - /* Windows 2003 and Vista return STATUS_UNSUCCESSFUL if given an unknown status */ win32status = I_RpcMapWin32Status(9999); if (win32status == STATUS_UNSUCCESSFUL) @@ -582,9 +567,6 @@ static void test_I_RpcMapWin32Status(void) expected_win32status = rpc_status; } - if (on_win9x) - missing = TRUE; - ok(win32status == expected_win32status || broken(missing && win32status == rpc_status), "I_RpcMapWin32Status(%d) should have returned 0x%x instead of 0x%x%s\n", diff --git a/winetests/rpcrt4/rpc_async.c b/winetests/rpcrt4/rpc_async.c index f82799cffc8..2cd95c8c254 100644 --- a/winetests/rpcrt4/rpc_async.c +++ b/winetests/rpcrt4/rpc_async.c @@ -25,8 +25,8 @@ #include #include -RPC_STATUS (RPC_ENTRY *pRpcAsyncInitializeHandle)(PRPC_ASYNC_STATE,unsigned int); -RPC_STATUS (RPC_ENTRY *pRpcAsyncGetCallStatus)(PRPC_ASYNC_STATE); +static RPC_STATUS (RPC_ENTRY *pRpcAsyncInitializeHandle)(PRPC_ASYNC_STATE,unsigned int); +static RPC_STATUS (RPC_ENTRY *pRpcAsyncGetCallStatus)(PRPC_ASYNC_STATE); static void test_RpcAsyncInitializeHandle(void) { diff --git a/winetests/rpcrt4/server.c b/winetests/rpcrt4/server.c index 6e177113ea2..21b0cedf6ab 100644 --- a/winetests/rpcrt4/server.c +++ b/winetests/rpcrt4/server.c @@ -88,50 +88,77 @@ xstrdup(const char *s) return d; } -int -s_int_return(void) +int __cdecl s_int_return(void) { return INT_CODE; } -int -s_square(int x) +int __cdecl s_square(int x) { return x * x; } -int -s_sum(int x, int y) +int __cdecl s_sum(int x, int y) { return x + y; } -void -s_square_out(int x, int *y) +signed char __cdecl s_sum_char(signed char x, signed char y) +{ + return x + y; +} + +short __cdecl s_sum_short(short x, short y) +{ + return x + y; +} + +int __cdecl s_sum_float(float x, float y) +{ + return x + y; +} + +int __cdecl s_sum_double_int(int x, double y) +{ + return x + y; +} + +hyper __cdecl s_sum_hyper(hyper x, hyper y) +{ + return x + y; +} + +int __cdecl s_sum_hyper_int(hyper x, hyper y) +{ + return x + y; +} + +int __cdecl s_sum_char_hyper(signed char x, hyper y) +{ + return x + y; +} + +void __cdecl s_square_out(int x, int *y) { *y = s_square(x); } -void -s_square_ref(int *x) +void __cdecl s_square_ref(int *x) { *x = s_square(*x); } -int -s_str_length(const char *s) +int __cdecl s_str_length(const char *s) { return strlen(s); } -int -s_str_t_length(str_t s) +int __cdecl s_str_t_length(str_t s) { return strlen(s); } -int -s_cstr_length(const char *s, int n) +int __cdecl s_cstr_length(const char *s, int n) { int len = 0; while (0 < n-- && *s++) @@ -139,65 +166,55 @@ s_cstr_length(const char *s, int n) return len; } -int -s_dot_self(vector_t *v) +int __cdecl s_dot_self(vector_t *v) { return s_square(v->x) + s_square(v->y) + s_square(v->z); } -double -s_square_half(double x, double *y) +double __cdecl s_square_half(double x, double *y) { *y = x / 2.0; return x * x; } -float -s_square_half_float(float x, float *y) +float __cdecl s_square_half_float(float x, float *y) { *y = x / 2.0f; return x * x; } -LONG -s_square_half_long(LONG x, LONG *y) +LONG __cdecl s_square_half_long(LONG x, LONG *y) { *y = x / 2; return x * x; } -int -s_sum_fixed_array(int a[5]) +int __cdecl s_sum_fixed_array(int a[5]) { return a[0] + a[1] + a[2] + a[3] + a[4]; } -int -s_pints_sum(pints_t *pints) +int __cdecl s_pints_sum(pints_t *pints) { return *pints->pi + **pints->ppi + ***pints->pppi; } -double -s_ptypes_sum(ptypes_t *pt) +double __cdecl s_ptypes_sum(ptypes_t *pt) { return *pt->pc + *pt->ps + *pt->pl + *pt->pf + *pt->pd; } -int -s_dot_pvectors(pvectors_t *p) +int __cdecl s_dot_pvectors(pvectors_t *p) { return p->pu->x * (*p->pv)->x + p->pu->y * (*p->pv)->y + p->pu->z * (*p->pv)->z; } -int -s_sum_sp(sp_t *sp) +int __cdecl s_sum_sp(sp_t *sp) { return sp->x + sp->s->x; } -double -s_square_sun(sun_t *su) +double __cdecl s_square_sun(sun_t *su) { switch (su->s) { @@ -210,16 +227,14 @@ s_square_sun(sun_t *su) } } -int -s_test_list_length(test_list_t *list) +int __cdecl s_test_list_length(test_list_t *list) { return (list->t == TL_LIST ? 1 + s_test_list_length(list->u.tail) : 0); } -int -s_sum_fixed_int_3d(int m[2][3][4]) +int __cdecl s_sum_fixed_int_3d(int m[2][3][4]) { int i, j, k; int sum = 0; @@ -232,8 +247,7 @@ s_sum_fixed_int_3d(int m[2][3][4]) return sum; } -int -s_sum_conf_array(int x[], int n) +int __cdecl s_sum_conf_array(int x[], int n) { int *p = x, *end = p + n; int sum = 0; @@ -244,8 +258,7 @@ s_sum_conf_array(int x[], int n) return sum; } -int -s_sum_conf_ptr_by_conf_ptr(int n1, int *n2_then_x1, int *x2) +int __cdecl s_sum_conf_ptr_by_conf_ptr(int n1, int *n2_then_x1, int *x2) { int i; int sum = 0; @@ -261,20 +274,17 @@ s_sum_conf_ptr_by_conf_ptr(int n1, int *n2_then_x1, int *x2) return sum; } -int -s_sum_unique_conf_array(int x[], int n) +int __cdecl s_sum_unique_conf_array(int x[], int n) { return s_sum_conf_array(x, n); } -int -s_sum_unique_conf_ptr(int *x, int n) +int __cdecl s_sum_unique_conf_ptr(int *x, int n) { return x ? s_sum_conf_array(x, n) : 0; } -int -s_sum_var_array(int x[20], int n) +int __cdecl s_sum_var_array(int x[20], int n) { ok(0 <= n, "RPC sum_var_array\n"); ok(n <= 20, "RPC sum_var_array\n"); @@ -282,8 +292,7 @@ s_sum_var_array(int x[20], int n) return s_sum_conf_array(x, n); } -int -s_sum_complex_array(int n, refpint_t pi[]) +int __cdecl s_sum_complex_array(int n, refpint_t pi[]) { int total = 0; for (; n > 0; n--) @@ -291,28 +300,24 @@ s_sum_complex_array(int n, refpint_t pi[]) return total; } -int -s_dot_two_vectors(vector_t vs[2]) +int __cdecl s_dot_two_vectors(vector_t vs[2]) { return vs[0].x * vs[1].x + vs[0].y * vs[1].y + vs[0].z * vs[1].z; } -void -s_get_number_array(int x[20], int *n) +void __cdecl s_get_number_array(int x[20], int *n) { int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; memcpy(x, c, sizeof(c)); *n = sizeof(c)/sizeof(c[0]); } -int -s_sum_cs(cs_t *cs) +int __cdecl s_sum_cs(cs_t *cs) { return s_sum_conf_array(cs->ca, cs->n); } -int -s_sum_cps(cps_t *cps) +int __cdecl s_sum_cps(cps_t *cps) { int sum = 0; int i; @@ -326,8 +331,7 @@ s_sum_cps(cps_t *cps) return sum; } -int -s_sum_cpsc(cpsc_t *cpsc) +int __cdecl s_sum_cpsc(cpsc_t *cpsc) { int sum = 0; int i; @@ -336,15 +340,13 @@ s_sum_cpsc(cpsc_t *cpsc) return sum; } -int -s_square_puint(puint_t p) +int __cdecl s_square_puint(puint_t p) { int n = atoi(p); return n * n; } -int -s_sum_puints(puints_t *p) +int __cdecl s_sum_puints(puints_t *p) { int sum = 0; int i; @@ -353,8 +355,7 @@ s_sum_puints(puints_t *p) return sum; } -int -s_sum_cpuints(cpuints_t *p) +int __cdecl s_sum_cpuints(cpuints_t *p) { int sum = 0; int i; @@ -363,21 +364,18 @@ s_sum_cpuints(cpuints_t *p) return sum; } -int -s_dot_copy_vectors(vector_t u, vector_t v) +int __cdecl s_dot_copy_vectors(vector_t u, vector_t v) { return u.x * v.x + u.y * v.y + u.z * v.z; } -int -s_square_test_us(test_us_t *tus) +int __cdecl s_square_test_us(test_us_t *tus) { int n = atoi(tus->us.x); return n * n; } -double -s_square_encu(encu_t *eu) +double __cdecl s_square_encu(encu_t *eu) { switch (eu->t) { @@ -388,8 +386,7 @@ s_square_encu(encu_t *eu) } } -double -s_square_unencu(int t, unencu_t *eu) +double __cdecl s_square_unencu(int t, unencu_t *eu) { switch (t) { @@ -400,20 +397,17 @@ s_square_unencu(int t, unencu_t *eu) } } -void -s_check_se2(se_t *s) +void __cdecl s_check_se2(se_t *s) { ok(s->f == E2, "check_se2\n"); } -int -s_sum_parr(int *a[3]) +int __cdecl s_sum_parr(int *a[3]) { return s_sum_pcarr(a, 3); } -int -s_sum_pcarr(int *a[], int n) +int __cdecl s_sum_pcarr(int *a[], int n) { int i, s = 0; for (i = 0; i < n; ++i) @@ -421,8 +415,7 @@ s_sum_pcarr(int *a[], int n) return s; } -int -s_enum_ord(e_t e) +int __cdecl s_enum_ord(e_t e) { switch (e) { @@ -435,8 +428,7 @@ s_enum_ord(e_t e) } } -double -s_square_encue(encue_t *eue) +double __cdecl s_square_encue(encue_t *eue) { switch (eue->t) { @@ -447,8 +439,7 @@ s_square_encue(encue_t *eue) } } -int -s_sum_toplev_conf_2n(int *x, int n) +int __cdecl s_sum_toplev_conf_2n(int *x, int n) { int sum = 0; int i; @@ -457,8 +448,7 @@ s_sum_toplev_conf_2n(int *x, int n) return sum; } -int -s_sum_toplev_conf_cond(int *x, int a, int b, int c) +int __cdecl s_sum_toplev_conf_cond(int *x, int a, int b, int c) { int sum = 0; int n = c ? a : b; @@ -468,26 +458,22 @@ s_sum_toplev_conf_cond(int *x, int a, int b, int c) return sum; } -double -s_sum_aligns(aligns_t *a) +double __cdecl s_sum_aligns(aligns_t *a) { return a->c + a->i + a->s + a->d; } -int -s_sum_padded(padded_t *p) +int __cdecl s_sum_padded(padded_t *p) { return p->i + p->c; } -int -s_sum_padded2(padded_t ps[2]) +int __cdecl s_sum_padded2(padded_t ps[2]) { return s_sum_padded(&ps[0]) + s_sum_padded(&ps[1]); } -int -s_sum_padded_conf(padded_t *ps, int n) +int __cdecl s_sum_padded_conf(padded_t *ps, int n) { int sum = 0; int i; @@ -496,32 +482,27 @@ s_sum_padded_conf(padded_t *ps, int n) return sum; } -int -s_sum_bogus(bogus_t *b) +int __cdecl s_sum_bogus(bogus_t *b) { return *b->h.p1 + *b->p2 + *b->p3 + b->c; } -void -s_check_null(int *null) +void __cdecl s_check_null(int *null) { ok(!null, "RPC check_null\n"); } -int -s_str_struct_len(str_struct_t *s) +int __cdecl s_str_struct_len(str_struct_t *s) { return lstrlenA(s->s); } -int -s_wstr_struct_len(wstr_struct_t *s) +int __cdecl s_wstr_struct_len(wstr_struct_t *s) { return lstrlenW(s->s); } -int -s_sum_doub_carr(doub_carr_t *dc) +int __cdecl s_sum_doub_carr(doub_carr_t *dc) { int i, j; int sum = 0; @@ -531,8 +512,7 @@ s_sum_doub_carr(doub_carr_t *dc) return sum; } -void -s_make_pyramid_doub_carr(unsigned char n, doub_carr_t **dc) +void __cdecl s_make_pyramid_doub_carr(unsigned char n, doub_carr_t **dc) { doub_carr_t *t; int i, j; @@ -549,8 +529,7 @@ s_make_pyramid_doub_carr(unsigned char n, doub_carr_t **dc) *dc = t; } -unsigned -s_hash_bstr(bstr_t b) +unsigned __cdecl s_hash_bstr(bstr_t b) { short n = b[-1]; short *s = b; @@ -561,8 +540,16 @@ s_hash_bstr(bstr_t b) return hash; } -void -s_get_name(name_t *name) +void __cdecl s_get_a_bstr(bstr_t *b) +{ + bstr_t bstr; + short str[] = {5, 'W', 'i', 'n', 'e', 0}; + bstr = HeapAlloc(GetProcessHeap(), 0, sizeof(str)); + memcpy(bstr, str, sizeof(str)); + *b = bstr + 1; +} + +void __cdecl s_get_name(name_t *name) { const char bossman[] = "Jeremy White"; memcpy(name->name, bossman, min(name->size, sizeof(bossman))); @@ -571,14 +558,12 @@ s_get_name(name_t *name) name->name[name->size - 1] = 0; } -int -s_sum_pcarr2(int n, int **pa) +int __cdecl s_sum_pcarr2(int n, int **pa) { return s_sum_conf_array(*pa, n); } -int -s_sum_L1_norms(int n, vector_t *vs) +int __cdecl s_sum_L1_norms(int n, vector_t *vs) { int i; int sum = 0; @@ -587,8 +572,7 @@ s_sum_L1_norms(int n, vector_t *vs) return sum; } -s123_t * -s_get_s123(void) +s123_t * __cdecl s_get_s123(void) { s123_t *s = MIDL_user_allocate(sizeof *s); s->f1 = 1; @@ -597,24 +581,22 @@ s_get_s123(void) return s; } -str_t -s_get_filename(void) +str_t __cdecl s_get_filename(void) { return (char *)__FILE__; } -int s_echo_ranged_int(int n) +int __cdecl s_echo_ranged_int(int n) { return n; } -void s_get_ranged_enum(renum_t *re) +void __cdecl s_get_ranged_enum(renum_t *re) { *re = RE3; } -void -s_context_handle_test(void) +void __cdecl s_context_handle_test(void) { NDR_SCONTEXT h; RPC_BINDING_HANDLE binding; @@ -714,8 +696,7 @@ s_context_handle_test(void) } } -void -s_get_numbers(int length, int size, pints_t n[]) +void __cdecl s_get_numbers(int length, int size, pints_t n[]) { int i; for (i = 0; i < length; i++) @@ -727,8 +708,7 @@ s_get_numbers(int length, int size, pints_t n[]) } } -void -s_get_numbers_struct(numbers_struct_t **ns) +void __cdecl s_get_numbers_struct(numbers_struct_t **ns) { int i; *ns = midl_user_allocate(FIELD_OFFSET(numbers_struct_t, numbers[5])); @@ -745,23 +725,20 @@ s_get_numbers_struct(numbers_struct_t **ns) *(*ns)->numbers[0].pi = 5; } -void -s_full_pointer_test(int *a, int *b) +void __cdecl s_full_pointer_test(int *a, int *b) { ok(*a == 42, "Expected *a to be 42 instead of %d\n", *a); ok(*b == 42, "Expected *b to be 42 instead of %d\n", *a); ok(a == b, "Expected a (%p) to point to the same memory as b (%p)\n", a, b); } -void -s_full_pointer_null_test(int *a, int *b) +void __cdecl s_full_pointer_null_test(int *a, int *b) { ok(*a == 42, "Expected *a to be 42 instead of %d\n", *a); ok(b == NULL, "Expected b to be NULL instead of %p\n", b); } -void -s_stop(void) +void __cdecl s_stop(void) { ok(RPC_S_OK == RpcMgmtStopServerListening(NULL), "RpcMgmtStopServerListening\n"); ok(RPC_S_OK == RpcServerUnregisterIf(NULL, NULL, FALSE), "RpcServerUnregisterIf\n"); @@ -815,6 +792,7 @@ basic_tests(void) short h; char c; int x; + hyper y; str_struct_t ss = {string}; wstr_struct_t ws = {wstring}; str_t str; @@ -824,7 +802,22 @@ basic_tests(void) ok(int_return() == INT_CODE, "RPC int_return\n"); ok(square(7) == 49, "RPC square\n"); - ok(sum(23, -4) == 19, "RPC sum\n"); + x = sum(23, -4); + ok(x == 19, "RPC sum got %d\n", x); + c = sum_char(-23, 50); + ok(c == 27, "RPC sum_char got %d\n", (int)c); + h = sum_short(1122, -344); + ok(h == 778, "RPC sum_short got %d\n", (int)h); + x = sum_float(123.45, -32.2); + ok(x == 91, "RPC sum_float got %d\n", x); + x = sum_double_int(-78, 148.46); + ok(x == 70, "RPC sum_double_int got %d\n", x); + y = sum_hyper((hyper)0x12345678 << 16, (hyper)0x33557799 << 16); + ok(y == (hyper)0x4589ce11 << 16, "RPC hyper got %x%08x\n", (DWORD)(y >> 32), (DWORD)y); + x = sum_hyper_int((hyper)0x24242424 << 16, -((hyper)0x24241212 << 16)); + ok(x == 0x12120000, "RPC hyper_int got 0x%x\n", x); + x = sum_char_hyper( 12, ((hyper)0x42424242 << 32) | 0x33334444 ); + ok(x == 0x33334450, "RPC char_hyper got 0x%x\n", x); x = 0; square_out(11, &x); @@ -1119,7 +1112,7 @@ pointer_tests(void) puints_t pus; cpuints_t cpus; short bstr_data[] = { 5, 'H', 'e', 'l', 'l', 'o' }; - bstr_t bstr = &bstr_data[1]; + bstr_t bstr = &bstr_data[1], bstr2; name_t name; void *buffer; int *pa2; @@ -1167,6 +1160,12 @@ pointer_tests(void) ok(hash_bstr(bstr) == s_hash_bstr(bstr), "RPC hash_bstr_data\n"); + get_a_bstr(&bstr); + s_get_a_bstr(&bstr2); + ok(!lstrcmpW((LPCWSTR)bstr, (LPCWSTR)bstr2), "bstr mismatch\n"); + HeapFree(GetProcessHeap(), 0, bstr - 1); + HeapFree(GetProcessHeap(), 0, bstr2 - 1); + free_list(list); if (!old_windows_version) @@ -1352,6 +1351,69 @@ array_tests(void) HeapFree(GetProcessHeap(), 0, pi); } +void __cdecl s_authinfo_test(unsigned int protseq, int secure) +{ + RPC_BINDING_HANDLE binding; + RPC_STATUS status; + ULONG level, authnsvc; + RPC_AUTHZ_HANDLE privs; + unsigned char *principal; + + binding = I_RpcGetCurrentCallHandle(); + ok(binding != NULL, "I_RpcGetCurrentCallHandle returned NULL\n"); + + level = authnsvc = 0xdeadbeef; + privs = (RPC_AUTHZ_HANDLE)0xdeadbeef; + principal = (unsigned char *)0xdeadbeef; + + if (secure || protseq == RPC_PROTSEQ_LRPC) + { + status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL); + if (status == RPC_S_CANNOT_SUPPORT) + { + win_skip("RpcBindingInqAuthClientA not supported\n"); + return; + } + ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status); + ok(privs != (RPC_AUTHZ_HANDLE)0xdeadbeef, "privs unchanged\n"); + ok(principal != (unsigned char *)0xdeadbeef, "principal unchanged\n"); + if (protseq != RPC_PROTSEQ_LRPC) + { + todo_wine + ok(principal != NULL, "NULL principal\n"); + } + if (protseq == RPC_PROTSEQ_LRPC && principal && pGetUserNameExA) + { + int len; + char *spn; + + len = WideCharToMultiByte(CP_ACP, 0, (const WCHAR *)privs, -1, NULL, 0, NULL, NULL); + spn = HeapAlloc( GetProcessHeap(), 0, len ); + WideCharToMultiByte(CP_ACP, 0, (const WCHAR *)privs, -1, spn, len, NULL, NULL); + + ok(!strcmp(domain_and_user, spn), "expected %s got %s\n", domain_and_user, spn); + HeapFree( GetProcessHeap(), 0, spn ); + } + ok(level == RPC_C_AUTHN_LEVEL_PKT_PRIVACY, "level unchanged\n"); + ok(authnsvc == RPC_C_AUTHN_WINNT, "authnsvc unchanged\n"); + + status = RpcImpersonateClient(NULL); + ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status); + status = RpcRevertToSelf(); + ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status); + + } + else + { + status = RpcBindingInqAuthClientA(binding, &privs, &principal, &level, &authnsvc, NULL); + ok(status == RPC_S_BINDING_HAS_NO_AUTH, "expected RPC_S_BINDING_HAS_NO_AUTH got %u\n", status); + ok(privs == (RPC_AUTHZ_HANDLE)0xdeadbeef, "got %p\n", privs); + ok(principal == (unsigned char *)0xdeadbeef, "got %s\n", principal); + ok(level == 0xdeadbeef, "got %u\n", level); + ok(authnsvc == 0xdeadbeef, "got %u\n", authnsvc); + } +} + static void run_tests(void) { diff --git a/winetests/rpcrt4/server.idl b/winetests/rpcrt4/server.idl index 89f9930fc74..3be3f33e4d4 100644 --- a/winetests/rpcrt4/server.idl +++ b/winetests/rpcrt4/server.idl @@ -31,9 +31,7 @@ typedef int fnprintf(const char *format, ...); [ uuid(00000000-4114-0704-2301-000000000000), -#ifndef __midl implicit_handle(handle_t IServer_IfHandle) -#endif ] interface IServer { @@ -81,6 +79,13 @@ cpp_quote("#endif") int int_return(void); int square(int x); int sum(int x, int y); + signed char sum_char(signed char x, signed char y); + short sum_short(short x, short y); + int sum_float(float x, float y); + int sum_double_int(int x, double y); + hyper sum_hyper(hyper x, hyper y); + int sum_hyper_int(hyper x, hyper y); + int sum_char_hyper(signed char x, hyper y); void square_out(int x, [out] int *y); void square_ref([in, out] int *x); int str_length([string] const char *s); @@ -157,7 +162,7 @@ cpp_quote("#endif") int sum_cs(cs_t *cs); int sum_cps(cps_t *cps); int sum_cpsc(cpsc_t *cpsc); - int sum_complex_array(int n, refpint_t pi[n]); + int sum_complex_array(int n, [size_is(n)] refpint_t pi[]); typedef [wire_marshal(int)] void *puint_t; int square_puint(puint_t p); @@ -311,7 +316,7 @@ cpp_quote("#endif") typedef [unique] user_bstr_t *wire_bstr_t; typedef [wire_marshal(wire_bstr_t)] short *bstr_t; unsigned hash_bstr(bstr_t s); - + void get_a_bstr([out]bstr_t *s); typedef struct { [string, size_is(size)] char *name; diff --git a/winetests/shdocvw/CMakeLists.txt b/winetests/shdocvw/CMakeLists.txt index 879268747b4..d4ec5befe4f 100644 --- a/winetests/shdocvw/CMakeLists.txt +++ b/winetests/shdocvw/CMakeLists.txt @@ -11,7 +11,7 @@ list(APPEND SOURCE testlist.c) add_executable(shdocvw_winetest ${SOURCE}) -target_link_libraries(shdocvw_winetest wine) +target_link_libraries(shdocvw_winetest wine uuid) set_module_type(shdocvw_winetest win32cui) add_importlibs(shdocvw_winetest gdi32 shell32 ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET shdocvw_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/urlmon/protocol.c b/winetests/urlmon/protocol.c index 4ca6da1cf20..d5a0357a2fd 100644 --- a/winetests/urlmon/protocol.c +++ b/winetests/urlmon/protocol.c @@ -3442,6 +3442,12 @@ START_TEST(protocol) { HMODULE hurlmon; + if(!winetest_interactive) + { + skip("protocol test skipped, bug 6381\n"); + return; + } + hurlmon = GetModuleHandle("urlmon.dll"); pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession"); pReleaseBindInfo = (void*) GetProcAddress(hurlmon, "ReleaseBindInfo"); diff --git a/winetests/ws2_32/sock.c b/winetests/ws2_32/sock.c index 8d195f07eea..663589f56a1 100644 --- a/winetests/ws2_32/sock.c +++ b/winetests/ws2_32/sock.c @@ -1310,7 +1310,7 @@ static void test_WSASocket(void) ok(ret != SOCKET_ERROR, "WSAEnumProtocolsA failed, last error is %d\n", WSAGetLastError()); - if (ret == 0) { + if (ret <= 0) { skip("No protocols enumerated.\n"); HeapFree(GetProcessHeap(), 0, pi); return; diff --git a/winetests/xmllite/CMakeLists.txt b/winetests/xmllite/CMakeLists.txt index ed2827c983c..b7ffe09da0f 100644 --- a/winetests/xmllite/CMakeLists.txt +++ b/winetests/xmllite/CMakeLists.txt @@ -1,10 +1,13 @@ -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) add_executable(xmllite_winetest reader.c testlist.c) target_link_libraries(xmllite_winetest wine) + +if(MSVC) + target_link_libraries(xmllite_winetest uuid) +endif() + set_module_type(xmllite_winetest win32cui) add_importlibs(xmllite_winetest xmllite ole32 msvcrt kernel32 ntdll) add_cd_file(TARGET xmllite_winetest DESTINATION reactos/bin FOR all) diff --git a/winetests/xmllite/reader.c b/winetests/xmllite/reader.c index 9bf18ac7f8d..035fc4f4ac9 100644 --- a/winetests/xmllite/reader.c +++ b/winetests/xmllite/reader.c @@ -32,8 +32,8 @@ DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda); -HRESULT WINAPI (*pCreateXmlReader)(REFIID riid, void **ppvObject, IMalloc *pMalloc); -HRESULT WINAPI (*pCreateXmlReaderInputWithEncodingName)(IUnknown *stream, +HRESULT (WINAPI *pCreateXmlReader)(REFIID riid, void **ppvObject, IMalloc *pMalloc); +HRESULT (WINAPI *pCreateXmlReaderInputWithEncodingName)(IUnknown *stream, IMalloc *pMalloc, LPCWSTR encoding, BOOL hint,