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
August 2005
----- 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
23 participants
669 discussions
Start a n
N
ew thread
[weiden] 17589: - don't close handles of keys in RegDeleteTree() that were deleted
by weiden@svn.reactos.com
- don't close handles of keys in RegDeleteTree() that were deleted - implemented RegConnectRegistryA() Modified: trunk/reactos/lib/advapi32/reg/reg.c _____ Modified: trunk/reactos/lib/advapi32/reg/reg.c --- trunk/reactos/lib/advapi32/reg/reg.c 2005-08-28 15:43:00 UTC (rev 17588) +++ trunk/reactos/lib/advapi32/reg/reg.c 2005-08-29 13:54:05 UTC (rev 17589) @@ -320,21 +320,6 @@ /*********************************************************************** * - * RegConnectRegistryA - * - * @unimplemented - */ -LONG STDCALL -RegConnectRegistryA (LPCSTR lpMachineName, - HKEY hKey, - PHKEY phkResult) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return ERROR_CALL_NOT_IMPLEMENTED; -} - - -/********************************************************************** ** * RegCopyTreeW * * @unimplemented @@ -446,6 +431,41 @@ /*********************************************************************** * + * RegConnectRegistryA + * + * @implemented + */ +LONG STDCALL +RegConnectRegistryA (IN LPCSTR lpMachineName, + IN HKEY hKey, + OUT PHKEY phkResult) +{ + UNICODE_STRING MachineName; + LONG Ret; + + if (lpMachineName != NULL) + { + if (!RtlCreateUnicodeStringFromAsciiz(&MachineName, + (LPSTR)lpMachineName)) + { + return ERROR_NOT_ENOUGH_MEMORY; + } + } + else + RtlInitUnicodeString(&MachineName, + NULL); + + Ret = RegConnectRegistryW(MachineName.Buffer, + hKey, + phkResult); + + RtlFreeUnicodeString(&MachineName); + + return Ret; +} + + +/********************************************************************** ** * RegConnectRegistryW * * @unimplemented @@ -971,7 +991,8 @@ static NTSTATUS -RegpDeleteTree(IN HKEY hKey) +RegpDeleteTree(IN HKEY hKey, + OUT PBOOLEAN KeysDeleted) { typedef struct { @@ -980,7 +1001,7 @@ } REGP_DEL_KEYS, *PREG_DEL_KEYS; LIST_ENTRY delQueueHead; - PREG_DEL_KEYS delKeys = NULL, newDelKeys; + PREG_DEL_KEYS delKeys, newDelKeys; HANDLE ProcessHeap; ULONG BufferSize; PKEY_BASIC_INFORMATION BasicInfo; @@ -988,6 +1009,8 @@ NTSTATUS Status = STATUS_SUCCESS; NTSTATUS Status2 = STATUS_SUCCESS; + *KeysDeleted = FALSE; + InitializeListHead(&delQueueHead); ProcessHeap = RtlGetProcessHeap(); @@ -1105,10 +1128,13 @@ Status2 = STATUS_INSUFFICIENT_RESOURCES; } } + SubKeyFailure: + ASSERT(newDelKeys != NULL); RtlFreeHeap(ProcessHeap, 0, newDelKeys); + SubKeyFailureNoFree: /* don't break, let's try to delete as many keys as possible */ if (Status2 != STATUS_NO_MORE_ENTRIES && NT_SUCCESS(Status)) @@ -1134,6 +1160,8 @@ 0, delKeys); } while (!IsListEmpty(&delQueueHead)); + + *KeysDeleted = TRUE; } else Status = STATUS_INSUFFICIENT_RESOURCES; @@ -1151,6 +1179,7 @@ RegDeleteTreeW(IN HKEY hKey, IN LPCWSTR lpSubKey OPTIONAL) { + BOOLEAN KeysDeleted; HANDLE KeyHandle, CurKey, SubKeyHandle = NULL; NTSTATUS Status; @@ -1188,15 +1217,20 @@ else CurKey = KeyHandle; - Status = RegpDeleteTree(CurKey); + Status = RegpDeleteTree(CurKey, + &KeysDeleted); - if (SubKeyHandle != NULL) + if (!KeysDeleted) { - NtClose(SubKeyHandle); - } + /* only close handles of keys that weren't deleted! */ + if (SubKeyHandle != NULL) + { + NtClose(SubKeyHandle); + } Cleanup: - CloseDefaultKey(KeyHandle); + CloseDefaultKey(KeyHandle); + } if (!NT_SUCCESS(Status)) {
19 years, 3 months
1
0
0
0
[hpoussin] 17588: Remove warnings
by hpoussin@svn.reactos.com
Remove warnings Modified: trunk/rosapps/sysutils/tlist/tlist.c Modified: trunk/rosapps/sysutils/tlist/tlist.xml _____ Modified: trunk/rosapps/sysutils/tlist/tlist.c --- trunk/rosapps/sysutils/tlist/tlist.c 2005-08-28 15:29:36 UTC (rev 17587) +++ trunk/rosapps/sysutils/tlist/tlist.c 2005-08-28 15:43:00 UTC (rev 17588) @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * ReactOS Project * TList * @@ -213,7 +212,6 @@ { PSYSTEM_PROCESS_INFORMATION pInfo = NULL; PSYSTEM_PROCESS_INFORMATION pInfoBase = NULL; - LONG Length = 0; LPWSTR Module = L""; LPWSTR Title = L""; @@ -378,7 +376,6 @@ VM_COUNTERS PsVm; PSYSTEM_PROCESS_INFORMATION pInfo = NULL; PSYSTEM_PROCESS_INFORMATION pInfoBase = NULL; - LONG pInfoBaseLength = 0; LPWSTR Module = L""; LPWSTR Title = L""; _____ Modified: trunk/rosapps/sysutils/tlist/tlist.xml --- trunk/rosapps/sysutils/tlist/tlist.xml 2005-08-28 15:29:36 UTC (rev 17587) +++ trunk/rosapps/sysutils/tlist/tlist.xml 2005-08-28 15:43:00 UTC (rev 17588) @@ -1,4 +1,4 @@ -<module name="tlist" type="win32cui" installbase="system32" installname="tlist.exe" warnings="true"> +<module name="tlist" type="win32cui" installbase="system32" installname="tlist.exe"> <define name="__USE_W32API" /> <library>epsapi</library> <!-- <library>tgetopt</library> -->
19 years, 3 months
1
0
0
0
[hpoussin] 17587: Remove warnings
by hpoussin@svn.reactos.com
Remove warnings Modified: trunk/rosapps/sysutils/pedump/pedump.c Modified: trunk/rosapps/sysutils/pedump/pedump.xml _____ Modified: trunk/rosapps/sysutils/pedump/pedump.c --- trunk/rosapps/sysutils/pedump/pedump.c 2005-08-28 15:07:45 UTC (rev 17586) +++ trunk/rosapps/sysutils/pedump/pedump.c 2005-08-28 15:29:36 UTC (rev 17587) @@ -880,7 +880,7 @@ void WINAPI GetPreviousParamString (char *, char *); void WINAPI TranslateParameters (char **, char **, char **); BOOL WINAPI StringExpands (char **, char **, char **, Str_P *); -LPVOID WINAPI TranslateFunctionName (char *); +char * WINAPI TranslateFunctionName (char *); /* export section info */ int WINAPI GetExportFunctionNames (LPVOID, char **); @@ -1949,7 +1949,7 @@ // October 5, 1997 // /* translate condesed import function name */ -LPVOID WINAPI +char * WINAPI TranslateFunctionName ( char *psz) { @@ -2688,7 +2688,7 @@ } else { - sprintf (buff, "RT_UNKNOWN:%08X", prdeName); + sprintf (buff, "RT_UNKNOWN:%08lX", prdeName); strcpy (pMem, buff); pMem += 20; } @@ -3143,7 +3143,7 @@ for (i = 0; i < prdName->NumberOfIdEntries; i++) { - sprintf (buff, "MenuId_%04X", (prde->Name)); + sprintf (buff, "MenuId_%04lX", (prde->Name)); strcpy (pMem, buff); pMem += strlen (buff) + 1; @@ -3537,7 +3537,7 @@ for (i = 0; i < prdName->NumberOfIdEntries; i++) { - sprintf (buff, "DialogId_%04X", (prde->Name)); + sprintf (buff, "DialogId_%04lX", (prde->Name)); strcpy (pMem, buff); pMem += strlen (buff) + 1; @@ -4061,7 +4061,7 @@ if (fileType != IMAGE_NT_SIGNATURE) { printf ( - "%s: This file is not in PE format (magic = 0x%08x).\n", + "%s: This file is not in PE format (magic = 0x%08lx).\n", argv[0], fileType ); @@ -4108,7 +4108,7 @@ if (poh->BaseOfCode == shdr[i].VirtualAddress) { printf ( - "Code Offset = %08X, Code Size = %08X \n", + "Code Offset = %08lX, Code Size = %08lX \n", shdr[i].PointerToRawData, shdr[i].SizeOfRawData ); @@ -4116,7 +4116,7 @@ if (((shdr[i].Characteristics) & 0xC0000040) == 0xC0000040) { printf ( - "Data Offset = %08X, Data Size = %08X \n", + "Data Offset = %08lX, Data Size = %08lX \n", shdr[i].PointerToRawData, shdr[i].SizeOfRawData ); @@ -4152,7 +4152,7 @@ shdr[i].Name[7] = 0; } for (i = 0; i < nSections; i++) - printf ("\n Object%02d: %8s RVA: %08X Offset: %08X Size: %08X Flags: %08X ", + printf ("\n Object%02d: %8s RVA: %08lX Offset: %08lX Size: %08lX Flags: %08lX ", i + 1, shdr[i].Name, shdr[i].VirtualAddress, shdr[i].PointerToRawData, shdr[i].SizeOfRawData, shdr[i].Characteristics); /* _____ Modified: trunk/rosapps/sysutils/pedump/pedump.xml --- trunk/rosapps/sysutils/pedump/pedump.xml 2005-08-28 15:07:45 UTC (rev 17586) +++ trunk/rosapps/sysutils/pedump/pedump.xml 2005-08-28 15:29:36 UTC (rev 17587) @@ -1,4 +1,4 @@ -<module name="pedump" type="win32cui" installbase="system32" installname="pedump.exe" warnings="true"> +<module name="pedump" type="win32cui" installbase="system32" installname="pedump.exe"> <linkerflag>--numeric-sort</linkerflag> <define name="__USE_W32API" /> <define name="_WIN32_IE">0x0501</define>
19 years, 3 months
1
0
0
0
[ekohl] 17586: Implement CM_Get_Class_Key_Name[_Ex]A/W and CM_Open_Class[_Ex]A/W.
by ekohl@svn.reactos.com
Implement CM_Get_Class_Key_Name[_Ex]A/W and CM_Open_Class[_Ex]A/W. Modified: trunk/reactos/include/idl/pnp.idl Modified: trunk/reactos/include/wine/cfgmgr32.h Modified: trunk/reactos/lib/setupapi/cfgmgr.c Modified: trunk/reactos/lib/setupapi/setupapi.spec Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h _____ Modified: trunk/reactos/include/idl/pnp.idl --- trunk/reactos/include/idl/pnp.idl 2005-08-28 12:23:37 UTC (rev 17585) +++ trunk/reactos/include/idl/pnp.idl 2005-08-28 15:07:45 UTC (rev 17586) @@ -69,6 +69,12 @@ [in] unsigned long Length, [in] unsigned long Flags); + CONFIGRET PNP_GetClassName(handle_t BindingHandle, + [in, string] wchar_t *ClassGuid, + [out, string, size_is(*Length)] wchar_t *Buffer, + [in, out] unsigned long *Length, + [in] unsigned long Flags); + CONFIGRET PNP_GetDeviceStatus(handle_t BindingHandle, [in, string] wchar_t *DeviceInstance, [out] unsigned long *Status, _____ Modified: trunk/reactos/include/wine/cfgmgr32.h --- trunk/reactos/include/wine/cfgmgr32.h 2005-08-28 12:23:37 UTC (rev 17585) +++ trunk/reactos/include/wine/cfgmgr32.h 2005-08-28 15:07:45 UTC (rev 17586) @@ -128,12 +128,17 @@ CONFIGRET WINAPI CM_Connect_MachineA( PCSTR, PHMACHINE ); CONFIGRET WINAPI CM_Connect_MachineW( PCWSTR, PHMACHINE ); #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_Class_Key_NameA( LPGUID, LPSTR, PULONG, ULONG ); +CONFIGRET WINAPI CM_Get_Class_Key_NameW( LPGUID, LPWSTR, PULONG, ULONG ); +#define CM_Get_Class_Key_Name WINELIB_NAME_AW(CM_Get_Class_Key_Name) +CONFIGRET WINAPI CM_Get_Class_Key_Name_ExA( LPGUID, LPSTR, PULONG, ULONG, HMACHINE ); +CONFIGRET WINAPI CM_Get_Class_Key_Name_ExW( LPGUID, LPWSTR, PULONG, ULONG, HMACHINE ); +#define CM_Get_Class_Key_Name_Ex WINELIB_NAME_AW(CM_Get_Class_Key_Name_Ex) CONFIGRET WINAPI CM_Get_Depth( PULONG, DEVINST, ULONG ); CONFIGRET WINAPI CM_Get_Depth_Ex( PULONG, DEVINST, ULONG, HMACHINE ); CONFIGRET WINAPI CM_Get_DevNode_Registry_PropertyA( DEVINST, ULONG, PULONG, PVOID, PULONG, ULONG ); _____ Modified: trunk/reactos/lib/setupapi/cfgmgr.c --- trunk/reactos/lib/setupapi/cfgmgr.c 2005-08-28 12:23:37 UTC (rev 17585) +++ trunk/reactos/lib/setupapi/cfgmgr.c 2005-08-28 15:07:45 UTC (rev 17586) @@ -41,11 +41,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi); /* Registry key and value names */ +static const WCHAR Backslash[] = {'\\', 0}; +static const WCHAR Class[] = {'C','l','a','s','s',0}; + 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}; +static const WCHAR DeviceClasses[] = {'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','\\', + 'D','e','v','i','c','e','C','l','a','s','s','e','s',0}; typedef struct _MACHINE_INFO { @@ -318,6 +325,76 @@ /*********************************************************************** + * CM_Get_Class_Key_NameA [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Get_Class_Key_NameA( + LPGUID ClassGuid, LPSTR pszKeyName, PULONG pulLength, ULONG ulFlags) +{ + TRACE("%p %p %p %lx\n", + ClassGuid, pszKeyName, pulLength, ulFlags); + return CM_Get_Class_Key_Name_ExA(ClassGuid, pszKeyName, pulLength, + ulFlags, NULL); +} + + +/********************************************************************** * + * CM_Get_Class_Key_NameW [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Get_Class_Key_NameW( + LPGUID ClassGuid, LPWSTR pszKeyName, PULONG pulLength, ULONG ulFlags) +{ + TRACE("%p %p %p %lx\n", + ClassGuid, pszKeyName, pulLength, ulFlags); + return CM_Get_Class_Key_Name_ExW(ClassGuid, pszKeyName, pulLength, + ulFlags, NULL); +} + + +/********************************************************************** * + * CM_Get_Class_Key_Name_ExA [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Get_Class_Key_Name_ExA( + LPGUID ClassGuid, LPSTR pszKeyName, PULONG pulLength, ULONG ulFlags, + HMACHINE hMachine) +{ + FIXME("%p %p %p %lx %lx\n", + ClassGuid, pszKeyName, pulLength, ulFlags, hMachine); + return CR_FAILURE; +} + + +/********************************************************************** * + * CM_Get_Class_Key_Name_ExW [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Get_Class_Key_Name_ExW( + LPGUID ClassGuid, LPWSTR pszKeyName, PULONG pulLength, ULONG ulFlags, + HMACHINE hMachine) +{ + FIXME("%p %p %p %lx %lx\n", + ClassGuid, pszKeyName, pulLength, ulFlags, hMachine); + + if (ClassGuid == NULL || pszKeyName == NULL || pulLength == NULL) + return CR_INVALID_POINTER; + + if (ulFlags != 0) + return CR_INVALID_FLAG; + + if (*pulLength < MAX_GUID_STRING_LEN) + { + *pulLength = 0; + return CR_BUFFER_SMALL; + } + + if (UuidToStringW(ClassGuid, &pszKeyName) != RPC_S_OK) + return CR_INVALID_DATA; + + *pulLength = MAX_GUID_STRING_LEN; + + return CR_SUCCESS; +} + + +/********************************************************************** * * CM_Get_Depth [SETUPAPI.@] */ CONFIGRET WINAPI CM_Get_Depth( @@ -1246,6 +1323,165 @@ /*********************************************************************** + * CM_Open_Class_KeyA [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Open_Class_KeyA( + LPGUID pClassGuid, LPCSTR pszClassName, REGSAM samDesired, + REGDISPOSITION Disposition, PHKEY phkClass, ULONG ulFlags) +{ + TRACE("%p %s %lx %lx %p %lx\n", + debugstr_guid(pClassGuid), pszClassName, + samDesired, Disposition, phkClass, ulFlags); + + return CM_Open_Class_Key_ExA(pClassGuid, pszClassName, samDesired, + Disposition, phkClass, ulFlags, NULL); +} + + +/********************************************************************** * + * CM_Open_Class_KeyW [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Open_Class_KeyW( + LPGUID pClassGuid, LPCWSTR pszClassName, REGSAM samDesired, + REGDISPOSITION Disposition, PHKEY phkClass, ULONG ulFlags) +{ + TRACE("%p %s %lx %lx %p %lx\n", + debugstr_guid(pClassGuid), debugstr_w(pszClassName), + samDesired, Disposition, phkClass, ulFlags); + + return CM_Open_Class_Key_ExW(pClassGuid, pszClassName, samDesired, + Disposition, phkClass, ulFlags, NULL); +} + + +/********************************************************************** * + * CM_Open_Class_Key_ExA [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Open_Class_Key_ExA( + LPGUID pClassGuid, LPCSTR pszClassName, REGSAM samDesired, + REGDISPOSITION Disposition, PHKEY phkClass, ULONG ulFlags, + HMACHINE hMachine) +{ + CONFIGRET rc = CR_SUCCESS; + LPWSTR pszClassNameW = NULL; + + TRACE("%p %s %lx %lx %p %lx %lx\n", + debugstr_guid(pClassGuid), pszClassName, + samDesired, Disposition, phkClass, ulFlags, hMachine); + + if (pszClassName != NULL) + { + if (CaptureAndConvertAnsiArg(pszClassName, &pszClassNameW)) + return CR_INVALID_DATA; + } + + rc = CM_Open_Class_Key_ExW(pClassGuid, pszClassNameW, samDesired, + Disposition, phkClass, ulFlags, hMachine); + + if (pszClassNameW != NULL) + MyFree(pszClassNameW); + + return CR_SUCCESS; +} + + +/********************************************************************** * + * CM_Open_Class_Key_ExW [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Open_Class_Key_ExW( + LPGUID pClassGuid, LPCWSTR pszClassName, REGSAM samDesired, + REGDISPOSITION Disposition, PHKEY phkClass, ULONG ulFlags, + HMACHINE hMachine) +{ + WCHAR szKeyName[MAX_PATH]; + LPWSTR lpGuidString; + DWORD dwDisposition; + DWORD dwError; + HKEY hKey; + + TRACE("%p %s %lx %lx %p %lx %lx\n", + debugstr_guid(pClassGuid), debugstr_w(pszClassName), + samDesired, Disposition, phkClass, ulFlags, hMachine); + + /* Check Disposition and ulFlags */ + if ((Disposition & ~RegDisposition_Bits) || + (ulFlags & ~CM_OPEN_CLASS_KEY_BITS)) + return CR_INVALID_FLAG; + + /* Check phkClass */ + if (phkClass == NULL) + return CR_INVALID_POINTER; + + *phkClass = NULL; + + if (ulFlags == CM_OPEN_CLASS_KEY_INTERFACE && + pszClassName != NULL) + return CR_INVALID_DATA; + + if (hMachine == NULL) + { + hKey = HKEY_LOCAL_MACHINE; + } + else + { + if (RegConnectRegistryW(((PMACHINE_INFO)hMachine)->szMachineName, + HKEY_LOCAL_MACHINE, &hKey)) + return CR_REGISTRY_ERROR; + } + + if (ulFlags & CM_OPEN_CLASS_KEY_INTERFACE) + { + lstrcpyW(szKeyName, DeviceClasses); + } + else + { + lstrcpyW(szKeyName, ControlClass); + } + + if (pClassGuid != NULL) + { + if (UuidToStringW((UUID*)pClassGuid, &lpGuidString) != RPC_S_OK) + { + RegCloseKey(hKey); + return CR_INVALID_DATA; + } + + lstrcatW(szKeyName, Backslash); + lstrcatW(szKeyName, lpGuidString); + } + + if (Disposition == RegDisposition_OpenAlways) + { + dwError = RegCreateKeyExW(hKey, szKeyName, 0, NULL, 0, samDesired, + NULL, phkClass, &dwDisposition); + } + else + { + dwError = RegOpenKeyExW(hKey, szKeyName, 0, samDesired, phkClass); + } + + RegCloseKey(hKey); + + if (pClassGuid != NULL) + RpcStringFreeW(&lpGuidString); + + if (dwError != ERROR_SUCCESS) + { + *phkClass = NULL; + return CR_NO_SUCH_REGISTRY_KEY; + } + + if (pszClassName != NULL) + { + RegSetValueExW(*phkClass, Class, 0, REG_SZ, (LPBYTE)pszClassName, + (lstrlenW(pszClassName) + 1) * sizeof(WCHAR)); + } + + return CR_SUCCESS; +} + + +/********************************************************************** * * CM_Set_DevNode_Problem [SETUPAPI.@] */ CONFIGRET WINAPI CM_Set_DevNode_Problem( _____ Modified: trunk/reactos/lib/setupapi/setupapi.spec --- trunk/reactos/lib/setupapi/setupapi.spec 2005-08-28 12:23:37 UTC (rev 17585) +++ trunk/reactos/lib/setupapi/setupapi.spec 2005-08-28 15:07:45 UTC (rev 17586) @@ -55,10 +55,10 @@ @ stub CM_Free_Res_Des_Handle @ stdcall CM_Get_Child(ptr long long) @ stdcall CM_Get_Child_Ex(ptr long long long) -@ stub CM_Get_Class_Key_NameA -@ stub CM_Get_Class_Key_NameW -@ stub CM_Get_Class_Key_Name_ExA -@ stub CM_Get_Class_Key_Name_ExW +@ stdcall CM_Get_Class_Key_NameA(ptr str ptr long) +@ stdcall CM_Get_Class_Key_NameW(ptr wstr ptr long) +@ stdcall CM_Get_Class_Key_Name_ExA(ptr str ptr long long) +@ stdcall CM_Get_Class_Key_Name_ExW(ptr wstr ptr long long) @ stub CM_Get_Class_NameA @ stub CM_Get_Class_NameW @ stub CM_Get_Class_Name_ExA @@ -139,10 +139,10 @@ @ stub CM_Move_DevNode @ stub CM_Move_DevNode_Ex @ stub CM_Next_Range -@ stub CM_Open_Class_KeyA -@ stub CM_Open_Class_KeyW -@ stub CM_Open_Class_Key_ExA -@ stub CM_Open_Class_Key_ExW +@ stdcall CM_Open_Class_KeyA(ptr str long long ptr long) +@ stdcall CM_Open_Class_KeyW(ptr wstr long long ptr long) +@ stdcall CM_Open_Class_Key_ExA(ptr str long long ptr long long) +@ stdcall CM_Open_Class_Key_ExW(ptr wstr long long ptr long long) @ stub CM_Open_DevNode_Key @ stub CM_Open_DevNode_Key_Ex @ stub CM_Query_Arbitrator_Free_Data _____ Modified: trunk/reactos/services/umpnpmgr/umpnpmgr.c --- trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-08-28 12:23:37 UTC (rev 17585) +++ trunk/reactos/services/umpnpmgr/umpnpmgr.c 2005-08-28 15:07:45 UTC (rev 17586) @@ -635,6 +635,55 @@ CONFIGRET +PNP_GetClassName(handle_t BindingHandle, + wchar_t *ClassGuid, /* in */ + wchar_t *Buffer, /* out */ + unsigned long *Length, /* in out */ + unsigned long Flags) +{ + WCHAR szKeyName[MAX_PATH]; + CONFIGRET ret = CR_SUCCESS; + HKEY hKey = NULL; + ULONG ulSize; + + DPRINT1("PNP_GetClassName() called\n"); + + lstrcpyW(szKeyName, L"System\\CurrentControlSet\\Control\\Class"); + lstrcatW(szKeyName, L"\\"); + lstrcatW(szKeyName, ClassGuid); + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, + szKeyName, + 0, + KEY_QUERY_VALUE, + &hKey)) + return CR_REGISTRY_ERROR; + + ulSize = *Length * sizeof(WCHAR); + if (RegQueryValueExW(hKey, + L"Class", + NULL, + NULL, + (LPBYTE)Buffer, + &ulSize)) + { + *Length = 0; + ret = CR_REGISTRY_ERROR; + } + else + { + *Length = ulSize / sizeof(WCHAR); + } + + RegCloseKey(hKey); + + DPRINT1("PNP_GetClassName() done (returns %lx)\n", ret); + + return ret; +} + + +CONFIGRET PNP_GetDeviceStatus(handle_t BindingHandle, wchar_t *DeviceInstance, unsigned long *pStatus, _____ Modified: trunk/reactos/w32api/include/ddk/cfgmgr32.h --- trunk/reactos/w32api/include/ddk/cfgmgr32.h 2005-08-28 12:23:37 UTC (rev 17585) +++ trunk/reactos/w32api/include/ddk/cfgmgr32.h 2005-08-28 15:07:45 UTC (rev 17586) @@ -787,7 +787,7 @@ #define CM_Enumerate_Enumerators_Ex CM_Enumerate_Enumerators_ExW #else #define CM_Enumerate_Enumerators CM_Enumerate_EnumeratorsA -#define CM_Enumerate_Enumerators_Ex CM_Enumerate_Enumerators_ExW +#define CM_Enumerate_Enumerators_Ex CM_Enumerate_Enumerators_ExA #endif /* UNICODE */ /* FIXME: Obsolete CM_Find_Range */ @@ -864,8 +864,53 @@ /* FIXME: Obsolete CM_Get_Class_Name */ /* FIXME: Obsolete CM_Get_Class_Name_Ex */ -/* FIXME: Obsolete CM_Get_Class_Key_Name */ -/* FIXME: Obsolete CM_Get_Class_Key_Name_Ex */ + +CMAPI +CONFIGRET +WINAPI +CM_Get_Class_Key_NameA( + IN LPGUID ClassGuid, + OUT LPSTR pszKeyName, + IN OUT PULONG pulLength, + IN ULONG ulFlags); + +CMAPI +CONFIGRET +WINAPI +CM_Get_Class_Key_NameW( + IN LPGUID ClassGuid, + OUT LPWSTR pszKeyName, + IN OUT PULONG pulLength, + IN ULONG ulFlags); + +CMAPI +CONFIGRET +WINAPI +CM_Get_Class_Key_Name_ExA( + IN LPGUID ClassGuid, + OUT LPSTR pszKeyName, + IN OUT PULONG pulLength, + IN ULONG ulFlags, + IN HMACHINE hMachine); + +CMAPI +CONFIGRET +WINAPI +CM_Get_Class_Key_Name_ExW( + IN LPGUID ClassGuid, + OUT LPWSTR pszKeyName, + IN OUT PULONG pulLength, + IN ULONG ulFlags, + IN HMACHINE hMachine); + +#ifdef UNICODE +#define CM_Get_Class_Key_Name CM_Get_Class_Key_NameW +#define CM_Get_Class_Key_Name_Ex CM_Get_Class_Key_Name_ExW +#else +#define CM_Get_Class_Key_Name CM_Get_Class_Key_NameA +#define CM_Get_Class_Key_Name_Ex CM_Get_Class_Key_Name_ExA +#endif /* UNICODE */ + /* FIXME: Obsolete CM_Get_Class_Registry_Property */ CMAPI @@ -928,7 +973,7 @@ #define CM_Get_Device_ID_Ex CM_Get_Device_ID_ExW #else #define CM_Get_Device_ID CM_Get_Device_IDA -#define CM_Get_Device_ID_Ex CM_Get_Device_ID_ExW +#define CM_Get_Device_ID_Ex CM_Get_Device_ID_ExA #endif /* UNICODE */ CMAPI @@ -1440,8 +1485,61 @@ /* FIXME: Obsolete CM_Move_DevNode */ /* FIXME: Obsolete CM_Move_DevNode_Ex */ /* FIXME: Obsolete CM_Next_Range */ -/* FIXME: Obsolete CM_Open_Class_Key */ -/* FIXME: Obsolete CM_Open_Class_Key_Ex */ + +CMAPI +CONFIGRET +WINAPI +CM_Open_Class_KeyA( + IN LPGUID ClassGuid, OPTIONAL + IN LPCSTR pszClassName, OPTIONAL + IN REGSAM samDesired, + IN REGDISPOSITION Disposition, + OUT PHKEY phkClass, + IN ULONG ulFlags); + +CMAPI +CONFIGRET +WINAPI +CM_Open_Class_KeyW( + IN LPGUID ClassGuid, OPTIONAL + IN LPCWSTR pszClassName, OPTIONAL + IN REGSAM samDesired, + IN REGDISPOSITION Disposition, + OUT PHKEY phkClass, + IN ULONG ulFlags); + +CMAPI +CONFIGRET +WINAPI +CM_Open_Class_Key_ExA( + IN LPGUID pszClassGuid, OPTIONAL + IN LPCSTR pszClassName, OPTIONAL + IN REGSAM samDesired, + IN REGDISPOSITION Disposition, + OUT PHKEY phkClass, + IN ULONG ulFlags, + IN HMACHINE hMachine); + +CMAPI +CONFIGRET +WINAPI +CM_Open_Class_Key_ExW( + IN LPGUID pszClassGuid, OPTIONAL + IN LPCWSTR pszClassName, OPTIONAL + IN REGSAM samDesired, + IN REGDISPOSITION Disposition, + OUT PHKEY phkClass, + IN ULONG ulFlags, + IN HMACHINE hMachine); + +#ifdef UNICODE +#define CM_Open_Class_Key CM_Open_Class_KeyW +#define CM_Open_Class_Key_Ex CM_Open_Class_Key_ExW +#else +#define CM_Open_Class_Key CM_Open_Class_KeyA +#define CM_Open_Class_Key_Ex CM_Open_Class_Key_ExA +#endif /* UNICODE */ + /* FIXME: Obsolete CM_Open_DevNode_Key */ /* FIXME: Obsolete CM_Open_DevNode_Key_Ex */
19 years, 3 months
1
0
0
0
[royce] 17585: remove single "." entries from paths
by royce@svn.reactos.com
remove single "." entries from paths Modified: trunk/reactos/tools/rbuild/XML.cpp _____ Modified: trunk/reactos/tools/rbuild/XML.cpp --- trunk/reactos/tools/rbuild/XML.cpp 2005-08-28 12:18:13 UTC (rev 17584) +++ trunk/reactos/tools/rbuild/XML.cpp 2005-08-28 12:23:37 UTC (rev 17585) @@ -223,12 +223,15 @@ out.resize ( 0 ); while ( p ) { - out.push_back ( prev ); + if ( strcmp ( prev, "." ) ) + out.push_back ( prev ); prev = p; p = strtok ( NULL, "/\\" ); } if ( include_last ) out.push_back ( prev ); + if ( out.back() == "." ) + out.pop_back(); } XMLFile::XMLFile()
19 years, 3 months
1
0
0
0
[royce] 17584: remove transient debugging code
by royce@svn.reactos.com
remove transient debugging code Modified: trunk/reactos/tools/rbuild/backend/msvc/msvcmaker.cpp _____ Modified: trunk/reactos/tools/rbuild/backend/msvc/msvcmaker.cpp --- trunk/reactos/tools/rbuild/backend/msvc/msvcmaker.cpp 2005-08-28 12:08:53 UTC (rev 17583) +++ trunk/reactos/tools/rbuild/backend/msvc/msvcmaker.cpp 2005-08-28 12:18:13 UTC (rev 17584) @@ -84,8 +84,6 @@ string path = Path::RelativeFromDirectory ( incs[i]->directory, module.GetBasePath() ); - if ( !path.size() ) - i = i; includes.push_back ( path ); } }
19 years, 3 months
1
0
0
0
[royce] 17583: don't crash if path == base_directory.
by royce@svn.reactos.com
don't crash if path == base_directory. sorry I forgot to commit my changes to this file last night Modified: trunk/reactos/tools/rbuild/XML.cpp _____ Modified: trunk/reactos/tools/rbuild/XML.cpp --- trunk/reactos/tools/rbuild/XML.cpp 2005-08-28 12:03:25 UTC (rev 17582) +++ trunk/reactos/tools/rbuild/XML.cpp 2005-08-28 12:08:53 UTC (rev 17583) @@ -176,7 +176,9 @@ } string -Path::RelativeFromDirectory ( const string& path, const string& base_directory ) +Path::RelativeFromDirectory ( + const string& path, + const string& base_directory ) { vector<string> vbase, vpath, vout; Path::Split ( vbase, base_directory, true ); @@ -190,6 +192,8 @@ size_t i = 0; while ( i < vbase.size() && i < vpath.size() && vbase[i] == vpath[i] ) ++i; + if ( vbase.size() == vpath.size() && i == vpath.size() ) + return "."; if ( i < vbase.size() ) { // path goes above our base directory, we will need some ..'s
19 years, 3 months
1
0
0
0
[hbirr] 17582: - Allocate the csrss request buffer from heap if the necessary length is larger than the request structure.
by hbirr@svn.reactos.com
- Allocate the csrss request buffer from heap if the necessary length is larger than the request structure. - Fixed some buffer length calculations. Modified: trunk/reactos/include/subsys/csrss/csrss.h Modified: trunk/reactos/lib/kernel32/misc/console.c Modified: trunk/reactos/subsys/csrss/api/wapi.c Modified: trunk/reactos/subsys/csrss/win32csr/conio.c _____ Modified: trunk/reactos/include/subsys/csrss/csrss.h --- trunk/reactos/include/subsys/csrss/csrss.h 2005-08-28 11:58:06 UTC (rev 17581) +++ trunk/reactos/include/subsys/csrss/csrss.h 2005-08-28 12:03:25 UTC (rev 17582) @@ -412,12 +412,12 @@ #define CSR_API_MESSAGE_HEADER_SIZE(Type) (FIELD_OFFSET(CSR_API_MESSAGE, Data) + sizeof(Type)) #define CSRSS_MAX_WRITE_CONSOLE (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE)) -#define CSRSS_MAX_SET_TITLE (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE)) #define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR)) #define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB)) #define CSRSS_MAX_READ_CONSOLE (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE)) #define CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR)) #define CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB)) +#define CSRSS_MAX_GET_PROCESS_LIST (LPC_MAX_DATA_LENGTH - CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_PROCESS_LIST)) /* WCHARs, not bytes! */ #define CSRSS_MAX_TITLE_LENGTH 80 @@ -462,7 +462,7 @@ #define GET_OUTPUT_HANDLE (0x25) #define CLOSE_HANDLE (0x26) #define VERIFY_HANDLE (0x27) -#define DUPLICATE_HANDLE (0x28) +#define DUPLICATE_HANDLE (0x28) #define SETGET_CONSOLE_HW_STATE (0x29) #define GET_CONSOLE_WINDOW (0x2A) #define CREATE_DESKTOP (0x2B) @@ -475,7 +475,7 @@ #define SET_CONSOLE_CP (0x32) #define GET_CONSOLE_OUTPUT_CP (0x33) #define SET_CONSOLE_OUTPUT_CP (0x34) -#define GET_INPUT_WAIT_HANDLE (0x35) +#define GET_INPUT_WAIT_HANDLE (0x35) #define GET_PROCESS_LIST (0x36) /* Keep in sync with definition below. */ @@ -483,76 +483,65 @@ typedef struct _CSR_API_MESSAGE { + PORT_MESSAGE Header; + ULONG Type; + NTSTATUS Status; union { - PORT_MESSAGE Header; - union - { - struct - { - BYTE HeaderReserved[sizeof(PORT_MESSAGE)]; - ULONG Type; - NTSTATUS Status; - union - { - CSRSS_CREATE_PROCESS CreateProcessRequest; - CSRSS_CONNECT_PROCESS ConnectRequest; - CSRSS_WRITE_CONSOLE WriteConsoleRequest; - CSRSS_READ_CONSOLE ReadConsoleRequest; - CSRSS_ALLOC_CONSOLE AllocConsoleRequest; - CSRSS_SCREEN_BUFFER_INFO ScreenBufferInfoRequest; - CSRSS_SET_CURSOR SetCursorRequest; - CSRSS_FILL_OUTPUT FillOutputRequest; - CSRSS_READ_INPUT ReadInputRequest; - CSRSS_WRITE_CONSOLE_OUTPUT_CHAR WriteConsoleOutputCharRequest; - CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB WriteConsoleOutputAttribRequest; - CSRSS_FILL_OUTPUT_ATTRIB FillOutputAttribRequest; - CSRSS_SET_CURSOR_INFO SetCursorInfoRequest; - CSRSS_GET_CURSOR_INFO GetCursorInfoRequest; - CSRSS_SET_ATTRIB SetAttribRequest; - CSRSS_SET_CONSOLE_MODE SetConsoleModeRequest; - CSRSS_GET_CONSOLE_MODE GetConsoleModeRequest; - CSRSS_CREATE_SCREEN_BUFFER CreateScreenBufferRequest; - CSRSS_SET_SCREEN_BUFFER SetScreenBufferRequest; - CSRSS_SET_TITLE SetTitleRequest; - CSRSS_GET_TITLE GetTitleRequest; - CSRSS_WRITE_CONSOLE_OUTPUT WriteConsoleOutputRequest; - CSRSS_FLUSH_INPUT_BUFFER FlushInputBufferRequest; - CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER ScrollConsoleScreenBufferRequest; - CSRSS_READ_CONSOLE_OUTPUT_CHAR ReadConsoleOutputCharRequest; - CSRSS_READ_CONSOLE_OUTPUT_ATTRIB ReadConsoleOutputAttribRequest; - CSRSS_GET_NUM_INPUT_EVENTS GetNumInputEventsRequest; - CSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest; - CSRSS_EXIT_REACTOS ExitReactosRequest; - CSRSS_SET_SHUTDOWN_PARAMETERS SetShutdownParametersRequest; - CSRSS_GET_SHUTDOWN_PARAMETERS GetShutdownParametersRequest; - CSRSS_PEEK_CONSOLE_INPUT PeekConsoleInputRequest; - CSRSS_READ_CONSOLE_OUTPUT ReadConsoleOutputRequest; - CSRSS_WRITE_CONSOLE_INPUT WriteConsoleInputRequest; - CSRSS_GET_INPUT_HANDLE GetInputHandleRequest; - CSRSS_GET_OUTPUT_HANDLE GetOutputHandleRequest; - CSRSS_CLOSE_HANDLE CloseHandleRequest; - CSRSS_VERIFY_HANDLE VerifyHandleRequest; - CSRSS_DUPLICATE_HANDLE DuplicateHandleRequest; - CSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest; - CSRSS_GET_CONSOLE_WINDOW GetConsoleWindowRequest; - CSRSS_CREATE_DESKTOP CreateDesktopRequest; - CSRSS_SHOW_DESKTOP ShowDesktopRequest; - CSRSS_HIDE_DESKTOP HideDesktopRequest; - CSRSS_SET_CONSOLE_ICON SetConsoleIconRequest; - CSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest; - CSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest; - CSRSS_GET_CONSOLE_CP GetConsoleCodePage; - CSRSS_SET_CONSOLE_CP SetConsoleCodePage; - CSRSS_GET_CONSOLE_OUTPUT_CP GetConsoleOutputCodePage; - CSRSS_SET_CONSOLE_OUTPUT_CP SetConsoleOutputCodePage; - CSRSS_GET_INPUT_WAIT_HANDLE GetConsoleInputWaitHandle; - CSRSS_GET_PROCESS_LIST GetProcessListRequest; - } Data; - }; - UCHAR PadBuffer[PORT_MAXIMUM_MESSAGE_LENGTH]; - }; - }; + CSRSS_CREATE_PROCESS CreateProcessRequest; + CSRSS_CONNECT_PROCESS ConnectRequest; + CSRSS_WRITE_CONSOLE WriteConsoleRequest; + CSRSS_READ_CONSOLE ReadConsoleRequest; + CSRSS_ALLOC_CONSOLE AllocConsoleRequest; + CSRSS_SCREEN_BUFFER_INFO ScreenBufferInfoRequest; + CSRSS_SET_CURSOR SetCursorRequest; + CSRSS_FILL_OUTPUT FillOutputRequest; + CSRSS_READ_INPUT ReadInputRequest; + CSRSS_WRITE_CONSOLE_OUTPUT_CHAR WriteConsoleOutputCharRequest; + CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB WriteConsoleOutputAttribRequest; + CSRSS_FILL_OUTPUT_ATTRIB FillOutputAttribRequest; + CSRSS_SET_CURSOR_INFO SetCursorInfoRequest; + CSRSS_GET_CURSOR_INFO GetCursorInfoRequest; + CSRSS_SET_ATTRIB SetAttribRequest; + CSRSS_SET_CONSOLE_MODE SetConsoleModeRequest; + CSRSS_GET_CONSOLE_MODE GetConsoleModeRequest; + CSRSS_CREATE_SCREEN_BUFFER CreateScreenBufferRequest; + CSRSS_SET_SCREEN_BUFFER SetScreenBufferRequest; + CSRSS_SET_TITLE SetTitleRequest; + CSRSS_GET_TITLE GetTitleRequest; + CSRSS_WRITE_CONSOLE_OUTPUT WriteConsoleOutputRequest; + CSRSS_FLUSH_INPUT_BUFFER FlushInputBufferRequest; + CSRSS_SCROLL_CONSOLE_SCREEN_BUFFER ScrollConsoleScreenBufferRequest; + CSRSS_READ_CONSOLE_OUTPUT_CHAR ReadConsoleOutputCharRequest; + CSRSS_READ_CONSOLE_OUTPUT_ATTRIB ReadConsoleOutputAttribRequest; + CSRSS_GET_NUM_INPUT_EVENTS GetNumInputEventsRequest; + CSRSS_REGISTER_SERVICES_PROCESS RegisterServicesProcessRequest; + CSRSS_EXIT_REACTOS ExitReactosRequest; + CSRSS_SET_SHUTDOWN_PARAMETERS SetShutdownParametersRequest; + CSRSS_GET_SHUTDOWN_PARAMETERS GetShutdownParametersRequest; + CSRSS_PEEK_CONSOLE_INPUT PeekConsoleInputRequest; + CSRSS_READ_CONSOLE_OUTPUT ReadConsoleOutputRequest; + CSRSS_WRITE_CONSOLE_INPUT WriteConsoleInputRequest; + CSRSS_GET_INPUT_HANDLE GetInputHandleRequest; + CSRSS_GET_OUTPUT_HANDLE GetOutputHandleRequest; + CSRSS_CLOSE_HANDLE CloseHandleRequest; + CSRSS_VERIFY_HANDLE VerifyHandleRequest; + CSRSS_DUPLICATE_HANDLE DuplicateHandleRequest; + CSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest; + CSRSS_GET_CONSOLE_WINDOW GetConsoleWindowRequest; + CSRSS_CREATE_DESKTOP CreateDesktopRequest; + CSRSS_SHOW_DESKTOP ShowDesktopRequest; + CSRSS_HIDE_DESKTOP HideDesktopRequest; + CSRSS_SET_CONSOLE_ICON SetConsoleIconRequest; + CSRSS_SET_LOGON_NOTIFY_WINDOW SetLogonNotifyWindowRequest; + CSRSS_REGISTER_LOGON_PROCESS RegisterLogonProcessRequest; + CSRSS_GET_CONSOLE_CP GetConsoleCodePage; + CSRSS_SET_CONSOLE_CP SetConsoleCodePage; + CSRSS_GET_CONSOLE_OUTPUT_CP GetConsoleOutputCodePage; + CSRSS_SET_CONSOLE_OUTPUT_CP SetConsoleOutputCodePage; + CSRSS_GET_INPUT_WAIT_HANDLE GetConsoleInputWaitHandle; + CSRSS_GET_PROCESS_LIST GetProcessListRequest; + } Data; } CSR_API_MESSAGE, *PCSR_API_MESSAGE; #endif /* __INCLUDE_CSRSS_CSRSS_H */ _____ Modified: trunk/reactos/lib/kernel32/misc/console.c --- trunk/reactos/lib/kernel32/misc/console.c 2005-08-28 11:58:06 UTC (rev 17581) +++ trunk/reactos/lib/kernel32/misc/console.c 2005-08-28 12:03:25 UTC (rev 17582) @@ -1097,7 +1097,7 @@ LPVOID lpReserved, BOOL bUnicode) { - CSR_API_MESSAGE Request; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; USHORT nChars; @@ -1105,40 +1105,51 @@ DWORD Written = 0; CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max(sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE) + + min(nNumberOfCharsToWrite, CSRSS_MAX_WRITE_CONSOLE / CharSize) * CharSize)); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } CsrRequest = MAKE_CSR_API(WRITE_CONSOLE, CSR_CONSOLE); - Request.Data.WriteConsoleRequest.ConsoleHandle = hConsoleOutput; - Request.Data.WriteConsoleRequest.Unicode = bUnicode; + Request->Data.WriteConsoleRequest.ConsoleHandle = hConsoleOutput; + Request->Data.WriteConsoleRequest.Unicode = bUnicode; while(nNumberOfCharsToWrite > 0) { - nChars = min(nNumberOfCharsToWrite, CSRSS_MAX_WRITE_CONSOLE) / CharSize; - Request.Data.WriteConsoleRequest.NrCharactersToWrite = nChars; + nChars = min(nNumberOfCharsToWrite, CSRSS_MAX_WRITE_CONSOLE / CharSize); + Request->Data.WriteConsoleRequest.NrCharactersToWrite = nChars; SizeBytes = nChars * CharSize; - memcpy(Request.Data.WriteConsoleRequest.Buffer, lpBuffer, SizeBytes); + memcpy(Request->Data.WriteConsoleRequest.Buffer, lpBuffer, SizeBytes); - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); + max(sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE) + SizeBytes)); - if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus(Status); return FALSE; } nNumberOfCharsToWrite -= nChars; lpBuffer = (PVOID)((ULONG_PTR)lpBuffer + (ULONG_PTR)SizeBytes); - Written += Request.Data.WriteConsoleRequest.NrCharactersWritten; + Written += Request->Data.WriteConsoleRequest.NrCharactersWritten; } if(lpNumberOfCharsWritten != NULL) { *lpNumberOfCharsWritten = Written; } + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); return TRUE; } @@ -1196,20 +1207,29 @@ LPVOID lpReserved, BOOL bUnicode) { - CSR_API_MESSAGE Request; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; ULONG CharSize, CharsRead = 0; CharSize = (bUnicode ? sizeof(WCHAR) : sizeof(CHAR)); + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max(sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE) + + min(nNumberOfCharsToRead, CSRSS_MAX_READ_CONSOLE / CharSize) * CharSize)); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } - Request.Status = STATUS_SUCCESS; + Request->Status = STATUS_SUCCESS; do { - if(Request.Status == STATUS_PENDING) + if(Request->Status == STATUS_PENDING) { - Status = NtWaitForSingleObject(Request.Data.ReadConsoleRequest.EventHandle, FALSE, 0); + Status = NtWaitForSingleObject(Request->Data.ReadConsoleRequest.EventHandle, FALSE, 0); if(!NT_SUCCESS(Status)) { DPRINT1("Wait for console input failed!\n"); @@ -1218,44 +1238,49 @@ } CsrRequest = MAKE_CSR_API(READ_CONSOLE, CSR_CONSOLE); - Request.Data.ReadConsoleRequest.ConsoleHandle = hConsoleInput; - Request.Data.ReadConsoleRequest.Unicode = bUnicode; - Request.Data.ReadConsoleRequest.NrCharactersToRead = min(nNumberOfCharsToRead, CSRSS_MAX_READ_CONSOLE) / CharSize; - Request.Data.ReadConsoleRequest.nCharsCanBeDeleted = CharsRead; - Status = CsrClientCallServer(&Request, + Request->Data.ReadConsoleRequest.ConsoleHandle = hConsoleInput; + Request->Data.ReadConsoleRequest.Unicode = bUnicode; + Request->Data.ReadConsoleRequest.NrCharactersToRead = min(nNumberOfCharsToRead, CSRSS_MAX_READ_CONSOLE / CharSize); + Request->Data.ReadConsoleRequest.nCharsCanBeDeleted = CharsRead; + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); + max(sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE) + + Request->Data.ReadConsoleRequest.NrCharactersToRead * CharSize)); - if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { DPRINT1("CSR returned error in ReadConsole\n"); + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus(Status); return FALSE; } - nNumberOfCharsToRead -= Request.Data.ReadConsoleRequest.NrCharactersRead; + nNumberOfCharsToRead -= Request->Data.ReadConsoleRequest.NrCharactersRead; memcpy((PVOID)((ULONG_PTR)lpBuffer + (ULONG_PTR)(CharsRead * CharSize)), - Request.Data.ReadConsoleRequest.Buffer, - Request.Data.ReadConsoleRequest.NrCharactersRead * CharSize); - CharsRead += Request.Data.ReadConsoleRequest.NrCharactersRead; + Request->Data.ReadConsoleRequest.Buffer, + Request->Data.ReadConsoleRequest.NrCharactersRead * CharSize); + CharsRead += Request->Data.ReadConsoleRequest.NrCharactersRead; - if(Request.Status == STATUS_NOTIFY_CLEANUP) + if(Request->Status == STATUS_NOTIFY_CLEANUP) { if(CharsRead > 0) { CharsRead--; nNumberOfCharsToRead++; } - Request.Status = STATUS_PENDING; + Request->Status = STATUS_PENDING; } - } while(Request.Status == STATUS_PENDING && nNumberOfCharsToRead > 0); + } while(Request->Status == STATUS_PENDING && nNumberOfCharsToRead > 0); if(lpNumberOfCharsRead != NULL) { *lpNumberOfCharsRead = CharsRead; } + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return TRUE; } @@ -2018,7 +2043,7 @@ LPDWORD lpNumberOfCharsRead, BOOL bUnicode) { - CSR_API_MESSAGE Request; ULONG CsrRequest; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; ULONG nChars, SizeBytes, CharSize; DWORD CharsRead = 0; @@ -2028,35 +2053,47 @@ nChars = min(nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR) / CharSize; SizeBytes = nChars * CharSize; + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max(sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) + + min (nChars, CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR / CharSize) * CharSize)); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + CsrRequest = MAKE_CSR_API(READ_CONSOLE_OUTPUT_CHAR, CSR_CONSOLE); - Request.Data.ReadConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput; - Request.Data.ReadConsoleOutputCharRequest.Unicode = bUnicode; - Request.Data.ReadConsoleOutputCharRequest.ReadCoord = dwReadCoord; + Request->Data.ReadConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput; + Request->Data.ReadConsoleOutputCharRequest.Unicode = bUnicode; + Request->Data.ReadConsoleOutputCharRequest.ReadCoord = dwReadCoord; while(nLength > 0) { DWORD BytesRead; - Request.Data.ReadConsoleOutputCharRequest.NumCharsToRead = min(nLength, nChars); - SizeBytes = Request.Data.ReadConsoleOutputCharRequest.NumCharsToRead * CharSize; + Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead = min(nLength, nChars); + SizeBytes = Request->Data.ReadConsoleOutputCharRequest.NumCharsToRead * CharSize; - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); - if(!NT_SUCCESS(Status) || !NT_SUCCESS(Request.Status)) + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_CHAR) + SizeBytes)); + if(!NT_SUCCESS(Status) || !NT_SUCCESS(Request->Status)) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus(Status); break; } - BytesRead = Request.Data.ReadConsoleOutputCharRequest.CharsRead * CharSize; - memcpy(lpCharacter, Request.Data.ReadConsoleOutputCharRequest.String, BytesRead); + BytesRead = Request->Data.ReadConsoleOutputCharRequest.CharsRead * CharSize; + memcpy(lpCharacter, Request->Data.ReadConsoleOutputCharRequest.String, BytesRead); lpCharacter = (PVOID)((ULONG_PTR)lpCharacter + (ULONG_PTR)BytesRead); - CharsRead += Request.Data.ReadConsoleOutputCharRequest.CharsRead; - nLength -= Request.Data.ReadConsoleOutputCharRequest.CharsRead; + CharsRead += Request->Data.ReadConsoleOutputCharRequest.CharsRead; + nLength -= Request->Data.ReadConsoleOutputCharRequest.CharsRead; - Request.Data.ReadConsoleOutputCharRequest.ReadCoord = Request.Data.ReadConsoleOutputCharRequest.EndCoord; + Request->Data.ReadConsoleOutputCharRequest.ReadCoord = Request->Data.ReadConsoleOutputCharRequest.EndCoord; } if(lpNumberOfCharsRead != NULL) @@ -2064,6 +2101,8 @@ *lpNumberOfCharsRead = CharsRead; } + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return TRUE; } @@ -2131,16 +2170,26 @@ LPDWORD lpNumberOfAttrsRead ) { - CSR_API_MESSAGE Request; ULONG CsrRequest; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; DWORD Size; if (lpNumberOfAttrsRead != NULL) *lpNumberOfAttrsRead = nLength; + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max(sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB) + + min (nLength, CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB / sizeof(WORD)) * sizeof(WORD))); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + CsrRequest = MAKE_CSR_API(READ_CONSOLE_OUTPUT_ATTRIB, CSR_CONSOLE); - Request.Data.ReadConsoleOutputAttribRequest.ConsoleHandle = hConsoleOutput; - Request.Data.ReadConsoleOutputAttribRequest.ReadCoord = dwReadCoord; + Request->Data.ReadConsoleOutputAttribRequest.ConsoleHandle = hConsoleOutput; + Request->Data.ReadConsoleOutputAttribRequest.ReadCoord = dwReadCoord; while (nLength != 0) { @@ -2149,24 +2198,28 @@ else Size = nLength; - Request.Data.ReadConsoleOutputAttribRequest.NumAttrsToRead = Size; + Request->Data.ReadConsoleOutputAttribRequest.NumAttrsToRead = Size; - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Request.Status)) + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB) + Size * sizeof(WORD))); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(Request->Status)) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus(Status); return(FALSE); } - memcpy(lpAttribute, Request.Data.ReadConsoleOutputAttribRequest.Attribute, Size * sizeof(WORD)); + memcpy(lpAttribute, Request->Data.ReadConsoleOutputAttribRequest.Attribute, Size * sizeof(WORD)); lpAttribute += Size; nLength -= Size; - Request.Data.ReadConsoleOutputAttribRequest.ReadCoord = Request.Data.ReadConsoleOutputAttribRequest.EndCoord; + Request->Data.ReadConsoleOutputAttribRequest.ReadCoord = Request->Data.ReadConsoleOutputAttribRequest.EndCoord; } + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return(TRUE); } @@ -2179,7 +2232,7 @@ LPDWORD lpNumberOfCharsWritten, BOOL bUnicode) { - CSR_API_MESSAGE Request; ULONG CsrRequest; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; ULONG SizeBytes, CharSize, nChars; DWORD Written = 0; @@ -2189,36 +2242,48 @@ nChars = min(nLength, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR / CharSize); SizeBytes = nChars * CharSize; + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR) + + min (nChars, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR / CharSize) * CharSize)); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + CsrRequest = MAKE_CSR_API(WRITE_CONSOLE_OUTPUT_CHAR, CSR_CONSOLE); - Request.Data.WriteConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput; - Request.Data.WriteConsoleOutputCharRequest.Unicode = bUnicode; - Request.Data.WriteConsoleOutputCharRequest.Coord = dwWriteCoord; + Request->Data.WriteConsoleOutputCharRequest.ConsoleHandle = hConsoleOutput; + Request->Data.WriteConsoleOutputCharRequest.Unicode = bUnicode; + Request->Data.WriteConsoleOutputCharRequest.Coord = dwWriteCoord; while(nLength > 0) { DWORD BytesWrite; - Request.Data.WriteConsoleOutputCharRequest.Length = min(nLength, nChars); - BytesWrite = Request.Data.WriteConsoleOutputCharRequest.Length * CharSize; + Request->Data.WriteConsoleOutputCharRequest.Length = min(nLength, nChars); + BytesWrite = Request->Data.WriteConsoleOutputCharRequest.Length * CharSize; - memcpy(Request.Data.WriteConsoleOutputCharRequest.String, lpCharacter, BytesWrite); + memcpy(Request->Data.WriteConsoleOutputCharRequest.String, lpCharacter, BytesWrite); - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR) + BytesWrite)); - if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus(Status); return FALSE; } - nLength -= Request.Data.WriteConsoleOutputCharRequest.NrCharactersWritten; - lpCharacter = (PVOID)((ULONG_PTR)lpCharacter + (ULONG_PTR)(Request.Data.WriteConsoleOutputCharRequest.NrCharactersWritt en * CharSize)); - Written += Request.Data.WriteConsoleOutputCharRequest.NrCharactersWritten; + nLength -= Request->Data.WriteConsoleOutputCharRequest.NrCharactersWritten; + lpCharacter = (PVOID)((ULONG_PTR)lpCharacter + (ULONG_PTR)(Request->Data.WriteConsoleOutputCharRequest.NrCharactersWrit ten * CharSize)); + Written += Request->Data.WriteConsoleOutputCharRequest.NrCharactersWritten; - Request.Data.WriteConsoleOutputCharRequest.Coord = Request.Data.WriteConsoleOutputCharRequest.EndCoord; + Request->Data.WriteConsoleOutputCharRequest.Coord = Request->Data.WriteConsoleOutputCharRequest.EndCoord; } if(lpNumberOfCharsWritten != NULL) @@ -2226,6 +2291,8 @@ *lpNumberOfCharsWritten = Written; } + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return TRUE; } @@ -2287,32 +2354,50 @@ LPDWORD lpNumberOfAttrsWritten ) { - CSR_API_MESSAGE Request; ULONG CsrRequest; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; WORD Size; + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB) + + min(nLength, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB / sizeof(WORD)) * sizeof(WORD))); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + CsrRequest = MAKE_CSR_API(WRITE_CONSOLE_OUTPUT_ATTRIB, CSR_CONSOLE); - Request.Data.WriteConsoleOutputAttribRequest.ConsoleHandle = hConsoleOutput; - Request.Data.WriteConsoleOutputAttribRequest.Coord = dwWriteCoord; + Request->Data.WriteConsoleOutputAttribRequest.ConsoleHandle = hConsoleOutput; + Request->Data.WriteConsoleOutputAttribRequest.Coord = dwWriteCoord; if( lpNumberOfAttrsWritten ) *lpNumberOfAttrsWritten = nLength; while( nLength ) { Size = min(nLength, CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB / sizeof(WORD)); - Request.Data.WriteConsoleOutputAttribRequest.Length = Size; - memcpy(Request.Data.WriteConsoleOutputAttribRequest.Attribute, lpAttribute, Size * sizeof(WORD)); + Request->Data.WriteConsoleOutputAttribRequest.Length = Size; + memcpy(Request->Data.WriteConsoleOutputAttribRequest.Attribute, lpAttribute, Size * sizeof(WORD)); - Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); - if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request.Status ) ) + Status = CsrClientCallServer( Request, + NULL, + CsrRequest, + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB) + Size * sizeof(WORD))); + + if( !NT_SUCCESS( Status ) || !NT_SUCCESS( Status = Request->Status ) ) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus ( Status ); return FALSE; } nLength -= Size; lpAttribute += Size; - Request.Data.WriteConsoleOutputAttribRequest.Coord = Request.Data.WriteConsoleOutputAttribRequest.EndCoord; + Request->Data.WriteConsoleOutputAttribRequest.Coord = Request->Data.WriteConsoleOutputAttribRequest.EndCoord; } + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return TRUE; } @@ -2879,7 +2964,7 @@ DWORD nSize ) { - CSR_API_MESSAGE Request; ULONG CsrRequest; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; HANDLE hConsole; @@ -2889,32 +2974,43 @@ return 0; } + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_TITLE) + CSRSS_MAX_TITLE_LENGTH * sizeof(WCHAR)); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + CsrRequest = MAKE_CSR_API(GET_TITLE, CSR_CONSOLE); - Request.Data.GetTitleRequest.ConsoleHandle = hConsole; + Request->Data.GetTitleRequest.ConsoleHandle = hConsole; - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_TITLE) + CSRSS_MAX_TITLE_LENGTH * sizeof(WCHAR)); CloseHandle(hConsole); - if(!NT_SUCCESS(Status) || !(NT_SUCCESS(Status = Request.Status))) + if(!NT_SUCCESS(Status) || !(NT_SUCCESS(Status = Request->Status))) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus(Status); return 0; } - if(nSize * sizeof(WCHAR) < Request.Data.GetTitleRequest.Length) + if(nSize * sizeof(WCHAR) < Request->Data.GetTitleRequest.Length) { - wcsncpy(lpConsoleTitle, Request.Data.GetTitleRequest.Title, nSize - 1); + wcsncpy(lpConsoleTitle, Request->Data.GetTitleRequest.Title, nSize - 1); lpConsoleTitle[nSize--] = L'\0'; } else { - nSize = Request.Data.GetTitleRequest.Length / sizeof (WCHAR); - wcscpy(lpConsoleTitle, Request.Data.GetTitleRequest.Title); + nSize = Request->Data.GetTitleRequest.Length / sizeof (WCHAR); + wcscpy(lpConsoleTitle, Request->Data.GetTitleRequest.Title); lpConsoleTitle[nSize] = L'\0'; } + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return nSize; } @@ -2971,7 +3067,7 @@ LPCWSTR lpConsoleTitle ) { - CSR_API_MESSAGE Request; ULONG CsrRequest; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; unsigned int c; HANDLE hConsole; @@ -2982,24 +3078,36 @@ return FALSE; } + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) + + min (wcslen(lpConsoleTitle), CSRSS_MAX_TITLE_LENGTH) * sizeof(WCHAR))); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + CsrRequest = MAKE_CSR_API(SET_TITLE, CSR_CONSOLE); - Request.Data.SetTitleRequest.Console = hConsole; + Request->Data.SetTitleRequest.Console = hConsole; for( c = 0; lpConsoleTitle[c] && c < CSRSS_MAX_TITLE_LENGTH; c++ ) - Request.Data.SetTitleRequest.Title[c] = lpConsoleTitle[c]; - // add null - Request.Data.SetTitleRequest.Title[c] = 0; - Request.Data.SetTitleRequest.Length = c; - Status = CsrClientCallServer(&Request, + Request->Data.SetTitleRequest.Title[c] = lpConsoleTitle[c]; + Request->Data.SetTitleRequest.Length = c * sizeof(WCHAR); + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); + max (sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) + c * sizeof(WCHAR))); CloseHandle(hConsole); - if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Request.Status ) ) + if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Request->Status ) ) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus (Status); return(FALSE); } + + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return TRUE; } @@ -3017,7 +3125,7 @@ LPCSTR lpConsoleTitle ) { - CSR_API_MESSAGE Request; ULONG CsrRequest; + PCSR_API_MESSAGE Request; ULONG CsrRequest; NTSTATUS Status; unsigned int c; HANDLE hConsole; @@ -3028,24 +3136,36 @@ return FALSE; } + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) + + min (strlen(lpConsoleTitle), CSRSS_MAX_TITLE_LENGTH) * sizeof(WCHAR))); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + CsrRequest = MAKE_CSR_API(SET_TITLE, CSR_CONSOLE); - Request.Data.SetTitleRequest.Console = hConsole; + Request->Data.SetTitleRequest.Console = hConsole; for( c = 0; lpConsoleTitle[c] && c < CSRSS_MAX_TITLE_LENGTH; c++ ) - Request.Data.SetTitleRequest.Title[c] = lpConsoleTitle[c]; - // add null - Request.Data.SetTitleRequest.Title[c] = 0; - Request.Data.SetTitleRequest.Length = c; - Status = CsrClientCallServer(&Request, + Request->Data.SetTitleRequest.Title[c] = lpConsoleTitle[c]; + Request->Data.SetTitleRequest.Length = c * sizeof(WCHAR); + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); + max (sizeof(CSR_API_MESSAGE), CSR_API_MESSAGE_HEADER_SIZE(CSRSS_SET_TITLE) + c * sizeof(WCHAR))); CloseHandle(hConsole); - if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Request.Status ) ) + if (!NT_SUCCESS(Status) || !NT_SUCCESS( Status = Request->Status ) ) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus (Status); return(FALSE); } + + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return TRUE; } @@ -3194,7 +3314,7 @@ GetConsoleProcessList(LPDWORD lpdwProcessList, DWORD dwProcessCount) { - CSR_API_MESSAGE Request; ULONG CsrRequest; + PCSR_API_MESSAGE Request; ULONG CsrRequest; ULONG nProcesses; NTSTATUS Status; @@ -3204,34 +3324,42 @@ return 0; } + Request = RtlAllocateHeap(RtlGetProcessHeap(), 0, + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_PROCESS_LIST) + + min (dwProcessCount, CSRSS_MAX_GET_PROCESS_LIST / sizeof(DWORD)) * sizeof(DWORD))); + if (Request == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + CsrRequest = MAKE_CSR_API(GET_PROCESS_LIST, CSR_CONSOLE); - Request.Data.GetProcessListRequest.nMaxIds = dwProcessCount; + Request->Data.GetProcessListRequest.nMaxIds = min (dwProcessCount, CSRSS_MAX_GET_PROCESS_LIST / sizeof(DWORD)); - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer(Request, NULL, CsrRequest, - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + max (sizeof(CSR_API_MESSAGE), + CSR_API_MESSAGE_HEADER_SIZE(CSRSS_GET_PROCESS_LIST) + + Request->Data.GetProcessListRequest.nMaxIds * sizeof(DWORD))); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); SetLastErrorByStatus (Status); nProcesses = 0; } else { - if(dwProcessCount >= Request.Data.GetProcessListRequest.nProcessIdsTotal) + nProcesses = Request->Data.GetProcessListRequest.nProcessIdsCopied; + if(dwProcessCount >= nProcesses) { - nProcesses = Request.Data.GetProcessListRequest.nProcessIdsCopied; - for(nProcesses = 0; nProcesses < Request.Data.GetProcessListRequest.nProcessIdsCopied; nProcesses++) - { - *(lpdwProcessList++) = (DWORD)Request.Data.GetProcessListRequest.ProcessId[nProcesses]; - } + memcpy(lpdwProcessList, Request->Data.GetProcessListRequest.ProcessId, nProcesses * sizeof(DWORD)); } - else - { - nProcesses = Request.Data.GetProcessListRequest.nProcessIdsTotal; - } } + RtlFreeHeap(RtlGetProcessHeap(), 0, Request); + return nProcesses; } _____ Modified: trunk/reactos/subsys/csrss/api/wapi.c --- trunk/reactos/subsys/csrss/api/wapi.c 2005-08-28 11:58:06 UTC (rev 17581) +++ trunk/reactos/subsys/csrss/api/wapi.c 2005-08-28 12:03:25 UTC (rev 17582) @@ -108,7 +108,8 @@ ClientConnectionThread(HANDLE ServerPort) { NTSTATUS Status; - CSR_API_MESSAGE Request; + BYTE RawRequest[LPC_MAX_DATA_LENGTH]; + PCSR_API_MESSAGE Request = (PCSR_API_MESSAGE)RawRequest; PCSR_API_MESSAGE Reply; PCSRSS_PROCESS_DATA ProcessData; @@ -124,7 +125,7 @@ Status = NtReplyWaitReceivePort(ServerPort, 0, &Reply->Header, - &Request.Header); + &Request->Header); if (!NT_SUCCESS(Status)) { DPRINT1("CSR: NtReplyWaitReceivePort failed\n"); @@ -132,31 +133,31 @@ } /* If the connection was closed, handle that */ - if (Request.Header.u2.s2.Type == LPC_PORT_CLOSED) + if (Request->Header.u2.s2.Type == LPC_PORT_CLOSED) { - CsrFreeProcessData( Request.Header.ClientId.UniqueProcess ); + CsrFreeProcessData( Request->Header.ClientId.UniqueProcess ); break; } DPRINT("CSR: Got CSR API: %x [Message Origin: %x]\n", - Request.Type, - Request.Header.ClientId.UniqueProcess); + Request->Type, + Request->Header.ClientId.UniqueProcess); /* Get the Process Data */ - ProcessData = CsrGetProcessData(Request.Header.ClientId.UniqueProcess); + ProcessData = CsrGetProcessData(Request->Header.ClientId.UniqueProcess); if (ProcessData == NULL) { DPRINT1("CSR: Message %d: Unable to find data for process 0x%x\n", - Request.Header.u2.s2.Type, - Request.Header.ClientId.UniqueProcess); + Request->Header.u2.s2.Type, + Request->Header.ClientId.UniqueProcess); break; } /* Call the Handler */ - CsrApiCallHandler(ProcessData, &Request); + CsrApiCallHandler(ProcessData, Request); /* Send back the reply */ - Reply = &Request; + Reply = Request; } /* Close the port and exit the thread */ _____ Modified: trunk/reactos/subsys/csrss/win32csr/conio.c --- trunk/reactos/subsys/csrss/win32csr/conio.c 2005-08-28 11:58:06 UTC (rev 17581) +++ trunk/reactos/subsys/csrss/win32csr/conio.c 2005-08-28 12:03:25 UTC (rev 17582) @@ -564,7 +564,7 @@ /* truncate length to CSRSS_MAX_READ_CONSOLE_REQUEST */ nNumberOfCharsToRead = min(Request->Data.ReadConsoleRequest.NrCharactersToRead, CSRSS_MAX_READ_CONSOLE / CharSize); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); - Request->Header.u1.s1.DataLength = Request->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE); + Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE); Buffer = Request->Data.ReadConsoleRequest.Buffer; UnicodeBuffer = (PWCHAR)Buffer; @@ -672,9 +672,15 @@ { Console->EchoCount = 0; /* if the client is no longer waiting on input, do not echo */ } - Request->Header.u1.s1.TotalLength += i * CharSize; ConioUnlockConsole(Console); + + if (CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE) + i * CharSize > sizeof(CSR_API_MESSAGE)) + { + Request->Header.u1.s1.TotalLength = CSR_API_MESSAGE_HEADER_SIZE(CSRSS_READ_CONSOLE) + i * CharSize; + Request->Header.u1.s1.DataLength = Request->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE); + } + return Request->Status; } @@ -923,8 +929,8 @@ DPRINT("CsrWriteConsole\n"); - if (Request->Header.u1.s1.DataLength - < sizeof(CSRSS_WRITE_CONSOLE) + if (Request->Header.u1.s1.TotalLength + < CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE) + (Request->Data.WriteConsoleRequest.NrCharactersToWrite * CharSize)) { DPRINT1("Invalid request size\n"); @@ -1558,8 +1564,8 @@ CharSize = (Request->Data.WriteConsoleOutputCharRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR)); - if (Request->Header.u1.s1.DataLength - < sizeof(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR) + if (Request->Header.u1.s1.TotalLength + < CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_CHAR) + (Request->Data.WriteConsoleOutputCharRequest.Length * CharSize)) { DPRINT1("Invalid request size\n"); @@ -1812,9 +1818,9 @@ DPRINT("CsrWriteConsoleOutputAttrib\n"); - if (Request->Header.u1.s1.DataLength - < sizeof(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB) - + Request->Data.WriteConsoleOutputAttribRequest.Length) + if (Request->Header.u1.s1.TotalLength + < CSR_API_MESSAGE_HEADER_SIZE(CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB) + + Request->Data.WriteConsoleOutputAttribRequest.Length * sizeof(WORD)) { DPRINT1("Invalid request size\n"); Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE); @@ -2256,11 +2262,12 @@ { NTSTATUS Status; PCSRSS_CONSOLE Console; + PWCHAR Buffer; DPRINT("CsrSetTitle\n"); - if (Request->Header.u1.s1.DataLength - < sizeof(CSRSS_SET_TITLE) + if (Request->Header.u1.s1.TotalLength [truncated at 1000 lines; 145 more skipped]
19 years, 3 months
1
0
0
0
[hbirr] 17581: Allocated the message reply buffer according to the size of the message.
by hbirr@svn.reactos.com
Allocated the message reply buffer according to the size of the message. Modified: trunk/reactos/ntoskrnl/include/internal/port.h Modified: trunk/reactos/ntoskrnl/lpc/reply.c _____ Modified: trunk/reactos/ntoskrnl/include/internal/port.h --- trunk/reactos/ntoskrnl/include/internal/port.h 2005-08-28 09:50:00 UTC (rev 17580) +++ trunk/reactos/ntoskrnl/include/internal/port.h 2005-08-28 11:58:06 UTC (rev 17581) @@ -88,7 +88,6 @@ PEPORT Sender; LIST_ENTRY QueueListEntry; PORT_MESSAGE Message; - UCHAR MessageData[0x130]; /* FIXME: HACK */ } QUEUEDMESSAGE, *PQUEUEDMESSAGE; typedef struct _LPC_DBG_MESSAGE _____ Modified: trunk/reactos/ntoskrnl/lpc/reply.c --- trunk/reactos/ntoskrnl/lpc/reply.c 2005-08-28 09:50:00 UTC (rev 17580) +++ trunk/reactos/ntoskrnl/lpc/reply.c 2005-08-28 11:58:06 UTC (rev 17581) @@ -37,20 +37,31 @@ { KIRQL oldIrql; PQUEUEDMESSAGE MessageReply; + ULONG Size; if (Port == NULL) { KEBUGCHECK(0); } - MessageReply = ExAllocatePoolWithTag(NonPagedPool, sizeof(QUEUEDMESSAGE), + Size = sizeof(QUEUEDMESSAGE); + if (LpcReply && LpcReply->u1.s1.TotalLength > sizeof(PORT_MESSAGE)) + { + Size += LpcReply->u1.s1.TotalLength - sizeof(PORT_MESSAGE); + } + MessageReply = ExAllocatePoolWithTag(NonPagedPool, Size, TAG_LPC_MESSAGE); MessageReply->Sender = Sender; if (LpcReply != NULL) { - memcpy(&MessageReply->Message, LpcReply, LpcReply->u1.s1.TotalLength); + memcpy(&MessageReply->Message, LpcReply, LpcReply->u1.s1.TotalLength); } + else + { + MessageReply->Message.u1.s1.TotalLength = sizeof(PORT_MESSAGE); + MessageReply->Message.u1.s1.DataLength = 0; + } MessageReply->Message.ClientId.UniqueProcess = PsGetCurrentProcessId(); MessageReply->Message.ClientId.UniqueThread = PsGetCurrentThreadId();
19 years, 3 months
1
0
0
0
[hpoussin] 17580: Fix rbuild compilation, by adding Path::RelativeFromDirectory method
by hpoussin@svn.reactos.com
Fix rbuild compilation, by adding Path::RelativeFromDirectory method Modified: trunk/reactos/tools/rbuild/XML.cpp Modified: trunk/reactos/tools/rbuild/XML.h _____ Modified: trunk/reactos/tools/rbuild/XML.cpp --- trunk/reactos/tools/rbuild/XML.cpp 2005-08-28 09:07:43 UTC (rev 17579) +++ trunk/reactos/tools/rbuild/XML.cpp 2005-08-28 09:50:00 UTC (rev 17580) @@ -172,21 +172,27 @@ string Path::RelativeFromWorkingDirectory ( const string& path ) { - vector<string> vwork, vpath, vout; - Path::Split ( vwork, working_directory, true ); + return Path::RelativeFromDirectory ( path, working_directory ); +} + +string +Path::RelativeFromDirectory ( const string& path, const string& base_directory ) +{ + vector<string> vbase, vpath, vout; + Path::Split ( vbase, base_directory, true ); Path::Split ( vpath, path, true ); #ifdef WIN32 // this squirreliness is b/c win32 has drive letters and *nix doesn't... // not possible to do relative across different drive letters - if ( vwork[0] != vpath[0] ) + if ( vbase[0] != vpath[0] ) return path; #endif size_t i = 0; - while ( i < vwork.size() && i < vpath.size() && vwork[i] == vpath[i] ) + while ( i < vbase.size() && i < vpath.size() && vbase[i] == vpath[i] ) ++i; - if ( i < vwork.size() ) + if ( i < vbase.size() ) { - // path goes above our working directory, we will need some ..'s + // path goes above our base directory, we will need some ..'s for ( size_t j = 0; j < i; j++ ) vout.push_back ( ".." ); } _____ Modified: trunk/reactos/tools/rbuild/XML.h --- trunk/reactos/tools/rbuild/XML.h 2005-08-28 09:07:43 UTC (rev 17579) +++ trunk/reactos/tools/rbuild/XML.h 2005-08-28 09:50:00 UTC (rev 17580) @@ -44,6 +44,7 @@ std::string RelativeFromWorkingDirectory (); static std::string RelativeFromWorkingDirectory ( const std::string& path ); + static std::string RelativeFromDirectory ( const std::string& path, const std::string& base_directory); static void Split ( std::vector<std::string>& out, const std::string& path,
19 years, 3 months
1
0
0
0
← Newer
1
2
3
4
5
...
67
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Results per page:
10
25
50
100
200