winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
December 2009
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
1233 discussions
Start a n
N
ew thread
Henri Verbeet : d3d8: Simplify GetDevice().
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: 3cedef2ffea3a72d9717470f01a3a046db923e4b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3cedef2ffea3a72d9717470f0…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Fri Dec 4 11:50:46 2009 +0100 d3d8: Simplify GetDevice(). We already store "parentDevice", so we might as well use it. --- dlls/d3d8/cubetexture.c | 21 ++++++++------------- dlls/d3d8/indexbuffer.c | 21 ++++++++------------- dlls/d3d8/surface.c | 21 ++++++++------------- dlls/d3d8/texture.c | 21 ++++++++------------- dlls/d3d8/vertexbuffer.c | 21 ++++++++------------- dlls/d3d8/volumetexture.c | 21 ++++++++------------- 6 files changed, 48 insertions(+), 78 deletions(-) diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c index 02d2bca..7e48dab 100644 --- a/dlls/d3d8/cubetexture.c +++ b/dlls/d3d8/cubetexture.c @@ -82,23 +82,18 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 ifa } /* IDirect3DCubeTexture8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(LPDIRECT3DCUBETEXTURE8 iface, IDirect3DDevice8 **ppDevice) { +static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(IDirect3DCubeTexture8 *iface, IDirect3DDevice8 **device) +{ IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; - IWineD3DDevice *wined3d_device; - HRESULT hr; - TRACE("iface %p, device %p.\n", iface, ppDevice); + TRACE("iface %p, device %p.\n", iface, device); - wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetDevice(This->wineD3DCubeTexture, &wined3d_device); - if (SUCCEEDED(hr)) - { - IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice); - IWineD3DDevice_Release(wined3d_device); - } - wined3d_mutex_unlock(); + *device = (IDirect3DDevice8 *)This->parentDevice; + IDirect3DDevice8_AddRef(*device); - return hr; + TRACE("Returning device %p.\n", *device); + + return D3D_OK; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { diff --git a/dlls/d3d8/indexbuffer.c b/dlls/d3d8/indexbuffer.c index 3369a0c..b98c2d3 100644 --- a/dlls/d3d8/indexbuffer.c +++ b/dlls/d3d8/indexbuffer.c @@ -79,23 +79,18 @@ static ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 ifa } /* IDirect3DIndexBuffer8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) { +static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(IDirect3DIndexBuffer8 *iface, IDirect3DDevice8 **device) +{ IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; - IWineD3DDevice *wined3d_device; - HRESULT hr; - TRACE("iface %p, device %p.\n", iface, ppDevice); + TRACE("iface %p, device %p.\n", iface, device); - wined3d_mutex_lock(); - hr = IWineD3DBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device); - if (SUCCEEDED(hr)) - { - IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice); - IWineD3DDevice_Release(wined3d_device); - } - wined3d_mutex_unlock(); + *device = (IDirect3DDevice8 *)This->parentDevice; + IDirect3DDevice8_AddRef(*device); - return hr; + TRACE("Returning device %p.\n", *device); + + return D3D_OK; } static HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 51c7966..1d4b1dc 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -100,23 +100,18 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) { } /* IDirect3DSurface8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(LPDIRECT3DSURFACE8 iface, IDirect3DDevice8 **ppDevice) { +static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(IDirect3DSurface8 *iface, IDirect3DDevice8 **device) +{ IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; - IWineD3DDevice *wined3d_device; - HRESULT hr; - TRACE("iface %p, device %p.\n", iface, ppDevice); + TRACE("iface %p, device %p.\n", iface, device); - wined3d_mutex_lock(); - hr = IWineD3DSurface_GetDevice(This->wineD3DSurface, &wined3d_device); - if (SUCCEEDED(hr)) - { - IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice); - IWineD3DDevice_Release(wined3d_device); - } - wined3d_mutex_unlock(); + *device = (IDirect3DDevice8 *)This->parentDevice; + IDirect3DDevice8_AddRef(*device); - return hr; + TRACE("Returning device %p.\n", *device); + + return D3D_OK; } static HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) { diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index 57cec4d..67a60b4 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -80,23 +80,18 @@ static ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) { } /* IDirect3DTexture8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(LPDIRECT3DTEXTURE8 iface, IDirect3DDevice8 **ppDevice) { +static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(IDirect3DTexture8 *iface, IDirect3DDevice8 **device) +{ IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; - IWineD3DDevice *wined3d_device; - HRESULT hr; - TRACE("iface %p, device %p.\n", iface, ppDevice); + TRACE("iface %p, device %p.\n", iface, device); - wined3d_mutex_lock(); - hr = IWineD3DTexture_GetDevice(This->wineD3DTexture, &wined3d_device); - if (SUCCEEDED(hr)) - { - IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice); - IWineD3DDevice_Release(wined3d_device); - } - wined3d_mutex_unlock(); + *device = (IDirect3DDevice8 *)This->parentDevice; + IDirect3DDevice8_AddRef(*device); - return hr; + TRACE("Returning device %p.\n", *device); + + return D3D_OK; } static HRESULT WINAPI IDirect3DTexture8Impl_SetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) { diff --git a/dlls/d3d8/vertexbuffer.c b/dlls/d3d8/vertexbuffer.c index ae5307a..9a984f2 100644 --- a/dlls/d3d8/vertexbuffer.c +++ b/dlls/d3d8/vertexbuffer.c @@ -81,23 +81,18 @@ static ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 i } /* IDirect3DVertexBuffer8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) { +static HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(IDirect3DVertexBuffer8 *iface, IDirect3DDevice8 **device) +{ IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface; - IWineD3DDevice *wined3d_device; - HRESULT hr; - TRACE("iface %p, device %p.\n", iface, ppDevice); + TRACE("iface %p, device %p.\n", iface, device); - wined3d_mutex_lock(); - hr = IWineD3DBuffer_GetDevice(This->wineD3DVertexBuffer, &wined3d_device); - if (SUCCEEDED(hr)) - { - IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice); - IWineD3DDevice_Release(wined3d_device); - } - wined3d_mutex_unlock(); + *device = (IDirect3DDevice8 *)This->parentDevice; + IDirect3DDevice8_AddRef(*device); - return hr; + TRACE("Returning device %p.\n", *device); + + return D3D_OK; } static HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) { diff --git a/dlls/d3d8/volumetexture.c b/dlls/d3d8/volumetexture.c index cb01540..bc5c5b8 100644 --- a/dlls/d3d8/volumetexture.c +++ b/dlls/d3d8/volumetexture.c @@ -80,23 +80,18 @@ static ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 } /* IDirect3DVolumeTexture8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE8 iface, IDirect3DDevice8 **ppDevice) { +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetDevice(IDirect3DVolumeTexture8 *iface, IDirect3DDevice8 **device) +{ IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; - IWineD3DDevice *wined3d_device; - HRESULT hr; - TRACE("iface %p, device %p.\n", iface, ppDevice); + TRACE("iface %p, device %p.\n", iface, device); - wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_GetDevice(This->wineD3DVolumeTexture, &wined3d_device); - if (SUCCEEDED(hr)) - { - IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice); - IWineD3DDevice_Release(wined3d_device); - } - wined3d_mutex_unlock(); + *device = (IDirect3DDevice8 *)This->parentDevice; + IDirect3DDevice8_AddRef(*device); - return hr; + TRACE("Returning device %p.\n", *device); + + return D3D_OK; } static HRESULT WINAPI IDirect3DVolumeTexture8Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
1
0
0
0
Owen Rudge : imagehlp: Implement ImageAddCertificate.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: 1f6d24565cc3a4ea75747bc8c836a884253602aa URL:
http://source.winehq.org/git/wine.git/?a=commit;h=1f6d24565cc3a4ea75747bc8c…
Author: Owen Rudge <orudge(a)codeweavers.com> Date: Thu Dec 3 13:51:02 2009 -0600 imagehlp: Implement ImageAddCertificate. --- dlls/imagehlp/integrity.c | 166 +++++++++++++++++++++++++++++++++++++- dlls/imagehlp/tests/integrity.c | 10 +- 2 files changed, 166 insertions(+), 10 deletions(-) diff --git a/dlls/imagehlp/integrity.c b/dlls/imagehlp/integrity.c index a46c853..6a13c53 100644 --- a/dlls/imagehlp/integrity.c +++ b/dlls/imagehlp/integrity.c @@ -167,6 +167,67 @@ static BOOL IMAGEHLP_GetSecurityDirOffset( HANDLE handle, } /*********************************************************************** + * IMAGEHLP_SetSecurityDirOffset (INTERNAL) + * + * Read a file's PE header, and update the offset and size of the + * security directory. + */ +static BOOL IMAGEHLP_SetSecurityDirOffset(HANDLE handle, + DWORD dwOfs, DWORD dwSize) +{ + IMAGE_NT_HEADERS32 nt_hdr32; + IMAGE_NT_HEADERS64 nt_hdr64; + IMAGE_DATA_DIRECTORY *sd; + int ret, nt_hdr_size = 0; + DWORD pe_offset; + void *nt_hdr; + DWORD count; + BOOL r; + + ret = IMAGEHLP_GetNTHeaders(handle, &pe_offset, &nt_hdr32, &nt_hdr64); + + if (ret == HDR_NT32) + { + sd = &nt_hdr32.OptionalHeader.DataDirectory[IMAGE_FILE_SECURITY_DIRECTORY]; + + nt_hdr = &nt_hdr32; + nt_hdr_size = sizeof(IMAGE_NT_HEADERS32); + } + else if (ret == HDR_NT64) + { + sd = &nt_hdr64.OptionalHeader.DataDirectory[IMAGE_FILE_SECURITY_DIRECTORY]; + + nt_hdr = &nt_hdr64; + nt_hdr_size = sizeof(IMAGE_NT_HEADERS64); + } + else + return FALSE; + + sd->Size = dwSize; + sd->VirtualAddress = dwOfs; + + TRACE("size = %x addr = %x\n", sd->Size, sd->VirtualAddress); + + /* write the header back again */ + count = SetFilePointer(handle, pe_offset, NULL, FILE_BEGIN); + + if (count == INVALID_SET_FILE_POINTER) + return FALSE; + + count = 0; + + r = WriteFile(handle, nt_hdr, nt_hdr_size, &count, NULL); + + if (!r) + return FALSE; + + if (count != nt_hdr_size) + return FALSE; + + return TRUE; +} + +/*********************************************************************** * IMAGEHLP_GetCertificateOffset (INTERNAL) * * Read a file's PE header, and return the offset and size of the @@ -227,16 +288,111 @@ static BOOL IMAGEHLP_GetCertificateOffset( HANDLE handle, DWORD num, /*********************************************************************** * ImageAddCertificate (IMAGEHLP.@) + * + * Adds the specified certificate to the security directory of + * open PE file. */ BOOL WINAPI ImageAddCertificate( HANDLE FileHandle, LPWIN_CERTIFICATE Certificate, PDWORD Index) { - FIXME("(%p, %p, %p): stub\n", - FileHandle, Certificate, Index - ); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + DWORD size = 0, count = 0, offset = 0, sd_VirtualAddr = 0, index = 0; + WIN_CERTIFICATE hdr; + const size_t cert_hdr_size = sizeof hdr - sizeof hdr.bCertificate; + BOOL r; + + TRACE("(%p, %p, %p)\n", FileHandle, Certificate, Index); + + r = IMAGEHLP_GetSecurityDirOffset(FileHandle, &sd_VirtualAddr, &size); + + /* If we've already got a security directory, find the end of it */ + if ((r) && (sd_VirtualAddr != 0)) + { + offset = 0; + index = 0; + count = 0; + + /* Check if the security directory is at the end of the file. + If not, we should probably relocate it. */ + if (GetFileSize(FileHandle, NULL) != sd_VirtualAddr + size) + { + FIXME("Security directory already present but not located at EOF, not adding certificate\n"); + + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; + } + + while (offset < size) + { + /* read the length of the current certificate */ + count = SetFilePointer (FileHandle, sd_VirtualAddr + offset, + NULL, FILE_BEGIN); + + if (count == INVALID_SET_FILE_POINTER) + return FALSE; + + r = ReadFile(FileHandle, &hdr, cert_hdr_size, &count, NULL); + + if (!r) + return FALSE; + + if (count != cert_hdr_size) + return FALSE; + + /* check the certificate is not too big or too small */ + if (hdr.dwLength < cert_hdr_size) + return FALSE; + + if (hdr.dwLength > (size-offset)) + return FALSE; + + /* next certificate */ + offset += hdr.dwLength; + + /* padded out to the nearest 8-byte boundary */ + if (hdr.dwLength % 8) + offset += 8 - (hdr.dwLength % 8); + + index++; + } + + count = SetFilePointer (FileHandle, sd_VirtualAddr + offset, NULL, FILE_BEGIN); + + if (count == INVALID_SET_FILE_POINTER) + return FALSE; + } + else + { + sd_VirtualAddr = SetFilePointer(FileHandle, 0, NULL, FILE_END); + + if (sd_VirtualAddr == INVALID_SET_FILE_POINTER) + return FALSE; + } + + /* Write the certificate to the file */ + r = WriteFile(FileHandle, Certificate, Certificate->dwLength, &count, NULL); + + if (!r) + return FALSE; + + /* Pad out if necessary */ + if (Certificate->dwLength % 8) + { + char null[8]; + + ZeroMemory(null, 8); + WriteFile(FileHandle, null, 8 - (Certificate->dwLength % 8), NULL, NULL); + + size += 8 - (Certificate->dwLength % 8); + } + + size += Certificate->dwLength; + + /* Update the security directory offset and size */ + if (!IMAGEHLP_SetSecurityDirOffset(FileHandle, sd_VirtualAddr, size)) + return FALSE; + + return TRUE; } /*********************************************************************** diff --git a/dlls/imagehlp/tests/integrity.c b/dlls/imagehlp/tests/integrity.c index 01fd4e9..e89167c 100644 --- a/dlls/imagehlp/tests/integrity.c +++ b/dlls/imagehlp/tests/integrity.c @@ -146,7 +146,7 @@ static void test_add_certificate(void) cert->wCertificateType = WIN_CERT_TYPE_PKCS_SIGNED_DATA; CopyMemory(cert->bCertificate, test_cert_data, sizeof(test_cert_data)); - todo_wine ok(pImageAddCertificate(hFile, cert, &index), "Unable to add certificate to image, error %x\n", GetLastError()); + ok(pImageAddCertificate(hFile, cert, &index), "Unable to add certificate to image, error %x\n", GetLastError()); HeapFree(GetProcessHeap(), 0, cert); CloseHandle(hFile); @@ -170,7 +170,7 @@ static void test_get_certificate(void) ret = pImageGetCertificateData(hFile, 0, NULL, &cert_len); err = GetLastError(); - todo_wine ok ((ret == FALSE) && (err == ERROR_INSUFFICIENT_BUFFER), "ImageGetCertificateData gave unexpected result; ret=%d / err=%x\n", ret, err); + ok ((ret == FALSE) && (err == ERROR_INSUFFICIENT_BUFFER), "ImageGetCertificateData gave unexpected result; ret=%d / err=%x\n", ret, err); cert = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cert_len); @@ -181,8 +181,8 @@ static void test_get_certificate(void) return; } - todo_wine ok(ret = pImageGetCertificateData(hFile, 0, cert, &cert_len), "Unable to retrieve certificate; err=%x\n", GetLastError()); - todo_wine ok(memcmp(cert->bCertificate, test_cert_data, cert_len - sizeof(WIN_CERTIFICATE)) == 0, "Certificate retrieved did not match original\n"); + ok(ret = pImageGetCertificateData(hFile, 0, cert, &cert_len), "Unable to retrieve certificate; err=%x\n", GetLastError()); + ok(memcmp(cert->bCertificate, test_cert_data, cert_len - sizeof(WIN_CERTIFICATE)) == 0, "Certificate retrieved did not match original\n"); HeapFree(GetProcessHeap(), 0, cert); CloseHandle(hFile); @@ -204,7 +204,7 @@ static void test_remove_certificate(void) todo_wine ok (pImageRemoveCertificate(hFile, 0), "Unable to remove certificate from file; err=%x\n", GetLastError()); /* Test to see if the certificate has actually been removed */ - ok(pImageGetCertificateHeader(hFile, 0, &cert) == FALSE, "Certificate header retrieval succeeded when it should have failed\n"); + todo_wine ok(pImageGetCertificateHeader(hFile, 0, &cert) == FALSE, "Certificate header retrieval succeeded when it should have failed\n"); CloseHandle(hFile); }
1
0
0
0
Owen Rudge : imagehlp: Verify magic numbers and pad certificates to 8 byte boundaries.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: f5ebe032b08ba87aaaee35f7bda571eb92c67fda URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f5ebe032b08ba87aaaee35f7b…
Author: Owen Rudge <orudge(a)codeweavers.com> Date: Thu Dec 3 13:50:58 2009 -0600 imagehlp: Verify magic numbers and pad certificates to 8 byte boundaries. Includes checks for 64-bit file structure and avoids repeating header checks. --- dlls/imagehlp/integrity.c | 143 ++++++++++++++++++++++++++++++++++++-------- 1 files changed, 117 insertions(+), 26 deletions(-) diff --git a/dlls/imagehlp/integrity.c b/dlls/imagehlp/integrity.c index bbec56b..a46c853 100644 --- a/dlls/imagehlp/integrity.c +++ b/dlls/imagehlp/integrity.c @@ -3,6 +3,7 @@ * * Copyright 1998 Patrik Stridvall * Copyright 2003 Mike McCormack + * Copyright 2009 Owen Rudge for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -36,49 +37,129 @@ WINE_DEFAULT_DEBUG_CHANNEL(imagehlp); *
http://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt
*/ +#define HDR_FAIL -1 +#define HDR_NT32 0 +#define HDR_NT64 1 + /*********************************************************************** - * IMAGEHLP_GetSecurityDirOffset (INTERNAL) + * IMAGEHLP_GetNTHeaders (INTERNAL) * - * Read a file's PE header, and return the offset and size of the - * security directory. + * Return the IMAGE_NT_HEADERS for a PE file, after validating magic + * numbers and distinguishing between 32-bit and 64-bit files. */ -static BOOL IMAGEHLP_GetSecurityDirOffset( HANDLE handle, - DWORD *pdwOfs, DWORD *pdwSize ) +static int IMAGEHLP_GetNTHeaders(HANDLE handle, DWORD *pe_offset, IMAGE_NT_HEADERS32 *nt32, IMAGE_NT_HEADERS64 *nt64) { IMAGE_DOS_HEADER dos_hdr; - IMAGE_NT_HEADERS nt_hdr; DWORD count; BOOL r; - IMAGE_DATA_DIRECTORY *sd; - TRACE("handle %p\n", handle ); + TRACE("handle %p\n", handle); + + if ((!nt32) || (!nt64)) + return HDR_FAIL; /* read the DOS header */ - count = SetFilePointer( handle, 0, NULL, FILE_BEGIN ); - if( count == INVALID_SET_FILE_POINTER ) - return FALSE; + count = SetFilePointer(handle, 0, NULL, FILE_BEGIN); + + if (count == INVALID_SET_FILE_POINTER) + return HDR_FAIL; + count = 0; - r = ReadFile( handle, &dos_hdr, sizeof dos_hdr, &count, NULL ); - if( !r ) - return FALSE; - if( count != sizeof dos_hdr ) - return FALSE; + + r = ReadFile(handle, &dos_hdr, sizeof dos_hdr, &count, NULL); + + if (!r) + return HDR_FAIL; + + if (count != sizeof dos_hdr) + return HDR_FAIL; + + /* verify magic number of 'MZ' */ + if (dos_hdr.e_magic != 0x5A4D) + return HDR_FAIL; + + if (pe_offset != NULL) + *pe_offset = dos_hdr.e_lfanew; /* read the PE header */ - count = SetFilePointer( handle, dos_hdr.e_lfanew, NULL, FILE_BEGIN ); - if( count == INVALID_SET_FILE_POINTER ) - return FALSE; + count = SetFilePointer(handle, dos_hdr.e_lfanew, NULL, FILE_BEGIN); + + if (count == INVALID_SET_FILE_POINTER) + return HDR_FAIL; + count = 0; - r = ReadFile( handle, &nt_hdr, sizeof nt_hdr, &count, NULL ); - if( !r ) - return FALSE; - if( count != sizeof nt_hdr ) + + r = ReadFile(handle, nt32, sizeof(IMAGE_NT_HEADERS32), &count, NULL); + + if (!r) + return HDR_FAIL; + + if (count != sizeof(IMAGE_NT_HEADERS32)) + return HDR_FAIL; + + /* verify NT signature */ + if (nt32->Signature != IMAGE_NT_SIGNATURE) + return HDR_FAIL; + + /* check if we have a 32-bit or 64-bit executable */ + switch (nt32->OptionalHeader.Magic) + { + case IMAGE_NT_OPTIONAL_HDR32_MAGIC: + return HDR_NT32; + + case IMAGE_NT_OPTIONAL_HDR64_MAGIC: + /* Re-read as 64-bit */ + + count = SetFilePointer(handle, dos_hdr.e_lfanew, NULL, FILE_BEGIN); + + if (count == INVALID_SET_FILE_POINTER) + return HDR_FAIL; + + count = 0; + + r = ReadFile(handle, nt64, sizeof(IMAGE_NT_HEADERS64), &count, NULL); + + if (!r) + return HDR_FAIL; + + if (count != sizeof(IMAGE_NT_HEADERS64)) + return HDR_FAIL; + + /* verify NT signature */ + if (nt64->Signature != IMAGE_NT_SIGNATURE) + return HDR_FAIL; + + return HDR_NT64; + } + + return HDR_FAIL; +} + +/*********************************************************************** + * IMAGEHLP_GetSecurityDirOffset (INTERNAL) + * + * Read a file's PE header, and return the offset and size of the + * security directory. + */ +static BOOL IMAGEHLP_GetSecurityDirOffset( HANDLE handle, + DWORD *pdwOfs, DWORD *pdwSize ) +{ + IMAGE_NT_HEADERS32 nt_hdr32; + IMAGE_NT_HEADERS64 nt_hdr64; + IMAGE_DATA_DIRECTORY *sd; + int ret; + + ret = IMAGEHLP_GetNTHeaders(handle, NULL, &nt_hdr32, &nt_hdr64); + + if (ret == HDR_NT32) + sd = &nt_hdr32.OptionalHeader.DataDirectory[IMAGE_FILE_SECURITY_DIRECTORY]; + else if (ret == HDR_NT64) + sd = &nt_hdr64.OptionalHeader.DataDirectory[IMAGE_FILE_SECURITY_DIRECTORY]; + else return FALSE; - sd = &nt_hdr.OptionalHeader. - DataDirectory[IMAGE_FILE_SECURITY_DIRECTORY]; + TRACE("ret = %d size = %x addr = %x\n", ret, sd->Size, sd->VirtualAddress); - TRACE("size = %x addr = %x\n", sd->Size, sd->VirtualAddress); *pdwSize = sd->Size; *pdwOfs = sd->VirtualAddress; @@ -126,6 +207,11 @@ static BOOL IMAGEHLP_GetCertificateOffset( HANDLE handle, DWORD num, /* calculate the offset of the next certificate */ offset += len; + + /* padded out to the nearest 8-byte boundary */ + if( len % 8 ) + offset += 8 - (len % 8); + if( offset >= size ) return FALSE; } @@ -207,6 +293,11 @@ BOOL WINAPI ImageEnumerateCertificates( /* next certificate */ offset += hdr.dwLength; + + /* padded out to the nearest 8-byte boundary */ + if (hdr.dwLength % 8) + offset += 8 - (hdr.dwLength % 8); + index++; }
1
0
0
0
Vincent Povirk : ole32: Add an internal vtable to StorageBaseImpl objects.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: cc98619ca4627949d2d278858364f4e1b0c1b468 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cc98619ca4627949d2d278858…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Nov 25 15:07:57 2009 -0600 ole32: Add an internal vtable to StorageBaseImpl objects. --- dlls/ole32/storage32.c | 16 +++++++++++++--- dlls/ole32/storage32.h | 16 ++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 8f9683f..384722d 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -378,7 +378,7 @@ static ULONG WINAPI StorageBaseImpl_Release( * destructor of the appropriate derived class. To do this, we are * using virtual functions to implement the destructor. */ - This->v_destructor(This); + StorageBaseImpl_Destroy(This); } return ref; @@ -2219,6 +2219,11 @@ static const IStorageVtbl Storage32Impl_Vtbl = StorageBaseImpl_Stat }; +static const StorageBaseImplVtbl StorageImpl_BaseVtbl = +{ + StorageImpl_Destroy +}; + static HRESULT StorageImpl_Construct( HANDLE hFile, LPCOLESTR pwcsName, @@ -2249,7 +2254,7 @@ static HRESULT StorageImpl_Construct( This->base.lpVtbl = &Storage32Impl_Vtbl; This->base.pssVtbl = &IPropertySetStorage_Vtbl; - This->base.v_destructor = StorageImpl_Destroy; + This->base.baseVtbl = &StorageImpl_BaseVtbl; This->base.openFlags = (openFlags & ~STGM_CREATE); This->base.ref = 1; This->base.create = create; @@ -4074,6 +4079,11 @@ static const IStorageVtbl Storage32InternalImpl_Vtbl = StorageBaseImpl_Stat }; +static const StorageBaseImplVtbl StorageInternalImpl_BaseVtbl = +{ + StorageInternalImpl_Destroy +}; + /****************************************************************************** ** Storage32InternalImpl implementation */ @@ -4097,7 +4107,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct( * Initialize the virtual function table. */ newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl; - newStorage->base.v_destructor = StorageInternalImpl_Destroy; + newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl; newStorage->base.openFlags = (openFlags & ~STGM_CREATE); /* diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 20de0eb..c97a2b7 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -114,6 +114,7 @@ static const ULONG DIRENTRY_NULL = 0xFFFFFFFF; * module. */ typedef struct StorageBaseImpl StorageBaseImpl; +typedef struct StorageBaseImplVtbl StorageBaseImplVtbl; typedef struct StorageImpl StorageImpl; typedef struct BlockChainStream BlockChainStream; typedef struct SmallBlockChainStream SmallBlockChainStream; @@ -179,6 +180,7 @@ HRESULT BIGBLOCKFILE_WriteAt(LPBIGBLOCKFILE This, ULARGE_INTEGER offset, void OLECONVERT_CreateOleStream(LPSTORAGE pStorage); HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName); + /**************************************************************************** * Storage32BaseImpl definitions. * @@ -222,9 +224,9 @@ struct StorageBaseImpl DirRef storageDirEntry; /* - * virtual Destructor method. + * virtual methods. */ - void (*v_destructor)(StorageBaseImpl*); + const StorageBaseImplVtbl *baseVtbl; /* * flags that this storage was opened or created with @@ -243,6 +245,16 @@ struct StorageBaseImpl The behaviour of STGM_SIMPLE depends on this */ }; +/* virtual methods for StorageBaseImpl objects */ +struct StorageBaseImplVtbl { + void (*Destroy)(StorageBaseImpl*); +}; + +static inline void StorageBaseImpl_Destroy(StorageBaseImpl *This) +{ + This->baseVtbl->Destroy(This); +} + /**************************************************************************** * StorageBaseImpl stream list handlers */
1
0
0
0
Vincent Povirk : ole32: Unify the logic for overriding the root storage filename in Stat.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: f434ab1f2aa3b0c330c44f135c8ffce039d7016f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f434ab1f2aa3b0c330c44f135…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Dec 2 12:35:53 2009 -0600 ole32: Unify the logic for overriding the root storage filename in Stat. This is needed so that the new transacted type will be able to easily support this logic. --- dlls/ole32/stg_stream.c | 4 +--- dlls/ole32/storage32.c | 39 +++++++++------------------------------ dlls/ole32/storage32.h | 8 ++++---- 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c index bf88c64..5355594 100644 --- a/dlls/ole32/stg_stream.c +++ b/dlls/ole32/stg_stream.c @@ -858,9 +858,7 @@ static HRESULT WINAPI StgStreamImpl_Stat( if (readSuccessful) { - StorageImpl *root = This->parentStorage->ancestorStorage; - - StorageUtl_CopyDirEntryToSTATSTG(root, + StorageUtl_CopyDirEntryToSTATSTG(This->parentStorage, pstatstg, ¤tEntry, grfStatFlag); diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 971f44a..8f9683f 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -704,7 +704,7 @@ static HRESULT WINAPI StorageBaseImpl_Stat( if (readSuccessful) { StorageUtl_CopyDirEntryToSTATSTG( - This->ancestorStorage, + This, pstatstg, ¤tEntry, grfStatFlag); @@ -1841,30 +1841,6 @@ static HRESULT WINAPI StorageBaseImpl_DestroyElement( } -/************************************************************************ - * StorageImpl_Stat (IStorage) - * - * This method will retrieve information about this storage object. - * - * See Windows documentation for more details on IStorage methods. - */ -static HRESULT WINAPI StorageImpl_Stat( IStorage* iface, - STATSTG* pstatstg, /* [out] */ - DWORD grfStatFlag) /* [in] */ -{ - StorageImpl* const This = (StorageImpl*)iface; - HRESULT result = StorageBaseImpl_Stat( iface, pstatstg, grfStatFlag ); - - if ( SUCCEEDED(result) && ((grfStatFlag & STATFLAG_NONAME) == 0) && This->pwcsName ) - { - CoTaskMemFree(pstatstg->pwcsName); - pstatstg->pwcsName = CoTaskMemAlloc((lstrlenW(This->pwcsName)+1)*sizeof(WCHAR)); - strcpyW(pstatstg->pwcsName, This->pwcsName); - } - - return result; -} - /****************************************************************************** * Internal stream list handlers */ @@ -2240,7 +2216,7 @@ static const IStorageVtbl Storage32Impl_Vtbl = StorageBaseImpl_SetElementTimes, StorageBaseImpl_SetClass, StorageBaseImpl_SetStateBits, - StorageImpl_Stat + StorageBaseImpl_Stat }; static HRESULT StorageImpl_Construct( @@ -2295,6 +2271,9 @@ static HRESULT StorageImpl_Construct( goto end; } strcpyW(This->pwcsName, pwcsName); + + memcpy(This->base.filename, pwcsName, DIRENTRY_NAME_BUFFER_LEN-1); + This->base.filename[DIRENTRY_NAME_BUFFER_LEN-1] = 0; } /* @@ -3786,7 +3765,7 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Next( /* * Copy the information to the return buffer. */ - StorageUtl_CopyDirEntryToSTATSTG(This->parentStorage, + StorageUtl_CopyDirEntryToSTATSTG(&This->parentStorage->base, currentReturnStruct, ¤tEntry, STATFLAG_DEFAULT); @@ -4218,7 +4197,7 @@ void StorageUtl_WriteGUID(BYTE* buffer, ULONG offset, const GUID* value) } void StorageUtl_CopyDirEntryToSTATSTG( - StorageImpl* storage, + StorageBaseImpl* storage, STATSTG* destination, const DirEntry* source, int statFlags) @@ -5998,8 +5977,8 @@ HRESULT WINAPI StgOpenStorage( /* prepare the file name string given in lieu of the root property name */ GetFullPathNameW(pwcsName, MAX_PATH, fullname, NULL); - memcpy(newStorage->filename, fullname, DIRENTRY_NAME_BUFFER_LEN); - newStorage->filename[DIRENTRY_NAME_BUFFER_LEN-1] = '\0'; + memcpy(newStorage->base.filename, fullname, DIRENTRY_NAME_BUFFER_LEN); + newStorage->base.filename[DIRENTRY_NAME_BUFFER_LEN-1] = '\0'; /* * Get an "out" pointer for the caller. diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 59a8fb9..20de0eb 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -236,6 +236,9 @@ struct StorageBaseImpl */ DWORD stateBits; + /* If set, this overrides the root storage name returned by IStorage_Stat */ + WCHAR filename[DIRENTRY_NAME_BUFFER_LEN]; + BOOL create; /* Was the storage created or opened. The behaviour of STGM_SIMPLE depends on this */ }; @@ -264,9 +267,6 @@ struct StorageImpl HANDLE hFile; /* Physical support for the Docfile */ LPOLESTR pwcsName; /* Full path of the document file */ - /* FIXME: should this be in Storage32BaseImpl ? */ - WCHAR filename[DIRENTRY_NAME_BUFFER_LEN]; - /* * File header */ @@ -429,7 +429,7 @@ void StorageUtl_WriteULargeInteger(BYTE* buffer, ULONG offset, const ULARGE_INTEGER *value); void StorageUtl_ReadGUID(const BYTE* buffer, ULONG offset, GUID* value); void StorageUtl_WriteGUID(BYTE* buffer, ULONG offset, const GUID* value); -void StorageUtl_CopyDirEntryToSTATSTG(StorageImpl *storage,STATSTG* destination, +void StorageUtl_CopyDirEntryToSTATSTG(StorageBaseImpl *storage,STATSTG* destination, const DirEntry* source, int statFlags); /****************************************************************************
1
0
0
0
Vincent Povirk : ole32: Move the create attribute from StorageImpl to StorageBaseImpl.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: 5456724fd77b2c5e8e40c87d5c24cb8e1b27a96f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5456724fd77b2c5e8e40c87d5…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Dec 2 11:37:54 2009 -0600 ole32: Move the create attribute from StorageImpl to StorageBaseImpl. This is to avoid accessing the top-level StorageImpl directly. --- dlls/ole32/stg_stream.c | 2 +- dlls/ole32/storage32.c | 4 +++- dlls/ole32/storage32.h | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c index 60cbb88..bf88c64 100644 --- a/dlls/ole32/stg_stream.c +++ b/dlls/ole32/stg_stream.c @@ -868,7 +868,7 @@ static HRESULT WINAPI StgStreamImpl_Stat( pstatstg->grfMode = This->grfMode; /* In simple create mode cbSize is the current pos */ - if((This->parentStorage->openFlags & STGM_SIMPLE) && root->create) + if((This->parentStorage->openFlags & STGM_SIMPLE) && This->parentStorage->create) pstatstg->cbSize = This->currentPosition; return S_OK; diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index e7a8c73..971f44a 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -2276,7 +2276,7 @@ static HRESULT StorageImpl_Construct( This->base.v_destructor = StorageImpl_Destroy; This->base.openFlags = (openFlags & ~STGM_CREATE); This->base.ref = 1; - This->create = create; + This->base.create = create; /* * This is the top-level storage so initialize the ancestor pointer @@ -4131,6 +4131,8 @@ static StorageInternalImpl* StorageInternalImpl_Construct( */ newStorage->base.storageDirEntry = storageDirEntry; + newStorage->base.create = 0; + return newStorage; } diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 508bd70..59a8fb9 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -235,6 +235,9 @@ struct StorageBaseImpl * State bits appear to only be preserved while running. No in the stream */ DWORD stateBits; + + BOOL create; /* Was the storage created or opened. + The behaviour of STGM_SIMPLE depends on this */ }; /**************************************************************************** @@ -260,8 +263,6 @@ struct StorageImpl */ HANDLE hFile; /* Physical support for the Docfile */ LPOLESTR pwcsName; /* Full path of the document file */ - BOOL create; /* Was the storage created or opened. - The behaviour of STGM_SIMPLE depends on this */ /* FIXME: should this be in Storage32BaseImpl ? */ WCHAR filename[DIRENTRY_NAME_BUFFER_LEN];
1
0
0
0
Vincent Povirk : ole32: Check the current storage for STGM_SIMPLE rather than ancestorStorage.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: b6dc718c4410c0f8eb44747152535a7cc02245a5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b6dc718c4410c0f8eb4474715…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Dec 2 11:31:43 2009 -0600 ole32: Check the current storage for STGM_SIMPLE rather than ancestorStorage. Since simple mode does not support substorages, we know these are the same. --- dlls/ole32/stg_stream.c | 4 ++-- dlls/ole32/storage32.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c index 332ee8a..60cbb88 100644 --- a/dlls/ole32/stg_stream.c +++ b/dlls/ole32/stg_stream.c @@ -575,7 +575,7 @@ static HRESULT WINAPI StgStreamImpl_SetSize( } /* In simple mode keep the stream size above the small block limit */ - if (This->parentStorage->ancestorStorage->base.openFlags & STGM_SIMPLE) + if (This->parentStorage->openFlags & STGM_SIMPLE) libNewSize.u.LowPart = max(libNewSize.u.LowPart, LIMIT_TO_USE_SMALL_BLOCK); if (This->streamSize.u.LowPart == libNewSize.u.LowPart) @@ -868,7 +868,7 @@ static HRESULT WINAPI StgStreamImpl_Stat( pstatstg->grfMode = This->grfMode; /* In simple create mode cbSize is the current pos */ - if((root->base.openFlags & STGM_SIMPLE) && root->create) + if((This->parentStorage->openFlags & STGM_SIMPLE) && root->create) pstatstg->cbSize = This->currentPosition; return S_OK; diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 3991b9e..e7a8c73 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -866,7 +866,7 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream( return STG_E_ACCESSDENIED; } - if(This->ancestorStorage->base.openFlags & STGM_SIMPLE) + if(This->openFlags & STGM_SIMPLE) if(grfMode & STGM_CREATE) return STG_E_INVALIDFLAG; *ppstm = 0;
1
0
0
0
Vincent Povirk : ole32: Forbid substorages of simple mode storages.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: cf5e6c571ad7b7a78289a116e9fdf2c2d7910997 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cf5e6c571ad7b7a78289a116e…
Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Wed Dec 2 11:28:09 2009 -0600 ole32: Forbid substorages of simple mode storages. --- dlls/ole32/storage32.c | 11 +++++++++++ dlls/ole32/tests/storage32.c | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 089206d..3991b9e 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -530,6 +530,12 @@ static HRESULT WINAPI StorageBaseImpl_OpenStorage( goto end; } + if (This->openFlags & STGM_SIMPLE) + { + res = STG_E_INVALIDFUNCTION; + goto end; + } + /* as documented */ if (snbExclude != NULL) { @@ -1022,6 +1028,11 @@ static HRESULT WINAPI StorageBaseImpl_CreateStorage( if (ppstg == 0) return STG_E_INVALIDPOINTER; + if (This->openFlags & STGM_SIMPLE) + { + return STG_E_INVALIDFUNCTION; + } + if (pwcsName == 0) return STG_E_INVALIDNAME; diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index 53811db..6e222c7 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -1774,9 +1774,10 @@ static void test_simple(void) { /* Tests for STGM_SIMPLE mode */ - IStorage *stg; + IStorage *stg, *stg2; HRESULT r; IStream *stm; + static const WCHAR stgname[] = { 'S','t','g',0 }; static const WCHAR stmname[] = { 'C','O','N','T','E','N','T','S',0 }; static const WCHAR stmname2[] = { 'S','m','a','l','l',0 }; LARGE_INTEGER pos; @@ -1789,6 +1790,10 @@ static void test_simple(void) r = StgCreateDocfile( filename, STGM_SIMPLE | STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stg); ok(r == S_OK, "got %08x\n", r); + r = IStorage_CreateStorage(stg, stgname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stg2); + ok(r == STG_E_INVALIDFUNCTION, "got %08x\n", r); + if (SUCCEEDED(r)) IStorage_Release(stg2); + r = IStorage_CreateStream(stg, stmname, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); ok(r == STG_E_INVALIDFLAG, "got %08x\n", r); r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm); @@ -1853,6 +1858,10 @@ static void test_simple(void) } ok(r == S_OK, "got %08x\n", r); + r = IStorage_OpenStorage(stg, stgname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, NULL, 0, &stg2); + ok(r == STG_E_INVALIDFUNCTION, "got %08x\n", r); + if (SUCCEEDED(r)) IStorage_Release(stg2); + r = IStorage_OpenStream(stg, stmname, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, &stm); ok(r == S_OK, "got %08x\n", r);
1
0
0
0
Alexandre Julliard : rpcrt4/tests: Skip the get_ranged_enum test on old Windows versions.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: e48f4253a493e4b91224810db3e0fd0976e6793b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e48f4253a493e4b91224810db…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Dec 4 12:56:04 2009 +0100 rpcrt4/tests: Skip the get_ranged_enum test on old Windows versions. --- dlls/rpcrt4/tests/server.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index 6453f53..2a32b45 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -904,8 +904,11 @@ basic_tests(void) x = echo_ranged_int(100); ok(x == 100, "echo_ranged_int() returned %d instead of 100\n", x); - get_ranged_enum(&re); - ok(re == RE3, "get_ranged_enum() returned %d instead of RE3\n", re); + if (!old_windows_version) + { + get_ranged_enum(&re); + ok(re == RE3, "get_ranged_enum() returned %d instead of RE3\n", re); + } } static void
1
0
0
0
Francois Gouget : wininet: Make FTP_FtpOpenFileW() static.
by Alexandre Julliard
04 Dec '09
04 Dec '09
Module: wine Branch: master Commit: f3b738f63c3e3987f51fda1dfd94de8a05718e97 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f3b738f63c3e3987f51fda1df…
Author: Francois Gouget <fgouget(a)free.fr> Date: Fri Dec 4 11:43:25 2009 +0100 wininet: Make FTP_FtpOpenFileW() static. --- dlls/wininet/ftp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 1d8a8f9..1736ad5 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -1308,7 +1308,7 @@ static const object_vtbl_t FTPFILEVtbl = { * NULL on failure * */ -HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, +static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, LPCWSTR lpszFileName, DWORD fdwAccess, DWORD dwFlags, DWORD_PTR dwContext) {
1
0
0
0
← Newer
1
...
101
102
103
104
105
106
107
...
124
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Results per page:
10
25
50
100
200