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
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2005
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
563 discussions
Start a n
N
ew thread
[hpoussin] 16391: Implement SetupDiGetActualSectionToInstallA
by hpoussin@svn.reactos.com
Implement SetupDiGetActualSectionToInstallA Implement SetupDiCreateDeviceInfoA Add SetupDiCreateDeviceInfoW stub Fix SetupDiOpenClassRegKeyExW, by adding { } around the GUID string when opening the registry key Don't use L"..." notation for wide strings Modified: trunk/reactos/lib/setupapi/cfgmgr.c Modified: trunk/reactos/lib/setupapi/devinst.c Modified: trunk/reactos/lib/setupapi/setupapi.spec _____ Modified: trunk/reactos/lib/setupapi/cfgmgr.c --- trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-03 12:18:23 UTC (rev 16390) +++ trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-03 13:46:33 UTC (rev 16391) @@ -39,6 +39,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi); +/* Registry key and value names */ +static const WCHAR ControlClass[] = {'S','y','s','t','e','m','\\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\' , + 'C','o','n','t','r','o','l','\\', + 'C','l','a','s','s',0}; + + typedef struct _MACHINE_INFO { RPC_BINDING_HANDLE BindingHandle; @@ -166,7 +173,7 @@ rc = RegOpenKeyExW( hRelativeKey, - L"System\\CurrentControlSet\\Control\\Class", + ControlClass, 0, /* options */ KEY_ENUMERATE_SUB_KEYS, &hKey); _____ Modified: trunk/reactos/lib/setupapi/devinst.c --- trunk/reactos/lib/setupapi/devinst.c 2005-07-03 12:18:23 UTC (rev 16390) +++ trunk/reactos/lib/setupapi/devinst.c 2005-07-03 13:46:33 UTC (rev 16391) @@ -292,7 +292,7 @@ LPWSTR MachineNameW = NULL; BOOL bResult; - FIXME("\n"); + TRACE("\n"); ClassNameW = MultiByteToUnicode(ClassName, CP_ACP); if (ClassNameW == NULL) @@ -630,8 +630,45 @@ PDWORD RequiredSize, PSTR *Extension) { - FIXME("\n"); - return FALSE; + LPWSTR InfSectionNameW = NULL; + PWSTR InfSectionWithExtW = NULL; + PWSTR ExtensionW; + BOOL bResult; + + TRACE("\n"); + + if (InfSectionName) + { + InfSectionNameW = MultiByteToUnicode(InfSectionName, CP_ACP); + if (InfSectionNameW == NULL) goto end; + } + if (InfSectionWithExt) + { + InfSectionWithExtW = HeapAlloc(GetProcessHeap(), 0, InfSectionWithExtSize * sizeof(WCHAR)); + if (InfSectionWithExtW == NULL) goto end; + } + + bResult = SetupDiGetActualSectionToInstallW(InfHandle, InfSectionNameW, + InfSectionWithExt ? InfSectionNameW : NULL, + InfSectionWithExtSize, RequiredSize, + Extension ? &ExtensionW : NULL); + + if (InfSectionWithExt) + { + } + if (Extension) + { + if (ExtensionW == NULL) + *Extension = NULL; + else + *Extension = &InfSectionWithExt[ExtensionW - InfSectionWithExtW]; + } + +end: + if (InfSectionNameW) MyFree(InfSectionNameW); + if (InfSectionWithExtW) HeapFree(GetProcessHeap(), 0, InfSectionWithExtW); + + return bResult; } /*********************************************************************** @@ -1394,6 +1431,8 @@ PVOID Reserved) { LPWSTR lpGuidString; + LPWSTR lpFullGuidString; + DWORD dwLength; HKEY hClassesKey; HKEY hClassKey; LPCWSTR lpKeyName; @@ -1437,18 +1476,31 @@ return INVALID_HANDLE_VALUE; } + dwLength = lstrlenW(lpGuidString); + lpFullGuidString = HeapAlloc(GetProcessHeap(), 0, (dwLength + 3) * sizeof(WCHAR)); + if (!lpFullGuidString) + { + RpcStringFreeW(&lpGuidString); + return INVALID_HANDLE_VALUE; + } + lpFullGuidString[0] = '{'; + memcpy(&lpFullGuidString[1], lpGuidString, dwLength * sizeof(WCHAR)); + lpFullGuidString[dwLength + 1] = '}'; + lpFullGuidString[dwLength + 2] = UNICODE_NULL; + RpcStringFreeW(&lpGuidString); + if (RegOpenKeyExW(hClassesKey, - lpGuidString, + lpFullGuidString, 0, KEY_ALL_ACCESS, &hClassKey)) { - RpcStringFreeW(&lpGuidString); + HeapFree(GetProcessHeap(), 0, lpFullGuidString); RegCloseKey(hClassesKey); return INVALID_HANDLE_VALUE; } - RpcStringFreeW(&lpGuidString); + HeapFree(GetProcessHeap(), 0, lpFullGuidString); RegCloseKey(hClassesKey); return hClassKey; @@ -1535,3 +1587,65 @@ Scope, HwProfile, KeyType, samDesired); return INVALID_HANDLE_VALUE; } + +/********************************************************************** * + * SetupDiCreateDeviceInfoA (SETUPAPI.@) + */ +BOOL WINAPI SetupDiCreateDeviceInfoA( + HDEVINFO DeviceInfoSet, + PCSTR DeviceName, + LPGUID ClassGuid, + PCSTR DeviceDescription, + HWND hwndParent, + DWORD CreationFlags, + PSP_DEVINFO_DATA DeviceInfoData) +{ + LPWSTR DeviceNameW = NULL; + LPWSTR DeviceDescriptionW = NULL; + BOOL bResult; + + TRACE("\n"); + + if (DeviceName) + { + DeviceNameW = MultiByteToUnicode(DeviceName, CP_ACP); + if (DeviceNameW == NULL) return FALSE; + } + if (DeviceDescription) + { + DeviceDescriptionW = MultiByteToUnicode(DeviceDescription, CP_ACP); + if (DeviceDescriptionW == NULL) + { + if (DeviceNameW) MyFree(DeviceNameW); + return FALSE; + } + } + + bResult = SetupDiCreateDeviceInfoW(DeviceInfoSet, DeviceNameW, + ClassGuid, DeviceDescriptionW, + hwndParent, CreationFlags, + DeviceInfoData); + + if (DeviceNameW) MyFree(DeviceNameW); + if (DeviceDescriptionW) MyFree(DeviceDescriptionW); + + return bResult; +} + +/********************************************************************** * + * SetupDiCreateDeviceInfoW (SETUPAPI.@) + */ +BOOL WINAPI SetupDiCreateDeviceInfoW( + HDEVINFO DeviceInfoSet, + PCWSTR DeviceName, + LPGUID ClassGuid, + PCWSTR DeviceDescription, + HWND hwndParent, + DWORD CreationFlags, + PSP_DEVINFO_DATA DeviceInfoData) +{ + FIXME("%p %S %p %S %p %lx %p\n", DeviceInfoSet, debugstr_w(DeviceName), + ClassGuid, debugstr_w(DeviceDescription), hwndParent, + CreationFlags, DeviceInfoData); + return FALSE; +} _____ Modified: trunk/reactos/lib/setupapi/setupapi.spec --- trunk/reactos/lib/setupapi/setupapi.spec 2005-07-03 12:18:23 UTC (rev 16390) +++ trunk/reactos/lib/setupapi/setupapi.spec 2005-07-03 13:46:33 UTC (rev 16391) @@ -38,8 +38,8 @@ @ stub CM_Dup_Range_List @ stub CM_Enable_DevNode @ stub CM_Enable_DevNode_Ex -@ stub CM_Enumerate_Classes -@ stub CM_Enumerate_Classes_Ex +@ stdcall CM_Enumerate_Classes(long ptr long) +@ stdcall CM_Enumerate_Classes_Ex(long ptr long ptr) @ stub CM_Enumerate_EnumeratorsA @ stub CM_Enumerate_EnumeratorsW @ stub CM_Enumerate_Enumerators_ExA @@ -282,11 +282,11 @@ @ stdcall SetupDiClassNameFromGuidW(ptr wstr long ptr) @ stub SetupDiCreateDevRegKeyA @ stub SetupDiCreateDevRegKeyW -@ stub SetupDiCreateDeviceInfoA +@ stdcall SetupDiCreateDeviceInfoA(ptr str ptr str ptr long ptr) +@ stdcall SetupDiCreateDeviceInfoW(ptr wstr ptr wstr ptr long ptr) @ stdcall SetupDiCreateDeviceInfoList(ptr ptr) @ stdcall SetupDiCreateDeviceInfoListExA(ptr long str ptr) -@ stdcall SetupDiCreateDeviceInfoListExW(ptr long str ptr) -@ stub SetupDiCreateDeviceInfoW +@ stdcall SetupDiCreateDeviceInfoListExW(ptr long wstr ptr) @ stub SetupDiDeleteDevRegKey @ stub SetupDiDeleteDeviceInfo @ stub SetupDiDeleteDeviceInterfaceData
19 years, 6 months
1
0
0
0
[ekohl] 16390: - Define and use PLUGPLAY_CONTROL_CLASS
by ekohl@svn.reactos.com
- Define and use PLUGPLAY_CONTROL_CLASS - PNP_GetVersion should return an error code - Rename structs used by NtPlugPlayControl Modified: trunk/reactos/include/ddk/ntpnp.h Modified: trunk/reactos/include/idl/pnp.idl Modified: trunk/reactos/include/ndk/zwfuncs.h Modified: trunk/reactos/include/ndk/zwtypes.h Modified: trunk/reactos/lib/setupapi/cfgmgr.c Modified: trunk/reactos/ntoskrnl/io/plugplay.c Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c _____ Modified: trunk/reactos/include/ddk/ntpnp.h --- trunk/reactos/include/ddk/ntpnp.h 2005-07-03 10:35:56 UTC (rev 16389) +++ trunk/reactos/include/ddk/ntpnp.h 2005-07-03 12:18:23 UTC (rev 16390) @@ -60,17 +60,18 @@ #ifndef __GUIDS_ONLY__ /* This is defined to build libwdmguid.a */ -typedef enum _PLUGPLAY_EVENT_CATEGORY { - HardwareProfileChangeEvent, - TargetDeviceChangeEvent, - DeviceClassChangeEvent, - CustomDeviceEvent, - DeviceInstallEvent, - DeviceArrivalEvent, - PowerEvent, - VetoEvent, - BlockedDriverEvent, - MaxPlugEventCategory +typedef enum _PLUGPLAY_EVENT_CATEGORY +{ + HardwareProfileChangeEvent, + TargetDeviceChangeEvent, + DeviceClassChangeEvent, + CustomDeviceEvent, + DeviceInstallEvent, + DeviceArrivalEvent, + PowerEvent, + VetoEvent, + BlockedDriverEvent, + MaxPlugEventCategory } PLUGPLAY_EVENT_CATEGORY; /* @@ -175,7 +176,7 @@ PPLUGPLAY_EVENT_BLOCK Buffer, ULONG BufferSize); */ - + /* * NtPlugPlayControl * @@ -231,19 +232,13 @@ * ... */ -#define PLUGPLAY_USER_RESPONSE 0x07 -#define PLUGPLAY_GET_PROPERTY 0x0A -#define PLUGPLAY_GET_RELATED_DEVICE 0x0C -#define PLUGPLAY_DEVICE_STATUS 0x0E - - -typedef struct _PLUGPLAY_PROPERTY_DATA +typedef struct _PLUGPLAY_CONTROL_PROPERTY_DATA { - UNICODE_STRING DeviceInstance; - ULONG Property; - PVOID Buffer; - ULONG BufferSize; -} PLUGPLAY_PROPERTY_DATA, *PPLUGPLAY_PROPERTY_DATA; + UNICODE_STRING DeviceInstance; + ULONG Property; + PVOID Buffer; + ULONG BufferSize; +} PLUGPLAY_CONTROL_PROPERTY_DATA, *PPLUGPLAY_CONTROL_PROPERTY_DATA; /* PLUGPLAY_GET_RELATED_DEVICE (Code 0x0C) */ @@ -253,29 +248,29 @@ #define PNP_GET_CHILD_DEVICE 2 #define PNP_GET_SIBLING_DEVICE 3 -typedef struct _PLUGPLAY_RELATED_DEVICE_DATA +typedef struct _PLUGPLAY_CONTROL_RELATED_DEVICE_DATA { - UNICODE_STRING DeviceInstance; - UNICODE_STRING RelatedDeviceInstance; - ULONG Relation; /* 1: Parent 2: Child 3: Sibling */ -} PLUGPLAY_RELATED_DEVICE_DATA, *PPLUGPLAY_RELATED_DEVICE_DATA; + UNICODE_STRING TargetDeviceInstance; + ULONG Relation; /* 1: Parent 2: Child 3: Sibling */ + UNICODE_STRING RelatedDeviceInstance; +} PLUGPLAY_CONTROL_RELATED_DEVICE_DATA, *PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA; /* PLUGPLAY_DEVICE_STATUS (Code 0x0E) */ -/* Action values */ +/* Operation values */ #define PNP_GET_DEVICE_STATUS 0 #define PNP_SET_DEVICE_STATUS 1 #define PNP_CLEAR_DEVICE_STATUS 2 -typedef struct _PLUGPLAY_DEVICE_STATUS_DATA +typedef struct _PLUGPLAY_CONTOL_STATUS_DATA { - UNICODE_STRING DeviceInstance; - ULONG Action; /* 0: Get 1: Set 2: Clear */ - ULONG Problem; /* CM_PROB_ see cfg.h */ - ULONG Flags; /* DN_ see cfg.h */ -} PLUGPLAY_DEVICE_STATUS_DATA, *PPLUGPLAY_DEVICE_STATUS_DATA; + UNICODE_STRING DeviceInstance; + ULONG Operation; /* 0: Get 1: Set 2: Clear */ + ULONG DeviceStatus; /* DN_ see cfg.h */ + ULONG DeviceProblem; /* CM_PROB_ see cfg.h */ +} PLUGPLAY_CONTROL_STATUS_DATA, *PPLUGPLAY_CONTROL_STATUS_DATA; #endif /* __GUIDS_ONLY__ */ _____ Modified: trunk/reactos/include/idl/pnp.idl --- trunk/reactos/include/idl/pnp.idl 2005-07-03 10:35:56 UTC (rev 16389) +++ trunk/reactos/include/idl/pnp.idl 2005-07-03 12:18:23 UTC (rev 16390) @@ -3,6 +3,7 @@ */ #define WORD unsigned short +#define CONFIGRET unsigned long [ uuid (809F4e40-A03D-11CE-8F69-08003E30051B), @@ -15,5 +16,6 @@ // unsigned long PNP_GetRootDeviceInstance(handle_t BindingHandle, // [out, string, size_is(Length)] wchar_t *DeviceInstance, // [in] unsigned long Length); - WORD PNP_GetVersion(handle_t BindingHandle); + CONFIGRET PNP_GetVersion(handle_t BindingHandle, + [out] WORD *Version); } _____ Modified: trunk/reactos/include/ndk/zwfuncs.h --- trunk/reactos/include/ndk/zwfuncs.h 2005-07-03 10:35:56 UTC (rev 16389) +++ trunk/reactos/include/ndk/zwfuncs.h 2005-07-03 12:18:23 UTC (rev 16390) @@ -1868,9 +1868,9 @@ NTSTATUS STDCALL NtPlugPlayControl( - ULONG ControlCode, - PVOID Buffer, - ULONG BufferSize + IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, + IN OUT PVOID Buffer, + IN ULONG BufferSize ); NTSTATUS _____ Modified: trunk/reactos/include/ndk/zwtypes.h --- trunk/reactos/include/ndk/zwtypes.h 2005-07-03 10:35:56 UTC (rev 16389) +++ trunk/reactos/include/ndk/zwtypes.h 2005-07-03 12:18:23 UTC (rev 16390) @@ -246,6 +246,17 @@ IoCompletionBasicInformation } IO_COMPLETION_INFORMATION_CLASS; +/* + * PlugPlay + */ +typedef enum _PLUGPLAY_CONTROL_CLASS +{ + PlugPlayControlUserResponse = 0x07, + PlugPlayControlProperty = 0x0A, + PlugPlayControlGetRelatedDevice = 0x0C, + PlugPlayControlDeviceStatus = 0x0E +} PLUGPLAY_CONTROL_CLASS; + /* TYPES *********************************************************************/ typedef unsigned short LANGID; _____ Modified: trunk/reactos/lib/setupapi/cfgmgr.c --- trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-03 10:35:56 UTC (rev 16389) +++ trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-03 12:18:23 UTC (rev 16390) @@ -376,6 +376,7 @@ { RPC_BINDING_HANDLE BindingHandle = NULL; RPC_STATUS Status; + WORD Version = 0; FIXME("%lx\n", hMachine); @@ -392,7 +393,10 @@ return 0; } - return PNP_GetVersion(BindingHandle); + if (PNP_GetVersion(BindingHandle, &Version) != CR_SUCCESS) + return 0; + + return Version; } _____ Modified: trunk/reactos/ntoskrnl/io/plugplay.c --- trunk/reactos/ntoskrnl/io/plugplay.c 2005-07-03 10:35:56 UTC (rev 16389) +++ trunk/reactos/ntoskrnl/io/plugplay.c 2005-07-03 12:18:23 UTC (rev 16390) @@ -285,7 +285,7 @@ static NTSTATUS -IopGetRelatedDevice(PPLUGPLAY_RELATED_DEVICE_DATA RelatedDeviceData) +IopGetRelatedDevice(PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA RelatedDeviceData) { UNICODE_STRING RootDeviceName; PDEVICE_OBJECT DeviceObject = NULL; @@ -294,11 +294,11 @@ DPRINT("IopGetRelatedDevice() called\n"); - DPRINT("Device name: %wZ\n", &RelatedDeviceData->DeviceInstance); + DPRINT("Device name: %wZ\n", &RelatedDeviceData->TargetDeviceInstance); RtlInitUnicodeString(&RootDeviceName, L"HTREE\\ROOT\\0"); - if (RtlEqualUnicodeString(&RelatedDeviceData->DeviceInstance, + if (RtlEqualUnicodeString(&RelatedDeviceData->TargetDeviceInstance, &RootDeviceName, TRUE)) { @@ -307,7 +307,7 @@ else { /* Get the device object */ - DeviceObject = IopGetDeviceObjectFromDeviceInstance(&RelatedDeviceData->DeviceInstance) ; + DeviceObject = IopGetDeviceObjectFromDeviceInstance(&RelatedDeviceData->TargetDeviceIns tance); if (DeviceObject == NULL) return STATUS_NO_SUCH_DEVICE; @@ -377,34 +377,34 @@ static NTSTATUS -IopDeviceStatus(PPLUGPLAY_DEVICE_STATUS_DATA DeviceStatusData) +IopDeviceStatus(PPLUGPLAY_CONTROL_STATUS_DATA StatusData) { PDEVICE_OBJECT DeviceObject; PDEVICE_NODE DeviceNode; DPRINT("IopDeviceStatus() called\n"); - DPRINT("Device name: %wZ\n", &DeviceStatusData->DeviceInstance); + DPRINT("Device name: %wZ\n", &StatusData->DeviceInstance); /* Get the device object */ - DeviceObject = IopGetDeviceObjectFromDeviceInstance(&DeviceStatusData->DeviceInstance); + DeviceObject = IopGetDeviceObjectFromDeviceInstance(&StatusData->DeviceInstance); if (DeviceObject == NULL) return STATUS_NO_SUCH_DEVICE; DeviceNode = DeviceObject->DeviceObjectExtension->DeviceNode; - switch (DeviceStatusData->Action) + switch (StatusData->Operation) { case PNP_GET_DEVICE_STATUS: DPRINT("Get status data\n"); - DeviceStatusData->Problem = DeviceNode->Problem; - DeviceStatusData->Flags = DeviceNode->Flags; + StatusData->DeviceStatus = DeviceNode->Flags; + StatusData->DeviceProblem = DeviceNode->Problem; break; case PNP_SET_DEVICE_STATUS: DPRINT("Set status data\n"); - DeviceNode->Problem = DeviceStatusData->Problem; - DeviceNode->Flags = DeviceStatusData->Flags; + DeviceNode->Flags = StatusData->DeviceStatus; + DeviceNode->Problem = StatusData->DeviceProblem; break; case PNP_CLEAR_DEVICE_STATUS: @@ -422,14 +422,14 @@ * @unimplemented */ NTSTATUS STDCALL -NtPlugPlayControl(IN ULONG ControlCode, +NtPlugPlayControl(IN PLUGPLAY_CONTROL_CLASS PlugPlayControlClass, IN OUT PVOID Buffer, IN ULONG BufferLength) { NTSTATUS Status = STATUS_SUCCESS; DPRINT("NtPlugPlayControl(%lu %p %lu) called\n", - ControlCode, Buffer, BufferLength); + PlugPlayControlClass, Buffer, BufferLength); /* Function can only be called from user-mode */ if (KeGetPreviousMode() != UserMode) @@ -464,22 +464,25 @@ return Status; } - switch (ControlCode) + switch (PlugPlayControlClass) { - case PLUGPLAY_USER_RESPONSE: + case PlugPlayControlUserResponse: if (Buffer || BufferLength != 0) return STATUS_INVALID_PARAMETER; return IopRemovePlugPlayEvent(); - case PLUGPLAY_GET_RELATED_DEVICE: - if (!Buffer || BufferLength < sizeof(PLUGPLAY_RELATED_DEVICE_DATA)) + case PlugPlayControlGetRelatedDevice: + if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_RELATED_DEVICE_DATA)) return STATUS_INVALID_PARAMETER; - return IopGetRelatedDevice((PPLUGPLAY_RELATED_DEVICE_DATA)Buffer); + return IopGetRelatedDevice((PPLUGPLAY_CONTROL_RELATED_DEVICE_DATA)Buffer); - case PLUGPLAY_DEVICE_STATUS: - if (!Buffer || BufferLength < sizeof(PLUGPLAY_DEVICE_STATUS_DATA)) + case PlugPlayControlDeviceStatus: + if (!Buffer || BufferLength < sizeof(PLUGPLAY_CONTROL_STATUS_DATA)) return STATUS_INVALID_PARAMETER; - return IopDeviceStatus((PPLUGPLAY_DEVICE_STATUS_DATA)Buffer); + return IopDeviceStatus((PPLUGPLAY_CONTROL_STATUS_DATA)Buffer); + + default: + return STATUS_NOT_IMPLEMENTED; } return STATUS_NOT_IMPLEMENTED; _____ Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c --- trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-07-03 10:35:56 UTC (rev 16389) +++ trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-07-03 12:18:23 UTC (rev 16390) @@ -109,9 +109,11 @@ //WORD PNP_GetVersion(RPC_BINDING_HANDLE BindingHandle) -WORD PNP_GetVersion(handle_t BindingHandle) +unsigned long PNP_GetVersion(handle_t BindingHandle, + unsigned short *Version) { - return 0x0400; + *Version = 0x0400; + return 0; } @@ -162,7 +164,7 @@ /* FIXME: Process the pnp event */ /* Dequeue the current pnp event and signal the next one */ - NtPlugPlayControl(PLUGPLAY_USER_RESPONSE, NULL, 0); + NtPlugPlayControl(PlugPlayControlUserResponse, NULL, 0); } HeapFree(GetProcessHeap(), 0, PnpEvent);
19 years, 6 months
1
0
0
0
[hpoussin] 16389: Implement CM_Enumerate_Classes and CM_Enumerate_Classes_Ex
by hpoussin@svn.reactos.com
Implement CM_Enumerate_Classes and CM_Enumerate_Classes_Ex Modified: trunk/reactos/lib/setupapi/cfgmgr.c _____ Modified: trunk/reactos/lib/setupapi/cfgmgr.c --- trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-03 10:33:51 UTC (rev 16388) +++ trunk/reactos/lib/setupapi/cfgmgr.c 2005-07-03 10:35:56 UTC (rev 16389) @@ -117,6 +117,84 @@ /*********************************************************************** + * CM_Enumerate_Classes [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Enumerate_Classes( + ULONG ulClassIndex, LPGUID ClassGuid, ULONG ulFlags) +{ + TRACE("%lx %p %lx\n", ulClassIndex, ClassGuid, ulFlags); + + return CM_Enumerate_Classes_Ex(ulClassIndex, ClassGuid, ulFlags, NULL); +} + + +static CONFIGRET GetCmCodeFromErrorCode(DWORD ErrorCode) +{ + switch (ErrorCode) + { + case ERROR_SUCCESS: return CR_SUCCESS; + case ERROR_ACCESS_DENIED: return CR_ACCESS_DENIED; + case ERROR_INSUFFICIENT_BUFFER: return CR_BUFFER_SMALL; + case ERROR_INVALID_DATA: return CR_INVALID_DATA; + case ERROR_INVALID_PARAMETER: return CR_INVALID_DATA; + case ERROR_NO_MORE_ITEMS: return CR_NO_SUCH_VALUE; + case ERROR_NO_SYSTEM_RESOURCES: return CR_OUT_OF_MEMORY; + default: return CR_FAILURE; + } +} + + +/********************************************************************** * + * CM_Enumerate_Classes_Ex [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Enumerate_Classes_Ex( + ULONG ulClassIndex, LPGUID ClassGuid, ULONG ulFlags, HMACHINE hMachine) +{ + HKEY hRelativeKey, hKey; + DWORD rc; + WCHAR Buffer[39]; + + TRACE("%lx %p %lx %p\n", ulClassIndex, ClassGuid, ulFlags, hMachine); + + if (hMachine != NULL) + { + FIXME("hMachine argument ignored\n"); + hRelativeKey = HKEY_LOCAL_MACHINE; /* FIXME: use here a field in hMachine */ + } + else + hRelativeKey = HKEY_LOCAL_MACHINE; + + rc = RegOpenKeyExW( + hRelativeKey, + L"System\\CurrentControlSet\\Control\\Class", + 0, /* options */ + KEY_ENUMERATE_SUB_KEYS, + &hKey); + if (rc != ERROR_SUCCESS) + return GetCmCodeFromErrorCode(rc); + + rc = RegEnumKeyW( + hKey, + ulClassIndex, + Buffer, + sizeof(Buffer) / sizeof(WCHAR)); + + RegCloseKey(hKey); + + if (rc == ERROR_SUCCESS) + { + /* Remove the {} */ + Buffer[37] = UNICODE_NULL; + /* Convert the buffer to a GUID */ + if (UuidFromStringW(&Buffer[1], ClassGuid) != RPC_S_OK) + return CR_FAILURE; + } + + return GetCmCodeFromErrorCode(rc); +} + + +/********************************************************************** * * CM_Get_Child [SETUPAPI.@] */ CONFIGRET WINAPI CM_Get_Child(
19 years, 6 months
1
0
0
0
[hpoussin] 16388: Add some missing constants and prototypes related to setupapi/cfgmgr
by hpoussin@svn.reactos.com
Add some missing constants and prototypes related to setupapi/cfgmgr Modified: trunk/reactos/include/wine/cfgmgr32.h Modified: trunk/reactos/include/wine/setupapi.h _____ Modified: trunk/reactos/include/wine/cfgmgr32.h --- trunk/reactos/include/wine/cfgmgr32.h 2005-07-03 09:39:11 UTC (rev 16387) +++ trunk/reactos/include/wine/cfgmgr32.h 2005-07-03 10:33:51 UTC (rev 16388) @@ -38,7 +38,10 @@ #define CR_SUCCESS 0x00000000 #define CR_OUT_OF_MEMORY 0x00000002 +#define CR_FAILURE 0x00000013 +#define CR_BUFFER_SMALL 0x0000001A #define CR_INVALID_DATA 0x0000001F +#define CR_NO_SUCH_VALUE 0x00000025 #define CR_INVALID_MACHINENAME 0x0000002F #define CR_ACCESS_DENIED 0x00000033 @@ -52,7 +55,8 @@ #define CM_Connect_Machine WINELIB_NAME_AW(CM_Connect_Machine) CONFIGRET WINAPI CM_Disconnect_Machine( HMACHINE ); - +CONFIGRET WINAPI CM_Enumerate_Classes( ULONG, LPGUID, ULONG ); +CONFIGRET WINAPI CM_Enumerate_Classes_Ex( ULONG, LPGUID, ULONG, HMACHINE ); CONFIGRET WINAPI CM_Get_Child( PDEVINST, DEVINST, ULONG ); CONFIGRET WINAPI CM_Get_Child_Ex( PDEVINST, DEVINST, ULONG, HMACHINE ); CONFIGRET WINAPI CM_Get_Device_ID_ListA( PCSTR, PCHAR, ULONG, ULONG ); _____ Modified: trunk/reactos/include/wine/setupapi.h --- trunk/reactos/include/wine/setupapi.h 2005-07-03 09:39:11 UTC (rev 16387) +++ trunk/reactos/include/wine/setupapi.h 2005-07-03 10:33:51 UTC (rev 16388) @@ -720,6 +720,9 @@ BOOL WINAPI SetupDiClassNameFromGuidExA(const GUID*, PSTR, DWORD, PDWORD, PCSTR, PVOID); BOOL WINAPI SetupDiClassNameFromGuidExW(const GUID*, PWSTR, DWORD, PDWORD, PCWSTR, PVOID); #define SetupDiClassNameFromGuidEx WINELIB_NAME_AW(SetupDiClassNameFromGuidEx) +BOOL WINAPI SetupDiCreateDeviceInfoA(HDEVINFO,PCSTR,LPGUID,PCSTR,HWND,DWORD,PSP_DEVI NFO_DATA); +BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO,PCWSTR,LPGUID,PCWSTR,HWND,DWORD,PSP_DE VINFO_DATA); +#define SetupDiCreateDeviceInfo WINELIB_NAME_AW(SetupDiCreateDeviceInfo) HDEVINFO WINAPI SetupDiCreateDeviceInfoList(const GUID *, HWND); HDEVINFO WINAPI SetupDiCreateDeviceInfoListExA(const GUID *, HWND, PCSTR, PVOID); HDEVINFO WINAPI SetupDiCreateDeviceInfoListExW(const GUID *, HWND, PCWSTR, PVOID);
19 years, 6 months
1
0
0
0
[mf] 16387: switch to WIN32 API string functions
by mf@svn.reactos.com
switch to WIN32 API string functions Modified: trunk/reactos/subsys/system/winefile/winefile.c _____ Modified: trunk/reactos/subsys/system/winefile/winefile.c --- trunk/reactos/subsys/system/winefile/winefile.c 2005-07-03 06:43:49 UTC (rev 16386) +++ trunk/reactos/subsys/system/winefile/winefile.c 2005-07-03 09:39:11 UTC (rev 16387) @@ -647,11 +647,9 @@ #ifdef _SHELL_FOLDERS #ifdef UNICODE -#define tcscpyn strcpyn #define get_strret get_strretW #define path_from_pidl path_from_pidlW #else -#define tcscpyn wcscpyn #define get_strret get_strretA #define path_from_pidl path_from_pidlA #endif @@ -1433,7 +1431,7 @@ _tsplitpath(path, drv, dir, name, ext); } - _tcscpy(child->filter_pattern, sAsterics); + lstrcpy(child->filter_pattern, sAsterics); child->filter_flags = TF_ALL; root->entry.level = 0; @@ -1901,7 +1899,7 @@ SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_LASTCHANGE), b1); size = ((ULONGLONG)pWFD->nFileSizeHigh << 32) | pWFD->nFileSizeLow; - wsprintf(b1, sLongNumFmt, size); + _stprintf(b1, sLongNumFmt, size); wsprintf(b2, sByteFmt, b1); SetWindowText(GetDlgItem(hwnd, IDC_STATIC_PROP_SIZE), b2); @@ -2808,11 +2806,11 @@ float fBytes = (float)bytes; if (bytes >= 1073741824) /* 1 GB */ - _stprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f); + wsprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f); else if (bytes >= 1048576) /* 1 MB */ - _stprintf(buffer, sFmtMB, fBytes/1048576.f+.5f); + wsprintf(buffer, sFmtMB, fBytes/1048576.f+.5f); else if (bytes >= 1024) /* 1 kB */ - _stprintf(buffer, sFmtkB, fBytes/1024.f+.5f); + wsprintf(buffer, sFmtkB, fBytes/1024.f+.5f); else _stprintf(buffer, sLongNumFmt, bytes); } @@ -2825,9 +2823,9 @@ if (GetDiskFreeSpaceEx(NULL, &ulFreeBytesToCaller, &ulTotalBytes, &ulFreeBytes)) { format_bytes(b1, ulFreeBytesToCaller.QuadPart); format_bytes(b2, ulTotalBytes.QuadPart); - _stprintf(buffer, RS(fmt,IDS_FREE_SPACE_FMT), b1, b2); + wsprintf(buffer, RS(fmt,IDS_FREE_SPACE_FMT), b1, b2); } else - _tcscpy(buffer, sQMarks); + lstrcpy(buffer, sQMarks); SendMessage(Globals.hstatusbar, SB_SETTEXT, 0, (LPARAM)buffer); } @@ -2888,7 +2886,7 @@ return; if (!FileTimeToLocalFileTime(ft, &lft)) - {err: _tcscpy(buffer,sQMarks); return;} + {err: lstrcpy(buffer,sQMarks); return;} if (!FileTimeToSystemTime(&lft, &systime)) goto err; @@ -3021,7 +3019,7 @@ d++; for(p=executable_extensions; (*p)[0]; p++) - if (!_tcsicmp(ext_buffer, *p)) + if (!lstrcmpi(ext_buffer, *p)) return TRUE; return FALSE; @@ -3325,10 +3323,10 @@ if (visible_cols & COL_ATTRIBUTES) { #ifdef _NO_EXTENSIONS const static TCHAR s4Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'}; - _tcscpy(buffer, s4Tabs); + lstrcpy(buffer, s4Tabs); #else const static TCHAR s11Tabs[] = {' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\t',' ','\0'}; - _tcscpy(buffer, s11Tabs); + lstrcpy(buffer, s11Tabs); #endif if (attrs & FILE_ATTRIBUTE_NORMAL) buffer[ 0] = 'N'; @@ -3370,7 +3368,7 @@ DWORD rights = get_access_mask(); - tcscpy(buffer, sSecTabs); + lstrcpy(buffer, sSecTabs); if (rights & FILE_READ_DATA) buffer[ 0] = 'R'; if (rights & FILE_WRITE_DATA) buffer[ 2] = 'W'; @@ -4396,11 +4394,11 @@ struct FilterDialog dlg; memset(&dlg, 0, sizeof(struct FilterDialog)); - _tcscpy(dlg.pattern, child->filter_pattern); + lstrcpy(dlg.pattern, child->filter_pattern); dlg.flags = child->filter_flags; if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_VIEW_TYPE), hwnd, FilterDialogDlgProc, (LPARAM)&dlg) == IDOK) { - _tcscpy(child->filter_pattern, dlg.pattern); + lstrcpy(child->filter_pattern, dlg.pattern); child->filter_flags = dlg.flags; refresh_right_pane(child); }
19 years, 6 months
1
0
0
0
[jimtabor] 16386: Half way implement NtGdiUnrealizedObject.
by jimtabor@svn.reactos.com
Half way implement NtGdiUnrealizedObject. Modified: trunk/reactos/subsys/win32k/objects/color.c _____ Modified: trunk/reactos/subsys/win32k/objects/color.c --- trunk/reactos/subsys/win32k/objects/color.c 2005-07-03 02:02:47 UTC (rev 16385) +++ trunk/reactos/subsys/win32k/objects/color.c 2005-07-03 06:43:49 UTC (rev 16386) @@ -591,7 +591,32 @@ BOOL STDCALL NtGdiUnrealizeObject(HGDIOBJ hgdiobj) { + + GDIOBJHDR * ptr; + DWORD objectType; + UNIMPLEMENTED; + + ptr = GDIOBJ_LockObj(hgdiobj, GDI_OBJECT_TYPE_DONTCARE); + if (ptr == 0) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + objectType = GDIOBJ_GetObjectType(hgdiobj); + switch(objectType) + { + case GDI_OBJECT_TYPE_PALETTE: + { + /* Make sure this is a Palette object!*/ + break; + } + default: + DPRINT1("Magic 0x%08x not implemented\n", objectType); + break; + } + + GDIOBJ_UnlockObjByPtr(ptr); return FALSE; }
19 years, 6 months
1
0
0
0
[weiden] 16385: don't look up list items with negative index
by weiden@svn.reactos.com
don't look up list items with negative index Modified: trunk/reactos/lib/aclui/checklist.c _____ Modified: trunk/reactos/lib/aclui/checklist.c --- trunk/reactos/lib/aclui/checklist.c 2005-07-03 01:44:25 UTC (rev 16384) +++ trunk/reactos/lib/aclui/checklist.c 2005-07-03 02:02:47 UTC (rev 16385) @@ -63,17 +63,20 @@ { PCHECKITEM Item, Found = NULL; - for (Item = infoPtr->CheckItemListHead; - Item != NULL; - Item = Item->Next) + if (Index >= 0) { - if (Index == 0) + for (Item = infoPtr->CheckItemListHead; + Item != NULL; + Item = Item->Next) { - Found = Item; - break; + if (Index == 0) + { + Found = Item; + break; + } + + Index--; } - - Index--; } return Found; @@ -1281,11 +1284,6 @@ pt.x = (LONG)LOWORD(lParam); pt.y = (LONG)HIWORD(lParam); - if (!infoPtr->HasFocus) - { - SetFocus(hwnd); - } - NewFocus = PtToCheckItemBox(infoPtr, &pt, &NewFocusBox, @@ -1321,6 +1319,11 @@ NewFocus, NewFocusBox); } + + if (!infoPtr->HasFocus) + { + SetFocus(hwnd); + } } break; }
19 years, 6 months
1
0
0
0
[weiden] 16384: - allow changing the focus of the check boxes in the checklist control
by weiden@svn.reactos.com
- allow changing the focus of the check boxes in the checklist control - minor fixes Modified: trunk/reactos/lib/aclui/aclui.c Modified: trunk/reactos/lib/aclui/aclui_De.rc Modified: trunk/reactos/lib/aclui/aclui_En.rc Modified: trunk/reactos/lib/aclui/aclui_Sv.rc Modified: trunk/reactos/lib/aclui/acluilib.h Modified: trunk/reactos/lib/aclui/checklist.c Modified: trunk/reactos/lib/aclui/resource.h _____ Modified: trunk/reactos/lib/aclui/aclui.c --- trunk/reactos/lib/aclui/aclui.c 2005-07-02 21:32:37 UTC (rev 16383) +++ trunk/reactos/lib/aclui/aclui.c 2005-07-03 01:44:25 UTC (rev 16384) @@ -416,22 +416,31 @@ { LPWSTR szLabel; - LoadAndFormatString(hDllInstance, - IDS_PERMISSIONS_FOR, - &szLabel, - Selected->AccountName); + if (LoadAndFormatString(hDllInstance, + IDS_PERMISSIONS_FOR, + &szLabel, + Selected->AccountName)) + { + SetWindowText(sp->hPermissionsForLabel, + szLabel); - SetWindowText(sp->hPermissionsForLabel, - szLabel); - - LocalFree((HLOCAL)szLabel); - + LocalFree((HLOCAL)szLabel); + } + /* FIXME - update the checkboxes */ } else { - SetWindowText(sp->hPermissionsForLabel, - NULL); + WCHAR szPermissions[255]; + + if (LoadString(hDllInstance, + IDS_PERMISSIONS, + szPermissions, + sizeof(szPermissions) / sizeof(szPermissions[0]))) + { + SetWindowText(sp->hPermissionsForLabel, + szPermissions); + } SendMessage(sp->hAceCheckList, CLM_CLEARCHECKBOXES, @@ -552,7 +561,7 @@ SendMessage(sp->hAceCheckList, CLM_ADDITEM, - CIS_DISABLED | CIS_NONE, + CIS_NONE, (LPARAM)NameStr); } } @@ -685,7 +694,7 @@ /* add the special permissions check item */ sp->SpecialPermCheckIndex = (INT)SendMessage(sp->hAceCheckList, CLM_ADDITEM, - CIS_DISABLED | CIS_NONE, + CIS_ALLOWDISABLED | CIS_DENYDISABLED | CIS_NONE, (LPARAM)szSpecialPermissions); } } _____ Modified: trunk/reactos/lib/aclui/aclui_De.rc --- trunk/reactos/lib/aclui/aclui_De.rc 2005-07-02 21:32:37 UTC (rev 16383) +++ trunk/reactos/lib/aclui/aclui_De.rc 2005-07-03 01:44:25 UTC (rev 16384) @@ -23,4 +23,5 @@ IDS_UNKNOWN "Unbekannt" IDS_SPECIAL_PERMISSIONS "Spezielle Berechtigungen" IDS_PERMISSIONS_FOR "Berechtigungen f³r %1" + IDS_PERMISSIONS "Berechtigungen" } _____ Modified: trunk/reactos/lib/aclui/aclui_En.rc --- trunk/reactos/lib/aclui/aclui_En.rc 2005-07-02 21:32:37 UTC (rev 16383) +++ trunk/reactos/lib/aclui/aclui_En.rc 2005-07-03 01:44:25 UTC (rev 16384) @@ -23,5 +23,6 @@ IDS_UNKNOWN "Unknown" IDS_SPECIAL_PERMISSIONS "Special Permissions" IDS_PERMISSIONS_FOR "Permissions for %1" + IDS_PERMISSIONS "Permissions" } _____ Modified: trunk/reactos/lib/aclui/aclui_Sv.rc --- trunk/reactos/lib/aclui/aclui_Sv.rc 2005-07-02 21:32:37 UTC (rev 16383) +++ trunk/reactos/lib/aclui/aclui_Sv.rc 2005-07-03 01:44:25 UTC (rev 16384) @@ -41,5 +41,6 @@ IDS_UNKNOWN "Unknown" IDS_SPECIAL_PERMISSIONS "Special Permissions" IDS_PERMISSIONS_FOR "Permissions for %1" + IDS_PERMISSIONS "Permissions" } _____ Modified: trunk/reactos/lib/aclui/acluilib.h --- trunk/reactos/lib/aclui/acluilib.h 2005-07-02 21:32:37 UTC (rev 16383) +++ trunk/reactos/lib/aclui/acluilib.h 2005-07-03 01:44:25 UTC (rev 16384) @@ -76,11 +76,14 @@ /* CHECKLIST CONTROL **********************************************************/ -#define CIS_DISABLED (0x4) -#define CIS_ENABLED (0x0) +#define CIS_DENYDISABLED (0x8) +#define CIS_DENYENABLED (0x0) +#define CIS_ALLOWDISABLED (0x4) +#define CIS_ALLOWENABLED (0x0) #define CIS_ALLOW (0x2) #define CIS_DENY (0x1) #define CIS_NONE (0x0) +#define CIS_DISABLED (CIS_ALLOWDISABLED | CIS_DENYDISABLED) #define CLB_ALLOW (0x1) #define CLB_DENY (0x0) _____ Modified: trunk/reactos/lib/aclui/checklist.c --- trunk/reactos/lib/aclui/checklist.c 2005-07-02 21:32:37 UTC (rev 16383) +++ trunk/reactos/lib/aclui/checklist.c 2005-07-03 01:44:25 UTC (rev 16384) @@ -24,7 +24,7 @@ * PROGRAMMER: Thomas Weidenmueller <w3seek(a)reactos.com> * * UPDATE HISTORY: - * 08/10/2004 Created + * 07/01/2005 Created */ #include "acluilib.h" @@ -39,19 +39,24 @@ { HWND hSelf; HWND hNotify; - DWORD Style; HFONT hFont; PCHECKITEM CheckItemListHead; UINT CheckItemCount; INT ItemHeight; + BOOL HasFocus; + PCHECKITEM FocusedCheckItem; + UINT FocusedCheckItemBox; COLORREF TextColor[2]; UINT CheckBoxLeft[2]; } CHECKLISTWND, *PCHECKLISTWND; +#define CI_TEXT_MARGIN_WIDTH (6) +#define CI_TEXT_MARGIN_HEIGHT (2) + static PCHECKITEM FindCheckItemByIndex(IN PCHECKLISTWND infoPtr, IN UINT Index) @@ -74,6 +79,248 @@ return Found; } +static INT +CheckItemToIndex(IN PCHECKLISTWND infoPtr, + IN PCHECKITEM Item) +{ + PCHECKITEM CurItem; + INT Index; + + for (CurItem = infoPtr->CheckItemListHead, Index = 0; + CurItem != NULL; + CurItem = CurItem->Next, Index++) + { + if (CurItem == Item) + { + return Index; + } + } + + return -1; +} + +static PCHECKITEM +FindFirstEnabledCheckBox(IN PCHECKLISTWND infoPtr, + OUT UINT *CheckBox) +{ + PCHECKITEM CurItem; + + for (CurItem = infoPtr->CheckItemListHead; + CurItem != NULL; + CurItem = CurItem->Next) + { + if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED) + { + /* return the Allow checkbox in case both check boxes are enabled! */ + *CheckBox = ((!(CurItem->State & CIS_ALLOWDISABLED)) ? CLB_ALLOW : CLB_DENY); + return CurItem; + } + } + + return NULL; +} + +static PCHECKITEM +FindLastEnabledCheckBox(IN PCHECKLISTWND infoPtr, + OUT UINT *CheckBox) +{ + PCHECKITEM CurItem; + PCHECKITEM LastEnabledItem = NULL; + + for (CurItem = infoPtr->CheckItemListHead; + CurItem != NULL; + CurItem = CurItem->Next) + { + if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED) + { + LastEnabledItem = CurItem; + } + } + + if (LastEnabledItem != NULL) + { + /* return the Deny checkbox in case both check boxes are enabled! */ + *CheckBox = ((!(LastEnabledItem->State & CIS_DENYDISABLED)) ? CLB_DENY : CLB_ALLOW); + return LastEnabledItem; + } + + return NULL; +} + +static PCHECKITEM +FindPreviousEnabledCheckBox(IN PCHECKLISTWND infoPtr, + OUT UINT *CheckBox) +{ + PCHECKITEM Item; + + if (infoPtr->FocusedCheckItem != NULL) + { + Item = infoPtr->FocusedCheckItem; + + if (infoPtr->FocusedCheckItemBox == CLB_DENY && + !(Item->State & CIS_ALLOWDISABLED)) + { + /* currently an Deny checkbox is focused. return the Allow checkbox + if it's enabled */ + *CheckBox = CLB_ALLOW; + } + else + { + PCHECKITEM CurItem; + + Item = NULL; + + for (CurItem = infoPtr->CheckItemListHead; + CurItem != infoPtr->FocusedCheckItem; + CurItem = CurItem->Next) + { + if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED) + { + Item = CurItem; + } + } + + if (Item != NULL) + { + /* return the Deny checkbox in case both check boxes are enabled! */ + *CheckBox = ((!(Item->State & CIS_DENYDISABLED)) ? CLB_DENY : CLB_ALLOW); + } + } + } + else + { + Item = FindLastEnabledCheckBox(infoPtr, + CheckBox); + } + + return Item; +} + +static PCHECKITEM +FindNextEnabledCheckBox(IN PCHECKLISTWND infoPtr, + OUT UINT *CheckBox) +{ + PCHECKITEM Item; + + if (infoPtr->FocusedCheckItem != NULL) + { + Item = infoPtr->FocusedCheckItem; + + if (infoPtr->FocusedCheckItemBox != CLB_DENY && + !(Item->State & CIS_DENYDISABLED)) + { + /* currently an Allow checkbox is focused. return the Deny checkbox + if it's enabled */ + *CheckBox = CLB_DENY; + } + else + { + Item = Item->Next; + + while (Item != NULL) + { + if ((Item->State & CIS_DISABLED) != CIS_DISABLED) + { + /* return the Allow checkbox in case both check boxes are enabled! */ + *CheckBox = ((!(Item->State & CIS_ALLOWDISABLED)) ? CLB_ALLOW : CLB_DENY); + break; + } + + Item = Item->Next; + } + } + } + else + { + Item = FindFirstEnabledCheckBox(infoPtr, + CheckBox); + } + + return Item; +} + +static PCHECKITEM +FindEnabledCheckBox(IN PCHECKLISTWND infoPtr, + IN BOOL ReverseSearch, + OUT UINT *CheckBox) +{ + PCHECKITEM Item; + + if (ReverseSearch) + { + Item = FindPreviousEnabledCheckBox(infoPtr, + CheckBox); + } + else + { + Item = FindNextEnabledCheckBox(infoPtr, + CheckBox); + } + + return Item; +} + +static PCHECKITEM +PtToCheckItemBox(IN PCHECKLISTWND infoPtr, + IN PPOINT ppt, + OUT UINT *CheckBox, + OUT BOOL *DirectlyInCheckBox) +{ + LONG Style; + INT FirstVisible, Index; + PCHECKITEM Item; + + Style = GetWindowLong(infoPtr->hSelf, + GWL_STYLE); + + if (Style & WS_VSCROLL) + { + FirstVisible = GetScrollPos(infoPtr->hSelf, + SB_VERT); + } + else + { + FirstVisible = 0; + } + + Index = FirstVisible + (ppt->y / infoPtr->ItemHeight); + + Item = FindCheckItemByIndex(infoPtr, + Index); + if (Item != NULL) + { + INT cx; + + cx = infoPtr->CheckBoxLeft[CLB_ALLOW] + + ((infoPtr->CheckBoxLeft[CLB_DENY] - infoPtr->CheckBoxLeft[CLB_ALLOW]) / 2); + + *CheckBox = ((ppt->x <= cx) ? CLB_ALLOW : CLB_DENY); + + if (DirectlyInCheckBox != NULL) + { + INT y = ppt->y % infoPtr->ItemHeight; + + if ((y >= CI_TEXT_MARGIN_HEIGHT && + y <= infoPtr->ItemHeight - CI_TEXT_MARGIN_HEIGHT) && + + (((ppt->x >= (infoPtr->CheckBoxLeft[CLB_ALLOW] - (infoPtr->ItemHeight / 2))) && + (ppt->x <= (infoPtr->CheckBoxLeft[CLB_ALLOW] - (infoPtr->ItemHeight / 2) + infoPtr->ItemHeight))) + || + ((ppt->x >= (infoPtr->CheckBoxLeft[CLB_DENY] - (infoPtr->ItemHeight / 2))) && + (ppt->x <= (infoPtr->CheckBoxLeft[CLB_DENY] - (infoPtr->ItemHeight / 2) + infoPtr->ItemHeight))))) + { + *DirectlyInCheckBox = TRUE; + } + else + { + *DirectlyInCheckBox = FALSE; + } + } + } + + return Item; +} + static VOID ClearCheckItems(IN PCHECKLISTWND infoPtr) { @@ -185,6 +432,7 @@ { RECT rcClient; SCROLLINFO ScrollInfo; + LONG Style; GetClientRect(infoPtr->hSelf, &rcClient); @@ -199,20 +447,23 @@ if (AllowChangeStyle) { + Style = GetWindowLong(infoPtr->hSelf, + GWL_STYLE); + /* determine whether the vertical scrollbar has to be visible or not */ if (ScrollInfo.nMax > ScrollInfo.nPage && - !(infoPtr->Style & WS_VSCROLL)) + !(Style & WS_VSCROLL)) { SetWindowLong(infoPtr->hSelf, GWL_STYLE, - infoPtr->Style | WS_VSCROLL); + Style | WS_VSCROLL); } else if (ScrollInfo.nMax < ScrollInfo.nPage && - infoPtr->Style & WS_VSCROLL) + Style & WS_VSCROLL) { SetWindowLong(infoPtr->hSelf, GWL_STYLE, - infoPtr->Style & ~WS_VSCROLL); + Style & ~WS_VSCROLL); } } @@ -227,6 +478,127 @@ RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN); } +static VOID +UpdateCheckItem(IN PCHECKLISTWND infoPtr, + IN PCHECKITEM Item) +{ + LONG Style; + RECT rcClient; + INT VisibleFirst, VisibleItems; + INT Index = CheckItemToIndex(infoPtr, + Item); + if (Index != -1) + { + Style = GetWindowLong(infoPtr->hSelf, + GWL_STYLE); + + if (Style & WS_VSCROLL) + { + VisibleFirst = GetScrollPos(infoPtr->hSelf, + SB_VERT); + } + else + { + VisibleFirst = 0; + } + + if (Index >= VisibleFirst) + { + GetClientRect(infoPtr->hSelf, + &rcClient); + + VisibleItems = ((rcClient.bottom - rcClient.top) + infoPtr->ItemHeight - 1) / infoPtr->ItemHeight; + + if (Index < VisibleFirst + VisibleItems) + { + RECT rcUpdate; + + rcUpdate.left = rcClient.left; + rcUpdate.right = rcClient.right; + rcUpdate.top = (Index - VisibleFirst) * infoPtr->ItemHeight; + rcUpdate.bottom = rcUpdate.top + infoPtr->ItemHeight; + + RedrawWindow(infoPtr->hSelf, + &rcUpdate, + NULL, + RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN); + } + } + } +} + +static VOID +MakeCheckItemVisible(IN PCHECKLISTWND infoPtr, + IN PCHECKITEM Item) +{ + LONG Style; + RECT rcClient; + INT VisibleFirst, VisibleItems, NewPos; + INT Index = CheckItemToIndex(infoPtr, + Item); + if (Index != -1) + { + Style = GetWindowLong(infoPtr->hSelf, + GWL_STYLE); + + if (Style & WS_VSCROLL) + { + VisibleFirst = GetScrollPos(infoPtr->hSelf, + SB_VERT); + + if (Index <= VisibleFirst) + { + NewPos = Index; + } + else + { + GetClientRect(infoPtr->hSelf, + &rcClient); + + VisibleItems = (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight; + if (Index - VisibleItems + 1 > VisibleFirst) + { + NewPos = Index - VisibleItems + 1; + } + else + { + NewPos = VisibleFirst; + } + } + + if (VisibleFirst != NewPos) + { + SCROLLINFO ScrollInfo; + + ScrollInfo.cbSize = sizeof(ScrollInfo); + ScrollInfo.fMask = SIF_POS; + ScrollInfo.nPos = NewPos; + NewPos = SetScrollInfo(infoPtr->hSelf, + SB_VERT, + &ScrollInfo, + TRUE); + + if (VisibleFirst != NewPos) + { + ScrollWindowEx(infoPtr->hSelf, + 0, + (NewPos - VisibleFirst) * infoPtr->ItemHeight, + NULL, + NULL, + NULL, + NULL, + SW_INVALIDATE); + + RedrawWindow(infoPtr->hSelf, + NULL, + NULL, + RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_NOCHILDREN); + } + } + } + } +} + static UINT GetIdealItemHeight(IN PCHECKLISTWND infoPtr) { @@ -286,6 +658,7 @@ INT ScrollPos; PCHECKITEM FirstItem, Item; RECT rcClient; + LONG Style; UINT VisibleFirstIndex = rcUpdate->top / infoPtr->ItemHeight; UINT LastTouchedIndex = rcUpdate->bottom / infoPtr->ItemHeight; @@ -295,7 +668,10 @@ GetClientRect(infoPtr->hSelf, &rcClient); - if (infoPtr->Style & WS_VSCROLL) + Style = GetWindowLong(infoPtr->hSelf, + GWL_STYLE); + + if (Style & WS_VSCROLL) { ScrollPos = GetScrollPos(infoPtr->hSelf, SB_VERT); @@ -314,6 +690,7 @@ DWORD CurrentIndex; COLORREF OldTextColor; BOOL Enabled, PrevEnabled; + POINT hOldBrushOrg; Enabled = IsWindowEnabled(infoPtr->hSelf); PrevEnabled = Enabled; @@ -322,10 +699,15 @@ ItemRect.right = rcClient.right; ItemRect.top = VisibleFirstIndex * infoPtr->ItemHeight; - TextRect.left = ItemRect.left + 6; - TextRect.right = ItemRect.right - 6; - TextRect.top = ItemRect.top + 2; + TextRect.left = ItemRect.left + CI_TEXT_MARGIN_WIDTH; + TextRect.right = ItemRect.right - CI_TEXT_MARGIN_WIDTH; + TextRect.top = ItemRect.top + CI_TEXT_MARGIN_HEIGHT; + SetBrushOrgEx(hDC, + ItemRect.left, + ItemRect.top, + &hOldBrushOrg); + OldTextColor = SetTextColor(hDC, infoPtr->TextColor[Enabled]); @@ -337,10 +719,16 @@ Item = Item->Next, CurrentIndex++) { TextRect.bottom = TextRect.top + infoPtr->ItemHeight; + ItemRect.bottom = ItemRect.top + infoPtr->ItemHeight; - if (Enabled && PrevEnabled != ((Item->State & CIS_DISABLED) == 0)) + SetBrushOrgEx(hDC, + ItemRect.left, + ItemRect.top, + NULL); + + if (Enabled && PrevEnabled != ((Item->State & CIS_DISABLED) != CIS_DISABLED)) { - PrevEnabled = ((Item->State & CIS_DISABLED) == 0); + PrevEnabled = ((Item->State & CIS_DISABLED) != CIS_DISABLED); SetTextColor(hDC, infoPtr->TextColor[PrevEnabled]); @@ -355,27 +743,54 @@ /* draw the Allow checkbox */ CheckBox.left = infoPtr->CheckBoxLeft[CLB_ALLOW] - ((TextRect.bottom - TextRect.top) / 2); - CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top) - 4; + CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top) - (2 * CI_TEXT_MARGIN_HEIGHT); CheckBox.top = TextRect.top; - CheckBox.bottom = CheckBox.top + (TextRect.bottom - TextRect.top) - 4; + CheckBox.bottom = CheckBox.top + (TextRect.bottom - TextRect.top) - (2 * CI_TEXT_MARGIN_HEIGHT); DrawFrameControl(hDC, &CheckBox, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | - ((Item->State & CIS_DISABLED) && Enabled ? DFCS_INACTIVE : 0) | + ((Item->State & CIS_ALLOWDISABLED) || !Enabled ? DFCS_INACTIVE : 0) | ((Item->State & CIS_ALLOW) ? DFCS_CHECKED : 0)); + if (infoPtr->HasFocus && + Item == infoPtr->FocusedCheckItem && + infoPtr->FocusedCheckItemBox != CLB_DENY) + { + RECT rcFocus = CheckBox; + + InflateRect (&rcFocus, + CI_TEXT_MARGIN_HEIGHT, + CI_TEXT_MARGIN_HEIGHT); + DrawFocusRect(hDC, + &rcFocus); + } + /* draw the Deny checkbox */ CheckBox.left = infoPtr->CheckBoxLeft[CLB_DENY] - ((TextRect.bottom - TextRect.top) / 2); - CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top) - 4; + CheckBox.right = CheckBox.left + (TextRect.bottom - TextRect.top) - (2 * CI_TEXT_MARGIN_HEIGHT); DrawFrameControl(hDC, &CheckBox, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | - ((Item->State & CIS_DISABLED) && Enabled ? DFCS_INACTIVE : 0) | + ((Item->State & CIS_DENYDISABLED) || !Enabled ? DFCS_INACTIVE : 0) | ((Item->State & CIS_DENY) ? DFCS_CHECKED : 0)); + if (infoPtr->HasFocus && + Item == infoPtr->FocusedCheckItem && + infoPtr->FocusedCheckItemBox == CLB_DENY) + { + RECT rcFocus = CheckBox; + InflateRect (&rcFocus, + CI_TEXT_MARGIN_HEIGHT, + CI_TEXT_MARGIN_HEIGHT); + + DrawFocusRect(hDC, + &rcFocus); + } + TextRect.top += infoPtr->ItemHeight; + ItemRect.top += infoPtr->ItemHeight; } SelectObject(hDC, @@ -383,10 +798,46 @@ SetTextColor(hDC, OldTextColor); + + SetBrushOrgEx(hDC, + hOldBrushOrg.x, + hOldBrushOrg.y, + NULL); } } -LRESULT CALLBACK +static VOID +ChangeCheckItemFocus(IN PCHECKLISTWND infoPtr, + IN PCHECKITEM NewFocus, + IN INT NewFocusBox) +{ + if (NewFocus != infoPtr->FocusedCheckItem) + { + PCHECKITEM OldFocus = infoPtr->FocusedCheckItem; + infoPtr->FocusedCheckItem = NewFocus; + infoPtr->FocusedCheckItemBox = NewFocusBox; + + if (OldFocus != NULL) + { + UpdateCheckItem(infoPtr, + OldFocus); + } + } + else + { + infoPtr->FocusedCheckItemBox = NewFocusBox; + } + + if (NewFocus != NULL) + { + MakeCheckItemVisible(infoPtr, + NewFocus); + UpdateCheckItem(infoPtr, + NewFocus); + } +} + +static LRESULT CALLBACK CheckListWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, @@ -440,7 +891,7 @@ SCROLLINFO ScrollInfo; ScrollInfo.cbSize = sizeof(ScrollInfo); - ScrollInfo.fMask = SIF_PAGE | SIF_RANGE | SIF_POS | SIF_TRACKPOS; + ScrollInfo.fMask = SIF_RANGE | SIF_POS; if (GetScrollInfo(hwnd, SB_VERT, @@ -469,38 +920,59 @@ break; case SB_PAGEDOWN: - if (ScrollInfo.nPos + ScrollInfo.nPage <= ScrollInfo.nMax) + { + RECT rcClient; + INT ScrollLines; + + /* don't use ScrollInfo.nPage because we should only scroll + down by the number of completely visible list entries. + nPage however also includes the partly cropped list + item at the bottom of the control */ + + GetClientRect(hwnd, &rcClient); + ScrollLines = max(1, (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight); + + if (ScrollInfo.nPos + ScrollLines <= ScrollInfo.nMax) { - ScrollInfo.nPos += ScrollInfo.nPage; + ScrollInfo.nPos += ScrollLines; } else { ScrollInfo.nPos = ScrollInfo.nMax; } break; + } case SB_PAGEUP: - if (ScrollInfo.nPos >= ScrollInfo.nPage) + { + RECT rcClient; + INT ScrollLines; + + /* don't use ScrollInfo.nPage because we should only scroll + down by the number of completely visible list entries. + nPage however also includes the partly cropped list + item at the bottom of the control */ + + GetClientRect(hwnd, &rcClient); + ScrollLines = max(1, (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight); + + if (ScrollInfo.nPos >= ScrollLines) { - ScrollInfo.nPos -= ScrollInfo.nPage; + ScrollInfo.nPos -= ScrollLines; } else { ScrollInfo.nPos = 0; } break; + } case SB_THUMBPOSITION: + case SB_THUMBTRACK: { ScrollInfo.nPos = HIWORD(wParam); break; } - - case SB_THUMBTRACK: - { - ScrollInfo.nPos = ScrollInfo.nTrackPos; - break; - } case SB_TOP: ScrollInfo.nPos = 0; @@ -589,6 +1061,27 @@ if (Item->State != OldState) { + /* revert the focus if the currently focused item is about + to be disabled */ + if (Item == infoPtr->FocusedCheckItem && + (Item->State & CIS_DISABLED)) + { + if (infoPtr->FocusedCheckItemBox == CLB_DENY) + { + if (Item->State & CIS_DENYDISABLED) + { + infoPtr->FocusedCheckItem = NULL; + } + } + else + { + if (Item->State & CIS_ALLOWDISABLED) + { + infoPtr->FocusedCheckItem = NULL; + } + } + } + UpdateControl(infoPtr, TRUE); } @@ -659,13 +1152,25 @@ if (wParam == GWL_STYLE) { - infoPtr->Style = Style->styleNew; + BOOL AllowChangeStyle; + + /* don't allow the control to enable/disable the vertical scrollbar + if this message was invoked due to such a window style change! */ + AllowChangeStyle = ((Style->styleNew & WS_VSCROLL) == (Style->styleOld & WS_VSCROLL)); + UpdateControl(infoPtr, - FALSE); + AllowChangeStyle); } break; } + case WM_ENABLE: + { + UpdateControl(infoPtr, + TRUE); + break; + } + case WM_MOUSEWHEEL: { SHORT ScrollDelta; @@ -731,12 +1236,33 @@ case WM_SETFOCUS: { infoPtr->HasFocus = TRUE; + + if (infoPtr->FocusedCheckItem == NULL) + { + BOOL Shift = GetKeyState(VK_SHIFT) & 0x8000; + infoPtr->FocusedCheckItem = FindEnabledCheckBox(infoPtr, + Shift, + &infoPtr->FocusedCheckItemBox); + } + if (infoPtr->FocusedCheckItem != NULL) + { + MakeCheckItemVisible(infoPtr, + infoPtr->FocusedCheckItem); + + UpdateCheckItem(infoPtr, + infoPtr->FocusedCheckItem); + } break; } case WM_KILLFOCUS: { infoPtr->HasFocus = FALSE; + if (infoPtr->FocusedCheckItem != NULL) + { + UpdateCheckItem(infoPtr, + infoPtr->FocusedCheckItem); + } break; } @@ -744,13 +1270,129 @@ case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: { - if (!infoPtr->HasFocus && IsWindowEnabled(hwnd)) + if (IsWindowEnabled(hwnd)) { - SetFocus(hwnd); + PCHECKITEM NewFocus; + INT NewFocusBox = 0; + BOOL InCheckBox; + POINT pt; + BOOL ChangeFocus; + + pt.x = (LONG)LOWORD(lParam); + pt.y = (LONG)HIWORD(lParam); + + if (!infoPtr->HasFocus) + { + SetFocus(hwnd); + } + + NewFocus = PtToCheckItemBox(infoPtr, + &pt, + &NewFocusBox, + &InCheckBox); + if (NewFocus != NULL) + { + if (NewFocus->State & ((NewFocusBox != CLB_DENY) ? CIS_ALLOWDISABLED : CIS_DENYDISABLED)) + { + /* the user clicked on a disabled checkbox, try to set + the focus to the other one or not change it at all */ + + InCheckBox = FALSE; + + ChangeFocus = ((NewFocus->State & CIS_DISABLED) != CIS_DISABLED); + if (ChangeFocus) + { + NewFocusBox = ((NewFocusBox != CLB_DENY) ? CLB_DENY : CLB_ALLOW); + } + } + else + { + ChangeFocus = TRUE; + } + } + else + { + ChangeFocus = TRUE; + } + + if (ChangeFocus) + { + ChangeCheckItemFocus(infoPtr, + NewFocus, + NewFocusBox); + } } break; } + case WM_KEYDOWN: + { + switch (wParam) + { + case VK_RETURN: + { + /* FIXME */ + break; + } + + case VK_TAB: + { + PCHECKITEM NewFocus; + UINT NewFocusBox = 0; + BOOL Shift = GetKeyState(VK_SHIFT) & 0x8000; + + NewFocus = FindEnabledCheckBox(infoPtr, + Shift, + &NewFocusBox); + + ChangeCheckItemFocus(infoPtr, + NewFocus, + NewFocusBox); + break; + } + [truncated at 1000 lines; 80 more skipped]
19 years, 6 months
1
0
0
0
[ekohl] 16383: Implement StringTableDuplicate.
by ekohl@svn.reactos.com
Implement StringTableDuplicate. Modified: trunk/reactos/include/wine/setupapi.h Modified: trunk/reactos/lib/setupapi/setupapi.spec Modified: trunk/reactos/lib/setupapi/stringtable.c Modified: trunk/reactos/w32api/include/setupapi.h _____ Modified: trunk/reactos/include/wine/setupapi.h --- trunk/reactos/include/wine/setupapi.h 2005-07-02 19:26:43 UTC (rev 16382) +++ trunk/reactos/include/wine/setupapi.h 2005-07-02 21:32:37 UTC (rev 16383) @@ -838,6 +838,7 @@ DWORD WINAPI StringTableAddString(HSTRING_TABLE, LPWSTR, DWORD); VOID WINAPI StringTableDestroy(HSTRING_TABLE); +HSTRING_TABLE WINAPI StringTableDuplicate(HSTRING_TABLE); HSTRING_TABLE WINAPI StringTableInitialize(VOID); DWORD WINAPI StringTableLookUpString(HSTRING_TABLE, LPWSTR, DWORD); LPWSTR WINAPI StringTableStringFromId(HSTRING_TABLE, DWORD); _____ Modified: trunk/reactos/lib/setupapi/setupapi.spec --- trunk/reactos/lib/setupapi/setupapi.spec 2005-07-02 19:26:43 UTC (rev 16382) +++ trunk/reactos/lib/setupapi/setupapi.spec 2005-07-02 21:32:37 UTC (rev 16383) @@ -516,7 +516,7 @@ @ stdcall StringTableAddString(ptr wstr long) @ stub StringTableAddStringEx @ stdcall StringTableDestroy(ptr) -@ stub StringTableDuplicate +@ stdcall StringTableDuplicate(ptr) @ stub StringTableEnum @ stub StringTableGetExtraData @ stdcall StringTableInitialize() _____ Modified: trunk/reactos/lib/setupapi/stringtable.c --- trunk/reactos/lib/setupapi/stringtable.c 2005-07-02 19:26:43 UTC (rev 16382) +++ trunk/reactos/lib/setupapi/stringtable.c 2005-07-02 21:32:37 UTC (rev 16383) @@ -36,9 +36,9 @@ typedef struct _STRING_TABLE { - LPWSTR *pSlots; /* 0x00 */ - DWORD dwUsedSlots; /* 0x04 */ - DWORD dwMaxSlots; /* 0x08 */ + LPWSTR *pSlots; + DWORD dwUsedSlots; + DWORD dwMaxSlots; } STRING_TABLE, *PSTRING_TABLE; @@ -222,6 +222,77 @@ /*********************************************************************** *** + * StringTableDuplicate [SETUPAPI.@] + * + * Duplicates a given string table. + * + * PARAMS + * hStringTable [I] Handle to the string table + * + * RETURNS + * Success: Handle to the duplicated string table + * Failure: NULL + * + */ +HSTRING_TABLE WINAPI +StringTableDuplicate(HSTRING_TABLE hStringTable) +{ + PSTRING_TABLE pSourceTable; + PSTRING_TABLE pDestinationTable; + DWORD i; + DWORD length; + + TRACE("%p\n", (PVOID)hStringTable); + + pSourceTable = (PSTRING_TABLE)hStringTable; + if (pSourceTable == NULL) + { + ERR("Invalid hStringTable!\n"); + return (HSTRING_TABLE)NULL; + } + + pDestinationTable = MyMalloc(sizeof(STRING_TABLE)); + if (pDestinationTable == NULL) + { + ERR("Cound not allocate a new string table!\n"); + return (HSTRING_TABLE)NULL; + } + + memset(pDestinationTable, 0, sizeof(STRING_TABLE)); + + pDestinationTable->pSlots = MyMalloc(sizeof(LPWSTR) * pSourceTable->dwMaxSlots); + if (pDestinationTable->pSlots == NULL) + { + MyFree(pDestinationTable); + return (HSTRING_TABLE)NULL; + } + + memset(pDestinationTable->pSlots, 0, sizeof(LPWSTR) * pSourceTable->dwMaxSlots); + + pDestinationTable->dwUsedSlots = 0; + pDestinationTable->dwMaxSlots = pSourceTable->dwMaxSlots; + + for (i = 0; i < pSourceTable->dwMaxSlots; i++) + { + if (pSourceTable->pSlots[i] != NULL) + { + length = lstrlenW(pSourceTable->pSlots[i]) + sizeof(WCHAR); + pDestinationTable->pSlots[i] = MyMalloc(length); + if (pDestinationTable->pSlots[i] != NULL) + { + memcpy(pDestinationTable->pSlots[i], + pSourceTable->pSlots[i], + length); + pDestinationTable->dwUsedSlots++; + } + } + } + + return (HSTRING_TABLE)pDestinationTable; +} + + +/********************************************************************** **** * StringTableLookUpString [SETUPAPI.@] * * Searches a string table for a given string. _____ Modified: trunk/reactos/w32api/include/setupapi.h --- trunk/reactos/w32api/include/setupapi.h 2005-07-02 19:26:43 UTC (rev 16382) +++ trunk/reactos/w32api/include/setupapi.h 2005-07-02 21:32:37 UTC (rev 16383) @@ -1350,6 +1350,7 @@ WINSETUPAPI DWORD WINAPI StringTableAddString(HSTRING_TABLE, LPWSTR, DWORD); WINSETUPAPI VOID WINAPI StringTableDestroy(HSTRING_TABLE); +WINSETUPAPI HSTRING_TABLE WINAPI StringTableDuplicate(HSTRING_TABLE); WINSETUPAPI HSTRING_TABLE WINAPI StringTableInitialize(VOID); WINSETUPAPI DWORD WINAPI StringTableLookUpString(HSTRING_TABLE, LPWSTR, DWORD); WINSETUPAPI LPWSTR WINAPI StringTableStringFromId(HSTRING_TABLE, DWORD);
19 years, 6 months
1
0
0
0
[ekohl] 16382: Implement GetVersionInfoFromImage.
by ekohl@svn.reactos.com
Implement GetVersionInfoFromImage. Add missing prototypes to w32api. Modified: trunk/reactos/include/wine/setupapi.h Modified: trunk/reactos/lib/setupapi/misc.c Modified: trunk/reactos/lib/setupapi/setupapi.spec Modified: trunk/reactos/w32api/include/setupapi.h _____ Modified: trunk/reactos/include/wine/setupapi.h --- trunk/reactos/include/wine/setupapi.h 2005-07-02 17:57:51 UTC (rev 16381) +++ trunk/reactos/include/wine/setupapi.h 2005-07-02 19:26:43 UTC (rev 16382) @@ -683,6 +683,7 @@ BOOL WINAPI EnablePrivilege(PCWSTR lpPrivilegeName, BOOL bEnable); BOOL WINAPI FileExists(PCWSTR lpFileName, PWIN32_FIND_DATAW lpFileFindData); DWORD WINAPI GetSetFileTimestamp(PCWSTR, PFILETIME, PFILETIME, PFILETIME, BOOLEAN); +BOOL WINAPI GetVersionInfoFromImage(LPWSTR, PULARGE_INTEGER, LPWORD); void WINAPI InstallHinfSectionA( HWND hwnd, HINSTANCE handle, PCSTR cmdline, INT show ); void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, PCWSTR cmdline, INT show ); #define InstallHinfSection WINELIB_NAME_AW(InstallHinfSection) _____ Modified: trunk/reactos/lib/setupapi/misc.c --- trunk/reactos/lib/setupapi/misc.c 2005-07-02 17:57:51 UTC (rev 16381) +++ trunk/reactos/lib/setupapi/misc.c 2005-07-02 19:26:43 UTC (rev 16382) @@ -25,6 +25,7 @@ #include "wingdi.h" #include "winuser.h" #include "winreg.h" +#include "winver.h" #include "setupapi.h" #include "wine/unicode.h" @@ -1090,3 +1091,73 @@ MoveWindow(hwnd, posX, posY, nWindowHeight, nWindowWidth, 0); } + + +/********************************************************************** **** + * GetVersionInfoFromImage [SETUPAPI.@] + * + * Retrieves version information for a given file. + * + * PARAMS + * lpFileName [I] File name + * lpFileVersion [O] Pointer to the full file version + * lpVersionVarSize [O] Pointer to the size of the variable version + * information + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ +BOOL WINAPI +GetVersionInfoFromImage(LPWSTR lpFileName, + PULARGE_INTEGER lpFileVersion, + LPWORD lpVersionVarSize) +{ + DWORD dwHandle; + DWORD dwSize; + LPVOID lpInfo; + UINT uSize; + VS_FIXEDFILEINFO *lpFixedInfo; + LPWORD lpVarSize; + + dwSize = GetFileVersionInfoSizeW(lpFileName, &dwHandle); + if (dwSize == 0) + return FALSE; + + lpInfo = MyMalloc(dwSize); + if (lpInfo == NULL) + return FALSE; + + if (!GetFileVersionInfoW(lpFileName, 0, dwSize, lpInfo)) + { + MyFree(lpInfo); + return FALSE; + } + + if (!VerQueryValueW(lpInfo, L"\\", + (LPVOID*)&lpFixedInfo, &uSize)) + { + MyFree(lpInfo); + return FALSE; + } + + lpFileVersion->LowPart = lpFixedInfo->dwFileVersionLS; + lpFileVersion->HighPart = lpFixedInfo->dwFileVersionMS; + + *lpVersionVarSize = 0; + if (!VerQueryValueW(lpInfo, L"\\VerFileInfo\\Translation", + (LPVOID*)&lpVarSize, &uSize)) + { + MyFree(lpInfo); + return TRUE; + } + + if (uSize >= 4) + { + *lpVersionVarSize = *lpVarSize; + } + + MyFree(lpInfo); + + return TRUE; +} _____ Modified: trunk/reactos/lib/setupapi/setupapi.spec --- trunk/reactos/lib/setupapi/setupapi.spec 2005-07-02 17:57:51 UTC (rev 16381) +++ trunk/reactos/lib/setupapi/setupapi.spec 2005-07-02 19:26:43 UTC (rev 16382) @@ -206,7 +206,7 @@ @ stub GetCurrentDriverSigningPolicy @ stub GetNewInfName @ stdcall GetSetFileTimestamp(wstr ptr ptr ptr long) -@ stub GetVersionInfoFromImage +@ stdcall GetVersionInfoFromImage(wstr ptr ptr) @ stub InfIsFromOemLocation @ stub InstallCatalog @ stdcall InstallHinfSection(long long str long) InstallHinfSectionA _____ Modified: trunk/reactos/w32api/include/setupapi.h --- trunk/reactos/w32api/include/setupapi.h 2005-07-02 17:57:51 UTC (rev 16381) +++ trunk/reactos/w32api/include/setupapi.h 2005-07-02 19:26:43 UTC (rev 16382) @@ -1038,13 +1038,27 @@ WINSETUPAPI LONG WINAPI AddTagToGroupOrderList(PCWSTR, DWORD, DWORD); +WINSETUPAPI VOID WINAPI AssertFail(LPSTR, UINT, LPSTR); +WINSETUPAPI DWORD WINAPI CaptureAndConvertAnsiArg(PCSTR, PWSTR*); +WINSETUPAPI DWORD WINAPI CaptureStringArg(PCWSTR, PWSTR*); WINSETUPAPI VOID WINAPI CenterWindowRelativeToParent(HWND); +WINSETUPAPI BOOL WINAPI ConcatenatePaths(LPWSTR, LPCWSTR, DWORD, LPDWORD); +WINSETUPAPI BOOL WINAPI DelayedMove(PCWSTR, PCWSTR); +WINSETUPAPI BOOL WINAPI DoesUserHavePrivilege(PCWSTR); WINSETUPAPI PWSTR WINAPI DuplicateString(PCWSTR); +WINSETUPAPI BOOL WINAPI EnablePrivilege(PCWSTR, BOOL); +WINSETUPAPI BOOL WINAPI FileExists(PCWSTR, PWIN32_FIND_DATAW); +WINSETUPAPI DWORD WINAPI GetSetFileTimestamp(PCWSTR, PFILETIME, PFILETIME, PFILETIME, BOOLEAN); +WINSETUPAPI BOOL WINAPI GetVersionInfoFromImage(LPWSTR, PULARGE_INTEGER, LPWORD); WINSETUPAPI BOOL WINAPI IsUserAdmin(VOID); +WINSETUPAPI PWSTR WINAPI MultiByteToUnicode(PCSTR, UINT); WINSETUPAPI VOID WINAPI MyFree(PVOID); +WINSETUPAPI PWSTR WINAPI MyGetFileTitle(PCWSTR); WINSETUPAPI PVOID WINAPI MyMalloc(DWORD); WINSETUPAPI PVOID WINAPI MyRealloc(PVOID, DWORD); +WINSETUPAPI DWORD WINAPI OpenAndMapForRead(PCWSTR, PDWORD, PHANDLE, PHANDLE, PVOID*); WINSETUPAPI LONG WINAPI QueryRegistryValue(HKEY, PCWSTR, PBYTE*, PDWORD, PDWORD); +WINSETUPAPI DWORD WINAPI RetreiveFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR*); WINSETUPAPI BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC,HINF,HINF,PCSTR,PVOID,UIN T); WINSETUPAPI BOOL WINAPI SetupAddInstallSectionToDiskSpaceListW(HDSKSPC,HINF,HINF,PCWSTR,PVOID,UI NT); @@ -1332,6 +1346,8 @@ WINSETUPAPI VOID WINAPI SetupTermDefaultQueueCallback(PVOID); WINSETUPAPI BOOL WINAPI SetupTerminateFileLog(HSPFILELOG); +WINSETUPAPI DWORD WINAPI StampFileSecurity(PCWSTR, PSECURITY_DESCRIPTOR); + WINSETUPAPI DWORD WINAPI StringTableAddString(HSTRING_TABLE, LPWSTR, DWORD); WINSETUPAPI VOID WINAPI StringTableDestroy(HSTRING_TABLE); WINSETUPAPI HSTRING_TABLE WINAPI StringTableInitialize(VOID); @@ -1340,7 +1356,11 @@ WINSETUPAPI BOOL WINAPI StringTableStringFromIdEx(HSTRING_TABLE, DWORD, LPWSTR, LPDWORD); WINSETUPAPI VOID WINAPI StringTableTrim(HSTRING_TABLE); +WINSETUPAPI DWORD WINAPI TakeOwnershipOfFile(PCWSTR); +WINSETUPAPI PSTR WINAPI UnicodeToMultiByte(PCWSTR lpUnicodeStr, UINT uCodePage); +WINSETUPAPI BOOL WINAPI UnmapAndCloseFile(HANDLE, HANDLE, PVOID); + /* for backward compatability */ #define SetupDiCreateInterfaceDeviceW SetupDiCreateDeviceInterfaceW #define SetupDiCreateInterfaceDeviceRegKeyW SetupDiCreateDeviceInterfaceRegKeyW
19 years, 6 months
1
0
0
0
← Newer
1
...
51
52
53
54
55
56
57
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Results per page:
10
25
50
100
200