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
March 2009
----- 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
28 participants
483 discussions
Start a n
N
ew thread
[dchapyshev] 40206: - Replace stub qedit on qedit from Wine
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue Mar 24 14:17:08 2009 New Revision: 40206 URL:
http://svn.reactos.org/svn/reactos?rev=40206&view=rev
Log: - Replace stub qedit on qedit from Wine Added: trunk/reactos/dll/directx/qedit/main.c (with props) trunk/reactos/dll/directx/qedit/mediadet.c (with props) trunk/reactos/dll/directx/qedit/qedit_private.h (with props) trunk/reactos/dll/directx/qedit/regsvr.c (with props) Removed: trunk/reactos/dll/directx/qedit/qedit.c trunk/reactos/dll/directx/qedit/qedit.rc Modified: trunk/reactos/dll/directx/qedit/qedit.rbuild Added: trunk/reactos/dll/directx/qedit/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/qedit/main.c?r…
============================================================================== --- trunk/reactos/dll/directx/qedit/main.c (added) +++ trunk/reactos/dll/directx/qedit/main.c [iso-8859-1] Tue Mar 24 14:17:08 2009 @@ -1,0 +1,184 @@ +/* DirectShow Editing Services (qedit.dll) + * + * Copyright 2008 Google (Lei Zhang) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "qedit_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(qedit); + +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) +{ + switch(fdwReason) { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hInstDLL); + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +/****************************************************************************** + * DirectShow ClassFactory + */ +typedef struct { + IClassFactory ITF_IClassFactory; + + LONG ref; + HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj); +} IClassFactoryImpl; + +struct object_creation_info +{ + const CLSID *clsid; + HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj); +}; + +static const struct object_creation_info object_creation[] = +{ + { &CLSID_MediaDet, MediaDet_create }, +}; + +static HRESULT WINAPI +DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + + if (IsEqualGUID(riid, &IID_IUnknown) + || IsEqualGUID(riid, &IID_IClassFactory)) + { + IClassFactory_AddRef(iface); + *ppobj = This; + return S_OK; + } + + *ppobj = NULL; + WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj); + return E_NOINTERFACE; +} + +static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + + ULONG ref = InterlockedDecrement(&This->ref); + + if (ref == 0) + CoTaskMemFree(This); + + return ref; +} + +static HRESULT WINAPI DSCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + HRESULT hres; + LPUNKNOWN punk; + + TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj); + + *ppobj = NULL; + hres = This->pfnCreateInstance(pOuter, (LPVOID *) &punk); + if (SUCCEEDED(hres)) { + hres = IUnknown_QueryInterface(punk, riid, ppobj); + IUnknown_Release(punk); + } + return hres; +} + +static HRESULT WINAPI DSCF_LockServer(LPCLASSFACTORY iface, BOOL dolock) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + FIXME("(%p)->(%d),stub!\n",This,dolock); + return S_OK; +} + +static const IClassFactoryVtbl DSCF_Vtbl = +{ + DSCF_QueryInterface, + DSCF_AddRef, + DSCF_Release, + DSCF_CreateInstance, + DSCF_LockServer +}; + + +/*********************************************************************** + * DllCanUnloadNow (QEDIT.@) + */ +HRESULT WINAPI DllCanUnloadNow(void) +{ + return S_OK; +} + +/******************************************************************************* + * DllGetClassObject [QEDIT.@] + * Retrieves class object from a DLL object + * + * PARAMS + * rclsid [I] CLSID for the class object + * riid [I] Reference to identifier of interface for class object + * ppv [O] Address of variable to receive interface pointer for riid + * + * RETURNS + * Success: S_OK + * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG, + * E_UNEXPECTED, E_NOINTERFACE + */ + +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) +{ + unsigned int i; + IClassFactoryImpl *factory; + + TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + + if ( !IsEqualGUID( &IID_IClassFactory, riid ) + && ! IsEqualGUID( &IID_IUnknown, riid) ) + return E_NOINTERFACE; + + for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++) + { + if (IsEqualGUID(object_creation[i].clsid, rclsid)) + break; + } + + if (i == sizeof(object_creation)/sizeof(object_creation[0])) + { + FIXME("%s: no class found.\n", debugstr_guid(rclsid)); + return CLASS_E_CLASSNOTAVAILABLE; + } + + factory = CoTaskMemAlloc(sizeof(*factory)); + if (factory == NULL) return E_OUTOFMEMORY; + + factory->ITF_IClassFactory.lpVtbl = &DSCF_Vtbl; + factory->ref = 1; + + factory->pfnCreateInstance = object_creation[i].pfnCreateInstance; + + *ppv = &(factory->ITF_IClassFactory); + return S_OK; +} Propchange: trunk/reactos/dll/directx/qedit/main.c ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/directx/qedit/mediadet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/qedit/mediadet…
============================================================================== --- trunk/reactos/dll/directx/qedit/mediadet.c (added) +++ trunk/reactos/dll/directx/qedit/mediadet.c [iso-8859-1] Tue Mar 24 14:17:08 2009 @@ -1,0 +1,610 @@ +/* DirectShow Media Detector object (QEDIT.DLL) + * + * Copyright 2008 Google (Lei Zhang, Dan Hipschman) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <assert.h> +#include <stdarg.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" + +#include "qedit_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(qedit); + +typedef struct MediaDetImpl { + const IMediaDetVtbl *MediaDet_Vtbl; + LONG refCount; + IGraphBuilder *graph; + IBaseFilter *source; + IBaseFilter *splitter; + long num_streams; + long cur_stream; + IPin *cur_pin; +} MediaDetImpl; + +static void MD_cleanup(MediaDetImpl *This) +{ + if (This->cur_pin) IPin_Release(This->cur_pin); + This->cur_pin = NULL; + if (This->source) IBaseFilter_Release(This->source); + This->source = NULL; + if (This->splitter) IBaseFilter_Release(This->splitter); + This->splitter = NULL; + if (This->graph) IGraphBuilder_Release(This->graph); + This->graph = NULL; + This->num_streams = -1; + This->cur_stream = 0; +} + +static ULONG WINAPI MediaDet_AddRef(IMediaDet* iface) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + ULONG refCount = InterlockedIncrement(&This->refCount); + TRACE("(%p)->() AddRef from %d\n", This, refCount - 1); + return refCount; +} + +static ULONG WINAPI MediaDet_Release(IMediaDet* iface) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + ULONG refCount = InterlockedDecrement(&This->refCount); + TRACE("(%p)->() Release from %d\n", This, refCount + 1); + + if (refCount == 0) + { + MD_cleanup(This); + CoTaskMemFree(This); + return 0; + } + + return refCount; +} + +static HRESULT WINAPI MediaDet_QueryInterface(IMediaDet* iface, REFIID riid, + void **ppvObject) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IMediaDet)) { + MediaDet_AddRef(iface); + *ppvObject = This; + return S_OK; + } + *ppvObject = NULL; + WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject); + return E_NOINTERFACE; +} + +static HRESULT WINAPI MediaDet_get_Filter(IMediaDet* iface, IUnknown **pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p)->(%p): not implemented!\n", This, pVal); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *newVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p)->(%p): not implemented!\n", This, newVal); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet* iface, long *pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + IEnumPins *pins; + IPin *pin; + HRESULT hr; + + TRACE("(%p)\n", This); + + if (!This->splitter) + return E_INVALIDARG; + + if (This->num_streams != -1) + { + *pVal = This->num_streams; + return S_OK; + } + + *pVal = 0; + + hr = IBaseFilter_EnumPins(This->splitter, &pins); + if (FAILED(hr)) + return hr; + + while (IEnumPins_Next(pins, 1, &pin, NULL) == S_OK) + { + PIN_DIRECTION dir; + hr = IPin_QueryDirection(pin, &dir); + IPin_Release(pin); + if (FAILED(hr)) + { + IEnumPins_Release(pins); + return hr; + } + + if (dir == PINDIR_OUTPUT) + ++*pVal; + } + IEnumPins_Release(pins); + + This->num_streams = *pVal; + return S_OK; +} + +static HRESULT WINAPI MediaDet_get_CurrentStream(IMediaDet* iface, long *pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + TRACE("(%p)\n", This); + + if (!pVal) + return E_POINTER; + + *pVal = This->cur_stream; + return S_OK; +} + +static HRESULT SetCurPin(MediaDetImpl *This, long strm) +{ + IEnumPins *pins; + IPin *pin; + HRESULT hr; + + assert(This->splitter); + assert(0 <= strm && strm < This->num_streams); + + if (This->cur_pin) + { + IPin_Release(This->cur_pin); + This->cur_pin = NULL; + } + + hr = IBaseFilter_EnumPins(This->splitter, &pins); + if (FAILED(hr)) + return hr; + + while (IEnumPins_Next(pins, 1, &pin, NULL) == S_OK && !This->cur_pin) + { + PIN_DIRECTION dir; + hr = IPin_QueryDirection(pin, &dir); + if (FAILED(hr)) + { + IPin_Release(pin); + IEnumPins_Release(pins); + return hr; + } + + if (dir == PINDIR_OUTPUT && strm-- == 0) + This->cur_pin = pin; + else + IPin_Release(pin); + } + IEnumPins_Release(pins); + + assert(This->cur_pin); + return S_OK; +} + +static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet* iface, long newVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + HRESULT hr; + + TRACE("(%p)->(%ld)\n", This, newVal); + + if (This->num_streams == -1) + { + long n; + hr = MediaDet_get_OutputStreams(iface, &n); + if (FAILED(hr)) + return hr; + } + + if (newVal < 0 || This->num_streams <= newVal) + return E_INVALIDARG; + + hr = SetCurPin(This, newVal); + if (FAILED(hr)) + return hr; + + This->cur_stream = newVal; + return S_OK; +} + +static HRESULT WINAPI MediaDet_get_StreamType(IMediaDet* iface, GUID *pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p)->(%p): not implemented!\n", This, debugstr_guid(pVal)); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaDet_get_StreamTypeB(IMediaDet* iface, BSTR *pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p)->(%p): not implemented!\n", This, pVal); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaDet_get_StreamLength(IMediaDet* iface, double *pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p): stub!\n", This); + return VFW_E_INVALIDMEDIATYPE; +} + +static HRESULT WINAPI MediaDet_get_Filename(IMediaDet* iface, BSTR *pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + IFileSourceFilter *file; + LPOLESTR name; + HRESULT hr; + + TRACE("(%p)\n", This); + + if (!pVal) + return E_POINTER; + + *pVal = NULL; + /* MSDN says it should return E_FAIL if no file is open, but tests + show otherwise. */ + if (!This->source) + return S_OK; + + hr = IBaseFilter_QueryInterface(This->source, &IID_IFileSourceFilter, + (void **) &file); + if (FAILED(hr)) + return hr; + + hr = IFileSourceFilter_GetCurFile(file, &name, NULL); + IFileSourceFilter_Release(file); + if (FAILED(hr)) + return hr; + + *pVal = SysAllocString(name); + CoTaskMemFree(name); + if (!*pVal) + return E_OUTOFMEMORY; + + return S_OK; +} + +/* From quartz, 2008/04/07 */ +static HRESULT GetFilterInfo(IMoniker *pMoniker, GUID *pclsid, VARIANT *pvar) +{ + static const WCHAR wszClsidName[] = {'C','L','S','I','D',0}; + static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0}; + IPropertyBag *pPropBagCat = NULL; + HRESULT hr; + + VariantInit(pvar); + V_VT(pvar) = VT_BSTR; + + hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag, + (LPVOID *) &pPropBagCat); + + if (SUCCEEDED(hr)) + hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL); + + if (SUCCEEDED(hr)) + hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid); + + if (SUCCEEDED(hr)) + hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL); + + if (SUCCEEDED(hr)) + TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), + debugstr_w(V_UNION(pvar, bstrVal))); + + if (pPropBagCat) + IPropertyBag_Release(pPropBagCat); + + return hr; +} + +static HRESULT GetSplitter(MediaDetImpl *This) +{ + IFileSourceFilter *file; + LPOLESTR name; + AM_MEDIA_TYPE mt; + GUID type[2]; + IFilterMapper2 *map; + IEnumMoniker *filters; + IMoniker *mon; + VARIANT var; + GUID clsid; + IBaseFilter *splitter; + IEnumPins *pins; + IPin *source_pin, *splitter_pin; + HRESULT hr; + + hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, + &IID_IFilterMapper2, (void **) &map); + if (FAILED(hr)) + return hr; + + hr = IBaseFilter_QueryInterface(This->source, &IID_IFileSourceFilter, + (void **) &file); + if (FAILED(hr)) + { + IFilterMapper2_Release(map); + return hr; + } + + hr = IFileSourceFilter_GetCurFile(file, &name, &mt); + IFileSourceFilter_Release(file); + CoTaskMemFree(name); + if (FAILED(hr)) + { + IFilterMapper2_Release(map); + return hr; + } + type[0] = mt.majortype; + type[1] = mt.subtype; + CoTaskMemFree(mt.pbFormat); + + hr = IFilterMapper2_EnumMatchingFilters(map, &filters, 0, TRUE, + MERIT_UNLIKELY, FALSE, 1, type, + NULL, NULL, FALSE, TRUE, + 0, NULL, NULL, NULL); + IFilterMapper2_Release(map); + if (FAILED(hr)) + return hr; + + hr = IEnumMoniker_Next(filters, 1, &mon, NULL); + IEnumMoniker_Release(filters); + if (hr != S_OK) /* No matches, what do we do? */ + return E_NOINTERFACE; + + hr = GetFilterInfo(mon, &clsid, &var); + IMoniker_Release(mon); + if (FAILED(hr)) + return hr; + + hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, + &IID_IBaseFilter, (void **) &splitter); + if (FAILED(hr)) + return hr; + + hr = IGraphBuilder_AddFilter(This->graph, splitter, + V_UNION(&var, bstrVal)); + if (FAILED(hr)) + { + IBaseFilter_Release(splitter); + return hr; + } + This->splitter = splitter; + + hr = IBaseFilter_EnumPins(This->source, &pins); + if (FAILED(hr)) + return hr; + IEnumPins_Next(pins, 1, &source_pin, NULL); + IEnumPins_Release(pins); + + hr = IBaseFilter_EnumPins(splitter, &pins); + if (FAILED(hr)) + { + IPin_Release(source_pin); + return hr; + } + IEnumPins_Next(pins, 1, &splitter_pin, NULL); + IEnumPins_Release(pins); + + hr = IPin_Connect(source_pin, splitter_pin, NULL); + IPin_Release(source_pin); + IPin_Release(splitter_pin); + if (FAILED(hr)) + return hr; + + return S_OK; +} + +static HRESULT WINAPI MediaDet_put_Filename(IMediaDet* iface, BSTR newVal) +{ + static const WCHAR reader[] = {'R','e','a','d','e','r',0}; + MediaDetImpl *This = (MediaDetImpl *)iface; + IGraphBuilder *gb; + IBaseFilter *bf; + HRESULT hr; + + TRACE("(%p)->(%s)\n", This, debugstr_w(newVal)); + + if (This->graph) + { + WARN("MSDN says not to call this method twice\n"); + MD_cleanup(This); + } + + hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, + &IID_IGraphBuilder, (void **) &gb); + if (FAILED(hr)) + return hr; + + hr = IGraphBuilder_AddSourceFilter(gb, newVal, reader, &bf); + if (FAILED(hr)) + { + IGraphBuilder_Release(gb); + return hr; + } + + This->graph = gb; + This->source = bf; + hr = GetSplitter(This); + if (FAILED(hr)) + return hr; + + return MediaDet_put_CurrentStream(iface, 0); +} + +static HRESULT WINAPI MediaDet_GetBitmapBits(IMediaDet* iface, + double StreamTime, + long *pBufferSize, char *pBuffer, + long Width, long Height) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p)->(%f %p %p %ld %ld): not implemented!\n", This, StreamTime, pBufferSize, pBuffer, + Width, Height); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaDet_WriteBitmapBits(IMediaDet* iface, + double StreamTime, long Width, + long Height, BSTR Filename) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p)->(%f %ld %ld %p): not implemented!\n", This, StreamTime, Width, Height, Filename); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaDet_get_StreamMediaType(IMediaDet* iface, + AM_MEDIA_TYPE *pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + IEnumMediaTypes *types; + AM_MEDIA_TYPE *pmt; + HRESULT hr; + + TRACE("(%p)\n", This); + + if (!pVal) + return E_POINTER; + + if (!This->cur_pin) + return E_INVALIDARG; + + hr = IPin_EnumMediaTypes(This->cur_pin, &types); + if (SUCCEEDED(hr)) + { + hr = (IEnumMediaTypes_Next(types, 1, &pmt, NULL) == S_OK + ? S_OK + : E_NOINTERFACE); + IEnumMediaTypes_Release(types); + } + + if (SUCCEEDED(hr)) + { + *pVal = *pmt; + CoTaskMemFree(pmt); + } + + return hr; +} + +static HRESULT WINAPI MediaDet_GetSampleGrabber(IMediaDet* iface, + ISampleGrabber **ppVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p)->(%p): not implemented!\n", This, ppVal); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaDet_get_FrameRate(IMediaDet* iface, double *pVal) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + AM_MEDIA_TYPE mt; + VIDEOINFOHEADER *vh; + HRESULT hr; + + TRACE("(%p)\n", This); + + if (!pVal) + return E_POINTER; + + hr = MediaDet_get_StreamMediaType(iface, &mt); + if (FAILED(hr)) + return hr; + + if (!IsEqualGUID(&mt.majortype, &MEDIATYPE_Video)) + { + CoTaskMemFree(mt.pbFormat); + return VFW_E_INVALIDMEDIATYPE; + } + + vh = (VIDEOINFOHEADER *) mt.pbFormat; + *pVal = 1.0e7 / (double) vh->AvgTimePerFrame; + + CoTaskMemFree(mt.pbFormat); + return S_OK; +} + +static HRESULT WINAPI MediaDet_EnterBitmapGrabMode(IMediaDet* iface, + double SeekTime) +{ + MediaDetImpl *This = (MediaDetImpl *)iface; + FIXME("(%p)->(%f): not implemented!\n", This, SeekTime); + return E_NOTIMPL; +} + +static const IMediaDetVtbl IMediaDet_VTable = +{ + MediaDet_QueryInterface, + MediaDet_AddRef, + MediaDet_Release, + MediaDet_get_Filter, + MediaDet_put_Filter, + MediaDet_get_OutputStreams, + MediaDet_get_CurrentStream, + MediaDet_put_CurrentStream, + MediaDet_get_StreamType, + MediaDet_get_StreamTypeB, + MediaDet_get_StreamLength, + MediaDet_get_Filename, + MediaDet_put_Filename, + MediaDet_GetBitmapBits, + MediaDet_WriteBitmapBits, + MediaDet_get_StreamMediaType, + MediaDet_GetSampleGrabber, + MediaDet_get_FrameRate, + MediaDet_EnterBitmapGrabMode, +}; + +HRESULT MediaDet_create(IUnknown * pUnkOuter, LPVOID * ppv) { + MediaDetImpl* obj = NULL; + + TRACE("(%p,%p)\n", ppv, pUnkOuter); + + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + obj = CoTaskMemAlloc(sizeof(MediaDetImpl)); + if (NULL == obj) { + *ppv = NULL; + return E_OUTOFMEMORY; + } + ZeroMemory(obj, sizeof(MediaDetImpl)); + + obj->refCount = 1; + obj->MediaDet_Vtbl = &IMediaDet_VTable; + obj->graph = NULL; + obj->source = NULL; + obj->splitter = NULL; + obj->cur_pin = NULL; + obj->num_streams = -1; + obj->cur_stream = 0; + *ppv = obj; + + return S_OK; +} Propchange: trunk/reactos/dll/directx/qedit/mediadet.c ------------------------------------------------------------------------------ svn:eol-style = native Removed: trunk/reactos/dll/directx/qedit/qedit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/qedit/qedit.c?…
============================================================================== --- trunk/reactos/dll/directx/qedit/qedit.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/qedit/qedit.c (removed) @@ -1,51 +1,0 @@ -/* - * QEDIT.DLL - ReactOS DirectShow Editing - * - * Copyright 2008 Dmitry Chapyshev - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <windows.h> -#include <stdio.h> -#include <wchar.h> -#include <tchar.h> - -HRESULT WINAPI -DllCanUnloadNow(void) -{ - return S_OK; -} - -HRESULT WINAPI -DllGetClassObject( - REFCLSID rclsid, - REFIID riid, - LPVOID *ppv) -{ - return S_OK; -} - -HRESULT WINAPI -DllRegisterServer(void) -{ - return S_OK; -} - -HRESULT WINAPI -DllUnregisterServer(void) -{ - return S_OK; -} Modified: trunk/reactos/dll/directx/qedit/qedit.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/qedit/qedit.rb…
============================================================================== --- trunk/reactos/dll/directx/qedit/qedit.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/directx/qedit/qedit.rbuild [iso-8859-1] Tue Mar 24 14:17:08 2009 @@ -1,13 +1,19 @@ -<?xml version="1.0"?> -<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> -<group> -<module name="qedit" type="win32dll" entrypoint="0" baseaddress="${BASEADDRESS_QEDIT}" installbase="system32" installname="qedit.dll"> +<module name="qedit" type="win32dll" baseaddress="${BASEADDRESS_QEDIT}" installbase="system32" installname="qedit.dll" allowwarnings="true"> + <autoregister infsection="OleControlDlls" type="DllRegisterServer" /> <importlibrary definition="qedit.spec" /> <include base="qedit">.</include> + <include base="ReactOS">include/reactos/wine</include> + <define name="_WIN32_WINNT">0x600</define> + <define name="__WINESRC__" /> + <file>main.c</file> + <file>mediadet.c</file> + <file>regsvr.c</file> + <library>wine</library> + <library>strmiids</library> + <library>uuid</library> + <library>oleaut32</library> + <library>ole32</library> <library>advapi32</library> <library>kernel32</library> <library>ntdll</library> - <file>qedit.c</file> - <file>qedit.rc</file> </module> -</group> Removed: trunk/reactos/dll/directx/qedit/qedit.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/qedit/qedit.rc…
============================================================================== --- trunk/reactos/dll/directx/qedit/qedit.rc [iso-8859-1] (original) +++ trunk/reactos/dll/directx/qedit/qedit.rc (removed) @@ -1,9 +1,0 @@ - -#define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS DirectShow Editing\0" -#define REACTOS_STR_INTERNAL_NAME "qedit\0" -#define REACTOS_STR_ORIGINAL_FILENAME "qedit.dll\0" - -#include <reactos/reactx.h> - -#include <reactos/version.rc> Added: trunk/reactos/dll/directx/qedit/qedit_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/qedit/qedit_pr…
============================================================================== --- trunk/reactos/dll/directx/qedit/qedit_private.h (added) +++ trunk/reactos/dll/directx/qedit/qedit_private.h [iso-8859-1] Tue Mar 24 14:17:08 2009 @@ -1,0 +1,41 @@ +/* DirectShow Editing Services (qedit.dll) + * + * Copyright 2008 Google (Lei Zhang) + * + * This file contains the (internal) driver registration functions, + * driver enumeration APIs and DirectDraw creation functions. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __QEDIT_PRIVATE_INCLUDED__ +#define __QEDIT_PRIVATE_INCLUDED__ + +#include <stdarg.h> + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "wtypes.h" +#include "wingdi.h" +#include "winuser.h" +#include "dshow.h" +#define __WINE_DDRAW_H /* ROS HACK */ +#include "qedit.h" + +HRESULT MediaDet_create(IUnknown *pUnkOuter, LPVOID *ppObj); + +#endif /* __QEDIT_PRIVATE_INCLUDED__ */ Propchange: trunk/reactos/dll/directx/qedit/qedit_private.h ------------------------------------------------------------------------------ svn:eol-style = native Added: trunk/reactos/dll/directx/qedit/regsvr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/qedit/regsvr.c…
============================================================================== --- trunk/reactos/dll/directx/qedit/regsvr.c (added) +++ trunk/reactos/dll/directx/qedit/regsvr.c [iso-8859-1] Tue Mar 24 14:17:08 2009 @@ -1,0 +1,324 @@ +/* + * self-registerable dll functions for qedit.dll + * + * Copyright (C) 2008 Google (Lei Zhang) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "qedit_private.h" +#include "winreg.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(qedit); + +struct regsvr_coclass +{ + CLSID const *clsid; /* NULL for end of list */ + LPCSTR name; /* can be NULL to omit */ + LPCSTR ips; /* can be NULL to omit */ + LPCSTR ips32; /* can be NULL to omit */ + LPCSTR ips32_tmodel; /* can be NULL to omit */ + LPCSTR progid; /* can be NULL to omit */ + LPCSTR viprogid; /* can be NULL to omit */ + LPCSTR progid_extra; /* can be NULL to omit */ +}; + +static HRESULT register_coclasses(struct regsvr_coclass const *list); +static HRESULT unregister_coclasses(struct regsvr_coclass const *list); + +/*********************************************************************** + * static string constants + */ +static WCHAR const clsid_keyname[6] = { + 'C', 'L', 'S', 'I', 'D', 0 }; +static WCHAR const curver_keyname[7] = { + 'C', 'u', 'r', 'V', 'e', 'r', 0 }; +static WCHAR const ips_keyname[13] = { + 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', 0 }; +static WCHAR const ips32_keyname[15] = { + 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', '3', '2', 0 }; +static WCHAR const progid_keyname[7] = { + 'P', 'r', 'o', 'g', 'I', 'D', 0 }; +static WCHAR const viprogid_keyname[25] = { + 'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p', + 'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D', + 0 }; +static char const tmodel_valuename[] = "ThreadingModel"; + +/*********************************************************************** + * static helper functions + */ +static LONG register_key_defvalueW(HKEY base, WCHAR const *name, + WCHAR const *value); +static LONG register_key_defvalueA(HKEY base, WCHAR const *name, + char const *value); +static LONG register_progid(WCHAR const *clsid, + char const *progid, char const *curver_progid, + char const *name, char const *extra); + + + +/*********************************************************************** + * register_coclasses + */ +static HRESULT register_coclasses(struct regsvr_coclass const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY coclass_key; + + res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL); + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->clsid; ++list) { + WCHAR buf[39]; + HKEY clsid_key; + + StringFromGUID2(list->clsid, buf, 39); + res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + + if (list->name) { + res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, + (CONST BYTE*)(list->name), + strlen(list->name) + 1); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->ips) { + res = register_key_defvalueA(clsid_key, ips_keyname, list->ips); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->ips32) { + HKEY ips32_key; + + res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, + &ips32_key, NULL); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + + res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, + (CONST BYTE*)list->ips32, + lstrlenA(list->ips32) + 1); + if (res == ERROR_SUCCESS && list->ips32_tmodel) + res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ, + (CONST BYTE*)list->ips32_tmodel, + strlen(list->ips32_tmodel) + 1); + RegCloseKey(ips32_key); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->progid) { + res = register_key_defvalueA(clsid_key, progid_keyname, + list->progid); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + + res = register_progid(buf, list->progid, NULL, + list->name, list->progid_extra); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + + if (list->viprogid) { + res = register_key_defvalueA(clsid_key, viprogid_keyname, + list->viprogid); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + + res = register_progid(buf, list->viprogid, list->progid, + list->name, list->progid_extra); + if (res != ERROR_SUCCESS) goto error_close_clsid_key; + } + +error_close_clsid_key: + RegCloseKey(clsid_key); + } + +error_close_coclass_key: + RegCloseKey(coclass_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * unregister_coclasses + */ +static HRESULT unregister_coclasses(struct regsvr_coclass const *list) +{ + LONG res = ERROR_SUCCESS; + HKEY coclass_key; + + res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, + KEY_READ | KEY_WRITE, &coclass_key); + if (res == ERROR_FILE_NOT_FOUND) return S_OK; + if (res != ERROR_SUCCESS) goto error_return; + + for (; res == ERROR_SUCCESS && list->clsid; ++list) { + WCHAR buf[39]; + + StringFromGUID2(list->clsid, buf, 39); + res = RegDeleteTreeW(coclass_key, buf); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + + if (list->progid) { + res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + } + + if (list->viprogid) { + res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; + if (res != ERROR_SUCCESS) goto error_close_coclass_key; + } + } + +error_close_coclass_key: + RegCloseKey(coclass_key); +error_return: + return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; +} + +/*********************************************************************** + * regsvr_key_defvalueW + */ +static LONG register_key_defvalueW( + HKEY base, + WCHAR const *name, + WCHAR const *value) +{ + LONG res; + HKEY key; + + res = RegCreateKeyExW(base, name, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &key, NULL); + if (res != ERROR_SUCCESS) return res; + res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value, + (lstrlenW(value) + 1) * sizeof(WCHAR)); + RegCloseKey(key); + return res; +} + +/*********************************************************************** + * regsvr_key_defvalueA + */ +static LONG register_key_defvalueA( + HKEY base, + WCHAR const *name, + char const *value) +{ + LONG res; + HKEY key; + + res = RegCreateKeyExW(base, name, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &key, NULL); + if (res != ERROR_SUCCESS) return res; + res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value, + lstrlenA(value) + 1); + RegCloseKey(key); + return res; +} + +/*********************************************************************** + * regsvr_progid + */ +static LONG register_progid( + WCHAR const *clsid, + char const *progid, + char const *curver_progid, + char const *name, + char const *extra) +{ + LONG res; + HKEY progid_key; + + res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0, + NULL, 0, KEY_READ | KEY_WRITE, NULL, + &progid_key, NULL); + if (res != ERROR_SUCCESS) return res; + + if (name) { + res = RegSetValueExA(progid_key, NULL, 0, REG_SZ, + (CONST BYTE*)name, strlen(name) + 1); + if (res != ERROR_SUCCESS) goto error_close_progid_key; + } + + if (clsid) { + res = register_key_defvalueW(progid_key, clsid_keyname, clsid); + if (res != ERROR_SUCCESS) goto error_close_progid_key; + } + + if (curver_progid) { + res = register_key_defvalueA(progid_key, curver_keyname, + curver_progid); + if (res != ERROR_SUCCESS) goto error_close_progid_key; + } + + if (extra) { + HKEY extra_key; + + res = RegCreateKeyExA(progid_key, extra, 0, + NULL, 0, KEY_READ | KEY_WRITE, NULL, + &extra_key, NULL); + if (res == ERROR_SUCCESS) + RegCloseKey(extra_key); + } + +error_close_progid_key: + RegCloseKey(progid_key); + return res; +} + +/*********************************************************************** + * coclass list + */ +static struct regsvr_coclass const coclass_list[] = { + { &CLSID_MediaDet, + "MediaDet", + NULL, + "qedit.dll", + "Both" + }, + { NULL } /* list terminator */ +}; + +/*********************************************************************** + * DllRegisterServer (QEDIT.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + hr = register_coclasses(coclass_list); + return hr; +} + +/*********************************************************************** + * DllUnregisterServer (QEDIT.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + hr = unregister_coclasses(coclass_list); + return S_OK; +} Propchange: trunk/reactos/dll/directx/qedit/regsvr.c ------------------------------------------------------------------------------ svn:eol-style = native
15 years, 9 months
1
0
0
0
[dchapyshev] 40205: - Sync Tahoma fonts with Wine head
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Tue Mar 24 14:09:11 2009 New Revision: 40205 URL:
http://svn.reactos.org/svn/reactos?rev=40205&view=rev
Log: - Sync Tahoma fonts with Wine head Modified: trunk/reactos/media/fonts/tahoma.ttf trunk/reactos/media/fonts/tahomabd.ttf Modified: trunk/reactos/media/fonts/tahoma.ttf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/fonts/tahoma.ttf?rev…
============================================================================== Binary files - no diff available. Modified: trunk/reactos/media/fonts/tahomabd.ttf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/fonts/tahomabd.ttf?r…
============================================================================== Binary files - no diff available.
15 years, 9 months
1
0
0
0
[tkreuzer] 40204: [FORMATTING] fix indentation, no code change.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 24 07:42:21 2009 New Revision: 40204 URL:
http://svn.reactos.org/svn/reactos?rev=40204&view=rev
Log: [FORMATTING] fix indentation, no code change. Modified: trunk/reactos/subsystems/win32/win32k/objects/dcstate.c Modified: trunk/reactos/subsystems/win32/win32k/objects/dcstate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] Tue Mar 24 07:42:21 2009 @@ -1,4 +1,4 @@ -/* +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: Functions for creation and destruction of DCs @@ -16,68 +16,68 @@ FASTCALL IntGdiCopyToSaveState(PDC dc, PDC newdc) { - PDC_ATTR pdcattr, nDc_Attr; - - pdcattr = dc->pdcattr; - nDc_Attr = newdc->pdcattr; - - newdc->dclevel.flPath = dc->dclevel.flPath | DCPATH_SAVESTATE; - - nDc_Attr->dwLayout = pdcattr->dwLayout; - nDc_Attr->hpen = pdcattr->hpen; - nDc_Attr->hbrush = pdcattr->hbrush; - nDc_Attr->hlfntNew = pdcattr->hlfntNew; - newdc->rosdc.hBitmap = dc->rosdc.hBitmap; - newdc->dclevel.hpal = dc->dclevel.hpal; - newdc->rosdc.bitsPerPixel = dc->rosdc.bitsPerPixel; - nDc_Attr->jROP2 = pdcattr->jROP2; - nDc_Attr->jFillMode = pdcattr->jFillMode; - nDc_Attr->jStretchBltMode = pdcattr->jStretchBltMode; - nDc_Attr->lRelAbs = pdcattr->lRelAbs; - nDc_Attr->jBkMode = pdcattr->jBkMode; - nDc_Attr->lBkMode = pdcattr->lBkMode; - nDc_Attr->crBackgroundClr = pdcattr->crBackgroundClr; - nDc_Attr->crForegroundClr = pdcattr->crForegroundClr; - nDc_Attr->ulBackgroundClr = pdcattr->ulBackgroundClr; - nDc_Attr->ulForegroundClr = pdcattr->ulForegroundClr; - nDc_Attr->ptlBrushOrigin = pdcattr->ptlBrushOrigin; - nDc_Attr->lTextAlign = pdcattr->lTextAlign; - nDc_Attr->lTextExtra = pdcattr->lTextExtra; - nDc_Attr->cBreak = pdcattr->cBreak; - nDc_Attr->lBreakExtra = pdcattr->lBreakExtra; - nDc_Attr->iMapMode = pdcattr->iMapMode; - nDc_Attr->iGraphicsMode = pdcattr->iGraphicsMode; -#if 0 - /* Apparently, the DC origin is not changed by [GS]etDCState */ - newdc->ptlDCOrig.x = dc->ptlDCOrig.x; - newdc->ptlDCOrig.y = dc->ptlDCOrig.y; -#endif - nDc_Attr->ptlCurrent = pdcattr->ptlCurrent; - nDc_Attr->ptfxCurrent = pdcattr->ptfxCurrent; - newdc->dclevel.mxWorldToDevice = dc->dclevel.mxWorldToDevice; - newdc->dclevel.mxDeviceToWorld = dc->dclevel.mxDeviceToWorld; - newdc->dclevel.mxWorldToPage = dc->dclevel.mxWorldToPage; - nDc_Attr->flXform = pdcattr->flXform; - nDc_Attr->ptlWindowOrg = pdcattr->ptlWindowOrg; - nDc_Attr->szlWindowExt = pdcattr->szlWindowExt; - nDc_Attr->ptlViewportOrg = pdcattr->ptlViewportOrg; - nDc_Attr->szlViewportExt = pdcattr->szlViewportExt; - - newdc->dclevel.lSaveDepth = 0; - newdc->dctype = dc->dctype; - -#if 0 - PATH_InitGdiPath( &newdc->dclevel.hPath ); -#endif - - /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */ - - newdc->rosdc.hGCClipRgn = newdc->rosdc.hVisRgn = 0; - if (dc->rosdc.hClipRgn) - { - newdc->rosdc.hClipRgn = NtGdiCreateRectRgn( 0, 0, 0, 0 ); - NtGdiCombineRgn( newdc->rosdc.hClipRgn, dc->rosdc.hClipRgn, 0, RGN_COPY ); - } + PDC_ATTR pdcattr, nDc_Attr; + + pdcattr = dc->pdcattr; + nDc_Attr = newdc->pdcattr; + + newdc->dclevel.flPath = dc->dclevel.flPath | DCPATH_SAVESTATE; + + nDc_Attr->dwLayout = pdcattr->dwLayout; + nDc_Attr->hpen = pdcattr->hpen; + nDc_Attr->hbrush = pdcattr->hbrush; + nDc_Attr->hlfntNew = pdcattr->hlfntNew; + newdc->rosdc.hBitmap = dc->rosdc.hBitmap; + newdc->dclevel.hpal = dc->dclevel.hpal; + newdc->rosdc.bitsPerPixel = dc->rosdc.bitsPerPixel; + nDc_Attr->jROP2 = pdcattr->jROP2; + nDc_Attr->jFillMode = pdcattr->jFillMode; + nDc_Attr->jStretchBltMode = pdcattr->jStretchBltMode; + nDc_Attr->lRelAbs = pdcattr->lRelAbs; + nDc_Attr->jBkMode = pdcattr->jBkMode; + nDc_Attr->lBkMode = pdcattr->lBkMode; + nDc_Attr->crBackgroundClr = pdcattr->crBackgroundClr; + nDc_Attr->crForegroundClr = pdcattr->crForegroundClr; + nDc_Attr->ulBackgroundClr = pdcattr->ulBackgroundClr; + nDc_Attr->ulForegroundClr = pdcattr->ulForegroundClr; + nDc_Attr->ptlBrushOrigin = pdcattr->ptlBrushOrigin; + nDc_Attr->lTextAlign = pdcattr->lTextAlign; + nDc_Attr->lTextExtra = pdcattr->lTextExtra; + nDc_Attr->cBreak = pdcattr->cBreak; + nDc_Attr->lBreakExtra = pdcattr->lBreakExtra; + nDc_Attr->iMapMode = pdcattr->iMapMode; + nDc_Attr->iGraphicsMode = pdcattr->iGraphicsMode; +#if 0 + /* Apparently, the DC origin is not changed by [GS]etDCState */ + newdc->ptlDCOrig.x = dc->ptlDCOrig.x; + newdc->ptlDCOrig.y = dc->ptlDCOrig.y; +#endif + nDc_Attr->ptlCurrent = pdcattr->ptlCurrent; + nDc_Attr->ptfxCurrent = pdcattr->ptfxCurrent; + newdc->dclevel.mxWorldToDevice = dc->dclevel.mxWorldToDevice; + newdc->dclevel.mxDeviceToWorld = dc->dclevel.mxDeviceToWorld; + newdc->dclevel.mxWorldToPage = dc->dclevel.mxWorldToPage; + nDc_Attr->flXform = pdcattr->flXform; + nDc_Attr->ptlWindowOrg = pdcattr->ptlWindowOrg; + nDc_Attr->szlWindowExt = pdcattr->szlWindowExt; + nDc_Attr->ptlViewportOrg = pdcattr->ptlViewportOrg; + nDc_Attr->szlViewportExt = pdcattr->szlViewportExt; + + newdc->dclevel.lSaveDepth = 0; + newdc->dctype = dc->dctype; + +#if 0 + PATH_InitGdiPath(&newdc->dclevel.hPath); +#endif + + /* Get/SetDCState() don't change hVisRgn field ("Undoc. Windows" p.559). */ + + newdc->rosdc.hGCClipRgn = newdc->rosdc.hVisRgn = 0; + if (dc->rosdc.hClipRgn) + { + newdc->rosdc.hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + NtGdiCombineRgn(newdc->rosdc.hClipRgn, dc->rosdc.hClipRgn, 0, RGN_COPY); + } } // FIXME: why 2 different functions that do the same? @@ -85,159 +85,158 @@ FASTCALL IntGdiCopyFromSaveState(PDC dc, PDC dcs, HDC hDC) { - PDC_ATTR pdcattr, sDc_Attr; - - pdcattr = dc->pdcattr; - sDc_Attr = dcs->pdcattr; - - dc->dclevel.flPath = dcs->dclevel.flPath & ~DCPATH_SAVESTATE; - - pdcattr->dwLayout = sDc_Attr->dwLayout; - pdcattr->jROP2 = sDc_Attr->jROP2; - pdcattr->jFillMode = sDc_Attr->jFillMode; - pdcattr->jStretchBltMode = sDc_Attr->jStretchBltMode; - pdcattr->lRelAbs = sDc_Attr->lRelAbs; - pdcattr->jBkMode = sDc_Attr->jBkMode; - pdcattr->crBackgroundClr = sDc_Attr->crBackgroundClr; - pdcattr->crForegroundClr = sDc_Attr->crForegroundClr; - pdcattr->lBkMode = sDc_Attr->lBkMode; - pdcattr->ulBackgroundClr = sDc_Attr->ulBackgroundClr; - pdcattr->ulForegroundClr = sDc_Attr->ulForegroundClr; - pdcattr->ptlBrushOrigin = sDc_Attr->ptlBrushOrigin; - - pdcattr->lTextAlign = sDc_Attr->lTextAlign; - pdcattr->lTextExtra = sDc_Attr->lTextExtra; - pdcattr->cBreak = sDc_Attr->cBreak; - pdcattr->lBreakExtra = sDc_Attr->lBreakExtra; - pdcattr->iMapMode = sDc_Attr->iMapMode; - pdcattr->iGraphicsMode = sDc_Attr->iGraphicsMode; -#if 0 -/* Apparently, the DC origin is not changed by [GS]etDCState */ - dc->ptlDCOrig.x = dcs->ptlDCOrig.x; - dc->ptlDCOrig.y = dcs->ptlDCOrig.y; -#endif - pdcattr->ptlCurrent = sDc_Attr->ptlCurrent; - pdcattr->ptfxCurrent = sDc_Attr->ptfxCurrent; - dc->dclevel.mxWorldToDevice = dcs->dclevel.mxWorldToDevice; - dc->dclevel.mxDeviceToWorld = dcs->dclevel.mxDeviceToWorld; - dc->dclevel.mxWorldToPage = dcs->dclevel.mxWorldToPage; - pdcattr->flXform = sDc_Attr->flXform; - pdcattr->ptlWindowOrg = sDc_Attr->ptlWindowOrg; - pdcattr->szlWindowExt = sDc_Attr->szlWindowExt; - pdcattr->ptlViewportOrg = sDc_Attr->ptlViewportOrg; - pdcattr->szlViewportExt = sDc_Attr->szlViewportExt; - - if (dc->dctype != DC_TYPE_MEMORY) - { - dc->rosdc.bitsPerPixel = dcs->rosdc.bitsPerPixel; - } - -#if 0 - if (dcs->rosdc.hClipRgn) - { - if (!dc->rosdc.hClipRgn) - { - dc->rosdc.hClipRgn = NtGdiCreateRectRgn( 0, 0, 0, 0 ); - } - NtGdiCombineRgn( dc->rosdc.hClipRgn, dcs->rosdc.hClipRgn, 0, RGN_COPY ); - } - else - { - if (dc->rosdc.hClipRgn) - { - NtGdiDeleteObject( dc->rosdc.hClipRgn ); - } - dc->rosdc.hClipRgn = 0; - } - { - int res; - res = CLIPPING_UpdateGCRegion( dc ); - ASSERT ( res != ERROR ); - } - DC_UnlockDc ( dc ); + PDC_ATTR pdcattr, sDc_Attr; + + pdcattr = dc->pdcattr; + sDc_Attr = dcs->pdcattr; + + dc->dclevel.flPath = dcs->dclevel.flPath & ~DCPATH_SAVESTATE; + + pdcattr->dwLayout = sDc_Attr->dwLayout; + pdcattr->jROP2 = sDc_Attr->jROP2; + pdcattr->jFillMode = sDc_Attr->jFillMode; + pdcattr->jStretchBltMode = sDc_Attr->jStretchBltMode; + pdcattr->lRelAbs = sDc_Attr->lRelAbs; + pdcattr->jBkMode = sDc_Attr->jBkMode; + pdcattr->crBackgroundClr = sDc_Attr->crBackgroundClr; + pdcattr->crForegroundClr = sDc_Attr->crForegroundClr; + pdcattr->lBkMode = sDc_Attr->lBkMode; + pdcattr->ulBackgroundClr = sDc_Attr->ulBackgroundClr; + pdcattr->ulForegroundClr = sDc_Attr->ulForegroundClr; + pdcattr->ptlBrushOrigin = sDc_Attr->ptlBrushOrigin; + + pdcattr->lTextAlign = sDc_Attr->lTextAlign; + pdcattr->lTextExtra = sDc_Attr->lTextExtra; + pdcattr->cBreak = sDc_Attr->cBreak; + pdcattr->lBreakExtra = sDc_Attr->lBreakExtra; + pdcattr->iMapMode = sDc_Attr->iMapMode; + pdcattr->iGraphicsMode = sDc_Attr->iGraphicsMode; +#if 0 + /* Apparently, the DC origin is not changed by [GS]etDCState */ + dc->ptlDCOrig.x = dcs->ptlDCOrig.x; + dc->ptlDCOrig.y = dcs->ptlDCOrig.y; +#endif + pdcattr->ptlCurrent = sDc_Attr->ptlCurrent; + pdcattr->ptfxCurrent = sDc_Attr->ptfxCurrent; + dc->dclevel.mxWorldToDevice = dcs->dclevel.mxWorldToDevice; + dc->dclevel.mxDeviceToWorld = dcs->dclevel.mxDeviceToWorld; + dc->dclevel.mxWorldToPage = dcs->dclevel.mxWorldToPage; + pdcattr->flXform = sDc_Attr->flXform; + pdcattr->ptlWindowOrg = sDc_Attr->ptlWindowOrg; + pdcattr->szlWindowExt = sDc_Attr->szlWindowExt; + pdcattr->ptlViewportOrg = sDc_Attr->ptlViewportOrg; + pdcattr->szlViewportExt = sDc_Attr->szlViewportExt; + + if (dc->dctype != DC_TYPE_MEMORY) + { + dc->rosdc.bitsPerPixel = dcs->rosdc.bitsPerPixel; + } + +#if 0 + if (dcs->rosdc.hClipRgn) + { + if (!dc->rosdc.hClipRgn) + { + dc->rosdc.hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + } + NtGdiCombineRgn(dc->rosdc.hClipRgn, dcs->rosdc.hClipRgn, 0, RGN_COPY); + } + else + { + if (dc->rosdc.hClipRgn) + { + NtGdiDeleteObject(dc->rosdc.hClipRgn); + } + dc->rosdc.hClipRgn = 0; + } + { + int res; + res = CLIPPING_UpdateGCRegion(dc); + ASSERT(res != ERROR); + } + DC_UnlockDc(dc); #else - GdiExtSelectClipRgn(dc, dcs->rosdc.hClipRgn, RGN_COPY); - DC_UnlockDc ( dc ); -#endif - if(!hDC) return; // Not a MemoryDC or SaveLevel DC, return. - - NtGdiSelectBitmap( hDC, dcs->rosdc.hBitmap ); - NtGdiSelectBrush( hDC, sDc_Attr->hbrush ); - NtGdiSelectFont( hDC, sDc_Attr->hlfntNew ); - NtGdiSelectPen( hDC, sDc_Attr->hpen ); - - IntGdiSetBkColor( hDC, sDc_Attr->crBackgroundClr); - IntGdiSetTextColor( hDC, sDc_Attr->crForegroundClr); - - GdiSelectPalette( hDC, dcs->dclevel.hpal, FALSE ); - -#if 0 - GDISelectPalette16( hDC, dcs->dclevel.hpal, FALSE ); + GdiExtSelectClipRgn(dc, dcs->rosdc.hClipRgn, RGN_COPY); + DC_UnlockDc(dc); +#endif + if (!hDC) return; // Not a MemoryDC or SaveLevel DC, return. + + NtGdiSelectBitmap(hDC, dcs->rosdc.hBitmap); + NtGdiSelectBrush(hDC, sDc_Attr->hbrush); + NtGdiSelectFont(hDC, sDc_Attr->hlfntNew); + NtGdiSelectPen(hDC, sDc_Attr->hpen); + + IntGdiSetBkColor(hDC, sDc_Attr->crBackgroundClr); + IntGdiSetTextColor(hDC, sDc_Attr->crForegroundClr); + + GdiSelectPalette(hDC, dcs->dclevel.hpal, FALSE); + +#if 0 + GDISelectPalette16(hDC, dcs->dclevel.hpal, FALSE); #endif } HDC APIENTRY IntGdiGetDCState(HDC hDC) { - PDC pdcNew, pdc; - HDC hdcNew; - - pdc = DC_LockDc(hDC); - if (pdc == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - pdcNew = DC_AllocDC(NULL); - if (pdcNew == NULL) - { + PDC pdcNew, pdc; + HDC hdcNew; + + pdc = DC_LockDc(hDC); + if (pdc == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + pdcNew = DC_AllocDC(NULL); + if (pdcNew == NULL) + { + DC_UnlockDc(pdc); + return 0; + } + hdcNew = pdcNew->BaseObject.hHmgr; + + pdcNew->dclevel.hdcSave = hdcNew; + IntGdiCopyToSaveState(pdc, pdcNew); + + DC_UnlockDc(pdcNew); DC_UnlockDc(pdc); - return 0; - } - hdcNew = pdcNew->BaseObject.hHmgr; - - pdcNew->dclevel.hdcSave = hdcNew; - IntGdiCopyToSaveState(pdc, pdcNew); - - DC_UnlockDc(pdcNew); - DC_UnlockDc(pdc); - - return hdcNew; + + return hdcNew; } VOID APIENTRY -IntGdiSetDCState ( HDC hDC, HDC hDCSave ) -{ - PDC dc, dcs; - - dc = DC_LockDc ( hDC ); - if ( dc ) - { - dcs = DC_LockDc ( hDCSave ); - if ( dcs ) - { - if ( dcs->dclevel.flPath & DCPATH_SAVESTATE ) - { - IntGdiCopyFromSaveState( dc, dcs, dc->dclevel.hdcSave); - } - else - { - DC_UnlockDc(dc); - } - DC_UnlockDc ( dcs ); +IntGdiSetDCState(HDC hDC, HDC hDCSave) +{ + PDC dc, dcs; + + dc = DC_LockDc(hDC); + if (dc) + { + dcs = DC_LockDc(hDCSave); + if (dcs) + { + if (dcs->dclevel.flPath & DCPATH_SAVESTATE) + { + IntGdiCopyFromSaveState(dc, dcs, dc->dclevel.hdcSave); + } + else + { + DC_UnlockDc(dc); + } + DC_UnlockDc(dcs); + } + else + { + DC_UnlockDc(dc); + SetLastWin32Error(ERROR_INVALID_HANDLE); + } } else - { - DC_UnlockDc ( dc ); - SetLastWin32Error(ERROR_INVALID_HANDLE); - } - } - else - SetLastWin32Error(ERROR_INVALID_HANDLE); -} - + SetLastWin32Error(ERROR_INVALID_HANDLE); +} BOOL @@ -249,135 +248,136 @@ IN OPTIONAL VOID *pDriverInfo2, OUT VOID *ppUMdhpdev) { - UNIMPLEMENTED; - return 0; + UNIMPLEMENTED; + return 0; } BOOL APIENTRY -NtGdiRestoreDC(HDC hDC, INT SaveLevel) -{ - PDC dc, dcs; - BOOL success; - - DPRINT("NtGdiRestoreDC(%lx, %d)\n", hDC, SaveLevel); - - dc = DC_LockDc(hDC); - if (!dc) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return FALSE; - } - - if (SaveLevel < 0) - SaveLevel = dc->dclevel.lSaveDepth + SaveLevel + 1; - - if(SaveLevel < 0 || dc->dclevel.lSaveDepth<SaveLevel) - { - DC_UnlockDc(dc); - return FALSE; - } - - success=TRUE; - while (dc->dclevel.lSaveDepth >= SaveLevel) - { - HDC hdcs = dc->hdcNext; - - dcs = DC_LockDc (hdcs); - if (dcs == NULL) - { +NtGdiRestoreDC( + HDC hDC, + INT SaveLevel) +{ + PDC dc, dcs; + BOOL success; + + DPRINT("NtGdiRestoreDC(%lx, %d)\n", hDC, SaveLevel); + + dc = DC_LockDc(hDC); + if (!dc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + if (SaveLevel < 0) + SaveLevel = dc->dclevel.lSaveDepth + SaveLevel + 1; + + if (SaveLevel < 0 || dc->dclevel.lSaveDepth<SaveLevel) + { DC_UnlockDc(dc); return FALSE; - } - - dc->hdcNext = dcs->hdcNext; - dcs->hdcNext = 0; - - if (--dc->dclevel.lSaveDepth < SaveLevel) - { - DC_UnlockDc( dc ); - DC_UnlockDc( dcs ); - - IntGdiSetDCState(hDC, hdcs); - - dc = DC_LockDc(hDC); - if(!dc) - { + } + + success=TRUE; + while (dc->dclevel.lSaveDepth >= SaveLevel) + { + HDC hdcs = dc->hdcNext; + + dcs = DC_LockDc(hdcs); + if (dcs == NULL) + { + DC_UnlockDc(dc); return FALSE; - } - // Restore Path by removing it, if the Save flag is set. - // BeginPath will takecare of the rest. - if ( dc->dclevel.hPath && dc->dclevel.flPath & DCPATH_SAVE) - { - PATH_Delete(dc->dclevel.hPath); - dc->dclevel.hPath = 0; - dc->dclevel.flPath &= ~DCPATH_SAVE; - } - } - else - { - DC_UnlockDc( dcs ); - } - NtGdiDeleteObjectApp (hdcs); - } - DC_UnlockDc( dc ); - return success; + } + + dc->hdcNext = dcs->hdcNext; + dcs->hdcNext = 0; + + if (--dc->dclevel.lSaveDepth < SaveLevel) + { + DC_UnlockDc(dc); + DC_UnlockDc(dcs); + + IntGdiSetDCState(hDC, hdcs); + + dc = DC_LockDc(hDC); + if (!dc) + { + return FALSE; + } + // Restore Path by removing it, if the Save flag is set. + // BeginPath will takecare of the rest. + if (dc->dclevel.hPath && dc->dclevel.flPath & DCPATH_SAVE) + { + PATH_Delete(dc->dclevel.hPath); + dc->dclevel.hPath = 0; + dc->dclevel.flPath &= ~DCPATH_SAVE; + } + } + else + { + DC_UnlockDc(dcs); + } + NtGdiDeleteObjectApp(hdcs); + } + DC_UnlockDc(dc); + return success; } INT APIENTRY -NtGdiSaveDC(HDC hDC) -{ - HDC hdcs; - PDC dc, dcs; - INT ret; - - DPRINT("NtGdiSaveDC(%lx)\n", hDC); - - if (!(hdcs = IntGdiGetDCState(hDC))) - { - return 0; - } - - dcs = DC_LockDc (hdcs); - if (dcs == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - dc = DC_LockDc (hDC); - if (dc == NULL) - { +NtGdiSaveDC( + HDC hDC) +{ + HDC hdcs; + PDC dc, dcs; + INT ret; + + DPRINT("NtGdiSaveDC(%lx)\n", hDC); + + if (!(hdcs = IntGdiGetDCState(hDC))) + { + return 0; + } + + dcs = DC_LockDc(hdcs); + if (dcs == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + dc = DC_LockDc(hDC); + if (dc == NULL) + { + DC_UnlockDc(dcs); + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + /* + * Copy path. + */ + dcs->dclevel.hPath = dc->dclevel.hPath; + if (dcs->dclevel.hPath) dcs->dclevel.flPath |= DCPATH_SAVE; + + dcs->hdcNext = dc->hdcNext; + dc->hdcNext = hdcs; + ret = ++dc->dclevel.lSaveDepth; DC_UnlockDc(dcs); - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - /* - * Copy path. - */ - dcs->dclevel.hPath = dc->dclevel.hPath; - if (dcs->dclevel.hPath) dcs->dclevel.flPath |= DCPATH_SAVE; - - dcs->hdcNext = dc->hdcNext; - dc->hdcNext = hdcs; - ret = ++dc->dclevel.lSaveDepth; - DC_UnlockDc( dcs ); - DC_UnlockDc( dc ); - - return ret; -} - - + DC_UnlockDc(dc); + + return ret; +} BOOL FASTCALL IntGdiCleanDC(HDC hDC) { - PDC dc; - if (!hDC) return FALSE; - dc = DC_LockDc ( hDC ); - if (!dc) return FALSE; - // Clean the DC - if (defaultDCstate) IntGdiCopyFromSaveState(dc, defaultDCstate, hDC ); - return TRUE; -} - + PDC dc; + if (!hDC) return FALSE; + dc = DC_LockDc(hDC); + if (!dc) return FALSE; + // Clean the DC + if (defaultDCstate) IntGdiCopyFromSaveState(dc, defaultDCstate, hDC); + return TRUE; +} +
15 years, 9 months
1
0
0
0
[tkreuzer] 40203: More dc cleanup: make DC_AllocDC return a pointer, not a handle, like done with the other objects, too. Remove DC_GetnextDC and DC_SetNextDC, as they are trivial. Misc cleanup and improvements.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 24 07:10:49 2009 New Revision: 40203 URL:
http://svn.reactos.org/svn/reactos?rev=40203&view=rev
Log: More dc cleanup: make DC_AllocDC return a pointer, not a handle, like done with the other objects, too. Remove DC_GetnextDC and DC_SetNextDC, as they are trivial. Misc cleanup and improvements. Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c trunk/reactos/subsystems/win32/win32k/objects/dcstate.c trunk/reactos/subsystems/win32/win32k/objects/dcutil.c Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Tue Mar 24 07:10:49 2009 @@ -57,6 +57,7 @@ } pdcattr = NewDC->pdcattr; + // FIXME: no floating point in the kernel! xformTemplate.eM11 = 1.0f; xformTemplate.eM12 = 0.0f; xformTemplate.eM21 = 0.0f; @@ -67,7 +68,7 @@ XForm2MatrixS(&NewDC->dclevel.mxDeviceToWorld, &xformTemplate); XForm2MatrixS(&NewDC->dclevel.mxWorldToPage, &xformTemplate); -// Setup syncing bits for the dcattr data packets. + // Setup syncing bits for the dcattr data packets. pdcattr->flXform = DEVICE_TO_PAGE_INVALID; pdcattr->ulDirty_ = 0; // Server side @@ -87,21 +88,21 @@ pdcattr->ulBackgroundClr = 0xffffff; pdcattr->crBackgroundClr = 0xffffff; - pdcattr->ulPenClr = RGB( 0, 0, 0 ); - pdcattr->crPenClr = RGB( 0, 0, 0 ); - - pdcattr->ulBrushClr = RGB( 255, 255, 255 ); // Do this way too. - pdcattr->crBrushClr = RGB( 255, 255, 255 ); + pdcattr->ulPenClr = RGB(0, 0, 0); + pdcattr->crPenClr = RGB(0, 0, 0); + + pdcattr->ulBrushClr = RGB(255, 255, 255); // Do this way too. + pdcattr->crBrushClr = RGB(255, 255, 255); //// This fixes the default brush and pen settings. See DC_InitDC. /* Create the default fill brush */ - pdcattr->hbrush = NtGdiGetStockObject( WHITE_BRUSH ); + pdcattr->hbrush = NtGdiGetStockObject(WHITE_BRUSH); NewDC->dclevel.pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush); EBRUSHOBJ_vInit(&NewDC->eboFill, NewDC->dclevel.pbrFill, NULL); /* Create the default pen / line brush */ - pdcattr->hpen = NtGdiGetStockObject( BLACK_PEN ); + pdcattr->hpen = NtGdiGetStockObject(BLACK_PEN); NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen); EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrFill, NULL); @@ -112,16 +113,14 @@ NewDC->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE); NewDC->dclevel.laPath.eMiterLimit = 10.0; - DC_UnlockDc(NewDC); - - return hDC; + return NewDC; } VOID FASTCALL DC_FreeDC(HDC DCToFree) { DC_FreeDcAttr(DCToFree); - if (!IsObjectDead( DCToFree )) + if (!IsObjectDead(DCToFree)) { if (!GDIOBJ_FreeObjByHandle(DCToFree, GDI_OBJECT_TYPE_DC)) { @@ -172,6 +171,7 @@ } DC_UnlockDc(pDC); } + return TRUE; } @@ -248,20 +248,13 @@ } /* Allocate a DC object */ - if ((hdc = DC_AllocDC(Driver)) == NULL) + pdc = DC_AllocDC(Driver); + if (pdc == NULL) { DPRINT1("DC_AllocDC() failed\n"); - return NULL; - } - - pdc = DC_LockDc( hdc ); - if ( !pdc ) - { - DC_FreeDC( hdc ); - DPRINT1("DC_LockDc() failed\n"); return NULL; } - + hdc = pdc->BaseObject.hHmgr; pdcattr = pdc->pdcattr; pdc->dctype = DC_TYPE_DIRECT; @@ -298,7 +291,7 @@ { pdc->pSurfInfo = NULL; // pdc->dclevel.pSurface = - DC_UnlockDc( pdc ); + DC_UnlockDc(pdc); /* Initialize the DC state */ DC_InitDC(hdc); @@ -318,7 +311,7 @@ DC_vSelectSurface(pdc, NULL); pdcattr->crBackgroundClr = pdcattr->ulBackgroundClr = RGB(255, 255, 255); pdcattr->crForegroundClr = RGB(0, 0, 0); - DC_UnlockDc( pdc ); + DC_UnlockDc(pdc); } if (hVisRgn) @@ -342,7 +335,7 @@ ULONG iType, HANDLE hspool, VOID *pDriverInfo2, - VOID *pUMdhpdev ) + VOID *pUMdhpdev) { UNICODE_STRING SafeDevice; DEVMODEW SafeInitData; @@ -417,17 +410,17 @@ // if (hDC && !defaultDCstate) // Ultra HAX! Dedicated to GvG! { // This is a cheesy way to do this. - PDC dc = DC_LockDc ( hDC ); + PDC dc = DC_LockDc(hDC); defaultDCstate = ExAllocatePoolWithTag(PagedPool, sizeof(DC), TAG_DC); if (!defaultDCstate) { - DC_UnlockDc( dc ); + DC_UnlockDc(dc); return NULL; } RtlZeroMemory(defaultDCstate, sizeof(DC)); defaultDCstate->pdcattr = &defaultDCstate->dcattr; IntGdiCopyToSaveState(dc, defaultDCstate); - DC_UnlockDc( dc ); + DC_UnlockDc(dc); } return hDC; } @@ -436,7 +429,7 @@ FASTCALL IntGdiDeleteDC(HDC hDC, BOOL Force) { - PDC DCToDelete = DC_LockDc(hDC); + PDC DCToDelete = DC_LockDc(hDC); if (DCToDelete == NULL) { @@ -449,7 +442,7 @@ if (DCToDelete->fs & DC_FLAG_PERMANENT) { DPRINT1("No! You Naughty Application!\n"); - DC_UnlockDc( DCToDelete ); + DC_UnlockDc(DCToDelete); return UserReleaseDC(NULL, hDC, FALSE); } } @@ -460,15 +453,15 @@ PDC savedDC; HDC savedHDC; - savedHDC = DC_GetNextDC (DCToDelete); - savedDC = DC_LockDc (savedHDC); + savedHDC = DCToDelete->hdcNext; + savedDC = DC_LockDc(savedHDC); if (savedDC == NULL) { break; } - DC_SetNextDC (DCToDelete, DC_GetNextDC (savedDC)); + DCToDelete->hdcNext = savedDC->hdcNext; DCToDelete->dclevel.lSaveDepth--; - DC_UnlockDc( savedDC ); + DC_UnlockDc(savedDC); IntGdiDeleteDC(savedHDC, Force); } @@ -487,11 +480,11 @@ } if (DCToDelete->rosdc.hClipRgn) { - NtGdiDeleteObject (DCToDelete->rosdc.hClipRgn); + NtGdiDeleteObject(DCToDelete->rosdc.hClipRgn); } if (DCToDelete->rosdc.hVisRgn) { - NtGdiDeleteObject (DCToDelete->rosdc.hVisRgn); + NtGdiDeleteObject(DCToDelete->rosdc.hVisRgn); } if (NULL != DCToDelete->rosdc.CombinedClip) { @@ -499,12 +492,12 @@ } if (DCToDelete->rosdc.hGCClipRgn) { - NtGdiDeleteObject (DCToDelete->rosdc.hGCClipRgn); + NtGdiDeleteObject(DCToDelete->rosdc.hGCClipRgn); } PATH_Delete(DCToDelete->dclevel.hPath); - DC_UnlockDc( DCToDelete ); - DC_FreeDC ( hDC ); + DC_UnlockDc(DCToDelete); + DC_FreeDC(hDC); return TRUE; } @@ -553,9 +546,9 @@ HDC APIENTRY NtGdiCreateCompatibleDC(HDC hDC) { - PDC NewDC, OrigDC; + PDC pdcNew, pdcOld; PDC_ATTR pdcattrNew, pdcattrOld; - HDC hNewDC, DisplayDC = NULL; + HDC hdcNew, DisplayDC = NULL; HRGN hVisRgn; UNICODE_STRING DriverName; DWORD Layout = 0; @@ -573,8 +566,8 @@ } /* Allocate a new DC based on the original DC's device */ - OrigDC = DC_LockDc(hDC); - if (NULL == OrigDC) + pdcOld = DC_LockDc(hDC); + if (NULL == pdcOld) { if (NULL != DisplayDC) { @@ -583,35 +576,28 @@ DPRINT1("Failed to lock hDC\n"); return NULL; } - hNewDC = DC_AllocDC(&OrigDC->rosdc.DriverName); - if (NULL == hNewDC) - { - DPRINT1("Failed to create hNewDC\n"); - DC_UnlockDc(OrigDC); - if (NULL != DisplayDC) + pdcNew = DC_AllocDC(&pdcOld->rosdc.DriverName); + if (!pdcNew) + { + DPRINT1("Failed to create pdcNew\n"); + DC_UnlockDc(pdcOld); + if (DisplayDC) { NtGdiDeleteObjectApp(DisplayDC); } return NULL; } - NewDC = DC_LockDc( hNewDC ); - - if (!NewDC) - { - DPRINT1("Failed to lock hNewDC\n"); - NtGdiDeleteObjectApp(hNewDC); - return NULL; - } - - pdcattrOld = OrigDC->pdcattr; - pdcattrNew = NewDC->pdcattr; + hdcNew = pdcNew->BaseObject.hHmgr; + + pdcattrOld = pdcOld->pdcattr; + pdcattrNew = pdcNew->pdcattr; /* Copy information from original DC to new DC */ - NewDC->dclevel.hdcSave = hNewDC; - - NewDC->dhpdev = OrigDC->dhpdev; - - NewDC->rosdc.bitsPerPixel = OrigDC->rosdc.bitsPerPixel; + pdcNew->dclevel.hdcSave = hdcNew; + + pdcNew->dhpdev = pdcOld->dhpdev; + + pdcNew->rosdc.bitsPerPixel = pdcOld->rosdc.bitsPerPixel; /* DriverName is copied in the AllocDC routine */ pdcattrNew->ptlWindowOrg = pdcattrOld->ptlWindowOrg; @@ -619,10 +605,10 @@ pdcattrNew->ptlViewportOrg = pdcattrOld->ptlViewportOrg; pdcattrNew->szlViewportExt = pdcattrOld->szlViewportExt; - NewDC->dctype = DC_TYPE_MEMORY; // Always! - NewDC->rosdc.hBitmap = NtGdiGetStockObject(DEFAULT_BITMAP); - NewDC->ppdev = OrigDC->ppdev; - NewDC->dclevel.hpal = OrigDC->dclevel.hpal; + pdcNew->dctype = DC_TYPE_MEMORY; // Always! + pdcNew->rosdc.hBitmap = NtGdiGetStockObject(DEFAULT_BITMAP); + pdcNew->ppdev = pdcOld->ppdev; + pdcNew->dclevel.hpal = pdcOld->dclevel.hpal; pdcattrNew->lTextAlign = pdcattrOld->lTextAlign; pdcattrNew->lBkMode = pdcattrOld->lBkMode; @@ -630,17 +616,14 @@ pdcattrNew->jROP2 = pdcattrOld->jROP2; pdcattrNew->dwLayout = pdcattrOld->dwLayout; if (pdcattrOld->dwLayout & LAYOUT_ORIENTATIONMASK) Layout = pdcattrOld->dwLayout; - NewDC->dclevel.flPath = OrigDC->dclevel.flPath; + pdcNew->dclevel.flPath = pdcOld->dclevel.flPath; pdcattrNew->ulDirty_ = pdcattrOld->ulDirty_; pdcattrNew->iCS_CP = pdcattrOld->iCS_CP; - NewDC->erclWindow = (RECTL) - { - 0,0,1,1 - }; - - DC_UnlockDc(NewDC); - DC_UnlockDc(OrigDC); + pdcNew->erclWindow = (RECTL){0, 0, 1, 1}; + + DC_UnlockDc(pdcNew); + DC_UnlockDc(pdcOld); if (NULL != DisplayDC) { NtGdiDeleteObjectApp(DisplayDC); @@ -649,19 +632,19 @@ hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1); if (hVisRgn) { - GdiSelectVisRgn(hNewDC, hVisRgn); + GdiSelectVisRgn(hdcNew, hVisRgn); NtGdiDeleteObject(hVisRgn); } - if (Layout) NtGdiSetLayout( hNewDC, -1, Layout); - - DC_InitDC(hNewDC); - return hNewDC; + if (Layout) NtGdiSetLayout(hdcNew, -1, Layout); + + DC_InitDC(hdcNew); + return hdcNew; } BOOL APIENTRY -NtGdiDeleteObjectApp(HANDLE DCHandle) +NtGdiDeleteObjectApp(HANDLE DCHandle) { /* Complete all pending operations */ NtGdiFlushUserBatch(); Modified: trunk/reactos/subsystems/win32/win32k/objects/dcstate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcstate.c [iso-8859-1] Tue Mar 24 07:10:49 2009 @@ -177,34 +177,33 @@ } HDC APIENTRY -IntGdiGetDCState(HDC hDC) -{ - PDC newdc, dc; - HDC hnewdc; - - dc = DC_LockDc(hDC); - if (dc == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - hnewdc = DC_AllocDC(NULL); - if (hnewdc == NULL) - { - DC_UnlockDc(dc); - return 0; - } - newdc = DC_LockDc( hnewdc ); - /* FIXME - newdc can be NULL!!!! Don't assert here!!! */ - ASSERT( newdc ); - - newdc->dclevel.hdcSave = hnewdc; - IntGdiCopyToSaveState( dc, newdc); - - DC_UnlockDc( newdc ); - DC_UnlockDc( dc ); - return hnewdc; +IntGdiGetDCState(HDC hDC) +{ + PDC pdcNew, pdc; + HDC hdcNew; + + pdc = DC_LockDc(hDC); + if (pdc == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + pdcNew = DC_AllocDC(NULL); + if (pdcNew == NULL) + { + DC_UnlockDc(pdc); + return 0; + } + hdcNew = pdcNew->BaseObject.hHmgr; + + pdcNew->dclevel.hdcSave = hdcNew; + IntGdiCopyToSaveState(pdc, pdcNew); + + DC_UnlockDc(pdcNew); + DC_UnlockDc(pdc); + + return hdcNew; } VOID @@ -281,7 +280,7 @@ success=TRUE; while (dc->dclevel.lSaveDepth >= SaveLevel) { - HDC hdcs = DC_GetNextDC (dc); + HDC hdcs = dc->hdcNext; dcs = DC_LockDc (hdcs); if (dcs == NULL) @@ -290,7 +289,7 @@ return FALSE; } - DC_SetNextDC (dc, DC_GetNextDC (dcs)); + dc->hdcNext = dcs->hdcNext; dcs->hdcNext = 0; if (--dc->dclevel.lSaveDepth < SaveLevel) @@ -359,8 +358,8 @@ dcs->dclevel.hPath = dc->dclevel.hPath; if (dcs->dclevel.hPath) dcs->dclevel.flPath |= DCPATH_SAVE; - DC_SetNextDC (dcs, DC_GetNextDC (dc)); - DC_SetNextDC (dc, hdcs); + dcs->hdcNext = dc->hdcNext; + dc->hdcNext = hdcs; ret = ++dc->dclevel.lSaveDepth; DC_UnlockDc( dcs ); DC_UnlockDc( dc ); Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Tue Mar 24 07:10:49 2009 @@ -124,19 +124,6 @@ } #endif -// FIXME: remove me -HDC FASTCALL -DC_GetNextDC (PDC pDC) -{ - return pDC->hdcNext; -} - -VOID FASTCALL -DC_SetNextDC (PDC pDC, HDC hNextDC) -{ - pDC->hdcNext = hNextDC; -} - BOOL APIENTRY NtGdiCancelDC(HDC hDC) @@ -144,8 +131,6 @@ UNIMPLEMENTED; return FALSE; } - - WORD APIENTRY @@ -191,7 +176,7 @@ DWORD *Result) { BOOL Ret = TRUE; - PDC dc; + PDC pdc; PDC_ATTR pdcattr; DWORD SafeResult = 0; @@ -203,13 +188,13 @@ return FALSE; } - dc = DC_LockDc(hDC); - if (!dc) + pdc = DC_LockDc(hDC); + if (!pdc) { SetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; } - pdcattr = dc->pdcattr; + pdcattr = pdc->pdcattr; switch (u) { @@ -230,20 +215,20 @@ case GdiGetArcDirection: if (pdcattr->dwLayout & LAYOUT_RTL) - SafeResult = AD_CLOCKWISE - ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0); + SafeResult = AD_CLOCKWISE - ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0); else - SafeResult = ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) + AD_COUNTERCLOCKWISE; + SafeResult = ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) + AD_COUNTERCLOCKWISE; break; case GdiGetEMFRestorDc: break; case GdiGetFontLanguageInfo: - SafeResult = IntGetFontLanguageInfo(dc); + SafeResult = IntGetFontLanguageInfo(pdc); break; case GdiGetIsMemDc: - SafeResult = dc->dctype; + SafeResult = pdc->dctype; break; case GdiGetMapMode: @@ -264,9 +249,7 @@ { _SEH2_TRY { - ProbeForWrite(Result, - sizeof(DWORD), - 1); + ProbeForWrite(Result, sizeof(DWORD), 1); *Result = SafeResult; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -274,16 +257,15 @@ Status = _SEH2_GetExceptionCode(); } _SEH2_END; - } - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - DC_UnlockDc(dc); - return FALSE; - } - - DC_UnlockDc(dc); + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + Ret = FALSE; + } + } + + DC_UnlockDc(pdc); return Ret; } @@ -296,7 +278,7 @@ DWORD *Result) { BOOL Ret = TRUE; - PDC dc; + PDC pdc; PDC_ATTR pdcattr; DWORD SafeResult = 0; @@ -308,19 +290,19 @@ return FALSE; } - dc = DC_LockDc(hDC); - if (!dc) + pdc = DC_LockDc(hDC); + if (!pdc) { SetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; } - pdcattr = dc->pdcattr; + pdcattr = pdc->pdcattr; switch (u) { case GdiGetSetCopyCount: - SafeResult = dc->ulCopyCount; - dc->ulCopyCount = dwIn; + SafeResult = pdc->ulCopyCount; + pdc->ulCopyCount = dwIn; break; case GdiGetSetTextAlign: @@ -354,7 +336,7 @@ break; case GdiGetSetMapMode: - SafeResult = IntGdiSetMapMode(dc, dwIn); + SafeResult = IntGdiSetMapMode(pdc, dwIn); break; case GdiGetSetArcDirection: @@ -366,23 +348,24 @@ } if (pdcattr->dwLayout & LAYOUT_RTL) // Right to Left { - SafeResult = AD_CLOCKWISE - ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0); + SafeResult = AD_CLOCKWISE - ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0); if (dwIn == AD_CLOCKWISE) { - dc->dclevel.flPath &= ~DCPATH_CLOCKWISE; + pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE; break; } - dc->dclevel.flPath |= DCPATH_CLOCKWISE; + pdc->dclevel.flPath |= DCPATH_CLOCKWISE; } else // Left to Right { - SafeResult = ((dc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) + AD_COUNTERCLOCKWISE; + SafeResult = ((pdc->dclevel.flPath & DCPATH_CLOCKWISE) != 0) + + AD_COUNTERCLOCKWISE; if (dwIn == AD_COUNTERCLOCKWISE) { - dc->dclevel.flPath &= ~DCPATH_CLOCKWISE; + pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE; break; } - dc->dclevel.flPath |= DCPATH_CLOCKWISE; + pdc->dclevel.flPath |= DCPATH_CLOCKWISE; } break; @@ -396,9 +379,7 @@ { _SEH2_TRY { - ProbeForWrite(Result, - sizeof(DWORD), - 1); + ProbeForWrite(Result, sizeof(DWORD), 1); *Result = SafeResult; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -406,15 +387,14 @@ Status = _SEH2_GetExceptionCode(); } _SEH2_END; - } - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - DC_UnlockDc(dc); - return FALSE; - } - - DC_UnlockDc(dc); + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + Ret = FALSE; + } + } + + DC_UnlockDc(pdc); return Ret; }
15 years, 9 months
1
0
0
0
[tkreuzer] 40202: Fix formatting add a FIXME comment, no code change
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 24 06:15:18 2009 New Revision: 40202 URL:
http://svn.reactos.org/svn/reactos?rev=40202&view=rev
Log: Fix formatting add a FIXME comment, no code change Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Tue Mar 24 06:15:18 2009 @@ -1,4 +1,4 @@ -/* +/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: Functions for creation and destruction of DCs @@ -17,131 +17,131 @@ HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver) { - PDC NewDC; - PDC_ATTR pdcattr; - HDC hDC; - PWSTR Buf = NULL; - XFORM xformTemplate; - - if (Driver != NULL) - { - Buf = ExAllocatePoolWithTag(PagedPool, Driver->MaximumLength, TAG_DC); - if(!Buf) - { - DPRINT1("ExAllocatePoolWithTag failed\n"); - return NULL; - } - RtlCopyMemory(Buf, Driver->Buffer, Driver->MaximumLength); - } - - NewDC = (PDC)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_DC); - if(!NewDC) - { - if(Buf) - { - ExFreePoolWithTag(Buf, TAG_DC); - } - DPRINT1("GDIOBJ_AllocObjWithHandle failed\n"); - return NULL; - } - - hDC = NewDC->BaseObject.hHmgr; - - NewDC->pdcattr = &NewDC->dcattr; - DC_AllocateDcAttr(hDC); - - if (Driver != NULL) - { - RtlCopyMemory(&NewDC->rosdc.DriverName, Driver, sizeof(UNICODE_STRING)); - NewDC->rosdc.DriverName.Buffer = Buf; - } - pdcattr = NewDC->pdcattr; - - xformTemplate.eM11 = 1.0f; - xformTemplate.eM12 = 0.0f; - xformTemplate.eM21 = 0.0f; - xformTemplate.eM22 = 1.0f; - xformTemplate.eDx = 0.0f; - xformTemplate.eDy = 0.0f; - XForm2MatrixS(&NewDC->dclevel.mxWorldToDevice, &xformTemplate); - XForm2MatrixS(&NewDC->dclevel.mxDeviceToWorld, &xformTemplate); - XForm2MatrixS(&NewDC->dclevel.mxWorldToPage, &xformTemplate); + PDC NewDC; + PDC_ATTR pdcattr; + HDC hDC; + PWSTR Buf = NULL; + XFORM xformTemplate; + + if (Driver != NULL) + { + Buf = ExAllocatePoolWithTag(PagedPool, Driver->MaximumLength, TAG_DC); + if (!Buf) + { + DPRINT1("ExAllocatePoolWithTag failed\n"); + return NULL; + } + RtlCopyMemory(Buf, Driver->Buffer, Driver->MaximumLength); + } + + NewDC = (PDC)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_DC); + if (!NewDC) + { + if (Buf) + { + ExFreePoolWithTag(Buf, TAG_DC); + } + DPRINT1("GDIOBJ_AllocObjWithHandle failed\n"); + return NULL; + } + + hDC = NewDC->BaseObject.hHmgr; + + NewDC->pdcattr = &NewDC->dcattr; + DC_AllocateDcAttr(hDC); + + if (Driver != NULL) + { + RtlCopyMemory(&NewDC->rosdc.DriverName, Driver, sizeof(UNICODE_STRING)); + NewDC->rosdc.DriverName.Buffer = Buf; + } + pdcattr = NewDC->pdcattr; + + xformTemplate.eM11 = 1.0f; + xformTemplate.eM12 = 0.0f; + xformTemplate.eM21 = 0.0f; + xformTemplate.eM22 = 1.0f; + xformTemplate.eDx = 0.0f; + xformTemplate.eDy = 0.0f; + XForm2MatrixS(&NewDC->dclevel.mxWorldToDevice, &xformTemplate); + XForm2MatrixS(&NewDC->dclevel.mxDeviceToWorld, &xformTemplate); + XForm2MatrixS(&NewDC->dclevel.mxWorldToPage, &xformTemplate); // Setup syncing bits for the dcattr data packets. - pdcattr->flXform = DEVICE_TO_PAGE_INVALID; - - pdcattr->ulDirty_ = 0; // Server side - - pdcattr->iMapMode = MM_TEXT; - pdcattr->iGraphicsMode = GM_COMPATIBLE; - pdcattr->jFillMode = ALTERNATE; - - pdcattr->szlWindowExt.cx = 1; // Float to Int,,, WRONG! - pdcattr->szlWindowExt.cy = 1; - pdcattr->szlViewportExt.cx = 1; - pdcattr->szlViewportExt.cy = 1; - - pdcattr->crForegroundClr = 0; - pdcattr->ulForegroundClr = 0; - - pdcattr->ulBackgroundClr = 0xffffff; - pdcattr->crBackgroundClr = 0xffffff; - - pdcattr->ulPenClr = RGB( 0, 0, 0 ); - pdcattr->crPenClr = RGB( 0, 0, 0 ); - - pdcattr->ulBrushClr = RGB( 255, 255, 255 ); // Do this way too. - pdcattr->crBrushClr = RGB( 255, 255, 255 ); + pdcattr->flXform = DEVICE_TO_PAGE_INVALID; + + pdcattr->ulDirty_ = 0; // Server side + + pdcattr->iMapMode = MM_TEXT; + pdcattr->iGraphicsMode = GM_COMPATIBLE; + pdcattr->jFillMode = ALTERNATE; + + pdcattr->szlWindowExt.cx = 1; // Float to Int,,, WRONG! + pdcattr->szlWindowExt.cy = 1; + pdcattr->szlViewportExt.cx = 1; + pdcattr->szlViewportExt.cy = 1; + + pdcattr->crForegroundClr = 0; + pdcattr->ulForegroundClr = 0; + + pdcattr->ulBackgroundClr = 0xffffff; + pdcattr->crBackgroundClr = 0xffffff; + + pdcattr->ulPenClr = RGB( 0, 0, 0 ); + pdcattr->crPenClr = RGB( 0, 0, 0 ); + + pdcattr->ulBrushClr = RGB( 255, 255, 255 ); // Do this way too. + pdcattr->crBrushClr = RGB( 255, 255, 255 ); //// This fixes the default brush and pen settings. See DC_InitDC. - /* Create the default fill brush */ - pdcattr->hbrush = NtGdiGetStockObject( WHITE_BRUSH ); - NewDC->dclevel.pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush); - EBRUSHOBJ_vInit(&NewDC->eboFill, NewDC->dclevel.pbrFill, NULL); - - /* Create the default pen / line brush */ - pdcattr->hpen = NtGdiGetStockObject( BLACK_PEN ); - NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen); - EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrFill, NULL); - - - pdcattr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT); - TextIntRealizeFont(pdcattr->hlfntNew,NULL); - - NewDC->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE); - NewDC->dclevel.laPath.eMiterLimit = 10.0; - - DC_UnlockDc(NewDC); - - return hDC; + /* Create the default fill brush */ + pdcattr->hbrush = NtGdiGetStockObject( WHITE_BRUSH ); + NewDC->dclevel.pbrFill = BRUSH_ShareLockBrush(pdcattr->hbrush); + EBRUSHOBJ_vInit(&NewDC->eboFill, NewDC->dclevel.pbrFill, NULL); + + /* Create the default pen / line brush */ + pdcattr->hpen = NtGdiGetStockObject( BLACK_PEN ); + NewDC->dclevel.pbrLine = PEN_ShareLockPen(pdcattr->hpen); + EBRUSHOBJ_vInit(&NewDC->eboLine, NewDC->dclevel.pbrFill, NULL); + + + pdcattr->hlfntNew = NtGdiGetStockObject(SYSTEM_FONT); + TextIntRealizeFont(pdcattr->hlfntNew,NULL); + + NewDC->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE); + NewDC->dclevel.laPath.eMiterLimit = 10.0; + + DC_UnlockDc(NewDC); + + return hDC; } VOID FASTCALL -DC_FreeDC(HDC DCToFree) -{ - DC_FreeDcAttr(DCToFree); - if(!IsObjectDead( DCToFree )) - { - if (!GDIOBJ_FreeObjByHandle(DCToFree, GDI_OBJECT_TYPE_DC)) - { - DPRINT1("DC_FreeDC failed\n"); - } - } - else - { - DPRINT1("Attempted to Delete 0x%x currently being destroyed!!!\n",DCToFree); - } +DC_FreeDC(HDC DCToFree) +{ + DC_FreeDcAttr(DCToFree); + if (!IsObjectDead( DCToFree )) + { + if (!GDIOBJ_FreeObjByHandle(DCToFree, GDI_OBJECT_TYPE_DC)) + { + DPRINT1("DC_FreeDC failed\n"); + } + } + else + { + DPRINT1("Attempted to Delete 0x%x currently being destroyed!!!\n",DCToFree); + } } BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody) { - PDC pDC = (PDC)ObjectBody; - if (pDC->rosdc.DriverName.Buffer) - ExFreePoolWithTag(pDC->rosdc.DriverName.Buffer, TAG_DC); - DC_vSelectSurface(pDC, NULL); - return TRUE; + PDC pDC = (PDC)ObjectBody; + if (pDC->rosdc.DriverName.Buffer) + ExFreePoolWithTag(pDC->rosdc.DriverName.Buffer, TAG_DC); + DC_vSelectSurface(pDC, NULL); + return TRUE; } BOOL @@ -150,25 +150,25 @@ { PDC pDC; - if(!GDIOBJ_SetOwnership(hDC, Owner)) return FALSE; + if (!GDIOBJ_SetOwnership(hDC, Owner)) return FALSE; pDC = DC_LockDc(hDC); if (pDC) { if (pDC->rosdc.hClipRgn) { - if(!GDIOBJ_SetOwnership(pDC->rosdc.hClipRgn, Owner)) return FALSE; + if (!GDIOBJ_SetOwnership(pDC->rosdc.hClipRgn, Owner)) return FALSE; } if (pDC->rosdc.hVisRgn) { - if(!GDIOBJ_SetOwnership(pDC->rosdc.hVisRgn, Owner)) return FALSE; + if (!GDIOBJ_SetOwnership(pDC->rosdc.hVisRgn, Owner)) return FALSE; } if (pDC->rosdc.hGCClipRgn) { - if(!GDIOBJ_SetOwnership(pDC->rosdc.hGCClipRgn, Owner)) return FALSE; + if (!GDIOBJ_SetOwnership(pDC->rosdc.hGCClipRgn, Owner)) return FALSE; } if (pDC->dclevel.hPath) { - if(!GDIOBJ_SetOwnership(pDC->dclevel.hPath, Owner)) return FALSE; + if (!GDIOBJ_SetOwnership(pDC->dclevel.hPath, Owner)) return FALSE; } DC_UnlockDc(pDC); } @@ -177,237 +177,237 @@ HDC FASTCALL -IntGdiCreateDC(PUNICODE_STRING Driver, - PUNICODE_STRING Device, - PVOID pUMdhpdev, - CONST PDEVMODEW InitData, - BOOL CreateAsIC) -{ - HDC hdc; - PDC pdc; - PDC_ATTR pdcattr; - HRGN hVisRgn; - UNICODE_STRING StdDriver; - BOOL calledFromUser; - - RtlInitUnicodeString(&StdDriver, L"DISPLAY"); - - DPRINT("DriverName: %wZ, DeviceName: %wZ\n", Driver, Device); - - if (NULL == Driver || 0 == RtlCompareUnicodeString(Driver, &StdDriver, TRUE)) - { - if (CreateAsIC) - { - if (! IntPrepareDriverIfNeeded()) +IntGdiCreateDC( + PUNICODE_STRING Driver, + PUNICODE_STRING Device, + PVOID pUMdhpdev, + CONST PDEVMODEW InitData, + BOOL CreateAsIC) +{ + HDC hdc; + PDC pdc; + PDC_ATTR pdcattr; + HRGN hVisRgn; + UNICODE_STRING StdDriver; + BOOL calledFromUser; + + RtlInitUnicodeString(&StdDriver, L"DISPLAY"); + + DPRINT("DriverName: %wZ, DeviceName: %wZ\n", Driver, Device); + + if (NULL == Driver || 0 == RtlCompareUnicodeString(Driver, &StdDriver, TRUE)) + { + if (CreateAsIC) + { + if (! IntPrepareDriverIfNeeded()) { - /* Here, we have two possibilities: - * a) return NULL, and hope that the caller - * won't call us in a loop - * b) bugcheck, but caller is unable to - * react on the problem - */ - /*DPRINT1("Unable to prepare graphics driver, returning NULL ic\n"); - return NULL;*/ - KeBugCheck(VIDEO_DRIVER_INIT_FAILURE); + /* Here, we have two possibilities: + * a) return NULL, and hope that the caller + * won't call us in a loop + * b) bugcheck, but caller is unable to + * react on the problem + */ + /*DPRINT1("Unable to prepare graphics driver, returning NULL ic\n"); + return NULL;*/ + KeBugCheck(VIDEO_DRIVER_INIT_FAILURE); } } - else - { - calledFromUser = UserIsEntered(); - if (!calledFromUser){ - UserEnterExclusive(); - } - - if (! co_IntGraphicsCheck(TRUE)) - { - if (!calledFromUser){ - UserLeave(); + else + { + calledFromUser = UserIsEntered(); + if (!calledFromUser) + { + UserEnterExclusive(); } - DPRINT1("Unable to initialize graphics, returning NULL dc\n"); + + if (! co_IntGraphicsCheck(TRUE)) + { + if (!calledFromUser) + { + UserLeave(); + } + DPRINT1("Unable to initialize graphics, returning NULL dc\n"); + return NULL; + } + + if (!calledFromUser) + { + UserLeave(); + } + + } + } + + /* Check for existing DC object */ + if ((hdc = DC_FindOpenDC(Driver)) != NULL) + { + hdc = NtGdiCreateCompatibleDC(hdc); + if (!hdc) + DPRINT1("NtGdiCreateCompatibleDC() failed\n"); + return hdc; + } + + /* Allocate a DC object */ + if ((hdc = DC_AllocDC(Driver)) == NULL) + { + DPRINT1("DC_AllocDC() failed\n"); + return NULL; + } + + pdc = DC_LockDc( hdc ); + if ( !pdc ) + { + DC_FreeDC( hdc ); + DPRINT1("DC_LockDc() failed\n"); + return NULL; + } + + pdcattr = pdc->pdcattr; + + pdc->dctype = DC_TYPE_DIRECT; + + pdc->dhpdev = PrimarySurface.hPDev; + if (pUMdhpdev) pUMdhpdev = pdc->dhpdev; // set DHPDEV for device. + pdc->ppdev = (PVOID)&PrimarySurface; + pdc->rosdc.hBitmap = (HBITMAP)PrimarySurface.pSurface; // <- what kind of haxx0ry is that? + // ATM we only have one display. + pdcattr->ulDirty_ |= DC_PRIMARY_DISPLAY; + + pdc->rosdc.bitsPerPixel = pdc->ppdev->GDIInfo.cBitsPixel * + pdc->ppdev->GDIInfo.cPlanes; + DPRINT("Bits per pel: %u\n", pdc->rosdc.bitsPerPixel); + + pdc->flGraphicsCaps = PrimarySurface.DevInfo.flGraphicsCaps; + pdc->flGraphicsCaps2 = PrimarySurface.DevInfo.flGraphicsCaps2; + + pdc->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE); + + pdcattr->jROP2 = R2_COPYPEN; + + pdc->erclWindow.top = pdc->erclWindow.left = 0; + pdc->erclWindow.right = pdc->ppdev->GDIInfo.ulHorzRes; + pdc->erclWindow.bottom = pdc->ppdev->GDIInfo.ulVertRes; + pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE; // Default is CCW. + + pdcattr->iCS_CP = ftGdiGetTextCharsetInfo(pdc,NULL,0); + + hVisRgn = NtGdiCreateRectRgn(0, 0, pdc->ppdev->GDIInfo.ulHorzRes, + pdc->ppdev->GDIInfo.ulVertRes); + + if (!CreateAsIC) + { + pdc->pSurfInfo = NULL; +// pdc->dclevel.pSurface = + DC_UnlockDc( pdc ); + + /* Initialize the DC state */ + DC_InitDC(hdc); + IntGdiSetTextColor(hdc, RGB(0, 0, 0)); + IntGdiSetBkColor(hdc, RGB(255, 255, 255)); + } + else + { + /* From MSDN2: + The CreateIC function creates an information context for the specified device. + The information context provides a fast way to get information about the + device without creating a device context (DC). However, GDI drawing functions + cannot accept a handle to an information context. + */ + pdc->dctype = DC_TYPE_INFO; +// pdc->pSurfInfo = + DC_vSelectSurface(pdc, NULL); + pdcattr->crBackgroundClr = pdcattr->ulBackgroundClr = RGB(255, 255, 255); + pdcattr->crForegroundClr = RGB(0, 0, 0); + DC_UnlockDc( pdc ); + } + + if (hVisRgn) + { + GdiSelectVisRgn(hdc, hVisRgn); + NtGdiDeleteObject(hVisRgn); + } + + IntGdiSetTextAlign(hdc, TA_TOP); + IntGdiSetBkMode(hdc, OPAQUE); + + return hdc; +} + + +HDC APIENTRY +NtGdiOpenDCW( + PUNICODE_STRING Device, + DEVMODEW *InitData, + PUNICODE_STRING pustrLogAddr, + ULONG iType, + HANDLE hspool, + VOID *pDriverInfo2, + VOID *pUMdhpdev ) +{ + UNICODE_STRING SafeDevice; + DEVMODEW SafeInitData; + PVOID Dhpdev; + HDC Ret; + NTSTATUS Status = STATUS_SUCCESS; + + if (InitData) + { + _SEH2_TRY + { + if (pUMdhpdev) + { + ProbeForWrite(pUMdhpdev, sizeof(PVOID), 1); + } + ProbeForRead(InitData, sizeof(DEVMODEW), 1); + RtlCopyMemory(&SafeInitData, InitData, sizeof(DEVMODEW)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); return NULL; - } - - if (!calledFromUser){ - UserLeave(); - } - - } - } - - /* Check for existing DC object */ - if ((hdc = DC_FindOpenDC(Driver)) != NULL) - { - hdc = NtGdiCreateCompatibleDC(hdc); - if (!hdc) - DPRINT1("NtGdiCreateCompatibleDC() failed\n"); - return hdc; - } - - /* Allocate a DC object */ - if ((hdc = DC_AllocDC(Driver)) == NULL) - { - DPRINT1("DC_AllocDC() failed\n"); - return NULL; - } - - pdc = DC_LockDc( hdc ); - if ( !pdc ) - { - DC_FreeDC( hdc ); - DPRINT1("DC_LockDc() failed\n"); - return NULL; - } - - pdcattr = pdc->pdcattr; - - pdc->dctype = DC_TYPE_DIRECT; - - pdc->dhpdev = PrimarySurface.hPDev; - if(pUMdhpdev) pUMdhpdev = pdc->dhpdev; // set DHPDEV for device. - pdc->ppdev = (PVOID)&PrimarySurface; - pdc->rosdc.hBitmap = (HBITMAP)PrimarySurface.pSurface; // <- what kind of haxx0ry is that? - // ATM we only have one display. - pdcattr->ulDirty_ |= DC_PRIMARY_DISPLAY; - - pdc->rosdc.bitsPerPixel = pdc->ppdev->GDIInfo.cBitsPixel * - pdc->ppdev->GDIInfo.cPlanes; - DPRINT("Bits per pel: %u\n", pdc->rosdc.bitsPerPixel); - - pdc->flGraphicsCaps = PrimarySurface.DevInfo.flGraphicsCaps; - pdc->flGraphicsCaps2 = PrimarySurface.DevInfo.flGraphicsCaps2; - - pdc->dclevel.hpal = NtGdiGetStockObject(DEFAULT_PALETTE); - - pdcattr->jROP2 = R2_COPYPEN; - - pdc->erclWindow.top = pdc->erclWindow.left = 0; - pdc->erclWindow.right = pdc->ppdev->GDIInfo.ulHorzRes; - pdc->erclWindow.bottom = pdc->ppdev->GDIInfo.ulVertRes; - pdc->dclevel.flPath &= ~DCPATH_CLOCKWISE; // Default is CCW. - - pdcattr->iCS_CP = ftGdiGetTextCharsetInfo(pdc,NULL,0); - - hVisRgn = NtGdiCreateRectRgn(0, 0, pdc->ppdev->GDIInfo.ulHorzRes, - pdc->ppdev->GDIInfo.ulVertRes); - - if (!CreateAsIC) - { - pdc->pSurfInfo = NULL; -// pdc->dclevel.pSurface = - DC_UnlockDc( pdc ); - - /* Initialize the DC state */ - DC_InitDC(hdc); - IntGdiSetTextColor(hdc, RGB(0, 0, 0)); - IntGdiSetBkColor(hdc, RGB(255, 255, 255)); - } - else - { - /* From MSDN2: - The CreateIC function creates an information context for the specified device. - The information context provides a fast way to get information about the - device without creating a device context (DC). However, GDI drawing functions - cannot accept a handle to an information context. - */ - pdc->dctype = DC_TYPE_INFO; -// pdc->pSurfInfo = - DC_vSelectSurface(pdc, NULL); - pdcattr->crBackgroundClr = pdcattr->ulBackgroundClr = RGB(255, 255, 255); - pdcattr->crForegroundClr = RGB(0, 0, 0); - DC_UnlockDc( pdc ); - } - - if (hVisRgn) - { - GdiSelectVisRgn(hdc, hVisRgn); - NtGdiDeleteObject(hVisRgn); - } - - IntGdiSetTextAlign(hdc, TA_TOP); - IntGdiSetBkMode(hdc, OPAQUE); - - return hdc; -} - - -HDC APIENTRY -NtGdiOpenDCW( PUNICODE_STRING Device, - DEVMODEW *InitData, - PUNICODE_STRING pustrLogAddr, - ULONG iType, - HANDLE hspool, - VOID *pDriverInfo2, - VOID *pUMdhpdev ) -{ - UNICODE_STRING SafeDevice; - DEVMODEW SafeInitData; - PVOID Dhpdev; - HDC Ret; - NTSTATUS Status = STATUS_SUCCESS; - - if(InitData) - { - _SEH2_TRY - { - if (pUMdhpdev) - { - ProbeForWrite(pUMdhpdev, - sizeof(PVOID), - 1); - } - ProbeForRead(InitData, - sizeof(DEVMODEW), - 1); - RtlCopyMemory(&SafeInitData, - InitData, - sizeof(DEVMODEW)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return NULL; - } - /* FIXME - InitData can have some more bytes! */ - } - - if(Device) - { - Status = IntSafeCopyUnicodeString(&SafeDevice, Device); - if(!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - return NULL; - } - } - - Ret = IntGdiCreateDC(Device ? &SafeDevice : NULL, - NULL, - pUMdhpdev ? &Dhpdev : NULL, - InitData ? &SafeInitData : NULL, - (BOOL) iType); // FALSE 0 DCW, TRUE 1 ICW - - if (pUMdhpdev) pUMdhpdev = Dhpdev; - - return Ret; - + } + /* FIXME - InitData can have some more bytes! */ + } + + if (Device) + { + Status = IntSafeCopyUnicodeString(&SafeDevice, Device); + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + return NULL; + } + } + + Ret = IntGdiCreateDC(Device ? &SafeDevice : NULL, + NULL, + pUMdhpdev ? &Dhpdev : NULL, + InitData ? &SafeInitData : NULL, + (BOOL) iType); // FALSE 0 DCW, TRUE 1 ICW + + // FIXME!!!! + if (pUMdhpdev) pUMdhpdev = Dhpdev; + + return Ret; } HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC) { - HDC hDC; - UNICODE_STRING DriverName; - RtlInitUnicodeString(&DriverName, L"DISPLAY"); - - if (DcType != DC_TYPE_MEMORY) - hDC = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, (DcType == DC_TYPE_INFO)); - else - hDC = NtGdiCreateCompatibleDC(NULL); // OH~ Yuck! I think I taste vomit in my mouth! + HDC hDC; + UNICODE_STRING DriverName; + RtlInitUnicodeString(&DriverName, L"DISPLAY"); + + if (DcType != DC_TYPE_MEMORY) + hDC = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, (DcType == DC_TYPE_INFO)); + else + hDC = NtGdiCreateCompatibleDC(NULL); // OH~ Yuck! I think I taste vomit in my mouth! // // There is room to grow here~ // @@ -415,103 +415,103 @@ // // If NULL, first time through! Build the default (was window) dc! // - if (hDC && !defaultDCstate) // Ultra HAX! Dedicated to GvG! - { // This is a cheesy way to do this. - PDC dc = DC_LockDc ( hDC ); - defaultDCstate = ExAllocatePoolWithTag(PagedPool, sizeof(DC), TAG_DC); - if (!defaultDCstate) - { - DC_UnlockDc( dc ); - return NULL; - } - RtlZeroMemory(defaultDCstate, sizeof(DC)); - defaultDCstate->pdcattr = &defaultDCstate->dcattr; - IntGdiCopyToSaveState(dc, defaultDCstate); - DC_UnlockDc( dc ); - } - return hDC; + if (hDC && !defaultDCstate) // Ultra HAX! Dedicated to GvG! + { // This is a cheesy way to do this. + PDC dc = DC_LockDc ( hDC ); + defaultDCstate = ExAllocatePoolWithTag(PagedPool, sizeof(DC), TAG_DC); + if (!defaultDCstate) + { + DC_UnlockDc( dc ); + return NULL; + } + RtlZeroMemory(defaultDCstate, sizeof(DC)); + defaultDCstate->pdcattr = &defaultDCstate->dcattr; + IntGdiCopyToSaveState(dc, defaultDCstate); + DC_UnlockDc( dc ); + } + return hDC; } BOOL FASTCALL IntGdiDeleteDC(HDC hDC, BOOL Force) { - PDC DCToDelete = DC_LockDc(hDC); - - if (DCToDelete == NULL) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return FALSE; - } - - if(!Force) - { - if (DCToDelete->fs & DC_FLAG_PERMANENT) - { - DPRINT1("No! You Naughty Application!\n"); - DC_UnlockDc( DCToDelete ); - return UserReleaseDC(NULL, hDC, FALSE); - } - } - - /* First delete all saved DCs */ - while (DCToDelete->dclevel.lSaveDepth) - { - PDC savedDC; - HDC savedHDC; - - savedHDC = DC_GetNextDC (DCToDelete); - savedDC = DC_LockDc (savedHDC); - if (savedDC == NULL) - { - break; - } - DC_SetNextDC (DCToDelete, DC_GetNextDC (savedDC)); - DCToDelete->dclevel.lSaveDepth--; - DC_UnlockDc( savedDC ); - IntGdiDeleteDC(savedHDC, Force); - } - - /* Free GDI resources allocated to this DC */ - if (!(DCToDelete->dclevel.flPath & DCPATH_SAVESTATE)) - { - /* - NtGdiSelectPen (DCHandle, STOCK_BLACK_PEN); - NtGdiSelectBrush (DCHandle, STOCK_WHITE_BRUSH); - NtGdiSelectFont (DCHandle, STOCK_SYSTEM_FONT); - DC_LockDC (DCHandle); NtGdiSelectXxx does not recognize stock objects yet */ - if (DCToDelete->rosdc.XlateBrush != NULL) - EngDeleteXlate(DCToDelete->rosdc.XlateBrush); - if (DCToDelete->rosdc.XlatePen != NULL) - EngDeleteXlate(DCToDelete->rosdc.XlatePen); - } - if (DCToDelete->rosdc.hClipRgn) - { - NtGdiDeleteObject (DCToDelete->rosdc.hClipRgn); - } - if (DCToDelete->rosdc.hVisRgn) - { - NtGdiDeleteObject (DCToDelete->rosdc.hVisRgn); - } - if (NULL != DCToDelete->rosdc.CombinedClip) - { - IntEngDeleteClipRegion(DCToDelete->rosdc.CombinedClip); - } - if (DCToDelete->rosdc.hGCClipRgn) - { - NtGdiDeleteObject (DCToDelete->rosdc.hGCClipRgn); - } - PATH_Delete(DCToDelete->dclevel.hPath); - - DC_UnlockDc( DCToDelete ); - DC_FreeDC ( hDC ); - return TRUE; + PDC DCToDelete = DC_LockDc(hDC); + + if (DCToDelete == NULL) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + if (!Force) + { + if (DCToDelete->fs & DC_FLAG_PERMANENT) + { + DPRINT1("No! You Naughty Application!\n"); + DC_UnlockDc( DCToDelete ); + return UserReleaseDC(NULL, hDC, FALSE); + } + } + + /* First delete all saved DCs */ + while (DCToDelete->dclevel.lSaveDepth) + { + PDC savedDC; + HDC savedHDC; + + savedHDC = DC_GetNextDC (DCToDelete); + savedDC = DC_LockDc (savedHDC); + if (savedDC == NULL) + { + break; + } + DC_SetNextDC (DCToDelete, DC_GetNextDC (savedDC)); + DCToDelete->dclevel.lSaveDepth--; + DC_UnlockDc( savedDC ); + IntGdiDeleteDC(savedHDC, Force); + } + + /* Free GDI resources allocated to this DC */ + if (!(DCToDelete->dclevel.flPath & DCPATH_SAVESTATE)) + { + /* + NtGdiSelectPen (DCHandle, STOCK_BLACK_PEN); + NtGdiSelectBrush (DCHandle, STOCK_WHITE_BRUSH); + NtGdiSelectFont (DCHandle, STOCK_SYSTEM_FONT); + DC_LockDC (DCHandle); NtGdiSelectXxx does not recognize stock objects yet */ + if (DCToDelete->rosdc.XlateBrush != NULL) + EngDeleteXlate(DCToDelete->rosdc.XlateBrush); + if (DCToDelete->rosdc.XlatePen != NULL) + EngDeleteXlate(DCToDelete->rosdc.XlatePen); + } + if (DCToDelete->rosdc.hClipRgn) + { + NtGdiDeleteObject (DCToDelete->rosdc.hClipRgn); + } + if (DCToDelete->rosdc.hVisRgn) + { + NtGdiDeleteObject (DCToDelete->rosdc.hVisRgn); + } + if (NULL != DCToDelete->rosdc.CombinedClip) + { + IntEngDeleteClipRegion(DCToDelete->rosdc.CombinedClip); + } + if (DCToDelete->rosdc.hGCClipRgn) + { + NtGdiDeleteObject (DCToDelete->rosdc.hGCClipRgn); + } + PATH_Delete(DCToDelete->dclevel.hPath); + + DC_UnlockDc( DCToDelete ); + DC_FreeDC ( hDC ); + return TRUE; } HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver) { - return NULL; + return NULL; } /*! @@ -526,20 +526,20 @@ // NtGdiSelectBrush(DCHandle, NtGdiGetStockObject( WHITE_BRUSH )); // NtGdiSelectPen(DCHandle, NtGdiGetStockObject( BLACK_PEN )); //// - //NtGdiSelectFont(DCHandle, hFont); + //NtGdiSelectFont(DCHandle, hFont); + + /* + { + int res; + res = CLIPPING_UpdateGCRegion(DCToInit); + ASSERT ( res != ERROR ); + } + */ +} /* - { - int res; - res = CLIPPING_UpdateGCRegion(DCToInit); - ASSERT ( res != ERROR ); - } +* @unimplemented */ -} - - /* - * @unimplemented - */ BOOL APIENTRY NtGdiMakeInfoDC( @@ -553,106 +553,109 @@ HDC APIENTRY NtGdiCreateCompatibleDC(HDC hDC) { - PDC NewDC, OrigDC; - PDC_ATTR pdcattrNew, pdcattrOld; - HDC hNewDC, DisplayDC = NULL; - HRGN hVisRgn; - UNICODE_STRING DriverName; - DWORD Layout = 0; - - if (hDC == NULL) - { - RtlInitUnicodeString(&DriverName, L"DISPLAY"); - DisplayDC = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, TRUE); - if (NULL == DisplayDC) - { - DPRINT1("Failed to create DisplayDC\n"); - return NULL; - } - hDC = DisplayDC; - } - - /* Allocate a new DC based on the original DC's device */ - OrigDC = DC_LockDc(hDC); - if (NULL == OrigDC) - { - if (NULL != DisplayDC) - { - NtGdiDeleteObjectApp(DisplayDC); - } - DPRINT1("Failed to lock hDC\n"); - return NULL; - } - hNewDC = DC_AllocDC(&OrigDC->rosdc.DriverName); - if (NULL == hNewDC) - { - DPRINT1("Failed to create hNewDC\n"); - DC_UnlockDc(OrigDC); - if (NULL != DisplayDC) - { - NtGdiDeleteObjectApp(DisplayDC); - } - return NULL; - } - NewDC = DC_LockDc( hNewDC ); - - if(!NewDC) - { - DPRINT1("Failed to lock hNewDC\n"); - NtGdiDeleteObjectApp(hNewDC); - return NULL; - } - - pdcattrOld = OrigDC->pdcattr; - pdcattrNew = NewDC->pdcattr; - - /* Copy information from original DC to new DC */ - NewDC->dclevel.hdcSave = hNewDC; - - NewDC->dhpdev = OrigDC->dhpdev; - - NewDC->rosdc.bitsPerPixel = OrigDC->rosdc.bitsPerPixel; - - /* DriverName is copied in the AllocDC routine */ - pdcattrNew->ptlWindowOrg = pdcattrOld->ptlWindowOrg; - pdcattrNew->szlWindowExt = pdcattrOld->szlWindowExt; - pdcattrNew->ptlViewportOrg = pdcattrOld->ptlViewportOrg; - pdcattrNew->szlViewportExt = pdcattrOld->szlViewportExt; - - NewDC->dctype = DC_TYPE_MEMORY; // Always! - NewDC->rosdc.hBitmap = NtGdiGetStockObject(DEFAULT_BITMAP); - NewDC->ppdev = OrigDC->ppdev; - NewDC->dclevel.hpal = OrigDC->dclevel.hpal; - - pdcattrNew->lTextAlign = pdcattrOld->lTextAlign; - pdcattrNew->lBkMode = pdcattrOld->lBkMode; - pdcattrNew->jBkMode = pdcattrOld->jBkMode; - pdcattrNew->jROP2 = pdcattrOld->jROP2; - pdcattrNew->dwLayout = pdcattrOld->dwLayout; - if (pdcattrOld->dwLayout & LAYOUT_ORIENTATIONMASK) Layout = pdcattrOld->dwLayout; - NewDC->dclevel.flPath = OrigDC->dclevel.flPath; - pdcattrNew->ulDirty_ = pdcattrOld->ulDirty_; - pdcattrNew->iCS_CP = pdcattrOld->iCS_CP; - - NewDC->erclWindow = (RECTL){0,0,1,1}; - - DC_UnlockDc(NewDC); - DC_UnlockDc(OrigDC); - if (NULL != DisplayDC) - { - NtGdiDeleteObjectApp(DisplayDC); - } - - hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1); - if (hVisRgn) - { - GdiSelectVisRgn(hNewDC, hVisRgn); - NtGdiDeleteObject(hVisRgn); - } - if (Layout) NtGdiSetLayout( hNewDC, -1, Layout); - - DC_InitDC(hNewDC); - return hNewDC; + PDC NewDC, OrigDC; + PDC_ATTR pdcattrNew, pdcattrOld; + HDC hNewDC, DisplayDC = NULL; + HRGN hVisRgn; + UNICODE_STRING DriverName; + DWORD Layout = 0; + + if (hDC == NULL) + { + RtlInitUnicodeString(&DriverName, L"DISPLAY"); + DisplayDC = IntGdiCreateDC(&DriverName, NULL, NULL, NULL, TRUE); + if (NULL == DisplayDC) + { + DPRINT1("Failed to create DisplayDC\n"); + return NULL; + } + hDC = DisplayDC; + } + + /* Allocate a new DC based on the original DC's device */ + OrigDC = DC_LockDc(hDC); + if (NULL == OrigDC) + { + if (NULL != DisplayDC) + { + NtGdiDeleteObjectApp(DisplayDC); + } + DPRINT1("Failed to lock hDC\n"); + return NULL; + } + hNewDC = DC_AllocDC(&OrigDC->rosdc.DriverName); + if (NULL == hNewDC) + { + DPRINT1("Failed to create hNewDC\n"); + DC_UnlockDc(OrigDC); + if (NULL != DisplayDC) + { + NtGdiDeleteObjectApp(DisplayDC); + } + return NULL; + } + NewDC = DC_LockDc( hNewDC ); + + if (!NewDC) + { + DPRINT1("Failed to lock hNewDC\n"); + NtGdiDeleteObjectApp(hNewDC); + return NULL; + } + + pdcattrOld = OrigDC->pdcattr; + pdcattrNew = NewDC->pdcattr; + + /* Copy information from original DC to new DC */ + NewDC->dclevel.hdcSave = hNewDC; + + NewDC->dhpdev = OrigDC->dhpdev; + + NewDC->rosdc.bitsPerPixel = OrigDC->rosdc.bitsPerPixel; + + /* DriverName is copied in the AllocDC routine */ + pdcattrNew->ptlWindowOrg = pdcattrOld->ptlWindowOrg; + pdcattrNew->szlWindowExt = pdcattrOld->szlWindowExt; + pdcattrNew->ptlViewportOrg = pdcattrOld->ptlViewportOrg; + pdcattrNew->szlViewportExt = pdcattrOld->szlViewportExt; + + NewDC->dctype = DC_TYPE_MEMORY; // Always! + NewDC->rosdc.hBitmap = NtGdiGetStockObject(DEFAULT_BITMAP); + NewDC->ppdev = OrigDC->ppdev; + NewDC->dclevel.hpal = OrigDC->dclevel.hpal; + + pdcattrNew->lTextAlign = pdcattrOld->lTextAlign; + pdcattrNew->lBkMode = pdcattrOld->lBkMode; + pdcattrNew->jBkMode = pdcattrOld->jBkMode; + pdcattrNew->jROP2 = pdcattrOld->jROP2; + pdcattrNew->dwLayout = pdcattrOld->dwLayout; + if (pdcattrOld->dwLayout & LAYOUT_ORIENTATIONMASK) Layout = pdcattrOld->dwLayout; + NewDC->dclevel.flPath = OrigDC->dclevel.flPath; + pdcattrNew->ulDirty_ = pdcattrOld->ulDirty_; + pdcattrNew->iCS_CP = pdcattrOld->iCS_CP; + + NewDC->erclWindow = (RECTL) + { + 0,0,1,1 + }; + + DC_UnlockDc(NewDC); + DC_UnlockDc(OrigDC); + if (NULL != DisplayDC) + { + NtGdiDeleteObjectApp(DisplayDC); + } + + hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1); + if (hVisRgn) + { + GdiSelectVisRgn(hNewDC, hVisRgn); + NtGdiDeleteObject(hVisRgn); + } + if (Layout) NtGdiSetLayout( hNewDC, -1, Layout); + + DC_InitDC(hNewDC); + return hNewDC; } @@ -660,22 +663,22 @@ APIENTRY NtGdiDeleteObjectApp(HANDLE DCHandle) { - /* Complete all pending operations */ - NtGdiFlushUserBatch(); - - if (GDI_HANDLE_IS_STOCKOBJ(DCHandle)) return TRUE; - - if (GDI_HANDLE_GET_TYPE(DCHandle) != GDI_OBJECT_TYPE_DC) - return NtGdiDeleteObject((HGDIOBJ) DCHandle); - - if(IsObjectDead((HGDIOBJ)DCHandle)) return TRUE; - - if (!GDIOBJ_OwnedByCurrentProcess(DCHandle)) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return FALSE; - } - - return IntGdiDeleteDC(DCHandle, FALSE); -} - + /* Complete all pending operations */ + NtGdiFlushUserBatch(); + + if (GDI_HANDLE_IS_STOCKOBJ(DCHandle)) return TRUE; + + if (GDI_HANDLE_GET_TYPE(DCHandle) != GDI_OBJECT_TYPE_DC) + return NtGdiDeleteObject((HGDIOBJ) DCHandle); + + if (IsObjectDead((HGDIOBJ)DCHandle)) return TRUE; + + if (!GDIOBJ_OwnedByCurrentProcess(DCHandle)) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + return IntGdiDeleteDC(DCHandle, FALSE); +} +
15 years, 9 months
1
0
0
0
[tkreuzer] 40201: Remove DC_GET_VAL macro and friends. They were defining functions that we didn't use, except 4, but those were also quite useless, as the only returned a value from the dc structure that you pass in. same for IntGetGraphicsMode. Also remove IntGetViewportExtEx and replace it with DC_vUpdateViewportExt
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 24 05:58:14 2009 New Revision: 40201 URL:
http://svn.reactos.org/svn/reactos?rev=40201&view=rev
Log: Remove DC_GET_VAL macro and friends. They were defining functions that we didn't use, except 4, but those were also quite useless, as the only returned a value from the dc structure that you pass in. same for IntGetGraphicsMode. Also remove IntGetViewportExtEx and replace it with DC_vUpdateViewportExt Modified: trunk/reactos/subsystems/win32/win32k/include/coord.h trunk/reactos/subsystems/win32/win32k/include/dc.h trunk/reactos/subsystems/win32/win32k/objects/coord.c trunk/reactos/subsystems/win32/win32k/objects/dcutil.c trunk/reactos/subsystems/win32/win32k/objects/fillshap.c trunk/reactos/subsystems/win32/win32k/objects/path.c Modified: trunk/reactos/subsystems/win32/win32k/include/coord.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/coord.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/coord.h [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -9,10 +9,6 @@ #define CoordLPtoDP(dc, pp) XFORMOBJ_bApplyXform((XFORMOBJ*)&(dc)->dclevel.mxWorldToDevice, XF_LTOL, 1, pp, pp); #define XForm2MatrixS(m, x) XFORMOBJ_iSetXform((XFORMOBJ*)m, (XFORML*)x) #define MatrixS2XForm(x, m) XFORMOBJ_iGetXform((XFORMOBJ*)m, (XFORML*)x) - -int -FASTCALL -IntGetGraphicsMode ( PDC dc ); int APIENTRY IntGdiSetMapMode(PDC, int); Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -248,15 +248,11 @@ VOID FASTCALL DC_UpdateXforms(PDC dc); BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest); +VOID FASTCALL DC_vUpdateViewportExt(PDC pdc); BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC); BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC); VOID FASTCALL DCU_SetDcUndeletable(HDC); - -VOID FASTCALL IntGetViewportExtEx(PDC dc, LPSIZE pt); -VOID FASTCALL IntGetViewportOrgEx(PDC dc, LPPOINT pt); -VOID FASTCALL IntGetWindowExtEx(PDC dc, LPSIZE pt); -VOID FASTCALL IntGetWindowOrgEx(PDC dc, LPPOINT pt); COLORREF FASTCALL IntGdiSetBkColor (HDC hDC, COLORREF Color); INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode); Modified: trunk/reactos/subsystems/win32/win32k/objects/coord.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/coord.c [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -119,17 +119,6 @@ return Ret; } -// FIXME: remove me! -int -FASTCALL -IntGetGraphicsMode(PDC dc) -{ - PDC_ATTR pdcattr; - ASSERT(dc); - pdcattr = dc->pdcattr; - return pdcattr->iGraphicsMode; -} - // FIXME: Don't use floating point in the kernel BOOL FASTCALL @@ -262,7 +251,8 @@ Size = Count * sizeof(POINT); - Points = (LPPOINT)ExAllocatePoolWithTag(PagedPool, Size, TAG_COORD); + // FIXME: It would be wise to have a small stack buffer as optimization + Points = ExAllocatePoolWithTag(PagedPool, Size, TAG_COORD); if (!Points) { DC_UnlockDc(dc); @@ -1129,7 +1119,7 @@ DC_UnlockDc(pdc); } - +// FIXME: remove me BOOL FASTCALL IntGdiGetDCOrg(PDC pDc, PPOINTL ppt) { @@ -1137,6 +1127,7 @@ return TRUE; } +// FIXME: remove me BOOL APIENTRY GdiGetDCOrgEx(HDC hDC, PPOINTL ppt, PRECTL prc) { @@ -1152,14 +1143,11 @@ return TRUE; } -BOOL FASTCALL -IntGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio) -{ - PDC_ATTR pdcattr; - - pdcattr = pDC->pdcattr; - - if ( pdcattr->flFontMapper & 1 ) // TRUE assume 1. +static +VOID FASTCALL +DC_vGetAspectRatioFilter(PDC pDC, LPSIZE AspectRatio) +{ + if (pDC->pdcattr->flFontMapper & 1) // TRUE assume 1. { // "This specifies that Windows should only match fonts that have the // same aspect ratio as the display.", Programming Windows, Fifth Ed. @@ -1171,12 +1159,11 @@ AspectRatio->cx = 0; AspectRatio->cy = 0; } - return TRUE; } VOID FASTCALL -IntGetViewportExtEx(PDC pdc, LPSIZE pSize) +DC_vUpdateViewportExt(PDC pdc) { PDC_ATTR pdcattr; @@ -1195,9 +1182,6 @@ /* Update xforms, CHECKME: really done here? */ DC_UpdateXforms(pdc); } - - /* Copy the viewport extension */ - *pSize = pdcattr->szlViewportExt; } BOOL APIENTRY @@ -1207,7 +1191,7 @@ PPOINTL Point) { BOOL Ret = TRUE; - DC *dc; + DC *pdc; POINTL SafePoint; SIZE Size; NTSTATUS Status = STATUS_SUCCESS; @@ -1218,10 +1202,8 @@ return FALSE; } - RtlZeroMemory(&SafePoint, sizeof(POINT)); - - dc = DC_LockDc(hDC); - if (!dc) + pdc = DC_LockDc(hDC); + if (!pdc) { SetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; @@ -1230,31 +1212,30 @@ switch (iPoint) { case GdiGetViewPortExt: - IntGetViewportExtEx(dc, &Size); - SafePoint.x = Size.cx; - SafePoint.y = Size.cy; + DC_vUpdateViewportExt(pdc); + SafePoint.x = pdc->pdcattr->szlViewportExt.cx; + SafePoint.y = pdc->pdcattr->szlViewportExt.cy; break; case GdiGetWindowExt: - IntGetWindowExtEx(dc, &Size); - SafePoint.x = Size.cx; - SafePoint.y = Size.cy; + SafePoint.x = pdc->pdcattr->szlWindowExt.cx; + SafePoint.y = pdc->pdcattr->szlWindowExt.cy; break; case GdiGetViewPortOrg: - IntGetViewportOrgEx(dc, &SafePoint); + SafePoint = pdc->pdcattr->ptlViewportOrg; break; case GdiGetWindowOrg: - IntGetWindowOrgEx(dc, &SafePoint); + SafePoint = pdc->pdcattr->ptlWindowOrg; break; case GdiGetDCOrg: - Ret = IntGdiGetDCOrg(dc, &SafePoint); + SafePoint = pdc->ptlDCOrig; break; case GdiGetAspectRatioFilter: - Ret = IntGetAspectRatioFilter(dc, &Size); + DC_vGetAspectRatioFilter(pdc, &Size); SafePoint.x = Size.cx; SafePoint.y = Size.cy; break; @@ -1269,9 +1250,7 @@ { _SEH2_TRY { - ProbeForWrite(Point, - sizeof(POINT), - 1); + ProbeForWrite(Point, sizeof(POINT), 1); *Point = SafePoint; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) @@ -1279,16 +1258,15 @@ Status = _SEH2_GetExceptionCode(); } _SEH2_END; - } - - if (!NT_SUCCESS(Status)) - { - SetLastNtError(Status); - DC_UnlockDc(dc); - return FALSE; - } - - DC_UnlockDc(dc); + + if (!NT_SUCCESS(Status)) + { + SetLastNtError(Status); + Ret = FALSE; + } + } + + DC_UnlockDc(pdc); return Ret; } Modified: trunk/reactos/subsystems/win32/win32k/objects/dcutil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcutil.c [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -3,126 +3,6 @@ #define NDEBUG #include <debug.h> - -/* - * DC device-independent Get/SetXXX functions - * (RJJ) swiped from WINE - */ - -#define DC_GET_VAL( func_type, func_name, dc_field ) \ -func_type APIENTRY func_name( HDC hdc ) \ -{ \ - func_type ft; \ - PDC dc = DC_LockDc( hdc ); \ - PDC_ATTR pdcattr; \ - if (!dc) \ - { \ - SetLastWin32Error(ERROR_INVALID_HANDLE); \ - return 0; \ - } \ - pdcattr = dc->pdcattr; \ - ft = pdcattr->dc_field; \ - DC_UnlockDc(dc); \ - return ft; \ -} - -/* DC_GET_VAL_EX is used to define functions returning a POINT or a SIZE. It is - * important that the function has the right signature, for the implementation - * we can do whatever we want. - */ -#define DC_GET_VAL_EX( FuncName, ret_x, ret_y, type, ax, ay ) \ -VOID FASTCALL Int##FuncName ( PDC dc, LP##type pt) \ -{ \ - PDC_ATTR pdcattr; \ - ASSERT(dc); \ - ASSERT(pt); \ - pdcattr = dc->pdcattr; \ - pt->ax = pdcattr->ret_x; \ - pt->ay = pdcattr->ret_y; \ -} - -#if 0 -BOOL APIENTRY NtGdi##FuncName ( HDC hdc, LP##type pt ) \ -{ \ - NTSTATUS Status = STATUS_SUCCESS; \ - type Safept; \ - PDC dc; \ - if(!pt) \ - { \ - SetLastWin32Error(ERROR_INVALID_PARAMETER); \ - return FALSE; \ - } \ - if(!(dc = DC_LockDc(hdc))) \ - { \ - SetLastWin32Error(ERROR_INVALID_HANDLE); \ - return FALSE; \ - } \ - Int##FuncName( dc, &Safept); \ - DC_UnlockDc(dc); \ - _SEH2_TRY \ - { \ - ProbeForWrite(pt, \ - sizeof( type ), \ - 1); \ - *pt = Safept; \ - } \ - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) \ - { \ - Status = _SEH2_GetExceptionCode(); \ - } \ - _SEH2_END; \ - if(!NT_SUCCESS(Status)) \ - { \ - SetLastNtError(Status); \ - return FALSE; \ - } \ - return TRUE; \ -} -#endif - -#define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \ -INT APIENTRY func_name( HDC hdc, INT mode ) \ -{ \ - INT prevMode; \ - PDC dc; \ - PDC_ATTR pdcattr; \ - if ((mode < min_val) || (mode > max_val)) \ - { \ - SetLastWin32Error(ERROR_INVALID_PARAMETER); \ - return 0; \ - } \ - dc = DC_LockDc ( hdc ); \ - if ( !dc ) \ - { \ - SetLastWin32Error(ERROR_INVALID_HANDLE); \ - return 0; \ - } \ - pdcattr = dc->pdcattr; \ - prevMode = pdcattr->dc_field; \ - pdcattr->dc_field = mode; \ - DC_UnlockDc ( dc ); \ - return prevMode; \ -} - - -DC_GET_VAL( INT, IntGdiGetMapMode, iMapMode ) -DC_GET_VAL( INT, IntGdiGetPolyFillMode, jFillMode ) -DC_GET_VAL( COLORREF, IntGdiGetBkColor, crBackgroundClr ) -DC_GET_VAL( INT, IntGdiGetBkMode, jBkMode ) -DC_GET_VAL( INT, IntGdiGetROP2, jROP2 ) -DC_GET_VAL( INT, IntGdiGetStretchBltMode, jStretchBltMode ) -DC_GET_VAL( UINT, IntGdiGetTextAlign, lTextAlign ) -DC_GET_VAL( COLORREF, IntGdiGetTextColor, crForegroundClr ) - -DC_GET_VAL_EX( GetViewportOrgEx, ptlViewportOrg.x, ptlViewportOrg.y, POINT, x, y ) -DC_GET_VAL_EX( GetWindowExtEx, szlWindowExt.cx, szlWindowExt.cy, SIZE, cx, cy ) -DC_GET_VAL_EX( GetWindowOrgEx, ptlWindowOrg.x, ptlWindowOrg.y, POINT, x, y ) - -DC_SET_MODE( IntGdiSetPolyFillMode, jFillMode, ALTERNATE, WINDING ) -DC_SET_MODE( IntGdiSetROP2, jROP2, R2_BLACK, R2_WHITE ) -DC_SET_MODE( IntGdiSetStretchBltMode, jStretchBltMode, BLACKONWHITE, HALFTONE ) - - COLORREF FASTCALL IntGdiSetBkColor(HDC hDC, COLORREF color) Modified: trunk/reactos/subsystems/win32/win32k/objects/fillshap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/fillshap.c [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -566,7 +566,7 @@ DestRect.bottom += dc->ptlDCOrig.y; /* In GM_COMPATIBLE, don't include bottom and right edges */ - if (IntGetGraphicsMode(dc) == GM_COMPATIBLE) + if (pdcattr->iGraphicsMode == GM_COMPATIBLE) { DestRect.right--; DestRect.bottom--; Modified: trunk/reactos/subsystems/win32/win32k/objects/path.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/path.c [iso-8859-1] Tue Mar 24 05:58:14 2009 @@ -350,7 +350,7 @@ } /* In GM_COMPATIBLE, don't include bottom and right edges */ - if ( IntGetGraphicsMode(dc) == GM_COMPATIBLE ) + if (dc->pdcattr->iGraphicsMode == GM_COMPATIBLE) { corners[1].x--; corners[1].y--; @@ -606,7 +606,7 @@ } /* In GM_COMPATIBLE, don't include bottom and right edges */ - if ( IntGetGraphicsMode(dc) == GM_COMPATIBLE ) + if (dc->pdcattr->iGraphicsMode == GM_COMPATIBLE ) { corners[1].x--; corners[1].y--; @@ -1343,11 +1343,13 @@ /* Save the mapping mode info */ mapMode = pdcattr->iMapMode; - IntGetViewportExtEx(dc, &szViewportExt); - IntGetViewportOrgEx(dc, &ptViewportOrg); - IntGetWindowExtEx(dc, &szWindowExt); - IntGetWindowOrgEx(dc, &ptWindowOrg); - + + DC_vUpdateViewportExt(dc); + szViewportExt = dc->pdcattr->szlViewportExt; + ptViewportOrg = dc->pdcattr->ptlViewportOrg; + szWindowExt = dc->pdcattr->szlWindowExt; + ptWindowOrg = dc->pdcattr->ptlWindowOrg; + MatrixS2XForm(&xform, &dc->dclevel.mxWorldToPage); /* Set MM_TEXT */
15 years, 9 months
1
0
0
0
[cgutman] 40200: - Fix several cancellation and socket shutdown issues: - Don't call DestroySocket if FCB->State == SOCKET_STATE_CLOSED because the FCB is already being destroyed (Irp->Cancel checks hid this bug) - Remove the Irp->Cancel checks (hacks) - Only return early if we can't cancel an IRP - Add an FCB->State check in StreamSocketConnectComplete - Store the failure status in the IRP
by cgutman@svn.reactos.org
Author: cgutman Date: Tue Mar 24 05:01:46 2009 New Revision: 40200 URL:
http://svn.reactos.org/svn/reactos?rev=40200&view=rev
Log: - Fix several cancellation and socket shutdown issues: - Don't call DestroySocket if FCB->State == SOCKET_STATE_CLOSED because the FCB is already being destroyed (Irp->Cancel checks hid this bug) - Remove the Irp->Cancel checks (hacks) - Only return early if we can't cancel an IRP - Add an FCB->State check in StreamSocketConnectComplete - Store the failure status in the IRP Modified: trunk/reactos/drivers/network/afd/afd/connect.c trunk/reactos/drivers/network/afd/afd/listen.c trunk/reactos/drivers/network/afd/afd/main.c trunk/reactos/drivers/network/afd/afd/read.c trunk/reactos/drivers/network/afd/afd/write.c Modified: trunk/reactos/drivers/network/afd/afd/connect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/co…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/connect.c [iso-8859-1] Tue Mar 24 05:01:46 2009 @@ -84,16 +84,22 @@ /* I was wrong about this before as we can have pending writes to a not * yet connected socket */ - if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; + if( !SocketAcquireStateLock( FCB ) ) { + Irp->IoStatus.Status = STATUS_FILE_CLOSED; + Irp->IoStatus.Information = 0; + return STATUS_FILE_CLOSED; + } AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n", Irp->IoStatus.Status)); FCB->ConnectIrp.InFlightRequest = NULL; - if( Irp->Cancel ) { - SocketStateUnlock( FCB ); - return STATUS_CANCELLED; + if( FCB->State == SOCKET_STATE_CLOSED ) { + Irp->IoStatus.Status = STATUS_FILE_CLOSED; + Irp->IoStatus.Information = 0; + SocketStateUnlock( FCB ); + return STATUS_FILE_CLOSED; } if( NT_SUCCESS(Irp->IoStatus.Status) ) { @@ -123,6 +129,8 @@ Status = MakeSocketIntoConnection( FCB ); if( !NT_SUCCESS(Status) ) { + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; SocketStateUnlock( FCB ); return Status; } @@ -141,6 +149,12 @@ if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS; + } + + if (!NT_SUCCESS(Status)) + { + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = 0; } SocketStateUnlock( FCB ); Modified: trunk/reactos/drivers/network/afd/afd/listen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/li…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/listen.c [iso-8859-1] Tue Mar 24 05:01:46 2009 @@ -112,18 +112,10 @@ FCB->ListenIrp.InFlightRequest = NULL; - if( Irp->Cancel ) { - Irp->IoStatus.Status = STATUS_CANCELLED; - Irp->IoStatus.Information = 0; - SocketStateUnlock( FCB ); - return STATUS_CANCELLED; - } - if( FCB->State == SOCKET_STATE_CLOSED ) { Irp->IoStatus.Status = STATUS_FILE_CLOSED; Irp->IoStatus.Information = 0; SocketStateUnlock( FCB ); - DestroySocket( FCB ); return STATUS_FILE_CLOSED; } Modified: trunk/reactos/drivers/network/afd/afd/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/ma…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/main.c [iso-8859-1] Tue Mar 24 05:01:46 2009 @@ -180,36 +180,20 @@ InFlightRequest[2] = &FCB->SendIrp; InFlightRequest[3] = &FCB->ConnectIrp; - /* Return early here because we might be called in the mean time. */ - if( FCB->Critical || - FCB->ListenIrp.InFlightRequest || - FCB->ReceiveIrp.InFlightRequest || - FCB->SendIrp.InFlightRequest || - FCB->ConnectIrp.InFlightRequest ) { - AFD_DbgPrint(MIN_TRACE,("Leaving socket alive (%x %x %x %x)\n", - FCB->ListenIrp.InFlightRequest, - FCB->ReceiveIrp.InFlightRequest, - FCB->SendIrp.InFlightRequest, - FCB->ConnectIrp.InFlightRequest)); - ReturnEarly = TRUE; - } - - /* After PoolReeval, this FCB should not be involved in any outstanding - * poll requests */ - /* Cancel our pending requests */ for( i = 0; i < IN_FLIGHT_REQUESTS; i++ ) { if( InFlightRequest[i]->InFlightRequest ) { AFD_DbgPrint(MID_TRACE,("Cancelling in flight irp %d (%x)\n", i, InFlightRequest[i]->InFlightRequest)); - IoCancelIrp(InFlightRequest[i]->InFlightRequest); - InFlightRequest[i]->InFlightRequest = NULL; + if (!IoCancelIrp(InFlightRequest[i]->InFlightRequest)) + ReturnEarly = TRUE; } } SocketStateUnlock( FCB ); - if( ReturnEarly ) return; + if( ReturnEarly ) + return; if( FCB->Recv.Window ) ExFreePool( FCB->Recv.Window ); Modified: trunk/reactos/drivers/network/afd/afd/read.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/re…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/read.c [iso-8859-1] Tue Mar 24 05:01:46 2009 @@ -238,13 +238,6 @@ FCB->ReceiveIrp.InFlightRequest = NULL; - if( Irp->Cancel ) { - Irp->IoStatus.Status = STATUS_CANCELLED; - Irp->IoStatus.Information = 0; - SocketStateUnlock( FCB ); - return STATUS_CANCELLED; - } - FCB->Recv.Content = Irp->IoStatus.Information; FCB->Recv.BytesUsed = 0; @@ -253,7 +246,6 @@ Irp->IoStatus.Status = STATUS_FILE_CLOSED; Irp->IoStatus.Information = 0; SocketStateUnlock( FCB ); - DestroySocket( FCB ); return STATUS_FILE_CLOSED; } else if( FCB->State == SOCKET_STATE_LISTENING ) { AFD_DbgPrint(MIN_TRACE,("!!! LISTENER GOT A RECEIVE COMPLETE !!!\n")); @@ -468,18 +460,10 @@ FCB->ReceiveIrp.InFlightRequest = NULL; - if( Irp->IoStatus.Status == STATUS_CANCELLED ) { - Irp->IoStatus.Status = STATUS_CANCELLED; - Irp->IoStatus.Information = 0; - SocketStateUnlock( FCB ); - return STATUS_CANCELLED; - } - if( FCB->State == SOCKET_STATE_CLOSED ) { Irp->IoStatus.Status = STATUS_FILE_CLOSED; Irp->IoStatus.Information = 0; SocketStateUnlock( FCB ); - DestroySocket( FCB ); return STATUS_FILE_CLOSED; } Modified: trunk/reactos/drivers/network/afd/afd/write.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/afd/afd/wr…
============================================================================== --- trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] (original) +++ trunk/reactos/drivers/network/afd/afd/write.c [iso-8859-1] Tue Mar 24 05:01:46 2009 @@ -49,18 +49,10 @@ FCB->SendIrp.InFlightRequest = NULL; /* Request is not in flight any longer */ - if( Irp->Cancel ) { - Irp->IoStatus.Status = STATUS_CANCELLED; - Irp->IoStatus.Information = 0; - SocketStateUnlock( FCB ); - return STATUS_CANCELLED; - } - if( FCB->State == SOCKET_STATE_CLOSED ) { Irp->IoStatus.Status = STATUS_FILE_CLOSED; Irp->IoStatus.Information = 0; SocketStateUnlock( FCB ); - DestroySocket( FCB ); return STATUS_FILE_CLOSED; } @@ -189,13 +181,6 @@ FCB->SendIrp.InFlightRequest = NULL; /* Request is not in flight any longer */ - if( Irp->Cancel ) { - Irp->IoStatus.Status = STATUS_CANCELLED; - Irp->IoStatus.Information = 0; - SocketStateUnlock( FCB ); - return STATUS_CANCELLED; - } - FCB->PollState |= AFD_EVENT_SEND; PollReeval( FCB->DeviceExt, FCB->FileObject ); @@ -203,7 +188,6 @@ Irp->IoStatus.Status = STATUS_FILE_CLOSED; Irp->IoStatus.Information = 0; SocketStateUnlock( FCB ); - DestroySocket( FCB ); return STATUS_FILE_CLOSED; }
15 years, 9 months
1
0
0
0
[tkreuzer] 40199: - Add a bunch of tests for NtGdiDeleteObjectApp - Add Is handle valid function to check whether a handle is still valid.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Mar 24 04:25:03 2009 New Revision: 40199 URL:
http://svn.reactos.org/svn/reactos?rev=40199&view=rev
Log: - Add a bunch of tests for NtGdiDeleteObjectApp - Add Is handle valid function to check whether a handle is still valid. Added: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c (with props) Modified: trunk/rostests/apitests/w32knapi/testlist.c trunk/rostests/apitests/w32knapi/w32knapi.c trunk/rostests/apitests/w32knapi/w32knapi.h Added: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
============================================================================== --- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c (added) +++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c [iso-8859-1] Tue Mar 24 04:25:03 2009 @@ -1,0 +1,93 @@ + +INT +Test_NtGdiDeleteObjectApp(PTESTINFO pti) +{ + HDC hdc; + HBITMAP hbmp; + HBRUSH hbrush; + BOOL ret; + + /* Try to delete 0 */ + SetLastError(0); + ret = NtGdiDeleteObjectApp(0); + TEST(ret == 0); + TEST(GetLastError() == 0); + + /* Delete a DC */ + SetLastError(0); + hdc = CreateCompatibleDC(NULL); + ASSERT(hdc); + TEST(IsHandleValid(hdc) == 1); + ret = NtGdiDeleteObjectApp(hdc); + TEST(ret == 1); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hdc) == 0); + + /* Delete a brush */ + SetLastError(0); + hbrush = CreateSolidBrush(0x123456); + ASSERT(hbrush); + TEST(IsHandleValid(hbrush) == 1); + ret = NtGdiDeleteObjectApp(hbrush); + TEST(ret == 1); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hbrush) == 0); + + /* Try to delete a stock brush */ + SetLastError(0); + hbrush = GetStockObject(BLACK_BRUSH); + ASSERT(hbrush); + TEST(IsHandleValid(hbrush) == 1); + ret = NtGdiDeleteObjectApp(hbrush); + TEST(ret == 1); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hbrush) == 1); + + /* Delete a bitmap */ + SetLastError(0); + hbmp = CreateBitmap(10, 10, 1, 1, NULL); + ASSERT(hbmp); + TEST(IsHandleValid(hbmp) == 1); + ret = NtGdiDeleteObjectApp(hbmp); + TEST(ret == 1); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hbmp) == 0); + + /* Create a DC for further use */ + hdc = CreateCompatibleDC(NULL); + ASSERT(hdc); + + /* Try to delete a brush that is selected into a DC */ + SetLastError(0); + hbrush = CreateSolidBrush(0x123456); + ASSERT(hbrush); + TEST(IsHandleValid(hbrush) == 1); + TEST(NtGdiSelectBrush(hdc, hbrush)); + ret = NtGdiDeleteObjectApp(hbrush); + TEST(ret == 1); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hbrush) == 1); + + /* Try to delete a bitmap that is selected into a DC */ + SetLastError(0); + hbmp = CreateBitmap(10, 10, 1, 1, NULL); + ASSERT(hbmp); + TEST(IsHandleValid(hbmp) == 1); + TEST(NtGdiSelectBitmap(hdc, hbmp)); + ret = NtGdiDeleteObjectApp(hbmp); + TEST(ret == 1); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hbmp) == 1); + + /* Bitmap get's deleted as soon as we dereference it */ + NtGdiSelectBitmap(hdc, GetStockObject(DEFAULT_BITMAP)); + TEST(IsHandleValid(hbmp) == 0); + + ret = NtGdiDeleteObjectApp(hbmp); + TEST(ret == 1); + TEST(GetLastError() == 0); + TEST(IsHandleValid(hbmp) == 0); + + + return APISTATUS_NORMAL; +} Propchange: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/w32knapi/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/testlis…
============================================================================== --- trunk/rostests/apitests/w32knapi/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/w32knapi/testlist.c [iso-8859-1] Tue Mar 24 04:25:03 2009 @@ -13,6 +13,7 @@ #include "ntgdi/NtGdiCreateCompatibleBitmap.c" #include "ntgdi/NtGdiCreateCompatibleDC.c" #include "ntgdi/NtGdiCreateDIBSection.c" +#include "ntgdi/NtGdiDeleteObjectApp.c" #include "ntgdi/NtGdiDoPalette.c" #include "ntgdi/NtGdiEngCreatePalette.c" //#include "ntgdi/NtGdiEnumFontChunk.c" @@ -72,6 +73,7 @@ { L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap }, { L"NtGdiCreateCompatibleDC", Test_NtGdiCreateCompatibleDC }, { L"NtGdiCreateDIBSection", Test_NtGdiCreateDIBSection }, + { L"NtGdiDeleteObjectApp", Test_NtGdiDeleteObjectApp }, { L"NtGdiDoPalette", Test_NtGdiDoPalette }, { L"NtGdiEngCreatePalette", Test_NtGdiEngCreatePalette }, // { L"NtGdiEnumFontChunk", Test_NtGdiEnumFontChunk }, Modified: trunk/rostests/apitests/w32knapi/w32knapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/w32knap…
============================================================================== --- trunk/rostests/apitests/w32knapi/w32knapi.c [iso-8859-1] (original) +++ trunk/rostests/apitests/w32knapi/w32knapi.c [iso-8859-1] Tue Mar 24 04:25:03 2009 @@ -11,6 +11,22 @@ PTEB pTeb = NtCurrentTeb(); PPEB pPeb = pTeb->ProcessEnvironmentBlock; return pPeb->GdiSharedHandleTable; +} + +BOOL +IsHandleValid(HGDIOBJ hobj) +{ + USHORT Index = (ULONG_PTR)hobj; + PGDI_TABLE_ENTRY pentry = &GdiHandleTable[Index]; + + if (pentry->KernelData == NULL || + pentry->KernelData < (PVOID)0x80000000 || + (USHORT)pentry->FullUnique != (USHORT)((ULONG_PTR)hobj >> 16)) + { + return FALSE; + } + + return TRUE; } static DWORD WINAPI Modified: trunk/rostests/apitests/w32knapi/w32knapi.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/w32knap…
============================================================================== --- trunk/rostests/apitests/w32knapi/w32knapi.h [iso-8859-1] (original) +++ trunk/rostests/apitests/w32knapi/w32knapi.h [iso-8859-1] Tue Mar 24 04:25:03 2009 @@ -37,6 +37,7 @@ extern HMODULE g_hModule; extern PGDI_TABLE_ENTRY GdiHandleTable; +BOOL IsHandleValid(HGDIOBJ hobj); DWORD Syscall(LPWSTR lpszFunction, int cParams, void* pParams); BOOL InitOsVersion(); extern UINT g_OsIdx;
15 years, 9 months
1
0
0
0
[jmorlan] 40198: Implement all remaining switches for the START command.
by jmorlan@svn.reactos.org
Author: jmorlan Date: Tue Mar 24 02:52:50 2009 New Revision: 40198 URL:
http://svn.reactos.org/svn/reactos?rev=40198&view=rev
Log: Implement all remaining switches for the START command. Modified: trunk/reactos/base/shell/cmd/cmd.c trunk/reactos/base/shell/cmd/cmd.h trunk/reactos/base/shell/cmd/setlocal.c trunk/reactos/base/shell/cmd/start.c Modified: trunk/reactos/base/shell/cmd/cmd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.c?rev=4…
============================================================================== --- trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/cmd.c [iso-8859-1] Tue Mar 24 02:52:50 2009 @@ -163,6 +163,7 @@ HANDLE hIn; HANDLE hOut; HANDLE hConsole; +LPTSTR lpOriginalEnvironment; HANDLE CMD_ModuleHandle; static NtQueryInformationProcessProc NtQueryInformationProcessPtr = NULL; @@ -1928,6 +1929,8 @@ CONSOLE_SCREEN_BUFFER_INFO Info; INT nExitCode; + lpOriginalEnvironment = DuplicateEnvironment(); + GetCurrentDirectory(MAX_PATH,startPath); _tchdir(startPath); @@ -1959,6 +1962,8 @@ /* do the cleanup */ Cleanup(); + cmd_free(lpOriginalEnvironment); + cmd_exit(nExitCode); return(nExitCode); } Modified: trunk/reactos/base/shell/cmd/cmd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/cmd.h?rev=4…
============================================================================== --- trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/cmd.h [iso-8859-1] Tue Mar 24 02:52:50 2009 @@ -54,6 +54,7 @@ extern HANDLE hOut; extern HANDLE hIn; extern HANDLE hConsole; +extern LPTSTR lpOriginalEnvironment; extern WORD wColor; extern WORD wDefColor; extern BOOL bCtrlBreak; @@ -437,6 +438,7 @@ INT cmd_set (LPTSTR); /* Prototypes for SETLOCAL.C */ +LPTSTR DuplicateEnvironment(VOID); INT cmd_setlocal (LPTSTR); INT cmd_endlocal (LPTSTR); Modified: trunk/reactos/base/shell/cmd/setlocal.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/setlocal.c?…
============================================================================== --- trunk/reactos/base/shell/cmd/setlocal.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/setlocal.c [iso-8859-1] Tue Mar 24 02:52:50 2009 @@ -16,7 +16,8 @@ } SETLOCAL; /* Create a copy of the current environment */ -static LPTSTR DuplicateEnvironment() +LPTSTR +DuplicateEnvironment(VOID) { LPTSTR Environ = GetEnvironmentStrings(); LPTSTR End, EnvironCopy; Modified: trunk/reactos/base/shell/cmd/start.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/cmd/start.c?rev…
============================================================================== --- trunk/reactos/base/shell/cmd/start.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/cmd/start.c [iso-8859-1] Tue Mar 24 02:52:50 2009 @@ -49,9 +49,15 @@ PROCESS_INFORMATION prci; STARTUPINFO stui; INT i = 0; - DWORD Priority = 0; +#ifdef UNICODE + DWORD dwCreationFlags = CREATE_NEW_CONSOLE | CREATE_UNICODE_ENVIRONMENT; +#else + DWORD dwCreationFlags = CREATE_NEW_CONSOLE; +#endif + DWORD dwAffinityMask = 0; LPTSTR lpTitle = NULL; LPTSTR lpDirectory = NULL; + LPTSTR lpEnvironment = NULL; WORD wShowWindow = SW_SHOWNORMAL; while (1) @@ -86,6 +92,11 @@ } StripQuotes(lpDirectory); } + else if (_totupper(*option) == _T('I')) + { + /* rest of the option is apparently ignored */ + lpEnvironment = lpOriginalEnvironment; + } else if (!_tcsicmp(option, _T("MIN"))) { wShowWindow = SW_MINIMIZE; @@ -94,29 +105,58 @@ { wShowWindow = SW_MAXIMIZE; } + else if (!_tcsicmp(option, _T("AFFINITY"))) + { + TCHAR *end; + while (_istspace(*Rest)) + Rest++; + option = GetParameter(&Rest); + /* Affinity mask is given in hexadecimal */ + dwAffinityMask = _tcstoul(option, &end, 16); + if (*end != _T('\0') || dwAffinityMask == 0 || + dwAffinityMask == (DWORD)-1) + { + ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT, option); + return 1; + } + dwCreationFlags |= CREATE_SUSPENDED; + } + else if (!_tcsicmp(option, _T("B"))) + { + dwCreationFlags &= ~CREATE_NEW_CONSOLE; + dwCreationFlags |= CREATE_NEW_PROCESS_GROUP; + } else if (!_tcsicmp(option, _T("LOW"))) { - Priority = IDLE_PRIORITY_CLASS; + dwCreationFlags |= IDLE_PRIORITY_CLASS; } else if (!_tcsicmp(option, _T("NORMAL"))) { - Priority = NORMAL_PRIORITY_CLASS; + dwCreationFlags |= NORMAL_PRIORITY_CLASS; } else if (!_tcsicmp(option, _T("HIGH"))) { - Priority = HIGH_PRIORITY_CLASS; + dwCreationFlags |= HIGH_PRIORITY_CLASS; } else if (!_tcsicmp(option, _T("REALTIME"))) { - Priority = REALTIME_PRIORITY_CLASS; + dwCreationFlags |= REALTIME_PRIORITY_CLASS; } else if (!_tcsicmp(option, _T("ABOVENORMAL"))) { - Priority = ABOVE_NORMAL_PRIORITY_CLASS; + dwCreationFlags |= ABOVE_NORMAL_PRIORITY_CLASS; } else if (!_tcsicmp(option, _T("BELOWNORMAL"))) { - Priority = BELOW_NORMAL_PRIORITY_CLASS; + dwCreationFlags |= BELOW_NORMAL_PRIORITY_CLASS; + } + else if (!_tcsicmp(option, _T("SEPARATE"))) + { + dwCreationFlags |= CREATE_SEPARATE_WOW_VDM; + } + else if (!_tcsicmp(option, _T("SHARED"))) + { + dwCreationFlags |= CREATE_SHARED_WOW_VDM; } else if (!_tcsicmp(option, _T("W")) || !_tcsicmp(option, _T("WAIT"))) @@ -223,18 +263,18 @@ stui.lpTitle = lpTitle; stui.wShowWindow = wShowWindow; - if (bBat == TRUE) - { - bCreate = CreateProcess (NULL, szFullCmdLine, NULL, NULL, FALSE, - CREATE_NEW_CONSOLE | Priority, NULL, lpDirectory, &stui, &prci); - } - else - { - bCreate = CreateProcess (szFullName, szFullCmdLine, NULL, NULL, FALSE, - CREATE_NEW_CONSOLE | Priority, NULL, lpDirectory, &stui, &prci); - } + bCreate = CreateProcess(bBat ? comspec : szFullName, + szFullCmdLine, NULL, NULL, TRUE, dwCreationFlags, + lpEnvironment, lpDirectory, &stui, &prci); if (bCreate) + { + if (dwAffinityMask) + { + SetProcessAffinityMask(prci.hProcess, dwAffinityMask); + ResumeThread(prci.hThread); + } CloseHandle(prci.hThread); + } } else { @@ -246,8 +286,10 @@ if (!bCreate) { /* CreateProcess didn't work; try ShellExecute */ - prci.hProcess = RunFile(SEE_MASK_NOCLOSEPROCESS, szFullName, - param, lpDirectory, wShowWindow); + DWORD flags = SEE_MASK_NOCLOSEPROCESS; + if (!(dwCreationFlags & CREATE_NEW_CONSOLE)) + flags |= SEE_MASK_NO_CONSOLE; + prci.hProcess = RunFile(flags, szFullName, param, lpDirectory, wShowWindow); } if (prci.hProcess != NULL)
15 years, 9 months
1
0
0
0
[jmorlan] 40197: Fix a bug in wcstoul causing it to set *endptr improperly.
by jmorlan@svn.reactos.org
Author: jmorlan Date: Tue Mar 24 02:51:59 2009 New Revision: 40197 URL:
http://svn.reactos.org/svn/reactos?rev=40197&view=rev
Log: Fix a bug in wcstoul causing it to set *endptr improperly. Modified: trunk/reactos/lib/sdk/crt/string/wcstoul.c Modified: trunk/reactos/lib/sdk/crt/string/wcstoul.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wcstoul…
============================================================================== --- trunk/reactos/lib/sdk/crt/string/wcstoul.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/string/wcstoul.c [iso-8859-1] Tue Mar 24 02:51:59 2009 @@ -67,6 +67,6 @@ else if (neg) acc = -acc; if (endptr != 0) - *endptr = any ? (wchar_t *)((size_t)s - 1) : (wchar_t *)((size_t)nptr); + *endptr = any ? (wchar_t *)((size_t)(s - 1)) : (wchar_t *)((size_t)nptr); return acc; }
15 years, 9 months
1
0
0
0
← Newer
1
...
8
9
10
11
12
13
14
...
49
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
Results per page:
10
25
50
100
200