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
September 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
22 participants
582 discussions
Start a n
N
ew thread
[weiden] 18141: add the vista application recovery functions to w32api and add their stubs to kernel32
by weiden@svn.reactos.com
add the vista application recovery functions to w32api and add their stubs to kernel32 Modified: trunk/reactos/lib/kernel32/k32.h Modified: trunk/reactos/lib/kernel32/kernel32.def Modified: trunk/reactos/lib/kernel32/kernel32.xml Added: trunk/reactos/lib/kernel32/misc/recovery.c Modified: trunk/reactos/w32api/include/winbase.h _____ Modified: trunk/reactos/lib/kernel32/k32.h --- trunk/reactos/lib/kernel32/k32.h 2005-09-28 19:56:05 UTC (rev 18140) +++ trunk/reactos/lib/kernel32/k32.h 2005-09-28 21:43:54 UTC (rev 18141) @@ -12,6 +12,7 @@ #define NTOS_MODE_USER #define _KERNEL32_ #include <windows.h> +#include <tlhelp32.h> #include <ndk/ntndk.h> /* CSRSS Header */ _____ Modified: trunk/reactos/lib/kernel32/kernel32.def --- trunk/reactos/lib/kernel32/kernel32.def 2005-09-28 19:56:05 UTC (rev 18140) +++ trunk/reactos/lib/kernel32/kernel32.def 2005-09-28 21:43:54 UTC (rev 18141) @@ -278,6 +278,8 @@ FreeVirtualBuffer@4 GenerateConsoleCtrlEvent@8 GetACP@0 +GetApplicationRecoveryCallback@12 +GetApplicationRestart@16 GetAtomNameA@12 GetAtomNameW@12 GetBinaryType@8=GetBinaryTypeA@8 @@ -714,6 +716,10 @@ ReadFileEx@20 ReadFileScatter@20 ReadProcessMemory@20 +RecoveryFinished@4 +RecoveryInProgress@4 +RegisterApplicationRecoveryCallback@8 +RegisterApplicationRestart@8 ;RegisterConsoleIME ;RegisterConsoleOS2 RegisterConsoleVDM@44 _____ Modified: trunk/reactos/lib/kernel32/kernel32.xml --- trunk/reactos/lib/kernel32/kernel32.xml 2005-09-28 19:56:05 UTC (rev 18140) +++ trunk/reactos/lib/kernel32/kernel32.xml 2005-09-28 21:43:54 UTC (rev 18141) @@ -70,6 +70,7 @@ <file>nls.c</file> <file>perfcnt.c</file> <file>profile.c</file> + <file>recovery.c</file> <file>res.c</file> <file>stubs.c</file> <file>sysinfo.c</file> _____ Added: trunk/reactos/lib/kernel32/misc/recovery.c --- trunk/reactos/lib/kernel32/misc/recovery.c 2005-09-28 19:56:05 UTC (rev 18140) +++ trunk/reactos/lib/kernel32/misc/recovery.c 2005-09-28 21:43:54 UTC (rev 18141) @@ -0,0 +1,117 @@ +/* + * ReactOS kernel + * Copyright (C) 2005 ReactOS Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* $Id$ + * + * KERNEL32.DLL application recovery functions + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/kernel32/misc/recovery.c + * PURPOSE: Application Recovery functions + * PROGRAMMER: Thomas Weidenmueller <w3seek(a)reactos.com> + * + * UPDATE HISTORY: + * 10/28/2005 Created stubs (w3) + */ + +#include <k32.h> + +#define NDEBUG +#include "../include/debug.h" + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @unimplemented + */ +HRESULT +WINAPI +GetApplicationRecoveryCallback(IN HANDLE hProcess, + OUT APPLICATION_RECOVERY_CALLBACK* pRecoveryCallback, + OUT PVOID* ppvParameter) +{ + UNIMPLEMENTED; + return E_FAIL; +} + + +/* + * @unimplemented + */ +HRESULT +WINAPI +GetApplicationRestart(IN HANDLE hProcess, + OUT PWSTR pwzCommandline OPTIONAL, + IN OUT PDWORD pcchSize, + OUT PDWORD pdwFlags OPTIONAL) +{ + UNIMPLEMENTED; + return E_FAIL; +} + + +/* + * @unimplemented + */ +VOID +WINAPI +RecoveryFinished(IN BOOL bSuccess) +{ + UNIMPLEMENTED; +} + + +/* + * @unimplemented + */ +HRESULT +WINAPI +RecoveryInProgress(OUT PBOOL pbCancelled) +{ + UNIMPLEMENTED; + return E_FAIL; +} + + +/* + * @unimplemented + */ +HRESULT +WINAPI +RegisterApplicationRecoveryCallback(IN APPLICATION_RECOVERY_CALLBACK pRecoveyCallback, + IN PVOID pvParameter OPTIONAL) +{ + UNIMPLEMENTED; + return E_FAIL; +} + + +/* + * @unimplemented + */ +HRESULT +WINAPI +RegisterApplicationRestart(IN PCWSTR pwzCommandline OPTIONAL, + IN DWORD dwFlags) +{ + UNIMPLEMENTED; + return E_FAIL; +} + +/* EOF */ Property changes on: trunk/reactos/lib/kernel32/misc/recovery.c ___________________________________________________________________ Name: svn:keywords + author date id revision Name: svn:eol-style + native _____ Modified: trunk/reactos/w32api/include/winbase.h --- trunk/reactos/w32api/include/winbase.h 2005-09-28 19:56:05 UTC (rev 18140) +++ trunk/reactos/w32api/include/winbase.h 2005-09-28 21:43:54 UTC (rev 18141) @@ -517,6 +517,12 @@ #endif #define FLS_OUT_OF_INDEXES 0xFFFFFFFF #define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000 +#if (_WIN32_WINNT >= 0x0600) +#define MAX_RESTART_CMD_LINE 0x800 +#define RESTART_CYCLICAL 0x1 +#define RESTART_NOTIFY_SOLUTION 0x2 +#define RESTART_NOTIFY_FAULT 0x4 +#endif #ifndef RC_INVOKED #ifndef _FILETIME_ @@ -1021,6 +1027,9 @@ #if (_WIN32_WINNT >= 0x0500) typedef void(CALLBACK *WAITORTIMERCALLBACK)(PVOID,BOOLEAN); #endif +#if (_WIN32_WINNT >= 0x0600) +typedef DWORD (WINAPI *APPLICATION_RECOVERY_CALLBACK)(PVOID); +#endif #define MAKEINTATOM(i) (LPTSTR)((ULONG_PTR)((WORD)(i))) /* Functions */ #ifndef UNDER_CE @@ -1299,6 +1308,10 @@ PVOID WINAPI FreeSid(PSID); BOOL WINAPI GetAce(PACL,DWORD,LPVOID*); BOOL WINAPI GetAclInformation(PACL,PVOID,DWORD,ACL_INFORMATION_CLASS); +#if (_WIN32_WINNT >= 0x0600) +HRESULT WINAPI GetApplicationRecoveryCallback(HANDLE,APPLICATION_RECOVERY_CALLBACK*,PVO ID*); +HRESULT WINAPI GetApplicationRestart(HANDLE,PWSTR,PDWORD,PDWORD); +#endif UINT WINAPI GetAtomNameA(ATOM,LPSTR,int); UINT WINAPI GetAtomNameW(ATOM,LPWSTR,int); BOOL WINAPI GetBinaryTypeA(LPCSTR,PDWORD); @@ -1599,6 +1612,9 @@ BOOL WINAPI IsProcessorFeaturePresent(DWORD); BOOL WINAPI IsSystemResumeAutomatic(void); BOOL WINAPI IsTextUnicode(PCVOID,int,LPINT); +#if (_WIN32_WINNT >= 0x0600) +BOOL WINAPI IsThreadAFiber(VOID); +#endif BOOL WINAPI IsValidAcl(PACL); BOOL WINAPI IsValidSecurityDescriptor(PSECURITY_DESCRIPTOR); BOOL WINAPI IsValidSid(PSID); @@ -1726,6 +1742,12 @@ BOOL WINAPI ReadFileEx(HANDLE,PVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTI NE); BOOL WINAPI ReadFileScatter(HANDLE,FILE_SEGMENT_ELEMENT*,DWORD,LPDWORD,LPOVERLAPPED) ; BOOL WINAPI ReadProcessMemory(HANDLE,PCVOID,PVOID,DWORD,PDWORD); +#if (_WIN32_WINNT >= 0x0600) +VOID WINAPI RecoveryFinished(BOOL); +HRESULT WINAPI RecoveryInProgress(OUT PBOOL); +HRESULT WINAPI RegisterApplicationRecoveryCallback(APPLICATION_RECOVERY_CALLBACK,PVOID) ; +HRESULT WINAPI RegisterApplicationRestart(PCWSTR,DWORD); +#endif HANDLE WINAPI RegisterEventSourceA (LPCSTR,LPCSTR); HANDLE WINAPI RegisterEventSourceW(LPCWSTR,LPCWSTR); #if (_WIN32_WINNT >= 0x0501)
19 years, 2 months
1
0
0
0
[weiden] 18140: don't free random pointer in MmCreateImageSection. should fix bug 836
by weiden@svn.reactos.com
don't free random pointer in MmCreateImageSection. should fix bug 836 Modified: trunk/reactos/ntoskrnl/mm/section.c _____ Modified: trunk/reactos/ntoskrnl/mm/section.c --- trunk/reactos/ntoskrnl/mm/section.c 2005-09-28 19:34:07 UTC (rev 18139) +++ trunk/reactos/ntoskrnl/mm/section.c 2005-09-28 19:56:05 UTC (rev 18140) @@ -3230,6 +3230,8 @@ ObDereferenceObject(Section); return(STATUS_NO_MEMORY); } + + RtlZeroMemory(ImageSectionObject, sizeof(MM_IMAGE_SECTION_OBJECT)); StatusExeFmt = ExeFmtpCreateImageSection(FileHandle, ImageSectionObject);
19 years, 2 months
1
0
0
0
[hbirr] 18139: Disable flushing if the device doesn't support it or if it isn't enabled.
by hbirr@svn.reactos.com
Disable flushing if the device doesn't support it or if it isn't enabled. Modified: trunk/reactos/drivers/storage/atapi/atapi.c _____ Modified: trunk/reactos/drivers/storage/atapi/atapi.c --- trunk/reactos/drivers/storage/atapi/atapi.c 2005-09-28 18:56:01 UTC (rev 18138) +++ trunk/reactos/drivers/storage/atapi/atapi.c 2005-09-28 19:34:07 UTC (rev 18139) @@ -1171,6 +1171,11 @@ DeviceExtension->DeviceFlags[UnitNumber] |= DEVICE_DMA_CMD; } #endif + if (!(DeviceExtension->DeviceParams[UnitNumber].SupportedFeatures83 & 0x1000) || + !(DeviceExtension->DeviceParams[UnitNumber].EnabledFeatures86 & 0x1000)) + { + DeviceExtension->DeviceFlags[UnitNumber] |= DEVICE_NO_FLUSH; + } DeviceFound = TRUE; } else @@ -1212,6 +1217,22 @@ DeviceExtension->DeviceFlags[UnitNumber] |= DEVICE_DMA_CMD; } #endif + if (DeviceExtension->DeviceFlags[UnitNumber] & DEVICE_48BIT_ADDRESS) + { + if (!(DeviceExtension->DeviceParams[UnitNumber].SupportedFeatures83 & 0x2000) || + !(DeviceExtension->DeviceParams[UnitNumber].EnabledFeatures86 & 0x2000)) + { + DeviceExtension->DeviceFlags[UnitNumber] |= DEVICE_NO_FLUSH; + } + } + else + { + if (!(DeviceExtension->DeviceParams[UnitNumber].SupportedFeatures83 & 0x1000) || + !(DeviceExtension->DeviceParams[UnitNumber].EnabledFeatures86 & 0x1000)) + { + DeviceExtension->DeviceFlags[UnitNumber] |= DEVICE_NO_FLUSH; + } + } DeviceFound = TRUE; } else @@ -2311,12 +2332,8 @@ * it doesn't make sense to flush cache on devices we don't * write to. */ - return SRB_STATUS_INVALID_REQUEST; - } - - if (!(DeviceExtension->DeviceParams[Srb->TargetId].SupportedFeatures83 & 0x1000)) - { - /* The device states it doesn't support the command */ + + /* The device states it doesn't support the command or it is disabled */ DPRINT("The drive doesn't support FLUSH_CACHE\n"); return SRB_STATUS_INVALID_REQUEST; }
19 years, 2 months
1
0
0
0
[weiden] 18138: added the Longhorn registry APIs to w32api
by weiden@svn.reactos.com
added the Longhorn registry APIs to w32api Modified: trunk/reactos/w32api/include/winreg.h _____ Modified: trunk/reactos/w32api/include/winreg.h --- trunk/reactos/w32api/include/winreg.h 2005-09-28 17:15:57 UTC (rev 18137) +++ trunk/reactos/w32api/include/winreg.h 2005-09-28 18:56:01 UTC (rev 18138) @@ -58,6 +58,10 @@ LONG WINAPI RegCloseKey(HKEY); LONG WINAPI RegConnectRegistryA(LPCSTR,HKEY,PHKEY); LONG WINAPI RegConnectRegistryW(LPCWSTR,HKEY,PHKEY); +#if (_WIN32_WINNT >= 0x0600) +LONG WINAPI RegCopyTreeA(HKEY,LPCSTR,HKEY); +LONG WINAPI RegCopyTreeW(HKEY,LPCWSTR,HKEY); +#endif LONG WINAPI RegCreateKeyA(HKEY,LPCSTR,PHKEY); LONG WINAPI RegCreateKeyExA(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,LPSECURITY_ATTRIBUT ES,PHKEY,PDWORD); LONG WINAPI RegCreateKeyExW(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,LPSECURITY_ATTRIB UTES,PHKEY,PDWORD); @@ -65,11 +69,16 @@ LONG WINAPI RegDeleteKeyA(HKEY,LPCSTR); LONG WINAPI RegDeleteKeyW(HKEY,LPCWSTR); #if (_WIN32_WINNT >= 0x0600) +LONG WINAPI RegDeleteKeyValueA(HKEY,LPCSTR,LPCSTR); +LONG WINAPI RegDeleteKeyValueW(HKEY,LPCWSTR,LPCWSTR); LONG WINAPI RegDeleteTreeA(HKEY,LPCSTR); LONG WINAPI RegDeleteTreeW(HKEY,LPCWSTR); #endif LONG WINAPI RegDeleteValueA(HKEY,LPCSTR); LONG WINAPI RegDeleteValueW(HKEY,LPCWSTR); +#if (_WIN32_WINNT >= 0x0600) +LONG WINAPI RegDisablePredefinedCacheEx(VOID); +#endif LONG WINAPI RegEnumKeyA(HKEY,DWORD,LPSTR,DWORD); LONG WINAPI RegEnumKeyW(HKEY,DWORD,LPWSTR,DWORD); LONG WINAPI RegEnumKeyExA(HKEY,DWORD,LPSTR,PDWORD,PDWORD,LPSTR,PDWORD,PFILETIME); @@ -80,6 +89,10 @@ LONG WINAPI RegGetKeySecurity(HKEY,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,PDWORD) ; LONG WINAPI RegLoadKeyA(HKEY,LPCSTR,LPCSTR); LONG WINAPI RegLoadKeyW(HKEY,LPCWSTR,LPCWSTR); +#if (_WIN32_WINNT >= 0x0600) +LONG WINAPI RegLoadMUIStringA(HKEY,LPCSTR,LPSTR,ULONG,ULONG,LPCSTR); +LONG WINAPI RegLoadMUIStringW(HKEY,LPCWSTR,LPWSTR,ULONG,ULONG,LPCWSTR); +#endif LONG WINAPI RegNotifyChangeKeyValue(HKEY,BOOL,DWORD,HANDLE,BOOL); LONG WINAPI RegOpenKeyA(HKEY,LPCSTR,PHKEY); LONG WINAPI RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY); @@ -100,6 +113,10 @@ LONG WINAPI RegSaveKeyA(HKEY,LPCSTR,LPSECURITY_ATTRIBUTES); LONG WINAPI RegSaveKeyW(HKEY,LPCWSTR,LPSECURITY_ATTRIBUTES); LONG WINAPI RegSetKeySecurity(HKEY,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR); +#if (_WIN32_WINNT >= 0x0600) +LONG WINAPI RegSetKeyValueA(HKEY,LPCSTR,LPCSTR,DWORD,LPCVOID,DWORD); +LONG WINAPI RegSetKeyValueW(HKEY,LPCWSTR,LPCWSTR,DWORD,LPCVOID,DWORD); +#endif LONG WINAPI RegSetValueA(HKEY,LPCSTR,DWORD,LPCSTR,DWORD); LONG WINAPI RegSetValueExA(HKEY,LPCSTR,DWORD,DWORD,const BYTE*,DWORD); LONG WINAPI RegSetValueExW(HKEY,LPCWSTR,DWORD,DWORD,const BYTE*,DWORD); @@ -112,10 +129,14 @@ #define AbortSystemShutdown AbortSystemShutdownW #define InitiateSystemShutdown InitiateSystemShutdownW #define RegConnectRegistry RegConnectRegistryW +#if (_WIN32_WINNT >= 0x0600) +#define RegCopyTree RegCopyTreeW +#endif #define RegCreateKey RegCreateKeyW #define RegCreateKeyEx RegCreateKeyExW #define RegDeleteKey RegDeleteKeyW #if (_WIN32_WINNT >= 0x0600) +#define RegDeleteKeyValue RegDeleteKeyValueW #define RegDeleteTree RegDeleteTreeW #endif #define RegDeleteValue RegDeleteValueW @@ -123,6 +144,9 @@ #define RegEnumKeyEx RegEnumKeyExW #define RegEnumValue RegEnumValueW #define RegLoadKey RegLoadKeyW +#if (_WIN32_WINNT >= 0x0600) +#define RegLoadMUIString RegLoadMUIStringW +#endif #define RegOpenKey RegOpenKeyW #define RegOpenKeyEx RegOpenKeyExW #define RegQueryInfoKey RegQueryInfoKeyW @@ -132,6 +156,9 @@ #define RegReplaceKey RegReplaceKeyW #define RegRestoreKey RegRestoreKeyW #define RegSaveKey RegSaveKeyW +#if (_WIN32_WINNT >= 0x0600) +#define RegSetKeyValue RegSetKeyValueW +#endif #define RegSetValue RegSetValueW #define RegSetValueEx RegSetValueExW #define RegUnLoadKey RegUnLoadKeyW @@ -140,10 +167,14 @@ #define AbortSystemShutdown AbortSystemShutdownA #define InitiateSystemShutdown InitiateSystemShutdownA #define RegConnectRegistry RegConnectRegistryA +#if (_WIN32_WINNT >= 0x0600) +#define RegCopyTree RegCopyTreeA +#endif #define RegCreateKey RegCreateKeyA #define RegCreateKeyEx RegCreateKeyExA #define RegDeleteKey RegDeleteKeyA #if (_WIN32_WINNT >= 0x0600) +#define RegDeleteKeyValue RegDeleteKeyValueA #define RegDeleteTree RegDeleteTreeA #endif #define RegDeleteValue RegDeleteValueA @@ -151,6 +182,9 @@ #define RegEnumKeyEx RegEnumKeyExA #define RegEnumValue RegEnumValueA #define RegLoadKey RegLoadKeyA +#if (_WIN32_WINNT >= 0x0600) +#define RegLoadMUIString RegLoadMUIStringA +#endif #define RegOpenKey RegOpenKeyA #define RegOpenKeyEx RegOpenKeyExA #define RegQueryInfoKey RegQueryInfoKeyA @@ -160,6 +194,9 @@ #define RegReplaceKey RegReplaceKeyA #define RegRestoreKey RegRestoreKeyA #define RegSaveKey RegSaveKeyA +#if (_WIN32_WINNT >= 0x0600) +#define RegSetKeyValue RegSetKeyValueA +#endif #define RegSetValue RegSetValueA #define RegSetValueEx RegSetValueExA #define RegUnLoadKey RegUnLoadKeyA
19 years, 2 months
1
0
0
0
[weiden] 18137: don't dereference the port in NtSetInformationFile with information class FileCompletionInformation. The Also make setting the completion port thread-safe. This might fix bug 816
by weiden@svn.reactos.com
don't dereference the port in NtSetInformationFile with information class FileCompletionInformation. The Also make setting the completion port thread-safe. This might fix bug 816 Modified: trunk/reactos/ntoskrnl/io/file.c _____ Modified: trunk/reactos/ntoskrnl/io/file.c --- trunk/reactos/ntoskrnl/io/file.c 2005-09-28 15:40:52 UTC (rev 18136) +++ trunk/reactos/ntoskrnl/io/file.c 2005-09-28 17:15:57 UTC (rev 18137) @@ -3059,34 +3059,57 @@ PVOID Queue; PFILE_COMPLETION_INFORMATION CompletionInfo = FileInformation; PIO_COMPLETION_CONTEXT Context; - - if (Length < sizeof(FILE_COMPLETION_INFORMATION)) + + if (FileObject->Flags & FO_SYNCHRONOUS_IO || FileObject->CompletionContext != NULL) { - Status = STATUS_INFO_LENGTH_MISMATCH; + Status = STATUS_INVALID_PARAMETER; } else { - /* Reference the Port */ - Status = ObReferenceObjectByHandle(CompletionInfo->Port, - IO_COMPLETION_MODIFY_STATE, - IoCompletionType, - PreviousMode, - (PVOID*)&Queue, - NULL); - if (NT_SUCCESS(Status)) + if (Length < sizeof(FILE_COMPLETION_INFORMATION)) { - /* Allocate the Context */ - Context = ExAllocatePoolWithTag(PagedPool, - sizeof(IO_COMPLETION_CONTEXT), - TAG('I', 'o', 'C', 'p')); + Status = STATUS_INFO_LENGTH_MISMATCH; + } + else + { + /* Reference the Port */ + Status = ObReferenceObjectByHandle(CompletionInfo->Port, /* FIXME - protect with SEH! */ + IO_COMPLETION_MODIFY_STATE, + IoCompletionType, + PreviousMode, + (PVOID*)&Queue, + NULL); + if (NT_SUCCESS(Status)) + { + /* Allocate the Context */ + Context = ExAllocatePoolWithTag(PagedPool, + sizeof(IO_COMPLETION_CONTEXT), + TAG('I', 'o', 'C', 'p')); - /* Set the Data */ - Context->Key = CompletionInfo->Key; - Context->Port = Queue; - FileObject->CompletionContext = Context; - - /* Dereference the Port now */ - ObDereferenceObject(Queue); + if (Context != NULL) + { + /* Set the Data */ + Context->Key = CompletionInfo->Key; /* FIXME - protect with SEH! */ + Context->Port = Queue; + + if (InterlockedCompareExchangePointer(&FileObject->CompletionContext, + Context, + NULL) != NULL) + { + /* someone else set the completion port in the + meanwhile, fail */ + ExFreePool(Context); + ObDereferenceObject(Queue); + Status = STATUS_INVALID_PARAMETER; + } + } + else + { + /* Dereference the Port now */ + ObDereferenceObject(Queue); + Status = STATUS_INSUFFICIENT_RESOURCES; + } + } } }
19 years, 2 months
1
0
0
0
[weiden] 18136: improved error handling
by weiden@svn.reactos.com
improved error handling Modified: trunk/reactos/lib/aclui/aclui.c Modified: trunk/reactos/lib/aclui/checklist.c _____ Modified: trunk/reactos/lib/aclui/aclui.c --- trunk/reactos/lib/aclui/aclui.c 2005-09-28 13:20:10 UTC (rev 18135) +++ trunk/reactos/lib/aclui/aclui.c 2005-09-28 15:40:52 UTC (rev 18136) @@ -1,6 +1,6 @@ /* * ReactOS Access Control List Editor - * Copyright (C) 2004 ReactOS Team + * Copyright (C) 2004-2005 ReactOS Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -101,33 +101,41 @@ SID_NAME_USE SidNameUse; DWORD LookupResult; PPRINCIPAL_LISTITEM AceListItem, *NextAcePtr; + + AccountNameSize = 0; + DomainNameSize = 0; + + /* calculate the size of the buffer we need to calculate */ + if (!LookupAccountSid(sp->ServerName, + Sid, + NULL, + &AccountNameSize, + NULL, + &DomainNameSize, + &SidNameUse)) + { + LookupResult = GetLastError(); + if (LookupResult != ERROR_NONE_MAPPED) + { + return FALSE; + } + } NextAcePtr = &sp->PrincipalsListHead; - for (AceListItem = sp->PrincipalsListHead; AceListItem != NULL; AceListItem = AceListItem->Next) + for (AceListItem = sp->PrincipalsListHead; + AceListItem != NULL; + AceListItem = AceListItem->Next) { NextAcePtr = &AceListItem->Next; } SidLength = GetLengthSid(Sid); - AccountNameSize = 0; - DomainNameSize = 0; - - /* calculate the size of the buffer we need to calculate */ - LookupAccountSid(sp->ServerName, - Sid, - NULL, - &AccountNameSize, - NULL, - &DomainNameSize, - &SidNameUse); - /* allocate the ace */ AceListItem = HeapAlloc(GetProcessHeap(), 0, - sizeof(PRINCIPAL_LISTITEM) + - SidLength + - ((AccountNameSize + DomainNameSize) * sizeof(WCHAR))); + sizeof(PRINCIPAL_LISTITEM) + SidLength + + ((AccountNameSize + DomainNameSize) * sizeof(WCHAR))); if (AceListItem != NULL) { AceListItem->AccountName = (LPWSTR)((ULONG_PTR)(AceListItem + 1) + SidLength); @@ -236,11 +244,10 @@ { if (Domain != NULL) { + SIZE_T Size = (AccountNameSize + DomainName->Length + + Names->Name.Length + 6) * sizeof(WCHAR); AceListItem->DisplayString = (LPWSTR)LocalAlloc(LMEM_FIXED, - (AccountNameSize * sizeof(WCHAR)) + - (DomainName->Length + sizeof(WCHAR)) + - (Names->Name.Length + sizeof(WCHAR)) + - (4 * sizeof(WCHAR))); + Size); if (AceListItem->DisplayString != NULL) { WCHAR *s; @@ -369,6 +376,7 @@ li.state = (Selected ? LVIS_SELECTED : 0); li.stateMask = LVIS_SELECTED; li.pszText = (PrincipalListItem->DisplayString != NULL ? PrincipalListItem->DisplayString : PrincipalListItem->AccountName); + switch (PrincipalListItem->SidNameUse) { case SidTypeUser: @@ -412,7 +420,8 @@ EnableRedrawWindow(sp->hWndPrincipalsList); - GetClientRect(sp->hWndPrincipalsList, &rcLvClient); + GetClientRect(sp->hWndPrincipalsList, + &rcLvClient); ListView_SetColumnWidth(sp->hWndPrincipalsList, 0, @@ -424,8 +433,10 @@ { PPRINCIPAL_LISTITEM Selected = (PPRINCIPAL_LISTITEM)ListViewGetSelectedItemData(sp->hWndPrincipalsList) ; - EnableWindow(sp->hBtnRemove, Selected != NULL); - EnableWindow(sp->hAceCheckList, Selected != NULL); + EnableWindow(sp->hBtnRemove, + Selected != NULL); + EnableWindow(sp->hAceCheckList, + Selected != NULL); if (Selected != NULL) { @@ -992,13 +1003,16 @@ sp->hiPrincipals, LVSIL_SMALL); - GetClientRect(sp->hWndPrincipalsList, &rcLvClient); + GetClientRect(sp->hWndPrincipalsList, + &rcLvClient); /* add a column to the list view */ lvc.mask = LVCF_FMT | LVCF_WIDTH; lvc.fmt = LVCFMT_LEFT; lvc.cx = rcLvClient.right; - ListView_InsertColumn(sp->hWndPrincipalsList, 0, &lvc); + ListView_InsertColumn(sp->hWndPrincipalsList, + 0, + &lvc); ReloadPrincipalsList(sp); @@ -1074,9 +1088,9 @@ WINAPI CreateSecurityPage(IN LPSECURITYINFO psi) { - PROPSHEETPAGE psp; + PROPSHEETPAGE psp = {0}; PSECURITY_PAGE sPage; - SI_OBJECT_INFO ObjectInfo; + SI_OBJECT_INFO ObjectInfo = {0}; HRESULT hRet; if (psi == NULL) @@ -1090,8 +1104,8 @@ /* get the object information from the server. Zero the structure before because some applications seem to return SUCCESS but only seem to set the fields they care about. */ - ZeroMemory(&ObjectInfo, sizeof(ObjectInfo)); - hRet = psi->lpVtbl->GetObjectInformation(psi, &ObjectInfo); + hRet = psi->lpVtbl->GetObjectInformation(psi, + &ObjectInfo); if (FAILED(hRet)) { @@ -1127,8 +1141,6 @@ sPage->psi = psi; sPage->ObjectInfo = ObjectInfo; - ZeroMemory(&psp, sizeof(psp)); - psp.dwSize = sizeof(PROPSHEETPAGE); psp.dwFlags = PSP_USECALLBACK; psp.hInstance = hDllInstance; @@ -1169,10 +1181,10 @@ IN LPSECURITYINFO psi) { HRESULT hRet; - SI_OBJECT_INFO ObjectInfo; + SI_OBJECT_INFO ObjectInfo = {0}; PROPSHEETHEADER psh; HPROPSHEETPAGE hPages[1]; - LPWSTR lpCaption; + LPWSTR lpCaption = NULL; BOOL Ret; if (psi == NULL) @@ -1186,8 +1198,8 @@ /* get the object information from the server. Zero the structure before because some applications seem to return SUCCESS but only seem to set the fields they care about. */ - ZeroMemory(&ObjectInfo, sizeof(ObjectInfo)); - hRet = psi->lpVtbl->GetObjectInformation(psi, &ObjectInfo); + hRet = psi->lpVtbl->GetObjectInformation(psi, + &ObjectInfo); if (FAILED(hRet)) { @@ -1213,11 +1225,17 @@ /* Set the page title to the object name, make sure the format string has "%1" NOT "%s" because it uses FormatMessage() to automatically allocate the right amount of memory. */ - LoadAndFormatString(hDllInstance, - IDS_PSP_TITLE, - &lpCaption, - ObjectInfo.pszObjectName); - psh.pszCaption = lpCaption; + if (LoadAndFormatString(hDllInstance, + IDS_PSP_TITLE, + &lpCaption, + ObjectInfo.pszObjectName)) + { + psh.pszCaption = lpCaption; + } + else + { + psh.pszCaption = ObjectInfo.pszObjectName; + } psh.nPages = sizeof(hPages) / sizeof(HPROPSHEETPAGE); psh.nStartPage = 0; _____ Modified: trunk/reactos/lib/aclui/checklist.c --- trunk/reactos/lib/aclui/checklist.c 2005-09-28 13:20:10 UTC (rev 18135) +++ trunk/reactos/lib/aclui/checklist.c 2005-09-28 15:40:52 UTC (rev 18136) @@ -1,6 +1,6 @@ /* * ReactOS Access Control List Editor - * Copyright (C) 2004 ReactOS Team + * Copyright (C) 2004-2005 ReactOS Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -177,7 +177,8 @@ CurItem = CurItem->Next) { if ((CurItem->State & CIS_DISABLED) != CIS_DISABLED && - !wcsnicmp(CurItem->Name, SearchText, Count)) + !wcsnicmp(CurItem->Name, + SearchText, Count)) { break; } @@ -762,7 +763,8 @@ rcUpdate, (HBRUSH)(COLOR_WINDOW + 1)); - GetClientRect(infoPtr->hSelf, &rcClient); + GetClientRect(infoPtr->hSelf, + &rcClient); ScrollPos = GetScrollPos(infoPtr->hSelf, SB_VERT); @@ -1204,7 +1206,8 @@ RECT rcClient; INT VisibleFirst; - GetClientRect(infoPtr->hSelf, &rcClient); + GetClientRect(infoPtr->hSelf, + &rcClient); VisibleFirst = GetScrollPos(infoPtr->hSelf, SB_VERT); @@ -1598,8 +1601,11 @@ 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); + GetClientRect(hwnd, + &rcClient); + + ScrollLines = max(1, + (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight); if (ScrollInfo.nPos + ScrollLines <= ScrollInfo.nMax) { @@ -1622,8 +1628,11 @@ 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); + GetClientRect(hwnd, + &rcClient); + + ScrollLines = max(1, + (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight); if (ScrollInfo.nPos >= ScrollLines) { @@ -1753,10 +1762,6 @@ } Ret = TRUE; } - else - { - Ret = FALSE; - } break; } @@ -2165,9 +2170,11 @@ if (!infoPtr->FocusVisible) { /* change the UI status */ - SendMessage(GetAncestor(hwnd, GA_ROOT), + SendMessage(GetAncestor(hwnd, + GA_ROOT), WM_CHANGEUISTATE, - MAKEWPARAM(UIS_INITIALIZE, UISF_HIDEFOCUS), + MAKEWPARAM(UIS_INITIALIZE, + UISF_HIDEFOCUS), 0); } @@ -2451,7 +2458,8 @@ infoPtr->TextColor[0] = GetSysColor(COLOR_GRAYTEXT); infoPtr->TextColor[1] = GetSysColor(COLOR_WINDOWTEXT); - GetClientRect(hwnd, &rcClient); + GetClientRect(hwnd, + &rcClient); infoPtr->CheckBoxLeft[0] = rcClient.right - 30; infoPtr->CheckBoxLeft[1] = rcClient.right - 15; @@ -2535,7 +2543,7 @@ } BOOL -RegisterCheckListControl(HINSTANCE hInstance) +RegisterCheckListControl(IN HINSTANCE hInstance) { WNDCLASS wc; @@ -2545,7 +2553,8 @@ wc.cbWndExtra = sizeof(PCHECKLISTWND); wc.hInstance = hInstance; wc.hIcon = NULL; - wc.hCursor = LoadCursor(0, (LPWSTR)IDC_ARROW); + wc.hCursor = LoadCursor(NULL, + (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = L"CHECKLIST_ACLUI";
19 years, 2 months
1
0
0
0
[npwoods] 18135: Notepad: Fixed some bugs in Search->Replace
by npwoods@svn.reactos.com
Notepad: Fixed some bugs in Search->Replace Modified: trunk/reactos/subsys/system/notepad/main.c _____ Modified: trunk/reactos/subsys/system/notepad/main.c --- trunk/reactos/subsys/system/notepad/main.c 2005-09-28 13:00:05 UTC (rev 18134) +++ trunk/reactos/subsys/system/notepad/main.c 2005-09-28 13:20:10 UTC (rev 18135) @@ -99,14 +99,44 @@ /*********************************************************************** * + * NOTEPAD_FindTextAt + */ + +static BOOL NOTEPAD_FindTextAt(FINDREPLACE *pFindReplace, LPCTSTR pszText, int iTextLength, DWORD dwPosition) +{ + BOOL bMatches; + int iTargetLength; + + iTargetLength = _tcslen(pFindReplace->lpstrFindWhat); + + /* Make proper comparison */ + if (pFindReplace->Flags & FR_MATCHCASE) + bMatches = !_tcsncmp(&pszText[dwPosition], pFindReplace->lpstrFindWhat, iTargetLength); + else + bMatches = !_tcsnicmp(&pszText[dwPosition], pFindReplace->lpstrFindWhat, iTargetLength); + + if (bMatches && pFindReplace->Flags & FR_WHOLEWORD) + { + if ((dwPosition > 0) && !_istspace(pszText[dwPosition-1])) + bMatches = FALSE; + if ((dwPosition < iTextLength - 1) && !_istspace(pszText[dwPosition+1])) + bMatches = FALSE; + } + + return bMatches; +} + +/********************************************************************** * + * * NOTEPAD_FindNext */ -static BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bShowAlert) +static BOOL NOTEPAD_FindNext(FINDREPLACE *pFindReplace, BOOL bReplace, BOOL bShowAlert) { int iTextLength, iTargetLength; + int iAdjustment = 0; LPTSTR pszText = NULL; - DWORD dwPosition, dwDummy; + DWORD dwPosition, dwBegin, dwEnd; BOOL bMatches = FALSE; TCHAR szResource[128], szText[128]; BOOL bSuccess; @@ -124,24 +154,20 @@ GetWindowText(Globals.hEdit, pszText, iTextLength + 1); } - SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwDummy, (LPARAM) &dwPosition); + SendMessage(Globals.hEdit, EM_GETSEL, (WPARAM) &dwBegin, (LPARAM) &dwEnd); + if (bReplace && ((dwEnd - dwBegin) == iTargetLength)) + { + if (NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwBegin)) + { + SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM) pFindReplace->lpstrReplaceWith); + iAdjustment = _tcslen(pFindReplace->lpstrReplaceWith) - (dwEnd - dwBegin); + } + } + dwPosition = dwEnd; while(dwPosition < iTextLength) { - /* Make proper comparison */ - if (pFindReplace->Flags & FR_MATCHCASE) - bMatches = !_tcsncmp(&pszText[dwPosition], pFindReplace->lpstrFindWhat, iTargetLength); - else - bMatches = !_tcsnicmp(&pszText[dwPosition], pFindReplace->lpstrFindWhat, iTargetLength); - - if (bMatches && pFindReplace->Flags & FR_WHOLEWORD) - { - if ((dwPosition > 0) && !_istspace(pszText[dwPosition-1])) - bMatches = FALSE; - if ((dwPosition < iTextLength - 1) && !_istspace(pszText[dwPosition+1])) - bMatches = FALSE; - } - + bMatches = NOTEPAD_FindTextAt(pFindReplace, pszText, iTextLength, dwPosition); if (bMatches) break; @@ -154,6 +180,8 @@ if (bMatches) { /* Found target */ + if (dwPosition > dwBegin) + dwPosition += iAdjustment; SendMessage(Globals.hEdit, EM_SETSEL, dwPosition, dwPosition + iTargetLength); SendMessage(Globals.hEdit, EM_SCROLLCARET, 0, 0); bSuccess = TRUE; @@ -178,17 +206,6 @@ /*********************************************************************** * - * NOTEPAD_Replace - */ - -static VOID NOTEPAD_Replace(FINDREPLACE *pFindReplace) -{ - if (NOTEPAD_FindNext(pFindReplace, TRUE)) - SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM) pFindReplace->lpstrReplaceWith); -} - -/********************************************************************** * - * * NOTEPAD_ReplaceAll */ @@ -198,9 +215,8 @@ SendMessage(Globals.hEdit, EM_SETSEL, 0, 0); - while (NOTEPAD_FindNext(pFindReplace, bShowAlert)) + while (NOTEPAD_FindNext(pFindReplace, TRUE, bShowAlert)) { - SendMessage(Globals.hEdit, EM_REPLACESEL, TRUE, (LPARAM) pFindReplace->lpstrReplaceWith); bShowAlert = FALSE; } } @@ -333,9 +349,9 @@ FINDREPLACE *pFindReplace = (FINDREPLACE *) lParam; if (pFindReplace->Flags & FR_FINDNEXT) - NOTEPAD_FindNext(pFindReplace, TRUE); + NOTEPAD_FindNext(pFindReplace, FALSE, TRUE); else if (pFindReplace->Flags & FR_REPLACE) - NOTEPAD_Replace(pFindReplace); + NOTEPAD_FindNext(pFindReplace, TRUE, TRUE); else if (pFindReplace->Flags & FR_REPLACEALL) NOTEPAD_ReplaceAll(pFindReplace); else if (pFindReplace->Flags & FR_DIALOGTERM)
19 years, 2 months
1
0
0
0
[weiden] 18134: improved error handling
by weiden@svn.reactos.com
improved error handling Modified: trunk/reactos/subsys/system/sndvol32/misc.c Modified: trunk/reactos/subsys/system/sndvol32/mixer.c Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.c Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.h _____ Modified: trunk/reactos/subsys/system/sndvol32/misc.c --- trunk/reactos/subsys/system/sndvol32/misc.c 2005-09-28 12:26:33 UTC (rev 18133) +++ trunk/reactos/subsys/system/sndvol32/misc.c 2005-09-28 13:00:05 UTC (rev 18134) @@ -15,8 +15,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * VMware is a registered trademark of VMware, Inc. */ /* $Id$ * _____ Modified: trunk/reactos/subsys/system/sndvol32/mixer.c --- trunk/reactos/subsys/system/sndvol32/mixer.c 2005-09-28 12:26:33 UTC (rev 18133) +++ trunk/reactos/subsys/system/sndvol32/mixer.c 2005-09-28 13:00:05 UTC (rev 18134) @@ -15,8 +15,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * VMware is a registered trademark of VMware, Inc. */ /* $Id$ * _____ Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.c --- trunk/reactos/subsys/system/sndvol32/sndvol32.c 2005-09-28 12:26:33 UTC (rev 18133) +++ trunk/reactos/subsys/system/sndvol32/sndvol32.c 2005-09-28 13:00:05 UTC (rev 18134) @@ -15,8 +15,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * VMware is a registered trademark of VMware, Inc. */ /* $Id$ * @@ -115,8 +113,6 @@ { PrefContext->SelectedLine = Line->dwLineID; } - - DPRINT("!%ws cControls: %d\n", Line->szName, Line->cControls); } else goto AddToOthersLines; @@ -132,7 +128,6 @@ { PrefContext->SelectedLine = Line->dwLineID; } - DPRINT("!%ws cControls: %d\n", Line->szName, Line->cControls); } else goto AddToOthersLines; @@ -550,7 +545,7 @@ { } -BOOL +static BOOL RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow) { DeleteMixerWindowControls(MixerWindow); @@ -558,7 +553,7 @@ return TRUE; } -LRESULT CALLBACK +static LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, @@ -658,6 +653,7 @@ { DPRINT("Rebuilding mixer window controls failed!\n"); SndMixerDestroy(MixerWindow->Mixer); + MixerWindow->Mixer = NULL; Result = -1; } } @@ -770,14 +766,16 @@ */ hWnd = NULL; - AllocAndLoadString(&lpErrMessage, - hAppInstance, - IDS_NOMIXERDEVICES); - MessageBox(NULL, - lpErrMessage, - lpAppTitle, - MB_ICONINFORMATION); - LocalFree(lpErrMessage); + if (AllocAndLoadString(&lpErrMessage, + hAppInstance, + IDS_NOMIXERDEVICES)) + { + MessageBox(NULL, + lpErrMessage, + lpAppTitle, + MB_ICONINFORMATION); + LocalFree(lpErrMessage); + } } if (hWnd == NULL) @@ -797,59 +795,68 @@ int nCmdShow) { MSG Msg; + int Ret = 1; hAppInstance = hInstance; hAppHeap = GetProcessHeap(); - if (!InitAppConfig()) + if (InitAppConfig()) { - DPRINT("Unable to open the Volume Control registry key!\n"); - return 1; - } - - /* load the application title */ - if (AllocAndLoadString(&lpAppTitle, - hAppInstance, - IDS_SNDVOL32) == 0) - { - lpAppTitle = NULL; - } + /* load the application title */ + if (!AllocAndLoadString(&lpAppTitle, + hAppInstance, + IDS_SNDVOL32)) + { + lpAppTitle = NULL; + } - InitCommonControls(); + InitCommonControls(); - if (!RegisterApplicationClasses()) - { - DPRINT("Failed to register application classes (LastError: %d)!\n", GetLastError()); - return 1; - } + if (RegisterApplicationClasses()) + { + hMainWnd = CreateApplicationWindow(); + if (hMainWnd != NULL) + { + BOOL bRet; + while ((bRet =GetMessage(&Msg, + NULL, + 0, + 0)) != 0) + { + if (bRet != -1) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + } - hMainWnd = CreateApplicationWindow(); - if (hMainWnd == NULL) - { - DPRINT("Failed to creat application window (LastError: %d)!\n", GetLastError()); - return 1; - } + DestroyWindow(hMainWnd); + Ret = 0; + } + else + { + DPRINT("Failed to creat application window (LastError: %d)!\n", GetLastError()); + } - while (GetMessage(&Msg, - NULL, - 0, - 0)) - { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } + UnregisterApplicationClasses(); + } + else + { + DPRINT("Failed to register application classes (LastError: %d)!\n", GetLastError()); + } - DestroyWindow(hMainWnd); + if (lpAppTitle != NULL) + { + LocalFree(lpAppTitle); + } - UnregisterApplicationClasses(); - - if (lpAppTitle != NULL) + CloseAppConfig(); + } + else { - LocalFree(lpAppTitle); + DPRINT("Unable to open the Volume Control registry key!\n"); } - - CloseAppConfig(); - return 0; + return Ret; } _____ Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.h --- trunk/reactos/subsys/system/sndvol32/sndvol32.h 2005-09-28 12:26:33 UTC (rev 18133) +++ trunk/reactos/subsys/system/sndvol32/sndvol32.h 2005-09-28 13:00:05 UTC (rev 18134) @@ -18,10 +18,6 @@ UINT SelectedLine; } MIXER_WINDOW, *PMIXER_WINDOW; -LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - -BOOL RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow); - extern HINSTANCE hAppInstance; extern ATOM MainWindowClass; extern HWND hMainWnd;
19 years, 2 months
1
0
0
0
[weiden] 18133: Fixed some memory leaks in taskmgr. Patch by Christoph_vW <Christoph@ApiViewer.de>
by weiden@svn.reactos.com
Fixed some memory leaks in taskmgr. Patch by Christoph_vW <Christoph(a)ApiViewer.de> Modified: trunk/reactos/subsys/system/taskmgr/graphctl.c Modified: trunk/reactos/subsys/system/taskmgr/graphctl.h Modified: trunk/reactos/subsys/system/taskmgr/perfpage.c _____ Modified: trunk/reactos/subsys/system/taskmgr/graphctl.c --- trunk/reactos/subsys/system/taskmgr/graphctl.c 2005-09-27 23:37:05 UTC (rev 18132) +++ trunk/reactos/subsys/system/taskmgr/graphctl.c 2005-09-28 12:26:33 UTC (rev 18133) @@ -99,20 +99,18 @@ this->m_bitmapOldPlot = NULL; } -#if 0 -TGraphCtrl::~TGraphCtrl() +void GraphCtrl_Dispose(TGraphCtrl* this) { /* just to be picky restore the bitmaps for the two memory dc's */ /* (these dc's are being destroyed so there shouldn't be any leaks) */ - if (m_bitmapOldGrid != NULL) SelectObject(m_dcGrid, m_bitmapOldGrid); - if (m_bitmapOldPlot != NULL) SelectObject(m_dcPlot, m_bitmapOldPlot); - if (m_bitmapGrid != NULL) DeleteObject(m_bitmapGrid); - if (m_bitmapPlot != NULL) DeleteObject(m_bitmapPlot); - if (m_dcGrid != NULL) DeleteDC(m_dcGrid); - if (m_dcPlot != NULL) DeleteDC(m_dcPlot); - if (m_brushBack != NULL) DeleteObject(m_brushBack); + if (this->m_bitmapOldGrid != NULL) SelectObject(this->m_dcGrid, this->m_bitmapOldGrid); + if (this->m_bitmapOldPlot != NULL) SelectObject(this->m_dcPlot, this->m_bitmapOldPlot); + if (this->m_bitmapGrid != NULL) DeleteObject(this->m_bitmapGrid); + if (this->m_bitmapPlot != NULL) DeleteObject(this->m_bitmapPlot); + if (this->m_dcGrid != NULL) DeleteDC(this->m_dcGrid); + if (this->m_dcPlot != NULL) DeleteDC(this->m_dcPlot); + if (this->m_brushBack != NULL) DeleteObject(this->m_brushBack); } -#endif BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID) { _____ Modified: trunk/reactos/subsys/system/taskmgr/graphctl.h --- trunk/reactos/subsys/system/taskmgr/graphctl.h 2005-09-27 23:37:05 UTC (rev 18132) +++ trunk/reactos/subsys/system/taskmgr/graphctl.h 2005-09-28 12:26:33 UTC (rev 18133) @@ -91,6 +91,7 @@ double dNewPoint2, double dNewPoint3); BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID); +void GraphCtrl_Dispose(TGraphCtrl* this); void GraphCtrl_DrawPoint(TGraphCtrl* this); void GraphCtrl_InvalidateCtrl(TGraphCtrl* this); void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc); _____ Modified: trunk/reactos/subsys/system/taskmgr/perfpage.c --- trunk/reactos/subsys/system/taskmgr/perfpage.c 2005-09-27 23:37:05 UTC (rev 18132) +++ trunk/reactos/subsys/system/taskmgr/perfpage.c 2005-09-28 12:26:33 UTC (rev 18133) @@ -115,6 +115,10 @@ /* PAINTSTRUCT ps; */ switch (message) { + case WM_DESTROY: + GraphCtrl_Dispose(&PerformancePageCpuUsageHistoryGraph); + GraphCtrl_Dispose(&PerformancePageMemUsageHistoryGraph); + case WM_INITDIALOG: /* Save the width and height */
19 years, 2 months
1
0
0
0
[gedmurphy] 18132: - Set svn:eol-style to native
by gedmurphy@svn.reactos.com
- Set svn:eol-style to native - Set svn:ignore on directories Thanks to w3seek for pointing this out. Modified: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c Modified: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.h Modified: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c Modified: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h Modified: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c Modified: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h Modified: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c Modified: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h Property changes on: trunk/reactos/apps/utils/net/tcpsvcs ___________________________________________________________________ Name: svn:ignore + *.o *.a *.d *.exe *.coff *.sym *.map Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/chargen ___________________________________________________________________ Name: svn:ignore + *.o *.a *.d *.exe *.coff *.sym *.map _____ Modified: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c --- trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c 2005-09-27 23:29:35 UTC (rev 18131) +++ trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c 2005-09-27 23:37:05 UTC (rev 18132) @@ -1,104 +1,104 @@ -#include <stdio.h> -#include <winsock2.h> -#include <tchar.h> -#include "chargen.h" -#include "../skelserver/skelserver.h" - -DWORD WINAPI ChargenHandler(VOID* Sock_) -{ - DWORD Retval = 0; - SOCKET Sock = (SOCKET)Sock_; - - if (!GenerateChars(Sock)) { - _tprintf(_T("Echo incoming packets failed\n")); - Retval = 3; - } - - _tprintf(_T("Shutting connection down...\n")); - if (ShutdownConnection(Sock)) { - _tprintf(_T("Connection is down.\n")); - } - else - { - _tprintf(_T("Connection shutdown failed\n")); - Retval = 3; - } - - return Retval; -} - - -BOOL GenerateChars(SOCKET Sock) -{ - int i, - charIndex, /* internal loop */ - loopIndex; /* line loop */ - char ring[END-START]; - char *endring; - - /* fill ring with printable characters */ - for (charIndex=0, i=START; i<=END; charIndex++, i++) - ring[charIndex] = i; - /* establish the end character in the ring */ - endring = &ring[charIndex]; - - /* where we will start output from */ - loopIndex = 0; - - while (1) - { - /* if the loop index is equal to number of chars previously - * printed, start the loop from the beginning */ - if (loopIndex == END-START) - loopIndex = 0; - - /* start printing from char controled by loopIndex */ - charIndex = loopIndex; - for (i=0; i<LINESIZ; i++) - { - SendChar(Sock, ring[charIndex]); - /* if current char equal last char, reset */ - if (ring[charIndex] == *endring) - charIndex = 0; - else - charIndex++; - } - SendChar(Sock, L'\r'); - SendChar(Sock, L'\n'); - - /* increment loop index to start printing from next char in ring */ - loopIndex++; - } - - return 0; -} - -BOOL SendChar(SOCKET Sock, TCHAR c) -{ - INT Temp; - INT SentBytes; - - SentBytes = 0; - Temp = send(Sock, &c, sizeof(TCHAR), 0); - if (Temp > 0) { - SentBytes += Temp; - } - else if (Temp == SOCKET_ERROR) { - return FALSE; - } - else - { - /* Client closed connection before we could reply to - all the data it sent, so quit early. */ - _tprintf(_T("Peer unexpectedly dropped connection!\n")); - return FALSE; - } - - _tprintf(("Connection closed by peer.\n")); - return TRUE; -} - - - - - +#include <stdio.h> +#include <winsock2.h> +#include <tchar.h> +#include "chargen.h" +#include "../skelserver/skelserver.h" + +DWORD WINAPI ChargenHandler(VOID* Sock_) +{ + DWORD Retval = 0; + SOCKET Sock = (SOCKET)Sock_; + + if (!GenerateChars(Sock)) { + _tprintf(_T("Echo incoming packets failed\n")); + Retval = 3; + } + + _tprintf(_T("Shutting connection down...\n")); + if (ShutdownConnection(Sock)) { + _tprintf(_T("Connection is down.\n")); + } + else + { + _tprintf(_T("Connection shutdown failed\n")); + Retval = 3; + } + + return Retval; +} + + +BOOL GenerateChars(SOCKET Sock) +{ + int i, + charIndex, /* internal loop */ + loopIndex; /* line loop */ + char ring[END-START]; + char *endring; + + /* fill ring with printable characters */ + for (charIndex=0, i=START; i<=END; charIndex++, i++) + ring[charIndex] = i; + /* establish the end character in the ring */ + endring = &ring[charIndex]; + + /* where we will start output from */ + loopIndex = 0; + + while (1) + { + /* if the loop index is equal to number of chars previously + * printed, start the loop from the beginning */ + if (loopIndex == END-START) + loopIndex = 0; + + /* start printing from char controled by loopIndex */ + charIndex = loopIndex; + for (i=0; i<LINESIZ; i++) + { + SendChar(Sock, ring[charIndex]); + /* if current char equal last char, reset */ + if (ring[charIndex] == *endring) + charIndex = 0; + else + charIndex++; + } + SendChar(Sock, L'\r'); + SendChar(Sock, L'\n'); + + /* increment loop index to start printing from next char in ring */ + loopIndex++; + } + + return 0; +} + +BOOL SendChar(SOCKET Sock, TCHAR c) +{ + INT RetVal; + INT SentBytes; + + SentBytes = 0; + RetVal = send(Sock, &c, sizeof(TCHAR), 0); + if (RetVal > 0) { + SentBytes += RetVal; + } + else if (RetVal == SOCKET_ERROR) { + return FALSE; + } + else + { + /* Client closed connection before we could reply to + all the data it sent, so quit early. */ + _tprintf(_T("Peer unexpectedly dropped connection!\n")); + return FALSE; + } + + _tprintf(("Connection closed by peer.\n")); + return TRUE; +} + + + + + Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.c ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.h --- trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.h 2005-09-27 23:29:35 UTC (rev 18131) +++ trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.h 2005-09-27 23:37:05 UTC (rev 18132) @@ -1,8 +1,8 @@ -#define START 32 -#define END 126 -#define LINESIZ 72 -#define BUF 1024 - -DWORD WINAPI ChargenHandler(VOID* Sock_); -BOOL GenerateChars(SOCKET Sock); -BOOL SendChar(SOCKET Sock, CHAR c); +#define START 32 +#define END 126 +#define LINESIZ 72 +#define BUF 1024 + +DWORD WINAPI ChargenHandler(VOID* Sock_); +BOOL GenerateChars(SOCKET Sock); +BOOL SendChar(SOCKET Sock, CHAR c); Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/chargen/chargen.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/daytime ___________________________________________________________________ Name: svn:ignore + *.o *.a *.d *.exe *.coff *.sym *.map Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/discard ___________________________________________________________________ Name: svn:ignore + *.o *.a *.d *.exe *.coff *.sym *.map Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/echo ___________________________________________________________________ Name: svn:ignore + *.o *.a *.d *.exe *.coff *.sym *.map _____ Modified: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c --- trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c 2005-09-27 23:29:35 UTC (rev 18131) +++ trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c 2005-09-27 23:37:05 UTC (rev 18132) @@ -1,72 +1,71 @@ -#include <stdio.h> -#include <winsock2.h> -#include <tchar.h> -#include "echo.h" -#include "../skelserver/skelserver.h" - -// Handles the incoming data by reflecting it back to the sender. -DWORD WINAPI EchoHandler(VOID* Sock_) -{ - DWORD Retval = 0; - SOCKET Sock = (SOCKET)Sock_; - - if (!EchoIncomingPackets(Sock)) { - _tprintf(_T("Echo incoming packets failed\n")); - Retval = 3; - } - - _tprintf(_T("Shutting connection down...\n")); - if (ShutdownConnection(Sock)) { - _tprintf(_T("Connection is down.\n")); - } - else - { - _tprintf(_T("Connection shutdown failed\n")); - Retval = 3; - } - - return Retval; -} - - - -BOOL EchoIncomingPackets(SOCKET Sock) -{ - TCHAR ReadBuffer[BUF]; - INT Temp; - INT ReadBytes; - INT SentBytes; - - do { - ReadBytes = recv(Sock, ReadBuffer, BUF, 0); - if (ReadBytes > 0) { - _tprintf(_T("Received %d bytes from client\n"), ReadBytes); - - SentBytes = 0; - while (SentBytes < ReadBytes) { - Temp = send(Sock, ReadBuffer + SentBytes, - ReadBytes - SentBytes, 0); - if (Temp > 0) { - _tprintf(_T("Sent %d bytes back to client\n"), Temp); - SentBytes += Temp; - } - else if (Temp == SOCKET_ERROR) { - return FALSE; - } - else { - /* Client closed connection before we could reply to - // all the data it sent, so quit early. */ - _tprintf(_T("Peer unexpectedly dropped connection!\n")); - return FALSE; - } - } - } - else if (ReadBytes == SOCKET_ERROR) { - return FALSE; - } - } while (ReadBytes != 0); - - _tprintf(("Connection closed by peer.\n")); - return TRUE; -} - +#include <stdio.h> +#include <winsock2.h> +#include <tchar.h> +#include "echo.h" +#include "../skelserver/skelserver.h" + +DWORD WINAPI EchoHandler(VOID* Sock_) +{ + DWORD Retval = 0; + SOCKET Sock = (SOCKET)Sock_; + + if (!EchoIncomingPackets(Sock)) { + _tprintf(_T("Echo incoming packets failed\n")); + Retval = 3; + } + + _tprintf(_T("Shutting connection down...\n")); + if (ShutdownConnection(Sock)) { + _tprintf(_T("Connection is down.\n")); + } + else + { + _tprintf(_T("Connection shutdown failed\n")); + Retval = 3; + } + + return Retval; +} + + + +BOOL EchoIncomingPackets(SOCKET Sock) +{ + TCHAR ReadBuffer[BUF]; + INT Temp; + INT ReadBytes; + INT SentBytes; + + do { + ReadBytes = recv(Sock, ReadBuffer, BUF, 0); + if (ReadBytes > 0) { + _tprintf(_T("Received %d bytes from client\n"), ReadBytes); + + SentBytes = 0; + while (SentBytes < ReadBytes) { + Temp = send(Sock, ReadBuffer + SentBytes, + ReadBytes - SentBytes, 0); + if (Temp > 0) { + _tprintf(_T("Sent %d bytes back to client\n"), Temp); + SentBytes += Temp; + } + else if (Temp == SOCKET_ERROR) { + return FALSE; + } + else { + /* Client closed connection before we could reply to + all the data it sent, so quit early. */ + _tprintf(_T("Peer unexpectedly dropped connection!\n")); + return FALSE; + } + } + } + else if (ReadBytes == SOCKET_ERROR) { + return FALSE; + } + } while (ReadBytes != 0); + + _tprintf(("Connection closed by peer.\n")); + return TRUE; +} + Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.c ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h --- trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h 2005-09-27 23:29:35 UTC (rev 18131) +++ trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h 2005-09-27 23:37:05 UTC (rev 18132) @@ -1,4 +1,4 @@ -#define BUF 1024 - -DWORD WINAPI EchoHandler(VOID* Sock_); -BOOL EchoIncomingPackets(SOCKET Sock); +#define BUF 1024 + +DWORD WINAPI EchoHandler(VOID* Sock_); +BOOL EchoIncomingPackets(SOCKET Sock); Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/echo/echo.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/qotd ___________________________________________________________________ Name: svn:ignore + *.o *.a *.d *.exe *.coff *.sym *.map Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/skelserver ___________________________________________________________________ Name: svn:ignore + *.o *.a *.d *.exe *.coff *.sym *.map _____ Modified: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c --- trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c 2005-09-27 23:29:35 UTC (rev 18131) +++ trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c 2005-09-27 23:37:05 UTC (rev 18132) @@ -1,127 +1,127 @@ -#include <stdio.h> -#include <winsock2.h> -#include <tchar.h> -#include "../tcpsvcs.h" -#include "skelserver.h" - - -DWORD WINAPI StartServer(LPVOID lpParam) -{ - const TCHAR* HostIP = "127.0.0.1"; - DWORD RetVal; - WSADATA wsaData; - PMYDATA pData; - - pData = (PMYDATA)lpParam; - - if ((RetVal = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0) - { - _tprintf(_T("WSAStartup() failed : %lu\n"), RetVal); - return -1; - } - - SOCKET ListeningSocket = SetUpListener(HostIP, htons(pData->Port)); - if (ListeningSocket == INVALID_SOCKET) - { - _tprintf(_T("error setting up socket\n")); - return 3; - } - - printf("Waiting for connections...\n"); - while (1) - { - AcceptConnections(ListeningSocket, pData->Service); - printf("Acceptor restarting...\n"); - } - - WSACleanup(); - return 0; -} - - -SOCKET SetUpListener(const char* ServAddr, int Port) -{ - SOCKET Sock; - SOCKADDR_IN Server; - DWORD InterfaceAddr = inet_addr(ServAddr); - - if (InterfaceAddr != INADDR_NONE) - { - Sock = socket(AF_INET, SOCK_STREAM, 0); - if (Sock != INVALID_SOCKET) - { - Server.sin_family = AF_INET; - Server.sin_addr.s_addr = InterfaceAddr; - Server.sin_port = Port; - if (bind(Sock, (SOCKADDR*)&Server, sizeof(SOCKADDR_IN)) != SOCKET_ERROR) - { - listen(Sock, SOMAXCONN); - return Sock; - } - else - printf("bind() failed\n"); - - } - } - return INVALID_SOCKET; -} - - - - -VOID AcceptConnections(SOCKET ListeningSocket, LPTHREAD_START_ROUTINE Service) -{ - SOCKADDR_IN Client; - SOCKET Sock; - INT nAddrSize = sizeof(Client); - DWORD ThreadID; - - while (1) - { - Sock = accept(ListeningSocket, (SOCKADDR*)&Client, &nAddrSize); - if (Sock != INVALID_SOCKET) - { - _tprintf(_T("Accepted connection from %s:%d\n"), - inet_ntoa(Client.sin_addr), ntohs(Client.sin_port)); - - CreateThread(0, 0, Service, (void*)Sock, 0, &ThreadID); - } - else - { - _tprintf(_T("accept() failed\n")); - return; - } - } -} - -BOOL ShutdownConnection(SOCKET Sock) -{ - /* Disallow any further data sends. This will tell the other side - that we want to go away now. If we skip this step, we don't - shut the connection down nicely. */ - if (shutdown(Sock, SD_SEND) == SOCKET_ERROR) - return FALSE; - - /* Receive any extra data still sitting on the socket. After all - data is received, this call will block until the remote host - acknowledges the TCP control packet sent by the shutdown above. - Then we'll get a 0 back from recv, signalling that the remote - host has closed its side of the connection. */ - while (1) - { - char ReadBuffer[BUF]; - int NewBytes = recv(Sock, ReadBuffer, BUF, 0); - if (NewBytes == SOCKET_ERROR) - return FALSE; - else if (NewBytes != 0) - _tprintf(_T("FYI, received %d unexpected bytes during shutdown\n"), NewBytes); - else - break; - } - - /* Close the socket. */ - if (closesocket(Sock) == SOCKET_ERROR) - return FALSE; - - return TRUE; -} +#include <stdio.h> +#include <winsock2.h> +#include <tchar.h> +#include "../tcpsvcs.h" +#include "skelserver.h" + + +DWORD WINAPI StartServer(LPVOID lpParam) +{ + const TCHAR* HostIP = "127.0.0.1"; + DWORD RetVal; + WSADATA wsaData; + PMYDATA pData; + + pData = (PMYDATA)lpParam; + + if ((RetVal = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0) + { + _tprintf(_T("WSAStartup() failed : %lu\n"), RetVal); + return -1; + } + + SOCKET ListeningSocket = SetUpListener(HostIP, htons(pData->Port)); + if (ListeningSocket == INVALID_SOCKET) + { + _tprintf(_T("error setting up socket\n")); + return 3; + } + + printf("Waiting for connections...\n"); + while (1) + { + AcceptConnections(ListeningSocket, pData->Service); + printf("Acceptor restarting...\n"); + } + + WSACleanup(); + return 0; +} + + +SOCKET SetUpListener(const char* ServAddr, int Port) +{ + SOCKET Sock; + SOCKADDR_IN Server; + DWORD InterfaceAddr = inet_addr(ServAddr); + + if (InterfaceAddr != INADDR_NONE) + { + Sock = socket(AF_INET, SOCK_STREAM, 0); + if (Sock != INVALID_SOCKET) + { + Server.sin_family = AF_INET; + Server.sin_addr.s_addr = InterfaceAddr; + Server.sin_port = Port; + if (bind(Sock, (SOCKADDR*)&Server, sizeof(SOCKADDR_IN)) != SOCKET_ERROR) + { + listen(Sock, SOMAXCONN); + return Sock; + } + else + printf("bind() failed\n"); + + } + } + return INVALID_SOCKET; +} + + + + +VOID AcceptConnections(SOCKET ListeningSocket, LPTHREAD_START_ROUTINE Service) +{ + SOCKADDR_IN Client; + SOCKET Sock; + INT nAddrSize = sizeof(Client); + DWORD ThreadID; + + while (1) + { + Sock = accept(ListeningSocket, (SOCKADDR*)&Client, &nAddrSize); + if (Sock != INVALID_SOCKET) + { + _tprintf(_T("Accepted connection from %s:%d\n"), + inet_ntoa(Client.sin_addr), ntohs(Client.sin_port)); + + CreateThread(0, 0, Service, (void*)Sock, 0, &ThreadID); + } + else + { + _tprintf(_T("accept() failed\n")); + return; + } + } +} + +BOOL ShutdownConnection(SOCKET Sock) +{ + /* Disallow any further data sends. This will tell the other side + that we want to go away now. If we skip this step, we don't + shut the connection down nicely. */ + if (shutdown(Sock, SD_SEND) == SOCKET_ERROR) + return FALSE; + + /* Receive any extra data still sitting on the socket. After all + data is received, this call will block until the remote host + acknowledges the TCP control packet sent by the shutdown above. + Then we'll get a 0 back from recv, signalling that the remote + host has closed its side of the connection. */ + while (1) + { + char ReadBuffer[BUF]; + int NewBytes = recv(Sock, ReadBuffer, BUF, 0); + if (NewBytes == SOCKET_ERROR) + return FALSE; + else if (NewBytes != 0) + _tprintf(_T("FYI, received %d unexpected bytes during shutdown\n"), NewBytes); + else + break; + } + + /* Close the socket. */ + if (closesocket(Sock) == SOCKET_ERROR) + return FALSE; + + return TRUE; +} Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.c ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h --- trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h 2005-09-27 23:29:35 UTC (rev 18131) +++ trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h 2005-09-27 23:37:05 UTC (rev 18132) @@ -1,7 +1,7 @@ -#define BUF 1024 - -DWORD WINAPI StartServer(LPVOID lpParam); -SOCKET SetUpListener(const char* ServAddr, int Port); -VOID AcceptConnections(SOCKET ListeningSocket, LPTHREAD_START_ROUTINE Service); -BOOL EchoIncomingPackets(SOCKET sd); -BOOL ShutdownConnection(SOCKET Sock); +#define BUF 1024 + +DWORD WINAPI StartServer(LPVOID lpParam); +SOCKET SetUpListener(const char* ServAddr, int Port); +VOID AcceptConnections(SOCKET ListeningSocket, LPTHREAD_START_ROUTINE Service); +BOOL EchoIncomingPackets(SOCKET sd); +BOOL ShutdownConnection(SOCKET Sock); Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/skelserver/skelserver.h ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c --- trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c 2005-09-27 23:29:35 UTC (rev 18131) +++ trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c 2005-09-27 23:37:05 UTC (rev 18132) @@ -1,57 +1,57 @@ -#include <stdio.h> -#include <winsock2.h> -#include <tchar.h> -#include "tcpsvcs.h" -#include "skelserver/skelserver.h" -#include "echo/echo.h" -#include "chargen/chargen.h" - -int main(int argc, char *argv[]) -{ - PMYDATA pData[MAX_THREADS]; - DWORD dwThreadId[MAX_THREADS]; - HANDLE hThread[MAX_THREADS]; - INT i; - - /* Create MAX_THREADS worker threads. */ - for( i=0; i<MAX_THREADS; i++ ) - { - /* Allocate memory for thread data. */ - pData[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MYDATA)); - - if( pData == NULL ) - ExitProcess(2); - - /* Generate unique data for each thread. */ - pData[0]->Port = ECHO_PORT; - pData[0]->Service = EchoHandler; - pData[1]->Port = CHARGEN_PORT; - pData[1]->Service = ChargenHandler; - - hThread[i] = CreateThread( - NULL, // default security attributes - 0, // use default stack size - StartServer, // thread function - pData[i], // argument to thread function - 0, // use default creation flags - &dwThreadId[i]); // returns the thread identifier - - /* Check the return value for success. */ - if (hThread[i] == NULL) - { - ExitProcess(i); - } - } - - /* Wait until all threads have terminated. */ - WaitForMultipleObjects(MAX_THREADS, hThread, TRUE, INFINITE); - - /* Close all thread handles upon completion. */ - for(i=0; i<MAX_THREADS; i++) - { - CloseHandle(hThread[i]); - } - - return 0; -} - +#include <stdio.h> +#include <winsock2.h> +#include <tchar.h> +#include "tcpsvcs.h" +#include "skelserver/skelserver.h" +#include "echo/echo.h" +#include "chargen/chargen.h" + +int main(int argc, char *argv[]) +{ + PMYDATA pData[MAX_THREADS]; + DWORD dwThreadId[MAX_THREADS]; + HANDLE hThread[MAX_THREADS]; + INT i; + + /* Create MAX_THREADS worker threads. */ + for( i=0; i<MAX_THREADS; i++ ) + { + /* Allocate memory for thread data. */ + pData[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(MYDATA)); + + if( pData == NULL ) + ExitProcess(2); + + /* Generate unique data for each thread. */ + pData[0]->Port = ECHO_PORT; + pData[0]->Service = EchoHandler; + pData[1]->Port = CHARGEN_PORT; + pData[1]->Service = ChargenHandler; + + hThread[i] = CreateThread( + NULL, // default security attributes + 0, // use default stack size + StartServer, // thread function + pData[i], // argument to thread function + 0, // use default creation flags + &dwThreadId[i]); // returns the thread identifier + + /* Check the return value for success. */ + if (hThread[i] == NULL) + { + ExitProcess(i); + } + } + + /* Wait until all threads have terminated. */ + WaitForMultipleObjects(MAX_THREADS, hThread, TRUE, INFINITE); + + /* Close all thread handles upon completion. */ + for(i=0; i<MAX_THREADS; i++) + { + CloseHandle(hThread[i]); + } + + return 0; +} + Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.c ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h --- trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h 2005-09-27 23:29:35 UTC (rev 18131) +++ trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h 2005-09-27 23:37:05 UTC (rev 18132) @@ -1,13 +1,13 @@ -#define ECHO_PORT 7 -#define CHARGEN_PORT 19 -#define DAYTIME_PORT 13 -#define DISCARD_PORT 9 -#define QOTD_PORT 17 - -#define MAX_THREADS 2 -#define BUF_SIZE 255 - -typedef struct _MyData { - INT Port; - LPTHREAD_START_ROUTINE Service; -} MYDATA, *PMYDATA; +#define ECHO_PORT 7 +#define CHARGEN_PORT 19 +#define DAYTIME_PORT 13 +#define DISCARD_PORT 9 +#define QOTD_PORT 17 + +#define MAX_THREADS 2 +#define BUF_SIZE 255 + +typedef struct _MyData { + INT Port; + LPTHREAD_START_ROUTINE Service; +} MYDATA, *PMYDATA; Property changes on: trunk/reactos/apps/utils/net/tcpsvcs/tcpsvcs.h ___________________________________________________________________ Name: svn:eol-style + native
19 years, 2 months
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
...
59
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
Results per page:
10
25
50
100
200