ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
April 2017
----- 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
14 participants
179 discussions
Start a n
N
ew thread
[ekohl] 74296: [NTOS:OB] - Move device map code into a separate file. - Create and inherit device maps instead of using a single global device map.
by ekohl@svn.reactos.org
Author: ekohl Date: Tue Apr 11 19:58:05 2017 New Revision: 74296 URL:
http://svn.reactos.org/svn/reactos?rev=74296&view=rev
Log: [NTOS:OB] - Move device map code into a separate file. - Create and inherit device maps instead of using a single global device map. Added: trunk/reactos/ntoskrnl/ob/devicemap.c (with props) Modified: trunk/reactos/ntoskrnl/include/internal/ob.h trunk/reactos/ntoskrnl/ntos.cmake trunk/reactos/ntoskrnl/ob/obname.c Modified: trunk/reactos/ntoskrnl/include/internal/ob.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/ob.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/ob.h [iso-8859-1] Tue Apr 11 19:58:05 2017 @@ -387,6 +387,12 @@ // // DOS Devices Functions // +NTSTATUS +NTAPI +ObpCreateDeviceMap( + IN HANDLE DirectoryHandle +); + VOID NTAPI ObDereferenceDeviceMap( @@ -396,7 +402,7 @@ VOID FASTCALL ObfDereferenceDeviceMap( - IN PVOID DeviceMap + IN PDEVICE_MAP DeviceMap ); VOID Modified: trunk/reactos/ntoskrnl/ntos.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ntos.cmake?rev=74…
============================================================================== --- trunk/reactos/ntoskrnl/ntos.cmake [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ntos.cmake [iso-8859-1] Tue Apr 11 19:58:05 2017 @@ -225,6 +225,7 @@ ${REACTOS_SOURCE_DIR}/ntoskrnl/mm/region.c ${REACTOS_SOURCE_DIR}/ntoskrnl/mm/rmap.c ${REACTOS_SOURCE_DIR}/ntoskrnl/mm/section.c + ${REACTOS_SOURCE_DIR}/ntoskrnl/ob/devicemap.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ob/obdir.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ob/obhandle.c ${REACTOS_SOURCE_DIR}/ntoskrnl/ob/obinit.c Added: trunk/reactos/ntoskrnl/ob/devicemap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/devicemap.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/ob/devicemap.c (added) +++ trunk/reactos/ntoskrnl/ob/devicemap.c [iso-8859-1] Tue Apr 11 19:58:05 2017 @@ -0,0 +1,227 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: GPL - See COPYING in the top level directory + * FILE: ntoskrnl/ob/devicemap.c + * PURPOSE: Device map implementation + * PROGRAMMERS: Eric Kohl (eric.kohl(a)reactos.org) + * Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES ***************************************************************/ + +#include <ntoskrnl.h> +#define NDEBUG +#include <debug.h> + +/* PRIVATE FUNCTIONS ******************************************************/ + +NTSTATUS +NTAPI +ObpCreateDeviceMap(IN HANDLE DirectoryHandle) +{ + POBJECT_DIRECTORY DirectoryObject = NULL; + PDEVICE_MAP DeviceMap = NULL; + NTSTATUS Status; + + Status = ObReferenceObjectByHandle(DirectoryHandle, + DIRECTORY_TRAVERSE, + ObDirectoryType, + KeGetPreviousMode(), + (PVOID*)&DirectoryObject, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT("ObReferenceObjectByHandle() failed (Status 0x%08lx)\n", Status); + return Status; + } + + /* Allocate and initialize a new device map */ + DeviceMap = ExAllocatePoolWithTag(NonPagedPool, + sizeof(*DeviceMap), + 'mDbO'); + if (DeviceMap == NULL) + { + ObDereferenceObject(DirectoryObject); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Initialize the device map */ + RtlZeroMemory(DeviceMap, sizeof(*DeviceMap)); + DeviceMap->ReferenceCount = 1; + DeviceMap->DosDevicesDirectory = DirectoryObject; + + /* Acquire the device map lock */ + KeAcquireGuardedMutex(&ObpDeviceMapLock); + + /* Attach the device map to the directory object */ + DirectoryObject->DeviceMap = DeviceMap; + + /* Attach the device map to the process */ + ObSystemDeviceMap = DeviceMap; + PsGetCurrentProcess()->DeviceMap = DeviceMap; + + /* Release the device map lock */ + KeReleaseGuardedMutex(&ObpDeviceMapLock); + + return STATUS_SUCCESS; +} + + +VOID +NTAPI +ObDereferenceDeviceMap(IN PEPROCESS Process) +{ + PDEVICE_MAP DeviceMap; + + DPRINT("ObDereferenceDeviceMap()\n"); + + /* Get the pointer to this process devicemap and reset it + holding the device map lock */ + KeAcquireGuardedMutex(&ObpDeviceMapLock); + DeviceMap = Process->DeviceMap; + Process->DeviceMap = NULL; + KeReleaseGuardedMutex(&ObpDeviceMapLock); + + /* Continue only if there is a device map */ + if (DeviceMap == NULL) + return; + + /* Acquire the device map lock again */ + KeAcquireGuardedMutex(&ObpDeviceMapLock); + + /* Decrement the reference counter */ + DeviceMap->ReferenceCount--; + DPRINT("ReferenceCount: %lu\n", DeviceMap->ReferenceCount); + + /* Leave, if there are still references to this device map */ + if (DeviceMap->ReferenceCount != 0) + { + /* Release the device map lock and leave */ + KeReleaseGuardedMutex(&ObpDeviceMapLock); + return; + } + + /* Nobody is referencing it anymore, unlink the DOS directory */ + DeviceMap->DosDevicesDirectory->DeviceMap = NULL; + + /* Release the device map lock */ + KeReleaseGuardedMutex(&ObpDeviceMapLock); + + /* Dereference the DOS Devices Directory and free the DeviceMap */ + ObDereferenceObject(DeviceMap->DosDevicesDirectory); + ExFreePoolWithTag(DeviceMap, 'mDbO'); +} + + +VOID +FASTCALL +ObfDereferenceDeviceMap(IN PDEVICE_MAP DeviceMap) +{ + DPRINT("ObfDereferenceDeviceMap()\n"); + + /* Acquire the device map lock */ + KeAcquireGuardedMutex(&ObpDeviceMapLock); + + /* Decrement the reference counter */ + DeviceMap->ReferenceCount--; + DPRINT("ReferenceCount: %lu\n", DeviceMap->ReferenceCount); + + /* Leave, if there are still references to this device map */ + if (DeviceMap->ReferenceCount != 0) + { + /* Release the device map lock and leave */ + KeReleaseGuardedMutex(&ObpDeviceMapLock); + return; + } + + /* Nobody is referencing it anymore, unlink the DOS directory */ + DeviceMap->DosDevicesDirectory->DeviceMap = NULL; + + /* Release the devicemap lock */ + KeReleaseGuardedMutex(&ObpDeviceMapLock); + + /* Dereference the DOS Devices Directory and free the Device Map */ + ObDereferenceObject(DeviceMap->DosDevicesDirectory ); + ExFreePoolWithTag(DeviceMap, 'mDbO'); +} + + +VOID +NTAPI +ObInheritDeviceMap(IN PEPROCESS Parent, + IN PEPROCESS Process) +{ + PDEVICE_MAP DeviceMap; + + DPRINT("ObInheritDeviceMap()\n"); + + /* Acquire the device map lock */ + KeAcquireGuardedMutex(&ObpDeviceMapLock); + + /* Get the parent process device map or the system device map */ + DeviceMap = (Parent != NULL) ? Parent->DeviceMap : ObSystemDeviceMap; + if (DeviceMap != NULL) + { + /* Reference the device map and attach it to the new process */ + DeviceMap->ReferenceCount++; + DPRINT("ReferenceCount: %lu\n", DeviceMap->ReferenceCount); + + Process->DeviceMap = DeviceMap; + } + + /* Release the device map lock */ + KeReleaseGuardedMutex(&ObpDeviceMapLock); +} + + +VOID +NTAPI +ObQueryDeviceMapInformation(IN PEPROCESS Process, + IN PPROCESS_DEVICEMAP_INFORMATION DeviceMapInfo) +{ + PDEVICE_MAP DeviceMap; + + /* Acquire the device map lock */ + KeAcquireGuardedMutex(&ObpDeviceMapLock); + + /* Get the process device map or the system device map */ + DeviceMap = (Process != NULL) ? Process->DeviceMap : ObSystemDeviceMap; + if (DeviceMap != NULL) + { + /* Make a copy */ + DeviceMapInfo->Query.DriveMap = DeviceMap->DriveMap; + RtlCopyMemory(DeviceMapInfo->Query.DriveType, + DeviceMap->DriveType, + sizeof(DeviceMap->DriveType)); + } + + /* Release the device map lock */ + KeReleaseGuardedMutex(&ObpDeviceMapLock); +} + + +#if 0 +NTSTATUS +NTAPI +ObIsDosDeviceLocallyMapped( + IN ULONG Index, + OUT PUCHAR DosDeviceState) +{ + /* Check the index */ + if (Index < 1 || Index > 26) + return STATUS_INVALID_PARAMETER; + + /* Acquire the device map lock */ + KeAcquireGuardedMutex(&ObpDeviceMapLock); + + /* Get drive mapping status */ + *DosDeviceState = (ObSystemDeviceMap->DriveMap & (1 << Index)) != 0; + + /* Release the device map lock */ + KeReleaseGuardedMutex(&ObpDeviceMapLock); + + return STATUS_SUCCESS; +} +#endif + +/* EOF */ Propchange: trunk/reactos/ntoskrnl/ob/devicemap.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/ntoskrnl/ob/obname.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obname.c?rev=7…
============================================================================== --- trunk/reactos/ntoskrnl/ob/obname.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ob/obname.c [iso-8859-1] Tue Apr 11 19:58:05 2017 @@ -152,6 +152,11 @@ &ObjectAttributes); ExFreePoolWithTag(DosDevicesSD, TAG_SD); if (!NT_SUCCESS(Status)) return Status; + + /* Create the system device map */ + Status = ObpCreateDeviceMap(Handle); + if (!NT_SUCCESS(Status)) + return Status; /*********************************************\ |*** HACK until we support device mappings ***| @@ -230,62 +235,8 @@ &RootName); if (NT_SUCCESS(Status)) NtClose(SymHandle); - /* FIXME: Hack Hack! */ - ObSystemDeviceMap = ExAllocatePoolWithTag(NonPagedPool, - sizeof(*ObSystemDeviceMap), - 'mDbO'); - if (!ObSystemDeviceMap) return STATUS_INSUFFICIENT_RESOURCES; - RtlZeroMemory(ObSystemDeviceMap, sizeof(*ObSystemDeviceMap)); - /* Return status */ return Status; -} - -VOID -NTAPI -ObDereferenceDeviceMap(IN PEPROCESS Process) -{ - PDEVICE_MAP DeviceMap; - - /* Get the pointer to this process devicemap and reset it - holding devicemap lock */ - KeAcquireGuardedMutex(&ObpDeviceMapLock); - DeviceMap = Process->DeviceMap; - Process->DeviceMap = NULL; - KeReleaseGuardedMutex(&ObpDeviceMapLock); - - /* Continue only if there is a devicemap to dereference */ - if (DeviceMap) - { - KeAcquireGuardedMutex(&ObpDeviceMapLock); - - /* Delete the device map link and dereference it */ - if (--DeviceMap->ReferenceCount) - { - /* Nobody is referencing it anymore, unlink the DOS directory */ - DeviceMap->DosDevicesDirectory->DeviceMap = NULL; - - /* Release the devicemap lock */ - KeReleaseGuardedMutex(&ObpDeviceMapLock); - - /* Dereference the DOS Devices Directory and free the Device Map */ - ObDereferenceObject(DeviceMap->DosDevicesDirectory); - ExFreePool(DeviceMap); - } - else - { - /* Release the devicemap lock */ - KeReleaseGuardedMutex(&ObpDeviceMapLock); - } - } -} - -VOID -NTAPI -ObInheritDeviceMap(IN PEPROCESS Parent, - IN PEPROCESS Process) -{ - /* FIXME: Devicemap Support */ } /*++ @@ -1322,51 +1273,4 @@ return Status; } -VOID -NTAPI -ObQueryDeviceMapInformation(IN PEPROCESS Process, - IN PPROCESS_DEVICEMAP_INFORMATION DeviceMapInfo) -{ - /* - * FIXME: This is an ugly hack for now, to always return the System Device Map - * instead of returning the Process Device Map. Not important yet since we don't use it - */ - - KeAcquireGuardedMutex(&ObpDeviceMapLock); - - /* Make a copy */ - DeviceMapInfo->Query.DriveMap = ObSystemDeviceMap->DriveMap; - RtlCopyMemory(DeviceMapInfo->Query.DriveType, - ObSystemDeviceMap->DriveType, - sizeof(ObSystemDeviceMap->DriveType)); - - KeReleaseGuardedMutex(&ObpDeviceMapLock); -} - -NTSTATUS -NTAPI -ObIsDosDeviceLocallyMapped( - IN ULONG Index, - OUT PUCHAR DosDeviceState) -{ - /* check parameters */ - if (Index < 1 || Index > 26) - { - /* invalid index */ - return STATUS_INVALID_PARAMETER; - } - - /* acquire lock */ - KeAcquireGuardedMutex(&ObpDeviceMapLock); - - /* get drive mapping status */ - *DosDeviceState = (ObSystemDeviceMap->DriveMap & (1 << Index)) != 0; - - /* release lock */ - KeReleaseGuardedMutex(&ObpDeviceMapLock); - - /* done */ - return STATUS_SUCCESS; -} - /* EOF */
7 years, 8 months
1
0
0
0
[ekohl] 74295: [SETUPAPI] Implement CMP_GetServerSideDeviceInstallFlags().
by ekohl@svn.reactos.org
Author: ekohl Date: Mon Apr 10 19:17:17 2017 New Revision: 74295 URL:
http://svn.reactos.org/svn/reactos?rev=74295&view=rev
Log: [SETUPAPI] Implement CMP_GetServerSideDeviceInstallFlags(). Modified: trunk/reactos/dll/win32/setupapi/cfgmgr.c trunk/reactos/dll/win32/setupapi/setupapi.spec trunk/reactos/sdk/include/psdk/cfgmgr32.h Modified: trunk/reactos/dll/win32/setupapi/cfgmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/cfgmgr.…
============================================================================== --- trunk/reactos/dll/win32/setupapi/cfgmgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/cfgmgr.c [iso-8859-1] Mon Apr 10 19:17:17 2017 @@ -149,17 +149,69 @@ /*********************************************************************** - * CMP_Init_Detection [SETUPAPI.@] - */ -CONFIGRET WINAPI CMP_Init_Detection( - DWORD dwMagic) + * CMP_GetServerSideDeviceInstallFlags [SETUPAPI.@] + */ +CONFIGRET +WINAPI +CMP_GetServerSideDeviceInstallFlags( + _Out_ PULONG pulSSDIFlags, + _In_ ULONG ulFlags, + _In_ HMACHINE hMachine) { RPC_BINDING_HANDLE BindingHandle = NULL; CONFIGRET ret; - TRACE("%lu\n", dwMagic); - - if (dwMagic != CMP_MAGIC) + TRACE("CMP_GetServerSideDeviceInstallFlags(%p %lx %p)\n", + pulSSDIFlags, ulFlags, hMachine); + + if (pulSSDIFlags == NULL) + return CR_INVALID_POINTER; + + if (ulFlags != 0) + return CR_INVALID_FLAG; + + if (hMachine != NULL) + { + BindingHandle = ((PMACHINE_INFO)hMachine)->BindingHandle; + if (BindingHandle == NULL) + return CR_FAILURE; + } + else + { + if (!PnpGetLocalHandles(&BindingHandle, NULL)) + return CR_FAILURE; + } + + RpcTryExcept + { + ret = PNP_GetServerSideDeviceInstallFlags(BindingHandle, + pulSSDIFlags, + ulFlags); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + ret = RpcStatusToCmStatus(RpcExceptionCode()); + } + RpcEndExcept; + + return ret; +} + + +/*********************************************************************** + * CMP_Init_Detection [SETUPAPI.@] + */ +CONFIGRET +WINAPI +CMP_Init_Detection( + _In_ ULONG ulMagic) +{ + RPC_BINDING_HANDLE BindingHandle = NULL; + CONFIGRET ret; + + TRACE("CMP_Init_Detection(%lu)\n", ulMagic); + + if (ulMagic != CMP_MAGIC) return CR_INVALID_DATA; if (!PnpGetLocalHandles(&BindingHandle, NULL)) @@ -185,23 +237,24 @@ CONFIGRET WINAPI CMP_RegisterNotification( - IN HANDLE hRecipient, - IN LPVOID lpvNotificationFilter, - IN DWORD dwFlags, - OUT PHDEVNOTIFY phDevNotify) + _In_ HANDLE hRecipient, + _In_ LPVOID lpvNotificationFilter, + _In_ ULONG ulFlags, + _Out_ PHDEVNOTIFY phDevNotify) { RPC_BINDING_HANDLE BindingHandle = NULL; PNOTIFY_DATA pNotifyData = NULL; CONFIGRET ret = CR_SUCCESS; - TRACE("CMP_RegisterNotification(%p %p %lu %p)\n", hRecipient, lpvNotificationFilter, dwFlags, phDevNotify); + TRACE("CMP_RegisterNotification(%p %p %lu %p)\n", + hRecipient, lpvNotificationFilter, ulFlags, phDevNotify); if ((hRecipient == NULL) || (lpvNotificationFilter == NULL) || (phDevNotify == NULL)) return CR_INVALID_POINTER; - if (dwFlags & ~0x7) + if (ulFlags & ~0x7) return CR_INVALID_FLAG; if (((PDEV_BROADCAST_HDR)lpvNotificationFilter)->dbch_size < sizeof(DEV_BROADCAST_HDR)) @@ -232,7 +285,7 @@ RpcTryExcept { ret = PNP_RegisterNotification(BindingHandle, - dwFlags, + ulFlags, &pNotifyData->ulNotifyData); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -260,9 +313,11 @@ /*********************************************************************** * CMP_Report_LogOn [SETUPAPI.@] */ -CONFIGRET WINAPI CMP_Report_LogOn( - DWORD dwMagic, - DWORD dwProcessId) +CONFIGRET +WINAPI +CMP_Report_LogOn( + _In_ DWORD dwMagic, + _In_ DWORD dwProcessId) { RPC_BINDING_HANDLE BindingHandle = NULL; CONFIGRET ret = CR_SUCCESS; @@ -309,7 +364,7 @@ CONFIGRET WINAPI CMP_UnregisterNotification( - IN HDEVNOTIFY hDevNotify) + _In_ HDEVNOTIFY hDevNotify) { RPC_BINDING_HANDLE BindingHandle = NULL; PNOTIFY_DATA pNotifyData; @@ -347,11 +402,15 @@ /*********************************************************************** * CMP_WaitNoPendingInstallEvents [SETUPAPI.@] */ -DWORD WINAPI CMP_WaitNoPendingInstallEvents( - DWORD dwTimeout) +DWORD +WINAPI +CMP_WaitNoPendingInstallEvents( + _In_ DWORD dwTimeout) { HANDLE hEvent; DWORD ret; + + TRACE("CMP_WaitNoPendingInstallEvents(%lu)\n", dwTimeout); hEvent = OpenEventW(SYNCHRONIZE, FALSE, L"Global\\PnP_No_Pending_Install_Events"); if (hEvent == NULL) @@ -368,11 +427,14 @@ */ CONFIGRET WINAPI -CMP_WaitServicesAvailable(HMACHINE hMachine) +CMP_WaitServicesAvailable( + _In_ HMACHINE hMachine) { RPC_BINDING_HANDLE BindingHandle = NULL; CONFIGRET ret = CR_SUCCESS; WORD Version; + + TRACE("CMP_WaitServicesAvailable(%p)\n", hMachine); if (!PnpGetLocalHandles(&BindingHandle, NULL)) return CR_FAILURE; Modified: trunk/reactos/dll/win32/setupapi/setupapi.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupap…
============================================================================== --- trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] Mon Apr 10 19:17:17 2017 @@ -1,6 +1,6 @@ # Functions exported by Win2003 SP1 @ stub CMP_GetBlockedDriverInfo -@ stub CMP_GetServerSideDeviceInstallFlags +@ stdcall CMP_GetServerSideDeviceInstallFlags(ptr long ptr) @ stdcall CMP_Init_Detection(long) @ stdcall CMP_RegisterNotification(ptr ptr long ptr) @ stdcall CMP_Report_LogOn(long long) Modified: trunk/reactos/sdk/include/psdk/cfgmgr32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/psdk/cfgmgr32.…
============================================================================== --- trunk/reactos/sdk/include/psdk/cfgmgr32.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/psdk/cfgmgr32.h [iso-8859-1] Mon Apr 10 19:17:17 2017 @@ -921,33 +921,44 @@ CMAPI CONFIGRET WINAPI -CMP_Init_Detection(IN DWORD dwMagic); +CMP_GetServerSideDeviceInstallFlags( + _Out_ PULONG pulSSDIFlags, + _In_ ULONG ulFlags, + _In_ HMACHINE hMachine) + +CMAPI +CONFIGRET +WINAPI +CMP_Init_Detection( + _In_ DWORD dwMagic); CMAPI CONFIGRET WINAPI CMP_RegisterNotification( - IN HANDLE hRecipient, - IN LPVOID lpvNotificationFilter, - IN DWORD dwFlags, - OUT PULONG pluhDevNotify); + _In_ HANDLE hRecipient, + _In_ LPVOID lpvNotificationFilter, + _In_ DWORD dwFlags, + _Out_ PULONG pluhDevNotify); CMAPI CONFIGRET WINAPI CMP_Report_LogOn( - IN DWORD dwMagic, - IN DWORD dwProcessId); - -CMAPI -CONFIGRET -WINAPI -CMP_UnregisterNotification(IN ULONG luhDevNotify); - -CMAPI -CONFIGRET -WINAPI -CMP_WaitServicesAvailable(IN HMACHINE hMachine); + _In_ DWORD dwMagic, + _In_ DWORD dwProcessId); + +CMAPI +CONFIGRET +WINAPI +CMP_UnregisterNotification( + _In_ ULONG luhDevNotify); + +CMAPI +CONFIGRET +WINAPI +CMP_WaitServicesAvailable( + _In_ IN HMACHINE hMachine); */ CMAPI
7 years, 8 months
1
0
0
0
[ekohl] 74294: [UMPNPMGR] Implement most of PNP_GetServerSideDeviceInstallFlags().
by ekohl@svn.reactos.org
Author: ekohl Date: Mon Apr 10 19:12:17 2017 New Revision: 74294 URL:
http://svn.reactos.org/svn/reactos?rev=74294&view=rev
Log: [UMPNPMGR] Implement most of PNP_GetServerSideDeviceInstallFlags(). Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Mon Apr 10 19:12:17 2017 @@ -3004,6 +3004,8 @@ handle_t hBinding, WORD *pwVersion) { + UNREFERENCED_PARAMETER(hBinding); + *pwVersion = 0x501; return CR_SUCCESS; } @@ -3032,8 +3034,21 @@ DWORD *pulSSDIFlags, DWORD ulFlags) { - UNIMPLEMENTED; - return CR_CALL_NOT_IMPLEMENTED; + UNREFERENCED_PARAMETER(hBinding); + + DPRINT1("PNP_GetServerSideDeviceInstallFlags(%p %p %lu)\n", + hBinding, pulSSDIFlags, ulFlags); + + if (pulSSDIFlags == NULL) + return CR_INVALID_POINTER; + + if (ulFlags != 0) + return CR_INVALID_FLAG; + + /* FIXME */ + *pulSSDIFlags = 0; + + return CR_SUCCESS; }
7 years, 8 months
1
0
0
0
[gadamopoulos] 74293: [RSHELL] -Link to shellbars and export CBandSite_CreateInstance and CBandSiteMenu_CreateInstance. [SHELLMENU] -Remove second copy of CBandSite. It was originally added here to...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Sun Apr 9 15:10:08 2017 New Revision: 74293 URL:
http://svn.reactos.org/svn/reactos?rev=74293&view=rev
Log: [RSHELL] -Link to shellbars and export CBandSite_CreateInstance and CBandSiteMenu_CreateInstance. [SHELLMENU] -Remove second copy of CBandSite. It was originally added here to be tested in windows but now it is hosted in a proper static link. Removed: trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.cpp trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h Modified: trunk/reactos/base/shell/rshell/CMakeLists.txt trunk/reactos/base/shell/rshell/misc.cpp trunk/reactos/base/shell/rshell/rshell.spec trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp trunk/reactos/dll/win32/shell32/precomp.h trunk/reactos/dll/win32/shell32/shell32.cpp trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h Modified: trunk/reactos/base/shell/rshell/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/CMakeLis…
============================================================================== --- trunk/reactos/base/shell/rshell/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/CMakeLists.txt [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -3,8 +3,7 @@ set_cpp(WITH_RUNTIME) include_directories( - ${REACTOS_SOURCE_DIR}/sdk/lib/atl - ${REACTOS_SOURCE_DIR}/dll/win32/shell32/shellmenu) + ${REACTOS_SOURCE_DIR}/sdk/lib/atl) spec2def(rshell.dll rshell.spec ADD_IMPORTLIB) @@ -17,6 +16,7 @@ set_module_type(rshell win32dll UNICODE) target_link_libraries(rshell + shellbars shellmenu shelldesktop atlnew Modified: trunk/reactos/base/shell/rshell/misc.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/misc.cpp…
============================================================================== --- trunk/reactos/base/shell/rshell/misc.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/misc.cpp [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -18,7 +18,52 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "shellmenu.h" + +#include <stdio.h> +#include <tchar.h> + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#define COBJMACROS + +#include <windef.h> +#include <winbase.h> +#include <winreg.h> +#include <wingdi.h> +#include <winnls.h> +#include <wincon.h> +#include <shellapi.h> +#include <shlobj.h> +#include <shlobj_undoc.h> +#include <shlwapi.h> +#include <shlguid_undoc.h> +#include <uxtheme.h> +#include <strsafe.h> + +#include <atlbase.h> +#include <atlcom.h> +#include <atlwin.h> +#include <undocshell.h> +#include <undocuser.h> + +#include <shellutils.h> + +#include <wine/debug.h> + +extern "C" +{ +extern HINSTANCE shell32_hInstance; + +HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv); +HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv); +HRESULT WINAPI CBandSite_CreateInstance(REFIID riid, void **ppv); +HRESULT WINAPI CBandSiteMenu_CreateInstance(REFIID riid, void **ppv); +} DWORD WINAPI WinList_Init(void) { @@ -197,9 +242,6 @@ if (IsEqualCLSID(m_Clsid, CLSID_MergedFolder)) return CMergedFolder_Constructor(riid, ppvObject); - if (IsEqualCLSID(m_Clsid, CLSID_RebarBandSite)) - return CBandSite_Constructor(riid, ppvObject); - return E_NOINTERFACE; } Modified: trunk/reactos/base/shell/rshell/rshell.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/rshell/rshell.s…
============================================================================== --- trunk/reactos/base/shell/rshell/rshell.spec [iso-8859-1] (original) +++ trunk/reactos/base/shell/rshell/rshell.spec [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -7,6 +7,8 @@ @ stdcall CMenuSite_Constructor(ptr ptr); @ stdcall CMenuBand_Constructor(ptr ptr); @ stdcall CMergedFolder_Constructor(ptr ptr); +@ stdcall CBandSite_CreateInstance(ptr ptr) +@ stdcall CBandSiteMenu_CreateInstance(ptr ptr) @ stdcall ShellDDEInit(long); @ stdcall SHCreateDesktop(ptr); @ stdcall SHDesktopMessageLoop(ptr); Modified: trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
============================================================================== --- trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -830,7 +830,8 @@ return E_NOTIMPL; } -HRESULT CBandSite_CreateInstance(REFIID riid, void **ppv) +extern "C" +HRESULT WINAPI CBandSite_CreateInstance(REFIID riid, void **ppv) { return ShellObjectCreator<CBandSite>(riid, ppv); } Modified: trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
============================================================================== --- trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -40,6 +40,7 @@ HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) { BOOL ret; + WCHAR buffer[100]; TRACE("CBandSiteMenu::QueryContextMenu(%p, %p, %u, %u, %u, 0x%x)\n", this, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); @@ -54,7 +55,7 @@ if (!hm) return HRESULT_FROM_WIN32(GetLastError()); - mii.dwTypeData = new WCHAR[mii.cch + 1]; + mii.dwTypeData = buffer; mii.cch = mii.cch + 1; ret = GetMenuItemInfoW(hm, 0, TRUE, &mii); @@ -62,8 +63,6 @@ return HRESULT_FROM_WIN32(GetLastError()); ret = InsertMenuItemW(hmenu, 0, TRUE, &mii); - - delete[] mii.dwTypeData; RemoveMenu(hm, 0, MF_BYPOSITION); @@ -95,7 +94,8 @@ return E_NOTIMPL; } -HRESULT CBandSiteMenu_CreateInstance(REFIID riid, void **ppv) +extern "C" +HRESULT WINAPI CBandSiteMenu_CreateInstance(REFIID riid, void **ppv) { return ShellObjectCreator<CBandSiteMenu>(riid, ppv); } Modified: trunk/reactos/dll/win32/shell32/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/precomp.…
============================================================================== --- trunk/reactos/dll/win32/shell32/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/precomp.h [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -74,7 +74,6 @@ #include "dialogs/filedefext.h" #include "dialogs/drvdefext.h" #include "CQueryAssociations.h" -#include "shellmenu/CBandSite.h" #include "shellmenu/CMenuBand.h" #include "shellmenu/CMenuDeskBar.h" #include "shellmenu/CMenuSite.h" Modified: trunk/reactos/dll/win32/shell32/shell32.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shell32.…
============================================================================== --- trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shell32.cpp [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -252,7 +252,6 @@ OBJECT_ENTRY(CLSID_MenuBand, CMenuBand) OBJECT_ENTRY(CLSID_MenuDeskBar, CMenuDeskBar) OBJECT_ENTRY(CLSID_MergedFolder, CMergedFolder) - OBJECT_ENTRY(CLSID_RebarBandSite, CBandSite) OBJECT_ENTRY(CLSID_ExeDropHandler, CExeDropHandler) OBJECT_ENTRY(CLSID_QueryAssociations, CQueryAssociations) END_OBJECT_MAP() Removed: trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.cpp (removed) @@ -1,842 +0,0 @@ -/* - * Rebar band site - * - * Copyright 2007 Hervé Poussineau - * Copyright 2009 Andrew Hill - * - * 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 "shellmenu.h" -#include <shobjidl.h> - -#include "CBandSite.h" - -WINE_DEFAULT_DEBUG_CHANNEL(CBandSite); - -#ifndef ASSERT -#define ASSERT(cond) \ - if (!(cond)) \ - ERR ("ASSERTION %s AT %s:%d FAILED!\n", #cond, __FILE__, __LINE__) -#endif - -extern "C" -HRESULT WINAPI CBandSite_Constructor(REFIID riid, LPVOID *ppv) -{ - return ShellObjectCreator<CBandSite>(riid, ppv); -} - -CBandSiteBase::CBandSiteBase() -{ - fBandsCount = 0; - fBandsAllocated = 0; - fBands = NULL; - fRebarWindow = NULL; -} - -UINT CBandSiteBase::GetBandID(struct BandObject *Band) -{ - return (UINT)(Band - fBands); -} - -struct CBandSiteBase::BandObject *CBandSiteBase::GetBandByID(DWORD dwBandID) -{ - if ((LONG)dwBandID >= fBandsAllocated) - return NULL; - - if (fBands[dwBandID].DeskBand == NULL) - return NULL; - - return &fBands[dwBandID]; -} - -void CBandSiteBase::FreeBand(struct BandObject *Band) -{ - ATLASSERT(Band->DeskBand != NULL); - ATLASSERT(Band->OleWindow != NULL); - ATLASSERT(Band->WndEvtHandler != NULL); - Band->DeskBand->Release(); - Band->OleWindow->Release(); - Band->WndEvtHandler->Release(); - memset(Band, 0, sizeof(*Band)); - fBandsCount--; -} - -DWORD CBandSiteBase::GetBandSiteViewMode() -{ - DWORD dwStyle; - - /* FIXME: What about DBIF_VIEWMODE_FLOATING and DBIF_VIEWMODE_TRANSPARENT? */ - dwStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE); - - if (dwStyle & CCS_VERT) - return DBIF_VIEWMODE_VERTICAL; - else - return DBIF_VIEWMODE_NORMAL; -} - -VOID CBandSiteBase::BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi) -{ - ZeroMemory(prbi, sizeof(*prbi)); - prbi->cbSize = sizeof(*prbi); - - prbi->fMask = RBBIM_ID; - prbi->wID = GetBandID(Band); - - if (Band->dbi.dwMask & DBIM_MINSIZE) - { - prbi->fMask |= RBBIM_CHILDSIZE; - prbi->cxMinChild = Band->dbi.ptMinSize.x; - prbi->cyMinChild = Band->dbi.ptMinSize.y; - } - - if (Band->dbi.dwMask & DBIM_MAXSIZE) - { - prbi->fMask |= RBBIM_CHILDSIZE; - prbi->cyMaxChild = Band->dbi.ptMaxSize.y; - } - - if ((Band->dbi.dwMask & (DBIM_INTEGRAL | DBIM_MODEFLAGS)) == (DBIM_INTEGRAL | DBIM_MODEFLAGS) && - (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT)) - { - prbi->fMask |= RBBIM_CHILDSIZE; - prbi->cyIntegral = Band->dbi.ptIntegral.y; - } - - if (Band->dbi.dwMask & DBIM_ACTUAL) - { - prbi->fMask |= RBBIM_IDEALSIZE | RBBIM_SIZE | RBBIM_CHILDSIZE; - prbi->cxIdeal = Band->dbi.ptActual.x; - prbi->cx = Band->dbi.ptActual.x; - prbi->cyChild = Band->dbi.ptActual.y; - } - - if (Band->dbi.dwMask & DBIM_TITLE) - { - prbi->fMask |= RBBIM_TEXT; - prbi->lpText = Band->dbi.wszTitle; - prbi->cch = wcslen(Band->dbi.wszTitle); - } - - if (Band->dbi.dwMask & DBIM_MODEFLAGS) - { - prbi->fMask |= RBBIM_STYLE; - - if (Band->dbi.dwModeFlags & DBIMF_FIXED) - prbi->fStyle |= RBBS_FIXEDSIZE | RBBS_NOGRIPPER; - if (Band->dbi.dwModeFlags & DBIMF_FIXEDBMP) - prbi->fStyle |= RBBS_FIXEDBMP; - if (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT) - prbi->fStyle |= RBBS_VARIABLEHEIGHT; - if (Band->dbi.dwModeFlags & DBIMF_DEBOSSED) - prbi->fStyle |= RBBS_CHILDEDGE; - if (Band->dbi.dwModeFlags & DBIMF_USECHEVRON) - prbi->fStyle |= RBBS_USECHEVRON; - if (Band->dbi.dwModeFlags & DBIMF_BREAK) - prbi->fStyle |= RBBS_BREAK; - if (Band->dbi.dwModeFlags & DBIMF_TOPALIGN) - prbi->fStyle |= RBBS_TOPALIGN; - if (Band->dbi.dwModeFlags & DBIMF_NOGRIPPER) - prbi->fStyle |= RBBS_NOGRIPPER; - if (Band->dbi.dwModeFlags & DBIMF_ALWAYSGRIPPER) - prbi->fStyle |= RBBS_GRIPPERALWAYS; - } - - if ((Band->dbi.dwMask & (DBIM_BKCOLOR | DBIM_MODEFLAGS)) == (DBIM_BKCOLOR | DBIM_MODEFLAGS) && - (Band->dbi.dwModeFlags & DBIMF_BKCOLOR)) - { - prbi->fMask |= RBBIM_COLORS; - prbi->clrFore = (COLORREF)(COLOR_WINDOWTEXT + 1); - prbi->clrBack = Band->dbi.crBkgnd; - } -} - -HRESULT CBandSiteBase::UpdateSingleBand(struct BandObject *Band) -{ - REBARBANDINFOW rbi; - DWORD dwViewMode; - UINT uBand; - HRESULT hRet; - - ZeroMemory(&Band->dbi, sizeof(Band->dbi)); - Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL | - DBIM_ACTUAL | DBIM_TITLE | DBIM_MODEFLAGS | DBIM_BKCOLOR; - - dwViewMode = GetBandSiteViewMode(); - - hRet = Band->DeskBand->GetBandInfo((DWORD)GetBandID(Band), dwViewMode, &Band->dbi); - if (SUCCEEDED(hRet)) - { - BuildRebarBandInfo(Band, &rbi); - if (SUCCEEDED(Band->OleWindow->GetWindow(&rbi.hwndChild)) && - rbi.hwndChild != NULL) - { - rbi.fMask |= RBBIM_CHILD; - WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild); - } - - uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0); - if (uBand != (UINT)-1) - { - if (!SendMessageW(fRebarWindow, RB_SETBANDINFOW, (WPARAM)uBand, reinterpret_cast<LPARAM>(&rbi))) - { - WARN("Failed to update the rebar band!\n"); - } - } - else - WARN("Failed to map rebar band id to index!\n"); - - } - - return hRet; -} - -HRESULT CBandSiteBase::UpdateAllBands() -{ - LONG i; - HRESULT hRet; - - for (i = 0; i < fBandsAllocated; i++) - { - if (fBands[i].DeskBand != NULL) - { - hRet = UpdateSingleBand(&fBands[i]); - if (FAILED_UNEXPECTEDLY(hRet)) - return hRet; - } - } - - return S_OK; -} - -HRESULT CBandSiteBase::UpdateBand(DWORD dwBandID) -{ - struct BandObject *Band; - - Band = GetBandByID(dwBandID); - if (Band == NULL) - return E_FAIL; - - return UpdateSingleBand(Band); -} - -struct CBandSiteBase::BandObject *CBandSiteBase::GetBandFromHwnd(HWND hwnd) -{ - HRESULT hRet; - HWND hWndBand; - LONG i; - - for (i = 0; i < fBandsAllocated; i++) - { - if (fBands[i].DeskBand != NULL) - { - ASSERT(fBands[i].OleWindow); - - hWndBand = NULL; - hRet = fBands[i].OleWindow->GetWindow(&hWndBand); - if (SUCCEEDED(hRet) && hWndBand == hwnd) - return &fBands[i]; - } - } - - return NULL; -} - -CBandSiteBase::~CBandSiteBase() -{ - - TRACE("destroying %p\n", this); - - if (fRebarWindow != NULL) - { - DestroyWindow(fRebarWindow); - fRebarWindow = NULL; - } - - if (fBands != NULL) - { - for (INT i = 0; i < fBandsAllocated; i++) - { - if (fBands[i].DeskBand != NULL) - FreeBand(&fBands[i]); - } - CoTaskMemFree(fBands); - fBands = NULL; - } -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk) -{ - LONG NewAllocated; - struct BandObject *NewBand = NULL; - CComPtr<IDeskBand> DeskBand; - CComPtr<IObjectWithSite> ObjWithSite; - CComPtr<IOleWindow> OleWindow; - CComPtr<IWinEventHandler> WndEvtHandler; - REBARBANDINFOW rbi; - HRESULT hRet; - UINT uBand; - - TRACE("(%p, %p)\n", this, punk); - - if (punk == NULL || fRebarWindow == NULL) - return E_FAIL; - - hRet = punk->QueryInterface(IID_PPV_ARG(IDeskBand, &DeskBand)); - if (!SUCCEEDED(hRet) || DeskBand == NULL) - goto Cleanup; - hRet = punk->QueryInterface(IID_PPV_ARG(IObjectWithSite, &ObjWithSite)); - if (!SUCCEEDED(hRet) || ObjWithSite == NULL) - goto Cleanup; - hRet = punk->QueryInterface(IID_PPV_ARG(IOleWindow, &OleWindow)); - if (!SUCCEEDED(hRet) || OleWindow == NULL) - goto Cleanup; - hRet = punk->QueryInterface(IID_PPV_ARG(IWinEventHandler, &WndEvtHandler)); - if (!SUCCEEDED(hRet) || WndEvtHandler == NULL) - goto Cleanup; - - hRet = S_OK; - if (fBandsAllocated > fBandsCount) - { - /* Search for a free band object */ - for (INT i = 0; i < fBandsAllocated; i++) - { - if (fBands[i].DeskBand == NULL) - { - NewBand = &fBands[i]; - break; - } - } - } - else if (fBandsAllocated > 0) - { - ASSERT (fBands != NULL); - - /* Reallocate the band object array */ - NewAllocated = fBandsAllocated + 8; - if (NewAllocated > 0xFFFF) - NewAllocated = 0xFFFF; - if (NewAllocated == fBandsAllocated) - { - hRet = E_OUTOFMEMORY; - goto Cleanup; - } - - - NewBand = static_cast<struct BandObject *>(CoTaskMemAlloc(NewAllocated * sizeof(struct BandObject))); - if (NewBand == NULL) - { - hRet = E_OUTOFMEMORY; - goto Cleanup; - } - - /* Copy the old array */ - memcpy(NewBand, fBands, fBandsAllocated * sizeof(struct BandObject)); - - /* Initialize the added bands */ - memset(&NewBand[fBandsAllocated], 0, (NewAllocated - fBandsAllocated) * sizeof(struct BandObject)); - - fBandsAllocated = NewAllocated; - CoTaskMemFree(fBands); - fBands = NewBand; - } - else - { - ASSERT(fBands == NULL); - ASSERT(fBandsAllocated == 0); - ASSERT(fBandsCount == 0); - - /* Allocate new array */ - fBands = static_cast<struct BandObject *>(CoTaskMemAlloc(8 * sizeof(struct BandObject))); - if (fBands == NULL) - { - hRet = E_OUTOFMEMORY; - goto Cleanup; - } - - /* Initialize the added bands */ - memset(fBands, 0, 8 * sizeof(struct BandObject)); - - fBandsAllocated += 8; - NewBand = &fBands[0]; - } - - if (SUCCEEDED(hRet)) - { - ASSERT(NewBand != NULL); - - fBandsCount++; - NewBand->DeskBand = DeskBand.Detach(); - NewBand->OleWindow = OleWindow.Detach(); - NewBand->WndEvtHandler = WndEvtHandler.Detach(); - - /* Create the ReBar band */ - hRet = ObjWithSite->SetSite(static_cast<IOleWindow *>(this)); - if (SUCCEEDED(hRet)) - { - uBand = 0xffffffff; - if (SUCCEEDED(UpdateSingleBand(NewBand))) - { - if (NewBand->dbi.dwMask & DBIM_MODEFLAGS) - { - if (NewBand->dbi.dwModeFlags & DBIMF_ADDTOFRONT) - uBand = 0; - } - } - - BuildRebarBandInfo(NewBand, &rbi); - - if (SUCCEEDED(NewBand->OleWindow->GetWindow(&rbi.hwndChild)) && - rbi.hwndChild != NULL) - { - rbi.fMask |= RBBIM_CHILD; - WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild); - } - - if (!SendMessageW(fRebarWindow, RB_INSERTBANDW, (WPARAM)uBand, reinterpret_cast<LPARAM>(&rbi))) - return E_FAIL; - - hRet = (HRESULT)((USHORT)GetBandID(NewBand)); - } - else - { - WARN("IBandSite::AddBand(): Call to IDeskBand::SetSite() failed: %x\n", hRet); - - /* Remove the band from the ReBar control */ - BuildRebarBandInfo(NewBand, &rbi); - uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0); - if (uBand != (UINT)-1) - { - if (!SendMessageW(fRebarWindow, RB_DELETEBAND, (WPARAM)uBand, 0)) - { - ERR("Failed to delete band!\n"); - } - } - else - ERR("Failed to map band id to index!\n"); - - FreeBand(NewBand); - - hRet = E_FAIL; - /* goto Cleanup; */ - } - } -Cleanup: - return hRet; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::EnumBands(UINT uBand, DWORD *pdwBandID) -{ - DWORD i; - - TRACE("(%p, %u, %p)\n", this, uBand, pdwBandID); - - if (uBand == 0xffffffff) - return (UINT)fBandsCount; - - if (uBand >= (UINT)fBandsCount) - return E_FAIL; - - for (i = 0; i < (DWORD)fBandsAllocated; i++) - { - if (fBands[i].DeskBand != NULL) - { - if (uBand == 0) - { - *pdwBandID = i; - return S_OK; - } - - uBand--; - } - } - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryBand(DWORD dwBandID, IDeskBand **ppstb, - DWORD *pdwState, LPWSTR pszName, int cchName) -{ - struct BandObject *Band; - - TRACE("(%p, %u, %p, %p, %p, %d)\n", this, dwBandID, ppstb, pdwState, pszName, cchName); - - Band = GetBandByID(dwBandID); - if (Band == NULL) - return E_FAIL; - - if (ppstb != NULL) - { - Band->DeskBand->AddRef(); - *ppstb = Band->DeskBand; - } - - if (pdwState != NULL) - { - FIXME("IBandSite::QueryBand() requests band state!\n"); - *pdwState = 0; - } - - if (pszName != NULL && cchName > 0) - { - FIXME("IBandSite::QueryBand() requests band name!\n"); - pszName[0] = 0; - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState) -{ - struct BandObject *Band; - - TRACE("(%p, %u, %x, %x)\n", this, dwBandID, dwMask, dwState); - - Band = GetBandByID(dwBandID); - if (Band == NULL) - return E_FAIL; - - FIXME("Stub\n"); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::RemoveBand(DWORD dwBandID) -{ - struct BandObject *Band; - UINT uBand; - - TRACE("(%p, %u)\n", this, dwBandID); - - if (fRebarWindow == NULL) - return E_FAIL; - - Band = GetBandByID(dwBandID); - if (Band == NULL) - return E_FAIL; - - uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)GetBandID(Band), 0); - if (uBand != (UINT)-1) - { - if (!SendMessageW(fRebarWindow, RB_DELETEBAND, (WPARAM)uBand, 0)) - { - ERR("Could not delete band!\n"); - } - } - else - ERR("Could not map band id to index!\n"); - - FreeBand(Band); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv) -{ - struct BandObject *Band; - - TRACE("(%p, %u, %s, %p)\n", this, dwBandID, debugstr_guid(&riid), ppv); - - Band = GetBandByID(dwBandID); - if (Band == NULL) - { - *ppv = NULL; - return E_FAIL; - } - - return Band->DeskBand->QueryInterface(riid, ppv); -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandSiteInfo(const BANDSITEINFO *pbsinfo) -{ - FIXME("(%p, %p)\n", this, pbsinfo); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandSiteInfo(BANDSITEINFO *pbsinfo) -{ - FIXME("(%p, %p)\n", this, pbsinfo); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult) -{ - struct BandObject *Band; - - TRACE("(%p, %p, %u, %p, %p, %p)\n", this, hWnd, uMsg, wParam, lParam, plrResult); - - *plrResult = 0; - if (fRebarWindow == NULL) - return E_FAIL; - - if (hWnd == fRebarWindow) - { - /* FIXME: Just send the message? */ - *plrResult = SendMessageW(hWnd, uMsg, wParam, lParam); - return S_OK; - } - - Band = GetBandFromHwnd(hWnd); - if (Band != NULL) - { - return Band->WndEvtHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plrResult); - } - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::IsWindowOwner(HWND hWnd) -{ - struct BandObject *Band; - - TRACE("(%p, %p)\n", this, hWnd); - - if (fRebarWindow == NULL) - return E_FAIL; - - Band = GetBandFromHwnd(hWnd); - if (Band != NULL) - return S_OK; - - return S_FALSE; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetWindow(HWND *phWnd) -{ - TRACE("(%p, %p)\n", this, phWnd); - - *phWnd = fRebarWindow; - if (fRebarWindow != NULL) - return S_OK; - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::ContextSensitiveHelp(BOOL fEnterMode) -{ - FIXME("(%p, %d)\n", this, fEnterMode); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SetDeskBarSite(IUnknown *pUnk) -{ - HWND hWndParent; - HRESULT hRet; - DWORD style; - - TRACE("(%p, %p)\n", this, pUnk); - - fOleWindow.Release(); - - hRet = pUnk->QueryInterface(IID_PPV_ARG(IOleWindow, &fOleWindow)); - if (FAILED_UNEXPECTEDLY(hRet)) - return E_FAIL; - - hRet = fOleWindow->GetWindow(&hWndParent); - if (FAILED_UNEXPECTEDLY(hRet)) - return E_FAIL; - - style = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT | RBS_AUTOSIZE | - RBS_BANDBORDERS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN; - - fRebarWindow = CreateWindowExW(WS_EX_TOOLWINDOW, - REBARCLASSNAMEW, - NULL, - style, - 0, 0, 0, 0, - hWndParent, - NULL, - _AtlBaseModule.GetModuleInstance(), - NULL); - if (fRebarWindow == NULL) - { - fOleWindow.Release(); - WARN("IDeskbarClient::SetDeskBarSite() failed to create ReBar control!\n"); - return E_FAIL; - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SetModeDBC(DWORD dwMode) -{ - LONG dwStyle; - LONG dwPrevStyle; - - TRACE("(%p, %x)\n", this, dwMode); - - if (fRebarWindow == NULL) - return E_FAIL; - - dwStyle = dwPrevStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE); - if (dwMode & DBIF_VIEWMODE_VERTICAL) - dwStyle |= CCS_VERT; - - if (dwMode & ~DBIF_VIEWMODE_VERTICAL) - FIXME("IDeskBarClient::SetModeDBC() unhandled modes: %x\n", dwStyle & ~DBIF_VIEWMODE_VERTICAL); - - if (dwStyle != dwPrevStyle) - { - SetWindowLongPtr(fRebarWindow, GWL_STYLE, dwPrevStyle); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateDBC(DWORD dwState) -{ - TRACE("(%p, %x)\n", this, dwState); - - if (fRebarWindow == NULL) - return E_FAIL; - - ShowWindow(fRebarWindow, (dwState & DBC_SHOW) ? SW_SHOW : SW_HIDE); - //FIXME: Properly notify bands? - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSize(DWORD unknown1, LPRECT unknown2) -{ - FIXME("(%p, %x, %p)\n", this, unknown1, unknown2); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryStatus(const GUID *pguidCmdGroup, - DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText) -{ - FIXME("(%p, %p, %u, %p, %p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, - DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut) -{ - HRESULT hRet = S_OK; - - TRACE("(%p, %p, %u, %u, %p, %p)\n", this, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut); - - if (fRebarWindow == NULL) - return E_FAIL; - - if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand)) - { - switch (nCmdID) - { - case DBID_BANDINFOCHANGED: - if (pvaIn == NULL) - hRet = UpdateAllBands(); - else - { - /* Update a single band */ - if (pvaIn->n1.n2.vt == VT_I4) - hRet = UpdateBand(pvaIn->n1.n2.n3.lVal); - else - hRet = E_FAIL; - } - break; - - case DBID_SHOWONLY: - case DBID_MAXIMIZEBAND: - case DBID_PUSHCHEVRON: - FIXME("IOleCommandTarget::Exec(): Unsupported command ID %d\n", nCmdID); - return E_NOTIMPL; - default: - return E_FAIL; - } - return hRet; - } - else - WARN("IOleCommandTarget::Exec(): Unsupported command group GUID\n"); - - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateIO(BOOL fActivate, LPMSG lpMsg) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::HasFocusIO() -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::TranslateAcceleratorIO(LPMSG lpMsg) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::OnFocusChangeIS(struct IUnknown *paramC, int param10) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetClassID(CLSID *pClassID) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::IsDirty() -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::Load(IStream *pStm) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::Save(IStream *pStm, BOOL fClearDirty) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSizeMax(ULARGE_INTEGER *pcbSize) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::DragEnter( - IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::DragLeave() -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::LoadFromStreamBS(IStream *, const GUID &, void **) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SaveToStreamBS(IUnknown *, IStream *) -{ - return E_NOTIMPL; -} Removed: trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CBandSite.h (removed) @@ -1,149 +0,0 @@ -/* - * Rebar band site - * - * Copyright 2007 Hervé Poussineau - * Copyright 2009 Andrew Hill - * - * 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 - */ - -#pragma once - -class CBandSiteBase : - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IBandSite, - public IInputObjectSite, - public IInputObject, - public IDeskBarClient, - public IWinEventHandler, - public IPersistStream, - public IDropTarget, - public IServiceProvider, - public IBandSiteHelper, - public IOleCommandTarget -{ -private: - struct BandObject - { - IDeskBand *DeskBand; - IOleWindow *OleWindow; - IWinEventHandler *WndEvtHandler; - DESKBANDINFO dbi; - }; - - LONG fBandsCount; - LONG fBandsAllocated; - struct BandObject *fBands; - HWND fRebarWindow; - CComPtr<IOleWindow> fOleWindow; -public: - CBandSiteBase(); - ~CBandSiteBase(); - - // *** IBandSite methods *** - virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk); - virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID); - virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName); - virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState); - virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID); - virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv); - virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo); - virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo); - - // *** IWinEventHandler methods *** - virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult); - virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - - // *** IDeskBarClient methods *** - virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite); - virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode); - virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState); - virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc); - - // *** IOleCommandTarget methods *** - virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); - virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - - // *** IInputObject methods *** - virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg); - virtual HRESULT STDMETHODCALLTYPE HasFocusIO(); - virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg); - - // *** IInputObjectSite methods *** - virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(struct IUnknown *paramC, int param10); - - // *** IServiceProvider methods *** - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); - - // *** IPersist methods *** - virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID); - - // *** IPersistStream methods *** - virtual HRESULT STDMETHODCALLTYPE IsDirty(); - virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm); - virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty); - virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize); - - // *** IDropTarget methods *** - virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragLeave(); - virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); - - // *** IBandSiteHelper methods *** - virtual HRESULT STDMETHODCALLTYPE LoadFromStreamBS(IStream *, const GUID &, void **); - virtual HRESULT STDMETHODCALLTYPE SaveToStreamBS(IUnknown *, IStream *); - -private: - UINT GetBandID(struct BandObject *Band); - struct BandObject *GetBandByID(DWORD dwBandID); - void FreeBand(struct BandObject *Band); - DWORD GetBandSiteViewMode(); - VOID BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi); - HRESULT UpdateSingleBand(struct BandObject *Band); - HRESULT UpdateAllBands(); - HRESULT UpdateBand(DWORD dwBandID); - struct BandObject *GetBandFromHwnd(HWND hwnd); - - BEGIN_COM_MAP(CBandSiteBase) - COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite) - COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) - COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient) - COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) - COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) - COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) - COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) - COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) - COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) - COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) - COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper) - END_COM_MAP() -}; - -class CBandSite : - public CComCoClass<CBandSite, &CLSID_RebarBandSite>, - public CBandSiteBase -{ -public: - DECLARE_REGISTRY_RESOURCEID(IDR_REBARBANDSITE) - DECLARE_AGGREGATABLE(CBandSite) - - DECLARE_PROTECT_FINAL_CONSTRUCT() -}; Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/CMakeLists.txt [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -7,7 +7,6 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl) list(APPEND SOURCE - CBandSite.cpp CMenuBand.cpp CMenuDeskBar.cpp CMenuFocusManager.cpp Modified: trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
============================================================================== --- trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shellmenu/shellmenu.h [iso-8859-1] Sun Apr 9 15:10:08 2017 @@ -77,7 +77,6 @@ HRESULT WINAPI CMenuDeskBar_Constructor(REFIID riid, LPVOID *ppv); HRESULT WINAPI CMenuSite_Constructor(REFIID riid, LPVOID *ppv); HRESULT WINAPI CMenuBand_Constructor(REFIID riid, LPVOID *ppv); -HRESULT WINAPI CBandSite_Constructor(REFIID riid, LPVOID *ppv); HRESULT WINAPI CMergedFolder_Constructor(REFIID riid, LPVOID *ppv); }
7 years, 8 months
1
0
0
0
[gadamopoulos] 74292: [BROWSEUI] -Move the following classes to a new static lib called shellbars: CBandSite, CBandSiteMenu, CBaseBar, CSHEnumClassesOfCategories. - This will be linked to rshell in...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Sun Apr 9 13:51:39 2017 New Revision: 74292 URL:
http://svn.reactos.org/svn/reactos?rev=74292&view=rev
Log: [BROWSEUI] -Move the following classes to a new static lib called shellbars: CBandSite, CBandSiteMenu, CBaseBar, CSHEnumClassesOfCategories. - This will be linked to rshell in order to implement support for additional toolbars in the taskbar as well as floating toolbars. - In the future more classes will be added in this static lib including: CISFBand (which implements a dockable toolbar that shows the contents of a shell folder), CQuickLinks (a special CISFBand), CDeskBarApp (a special CBaseBar that implements the floating host for toolbars) and perhaps more. Added: trunk/reactos/dll/win32/browseui/shellbars/ trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp - copied, changed from r74291, trunk/reactos/dll/win32/browseui/bandsite.cpp trunk/reactos/dll/win32/browseui/shellbars/CBandSite.h - copied unchanged from r74291, trunk/reactos/dll/win32/browseui/bandsite.h trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp - copied, changed from r74291, trunk/reactos/dll/win32/browseui/bandsitemenu.cpp trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.h - copied unchanged from r74291, trunk/reactos/dll/win32/browseui/bandsitemenu.h trunk/reactos/dll/win32/browseui/shellbars/CBaseBar.cpp - copied, changed from r74291, trunk/reactos/dll/win32/browseui/basebar.cpp trunk/reactos/dll/win32/browseui/shellbars/CMakeLists.txt (with props) trunk/reactos/dll/win32/browseui/shellbars/CSHEnumClassesOfCategories.cpp - copied, changed from r74291, trunk/reactos/dll/win32/browseui/comcat.cpp trunk/reactos/dll/win32/browseui/shellbars/shellbars.h (with props) Removed: trunk/reactos/dll/win32/browseui/bandsite.cpp trunk/reactos/dll/win32/browseui/bandsite.h trunk/reactos/dll/win32/browseui/bandsitemenu.cpp trunk/reactos/dll/win32/browseui/bandsitemenu.h trunk/reactos/dll/win32/browseui/basebar.cpp trunk/reactos/dll/win32/browseui/comcat.cpp Modified: trunk/reactos/dll/win32/browseui/CMakeLists.txt trunk/reactos/dll/win32/browseui/browseui.cpp trunk/reactos/dll/win32/browseui/browseui.h trunk/reactos/dll/win32/browseui/precomp.h Modified: trunk/reactos/dll/win32/browseui/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/browseui/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/CMakeLists.txt [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -1,4 +1,6 @@ PROJECT(SHELL) + +add_subdirectory(shellbars) set_cpp(WITH_RUNTIME) @@ -11,9 +13,6 @@ addressband.cpp addresseditbox.cpp bandproxy.cpp - bandsite.cpp - bandsitemenu.cpp - basebar.cpp basebarsite.cpp brandband.cpp browseui.cpp @@ -31,7 +30,6 @@ travellog.cpp utility.cpp CProgressDialog.cpp - comcat.cpp precomp.h) add_library(browseui SHARED @@ -41,7 +39,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/browseui.def) set_module_type(browseui win32dll UNICODE) -target_link_libraries(browseui atlnew uuid wine) +target_link_libraries(browseui shellbars atlnew uuid wine) add_importlibs(browseui shlwapi shell32 comctl32 gdi32 ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll) add_pch(browseui precomp.h SOURCE) add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all) Removed: trunk/reactos/dll/win32/browseui/bandsite.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/bandsit…
============================================================================== --- trunk/reactos/dll/win32/browseui/bandsite.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/bandsite.cpp (removed) @@ -1,831 +0,0 @@ -/* - * Rebar band site - * - * Copyright 2007 Hervé Poussineau - * Copyright 2009 Andrew Hill - * - * 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 "precomp.h" - -#ifndef ASSERT -#define ASSERT(cond) \ - if (!(cond)) \ - ERR ("ASSERTION %s AT %s:%d FAILED!\n", #cond, __FILE__, __LINE__) -#endif - -CBandSiteBase::CBandSiteBase() -{ - fBandsCount = 0; - fBandsAllocated = 0; - fBands = NULL; - fRebarWindow = NULL; -} - -UINT CBandSiteBase::GetBandID(struct BandObject *Band) -{ - return (UINT)(Band - fBands); -} - -struct CBandSiteBase::BandObject *CBandSiteBase::GetBandByID(DWORD dwBandID) -{ - if ((LONG)dwBandID >= fBandsAllocated) - return NULL; - - if (fBands[dwBandID].DeskBand == NULL) - return NULL; - - return &fBands[dwBandID]; -} - -void CBandSiteBase::FreeBand(struct BandObject *Band) -{ - ATLASSERT(Band->DeskBand != NULL); - ATLASSERT(Band->OleWindow != NULL); - ATLASSERT(Band->WndEvtHandler != NULL); - Band->DeskBand->Release(); - Band->OleWindow->Release(); - Band->WndEvtHandler->Release(); - memset(Band, 0, sizeof(*Band)); - fBandsCount--; -} - -DWORD CBandSiteBase::GetBandSiteViewMode() -{ - DWORD dwStyle; - - /* FIXME: What about DBIF_VIEWMODE_FLOATING and DBIF_VIEWMODE_TRANSPARENT? */ - dwStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE); - - if (dwStyle & CCS_VERT) - return DBIF_VIEWMODE_VERTICAL; - else - return DBIF_VIEWMODE_NORMAL; -} - -VOID CBandSiteBase::BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi) -{ - ZeroMemory(prbi, sizeof(*prbi)); - prbi->cbSize = sizeof(*prbi); - - prbi->fMask = RBBIM_ID; - prbi->wID = GetBandID(Band); - - if (Band->dbi.dwMask & DBIM_MINSIZE) - { - prbi->fMask |= RBBIM_CHILDSIZE; - prbi->cxMinChild = Band->dbi.ptMinSize.x; - prbi->cyMinChild = Band->dbi.ptMinSize.y; - } - - if (Band->dbi.dwMask & DBIM_MAXSIZE) - { - prbi->fMask |= RBBIM_CHILDSIZE; - prbi->cyMaxChild = Band->dbi.ptMaxSize.y; - } - - if ((Band->dbi.dwMask & (DBIM_INTEGRAL | DBIM_MODEFLAGS)) == (DBIM_INTEGRAL | DBIM_MODEFLAGS) && - (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT)) - { - prbi->fMask |= RBBIM_CHILDSIZE; - prbi->cyIntegral = Band->dbi.ptIntegral.y; - } - - if (Band->dbi.dwMask & DBIM_ACTUAL) - { - prbi->fMask |= RBBIM_IDEALSIZE | RBBIM_SIZE | RBBIM_CHILDSIZE; - prbi->cxIdeal = Band->dbi.ptActual.x; - prbi->cx = Band->dbi.ptActual.x; - prbi->cyChild = Band->dbi.ptActual.y; - } - - if (Band->dbi.dwMask & DBIM_TITLE) - { - prbi->fMask |= RBBIM_TEXT; - prbi->lpText = Band->dbi.wszTitle; - prbi->cch = wcslen(Band->dbi.wszTitle); - } - - if (Band->dbi.dwMask & DBIM_MODEFLAGS) - { - prbi->fMask |= RBBIM_STYLE; - - if (Band->dbi.dwModeFlags & DBIMF_FIXED) - prbi->fStyle |= RBBS_FIXEDSIZE | RBBS_NOGRIPPER; - if (Band->dbi.dwModeFlags & DBIMF_FIXEDBMP) - prbi->fStyle |= RBBS_FIXEDBMP; - if (Band->dbi.dwModeFlags & DBIMF_VARIABLEHEIGHT) - prbi->fStyle |= RBBS_VARIABLEHEIGHT; - if (Band->dbi.dwModeFlags & DBIMF_DEBOSSED) - prbi->fStyle |= RBBS_CHILDEDGE; - if (Band->dbi.dwModeFlags & DBIMF_USECHEVRON) - prbi->fStyle |= RBBS_USECHEVRON; - if (Band->dbi.dwModeFlags & DBIMF_BREAK) - prbi->fStyle |= RBBS_BREAK; - if (Band->dbi.dwModeFlags & DBIMF_TOPALIGN) - prbi->fStyle |= RBBS_TOPALIGN; - if (Band->dbi.dwModeFlags & DBIMF_NOGRIPPER) - prbi->fStyle |= RBBS_NOGRIPPER; - if (Band->dbi.dwModeFlags & DBIMF_ALWAYSGRIPPER) - prbi->fStyle |= RBBS_GRIPPERALWAYS; - } - - if ((Band->dbi.dwMask & (DBIM_BKCOLOR | DBIM_MODEFLAGS)) == (DBIM_BKCOLOR | DBIM_MODEFLAGS) && - (Band->dbi.dwModeFlags & DBIMF_BKCOLOR)) - { - prbi->fMask |= RBBIM_COLORS; - prbi->clrFore = (COLORREF)(COLOR_WINDOWTEXT + 1); - prbi->clrBack = Band->dbi.crBkgnd; - } -} - -HRESULT CBandSiteBase::UpdateSingleBand(struct BandObject *Band) -{ - REBARBANDINFOW rbi; - DWORD dwViewMode; - UINT uBand; - HRESULT hRet; - - ZeroMemory(&Band->dbi, sizeof(Band->dbi)); - Band->dbi.dwMask = DBIM_MINSIZE | DBIM_MAXSIZE | DBIM_INTEGRAL | - DBIM_ACTUAL | DBIM_TITLE | DBIM_MODEFLAGS | DBIM_BKCOLOR; - - dwViewMode = GetBandSiteViewMode(); - - hRet = Band->DeskBand->GetBandInfo((DWORD)GetBandID(Band), dwViewMode, &Band->dbi); - if (SUCCEEDED(hRet)) - { - BuildRebarBandInfo(Band, &rbi); - if (SUCCEEDED(Band->OleWindow->GetWindow(&rbi.hwndChild)) && - rbi.hwndChild != NULL) - { - rbi.fMask |= RBBIM_CHILD; - WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild); - } - - uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0); - if (uBand != (UINT)-1) - { - if (!SendMessageW(fRebarWindow, RB_SETBANDINFOW, (WPARAM)uBand, reinterpret_cast<LPARAM>(&rbi))) - { - WARN("Failed to update the rebar band!\n"); - } - } - else - WARN("Failed to map rebar band id to index!\n"); - - } - - return hRet; -} - -HRESULT CBandSiteBase::UpdateAllBands() -{ - LONG i; - HRESULT hRet; - - for (i = 0; i < fBandsAllocated; i++) - { - if (fBands[i].DeskBand != NULL) - { - hRet = UpdateSingleBand(&fBands[i]); - if (FAILED_UNEXPECTEDLY(hRet)) - return hRet; - } - } - - return S_OK; -} - -HRESULT CBandSiteBase::UpdateBand(DWORD dwBandID) -{ - struct BandObject *Band; - - Band = GetBandByID(dwBandID); - if (Band == NULL) - return E_FAIL; - - return UpdateSingleBand(Band); -} - -struct CBandSiteBase::BandObject *CBandSiteBase::GetBandFromHwnd(HWND hwnd) -{ - HRESULT hRet; - HWND hWndBand; - LONG i; - - for (i = 0; i < fBandsAllocated; i++) - { - if (fBands[i].DeskBand != NULL) - { - ASSERT(fBands[i].OleWindow); - - hWndBand = NULL; - hRet = fBands[i].OleWindow->GetWindow(&hWndBand); - if (SUCCEEDED(hRet) && hWndBand == hwnd) - return &fBands[i]; - } - } - - return NULL; -} - -CBandSiteBase::~CBandSiteBase() -{ - - TRACE("destroying %p\n", this); - - if (fRebarWindow != NULL) - { - DestroyWindow(fRebarWindow); - fRebarWindow = NULL; - } - - if (fBands != NULL) - { - for (INT i = 0; i < fBandsAllocated; i++) - { - if (fBands[i].DeskBand != NULL) - FreeBand(&fBands[i]); - } - CoTaskMemFree(fBands); - fBands = NULL; - } -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk) -{ - LONG NewAllocated; - struct BandObject *NewBand = NULL; - CComPtr<IDeskBand> DeskBand; - CComPtr<IObjectWithSite> ObjWithSite; - CComPtr<IOleWindow> OleWindow; - CComPtr<IWinEventHandler> WndEvtHandler; - REBARBANDINFOW rbi; - HRESULT hRet; - UINT uBand; - - TRACE("(%p, %p)\n", this, punk); - - if (punk == NULL || fRebarWindow == NULL) - return E_FAIL; - - hRet = punk->QueryInterface(IID_PPV_ARG(IDeskBand, &DeskBand)); - if (!SUCCEEDED(hRet) || DeskBand == NULL) - goto Cleanup; - hRet = punk->QueryInterface(IID_PPV_ARG(IObjectWithSite, &ObjWithSite)); - if (!SUCCEEDED(hRet) || ObjWithSite == NULL) - goto Cleanup; - hRet = punk->QueryInterface(IID_PPV_ARG(IOleWindow, &OleWindow)); - if (!SUCCEEDED(hRet) || OleWindow == NULL) - goto Cleanup; - hRet = punk->QueryInterface(IID_PPV_ARG(IWinEventHandler, &WndEvtHandler)); - if (!SUCCEEDED(hRet) || WndEvtHandler == NULL) - goto Cleanup; - - hRet = S_OK; - if (fBandsAllocated > fBandsCount) - { - /* Search for a free band object */ - for (INT i = 0; i < fBandsAllocated; i++) - { - if (fBands[i].DeskBand == NULL) - { - NewBand = &fBands[i]; - break; - } - } - } - else if (fBandsAllocated > 0) - { - ASSERT (fBands != NULL); - - /* Reallocate the band object array */ - NewAllocated = fBandsAllocated + 8; - if (NewAllocated > 0xFFFF) - NewAllocated = 0xFFFF; - if (NewAllocated == fBandsAllocated) - { - hRet = E_OUTOFMEMORY; - goto Cleanup; - } - - - NewBand = static_cast<struct BandObject *>(CoTaskMemAlloc(NewAllocated * sizeof(struct BandObject))); - if (NewBand == NULL) - { - hRet = E_OUTOFMEMORY; - goto Cleanup; - } - - /* Copy the old array */ - memcpy(NewBand, fBands, fBandsAllocated * sizeof(struct BandObject)); - - /* Initialize the added bands */ - memset(&NewBand[fBandsAllocated], 0, (NewAllocated - fBandsAllocated) * sizeof(struct BandObject)); - - fBandsAllocated = NewAllocated; - CoTaskMemFree(fBands); - fBands = NewBand; - } - else - { - ASSERT(fBands == NULL); - ASSERT(fBandsAllocated == 0); - ASSERT(fBandsCount == 0); - - /* Allocate new array */ - fBands = static_cast<struct BandObject *>(CoTaskMemAlloc(8 * sizeof(struct BandObject))); - if (fBands == NULL) - { - hRet = E_OUTOFMEMORY; - goto Cleanup; - } - - /* Initialize the added bands */ - memset(fBands, 0, 8 * sizeof(struct BandObject)); - - fBandsAllocated += 8; - NewBand = &fBands[0]; - } - - if (SUCCEEDED(hRet)) - { - ASSERT(NewBand != NULL); - - fBandsCount++; - NewBand->DeskBand = DeskBand.Detach(); - NewBand->OleWindow = OleWindow.Detach(); - NewBand->WndEvtHandler = WndEvtHandler.Detach(); - - /* Create the ReBar band */ - hRet = ObjWithSite->SetSite(static_cast<IOleWindow *>(this)); - if (SUCCEEDED(hRet)) - { - uBand = 0xffffffff; - if (SUCCEEDED(UpdateSingleBand(NewBand))) - { - if (NewBand->dbi.dwMask & DBIM_MODEFLAGS) - { - if (NewBand->dbi.dwModeFlags & DBIMF_ADDTOFRONT) - uBand = 0; - } - } - - BuildRebarBandInfo(NewBand, &rbi); - - if (SUCCEEDED(NewBand->OleWindow->GetWindow(&rbi.hwndChild)) && - rbi.hwndChild != NULL) - { - rbi.fMask |= RBBIM_CHILD; - WARN ("ReBar band uses child window 0x%p\n", rbi.hwndChild); - } - - if (!SendMessageW(fRebarWindow, RB_INSERTBANDW, (WPARAM)uBand, reinterpret_cast<LPARAM>(&rbi))) - return E_FAIL; - - hRet = (HRESULT)((USHORT)GetBandID(NewBand)); - } - else - { - WARN("IBandSite::AddBand(): Call to IDeskBand::SetSite() failed: %x\n", hRet); - - /* Remove the band from the ReBar control */ - BuildRebarBandInfo(NewBand, &rbi); - uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0); - if (uBand != (UINT)-1) - { - if (!SendMessageW(fRebarWindow, RB_DELETEBAND, (WPARAM)uBand, 0)) - { - ERR("Failed to delete band!\n"); - } - } - else - ERR("Failed to map band id to index!\n"); - - FreeBand(NewBand); - - hRet = E_FAIL; - /* goto Cleanup; */ - } - } -Cleanup: - return hRet; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::EnumBands(UINT uBand, DWORD *pdwBandID) -{ - DWORD i; - - TRACE("(%p, %u, %p)\n", this, uBand, pdwBandID); - - if (uBand == 0xffffffff) - return (UINT)fBandsCount; - - if (uBand >= (UINT)fBandsCount) - return E_FAIL; - - for (i = 0; i < (DWORD)fBandsAllocated; i++) - { - if (fBands[i].DeskBand != NULL) - { - if (uBand == 0) - { - *pdwBandID = i; - return S_OK; - } - - uBand--; - } - } - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryBand(DWORD dwBandID, IDeskBand **ppstb, - DWORD *pdwState, LPWSTR pszName, int cchName) -{ - struct BandObject *Band; - - TRACE("(%p, %u, %p, %p, %p, %d)\n", this, dwBandID, ppstb, pdwState, pszName, cchName); - - Band = GetBandByID(dwBandID); - if (Band == NULL) - return E_FAIL; - - if (ppstb != NULL) - { - Band->DeskBand->AddRef(); - *ppstb = Band->DeskBand; - } - - if (pdwState != NULL) - { - FIXME("IBandSite::QueryBand() requests band state!\n"); - *pdwState = 0; - } - - if (pszName != NULL && cchName > 0) - { - FIXME("IBandSite::QueryBand() requests band name!\n"); - pszName[0] = 0; - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState) -{ - struct BandObject *Band; - - TRACE("(%p, %u, %x, %x)\n", this, dwBandID, dwMask, dwState); - - Band = GetBandByID(dwBandID); - if (Band == NULL) - return E_FAIL; - - FIXME("Stub\n"); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::RemoveBand(DWORD dwBandID) -{ - struct BandObject *Band; - UINT uBand; - - TRACE("(%p, %u)\n", this, dwBandID); - - if (fRebarWindow == NULL) - return E_FAIL; - - Band = GetBandByID(dwBandID); - if (Band == NULL) - return E_FAIL; - - uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)GetBandID(Band), 0); - if (uBand != (UINT)-1) - { - if (!SendMessageW(fRebarWindow, RB_DELETEBAND, (WPARAM)uBand, 0)) - { - ERR("Could not delete band!\n"); - } - } - else - ERR("Could not map band id to index!\n"); - - FreeBand(Band); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandObject(DWORD dwBandID, REFIID riid, VOID **ppv) -{ - struct BandObject *Band; - - TRACE("(%p, %u, %s, %p)\n", this, dwBandID, debugstr_guid(&riid), ppv); - - Band = GetBandByID(dwBandID); - if (Band == NULL) - { - *ppv = NULL; - return E_FAIL; - } - - return Band->DeskBand->QueryInterface(riid, ppv); -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SetBandSiteInfo(const BANDSITEINFO *pbsinfo) -{ - FIXME("(%p, %p)\n", this, pbsinfo); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetBandSiteInfo(BANDSITEINFO *pbsinfo) -{ - FIXME("(%p, %p)\n", this, pbsinfo); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plrResult) -{ - struct BandObject *Band; - - TRACE("(%p, %p, %u, %p, %p, %p)\n", this, hWnd, uMsg, wParam, lParam, plrResult); - - *plrResult = 0; - if (fRebarWindow == NULL) - return E_FAIL; - - if (hWnd == fRebarWindow) - { - /* FIXME: Just send the message? */ - *plrResult = SendMessageW(hWnd, uMsg, wParam, lParam); - return S_OK; - } - - Band = GetBandFromHwnd(hWnd); - if (Band != NULL) - { - return Band->WndEvtHandler->OnWinEvent(hWnd, uMsg, wParam, lParam, plrResult); - } - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::IsWindowOwner(HWND hWnd) -{ - struct BandObject *Band; - - TRACE("(%p, %p)\n", this, hWnd); - - if (fRebarWindow == NULL) - return E_FAIL; - - Band = GetBandFromHwnd(hWnd); - if (Band != NULL) - return S_OK; - - return S_FALSE; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetWindow(HWND *phWnd) -{ - TRACE("(%p, %p)\n", this, phWnd); - - *phWnd = fRebarWindow; - if (fRebarWindow != NULL) - return S_OK; - - return E_FAIL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::ContextSensitiveHelp(BOOL fEnterMode) -{ - FIXME("(%p, %d)\n", this, fEnterMode); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SetDeskBarSite(IUnknown *pUnk) -{ - HWND hWndParent; - HRESULT hRet; - DWORD style; - - TRACE("(%p, %p)\n", this, pUnk); - - fOleWindow.Release(); - - hRet = pUnk->QueryInterface(IID_PPV_ARG(IOleWindow, &fOleWindow)); - if (FAILED_UNEXPECTEDLY(hRet)) - return E_FAIL; - - hRet = fOleWindow->GetWindow(&hWndParent); - if (FAILED_UNEXPECTEDLY(hRet)) - return E_FAIL; - - style = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | RBS_VARHEIGHT | RBS_AUTOSIZE | - RBS_BANDBORDERS | CCS_NODIVIDER | CCS_NORESIZE | CCS_NOPARENTALIGN; - - fRebarWindow = CreateWindowExW(WS_EX_TOOLWINDOW, - REBARCLASSNAMEW, - NULL, - style, - 0, 0, 0, 0, - hWndParent, - NULL, - _AtlBaseModule.GetModuleInstance(), - NULL); - if (fRebarWindow == NULL) - { - fOleWindow.Release(); - WARN("IDeskbarClient::SetDeskBarSite() failed to create ReBar control!\n"); - return E_FAIL; - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SetModeDBC(DWORD dwMode) -{ - LONG dwStyle; - LONG dwPrevStyle; - - TRACE("(%p, %x)\n", this, dwMode); - - if (fRebarWindow == NULL) - return E_FAIL; - - dwStyle = dwPrevStyle = GetWindowLongPtr(fRebarWindow, GWL_STYLE); - if (dwMode & DBIF_VIEWMODE_VERTICAL) - dwStyle |= CCS_VERT; - - if (dwMode & ~DBIF_VIEWMODE_VERTICAL) - FIXME("IDeskBarClient::SetModeDBC() unhandled modes: %x\n", dwStyle & ~DBIF_VIEWMODE_VERTICAL); - - if (dwStyle != dwPrevStyle) - { - SetWindowLongPtr(fRebarWindow, GWL_STYLE, dwPrevStyle); - } - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateDBC(DWORD dwState) -{ - TRACE("(%p, %x)\n", this, dwState); - - if (fRebarWindow == NULL) - return E_FAIL; - - ShowWindow(fRebarWindow, (dwState & DBC_SHOW) ? SW_SHOW : SW_HIDE); - FIXME("IDeskBarClient::UIActivateDBC() Properly notify bands?\n"); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSize(DWORD unknown1, LPRECT unknown2) -{ - FIXME("(%p, %x, %p)\n", this, unknown1, unknown2); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryStatus(const GUID *pguidCmdGroup, - DWORD cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText) -{ - FIXME("(%p, %p, %u, %p, %p)\n", this, pguidCmdGroup, cCmds, prgCmds, pCmdText); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, - DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut) -{ - HRESULT hRet = S_OK; - - TRACE("(%p, %p, %u, %u, %p, %p)\n", this, pguidCmdGroup, nCmdID, nCmdExecOpt, pvaIn, pvaOut); - - if (fRebarWindow == NULL) - return E_FAIL; - - if (IsEqualIID(*pguidCmdGroup, IID_IDeskBand)) - { - switch (nCmdID) - { - case DBID_BANDINFOCHANGED: - if (pvaIn == NULL) - hRet = UpdateAllBands(); - else - { - /* Update a single band */ - if (pvaIn->n1.n2.vt == VT_I4) - hRet = UpdateBand(pvaIn->n1.n2.n3.lVal); - else - hRet = E_FAIL; - } - break; - - case DBID_SHOWONLY: - case DBID_MAXIMIZEBAND: - case DBID_PUSHCHEVRON: - FIXME("IOleCommandTarget::Exec(): Unsupported command ID %d\n", nCmdID); - return E_NOTIMPL; - default: - return E_FAIL; - } - return hRet; - } - else - WARN("IOleCommandTarget::Exec(): Unsupported command group GUID\n"); - - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::UIActivateIO(BOOL fActivate, LPMSG lpMsg) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::HasFocusIO() -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::TranslateAcceleratorIO(LPMSG lpMsg) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::OnFocusChangeIS(struct IUnknown *paramC, int param10) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetClassID(CLSID *pClassID) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::IsDirty() -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::Load(IStream *pStm) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::Save(IStream *pStm, BOOL fClearDirty) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::GetSizeMax(ULARGE_INTEGER *pcbSize) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::DragEnter( - IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::DragLeave() -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::LoadFromStreamBS(IStream *, const GUID &, void **) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteBase::SaveToStreamBS(IUnknown *, IStream *) -{ - return E_NOTIMPL; -} Removed: trunk/reactos/dll/win32/browseui/bandsite.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/bandsit…
============================================================================== --- trunk/reactos/dll/win32/browseui/bandsite.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/bandsite.h (removed) @@ -1,150 +0,0 @@ -/* - * Rebar band site - * - * Copyright 2007 Hervé Poussineau - * Copyright 2009 Andrew Hill - * - * 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 - */ - -#pragma once - -class CBandSiteBase : - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IBandSite, - public IInputObjectSite, - public IInputObject, - public IDeskBarClient, - public IWinEventHandler, - public IPersistStream, - public IDropTarget, - public IServiceProvider, - public IBandSiteHelper, - public IOleCommandTarget -{ -private: - struct BandObject - { - IDeskBand *DeskBand; - IOleWindow *OleWindow; - IWinEventHandler *WndEvtHandler; - DESKBANDINFO dbi; - }; - - LONG fBandsCount; - LONG fBandsAllocated; - struct BandObject *fBands; - HWND fRebarWindow; - CComPtr<IOleWindow> fOleWindow; -public: - CBandSiteBase(); - ~CBandSiteBase(); - - // *** IBandSite methods *** - virtual HRESULT STDMETHODCALLTYPE AddBand(IUnknown *punk); - virtual HRESULT STDMETHODCALLTYPE EnumBands(UINT uBand, DWORD *pdwBandID); - virtual HRESULT STDMETHODCALLTYPE QueryBand(DWORD dwBandID, IDeskBand **ppstb, DWORD *pdwState, LPWSTR pszName, int cchName); - virtual HRESULT STDMETHODCALLTYPE SetBandState(DWORD dwBandID, DWORD dwMask, DWORD dwState); - virtual HRESULT STDMETHODCALLTYPE RemoveBand(DWORD dwBandID); - virtual HRESULT STDMETHODCALLTYPE GetBandObject(DWORD dwBandID, REFIID riid, void **ppv); - virtual HRESULT STDMETHODCALLTYPE SetBandSiteInfo(const BANDSITEINFO *pbsinfo); - virtual HRESULT STDMETHODCALLTYPE GetBandSiteInfo(BANDSITEINFO *pbsinfo); - - // *** IWinEventHandler methods *** - virtual HRESULT STDMETHODCALLTYPE OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult); - virtual HRESULT STDMETHODCALLTYPE IsWindowOwner(HWND hWnd); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - - // *** IDeskBarClient methods *** - virtual HRESULT STDMETHODCALLTYPE SetDeskBarSite(IUnknown *punkSite); - virtual HRESULT STDMETHODCALLTYPE SetModeDBC(DWORD dwMode); - virtual HRESULT STDMETHODCALLTYPE UIActivateDBC(DWORD dwState); - virtual HRESULT STDMETHODCALLTYPE GetSize(DWORD dwWhich, LPRECT prc); - - // *** IOleCommandTarget methods *** - virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); - virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - - // *** IInputObject methods *** - virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg); - virtual HRESULT STDMETHODCALLTYPE HasFocusIO(); - virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg); - - // *** IInputObjectSite methods *** - virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(struct IUnknown *paramC, int param10); - - // *** IServiceProvider methods *** - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); - - // *** IPersist methods *** - virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID); - - // *** IPersistStream methods *** - virtual HRESULT STDMETHODCALLTYPE IsDirty(); - virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm); - virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty); - virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize); - - // *** IDropTarget methods *** - virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragLeave(); - virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); - - // *** IBandSiteHelper methods *** - virtual HRESULT STDMETHODCALLTYPE LoadFromStreamBS(IStream *, const GUID &, void **); - virtual HRESULT STDMETHODCALLTYPE SaveToStreamBS(IUnknown *, IStream *); - -private: - UINT GetBandID(struct BandObject *Band); - struct BandObject *GetBandByID(DWORD dwBandID); - void FreeBand(struct BandObject *Band); - DWORD GetBandSiteViewMode(); - VOID BuildRebarBandInfo(struct BandObject *Band, REBARBANDINFOW *prbi); - HRESULT UpdateSingleBand(struct BandObject *Band); - HRESULT UpdateAllBands(); - HRESULT UpdateBand(DWORD dwBandID); - struct BandObject *GetBandFromHwnd(HWND hwnd); - - BEGIN_COM_MAP(CBandSiteBase) - COM_INTERFACE_ENTRY_IID(IID_IBandSite, IBandSite) - COM_INTERFACE_ENTRY_IID(IID_IWinEventHandler, IWinEventHandler) - COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) - COM_INTERFACE_ENTRY_IID(IID_IDeskBarClient, IDeskBarClient) - COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) - COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) - COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) - COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) - COM_INTERFACE_ENTRY_IID(IID_IPersist, IPersist) - COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) - COM_INTERFACE_ENTRY_IID(IID_IDropTarget, IDropTarget) - COM_INTERFACE_ENTRY_IID(IID_IBandSiteHelper, IBandSiteHelper) - END_COM_MAP() -}; - -class CBandSite : - public CComCoClass<CBandSite, &CLSID_RebarBandSite>, - public CBandSiteBase -{ -public: - - DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITE) - DECLARE_AGGREGATABLE(CBandSite) - - DECLARE_PROTECT_FINAL_CONSTRUCT() -}; Removed: trunk/reactos/dll/win32/browseui/bandsitemenu.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/bandsit…
============================================================================== --- trunk/reactos/dll/win32/browseui/bandsitemenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/bandsitemenu.cpp (removed) @@ -1,96 +0,0 @@ -/* - * Band site menu - * - * Copyright 2007 Hervé Poussineua - * Copyright 2009 Andrew Hill - * - * 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 "precomp.h" - -CBandSiteMenu::CBandSiteMenu() -{ -} - -CBandSiteMenu::~CBandSiteMenu() -{ -} - -HRESULT STDMETHODCALLTYPE CBandSiteMenu::SetOwner(IUnknown *pOwner) -{ - TRACE("CBandSiteMenu::SetOwner(%p, %p)\n", this, pOwner); - m_Owner = pOwner; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteMenu::QueryContextMenu( - HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) -{ - BOOL ret; - - TRACE("CBandSiteMenu::QueryContextMenu(%p, %p, %u, %u, %u, 0x%x)\n", this, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); - - HMENU hm = LoadMenuW(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCEW(IDM_TASKBAR_TOOLBARS)); - if (!hm) - return HRESULT_FROM_WIN32(GetLastError()); - - MENUITEMINFOW mii = { 0 }; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STATE | MIIM_STRING | MIIM_SUBMENU; - ret = GetMenuItemInfoW(hm, 0, TRUE, &mii); - if (!hm) - return HRESULT_FROM_WIN32(GetLastError()); - - mii.dwTypeData = new WCHAR[mii.cch + 1]; - mii.cch = mii.cch + 1; - - ret = GetMenuItemInfoW(hm, 0, TRUE, &mii); - if (!hm) - return HRESULT_FROM_WIN32(GetLastError()); - - ret = InsertMenuItemW(hmenu, 0, TRUE, &mii); - - delete[] mii.dwTypeData; - - RemoveMenu(hm, 0, MF_BYPOSITION); - - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) -{ - FIXME("CBandSiteMenu::InvokeCommand is UNIMPLEMENTED (%p, %p)\n", this, lpici); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBandSiteMenu::GetCommandString(UINT_PTR idCmd, UINT uType, - UINT *pwReserved, LPSTR pszName, UINT cchMax) -{ - FIXME("CBandSiteMenu::GetCommandString is UNIMPLEMENTED (%p, %p, %u, %p, %p, %u)\n", this, idCmd, uType, pwReserved, pszName, cchMax); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteMenu::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - FIXME("CBandSiteMenu::HandleMenuMsg is UNIMPLEMENTED (%p, %u, %p, %p)\n", this, uMsg, wParam, lParam); - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBandSiteMenu::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) -{ - FIXME("CBandSiteMenu::HandleMenuMsg2 is UNIMPLEMENTED(%p, %u, %p, %p, %p)\n", this, uMsg, wParam, lParam, plResult); - return E_NOTIMPL; -} Removed: trunk/reactos/dll/win32/browseui/bandsitemenu.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/bandsit…
============================================================================== --- trunk/reactos/dll/win32/browseui/bandsitemenu.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/bandsitemenu.h (removed) @@ -1,60 +0,0 @@ -/* - * Band site menu - * - * Copyright 2007 Hervé Poussineua - * Copyright 2009 Andrew Hill - * - * 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 - */ - -#pragma once - -// oddly, this class also responds to QueryInterface for CLSID_BandSiteMenu by returning the vtable at offset 0 -class CBandSiteMenu : - public CComCoClass<CBandSiteMenu, &CLSID_BandSiteMenu>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IContextMenu3, - public IShellService -{ - CComPtr<IUnknown> m_Owner; -public: - CBandSiteMenu(); - ~CBandSiteMenu(); - - // *** IShellService methods *** - virtual HRESULT STDMETHODCALLTYPE SetOwner(IUnknown *); - - // *** IContextMenu methods *** - virtual HRESULT STDMETHODCALLTYPE QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); - virtual HRESULT STDMETHODCALLTYPE InvokeCommand(LPCMINVOKECOMMANDINFO lpici); - virtual HRESULT STDMETHODCALLTYPE GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax); - - // *** IContextMenu2 methods *** - virtual HRESULT STDMETHODCALLTYPE HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam); - - // *** IContextMenu3 methods *** - virtual HRESULT STDMETHODCALLTYPE HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult); - - DECLARE_REGISTRY_RESOURCEID(IDR_BANDSITEMENU) - DECLARE_NOT_AGGREGATABLE(CBandSiteMenu) - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - BEGIN_COM_MAP(CBandSiteMenu) - COM_INTERFACE_ENTRY_IID(IID_IShellService, IShellService) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) - END_COM_MAP() -}; Removed: trunk/reactos/dll/win32/browseui/basebar.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/basebar…
============================================================================== --- trunk/reactos/dll/win32/browseui/basebar.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/basebar.cpp (removed) @@ -1,558 +0,0 @@ -/* - * ReactOS Explorer - * - * Copyright 2009 Andrew Hill <ash77 at domain
reactos.org
> - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* -This class knows how to contain base bar site in a cabinet window. -*/ - -#include "precomp.h" - -/* -Base bar that contains a vertical or horizontal explorer band. It also -provides resizing abilities. -*/ -/* -TODO: - **Make base bar support resizing -- almost done (need to support integral ?) - Add context menu for base bar - Fix base bar to correctly initialize fVertical field - Fix base bar to correctly reposition its base bar site when resized -- done ? -*/ - -class CBaseBar : - public CWindowImpl<CBaseBar, CWindow, CControlWinTraits>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IInputObjectSite, - public IOleCommandTarget, - public IServiceProvider, - public IInputObject, - public IDeskBar, - public IDockingWindow, - public IPersistStream, - public IPersistStreamInit, - public IPersistPropertyBag, - public IObjectWithSite -{ -private: - CComPtr<IUnknown> fSite; - CComPtr<IUnknown> fClient; - HWND fClientWindow; - bool fVertical; - bool fVisible; - int fNeededSize; // width or height - - // used by resize tracking loop - bool fTracking; - POINT fLastLocation; -public: - CBaseBar(); - ~CBaseBar(); - HRESULT Initialize(BOOL); - -public: - HRESULT ReserveBorderSpace(); - - // *** IOleWindow methods *** - virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND *lphwnd); - virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode); - - // *** IInputObjectSite specific methods *** - virtual HRESULT STDMETHODCALLTYPE OnFocusChangeIS(IUnknown *punkObj, BOOL fSetFocus); - - // *** IOleCommandTarget specific methods *** - virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, - OLECMD prgCmds[ ], OLECMDTEXT *pCmdText); - virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, - DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); - - // *** IServiceProvider methods *** - virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppvObject); - - // *** IInputObject methods *** - // forward the methods to the contained active bar - virtual HRESULT STDMETHODCALLTYPE UIActivateIO(BOOL fActivate, LPMSG lpMsg); - virtual HRESULT STDMETHODCALLTYPE HasFocusIO(); - virtual HRESULT STDMETHODCALLTYPE TranslateAcceleratorIO(LPMSG lpMsg); - - // *** IDeskBar methods *** - virtual HRESULT STDMETHODCALLTYPE SetClient(IUnknown *punkClient); - virtual HRESULT STDMETHODCALLTYPE GetClient(IUnknown **ppunkClient); - virtual HRESULT STDMETHODCALLTYPE OnPosRectChangeDB(LPRECT prc); - - // *** IDockingWindow methods *** - virtual HRESULT STDMETHODCALLTYPE ShowDW(BOOL fShow); - virtual HRESULT STDMETHODCALLTYPE CloseDW(DWORD dwReserved); - virtual HRESULT STDMETHODCALLTYPE ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved); - - // *** IObjectWithSite methods *** - virtual HRESULT STDMETHODCALLTYPE SetSite(IUnknown *pUnkSite); - virtual HRESULT STDMETHODCALLTYPE GetSite(REFIID riid, void **ppvSite); - - // *** IPersist methods *** - virtual HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID); - - // *** IPersistStream methods *** - virtual HRESULT STDMETHODCALLTYPE IsDirty(); - virtual HRESULT STDMETHODCALLTYPE Load(IStream *pStm); - virtual HRESULT STDMETHODCALLTYPE Save(IStream *pStm, BOOL fClearDirty); - virtual HRESULT STDMETHODCALLTYPE GetSizeMax(ULARGE_INTEGER *pcbSize); - - // *** IPersistStreamInit methods *** - virtual HRESULT STDMETHODCALLTYPE InitNew(); - - // *** IPersistPropertyBag methods *** - virtual HRESULT STDMETHODCALLTYPE Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog); - virtual HRESULT STDMETHODCALLTYPE Save(IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties); - - // message handlers - LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnCancelMode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - LRESULT OnCaptureChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); - -DECLARE_WND_CLASS_EX(_T("BaseBar"), 0, COLOR_3DFACE) - -BEGIN_MSG_MAP(CBaseBar) - MESSAGE_HANDLER(WM_SIZE, OnSize) - MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) - MESSAGE_HANDLER(WM_NOTIFY, OnNotify) - MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) - MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp) - MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove) - MESSAGE_HANDLER(WM_CANCELMODE, OnCancelMode) - MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged) -END_MSG_MAP() - -BEGIN_COM_MAP(CBaseBar) - COM_INTERFACE_ENTRY2_IID(IID_IOleWindow, IOleWindow, IDockingWindow) - COM_INTERFACE_ENTRY_IID(IID_IInputObjectSite, IInputObjectSite) - COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) - COM_INTERFACE_ENTRY_IID(IID_IServiceProvider, IServiceProvider) - COM_INTERFACE_ENTRY_IID(IID_IInputObject, IInputObject) - COM_INTERFACE_ENTRY_IID(IID_IDeskBar, IDeskBar) - COM_INTERFACE_ENTRY_IID(IID_IDockingWindow, IDockingWindow) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) - COM_INTERFACE_ENTRY2_IID(IID_IPersist, IPersist, IPersistStream) - COM_INTERFACE_ENTRY_IID(IID_IPersistStream, IPersistStream) - COM_INTERFACE_ENTRY_IID(IID_IPersistStreamInit, IPersistStreamInit) - COM_INTERFACE_ENTRY_IID(IID_IPersistPropertyBag, IPersistPropertyBag) -END_COM_MAP() -}; - -CBaseBar::CBaseBar() -{ - fClientWindow = NULL; - fVertical = true; - fVisible = false; - fNeededSize = 200; - fTracking = false; -} - -CBaseBar::~CBaseBar() -{ -} - -HRESULT CBaseBar::Initialize(BOOL vert) -{ - fVertical = (vert == TRUE); - return S_OK; -} - -HRESULT CBaseBar::ReserveBorderSpace() -{ - CComPtr<IDockingWindowSite> dockingWindowSite; - RECT availableBorderSpace; - RECT neededBorderSpace; - HRESULT hResult; - - hResult = fSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite, &dockingWindowSite)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - hResult = dockingWindowSite->GetBorderDW(static_cast<IDeskBar *>(this), &availableBorderSpace); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - memset(&neededBorderSpace, 0, sizeof(neededBorderSpace)); - if (fVisible) - { - if (fVertical) - neededBorderSpace.left = fNeededSize + GetSystemMetrics(SM_CXFRAME); - else - neededBorderSpace.bottom = fNeededSize + GetSystemMetrics(SM_CXFRAME); - } - hResult = dockingWindowSite->SetBorderSpaceDW(static_cast<IDeskBar *>(this), &neededBorderSpace); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - return S_OK; -} - -// current bar size is stored in the registry under -// key=HKCU\Software\Microsoft\Internet Explorer\Explorer Bars -// value=current bar GUID -// result is 8 bytes of binary data, 2 longs. First is the size, second is reserved and will always be 0 -/*HRESULT CBaseBar::StopCurrentBar() -{ - CComPtr<IOleCommandTarget> commandTarget; - HRESULT hResult; - - if (fCurrentBar.p != NULL) - { - hResult = fCurrentBar->QueryInterface(IID_IOleCommandTarget, (void **)&commandTarget); - hResult = commandTarget->Exec(NULL, 0x17, 0, NULL, NULL); - } - // hide the current bar - memcpy(&fCurrentActiveClass, &GUID_NULL, sizeof(fCurrentActiveClass)); - return S_OK; -}*/ - -HRESULT STDMETHODCALLTYPE CBaseBar::GetWindow(HWND *lphwnd) -{ - if (lphwnd == NULL) - return E_POINTER; - *lphwnd = m_hWnd; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::ContextSensitiveHelp(BOOL fEnterMode) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::OnFocusChangeIS (IUnknown *punkObj, BOOL fSetFocus) -{ - return IUnknown_OnFocusChangeIS(fSite, punkObj, fSetFocus); -} - -HRESULT STDMETHODCALLTYPE CBaseBar::QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, - OLECMD prgCmds[ ], OLECMDTEXT *pCmdText) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::Exec(const GUID *pguidCmdGroup, DWORD nCmdID, - DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut) -{ - if (IsEqualIID(*pguidCmdGroup, CGID_Explorer)) - { - // pass through to the explorer ? - } - else if (IsEqualIID(*pguidCmdGroup, IID_IDeskBarClient)) - { - switch (nCmdID) - { - case 0: - // hide current band - break; - case 2: - // switch bands - break; - case 3: - break; - } - } - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::QueryService(REFGUID guidService, REFIID riid, void **ppvObject) -{ - CComPtr<IServiceProvider> serviceProvider; - HRESULT hResult; - - if (fSite == NULL) - return E_FAIL; - hResult = fSite->QueryInterface(IID_PPV_ARG(IServiceProvider, &serviceProvider)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - // called for SID_STopLevelBrowser, IID_IBrowserService to find top level browser - // called for SID_IWebBrowserApp, IID_IConnectionPointContainer - // connection point called for DIID_DWebBrowserEvents2 to establish connection - return serviceProvider->QueryService(guidService, riid, ppvObject); -} - -HRESULT STDMETHODCALLTYPE CBaseBar::UIActivateIO(BOOL fActivate, LPMSG lpMsg) -{ - return IUnknown_UIActivateIO(fClient, fActivate, lpMsg); -} - -HRESULT STDMETHODCALLTYPE CBaseBar::HasFocusIO() -{ - return IUnknown_HasFocusIO(fClient); -} - -HRESULT STDMETHODCALLTYPE CBaseBar::TranslateAcceleratorIO(LPMSG lpMsg) -{ - return IUnknown_TranslateAcceleratorIO(fClient, lpMsg); -} - -HRESULT STDMETHODCALLTYPE CBaseBar::SetClient(IUnknown *punkClient) -{ - CComPtr<IOleWindow> oleWindow; - HWND ownerWindow; - HRESULT hResult; - - /* Clean up old client */ - fClient = NULL; - - if (punkClient) - { - hResult = punkClient->QueryInterface(IID_PPV_ARG(IUnknown, &fClient)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - hResult = fSite->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow)); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - hResult = oleWindow->GetWindow(&ownerWindow); - if (FAILED_UNEXPECTEDLY(hResult)) - return hResult; - Create(ownerWindow, 0, NULL, - WS_VISIBLE | WS_CHILDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, WS_EX_TOOLWINDOW); - ReserveBorderSpace(); - } - else - { - DestroyWindow(); - } - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::GetClient(IUnknown **ppunkClient) -{ - if (ppunkClient == NULL) - return E_POINTER; - *ppunkClient = fClient; - if (fClient.p != NULL) - fClient.p->AddRef(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::OnPosRectChangeDB(LPRECT prc) -{ - if (prc == NULL) - return E_POINTER; - if (fVertical) - fNeededSize = prc->right - prc->left; - else - fNeededSize = prc->bottom - prc->top; - ReserveBorderSpace(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::ShowDW(BOOL fShow) -{ - fVisible = fShow ? true : false; - ShowWindow(fShow); - ReserveBorderSpace(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::CloseDW(DWORD dwReserved) -{ - ShowDW(0); - // Detach from our client - SetClient(NULL); - // Destroy our site - SetSite(NULL); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::ResizeBorderDW(LPCRECT prcBorder, IUnknown *punkToolbarSite, BOOL fReserved) -{ - ReserveBorderSpace(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::SetSite(IUnknown *pUnkSite) -{ - fSite = pUnkSite; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::GetSite(REFIID riid, void **ppvSite) -{ - if (ppvSite == NULL) - return E_POINTER; - *ppvSite = fSite; - if (fSite.p != NULL) - fSite.p->AddRef(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::GetClassID(CLSID *pClassID) -{ - if (pClassID == NULL) - return E_POINTER; - // TODO: what class to return here? - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::IsDirty() -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::Load(IStream *pStm) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::Save(IStream *pStm, BOOL fClearDirty) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::GetSizeMax(ULARGE_INTEGER *pcbSize) -{ - if (pcbSize == NULL) - return E_POINTER; - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::InitNew() -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::Load(IPropertyBag *pPropBag, IErrorLog *pErrorLog) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CBaseBar::Save(IPropertyBag *pPropBag, BOOL fClearDirty, BOOL fSaveAllProperties) -{ - return E_NOTIMPL; -} - -LRESULT CBaseBar::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - DWORD dwWidth; - DWORD dwHeight; - CComPtr<IOleWindow> pClient; - HWND clientHwnd; - HRESULT hr; - - if (fVisible) - { - dwWidth = LOWORD(lParam); - dwHeight = HIWORD(lParam); - - // substract resizing grips to child's window size - if (fVertical) - dwWidth -= GetSystemMetrics(SM_CXFRAME); - else - dwHeight -= GetSystemMetrics(SM_CXFRAME); - hr = fClient->QueryInterface(IID_PPV_ARG(IOleWindow, &pClient)); - if (FAILED_UNEXPECTEDLY(hr)) - return 0; - hr = pClient->GetWindow(&clientHwnd); - if (FAILED_UNEXPECTEDLY(hr)) - return 0; - ::SetWindowPos(clientHwnd, NULL, 0, (fVertical) ? 0 : GetSystemMetrics(SM_CXFRAME), dwWidth, dwHeight, NULL); - bHandled = TRUE; - } - return 0; -} - -LRESULT CBaseBar::OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - if ((short)lParam != HTCLIENT || (HWND)wParam != m_hWnd) - { - bHandled = FALSE; - return 0; - } - if (fVertical) - SetCursor(LoadCursor(NULL, IDC_SIZEWE)); - else - SetCursor(LoadCursor(NULL, IDC_SIZENS)); - return 1; -} - -LRESULT CBaseBar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - CComPtr<IWinEventHandler> winEventHandler; - LRESULT result; - HRESULT hResult; - - result = 0; - if (fClient.p != NULL) - { - hResult = fClient->QueryInterface(IID_PPV_ARG(IWinEventHandler, &winEventHandler)); - if (SUCCEEDED(hResult) && winEventHandler.p != NULL) - hResult = winEventHandler->OnWinEvent(NULL, uMsg, wParam, lParam, &result); - } - return result; -} - -LRESULT CBaseBar::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - SetCapture(); - fTracking = true; - fLastLocation.x = (short)LOWORD(lParam); - fLastLocation.y = (short)HIWORD(lParam); - return 0; -} - -LRESULT CBaseBar::OnLButtonUp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - ReleaseCapture(); - fTracking = false; - return 0; -} - -LRESULT CBaseBar::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - POINT newLocation; - int delta; - - if (fTracking) - { - newLocation.x = (short)LOWORD(lParam); - newLocation.y = (short)HIWORD(lParam); - if (fVertical) - delta = newLocation.x - fLastLocation.x; - else - delta = fLastLocation.y - newLocation.y; - if (fNeededSize + delta < 0) - return 0; - fNeededSize += delta; - fLastLocation = newLocation; - ReserveBorderSpace(); - } - return 0; -} - -LRESULT CBaseBar::OnCancelMode(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - fTracking = false; - return 0; -} - -LRESULT CBaseBar::OnCaptureChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) -{ - fTracking = false; - return 0; -} - -HRESULT CBaseBar_CreateInstance(REFIID riid, void **ppv, BOOL vertical) -{ - return ShellObjectCreatorInit<CBaseBar, BOOL>(vertical, riid, ppv); -} Modified: trunk/reactos/dll/win32/browseui/browseui.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/browseu…
============================================================================== --- trunk/reactos/dll/win32/browseui/browseui.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/browseui.cpp [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -19,6 +19,106 @@ */ #include "precomp.h" + + +HRESULT CAddressBand_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_ADDRESSBAND + return ShellObjectCreator<CAddressBand>(riid, ppv); +#else + return CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, toolsBar)); +#endif +} + +HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_ADDRESSEDITBOX + return ShellObjectCreator<CAddressEditBox>(riid, ppv); +#else + return CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); +#endif +} + +HRESULT CBandProxy_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_BANDPROXY + return ShellObjectCreator<CBandProxy>(riid, ppv); +#else + return CoCreateInstance(CLSID_BandProxy, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); +#endif +} + +HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_BRANDBAND + return ShellObjectCreator<CBrandBand>(riid, ppv); +#else + return CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); +#endif +} + +HRESULT CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv) +{ +#if USE_CUSTOM_EXPLORERBAND + return ShellObjectCreator<CExplorerBand>(riid, ppv); +#else + return CoCreateInstance(CLSID_ExplorerBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); +#endif +} + +HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_INTERNETTOOLBAR + return ShellObjectCreator<CInternetToolbar>(riid, ppv); +#else + return CoCreateInstance(CLSID_InternetToolbar, NULL, CLSCTX_INPROC_SERVER, riid, ppv); +#endif +} + +typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv); +typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(REFIID riid, void **ppv); + +HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv) +{ +#if USE_CUSTOM_MERGEDFOLDER + HMODULE hRShell = GetModuleHandle(L"rshell.dll"); + if (!hRShell) + hRShell = LoadLibrary(L"rshell.dll"); + + if (hRShell) + { + PMERGEDFOLDER_CONSTRUCTOR pCMergedFolder_Constructor = (PMERGEDFOLDER_CONSTRUCTOR) + GetProcAddress(hRShell, "CMergedFolder_Constructor"); + + if (pCMergedFolder_Constructor) + { + return pCMergedFolder_Constructor(riid, ppv); + } + } +#endif + return CoCreateInstance(CLSID_MergedFolder, NULL, CLSCTX_INPROC_SERVER, riid, ppv); +} + +HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv) +{ +#if USE_CUSTOM_MENUBAND + HMODULE hRShell = GetModuleHandleW(L"rshell.dll"); + + if (!hRShell) + hRShell = LoadLibraryW(L"rshell.dll"); + + if (hRShell) + { + PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hRShell, "CMenuBand_Constructor"); + if (func) + { + return func(iid , ppv); + } + } +#endif + return CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, iid, ppv); +} + class CBrowseUIModule : public CComModule { Modified: trunk/reactos/dll/win32/browseui/browseui.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/browseu…
============================================================================== --- trunk/reactos/dll/win32/browseui/browseui.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/browseui.h [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -9,115 +9,16 @@ #define USE_CUSTOM_EXPLORERBAND 1 #define USE_CUSTOM_INTERNETTOOLBAR 1 -/* Constructors for the classes that are not exported */ +HRESULT CAddressBand_CreateInstance(REFIID riid, void **ppv); +HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv); +HRESULT CBandProxy_CreateInstance(REFIID riid, void **ppv); +HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv); +HRESULT CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv); +HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv); +HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv); +HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv); HRESULT CShellBrowser_CreateInstance(LPITEMIDLIST pidl, DWORD dwFlags, REFIID riid, void **ppv); HRESULT CTravelLog_CreateInstance(REFIID riid, void **ppv); HRESULT CBaseBar_CreateInstance(REFIID riid, void **ppv, BOOL vertical); HRESULT CBaseBarSite_CreateInstance(REFIID riid, void **ppv, BOOL bVertical); HRESULT CToolsBand_CreateInstance(REFIID riid, void **ppv); - -static inline -HRESULT CAddressBand_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_ADDRESSBAND - return ShellObjectCreator<CAddressBand>(riid, ppv); -#else - return CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(IUnknown, toolsBar)); -#endif -} - -static inline -HRESULT CAddressEditBox_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_ADDRESSEDITBOX - return ShellObjectCreator<CAddressEditBox>(riid, ppv); -#else - return CoCreateInstance(CLSID_AddressEditBox, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); -#endif -} - -static inline -HRESULT CBandProxy_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_BANDPROXY - return ShellObjectCreator<CBandProxy>(riid, ppv); -#else - return CoCreateInstance(CLSID_BandProxy, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARG(riid, &ppv)); -#endif -} - -static inline -HRESULT CBrandBand_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_BRANDBAND - return ShellObjectCreator<CBrandBand>(riid, ppv); -#else - return CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); -#endif -} - -static inline -HRESULT WINAPI CExplorerBand_CreateInstance(REFIID riid, LPVOID *ppv) -{ -#if USE_CUSTOM_EXPLORERBAND - return ShellObjectCreator<CExplorerBand>(riid, ppv); -#else - return CoCreateInstance(CLSID_ExplorerBand, NULL, CLSCTX_INPROC_SERVER, riid, ppv); -#endif -} - -static inline -HRESULT CInternetToolbar_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_INTERNETTOOLBAR - return ShellObjectCreator<CInternetToolbar>(riid, ppv); -#else - return CoCreateInstance(CLSID_InternetToolbar, NULL, CLSCTX_INPROC_SERVER, riid, ppv); -#endif -} - -typedef HRESULT(WINAPI * PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv); -typedef HRESULT(WINAPI * PMERGEDFOLDER_CONSTRUCTOR)(REFIID riid, void **ppv); - -static inline -HRESULT CMergedFolder_CreateInstance(REFIID riid, void **ppv) -{ -#if USE_CUSTOM_MERGEDFOLDER - HMODULE hRShell = GetModuleHandle(L"rshell.dll"); - if (!hRShell) - hRShell = LoadLibrary(L"rshell.dll"); - - if (hRShell) - { - PMERGEDFOLDER_CONSTRUCTOR pCMergedFolder_Constructor = (PMERGEDFOLDER_CONSTRUCTOR) - GetProcAddress(hRShell, "CMergedFolder_Constructor"); - - if (pCMergedFolder_Constructor) - { - return pCMergedFolder_Constructor(riid, ppv); - } - } -#endif - return CoCreateInstance(CLSID_MergedFolder, NULL, CLSCTX_INPROC_SERVER, riid, ppv); -} - -static inline -HRESULT CMenuBand_CreateInstance(REFIID iid, LPVOID *ppv) -{ -#if USE_CUSTOM_MENUBAND - HMODULE hRShell = GetModuleHandleW(L"rshell.dll"); - - if (!hRShell) - hRShell = LoadLibraryW(L"rshell.dll"); - - if (hRShell) - { - PMENUBAND_CONSTRUCTOR func = (PMENUBAND_CONSTRUCTOR) GetProcAddress(hRShell, "CMenuBand_Constructor"); - if (func) - { - return func(iid , ppv); - } - } -#endif - return CoCreateInstance(CLSID_MenuBand, NULL, CLSCTX_INPROC_SERVER, iid, ppv); -} Removed: trunk/reactos/dll/win32/browseui/comcat.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/comcat.…
============================================================================== --- trunk/reactos/dll/win32/browseui/comcat.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/comcat.cpp (removed) @@ -1,335 +0,0 @@ -/* - * ReactOS Explorer - * - * Copyright 2016 Sylvain Deverre <deverre dot sylv at gmail dot com> - * - * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Wraps the component categories manager enum - */ - -#include "precomp.h" - -#define REGPATH L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Discardable\\PostSetup\\Component Categories" -#define IMPLEMENTING L"Implementing" -#define REQUIRING L"Requiring" - -typedef struct categoryCacheHeader -{ - DWORD dwSize; // size of header only - DWORD version; // currently 1 - SYSTEMTIME writeTime; // time we were written to registry - DWORD classCount; // number of classes following -} CATCACHEHDR, *PCATCACHEHDR; - -/* - * This class manages a cached explorer component categories items, writing cache if it - * doesn't exist yet. - * It is used by CSHEnumClassesOfCategories internally. - */ -class CComCatCachedCategory -{ - public: - CComCatCachedCategory(); - virtual ~CComCatCachedCategory(); - HRESULT WriteCacheToDSA(HDSA pDest); - HRESULT STDMETHODCALLTYPE Initialize(CATID &catID, BOOL reloadCache); - private: - BOOL LoadFromRegistry(); - HRESULT LoadFromComCatMgr(); - HRESULT CacheDSA(); - CATID fCategory; - HDSA fLocalDsa; -}; - -CComCatCachedCategory::CComCatCachedCategory() -{ - fLocalDsa = DSA_Create(sizeof(GUID), 5); -} - -HRESULT STDMETHODCALLTYPE CComCatCachedCategory::Initialize(CATID &catID, BOOL reloadCache) -{ - HRESULT hr; - - fCategory = catID; - if (reloadCache || !LoadFromRegistry()) - { - hr = LoadFromComCatMgr(); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - - hr = CacheDSA(); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - } - return S_OK; -} - -CComCatCachedCategory::~CComCatCachedCategory() -{ - DSA_Destroy(fLocalDsa); -} - -BOOL CComCatCachedCategory::LoadFromRegistry() -{ - WCHAR bufKey[MAX_PATH]; - WCHAR guidStr[MAX_PATH]; - DWORD dataSize, i; - CComHeapPtr<CATCACHEHDR> buffer; - GUID *guidArray; - - if (!fLocalDsa) - return FALSE; - - dataSize = 0; - if (!StringFromGUID2(fCategory, guidStr, MAX_PATH)) - return FALSE; - - wsprintf(bufKey, L"%s\\%s\\%s", REGPATH , guidStr, L"Enum"); - - // Try to read key and get proper value size - if (SHGetValue(HKEY_CURRENT_USER, bufKey, IMPLEMENTING, NULL, NULL, &dataSize)) - return FALSE; - - buffer.Attach((PCATCACHEHDR)CoTaskMemAlloc(dataSize)); - - SHGetValue(HKEY_CURRENT_USER, bufKey, IMPLEMENTING, NULL, buffer, &dataSize); - guidArray = (GUID*)(buffer + 1); - for (i = 0; i < buffer->classCount; i++) - { - // Add class to cache - DSA_InsertItem(fLocalDsa, DSA_APPEND, guidArray + i); - } - - return TRUE; -} - -HRESULT CComCatCachedCategory::CacheDSA() -{ - WCHAR bufKey[MAX_PATH]; - WCHAR guidStr[MAX_PATH]; - UINT elemCount; - UINT i; - UINT bufferSize; - CComHeapPtr<CATCACHEHDR> buffer; - GUID *guidArray; - GUID *tmp; - - elemCount = DSA_GetItemCount(fLocalDsa); - bufferSize = sizeof(CATCACHEHDR) + elemCount * sizeof(GUID); - if (!StringFromGUID2(fCategory, guidStr, MAX_PATH)) - return E_FAIL; - - buffer.Attach((PCATCACHEHDR)CoTaskMemAlloc(bufferSize)); - if (!buffer) - return E_OUTOFMEMORY; - - // Correctly fill cache header - buffer->dwSize = sizeof(CATCACHEHDR); - buffer->version = 1; - GetSystemTime(&buffer->writeTime); - buffer->classCount = (DWORD)elemCount; - - guidArray = (GUID*)(buffer + 1); - wsprintf(bufKey, L"%s\\%s\\%s", REGPATH , guidStr, L"Enum"); - - // Write DSA contents inside the memory buffer allocated - for(i = 0; i < elemCount; i++) - { - tmp = (GUID*)DSA_GetItemPtr(fLocalDsa, i); - if (tmp) - { - guidArray[i] = *tmp; - } - } - - // Save items to registry - SHSetValue(HKEY_CURRENT_USER, bufKey, IMPLEMENTING, REG_BINARY, buffer, bufferSize); - - guidArray = NULL; - return S_OK; -} - -HRESULT CComCatCachedCategory::LoadFromComCatMgr() -{ - HRESULT hr; - CComPtr<ICatInformation> pCatInformation; - CComPtr<IEnumGUID> pEnumGUID; - ULONG pFetched; - CLSID tmp; - - // Get component categories manager instance - hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, - IID_PPV_ARG(ICatInformation, &pCatInformation)); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - - // Get the proper enumerator - hr = pCatInformation->EnumClassesOfCategories(1, &fCategory, NULL, NULL, &pEnumGUID); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - - // Enumerate elements - do - { - pFetched = 0; - pEnumGUID->Next(1, &tmp, &pFetched); - if (pFetched) - { - if (DSA_InsertItem(fLocalDsa, DSA_APPEND, &tmp) == E_OUTOFMEMORY) - return E_OUTOFMEMORY; - } - } - while (pFetched > 0); - return S_OK; -} - -HRESULT CComCatCachedCategory::WriteCacheToDSA(HDSA pDest) -{ - INT i; - for(i = 0; i < DSA_GetItemCount(fLocalDsa); i++) - { - if (DSA_InsertItem(pDest, DSA_APPEND, DSA_GetItemPtr(fLocalDsa, i)) == DSA_ERR) - return E_OUTOFMEMORY; - } - return S_OK; -} - -class CSHEnumClassesOfCategories : - public CComCoClass<CSHEnumClassesOfCategories>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IEnumGUID -{ - private: - CComPtr<ICatInformation> fCatInformation; - HDSA fDsa; - ULONG fCursor; - - public: - CSHEnumClassesOfCategories(); - virtual ~CSHEnumClassesOfCategories(); - virtual HRESULT STDMETHODCALLTYPE Initialize(ULONG cImplemented, CATID *pImplemented, ULONG cRequired, CATID *pRequired); - // *** IEnumGUID methods *** - virtual HRESULT STDMETHODCALLTYPE Clone(IEnumCLSID **ppvOut); - virtual HRESULT STDMETHODCALLTYPE Next(ULONG cElt, CLSID *pElts, ULONG *pFetched); - virtual HRESULT STDMETHODCALLTYPE Reset(); - virtual HRESULT STDMETHODCALLTYPE Skip(ULONG nbElts); - - BEGIN_COM_MAP(CSHEnumClassesOfCategories) - COM_INTERFACE_ENTRY_IID(IID_IEnumGUID, IEnumGUID) - END_COM_MAP() -}; - -CSHEnumClassesOfCategories::CSHEnumClassesOfCategories() -{ - fCursor = 0; - fDsa = DSA_Create(sizeof(GUID), 5); -} - -CSHEnumClassesOfCategories::~CSHEnumClassesOfCategories() -{ - if (fDsa) - DSA_Destroy(fDsa); -} - -HRESULT CSHEnumClassesOfCategories::Initialize(ULONG cImplemented, CATID *pImplemented, ULONG cRequired, CATID *pRequired) -{ - UINT i; - HRESULT hr; - - if (!fDsa) - return E_FAIL; - - if (cRequired > 0 || cImplemented == (ULONG)-1) - { - FIXME("Implement required categories class enumeration\n"); - return E_NOTIMPL; - } - - // Don't do anything if we have nothing - if (cRequired == 0 && cImplemented == (ULONG)-1) - return E_FAIL; - - // For each implemented category, create a cache and add it to our local DSA - for (i = 0; i < cImplemented; i++) - { - CComCatCachedCategory cachedCat; - hr = cachedCat.Initialize(pImplemented[i], FALSE); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - cachedCat.WriteCacheToDSA(fDsa); - } - return S_OK; -} - -// *** IEnumGUID methods *** - -HRESULT STDMETHODCALLTYPE CSHEnumClassesOfCategories::Clone(IEnumCLSID **ppvOut) -{ - return E_NOTIMPL; -} - -HRESULT STDMETHODCALLTYPE CSHEnumClassesOfCategories::Next(ULONG cElt, CLSID *pElts, ULONG *pFetched) -{ - ULONG i; - ULONG read; - GUID *tmp; - - if (!pElts) - return E_INVALIDARG; - read = 0; - for (i = 0; i < cElt && (fCursor < (ULONG)DSA_GetItemCount(fDsa)); i++) - { - tmp = (GUID*)DSA_GetItemPtr(fDsa, fCursor + i); - if (!tmp) - break; - pElts[i] = *tmp; - read++; - } - fCursor += read; - if (pFetched) - *pFetched = read; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CSHEnumClassesOfCategories::Reset() -{ - fCursor = 0; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE CSHEnumClassesOfCategories::Skip(ULONG nbElts) -{ - if (fCursor + nbElts >= (ULONG)DSA_GetItemCount(fDsa)) - return E_INVALIDARG; - fCursor += nbElts; - return S_OK; -} - -/************************************************************************* - * SHEnumClassesOfCategories [BROWSEUI.136] - */ -extern "C" HRESULT WINAPI SHEnumClassesOfCategories(ULONG cImplemented, CATID *pImplemented, ULONG cRequired, CATID *pRequired, IEnumGUID **out) -{ - HRESULT hr; - - hr = ShellObjectCreatorInit<CSHEnumClassesOfCategories, ULONG, CATID*, ULONG, CATID*, IEnumGUID>( - cImplemented, pImplemented, cRequired, pRequired, IID_IEnumGUID, out); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - return S_OK; -} Modified: trunk/reactos/dll/win32/browseui/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/precomp…
============================================================================== --- trunk/reactos/dll/win32/browseui/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/precomp.h [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -40,8 +40,8 @@ #include "addresseditbox.h" #include "CAutoComplete.h" #include "bandproxy.h" -#include "bandsite.h" -#include "bandsitemenu.h" +#include "shellbars/CBandSite.h" +#include "shellbars/CBandSiteMenu.h" #include "brandband.h" #include "internettoolbar.h" #include "commonbrowser.h" Copied: trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp (from r74291, trunk/reactos/dll/win32/browseui/bandsite.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
============================================================================== --- trunk/reactos/dll/win32/browseui/bandsite.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbars/CBandSite.cpp [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "shellbars.h" #ifndef ASSERT #define ASSERT(cond) \ @@ -829,3 +829,8 @@ { return E_NOTIMPL; } + +HRESULT CBandSite_CreateInstance(REFIID riid, void **ppv) +{ + return ShellObjectCreator<CBandSite>(riid, ppv); +} Copied: trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp (from r74291, trunk/reactos/dll/win32/browseui/bandsitemenu.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
============================================================================== --- trunk/reactos/dll/win32/browseui/bandsitemenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbars/CBandSiteMenu.cpp [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -19,7 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "precomp.h" +#include "shellbars.h" CBandSiteMenu::CBandSiteMenu() { @@ -94,3 +94,8 @@ FIXME("CBandSiteMenu::HandleMenuMsg2 is UNIMPLEMENTED(%p, %u, %p, %p, %p)\n", this, uMsg, wParam, lParam, plResult); return E_NOTIMPL; } + +HRESULT CBandSiteMenu_CreateInstance(REFIID riid, void **ppv) +{ + return ShellObjectCreator<CBandSiteMenu>(riid, ppv); +} Copied: trunk/reactos/dll/win32/browseui/shellbars/CBaseBar.cpp (from r74291, trunk/reactos/dll/win32/browseui/basebar.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
============================================================================== --- trunk/reactos/dll/win32/browseui/basebar.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbars/CBaseBar.cpp [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -22,7 +22,7 @@ This class knows how to contain base bar site in a cabinet window. */ -#include "precomp.h" +#include "shellbars.h" /* Base bar that contains a vertical or horizontal explorer band. It also Added: trunk/reactos/dll/win32/browseui/shellbars/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
============================================================================== --- trunk/reactos/dll/win32/browseui/shellbars/CMakeLists.txt (added) +++ trunk/reactos/dll/win32/browseui/shellbars/CMakeLists.txt [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -0,0 +1,22 @@ +PROJECT(SHELL) + +set_cpp(WITH_RUNTIME) + +add_definitions(-DUNICODE -D_UNICODE) + +include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/atl) + +list(APPEND SOURCE + CBandSite.cpp + CBandSiteMenu.cpp + CBaseBar.cpp + CSHEnumClassesOfCategories.cpp) + +add_library(shellbars ${SOURCE}) +add_dependencies(shellbars xdk) + +if(NOT MSVC) + if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang") + add_target_compile_flags(shellbars "-Wno-unused-but-set-variable") + endif() +endif() Propchange: trunk/reactos/dll/win32/browseui/shellbars/CMakeLists.txt ------------------------------------------------------------------------------ svn:eol-style = native Copied: trunk/reactos/dll/win32/browseui/shellbars/CSHEnumClassesOfCategories.cpp (from r74291, trunk/reactos/dll/win32/browseui/comcat.cpp) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
============================================================================== --- trunk/reactos/dll/win32/browseui/comcat.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/browseui/shellbars/CSHEnumClassesOfCategories.cpp [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -22,7 +22,7 @@ * Wraps the component categories manager enum */ -#include "precomp.h" +#include "shellbars.h" #define REGPATH L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Discardable\\PostSetup\\Component Categories" #define IMPLEMENTING L"Implementing" Added: trunk/reactos/dll/win32/browseui/shellbars/shellbars.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellba…
============================================================================== --- trunk/reactos/dll/win32/browseui/shellbars/shellbars.h (added) +++ trunk/reactos/dll/win32/browseui/shellbars/shellbars.h [iso-8859-1] Sun Apr 9 13:51:39 2017 @@ -0,0 +1,36 @@ +#ifndef _SHELLBARS_PCH_ +#define _SHELLBARS_PCH_ + +#define WIN32_NO_STATUS +#define _INC_WINDOWS +#define COM_NO_WINDOWS_H + +#include <windef.h> +#include <winbase.h> +#include <wincon.h> +#include <wingdi.h> +#include <shlobj.h> +#include <shellapi.h> +#include <shlobj_undoc.h> +#include <shlguid_undoc.h> +#include <shdeprecated.h> +#include <tchar.h> +#include <atlbase.h> +#include <atlcom.h> +#include <atlwin.h> +#include <undocuser.h> +#include <shlwapi.h> +#include <shlwapi_undoc.h> +#include <undocshell.h> +#include <shellutils.h> +#include <browseui_undoc.h> +#include <wine/debug.h> + +#include "../resource.h" + +#include "CBandSite.h" +#include "CBandSiteMenu.h" + +WINE_DEFAULT_DEBUG_CHANNEL(browseui); + +#endif /* _BROWSEUI_PCH_ */ Propchange: trunk/reactos/dll/win32/browseui/shellbars/shellbars.h ------------------------------------------------------------------------------ svn:eol-style = native
7 years, 8 months
1
0
0
0
[spetreolle] 74291: [NTOS:MM] Addendum to r74263: - Really only warn once in MmLockPageableDataSection/MmUnlockPageableImageSection, not on every 256th call
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sun Apr 9 12:26:16 2017 New Revision: 74291 URL:
http://svn.reactos.org/svn/reactos?rev=74291&view=rev
Log: [NTOS:MM] Addendum to r74263: - Really only warn once in MmLockPageableDataSection/MmUnlockPageableImageSection, not on every 256th call Modified: trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c Modified: trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c…
============================================================================== --- trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/ARM3/drvmgmt.c [iso-8859-1] Sun Apr 9 12:26:16 2017 @@ -36,22 +36,22 @@ NTAPI MmUnlockPageableImageSection(IN PVOID ImageSectionHandle) { + static ULONG Warn; if (!Warn++) UNIMPLEMENTED; +} + +/* + * @unimplemented + */ +VOID +NTAPI +MmLockPageableSectionByHandle(IN PVOID ImageSectionHandle) +{ UNIMPLEMENTED; } /* * @unimplemented */ -VOID -NTAPI -MmLockPageableSectionByHandle(IN PVOID ImageSectionHandle) -{ - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ PVOID NTAPI MmLockPageableDataSection(IN PVOID AddressWithinSection) @@ -59,7 +59,7 @@ // // We should just find the section and call MmLockPageableSectionByHandle // - static BOOLEAN Warn; if (!Warn++) UNIMPLEMENTED; + static ULONG Warn; if (!Warn++) UNIMPLEMENTED; return AddressWithinSection; }
7 years, 8 months
1
0
0
0
[ekohl] 74290: [SCHEDSVC] Add missing file. Sorry!
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Apr 9 10:03:20 2017 New Revision: 74290 URL:
http://svn.reactos.org/svn/reactos?rev=74290&view=rev
Log: [SCHEDSVC] Add missing file. Sorry! Added: trunk/reactos/base/services/schedsvc/job.c (with props) Added: trunk/reactos/base/services/schedsvc/job.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/schedsvc/job…
============================================================================== --- trunk/reactos/base/services/schedsvc/job.c (added) +++ trunk/reactos/base/services/schedsvc/job.c [iso-8859-1] Sun Apr 9 10:03:20 2017 @@ -0,0 +1,347 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Services + * FILE: base/services/schedsvc/job.c + * PURPOSE: Scheduling service + * PROGRAMMER: Eric Kohl <eric.kohl(a)reactos.org> + */ + +/* INCLUDES *****************************************************************/ + +#include "precomp.h" + +WINE_DEFAULT_DEBUG_CHANNEL(schedsvc); + + +/* GLOBALS ******************************************************************/ + +typedef struct _SCHEDULE +{ + DWORD JobTime; + DWORD DaysOfMonth; + UCHAR DaysOfWeek; + UCHAR Flags; + WORD Reserved; +} SCHEDULE, PSCHEDULE; + +DWORD dwNextJobId = 0; +DWORD dwJobCount = 0; +LIST_ENTRY JobListHead; +RTL_RESOURCE JobListLock; + +LIST_ENTRY StartListHead; +RTL_RESOURCE StartListLock; + + +/* FUNCTIONS *****************************************************************/ + +static +VOID +GetJobName( + HKEY hJobsKey, + PWSTR pszJobName) +{ + WCHAR szNameBuffer[9]; + FILETIME SystemTime; + ULONG ulSeed, ulValue; + HKEY hKey; + LONG lError; + + GetSystemTimeAsFileTime(&SystemTime); + ulSeed = SystemTime.dwLowDateTime; + for (;;) + { + ulValue = RtlRandomEx(&ulSeed); + swprintf(szNameBuffer, L"%08lx", ulValue); + + hKey = NULL; + lError = RegOpenKeyEx(hJobsKey, + szNameBuffer, + 0, + KEY_READ, + &hKey); + if (lError != ERROR_SUCCESS) + { + wcscpy(pszJobName, szNameBuffer); + return; + } + + RegCloseKey(hKey); + } +} + + +LONG +SaveJob( + _In_ PJOB pJob) +{ + SCHEDULE Schedule; + HKEY hJobsKey = NULL, hJobKey = NULL; + LONG lError; + + TRACE("SaveJob()\n"); + + lError = RegCreateKeyExW(HKEY_LOCAL_MACHINE, + L"System\\CurrentControlSet\\Services\\Schedule\\Jobs", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + NULL, + &hJobsKey, + NULL); + if (lError != ERROR_SUCCESS) + goto done; + + GetJobName(hJobsKey, pJob->Name); + + lError = RegCreateKeyExW(hJobsKey, + pJob->Name, + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + NULL, + &hJobKey, + NULL); + if (lError != ERROR_SUCCESS) + goto done; + + Schedule.JobTime = pJob->JobTime; + Schedule.DaysOfMonth = pJob->DaysOfMonth; + Schedule.DaysOfWeek = pJob->DaysOfWeek; + Schedule.Flags = pJob->Flags; + + lError = RegSetValueEx(hJobKey, + L"Schedule", + 0, + REG_BINARY, + (PBYTE)&Schedule, + sizeof(Schedule)); + if (lError != ERROR_SUCCESS) + goto done; + + lError = RegSetValueEx(hJobKey, + L"Command", + 0, + REG_SZ, + (PBYTE)pJob->Command, + (wcslen(pJob->Command) + 1) * sizeof(WCHAR)); + if (lError != ERROR_SUCCESS) + goto done; + +done: + if (hJobKey != NULL) + RegCloseKey(hJobKey); + + if (hJobsKey != NULL) + RegCloseKey(hJobsKey); + + return lError; +} + + +LONG +DeleteJob( + _In_ PJOB pJob) +{ + HKEY hJobsKey = NULL; + LONG lError; + + TRACE("DeleteJob()\n"); + + lError = RegCreateKeyExW(HKEY_LOCAL_MACHINE, + L"System\\CurrentControlSet\\Services\\Schedule\\Jobs", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_WRITE, + NULL, + &hJobsKey, + NULL); + if (lError != ERROR_SUCCESS) + goto done; + + lError = RegDeleteKey(hJobsKey, + pJob->Name); + if (lError != ERROR_SUCCESS) + goto done; + +done: + if (hJobsKey != NULL) + RegCloseKey(hJobsKey); + + return lError; +} + + +LONG +LoadJobs(VOID) +{ + SCHEDULE Schedule; + WCHAR szNameBuffer[32]; + DWORD dwNameLength, dwIndex, dwSize; + HKEY hJobsKey = NULL, hJobKey = NULL; + PJOB pJob = NULL; + LONG lError; + + TRACE("LoadJobs()\n"); + + lError = RegCreateKeyExW(HKEY_LOCAL_MACHINE, + L"System\\CurrentControlSet\\Services\\Schedule\\Jobs", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_READ, + NULL, + &hJobsKey, + NULL); + if (lError != ERROR_SUCCESS) + goto done; + + for (dwIndex = 0; dwIndex < 1000; dwIndex++) + { + dwNameLength = 32; + lError = RegEnumKeyEx(hJobsKey, + dwIndex, + szNameBuffer, + &dwNameLength, + NULL, + NULL, + NULL, + NULL); + if (lError != ERROR_SUCCESS) + { + lError = ERROR_SUCCESS; + break; + } + + TRACE("KeyName: %S\n", szNameBuffer); + + lError = RegOpenKeyEx(hJobsKey, + szNameBuffer, + 0, + KEY_READ, + &hJobKey); + if (lError != ERROR_SUCCESS) + break; + + dwSize = sizeof(SCHEDULE); + lError = RegQueryValueEx(hJobKey, + L"Schedule", + NULL, + NULL, + (PBYTE)&Schedule, + &dwSize); + if (lError == ERROR_SUCCESS) + { + dwSize = 0; + RegQueryValueEx(hJobKey, + L"Command", + NULL, + NULL, + NULL, + &dwSize); + if (dwSize != 0) + { + /* Allocate a new job object */ + pJob = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(JOB) + dwSize - sizeof(WCHAR)); + if (pJob == NULL) + { + lError = ERROR_OUTOFMEMORY; + break; + } + + lError = RegQueryValueEx(hJobKey, + L"Command", + NULL, + NULL, + (PBYTE)pJob->Command, + &dwSize); + if (lError != ERROR_SUCCESS) + break; + + wcscpy(pJob->Name, szNameBuffer); + pJob->JobTime = Schedule.JobTime; + pJob->DaysOfMonth = Schedule.DaysOfMonth; + pJob->DaysOfWeek = Schedule.DaysOfWeek; + pJob->Flags = Schedule.Flags; + + /* Acquire the job list lock exclusively */ + RtlAcquireResourceExclusive(&JobListLock, TRUE); + + /* Assign a new job ID */ + pJob->JobId = dwNextJobId++; + dwJobCount++; + + /* Append the new job to the job list */ + InsertTailList(&JobListHead, &pJob->JobEntry); + + /* Release the job list lock */ + RtlReleaseResource(&JobListLock); + + // Calculate start time + + // Insert job into the start list + + // Update the start timer + + pJob = NULL; + } + } + + RegCloseKey(hJobKey); + hJobKey = NULL; + } + +done: + if (pJob != NULL) + HeapFree(GetProcessHeap(), 0, pJob); + + if (hJobKey != NULL) + RegCloseKey(hJobKey); + + if (hJobsKey != NULL) + RegCloseKey(hJobsKey); + + return lError; +} + + +#if 0 +VOID +CalculateNextStartTime(PJOB pJob) +{ + SYSTEMTIME Time; + DWORD_PTR JobTime; + WORD wDay; + BOOL bToday = FALSE; + + GetLocalTime(&Time); + + Now = (DWORD_PTR)Time.wHour * 3600000 + + (DWORD_PTR)Time.wMinute * 60000; + if (pJob->JobTime > Now) + bToday = TRUE; + + if (pJob->DaysOfMonth != 0) + { + wDay = 0; + for (i = Time.wDay - 1; i < 32; i++) + { + if (pJob->DaysOfMonth && (1 << i)) + { + wDay = i; + break; + } + } + ERR("Next day this month: %hu\n", wDay); + } + else if (pJob->DaysOfWeek != 0) + { + + } +} +#endif Propchange: trunk/reactos/base/services/schedsvc/job.c ------------------------------------------------------------------------------ svn:eol-style = native
7 years, 8 months
1
0
0
0
[ekohl] 74289: [UMPNPMGR] Use SendMessageW() to broadcast WM_DEVICECHANGE messages because BroadcastSystemMessageW() does not seem to work.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Apr 9 08:51:03 2017 New Revision: 74289 URL:
http://svn.reactos.org/svn/reactos?rev=74289&view=rev
Log: [UMPNPMGR] Use SendMessageW() to broadcast WM_DEVICECHANGE messages because BroadcastSystemMessageW() does not seem to work. Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c Modified: trunk/reactos/base/services/umpnpmgr/umpnpmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/umpnpmgr/ump…
============================================================================== --- trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] (original) +++ trunk/reactos/base/services/umpnpmgr/umpnpmgr.c [iso-8859-1] Sun Apr 9 08:51:03 2017 @@ -3565,16 +3565,17 @@ } else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_ARRIVAL, &RpcStatus)) { - DWORD dwRecipient; +// DWORD dwRecipient; DPRINT("Device arrival: %S\n", PnpEvent->TargetDevice.DeviceIds); - dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS; - BroadcastSystemMessageW(BSF_POSTMESSAGE, - &dwRecipient, - WM_DEVICECHANGE, - DBT_DEVNODES_CHANGED, - 0); +// dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS; +// BroadcastSystemMessageW(BSF_POSTMESSAGE, +// &dwRecipient, +// WM_DEVICECHANGE, +// DBT_DEVNODES_CHANGED, +// 0); + SendMessageW(HWND_BROADCAST, WM_DEVICECHANGE, DBT_DEVNODES_CHANGED, 0); } else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_EJECT_VETOED, &RpcStatus)) { @@ -3586,29 +3587,31 @@ } else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_SAFE_REMOVAL, &RpcStatus)) { - DWORD dwRecipient; +// DWORD dwRecipient; DPRINT1("Safe removal: %S\n", PnpEvent->TargetDevice.DeviceIds); - dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS; - BroadcastSystemMessageW(BSF_POSTMESSAGE, - &dwRecipient, - WM_DEVICECHANGE, - DBT_DEVNODES_CHANGED, - 0); +// dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS; +// BroadcastSystemMessageW(BSF_POSTMESSAGE, +// &dwRecipient, +// WM_DEVICECHANGE, +// DBT_DEVNODES_CHANGED, +// 0); + SendMessageW(HWND_BROADCAST, WM_DEVICECHANGE, DBT_DEVNODES_CHANGED, 0); } else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_SURPRISE_REMOVAL, &RpcStatus)) { - DWORD dwRecipient; +// DWORD dwRecipient; DPRINT1("Surprise removal: %S\n", PnpEvent->TargetDevice.DeviceIds); - dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS; - BroadcastSystemMessageW(BSF_POSTMESSAGE, - &dwRecipient, - WM_DEVICECHANGE, - DBT_DEVNODES_CHANGED, - 0); +// dwRecipient = BSM_ALLDESKTOPS | BSM_APPLICATIONS; +// BroadcastSystemMessageW(BSF_POSTMESSAGE, +// &dwRecipient, +// WM_DEVICECHANGE, +// DBT_DEVNODES_CHANGED, +// 0); + SendMessageW(HWND_BROADCAST, WM_DEVICECHANGE, DBT_DEVNODES_CHANGED, 0); } else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_REMOVAL_VETOED, &RpcStatus)) {
7 years, 8 months
1
0
0
0
[ekohl] 74288: [SCHEDSVC] Implement storing and loading of jobs in the registry.
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Apr 9 08:47:10 2017 New Revision: 74288 URL:
http://svn.reactos.org/svn/reactos?rev=74288&view=rev
Log: [SCHEDSVC] Implement storing and loading of jobs in the registry. Modified: trunk/reactos/base/services/schedsvc/CMakeLists.txt trunk/reactos/base/services/schedsvc/precomp.h trunk/reactos/base/services/schedsvc/rpcserver.c trunk/reactos/base/services/schedsvc/schedsvc.c Modified: trunk/reactos/base/services/schedsvc/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/schedsvc/CMa…
============================================================================== --- trunk/reactos/base/services/schedsvc/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/base/services/schedsvc/CMakeLists.txt [iso-8859-1] Sun Apr 9 08:47:10 2017 @@ -4,6 +4,7 @@ spec2def(schedsvc.dll schedsvc.spec ADD_IMPORTLIB) add_library(schedsvc SHARED + job.c rpcserver.c schedsvc.c schedsvc.rc Modified: trunk/reactos/base/services/schedsvc/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/schedsvc/pre…
============================================================================== --- trunk/reactos/base/services/schedsvc/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/services/schedsvc/precomp.h [iso-8859-1] Sun Apr 9 08:47:10 2017 @@ -5,6 +5,7 @@ #define _INC_WINDOWS #define COM_NO_WINDOWS_H #include <stdarg.h> +#include <stdio.h> #include <windef.h> #include <winbase.h> #include <winreg.h> @@ -16,8 +17,55 @@ #include <wine/debug.h> +NTSYSAPI +ULONG +NTAPI +RtlRandomEx( + PULONG Seed); + +typedef struct _JOB +{ + LIST_ENTRY JobEntry; + + LIST_ENTRY StartEntry; + LARGE_INTEGER StartTime; + WCHAR Name[9]; + + DWORD JobId; + DWORD_PTR JobTime; + DWORD DaysOfMonth; + UCHAR DaysOfWeek; + UCHAR Flags; + WCHAR Command[1]; +} JOB, *PJOB; + +#define DWORD_MAX 0xffffffffUL + +extern DWORD dwNextJobId; +extern DWORD dwJobCount; + extern LIST_ENTRY JobListHead; extern RTL_RESOURCE JobListLock; + +extern LIST_ENTRY StartListHead; +extern RTL_RESOURCE StartListLock; + + +/* job.c */ + +LONG +SaveJob( + PJOB pJob); + +LONG +DeleteJob( + PJOB pJob); + +LONG +LoadJobs(VOID); + + +/* rpcserver.c */ DWORD WINAPI Modified: trunk/reactos/base/services/schedsvc/rpcserver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/schedsvc/rpc…
============================================================================== --- trunk/reactos/base/services/schedsvc/rpcserver.c [iso-8859-1] (original) +++ trunk/reactos/base/services/schedsvc/rpcserver.c [iso-8859-1] Sun Apr 9 08:47:10 2017 @@ -32,25 +32,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(schedsvc); -#define DWORD_MAX 0xffffffffUL - -typedef struct _JOB -{ - LIST_ENTRY Entry; - DWORD JobId; - - DWORD_PTR JobTime; - DWORD DaysOfMonth; - UCHAR DaysOfWeek; - UCHAR Flags; - WCHAR Command[1]; -} JOB, *PJOB; - -DWORD dwNextJobId = 0; -DWORD dwJobCount = 0; -LIST_ENTRY JobListHead; -RTL_RESOURCE JobListLock; - /* FUNCTIONS *****************************************************************/ @@ -132,10 +113,19 @@ dwJobCount++; /* Append the new job to the job list */ - InsertTailList(&JobListHead, &pJob->Entry); + InsertTailList(&JobListHead, &pJob->JobEntry); /* Release the job list lock */ RtlReleaseResource(&JobListLock); + + /* Save the job in the registry */ + SaveJob(pJob); + + // Calculate start time + + // Insert job into start list + + // Update start timer /* Return the new job ID */ *pJobId = pJob->JobId; @@ -158,16 +148,27 @@ TRACE("NetrJobDel(%S %lu %lu)\n", ServerName, MinJobId, MaxJobId); + /* Check the job IDs */ + if (MinJobId > MaxJobId) + return ERROR_INVALID_PARAMETER; + /* Acquire the job list lock exclusively */ RtlAcquireResourceExclusive(&JobListLock, TRUE); JobEntry = JobListHead.Flink; while (JobEntry != &JobListHead) { - CurrentJob = CONTAINING_RECORD(JobEntry, JOB, Entry); + CurrentJob = CONTAINING_RECORD(JobEntry, JOB, JobEntry); if ((CurrentJob->JobId >= MinJobId) && (CurrentJob->JobId <= MaxJobId)) { + // Remove job from start list + + // Update start timer + + /* Remove the job from the registry */ + DeleteJob(CurrentJob); + NextEntry = JobEntry->Flink; if (RemoveEntryList(JobEntry)) { @@ -234,7 +235,7 @@ JobEntry = JobListHead.Flink; while (JobEntry != &JobListHead) { - CurrentJob = CONTAINING_RECORD(JobEntry, JOB, Entry); + CurrentJob = CONTAINING_RECORD(JobEntry, JOB, JobEntry); if (dwIndex >= dwStartIndex) { @@ -275,7 +276,7 @@ JobEntry = JobListHead.Flink; while (JobEntry != &JobListHead) { - CurrentJob = CONTAINING_RECORD(JobEntry, JOB, Entry); + CurrentJob = CONTAINING_RECORD(JobEntry, JOB, JobEntry); if (dwIndex >= dwStartIndex) { @@ -342,7 +343,7 @@ JobEntry = JobListHead.Flink; while (JobEntry != &JobListHead) { - CurrentJob = CONTAINING_RECORD(JobEntry, JOB, Entry); + CurrentJob = CONTAINING_RECORD(JobEntry, JOB, JobEntry); /* Do we have the right job? */ if (CurrentJob->JobId == JobId) Modified: trunk/reactos/base/services/schedsvc/schedsvc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/schedsvc/sch…
============================================================================== --- trunk/reactos/base/services/schedsvc/schedsvc.c [iso-8859-1] (original) +++ trunk/reactos/base/services/schedsvc/schedsvc.c [iso-8859-1] Sun Apr 9 08:47:10 2017 @@ -21,7 +21,7 @@ * PROJECT: ReactOS Services * FILE: base/services/schedsvc/schedsvc.c * PURPOSE: Scheduling service - * PROGRAMMER: Eric Kohl + * PROGRAMMER: Eric Kohl <eric.kohl(a)reactos.org> */ /* INCLUDES *****************************************************************/ @@ -99,6 +99,7 @@ case SERVICE_CONTROL_SHUTDOWN: TRACE(" SERVICE_CONTROL_SHUTDOWN received\n"); UpdateServiceStatus(SERVICE_STOP_PENDING); + RpcMgmtStopServerListening(NULL); UpdateServiceStatus(SERVICE_STOPPED); return ERROR_SUCCESS; @@ -114,6 +115,7 @@ ServiceInit(VOID) { HANDLE hThread; + DWORD dwError; /* Initialize the job list */ InitializeListHead(&JobListHead); @@ -121,6 +123,18 @@ /* Initialize the job list lock */ RtlInitializeResource(&JobListLock); + /* Initialize the start list */ + InitializeListHead(&StartListHead); + + /* Initialize the start list lock */ + RtlInitializeResource(&StartListLock); + + /* Load stored jobs from the registry */ + dwError = LoadJobs(); + if (dwError != ERROR_SUCCESS) + return dwError; + + /* Start the RPC thread */ hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RpcThreadRoutine,
7 years, 8 months
1
0
0
0
[mjansen] 74287: [GDI32_APITEST] Add test for AddFontMemResourceEx. Uses PanosePitchTest.ttf from Katayama Hirofumi MZ. CORE-13046 CORE-13038 CORE-13053
by mjansen@svn.reactos.org
Author: mjansen Date: Sat Apr 8 22:25:54 2017 New Revision: 74287 URL:
http://svn.reactos.org/svn/reactos?rev=74287&view=rev
Log: [GDI32_APITEST] Add test for AddFontMemResourceEx. Uses PanosePitchTest.ttf from Katayama Hirofumi MZ. CORE-13046 CORE-13038 CORE-13053 Added: trunk/rostests/apitests/gdi32/AddFontMemResourceEx.c (with props) trunk/rostests/apitests/gdi32/PanosePitchTest.ttf (with props) Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt trunk/rostests/apitests/gdi32/resource.rc trunk/rostests/apitests/gdi32/testlist.c Added: trunk/rostests/apitests/gdi32/AddFontMemResourceEx.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/AddFontMem…
============================================================================== --- trunk/rostests/apitests/gdi32/AddFontMemResourceEx.c (added) +++ trunk/rostests/apitests/gdi32/AddFontMemResourceEx.c [iso-8859-1] Sat Apr 8 22:25:54 2017 @@ -0,0 +1,191 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL - See COPYING in the top level directory + * PURPOSE: Test for AddFontMemResourceEx + * PROGRAMMERS: Mark Jansen + * + * PanosePitchTest by Katayama Hirofumi MZ, licensed under CC BY + */ + + +#include <apitest.h> +#include <wingdi.h> +#include <winuser.h> + + +static void test_font_caps(HDC hdc) +{ + HGDIOBJ old; + TEXTMETRICA tm = { 0 }; + char name[64]; + BOOL ret; + HFONT font = CreateFont(0, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, TEXT("PanosePitchTest")); + + if (font) + { + old = SelectObject(hdc, font); + + memset(&tm, 0xaa, sizeof(tm)); + ret = GetTextMetricsA(hdc, &tm); + ok_int(ret, TRUE); + + SetLastError(0xdeadbeef); + ret = GetTextFaceA(hdc, sizeof(name), name); + ok(ret, "GetTextFaceA error %lu\n", GetLastError()); + if (ret) + { + ok_str(name, "PanosePitchTest"); + } + + ok_int(tm.tmHeight, 11); + ok_int(tm.tmAscent, 11); + ok_int(tm.tmDescent, 0); + ok_int(tm.tmInternalLeading, -5); + ok_int(tm.tmExternalLeading, 1); + ok_int(tm.tmAveCharWidth, 8); + ok_int(tm.tmMaxCharWidth, 11); + ok_int(tm.tmWeight, FW_NORMAL); + ok_int(tm.tmOverhang, 0); + ok_int(tm.tmDigitizedAspectX, 96); + ok_int(tm.tmDigitizedAspectY, 96); + ok_int(tm.tmFirstChar, 63); + ok_int(tm.tmLastChar, 65); + ok_int(tm.tmDefaultChar, 165); + ok_int(tm.tmBreakChar, 65); + ok_int(tm.tmItalic, 0); + ok_int(tm.tmUnderlined, 0); + ok_int(tm.tmStruckOut, 0); + ok_hex(tm.tmPitchAndFamily, TMPF_TRUETYPE | TMPF_VECTOR); + ok_int(tm.tmCharSet, SHIFTJIS_CHARSET); + + SelectObject(hdc, old); + DeleteObject(font); + } + + font = CreateFont(0, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, TEXT("@PanosePitchTest")); + + if (font) + { + old = SelectObject(hdc, font); + + memset(&tm, 0xaa, sizeof(tm)); + ret = GetTextMetricsA(hdc, &tm); + ok_int(ret, TRUE); + + SetLastError(0xdeadbeef); + ret = GetTextFaceA(hdc, sizeof(name), name); + ok(ret, "GetTextFaceA error %lu\n", GetLastError()); + if (ret) + { + ok_str(name, "@PanosePitchTest"); + } + + ok_int(tm.tmHeight, 11); + ok_int(tm.tmAscent, 11); + ok_int(tm.tmDescent, 0); + ok_int(tm.tmInternalLeading, -5); + ok_int(tm.tmExternalLeading, 1); + ok_int(tm.tmAveCharWidth, 8); + ok_int(tm.tmMaxCharWidth, 11); + ok_int(tm.tmWeight, FW_NORMAL); + ok_int(tm.tmOverhang, 0); + ok_int(tm.tmDigitizedAspectX, 96); + ok_int(tm.tmDigitizedAspectY, 96); + ok_int(tm.tmFirstChar, 63); + ok_int(tm.tmLastChar, 65); + ok_int(tm.tmDefaultChar, 165); + ok_int(tm.tmBreakChar, 65); + ok_int(tm.tmItalic, 0); + ok_int(tm.tmUnderlined, 0); + ok_int(tm.tmStruckOut, 0); + ok_hex(tm.tmPitchAndFamily, TMPF_TRUETYPE | TMPF_VECTOR); + ok_int(tm.tmCharSet, SHIFTJIS_CHARSET); + + SelectObject(hdc, old); + DeleteObject(font); + } +} + +/* Not working as of 2017-04-08 on ReactOS */ +static BOOL is_font_available(HDC hdc, const char* fontName) +{ + char name[64]; + BOOL ret; + + HFONT font = CreateFontA(0, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET, + OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, fontName); + HGDIOBJ old = SelectObject(hdc, font); + + + SetLastError(0xdeadbeef); + + ret = GetTextFaceA(hdc, sizeof(name), name); + ok(ret, "GetTextFaceA error %lu\n", GetLastError()); + SelectObject(hdc, old); + DeleteObject(font); + + if (ret) + { + return !_strcmpi(name, fontName); + } + return FALSE; +} + + + +START_TEST(AddFontMemResourceEx) +{ + HMODULE mod; + HRSRC hRsrc; + + HGLOBAL hTemplate; + DWORD dwSize, dwNumFonts; + LPVOID pFont; + + HANDLE hFont; + + HDC hdc = CreateCompatibleDC(NULL); + BOOL is_font_available_broken = is_font_available(hdc, "Nonexisting font name here"); + + ok(!is_font_available_broken, "Validating font is broken! (CORE-13053) !\n"); + + if (is_font_available_broken || !is_font_available(hdc, "PanosePitchTest")) + { + mod = GetModuleHandle(NULL); + hRsrc = FindResource(mod, TEXT("PanosePitchTest.ttf"), MAKEINTRESOURCE(RT_RCDATA)); + + hTemplate = LoadResource(mod, hRsrc); + dwSize = SizeofResource(mod, hRsrc); + pFont = LockResource(hTemplate); + + dwNumFonts = 0; + hFont = AddFontMemResourceEx(pFont, dwSize, NULL, &dwNumFonts); + ok_int(dwNumFonts, 2); + ok(hFont != NULL, "Expected valid handle\n"); + + if (hFont) + { + test_font_caps(hdc); + RemoveFontMemResourceEx(hFont); + if (!is_font_available_broken) + { + ok (!is_font_available(hdc, "PanosePitchTest"), "Expected font to be unregistered again\n"); + } + else + { + skip("Font unregister test\n"); + } + } + + UnlockResource(hTemplate); + FreeResource(hTemplate); + } + else + { + skip("Font PanosePitchTest already available\n"); + } + DeleteDC(hdc); +} + Propchange: trunk/rostests/apitests/gdi32/AddFontMemResourceEx.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CMakeLists…
============================================================================== --- trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] Sat Apr 8 22:25:54 2017 @@ -2,6 +2,7 @@ include_directories(${REACTOS_SOURCE_DIR}/win32ss) list(APPEND SOURCE + AddFontMemResourceEx.c AddFontResource.c AddFontResourceEx.c BeginPath.c Added: trunk/rostests/apitests/gdi32/PanosePitchTest.ttf URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/PanosePitc…
============================================================================== Binary file - no diff available. Propchange: trunk/rostests/apitests/gdi32/PanosePitchTest.ttf ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: trunk/rostests/apitests/gdi32/resource.rc URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/resource.r…
============================================================================== --- trunk/rostests/apitests/gdi32/resource.rc [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/resource.rc [iso-8859-1] Sat Apr 8 22:25:54 2017 @@ -1,3 +1,4 @@ #include "windef.h" ReactOSTestTahoma.ttf RCDATA ReactOSTestTahoma.ttf +PanosePitchTest.ttf RCDATA PanosePitchTest.ttf Modified: trunk/rostests/apitests/gdi32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/testlist.c…
============================================================================== --- trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] Sat Apr 8 22:25:54 2017 @@ -3,6 +3,7 @@ #define STANDALONE #include <apitest.h> +extern void func_AddFontMemResourceEx(void); extern void func_AddFontResource(void); extern void func_AddFontResourceEx(void); extern void func_BeginPath(void); @@ -75,6 +76,7 @@ const struct test winetest_testlist[] = { + { "AddFontMemResourceEx", func_AddFontMemResourceEx }, { "AddFontResource", func_AddFontResource }, { "AddFontResourceEx", func_AddFontResourceEx }, { "BeginPath", func_BeginPath },
7 years, 8 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Results per page:
10
25
50
100
200