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
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
September 2013
----- 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
16 participants
554 discussions
Start a n
N
ew thread
[akhaldi] 60356: [OLEAUT32] * Sync with Wine 1.7.1. CORE-7469
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Sep 26 13:59:38 2013 New Revision: 60356 URL:
http://svn.reactos.org/svn/reactos?rev=60356&view=rev
Log: [OLEAUT32] * Sync with Wine 1.7.1. CORE-7469 Removed: trunk/reactos/dll/win32/oleaut32/typelib2.c Modified: trunk/reactos/dll/win32/oleaut32/CMakeLists.txt trunk/reactos/dll/win32/oleaut32/hash.c trunk/reactos/dll/win32/oleaut32/oleaut.c trunk/reactos/dll/win32/oleaut32/typelib.c trunk/reactos/dll/win32/oleaut32/typelib.h trunk/reactos/dll/win32/oleaut32/usrmarshal.c trunk/reactos/media/doc/README.WINE [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/oleaut32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/CMakeLi…
Modified: trunk/reactos/dll/win32/oleaut32/hash.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/hash.c?…
Modified: trunk/reactos/dll/win32/oleaut32/oleaut.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/oleaut.…
Modified: trunk/reactos/dll/win32/oleaut32/typelib.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
Modified: trunk/reactos/dll/win32/oleaut32/typelib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
Removed: trunk/reactos/dll/win32/oleaut32/typelib2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/typelib…
Modified: trunk/reactos/dll/win32/oleaut32/usrmarshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/oleaut32/usrmars…
Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
11 years, 3 months
1
0
0
0
[akhaldi] 60355: [OLE32_WINETEST] * Sync with Wine 1.7.1. CORE-7469
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Sep 26 13:58:28 2013 New Revision: 60355 URL:
http://svn.reactos.org/svn/reactos?rev=60355&view=rev
Log: [OLE32_WINETEST] * Sync with Wine 1.7.1. CORE-7469 Added: trunk/rostests/winetests/ole32/ole_server.c (with props) Modified: trunk/rostests/winetests/ole32/CMakeLists.txt trunk/rostests/winetests/ole32/clipboard.c trunk/rostests/winetests/ole32/compobj.c trunk/rostests/winetests/ole32/defaulthandler.c trunk/rostests/winetests/ole32/marshal.c trunk/rostests/winetests/ole32/moniker.c trunk/rostests/winetests/ole32/storage32.c trunk/rostests/winetests/ole32/testlist.c Modified: trunk/rostests/winetests/ole32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/CMakeList…
============================================================================== --- trunk/rostests/winetests/ole32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/CMakeLists.txt [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -1,5 +1,3 @@ - -add_definitions(-D__ROS_LONG64__) list(APPEND SOURCE clipboard.c @@ -11,6 +9,7 @@ marshal.c moniker.c ole2.c + ole_server.c propvariant.c stg_prop.c storage32.c @@ -18,7 +17,7 @@ testlist.c) add_executable(ole32_winetest ${SOURCE}) -target_link_libraries(ole32_winetest wine uuid) +target_link_libraries(ole32_winetest uuid) set_module_type(ole32_winetest win32cui) -add_importlibs(ole32_winetest oleaut32 ole32 user32 gdi32 advapi32 msvcrt kernel32 ntdll) +add_importlibs(ole32_winetest oleaut32 ole32 user32 gdi32 advapi32 msvcrt kernel32) add_cd_file(TARGET ole32_winetest DESTINATION reactos/bin FOR all) Modified: trunk/rostests/winetests/ole32/clipboard.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/clipboard…
============================================================================== --- trunk/rostests/winetests/ole32/clipboard.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/clipboard.c [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -748,8 +748,8 @@ cfs_seen[count] = fmt.cfFormat; ok(fmt_ptr->first_use_of_cf != seen_cf, "got %08x expected %08x\n", fmt_ptr->first_use_of_cf, !seen_cf); - ok(fmt_ptr->res[0] == 0, "got %08x\n", fmt_ptr->res[1]); - ok(fmt_ptr->res[1] == 0, "got %08x\n", fmt_ptr->res[2]); + ok(fmt_ptr->res[0] == 0, "got %08x\n", fmt_ptr->res[0]); + ok(fmt_ptr->res[1] == 0, "got %08x\n", fmt_ptr->res[1]); if(fmt.ptd) { DVTARGETDEVICE *target; Modified: trunk/rostests/winetests/ole32/compobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/compobj.c…
============================================================================== --- trunk/rostests/winetests/ole32/compobj.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/compobj.c [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -26,12 +26,14 @@ #define CONST_VTABLE #include <stdarg.h> +#include <stdio.h> #include <windef.h> #include <winbase.h> +#include <winnls.h> #include <winreg.h> #define USE_COM_CONTEXT_DEF -//#include "initguid.h" +#include <initguid.h> //#include "objbase.h" //#include "shlguid.h" #include <ole2.h> @@ -51,12 +53,23 @@ static HRESULT (WINAPI * pCoGetContextToken)(ULONG_PTR *token); static LONG (WINAPI * pRegOverridePredefKey)(HKEY key, HKEY override); +static BOOL (WINAPI *pActivateActCtx)(HANDLE,ULONG_PTR*); +static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW); +static BOOL (WINAPI *pDeactivateActCtx)(DWORD,ULONG_PTR); +static void (WINAPI *pReleaseActCtx)(HANDLE); + #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr) #define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks) #define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %d\n", cLocks) static const CLSID CLSID_non_existent = { 0x12345678, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }; static const CLSID CLSID_StdFont = { 0x0be35203, 0x8f91, 0x11ce, { 0x9d, 0xe3, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51 } }; +static const GUID IID_Testiface = { 0x22222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }; +static const GUID IID_Testiface2 = { 0x32222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }; +static const GUID IID_Testiface3 = { 0x42222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }; +static const GUID IID_Testiface4 = { 0x52222222, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }; +static const GUID IID_TestPS = { 0x66666666, 0x8888, 0x7777, { 0x66, 0x66, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 } }; + static WCHAR stdfont[] = {'S','t','d','F','o','n','t',0}; static const WCHAR wszNonExistent[] = {'N','o','n','E','x','i','s','t','e','n','t',0}; static WCHAR wszCLSID_StdFont[] = @@ -64,20 +77,22 @@ '{','0','b','e','3','5','2','0','3','-','8','f','9','1','-','1','1','c','e','-', '9','d','e','3','-','0','0','a','a','0','0','4','b','b','8','5','1','}',0 }; - -static const IID IID_IWineTest = -{ - 0x5201163f, - 0x8164, - 0x4fd0, - {0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd} -}; /* 5201163f-8164-4fd0-a1a2-5d5a3654d3bd */ -static const CLSID CLSID_WineOOPTest = { - 0x5201163f, - 0x8164, - 0x4fd0, - {0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd} -}; /* 5201163f-8164-4fd0-a1a2-5d5a3654d3bd */ +static const WCHAR progidW[] = {'P','r','o','g','I','d','.','P','r','o','g','I','d',0}; + +DEFINE_GUID(IID_IWineTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd); +DEFINE_GUID(CLSID_WineOOPTest, 0x5201163f, 0x8164, 0x4fd0, 0xa1, 0xa2, 0x5d, 0x5a, 0x36, 0x54, 0xd3, 0xbd); + +static const char *debugstr_guid(REFIID riid) +{ + static char buf[50]; + + sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], + riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], + riid->Data4[5], riid->Data4[6], riid->Data4[7]); + + return buf; +} static LONG cLocks; @@ -151,10 +166,117 @@ static IClassFactory Test_ClassFactory = { &TestClassFactory_Vtbl }; +static WCHAR manifest_path[MAX_PATH]; + +static BOOL create_manifest_file(const char *filename, const char *manifest) +{ + int manifest_len; + DWORD size; + HANDLE file; + WCHAR path[MAX_PATH]; + + MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH ); + GetFullPathNameW(path, sizeof(manifest_path)/sizeof(WCHAR), manifest_path, NULL); + + manifest_len = strlen(manifest); + file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError()); + if(file == INVALID_HANDLE_VALUE) + return FALSE; + WriteFile(file, manifest, manifest_len, &size, NULL); + CloseHandle(file); + + return TRUE; +} + +static HANDLE activate_context(const char *manifest, ULONG_PTR *cookie) +{ + WCHAR path[MAX_PATH]; + ACTCTXW actctx; + HANDLE handle; + BOOL ret; + + if (!pCreateActCtxW) return NULL; + + create_manifest_file("file.manifest", manifest); + + MultiByteToWideChar( CP_ACP, 0, "file.manifest", -1, path, MAX_PATH ); + memset(&actctx, 0, sizeof(ACTCTXW)); + actctx.cbSize = sizeof(ACTCTXW); + actctx.lpSource = path; + + handle = pCreateActCtxW(&actctx); + ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError()); + + ok(actctx.cbSize == sizeof(ACTCTXW), "actctx.cbSize=%d\n", actctx.cbSize); + ok(actctx.dwFlags == 0, "actctx.dwFlags=%d\n", actctx.dwFlags); + ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource); + ok(actctx.wProcessorArchitecture == 0, "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture); + ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId); + ok(actctx.lpAssemblyDirectory == NULL, "actctx.lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory); + ok(actctx.lpResourceName == NULL, "actctx.lpResourceName=%p\n", actctx.lpResourceName); + ok(actctx.lpApplicationName == NULL, "actctx.lpApplicationName=%p\n", actctx.lpApplicationName); + ok(actctx.hModule == NULL, "actctx.hModule=%p\n", actctx.hModule); + + DeleteFileA("file.manifest"); + + ret = pActivateActCtx(handle, cookie); + ok(ret, "ActivateActCtx failed: %u\n", GetLastError()); + + return handle; +} + +static const char actctx_manifest[] = +"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">" +"<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\"" +" publicKeyToken=\"6595b6414666f1df\" />" +"<file name=\"testlib.dll\">" +" <comClass description=\"Test com class\"" +" clsid=\"{12345678-1234-1234-1234-56789abcdef0}\"" +" progid=\"ProgId.ProgId\"" +" miscStatusIcon=\"recomposeonresize\"" +" />" +" <comClass clsid=\"{0be35203-8f91-11ce-9de3-00aa004bb851}\"" +" progid=\"CustomFont\"" +" miscStatusIcon=\"recomposeonresize\"" +" miscStatusContent=\"insideout\"" +" />" +" <comClass clsid=\"{0be35203-8f91-11ce-9de3-00aa004bb852}\"" +" progid=\"StdFont\"" +" />" +" <comInterfaceProxyStub " +" name=\"Iifaceps\"" +" iid=\"{22222222-1234-1234-1234-56789abcdef0}\"" +" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555555}\"" +" />" +"</file>" +" <comInterfaceExternalProxyStub " +" name=\"Iifaceps2\"" +" iid=\"{32222222-1234-1234-1234-56789abcdef0}\"" +" />" +" <comInterfaceExternalProxyStub " +" name=\"Iifaceps3\"" +" iid=\"{42222222-1234-1234-1234-56789abcdef0}\"" +" proxyStubClsid32=\"{66666666-8888-7777-6666-555555555555}\"" +" />" +" <comInterfaceExternalProxyStub " +" name=\"Iifaceps4\"" +" iid=\"{52222222-1234-1234-1234-56789abcdef0}\"" +" proxyStubClsid32=\"{00000000-0000-0000-0000-000000000000}\"" +" />" +"</assembly>"; + +DEFINE_GUID(CLSID_Testclass, 0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0); + static void test_ProgIDFromCLSID(void) { + ULONG_PTR cookie = 0; LPWSTR progid; - HRESULT hr = ProgIDFromCLSID(&CLSID_StdFont, &progid); + HANDLE handle; + HRESULT hr; + + hr = ProgIDFromCLSID(&CLSID_StdFont, &progid); ok(hr == S_OK, "ProgIDFromCLSID failed with error 0x%08x\n", hr); if (hr == S_OK) { @@ -169,10 +291,37 @@ hr = ProgIDFromCLSID(&CLSID_StdFont, NULL); ok(hr == E_INVALIDARG, "ProgIDFromCLSID should return E_INVALIDARG instead of 0x%08x\n", hr); + + if ((handle = activate_context(actctx_manifest, &cookie))) + { + static const WCHAR customfontW[] = {'C','u','s','t','o','m','F','o','n','t',0}; + + hr = ProgIDFromCLSID(&CLSID_non_existent, &progid); +todo_wine + ok(hr == S_OK, "got 0x%08x\n", hr); + if (hr == S_OK) + { + ok(!lstrcmpiW(progid, progidW), "got %s\n", wine_dbgstr_w(progid)); + CoTaskMemFree(progid); + } + + /* try something registered and redirected */ + progid = NULL; + hr = ProgIDFromCLSID(&CLSID_StdFont, &progid); + ok(hr == S_OK, "got 0x%08x\n", hr); +todo_wine + ok(!lstrcmpiW(progid, customfontW), "got wrong progid %s\n", wine_dbgstr_w(progid)); + CoTaskMemFree(progid); + + pDeactivateActCtx(0, cookie); + pReleaseActCtx(handle); + } } static void test_CLSIDFromProgID(void) { + ULONG_PTR cookie = 0; + HANDLE handle; CLSID clsid; HRESULT hr = CLSIDFromProgID(stdfont, &clsid); ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08x\n", hr); @@ -194,6 +343,40 @@ hr = CLSIDFromProgID(wszNonExistent, &clsid); ok(hr == CO_E_CLASSSTRING, "CLSIDFromProgID on nonexistent ProgID should have returned CO_E_CLASSSTRING instead of 0x%08x\n", hr); ok(IsEqualCLSID(&clsid, &CLSID_NULL), "CLSIDFromProgID should have set clsid to all-zeros on failure\n"); + + /* fails without proper context */ + memset(&clsid, 0xcc, sizeof(clsid)); + hr = CLSIDFromProgID(progidW, &clsid); + ok(hr == CO_E_CLASSSTRING, "got 0x%08x\n", hr); + ok(IsEqualCLSID(&clsid, &CLSID_NULL), "wrong clsid\n"); + + if ((handle = activate_context(actctx_manifest, &cookie))) + { + GUID clsid1; + + clsid = CLSID_NULL; + hr = CLSIDFromProgID(progidW, &clsid); +todo_wine + ok(hr == S_OK, "got 0x%08x\n", hr); + if (hr == S_OK) + /* it returns generated CLSID here */ + ok(!IsEqualCLSID(&clsid, &CLSID_non_existent) && !IsEqualCLSID(&clsid, &CLSID_NULL), + "got wrong clsid %s\n", debugstr_guid(&clsid)); + + /* duplicate progid present in context - returns generated guid here too */ + clsid = CLSID_NULL; + hr = CLSIDFromProgID(stdfont, &clsid); + ok(hr == S_OK, "got 0x%08x\n", hr); + clsid1 = CLSID_StdFont; + /* that's where it differs from StdFont */ + clsid1.Data4[7] = 0x52; +todo_wine + ok(!IsEqualCLSID(&clsid, &CLSID_StdFont) && !IsEqualCLSID(&clsid, &CLSID_NULL) && !IsEqualCLSID(&clsid, &clsid1), + "got %s\n", debugstr_guid(&clsid)); + + pDeactivateActCtx(0, cookie); + pReleaseActCtx(handle); + } } static void test_CLSIDFromString(void) @@ -439,6 +622,12 @@ CloseHandle(info.wait); CloseHandle(info.stop); + if (!pRegOverridePredefKey) + { + win_skip("RegOverridePredefKey not available\n"); + return; + } + pCoInitializeEx(NULL, COINIT_MULTITHREADED); hr = CoGetClassObject(rclsid, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk); @@ -446,8 +635,9 @@ { IUnknown_Release(pUnk); - res = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &hkey); - ok(!res, "RegOpenKeyExA returned %d\n", res); + res = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkey, NULL); + ok(!res, "RegCreateKeyEx returned %d\n", res); res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey); ok(!res, "RegOverridePredefKey returned %d\n", res); @@ -748,6 +938,8 @@ static void test_CoGetPSClsid(void) { + ULONG_PTR cookie; + HANDLE handle; HRESULT hr; CLSID clsid; HKEY hkey; @@ -782,8 +974,9 @@ hr = CoGetPSClsid(&IID_IClassFactory, &clsid); ok_ole_success(hr, "CoGetPSClsid"); - res = RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Classes", 0, KEY_ALL_ACCESS, &hkey); - ok(!res, "RegOpenKeyExA returned %d\n", res); + res = RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Classes", 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkey, NULL); + ok(!res, "RegCreateKeyEx returned %d\n", res); res = pRegOverridePredefKey(HKEY_CLASSES_ROOT, hkey); ok(!res, "RegOverridePredefKey returned %d\n", res); @@ -795,6 +988,38 @@ ok(!res, "RegOverridePredefKey returned %d\n", res); RegCloseKey(hkey); + + /* not registered CLSID */ + hr = CoGetPSClsid(&IID_Testiface, &clsid); + ok(hr == REGDB_E_IIDNOTREG, "got 0x%08x\n", hr); + + if ((handle = activate_context(actctx_manifest, &cookie))) + { +todo_wine { + memset(&clsid, 0, sizeof(clsid)); + hr = CoGetPSClsid(&IID_Testiface, &clsid); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(IsEqualGUID(&clsid, &IID_Testiface), "got clsid %s\n", debugstr_guid(&clsid)); + + memset(&clsid, 0, sizeof(clsid)); + hr = CoGetPSClsid(&IID_Testiface2, &clsid); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(IsEqualGUID(&clsid, &IID_Testiface2), "got clsid %s\n", debugstr_guid(&clsid)); + + memset(&clsid, 0, sizeof(clsid)); + hr = CoGetPSClsid(&IID_Testiface3, &clsid); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(IsEqualGUID(&clsid, &IID_TestPS), "got clsid %s\n", debugstr_guid(&clsid)); + + memset(&clsid, 0xaa, sizeof(clsid)); + hr = CoGetPSClsid(&IID_Testiface4, &clsid); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", debugstr_guid(&clsid)); +} + pDeactivateActCtx(0, cookie); + pReleaseActCtx(handle); + } + CoUninitialize(); } @@ -1568,16 +1793,77 @@ OleUninitialize(); } -START_TEST(compobj) -{ - HMODULE hOle32 = GetModuleHandle("ole32"); - HMODULE hAdvapi32 = GetModuleHandle("advapi32"); +static void test_OleRegGetMiscStatus(void) +{ + ULONG_PTR cookie; + HANDLE handle; + DWORD status; + HRESULT hr; + + hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + status = 0xdeadbeef; + hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status); + ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", hr); + ok(status == 0, "got 0x%08x\n", status); + + status = -1; + hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(status == 0, "got 0x%08x\n", status); + + if ((handle = activate_context(actctx_manifest, &cookie))) + { + status = 0; + hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status); +todo_wine { + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status); +} + /* context data takes precedence over registration info */ + status = 0; + hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status); + ok(hr == S_OK, "got 0x%08x\n", hr); +todo_wine + ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status); + + /* there's no such attribute in context */ + status = -1; + hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_DOCPRINT, &status); +todo_wine + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(status == 0, "got 0x%08x\n", status); + + pDeactivateActCtx(0, cookie); + pReleaseActCtx(handle); + } +} + +static void init_funcs(void) +{ + HMODULE hOle32 = GetModuleHandleA("ole32"); + HMODULE hAdvapi32 = GetModuleHandleA("advapi32"); + HMODULE hkernel32 = GetModuleHandleA("kernel32"); + pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext"); pCoSwitchCallContext = (void*)GetProcAddress(hOle32, "CoSwitchCallContext"); pCoGetTreatAsClass = (void*)GetProcAddress(hOle32,"CoGetTreatAsClass"); pCoGetContextToken = (void*)GetProcAddress(hOle32, "CoGetContextToken"); pRegOverridePredefKey = (void*)GetProcAddress(hAdvapi32, "RegOverridePredefKey"); - if (!(pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx"))) + pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx"); + + pActivateActCtx = (void*)GetProcAddress(hkernel32, "ActivateActCtx"); + pCreateActCtxW = (void*)GetProcAddress(hkernel32, "CreateActCtxW"); + pDeactivateActCtx = (void*)GetProcAddress(hkernel32, "DeactivateActCtx"); + pReleaseActCtx = (void*)GetProcAddress(hkernel32, "ReleaseActCtx"); +} + +START_TEST(compobj) +{ + init_funcs(); + + if (!pCoInitializeEx) { trace("You need DCOM95 installed to run this test\n"); return; @@ -1605,4 +1891,5 @@ test_CoGetContextToken(); test_CoGetTreatAsClass(); test_CoInitializeEx(); -} + test_OleRegGetMiscStatus(); +} Modified: trunk/rostests/winetests/ole32/defaulthandler.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/defaultha…
============================================================================== --- trunk/rostests/winetests/ole32/defaulthandler.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/defaulthandler.c [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -59,8 +59,15 @@ expect_ ## func = called_ ## func = FALSE; \ }while(0) +#define CHECK_NOT_CALLED(func) \ + do { \ + ok(!called_ ## func, "unexpected " #func "\n"); \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + DEFINE_EXPECT(CF_QueryInterface_ClassFactory); DEFINE_EXPECT(CF_CreateInstance); +DEFINE_EXPECT(CF_QueryInterface_IMarshal); static const char *debugstr_guid(REFIID riid) { @@ -169,7 +176,7 @@ return 1; } -static IUnknownVtbl test_class_vtbl = { +static const IUnknownVtbl test_class_vtbl = { test_class_QueryInterface, test_class_AddRef, test_class_Release, @@ -183,6 +190,7 @@ *ppv = iface; return S_OK; }else if(IsEqualGUID(riid, &IID_IMarshal)) { + CHECK_EXPECT(CF_QueryInterface_IMarshal); *ppv = NULL; return E_NOINTERFACE; }else if(IsEqualGUID(riid, &IID_IClassFactory)) { @@ -228,7 +236,7 @@ return E_NOTIMPL; } -static IClassFactoryVtbl ClassFactoryVtbl = { +static const IClassFactoryVtbl ClassFactoryVtbl = { ClassFactory_QueryInterface, ClassFactory_AddRef, ClassFactory_Release, @@ -244,6 +252,8 @@ IUnknown *unk; IRunnableObject *ro; + IOleObject *oleobj; + IPersistStorage *persist; DWORD class_reg; HRESULT hres; @@ -267,7 +277,9 @@ ok(hres == REGDB_E_CLASSNOTREG, "Run returned: %x, expected REGDB_E_CLASSNOTREG\n", hres); IRunnableObject_Release(ro); + SET_EXPECT(CF_QueryInterface_IMarshal); CoRevokeClassObject(class_reg); + todo_wine CHECK_CALLED(CF_QueryInterface_IMarshal); hres = CoRegisterClassObject(&test_server_clsid, (IUnknown*)&ClassFactory, CLSCTX_LOCAL_SERVER, 0, &class_reg); @@ -276,6 +288,14 @@ hres = OleCreateDefaultHandler(&test_server_clsid, NULL, &IID_IUnknown, (void**)&unk); ok(hres == S_OK, "OleCreateDefaultHandler failed: %x\n", hres); + hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj); + ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %x\n", hres); + + hres = IOleObject_QueryInterface(oleobj, &IID_IPersistStorage, (void**)&persist); + ok(hres == S_OK, "QueryInterface(IID_IPersistStorage) failed: %x\n", hres); + IPersistStorage_Release(persist); + IOleObject_Release(oleobj); + hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&ro); ok(hres == S_OK, "QueryInterface(IRunnableObject) failed: %x\n", hres); IUnknown_Release(unk); @@ -283,12 +303,26 @@ SET_EXPECT(CF_QueryInterface_ClassFactory); SET_EXPECT(CF_CreateInstance); hres = IRunnableObject_Run(ro, NULL); - todo_wine ok(hres == S_OK, "Run failed: %x\n", hres); +todo_wine + ok(hres == S_OK, "Run failed: %x\n", hres); CHECK_CALLED(CF_QueryInterface_ClassFactory); CHECK_CALLED(CF_CreateInstance); IRunnableObject_Release(ro); + SET_EXPECT(CF_QueryInterface_ClassFactory); + SET_EXPECT(CF_CreateInstance); + hres = CoCreateInstance(&test_server_clsid, NULL, CLSCTX_LOCAL_SERVER, + &IID_IOleObject, (void**)&oleobj); +todo_wine + ok(hres == REGDB_E_CLASSNOTREG, "expected REGDB_E_CLASSNOTREG, got %x\n", hres); +todo_wine + CHECK_NOT_CALLED(CF_QueryInterface_ClassFactory); +todo_wine + CHECK_NOT_CALLED(CF_CreateInstance); + + SET_EXPECT(CF_QueryInterface_IMarshal); CoRevokeClassObject(class_reg); + todo_wine CHECK_CALLED(CF_QueryInterface_IMarshal); } START_TEST(defaulthandler) Modified: trunk/rostests/winetests/ole32/marshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/marshal.c…
============================================================================== --- trunk/rostests/winetests/ole32/marshal.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/marshal.c [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -47,6 +47,7 @@ /* functions that are not present on all versions of Windows */ static HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit); +static HRESULT (WINAPI *pDllGetClassObject)(REFCLSID,REFIID,LPVOID); /* helper macros to make tests a bit leaner */ #define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks) @@ -2811,12 +2812,32 @@ struct git_params params; DWORD ret; IUnknown *object; + IClassFactory *cf; + ULONG ref; trace("test_globalinterfacetable\n"); cLocks = 0; + hr = pDllGetClassObject(&CLSID_StdGlobalInterfaceTable, &IID_IClassFactory, (void**)&cf); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IClassFactory_QueryInterface(cf, &IID_IGlobalInterfaceTable, (void**)&object); + ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); + + IClassFactory_Release(cf); + hr = CoCreateInstance(&CLSID_StdGlobalInterfaceTable, NULL, CLSCTX_INPROC_SERVER, &IID_IGlobalInterfaceTable, (void **)&git); ok_ole_success(hr, CoCreateInstance); + + ref = IGlobalInterfaceTable_AddRef(git); + ok(ref == 1, "ref=%d\n", ref); + ref = IGlobalInterfaceTable_AddRef(git); + ok(ref == 1, "ref=%d\n", ref); + + ref = IGlobalInterfaceTable_Release(git); + ok(ref == 1, "ref=%d\n", ref); + ref = IGlobalInterfaceTable_Release(git); + ok(ref == 1, "ref=%d\n", ref); hr = IGlobalInterfaceTable_RegisterInterfaceInGlobal(git, (IUnknown *)&Test_ClassFactory, &IID_IClassFactory, &cookie); ok_ole_success(hr, IGlobalInterfaceTable_RegisterInterfaceInGlobal); @@ -3156,6 +3177,7 @@ } pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx"); + pDllGetClassObject = (void*)GetProcAddress(hOle32, "DllGetClassObject"); argc = winetest_get_mainargs( &argv ); if (argc > 2 && (!strcmp(argv[2], "-Embedding"))) Modified: trunk/rostests/winetests/ole32/moniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/moniker.c…
============================================================================== --- trunk/rostests/winetests/ole32/moniker.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/moniker.c [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -103,6 +103,55 @@ return ((size + global_size_alignment - 1) & ~(global_size_alignment - 1)); } +static DWORD external_connections; + +static HRESULT WINAPI ExternalConnection_QueryInterface(IExternalConnection *iface, REFIID riid, void **ppv) +{ + ok(0, "unxpected call\n"); + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI ExternalConnection_AddRef(IExternalConnection *iface) +{ + return 2; +} + +static ULONG WINAPI ExternalConnection_Release(IExternalConnection *iface) +{ + return 1; +} + +static DWORD WINAPI ExternalConnection_AddConnection(IExternalConnection *iface, DWORD extconn, DWORD reserved) +{ + trace("add connection\n"); + + ok(extconn == EXTCONN_STRONG, "extconn = %d\n", extconn); + ok(!reserved, "reserved = %x\n", reserved); + return ++external_connections; +} + +static DWORD WINAPI ExternalConnection_ReleaseConnection(IExternalConnection *iface, DWORD extconn, + DWORD reserved, BOOL fLastReleaseCloses) +{ + trace("release connection\n"); + + ok(extconn == EXTCONN_STRONG, "extconn = %d\n", extconn); + ok(!reserved, "reserved = %x\n", reserved); + + return --external_connections; +} + +static const IExternalConnectionVtbl ExternalConnectionVtbl = { + ExternalConnection_QueryInterface, + ExternalConnection_AddRef, + ExternalConnection_Release, + ExternalConnection_AddConnection, + ExternalConnection_ReleaseConnection +}; + +static IExternalConnection ExternalConnection = { &ExternalConnectionVtbl }; + static HRESULT WINAPI Test_IClassFactory_QueryInterface( LPCLASSFACTORY iface, REFIID riid, @@ -115,6 +164,11 @@ { *ppvObj = iface; IClassFactory_AddRef(iface); + return S_OK; + } + + if(IsEqualGUID(riid, &IID_IExternalConnection)) { + *ppvObj = &ExternalConnection; return S_OK; } @@ -594,11 +648,13 @@ ok_ole_success(hr, GetRunningObjectTable); expected_method_list = methods_register_no_ROTData; + external_connections = 0; /* try with our own moniker that doesn't support IROTData */ hr = IRunningObjectTable_Register(pROT, ROTFLAGS_REGISTRATIONKEEPSALIVE, (IUnknown*)&Test_ClassFactory, &MonikerNoROTData, &dwCookie); ok_ole_success(hr, IRunningObjectTable_Register); ok(!*expected_method_list, "Method sequence starting from %s not called\n", *expected_method_list); + ok(external_connections == 1, "external_connections = %d\n", external_connections); ok_more_than_one_lock(); @@ -609,6 +665,7 @@ hr = IRunningObjectTable_Revoke(pROT, dwCookie); ok_ole_success(hr, IRunningObjectTable_Revoke); + ok(external_connections == 0, "external_connections = %d\n", external_connections); ok_no_locks(); @@ -635,9 +692,11 @@ ok_ole_success(hr, CreateClassMoniker); /* test flags: 0 */ + external_connections = 0; hr = IRunningObjectTable_Register(pROT, 0, (IUnknown*)&Test_ClassFactory, pMoniker, &dwCookie); ok_ole_success(hr, IRunningObjectTable_Register); + ok(external_connections == 0, "external_connections = %d\n", external_connections); ok_more_than_one_lock(); Added: trunk/rostests/winetests/ole32/ole_server.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/ole_serve…
============================================================================== --- trunk/rostests/winetests/ole32/ole_server.c (added) +++ trunk/rostests/winetests/ole32/ole_server.c [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -0,0 +1,571 @@ +/* + * OLE client/server test suite + * + * Copyright 2013 Dmitry Timoshkov + * + * 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 + */ + +#define COBJMACROS +#define CONST_VTABLE + +#include <windows.h> +#include <exdisp.h> +#include <tlhelp32.h> +#include <stdio.h> +#include <assert.h> +#include "wine/test.h" + +#include <initguid.h> +DEFINE_GUID(CLSID_WineTestObject, 0xdeadbeef,0xdead,0xbeef,0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef); +#ifndef CLSID_IdentityUnmarshal +DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46); +#endif +DEFINE_GUID(CLSID_UnknownUnmarshal,0x4c1e39e1,0xe3e3,0x4296,0xaa,0x86,0xec,0x93,0x8d,0x89,0x6e,0x92); + +struct winetest_info +{ + LONG child_failures; +}; + +static const struct +{ + const GUID *guid; + const char *name; +} guid_name[] = +{ +#define GUID_NAME(guid) \ + { &IID_##guid, #guid } + GUID_NAME(IUnknown), + GUID_NAME(IClassFactory), + GUID_NAME(IOleObject), + GUID_NAME(IMarshal), + GUID_NAME(IStdMarshalInfo), + GUID_NAME(IExternalConnection), + GUID_NAME(IRunnableObject), + GUID_NAME(ICallFactory), + { &CLSID_IdentityUnmarshal, "CLSID_IdentityUnmarshal" }, + { &CLSID_UnknownUnmarshal, "CLSID_UnknownUnmarshal" }, +#undef GUID_NAME +}; + +static LONG obj_ref, class_ref, server_locks; + +static const char *debugstr_guid(const GUID *guid) +{ + static char buf[50]; + int i; + + if (!guid) return "(null)"; + + for (i = 0; i < sizeof(guid_name)/sizeof(guid_name[0]); i++) + { + if (IsEqualIID(guid, guid_name[i].guid)) + return guid_name[i].name; + } + + sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], + guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], + guid->Data4[5], guid->Data4[6], guid->Data4[7]); + return buf; +} + +/******************************* OLE server *******************************/ +typedef struct +{ + IUnknown IUnknown_iface; + LONG ref; +} UnknownImpl; + +static inline UnknownImpl *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, UnknownImpl, IUnknown_iface); +} + +static HRESULT WINAPI UnknownImpl_QueryInterface(IUnknown *iface, + REFIID iid, void **ppv) +{ + UnknownImpl *This = impl_from_IUnknown(iface); + + trace("server: unknown_QueryInterface: %p,%s,%p\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid)) + { + *ppv = &This->IUnknown_iface; + IUnknown_AddRef(&This->IUnknown_iface); + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI UnknownImpl_AddRef(IUnknown *iface) +{ + UnknownImpl *This = impl_from_IUnknown(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + InterlockedIncrement(&obj_ref); + + trace("server: unknown_AddRef: %p, ref %u\n", iface, ref); + return ref; +} + +static ULONG WINAPI UnknownImpl_Release(IUnknown *iface) +{ + UnknownImpl *This = impl_from_IUnknown(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + InterlockedDecrement(&obj_ref); + + trace("server: unknown_Release: %p, ref %u\n", iface, ref); + if (ref == 0) HeapFree(GetProcessHeap(), 0, This); + return ref; +} + +static const IUnknownVtbl UnknownImpl_Vtbl = +{ + UnknownImpl_QueryInterface, + UnknownImpl_AddRef, + UnknownImpl_Release, +}; + +typedef struct +{ + IClassFactory IClassFactory_iface; + LONG ref; +} ClassFactoryImpl; + +static inline ClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, ClassFactoryImpl, IClassFactory_iface); +} + +static HRESULT WINAPI ClassFactoryImpl_QueryInterface(IClassFactory *iface, + REFIID iid, void **ppv) +{ + ClassFactoryImpl *This = impl_from_IClassFactory(iface); + + trace("server: factory_QueryInterface: %p,%s,%p\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IClassFactory, iid)) + { + IClassFactory_AddRef(&This->IClassFactory_iface); + *ppv = &This->IClassFactory_iface; + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI ClassFactoryImpl_AddRef(IClassFactory *iface) +{ + ClassFactoryImpl *This = impl_from_IClassFactory(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + InterlockedIncrement(&class_ref); + + trace("server: factory_AddRef: %p, ref %u\n", iface, ref); + return ref; +} + +static ULONG WINAPI ClassFactoryImpl_Release(IClassFactory *iface) +{ + ClassFactoryImpl *This = impl_from_IClassFactory(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + InterlockedDecrement(&class_ref); + + trace("server: factory_Release: %p, ref %u\n", iface, ref); + return ref; +} + +static HRESULT WINAPI ClassFactoryImpl_CreateInstance(IClassFactory *iface, + IUnknown *punkouter, REFIID iid, void **ppv) +{ + UnknownImpl *unknown; + HRESULT hr; + + trace("server: factory_CreateInstance: %p,%s,%p\n", iface, debugstr_guid(iid), ppv); + + if (punkouter) return CLASS_E_NOAGGREGATION; + + unknown = HeapAlloc(GetProcessHeap(), 0, sizeof(*unknown)); + if (!unknown) return E_OUTOFMEMORY; + + unknown->IUnknown_iface.lpVtbl = &UnknownImpl_Vtbl; + unknown->ref = 0; + IUnknown_AddRef(&unknown->IUnknown_iface); + + hr = IUnknown_QueryInterface(&unknown->IUnknown_iface, iid, ppv); + IUnknown_Release(&unknown->IUnknown_iface); + + return hr; +} + +static HRESULT WINAPI ClassFactoryImpl_LockServer(IClassFactory *iface, BOOL lock) +{ + ULONG ref = lock ? InterlockedIncrement(&server_locks) : InterlockedDecrement(&server_locks); + + trace("server: factory_LockServer: %p,%d, ref %u\n", iface, lock, ref); + return S_OK; +} + +static const IClassFactoryVtbl ClassFactoryImpl_Vtbl = +{ + ClassFactoryImpl_QueryInterface, + ClassFactoryImpl_AddRef, + ClassFactoryImpl_Release, + ClassFactoryImpl_CreateInstance, + ClassFactoryImpl_LockServer +}; + +static ClassFactoryImpl factory = { { &ClassFactoryImpl_Vtbl }, 0 }; + +static void ole_server(void) +{ + HRESULT hr; + DWORD key; + + trace("server: starting %u\n", GetCurrentProcessId()); + + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); + if (hr == S_OK) + { + trace("server: registering class object\n"); + hr = CoRegisterClassObject(&CLSID_WineTestObject, (IUnknown *)&factory, + CLSCTX_SERVER, REGCLS_MULTIPLEUSE, &key); + if (hr == S_OK) + { + HANDLE done_event, init_done_event; + + done_event = OpenEvent(SYNCHRONIZE, FALSE, "ole_server_done_event"); + ok(done_event != 0, "server: OpenEvent error %d\n", GetLastError()); + init_done_event = OpenEvent(EVENT_MODIFY_STATE, FALSE, "ole_server_init_done_event"); + ok(init_done_event != 0, "server: OpenEvent error %d\n", GetLastError()); + + SetEvent(init_done_event); + + trace("server: waiting for requests\n"); + WaitForSingleObject(done_event, INFINITE); + + /* 1 remainining class ref is supposed to be cleared by CoRevokeClassObject */ + ok(class_ref == 1, "expected 1 class refs, got %d\n", class_ref); + ok(!obj_ref, "expected 0 object refs, got %d\n", obj_ref); + ok(!server_locks, "expected 0 server locks, got %d\n", server_locks); + + CloseHandle(done_event); + CloseHandle(init_done_event); + if (0) + { + /* calling CoRevokeClassObject terminates process under Win7 */ + trace("call CoRevokeClassObject\n"); + CoRevokeClassObject(key); + trace("ret CoRevokeClassObject\n"); + } + } + trace("server: call CoUninitialize\n"); + CoUninitialize(); + trace("server: ret CoUninitialize\n"); + } + + trace("server: exiting %u\n", GetCurrentProcessId()); +} + +/******************************* OLE client *******************************/ +static BOOL register_server(const char *server, BOOL inproc_handler) +{ + static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0}; + DWORD ret; + HKEY root; + WCHAR buf[39 + 6]; + char server_path[MAX_PATH]; + + lstrcpy(server_path, server); + lstrcat(server_path, " ole_server"); + + lstrcpyW(buf, clsidW); + StringFromGUID2(&CLSID_WineTestObject, buf + 6, 39); + + ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE | KEY_CREATE_SUB_KEY, NULL, &root, NULL); + if (ret == ERROR_SUCCESS) + { + ret = RegSetValue(root, "LocalServer32", REG_SZ, server_path, strlen(server_path)); + ok(ret == ERROR_SUCCESS, "RegSetValue error %u\n", ret); + + if (inproc_handler) + { + ret = RegSetValue(root, "InprocHandler32", REG_SZ, "ole32.dll", 9); + ok(ret == ERROR_SUCCESS, "RegSetValue error %u\n", ret); + } + + RegCloseKey(root); + } + + return ret == ERROR_SUCCESS; +} + +static void unregister_server(void) +{ + static const WCHAR clsidW[] = {'C','L','S','I','D','\\',0}; + DWORD ret; + HKEY root; + WCHAR buf[39 + 6]; + + lstrcpyW(buf, clsidW); + StringFromGUID2(&CLSID_WineTestObject, buf + 6, 39); + + ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, buf, 0, NULL, 0, + DELETE, NULL, &root, NULL); + if (ret == ERROR_SUCCESS) + { + ret = RegDeleteKey(root, "InprocHandler32"); + ok(ret == ERROR_SUCCESS, "RegDeleteKey error %u\n", ret); + ret = RegDeleteKey(root, "LocalServer32"); + ok(ret == ERROR_SUCCESS, "RegDeleteKey error %u\n", ret); + ret = RegDeleteKey(root, ""); + ok(ret == ERROR_SUCCESS, "RegDeleteKey error %u\n", ret); + RegCloseKey(root); + } +} + +static HANDLE start_server(const char *argv0) +{ + PROCESS_INFORMATION pi; + STARTUPINFO si; + SECURITY_ATTRIBUTES sa; + char cmdline[MAX_PATH * 2]; + BOOL ret; + + memset(&si, 0, sizeof(si)); + si.cb = sizeof(si); + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); + si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); + si.hStdError = si.hStdOutput; + + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + sprintf(cmdline, "\"%s\" ole_server -server", argv0); + ret = CreateProcess(argv0, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi); + ok(ret, "CreateProcess(%s) error %d\n", cmdline, GetLastError()); + if (!ret) return 0; + + CloseHandle(pi.hThread); + return pi.hProcess; +} + +START_TEST(ole_server) +{ + CLSID clsid = CLSID_WineTestObject; + HRESULT hr; + IClassFactory *factory; + IUnknown *unknown; + IOleObject *oleobj; + IRunnableObject *runobj; + DWORD ret; + HANDLE mapping, done_event, init_done_event, process; + struct winetest_info *info; + int argc; + char **argv; + + mapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4096, "winetest_ole_server"); + ok(mapping != 0, "CreateFileMapping failed\n"); + info = MapViewOfFile(mapping, FILE_MAP_READ|FILE_MAP_WRITE, 0, 0, 4096); + + argc = winetest_get_mainargs(&argv); + + done_event = CreateEvent(NULL, TRUE, FALSE, "ole_server_done_event"); + ok(done_event != 0, "CreateEvent error %d\n", GetLastError()); + init_done_event = CreateEvent(NULL, TRUE, FALSE, "ole_server_init_done_event"); + ok(init_done_event != 0, "CreateEvent error %d\n", GetLastError()); + + if (argc > 2) + { + if (!lstrcmpi(argv[2], "-Embedding")) + { + trace("server: Refusing to be run by ole32\n"); + return; + } + + if (!lstrcmpi(argv[2], "-server")) + { + info->child_failures = 0; + ole_server(); + info->child_failures = winetest_get_failures(); + return; + } + + trace("server: Unknown parameter: %s\n", argv[2]); + return; + } + + if (!register_server(argv[0], FALSE)) + { + win_skip("not enough permissions to create a server CLSID key\n"); + return; + } + + if (!(process = start_server(argv[0]))) + { + unregister_server(); + return; + } + WaitForSingleObject(init_done_event, 5000); + + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); + ok(hr == S_OK, "OleInitialize error %#x\n", hr); + + hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&unknown); + ok(hr == REGDB_E_CLASSNOTREG, "expected REGDB_E_CLASSNOTREG, got %#x\n", hr); + + if (!register_server(argv[0], TRUE)) + { + win_skip("not enough permissions to create a server CLSID key\n"); + unregister_server(); + return; + } + + trace("call CoCreateInstance(&IID_NULL)\n"); + hr = CoCreateInstance(&clsid, NULL, CLSCTX_LOCAL_SERVER, &IID_NULL, (void **)&unknown); + trace("ret CoCreateInstance(&IID_NULL)\n"); + ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr); + + /* in-process handler supports IID_IUnknown starting from Vista */ + trace("call CoCreateInstance(&IID_IUnknown)\n"); + hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_HANDLER, &IID_IUnknown, (void **)&unknown); + trace("ret CoCreateInstance(&IID_IUnknown)\n"); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* XP,win2000 and earlier */, "CoCreateInstance(IID_IUnknown) error %#x\n", hr); + if (hr != S_OK) + { + win_skip("In-process handler doesn't support IID_IUnknown on this platform\n"); + goto test_local_server; + } + + trace("call CoCreateInstance(&IID_IOleObject)\n"); + hr = CoCreateInstance(&clsid, NULL, CLSCTX_LOCAL_SERVER, &IID_IOleObject, (void **)&oleobj); + trace("ret CoCreateInstance(&IID_IOleObject)\n"); + ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr); + + trace("call IUnknown_QueryInterface(&IID_IRunnableObject)\n"); + hr = IUnknown_QueryInterface(unknown, &IID_IRunnableObject, (void **)&runobj); + trace("ret IUnknown_QueryInterface(&IID_IRunnableObject)\n"); + ok(hr == S_OK, "QueryInterface(&IID_IRunnableObject) error %#x\n", hr); + + ret = IRunnableObject_IsRunning(runobj); + ok(!ret, "expected 0, got %d\n", ret); + + trace("call OleRun\n"); + hr = OleRun(unknown); + trace("ret OleRun\n"); +todo_wine + ok(hr == S_OK, "OleRun error %#x\n", hr); + + ret = IRunnableObject_IsRunning(runobj); +todo_wine + ok(ret == 1, "expected 1, got %d\n", ret); + + trace("call IRunnableObject_Release\n"); + ret = IRunnableObject_Release(runobj); + trace("ret IRunnableObject_Release\n"); + ok(ret == 1, "expected ref 1, got %u\n", ret); + + trace("call IUnknown_QueryInterface(&IID_IOleObject)\n"); + hr = IUnknown_QueryInterface(unknown, &IID_IOleObject, (void **)&oleobj); + trace("ret IUnknown_QueryInterface(&IID_IOleObject)\n"); + ok(hr == S_OK, "QueryInterface(&IID_IOleObject) error %#x\n", hr); + + trace("call IOleObject_Release\n"); + ret = IOleObject_Release(oleobj); + trace("ret IOleObject_Release\n"); + ok(ret == 1, "expected ref 1, got %u\n", ret); + + trace("call IUnknown_Release\n"); + ret = IUnknown_Release(unknown); + trace("ret IUnknown_Release\n"); + ok(!ret, "expected ref 0, got %u\n", ret); + +test_local_server: + /* local server supports IID_IUnknown */ + trace("call CoCreateInstance(&IID_IUnknown)\n"); + hr = CoCreateInstance(&clsid, NULL, CLSCTX_LOCAL_SERVER, &IID_IUnknown, (void **)&unknown); + trace("ret CoCreateInstance(&IID_IUnknown)\n"); + ok(hr == S_OK, "CoCreateInstance(IID_IUnknown) error %#x\n", hr); + + trace("call IUnknown_QueryInterface(&IID_IRunnableObject)\n"); + hr = IUnknown_QueryInterface(unknown, &IID_IRunnableObject, (void **)&runobj); + trace("ret IUnknown_QueryInterface(&IID_IRunnableObject)\n"); + ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr); + + trace("call OleRun\n"); + hr = OleRun(unknown); + trace("ret OleRun\n"); + ok(hr == S_OK, "OleRun error %#x\n", hr); + + trace("call IUnknown_QueryInterface(&IID_IOleObject)\n"); + hr = IUnknown_QueryInterface(unknown, &IID_IOleObject, (void **)&oleobj); + trace("ret IUnknown_QueryInterface(&IID_IOleObject)\n"); + ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr); + + trace("call IUnknown_Release\n"); + ret = IUnknown_Release(unknown); + trace("ret IUnknown_Release\n"); + ok(!ret, "expected ref 0, got %u\n", ret); + + trace("call CoGetClassObject(&IID_IClassFactory)\n"); + hr = CoGetClassObject(&clsid, CLSCTX_LOCAL_SERVER, NULL, &IID_IClassFactory, (void **)&factory); + trace("ret CoGetClassObject(&IID_IClassFactory)\n"); + ok(hr == S_OK, "CoGetClassObject error %#x\n", hr); + + trace("call IClassFactory_CreateInstance(&IID_NULL)\n"); + hr = IClassFactory_CreateInstance(factory, NULL, &IID_NULL, (void **)&oleobj); + trace("ret IClassFactory_CreateInstance(&IID_NULL)\n"); + ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr); + + trace("call IClassFactory_CreateInstance(&IID_IOleObject)\n"); + hr = IClassFactory_CreateInstance(factory, NULL, &IID_IOleObject, (void **)&oleobj); + trace("ret IClassFactory_CreateInstance(&IID_IOleObject)\n"); + ok(hr == E_NOINTERFACE, "expected E_NOINTERFACE, got %#x\n", hr); + + trace("call IClassFactory_Release\n"); + ret = IClassFactory_Release(factory); + trace("ret IClassFactory_Release\n"); + ok(!ret, "expected ref 0, got %u\n", ret); + + trace("signalling termination\n"); + SetEvent(done_event); + ret = WaitForSingleObject(process, 10000); + ok(ret == WAIT_OBJECT_0, "server failed to terminate\n"); + + OleUninitialize(); + + unregister_server(); + + if (info->child_failures) + { + trace("%d failures in child process\n", info->child_failures); + winetest_add_failures(info->child_failures); + } +} Propchange: trunk/rostests/winetests/ole32/ole_server.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/winetests/ole32/storage32.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/storage32…
============================================================================== --- trunk/rostests/winetests/ole32/storage32.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/storage32.c [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -1812,32 +1812,36 @@ { TRUE, ERROR_SUCCESS } }; +static const DWORD access_modes[4] = { + 0, + GENERIC_READ, + GENERIC_WRITE, + GENERIC_READ | GENERIC_WRITE +}; + +static const DWORD share_modes[4] = { + 0, + FILE_SHARE_READ, + FILE_SHARE_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE +}; + static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line) { - DWORD access = 0, share = 0; - DWORD lasterr; - HANDLE hfile; int i, j, idx = 0; - for (i = 0; i < 4; i++) + for (i = 0; i < sizeof(access_modes)/sizeof(access_modes[0]); i++) { - if (i == 0) access = 0; - if (i == 1) access = GENERIC_READ; - if (i == 2) access = GENERIC_WRITE; - if (i == 3) access = GENERIC_READ | GENERIC_WRITE; - - for (j = 0; j < 4; j++) + for (j = 0; j < sizeof(share_modes)/sizeof(share_modes[0]); j++) { + DWORD lasterr; + HANDLE hfile; + if (ares[idx].ignore) continue; - if (j == 0) share = 0; - if (j == 1) share = FILE_SHARE_READ; - if (j == 2) share = FILE_SHARE_WRITE; - if (j == 3) share = FILE_SHARE_READ | FILE_SHARE_WRITE; - SetLastError(0xdeadbeef); - hfile = CreateFileA(file, access, share, NULL, OPEN_EXISTING, + hfile = CreateFileA(file, access_modes[i], share_modes[j], NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); lasterr = GetLastError(); @@ -1861,105 +1865,117 @@ static void test_access(void) { + static const WCHAR fileW[] = {'w','i','n','e','t','e','s','t',0}; + static const char fileA[] = "winetest"; IStorage *stg; HRESULT hr; - static const WCHAR fileW[] = {'w','i','n','e','t','e','s','t',0}; - /* STGM_TRANSACTED */ - hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED, 0, &stg); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create); + test_file_access(fileA, create); hr = IStorage_Commit(stg, STGC_DEFAULT); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create_commit); + test_file_access(fileA, create_commit); IStorage_Release(stg); - test_file_access("winetest", create_close); - - DeleteFileA("winetest"); + test_file_access(fileA, create_close); + + DeleteFileA(fileA); /* STGM_DIRECT */ - hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_DIRECT, 0, &stg); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create); + test_file_access(fileA, create); hr = IStorage_Commit(stg, STGC_DEFAULT); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create_commit); + test_file_access(fileA, create_commit); IStorage_Release(stg); - test_file_access("winetest", create_close); - - DeleteFileA("winetest"); + test_file_access(fileA, create_close); + + DeleteFileA(fileA); /* STGM_SHARE_DENY_NONE */ - hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_NONE | STGM_TRANSACTED, 0, &stg); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create); + test_file_access(fileA, create); hr = IStorage_Commit(stg, STGC_DEFAULT); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create_commit); + test_file_access(fileA, create_commit); IStorage_Release(stg); - test_file_access("winetest", create_close); - - DeleteFileA("winetest"); + test_file_access(fileA, create_close); + + DeleteFileA(fileA); /* STGM_SHARE_DENY_READ */ - hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_READ | STGM_TRANSACTED, 0, &stg); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create); + test_file_access(fileA, create); hr = IStorage_Commit(stg, STGC_DEFAULT); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create_commit); + test_file_access(fileA, create_commit); IStorage_Release(stg); - test_file_access("winetest", create_close); - - DeleteFileA("winetest"); + test_file_access(fileA, create_close); + + DeleteFileA(fileA); /* STGM_SHARE_DENY_WRITE */ - hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create); + test_file_access(fileA, create); hr = IStorage_Commit(stg, STGC_DEFAULT); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - test_file_access("winetest", create_commit); + test_file_access(fileA, create_commit); IStorage_Release(stg); - test_file_access("winetest", create_close); - - DeleteFileA("winetest"); + test_file_access(fileA, create_close); + + DeleteFileA(fileA); + + /* STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE - reader mode for direct SWMR mode */ + hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg); + ok(hr == S_OK, "got %08x\n", hr); + IStorage_Release(stg); + + hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE, NULL, 0, &stg); + ok(hr == S_OK || broken(hr == STG_E_INVALIDFLAG), "got %08x\n", hr); + if(hr != S_OK) + return; + + test_file_access(fileA, create); + + IStorage_Release(stg); + test_file_access(fileA, create_close); + + DeleteFileA(fileA); } static void test_readonly(void) @@ -3034,6 +3050,57 @@ IStorage_Release(stg); DeleteFileW(filename); +} + +static void test_direct_swmr(void) +{ + static const WCHAR fileW[] = {'w','i','n','e','t','e','s','t',0}; + IDirectWriterLock *dwlock; + ULONG ref, ref2; + IStorage *stg; + HRESULT hr; + + /* it's possible to create in writer mode */ + hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_DIRECT_SWMR, 0, &stg); +todo_wine + ok(hr == S_OK, "got %08x\n", hr); +if (hr == S_OK) { + IStorage_Release(stg); + DeleteFileW(fileW); +} + + hr = StgCreateDocfile(fileW, STGM_CREATE | STGM_READWRITE | STGM_SHARE_DENY_WRITE | STGM_TRANSACTED, 0, &stg); + ok(hr == S_OK, "got %08x\n", hr); + IStorage_Release(stg); + + /* reader mode */ + hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READ | STGM_SHARE_DENY_NONE, NULL, 0, &stg); + ok(hr == S_OK || broken(hr == STG_E_INVALIDFLAG), "got %08x\n", hr); + if(hr == S_OK) + { + hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (void**)&dwlock); + ok(hr == E_NOINTERFACE, "got %08x\n", hr); + IStorage_Release(stg); + } + + /* writer mode */ + hr = StgOpenStorage(fileW, NULL, STGM_DIRECT_SWMR | STGM_READWRITE | STGM_SHARE_DENY_WRITE, NULL, 0, &stg); + ok(hr == S_OK, "got %08x\n", hr); + + ref = IStorage_AddRef(stg); + IStorage_Release(stg); + + hr = IStorage_QueryInterface(stg, &IID_IDirectWriterLock, (void**)&dwlock); + ok(hr == S_OK, "got %08x\n", hr); + + ref2 = IStorage_AddRef(stg); + IStorage_Release(stg); + ok(ref2 == ref + 1, "got %u\n", ref2); + + IDirectWriterLock_Release(dwlock); + IStorage_Release(stg); + + DeleteFileW(fileW); } START_TEST(storage32) @@ -3080,4 +3147,5 @@ test_copyto_recursive(); test_hglobal_storage_creation(); test_convert(); -} + test_direct_swmr(); +} Modified: trunk/rostests/winetests/ole32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ole32/testlist.…
============================================================================== --- trunk/rostests/winetests/ole32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ole32/testlist.c [iso-8859-1] Thu Sep 26 13:58:28 2013 @@ -12,6 +12,7 @@ extern void func_marshal(void); extern void func_moniker(void); extern void func_ole2(void); +extern void func_ole_server(void); extern void func_propvariant(void); extern void func_stg_prop(void); extern void func_storage32(void); @@ -28,6 +29,7 @@ { "marshal", func_marshal }, { "moniker", func_moniker }, { "ole2", func_ole2 }, + { "ole_server", func_ole_server }, { "propvariant", func_propvariant }, { "stg_prop", func_stg_prop }, { "storage32", func_storage32 },
11 years, 3 months
1
0
0
0
[akhaldi] 60354: [OLE32] * Sync with Wine 1.7.1. CORE-7469
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Sep 26 13:58:03 2013 New Revision: 60354 URL:
http://svn.reactos.org/svn/reactos?rev=60354&view=rev
Log: [OLE32] * Sync with Wine 1.7.1. CORE-7469 Modified: trunk/reactos/dll/win32/ole32/CMakeLists.txt trunk/reactos/dll/win32/ole32/compobj.c trunk/reactos/dll/win32/ole32/compobj_private.h trunk/reactos/dll/win32/ole32/compositemoniker.c trunk/reactos/dll/win32/ole32/errorinfo.c trunk/reactos/dll/win32/ole32/git.c trunk/reactos/dll/win32/ole32/ifs.c trunk/reactos/dll/win32/ole32/marshal.c trunk/reactos/dll/win32/ole32/ole2.c trunk/reactos/dll/win32/ole32/ole32.spec trunk/reactos/dll/win32/ole32/rpc.c trunk/reactos/dll/win32/ole32/stg_stream.c trunk/reactos/dll/win32/ole32/storage32.c trunk/reactos/dll/win32/ole32/storage32.h trunk/reactos/dll/win32/ole32/stubmanager.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/ole32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/CMakeLists…
============================================================================== --- trunk/reactos/dll/win32/ole32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/CMakeLists.txt [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -1,7 +1,3 @@ - -spec2def(ole32.dll ole32.spec ADD_IMPORTLIB) -generate_idl_iids(dcom.idl) -add_idl_headers(ole32idl dcom.idl irot.idl) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) @@ -16,6 +12,9 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) +spec2def(ole32.dll ole32.spec ADD_IMPORTLIB) +generate_idl_iids(dcom.idl) +add_idl_headers(ole32idl dcom.idl irot.idl) add_rpc_files(client irot.idl) add_rpcproxy_files( @@ -60,13 +59,12 @@ storage32.c stubmanager.c usrmarshal.c - ole32res.rc ${CMAKE_CURRENT_BINARY_DIR}/dcom_i.c ${CMAKE_CURRENT_BINARY_DIR}/dcom_p.c ${CMAKE_CURRENT_BINARY_DIR}/irot_c.c - ${CMAKE_CURRENT_BINARY_DIR}/ole32_unknwn_p.c ${CMAKE_CURRENT_BINARY_DIR}/ole32_objidl_p.c ${CMAKE_CURRENT_BINARY_DIR}/ole32_oleidl_p.c + ${CMAKE_CURRENT_BINARY_DIR}/ole32_unknwn_p.c ${CMAKE_CURRENT_BINARY_DIR}/ole32_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c ${CMAKE_CURRENT_BINARY_DIR}/ole32.def) @@ -78,7 +76,7 @@ set_source_files_properties(stg_prop.c PROPERTIES COMPILE_FLAGS "/FImsvc.h") endif() -add_library(ole32 SHARED ${SOURCE}) +add_library(ole32 SHARED ${SOURCE} ole32res.rc) set_module_type(ole32 win32dll) target_link_libraries(ole32 wine uuid ${PSEH_LIB}) add_importlibs(ole32 advapi32 user32 gdi32 rpcrt4 msvcrt kernel32 ntdll) Modified: trunk/reactos/dll/win32/ole32/compobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/compobj.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/compobj.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -61,6 +61,7 @@ #include <ole2ver.h> #include <ctxtcall.h> #include <dde.h> +#include <servprov.h> #include <initguid.h> #include "compobj_private.h" @@ -95,6 +96,20 @@ struct list entry; IID iid; CLSID clsid; +}; + +/* + * This is a marshallable object exposing registered local servers. + * IServiceProvider is used only because it happens meet requirements + * and already has proxy/stub code. If more functionality is needed, + * a custom interface may be used instead. + */ +struct LocalServer +{ + IServiceProvider IServiceProvider_iface; + LONG ref; + APARTMENT *apt; + IStream *marshal_stream; }; /* @@ -123,7 +138,6 @@ DWORD runContext; DWORD connectFlags; DWORD dwCookie; - LPSTREAM pMarshaledData; /* FIXME: only really need to store OXID and IPID */ void *RpcRegistration; } RegisteredClass; @@ -384,6 +398,7 @@ entry->DllCanUnloadNow = DllCanUnloadNow; entry->DllGetClassObject = DllGetClassObject; list_add_tail(&openDllList, &entry->entry); + *ret = entry; } else { @@ -391,7 +406,6 @@ hr = E_OUTOFMEMORY; FreeLibrary(hLibrary); } - *ret = entry; } LeaveCriticalSection( &csOpenDllList ); @@ -549,20 +563,7 @@ if (curClass->runContext & CLSCTX_LOCAL_SERVER) RPC_StopLocalServer(curClass->RpcRegistration); - /* - * Release the reference to the class object. - */ IUnknown_Release(curClass->classObject); - - if (curClass->pMarshaledData) - { - LARGE_INTEGER zero; - memset(&zero, 0, sizeof(zero)); - IStream_Seek(curClass->pMarshaledData, zero, STREAM_SEEK_SET, NULL); - CoReleaseMarshalData(curClass->pMarshaledData); - IStream_Release(curClass->pMarshaledData); - } - HeapFree(GetProcessHeap(), 0, curClass); } @@ -728,6 +729,130 @@ hr = ISynchronize_QueryInterface(&This->ISynchronize_iface, iid, ppv); ISynchronize_Release(&This->ISynchronize_iface); return hr; +} + +static inline LocalServer *impl_from_IServiceProvider(IServiceProvider *iface) +{ + return CONTAINING_RECORD(iface, LocalServer, IServiceProvider_iface); +} + +static HRESULT WINAPI LocalServer_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + LocalServer *This = impl_from_IServiceProvider(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + + if(IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IServiceProvider)) { + *ppv = &This->IServiceProvider_iface; + }else { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI LocalServer_AddRef(IServiceProvider *iface) +{ + LocalServer *This = impl_from_IServiceProvider(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI LocalServer_Release(IServiceProvider *iface) +{ + LocalServer *This = impl_from_IServiceProvider(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) { + assert(!This->apt); + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI LocalServer_QueryService(IServiceProvider *iface, REFGUID guid, REFIID riid, void **ppv) +{ + LocalServer *This = impl_from_IServiceProvider(iface); + APARTMENT *apt = COM_CurrentApt(); + RegisteredClass *iter; + HRESULT hres = E_FAIL; + + TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guid), debugstr_guid(riid), ppv); + + if(!This->apt) + return E_UNEXPECTED; + + EnterCriticalSection(&csRegisteredClassList); + + LIST_FOR_EACH_ENTRY(iter, &RegisteredClassList, RegisteredClass, entry) { + if(iter->apartment_id == apt->oxid + && (iter->runContext & CLSCTX_LOCAL_SERVER) + && IsEqualGUID(&iter->classIdentifier, guid)) { + hres = IUnknown_QueryInterface(iter->classObject, riid, ppv); + break; + } + } + + LeaveCriticalSection( &csRegisteredClassList ); + + return hres; +} + +static const IServiceProviderVtbl LocalServerVtbl = { + LocalServer_QueryInterface, + LocalServer_AddRef, + LocalServer_Release, + LocalServer_QueryService +}; + +static HRESULT get_local_server_stream(APARTMENT *apt, IStream **ret) +{ + HRESULT hres = S_OK; + + EnterCriticalSection(&apt->cs); + + if(!apt->local_server) { + LocalServer *obj; + + obj = heap_alloc(sizeof(*obj)); + if(obj) { + obj->IServiceProvider_iface.lpVtbl = &LocalServerVtbl; + obj->ref = 1; + obj->apt = apt; + + hres = CreateStreamOnHGlobal(0, TRUE, &obj->marshal_stream); + if(SUCCEEDED(hres)) { + hres = CoMarshalInterface(obj->marshal_stream, &IID_IServiceProvider, (IUnknown*)&obj->IServiceProvider_iface, + MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG); + if(FAILED(hres)) + IStream_Release(obj->marshal_stream); + } + + if(SUCCEEDED(hres)) + apt->local_server = obj; + else + heap_free(obj); + }else { + hres = E_OUTOFMEMORY; + } + } + + if(SUCCEEDED(hres)) + hres = IStream_Clone(apt->local_server->marshal_stream, ret); + + LeaveCriticalSection(&apt->cs); + + if(FAILED(hres)) + ERR("Failed: %08x\n", hres); + return hres; } /*********************************************************************** @@ -859,6 +984,21 @@ struct list *cursor, *cursor2; TRACE("destroying apartment %p, oxid %s\n", apt, wine_dbgstr_longlong(apt->oxid)); + + if(apt->local_server) { + LocalServer *local_server = apt->local_server; + LARGE_INTEGER zero; + + memset(&zero, 0, sizeof(zero)); + IStream_Seek(local_server->marshal_stream, zero, STREAM_SEEK_SET, NULL); + CoReleaseMarshalData(local_server->marshal_stream); + IStream_Release(local_server->marshal_stream); + local_server->marshal_stream = NULL; + + apt->local_server = NULL; + local_server->apt = NULL; + IServiceProvider_Release(&local_server->IServiceProvider_iface); + } /* Release the references to the registered class objects */ COM_RevokeAllClasses(apt); @@ -2103,6 +2243,15 @@ return __CLSIDFromString(buf2,clsid); } +/****************************************************************************** + * CLSIDFromProgIDEx [OLE32.@] + */ +HRESULT WINAPI CLSIDFromProgIDEx(LPCOLESTR progid, LPCLSID clsid) +{ + FIXME("%s,%p: semi-stub\n", debugstr_w(progid), clsid); + + return CLSIDFromProgID(progid, clsid); +} /***************************************************************************** * CoGetPSClsid [OLE32.@] @@ -2407,7 +2556,6 @@ newClass->apartment_id = apt->oxid; newClass->runContext = dwClsContext; newClass->connectFlags = flags; - newClass->pMarshaledData = NULL; newClass->RpcRegistration = NULL; if (!(newClass->dwCookie = InterlockedIncrement( &next_cookie ))) @@ -2427,23 +2575,17 @@ *lpdwRegister = newClass->dwCookie; if (dwClsContext & CLSCTX_LOCAL_SERVER) { - hr = CreateStreamOnHGlobal(0, TRUE, &newClass->pMarshaledData); - if (hr) { - FIXME("Failed to create stream on hglobal, %x\n", hr); + IStream *marshal_stream; + + hr = get_local_server_stream(apt, &marshal_stream); + if(FAILED(hr)) return hr; - } - hr = CoMarshalInterface(newClass->pMarshaledData, &IID_IUnknown, - newClass->classObject, MSHCTX_LOCAL, NULL, - MSHLFLAGS_TABLESTRONG); - if (hr) { - FIXME("CoMarshalInterface failed, %x!\n",hr); - return hr; - } hr = RPC_StartLocalServer(&newClass->classIdentifier, - newClass->pMarshaledData, + marshal_stream, flags & (REGCLS_MULTIPLEUSE|REGCLS_MULTI_SEPARATE), &newClass->RpcRegistration); + IStream_Release(marshal_stream); } return S_OK; } @@ -2768,16 +2910,12 @@ /* * The Standard Global Interface Table (GIT) object is a process-wide singleton. - * Rather than create a class factory, we can just check for it here */ if (IsEqualIID(rclsid, &CLSID_StdGlobalInterfaceTable)) { - if (StdGlobalInterfaceTableInstance == NULL) - StdGlobalInterfaceTableInstance = StdGlobalInterfaceTable_Construct(); - hres = IGlobalInterfaceTable_QueryInterface((IGlobalInterfaceTable*)StdGlobalInterfaceTableInstance, - iid, - ppv); - if (hres) return hres; + IGlobalInterfaceTable *git = get_std_git(); + hres = IGlobalInterfaceTable_QueryInterface(git, iid, ppv); + if (hres != S_OK) return hres; TRACE("Retrieved GIT (%p)\n", *ppv); return S_OK; @@ -2859,7 +2997,7 @@ &IID_IUnknown, (VOID**)&pUnk); - if (hr) + if (hr != S_OK) return hr; /* @@ -4445,9 +4583,9 @@ /*********************************************************************** * DllMain (OLE32.@) */ -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) -{ - TRACE("%p 0x%x %p\n", hinstDLL, fdwReason, fImpLoad); +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID reserved) +{ + TRACE("%p 0x%x %p\n", hinstDLL, fdwReason, reserved); switch(fdwReason) { case DLL_PROCESS_ATTACH: @@ -4456,6 +4594,8 @@ break; case DLL_PROCESS_DETACH: + if (reserved) break; + release_std_git(); COMPOBJ_UninitProcess(); RPC_UnregisterAllChannelHooks(); COMPOBJ_DllList_Free(); Modified: trunk/reactos/dll/win32/ole32/compobj_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compobj_pr…
============================================================================== --- trunk/reactos/dll/win32/ole32/compobj_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/compobj_private.h [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -40,6 +40,7 @@ struct apartment; typedef struct apartment APARTMENT; +typedef struct LocalServer LocalServer; DEFINE_OLEGUID( CLSID_DfMarshal, 0x0000030b, 0, 0 ); @@ -96,6 +97,8 @@ IUnknown *object; /* the object we are managing the stub for (RO) */ ULONG next_ipid; /* currently unused (LOCK) */ OXID_INFO oxid_info; /* string binding, ipid of rem unknown and other information (RO) */ + + IExternalConnection *extern_conn; /* We need to keep a count of the outstanding marshals, so we can enforce the * marshalling rules (ie, you can only unmarshal normal marshals once). Note @@ -137,6 +140,7 @@ struct list loaded_dlls; /* list of dlls loaded by this apartment (CS cs) */ DWORD host_apt_tid; /* thread ID of apartment hosting objects of differing threading model (CS cs) */ HWND host_apt_hwnd; /* handle to apartment window of host apartment (CS cs) */ + LocalServer *local_server; /* A marshallable object exposing local servers (CS cs) */ /* FIXME: OIDs should be given out by RPCSS */ OID oidc; /* object ID counter, starts at 1, zero is invalid OID (CS cs) */ @@ -169,10 +173,9 @@ /* Global Interface Table Functions */ - -extern void* StdGlobalInterfaceTable_Construct(void) DECLSPEC_HIDDEN; +extern IGlobalInterfaceTable *get_std_git(void) DECLSPEC_HIDDEN; +extern void release_std_git(void) DECLSPEC_HIDDEN; extern HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) DECLSPEC_HIDDEN; -extern void* StdGlobalInterfaceTableInstance DECLSPEC_HIDDEN; HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *key) DECLSPEC_HIDDEN; HRESULT COM_OpenKeyForAppIdFromCLSID(REFCLSID clsid, REGSAM access, HKEY *subkey) DECLSPEC_HIDDEN; @@ -312,4 +315,14 @@ extern LSTATUS create_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN; extern LSTATUS open_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN; +static inline void *heap_alloc(size_t len) +{ + return HeapAlloc(GetProcessHeap(), 0, len); +} + +static inline BOOL heap_free(void *mem) +{ + return HeapFree(GetProcessHeap(), 0, mem); +} + #endif /* __WINE_OLE_COMPOBJ_H */ Modified: trunk/reactos/dll/win32/ole32/compositemoniker.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/compositem…
============================================================================== --- trunk/reactos/dll/win32/ole32/compositemoniker.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/compositemoniker.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -239,7 +239,7 @@ if (++This->tabLastIndex==This->tabSize){ This->tabSize+=BLOCK_TAB_SIZE; - This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); + This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(This->tabMoniker[0])); if (This->tabMoniker==NULL) return E_OUTOFMEMORY; @@ -1446,7 +1446,7 @@ if (This->tabLastIndex + 2 > This->tabSize) { This->tabSize += max(BLOCK_TAB_SIZE, 2); - This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); + This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(This->tabMoniker[0])); if (This->tabMoniker==NULL) return E_OUTOFMEMORY; @@ -1661,7 +1661,7 @@ newEnumMoniker->tabSize=tabSize; newEnumMoniker->currentPos=currentPos; - newEnumMoniker->tabMoniker=HeapAlloc(GetProcessHeap(),0,tabSize*sizeof(IMoniker)); + newEnumMoniker->tabMoniker=HeapAlloc(GetProcessHeap(),0,tabSize*sizeof(newEnumMoniker->tabMoniker[0])); if (newEnumMoniker->tabMoniker==NULL) { HeapFree(GetProcessHeap(), 0, newEnumMoniker); @@ -1768,7 +1768,7 @@ This->tabSize=BLOCK_TAB_SIZE; This->tabLastIndex=0; - This->tabMoniker=HeapAlloc(GetProcessHeap(),0,This->tabSize*sizeof(IMoniker)); + This->tabMoniker=HeapAlloc(GetProcessHeap(),0,This->tabSize*sizeof(This->tabMoniker[0])); if (This->tabMoniker==NULL) { HeapFree(GetProcessHeap(), 0, This); return E_OUTOFMEMORY; @@ -1896,7 +1896,7 @@ This->tabSize+=BLOCK_TAB_SIZE; - This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(IMoniker)); + This->tabMoniker=HeapReAlloc(GetProcessHeap(),0,This->tabMoniker,This->tabSize*sizeof(This->tabMoniker[0])); if (This->tabMoniker==NULL){ HeapFree(GetProcessHeap(), 0, tab_moniker); Modified: trunk/reactos/dll/win32/ole32/errorinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/errorinfo.…
============================================================================== --- trunk/reactos/dll/win32/ole32/errorinfo.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/errorinfo.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -43,16 +43,6 @@ #include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(ole); - -static inline void *heap_alloc(size_t len) -{ - return HeapAlloc(GetProcessHeap(), 0, len); -} - -static inline BOOL heap_free(void *mem) -{ - return HeapFree(GetProcessHeap(), 0, mem); -} static inline WCHAR *heap_strdupW(const WCHAR *str) { Modified: trunk/reactos/dll/win32/ole32/git.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/git.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/ole32/git.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/git.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -69,13 +69,12 @@ { IGlobalInterfaceTable IGlobalInterfaceTable_iface; - ULONG ref; struct list list; ULONG nextCookie; } StdGlobalInterfaceTableImpl; -void* StdGlobalInterfaceTableInstance; +static IGlobalInterfaceTable *std_git; static CRITICAL_SECTION git_section; static CRITICAL_SECTION_DEBUG critsect_debug = @@ -90,16 +89,6 @@ static inline StdGlobalInterfaceTableImpl *impl_from_IGlobalInterfaceTable(IGlobalInterfaceTable *iface) { return CONTAINING_RECORD(iface, StdGlobalInterfaceTableImpl, IGlobalInterfaceTable_iface); -} - -/** This destroys it again. It should revoke all the held interfaces first **/ -static void StdGlobalInterfaceTable_Destroy(void* This) -{ - TRACE("(%p)\n", This); - FIXME("Revoke held interfaces here\n"); - - HeapFree(GetProcessHeap(), 0, This); - StdGlobalInterfaceTableInstance = NULL; } /*** @@ -150,25 +139,13 @@ static ULONG WINAPI StdGlobalInterfaceTable_AddRef(IGlobalInterfaceTable* iface) { - StdGlobalInterfaceTableImpl* const This = impl_from_IGlobalInterfaceTable(iface); - - /* InterlockedIncrement(&This->ref); */ - return This->ref; + return 1; } static ULONG WINAPI StdGlobalInterfaceTable_Release(IGlobalInterfaceTable* iface) { - StdGlobalInterfaceTableImpl* const This = impl_from_IGlobalInterfaceTable(iface); - - /* InterlockedDecrement(&This->ref); */ - if (This->ref == 0) { - /* Hey ho, it's time to go, so long again 'till next weeks show! */ - StdGlobalInterfaceTable_Destroy(This); - return 0; - } - - return This->ref; + return 1; } /*** @@ -206,7 +183,12 @@ IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL); entry = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGITEntry)); - if (entry == NULL) return E_OUTOFMEMORY; + if (!entry) + { + CoReleaseMarshalData(stream); + IStream_Release(stream); + return E_OUTOFMEMORY; + } EnterCriticalSection(&git_section); @@ -299,7 +281,7 @@ hres = CoUnmarshalInterface(stream, riid, ppv); IStream_Release(stream); - if (hres) { + if (hres != S_OK) { WARN("Failed to unmarshal stream\n"); return hres; } @@ -314,8 +296,8 @@ GITCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) { *ppv = NULL; - if (IsEqualIID(riid,&IID_IUnknown) || - IsEqualIID(riid,&IID_IGlobalInterfaceTable)) + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IClassFactory)) { *ppv = iface; return S_OK; @@ -338,9 +320,8 @@ REFIID riid, LPVOID *ppv) { if (IsEqualIID(riid,&IID_IGlobalInterfaceTable)) { - if (StdGlobalInterfaceTableInstance == NULL) - StdGlobalInterfaceTableInstance = StdGlobalInterfaceTable_Construct(); - return IGlobalInterfaceTable_QueryInterface( (IGlobalInterfaceTable*) StdGlobalInterfaceTableInstance, riid, ppv); + IGlobalInterfaceTable *git = get_std_git(); + return IGlobalInterfaceTable_QueryInterface(git, riid, ppv); } FIXME("(%s), not supported.\n",debugstr_guid(riid)); @@ -361,11 +342,11 @@ GITCF_LockServer }; -static const IClassFactoryVtbl *PGITClassFactoryVtbl = &GITClassFactoryVtbl; +static IClassFactory git_classfactory = { &GITClassFactoryVtbl }; HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) { - *ppv = &PGITClassFactoryVtbl; + *ppv = &git_classfactory; TRACE("Returning GIT classfactory\n"); return S_OK; } @@ -381,19 +362,46 @@ StdGlobalInterfaceTable_GetInterfaceFromGlobal }; -/** This function constructs the GIT. It should only be called once **/ -void* StdGlobalInterfaceTable_Construct(void) -{ - StdGlobalInterfaceTableImpl* newGIT; - - newGIT = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGlobalInterfaceTableImpl)); - if (newGIT == 0) return newGIT; - - newGIT->IGlobalInterfaceTable_iface.lpVtbl = &StdGlobalInterfaceTableImpl_Vtbl; - newGIT->ref = 1; /* Initialise the reference count */ - list_init(&newGIT->list); - newGIT->nextCookie = 0xf100; /* that's where windows starts, so that's where we start */ - TRACE("Created the GIT at %p\n", newGIT); - - return (void*)newGIT; -} +IGlobalInterfaceTable* get_std_git(void) +{ + if (!std_git) + { + StdGlobalInterfaceTableImpl* newGIT; + + newGIT = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGlobalInterfaceTableImpl)); + if (!newGIT) return NULL; + + newGIT->IGlobalInterfaceTable_iface.lpVtbl = &StdGlobalInterfaceTableImpl_Vtbl; + list_init(&newGIT->list); + newGIT->nextCookie = 0xf100; /* that's where windows starts, so that's where we start */ + + if (InterlockedCompareExchangePointer((void**)&std_git, &newGIT->IGlobalInterfaceTable_iface, NULL)) + { + HeapFree(GetProcessHeap(), 0, newGIT); + } + else + TRACE("Created the GIT at %p\n", newGIT); + } + + return std_git; +} + +void release_std_git(void) +{ + StdGlobalInterfaceTableImpl *git; + StdGITEntry *entry, *entry2; + + if (!std_git) return; + + git = impl_from_IGlobalInterfaceTable(std_git); + LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &git->list, StdGITEntry, entry) + { + list_remove(&entry->entry); + + CoReleaseMarshalData(entry->stream); + IStream_Release(entry->stream); + HeapFree(GetProcessHeap(), 0, entry); + } + + HeapFree(GetProcessHeap(), 0, git); +} Modified: trunk/reactos/dll/win32/ole32/ifs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ifs.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/ole32/ifs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ifs.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -81,7 +81,7 @@ LPVOID *NewSpyedBlocks; if (!Malloc32.SpyedBlocks) NewSpyedBlocks = LocalAlloc(LMEM_ZEROINIT, NewLength * sizeof(PVOID)); - else NewSpyedBlocks = LocalReAlloc(Malloc32.SpyedBlocks, NewLength * sizeof(PVOID), LMEM_ZEROINIT); + else NewSpyedBlocks = LocalReAlloc(Malloc32.SpyedBlocks, NewLength * sizeof(PVOID), LMEM_ZEROINIT | LMEM_MOVEABLE); if (NewSpyedBlocks) { Malloc32.SpyedBlocks = NewSpyedBlocks; Malloc32.SpyedBlockTableLength = NewLength; @@ -220,13 +220,16 @@ IMallocSpy_Release(Malloc32.pSpy); Malloc32.SpyReleasePending = FALSE; Malloc32.pSpy = NULL; + LeaveCriticalSection(&IMalloc32_SpyCS); } if (0==cb) { - /* PreRealloc can force Realloc to fail */ - LeaveCriticalSection(&IMalloc32_SpyCS); + /* PreRealloc can force Realloc to fail */ + if (Malloc32.pSpy) + LeaveCriticalSection(&IMalloc32_SpyCS); return NULL; } + pv = pRealMemory; } Modified: trunk/reactos/dll/win32/ole32/marshal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/marshal.c?…
============================================================================== --- trunk/reactos/dll/win32/ole32/marshal.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/marshal.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -1440,6 +1440,7 @@ if (!(stubmgr = get_stub_manager(apt, stdobjref.oid))) { + apartment_release(apt); ERR("could not map object ID to stub manager, oxid=%s, oid=%s\n", wine_dbgstr_longlong(stdobjref.oxid), wine_dbgstr_longlong(stdobjref.oid)); return RPC_E_INVALID_OBJREF; Modified: trunk/reactos/dll/win32/ole32/ole2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole2.c?rev…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole2.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ole2.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -885,11 +885,6 @@ LONG result; /* - * Initialize the out parameter. - */ - *pdwStatus = 0; - - /* * Build the key name we're looking for */ sprintfW( keyName, clsidfmtW, @@ -899,6 +894,10 @@ TRACE("(%s, %d, %p)\n", debugstr_w(keyName), dwAspect, pdwStatus); + if (!pdwStatus) return E_INVALIDARG; + + *pdwStatus = 0; + /* * Open the class id Key */ @@ -913,7 +912,7 @@ if (result != ERROR_SUCCESS) { RegCloseKey(clsidKey); - return REGDB_E_READREGDB; + return S_OK; } /* Modified: trunk/reactos/dll/win32/ole32/ole32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/ole32.spec…
============================================================================== --- trunk/reactos/dll/win32/ole32/ole32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/ole32.spec [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -4,6 +4,7 @@ @ stdcall CLIPFORMAT_UserSize(ptr long ptr) @ stdcall CLIPFORMAT_UserUnmarshal(ptr ptr ptr) @ stdcall CLSIDFromProgID(wstr ptr) +@ stdcall CLSIDFromProgIDEx(wstr ptr) @ stdcall CLSIDFromString(wstr ptr) @ stdcall CoAddRefServerProcess() @ stdcall CoAllowSetForegroundWindow(ptr ptr) Modified: trunk/reactos/dll/win32/ole32/rpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/rpc.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/ole32/rpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/rpc.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -42,6 +42,7 @@ //#include "rpc.h" //#include "winerror.h" //#include "winreg.h" +#include <servprov.h> #include <wine/unicode.h> #include "compobj_private.h" @@ -1521,7 +1522,7 @@ /* if IRpcStubBuffer_Invoke fails, we should raise an exception to tell * the RPC runtime that the call failed */ - if (hr) RpcRaiseException(hr); + if (hr != S_OK) RpcRaiseException(hr); } /* stub registration */ @@ -1658,6 +1659,7 @@ DWORD size = (MAX_PATH+1) * sizeof(WCHAR); STARTUPINFOW sinfo; PROCESS_INFORMATION pinfo; + LONG ret; hres = COM_OpenKeyForCLSID(rclsid, wszLocalServer32, KEY_READ, &key); if (FAILED(hres)) { @@ -1665,9 +1667,9 @@ return hres; } - hres = RegQueryValueExW(key, NULL, NULL, NULL, (LPBYTE)command, &size); + ret = RegQueryValueExW(key, NULL, NULL, NULL, (LPBYTE)command, &size); RegCloseKey(key); - if (hres) { + if (ret) { WARN("No default value for LocalServer32 key\n"); return REGDB_E_CLASSNOTREG; /* FIXME: check retval */ } @@ -1809,6 +1811,7 @@ LARGE_INTEGER seekto; ULARGE_INTEGER newpos; int tries = 0; + IServiceProvider *local_server; static const int MAXTRIES = 30; /* 30 seconds */ @@ -1862,14 +1865,17 @@ return E_NOINTERFACE; hres = CreateStreamOnHGlobal(0,TRUE,&pStm); - if (hres) return hres; + if (hres != S_OK) return hres; hres = IStream_Write(pStm,marshalbuffer,bufferlen,&res); - if (hres) goto out; + if (hres != S_OK) goto out; seekto.u.LowPart = 0;seekto.u.HighPart = 0; hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos); - TRACE("unmarshalling classfactory\n"); - hres = CoUnmarshalInterface(pStm,&IID_IClassFactory,ppv); + TRACE("unmarshalling local server\n"); + hres = CoUnmarshalInterface(pStm, &IID_IServiceProvider, (void**)&local_server); + if(SUCCEEDED(hres)) + hres = IServiceProvider_QueryService(local_server, rclsid, iid, ppv); + IServiceProvider_Release(local_server); out: IStream_Release(pStm); return hres; @@ -1920,50 +1926,38 @@ DWORD ret; ret = WaitForMultipleObjects(2, handles, FALSE, INFINITE); if (ret != WAIT_OBJECT_0) - { - CloseHandle(hPipe); break; - } } /* client already connected isn't an error */ else if (error != ERROR_PIPE_CONNECTED) { ERR("ConnectNamedPipe failed with error %d\n", GetLastError()); - CloseHandle(hPipe); break; } } - TRACE("marshalling IClassFactory to client\n"); + TRACE("marshalling LocalServer to client\n"); hres = IStream_Stat(pStm,&ststg,STATFLAG_NONAME); - if (hres) - { - CloseHandle(hPipe); - CloseHandle(pipe_event); - return hres; - } + if (hres != S_OK) + break; seekto.u.LowPart = 0; seekto.u.HighPart = 0; hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos); - if (hres) { + if (hres != S_OK) { FIXME("IStream_Seek failed, %x\n",hres); - CloseHandle(hPipe); - CloseHandle(pipe_event); - return hres; + break; } buflen = ststg.cbSize.u.LowPart; buffer = HeapAlloc(GetProcessHeap(),0,buflen); hres = IStream_Read(pStm,buffer,buflen,&res); - if (hres) { + if (hres != S_OK) { FIXME("Stream Read failed, %x\n",hres); - CloseHandle(hPipe); - CloseHandle(pipe_event); HeapFree(GetProcessHeap(),0,buffer); - return hres; + break; } WriteFile(hPipe,buffer,buflen,&res,&ovl); @@ -1972,27 +1966,27 @@ FlushFileBuffers(hPipe); DisconnectNamedPipe(hPipe); - TRACE("done marshalling IClassFactory\n"); + TRACE("done marshalling LocalServer\n"); if (!multi_use) { TRACE("single use object, shutting down pipe %s\n", debugstr_w(pipefn)); - CloseHandle(hPipe); break; } new_pipe = CreateNamedPipeW( pipefn, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE|PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 4096, 4096, 500 /* 0.5 second timeout */, NULL ); + if (new_pipe == INVALID_HANDLE_VALUE) + { + FIXME("pipe creation failed for %s, le is %u\n", debugstr_w(pipefn), GetLastError()); + break; + } CloseHandle(hPipe); - if (new_pipe == INVALID_HANDLE_VALUE) - { - FIXME("pipe creation failed for %s, le is %u\n", debugstr_w(pipefn), GetLastError()); - CloseHandle(pipe_event); - return 1; - } hPipe = new_pipe; } + CloseHandle(pipe_event); + CloseHandle(hPipe); return 0; } Modified: trunk/reactos/dll/win32/ole32/stg_stream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stg_stream…
============================================================================== --- trunk/reactos/dll/win32/ole32/stg_stream.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/stg_stream.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -43,40 +43,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage); - -/*** - * This is the destructor of the StgStreamImpl class. - * - * This method will clean-up all the resources used-up by the given StgStreamImpl - * class. The pointer passed-in to this function will be freed and will not - * be valid anymore. - */ -static void StgStreamImpl_Destroy(StgStreamImpl* This) -{ - TRACE("(%p)\n", This); - - /* - * Release the reference we are holding on the parent storage. - * IStorage_Release(&This->parentStorage->IStorage_iface); - * - * No, don't do this. Some apps call IStorage_Release without - * calling IStream_Release first. If we grab a reference the - * file is not closed, and the app fails when it tries to - * reopen the file (Easy-PC, for example). Just inform the - * storage that we have closed the stream - */ - - if(This->parentStorage) { - - StorageBaseImpl_RemoveStream(This->parentStorage, This); - - } - - This->parentStorage = 0; - - HeapFree(GetProcessHeap(), 0, This); -} - /*** * This implements the IUnknown method QueryInterface for this * class @@ -126,17 +92,27 @@ IStream* iface) { StgStreamImpl* This = impl_from_IStream(iface); - - ULONG ref; - - ref = InterlockedDecrement(&This->ref); - - /* - * If the reference count goes down to 0, perform suicide. - */ - if (ref==0) - { - StgStreamImpl_Destroy(This); + ULONG ref = InterlockedDecrement(&This->ref); + + if (!ref) + { + TRACE("(%p)\n", This); + + /* + * Release the reference we are holding on the parent storage. + * IStorage_Release(&This->parentStorage->IStorage_iface); + * + * No, don't do this. Some apps call IStorage_Release without + * calling IStream_Release first. If we grab a reference the + * file is not closed, and the app fails when it tries to + * reopen the file (Easy-PC, for example). Just inform the + * storage that we have closed the stream + */ + + if (This->parentStorage) + StorageBaseImpl_RemoveStream(This->parentStorage, This); + This->parentStorage = 0; + HeapFree(GetProcessHeap(), 0, This); } return ref; Modified: trunk/reactos/dll/win32/ole32/storage32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage32.…
============================================================================== --- trunk/reactos/dll/win32/ole32/storage32.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/storage32.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -71,6 +71,11 @@ return CONTAINING_RECORD(iface, StorageBaseImpl, IStorage_iface); } +static inline StorageBaseImpl *impl_from_IDirectWriterLock( IDirectWriterLock *iface ) +{ + return CONTAINING_RECORD(iface, StorageBaseImpl, IDirectWriterLock_iface); +} + /**************************************************************************** * Storage32InternalImpl definitions. * @@ -100,7 +105,7 @@ static void StorageImpl_Destroy(StorageBaseImpl* iface); static void StorageImpl_Invalidate(StorageBaseImpl* iface); static HRESULT StorageImpl_Flush(StorageBaseImpl* iface); -static BOOL StorageImpl_ReadBigBlock(StorageImpl* This, ULONG blockIndex, void* buffer); +static HRESULT StorageImpl_ReadBigBlock(StorageImpl* This, ULONG blockIndex, void* buffer, ULONG *read ); static BOOL StorageImpl_WriteBigBlock(StorageImpl* This, ULONG blockIndex, const void* buffer); static void StorageImpl_SetNextBlockInChain(StorageImpl* This, ULONG blockIndex, ULONG nextBlock); static HRESULT StorageImpl_LoadFileHeader(StorageImpl* This); @@ -380,6 +385,11 @@ { *ppvObject = &This->IPropertySetStorage_iface; } + /* locking interface is reported for writer only */ + else if (IsEqualGUID(&IID_IDirectWriterLock, riid) && This->lockingrole == SWMR_Writer) + { + *ppvObject = &This->IDirectWriterLock_iface; + } else return E_NOINTERFACE; @@ -722,9 +732,6 @@ if (newEnum) { *ppenum = &newEnum->IEnumSTATSTG_iface; - - IEnumSTATSTG_AddRef(*ppenum); - return S_OK; } @@ -2605,9 +2612,7 @@ stream = *StorageImpl_GetCachedBlockChainStream(This, index); if (!stream) return E_OUTOFMEMORY; - hr = BlockChainStream_WriteAt(stream, offset, size, buffer, bytesWritten); - - return hr; + return BlockChainStream_WriteAt(stream, offset, size, buffer, bytesWritten); } } @@ -2647,6 +2652,55 @@ return hr; } + +static HRESULT WINAPI directwriterlock_QueryInterface(IDirectWriterLock *iface, REFIID riid, void **obj) +{ + StorageBaseImpl *This = impl_from_IDirectWriterLock(iface); + return IStorage_QueryInterface(&This->IStorage_iface, riid, obj); +} + +static ULONG WINAPI directwriterlock_AddRef(IDirectWriterLock *iface) +{ + StorageBaseImpl *This = impl_from_IDirectWriterLock(iface); + return IStorage_AddRef(&This->IStorage_iface); +} + +static ULONG WINAPI directwriterlock_Release(IDirectWriterLock *iface) +{ + StorageBaseImpl *This = impl_from_IDirectWriterLock(iface); + return IStorage_Release(&This->IStorage_iface); +} + +static HRESULT WINAPI directwriterlock_WaitForWriteAccess(IDirectWriterLock *iface, DWORD timeout) +{ + StorageBaseImpl *This = impl_from_IDirectWriterLock(iface); + FIXME("(%p)->(%d): stub\n", This, timeout); + return E_NOTIMPL; +} + +static HRESULT WINAPI directwriterlock_ReleaseWriteAccess(IDirectWriterLock *iface) +{ + StorageBaseImpl *This = impl_from_IDirectWriterLock(iface); + FIXME("(%p): stub\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI directwriterlock_HaveWriteAccess(IDirectWriterLock *iface) +{ + StorageBaseImpl *This = impl_from_IDirectWriterLock(iface); + FIXME("(%p): stub\n", This); + return E_NOTIMPL; +} + +static const IDirectWriterLockVtbl DirectWriterLockVtbl = +{ + directwriterlock_QueryInterface, + directwriterlock_AddRef, + directwriterlock_Release, + directwriterlock_WaitForWriteAccess, + directwriterlock_ReleaseWriteAccess, + directwriterlock_HaveWriteAccess +}; /* * Virtual function table for the IStorage32Impl class. @@ -2719,10 +2773,18 @@ This->base.IStorage_iface.lpVtbl = &Storage32Impl_Vtbl; This->base.IPropertySetStorage_iface.lpVtbl = &IPropertySetStorage_Vtbl; + This->base.IDirectWriterLock_iface.lpVtbl = &DirectWriterLockVtbl; This->base.baseVtbl = &StorageImpl_BaseVtbl; This->base.openFlags = (openFlags & ~STGM_CREATE); This->base.ref = 1; This->base.create = create; + + if (openFlags == (STGM_DIRECT_SWMR|STGM_READWRITE|STGM_SHARE_DENY_WRITE)) + This->base.lockingrole = SWMR_Writer; + else if (openFlags == (STGM_DIRECT_SWMR|STGM_READ|STGM_SHARE_DENY_NONE)) + This->base.lockingrole = SWMR_Reader; + else + This->base.lockingrole = SWMR_None; This->base.reverted = 0; @@ -2941,7 +3003,7 @@ } else { - StorageImpl_Flush((StorageBaseImpl*)This); + StorageImpl_Flush(&This->base); *result = This; } @@ -2981,9 +3043,9 @@ HeapFree(GetProcessHeap(), 0, This); } -static HRESULT StorageImpl_Flush(StorageBaseImpl* iface) -{ - StorageImpl *This = (StorageImpl*) iface; +static HRESULT StorageImpl_Flush(StorageBaseImpl *storage) +{ + StorageImpl *This = (StorageImpl*)storage; int i; HRESULT hr; TRACE("(%p)\n", This); @@ -3018,12 +3080,12 @@ { ULONG depotBlockIndexPos; BYTE depotBuffer[MAX_BIG_BLOCK_SIZE]; - BOOL success; ULONG depotBlockOffset; ULONG blocksPerDepot = This->bigBlockSize / sizeof(ULONG); ULONG nextBlockIndex = BLOCK_SPECIAL; int depotIndex = 0; ULONG freeBlock = BLOCK_UNUSED; + ULONG read; ULARGE_INTEGER neededSize; STATSTG statstg; @@ -3113,9 +3175,9 @@ } } - success = StorageImpl_ReadBigBlock(This, depotBlockIndexPos, depotBuffer); - - if (success) + StorageImpl_ReadBigBlock(This, depotBlockIndexPos, depotBuffer, &read); + + if (read) { while ( ( (depotBlockOffset/sizeof(ULONG) ) < blocksPerDepot) && ( nextBlockIndex != BLOCK_UNUSED)) @@ -3195,7 +3257,7 @@ { extBlockIndex = This->extBigBlockDepotLocations[extBlockCount]; - StorageImpl_ReadBigBlock(This, extBlockIndex, depotBuffer); + StorageImpl_ReadBigBlock(This, extBlockIndex, depotBuffer, NULL); num_blocks = This->bigBlockSize / 4; @@ -3357,7 +3419,7 @@ ULONG depotBlockCount = offsetInDepot / This->bigBlockSize; ULONG depotBlockOffset = offsetInDepot % This->bigBlockSize; BYTE depotBuffer[MAX_BIG_BLOCK_SIZE]; - BOOL success; + ULONG read; ULONG depotBlockIndexPos; int index, num_blocks; @@ -3389,9 +3451,9 @@ depotBlockIndexPos = Storage32Impl_GetExtDepotBlock(This, depotBlockCount); } - success = StorageImpl_ReadBigBlock(This, depotBlockIndexPos, depotBuffer); - - if (!success) + StorageImpl_ReadBigBlock(This, depotBlockIndexPos, depotBuffer, &read); + + if (!read) return STG_E_READFAULT; num_blocks = This->bigBlockSize / 4; @@ -3784,20 +3846,17 @@ HRESULT StorageImpl_WriteRawDirEntry(StorageImpl *This, ULONG index, const BYTE *buffer) { ULARGE_INTEGER offset; - HRESULT hr; ULONG bytesRead; offset.u.HighPart = 0; offset.u.LowPart = index * RAW_DIRENTRY_SIZE; - hr = BlockChainStream_WriteAt( + return BlockChainStream_WriteAt( This->rootBlockChain, offset, RAW_DIRENTRY_SIZE, buffer, &bytesRead); - - return hr; } /****************************************************************************** @@ -3969,35 +4028,37 @@ DirRef index, const DirEntry* buffer) { - BYTE currentEntry[RAW_DIRENTRY_SIZE]; - HRESULT writeRes; + BYTE currentEntry[RAW_DIRENTRY_SIZE]; UpdateRawDirEntry(currentEntry, buffer); - writeRes = StorageImpl_WriteRawDirEntry(This, index, currentEntry); - return writeRes; -} - -static BOOL StorageImpl_ReadBigBlock( + return StorageImpl_WriteRawDirEntry(This, index, currentEntry); +} + +static HRESULT StorageImpl_ReadBigBlock( StorageImpl* This, ULONG blockIndex, - void* buffer) + void* buffer, + ULONG* out_read) { ULARGE_INTEGER ulOffset; DWORD read=0; + HRESULT hr; ulOffset.u.HighPart = 0; ulOffset.u.LowPart = StorageImpl_GetBigBlockOffset(This, blockIndex); - StorageImpl_ReadAt(This, ulOffset, buffer, This->bigBlockSize, &read); - - if (read && read < This->bigBlockSize) + hr = StorageImpl_ReadAt(This, ulOffset, buffer, This->bigBlockSize, &read); + + if (SUCCEEDED(hr) && read < This->bigBlockSize) { /* File ends during this block; fill the rest with 0's. */ memset((LPBYTE)buffer+read, 0, This->bigBlockSize-read); } - return (read != 0); + if (out_read) *out_read = read; + + return hr; } static BOOL StorageImpl_ReadDWordFromBigBlock( @@ -5120,7 +5181,7 @@ /* parentStorage already has 1 reference, which we take over here. */ (*result)->transactedParent = parentStorage; - parentStorage->transactedChild = (StorageBaseImpl*)*result; + parentStorage->transactedChild = &(*result)->base; (*result)->base.storageDirEntry = TransactedSnapshotImpl_CreateStubEntry(*result, parentStorage->storageDirEntry); } @@ -5132,7 +5193,7 @@ } } - if (FAILED(hr)) HeapFree(GetProcessHeap(), 0, (*result)); + if (FAILED(hr)) HeapFree(GetProcessHeap(), 0, *result); return hr; } @@ -5539,35 +5600,29 @@ IEnumSTATSTG** ppenum) { IEnumSTATSTGImpl* const This = impl_from_IEnumSTATSTG(iface); - IEnumSTATSTGImpl* newClone; if (This->parentStorage->reverted) return STG_E_REVERTED; - /* - * Perform a sanity check on the parameters. - */ if (ppenum==0) return E_INVALIDARG; newClone = IEnumSTATSTGImpl_Construct(This->parentStorage, This->storageDirEntry); - + if (!newClone) + { + *ppenum = NULL; + return E_OUTOFMEMORY; + } /* * The new clone enumeration must point to the same current node as - * the ole one. + * the old one. */ memcpy(newClone->name, This->name, sizeof(newClone->name)); *ppenum = &newClone->IEnumSTATSTG_iface; - - /* - * Don't forget to nail down a reference to the clone before - * returning it. - */ - IEnumSTATSTGImpl_AddRef(*ppenum); return S_OK; } @@ -5598,13 +5653,11 @@ newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl)); - if (newEnumeration!=0) - { - /* - * Set-up the virtual function table and reference count. - */ + if (newEnumeration) + { newEnumeration->IEnumSTATSTG_iface.lpVtbl = &IEnumSTATSTGImpl_Vtbl; - newEnumeration->ref = 0; + newEnumeration->ref = 1; + newEnumeration->name[0] = 0; /* * We want to nail-down the reference to the storage in case the @@ -5613,12 +5666,7 @@ newEnumeration->parentStorage = parentStorage; IStorage_AddRef(&newEnumeration->parentStorage->IStorage_iface); - newEnumeration->storageDirEntry = storageDirEntry; - - /* - * Make sure the current node of the iterator is the first one. - */ - IEnumSTATSTGImpl_Reset(&newEnumeration->IEnumSTATSTG_iface); + newEnumeration->storageDirEntry = storageDirEntry; } return newEnumeration; @@ -6178,7 +6226,8 @@ { if (!cachedBlock->read) { - if (!StorageImpl_ReadBigBlock(This->parentStorage, cachedBlock->sector, cachedBlock->data)) + ULONG read; + if (FAILED(StorageImpl_ReadBigBlock(This->parentStorage, cachedBlock->sector, cachedBlock->data, &read)) && !read) return STG_E_READFAULT; cachedBlock->read = 1; @@ -6262,7 +6311,8 @@ { if (!cachedBlock->read && bytesToWrite != This->parentStorage->bigBlockSize) { - if (!StorageImpl_ReadBigBlock(This->parentStorage, cachedBlock->sector, cachedBlock->data)) + ULONG read; + if (FAILED(StorageImpl_ReadBigBlock(This->parentStorage, cachedBlock->sector, cachedBlock->data, &read)) && !read) return STG_E_READFAULT; } @@ -7604,7 +7654,16 @@ /* * Validate the sharing mode */ - if (!(grfMode & (STGM_TRANSACTED|STGM_PRIORITY))) + if (grfMode & STGM_DIRECT_SWMR) + { + if ((STGM_SHARE_MODE(grfMode) != STGM_SHARE_DENY_WRITE) && + (STGM_SHARE_MODE(grfMode) != STGM_SHARE_DENY_NONE)) + { + hr = STG_E_INVALIDFLAG; + goto end; + } + } + else if (!(grfMode & (STGM_TRANSACTED|STGM_PRIORITY))) switch(STGM_SHARE_MODE(grfMode)) { case STGM_SHARE_EXCLUSIVE: @@ -7622,10 +7681,10 @@ goto end; } - /* shared reading requires transacted mode */ + /* shared reading requires transacted or single writer mode */ if( STGM_SHARE_MODE(grfMode) == STGM_SHARE_DENY_WRITE && STGM_ACCESS_MODE(grfMode) == STGM_READWRITE && - !(grfMode&STGM_TRANSACTED) ) + !(grfMode & STGM_TRANSACTED) && !(grfMode & STGM_DIRECT_SWMR)) { hr = STG_E_INVALIDFLAG; goto end; Modified: trunk/reactos/dll/win32/ole32/storage32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/storage32.…
============================================================================== --- trunk/reactos/dll/win32/ole32/storage32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/storage32.h [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -166,6 +166,12 @@ HRESULT STORAGE_CreateOleStream(IStorage*, DWORD) DECLSPEC_HIDDEN; HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName) DECLSPEC_HIDDEN; +enum swmr_mode +{ + SWMR_None, + SWMR_Writer, + SWMR_Reader +}; /**************************************************************************** * StorageBaseImpl definitions. @@ -180,6 +186,7 @@ { IStorage IStorage_iface; IPropertySetStorage IPropertySetStorage_iface; /* interface for adding a properties stream */ + IDirectWriterLock IDirectWriterLock_iface; LONG ref; /* @@ -225,6 +232,7 @@ * the transacted snapshot or cache. */ StorageBaseImpl *transactedChild; + enum swmr_mode lockingrole; }; /* virtual methods for StorageBaseImpl objects */ Modified: trunk/reactos/dll/win32/ole32/stubmanager.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ole32/stubmanage…
============================================================================== --- trunk/reactos/dll/win32/ole32/stubmanager.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ole32/stubmanager.c [iso-8859-1] Thu Sep 26 13:58:03 2013 @@ -176,6 +176,7 @@ struct stub_manager *new_stub_manager(APARTMENT *apt, IUnknown *object) { struct stub_manager *sm; + HRESULT hres; assert( apt ); @@ -221,6 +222,10 @@ */ sm->extrefs = 0; + hres = IUnknown_QueryInterface(object, &IID_IExternalConnection, (void**)&sm->extern_conn); + if(FAILED(hres)) + sm->extern_conn = NULL; + EnterCriticalSection(&apt->cs); sm->oid = apt->oidc++; list_add_head(&apt->stubmgrs, &sm->entry); @@ -245,6 +250,9 @@ stub_manager_delete_ifstub(m, ifstub); } + if(m->extern_conn) + IExternalConnection_Release(m->extern_conn); + CoTaskMemFree(m->oxid_info.psa); IUnknown_Release(m->object); @@ -380,9 +388,12 @@ /* add some external references (ie from a client that unmarshaled an ifptr) */ ULONG stub_manager_ext_addref(struct stub_manager *m, ULONG refs, BOOL tableweak) { + BOOL first_extern_ref; ULONG rc; EnterCriticalSection(&m->lock); + + first_extern_ref = refs && !m->extrefs; /* make sure we don't overflow extrefs */ refs = min(refs, (ULONG_MAX-1 - m->extrefs)); @@ -395,12 +406,20 @@ TRACE("added %u refs to %p (oid %s), rc is now %u\n", refs, m, wine_dbgstr_longlong(m->oid), rc); + /* + * NOTE: According to tests, creating a stub causes two AddConnection calls followed by + * one ReleaseConnection call (with fLastReleaseCloses=FALSE). + */ + if(first_extern_ref && m->extern_conn) + IExternalConnection_AddConnection(m->extern_conn, EXTCONN_STRONG, 0); + return rc; } /* remove some external references */ ULONG stub_manager_ext_release(struct stub_manager *m, ULONG refs, BOOL tableweak, BOOL last_unlock_releases) { + BOOL last_extern_ref; ULONG rc; EnterCriticalSection(&m->lock); @@ -414,9 +433,14 @@ if (!last_unlock_releases) rc += m->weakrefs; + last_extern_ref = refs && !m->extrefs; + LeaveCriticalSection(&m->lock); TRACE("removed %u refs from %p (oid %s), rc is now %u\n", refs, m, wine_dbgstr_longlong(m->oid), rc); + + if (last_extern_ref && m->extern_conn) + IExternalConnection_ReleaseConnection(m->extern_conn, EXTCONN_STRONG, 0, TRUE /* FIXME: Use last_unlock releases? */); if (rc == 0) stub_manager_int_release(m); 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] Thu Sep 26 13:58:03 2013 @@ -142,7 +142,7 @@ reactos/dll/win32/objsel # Synced to Wine-1.5.19 reactos/dll/win32/odbc32 # Out of sync. Depends on port of Linux ODBC. reactos/dll/win32/odbccp32 # Synced to Wine-1.5.19 -reactos/dll/win32/ole32 # Synced to Wine-1.5.26 +reactos/dll/win32/ole32 # Synced to Wine-1.7.1 reactos/dll/win32/oleacc # Autosync reactos/dll/win32/oleaut32 # Synced to Wine-1.5.26 reactos/dll/win32/olecli32 # Synced to Wine-1.5.19
11 years, 3 months
1
0
0
0
[akhaldi] 60353: [NTPRINT] * Sync with Wine 1.7.1. CORE-7469
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Sep 26 13:55:45 2013 New Revision: 60353 URL:
http://svn.reactos.org/svn/reactos?rev=60353&view=rev
Log: [NTPRINT] * Sync with Wine 1.7.1. CORE-7469 Modified: trunk/reactos/dll/win32/ntprint/ntprint.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/ntprint/ntprint.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/ntprint/ntprint.…
============================================================================== --- trunk/reactos/dll/win32/ntprint/ntprint.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/ntprint/ntprint.c [iso-8859-1] Thu Sep 26 13:55:45 2013 @@ -38,8 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntprint); -static HINSTANCE NTPRINT_hInstance = NULL; - typedef struct { LPMONITOR_INFO_2W mi2; /* Buffer for installed Monitors */ DWORD installed; /* Number of installed Monitors */ @@ -58,7 +56,6 @@ return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: - NTPRINT_hInstance = hinstDLL; DisableThreadLibraryCalls( hinstDLL ); break; } 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] Thu Sep 26 13:55:45 2013 @@ -138,7 +138,7 @@ reactos/dll/win32/nddeapi # Synced to Wine-1.5.19 reactos/dll/win32/netapi32 # Forked at Wine-1.3.34 reactos/dll/win32/ntdsapi # Synced to Wine-1.5.19 -reactos/dll/win32/ntprint # Synced to Wine-1.5.4 +reactos/dll/win32/ntprint # Synced to Wine-1.7.1 reactos/dll/win32/objsel # Synced to Wine-1.5.19 reactos/dll/win32/odbc32 # Out of sync. Depends on port of Linux ODBC. reactos/dll/win32/odbccp32 # Synced to Wine-1.5.19
11 years, 3 months
1
0
0
0
[akhaldi] 60352: [PSDK] * Update pdhmsg.h.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Sep 26 13:52:46 2013 New Revision: 60352 URL:
http://svn.reactos.org/svn/reactos?rev=60352&view=rev
Log: [PSDK] * Update pdhmsg.h. Modified: trunk/reactos/include/psdk/pdhmsg.h Modified: trunk/reactos/include/psdk/pdhmsg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/pdhmsg.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/pdhmsg.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/pdhmsg.h [iso-8859-1] Thu Sep 26 13:52:46 2013 @@ -22,18 +22,90 @@ #define _PDH_MSG_H_ #define PDH_CSTATUS_VALID_DATA 0x00000000 +#define PDH_CSTATUS_NEW_DATA 0x00000001 #define PDH_CSTATUS_NO_MACHINE 0x800007d0 +#define PDH_CSTATUS_NO_INSTANCE 0x800007d1 #define PDH_MORE_DATA 0x800007d2 +#define PDH_CSTATUS_ITEM_NOT_VALIDATED 0x800007d3 +#define PDH_RETRY 0x800007d4 #define PDH_NO_DATA 0x800007d5 +#define PDH_CALC_NEGATIVE_DENOMINATOR 0x800007d6 +#define PDH_CALC_NEGATIVE_TIMEBASE 0x800007d7 +#define PDH_CALC_NEGATIVE_VALUE 0x800007d8 +#define PDH_DIALOG_CANCELLED 0x800007d9 +#define PDH_END_OF_LOG_FILE 0x800007da +#define PDH_ASYNC_QUERY_TIMEOUT 0x800007db +#define PDH_CANNOT_SET_DEFAULT_REALTIME_DATASOURCE 0x800007dc +#define PDH_UNABLE_MAP_NAME_FILES 0x80000bd5 +#define PDH_PLA_VALIDATION_WARNING 0x80000bf3 #define PDH_CSTATUS_NO_OBJECT 0xc0000bb8 #define PDH_CSTATUS_NO_COUNTER 0xc0000bb9 +#define PDH_CSTATUS_INVALID_DATA 0xc0000bba #define PDH_MEMORY_ALLOCATION_FAILURE 0xc0000bbb #define PDH_INVALID_HANDLE 0xc0000bbc #define PDH_INVALID_ARGUMENT 0xc0000bbd +#define PDH_FUNCTION_NOT_FOUND 0xc0000bbe +#define PDH_CSTATUS_NO_COUNTERNAME 0xc0000bbf #define PDH_CSTATUS_BAD_COUNTERNAME 0xc0000bc0 +#define PDH_INVALID_BUFFER 0xc0000bc1 #define PDH_INSUFFICIENT_BUFFER 0xc0000bc2 +#define PDH_CANNOT_CONNECT_MACHINE 0xc0000bc3 +#define PDH_INVALID_PATH 0xc0000bc4 +#define PDH_INVALID_INSTANCE 0xc0000bc5 #define PDH_INVALID_DATA 0xc0000bc6 +#define PDH_NO_DIALOG_DATA 0xc0000bc7 +#define PDH_CANNOT_READ_NAME_STRINGS 0xc0000bc8 +#define PDH_LOG_FILE_CREATE_ERROR 0xc0000bc9 +#define PDH_LOG_FILE_OPEN_ERROR 0xc0000bca +#define PDH_LOG_TYPE_NOT_FOUND 0xc0000bcb +#define PDH_NO_MORE_DATA 0xc0000bcc +#define PDH_ENTRY_NOT_IN_LOG_FILE 0xc0000bcd +#define PDH_DATA_SOURCE_IS_LOG_FILE 0xc0000bce +#define PDH_DATA_SOURCE_IS_REAL_TIME 0xc0000bcf +#define PDH_UNABLE_READ_LOG_HEADER 0xc0000bd0 +#define PDH_FILE_NOT_FOUND 0xc0000bd1 +#define PDH_FILE_ALREADY_EXISTS 0xc0000bd2 #define PDH_NOT_IMPLEMENTED 0xc0000bd3 #define PDH_STRING_NOT_FOUND 0xc0000bd4 +#define PDH_UNKNOWN_LOG_FORMAT 0xc0000bd6 +#define PDH_UNKNOWN_LOGSVC_COMMAND 0xc0000bd7 +#define PDH_LOGSVC_QUERY_NOT_FOUND 0xc0000bd8 +#define PDH_LOGSVC_NOT_OPENED 0xc0000bd9 +#define PDH_WBEM_ERROR 0xc0000bda +#define PDH_ACCESS_DENIED 0xc0000bdb +#define PDH_LOG_FILE_TOO_SMALL 0xc0000bdc +#define PDH_INVALID_DATASOURCE 0xc0000bdd +#define PDH_INVALID_SQLDB 0xc0000bde +#define PDH_NO_COUNTERS 0xc0000bdf +#define PDH_SQL_ALLOC_FAILED 0xc0000be0 +#define PDH_SQL_ALLOCCON_FAILED 0xc0000be1 +#define PDH_SQL_EXEC_DIRECT_FAILED 0xc0000be2 +#define PDH_SQL_FETCH_FAILED 0xc0000be3 +#define PDH_SQL_ROWCOUNT_FAILED 0xc0000be4 +#define PDH_SQL_MORE_RESULTS_FAILED 0xc0000be5 +#define PDH_SQL_CONNECT_FAILED 0xc0000be6 +#define PDH_SQL_BIND_FAILED 0xc0000be7 +#define PDH_CANNOT_CONNECT_WMI_SERVER 0xc0000be8 +#define PDH_PLA_COLLECTION_ALREADY_RUNNING 0xc0000be9 +#define PDH_PLA_ERROR_SCHEDULE_OVERLAP 0xc0000bea +#define PDH_PLA_COLLECTION_NOT_FOUND 0xc0000beb +#define PDH_PLA_ERROR_SCHEDULE_ELAPSED 0xc0000bec +#define PDH_PLA_ERROR_NOSTART 0xc0000bed +#define PDH_PLA_ERROR_ALREADY_EXISTS 0xc0000bee +#define PDH_PLA_ERROR_TYPE_MISMATCH 0xc0000bef +#define PDH_PLA_ERROR_FILEPATH 0xc0000bf0 +#define PDH_PLA_SERVICE_ERROR 0xc0000bf1 +#define PDH_PLA_VALIDATION_ERROR 0xc0000bf2 +#define PDH_PLA_ERROR_NAME_TOO_LONG 0xc0000bf4 +#define PDH_INVALID_SQL_LOG_FORMAT 0xc0000bf5 +#define PDH_COUNTER_ALREADY_IN_QUERY 0xc0000bf6 +#define PDH_BINARY_LOG_CORRUPT 0xc0000bf7 +#define PDH_LOG_SAMPLE_TOO_SMALL 0xc0000bf8 +#define PDH_OS_LATER_VERSION 0xc0000bf9 +#define PDH_OS_EARLIER_VERSION 0xc0000bfa +#define PDH_INCORRECT_APPEND_TIME 0xc0000bfb +#define PDH_UNMATCHED_APPEND_COUNTER 0xc0000bfc +#define PDH_SQL_ALTER_DETAIL_FAILED 0xc0000bfd +#define PDH_QUERY_PERF_DATA_TIMEOUT 0xc0000bfe #endif /* _PDH_MSG_H_ */
11 years, 3 months
1
0
0
0
[tfaber] 60351: [PSDK] - Add MAX_SHUTDOWN_TIMEOUT. Patch by Lee Schroeder CORE-7450 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Sep 26 11:55:13 2013 New Revision: 60351 URL:
http://svn.reactos.org/svn/reactos?rev=60351&view=rev
Log: [PSDK] - Add MAX_SHUTDOWN_TIMEOUT. Patch by Lee Schroeder CORE-7450 #resolve Modified: trunk/reactos/include/psdk/winreg.h Modified: trunk/reactos/include/psdk/winreg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winreg.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/winreg.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winreg.h [iso-8859-1] Thu Sep 26 11:55:13 2013 @@ -47,6 +47,8 @@ #define SHUTDOWN_RESTART 0x00000004 #define SHUTDOWN_RESTARTAPPS 0x00000080 +#define MAX_SHUTDOWN_TIMEOUT (10*365*24*60*60) + #define RRF_RT_REG_NONE (1 << 0) #define RRF_RT_REG_SZ (1 << 1) #define RRF_RT_REG_EXPAND_SZ (1 << 2)
11 years, 3 months
1
0
0
0
[aandrejevic] 60350: [SOFT386] Implement the ENTER instruction.
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Wed Sep 25 18:34:57 2013 New Revision: 60350 URL:
http://svn.reactos.org/svn/reactos?rev=60350&view=rev
Log: [SOFT386] Implement the ENTER instruction. Modified: branches/ntvdm/lib/soft386/opcodes.c Modified: branches/ntvdm/lib/soft386/opcodes.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/soft386/opcodes.c?rev…
============================================================================== --- branches/ntvdm/lib/soft386/opcodes.c [iso-8859-1] (original) +++ branches/ntvdm/lib/soft386/opcodes.c [iso-8859-1] Wed Sep 25 18:34:57 2013 @@ -4492,10 +4492,75 @@ SOFT386_OPCODE_HANDLER(Soft386OpcodeEnter) { - // TODO: NOT IMPLEMENTED - UNIMPLEMENTED; - - return FALSE; + INT i; + BOOLEAN Size = State->SegmentRegs[SOFT386_REG_CS].Size; + USHORT FrameSize; + UCHAR NestingLevel; + SOFT386_REG FramePointer; + + /* Make sure this is the right instruction */ + ASSERT(Opcode == 0xC8); + + if (State->PrefixFlags & SOFT386_PREFIX_LOCK) + { + /* Invalid prefix */ + Soft386Exception(State, SOFT386_EXCEPTION_UD); + return FALSE; + } + + if (State->PrefixFlags == SOFT386_PREFIX_OPSIZE) + { + /* The OPSIZE prefix toggles the size */ + Size = !Size; + } + + if (!Soft386FetchWord(State, &FrameSize)) + { + /* Exception occurred */ + return FALSE; + } + + if (!Soft386FetchByte(State, &NestingLevel)) + { + /* Exception occurred */ + return FALSE; + } + + /* Push EBP */ + if (!Soft386StackPush(State, State->GeneralRegs[SOFT386_REG_EBP].Long)) + { + /* Exception occurred */ + return FALSE; + } + + /* Save ESP */ + FramePointer = State->GeneralRegs[SOFT386_REG_ESP]; + + /* Set up the nested procedure stacks */ + for (i = 1; i < NestingLevel; i++) + { + if (Size) + { + State->GeneralRegs[SOFT386_REG_EBP].Long -= 4; + Soft386StackPush(State, State->GeneralRegs[SOFT386_REG_EBP].Long); + } + else + { + State->GeneralRegs[SOFT386_REG_EBP].LowWord -= 2; + Soft386StackPush(State, State->GeneralRegs[SOFT386_REG_EBP].LowWord); + } + } + + if (NestingLevel > 0) Soft386StackPush(State, FramePointer.Long); + + /* Set EBP to the frame pointer */ + State->GeneralRegs[SOFT386_REG_EBP] = FramePointer; + + /* Reserve space for the frame */ + if (Size) State->GeneralRegs[SOFT386_REG_ESP].Long -= (ULONG)FrameSize; + else State->GeneralRegs[SOFT386_REG_ESP].LowWord -= FrameSize; + + return TRUE; } SOFT386_OPCODE_HANDLER(Soft386OpcodeLeave)
11 years, 3 months
1
0
0
0
[tkreuzer] 60349: [WIN23K] Fix prototype of NtUserNotifyProcessCreate and BASE_PROCESS_CREATE_NOTIFY_ROUTINE
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Sep 25 17:14:21 2013 New Revision: 60349 URL:
http://svn.reactos.org/svn/reactos?rev=60349&view=rev
Log: [WIN23K] Fix prototype of NtUserNotifyProcessCreate and BASE_PROCESS_CREATE_NOTIFY_ROUTINE Modified: trunk/reactos/include/reactos/subsys/win/base.h trunk/reactos/win32ss/include/ntuser.h trunk/reactos/win32ss/user/ntuser/ntstubs.c Modified: trunk/reactos/include/reactos/subsys/win/base.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win…
============================================================================== --- trunk/reactos/include/reactos/subsys/win/base.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/subsys/win/base.h [iso-8859-1] Wed Sep 25 17:14:21 2013 @@ -11,7 +11,13 @@ #pragma once -typedef VOID (CALLBACK * BASE_PROCESS_CREATE_NOTIFY_ROUTINE)(PVOID); +typedef +BOOL +(CALLBACK * BASE_PROCESS_CREATE_NOTIFY_ROUTINE)( + HANDLE NewProcessId, + HANDLE SourceThreadId, + DWORD dwUnknown, + ULONG CreateFlags); NTSTATUS WINAPI BaseSetProcessCreateNotify(BASE_PROCESS_CREATE_NOTIFY_ROUTINE); @@ -62,7 +68,7 @@ } NLS_USER_INFO, *PNLS_USER_INFO; C_ASSERT(sizeof(NLS_USER_INFO) == 0x1870); -typedef struct _INIFILE_MAPPING_TARGET +typedef struct _INIFILE_MAPPING_TARGET { struct _INIFILE_MAPPING_TARGET *Next; UNICODE_STRING RegistryPath; @@ -125,7 +131,9 @@ BOOLEAN LUIDDeviceMapsEnabled; ULONG TermsrvClientTimeZoneChangeNum; } BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA; +#ifndef _WIN64 C_ASSERT(sizeof(BASE_STATIC_SERVER_DATA) == 0x1AC8); +#endif VOID WINAPI BaseSrvNLSInit(IN PBASE_STATIC_SERVER_DATA StaticData); Modified: trunk/reactos/win32ss/include/ntuser.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?r…
============================================================================== --- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Wed Sep 25 17:14:21 2013 @@ -2436,7 +2436,7 @@ DWORD Unknown1, DWORD Unknown2); -DWORD +BOOL NTAPI NtUserNotifyProcessCreate( HANDLE NewProcessId, Modified: trunk/reactos/win32ss/user/ntuser/ntstubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/ntstub…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/ntstubs.c [iso-8859-1] Wed Sep 25 17:14:21 2013 @@ -707,7 +707,7 @@ return 0; } -DWORD +BOOL NTAPI NtUserNotifyProcessCreate( HANDLE NewProcessId, @@ -716,7 +716,7 @@ ULONG CreateFlags) { STUB; - return 0; + return FALSE; } NTSTATUS
11 years, 3 months
1
0
0
0
[hbelusca] 60348: [RTL] Implement and export RtlGetLengthWithoutTrailingPathSeperators (aka. RtlGetLengthWithoutTrailingPathSeparators) (needed for win2k3's basesrv.dll). Patch by David Quintana, w...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Tue Sep 24 22:16:30 2013 New Revision: 60348 URL:
http://svn.reactos.org/svn/reactos?rev=60348&view=rev
Log: [RTL] Implement and export RtlGetLengthWithoutTrailingPathSeperators (aka. RtlGetLengthWithoutTrailingPathSeparators) (needed for win2k3's basesrv.dll). Patch by David Quintana, where I simplified the loop (and reduced the number of local variables). CORE-7482 #comment Function committed in revision 60348, thanks ;) Modified: trunk/reactos/dll/ntdll/def/ntdll.spec trunk/reactos/include/ndk/rtlfuncs.h trunk/reactos/lib/rtl/path.c Modified: trunk/reactos/dll/ntdll/def/ntdll.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?r…
============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Tue Sep 24 22:16:30 2013 @@ -630,7 +630,7 @@ @ stdcall RtlGetLastWin32Error() @ stdcall RtlGetLengthWithoutLastFullDosOrNtPathElement(long ptr ptr) ; Yes, Microsoft really misspelled this one! -;@ stdcall RtlGetLengthWithoutTrailingPathSeperators +@ stdcall RtlGetLengthWithoutTrailingPathSeperators(long ptr ptr) RtlGetLengthWithoutTrailingPathSeparators @ stdcall RtlGetLongestNtPathLength() @ stdcall RtlGetNativeSystemInformation(long long long long) NtQuerySystemInformation @ stdcall RtlGetNextRange(ptr ptr long) Modified: trunk/reactos/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Tue Sep 24 22:16:30 2013 @@ -2723,6 +2723,15 @@ _Out_opt_ PBOOLEAN NameInvalid, _Out_ RTL_PATH_TYPE* PathType, _Out_opt_ PSIZE_T LengthNeeded +); + +NTSYSAPI +NTSTATUS +NTAPI +RtlGetLengthWithoutTrailingPathSeparators( + _In_ ULONG Flags, + _In_ PCUNICODE_STRING PathString, + _Out_ PULONG Length ); NTSYSAPI Modified: trunk/reactos/lib/rtl/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=60348&r…
============================================================================== --- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Tue Sep 24 22:16:30 2013 @@ -1253,6 +1253,48 @@ /* * @implemented + * @note: the export is called RtlGetLengthWithoutTrailingPathSeperators + * (with a 'e' instead of a 'a' in "Seperators"). + */ +NTSTATUS +NTAPI +RtlGetLengthWithoutTrailingPathSeparators(IN ULONG Flags, + IN PCUNICODE_STRING PathString, + OUT PULONG Length) +{ + ULONG NumChars; + + /* Parameters validation */ + if (Length == NULL) return STATUS_INVALID_PARAMETER; + + *Length = 0; + + if (PathString == NULL) return STATUS_INVALID_PARAMETER; + + /* No flags are supported yet */ + if (Flags != 0) return STATUS_INVALID_PARAMETER; + + NumChars = PathString->Length / sizeof(WCHAR); + + /* + * Notice that we skip the last character, therefore: + * - if we have: "some/path/f" we test for: "some/path/" + * - if we have: "some/path/" we test for: "some/path" + * - if we have: "s" we test for: "" + * - if we have: "" then NumChars was already zero and we aren't there + */ + + while (NumChars > 0 && IS_PATH_SEPARATOR(PathString->Buffer[NumChars - 1])) + { + --NumChars; + } + + *Length = NumChars; + return STATUS_SUCCESS; +} + +/* + * @implemented */ RTL_PATH_TYPE NTAPI
11 years, 3 months
1
0
0
0
[akhaldi] 60347: [GDI32_APITEST] * Fix GCC warnings. * Enable -Werror again. * Remove redundant test header inclusion. * Speedup linking.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Sep 23 21:54:01 2013 New Revision: 60347 URL:
http://svn.reactos.org/svn/reactos?rev=60347&view=rev
Log: [GDI32_APITEST] * Fix GCC warnings. * Enable -Werror again. * Remove redundant test header inclusion. * Speedup linking. Modified: trunk/rostests/apitests/gdi32/AddFontResource.c trunk/rostests/apitests/gdi32/CMakeLists.txt Modified: trunk/rostests/apitests/gdi32/AddFontResource.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/AddFontRes…
============================================================================== --- trunk/rostests/apitests/gdi32/AddFontResource.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/AddFontResource.c [iso-8859-1] Mon Sep 23 21:54:01 2013 @@ -5,9 +5,8 @@ * PROGRAMMERS: Timo Kreuzer */ +#include <stdio.h> #include <apitest.h> - -#include <wine/test.h> #include <wingdi.h> #define COUNT 26 Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CMakeLists…
============================================================================== --- trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] Mon Sep 23 21:54:01 2013 @@ -1,5 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) include_directories(${REACTOS_SOURCE_DIR}/win32ss) list(APPEND SOURCE @@ -62,14 +61,8 @@ init.c testlist.c) -if(NOT MSVC) - # FIXME:
http://www.cmake.org/Bug/view.php?id=12998
- #allow_warnings(gdi32_apitest) - set_source_files_properties(${SOURCE} PROPERTIES COMPILE_FLAGS "-Wno-error") -endif() - add_executable(gdi32_apitest ${SOURCE}) -target_link_libraries(gdi32_apitest wine ${PSEH_LIB}) +target_link_libraries(gdi32_apitest ${PSEH_LIB}) set_module_type(gdi32_apitest win32cui) -add_importlibs(gdi32_apitest gdi32 user32 msvcrt kernel32 ntdll) +add_importlibs(gdi32_apitest gdi32 user32 msvcrt kernel32) add_cd_file(TARGET gdi32_apitest DESTINATION reactos/bin FOR all)
11 years, 3 months
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
56
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
54
55
56
Results per page:
10
25
50
100
200