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
July 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
27 participants
605 discussions
Start a n
N
ew thread
[dchapyshev] 42101: - Add debug print to MiQueryVirtualMemory
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Mon Jul 20 20:03:16 2009 New Revision: 42101 URL:
http://svn.reactos.org/svn/reactos?rev=42101&view=rev
Log: - Add debug print to MiQueryVirtualMemory Modified: trunk/reactos/ntoskrnl/mm/virtual.c Modified: trunk/reactos/ntoskrnl/mm/virtual.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/virtual.c?rev=…
============================================================================== --- trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] Mon Jul 20 20:03:16 2009 @@ -555,6 +555,7 @@ default: { + DPRINT1("Unsupported or unimplemented class: %lx\n", VirtualMemoryInformationClass); Status = STATUS_INVALID_INFO_CLASS; *ResultLength = 0; break;
15 years, 5 months
1
0
0
0
[janderwald] 42100: - A few updates from the Ninja-Arch
by janderwald@svn.reactos.org
Author: janderwald Date: Mon Jul 20 19:14:21 2009 New Revision: 42100 URL:
http://svn.reactos.org/svn/reactos?rev=42100&view=rev
Log: - A few updates from the Ninja-Arch Modified: trunk/reactos/include/psdk/ks.h Modified: trunk/reactos/include/psdk/ks.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/ks.h?rev=4210…
============================================================================== --- trunk/reactos/include/psdk/ks.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/ks.h [iso-8859-1] Mon Jul 20 19:14:21 2009 @@ -542,8 +542,10 @@ Properties/Methods/Events */ -#define KSPROPSETID_StreamAllocator \ +#define STATIC_KSPROPSETID_StreamAllocator\ 0xcf6e4342L, 0xec87, 0x11cf, 0xa1, 0x30, 0x00, 0x20, 0xaf, 0xd1, 0x56, 0xe4 +DEFINE_GUIDSTRUCT("cf6e4342-ec87-11cf-a130-0020afd156e4", KSPROPSETID_StreamAllocator); +#define KSPROPSETID_StreamAllocator DEFINE_GUIDNAMED(KSPROPSETID_StreamAllocator) typedef enum { @@ -1463,6 +1465,7 @@ typedef BOOLEAN +NTAPI (*PFNKSFASTHANDLER)( IN PFILE_OBJECT FileObject, IN PKSIDENTIFIER Request, @@ -1536,13 +1539,17 @@ typedef struct { - ULONG CountItems; // count of FramingItem-s below. + ULONG CountItems; ULONG PinFlags; KS_COMPRESSION OutputCompression; - ULONG PinWeight; // this pin framing's Weight graph-wide + ULONG PinWeight; KS_FRAMING_ITEM FramingItem[1]; } KSALLOCATOR_FRAMING_EX, *PKSALLOCATOR_FRAMING_EX; +#define KSALLOCATOR_FLAG_PARTIAL_READ_SUPPORT 0x00000010 +#define KSALLOCATOR_FLAG_DEVICE_SPECIFIC 0x00000020 +#define KSALLOCATOR_FLAG_CAN_ALLOCATE 0x00000040 +#define KSALLOCATOR_FLAG_INSIST_ON_FRAMESIZE_RATIO 0x00000080 /* =============================================================== Quality @@ -1739,7 +1746,7 @@ PKSOBJECT_CREATE_ITEM CreateItemsList; } KSOBJECT_CREATE, *PKSOBJECT_CREATE; -typedef VOID (*PFNKSITEMFREECALLBACK)( +typedef VOID (NTAPI *PFNKSITEMFREECALLBACK)( IN PKSOBJECT_CREATE_ITEM CreateItem); #endif @@ -2401,7 +2408,7 @@ /* TODO */ typedef void* UNKNOWN; -typedef PVOID (*PFNKSINITIALIZEALLOCATOR)( +typedef PVOID NTAPI(*PFNKSINITIALIZEALLOCATOR)( IN PVOID InitialContext, IN PKSALLOCATOR_FRAMING AllocatorFraming, OUT PVOID* Context); @@ -2421,18 +2428,30 @@ IN ULONG DataBufferSize, OUT PVOID Data OPTIONAL, OUT PULONG DataSize); -#endif - -typedef UNKNOWN PFNALLOCATORE_ALLOCATEFRAME; -typedef UNKNOWN PFNALLOCATOR_FREEFRAME; - -/* -typedef struct -{ - PFNALLOCATOR_ALLOCATEFRAME AllocateFrame; - PFNALLOCATOR_FREEFRAME FreeFrame; -} -*/ + + +typedef +NTSTATUS +NTAPI +(*PFNALLOCATOR_ALLOCATEFRAME)( + IN PFILE_OBJECT FileObject, + PVOID *Frame + ); + +typedef +VOID +NTAPI +(*PFNALLOCATOR_FREEFRAME)( + IN PFILE_OBJECT FileObject, + IN PVOID Frame + ); + +typedef struct { + PFNALLOCATOR_ALLOCATEFRAME AllocateFrame; + PFNALLOCATOR_FREEFRAME FreeFrame; +} KSSTREAMALLOCATOR_FUNCTIONTABLE, *PKSSTREAMALLOCATOR_FUNCTIONTABLE; + +#endif typedef struct { @@ -2472,6 +2491,21 @@ ULONG Alignment; }; #endif + + +typedef struct { + GUID ProtocolId; + PVOID Argument1; + PVOID Argument2; +} KSHANDSHAKE, *PKSHANDSHAKE; + +typedef struct _KSGATE KSGATE, *PKSGATE; +typedef struct _KSPROCESSPIN_INDEXENTRY KSPROCESSPIN_INDEXENTRY, *PKSPROCESSPIN_INDEXENTRY; + +struct _KSGATE { + LONG Count; + PKSGATE NextGate; +}; struct _KSSTREAM_POINTER_OFFSET { @@ -2514,11 +2548,11 @@ BOOLEAN Terminate; }; -typedef struct +struct _KSPROCESSPIN_INDEXENTRY { PKSPROCESSPIN* Pins; ULONG Count; -} KSPROCESSPIN_INDEXENTRY, *PKSPROCESSPIN_INDEXENTRY; +}; #endif /* =============================================================== @@ -2671,9 +2705,11 @@ struct _KSDEVICE_DESCRIPTOR { - const KSDEVICE_DISPATCH* Dispatch; - ULONG FilterDescriptorsCount; - const KSFILTER_DESCRIPTOR*const* FilterDescriptors; + const KSDEVICE_DISPATCH* Dispatch; + ULONG FilterDescriptorsCount; + const KSFILTER_DESCRIPTOR*const* FilterDescriptors; + ULONG Version; + ULONG Flags; }; struct _KSFILTERFACTORY { @@ -3462,6 +3498,17 @@ typedef struct _KSFILTERFACTORY KSFILTERFACTORY, *PKSFILTERFACTORY; //FIXME + +KSDDKAPI +NTSTATUS +NTAPI +KsInitializeDevice ( + IN PDEVICE_OBJECT FunctionalDeviceObject, + IN PDEVICE_OBJECT PhysicalDeviceObject, + IN PDEVICE_OBJECT NextDeviceObject, + IN const KSDEVICE_DESCRIPTOR* Descriptor OPTIONAL); + + typedef void (*PFNKSFILTERFACTORYPOWER)( IN PKSFILTERFACTORY FilterFactory, IN DEVICE_POWER_STATE State); @@ -3551,7 +3598,7 @@ IN ULONG CreateItemFlags, IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, - OUT PKSFILTERFACTORY FilterFactory OPTIONAL); + OUT PKSFILTERFACTORY *FilterFactory OPTIONAL); KSDDKAPI NTSTATUS @@ -3560,6 +3607,23 @@ IN PIRP Irp, IN PKSEVENTDATA EventData, IN OUT PKSEVENT_ENTRY EventEntry); + +KSDDKAPI +NTSTATUS +NTAPI +KsDispatchQuerySecurity( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ); + +KSDDKAPI +NTSTATUS +NTAPI +KsDispatchSetSecurity( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ); + #define KsDeleteFilterFactory(FilterFactory) \ @@ -3618,7 +3682,49 @@ IN PKSDEVICE Device, IN PUNKNOWN ClientUnknown); -#endif + +#endif + +#undef INTERFACE +#define INTERFACE IKsControl + +DEFINE_GUID(IID_IKsControl, 0x28F54685L, 0x06FD, 0x11D2, 0xB2, 0x7A, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96); + +DECLARE_INTERFACE_(IKsControl,IUnknown) +{ + STDMETHOD_(NTSTATUS, QueryInterface)( THIS_ + REFIID InterfaceId, + PVOID* Interface)PURE; + + STDMETHOD_(ULONG, AddRef)(THIS) PURE; + + STDMETHOD_(ULONG, Release)(THIS) PURE; + + STDMETHOD_(NTSTATUS, KsProperty)(THIS_ + IN PKSPROPERTY Property, + IN ULONG PropertyLength, + IN OUT PVOID PropertyData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; + STDMETHOD_(NTSTATUS, KsMethod)(THIS_ + IN PKSMETHOD Method, + IN ULONG MethodLength, + IN OUT PVOID MethodData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; + STDMETHOD_(NTSTATUS, KsEvent)(THIS_ + IN PKSEVENT Event OPTIONAL, + IN ULONG EventLength, + IN OUT PVOID EventData, + IN ULONG DataLength, + OUT ULONG* BytesReturned + ) PURE; +}; + +#undef INTERFACE +typedef IKsControl* PIKSCONTROL; KSDDKAPI VOID
15 years, 5 months
1
0
0
0
[fireball] 42099: - Copy polygon filling algorithms from trunk's win32k.
by fireball@svn.reactos.org
Author: fireball Date: Mon Jul 20 16:18:56 2009 New Revision: 42099 URL:
http://svn.reactos.org/svn/reactos?rev=42099&view=rev
Log: - Copy polygon filling algorithms from trunk's win32k. Added: branches/arwinss/reactos/subsystems/win32/win32k/gre/polyfill.c - copied unchanged from r42098, trunk/reactos/subsystems/win32/win32k/objects/polyfill.c
15 years, 5 months
1
0
0
0
[fireball] 42098: - Properly implement add_timeout_user / remove_timeout_user (thus eliminating non paged pool leakage of a test implementation). - Debug prints are still turned on because remove_timeout_user seems to not being called.
by fireball@svn.reactos.org
Author: fireball Date: Mon Jul 20 16:01:25 2009 New Revision: 42098 URL:
http://svn.reactos.org/svn/reactos?rev=42098&view=rev
Log: - Properly implement add_timeout_user / remove_timeout_user (thus eliminating non paged pool leakage of a test implementation). - Debug prints are still turned on because remove_timeout_user seems to not being called. Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h [iso-8859-1] Mon Jul 20 16:01:25 2009 @@ -123,7 +123,12 @@ static inline int check_object_access(struct object *obj, unsigned int *access) { return TRUE; }; // timeout stuff -struct timeout_user; +struct timeout_user +{ + KTIMER Timer; + KDPC Dpc; +}; + enum timeout_t; typedef PKDEFERRED_ROUTINE timeout_callback; #define TICKS_PER_SEC 10000000 Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1] Mon Jul 20 16:01:25 2009 @@ -40,35 +40,36 @@ struct timeout_user *add_timeout_user( timeout_t when, timeout_callback func, void *private ) { - PKTIMER Timer; - PKDPC Dpc; LARGE_INTEGER DueTime; + struct timeout_user *TimeoutUser; DueTime.QuadPart = (LONGLONG)when; - DPRINT1("add_timeout_user(when %I64d, func %p)\n", when, func); + DPRINT1("add_timeout_user(when %I64d, func %p), current time %I64d\n", when, func, CurrentTime.QuadPart); - Timer = ExAllocatePool(NonPagedPool, sizeof(KTIMER)); - KeInitializeTimer(Timer); + /* Allocate memory for timeout structure */ + TimeoutUser = ExAllocatePool(NonPagedPool, sizeof(struct timeout_user)); - Dpc = ExAllocatePool(NonPagedPool, sizeof(KDPC)); - KeInitializeDpc(Dpc, func, private); + /* Initialize timer and DPC objects */ + KeInitializeTimer(&TimeoutUser->Timer); + KeInitializeDpc(&TimeoutUser->Dpc, func, private); - KeSetTimer(Timer, DueTime, Dpc); + /* Set the timer */ + KeSetTimer(&TimeoutUser->Timer, DueTime, &TimeoutUser->Dpc); - return (struct timeout_user *)Timer; + return TimeoutUser; } /* remove a timeout user */ void remove_timeout_user( struct timeout_user *user ) { - PKTIMER Timer = (PKTIMER)user; DPRINT1("remove_timeout_user %p\n", user); - KeCancelTimer(Timer); - ExFreePool(Timer); + /* Cancel the timer */ + KeCancelTimer(&user->Timer); - // FIXME: Dpc memory is not freed! + /* Free memory */ + ExFreePool(user); } /* default map_access() routine for objects that behave like an fd */
15 years, 5 months
1
0
0
0
[fireball] 42097: - Swap szWnd/szVport/ptWndOrg/ptVportOrg to two rectangles: Vport one, and DC one. The DC one is relative to the Vport one. - Set both DC and Vport rectangles from the winent driver. Setting them back to fullscreen is not supported now, but since only their origins (top, left) are used now - it's ok. - Offset all graphic operations by the Vport offset too. Now graphics is displayed at correct places inside windows, including text output too. - Silence font.c debug prints. - Add
by fireball@svn.reactos.org
Author: fireball Date: Mon Jul 20 15:33:16 2009 New Revision: 42097 URL:
http://svn.reactos.org/svn/reactos?rev=42097&view=rev
Log: - Swap szWnd/szVport/ptWndOrg/ptVportOrg to two rectangles: Vport one, and DC one. The DC one is relative to the Vport one. - Set both DC and Vport rectangles from the winent driver. Setting them back to fullscreen is not supported now, but since only their origins (top,left) are used now - it's ok. - Offset all graphic operations by the Vport offset too. Now graphics is displayed at correct places inside windows, including text output too. - Silence font.c debug prints. - Add inlined functions for RECTL management (set, offset, check for emptyness) from the trunk's win32k. Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c branches/arwinss/reactos/include/psdk/ntrosgdi.h branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winen…
============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -191,7 +191,6 @@ INT CDECL RosDrv_ExtEscape( NTDRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID in_data, INT out_count, LPVOID out_data ) { - RECT dc_rect; switch(escape) { case NTDRV_ESCAPE: @@ -203,14 +202,9 @@ if (in_count >= sizeof(struct ntdrv_escape_set_drawable)) { const struct ntdrv_escape_set_drawable *data = in_data; - dc_rect = data->dc_rect; - RosGdiSetDcRect(physDev->hKernelDC, &dc_rect); - //physDev->dc_rect = data->dc_rect; - //physDev->drawable = data->drawable; - //physDev->drawable_rect = data->drawable_rect; - //TRACE( "SET_DRAWABLE hdc %p drawable %lx gl_drawable %lx pf %u dc_rect %s drawable_rect %s\n", - // physDev->hdc, physDev->drawable, physDev->gl_drawable, physDev->current_pf, - // wine_dbgstr_rect(&physDev->dc_rect), wine_dbgstr_rect(&physDev->drawable_rect) ); + RosGdiSetDcRects(physDev->hKernelDC, &data->dc_rect, &data->drawable_rect); + TRACE( "SET_DRAWABLE hdc %p dc_rect %s drawable_rect %s\n", + physDev->hUserDC, wine_dbgstr_rect(&data->dc_rect), wine_dbgstr_rect(&data->drawable_rect) ); return TRUE; } break; Modified: branches/arwinss/reactos/include/psdk/ntrosgdi.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/psdk/nt…
============================================================================== --- branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -116,7 +116,7 @@ int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd); COLORREF APIENTRY RosGdiSetTextColor( HDC physDev, COLORREF color ); -VOID APIENTRY RosGdiSetDcRect( HDC physDev, RECT *rcDcRect ); +VOID APIENTRY RosGdiSetDcRects( HDC physDev, RECT *rcDcRect, RECT *rcVport ); /* enum.c */ int APIENTRY RosGdiChoosePixelFormat(HDC physDev, Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -113,22 +113,33 @@ /* Check if it's a compatible DC */ if (*pdev) { - DPRINT1("Creating a compatible with %x DC\n", *pdev); - slSize.cx = 1; slSize.cy = 1; - hStockBitmap = GreCreateBitmap(slSize, 1, 1, 0, NULL); - pNewDC->pBitmap = GDI_GetObjPtr(hStockBitmap, (SHORT)GDI_OBJECT_TYPE_BITMAP); - } - else if (dc->dwType == OBJ_MEMDC) + DPRINT1("Creating a compatible with %x DC!\n", *pdev); + } + + if (dc->dwType == OBJ_MEMDC) { DPRINT1("Creating a memory DC %x\n", hNewDC); slSize.cx = 1; slSize.cy = 1; hStockBitmap = GreCreateBitmap(slSize, 1, 1, 0, NULL); pNewDC->pBitmap = GDI_GetObjPtr(hStockBitmap, (SHORT)GDI_OBJECT_TYPE_BITMAP); + + /* Set DC rectangles */ + pNewDC->rcDcRect.left = 0; pNewDC->rcDcRect.top = 0; + pNewDC->rcDcRect.right = 1; pNewDC->rcDcRect.bottom = 1; + pNewDC->rcVport = pNewDC->rcDcRect; } else { DPRINT1("Creating a display DC %x\n", hNewDC); pNewDC->pBitmap = GDI_GetObjPtr(PrimarySurface.pSurface, (SHORT)GDI_OBJECT_TYPE_BITMAP); + + /* Set DC rectangles */ + pNewDC->rcVport.left = 0; + pNewDC->rcVport.top = 0; + pNewDC->rcVport.right = PrimarySurface.GDIInfo.ulHorzRes; + pNewDC->rcVport.bottom = PrimarySurface.GDIInfo.ulVertRes; + + pNewDC->rcDcRect = pNewDC->rcVport; } /* Give handle to the caller */ @@ -187,6 +198,13 @@ /* Select it */ pDC->pBitmap = pSurface; + + /* Set DC rectangles */ + pDC->rcVport.left = 0; + pDC->rcVport.top = 0; + pDC->rcVport.right = pSurface->SurfObj.sizlBitmap.cx; + pDC->rcVport.bottom = pSurface->SurfObj.sizlBitmap.cy; + pDC->rcDcRect = pDC->rcVport; /* Release the DC object */ GDI_ReleaseObj(physDev); @@ -379,7 +397,7 @@ return color; } -VOID APIENTRY RosGdiSetDcRect( HDC physDev, RECT *rcDcRect ) +VOID APIENTRY RosGdiSetDcRects( HDC physDev, RECT *rcDcRect, RECT *rcVport ) { PDC pDC; @@ -387,19 +405,23 @@ pDC = GDI_GetObjPtr(physDev, (SHORT)GDI_OBJECT_TYPE_DC); /* Set DC rectangle */ - if (rcDcRect->left && rcDcRect->top && rcDcRect->right && rcDcRect->bottom) + if (rcDcRect) { pDC->rcDcRect = *rcDcRect; - } - else - { + +#if 0 /* Set back to full screen */ pDC->rcDcRect.top = 0; pDC->rcDcRect.left = 0; pDC->rcDcRect.right = pDC->szVportExt.cx; pDC->rcDcRect.top = pDC->szVportExt.cy; - - DPRINT1("right/top %d %d\n", pDC->szVportExt.cx, pDC->szVportExt.cy); +#endif + } + + /* Set viewport rectangle */ + if (rcVport) + { + pDC->rcVport = *rcVport; } /* Release the object */ Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -88,10 +88,10 @@ pt[1].x = x2; pt[1].y = y2; /* Add DC origin */ - pt[0].x += pDC->ptVportOrg.x + pDC->rcDcRect.left; - pt[0].y += pDC->ptVportOrg.y + pDC->rcDcRect.top; - pt[1].x += pDC->ptVportOrg.x + pDC->rcDcRect.left; - pt[1].y += pDC->ptVportOrg.y + pDC->rcDcRect.top; + pt[0].x += pDC->rcVport.left + pDC->rcDcRect.left; + pt[0].y += pDC->rcVport.top + pDC->rcDcRect.top; + pt[1].x += pDC->rcVport.left + pDC->rcDcRect.left; + pt[1].y += pDC->rcVport.top + pDC->rcDcRect.top; GreLineTo(&pDC->pBitmap->SurfObj, pClipObj, Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -172,10 +172,10 @@ // FIXME: LP->DP missing! //IntLPtoDP(pDest, (LPPOINT)&DestRect, 2); - DestRect.left += pDest->ptVportOrg.x + pDest->rcDcRect.left; - DestRect.top += pDest->ptVportOrg.y + pDest->rcDcRect.top; - DestRect.right += pDest->ptVportOrg.x + pDest->rcDcRect.left; - DestRect.bottom += pDest->ptVportOrg.y + pDest->rcDcRect.top; + DestRect.left += pDest->rcVport.left + pDest->rcDcRect.left; + DestRect.top += pDest->rcVport.top + pDest->rcDcRect.top; + DestRect.right += pDest->rcVport.left + pDest->rcDcRect.left; + DestRect.bottom += pDest->rcVport.top + pDest->rcDcRect.top; SourcePoint.x = XSrc; SourcePoint.y = YSrc; @@ -238,11 +238,10 @@ DestRect.bottom = YLeft + 1; } - //IntLPtoDP(pDC, (LPPOINT)&DestRect, 2); - DestRect.left += pDC->ptVportOrg.x + pDC->rcDcRect.left; - DestRect.top += pDC->ptVportOrg.y + pDC->rcDcRect.top; - DestRect.right += pDC->ptVportOrg.x + pDC->rcDcRect.left; - DestRect.bottom += pDC->ptVportOrg.y + pDC->rcDcRect.top; + DestRect.left += pDC->rcVport.left + pDC->rcDcRect.left; + DestRect.top += pDC->rcVport.top + pDC->rcDcRect.top; + DestRect.right += pDC->rcVport.left + pDC->rcDcRect.left; + DestRect.bottom += pDC->rcVport.top + pDC->rcDcRect.top; //BrushOrigin.x = BrushObj->ptOrigin.x + pDC->ptVportOrg.x; //BrushOrigin.y = BrushObj->ptOrigin.y + pDC->ptVportOrg.y; @@ -300,12 +299,12 @@ DestRect.top = YOriginDest; DestRect.right = XOriginDest+WidthDest; DestRect.bottom = YOriginDest+HeightDest; - IntLPtoDP(DCDest, (LPPOINT)&DestRect, 2); - - DestRect.left += DCDest->ptVportOrg.x + DCDest->rcDcRect.left; - DestRect.top += DCDest->ptVportOrg.y + DCDest->rcDcRect.top; - DestRect.right += DCDest->ptVportOrg.x + DCDest->rcDcRect.left; - DestRect.bottom += DCDest->ptVportOrg.y + DCDest->rcDcRect.top; + IntLPtoDP(DCDest, (LPPOINT)&DestRect, 2); // FIXME: Why? + + DestRect.left += DCDest->rcVport.left + DCDest->rcDcRect.left; + DestRect.top += DCDest->rcVport.top + DCDest->rcDcRect.top; + DestRect.right += DCDest->rcVport.left + DCDest->rcDcRect.left; + DestRect.bottom += DCDest->rcVport.top + DCDest->rcDcRect.top; SourceRect.left = XOriginSrc; SourceRect.top = YOriginSrc; @@ -316,10 +315,10 @@ { IntLPtoDP(DCSrc, (LPPOINT)&SourceRect, 2); - SourceRect.left += DCSrc->ptVportOrg.x + DCSrc->rcDcRect.left; - SourceRect.top += DCSrc->ptVportOrg.y + DCSrc->rcDcRect.top; - SourceRect.right += DCSrc->ptVportOrg.x + DCSrc->rcDcRect.left; - SourceRect.bottom += DCSrc->ptVportOrg.y + DCSrc->rcDcRect.top; + SourceRect.left += DCSrc->rcVport.left + DCSrc->rcDcRect.left; + SourceRect.top += DCSrc->rcVport.top + DCSrc->rcDcRect.top; + SourceRect.right += DCSrc->rcVport.left + DCSrc->rcDcRect.left; + SourceRect.bottom += DCSrc->rcVport.top + DCSrc->rcDcRect.top; } BrushOrigin.x = 0; @@ -348,8 +347,8 @@ } /* Offset the brush */ - BrushOrigin.x += DCDest->ptVportOrg.x + DCDest->rcDcRect.left; - BrushOrigin.y += DCDest->ptVportOrg.y + DCDest->rcDcRect.top; + BrushOrigin.x += DCDest->rcVport.left + DCDest->rcDcRect.left; + BrushOrigin.y += DCDest->rcVport.top + DCDest->rcDcRect.top; /* Make mask surface for source surface */ if (BitmapSrc && DCMask) Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -9,7 +9,7 @@ /* INCLUDES ******************************************************************/ #include <win32k.h> -//#define NDEBUG +#define NDEBUG #include <debug.h> /* PRIVATE FUNCTIONS *********************************************************/ @@ -59,10 +59,14 @@ } while (bits & bitsMask); rcBounds.left = xspan; rcBounds.top = y; rcBounds.right = xspan+lenspan; rcBounds.bottom = y+1; + RECTL_vOffsetRect(&rcBounds, physDev->rcVport.left, physDev->rcVport.top); GreLineTo(&physDev->pBitmap->SurfObj, NULL, &physDev->pLineBrush->BrushObj, - xspan, y, xspan+lenspan, y, + xspan + physDev->rcVport.left, + y + physDev->rcVport.top, + xspan + lenspan + physDev->rcVport.left, + y + physDev->rcVport.top, &rcBounds, 0); xspan += lenspan; Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -152,17 +152,6 @@ } } - -VOID -NTAPI -RECTL_vSetEmptyRect(RECTL *prcl) -{ - prcl->left = 0; - prcl->top = 0; - prcl->right = 0; - prcl->bottom = 0; -} - BOOLEAN NTAPI RECTL_bIntersectRect(RECTL* prclDst, const RECTL* prcl1, const RECTL* prcl2) Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -17,11 +17,8 @@ COLORREF crBackgroundClr; /* Origins and extents */ - SIZE szVportExt; - POINT ptVportOrg; - SIZE szWndExt; - POINT ptWndOrg; - RECT rcDcRect; + RECT rcDcRect; /* Relative to Vport */ + RECT rcVport; /* Combined clipping region */ CLIPOBJ *CombinedClip; Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -98,11 +98,53 @@ const POINT *ptPoints, INT count); -VOID NTAPI -RECTL_vSetEmptyRect(RECTL *prcl); - BOOLEAN NTAPI RECTL_bIntersectRect(RECTL* prclDst, const RECTL* prcl1, const RECTL* prcl2); + +VOID +FORCEINLINE +RECTL_vSetRect(RECTL *prcl, LONG left, LONG top, LONG right, LONG bottom) +{ + prcl->left = left; + prcl->top = top; + prcl->right = right; + prcl->bottom = bottom; +} + +VOID +FORCEINLINE +RECTL_vSetEmptyRect(RECTL *prcl) +{ + prcl->left = 0; + prcl->top = 0; + prcl->right = 0; + prcl->bottom = 0; +} + +VOID +FORCEINLINE +RECTL_vOffsetRect(RECTL *prcl, INT cx, INT cy) +{ + prcl->left += cx; + prcl->right += cx; + prcl->top += cy; + prcl->bottom += cy; +} + +BOOL +FORCEINLINE +RECTL_bIsEmptyRect(const RECTL *prcl) +{ + return (prcl->left >= prcl->right || prcl->top >= prcl->bottom); +} + +BOOL +FORCEINLINE +RECTL_bPointInRect(const RECTL *prcl, INT x, INT y) +{ + return (x >= prcl->left && x <= prcl->right && + y >= prcl->top && y <= prcl->bottom); +} /* Private Eng functions */ BOOL APIENTRY Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Mon Jul 20 15:33:16 2009 @@ -30,7 +30,7 @@ RosGdiSetPixel 4 RosGdiSetPixelFormat 3 RosGdiSetTextColor 2 -RosGdiSetDcRect 2 +RosGdiSetDcRects 3 RosGdiChoosePixelFormat 2 RosGdiDescribePixelFormat 4 RosGdiEnumDeviceFonts 4
15 years, 5 months
1
0
0
0
[fireball] 42096: - Add CsrNotifyShowDesktop CSR notification, not used now and its future is unclear.
by fireball@svn.reactos.org
Author: fireball Date: Mon Jul 20 14:04:51 2009 New Revision: 42096 URL:
http://svn.reactos.org/svn/reactos?rev=42096&view=rev
Log: - Add CsrNotifyShowDesktop CSR notification, not used now and its future is unclear. Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/csr.h branches/arwinss/reactos/subsystems/win32/win32k/main/csr.c Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/csr.h URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/csr.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/csr.h [iso-8859-1] Mon Jul 20 14:04:51 2009 @@ -5,4 +5,8 @@ NTSTATUS NTAPI CsrNotifyCreateDesktop(HDESK Desktop); +/* Notifies CSR about a show desktop event */ +NTSTATUS NTAPI +CsrNotifyShowDesktop(HWND DesktopWindow, ULONG Width, ULONG Height); + #endif Modified: branches/arwinss/reactos/subsystems/win32/win32k/main/csr.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/main/csr.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/main/csr.c [iso-8859-1] Mon Jul 20 14:04:51 2009 @@ -206,4 +206,18 @@ return STATUS_SUCCESS; } +NTSTATUS +NTAPI +CsrNotifyShowDesktop(HWND DesktopWindow, ULONG Width, ULONG Height) +{ + CSR_API_MESSAGE Request; + + Request.Type = MAKE_CSR_API(SHOW_DESKTOP, CSR_GUI); + Request.Data.ShowDesktopRequest.DesktopWindow = DesktopWindow; + Request.Data.ShowDesktopRequest.Width = Width; + Request.Data.ShowDesktopRequest.Height = Height; + + return co_CsrNotify(&Request); +} + /* EOF */
15 years, 5 months
1
0
0
0
[khornicek] 42095: - plug in code previously #ifed out - fix some warnings - some quick 'n dirty fixes, WIP - fonts should load now
by khornicek@svn.reactos.org
Author: khornicek Date: Mon Jul 20 03:24:47 2009 New Revision: 42095 URL:
http://svn.reactos.org/svn/reactos?rev=42095&view=rev
Log: - plug in code previously #ifed out - fix some warnings - some quick 'n dirty fixes, WIP - fonts should load now Modified: branches/arwinss/reactos/dll/win32/gdi32/freetype.c Modified: branches/arwinss/reactos/dll/win32/gdi32/freetype.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/freetype.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/freetype.c [iso-8859-1] Mon Jul 20 03:24:47 2009 @@ -1006,7 +1006,6 @@ static void LoadSubstList(void) { -#if 0 FontSubst *psub; HKEY hkey; DWORD valuelen, datalen, i = 0, type, dlen, vlen; @@ -1052,9 +1051,6 @@ HeapFree(GetProcessHeap(), 0, value); RegCloseKey(hkey); } -#else - UNIMPLEMENTED; -#endif } @@ -1587,7 +1583,6 @@ */ static void LoadReplaceList(void) { -#if 0 HKEY hkey; DWORD valuelen, datalen, i = 0, type, dlen, vlen; LPWSTR value; @@ -1638,9 +1633,6 @@ HeapFree(GetProcessHeap(), 0, value); RegCloseKey(hkey); } -#else - UNIMPLEMENTED; -#endif } /************************************************************* @@ -1648,7 +1640,7 @@ */ static BOOL init_system_links(void) { - HKEY hkey; + HANDLE hkey; BOOL ret = FALSE; DWORD type, max_val, max_data, val_len, data_len, index; WCHAR *value, *data; @@ -1681,7 +1673,7 @@ { ERR("NtQueryKey failed with Status 0x%08X\n", Status); NtClose(hkey); - return; + return FALSE; } max_val = FullInfo->MaxValueNameLen / sizeof(WCHAR) + 1; @@ -1791,7 +1783,7 @@ HeapFree(GetProcessHeap(), 0, value); HeapFree(GetProcessHeap(), 0, data); - NtClose(hkey); + RegCloseKey(hkey); } /* Explicitly add an entry for the system font, this links to Tahoma and any links @@ -1833,12 +1825,12 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts) { HANDLE file; - WIN32_FIND_DATA find_data; + WIN32_FIND_DATAA find_data; CHAR search_path[MAX_PATH]; TRACE("Loading fonts from %s\n", debugstr_a(dirname)); - snprintf(search_path, MAX_PATH, "%s\\*", dirname); + _snprintf(search_path, MAX_PATH, "%s\\*", dirname); file = FindFirstFileA(search_path, &find_data); @@ -1856,7 +1848,7 @@ continue; TRACE("Found %s in %s\n", find_data.cFileName, debugstr_a(dirname)); - snprintf(path, MAX_PATH, "%s\\%s", dirname, find_data.cFileName); + _snprintf(path, MAX_PATH, "%s\\%s", dirname, find_data.cFileName); if(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { @@ -1994,7 +1986,6 @@ static void load_system_fonts(void) { -#if 0 HKEY hkey; WCHAR data[MAX_PATH], windowsdir[MAX_PATH], pathW[MAX_PATH]; char pathA[MAX_PATH]; @@ -2020,7 +2011,6 @@ } RegCloseKey(hkey); } -#endif } /************************************************************* @@ -2032,7 +2022,6 @@ */ static void update_reg_entries(void) { -#if 0 HKEY winnt_key = 0, win9x_key = 0, external_key = 0; LPWSTR valueW; DWORD len, len_fam; @@ -2108,14 +2097,10 @@ if(win9x_key) RegCloseKey(win9x_key); if(winnt_key) RegCloseKey(winnt_key); return; -#else - UNIMPLEMENTED; -#endif } static void delete_external_font_keys(void) { -#if 0 HKEY winnt_key = 0, win9x_key = 0, external_key = 0; DWORD dlen, vlen, datalen, valuelen, i, type; LPWSTR valueW; @@ -2168,9 +2153,6 @@ end: if(win9x_key) RegCloseKey(win9x_key); if(winnt_key) RegCloseKey(winnt_key); -#else - UNIMPLEMENTED; -#endif } /************************************************************* @@ -2185,22 +2167,16 @@ if (ft_handle) /* do it only if we have freetype up and running */ { - char *unixname; + CHAR filename[MAX_PATH]; if(flags) FIXME("Ignoring flags %x\n", flags); -#if 0 - if((unixname = wine_get_unix_file_name(file))) - { - EnterCriticalSection( &freetype_cs ); - ret = AddFontFileToList(unixname, NULL, NULL, ADDFONT_FORCE_BITMAP); - LeaveCriticalSection( &freetype_cs ); - HeapFree(GetProcessHeap(), 0, unixname); - } -#else - UNIMPLEMENTED; -#endif + _snprintf(filename, MAX_PATH, "%S", file); + EnterCriticalSection( &freetype_cs ); + ret = AddFontFileToList(filename, NULL, NULL, ADDFONT_FORCE_BITMAP); + LeaveCriticalSection( &freetype_cs ); + if (!ret && !strchrW(file, '\\')) { /* Try in %WINDIR%/fonts, needed for Fotobuch Designer */ ret = load_font_from_winfonts_dir(file); @@ -2460,8 +2436,8 @@ { HKEY hkey = 0; - //RegCreateKeyExW(HKEY_LOCAL_MACHINE, winnt_font_reg_key, 0, NULL, - // 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); + RegCreateKeyExW(HKEY_LOCAL_MACHINE, winnt_font_reg_key, 0, NULL, + 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); return hkey; } @@ -2478,30 +2454,29 @@ { HKEY hkey = 0; - //RegCreateKeyExW(HKEY_CURRENT_CONFIG, system_fonts_reg_key, 0, NULL, - // 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); + RegCreateKeyExW(HKEY_CURRENT_CONFIG, system_fonts_reg_key, 0, NULL, + 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); return hkey; } static void add_font_list(HKEY hkey, const struct nls_update_font_list *fl) { - //RegSetValueExA(hkey, "Courier", 0, REG_SZ, (const BYTE *)fl->courier, strlen(fl->courier)+1); - //RegSetValueExA(hkey, "MS Serif", 0, REG_SZ, (const BYTE *)fl->serif, strlen(fl->serif)+1); - //RegSetValueExA(hkey, "MS Sans Serif", 0, REG_SZ, (const BYTE *)fl->sserif, strlen(fl->sserif)+1); - //RegSetValueExA(hkey, "Small Fonts", 0, REG_SZ, (const BYTE *)fl->small, strlen(fl->small)+1); + RegSetValueExA(hkey, "Courier", 0, REG_SZ, (const BYTE *)fl->courier, strlen(fl->courier)+1); + RegSetValueExA(hkey, "MS Serif", 0, REG_SZ, (const BYTE *)fl->serif, strlen(fl->serif)+1); + RegSetValueExA(hkey, "MS Sans Serif", 0, REG_SZ, (const BYTE *)fl->sserif, strlen(fl->sserif)+1); + RegSetValueExA(hkey, "Small Fonts", 0, REG_SZ, (const BYTE *)fl->small, strlen(fl->small)+1); } static void set_value_key(HKEY hkey, const char *name, const char *value) { - //if (value) - // RegSetValueExA(hkey, name, 0, REG_SZ, (const BYTE *)value, strlen(value) + 1); - //else if (name) - // RegDeleteValueA(hkey, name); + if (value) + RegSetValueExA(hkey, name, 0, REG_SZ, (const BYTE *)value, strlen(value) + 1); + else if (name) + RegDeleteValueA(hkey, name); } static void update_font_info(void) { -#if 0 char buf[40], cpbuf[40]; DWORD len, type; HKEY hkey = 0; @@ -2598,14 +2573,10 @@ /* Clear out system links */ RegDeleteKeyW(HKEY_LOCAL_MACHINE, system_link); -#else - UNIMPLEMENTED; -#endif } static void populate_system_links(HKEY hkey, const WCHAR *name, const WCHAR *const *values) { -#if 0 const WCHAR *value; int i; FontSubst *psub; @@ -2677,12 +2648,10 @@ TRACE("no SystemLink fonts found for %s\n", debugstr_w(name)); } else TRACE("removed SystemLink for %s\n", debugstr_w(name)); -#endif } static void update_system_links(void) { -#if 0 HKEY hkey = 0; UINT i, j; BOOL done = FALSE; @@ -2728,7 +2697,6 @@ WARN("there is no SystemLink default list for MS Shell Dlg %s\n", debugstr_w(psub->to.name)); } else WARN("failed to create SystemLink key\n"); -#endif } @@ -2835,10 +2803,9 @@ static const WCHAR pathW[] = {'P','a','t','h',0}; HKEY hkey; DWORD valuelen, datalen, i = 0, type, dlen, vlen; - WCHAR windowsdir[MAX_PATH]; - char *unixname; + WCHAR windowsdirW[MAX_PATH]; + CHAR windowsdir[MAX_PATH]; HANDLE font_mutex; - const char *data_dir; TRACE("\n"); @@ -2859,8 +2826,9 @@ load_system_fonts(); /* load in the fonts from %WINDOWSDIR%\\Fonts first of all */ - GetWindowsDirectoryW(windowsdir, sizeof(windowsdir) / sizeof(WCHAR)); - strcatW(windowsdir, fontsW); + GetWindowsDirectoryW(windowsdirW, sizeof(windowsdirW) / sizeof(WCHAR)); + strcatW(windowsdirW, fontsW); + _snprintf(windowsdir, MAX_PATH, "%S", windowsdirW); ReadFontDir(windowsdir, FALSE); /* load the system truetype fonts */ @@ -2879,7 +2847,6 @@ for any fonts not installed in %WINDOWSDIR%\Fonts. They will have their full path as the entry. Also look for any .fon fonts, since ReadFontDir will skip these. */ -#if 0 if(RegOpenKeyW(HKEY_LOCAL_MACHINE, is_win9x() ? win9x_font_reg_key : winnt_font_reg_key, &hkey) == ERROR_SUCCESS) { @@ -2898,16 +2865,19 @@ &dlen) == ERROR_SUCCESS) { if(data[0] && (data[1] == ':')) { - AddFontFileToList(data, NULL, NULL, ADDFONT_FORCE_BITMAP); + LPSTR dataA = HeapAlloc(GetProcessHeap(), 0, datalen); + _snprintf(dataA, datalen, "%S", data); + AddFontFileToList(dataA, NULL, NULL, ADDFONT_FORCE_BITMAP); + HeapFree(GetProcessHeap(), 0, dataA); } else if(dlen / 2 >= 6 && !strcmpiW(data + dlen / 2 - 5, dot_fonW)) { - WCHAR pathW[MAX_PATH]; - static const WCHAR fmtW[] = {'%','s','\\','%','s','\0'}; + CHAR path[MAX_PATH]; + static const CHAR fmt[] = {'%','s','\\','%','S','\0'}; BOOL added = FALSE; - sprintfW(pathW, fmtW, windowsdir, data); - added = AddFontFileToList(pathW, NULL, NULL, ADDFONT_FORCE_BITMAP); + _snprintf(path, MAX_PATH, fmt, windowsdir, data); + added = AddFontFileToList(path, NULL, NULL, ADDFONT_FORCE_BITMAP); if (!added) load_font_from_data_dir(data); } @@ -2920,12 +2890,11 @@ HeapFree(GetProcessHeap(), 0, valueW); RegCloseKey(hkey); } -#endif + load_fontconfig_fonts(); /* then look in any directories that we've specified in the config file */ /* @@ Wine registry key: HKCU\Software\Wine\Fonts */ -#if 0 if(RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Fonts", &hkey) == ERROR_SUCCESS) { DWORD len; @@ -2956,7 +2925,6 @@ } RegCloseKey(hkey); } -#endif DumpFontList(); LoadSubstList();
15 years, 5 months
1
0
0
0
[khornicek] 42094: - add regglue.c for now, it contains APIs needed by freetype
by khornicek@svn.reactos.org
Author: khornicek Date: Mon Jul 20 03:08:50 2009 New Revision: 42094 URL:
http://svn.reactos.org/svn/reactos?rev=42094&view=rev
Log: - add regglue.c for now, it contains APIs needed by freetype Added: branches/arwinss/reactos/dll/win32/gdi32/regglue.c (with props) Modified: branches/arwinss/reactos/dll/win32/gdi32/gdi32.rbuild Modified: branches/arwinss/reactos/dll/win32/gdi32/gdi32.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/gdi32.rbuild [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/gdi32.rbuild [iso-8859-1] Mon Jul 20 03:08:50 2009 @@ -41,6 +41,7 @@ <file>pen.c</file> <file>printdrv.c</file> <file>region.c</file> + <file>regglue.c</file> <file>gdi32.rc</file> </module> Added: branches/arwinss/reactos/dll/win32/gdi32/regglue.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/regglue.c (added) +++ branches/arwinss/reactos/dll/win32/gdi32/regglue.c [iso-8859-1] Mon Jul 20 03:08:50 2009 @@ -1,0 +1,1606 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/advapi32/reg/reg.c + * PURPOSE: Registry functions + * PROGRAMMER: Ariadne ( ariadne(a)xs4all.nl) + * Thomas Weidenmueller <w3seek(a)reactos.com> + * UPDATE HISTORY: + * Created 01/11/98 + * 19990309 EA Stubs + * 20050502 Fireball imported some stuff from WINE + */ + +/* INCLUDES *****************************************************************/ + +#include <stdio.h> +#define WIN32_NO_STATUS +#define _WMI_SOURCE_ +#include <windows.h> +#include <string.h> +#define NTOS_MODE_USER +#include <ndk/ntndk.h> +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdi); + +#define ClosePredefKey(Handle) \ + if ((ULONG_PTR)Handle & 0x1) { \ + NtClose(Handle); \ + } +#define IsPredefKey(HKey) \ + (((ULONG)(HKey) & 0xF0000000) == 0x80000000) +#define GetPredefKeyIndex(HKey) \ + ((ULONG)(HKey) & 0x0FFFFFFF) + +#define MAX_DEFAULT_HANDLES 6 +#define REG_MAX_NAME_SIZE 256 +#define REG_MAX_DATA_SIZE 2048 + +static NTSTATUS MapDefaultKey(OUT PHANDLE, IN HKEY); +static NTSTATUS OpenClassesRootKey(PHANDLE KeyHandle); +static NTSTATUS OpenLocalMachineKey (PHANDLE KeyHandle); +static NTSTATUS OpenUsersKey (PHANDLE KeyHandle); +static NTSTATUS OpenCurrentConfigKey(PHANDLE KeyHandle); + +LONG WINAPI RegOpenKeyA(HKEY, LPCSTR, PHKEY); +LONG WINAPI RegOpenKeyW(HKEY, LPCWSTR, PHKEY); +LONG WINAPI RegOpenKeyExA(HKEY, LPCSTR, DWORD, REGSAM, PHKEY); +LONG WINAPI RegOpenKeyExW(HKEY, LPCWSTR, DWORD, REGSAM, PHKEY); + +static HANDLE DefaultHandleTable[MAX_DEFAULT_HANDLES]; +static BOOLEAN DefaultHandlesDisabled = FALSE; +static BOOLEAN DefaultHandleHKUDisabled = FALSE; + + +__inline static int is_string( DWORD type ) +{ + return (type == REG_SZ) || (type == REG_EXPAND_SZ) || (type == REG_MULTI_SZ); +} + +static NTSTATUS +OpenPredefinedKey(IN ULONG Index, + OUT HANDLE Handle) +{ + NTSTATUS Status; + + switch (Index) + { + case 0: /* HKEY_CLASSES_ROOT */ + Status = OpenClassesRootKey (Handle); + break; + + case 1: /* HKEY_CURRENT_USER */ + Status = RtlOpenCurrentUser (MAXIMUM_ALLOWED, + Handle); + break; + + case 2: /* HKEY_LOCAL_MACHINE */ + Status = OpenLocalMachineKey (Handle); + break; + + case 3: /* HKEY_USERS */ + Status = OpenUsersKey (Handle); + break; + + case 5: /* HKEY_CURRENT_CONFIG */ + Status = OpenCurrentConfigKey (Handle); + break; + + case 6: /* HKEY_DYN_DATA */ + Status = STATUS_NOT_IMPLEMENTED; + break; + + default: + WARN("MapDefaultHandle() no handle creator\n"); + Status = STATUS_INVALID_PARAMETER; + break; + } + + return Status; +} + +static NTSTATUS +MapDefaultKey(PHANDLE RealKey, + HKEY Key) +{ + PHANDLE Handle; + ULONG Index; + BOOLEAN DoOpen, DefDisabled; + NTSTATUS Status = STATUS_SUCCESS; + + TRACE("MapDefaultKey (Key %x)\n", Key); + + if (!IsPredefKey(Key)) + { + *RealKey = (HANDLE)((ULONG_PTR)Key & ~0x1); + return STATUS_SUCCESS; + } + + /* Handle special cases here */ + Index = GetPredefKeyIndex(Key); + if (Index >= MAX_DEFAULT_HANDLES) + { + return STATUS_INVALID_PARAMETER; + } + + if (Key == HKEY_CURRENT_USER) + DefDisabled = DefaultHandleHKUDisabled; + else + DefDisabled = DefaultHandlesDisabled; + + if (!DefDisabled) + { + Handle = &DefaultHandleTable[Index]; + DoOpen = (*Handle == NULL); + } + else + { + Handle = RealKey; + DoOpen = TRUE; + } + + if (DoOpen) + { + /* create/open the default handle */ + Status = OpenPredefinedKey(Index, + Handle); + } + + if (NT_SUCCESS(Status)) + { + if (!DefDisabled) + *RealKey = *Handle; + else + *(PULONG_PTR)Handle |= 0x1; + } + + return Status; +} + +static NTSTATUS +OpenClassesRootKey(PHANDLE KeyHandle) +{ + OBJECT_ATTRIBUTES Attributes; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\Software\\CLASSES"); + + TRACE("OpenClassesRootKey()\n"); + + InitializeObjectAttributes(&Attributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + return NtOpenKey(KeyHandle, + MAXIMUM_ALLOWED, + &Attributes); +} + + +static NTSTATUS +OpenLocalMachineKey(PHANDLE KeyHandle) +{ + OBJECT_ATTRIBUTES Attributes; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine"); + NTSTATUS Status; + + TRACE("OpenLocalMachineKey()\n"); + + InitializeObjectAttributes(&Attributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + Status = NtOpenKey(KeyHandle, + MAXIMUM_ALLOWED, + &Attributes); + + TRACE("NtOpenKey(%wZ) => %08x\n", &KeyName, Status); + + return Status; +} + + +static NTSTATUS +OpenUsersKey(PHANDLE KeyHandle) +{ + OBJECT_ATTRIBUTES Attributes; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\User"); + + TRACE("OpenUsersKey()\n"); + + InitializeObjectAttributes(&Attributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + return NtOpenKey(KeyHandle, + MAXIMUM_ALLOWED, + &Attributes); +} + + +static NTSTATUS +OpenCurrentConfigKey (PHANDLE KeyHandle) +{ + OBJECT_ATTRIBUTES Attributes; + UNICODE_STRING KeyName = + RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Hardware Profiles\\Current"); + + TRACE("OpenCurrentConfigKey()\n"); + + InitializeObjectAttributes(&Attributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + return NtOpenKey(KeyHandle, + MAXIMUM_ALLOWED, + &Attributes); +} + +LONG WINAPI +RegCloseKey(HKEY hKey) +{ + NTSTATUS Status; + + /* don't close null handle or a pseudo handle */ + if ((!hKey) || (((ULONG_PTR)hKey & 0xF0000000) == 0x80000000)) + { + return ERROR_INVALID_HANDLE; + } + + Status = NtClose(hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} + +static NTSTATUS +CreateNestedKey(PHKEY KeyHandle, + POBJECT_ATTRIBUTES ObjectAttributes, + PUNICODE_STRING ClassString, + DWORD dwOptions, + REGSAM samDesired, + DWORD *lpdwDisposition) +{ + OBJECT_ATTRIBUTES LocalObjectAttributes; + UNICODE_STRING LocalKeyName; + ULONG Disposition; + NTSTATUS Status; + ULONG FullNameLength; + ULONG Length; + PWCHAR Ptr; + HANDLE LocalKeyHandle; + + Status = NtCreateKey((PHANDLE) KeyHandle, + samDesired, + ObjectAttributes, + 0, + ClassString, + dwOptions, + (PULONG)lpdwDisposition); + TRACE("NtCreateKey(%wZ) called (Status %lx)\n", ObjectAttributes->ObjectName, Status); + if (Status != STATUS_OBJECT_NAME_NOT_FOUND) + return Status; + + /* Copy object attributes */ + RtlCopyMemory(&LocalObjectAttributes, + ObjectAttributes, + sizeof(OBJECT_ATTRIBUTES)); + RtlCreateUnicodeString(&LocalKeyName, + ObjectAttributes->ObjectName->Buffer); + LocalObjectAttributes.ObjectName = &LocalKeyName; + FullNameLength = LocalKeyName.Length / sizeof(WCHAR); + + LocalKeyHandle = NULL; + + /* Remove the last part of the key name and try to create the key again. */ + while (Status == STATUS_OBJECT_NAME_NOT_FOUND) + { + Ptr = wcsrchr(LocalKeyName.Buffer, '\\'); + if (Ptr == NULL || Ptr == LocalKeyName.Buffer) + { + Status = STATUS_UNSUCCESSFUL; + break; + } + + *Ptr = (WCHAR)0; + LocalKeyName.Length = wcslen(LocalKeyName.Buffer) * sizeof(WCHAR); + + Status = NtCreateKey(&LocalKeyHandle, + KEY_CREATE_SUB_KEY, + &LocalObjectAttributes, + 0, + NULL, + 0, + &Disposition); + TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status); + } + + if (!NT_SUCCESS(Status)) + { + RtlFreeUnicodeString(&LocalKeyName); + return Status; + } + + /* Add removed parts of the key name and create them too. */ + Length = wcslen(LocalKeyName.Buffer); + while (TRUE) + { + if (LocalKeyHandle) + NtClose (LocalKeyHandle); + + LocalKeyName.Buffer[Length] = L'\\'; + Length = wcslen (LocalKeyName.Buffer); + LocalKeyName.Length = Length * sizeof(WCHAR); + + if (Length == FullNameLength) + { + Status = NtCreateKey((PHANDLE) KeyHandle, + samDesired, + ObjectAttributes, + 0, + ClassString, + dwOptions, + (PULONG)lpdwDisposition); + break; + } + + Status = NtCreateKey(&LocalKeyHandle, + KEY_CREATE_SUB_KEY, + &LocalObjectAttributes, + 0, + NULL, + 0, + &Disposition); + TRACE("NtCreateKey(%wZ) called (Status %lx)\n", &LocalKeyName, Status); + if (!NT_SUCCESS(Status)) + break; + } + + RtlFreeUnicodeString(&LocalKeyName); + + return Status; +} + +LONG WINAPI +RegCreateKeyExA(HKEY hKey, + LPCSTR lpSubKey, + DWORD Reserved, + LPSTR lpClass, + DWORD dwOptions, + REGSAM samDesired, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + PHKEY phkResult, + LPDWORD lpdwDisposition) +{ + UNICODE_STRING SubKeyString; + UNICODE_STRING ClassString; + OBJECT_ATTRIBUTES Attributes; + HANDLE ParentKey; + NTSTATUS Status; + + TRACE("RegCreateKeyExA() called\n"); + + if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES)) + return ERROR_INVALID_USER_BUFFER; + + /* get the real parent key */ + Status = MapDefaultKey(&ParentKey, + hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + TRACE("ParentKey %p\n", ParentKey); + + if (lpClass != NULL) + { + RtlCreateUnicodeStringFromAsciiz(&ClassString, + lpClass); + } + + RtlCreateUnicodeStringFromAsciiz(&SubKeyString, + (LPSTR)lpSubKey); + InitializeObjectAttributes(&Attributes, + &SubKeyString, + OBJ_CASE_INSENSITIVE, + (HANDLE)ParentKey, + lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL); + Status = CreateNestedKey(phkResult, + &Attributes, + (lpClass == NULL)? NULL : &ClassString, + dwOptions, + samDesired, + lpdwDisposition); + RtlFreeUnicodeString(&SubKeyString); + if (lpClass != NULL) + { + RtlFreeUnicodeString(&ClassString); + } + + ClosePredefKey(ParentKey); + + TRACE("Status %x\n", Status); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} + +LONG WINAPI +RegCreateKeyA(HKEY hKey, + LPCSTR lpSubKey, + PHKEY phkResult) +{ + return RegCreateKeyExA(hKey, + lpSubKey, + 0, + NULL, + 0, + MAXIMUM_ALLOWED, + NULL, + phkResult, + NULL); +} + +LONG WINAPI +RegCreateKeyExW(HKEY hKey, + LPCWSTR lpSubKey, + DWORD Reserved, + LPWSTR lpClass, + DWORD dwOptions, + REGSAM samDesired, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + PHKEY phkResult, + LPDWORD lpdwDisposition) +{ + UNICODE_STRING SubKeyString; + UNICODE_STRING ClassString; + OBJECT_ATTRIBUTES Attributes; + HANDLE ParentKey; + NTSTATUS Status; + + TRACE("RegCreateKeyExW() called\n"); + + if (lpSecurityAttributes && lpSecurityAttributes->nLength != sizeof(SECURITY_ATTRIBUTES)) + return ERROR_INVALID_USER_BUFFER; + + /* get the real parent key */ + Status = MapDefaultKey(&ParentKey, + hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + TRACE("ParentKey %p\n", ParentKey); + + RtlInitUnicodeString(&ClassString, + lpClass); + RtlInitUnicodeString(&SubKeyString, + lpSubKey); + InitializeObjectAttributes(&Attributes, + &SubKeyString, + OBJ_CASE_INSENSITIVE, + (HANDLE)ParentKey, + lpSecurityAttributes ? (PSECURITY_DESCRIPTOR)lpSecurityAttributes->lpSecurityDescriptor : NULL); + Status = CreateNestedKey(phkResult, + &Attributes, + (lpClass == NULL)? NULL : &ClassString, + dwOptions, + samDesired, + lpdwDisposition); + + ClosePredefKey(ParentKey); + + TRACE("Status %x\n", Status); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} + +LONG WINAPI +RegCreateKeyW(HKEY hKey, + LPCWSTR lpSubKey, + PHKEY phkResult) +{ + return RegCreateKeyExW(hKey, + lpSubKey, + 0, + NULL, + 0, + MAXIMUM_ALLOWED, + NULL, + phkResult, + NULL); +} + +LONG WINAPI +RegDeleteKeyW(HKEY hKey, + LPCWSTR lpSubKey) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING SubKeyName; + HANDLE ParentKey; + HANDLE TargetKey; + NTSTATUS Status; + + /* Make sure we got a subkey */ + if (!lpSubKey) + { + /* Fail */ + return ERROR_INVALID_PARAMETER; + } + + Status = MapDefaultKey(&ParentKey, + hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + RtlInitUnicodeString(&SubKeyName, + (LPWSTR)lpSubKey); + InitializeObjectAttributes(&ObjectAttributes, + &SubKeyName, + OBJ_CASE_INSENSITIVE, + ParentKey, + NULL); + Status = NtOpenKey(&TargetKey, + DELETE, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + goto Cleanup; + } + + Status = NtDeleteKey(TargetKey); + NtClose(TargetKey); + +Cleanup: + ClosePredefKey(ParentKey); + + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} + +LONG WINAPI +RegDeleteValueA(HKEY hKey, + LPCSTR lpValueName) +{ + UNICODE_STRING ValueName; + HANDLE KeyHandle; + NTSTATUS Status; + + Status = MapDefaultKey(&KeyHandle, + hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + RtlCreateUnicodeStringFromAsciiz(&ValueName, + (LPSTR)lpValueName); + Status = NtDeleteValueKey(KeyHandle, + &ValueName); + RtlFreeUnicodeString (&ValueName); + + ClosePredefKey(KeyHandle); + + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} + +LONG WINAPI +RegDeleteValueW(HKEY hKey, + LPCWSTR lpValueName) +{ + UNICODE_STRING ValueName; + NTSTATUS Status; + HANDLE KeyHandle; + + Status = MapDefaultKey(&KeyHandle, + hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + RtlInitUnicodeString(&ValueName, + (LPWSTR)lpValueName); + + Status = NtDeleteValueKey(KeyHandle, + &ValueName); + + ClosePredefKey(KeyHandle); + + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} + +LONG WINAPI +RegEnumValueA(HKEY hKey, + DWORD index, + LPSTR value, + LPDWORD val_count, + LPDWORD reserved, + LPDWORD type, + LPBYTE data, + LPDWORD count) +{ + HANDLE KeyHandle; + NTSTATUS status; + ULONG total_size; + char buffer[256], *buf_ptr = buffer; + KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer; + static const int info_size = FIELD_OFFSET( KEY_VALUE_FULL_INFORMATION, Name ); + + //TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n", + // hkey, index, value, val_count, reserved, type, data, count ); + + /* NT only checks count, not val_count */ + if ((data && !count) || reserved) + return ERROR_INVALID_PARAMETER; + + status = MapDefaultKey(&KeyHandle, hKey); + if (!NT_SUCCESS(status)) + { + return RtlNtStatusToDosError(status); + } + + total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR); + if (data) total_size += *count; + total_size = min( sizeof(buffer), total_size ); + + status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation, + buffer, total_size, &total_size ); + if (status && status != STATUS_BUFFER_OVERFLOW) goto done; + + /* we need to fetch the contents for a string type even if not requested, + * because we need to compute the length of the ASCII string. */ + if (value || data || is_string(info->Type)) + { + /* retry with a dynamically allocated buffer */ + while (status == STATUS_BUFFER_OVERFLOW) + { + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size ))) + { + status = STATUS_INSUFFICIENT_RESOURCES; + goto done; + } + info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr; + status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation, + buf_ptr, total_size, &total_size ); + } + + if (status) goto done; + + if (is_string(info->Type)) + { + ULONG len; + RtlUnicodeToMultiByteSize( &len, (WCHAR *)(buf_ptr + info->DataOffset), + total_size - info->DataOffset ); + if (data && len) + { + if (len > *count) status = STATUS_BUFFER_OVERFLOW; + else + { + RtlUnicodeToMultiByteN( (PCHAR)data, len, NULL, (WCHAR *)(buf_ptr + info->DataOffset), + total_size - info->DataOffset ); + /* if the type is REG_SZ and data is not 0-terminated + * and there is enough space in the buffer NT appends a \0 */ + if (len < *count && data[len-1]) data[len] = 0; + } + } + info->DataLength = len; + } + else if (data) + { + if (total_size - info->DataOffset > *count) status = STATUS_BUFFER_OVERFLOW; + else memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); + } + + if (value && !status) + { + ULONG len; + + RtlUnicodeToMultiByteSize( &len, info->Name, info->NameLength ); + if (len >= *val_count) + { + status = STATUS_BUFFER_OVERFLOW; + if (*val_count) + { + len = *val_count - 1; + RtlUnicodeToMultiByteN( value, len, NULL, info->Name, info->NameLength ); + value[len] = 0; + } + } + else + { + RtlUnicodeToMultiByteN( value, len, NULL, info->Name, info->NameLength ); + value[len] = 0; + *val_count = len; + } + } + } + else status = STATUS_SUCCESS; + + if (type) *type = info->Type; + if (count) *count = info->DataLength; + + done: + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + ClosePredefKey(KeyHandle); + return RtlNtStatusToDosError(status); +} + +LONG WINAPI +RegEnumValueW(HKEY hKey, + DWORD index, + LPWSTR value, + PDWORD val_count, + PDWORD reserved, + PDWORD type, + LPBYTE data, + PDWORD count) +{ + HANDLE KeyHandle; + NTSTATUS status; + ULONG total_size; + char buffer[256], *buf_ptr = buffer; + KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer; + static const int info_size = FIELD_OFFSET( KEY_VALUE_FULL_INFORMATION, Name ); + + //TRACE("(%p,%ld,%p,%p,%p,%p,%p,%p)\n", + // hkey, index, value, val_count, reserved, type, data, count ); + + /* NT only checks count, not val_count */ + if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER; + + status = MapDefaultKey(&KeyHandle, hKey); + if (!NT_SUCCESS(status)) + { + return RtlNtStatusToDosError(status); + } + + total_size = info_size + (MAX_PATH + 1) * sizeof(WCHAR); + if (data) total_size += *count; + total_size = min( sizeof(buffer), total_size ); + + status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation, + buffer, total_size, &total_size ); + if (status && status != STATUS_BUFFER_OVERFLOW) goto done; + + if (value || data) + { + /* retry with a dynamically allocated buffer */ + while (status == STATUS_BUFFER_OVERFLOW) + { + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size ))) + { + status = ERROR_NOT_ENOUGH_MEMORY; + goto done; + } + info = (KEY_VALUE_FULL_INFORMATION *)buf_ptr; + status = NtEnumerateValueKey( KeyHandle, index, KeyValueFullInformation, + buf_ptr, total_size, &total_size ); + } + + if (status) goto done; + + if (value) + { + if (info->NameLength/sizeof(WCHAR) >= *val_count) + { + status = STATUS_BUFFER_OVERFLOW; + goto overflow; + } + memcpy( value, info->Name, info->NameLength ); + *val_count = info->NameLength / sizeof(WCHAR); + value[*val_count] = 0; + } + + if (data) + { + if (total_size - info->DataOffset > *count) + { + status = STATUS_BUFFER_OVERFLOW; + goto overflow; + } + memcpy( data, buf_ptr + info->DataOffset, total_size - info->DataOffset ); + if (total_size - info->DataOffset <= *count-sizeof(WCHAR) && is_string(info->Type)) + { + /* if the type is REG_SZ and data is not 0-terminated + * and there is enough space in the buffer NT appends a \0 */ + WCHAR *ptr = (WCHAR *)(data + total_size - info->DataOffset); + if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0; + } + } + } + else status = STATUS_SUCCESS; + + overflow: + if (type) *type = info->Type; + if (count) *count = info->DataLength; + + done: + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + ClosePredefKey(KeyHandle); + return RtlNtStatusToDosError(status); +} + +LONG WINAPI +RegOpenKeyA(HKEY hKey, + LPCSTR lpSubKey, + PHKEY phkResult) +{ + TRACE("RegOpenKeyA hKey 0x%x lpSubKey %s phkResult %p\n", + hKey, lpSubKey, phkResult); + + if (!hKey && lpSubKey && phkResult) + { + return ERROR_INVALID_HANDLE; + } + + if (!lpSubKey || !*lpSubKey) + { + *phkResult = hKey; + return ERROR_SUCCESS; + } + + return RegOpenKeyExA(hKey, + lpSubKey, + 0, + MAXIMUM_ALLOWED, + phkResult); +} + +LONG WINAPI +RegOpenKeyW(HKEY hKey, + LPCWSTR lpSubKey, + PHKEY phkResult) +{ + TRACE("RegOpenKeyW hKey 0x%x lpSubKey %S phkResult %p\n", + hKey, lpSubKey, phkResult); + + if (!hKey && lpSubKey && phkResult) + { + return ERROR_INVALID_HANDLE; + } + + if (!lpSubKey || !*lpSubKey) + { + *phkResult = hKey; + return ERROR_SUCCESS; + } + + return RegOpenKeyExW(hKey, + lpSubKey, + 0, + MAXIMUM_ALLOWED, + phkResult); +} + +LONG WINAPI +RegOpenKeyExA(HKEY hKey, + LPCSTR lpSubKey, + DWORD ulOptions, + REGSAM samDesired, + PHKEY phkResult) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING SubKeyString; + HANDLE KeyHandle; + NTSTATUS Status; + LONG ErrorCode = ERROR_SUCCESS; + + TRACE("RegOpenKeyExA hKey 0x%x lpSubKey %s ulOptions 0x%x samDesired 0x%x phkResult %p\n", + hKey, lpSubKey, ulOptions, samDesired, phkResult); + if (!phkResult) + { + return ERROR_INVALID_PARAMETER; + } + + Status = MapDefaultKey(&KeyHandle, + hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + RtlCreateUnicodeStringFromAsciiz(&SubKeyString, + (LPSTR)lpSubKey); + InitializeObjectAttributes(&ObjectAttributes, + &SubKeyString, + OBJ_CASE_INSENSITIVE, + KeyHandle, + NULL); + + Status = NtOpenKey((PHANDLE)phkResult, + samDesired, + &ObjectAttributes); + RtlFreeUnicodeString(&SubKeyString); + if (!NT_SUCCESS(Status)) + { + ErrorCode = RtlNtStatusToDosError(Status); + } + + ClosePredefKey(KeyHandle); + + return ErrorCode; +} + +LONG WINAPI +RegOpenKeyExW(HKEY hKey, + LPCWSTR lpSubKey, + DWORD ulOptions, + REGSAM samDesired, + PHKEY phkResult) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING SubKeyString; + HANDLE KeyHandle; + NTSTATUS Status; + LONG ErrorCode = ERROR_SUCCESS; + + TRACE("RegOpenKeyExW hKey 0x%x lpSubKey %S ulOptions 0x%x samDesired 0x%x phkResult %p\n", + hKey, lpSubKey, ulOptions, samDesired, phkResult); + if (!phkResult) + { + return ERROR_INVALID_PARAMETER; + } + + Status = MapDefaultKey(&KeyHandle, hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + if (lpSubKey != NULL) + RtlInitUnicodeString(&SubKeyString, (LPWSTR)lpSubKey); + else + RtlInitUnicodeString(&SubKeyString, (LPWSTR)L""); + + InitializeObjectAttributes(&ObjectAttributes, + &SubKeyString, + OBJ_CASE_INSENSITIVE, + KeyHandle, + NULL); + + Status = NtOpenKey((PHANDLE)phkResult, + samDesired, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + ErrorCode = RtlNtStatusToDosError(Status); + } + + ClosePredefKey(KeyHandle); + + return ErrorCode; +} + +LONG WINAPI +RegQueryInfoKeyA(HKEY hKey, + LPSTR lpClass, + LPDWORD lpcbClass, + LPDWORD lpReserved, + LPDWORD lpcSubKeys, + LPDWORD lpcbMaxSubKeyLen, + LPDWORD lpcbMaxClassLen, + LPDWORD lpcValues, + LPDWORD lpcbMaxValueNameLen, + LPDWORD lpcbMaxValueLen, + LPDWORD lpcbSecurityDescriptor, + PFILETIME lpftLastWriteTime) +{ + WCHAR ClassName[MAX_PATH]; + UNICODE_STRING UnicodeString; + ANSI_STRING AnsiString; + LONG ErrorCode; + + RtlInitUnicodeString(&UnicodeString, + NULL); + if (lpClass != NULL) + { + UnicodeString.Buffer = &ClassName[0]; + UnicodeString.MaximumLength = sizeof(ClassName); + AnsiString.MaximumLength = *lpcbClass; + } + + ErrorCode = RegQueryInfoKeyW(hKey, + UnicodeString.Buffer, + lpcbClass, + lpReserved, + lpcSubKeys, + lpcbMaxSubKeyLen, + lpcbMaxClassLen, + lpcValues, + lpcbMaxValueNameLen, + lpcbMaxValueLen, + lpcbSecurityDescriptor, + lpftLastWriteTime); + if ((ErrorCode == ERROR_SUCCESS) && (lpClass != NULL)) + { + AnsiString.Buffer = lpClass; + AnsiString.Length = 0; + UnicodeString.Length = *lpcbClass * sizeof(WCHAR); + RtlUnicodeStringToAnsiString(&AnsiString, + &UnicodeString, + FALSE); + *lpcbClass = AnsiString.Length; + lpClass[AnsiString.Length] = 0; + } + + return ErrorCode; +} + +LONG WINAPI +RegQueryInfoKeyW(HKEY hKey, + LPWSTR lpClass, + LPDWORD lpcbClass, + LPDWORD lpReserved, + LPDWORD lpcSubKeys, + LPDWORD lpcbMaxSubKeyLen, + LPDWORD lpcbMaxClassLen, + LPDWORD lpcValues, + LPDWORD lpcbMaxValueNameLen, + LPDWORD lpcbMaxValueLen, + LPDWORD lpcbSecurityDescriptor, + PFILETIME lpftLastWriteTime) +{ + KEY_FULL_INFORMATION FullInfoBuffer; + PKEY_FULL_INFORMATION FullInfo; + ULONG FullInfoSize; + ULONG ClassLength = 0; + HANDLE KeyHandle; + NTSTATUS Status; + ULONG Length; + LONG ErrorCode = ERROR_SUCCESS; + + if ((lpClass) && (!lpcbClass)) + { + return ERROR_INVALID_PARAMETER; + } + + Status = MapDefaultKey(&KeyHandle, + hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + if (lpClass != NULL) + { + if (*lpcbClass > 0) + { + ClassLength = min(*lpcbClass - 1, REG_MAX_NAME_SIZE) * sizeof(WCHAR); + } + else + { + ClassLength = 0; + } + + FullInfoSize = sizeof(KEY_FULL_INFORMATION) + ((ClassLength + 3) & ~3); + FullInfo = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + FullInfoSize); + if (FullInfo == NULL) + { + ErrorCode = ERROR_OUTOFMEMORY; + goto Cleanup; + } + + FullInfo->ClassLength = ClassLength; + } + else + { + FullInfoSize = sizeof(KEY_FULL_INFORMATION); + FullInfo = &FullInfoBuffer; + FullInfo->ClassLength = 0; + } + FullInfo->ClassOffset = FIELD_OFFSET(KEY_FULL_INFORMATION, Class); + + Status = NtQueryKey(KeyHandle, + KeyFullInformation, + FullInfo, + FullInfoSize, + &Length); + TRACE("NtQueryKey() returned status 0x%X\n", Status); + if (!NT_SUCCESS(Status)) + { + if (lpClass != NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), + 0, + FullInfo); + } + + ErrorCode = RtlNtStatusToDosError(Status); + goto Cleanup; + } + + TRACE("SubKeys %d\n", FullInfo->SubKeys); + if (lpcSubKeys != NULL) + { + *lpcSubKeys = FullInfo->SubKeys; + } + + TRACE("MaxNameLen %lu\n", FullInfo->MaxNameLen); + if (lpcbMaxSubKeyLen != NULL) + { + *lpcbMaxSubKeyLen = FullInfo->MaxNameLen / sizeof(WCHAR) + 1; + } + + TRACE("MaxClassLen %lu\n", FullInfo->MaxClassLen); + if (lpcbMaxClassLen != NULL) + { + *lpcbMaxClassLen = FullInfo->MaxClassLen / sizeof(WCHAR) + 1; + } + + TRACE("Values %lu\n", FullInfo->Values); + if (lpcValues != NULL) + { + *lpcValues = FullInfo->Values; + } + + TRACE("MaxValueNameLen %lu\n", FullInfo->MaxValueNameLen); + if (lpcbMaxValueNameLen != NULL) + { + *lpcbMaxValueNameLen = FullInfo->MaxValueNameLen / sizeof(WCHAR) + 1; + } + + TRACE("MaxValueDataLen %lu\n", FullInfo->MaxValueDataLen); + if (lpcbMaxValueLen != NULL) + { + *lpcbMaxValueLen = FullInfo->MaxValueDataLen; + } + + if (lpftLastWriteTime != NULL) + { + lpftLastWriteTime->dwLowDateTime = FullInfo->LastWriteTime.u.LowPart; + lpftLastWriteTime->dwHighDateTime = FullInfo->LastWriteTime.u.HighPart; + } + + if (lpClass != NULL) + { + if (FullInfo->ClassLength > ClassLength) + { + ErrorCode = ERROR_BUFFER_OVERFLOW; + } + else + { + RtlCopyMemory(lpClass, + FullInfo->Class, + FullInfo->ClassLength); + *lpcbClass = FullInfo->ClassLength / sizeof(WCHAR); + lpClass[*lpcbClass] = 0; + } + + RtlFreeHeap(RtlGetProcessHeap(), + 0, + FullInfo); + } + +Cleanup: + ClosePredefKey(KeyHandle); + + return ErrorCode; +} + +LONG WINAPI +RegQueryValueExA(HKEY hKey, + LPCSTR lpValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData) +{ + UNICODE_STRING ValueName; + UNICODE_STRING ValueData; + ANSI_STRING AnsiString; + LONG ErrorCode; + DWORD Length; + DWORD Type; + + TRACE("hKey 0x%X lpValueName %s lpData 0x%X lpcbData %d\n", + hKey, lpValueName, lpData, lpcbData ? *lpcbData : 0); + + if (lpData != NULL && lpcbData == NULL) + { + return ERROR_INVALID_PARAMETER; + } + + if (lpData) + { + ValueData.Length = 0; + ValueData.MaximumLength = (*lpcbData + 1) * sizeof(WCHAR); + ValueData.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + ValueData.MaximumLength); + if (!ValueData.Buffer) + { + return ERROR_OUTOFMEMORY; + } + } + else + { + ValueData.Buffer = NULL; + ValueData.Length = 0; + ValueData.MaximumLength = 0; + + if (lpcbData) + *lpcbData = 0; + } + + RtlCreateUnicodeStringFromAsciiz(&ValueName, + (LPSTR)lpValueName); + + Length = (lpcbData == NULL) ? 0 : *lpcbData * sizeof(WCHAR); + ErrorCode = RegQueryValueExW(hKey, + ValueName.Buffer, + lpReserved, + &Type, + (lpData == NULL) ? NULL : (LPBYTE)ValueData.Buffer, + &Length); + TRACE("ErrorCode %lu\n", ErrorCode); + RtlFreeUnicodeString(&ValueName); + + if (ErrorCode == ERROR_SUCCESS || + ErrorCode == ERROR_MORE_DATA) + { + + if ((Type == REG_SZ) || (Type == REG_MULTI_SZ) || (Type == REG_EXPAND_SZ)) + { + if (ErrorCode == ERROR_SUCCESS && ValueData.Buffer != NULL) + { + RtlInitAnsiString(&AnsiString, NULL); + AnsiString.Buffer = (LPSTR)lpData; + AnsiString.MaximumLength = *lpcbData; + ValueData.Length = Length; + ValueData.MaximumLength = ValueData.Length + sizeof(WCHAR); + RtlUnicodeStringToAnsiString(&AnsiString, &ValueData, FALSE); + } + + Length = Length / sizeof(WCHAR); + } + else if (ErrorCode == ERROR_SUCCESS && ValueData.Buffer != NULL) + { + if (*lpcbData < Length) + { + ErrorCode = ERROR_MORE_DATA; + } + else + { + RtlMoveMemory(lpData, ValueData.Buffer, Length); + } + } + + if (lpcbData != NULL) + { + *lpcbData = Length; + } + } + + if (lpType != NULL) + { + *lpType = Type; + } + + if (ValueData.Buffer != NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, ValueData.Buffer); + } + + return ErrorCode; +} + +LONG +WINAPI +RegQueryValueExW(HKEY hkeyorg, + LPCWSTR name, + LPDWORD reserved, + LPDWORD type, + LPBYTE data, + LPDWORD count) +{ + HANDLE hkey; + NTSTATUS status; + UNICODE_STRING name_str; + DWORD total_size; + char buffer[256], *buf_ptr = buffer; + KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; + static const int info_size = offsetof( KEY_VALUE_PARTIAL_INFORMATION, Data ); + + TRACE("(%p,%s,%p,%p,%p,%p=%d)\n", + hkey, debugstr_w(name), reserved, type, data, count, + (count && data) ? *count : 0 ); + + if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER; + + status = MapDefaultKey(&hkey, hkeyorg); + if (!NT_SUCCESS(status)) + { + return RtlNtStatusToDosError(status); + } + + RtlInitUnicodeString( &name_str, name ); + + if (data) total_size = min( sizeof(buffer), *count + info_size ); + else + { + total_size = info_size; + if (count) *count = 0; + } + + /* this matches Win9x behaviour - NT sets *type to a random value */ + if (type) *type = REG_NONE; + + status = NtQueryValueKey( hkey, &name_str, KeyValuePartialInformation, + buffer, total_size, &total_size ); + if (status && status != STATUS_BUFFER_OVERFLOW) goto done; + + if (data) + { + /* retry with a dynamically allocated buffer */ + while (status == STATUS_BUFFER_OVERFLOW && total_size - info_size <= *count) + { + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + if (!(buf_ptr = HeapAlloc( GetProcessHeap(), 0, total_size ))) + { + ClosePredefKey(hkey); + return ERROR_NOT_ENOUGH_MEMORY; + } + info = (KEY_VALUE_PARTIAL_INFORMATION *)buf_ptr; + status = NtQueryValueKey( hkey, &name_str, KeyValuePartialInformation, + buf_ptr, total_size, &total_size ); + } + + if (!status) + { + memcpy( data, buf_ptr + info_size, total_size - info_size ); + /* if the type is REG_SZ and data is not 0-terminated + * and there is enough space in the buffer NT appends a \0 */ + if (total_size - info_size <= *count-sizeof(WCHAR) && is_string(info->Type)) + { + WCHAR *ptr = (WCHAR *)(data + total_size - info_size); + if (ptr > (WCHAR *)data && ptr[-1]) *ptr = 0; + } + } + else if (status != STATUS_BUFFER_OVERFLOW) goto done; + } + else status = STATUS_SUCCESS; + + if (type) *type = info->Type; + if (count) *count = total_size - info_size; + + done: + if (buf_ptr != buffer) HeapFree( GetProcessHeap(), 0, buf_ptr ); + ClosePredefKey(hkey); + return RtlNtStatusToDosError(status); +} + +LSTATUS WINAPI RegQueryValueA( HKEY hkey, LPCSTR name, LPSTR data, LPLONG count ) +{ + DWORD ret; + HKEY subkey = hkey; + + TRACE("(%p,%s,%p,%d)\n", hkey, debugstr_a(name), data, count ? *count : 0 ); + + if (name && name[0]) + { + if ((ret = RegOpenKeyA( hkey, name, &subkey )) != ERROR_SUCCESS) return ret; + } + ret = RegQueryValueExA( subkey, NULL, NULL, NULL, (LPBYTE)data, (LPDWORD)count ); + if (subkey != hkey) RegCloseKey( subkey ); + if (ret == ERROR_FILE_NOT_FOUND) + { + /* return empty string if default value not found */ + if (data) *data = 0; + if (count) *count = 1; + ret = ERROR_SUCCESS; + } + return ret; +} + +LSTATUS WINAPI RegQueryValueW( HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count ) +{ + DWORD ret; + HKEY subkey = hkey; + + TRACE("(%p,%s,%p,%d)\n", hkey, debugstr_w(name), data, count ? *count : 0 ); + if (hkey == NULL) + { + return ERROR_INVALID_HANDLE; + } + if (name && name[0]) + { + ret = RegOpenKeyW( hkey, name, &subkey); + if (ret != ERROR_SUCCESS) + { + return ret; + } + } + + ret = RegQueryValueExW( subkey, NULL, NULL, NULL, (LPBYTE)data, (LPDWORD)count ); + + if (subkey != hkey) + { + RegCloseKey( subkey ); + } + + if (ret == ERROR_FILE_NOT_FOUND) + { + /* return empty string if default value not found */ + if (data) + *data = 0; + if (count) + *count = sizeof(WCHAR); + ret = ERROR_SUCCESS; + } + return ret; +} + +LONG WINAPI +RegSetValueExA(HKEY hKey, + LPCSTR lpValueName, + DWORD Reserved, + DWORD dwType, + CONST BYTE* lpData, + DWORD cbData) +{ + UNICODE_STRING ValueName; + LPWSTR pValueName; + ANSI_STRING AnsiString; + UNICODE_STRING Data; + LONG ErrorCode; + LPBYTE pData; + DWORD DataSize; + + if (lpValueName != NULL && + strlen(lpValueName) != 0) + { + RtlCreateUnicodeStringFromAsciiz(&ValueName, + (PSTR)lpValueName); + } + else + { + ValueName.Buffer = NULL; + } + + pValueName = (LPWSTR)ValueName.Buffer; + + if (((dwType == REG_SZ) || + (dwType == REG_MULTI_SZ) || + (dwType == REG_EXPAND_SZ)) && + (cbData != 0)) + { + /* NT adds one if the caller forgot the NULL-termination character */ + if (lpData[cbData - 1] != '\0') + { + cbData++; + } + + RtlInitAnsiString(&AnsiString, + NULL); + AnsiString.Buffer = (PSTR)lpData; + AnsiString.Length = cbData - 1; + AnsiString.MaximumLength = cbData; + RtlAnsiStringToUnicodeString(&Data, + &AnsiString, + TRUE); + pData = (LPBYTE)Data.Buffer; + DataSize = cbData * sizeof(WCHAR); + } + else + { + RtlInitUnicodeString(&Data, + NULL); + pData = (LPBYTE)lpData; + DataSize = cbData; + } + + ErrorCode = RegSetValueExW(hKey, + pValueName, + Reserved, + dwType, + pData, + DataSize); + if (pValueName != NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), + 0, + ValueName.Buffer); + } + + if (Data.Buffer != NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), + 0, + Data.Buffer); + } + + return ErrorCode; +} + +LONG WINAPI +RegSetValueExW(HKEY hKey, + LPCWSTR lpValueName, + DWORD Reserved, + DWORD dwType, + CONST BYTE* lpData, + DWORD cbData) +{ + UNICODE_STRING ValueName; + PUNICODE_STRING pValueName; + HANDLE KeyHandle; + NTSTATUS Status; + + Status = MapDefaultKey(&KeyHandle, + hKey); + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + if (lpValueName != NULL) + { + RtlInitUnicodeString(&ValueName, + lpValueName); + } + else + { + RtlInitUnicodeString(&ValueName, L""); + } + pValueName = &ValueName; + + if (((dwType == REG_SZ) || + (dwType == REG_MULTI_SZ) || + (dwType == REG_EXPAND_SZ)) && + (cbData != 0) && (*(((PWCHAR)lpData) + (cbData / sizeof(WCHAR)) - 1) != L'\0')) + { + /* NT adds one if the caller forgot the NULL-termination character */ + cbData += sizeof(WCHAR); + } + + Status = NtSetValueKey(KeyHandle, + pValueName, + 0, + dwType, + (PVOID)lpData, + (ULONG)cbData); + + ClosePredefKey(KeyHandle); + + if (!NT_SUCCESS(Status)) + { + return RtlNtStatusToDosError(Status); + } + + return ERROR_SUCCESS; +} Propchange: branches/arwinss/reactos/dll/win32/gdi32/regglue.c ------------------------------------------------------------------------------ svn:eol-style = native
15 years, 5 months
1
0
0
0
[khornicek] 42093: - go through all fonts in the requested directory and load them
by khornicek@svn.reactos.org
Author: khornicek Date: Mon Jul 20 03:03:19 2009 New Revision: 42093 URL:
http://svn.reactos.org/svn/reactos?rev=42093&view=rev
Log: - go through all fonts in the requested directory and load them Modified: branches/arwinss/reactos/dll/win32/gdi32/freetype.c Modified: branches/arwinss/reactos/dll/win32/gdi32/freetype.c URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/freetype.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/freetype.c [iso-8859-1] Mon Jul 20 03:03:19 2009 @@ -1832,47 +1832,45 @@ static BOOL ReadFontDir(const char *dirname, BOOL external_fonts) { -#if 0 - DIR *dir; - struct dirent *dent; - char path[MAX_PATH]; - - TRACE("Loading fonts from %s\n", debugstr_a(dirname)); - - dir = opendir(dirname); - if(!dir) { - WARN("Can't open directory %s\n", debugstr_a(dirname)); - return FALSE; - } - while((dent = readdir(dir)) != NULL) { - struct stat statbuf; - - if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) - continue; - - TRACE("Found %s in %s\n", debugstr_a(dent->d_name), debugstr_a(dirname)); - - sprintf(path, "%s/%s", dirname, dent->d_name); - - if(stat(path, &statbuf) == -1) - { - WARN("Can't stat %s\n", debugstr_a(path)); - continue; - } - if(S_ISDIR(statbuf.st_mode)) - ReadFontDir(path, external_fonts); - else - AddFontFileToList(path, NULL, NULL, external_fonts ? ADDFONT_EXTERNAL_FONT : 0); - } - closedir(dir); + HANDLE file; + WIN32_FIND_DATA find_data; + CHAR search_path[MAX_PATH]; + + TRACE("Loading fonts from %s\n", debugstr_a(dirname)); + + snprintf(search_path, MAX_PATH, "%s\\*", dirname); + + file = FindFirstFileA(search_path, &find_data); + + if (file == INVALID_HANDLE_VALUE) + { + WARN("Can't open directory %s\n", debugstr_a(dirname)); + return FALSE; + } + + do + { + CHAR path[MAX_PATH]; + + if(strcmp(find_data.cFileName, ".") == 0 || strcmp(find_data.cFileName, "..") == 0) + continue; + + TRACE("Found %s in %s\n", find_data.cFileName, debugstr_a(dirname)); + snprintf(path, MAX_PATH, "%s\\%s", dirname, find_data.cFileName); + + if(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + ReadFontDir(path, external_fonts); + } + else + { + AddFontFileToList(path, NULL, NULL, external_fonts ? ADDFONT_EXTERNAL_FONT : 0); + } + } + while (FindNextFileA(file, &find_data)); + + FindClose(file); return TRUE; -#else - AddFontFileToList("C:\\ReactOS\\fonts\\tahoma.ttf", NULL, NULL, external_fonts ? ADDFONT_EXTERNAL_FONT : 0); - AddFontFileToList("C:\\ReactOS\\fonts\\symbol.ttf", NULL, NULL, external_fonts ? ADDFONT_EXTERNAL_FONT : 0); - AddFontFileToList("C:\\ReactOS\\fonts\\Marlett.ttf", NULL, NULL, external_fonts ? ADDFONT_EXTERNAL_FONT : 0); - UNIMPLEMENTED; - return TRUE; -#endif } static void load_fontconfig_fonts(void)
15 years, 5 months
1
0
0
0
[jimtabor] 42092: - [Win32k] Make co_IntCreateWindowEx return pointer to public window structure.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Sun Jul 19 23:18:08 2009 New Revision: 42092 URL:
http://svn.reactos.org/svn/reactos?rev=42092&view=rev
Log: - [Win32k] Make co_IntCreateWindowEx return pointer to public window structure. Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c Modified: trunk/reactos/subsystems/win32/win32k/include/desktop.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/desktop.h [iso-8859-1] Sun Jul 19 23:18:08 2009 @@ -28,7 +28,7 @@ PWIN32HEAP pheapDesktop; PSECTION_OBJECT DesktopHeapSection; PDESKTOPINFO DesktopInfo; - HWND spwndMessage; + PWINDOW spwndMessage; } DESKTOP, *PDESKTOP; extern PDESKTOP InputDesktop; Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h [iso-8859-1] Sun Jul 19 23:18:08 2009 @@ -171,7 +171,7 @@ VOID FASTCALL IntNotifyWinEvent(DWORD, HWND, LONG, LONG); -HWND APIENTRY co_IntCreateWindowEx(DWORD,PUNICODE_STRING,PUNICODE_STRING,DWORD,LONG,LONG,LONG,LONG,HWND,HMENU,HINSTANCE,LPVOID,DWORD,BOOL); +PWINDOW APIENTRY co_IntCreateWindowEx(DWORD,PUNICODE_STRING,PUNICODE_STRING,DWORD,LONG,LONG,LONG,LONG,HWND,HMENU,HINSTANCE,LPVOID,DWORD,BOOL); #endif /* _WIN32K_WINDOW_H */ /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c [iso-8859-1] Sun Jul 19 23:18:08 2009 @@ -566,7 +566,7 @@ DPRINT("No active desktop\n"); return NULL; } - return pdo->spwndMessage; + return pdo->spwndMessage->hdr.Handle; } HWND FASTCALL IntGetCurrentThreadDesktopWindow(VOID) @@ -898,7 +898,6 @@ { OBJECT_ATTRIBUTES ObjectAttributes; PTHREADINFO W32Thread; - HWND hwndMessage; PWINSTATION_OBJECT WinStaObject; PDESKTOP DesktopObject; UNICODE_STRING DesktopName; @@ -916,6 +915,7 @@ PPROCESSINFO pi = GetW32ProcessInfo(); WNDCLASSEXW wc; PWINDOWCLASS Class; + PWINDOW pWnd; DECLARE_RETURN(HDESK); DPRINT("Enter NtUserCreateDesktop: %wZ\n", lpszDesktopName); @@ -1149,27 +1149,27 @@ DPRINT1("!!! Registering Message system class failed!\n"); } - hwndMessage = co_IntCreateWindowEx( 0, - &ClassName, - &WindowName, - (WS_POPUP|WS_CLIPCHILDREN), - 0, - 0, - 100, - 100, - NULL, - NULL, - pi->hModUser, // hModClient; - NULL, - 0, - TRUE); - if (!hwndMessage) + pWnd = co_IntCreateWindowEx( 0, + &ClassName, + &WindowName, + (WS_POPUP|WS_CLIPCHILDREN), + 0, + 0, + 100, + 100, + NULL, + NULL, + pi->hModUser, // hModClient; + NULL, + 0, + TRUE); + if (!pWnd) { DPRINT1("Failed to create Message window handle\n"); } else { - DesktopObject->spwndMessage = hwndMessage; + DesktopObject->spwndMessage = pWnd; } RETURN( Desktop); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Sun Jul 19 23:18:08 2009 @@ -1518,7 +1518,7 @@ /* * @implemented */ -HWND APIENTRY +PWINDOW APIENTRY co_IntCreateWindowEx(DWORD dwExStyle, PUNICODE_STRING ClassName, PUNICODE_STRING WindowName, @@ -1558,7 +1558,7 @@ CBT_CREATEWNDW CbtCreate; LRESULT Result; BOOL MenuChanged; - DECLARE_RETURN(HWND); + DECLARE_RETURN(PWINDOW); BOOL HasOwner; USER_REFERENCE_ENTRY ParentRef, Ref; PTHREADINFO pti; @@ -1595,7 +1595,7 @@ else if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD) { SetLastWin32Error(ERROR_TLW_WITH_WSCHILD); - RETURN( (HWND)0); /* WS_CHILD needs a parent, but WS_POPUP doesn't */ + RETURN( (PWINDOW)0); /* WS_CHILD needs a parent, but WS_POPUP doesn't */ } if (ParentWindowHandle) @@ -1616,7 +1616,7 @@ if (ti == NULL || pti->Desktop == NULL) { DPRINT1("Thread is not attached to a desktop! Cannot create window!\n"); - RETURN( (HWND)0); + RETURN( (PWINDOW)0); } /* Check the class. */ @@ -1639,7 +1639,7 @@ } SetLastWin32Error(ERROR_CANNOT_FIND_WND_CLASS); - RETURN((HWND)0); + RETURN((PWINDOW)0); } Class = IntReferenceClass(Class, @@ -1657,9 +1657,10 @@ ObReferenceObjectByPointer(WinSta, KernelMode, ExWindowStationObjectType, 0); /* Create the window object. */ - Window = (PWINDOW_OBJECT) - UserCreateObject(gHandleTable, (PHANDLE)&hWnd, - otWindow, sizeof(WINDOW_OBJECT)); + Window = (PWINDOW_OBJECT) UserCreateObject( gHandleTable, + (PHANDLE)&hWnd, + otWindow, + sizeof(WINDOW_OBJECT)); if (Window) { Window->Wnd = DesktopHeapAlloc(pti->Desktop, @@ -1668,7 +1669,7 @@ goto AllocErr; RtlZeroMemory(Window->Wnd, sizeof(WINDOW) + Class->WndExtra); - Window->Wnd->hdr.Handle = hWnd; /* FIXME: Remove hack */ + Window->Wnd->hdr.Handle = hWnd; /* FIXME: Remove hack , are you sure?*/ Wnd = Window->Wnd; Wnd->ti = ti; @@ -1683,7 +1684,7 @@ AllocErr: ObDereferenceObject(WinSta); SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); - RETURN( (HWND)0); + RETURN( (PWINDOW)0); } UserRefObjectCo(Window, &Ref); @@ -1775,7 +1776,7 @@ if (Wnd->WindowName.Buffer == NULL) { SetLastNtError(STATUS_INSUFFICIENT_RESOURCES); - RETURN( (HWND)0); + RETURN( (PWINDOW)0); } Wnd->WindowName.Buffer[WindowName->Length / sizeof(WCHAR)] = L'\0'; @@ -1885,7 +1886,7 @@ /* FIXME - Delete window object and remove it from the thread windows list */ /* FIXME - delete allocated DCE */ DPRINT1("CBT-hook returned !0\n"); - RETURN( (HWND) NULL); + RETURN( (PWINDOW) NULL); } } x = Cs.x; @@ -2052,7 +2053,7 @@ { /* FIXME: Cleanup. */ DPRINT1("IntCreateWindowEx(): NCCREATE message failed. No cleanup performed!\n"); - RETURN((HWND)0); + RETURN((PWINDOW)0); } /* Calculate the non-client size. */ @@ -2116,7 +2117,7 @@ /* FIXME: Cleanup. */ DPRINT1("IntCreateWindowEx(): send CREATE message failed. No cleanup performed!\n"); IntUnlinkWindow(Window); - RETURN((HWND)0); + RETURN((PWINDOW)0); } IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window->hSelf, OBJID_WINDOW, 0); @@ -2254,7 +2255,7 @@ DPRINT("IntCreateWindow(): = %X\n", hWnd); DPRINT("WindowObject->SystemMenu = 0x%x\n", Window->SystemMenu); - RETURN(hWnd); + RETURN( Wnd); CLEANUP: if (!_ret_ && Window && Window->Wnd && ti) @@ -2297,7 +2298,8 @@ NTSTATUS Status; UNICODE_STRING WindowName; UNICODE_STRING ClassName; - HWND NewWindow; + HWND NewWindow = NULL; + PWINDOW pNewWindow; DECLARE_RETURN(HWND); DPRINT("Enter NtUserCreateWindowEx(): (%d,%d-%d,%d)\n", x, y, nWidth, nHeight); @@ -2344,8 +2346,22 @@ RtlInitUnicodeString(&WindowName, NULL); } - NewWindow = co_IntCreateWindowEx(dwExStyle, &ClassName, &WindowName, dwStyle, x, y, nWidth, nHeight, - hWndParent, hMenu, hInstance, lpParam, dwShowMode, bUnicodeWindow); + pNewWindow = co_IntCreateWindowEx( dwExStyle, + &ClassName, + &WindowName, + dwStyle, + x, + y, + nWidth, + nHeight, + hWndParent, + hMenu, + hInstance, + lpParam, + dwShowMode, + bUnicodeWindow); + + if (pNewWindow) NewWindow = pNewWindow->hdr.Handle; if (WindowName.Buffer) {
15 years, 5 months
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
61
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Results per page:
10
25
50
100
200