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
April 2014
----- 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
15 participants
492 discussions
Start a n
N
ew thread
[tfaber] 62958: [WIN32K] - Reinstate ProbeForWrite call in MmCopyToCaller CORE-8095 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Apr 24 17:19:20 2014 New Revision: 62958 URL:
http://svn.reactos.org/svn/reactos?rev=62958&view=rev
Log: [WIN32K] - Reinstate ProbeForWrite call in MmCopyToCaller CORE-8095 #resolve Modified: trunk/reactos/win32ss/user/ntuser/misc/copy.c trunk/reactos/win32ss/user/ntuser/mmcopy.h Modified: trunk/reactos/win32ss/user/ntuser/misc/copy.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/misc/c…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/misc/copy.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/misc/copy.c [iso-8859-1] Thu Apr 24 17:19:20 2014 @@ -1,12 +1,22 @@ #include "win32k.h" -NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes ) { - NTSTATUS Status = STATUS_SUCCESS; +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +_MmCopyFromCaller( + _Out_writes_bytes_all_(Bytes) PVOID Target, + _In_reads_bytes_(Bytes) PVOID Source, + _In_ UINT Bytes) +{ + NTSTATUS Status; + PAGED_CODE(); + ASSERT(ExGetPreviousMode() == UserMode); + + Status = STATUS_SUCCESS; _SEH2_TRY { - ProbeForRead(Source,Bytes,1); - RtlCopyMemory(Target,Source,Bytes); + ProbeForRead(Source, Bytes, 1); + RtlCopyMemory(Target, Source, Bytes); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -17,13 +27,23 @@ return Status; } -NTSTATUS _MmCopyToCaller( PVOID Target, PVOID Source, UINT Bytes ) { - NTSTATUS Status = STATUS_SUCCESS; +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +_MmCopyToCaller( + _Out_writes_bytes_all_(Bytes) PVOID Target, + _In_reads_bytes_(Bytes) PVOID Source, + _In_ UINT Bytes) +{ + NTSTATUS Status; + PAGED_CODE(); + ASSERT(ExGetPreviousMode() == UserMode); + + Status = STATUS_SUCCESS; _SEH2_TRY { - /* ProbeForWrite(Target,Bytes,1); */ - RtlCopyMemory(Target,Source,Bytes); + ProbeForWrite(Target, Bytes, 1); + RtlCopyMemory(Target, Source, Bytes); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { Modified: trunk/reactos/win32ss/user/ntuser/mmcopy.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/mmcopy…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/mmcopy.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/mmcopy.h [iso-8859-1] Thu Apr 24 17:19:20 2014 @@ -1,8 +1,19 @@ #pragma once -NTSTATUS _MmCopyFromCaller( PVOID Target, PVOID Source, UINT Bytes ); -NTSTATUS _MmCopyToCaller( PVOID Target, PVOID Source, UINT Bytes ); +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +_MmCopyFromCaller( + _Out_writes_bytes_all_(Bytes) PVOID Target, + _In_reads_bytes_(Bytes) PVOID Source, + _In_ UINT Bytes); + +_IRQL_requires_max_(APC_LEVEL) +NTSTATUS +_MmCopyToCaller( + _Out_writes_bytes_all_(Bytes) PVOID Target, + _In_reads_bytes_(Bytes) PVOID Source, + _In_ UINT Bytes); #define MmCopyFromCaller(x,y,z) _MmCopyFromCaller((PCHAR)(x),(PCHAR)(y),(UINT)(z)) #define MmCopyToCaller(x,y,z) _MmCopyToCaller((PCHAR)(x),(PCHAR)(y),(UINT)(z))
10 years, 8 months
1
0
0
0
[dquintana] 62957: [RSHELL] * Fix stack overflow when pressing enter with a menu item selected. Executing with enter now works correctly. CORE-7586
by dquintana@svn.reactos.org
Author: dquintana Date: Thu Apr 24 16:17:53 2014 New Revision: 62957 URL:
http://svn.reactos.org/svn/reactos?rev=62957&view=rev
Log: [RSHELL] * Fix stack overflow when pressing enter with a menu item selected. Executing with enter now works correctly. CORE-7586 Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] Thu Apr 24 16:17:53 2014 @@ -816,13 +816,6 @@ INT iItem = (INT)wParam; - return ExecuteItem(iItem); -} - -HRESULT CMenuToolbarBase::ExecuteItem(INT iItem) -{ - m_menuBand->_KillPopupTimers(); - if (PopupItem(iItem) == S_OK) { TRACE("PopupItem returned S_OK\n"); @@ -831,10 +824,12 @@ TRACE("Executing...\n"); - HRESULT hr = m_menuBand->_MenuItemHotTrack(MPOS_EXECUTE); - - if (FAILED_UNEXPECTEDLY(hr)) - return hr; + return m_menuBand->_MenuItemHotTrack(MPOS_EXECUTE); +} + +HRESULT CMenuToolbarBase::ExecuteItem(INT iItem) +{ + m_menuBand->_KillPopupTimers(); INT index; DWORD_PTR data;
10 years, 8 months
1
0
0
0
[akhaldi] 62956: [SHLWAPI_WINETEST] * Sync with Wine 1.7.17. CORE-8080
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 24 16:07:42 2014 New Revision: 62956 URL:
http://svn.reactos.org/svn/reactos?rev=62956&view=rev
Log: [SHLWAPI_WINETEST] * Sync with Wine 1.7.17. CORE-8080 Modified: trunk/rostests/winetests/shlwapi/CMakeLists.txt trunk/rostests/winetests/shlwapi/assoc.c trunk/rostests/winetests/shlwapi/clist.c trunk/rostests/winetests/shlwapi/clsid.c trunk/rostests/winetests/shlwapi/istream.c trunk/rostests/winetests/shlwapi/ordinal.c trunk/rostests/winetests/shlwapi/path.c trunk/rostests/winetests/shlwapi/shreg.c trunk/rostests/winetests/shlwapi/string.c trunk/rostests/winetests/shlwapi/url.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/winetests/shlwapi/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/CMakeLi…
Modified: trunk/rostests/winetests/shlwapi/assoc.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/assoc.c…
Modified: trunk/rostests/winetests/shlwapi/clist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/clist.c…
Modified: trunk/rostests/winetests/shlwapi/clsid.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/clsid.c…
Modified: trunk/rostests/winetests/shlwapi/istream.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/istream…
Modified: trunk/rostests/winetests/shlwapi/ordinal.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/ordinal…
Modified: trunk/rostests/winetests/shlwapi/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/path.c?…
Modified: trunk/rostests/winetests/shlwapi/shreg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/shreg.c…
Modified: trunk/rostests/winetests/shlwapi/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/string.…
Modified: trunk/rostests/winetests/shlwapi/url.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/url.c?r…
10 years, 8 months
1
0
0
0
[akhaldi] 62955: [SHLWAPI] * Sync with Wine 1.7.17. CORE-8080
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 24 16:07:14 2014 New Revision: 62955 URL:
http://svn.reactos.org/svn/reactos?rev=62955&view=rev
Log: [SHLWAPI] * Sync with Wine 1.7.17. CORE-8080 Modified: trunk/reactos/dll/win32/shlwapi/istream.c trunk/reactos/dll/win32/shlwapi/ordinal.c trunk/reactos/dll/win32/shlwapi/path.c trunk/reactos/dll/win32/shlwapi/shlwapi.spec trunk/reactos/dll/win32/shlwapi/string.c trunk/reactos/dll/win32/shlwapi/url.c trunk/reactos/dll/win32/shlwapi/wsprintf.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/shlwapi/istream.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/istream.…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/istream.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/istream.c [iso-8859-1] Thu Apr 24 16:07:14 2014 @@ -58,8 +58,8 @@ if(IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IStream)) { - *ppvObj = This; IStream_AddRef(iface); + *ppvObj = iface; return S_OK; } return E_NOINTERFACE; @@ -216,22 +216,22 @@ ulSize = cb.QuadPart; while (ulSize) { - ULONG ulLeft, ulAmt; + ULONG ulLeft, ulRead, ulWritten; ulLeft = ulSize > sizeof(copyBuff) ? sizeof(copyBuff) : ulSize; /* Read */ - hRet = IStream_fnRead(iface, copyBuff, ulLeft, &ulAmt); + hRet = IStream_fnRead(iface, copyBuff, ulLeft, &ulRead); + if (FAILED(hRet) || ulRead == 0) + break; if (pcbRead) - pcbRead->QuadPart += ulAmt; - if (FAILED(hRet) || ulAmt != ulLeft) - break; + pcbRead->QuadPart += ulRead; /* Write */ - hRet = IStream_fnWrite(pstm, copyBuff, ulLeft, &ulAmt); + hRet = IStream_fnWrite(pstm, copyBuff, ulRead, &ulWritten); if (pcbWritten) - pcbWritten->QuadPart += ulAmt; - if (FAILED(hRet) || ulAmt != ulLeft) + pcbWritten->QuadPart += ulWritten; + if (FAILED(hRet) || ulWritten != ulLeft) break; ulSize -= ulLeft; @@ -279,16 +279,14 @@ static HRESULT WINAPI IStream_fnStat(IStream *iface, STATSTG* lpStat, DWORD grfStatFlag) { - ISHFileStream *This = impl_from_IStream(iface); - BY_HANDLE_FILE_INFORMATION fi; - HRESULT hRet = S_OK; - - TRACE("(%p,%p,%d)\n", This, lpStat, grfStatFlag); - - if (!grfStatFlag) - hRet = STG_E_INVALIDPOINTER; - else - { + ISHFileStream *This = impl_from_IStream(iface); + BY_HANDLE_FILE_INFORMATION fi; + + TRACE("(%p,%p,%d)\n", This, lpStat, grfStatFlag); + + if (!grfStatFlag) + return STG_E_INVALIDPOINTER; + memset(&fi, 0, sizeof(fi)); GetFileInformationByHandle(This->hFile, &fi); @@ -307,8 +305,8 @@ memcpy(&lpStat->clsid, &IID_IStream, sizeof(CLSID)); lpStat->grfStateBits = This->grfStateBits; lpStat->reserved = 0; - } - return hRet; + + return S_OK; } /************************************************************************* @@ -349,22 +347,21 @@ */ static IStream *IStream_Create(LPCWSTR lpszPath, HANDLE hFile, DWORD dwMode) { - ISHFileStream* fileStream; - - fileStream = HeapAlloc(GetProcessHeap(), 0, sizeof(ISHFileStream)); - - if (fileStream) - { - fileStream->IStream_iface.lpVtbl = &SHLWAPI_fsVTable; - fileStream->ref = 1; - fileStream->hFile = hFile; - fileStream->dwMode = dwMode; - fileStream->lpszPath = StrDupW(lpszPath); - fileStream->type = 0; /* FIXME */ - fileStream->grfStateBits = 0; /* FIXME */ - } - TRACE ("Returning %p\n", fileStream); - return &fileStream->IStream_iface; + ISHFileStream *fileStream; + + fileStream = HeapAlloc(GetProcessHeap(), 0, sizeof(ISHFileStream)); + if (!fileStream) return NULL; + + fileStream->IStream_iface.lpVtbl = &SHLWAPI_fsVTable; + fileStream->ref = 1; + fileStream->hFile = hFile; + fileStream->dwMode = dwMode; + fileStream->lpszPath = StrDupW(lpszPath); + fileStream->type = 0; /* FIXME */ + fileStream->grfStateBits = 0; /* FIXME */ + + TRACE ("Returning %p\n", fileStream); + return &fileStream->IStream_iface; } /************************************************************************* @@ -405,12 +402,10 @@ /* Access */ switch (STGM_ACCESS_MODE(dwMode)) { + case STGM_WRITE: case STGM_READWRITE: dwAccess = GENERIC_READ|GENERIC_WRITE; break; - case STGM_WRITE: - dwAccess = GENERIC_WRITE; - break; case STGM_READ: dwAccess = GENERIC_READ; break; @@ -422,6 +417,7 @@ switch (STGM_SHARE_MODE(dwMode)) { case 0: + case STGM_SHARE_DENY_NONE: dwShare = FILE_SHARE_READ|FILE_SHARE_WRITE; break; case STGM_SHARE_DENY_READ: @@ -432,9 +428,6 @@ break; case STGM_SHARE_EXCLUSIVE: dwShare = 0; - break; - case STGM_SHARE_DENY_NONE: - dwShare = FILE_SHARE_READ|FILE_SHARE_WRITE; break; default: return E_INVALIDARG; Modified: trunk/reactos/dll/win32/shlwapi/ordinal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/ordinal.…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/ordinal.c [iso-8859-1] Thu Apr 24 16:07:14 2014 @@ -38,7 +38,7 @@ extern DWORD SHLWAPI_ThreadRef_index; HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*); -HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,BOOL); +HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,DWORD); BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD); /* @@ -2911,7 +2911,7 @@ HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl) { TRACE("%p %p %p\n", hWnd, lpFolder, lpApidl); - return SHInvokeCommand(hWnd, lpFolder, lpApidl, FALSE); + return SHInvokeCommand(hWnd, lpFolder, lpApidl, 0); } /************************************************************************* @@ -3459,19 +3459,19 @@ * hWnd [I] Window displaying the shell folder * lpFolder [I] IShellFolder interface * lpApidl [I] Id for the particular folder desired - * bInvokeDefault [I] Whether to invoke the default menu item + * dwCommandId [I] The command ID to invoke (0=invoke default) * * RETURNS * Success: S_OK. If bInvokeDefault is TRUE, the default menu action was * executed. * Failure: An HRESULT error code indicating the error. */ -HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, BOOL bInvokeDefault) +HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, DWORD dwCommandId) { IContextMenu *iContext; HRESULT hRet; - TRACE("(%p, %p, %p, %d)\n", hWnd, lpFolder, lpApidl, bInvokeDefault); + TRACE("(%p, %p, %p, %u)\n", hWnd, lpFolder, lpApidl, dwCommandId); if (!lpFolder) return E_FAIL; @@ -3485,16 +3485,16 @@ if ((hMenu = CreatePopupMenu())) { HRESULT hQuery; - DWORD dwDefaultId = 0; /* Add the context menu entries to the popup */ hQuery = IContextMenu_QueryContextMenu(iContext, hMenu, 0, 1, 0x7FFF, - bInvokeDefault ? CMF_NORMAL : CMF_DEFAULTONLY); + dwCommandId ? CMF_NORMAL : CMF_DEFAULTONLY); if (SUCCEEDED(hQuery)) { - if (bInvokeDefault && - (dwDefaultId = GetMenuDefaultItem(hMenu, 0, 0)) != (UINT)-1) + if (!dwCommandId) + dwCommandId = GetMenuDefaultItem(hMenu, 0, 0); + if (dwCommandId != (UINT)-1) { CMINVOKECOMMANDINFO cmIci; /* Invoke the default item */ @@ -3502,8 +3502,8 @@ cmIci.cbSize = sizeof(cmIci); cmIci.fMask = CMIC_MASK_ASYNCOK; cmIci.hwnd = hWnd; - cmIci.lpVerb = MAKEINTRESOURCEA(dwDefaultId); - cmIci.nShow = SW_SCROLLCHILDREN; + cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId); + cmIci.nShow = SW_SHOWNORMAL; hRet = IContextMenu_InvokeCommand(iContext, &cmIci); } Modified: trunk/reactos/dll/win32/shlwapi/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/path.c?r…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/path.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/path.c [iso-8859-1] Thu Apr 24 16:07:14 2014 @@ -39,6 +39,21 @@ static fnpIsNetDrive pIsNetDrive; HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR,LPWSTR,DWORD); + +static inline WCHAR* heap_strdupAtoW(LPCSTR str) +{ + WCHAR *ret = NULL; + + if (str) + { + DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + if (ret) + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + } + + return ret; +} /************************************************************************* * PathAppendA [SHLWAPI.@] @@ -3852,16 +3867,14 @@ strcpyW(szSearch + dwLen, szAllFiles); hfind = FindFirstFileW(szSearch, &find_data); - - if (hfind != INVALID_HANDLE_VALUE && - find_data.cFileName[0] == '.' && - find_data.cFileName[1] == '.') - { - /* The only directory entry should be the parent */ - if (!FindNextFileW(hfind, &find_data)) - retVal = TRUE; + if (hfind != INVALID_HANDLE_VALUE) + { + if (find_data.cFileName[0] == '.' && find_data.cFileName[1] == '.') + /* The only directory entry should be the parent */ + retVal = !FindNextFileW(hfind, &find_data); FindClose(hfind); } + return retVal; } @@ -4022,18 +4035,61 @@ * strings. * * PARAMS - * pszPath [I] Buffer containing the path to unexpand. - * pszBuf [O] Buffer to receive the unexpanded path. - * cchBuf [I] Size of pszBuf in characters. + * path [I] Buffer containing the path to unexpand. + * buffer [O] Buffer to receive the unexpanded path. + * buf_len [I] Size of pszBuf in characters. * * RETURNS * Success: TRUE * Failure: FALSE */ -BOOL WINAPI PathUnExpandEnvStringsA(LPCSTR pszPath, LPSTR pszBuf, UINT cchBuf) -{ - FIXME("(%s,%s,0x%08x)\n", debugstr_a(pszPath), debugstr_a(pszBuf), cchBuf); - return FALSE; +BOOL WINAPI PathUnExpandEnvStringsA(LPCSTR path, LPSTR buffer, UINT buf_len) +{ + WCHAR bufferW[MAX_PATH], *pathW; + DWORD len; + BOOL ret; + + TRACE("(%s, %p, %d)\n", debugstr_a(path), buffer, buf_len); + + pathW = heap_strdupAtoW(path); + if (!pathW) return FALSE; + + ret = PathUnExpandEnvStringsW(pathW, bufferW, MAX_PATH); + HeapFree(GetProcessHeap(), 0, pathW); + if (!ret) return FALSE; + + len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL); + if (buf_len < len + 1) return FALSE; + + WideCharToMultiByte(CP_ACP, 0, bufferW, -1, buffer, buf_len, NULL, NULL); + return TRUE; +} + +static const WCHAR allusersprofileW[] = {'%','A','L','L','U','S','E','R','S','P','R','O','F','I','L','E','%',0}; +static const WCHAR appdataW[] = {'%','A','P','P','D','A','T','A','%',0}; +static const WCHAR computernameW[] = {'%','C','O','M','P','U','T','E','R','N','A','M','E','%',0}; +static const WCHAR programfilesW[] = {'%','P','r','o','g','r','a','m','F','i','l','e','s','%',0}; +static const WCHAR systemrootW[] = {'%','S','y','s','t','e','m','R','o','o','t','%',0}; +static const WCHAR systemdriveW[] = {'%','S','y','s','t','e','m','D','r','i','v','e','%',0}; +static const WCHAR userprofileW[] = {'%','U','S','E','R','P','R','O','F','I','L','E','%',0}; + +struct envvars_map +{ + const WCHAR *var; + UINT varlen; + WCHAR path[MAX_PATH]; + DWORD len; +}; + +static void init_envvars_map(struct envvars_map *map) +{ + while (map->var) + { + map->len = ExpandEnvironmentStringsW(map->var, map->path, sizeof(map->path)/sizeof(WCHAR)); + /* exclude null from length */ + if (map->len) map->len--; + map++; + } } /************************************************************************* @@ -4041,10 +4097,51 @@ * * Unicode version of PathUnExpandEnvStringsA. */ -BOOL WINAPI PathUnExpandEnvStringsW(LPCWSTR pszPath, LPWSTR pszBuf, UINT cchBuf) -{ - FIXME("(%s,%s,0x%08x)\n", debugstr_w(pszPath), debugstr_w(pszBuf), cchBuf); - return FALSE; +BOOL WINAPI PathUnExpandEnvStringsW(LPCWSTR path, LPWSTR buffer, UINT buf_len) +{ + static struct envvars_map null_var = {NULL, 0, {0}, 0}; + struct envvars_map *match = &null_var, *cur; + struct envvars_map envvars[] = { + { allusersprofileW, sizeof(allusersprofileW)/sizeof(WCHAR) }, + { appdataW, sizeof(appdataW)/sizeof(WCHAR) }, + { computernameW, sizeof(computernameW)/sizeof(WCHAR) }, + { programfilesW, sizeof(programfilesW)/sizeof(WCHAR) }, + { systemrootW, sizeof(systemrootW)/sizeof(WCHAR) }, + { systemdriveW, sizeof(systemdriveW)/sizeof(WCHAR) }, + { userprofileW, sizeof(userprofileW)/sizeof(WCHAR) }, + { NULL } + }; + DWORD pathlen; + UINT needed; + + TRACE("(%s, %p, %d)\n", debugstr_w(path), buffer, buf_len); + + pathlen = strlenW(path); + init_envvars_map(envvars); + cur = envvars; + while (cur->var) + { + /* path can't contain expanded value or value wasn't retrieved */ + if (cur->len == 0 || cur->len > pathlen || strncmpiW(cur->path, path, cur->len)) + { + cur++; + continue; + } + + if (cur->len > match->len) + match = cur; + cur++; + } + + /* 'varlen' includes NULL termination char */ + needed = match->varlen + pathlen - match->len; + if (match->len == 0 || needed > buf_len) return FALSE; + + strcpyW(buffer, match->var); + strcatW(buffer, &path[match->len]); + TRACE("ret %s\n", debugstr_w(buffer)); + + return TRUE; } /************************************************************************* Modified: trunk/reactos/dll/win32/shlwapi/shlwapi.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/shlwapi.…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/shlwapi.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/shlwapi.spec [iso-8859-1] Thu Apr 24 16:07:14 2014 @@ -216,7 +216,7 @@ 216 stdcall -noname SHAnsiToUnicodeCP(long str ptr long) 217 stdcall -ordinal SHUnicodeToAnsi(wstr ptr ptr) 218 stdcall -noname SHUnicodeToAnsiCP(long wstr ptr long) -219 stdcall -noname QISearch(long long long long) +219 stdcall QISearch(long long long long) 220 stdcall -noname SHSetDefaultDialogFont(ptr long) 221 stdcall -noname SHRemoveDefaultDialogFont(ptr) 222 stdcall -noname SHGlobalCounterCreate(long) @@ -546,7 +546,7 @@ 550 stub -noname GetTemplateInfoFromHandle 551 stub -noname IShellFolder_CompareIDs -@ stdcall AssocCreate(double double ptr ptr) +@ stdcall AssocCreate(int128 ptr ptr) @ stdcall AssocGetPerceivedType(wstr ptr ptr ptr) @ stdcall AssocIsDangerous(wstr) @ stdcall AssocQueryKeyA(long long str str ptr) Modified: trunk/reactos/dll/win32/shlwapi/string.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/string.c…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/string.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/string.c [iso-8859-1] Thu Apr 24 16:07:14 2014 @@ -2800,7 +2800,7 @@ TRACE("returning %s\n", debugstr_w(dst)); end: if(hmod) FreeLibrary(hmod); - HeapFree(GetProcessHeap(), 0, dllname); + LocalFree(dllname); return hr; } Modified: trunk/reactos/dll/win32/shlwapi/url.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/url.c?re…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/url.c [iso-8859-1] Thu Apr 24 16:07:14 2014 @@ -650,6 +650,7 @@ DWORD i, len, res1, res2, process_case = 0; LPWSTR work, preliminary, mbase, mrelative; static const WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'}; + static const WCHAR fragquerystr[] = {'#','?',0}; HRESULT ret; TRACE("(base %s, Relative %s, Combine size %d, flags %08x)\n", @@ -721,17 +722,19 @@ } } - /* If there is a '#' and the characters immediately preceding it are - * ".htm[l]", then begin looking for the last leaf starting from - * the '#'. Otherwise the '#' is not meaningful and just start - * looking from the end. */ - if ((work = strchrW(base.pszSuffix + sizeloc, '#'))) { + /* If there is a '?', then the remaining part can only contain a + * query string or fragment, so start looking for the last leaf + * from the '?'. Otherwise, if there is a '#' and the characters + * immediately preceding it are ".htm[l]", then begin looking for + * the last leaf starting from the '#'. Otherwise the '#' is not + * meaningful and just start looking from the end. */ + if ((work = strpbrkW(base.pszSuffix + sizeloc, fragquerystr))) { const WCHAR htmlW[] = {'.','h','t','m','l',0}; const int len_htmlW = 5; const WCHAR htmW[] = {'.','h','t','m',0}; const int len_htmW = 4; - if (base.nScheme == URL_SCHEME_HTTP || base.nScheme == URL_SCHEME_HTTPS) + if (*work == '?' || base.nScheme == URL_SCHEME_HTTP || base.nScheme == URL_SCHEME_HTTPS) manual_search = TRUE; else if (work - base.pszSuffix > len_htmW) { work -= len_htmW; @@ -968,57 +971,43 @@ #define WINE_URL_STOP_ON_HASH 0x20 #define WINE_URL_STOP_ON_QUESTION 0x40 -static inline BOOL URL_NeedEscapeW(WCHAR ch, DWORD dwFlags, DWORD int_flags) -{ +static inline BOOL URL_NeedEscapeW(WCHAR ch, DWORD flags, DWORD int_flags) +{ + if (flags & URL_ESCAPE_SPACES_ONLY) + return ch == ' '; + + if ((flags & URL_ESCAPE_PERCENT) && (ch == '%')) + return TRUE; + + if (ch <= 31 || (ch >= 127 && ch <= 255) ) + return TRUE; if (isalnumW(ch)) return FALSE; - if(dwFlags & URL_ESCAPE_SPACES_ONLY) { - if(ch == ' ') - return TRUE; - else - return FALSE; - } - - if ((dwFlags & URL_ESCAPE_PERCENT) && (ch == '%')) - return TRUE; - - if (ch <= 31 || ch >= 127) - return TRUE; - - else { - switch (ch) { - case ' ': - case '<': - case '>': - case '\"': - case '{': - case '}': - case '|': - case '\\': - case '^': - case ']': - case '[': - case '`': - case '&': - return TRUE; - - case '/': - if (int_flags & WINE_URL_ESCAPE_SLASH) return TRUE; - return FALSE; - - case '?': - if (int_flags & WINE_URL_ESCAPE_QUESTION) return TRUE; - return FALSE; - - case '#': - if (int_flags & WINE_URL_ESCAPE_HASH) return TRUE; - return FALSE; - - default: - return FALSE; - } + switch (ch) { + case ' ': + case '<': + case '>': + case '\"': + case '{': + case '}': + case '|': + case '\\': + case '^': + case ']': + case '[': + case '`': + case '&': + return TRUE; + case '/': + return !!(int_flags & WINE_URL_ESCAPE_SLASH); + case '?': + return !!(int_flags & WINE_URL_ESCAPE_QUESTION); + case '#': + return !!(int_flags & WINE_URL_ESCAPE_HASH); + default: + return FALSE; } } Modified: trunk/reactos/dll/win32/shlwapi/wsprintf.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shlwapi/wsprintf…
============================================================================== --- trunk/reactos/dll/win32/shlwapi/wsprintf.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shlwapi/wsprintf.c [iso-8859-1] Thu Apr 24 16:07:14 2014 @@ -26,6 +26,7 @@ #include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(string); + #define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */ #define WPRINTF_PREFIX_HEX 0x0002 /* Prefix hex with 0x ('#' prefix) */ 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 Apr 24 16:07:14 2014 @@ -180,7 +180,7 @@ reactos/dll/win32/shdocvw # Synced to Wine-1.7.1 reactos/dll/win32/shell32 # Forked at Wine-20071011 reactos/dll/win32/shfolder # Synced to Wine-1.7.1 -reactos/dll/win32/shlwapi # Synced to Wine-1.7.1 +reactos/dll/win32/shlwapi # Synced to Wine-1.7.17 reactos/dll/win32/slbcsp # Synced to Wine-1.7.1 reactos/dll/win32/snmpapi # Synced to Wine-1.7.1 reactos/dll/win32/softpub # Synced to Wine-1.7.1
10 years, 8 months
1
0
0
0
[akhaldi] 62954: [SCRRUN_WINETEST] * Sync with Wine 1.7.17. CORE-8080
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 24 16:00:38 2014 New Revision: 62954 URL:
http://svn.reactos.org/svn/reactos?rev=62954&view=rev
Log: [SCRRUN_WINETEST] * Sync with Wine 1.7.17. CORE-8080 Modified: trunk/rostests/winetests/scrrun/CMakeLists.txt trunk/rostests/winetests/scrrun/filesystem.c trunk/rostests/winetests/scrrun/scrrun.idl Modified: trunk/rostests/winetests/scrrun/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/scrrun/CMakeLis…
============================================================================== --- trunk/rostests/winetests/scrrun/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/scrrun/CMakeLists.txt [iso-8859-1] Thu Apr 24 16:00:38 2014 @@ -1,7 +1,5 @@ -add_definitions( - -D__ROS_LONG64__ - -DUSE_WINE_TODOS) +add_definitions(-DUSE_WINE_TODOS) list(APPEND SOURCE dictionary.c Modified: trunk/rostests/winetests/scrrun/filesystem.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/scrrun/filesyst…
============================================================================== --- trunk/rostests/winetests/scrrun/filesystem.c [iso-8859-1] (original) +++ trunk/rostests/winetests/scrrun/filesystem.c [iso-8859-1] Thu Apr 24 16:00:38 2014 @@ -1,6 +1,7 @@ /* * * Copyright 2012 Alistair Leslie-Hughes + * Copyright 2014 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,6 +34,17 @@ static IFileSystem3 *fs3; +static inline ULONG get_refcount(IUnknown *iface) +{ + IUnknown_AddRef(iface); + return IUnknown_Release(iface); +} + +static const WCHAR crlfW[] = {'\r','\n',0}; + +#define GET_REFCOUNT(iface) \ + get_refcount((IUnknown*)iface) + static void test_interfaces(void) { static const WCHAR nonexistent_dirW[] = { @@ -117,29 +129,38 @@ static void test_createfolder(void) { - HRESULT hr; - WCHAR pathW[MAX_PATH]; + WCHAR pathW[MAX_PATH], buffW[MAX_PATH]; + HRESULT hr; BSTR path; IFolder *folder; + BOOL ret; + + GetTempPathW(MAX_PATH, pathW); + GetTempFileNameW(pathW, NULL, 0, buffW); + DeleteFileW(buffW); + ret = CreateDirectoryW(buffW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); /* create existing directory */ - GetCurrentDirectoryW(sizeof(pathW)/sizeof(WCHAR), pathW); - path = SysAllocString(pathW); + path = SysAllocString(buffW); folder = (void*)0xdeabeef; hr = IFileSystem3_CreateFolder(fs3, path, &folder); ok(hr == CTL_E_FILEALREADYEXISTS, "got 0x%08x\n", hr); ok(folder == NULL, "got %p\n", folder); SysFreeString(path); + RemoveDirectoryW(buffW); } static void test_textstream(void) { - static WCHAR testfileW[] = {'t','e','s','t','f','i','l','e','.','t','x','t',0}; + static const WCHAR testfileW[] = {'t','e','s','t','f','i','l','e','.','t','x','t',0}; ITextStream *stream; VARIANT_BOOL b; + DWORD written; HANDLE file; HRESULT hr; BSTR name, data; + BOOL ret; file = CreateFileW(testfileW, GENERIC_READ, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CloseHandle(file); @@ -150,15 +171,46 @@ ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK); ok(b == VARIANT_TRUE, "got %x\n", b); + /* different mode combinations */ + hr = IFileSystem3_OpenTextFile(fs3, name, ForWriting | ForAppending, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForReading | ForAppending, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForWriting | ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForAppending, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = ITextStream_Read(stream, 1, &data); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForWriting, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = ITextStream_Read(stream, 1, &data); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + ITextStream_Release(stream); + hr = IFileSystem3_OpenTextFile(fs3, name, ForReading, VARIANT_FALSE, TristateFalse, &stream); ok(hr == S_OK, "got 0x%08x\n", hr); + + /* try to write when open for reading */ + hr = ITextStream_WriteLine(stream, name); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + + hr = ITextStream_Write(stream, name); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + + hr = ITextStream_get_AtEndOfStream(stream, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); b = 10; hr = ITextStream_get_AtEndOfStream(stream, &b); -todo_wine { - ok(hr == S_FALSE || broken(hr == S_OK), "got 0x%08x\n", hr); + ok(hr == S_OK || broken(hr == S_FALSE), "got 0x%08x\n", hr); ok(b == VARIANT_TRUE, "got 0x%x\n", b); -} + ITextStream_Release(stream); hr = IFileSystem3_OpenTextFile(fs3, name, ForWriting, VARIANT_FALSE, TristateFalse, &stream); @@ -166,10 +218,9 @@ b = 10; hr = ITextStream_get_AtEndOfStream(stream, &b); -todo_wine { ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); ok(b == VARIANT_TRUE || broken(b == 10), "got 0x%x\n", b); -} + b = 10; hr = ITextStream_get_AtEndOfLine(stream, &b); todo_wine { @@ -189,14 +240,12 @@ hr = IFileSystem3_OpenTextFile(fs3, name, ForAppending, VARIANT_FALSE, TristateFalse, &stream); ok(hr == S_OK, "got 0x%08x\n", hr); - SysFreeString(name); b = 10; hr = ITextStream_get_AtEndOfStream(stream, &b); -todo_wine { ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); ok(b == VARIANT_TRUE || broken(b == 10), "got 0x%x\n", b); -} + b = 10; hr = ITextStream_get_AtEndOfLine(stream, &b); todo_wine { @@ -214,6 +263,21 @@ ITextStream_Release(stream); + /* now with non-empty file */ + file = CreateFileW(testfileW, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ret = WriteFile(file, testfileW, sizeof(testfileW), &written, NULL); + ok(ret && written == sizeof(testfileW), "got %d\n", ret); + CloseHandle(file); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + b = 10; + hr = ITextStream_get_AtEndOfStream(stream, &b); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(b == VARIANT_FALSE, "got 0x%x\n", b); + ITextStream_Release(stream); + + SysFreeString(name); DeleteFileW(testfileW); } @@ -411,7 +475,7 @@ hr = IFileSystem3_GetAbsolutePathName(fs3, NULL, &result); ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr); GetFullPathNameW(cur_dir, MAX_PATH, buf, NULL); - ok(!lstrcmpW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf)); + ok(!lstrcmpiW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf)); SysFreeString(result); find = FindFirstFileW(dir_match2, &fdata); @@ -425,26 +489,26 @@ hr = IFileSystem3_GetAbsolutePathName(fs3, path, &result); ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr); GetFullPathNameW(dir_match1, MAX_PATH, buf2, NULL); - ok(!lstrcmpW(buf2, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf2)); + ok(!lstrcmpiW(buf2, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf2)); SysFreeString(result); ok(CreateDirectoryW(dir1, NULL), "CreateDirectory(%s) failed\n", wine_dbgstr_w(dir1)); hr = IFileSystem3_GetAbsolutePathName(fs3, path, &result); ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr); GetFullPathNameW(dir1, MAX_PATH, buf, NULL); - ok(!lstrcmpW(buf, result) || broken(!lstrcmpW(buf2, result)), "result = %s, expected %s\n", + ok(!lstrcmpiW(buf, result) || broken(!lstrcmpiW(buf2, result)), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf)); SysFreeString(result); ok(CreateDirectoryW(dir2, NULL), "CreateDirectory(%s) failed\n", wine_dbgstr_w(dir2)); hr = IFileSystem3_GetAbsolutePathName(fs3, path, &result); ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr); - if(!lstrcmpW(buf, result) || !lstrcmpW(buf2, result)) { - ok(!lstrcmpW(buf, result) || broken(!lstrcmpW(buf2, result)), "result = %s, expected %s\n", + if(!lstrcmpiW(buf, result) || !lstrcmpiW(buf2, result)) { + ok(!lstrcmpiW(buf, result) || broken(!lstrcmpiW(buf2, result)), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf)); }else { GetFullPathNameW(dir2, MAX_PATH, buf, NULL); - ok(!lstrcmpW(buf, result), "result = %s, expected %s\n", + ok(!lstrcmpiW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf)); } SysFreeString(result); @@ -454,7 +518,7 @@ hr = IFileSystem3_GetAbsolutePathName(fs3, path, &result); ok(hr == S_OK, "GetAbsolutePathName returned %x, expected S_OK\n", hr); GetFullPathNameW(dir_match2, MAX_PATH, buf, NULL); - ok(!lstrcmpW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf)); + ok(!lstrcmpiW(buf, result), "result = %s, expected %s\n", wine_dbgstr_w(result), wine_dbgstr_w(buf)); SysFreeString(result); SysFreeString(path); @@ -651,6 +715,1009 @@ SysFreeString(bsrc); } +static BSTR bstr_from_str(const char *str) +{ + int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + BSTR ret = SysAllocStringLen(NULL, len - 1); /* NUL character added automatically */ + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + return ret; +} + +struct buildpath_test +{ + const char *path; + const char *name; + const char *result; +}; + +static struct buildpath_test buildpath_data[] = +{ + { "C:\\path", "..\\name.tmp", "C:\\path\\..\\name.tmp" }, + { "C:\\path", "\\name.tmp", "C:\\path\\name.tmp" }, + { "C:\\path", "name.tmp", "C:\\path\\name.tmp" }, + { "C:\\path\\", "name.tmp", "C:\\path\\name.tmp" }, + { "C:\\path", "\\\\name.tmp", "C:\\path\\\\name.tmp" }, + { "C:\\path\\", "\\name.tmp", "C:\\path\\name.tmp" }, + { "C:\\path\\", "\\\\name.tmp", "C:\\path\\\\name.tmp" }, + { "C:\\path\\\\", "\\\\name.tmp", "C:\\path\\\\\\name.tmp" }, + { "C:\\\\", "\\name.tmp", "C:\\\\name.tmp" }, + { "C:", "name.tmp", "C:name.tmp" }, + { "C:", "\\\\name.tmp", "C:\\\\name.tmp" }, + { NULL } +}; + +static void test_BuildPath(void) +{ + struct buildpath_test *ptr = buildpath_data; + BSTR ret, path; + HRESULT hr; + int i = 0; + + hr = IFileSystem3_BuildPath(fs3, NULL, NULL, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + ret = (BSTR)0xdeadbeef; + hr = IFileSystem3_BuildPath(fs3, NULL, NULL, &ret); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(*ret == 0, "got %p\n", ret); + SysFreeString(ret); + + ret = (BSTR)0xdeadbeef; + path = bstr_from_str("path"); + hr = IFileSystem3_BuildPath(fs3, path, NULL, &ret); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(!lstrcmpW(ret, path), "got %s\n", wine_dbgstr_w(ret)); + SysFreeString(ret); + SysFreeString(path); + + ret = (BSTR)0xdeadbeef; + path = bstr_from_str("path"); + hr = IFileSystem3_BuildPath(fs3, NULL, path, &ret); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(!lstrcmpW(ret, path), "got %s\n", wine_dbgstr_w(ret)); + SysFreeString(ret); + SysFreeString(path); + + while (ptr->path) + { + BSTR name, result; + + ret = NULL; + path = bstr_from_str(ptr->path); + name = bstr_from_str(ptr->name); + result = bstr_from_str(ptr->result); + hr = IFileSystem3_BuildPath(fs3, path, name, &ret); + ok(hr == S_OK, "%d: got 0x%08x\n", i, hr); + if (hr == S_OK) + { + ok(!lstrcmpW(ret, result), "%d: got wrong path %s, expected %s\n", i, wine_dbgstr_w(ret), + wine_dbgstr_w(result)); + SysFreeString(ret); + } + SysFreeString(path); + SysFreeString(name); + SysFreeString(result); + + i++; + ptr++; + } +} + +static void test_GetFolder(void) +{ + static const WCHAR dummyW[] = {'d','u','m','m','y',0}; + WCHAR buffW[MAX_PATH]; + IFolder *folder; + HRESULT hr; + BSTR str; + + folder = (void*)0xdeadbeef; + hr = IFileSystem3_GetFolder(fs3, NULL, &folder); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + ok(folder == NULL, "got %p\n", folder); + + hr = IFileSystem3_GetFolder(fs3, NULL, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + /* something that doesn't exist */ + str = SysAllocString(dummyW); + + hr = IFileSystem3_GetFolder(fs3, str, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + folder = (void*)0xdeadbeef; + hr = IFileSystem3_GetFolder(fs3, str, &folder); + ok(hr == CTL_E_PATHNOTFOUND, "got 0x%08x\n", hr); + ok(folder == NULL, "got %p\n", folder); + SysFreeString(str); + + GetWindowsDirectoryW(buffW, MAX_PATH); + str = SysAllocString(buffW); + hr = IFileSystem3_GetFolder(fs3, str, &folder); + ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(str); + IFolder_Release(folder); +} + +/* Please keep the tests for IFolderCollection and IFileCollection in sync */ +static void test_FolderCollection(void) +{ + static const WCHAR fooW[] = {'f','o','o',0}; + static const WCHAR aW[] = {'\\','a',0}; + static const WCHAR bW[] = {'\\','b',0}; + static const WCHAR cW[] = {'\\','c',0}; + IFolderCollection *folders; + WCHAR buffW[MAX_PATH], pathW[MAX_PATH]; + IEnumVARIANT *enumvar, *clone; + LONG count, ref, ref2, i; + IUnknown *unk, *unk2; + IFolder *folder; + ULONG fetched; + VARIANT var, var2[2]; + HRESULT hr; + BSTR str; + int found_a = 0, found_b = 0, found_c = 0; + + GetTempPathW(MAX_PATH, pathW); + GetTempFileNameW(pathW, fooW, 0, buffW); + DeleteFileW(buffW); + CreateDirectoryW(buffW, NULL); + + str = SysAllocString(buffW); + hr = IFileSystem3_GetFolder(fs3, str, &folder); + ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(str); + + hr = IFolder_get_SubFolders(folder, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IFolder_get_Path(folder, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IFolder_get_Path(folder, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(!lstrcmpW(buffW, str), "got %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buffW)); + SysFreeString(str); + + lstrcpyW(pathW, buffW); + lstrcatW(pathW, aW); + CreateDirectoryW(pathW, NULL); + + lstrcpyW(pathW, buffW); + lstrcatW(pathW, bW); + CreateDirectoryW(pathW, NULL); + + hr = IFolder_get_SubFolders(folder, &folders); + ok(hr == S_OK, "got 0x%08x\n", hr); + IFolder_Release(folder); + + count = 0; + hr = IFolderCollection_get_Count(folders, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count == 2, "got %d\n", count); + + lstrcpyW(pathW, buffW); + lstrcatW(pathW, cW); + CreateDirectoryW(pathW, NULL); + + /* every time property is requested it scans directory */ + count = 0; + hr = IFolderCollection_get_Count(folders, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count == 3, "got %d\n", count); + + hr = IFolderCollection_get__NewEnum(folders, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IFolderCollection_QueryInterface(folders, &IID_IEnumVARIANT, (void**)&unk); + ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); + + /* NewEnum creates new instance each time it's called */ + ref = GET_REFCOUNT(folders); + + unk = NULL; + hr = IFolderCollection_get__NewEnum(folders, &unk); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ref2 = GET_REFCOUNT(folders); + ok(ref2 == ref + 1, "got %d, %d\n", ref2, ref); + + unk2 = NULL; + hr = IFolderCollection_get__NewEnum(folders, &unk2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(unk != unk2, "got %p, %p\n", unk2, unk); + IUnknown_Release(unk2); + + /* now get IEnumVARIANT */ + ref = GET_REFCOUNT(folders); + hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (void**)&enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + ref2 = GET_REFCOUNT(folders); + ok(ref2 == ref, "got %d, %d\n", ref2, ref); + + /* clone enumerator */ + hr = IEnumVARIANT_Clone(enumvar, &clone); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(clone != enumvar, "got %p, %p\n", enumvar, clone); + IEnumVARIANT_Release(clone); + + hr = IEnumVARIANT_Reset(enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + + for (i = 0; i < 3; i++) + { + VariantInit(&var); + fetched = 0; + hr = IEnumVARIANT_Next(enumvar, 1, &var, &fetched); + ok(hr == S_OK, "%d: got 0x%08x\n", i, hr); + ok(fetched == 1, "%d: got %d\n", i, fetched); + ok(V_VT(&var) == VT_DISPATCH, "%d: got type %d\n", i, V_VT(&var)); + + hr = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IFolder, (void**)&folder); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = NULL; + hr = IFolder_get_Name(folder, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + if (!lstrcmpW(str, aW + 1)) + found_a++; + else if (!lstrcmpW(str, bW + 1)) + found_b++; + else if (!lstrcmpW(str, cW + 1)) + found_c++; + else + ok(0, "unexpected folder %s was found\n", wine_dbgstr_w(str)); + SysFreeString(str); + + IFolder_Release(folder); + VariantClear(&var); + } + + ok(found_a == 1 && found_b == 1 && found_c == 1, + "each folder should be found 1 time instead of %d/%d/%d\n", + found_a, found_b, found_c); + + VariantInit(&var); + fetched = -1; + hr = IEnumVARIANT_Next(enumvar, 1, &var, &fetched); + ok(hr == S_FALSE, "got 0x%08x\n", hr); + ok(fetched == 0, "got %d\n", fetched); + + hr = IEnumVARIANT_Reset(enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IEnumVARIANT_Skip(enumvar, 2); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IEnumVARIANT_Skip(enumvar, 0); + ok(hr == S_OK, "got 0x%08x\n", hr); + + VariantInit(&var2[0]); + VariantInit(&var2[1]); + fetched = -1; + hr = IEnumVARIANT_Next(enumvar, 0, var2, &fetched); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(fetched == 0, "got %d\n", fetched); + fetched = -1; + hr = IEnumVARIANT_Next(enumvar, 2, var2, &fetched); + ok(hr == S_FALSE, "got 0x%08x\n", hr); + ok(fetched == 1, "got %d\n", fetched); + ok(V_VT(&var2[0]) == VT_DISPATCH, "got type %d\n", V_VT(&var2[0])); + VariantClear(&var2[0]); + VariantClear(&var2[1]); + + IEnumVARIANT_Release(enumvar); + IUnknown_Release(unk); + + lstrcpyW(pathW, buffW); + lstrcatW(pathW, aW); + RemoveDirectoryW(pathW); + lstrcpyW(pathW, buffW); + lstrcatW(pathW, bW); + RemoveDirectoryW(pathW); + lstrcpyW(pathW, buffW); + lstrcatW(pathW, cW); + RemoveDirectoryW(pathW); + RemoveDirectoryW(buffW); + + IFolderCollection_Release(folders); +} + +/* Please keep the tests for IFolderCollection and IFileCollection in sync */ +static void test_FileCollection(void) +{ + static const WCHAR fooW[] = {'\\','f','o','o',0}; + static const WCHAR aW[] = {'\\','a',0}; + static const WCHAR bW[] = {'\\','b',0}; + static const WCHAR cW[] = {'\\','c',0}; + WCHAR buffW[MAX_PATH], pathW[MAX_PATH]; + IFolder *folder; + IFileCollection *files; + IFile *file; + IEnumVARIANT *enumvar, *clone; + LONG count, ref, ref2, i; + IUnknown *unk, *unk2; + ULONG fetched; + VARIANT var, var2[2]; + HRESULT hr; + BSTR str; + HANDLE file_a, file_b, file_c; + int found_a = 0, found_b = 0, found_c = 0; + + GetTempPathW(MAX_PATH, pathW); + GetTempFileNameW(pathW, fooW, 0, buffW); + DeleteFileW(buffW); + CreateDirectoryW(buffW, NULL); + + str = SysAllocString(buffW); + hr = IFileSystem3_GetFolder(fs3, str, &folder); + ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(str); + + hr = IFolder_get_Files(folder, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + lstrcpyW(pathW, buffW); + lstrcatW(pathW, aW); + file_a = CreateFileW(pathW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_FLAG_DELETE_ON_CLOSE, 0); + lstrcpyW(pathW, buffW); + lstrcatW(pathW, bW); + file_b = CreateFileW(pathW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_FLAG_DELETE_ON_CLOSE, 0); + + hr = IFolder_get_Files(folder, &files); + ok(hr == S_OK, "got 0x%08x\n", hr); + IFolder_Release(folder); + + count = 0; + hr = IFileCollection_get_Count(files, &count); +todo_wine + ok(hr == S_OK, "got 0x%08x\n", hr); +todo_wine + ok(count == 2, "got %d\n", count); + + lstrcpyW(pathW, buffW); + lstrcatW(pathW, cW); + file_c = CreateFileW(pathW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_FLAG_DELETE_ON_CLOSE, 0); + + /* every time property is requested it scans directory */ + count = 0; + hr = IFileCollection_get_Count(files, &count); +todo_wine + ok(hr == S_OK, "got 0x%08x\n", hr); +todo_wine + ok(count == 3, "got %d\n", count); + + hr = IFileCollection_get__NewEnum(files, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IFileCollection_QueryInterface(files, &IID_IEnumVARIANT, (void**)&unk); + ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); + + /* NewEnum creates new instance each time it's called */ + ref = GET_REFCOUNT(files); + + unk = NULL; + hr = IFileCollection_get__NewEnum(files, &unk); + ok(hr == S_OK, "got 0x%08x\n", hr); + + ref2 = GET_REFCOUNT(files); + ok(ref2 == ref + 1, "got %d, %d\n", ref2, ref); + + unk2 = NULL; + hr = IFileCollection_get__NewEnum(files, &unk2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(unk != unk2, "got %p, %p\n", unk2, unk); + IUnknown_Release(unk2); + + /* now get IEnumVARIANT */ + ref = GET_REFCOUNT(files); + hr = IUnknown_QueryInterface(unk, &IID_IEnumVARIANT, (void**)&enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + ref2 = GET_REFCOUNT(files); + ok(ref2 == ref, "got %d, %d\n", ref2, ref); + + /* clone enumerator */ + hr = IEnumVARIANT_Clone(enumvar, &clone); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(clone != enumvar, "got %p, %p\n", enumvar, clone); + IEnumVARIANT_Release(clone); + + hr = IEnumVARIANT_Reset(enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + + for (i = 0; i < 3; i++) + { + VariantInit(&var); + fetched = 0; + hr = IEnumVARIANT_Next(enumvar, 1, &var, &fetched); + ok(hr == S_OK, "%d: got 0x%08x\n", i, hr); + ok(fetched == 1, "%d: got %d\n", i, fetched); + ok(V_VT(&var) == VT_DISPATCH, "%d: got type %d\n", i, V_VT(&var)); + + hr = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IFile, (void **)&file); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = NULL; + hr = IFile_get_Name(file, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + if (!lstrcmpW(str, aW + 1)) + found_a++; + else if (!lstrcmpW(str, bW + 1)) + found_b++; + else if (!lstrcmpW(str, cW + 1)) + found_c++; + else + ok(0, "unexpected file %s was found\n", wine_dbgstr_w(str)); + SysFreeString(str); + + IFile_Release(file); + VariantClear(&var); + } + + ok(found_a == 1 && found_b == 1 && found_c == 1, + "each file should be found 1 time instead of %d/%d/%d\n", + found_a, found_b, found_c); + + VariantInit(&var); + fetched = -1; + hr = IEnumVARIANT_Next(enumvar, 1, &var, &fetched); + ok(hr == S_FALSE, "got 0x%08x\n", hr); + ok(fetched == 0, "got %d\n", fetched); + + hr = IEnumVARIANT_Reset(enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IEnumVARIANT_Skip(enumvar, 2); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IEnumVARIANT_Skip(enumvar, 0); + ok(hr == S_OK, "got 0x%08x\n", hr); + + VariantInit(&var2[0]); + VariantInit(&var2[1]); + fetched = -1; + hr = IEnumVARIANT_Next(enumvar, 0, var2, &fetched); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(fetched == 0, "got %d\n", fetched); + fetched = -1; + hr = IEnumVARIANT_Next(enumvar, 2, var2, &fetched); + ok(hr == S_FALSE, "got 0x%08x\n", hr); + ok(fetched == 1, "got %d\n", fetched); + ok(V_VT(&var2[0]) == VT_DISPATCH, "got type %d\n", V_VT(&var2[0])); + VariantClear(&var2[0]); + VariantClear(&var2[1]); + + IEnumVARIANT_Release(enumvar); + IUnknown_Release(unk); + + CloseHandle(file_a); + CloseHandle(file_b); + CloseHandle(file_c); + RemoveDirectoryW(buffW); + + IFileCollection_Release(files); +} + +static void test_DriveCollection(void) +{ + IDriveCollection *drives; + IEnumVARIANT *enumvar; + ULONG fetched; + VARIANT var; + HRESULT hr; + LONG count; + + hr = IFileSystem3_get_Drives(fs3, &drives); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDriveCollection_get__NewEnum(drives, (IUnknown**)&enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDriveCollection_get_Count(drives, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + count = 0; + hr = IDriveCollection_get_Count(drives, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count > 0, "got %d\n", count); + + V_VT(&var) = VT_EMPTY; + fetched = -1; + hr = IEnumVARIANT_Next(enumvar, 0, &var, &fetched); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(fetched == 0, "got %d\n", fetched); + + hr = IEnumVARIANT_Skip(enumvar, 0); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IEnumVARIANT_Skip(enumvar, count); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IEnumVARIANT_Skip(enumvar, 1); + ok(hr == S_FALSE, "got 0x%08x\n", hr); + + /* reset and iterate again */ + hr = IEnumVARIANT_Reset(enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + + while (IEnumVARIANT_Next(enumvar, 1, &var, &fetched) == S_OK) { + IDrive *drive = (IDrive*)V_DISPATCH(&var); + DriveTypeConst type; + BSTR str; + + hr = IDrive_get_DriveType(drive, &type); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDrive_get_DriveLetter(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IDrive_get_DriveLetter(drive, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(SysStringLen(str) == 1, "got string %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + hr = IDrive_get_IsReady(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IDrive_get_TotalSize(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IDrive_get_AvailableSpace(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IDrive_get_FreeSpace(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + if (type == Fixed) { + VARIANT_BOOL ready = VARIANT_FALSE; + VARIANT size; + + hr = IDrive_get_IsReady(drive, &ready); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(ready == VARIANT_TRUE, "got %x\n", ready); + + V_VT(&size) = VT_EMPTY; + hr = IDrive_get_TotalSize(drive, &size); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(V_VT(&size) == VT_R8, "got %d\n", V_VT(&size)); + ok(V_R8(&size) > 0, "got %f\n", V_R8(&size)); + + V_VT(&size) = VT_EMPTY; + hr = IDrive_get_AvailableSpace(drive, &size); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(V_VT(&size) == VT_R8, "got %d\n", V_VT(&size)); + ok(V_R8(&size) > 0, "got %f\n", V_R8(&size)); + + V_VT(&size) = VT_EMPTY; + hr = IDrive_get_FreeSpace(drive, &size); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(V_VT(&size) == VT_R8, "got %d\n", V_VT(&size)); + ok(V_R8(&size) > 0, "got %f\n", V_R8(&size)); + } + VariantClear(&var); + } + + IEnumVARIANT_Release(enumvar); + IDriveCollection_Release(drives); +} + +static void test_CreateTextFile(void) +{ + static const WCHAR scrrunW[] = {'s','c','r','r','u','n','\\',0}; + static const WCHAR testfileW[] = {'t','e','s','t','.','t','x','t',0}; + static const WCHAR bomAW[] = {0xff,0xfe,0}; + WCHAR pathW[MAX_PATH], dirW[MAX_PATH]; + ITextStream *stream; + BSTR nameW, str; + HANDLE file; + HRESULT hr; + BOOL ret; + + GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); + lstrcatW(pathW, scrrunW); + lstrcpyW(dirW, pathW); + lstrcatW(pathW, testfileW); + + /* dir doesn't exist */ + nameW = SysAllocString(pathW); + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream); + ok(hr == CTL_E_PATHNOTFOUND, "got 0x%08x\n", hr); + + ret = CreateDirectoryW(dirW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); + + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_Read(stream, 1, &str); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + + ITextStream_Release(stream); + + /* check it's created */ + file = CreateFileW(pathW, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "got %p\n", file); + CloseHandle(file); + + /* try to create again with no-overwrite mode */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream); + ok(hr == CTL_E_FILEALREADYEXISTS, "got 0x%08x\n", hr); + + /* now overwrite */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_TRUE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + /* overwrite in Unicode mode, check for BOM */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_TRUE, VARIANT_TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = ITextStream_ReadAll(stream, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); + ok(!lstrcmpW(str, bomAW), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + ITextStream_Release(stream); + + DeleteFileW(nameW); + RemoveDirectoryW(dirW); + SysFreeString(nameW); +} + +static void test_WriteLine(void) +{ + static const WCHAR scrrunW[] = {'s','c','r','r','u','n','\\',0}; + static const WCHAR testfileW[] = {'t','e','s','t','.','t','x','t',0}; + WCHAR pathW[MAX_PATH], dirW[MAX_PATH]; + WCHAR buffW[MAX_PATH], buff2W[MAX_PATH]; + char buffA[MAX_PATH]; + ITextStream *stream; + DWORD r, len; + HANDLE file; + BSTR nameW; + HRESULT hr; + BOOL ret; + + GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); + lstrcatW(pathW, scrrunW); + lstrcpyW(dirW, pathW); + lstrcatW(pathW, testfileW); + + ret = CreateDirectoryW(dirW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); + + /* create as ASCII file first */ + nameW = SysAllocString(pathW); + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_WriteLine(stream, nameW); + ok(hr == S_OK, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + /* check contents */ + file = CreateFileW(pathW, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "got %p\n", file); + r = 0; + ret = ReadFile(file, buffA, sizeof(buffA), &r, NULL); + ok(ret && r, "read %d, got %d, %d\n", r, ret, GetLastError()); + + len = MultiByteToWideChar(CP_ACP, 0, buffA, r, buffW, sizeof(buffW)/sizeof(WCHAR)); + buffW[len] = 0; + lstrcpyW(buff2W, nameW); + lstrcatW(buff2W, crlfW); + ok(!lstrcmpW(buff2W, buffW), "got %s, expected %s\n", wine_dbgstr_w(buffW), wine_dbgstr_w(buff2W)); + CloseHandle(file); + DeleteFileW(nameW); + + /* same for unicode file */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_WriteLine(stream, nameW); + ok(hr == S_OK, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + /* check contents */ + file = CreateFileW(pathW, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "got %p\n", file); + r = 0; + ret = ReadFile(file, buffW, sizeof(buffW), &r, NULL); + ok(ret && r, "read %d, got %d, %d\n", r, ret, GetLastError()); + buffW[r/sizeof(WCHAR)] = 0; + + buff2W[0] = 0xfeff; + buff2W[1] = 0; + lstrcatW(buff2W, nameW); + lstrcatW(buff2W, crlfW); + ok(!lstrcmpW(buff2W, buffW), "got %s, expected %s\n", wine_dbgstr_w(buffW), wine_dbgstr_w(buff2W)); + CloseHandle(file); + DeleteFileW(nameW); + + RemoveDirectoryW(dirW); + SysFreeString(nameW); +} + +static void test_ReadAll(void) +{ + static const WCHAR scrrunW[] = {'s','c','r','r','u','n','\\',0}; + static const WCHAR testfileW[] = {'t','e','s','t','.','t','x','t',0}; + static const WCHAR secondlineW[] = {'s','e','c','o','n','d',0}; + static const WCHAR aW[] = {'A',0}; + WCHAR pathW[MAX_PATH], dirW[MAX_PATH], buffW[500]; + ITextStream *stream; + BSTR nameW; + HRESULT hr; + BOOL ret; + BSTR str; + + GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); + lstrcatW(pathW, scrrunW); + lstrcpyW(dirW, pathW); + lstrcatW(pathW, testfileW); + + ret = CreateDirectoryW(dirW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); + + /* Unicode file -> read with ascii stream */ + nameW = SysAllocString(pathW); + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_WriteLine(stream, nameW); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = SysAllocString(secondlineW); + hr = ITextStream_WriteLine(stream, str); + ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(str); + + hr = ITextStream_ReadAll(stream, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef) /* win2k */, "got %p\n", str); + + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_ReadAll(stream, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + /* Buffer content is not interpreted - BOM is kept, all data is converted to WCHARs */ + str = NULL; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); + ok(str[0] == 0x00ff && str[1] == 0x00fe, "got %s, %d\n", wine_dbgstr_w(str), SysStringLen(str)); + SysFreeString(str); + ITextStream_Release(stream); + + /* Unicode file -> read with unicode stream */ + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + lstrcpyW(buffW, nameW); + lstrcatW(buffW, crlfW); + lstrcatW(buffW, secondlineW); + lstrcatW(buffW, crlfW); + str = NULL; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); + ok(!lstrcmpW(buffW, str), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + /* ReadAll one more time */ + str = (void*)0xdeadbeef; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef) /* win2k */, "got %p\n", str); + + /* ReadLine fails the same way */ + str = (void*)0xdeadbeef; + hr = ITextStream_ReadLine(stream, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef) /* win2k */, "got %p\n", str); + ITextStream_Release(stream); + + /* Open again and skip first line before ReadAll */ + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = NULL; + hr = ITextStream_ReadLine(stream, &str); +todo_wine { + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(str != NULL, "got %p\n", str); +} + SysFreeString(str); + + lstrcpyW(buffW, secondlineW); + lstrcatW(buffW, crlfW); + str = NULL; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); +todo_wine + ok(!lstrcmpW(buffW, str), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + ITextStream_Release(stream); + + /* ASCII file, read with Unicode stream */ + /* 1. one byte content, not enough for Unicode read */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_TRUE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + str = SysAllocString(aW); + hr = ITextStream_Write(stream, str); + SysFreeString(str); + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef) /* win2k */, "got %p\n", str); + + ITextStream_Release(stream); + + DeleteFileW(nameW); + RemoveDirectoryW(dirW); + SysFreeString(nameW); +} + +static void test_Read(void) +{ + static const WCHAR scrrunW[] = {'s','c','r','r','u','n','\\',0}; + static const WCHAR testfileW[] = {'t','e','s','t','.','t','x','t',0}; + static const WCHAR secondlineW[] = {'s','e','c','o','n','d',0}; + static const WCHAR aW[] = {'A',0}; + WCHAR pathW[MAX_PATH], dirW[MAX_PATH], buffW[500]; + ITextStream *stream; + BSTR nameW; + HRESULT hr; + BOOL ret; + BSTR str; + + GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); + lstrcatW(pathW, scrrunW); + lstrcpyW(dirW, pathW); + lstrcatW(pathW, testfileW); + + ret = CreateDirectoryW(dirW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); + + /* Unicode file -> read with ascii stream */ + nameW = SysAllocString(pathW); + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_WriteLine(stream, nameW); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = SysAllocString(secondlineW); + hr = ITextStream_WriteLine(stream, str); + ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(str); + + hr = ITextStream_Read(stream, 0, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = ITextStream_Read(stream, 1, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = ITextStream_Read(stream, -1, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, 1, &str); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_Read(stream, 1, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, -1, &str); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, 0, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + /* Buffer content is not interpreted - BOM is kept, all data is converted to WCHARs */ + str = NULL; + hr = ITextStream_Read(stream, 2, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(str[0] == 0x00ff && str[1] == 0x00fe, "got %s, %d\n", wine_dbgstr_w(str), SysStringLen(str)); + ok(SysStringLen(str) == 2, "got %d\n", SysStringLen(str)); + SysFreeString(str); + ITextStream_Release(stream); + + /* Unicode file -> read with unicode stream */ + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + lstrcpyW(buffW, nameW); + lstrcatW(buffW, crlfW); + lstrcatW(buffW, secondlineW); + lstrcatW(buffW, crlfW); + str = NULL; + hr = ITextStream_Read(stream, 500, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); + ok(!lstrcmpW(buffW, str), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + /* ReadAll one more time */ + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, 10, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + /* ReadLine fails the same way */ + str = (void*)0xdeadbeef; + hr = ITextStream_ReadLine(stream, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef), "got %p\n", str); + ITextStream_Release(stream); + + /* Open again and skip first line before ReadAll */ + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = NULL; + hr = ITextStream_ReadLine(stream, &str); +todo_wine { + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(str != NULL, "got %p\n", str); +} + SysFreeString(str); + + lstrcpyW(buffW, secondlineW); + lstrcatW(buffW, crlfW); + str = NULL; + hr = ITextStream_Read(stream, 100, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); +todo_wine + ok(!lstrcmpW(buffW, str), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + ITextStream_Release(stream); + + /* ASCII file, read with Unicode stream */ + /* 1. one byte content, not enough for Unicode read */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_TRUE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + str = SysAllocString(aW); + hr = ITextStream_Write(stream, str); + SysFreeString(str); + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, 500, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + ITextStream_Release(stream); + + DeleteFileW(nameW); + RemoveDirectoryW(dirW); + SysFreeString(nameW); +} + START_TEST(filesystem) { HRESULT hr; @@ -674,6 +1741,15 @@ test_GetAbsolutePathName(); test_GetFile(); test_CopyFolder(); + test_BuildPath(); + test_GetFolder(); + test_FolderCollection(); + test_FileCollection(); + test_DriveCollection(); + test_CreateTextFile(); + test_WriteLine(); + test_ReadAll(); + test_Read(); IFileSystem3_Release(fs3); Modified: trunk/rostests/winetests/scrrun/scrrun.idl URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/scrrun/scrrun.i…
============================================================================== --- trunk/rostests/winetests/scrrun/scrrun.idl [iso-8859-1] (original) +++ trunk/rostests/winetests/scrrun/scrrun.idl [iso-8859-1] Thu Apr 24 16:00:38 2014 @@ -24,6 +24,7 @@ cpp_quote("#undef DeleteFile") cpp_quote("#undef MoveFile") cpp_quote("#endif") +cpp_quote("#define CTL_E_ENDOFFILE STD_CTL_SCODE(62)") /* this is not defined in public headers */ [ uuid(420B2830-E718-11CF-893D-00A0C9054228), @@ -33,23 +34,13 @@ { importlib("stdole2.tlb"); - interface IDictionary; - interface IDrive; - interface IDriveCollection; - interface IFile; - interface IFileCollection; - interface IFileSystem; - interface IFileSystem3; interface IFolder; - interface IFolderCollection; - interface IScriptEncoder; - interface ITextStream; typedef enum CompareMethod { - BinaryCompare = 0, - TextCompare = 1, - DatabaseCompare = 2 + BinaryCompare, + TextCompare, + DatabaseCompare } CompareMethod; typedef enum IOMode @@ -61,10 +52,10 @@ typedef enum Tristate { - TristateTrue = 0xffffffff, - TristateFalse = 0, - TristateUseDefault = 0xfffffffe, - TristateMixed = 0xfffffffe + TristateTrue = -1, + TristateFalse = 0, + TristateUseDefault = -2, + TristateMixed = -2 } Tristate; typedef enum FileAttribute @@ -82,26 +73,26 @@ typedef enum SpecialFolderConst { - WindowsFolder = 0, - SystemFolder = 1, - TemporaryFolder = 2 + WindowsFolder, + SystemFolder, + TemporaryFolder } SpecialFolderConst; typedef enum DriveTypeConst { - UnknownType = 0, - Removable = 1, - Fixed = 2, - Remote = 3, - CDRom = 4, - RamDisk = 5 + UnknownType, + Removable, + Fixed, + Remote, + CDRom, + RamDisk } DriveTypeConst; typedef enum StandardStreamTypes { - StdIn = 0, - StdOut = 1, - StdErr = 2 + StdIn, + StdOut, + StdErr } StandardStreamTypes; [ @@ -113,13 +104,13 @@ ] interface IDictionary : IDispatch { - [id(00000000), propputref] + [id(DISPID_VALUE), propputref] HRESULT Item([in] VARIANT* Key, [in] VARIANT* pRetItem); - [id(00000000), propput] + [id(DISPID_VALUE), propput] HRESULT Item([in] VARIANT* Key, [in] VARIANT* pRetItem); - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Item([in] VARIANT* Key, [out, retval] VARIANT* pRetItem); [id(0x00000001)] @@ -161,6 +152,191 @@ [ odl, + uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IDrive : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Path([out, retval] BSTR* pbstrPath); + + [id(0x00002710), propget] + HRESULT DriveLetter([out, retval] BSTR* pbstrLetter); + + [id(0x00002711), propget] + HRESULT ShareName([out, retval] BSTR* pbstrShareName); + + [id(0x00002712), propget] + HRESULT DriveType([out, retval] DriveTypeConst* pdt); + + [id(0x00002713), propget] + HRESULT RootFolder([out, retval] IFolder** ppfolder); + + [id(0x00002715), propget] + HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); + + [id(0x00002714), propget] + HRESULT FreeSpace([out, retval] VARIANT* pvarFree); + + [id(0x00002716), propget] + HRESULT TotalSize([out, retval] VARIANT* pvarTotal); + + [id(0x00002717), propget] + HRESULT VolumeName([out, retval] BSTR* pbstrName); + + [id(0x00002717), propput] + HRESULT VolumeName([in] BSTR pbstrName); + + [id(0x00002718), propget] + HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); + + [id(0x00002719), propget] + HRESULT SerialNumber([out, retval] long* pulSerialNumber); + + [id(0x0000271a), propget] + HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); + } + + [ + odl, + uuid(C7C3F5A1-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IDriveCollection : IDispatch { + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive); + + [id(DISPID_NEWENUM), propget, restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppenum); + + [id(0x00000001), propget] + HRESULT Count([out, retval] long* plCount); + } + + [ + odl, + uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), + hidden, + dual, + nonextensible, + oleautomation + ] + interface ITextStream : IDispatch + { + [id(0x00002710), propget] + HRESULT Line([out, retval] long* Line); + + [id(0xfffffdef), propget] + HRESULT Column([out, retval] long* Column); + + [id(0x00002712), propget] + HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); + + [id(0x00002713), propget] + HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); + + [id(0x00002714)] + HRESULT Read([in] long Characters, [out, retval] BSTR* Text); + + [id(0x00002715)] + HRESULT ReadLine([out, retval] BSTR* Text); + + [id(0x00002716)] + HRESULT ReadAll([out, retval] BSTR* Text); + + [id(0x00002717)] + HRESULT Write([in] BSTR Text); + + [id(0x00002718)] + HRESULT WriteLine([in, defaultvalue("")] BSTR Text); + + [id(0x00002719)] + HRESULT WriteBlankLines([in] long Lines); + + [id(0x0000271a)] + HRESULT Skip([in] long Characters); + + [id(0x0000271b)] + HRESULT SkipLine(); + + [id(0x0000271c)] + HRESULT Close(); + } + + [ + odl, + uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFile : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Path([out, retval] BSTR* pbstrPath); + + [id(0x000003e8), propget] + HRESULT Name([out, retval] BSTR* pbstrName); + + [id(0x000003e8), propput] + HRESULT Name([in] BSTR pbstrName); + + [id(0x000003ea), propget] + HRESULT ShortPath([out, retval] BSTR* pbstrPath); + + [id(0x000003e9), propget] + HRESULT ShortName([out, retval] BSTR* pbstrName); + + [id(0x000003ec), propget] + HRESULT Drive([out, retval] IDrive** ppdrive); + + [id(0x000003ed), propget] + HRESULT ParentFolder([out, retval] IFolder** ppfolder); + + [id(0x000003eb), propget] + HRESULT Attributes([out, retval] FileAttribute* pfa); + + [id(0x000003eb), propput] + HRESULT Attributes([in] FileAttribute pfa); + + [id(0x000003ee), propget] + HRESULT DateCreated([out, retval] DATE* pdate); + + [id(0x000003ef), propget] + HRESULT DateLastModified([out, retval] DATE* pdate); + + [id(0x000003f0), propget] + HRESULT DateLastAccessed([out, retval] DATE* pdate); + + [id(0x000003f1), propget] + HRESULT Size([out, retval] VARIANT* pvarSize); + + [id(0x000003f2), propget] + HRESULT Type([out, retval] BSTR* pbstrType); + + [id(0x000004b0)] + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); + + [id(0x000004b2)] + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + + [id(0x000004b4)] + HRESULT Move([in] BSTR Destination); + + [id(0x0000044c)] + HRESULT OpenAsTextStream([in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); + } + + [ + odl, uuid(0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0), hidden, dual, @@ -218,10 +394,10 @@ HRESULT GetSpecialFolder([in] SpecialFolderConst SpecialFolder, [out, retval] IFolder** ppfolder); [id(0x000004b0)] - HRESULT DeleteFile([in] BSTR FileSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT DeleteFile([in] BSTR FileSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b1)] - HRESULT DeleteFolder([in] BSTR FolderSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT DeleteFolder([in] BSTR FolderSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b4), helpstring("Move a file"), helpcontext(0x00214bab)] HRESULT MoveFile([in] BSTR Source, [in] BSTR Destination); @@ -231,37 +407,38 @@ [id(0x000004b2)] HRESULT CopyFile([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x000004b3)] HRESULT CopyFolder([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x00000460)] HRESULT CreateFolder([in] BSTR Path, [out, retval] IFolder** ppfolder); [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); [id(0x0000044c)] - HRESULT OpenTextFile([in] BSTR FileName, [in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] VARIANT_BOOL Create, - [in, optional, defaultvalue(0)] Tristate Format, + HRESULT OpenTextFile([in] BSTR FileName, [in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] VARIANT_BOOL Create, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); } [ odl, - uuid(C7C3F5A1-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IDriveCollection : IDispatch { - [id(00000000)] - HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive); + uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFileCollection : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); [id(DISPID_NEWENUM), propget, restricted, hidden] HRESULT _NewEnum([out, retval] IUnknown** ppenum); @@ -272,52 +449,25 @@ [ odl, - uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IDrive : IDispatch - { - [id(00000000), propget] - HRESULT Path([out, retval] BSTR* pbstrPath); - - [id(0x00002710), propget] - HRESULT DriveLetter([out, retval] BSTR* pbstrLetter) -; - [id(0x00002711), propget] - HRESULT ShareName([out, retval] BSTR* pbstrShareName); - - [id(0x00002712), propget] - HRESULT DriveType([out, retval] DriveTypeConst* pdt); - - [id(0x00002713), propget] - HRESULT RootFolder([out, retval] IFolder** ppfolder); - - [id(0x00002715), propget] - HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); - - [id(0x00002714), propget] - HRESULT FreeSpace([out, retval] VARIANT* pvarFree); - - [id(0x00002716), propget] - HRESULT TotalSize([out, retval] VARIANT* pvarTotal); - - [id(0x00002717), propget] - HRESULT VolumeName([out, retval] BSTR* pbstrName); - - [id(0x00002717), propput] - HRESULT VolumeName([in] BSTR pbstrName); - - [id(0x00002718), propget] - HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); - - [id(0x00002719), propget] - HRESULT SerialNumber([out, retval] long* pulSerialNumber); - - [id(0x0000271a), propget] - HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); + uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFolderCollection : IDispatch + { + [id(0x00000002)] + HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); + + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); + + [id(DISPID_NEWENUM), propget, restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppenum); + + [id(0x00000001), propget] + HRESULT Count([out, retval] long* plCount); } [ @@ -330,7 +480,7 @@ ] interface IFolder : IDispatch { - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Path([out, retval] BSTR* pbstrPath); [id(0x000003e8), propget] @@ -370,10 +520,10 @@ HRESULT Type([out, retval] BSTR* pbstrType); [id(0x000004b1)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b3)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x000004b5)] HRESULT Move([in] BSTR Destination); @@ -391,167 +541,8 @@ HRESULT Files([out, retval] IFileCollection** ppfiles); [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); - } - - [ - odl, - uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFolderCollection : IDispatch - { - [id(0x00000002)] - HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); - - [id(00000000), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); - - [id(DISPID_NEWENUM), propget, restricted, hidden] - HRESULT _NewEnum([out, retval] IUnknown** ppenum); - - [id(0x00000001), propget] - HRESULT Count([out, retval] long* plCount); - } - - [ - odl, - uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFileCollection : IDispatch - { - [id(00000000), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); - - [id(DISPID_NEWENUM), propget, restricted, hidden] - HRESULT _NewEnum([out, retval] IUnknown** ppenum); - - [id(0x00000001), propget] - HRESULT Count([out, retval] long* plCount); - } - - [ - odl, - uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFile : IDispatch - { - [id(00000000), propget] - HRESULT Path([out, retval] BSTR* pbstrPath); - - [id(0x000003e8), propget] - HRESULT Name([out, retval] BSTR* pbstrName); - - [id(0x000003e8), propput] - HRESULT Name([in] BSTR pbstrName); - - [id(0x000003ea), propget] - HRESULT ShortPath([out, retval] BSTR* pbstrPath); - - [id(0x000003e9), propget] - HRESULT ShortName([out, retval] BSTR* pbstrName); - - [id(0x000003ec), propget] - HRESULT Drive([out, retval] IDrive** ppdrive); - - [id(0x000003ed), propget] - HRESULT ParentFolder([out, retval] IFolder** ppfolder); - - [id(0x000003eb), propget] - HRESULT Attributes([out, retval] FileAttribute* pfa); - - [id(0x000003eb), propput] - HRESULT Attributes([in] FileAttribute pfa); - - [id(0x000003ee), propget] - HRESULT DateCreated([out, retval] DATE* pdate); - - [id(0x000003ef), propget] - HRESULT DateLastModified([out, retval] DATE* pdate); - - [id(0x000003f0), propget] - HRESULT DateLastAccessed([out, retval] DATE* pdate); - - [id(0x000003f1), propget] - HRESULT Size([out, retval] VARIANT* pvarSize); - - [id(0x000003f2), propget] - HRESULT Type([out, retval] BSTR* pbstrType); - - [id(0x000004b0)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); - - [id(0x000004b2)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); - - [id(0x000004b4)] - HRESULT Move([in] BSTR Destination); - - [id(0x0000044c)] - HRESULT OpenAsTextStream([in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); - } - - [ - odl, - uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), - hidden, - dual, - nonextensible, - oleautomation - ] - interface ITextStream : IDispatch - { - [id(0x00002710), propget] - HRESULT Line([out, retval] long* Line); - - [id(0xfffffdef), propget] - HRESULT Column([out, retval] long* Column); - - [id(0x00002712), propget] - HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); - - [id(0x00002713), propget] - HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); - - [id(0x00002714)] - HRESULT Read([in] long Characters, [out, retval] BSTR* Text); - - [id(0x00002715)] - HRESULT ReadLine([out, retval] BSTR* Text); - - [id(0x00002716)] - HRESULT ReadAll([out, retval] BSTR* Text); - - [id(0x00002717)] - HRESULT Write([in] BSTR Text); - - [id(0x00002718)] - HRESULT WriteLine([in, optional, defaultvalue("")] BSTR Text); - - [id(0x00002719)] - HRESULT WriteBlankLines([in] long Lines); - - [id(0x0000271a)] - HRESULT Skip([in] long Characters); - - [id(0x0000271b)] - HRESULT SkipLine(); - - [id(0x0000271c)] - HRESULT Close(); + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); } [ @@ -565,7 +556,7 @@ { [id(0x00004e20)] HRESULT GetStandardStream([in] StandardStreamTypes StandardStreamType, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); [id(0x00004e2a)] HRESULT GetFileVersion([in] BSTR FileName, [out, retval] BSTR* FileVersion); @@ -579,7 +570,7 @@ ] interface IScriptEncoder : IDispatch { - [id(00000000)] + [id(DISPID_VALUE)] HRESULT EncodeScriptFile([in] BSTR szExt, [in] BSTR bstrStreamIn, [in] long cFlags, [in] BSTR bstrDefaultLang, [out, retval] BSTR* pbstrStreamOut); }
10 years, 8 months
1
0
0
0
[akhaldi] 62953: [SCRRUN] * Sync with Wine 1.7.17. CORE-8080
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 24 16:00:09 2014 New Revision: 62953 URL:
http://svn.reactos.org/svn/reactos?rev=62953&view=rev
Log: [SCRRUN] * Sync with Wine 1.7.17. CORE-8080 Modified: trunk/reactos/dll/win32/scrrun/filesystem.c trunk/reactos/dll/win32/scrrun/scrrun.c trunk/reactos/dll/win32/scrrun/scrrun.idl trunk/reactos/dll/win32/scrrun/scrrun_private.h trunk/reactos/dll/win32/scrrun/scrrun_tlb.rgs trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/scrrun/filesystem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/scrrun/filesyste…
============================================================================== --- trunk/reactos/dll/win32/scrrun/filesystem.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/scrrun/filesystem.c [iso-8859-1] Thu Apr 24 16:00:09 2014 @@ -23,9 +23,66 @@ #include <ntsecapi.h> #include <wine/unicode.h> +static const WCHAR bsW[] = {'\\',0}; +static const WCHAR utf16bom = 0xfeff; + +struct foldercollection { + IFolderCollection IFolderCollection_iface; + LONG ref; + BSTR path; +}; + +struct filecollection { + IFileCollection IFileCollection_iface; + LONG ref; + BSTR path; +}; + +struct drivecollection { + IDriveCollection IDriveCollection_iface; + LONG ref; + DWORD drives; + LONG count; +}; + +struct enumdata { + union + { + struct + { + struct foldercollection *coll; + HANDLE find; + } foldercoll; + struct + { + struct filecollection *coll; + HANDLE find; + } filecoll; + struct + { + struct drivecollection *coll; + INT cur; + } drivecoll; + } u; +}; + +struct enumvariant { + IEnumVARIANT IEnumVARIANT_iface; + LONG ref; + + struct enumdata data; +}; + +struct drive { + IDrive IDrive_iface; + LONG ref; + BSTR root; +}; + struct folder { IFolder IFolder_iface; LONG ref; + BSTR path; }; struct file { @@ -40,6 +97,10 @@ LONG ref; IOMode mode; + BOOL unicode; + BOOL first_read; + LARGE_INTEGER size; + HANDLE file; }; enum iotype { @@ -47,6 +108,11 @@ IOWrite }; +static inline struct drive *impl_from_IDrive(IDrive *iface) +{ + return CONTAINING_RECORD(iface, struct drive, IDrive_iface); +} + static inline struct folder *impl_from_IFolder(IFolder *iface) { return CONTAINING_RECORD(iface, struct folder, IFolder_iface); @@ -60,6 +126,26 @@ static inline struct textstream *impl_from_ITextStream(ITextStream *iface) { return CONTAINING_RECORD(iface, struct textstream, ITextStream_iface); +} + +static inline struct foldercollection *impl_from_IFolderCollection(IFolderCollection *iface) +{ + return CONTAINING_RECORD(iface, struct foldercollection, IFolderCollection_iface); +} + +static inline struct filecollection *impl_from_IFileCollection(IFileCollection *iface) +{ + return CONTAINING_RECORD(iface, struct filecollection, IFileCollection_iface); +} + +static inline struct drivecollection *impl_from_IDriveCollection(IDriveCollection *iface) +{ + return CONTAINING_RECORD(iface, struct drivecollection, IDriveCollection_iface); +} + +static inline struct enumvariant *impl_from_IEnumVARIANT(IEnumVARIANT *iface) +{ + return CONTAINING_RECORD(iface, struct enumvariant, IEnumVARIANT_iface); } static inline HRESULT create_error(DWORD err) @@ -76,12 +162,45 @@ } } -static int textstream_check_iomode(struct textstream *This, enum iotype type) +static HRESULT create_folder(const WCHAR*, IFolder**); +static HRESULT create_file(BSTR, IFile**); +static HRESULT create_foldercoll_enum(struct foldercollection*, IUnknown**); +static HRESULT create_filecoll_enum(struct filecollection*, IUnknown**); + +static inline BOOL is_dir_data(const WIN32_FIND_DATAW *data) +{ + static const WCHAR dotdotW[] = {'.','.',0}; + static const WCHAR dotW[] = {'.',0}; + + return (data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && + strcmpW(data->cFileName, dotdotW) && + strcmpW(data->cFileName, dotW); +} + +static inline BOOL is_file_data(const WIN32_FIND_DATAW *data) +{ + return !(data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); +} + +static BSTR get_full_path(BSTR path, const WIN32_FIND_DATAW *data) +{ + int len = SysStringLen(path); + WCHAR buffW[MAX_PATH]; + + strcpyW(buffW, path); + if (path[len-1] != '\\') + strcatW(buffW, bsW); + strcatW(buffW, data->cFileName); + + return SysAllocString(buffW); +} + +static BOOL textstream_check_iomode(struct textstream *This, enum iotype type) { if (type == IORead) return This->mode == ForWriting || This->mode == ForAppending; else - return 1; + return This->mode == ForReading; } static HRESULT WINAPI textstream_QueryInterface(ITextStream *iface, REFIID riid, void **obj) @@ -118,7 +237,10 @@ TRACE("(%p)->(%d)\n", This, ref); if (!ref) + { + CloseHandle(This->file); heap_free(This); + } return ref; } @@ -199,8 +321,24 @@ static HRESULT WINAPI textstream_get_AtEndOfStream(ITextStream *iface, VARIANT_BOOL *eos) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, eos); - return E_NOTIMPL; + LARGE_INTEGER pos, dist; + + TRACE("(%p)->(%p)\n", This, eos); + + if (!eos) + return E_POINTER; + + if (textstream_check_iomode(This, IORead)) { + *eos = VARIANT_TRUE; + return CTL_E_BADFILEMODE; + } + + dist.QuadPart = 0; + if (!SetFilePointerEx(This->file, dist, &pos, FILE_CURRENT)) + return E_FAIL; + + *eos = This->size.QuadPart == pos.QuadPart ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI textstream_get_AtEndOfLine(ITextStream *iface, VARIANT_BOOL *eol) @@ -210,51 +348,252 @@ return E_NOTIMPL; } +/* + Reads 'toread' bytes from a file, converts if needed + BOM is skipped if 'bof' is set. + */ +static HRESULT textstream_read(struct textstream *stream, LONG toread, BOOL bof, BSTR *text) +{ + HRESULT hr = S_OK; + DWORD read; + char *buff; + BOOL ret; + + if (toread == 0) { + *text = SysAllocStringLen(NULL, 0); + return *text ? S_FALSE : E_OUTOFMEMORY; + } + + if (toread < sizeof(WCHAR)) + return CTL_E_ENDOFFILE; + + buff = heap_alloc(toread); + if (!buff) + return E_OUTOFMEMORY; + + ret = ReadFile(stream->file, buff, toread, &read, NULL); + if (!ret || toread != read) { + WARN("failed to read from file %d, %d, error %d\n", read, toread, GetLastError()); + heap_free(buff); + return E_FAIL; + } + + if (stream->unicode) { + int i = 0; + + /* skip BOM */ + if (bof && *(WCHAR*)buff == utf16bom) { + read -= sizeof(WCHAR); + i += sizeof(WCHAR); + } + + *text = SysAllocStringLen(read ? (WCHAR*)&buff[i] : NULL, read/sizeof(WCHAR)); + if (!*text) hr = E_OUTOFMEMORY; + } + else { + INT len = MultiByteToWideChar(CP_ACP, 0, buff, read, NULL, 0); + *text = SysAllocStringLen(NULL, len); + if (*text) + MultiByteToWideChar(CP_ACP, 0, buff, read, *text, len); + else + hr = E_OUTOFMEMORY; + } + heap_free(buff); + + return hr; +} + static HRESULT WINAPI textstream_Read(ITextStream *iface, LONG len, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, text); + LARGE_INTEGER start, end, dist; + DWORD toread; + HRESULT hr; + + TRACE("(%p)->(%d %p)\n", This, len, text); + + if (!text) + return E_POINTER; + + *text = NULL; + if (len <= 0) + return len == 0 ? S_OK : E_INVALIDARG; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; - return E_NOTIMPL; + if (!This->first_read) { + VARIANT_BOOL eos; + + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + } + + /* read everything from current position */ + dist.QuadPart = 0; + SetFilePointerEx(This->file, dist, &start, FILE_CURRENT); + SetFilePointerEx(This->file, dist, &end, FILE_END); + toread = end.QuadPart - start.QuadPart; + /* rewind back */ + dist.QuadPart = start.QuadPart; + SetFilePointerEx(This->file, dist, NULL, FILE_BEGIN); + + This->first_read = FALSE; + if (This->unicode) len *= sizeof(WCHAR); + + hr = textstream_read(This, min(toread, len), start.QuadPart == 0, text); + if (FAILED(hr)) + return hr; + else + return toread <= len ? S_FALSE : S_OK; } static HRESULT WINAPI textstream_ReadLine(ITextStream *iface, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); + VARIANT_BOOL eos; + HRESULT hr; + FIXME("(%p)->(%p): stub\n", This, text); + if (!text) + return E_POINTER; + + *text = NULL; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + return E_NOTIMPL; } static HRESULT WINAPI textstream_ReadAll(ITextStream *iface, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, text); - + LARGE_INTEGER start, end, dist; + DWORD toread; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, text); + + if (!text) + return E_POINTER; + + *text = NULL; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; - return E_NOTIMPL; + if (!This->first_read) { + VARIANT_BOOL eos; + + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + } + + /* read everything from current position */ + dist.QuadPart = 0; + SetFilePointerEx(This->file, dist, &start, FILE_CURRENT); + SetFilePointerEx(This->file, dist, &end, FILE_END); + toread = end.QuadPart - start.QuadPart; + /* rewind back */ + dist.QuadPart = start.QuadPart; + SetFilePointerEx(This->file, dist, NULL, FILE_BEGIN); + + This->first_read = FALSE; + + hr = textstream_read(This, toread, start.QuadPart == 0, text); + return FAILED(hr) ? hr : S_FALSE; +} + +static HRESULT textstream_writestr(struct textstream *stream, BSTR text) +{ + DWORD written = 0; + BOOL ret; + + if (stream->unicode) { + ret = WriteFile(stream->file, text, SysStringByteLen(text), &written, NULL); + return (ret && written == SysStringByteLen(text)) ? S_OK : create_error(GetLastError()); + } else { + DWORD len = WideCharToMultiByte(CP_ACP, 0, text, SysStringLen(text), NULL, 0, NULL, NULL); + char *buffA; + HRESULT hr; + + buffA = heap_alloc(len); + if (!buffA) + return E_OUTOFMEMORY; + + WideCharToMultiByte(CP_ACP, 0, text, SysStringLen(text), buffA, len, NULL, NULL); + ret = WriteFile(stream->file, buffA, len, &written, NULL); + hr = (ret && written == len) ? S_OK : create_error(GetLastError()); + heap_free(buffA); + return hr; + } } static HRESULT WINAPI textstream_Write(ITextStream *iface, BSTR text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%s): stub\n", This, debugstr_w(text)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(text)); + + if (textstream_check_iomode(This, IOWrite)) + return CTL_E_BADFILEMODE; + + return textstream_writestr(This, text); +} + +static HRESULT textstream_writecrlf(struct textstream *stream) +{ + static const WCHAR crlfW[] = {'\r','\n'}; + static const char crlfA[] = {'\r','\n'}; + DWORD written = 0, len; + const void *ptr; + BOOL ret; + + if (stream->unicode) { + ptr = crlfW; + len = sizeof(crlfW); + } + else { + ptr = crlfA; + len = sizeof(crlfA); + } + + ret = WriteFile(stream->file, ptr, len, &written, NULL); + return (ret && written == len) ? S_OK : create_error(GetLastError()); } static HRESULT WINAPI textstream_WriteLine(ITextStream *iface, BSTR text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%s): stub\n", This, debugstr_w(text)); - return E_NOTIMPL; + HRESULT hr; + + TRACE("(%p)->(%s)\n", This, debugstr_w(text)); + + if (textstream_check_iomode(This, IOWrite)) + return CTL_E_BADFILEMODE; + + hr = textstream_writestr(This, text); + if (SUCCEEDED(hr)) + hr = textstream_writecrlf(This); + return hr; } static HRESULT WINAPI textstream_WriteBlankLines(ITextStream *iface, LONG lines) @@ -308,9 +647,26 @@ textstream_Close }; -static HRESULT create_textstream(IOMode mode, ITextStream **ret) +static HRESULT create_textstream(const WCHAR *filename, DWORD disposition, IOMode mode, BOOL unicode, ITextStream **ret) { struct textstream *stream; + DWORD access = 0; + + /* map access mode */ + switch (mode) + { + case ForReading: + access = GENERIC_READ; + break; + case ForWriting: + access = GENERIC_WRITE; + break; + case ForAppending: + access = FILE_APPEND_DATA; + break; + default: + return E_INVALIDARG; + } stream = heap_alloc(sizeof(struct textstream)); if (!stream) return E_OUTOFMEMORY; @@ -318,11 +674,1354 @@ stream->ITextStream_iface.lpVtbl = &textstreamvtbl; stream->ref = 1; stream->mode = mode; + stream->unicode = unicode; + stream->first_read = TRUE; + + stream->file = CreateFileW(filename, access, 0, NULL, disposition, FILE_ATTRIBUTE_NORMAL, NULL); + if (stream->file == INVALID_HANDLE_VALUE) + { + HRESULT hr = create_error(GetLastError()); + heap_free(stream); + return hr; + } + + if (mode == ForReading) + GetFileSizeEx(stream->file, &stream->size); + else + stream->size.QuadPart = 0; + + /* Write Unicode BOM */ + if (unicode && mode == ForWriting && (disposition == CREATE_ALWAYS || disposition == CREATE_NEW)) { + DWORD written = 0; + BOOL ret = WriteFile(stream->file, &utf16bom, sizeof(utf16bom), &written, NULL); + if (!ret || written != sizeof(utf16bom)) { + ITextStream_Release(&stream->ITextStream_iface); + return create_error(GetLastError()); + } + } *ret = &stream->ITextStream_iface; return S_OK; } +static HRESULT WINAPI drive_QueryInterface(IDrive *iface, REFIID riid, void **obj) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IDrive ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown)) + { + *obj = iface; + IDrive_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI drive_AddRef(IDrive *iface) +{ + struct drive *This = impl_from_IDrive(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI drive_Release(IDrive *iface) +{ + struct drive *This = impl_from_IDrive(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + SysFreeString(This->root); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI drive_GetTypeInfoCount(IDrive *iface, UINT *pctinfo) +{ + struct drive *This = impl_from_IDrive(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI drive_GetTypeInfo(IDrive *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct drive *This = impl_from_IDrive(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IDrive_tid, ppTInfo); +} + +static HRESULT WINAPI drive_GetIDsOfNames(IDrive *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct drive *This = impl_from_IDrive(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IDrive_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drive_Invoke(IDrive *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct drive *This = impl_from_IDrive(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IDrive_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drive_get_Path(IDrive *iface, BSTR *path) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, path); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_DriveLetter(IDrive *iface, BSTR *letter) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%p)\n", This, letter); + + if (!letter) + return E_POINTER; + + *letter = SysAllocStringLen(This->root, 1); + if (!*letter) + return E_OUTOFMEMORY; + + return S_OK; +} + +static HRESULT WINAPI drive_get_ShareName(IDrive *iface, BSTR *share_name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, share_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_DriveType(IDrive *iface, DriveTypeConst *type) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%p)\n", This, type); + + switch (GetDriveTypeW(This->root)) + { + case DRIVE_REMOVABLE: + *type = Removable; + break; + case DRIVE_FIXED: + *type = Fixed; + break; + case DRIVE_REMOTE: + *type = Remote; + break; + case DRIVE_CDROM: + *type = CDRom; + break; + case DRIVE_RAMDISK: + *type = RamDisk; + break; + default: + *type = UnknownType; + break; + } + + return S_OK; +} + +static HRESULT WINAPI drive_get_RootFolder(IDrive *iface, IFolder **folder) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, folder); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_AvailableSpace(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER avail; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, &avail, NULL, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(avail.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_FreeSpace(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER freespace; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(freespace.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_TotalSize(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER total; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, NULL, &total, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(total.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_VolumeName(IDrive *iface, BSTR *name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, name); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_put_VolumeName(IDrive *iface, BSTR name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%s): stub\n", This, debugstr_w(name)); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_FileSystem(IDrive *iface, BSTR *fs) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, fs); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_SerialNumber(IDrive *iface, LONG *serial) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, serial); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_IsReady(IDrive *iface, VARIANT_BOOL *ready) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER freespace; + BOOL ret; + + TRACE("(%p)->(%p)\n", This, ready); + + if (!ready) + return E_POINTER; + + ret = GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL); + *ready = ret ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; +} + +static const IDriveVtbl drivevtbl = { + drive_QueryInterface, + drive_AddRef, + drive_Release, + drive_GetTypeInfoCount, + drive_GetTypeInfo, + drive_GetIDsOfNames, + drive_Invoke, + drive_get_Path, + drive_get_DriveLetter, + drive_get_ShareName, + drive_get_DriveType, + drive_get_RootFolder, + drive_get_AvailableSpace, + drive_get_FreeSpace, + drive_get_TotalSize, + drive_get_VolumeName, + drive_put_VolumeName, + drive_get_FileSystem, + drive_get_SerialNumber, + drive_get_IsReady +}; + +static HRESULT create_drive(WCHAR letter, IDrive **drive) +{ + struct drive *This; + + *drive = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IDrive_iface.lpVtbl = &drivevtbl; + This->ref = 1; + This->root = SysAllocStringLen(NULL, 3); + if (!This->root) + { + heap_free(This); + return E_OUTOFMEMORY; + } + This->root[0] = letter; + This->root[1] = ':'; + This->root[2] = '\\'; + This->root[3] = 0; + + *drive = &This->IDrive_iface; + return S_OK; +} + +static HRESULT WINAPI enumvariant_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **obj) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IEnumVARIANT ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IEnumVARIANT_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI enumvariant_AddRef(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI foldercoll_enumvariant_Release(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + IFolderCollection_Release(&This->data.u.foldercoll.coll->IFolderCollection_iface); + FindClose(This->data.u.foldercoll.find); + heap_free(This); + } + + return ref; +} + +static HANDLE start_enumeration(const WCHAR *path, WIN32_FIND_DATAW *data, BOOL file) +{ + static const WCHAR allW[] = {'*',0}; + WCHAR pathW[MAX_PATH]; + int len; + HANDLE handle; + + strcpyW(pathW, path); + len = strlenW(pathW); + if (pathW[len-1] != '\\') + strcatW(pathW, bsW); + strcatW(pathW, allW); + handle = FindFirstFileW(pathW, data); + if (handle == INVALID_HANDLE_VALUE) return 0; + + /* find first dir/file */ + while (1) + { + if (file ? is_file_data(data) : is_dir_data(data)) + break; + + if (!FindNextFileW(handle, data)) + { + FindClose(handle); + return 0; + } + } + return handle; +} + +static HRESULT WINAPI foldercoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.foldercoll.find; + WIN32_FIND_DATAW data; + ULONG count = 0; + + TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched); + + if (fetched) + *fetched = 0; + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.foldercoll.coll->path, &data, FALSE); + if (!handle) return S_FALSE; + + This->data.u.foldercoll.find = handle; + } + else + { + if (!FindNextFileW(handle, &data)) + return S_FALSE; + } + + do + { + if (is_dir_data(&data)) + { + IFolder *folder; + HRESULT hr; + BSTR str; + + str = get_full_path(This->data.u.foldercoll.coll->path, &data); + hr = create_folder(str, &folder); + SysFreeString(str); + if (FAILED(hr)) return hr; + + V_VT(&var[count]) = VT_DISPATCH; + V_DISPATCH(&var[count]) = (IDispatch*)folder; + count++; + + if (count >= celt) break; + } + } while (FindNextFileW(handle, &data)); + + if (fetched) + *fetched = count; + + return (count < celt) ? S_FALSE : S_OK; +} + +static HRESULT WINAPI foldercoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.foldercoll.find; + WIN32_FIND_DATAW data; + + TRACE("(%p)->(%d)\n", This, celt); + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.foldercoll.coll->path, &data, FALSE); + if (!handle) return S_FALSE; + + This->data.u.foldercoll.find = handle; + } + else + { + if (!FindNextFileW(handle, &data)) + return S_FALSE; + } + + do + { + if (is_dir_data(&data)) + --celt; + + if (!celt) break; + } while (FindNextFileW(handle, &data)); + + return celt ? S_FALSE : S_OK; +} + +static HRESULT WINAPI foldercoll_enumvariant_Reset(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)\n", This); + + FindClose(This->data.u.foldercoll.find); + This->data.u.foldercoll.find = NULL; + + return S_OK; +} + +static HRESULT WINAPI foldercoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + TRACE("(%p)->(%p)\n", This, pclone); + return create_foldercoll_enum(This->data.u.foldercoll.coll, (IUnknown**)pclone); +} + +static const IEnumVARIANTVtbl foldercollenumvariantvtbl = { + enumvariant_QueryInterface, + enumvariant_AddRef, + foldercoll_enumvariant_Release, + foldercoll_enumvariant_Next, + foldercoll_enumvariant_Skip, + foldercoll_enumvariant_Reset, + foldercoll_enumvariant_Clone +}; + +static HRESULT create_foldercoll_enum(struct foldercollection *collection, IUnknown **newenum) +{ + struct enumvariant *This; + + *newenum = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumVARIANT_iface.lpVtbl = &foldercollenumvariantvtbl; + This->ref = 1; + This->data.u.foldercoll.find = NULL; + This->data.u.foldercoll.coll = collection; + IFolderCollection_AddRef(&collection->IFolderCollection_iface); + + *newenum = (IUnknown*)&This->IEnumVARIANT_iface; + + return S_OK; +} + +static ULONG WINAPI filecoll_enumvariant_Release(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + IFileCollection_Release(&This->data.u.filecoll.coll->IFileCollection_iface); + FindClose(This->data.u.filecoll.find); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI filecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.filecoll.find; + WIN32_FIND_DATAW data; + ULONG count = 0; + + TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched); + + if (fetched) + *fetched = 0; + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.filecoll.coll->path, &data, TRUE); + if (!handle) return S_FALSE; + This->data.u.filecoll.find = handle; + } + else if (!FindNextFileW(handle, &data)) + return S_FALSE; + + do + { + if (is_file_data(&data)) + { + IFile *file; + HRESULT hr; + BSTR str; + + str = get_full_path(This->data.u.filecoll.coll->path, &data); + hr = create_file(str, &file); + SysFreeString(str); + if (FAILED(hr)) return hr; + + V_VT(&var[count]) = VT_DISPATCH; + V_DISPATCH(&var[count]) = (IDispatch*)file; + if (++count >= celt) break; + } + } while (FindNextFileW(handle, &data)); + + if (fetched) + *fetched = count; + + return (count < celt) ? S_FALSE : S_OK; +} + +static HRESULT WINAPI filecoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.filecoll.find; + WIN32_FIND_DATAW data; + + TRACE("(%p)->(%d)\n", This, celt); + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.filecoll.coll->path, &data, TRUE); + if (!handle) return S_FALSE; + This->data.u.filecoll.find = handle; + } + else if (!FindNextFileW(handle, &data)) + return S_FALSE; + + do + { + if (is_file_data(&data)) + --celt; + } while (celt && FindNextFileW(handle, &data)); + + return celt ? S_FALSE : S_OK; +} + +static HRESULT WINAPI filecoll_enumvariant_Reset(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)\n", This); + + FindClose(This->data.u.filecoll.find); + This->data.u.filecoll.find = NULL; + + return S_OK; +} + +static HRESULT WINAPI filecoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + TRACE("(%p)->(%p)\n", This, pclone); + return create_filecoll_enum(This->data.u.filecoll.coll, (IUnknown**)pclone); +} + +static const IEnumVARIANTVtbl filecollenumvariantvtbl = { + enumvariant_QueryInterface, + enumvariant_AddRef, + filecoll_enumvariant_Release, + filecoll_enumvariant_Next, + filecoll_enumvariant_Skip, + filecoll_enumvariant_Reset, + filecoll_enumvariant_Clone +}; + +static HRESULT create_filecoll_enum(struct filecollection *collection, IUnknown **newenum) +{ + struct enumvariant *This; + + *newenum = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumVARIANT_iface.lpVtbl = &filecollenumvariantvtbl; + This->ref = 1; + This->data.u.filecoll.find = NULL; + This->data.u.filecoll.coll = collection; + IFileCollection_AddRef(&collection->IFileCollection_iface); + + *newenum = (IUnknown*)&This->IEnumVARIANT_iface; + + return S_OK; +} + +static ULONG WINAPI drivecoll_enumvariant_Release(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + IDriveCollection_Release(&This->data.u.drivecoll.coll->IDriveCollection_iface); + heap_free(This); + } + + return ref; +} + +static HRESULT find_next_drive(struct enumvariant *penum) +{ + int i = penum->data.u.drivecoll.cur == -1 ? 0 : penum->data.u.drivecoll.cur + 1; + + for (; i < 32; i++) + if (penum->data.u.drivecoll.coll->drives & (1 << i)) + { + penum->data.u.drivecoll.cur = i; + return S_OK; + } + + return S_FALSE; +} + +static HRESULT WINAPI drivecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG count = 0; + + TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched); + + if (fetched) + *fetched = 0; + + if (!celt) return S_OK; + + while (find_next_drive(This) == S_OK) + { + IDrive *drive; + HRESULT hr; + + hr = create_drive('A' + This->data.u.drivecoll.cur, &drive); + if (FAILED(hr)) return hr; + + V_VT(&var[count]) = VT_DISPATCH; + V_DISPATCH(&var[count]) = (IDispatch*)drive; + + if (++count >= celt) break; + } + + if (fetched) + *fetched = count; + + return (count < celt) ? S_FALSE : S_OK; +} + +static HRESULT WINAPI drivecoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)->(%d)\n", This, celt); + + if (!celt) return S_OK; + + while (celt && find_next_drive(This) == S_OK) + celt--; + + return celt ? S_FALSE : S_OK; +} + +static HRESULT WINAPI drivecoll_enumvariant_Reset(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)\n", This); + + This->data.u.drivecoll.cur = -1; + return S_OK; +} + +static HRESULT WINAPI drivecoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + FIXME("(%p)->(%p): stub\n", This, pclone); + return E_NOTIMPL; +} + +static const IEnumVARIANTVtbl drivecollenumvariantvtbl = { + enumvariant_QueryInterface, + enumvariant_AddRef, + drivecoll_enumvariant_Release, + drivecoll_enumvariant_Next, + drivecoll_enumvariant_Skip, + drivecoll_enumvariant_Reset, + drivecoll_enumvariant_Clone +}; + +static HRESULT create_drivecoll_enum(struct drivecollection *collection, IUnknown **newenum) +{ + struct enumvariant *This; + + *newenum = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumVARIANT_iface.lpVtbl = &drivecollenumvariantvtbl; + This->ref = 1; + This->data.u.drivecoll.coll = collection; + This->data.u.drivecoll.cur = -1; + IDriveCollection_AddRef(&collection->IDriveCollection_iface); + + *newenum = (IUnknown*)&This->IEnumVARIANT_iface; + + return S_OK; +} + +static HRESULT WINAPI foldercoll_QueryInterface(IFolderCollection *iface, REFIID riid, void **obj) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IFolderCollection ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IFolderCollection_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI foldercoll_AddRef(IFolderCollection *iface) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI foldercoll_Release(IFolderCollection *iface) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + SysFreeString(This->path); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI foldercoll_GetTypeInfoCount(IFolderCollection *iface, UINT *pctinfo) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI foldercoll_GetTypeInfo(IFolderCollection *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IFolderCollection_tid, ppTInfo); +} + +static HRESULT WINAPI foldercoll_GetIDsOfNames(IFolderCollection *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IFolderCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI foldercoll_Invoke(IFolderCollection *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IFolderCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI foldercoll_Add(IFolderCollection *iface, BSTR name, IFolder **folder) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(name), folder); + return E_NOTIMPL; +} + +static HRESULT WINAPI foldercoll_get_Item(IFolderCollection *iface, VARIANT key, IFolder **folder) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + FIXME("(%p)->(%p): stub\n", This, folder); + return E_NOTIMPL; +} + +static HRESULT WINAPI foldercoll_get__NewEnum(IFolderCollection *iface, IUnknown **newenum) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + + TRACE("(%p)->(%p)\n", This, newenum); + + if(!newenum) + return E_POINTER; + + return create_foldercoll_enum(This, newenum); +} + +static HRESULT WINAPI foldercoll_get_Count(IFolderCollection *iface, LONG *count) +{ + struct foldercollection *This = impl_from_IFolderCollection(iface); + static const WCHAR allW[] = {'\\','*',0}; + WIN32_FIND_DATAW data; + WCHAR pathW[MAX_PATH]; + HANDLE handle; + + TRACE("(%p)->(%p)\n", This, count); + + if(!count) + return E_POINTER; + + *count = 0; + + strcpyW(pathW, This->path); + strcatW(pathW, allW); + handle = FindFirstFileW(pathW, &data); + if (handle == INVALID_HANDLE_VALUE) + return HRESULT_FROM_WIN32(GetLastError()); + + do + { + if (is_dir_data(&data)) + *count += 1; + } while (FindNextFileW(handle, &data)); + FindClose(handle); + + return S_OK; +} + +static const IFolderCollectionVtbl foldercollvtbl = { + foldercoll_QueryInterface, + foldercoll_AddRef, + foldercoll_Release, + foldercoll_GetTypeInfoCount, + foldercoll_GetTypeInfo, + foldercoll_GetIDsOfNames, + foldercoll_Invoke, + foldercoll_Add, + foldercoll_get_Item, + foldercoll_get__NewEnum, + foldercoll_get_Count +}; + +static HRESULT create_foldercoll(BSTR path, IFolderCollection **folders) +{ + struct foldercollection *This; + + *folders = NULL; + + This = heap_alloc(sizeof(struct foldercollection)); + if (!This) return E_OUTOFMEMORY; + + This->IFolderCollection_iface.lpVtbl = &foldercollvtbl; + This->ref = 1; + This->path = SysAllocString(path); + if (!This->path) + { + heap_free(This); + return E_OUTOFMEMORY; + } + + *folders = &This->IFolderCollection_iface; + + return S_OK; +} + +static HRESULT WINAPI filecoll_QueryInterface(IFileCollection *iface, REFIID riid, void **obj) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IFileCollection ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IFileCollection_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI filecoll_AddRef(IFileCollection *iface) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI filecoll_Release(IFileCollection *iface) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + SysFreeString(This->path); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI filecoll_GetTypeInfoCount(IFileCollection *iface, UINT *pctinfo) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI filecoll_GetTypeInfo(IFileCollection *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IFileCollection_tid, ppTInfo); +} + +static HRESULT WINAPI filecoll_GetIDsOfNames(IFileCollection *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IFileCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI filecoll_Invoke(IFileCollection *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IFileCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI filecoll_get_Item(IFileCollection *iface, VARIANT Key, IFile **file) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + FIXME("(%p)->(%p)\n", This, file); + return E_NOTIMPL; +} + +static HRESULT WINAPI filecoll_get__NewEnum(IFileCollection *iface, IUnknown **ppenum) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + + TRACE("(%p)->(%p)\n", This, ppenum); + + if(!ppenum) + return E_POINTER; + + return create_filecoll_enum(This, ppenum); +} + +static HRESULT WINAPI filecoll_get_Count(IFileCollection *iface, LONG *count) +{ + struct filecollection *This = impl_from_IFileCollection(iface); + FIXME("(%p)->(%p)\n", This, count); + return E_NOTIMPL; +} + +static const IFileCollectionVtbl filecollectionvtbl = { + filecoll_QueryInterface, + filecoll_AddRef, + filecoll_Release, + filecoll_GetTypeInfoCount, + filecoll_GetTypeInfo, + filecoll_GetIDsOfNames, + filecoll_Invoke, + filecoll_get_Item, + filecoll_get__NewEnum, + filecoll_get_Count +}; + +static HRESULT create_filecoll(BSTR path, IFileCollection **files) +{ + struct filecollection *This; + + *files = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IFileCollection_iface.lpVtbl = &filecollectionvtbl; + This->ref = 1; + This->path = SysAllocString(path); + if (!This->path) + { + heap_free(This); + return E_OUTOFMEMORY; + } + + *files = &This->IFileCollection_iface; + return S_OK; +} + +static HRESULT WINAPI drivecoll_QueryInterface(IDriveCollection *iface, REFIID riid, void **obj) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IDriveCollection ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IDriveCollection_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI drivecoll_AddRef(IDriveCollection *iface) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI drivecoll_Release(IDriveCollection *iface) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + heap_free(This); + + return ref; +} + +static HRESULT WINAPI drivecoll_GetTypeInfoCount(IDriveCollection *iface, UINT *pctinfo) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI drivecoll_GetTypeInfo(IDriveCollection *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IDriveCollection_tid, ppTInfo); +} + +static HRESULT WINAPI drivecoll_GetIDsOfNames(IDriveCollection *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IDriveCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drivecoll_Invoke(IDriveCollection *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IDriveCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drivecoll_get_Item(IDriveCollection *iface, VARIANT key, IDrive **drive) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + FIXME("(%p)->(%p): stub\n", This, drive); + return E_NOTIMPL; +} + +static HRESULT WINAPI drivecoll_get__NewEnum(IDriveCollection *iface, IUnknown **ppenum) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%p)\n", This, ppenum); + + if(!ppenum) + return E_POINTER; + + return create_drivecoll_enum(This, ppenum); +} + +static HRESULT WINAPI drivecoll_get_Count(IDriveCollection *iface, LONG *count) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%p)\n", This, count); + + if (!count) return E_POINTER; + + *count = This->count; + return S_OK; +} + +static const IDriveCollectionVtbl drivecollectionvtbl = { + drivecoll_QueryInterface, + drivecoll_AddRef, + drivecoll_Release, + drivecoll_GetTypeInfoCount, + drivecoll_GetTypeInfo, + drivecoll_GetIDsOfNames, + drivecoll_Invoke, + drivecoll_get_Item, + drivecoll_get__NewEnum, + drivecoll_get_Count +}; + +static HRESULT create_drivecoll(IDriveCollection **drives) +{ + struct drivecollection *This; + DWORD mask; + + *drives = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IDriveCollection_iface.lpVtbl = &drivecollectionvtbl; + This->ref = 1; + This->drives = mask = GetLogicalDrives(); + /* count set bits */ + for (This->count = 0; mask; This->count++) + mask &= mask - 1; + + *drives = &This->IDriveCollection_iface; + return S_OK; +} + static HRESULT WINAPI folder_QueryInterface(IFolder *iface, REFIID riid, void **obj) { struct folder *This = impl_from_IFolder(iface); @@ -331,8 +2030,9 @@ *obj = NULL; - if (IsEqualGUID( riid, &IID_IFolder ) || - IsEqualGUID( riid, &IID_IUnknown)) + if (IsEqualIID( riid, &IID_IFolder ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown)) { *obj = iface; IFolder_AddRef(iface); @@ -358,7 +2058,10 @@ TRACE("(%p)->(%d)\n", This, ref); if (!ref) + { + SysFreeString(This->path); heap_free(This); + } return ref; } @@ -425,38 +2128,62 @@ static HRESULT WINAPI folder_get_Path(IFolder *iface, BSTR *path) { struct folder *This = impl_from_IFolder(iface); + + TRACE("(%p)->(%p)\n", This, path); + + if(!path) + return E_POINTER; + + *path = SysAllocString(This->path); + return *path ? S_OK : E_OUTOFMEMORY; +} + +static HRESULT WINAPI folder_get_Name(IFolder *iface, BSTR *name) +{ + struct folder *This = impl_from_IFolder(iface); + WCHAR *ptr; + + TRACE("(%p)->(%p)\n", This, name); + + if(!name) + return E_POINTER; + + *name = NULL; + + ptr = strrchrW(This->path, '\\'); + if (ptr) + { + *name = SysAllocString(ptr+1); + TRACE("%s\n", debugstr_w(*name)); + if (!*name) return E_OUTOFMEMORY; + } + else + return E_FAIL; + + return S_OK; +} + +static HRESULT WINAPI folder_put_Name(IFolder *iface, BSTR name) +{ + struct folder *This = impl_from_IFolder(iface); + FIXME("(%p)->(%s): stub\n", This, debugstr_w(name)); + return E_NOTIMPL; +} + +static HRESULT WINAPI folder_get_ShortPath(IFolder *iface, BSTR *path) +{ + struct folder *This = impl_from_IFolder(iface); FIXME("(%p)->(%p): stub\n", This, path); return E_NOTIMPL; } -static HRESULT WINAPI folder_get_Name(IFolder *iface, BSTR *name) +static HRESULT WINAPI folder_get_ShortName(IFolder *iface, BSTR *name) { struct folder *This = impl_from_IFolder(iface); FIXME("(%p)->(%p): stub\n", This, name); return E_NOTIMPL; } -static HRESULT WINAPI folder_put_Name(IFolder *iface, BSTR name) -{ - struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%s): stub\n", This, debugstr_w(name)); - return E_NOTIMPL; -} - -static HRESULT WINAPI folder_get_ShortPath(IFolder *iface, BSTR *path) -{ - struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, path); - return E_NOTIMPL; -} - -static HRESULT WINAPI folder_get_ShortName(IFolder *iface, BSTR *name) -{ - struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, name); - return E_NOTIMPL; -} - static HRESULT WINAPI folder_get_Drive(IFolder *iface, IDrive **drive) { struct folder *This = impl_from_IFolder(iface); @@ -551,15 +2278,25 @@ static HRESULT WINAPI folder_get_SubFolders(IFolder *iface, IFolderCollection **folders) { struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, folders); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, folders); + + if(!folders) + return E_POINTER; + + return create_foldercoll(This->path, folders); } static HRESULT WINAPI folder_get_Files(IFolder *iface, IFileCollection **files) { struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, files); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, files); + + if(!files) + return E_POINTER; + + return create_filecoll(This->path, files); } static HRESULT WINAPI folder_CreateTextFile(IFolder *iface, BSTR filename, VARIANT_BOOL overwrite, @@ -601,15 +2338,25 @@ folder_CreateTextFile }; -static HRESULT create_folder(IFolder **folder) +HRESULT create_folder(const WCHAR *path, IFolder **folder) { struct folder *This; + + *folder = NULL; + + TRACE("%s\n", debugstr_w(path)); This = heap_alloc(sizeof(struct folder)); if (!This) return E_OUTOFMEMORY; This->IFolder_iface.lpVtbl = &foldervtbl; This->ref = 1; + This->path = SysAllocString(path); + if (!This->path) + { + heap_free(This); + return E_OUTOFMEMORY; + } *folder = &This->IFolder_iface; @@ -653,7 +2400,10 @@ TRACE("(%p) ref=%d\n", This, ref); if(!ref) + { heap_free(This->path); + heap_free(This); + } return ref; } @@ -722,11 +2472,29 @@ return E_NOTIMPL; } -static HRESULT WINAPI file_get_Name(IFile *iface, BSTR *pbstrName) +static HRESULT WINAPI file_get_Name(IFile *iface, BSTR *name) { struct file *This = impl_from_IFile(iface); - FIXME("(%p)->(%p)\n", This, pbstrName); - return E_NOTIMPL; + WCHAR *ptr; + + TRACE("(%p)->(%p)\n", This, name); + + if(!name) + return E_POINTER; + + *name = NULL; + + ptr = strrchrW(This->path, '\\'); + if (ptr) + { + *name = SysAllocString(ptr+1); + TRACE("%s\n", debugstr_w(*name)); + if (!*name) return E_OUTOFMEMORY; + } + else + return E_FAIL; + + return S_OK; } static HRESULT WINAPI file_put_Name(IFile *iface, BSTR pbstrName) @@ -866,11 +2634,18 @@ return E_NOTIMPL; } -static HRESULT WINAPI file_OpenAsTextStream(IFile *iface, IOMode IOMode, Tristate Format, ITextStream **ppts) +static HRESULT WINAPI file_OpenAsTextStream(IFile *iface, IOMode mode, Tristate format, ITextStream **stream) { struct file *This = impl_from_IFile(iface); - FIXME("(%p)->(%x %x %p)\n", This, IOMode, Format, ppts); - return E_NOTIMPL; + + TRACE("(%p)->(%d %d %p)\n", This, mode, format, stream); + + if (format == TristateUseDefault) { + FIXME("default format not handled, defaulting to unicode\n"); + format = TristateTrue; + } + + return create_textstream(This->path, OPEN_EXISTING, mode, format == TristateTrue, stream); } static const IFileVtbl file_vtbl = { @@ -1054,17 +2829,66 @@ static HRESULT WINAPI filesys_get_Drives(IFileSystem3 *iface, IDriveCollection **ppdrives) { - FIXME("%p %p\n", iface, ppdrives); - - return E_NOTIMPL; + TRACE("%p %p\n", iface, ppdrives); + return create_drivecoll(ppdrives); } static HRESULT WINAPI filesys_BuildPath(IFileSystem3 *iface, BSTR Path, - BSTR Name, BSTR *pbstrResult) -{ - FIXME("%p %s %s %p\n", iface, debugstr_w(Path), debugstr_w(Name), pbstrResult); - - return E_NOTIMPL; + BSTR Name, BSTR *Result) +{ + BSTR ret; + + TRACE("%p %s %s %p\n", iface, debugstr_w(Path), debugstr_w(Name), Result); + + if (!Result) return E_POINTER; + + if (Path && Name) + { + int path_len = SysStringLen(Path), name_len = SysStringLen(Name); + + /* if both parts have backslashes strip one from Path */ + if (Path[path_len-1] == '\\' && Name[0] == '\\') + { + path_len -= 1; + + ret = SysAllocStringLen(NULL, path_len + name_len); + if (ret) + { + strcpyW(ret, Path); + ret[path_len] = 0; + strcatW(ret, Name); + } + } + else if (Path[path_len-1] != '\\' && Name[0] != '\\') + { + ret = SysAllocStringLen(NULL, path_len + name_len + 1); + if (ret) + { + strcpyW(ret, Path); + if (Path[path_len-1] != ':') + strcatW(ret, bsW); + strcatW(ret, Name); + } + } + else + { + ret = SysAllocStringLen(NULL, path_len + name_len); + if (ret) + { + strcpyW(ret, Path); + strcatW(ret, Name); + } + } + } + else if (Path || Name) + ret = SysAllocString(Path ? Path : Name); + else + ret = SysAllocStringLen(NULL, 0); + + if (!ret) return E_OUTOFMEMORY; + *Result = ret; + + return S_OK; } static HRESULT WINAPI filesys_GetDriveName(IFileSystem3 *iface, BSTR Path, @@ -1334,11 +3158,24 @@ } static HRESULT WINAPI filesys_GetFolder(IFileSystem3 *iface, BSTR FolderPath, - IFolder **ppfolder) -{ - FIXME("%p %s %p\n", iface, debugstr_w(FolderPath), ppfolder); - - return E_NOTIMPL; + IFolder **folder) +{ + DWORD attrs; + + TRACE("%p %s %p\n", iface, debugstr_w(FolderPath), folder); + + if(!folder) + return E_POINTER; + + *folder = NULL; + if(!FolderPath) + return E_INVALIDARG; + + attrs = GetFileAttributesW(FolderPath); + if((attrs == INVALID_FILE_ATTRIBUTES) || !(attrs & FILE_ATTRIBUTE_DIRECTORY)) + return CTL_E_PATHNOTFOUND; + + return create_folder(FolderPath, folder); } static HRESULT WINAPI filesys_GetSpecialFolder(IFileSystem3 *iface, @@ -1530,8 +3367,10 @@ return CTL_E_FILENOTFOUND; src_len = get_parent_folder_name(source, source_len); - if(src_len+1 >= MAX_PATH) + if(src_len+1 >= MAX_PATH) { + FindClose(f); return E_FAIL; + } if(src_len) { memcpy(src_path, source, src_len*sizeof(WCHAR)); src_path[src_len++] = '\\'; @@ -1674,10 +3513,9 @@ FindClose(f); return CTL_E_FILEALREADYEXISTS; } - }else { - FindClose(f); - return create_error(GetLastError()); } + + FindClose(f); return create_error(GetLastError()); } copied = TRUE; @@ -1726,24 +3564,36 @@ return HRESULT_FROM_WIN32(GetLastError()); } - return create_folder(folder); -} - -static HRESULT WINAPI filesys_CreateTextFile(IFileSystem3 *iface, BSTR FileName, - VARIANT_BOOL Overwrite, VARIANT_BOOL Unicode, - ITextStream **ppts) -{ - FIXME("%p %s %d %d %p\n", iface, debugstr_w(FileName), Overwrite, Unicode, ppts); - - return E_NOTIMPL; + return create_folder(path, folder); +} + +static HRESULT WINAPI filesys_CreateTextFile(IFileSystem3 *iface, BSTR filename, + VARIANT_BOOL overwrite, VARIANT_BOOL unicode, + ITextStream **stream) +{ + DWORD disposition; + + TRACE("%p %s %d %d %p\n", iface, debugstr_w(filename), overwrite, unicode, stream); + + disposition = overwrite == VARIANT_TRUE ? CREATE_ALWAYS : CREATE_NEW; + return create_textstream(filename, disposition, ForWriting, !!unicode, stream); } static HRESULT WINAPI filesys_OpenTextFile(IFileSystem3 *iface, BSTR filename, IOMode mode, VARIANT_BOOL create, Tristate format, ITextStream **stream) { - FIXME("(%p)->(%s %d %d %d %p)\n", iface, debugstr_w(filename), mode, create, format, stream); - return create_textstream(mode, stream); + DWORD disposition; + + TRACE("(%p)->(%s %d %d %d %p)\n", iface, debugstr_w(filename), mode, create, format, stream); + disposition = create == VARIANT_TRUE ? OPEN_ALWAYS : OPEN_EXISTING; + + if (format == TristateUseDefault) { + FIXME("default format not handled, defaulting to unicode\n"); + format = TristateTrue; + } + + return create_textstream(filename, disposition, mode, format == TristateTrue, stream); } static HRESULT WINAPI filesys_GetStandardStream(IFileSystem3 *iface, @@ -1758,7 +3608,7 @@ static void get_versionstring(VS_FIXEDFILEINFO *info, WCHAR *ver) { - static WCHAR fmtW[] = {'%','d','.','%','d','.','%','d','.','%','d',0}; + static const WCHAR fmtW[] = {'%','d','.','%','d','.','%','d','.','%','d',0}; DWORDLONG version; WORD a, b, c, d; Modified: trunk/reactos/dll/win32/scrrun/scrrun.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/scrrun/scrrun.c?…
============================================================================== --- trunk/reactos/dll/win32/scrrun/scrrun.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/scrrun/scrrun.c [iso-8859-1] Thu Apr 24 16:00:09 2014 @@ -90,9 +90,14 @@ static REFIID tid_ids[] = { &IID_NULL, &IID_IDictionary, + &IID_IDrive, + &IID_IDriveCollection, + &IID_IFile, + &IID_IFileCollection, &IID_IFileSystem3, &IID_IFolder, - &IID_IFile + &IID_IFolderCollection, + &IID_ITextStream }; static HRESULT load_typelib(void) Modified: trunk/reactos/dll/win32/scrrun/scrrun.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/scrrun/scrrun.id…
============================================================================== --- trunk/reactos/dll/win32/scrrun/scrrun.idl [iso-8859-1] (original) +++ trunk/reactos/dll/win32/scrrun/scrrun.idl [iso-8859-1] Thu Apr 24 16:00:09 2014 @@ -15,6 +15,9 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ + +#pragma makedep regtypelib + import "unknwn.idl"; import "objidl.idl"; import "oaidl.idl"; @@ -24,6 +27,7 @@ cpp_quote("#undef DeleteFile") cpp_quote("#undef MoveFile") cpp_quote("#endif") +cpp_quote("#define CTL_E_ENDOFFILE STD_CTL_SCODE(62)") /* this is not defined in public headers */ [ uuid(420B2830-E718-11CF-893D-00A0C9054228), @@ -33,23 +37,13 @@ { importlib("stdole2.tlb"); - interface IDictionary; - interface IDrive; - interface IDriveCollection; - interface IFile; - interface IFileCollection; - interface IFileSystem; - interface IFileSystem3; interface IFolder; - interface IFolderCollection; - interface IScriptEncoder; - interface ITextStream; typedef enum CompareMethod { - BinaryCompare = 0, - TextCompare = 1, - DatabaseCompare = 2 + BinaryCompare, + TextCompare, + DatabaseCompare } CompareMethod; typedef enum IOMode @@ -61,10 +55,10 @@ typedef enum Tristate { - TristateTrue = 0xffffffff, - TristateFalse = 0, - TristateUseDefault = 0xfffffffe, - TristateMixed = 0xfffffffe + TristateTrue = -1, + TristateFalse = 0, + TristateUseDefault = -2, + TristateMixed = -2 } Tristate; typedef enum FileAttribute @@ -82,26 +76,26 @@ typedef enum SpecialFolderConst { - WindowsFolder = 0, - SystemFolder = 1, - TemporaryFolder = 2 + WindowsFolder, + SystemFolder, + TemporaryFolder } SpecialFolderConst; typedef enum DriveTypeConst { - UnknownType = 0, - Removable = 1, - Fixed = 2, - Remote = 3, - CDRom = 4, - RamDisk = 5 + UnknownType, + Removable, + Fixed, + Remote, + CDRom, + RamDisk } DriveTypeConst; typedef enum StandardStreamTypes { - StdIn = 0, - StdOut = 1, - StdErr = 2 + StdIn, + StdOut, + StdErr } StandardStreamTypes; [ @@ -113,13 +107,13 @@ ] interface IDictionary : IDispatch { - [id(00000000), propputref] + [id(DISPID_VALUE), propputref] HRESULT Item([in] VARIANT* Key, [in] VARIANT* pRetItem); - [id(00000000), propput] + [id(DISPID_VALUE), propput] HRESULT Item([in] VARIANT* Key, [in] VARIANT* pRetItem); - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Item([in] VARIANT* Key, [out, retval] VARIANT* pRetItem); [id(0x00000001)] @@ -161,6 +155,191 @@ [ odl, + uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IDrive : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Path([out, retval] BSTR* pbstrPath); + + [id(0x00002710), propget] + HRESULT DriveLetter([out, retval] BSTR* pbstrLetter); + + [id(0x00002711), propget] + HRESULT ShareName([out, retval] BSTR* pbstrShareName); + + [id(0x00002712), propget] + HRESULT DriveType([out, retval] DriveTypeConst* pdt); + + [id(0x00002713), propget] + HRESULT RootFolder([out, retval] IFolder** ppfolder); + + [id(0x00002715), propget] + HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); + + [id(0x00002714), propget] + HRESULT FreeSpace([out, retval] VARIANT* pvarFree); + + [id(0x00002716), propget] + HRESULT TotalSize([out, retval] VARIANT* pvarTotal); + + [id(0x00002717), propget] + HRESULT VolumeName([out, retval] BSTR* pbstrName); + + [id(0x00002717), propput] + HRESULT VolumeName([in] BSTR pbstrName); + + [id(0x00002718), propget] + HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); + + [id(0x00002719), propget] + HRESULT SerialNumber([out, retval] long* pulSerialNumber); + + [id(0x0000271a), propget] + HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); + } + + [ + odl, + uuid(C7C3F5A1-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IDriveCollection : IDispatch { + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive); + + [id(DISPID_NEWENUM), propget, restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppenum); + + [id(0x00000001), propget] + HRESULT Count([out, retval] long* plCount); + } + + [ + odl, + uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), + hidden, + dual, + nonextensible, + oleautomation + ] + interface ITextStream : IDispatch + { + [id(0x00002710), propget] + HRESULT Line([out, retval] long* Line); + + [id(0xfffffdef), propget] + HRESULT Column([out, retval] long* Column); + + [id(0x00002712), propget] + HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); + + [id(0x00002713), propget] + HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); + + [id(0x00002714)] + HRESULT Read([in] long Characters, [out, retval] BSTR* Text); + + [id(0x00002715)] + HRESULT ReadLine([out, retval] BSTR* Text); + + [id(0x00002716)] + HRESULT ReadAll([out, retval] BSTR* Text); + + [id(0x00002717)] + HRESULT Write([in] BSTR Text); + + [id(0x00002718)] + HRESULT WriteLine([in, defaultvalue("")] BSTR Text); + + [id(0x00002719)] + HRESULT WriteBlankLines([in] long Lines); + + [id(0x0000271a)] + HRESULT Skip([in] long Characters); + + [id(0x0000271b)] + HRESULT SkipLine(); + + [id(0x0000271c)] + HRESULT Close(); + } + + [ + odl, + uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFile : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Path([out, retval] BSTR* pbstrPath); + + [id(0x000003e8), propget] + HRESULT Name([out, retval] BSTR* pbstrName); + + [id(0x000003e8), propput] + HRESULT Name([in] BSTR pbstrName); + + [id(0x000003ea), propget] + HRESULT ShortPath([out, retval] BSTR* pbstrPath); + + [id(0x000003e9), propget] + HRESULT ShortName([out, retval] BSTR* pbstrName); + + [id(0x000003ec), propget] + HRESULT Drive([out, retval] IDrive** ppdrive); + + [id(0x000003ed), propget] + HRESULT ParentFolder([out, retval] IFolder** ppfolder); + + [id(0x000003eb), propget] + HRESULT Attributes([out, retval] FileAttribute* pfa); + + [id(0x000003eb), propput] + HRESULT Attributes([in] FileAttribute pfa); + + [id(0x000003ee), propget] + HRESULT DateCreated([out, retval] DATE* pdate); + + [id(0x000003ef), propget] + HRESULT DateLastModified([out, retval] DATE* pdate); + + [id(0x000003f0), propget] + HRESULT DateLastAccessed([out, retval] DATE* pdate); + + [id(0x000003f1), propget] + HRESULT Size([out, retval] VARIANT* pvarSize); + + [id(0x000003f2), propget] + HRESULT Type([out, retval] BSTR* pbstrType); + + [id(0x000004b0)] + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); + + [id(0x000004b2)] + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + + [id(0x000004b4)] + HRESULT Move([in] BSTR Destination); + + [id(0x0000044c)] + HRESULT OpenAsTextStream([in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); + } + + [ + odl, uuid(0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0), hidden, dual, @@ -218,10 +397,10 @@ HRESULT GetSpecialFolder([in] SpecialFolderConst SpecialFolder, [out, retval] IFolder** ppfolder); [id(0x000004b0)] - HRESULT DeleteFile([in] BSTR FileSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT DeleteFile([in] BSTR FileSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b1)] - HRESULT DeleteFolder([in] BSTR FolderSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT DeleteFolder([in] BSTR FolderSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b4), helpstring("Move a file"), helpcontext(0x00214bab)] HRESULT MoveFile([in] BSTR Source, [in] BSTR Destination); @@ -231,37 +410,38 @@ [id(0x000004b2)] HRESULT CopyFile([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x000004b3)] HRESULT CopyFolder([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x00000460)] HRESULT CreateFolder([in] BSTR Path, [out, retval] IFolder** ppfolder); [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); [id(0x0000044c)] - HRESULT OpenTextFile([in] BSTR FileName, [in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] VARIANT_BOOL Create, - [in, optional, defaultvalue(0)] Tristate Format, + HRESULT OpenTextFile([in] BSTR FileName, [in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] VARIANT_BOOL Create, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); } [ odl, - uuid(C7C3F5A1-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IDriveCollection : IDispatch { - [id(00000000)] - HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive); + uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFileCollection : IDispatch + { + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); [id(DISPID_NEWENUM), propget, restricted, hidden] HRESULT _NewEnum([out, retval] IUnknown** ppenum); @@ -272,52 +452,25 @@ [ odl, - uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IDrive : IDispatch - { - [id(00000000), propget] - HRESULT Path([out, retval] BSTR* pbstrPath); - - [id(0x00002710), propget] - HRESULT DriveLetter([out, retval] BSTR* pbstrLetter) -; - [id(0x00002711), propget] - HRESULT ShareName([out, retval] BSTR* pbstrShareName); - - [id(0x00002712), propget] - HRESULT DriveType([out, retval] DriveTypeConst* pdt); - - [id(0x00002713), propget] - HRESULT RootFolder([out, retval] IFolder** ppfolder); - - [id(0x00002715), propget] - HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); - - [id(0x00002714), propget] - HRESULT FreeSpace([out, retval] VARIANT* pvarFree); - - [id(0x00002716), propget] - HRESULT TotalSize([out, retval] VARIANT* pvarTotal); - - [id(0x00002717), propget] - HRESULT VolumeName([out, retval] BSTR* pbstrName); - - [id(0x00002717), propput] - HRESULT VolumeName([in] BSTR pbstrName); - - [id(0x00002718), propget] - HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); - - [id(0x00002719), propget] - HRESULT SerialNumber([out, retval] long* pulSerialNumber); - - [id(0x0000271a), propget] - HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); + uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFolderCollection : IDispatch + { + [id(0x00000002)] + HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); + + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); + + [id(DISPID_NEWENUM), propget, restricted, hidden] + HRESULT _NewEnum([out, retval] IUnknown** ppenum); + + [id(0x00000001), propget] + HRESULT Count([out, retval] long* plCount); } [ @@ -330,7 +483,7 @@ ] interface IFolder : IDispatch { - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Path([out, retval] BSTR* pbstrPath); [id(0x000003e8), propget] @@ -370,10 +523,10 @@ HRESULT Type([out, retval] BSTR* pbstrType); [id(0x000004b1)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x000004b3)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x000004b5)] HRESULT Move([in] BSTR Destination); @@ -391,167 +544,8 @@ HRESULT Files([out, retval] IFileCollection** ppfiles); [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); - } - - [ - odl, - uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFolderCollection : IDispatch - { - [id(0x00000002)] - HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); - - [id(00000000), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); - - [id(DISPID_NEWENUM), propget, restricted, hidden] - HRESULT _NewEnum([out, retval] IUnknown** ppenum); - - [id(0x00000001), propget] - HRESULT Count([out, retval] long* plCount); - } - - [ - odl, - uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFileCollection : IDispatch - { - [id(00000000), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); - - [id(DISPID_NEWENUM), propget, restricted, hidden] - HRESULT _NewEnum([out, retval] IUnknown** ppenum); - - [id(0x00000001), propget] - HRESULT Count([out, retval] long* plCount); - } - - [ - odl, - uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), - hidden, - dual, - nonextensible, - oleautomation - ] - interface IFile : IDispatch - { - [id(00000000), propget] - HRESULT Path([out, retval] BSTR* pbstrPath); - - [id(0x000003e8), propget] - HRESULT Name([out, retval] BSTR* pbstrName); - - [id(0x000003e8), propput] - HRESULT Name([in] BSTR pbstrName); - - [id(0x000003ea), propget] - HRESULT ShortPath([out, retval] BSTR* pbstrPath); - - [id(0x000003e9), propget] - HRESULT ShortName([out, retval] BSTR* pbstrName); - - [id(0x000003ec), propget] - HRESULT Drive([out, retval] IDrive** ppdrive); - - [id(0x000003ed), propget] - HRESULT ParentFolder([out, retval] IFolder** ppfolder); - - [id(0x000003eb), propget] - HRESULT Attributes([out, retval] FileAttribute* pfa); - - [id(0x000003eb), propput] - HRESULT Attributes([in] FileAttribute pfa); - - [id(0x000003ee), propget] - HRESULT DateCreated([out, retval] DATE* pdate); - - [id(0x000003ef), propget] - HRESULT DateLastModified([out, retval] DATE* pdate); - - [id(0x000003f0), propget] - HRESULT DateLastAccessed([out, retval] DATE* pdate); - - [id(0x000003f1), propget] - HRESULT Size([out, retval] VARIANT* pvarSize); - - [id(0x000003f2), propget] - HRESULT Type([out, retval] BSTR* pbstrType); - - [id(0x000004b0)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); - - [id(0x000004b2)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); - - [id(0x000004b4)] - HRESULT Move([in] BSTR Destination); - - [id(0x0000044c)] - HRESULT OpenAsTextStream([in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); - } - - [ - odl, - uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), - hidden, - dual, - nonextensible, - oleautomation - ] - interface ITextStream : IDispatch - { - [id(0x00002710), propget] - HRESULT Line([out, retval] long* Line); - - [id(0xfffffdef), propget] - HRESULT Column([out, retval] long* Column); - - [id(0x00002712), propget] - HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); - - [id(0x00002713), propget] - HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); - - [id(0x00002714)] - HRESULT Read([in] long Characters, [out, retval] BSTR* Text); - - [id(0x00002715)] - HRESULT ReadLine([out, retval] BSTR* Text); - - [id(0x00002716)] - HRESULT ReadAll([out, retval] BSTR* Text); - - [id(0x00002717)] - HRESULT Write([in] BSTR Text); - - [id(0x00002718)] - HRESULT WriteLine([in, optional, defaultvalue("")] BSTR Text); - - [id(0x00002719)] - HRESULT WriteBlankLines([in] long Lines); - - [id(0x0000271a)] - HRESULT Skip([in] long Characters); - - [id(0x0000271b)] - HRESULT SkipLine(); - - [id(0x0000271c)] - HRESULT Close(); + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); } [ @@ -565,7 +559,7 @@ { [id(0x00004e20)] HRESULT GetStandardStream([in] StandardStreamTypes StandardStreamType, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); [id(0x00004e2a)] HRESULT GetFileVersion([in] BSTR FileName, [out, retval] BSTR* FileVersion); @@ -579,7 +573,7 @@ ] interface IScriptEncoder : IDispatch { - [id(00000000)] + [id(DISPID_VALUE)] HRESULT EncodeScriptFile([in] BSTR szExt, [in] BSTR bstrStreamIn, [in] long cFlags, [in] BSTR bstrDefaultLang, [out, retval] BSTR* pbstrStreamOut); } Modified: trunk/reactos/dll/win32/scrrun/scrrun_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/scrrun/scrrun_pr…
============================================================================== --- trunk/reactos/dll/win32/scrrun/scrrun_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/scrrun/scrrun_private.h [iso-8859-1] Thu Apr 24 16:00:09 2014 @@ -47,10 +47,14 @@ { NULL_tid, IDictionary_tid, + IDrive_tid, + IDriveCollection_tid, + IFile_tid, + IFileCollection_tid, IFileSystem3_tid, IFolder_tid, + IFolderCollection_tid, ITextStream_tid, - IFile_tid, LAST_tid } tid_t; Modified: trunk/reactos/dll/win32/scrrun/scrrun_tlb.rgs URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/scrrun/scrrun_tl…
============================================================================== --- trunk/reactos/dll/win32/scrrun/scrrun_tlb.rgs [iso-8859-1] (original) +++ trunk/reactos/dll/win32/scrrun/scrrun_tlb.rgs [iso-8859-1] Thu Apr 24 16:00:09 2014 @@ -19,7 +19,7 @@ ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } } - '{0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0}' = s 'IFileSystem' + '{C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IDrive' { ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' @@ -31,13 +31,25 @@ ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } } - '{C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IDrive' + '{53BAD8C1-E718-11CF-893D-00A0C9054228}' = s 'ITextStream' { ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } } - '{C7C3F5A2-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFolder' + '{C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFile' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } + } + '{0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0}' = s 'IFileSystem' + { + ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' + ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' + TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } + } + '{C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFileCollection' { ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' @@ -49,19 +61,7 @@ ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } } - '{C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFileCollection' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } - } - '{C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFile' - { - ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' - ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' - TypeLib = s '{420B2830-E718-11CF-893D-00A0C9054228}' { val Version = s '1.0' } - } - '{53BAD8C1-E718-11CF-893D-00A0C9054228}' = s 'ITextStream' + '{C7C3F5A2-88A3-11D0-ABCB-00A0C90FFFC0}' = s 'IFolder' { ProxyStubClsid = s '{00020424-0000-0000-C000-000000000046}' ProxyStubClsid32 = s '{00020424-0000-0000-C000-000000000046}' 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 Apr 24 16:00:09 2014 @@ -171,7 +171,7 @@ reactos/dll/win32/rsaenh # Synced to Wine-1.7.17 reactos/dll/win32/sccbase # Synced to Wine-1.7.1 reactos/dll/win32/schannel # Synced to Wine-1.7.1 -reactos/dll/win32/scrrun # Synced to Wine-1.7.1 +reactos/dll/win32/scrrun # Synced to Wine-1.7.17 reactos/dll/win32/secur32 # Forked reactos/dll/win32/security # Forked (different .spec) reactos/dll/win32/sensapi # Synced to Wine-1.7.1
10 years, 8 months
1
0
0
0
[akhaldi] 62952: [WLDAP32_WINETEST] * Sync with Wine 1.7.17. CORE-8080
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 24 15:53:26 2014 New Revision: 62952 URL:
http://svn.reactos.org/svn/reactos?rev=62952&view=rev
Log: [WLDAP32_WINETEST] * Sync with Wine 1.7.17. CORE-8080 Modified: trunk/rostests/winetests/wldap32/parse.c Modified: trunk/rostests/winetests/wldap32/parse.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wldap32/parse.c…
============================================================================== --- trunk/rostests/winetests/wldap32/parse.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wldap32/parse.c [iso-8859-1] Thu Apr 24 15:53:26 2014 @@ -48,16 +48,16 @@ timeout.tv_sec = 20; timeout.tv_usec = 0; ret = ldap_search_ext_sA( ld, (char *)"", LDAP_SCOPE_ONELEVEL, (char *)"(ou=*)", NULL, 0, ctrls, NULL, &timeout, 10, &res ); - if (ret == LDAP_SERVER_DOWN) + if (ret == LDAP_SERVER_DOWN || ret == LDAP_TIMEOUT) { skip("test server can't be reached\n"); - ldap_control_free( sort ); + ldap_control_freeA( sort ); return; } ok( !ret, "ldap_search_ext_sA failed 0x%x\n", ret ); ok( res != NULL, "expected res != NULL\n" ); - if (GetProcAddress(GetModuleHandle("wldap32.dll"), "ber_init")) + if (GetProcAddress(GetModuleHandleA("wldap32.dll"), "ber_init")) { ret = ldap_parse_resultA( NULL, res, &result, NULL, NULL, NULL, &server_ctrls, 1 ); ok( ret == LDAP_PARAM_ERROR, "ldap_parse_resultA failed 0x%x\n", ret ); @@ -82,8 +82,8 @@ ret = ldap_parse_sort_controlA( ld, server_ctrls, &result, NULL ); ok( ret == LDAP_CONTROL_NOT_FOUND, "ldap_parse_sort_controlA failed 0x%x\n", ret ); - ldap_control_free( sort ); - ldap_controls_free( server_ctrls ); + ldap_control_freeA( sort ); + ldap_controls_freeA( server_ctrls ); } static void test_ldap_search_extW( LDAP *ld )
10 years, 8 months
1
0
0
0
[akhaldi] 62951: [WLDAP32] * Sync with Wine 1.7.17. CORE-8080
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 24 15:53:15 2014 New Revision: 62951 URL:
http://svn.reactos.org/svn/reactos?rev=62951&view=rev
Log: [WLDAP32] * Sync with Wine 1.7.17. CORE-8080 Modified: trunk/reactos/dll/win32/wldap32/init.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/wldap32/init.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wldap32/init.c?r…
============================================================================== --- trunk/reactos/dll/win32/wldap32/init.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wldap32/init.c [iso-8859-1] Thu Apr 24 15:53:15 2014 @@ -98,13 +98,12 @@ } /* Determine if a URL starts with a known LDAP scheme */ -static int has_ldap_scheme( char *url ) -{ - if (!strncasecmp( url, "ldap://", 7 ) || - !strncasecmp( url, "ldaps://", 8 ) || - !strncasecmp( url, "ldapi://", 8 ) || - !strncasecmp( url, "cldap://", 8 )) return 1; - return 0; +static BOOL has_ldap_scheme( char *url ) +{ + return !strncasecmp( url, "ldap://", 7 ) || + !strncasecmp( url, "ldaps://", 8 ) || + !strncasecmp( url, "ldapi://", 8 ) || + !strncasecmp( url, "cldap://", 8 ); } /* Flatten an array of hostnames into a space separated string of URLs. 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 Apr 24 15:53:15 2014 @@ -213,7 +213,7 @@ reactos/dll/win32/winmm/midimap # Forked at Wine-20050628 reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628 reactos/dll/win32/wintrust # Synced to Wine-1.7.17 -reactos/dll/win32/wldap32 # Synced to Wine-1.7.1 +reactos/dll/win32/wldap32 # Synced to Wine-1.7.17 reactos/dll/win32/wmi # Synced to Wine-1.7.17 reactos/dll/win32/wtsapi32 # Synced to Wine-1.7.1 reactos/dll/win32/wuapi # Synced to Wine-1.7.1
10 years, 8 months
1
0
0
0
[akhaldi] 62950: [WMI] * Sync with Wine 1.7.17. CORE-8080
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 24 15:49:21 2014 New Revision: 62950 URL:
http://svn.reactos.org/svn/reactos?rev=62950&view=rev
Log: [WMI] * Sync with Wine 1.7.17. CORE-8080 Modified: trunk/reactos/dll/win32/wmi/wmi.spec trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/wmi/wmi.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wmi/wmi.spec?rev…
============================================================================== --- trunk/reactos/dll/win32/wmi/wmi.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wmi/wmi.spec [iso-8859-1] Thu Apr 24 15:49:21 2014 @@ -1,13 +1,13 @@ -@ stdcall CloseTrace(long) advapi32.CloseTrace -@ stdcall ControlTraceA(long long ptr long) advapi32.ControlTraceA -@ stdcall ControlTraceW(long long ptr long) advapi32.ControlTraceW +@ stdcall CloseTrace(int64) advapi32.CloseTrace +@ stdcall ControlTraceA(int64 str ptr long) advapi32.ControlTraceA +@ stdcall ControlTraceW(int64 wstr ptr long) advapi32.ControlTraceW @ stdcall CreateTraceInstanceId(long ptr) advapi32.CreateTraceInstanceId -@ stdcall EnableTrace(long long long ptr long) advapi32.EnableTrace -@ stdcall GetTraceEnableFlags(long) advapi32.GetTraceEnableFlags -@ stdcall GetTraceEnableLevel(long) advapi32.GetTraceEnableLevel -@ stdcall GetTraceLoggerHandle(ptr) advapi32.GetTraceLoggerHandle -@ stdcall OpenTraceA(ptr) advapi32.OpenTraceA -@ stdcall OpenTraceW(ptr) advapi32.OpenTraceW +@ stdcall EnableTrace(long long long ptr int64) advapi32.EnableTrace +@ stdcall GetTraceEnableFlags(int64) advapi32.GetTraceEnableFlags +@ stdcall GetTraceEnableLevel(int64) advapi32.GetTraceEnableLevel +@ stdcall -ret64 GetTraceLoggerHandle(ptr) advapi32.GetTraceLoggerHandle +@ stdcall -ret64 OpenTraceA(ptr) advapi32.OpenTraceA +@ stdcall -ret64 OpenTraceW(ptr) advapi32.OpenTraceW @ stdcall ProcessTrace(ptr long ptr ptr) advapi32.ProcessTrace @ stdcall QueryAllTracesA(ptr long ptr) advapi32.QueryAllTracesA @ stdcall QueryAllTracesW(ptr long ptr) advapi32.QueryAllTracesW @@ -17,9 +17,9 @@ @ stdcall SetTraceCallback(ptr ptr) advapi32.SetTraceCallback @ stdcall StartTraceA(ptr str ptr) advapi32.StartTraceA @ stdcall StartTraceW(ptr wstr ptr) advapi32.StartTraceW -@ stdcall TraceEvent(long ptr) advapi32.TraceEvent -@ stdcall TraceEventInstance(long ptr ptr ptr) advapi32.TraceEventInstance -@ stdcall UnregisterTraceGuids(long) advapi32.UnregisterTraceGuids +@ stdcall TraceEvent(int64 ptr) advapi32.TraceEvent +@ stdcall TraceEventInstance(int64 ptr ptr ptr) advapi32.TraceEventInstance +@ stdcall UnregisterTraceGuids(int64) advapi32.UnregisterTraceGuids @ stdcall WmiCloseBlock() advapi32.WmiCloseBlock @ stdcall WmiDevInstToInstanceNameA() advapi32.WmiDevInstToInstanceNameA @ stdcall WmiDevInstToInstanceNameW() advapi32.WmiDevInstToInstanceNameW 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 Apr 24 15:49:21 2014 @@ -214,7 +214,7 @@ reactos/dll/win32/winmm/wavemap # Forked at Wine-20050628 reactos/dll/win32/wintrust # Synced to Wine-1.7.17 reactos/dll/win32/wldap32 # Synced to Wine-1.7.1 -reactos/dll/win32/wmi # Synced to Wine-1.7.1 +reactos/dll/win32/wmi # Synced to Wine-1.7.17 reactos/dll/win32/wtsapi32 # Synced to Wine-1.7.1 reactos/dll/win32/wuapi # Synced to Wine-1.7.1 reactos/dll/win32/xinput1_1 # Synced to Wine-1.7.1
10 years, 8 months
1
0
0
0
[akhaldi] 62949: [WINTRUST_WINETEST] * Sync with Wine 1.7.17. CORE-8080
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Apr 24 15:48:16 2014 New Revision: 62949 URL:
http://svn.reactos.org/svn/reactos?rev=62949&view=rev
Log: [WINTRUST_WINETEST] * Sync with Wine 1.7.17. CORE-8080 Modified: trunk/rostests/winetests/wintrust/crypt.c Modified: trunk/rostests/winetests/wintrust/crypt.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wintrust/crypt.…
============================================================================== --- trunk/rostests/winetests/wintrust/crypt.c [iso-8859-1] (original) +++ trunk/rostests/winetests/wintrust/crypt.c [iso-8859-1] Thu Apr 24 15:48:16 2014 @@ -251,23 +251,23 @@ } ok(hca != NULL, "Expected a context handle, got NULL\n"); - attrs = GetFileAttributes(catroot); + attrs = GetFileAttributesA(catroot); ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected the CatRoot directory to exist\n"); /* Windows creates the GUID directory in capitals */ lstrcpyA(dummydir, catroot); lstrcatA(dummydir, "\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}"); - attrs = GetFileAttributes(dummydir); + attrs = GetFileAttributesA(dummydir); ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected CatRoot\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist\n"); /* Only present on XP or higher. */ - attrs = GetFileAttributes(catroot2); + attrs = GetFileAttributesA(catroot2); if (attrs != INVALID_FILE_ATTRIBUTES) { lstrcpyA(dummydir, catroot2); lstrcatA(dummydir, "\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}"); - attrs = GetFileAttributes(dummydir); + attrs = GetFileAttributesA(dummydir); ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected CatRoot2\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist\n"); } @@ -283,13 +283,21 @@ ret = pCryptCATAdminReleaseContext(hca, 0); ok(ret, "Expected success, got FALSE with %d\n", GetLastError()); - /* Flags not equal to 0 */ + hca = (void *) 0xdeadbeef; + SetLastError(0xdeadbeef); + /* Flags is documented as unused, but the parameter is checked since win8 */ ret = pCryptCATAdminAcquireContext(&hca, &unknown, 1); - ok(ret, "Expected success, got FALSE with %d\n", GetLastError()); - ok(hca != NULL, "Expected a context handle, got NULL\n"); - - ret = pCryptCATAdminReleaseContext(hca, 0); - ok(ret, "Expected success, got FALSE with %d\n", GetLastError()); + ok((!ret && (GetLastError() == ERROR_INVALID_PARAMETER) && (hca == (void *) 0xdeadbeef)) || + broken(ret && hca != NULL && hca != (void *) 0xdeadbeef), + "Expected FALSE and ERROR_INVALID_PARAMETER with untouched handle, got %d and %u with %p\n", + ret, GetLastError(), hca); + + if (ret && hca) + { + SetLastError(0xdeadbeef); + ret = pCryptCATAdminReleaseContext(hca, 0); + ok(ret, "Expected success, got FALSE with %d\n", GetLastError()); + } } /* TODO: Check whether SHA-1 is the algorithm that's always used */ @@ -480,7 +488,7 @@ static void test_CryptCATAdminAddRemoveCatalog(void) { static WCHAR basenameW[] = {'w','i','n','e','t','e','s','t','.','c','a','t',0}; - static CHAR basename[] = "winetest.cat"; + static const char basename[] = "winetest.cat"; HCATADMIN hcatadmin; HCATINFO hcatinfo; CATALOG_INFO info; @@ -589,7 +597,7 @@ lstrcpyA(catfilepath, catroot); lstrcatA(catfilepath, "\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}\\winetest.cat"); - attrs = GetFileAttributes(catfilepath); + attrs = GetFileAttributesA(catfilepath); ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected %s to exist\n", catfilepath); todo_wine ok(attrs == FILE_ATTRIBUTE_SYSTEM || @@ -617,12 +625,12 @@ ret = pCryptCATAdminRemoveCatalog(hcatadmin, info.wszCatalogFile, 0); ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError()); /* The call succeeded with the full path but the file is not removed */ - attrs = GetFileAttributes(catfilepath); + attrs = GetFileAttributesA(catfilepath); ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected %s to exist\n", catfilepath); /* Given only the filename the file is removed */ ret = pCryptCATAdminRemoveCatalog(hcatadmin, basenameW, 0); ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError()); - attrs = GetFileAttributes(catfilepath); + attrs = GetFileAttributesA(catfilepath); ok(attrs == INVALID_FILE_ATTRIBUTES, "Expected %s to be removed\n", catfilepath); cleanup: @@ -636,7 +644,7 @@ DeleteFileA(tmpfile); } -static void test_catalog_properties(CHAR *catfile, int attributes, int members) +static void test_catalog_properties(const char *catfile, int attributes, int members) { static const GUID subject = {0xde351a42,0x8e59,0x11d0,{0x8c,0x47,0x00,0xc0,0x4f,0xc2,0x95,0xee}}; @@ -729,8 +737,8 @@ static void test_create_catalog_file(void) { - static CHAR catfileA[] = "winetest.cat"; - static CHAR cdffileA[] = "winetest.cdf"; + static const char catfileA[] = "winetest.cat"; + static const char cdffileA[] = "winetest.cdf"; static WCHAR cdffileW[] = {'w','i','n','e','t','e','s','t','.','c','d','f',0}; CRYPTCATCDF *catcdf; CRYPTCATATTRIBUTE *catattr; @@ -870,8 +878,8 @@ static void test_cdf_parsing(void) { - static CHAR catfileA[] = "tempfile.cat"; - static CHAR cdffileA[] = "tempfile.cdf"; + static const char catfileA[] = "tempfile.cat"; + static const char cdffileA[] = "tempfile.cdf"; static WCHAR cdffileW[] = {'t','e','m','p','f','i','l','e','.','c','d','f',0}; CHAR cdf_contents[4096]; CRYPTCATCDF *catcdf; @@ -1194,7 +1202,7 @@ static void test_sip(void) { - static WCHAR nameW[] = {'t','e','s','t','.','e','x','e',0}; + static const WCHAR nameW[] = {'t','e','s','t','.','e','x','e',0}; SIP_SUBJECTINFO info; DWORD index, encoding, size; HANDLE file;
10 years, 8 months
1
0
0
0
← Newer
1
...
11
12
13
14
15
16
17
...
50
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
Results per page:
10
25
50
100
200