ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
September 2008
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
27 participants
747 discussions
Start a n
N
ew thread
[dchapyshev] 36183: - volume.c: replace HeapAlloc to RtlAllocateHeap, HeapFree to RtlFreeHeap - move TzSpecificLocalTimeToSystemTime to time.c - implement TzSpecificLocalTimeToSystemTime based on wine. It corrects 378 wine tests.
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat Sep 13 05:22:28 2008 New Revision: 36183 URL:
http://svn.reactos.org/svn/reactos?rev=36183&view=rev
Log: - volume.c: replace HeapAlloc to RtlAllocateHeap, HeapFree to RtlFreeHeap - move TzSpecificLocalTimeToSystemTime to time.c - implement TzSpecificLocalTimeToSystemTime based on wine. It corrects 378 wine tests. Modified: trunk/reactos/dll/win32/kernel32/file/volume.c trunk/reactos/dll/win32/kernel32/misc/stubs.c trunk/reactos/dll/win32/kernel32/misc/time.c Modified: trunk/reactos/dll/win32/kernel32/file/volume.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/vo…
============================================================================== --- trunk/reactos/dll/win32/kernel32/file/volume.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/file/volume.c [iso-8859-1] Sat Sep 13 05:22:28 2008 @@ -1083,7 +1083,7 @@ if ((ret = GetVolumeNameForVolumeMountPointW( pathW, volumeW, len ))) FilenameW2A_N( lpszVolumeName, len, volumeW, -1 ); - HeapFree( GetProcessHeap(), 0, pathW ); + RtlFreeHeap( GetProcessHeap(), 0, pathW ); return ret; } @@ -1107,7 +1107,7 @@ MOUNTMGR_MOUNT_POINT input; MOUNTMGR_MOUNT_POINTS *output; - if (!(output = HeapAlloc( GetProcessHeap(), 0, size ))) + if (!(output = RtlAllocateHeap( GetProcessHeap(), 0, size ))) { SetLastError( ERROR_NOT_ENOUGH_MEMORY ); break; @@ -1119,7 +1119,7 @@ { if (GetLastError() != ERROR_MORE_DATA) break; size = output->Size; - HeapFree( GetProcessHeap(), 0, output ); + RtlFreeHeap( GetProcessHeap(), 0, output ); continue; } CloseHandle( mgr ); @@ -1127,7 +1127,7 @@ output->Size = 0; if (!FindNextVolumeW( output, volume, len )) { - HeapFree( GetProcessHeap(), 0, output ); + RtlFreeHeap( GetProcessHeap(), 0, output ); return INVALID_HANDLE_VALUE; } return (HANDLE)output; @@ -1146,7 +1146,7 @@ DWORD len ) { - WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + WCHAR *buffer = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ); HANDLE handle = FindFirstVolumeW( buffer, len ); if (handle != INVALID_HANDLE_VALUE) @@ -1157,7 +1157,7 @@ handle = INVALID_HANDLE_VALUE; } } - HeapFree( GetProcessHeap(), 0, buffer ); + RtlFreeHeap( GetProcessHeap(), 0, buffer ); return handle; } @@ -1170,7 +1170,7 @@ HANDLE hFindVolume ) { - return HeapFree(GetProcessHeap(), 0, hFindVolume); + return RtlFreeHeap(GetProcessHeap(), 0, hFindVolume); } /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/st…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] Sat Sep 13 05:22:28 2008 @@ -726,21 +726,6 @@ if (!(current & ES_CONTINUOUS) || (esFlags & ES_CONTINUOUS)) current = esFlags; return old; -} - -/* - * @unimplemented - */ -BOOL -STDCALL -TzSpecificLocalTimeToSystemTime( - CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation, - CONST SYSTEMTIME *lpLocalTime, - LPSYSTEMTIME lpUniversalTime - ) -{ - STUB; - return 0; } /* Modified: trunk/reactos/dll/win32/kernel32/misc/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/ti…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/time.c [iso-8859-1] Sat Sep 13 05:22:28 2008 @@ -34,6 +34,204 @@ } DOSDATE, *PDOSDATE; #define TICKSPERMIN 600000000 + +#define LL2FILETIME( ll, pft )\ + (pft)->dwLowDateTime = (UINT)(ll); \ + (pft)->dwHighDateTime = (UINT)((ll) >> 32); +#define FILETIME2LL( pft, ll) \ + ll = (((LONGLONG)((pft)->dwHighDateTime))<<32) + (pft)-> dwLowDateTime ; + +static const int MonthLengths[2][12] = +{ + { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, + { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } +}; + +/* STATIC FUNTIONS **********************************************************/ + +static inline int IsLeapYear(int Year) +{ + return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0; +} + +/*********************************************************************** + * TIME_DayLightCompareDate + * + * Compares two dates without looking at the year. + * + * PARAMS + * date [in] The local time to compare. + * compareDate [in] The daylight savings begin or end date. + * + * RETURNS + * + * -1 if date < compareDate + * 0 if date == compareDate + * 1 if date > compareDate + * -2 if an error occurs + */ +static int TIME_DayLightCompareDate( const SYSTEMTIME *date, + const SYSTEMTIME *compareDate ) +{ + int limit_day, dayinsecs; + + if (date->wMonth < compareDate->wMonth) + return -1; /* We are in a month before the date limit. */ + + if (date->wMonth > compareDate->wMonth) + return 1; /* We are in a month after the date limit. */ + + /* if year is 0 then date is in day-of-week format, otherwise + * it's absolute date. + */ + if (compareDate->wYear == 0) + { + WORD First; + /* compareDate->wDay is interpreted as number of the week in the month + * 5 means: the last week in the month */ + int weekofmonth = compareDate->wDay; + /* calculate the day of the first DayOfWeek in the month */ + First = ( 6 + compareDate->wDayOfWeek - date->wDayOfWeek + date->wDay + ) % 7 + 1; + limit_day = First + 7 * (weekofmonth - 1); + /* check needed for the 5th weekday of the month */ + if(limit_day > MonthLengths[date->wMonth==2 && IsLeapYear(date->wYear)] + [date->wMonth - 1]) + limit_day -= 7; + } + else + { + limit_day = compareDate->wDay; + } + + /* convert to seconds */ + limit_day = ((limit_day * 24 + compareDate->wHour) * 60 + + compareDate->wMinute ) * 60; + dayinsecs = ((date->wDay * 24 + date->wHour) * 60 + + date->wMinute ) * 60 + date->wSecond; + /* and compare */ + return dayinsecs < limit_day ? -1 : + dayinsecs > limit_day ? 1 : + 0; /* date is equal to the date limit. */ +} + +/*********************************************************************** + * TIME_CompTimeZoneID + * + * Computes the local time bias for a given time and time zone. + * + * PARAMS + * pTZinfo [in] The time zone data. + * lpFileTime [in] The system or local time. + * islocal [in] it is local time. + * + * RETURNS + * TIME_ZONE_ID_INVALID An error occurred + * TIME_ZONE_ID_UNKNOWN There are no transition time known + * TIME_ZONE_ID_STANDARD Current time is standard time + * TIME_ZONE_ID_DAYLIGHT Current time is daylight savings time + */ +static DWORD TIME_CompTimeZoneID ( const TIME_ZONE_INFORMATION *pTZinfo, + FILETIME *lpFileTime, BOOL islocal ) +{ + int ret; + BOOL beforeStandardDate, afterDaylightDate; + DWORD retval = TIME_ZONE_ID_INVALID; + LONGLONG llTime = 0; /* initialized to prevent gcc complaining */ + SYSTEMTIME SysTime; + FILETIME ftTemp; + + if (pTZinfo->DaylightDate.wMonth != 0) + { + /* if year is 0 then date is in day-of-week format, otherwise + * it's absolute date. + */ + if (pTZinfo->StandardDate.wMonth == 0 || + (pTZinfo->StandardDate.wYear == 0 && + (pTZinfo->StandardDate.wDay<1 || + pTZinfo->StandardDate.wDay>5 || + pTZinfo->DaylightDate.wDay<1 || + pTZinfo->DaylightDate.wDay>5))) + { + SetLastError(ERROR_INVALID_PARAMETER); + return TIME_ZONE_ID_INVALID; + } + + if (!islocal) { + FILETIME2LL( lpFileTime, llTime ); + llTime -= ( pTZinfo->Bias + pTZinfo->DaylightBias ) + * (LONGLONG) TICKSPERMIN; + LL2FILETIME( llTime, &ftTemp) + lpFileTime = &ftTemp; + } + + FileTimeToSystemTime(lpFileTime, &SysTime); + + /* check for daylight savings */ + ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->StandardDate); + if (ret == -2) + return TIME_ZONE_ID_INVALID; + + beforeStandardDate = ret < 0; + + if (!islocal) { + llTime -= ( pTZinfo->StandardBias - pTZinfo->DaylightBias ) + * (LONGLONG) TICKSPERMIN; + LL2FILETIME( llTime, &ftTemp) + FileTimeToSystemTime(lpFileTime, &SysTime); + } + + ret = TIME_DayLightCompareDate( &SysTime, &pTZinfo->DaylightDate); + if (ret == -2) + return TIME_ZONE_ID_INVALID; + + afterDaylightDate = ret >= 0; + + retval = TIME_ZONE_ID_STANDARD; + if( pTZinfo->DaylightDate.wMonth < pTZinfo->StandardDate.wMonth ) { + /* Northern hemisphere */ + if( beforeStandardDate && afterDaylightDate ) + retval = TIME_ZONE_ID_DAYLIGHT; + } else /* Down south */ + if( beforeStandardDate || afterDaylightDate ) + retval = TIME_ZONE_ID_DAYLIGHT; + } else + /* No transition date */ + retval = TIME_ZONE_ID_UNKNOWN; + + return retval; +} + +/*********************************************************************** + * TIME_GetTimezoneBias + * + * Calculates the local time bias for a given time zone. + * + * PARAMS + * pTZinfo [in] The time zone data. + * lpFileTime [in] The system or local time. + * islocal [in] It is local time. + * pBias [out] The calculated bias in minutes. + * + * RETURNS + * TRUE when the time zone bias was calculated. + */ +static BOOL TIME_GetTimezoneBias( const TIME_ZONE_INFORMATION *pTZinfo, + FILETIME *lpFileTime, BOOL islocal, LONG *pBias ) +{ + LONG bias = pTZinfo->Bias; + DWORD tzid = TIME_CompTimeZoneID( pTZinfo, lpFileTime, islocal); + + if( tzid == TIME_ZONE_ID_INVALID) + return FALSE; + if (tzid == TIME_ZONE_ID_DAYLIGHT) + bias += pTZinfo->DaylightBias; + else if (tzid == TIME_ZONE_ID_STANDARD) + bias += pTZinfo->StandardBias; + *pBias = bias; + return TRUE; +} + /* FUNCTIONS ****************************************************************/ @@ -445,6 +643,44 @@ /* + * @implemented (Wine 13 sep 2008) + */ +BOOL +STDCALL +TzSpecificLocalTimeToSystemTime( + CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation, + CONST SYSTEMTIME *lpLocalTime, + LPSYSTEMTIME lpUniversalTime + ) +{ + FILETIME ft; + LONG lBias; + LONGLONG t; + TIME_ZONE_INFORMATION tzinfo; + + if (lpTimeZoneInformation != NULL) + { + tzinfo = *lpTimeZoneInformation; + } + else + { + if (GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_INVALID) + return FALSE; + } + + if (!SystemTimeToFileTime(lpLocalTime, &ft)) + return FALSE; + FILETIME2LL( &ft, t) + if (!TIME_GetTimezoneBias(&tzinfo, &ft, TRUE, &lBias)) + return FALSE; + /* convert minutes to 100-nanoseconds-ticks */ + t += (LONGLONG)lBias * TICKSPERMIN; + LL2FILETIME( t, &ft) + return FileTimeToSystemTime(&ft, lpUniversalTime); +} + + +/* * @implemented */ BOOL STDCALL
16 years, 3 months
1
0
0
0
[fireball] 36182: - Call NtCreateSection and NtMapViewOfSection with more correct parameters.
by fireball@svn.reactos.org
Author: fireball Date: Sat Sep 13 04:59:22 2008 New Revision: 36182 URL:
http://svn.reactos.org/svn/reactos?rev=36182&view=rev
Log: - Call NtCreateSection and NtMapViewOfSection with more correct parameters. Modified: trunk/reactos/dll/ntdll/ldr/utils.c Modified: trunk/reactos/dll/ntdll/ldr/utils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/utils.c?rev=…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/utils.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/utils.c [iso-8859-1] Sat Sep 13 04:59:22 2008 @@ -697,7 +697,7 @@ NULL, NULL, PAGE_READONLY, - SEC_COMMIT | (MapAsDataFile ? 0 : SEC_IMAGE), + MapAsDataFile ? SEC_COMMIT : SEC_IMAGE, FileHandle); NtClose(FileHandle); @@ -2048,8 +2048,8 @@ 0, NULL, &ViewSize, + ViewShare, 0, - MEM_COMMIT, PAGE_READONLY); NtCurrentTeb()->Tib.ArbitraryUserPointer = ArbitraryUserPointer; if (!NT_SUCCESS(Status))
16 years, 3 months
1
0
0
0
[dchapyshev] 36181: - Move FindVolumeClose, FindFirstVolumeW/A, GetVolumeNameForVolumeMountPointA to volume.c - Implement FindVolumeClose, GetVolumeNameForVolumeMountPointA (based on wine)
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat Sep 13 04:21:43 2008 New Revision: 36181 URL:
http://svn.reactos.org/svn/reactos?rev=36181&view=rev
Log: - Move FindVolumeClose, FindFirstVolumeW/A, GetVolumeNameForVolumeMountPointA to volume.c - Implement FindVolumeClose, GetVolumeNameForVolumeMountPointA (based on wine) Modified: trunk/reactos/dll/win32/kernel32/file/volume.c trunk/reactos/dll/win32/kernel32/include/kernel32.h trunk/reactos/dll/win32/kernel32/misc/stubs.c Modified: trunk/reactos/dll/win32/kernel32/file/volume.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/vo…
============================================================================== --- trunk/reactos/dll/win32/kernel32/file/volume.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/file/volume.c [iso-8859-1] Sat Sep 13 04:21:43 2008 @@ -1060,4 +1060,117 @@ return FALSE; } +/* + * @implemented (Wine 13 sep 2008) + */ +BOOL +STDCALL +GetVolumeNameForVolumeMountPointA( + LPCSTR lpszVolumeMountPoint, + LPSTR lpszVolumeName, + DWORD cchBufferLength + ) +{ + BOOL ret; + WCHAR volumeW[50], *pathW = NULL; + DWORD len = min( sizeof(volumeW) / sizeof(WCHAR), cchBufferLength ); + + TRACE("(%s, %p, %x)\n", debugstr_a(lpszVolumeMountPoint), lpszVolumeName, cchBufferLength); + + if (!lpszVolumeMountPoint || !(pathW = FilenameA2W( lpszVolumeMountPoint, TRUE ))) + return FALSE; + + if ((ret = GetVolumeNameForVolumeMountPointW( pathW, volumeW, len ))) + FilenameW2A_N( lpszVolumeName, len, volumeW, -1 ); + + HeapFree( GetProcessHeap(), 0, pathW ); + return ret; +} + +/* + * @implemented (Wine 13 sep 2008) + */ +HANDLE +STDCALL +FindFirstVolumeW( + LPWSTR volume, + DWORD len + ) +{ + DWORD size = 1024; + HANDLE mgr = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, 0, 0 ); + if (mgr == INVALID_HANDLE_VALUE) return INVALID_HANDLE_VALUE; + + for (;;) + { + MOUNTMGR_MOUNT_POINT input; + MOUNTMGR_MOUNT_POINTS *output; + + if (!(output = HeapAlloc( GetProcessHeap(), 0, size ))) + { + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + break; + } + memset( &input, 0, sizeof(input) ); + + if (!DeviceIoControl( mgr, IOCTL_MOUNTMGR_QUERY_POINTS, &input, sizeof(input), + output, size, NULL, NULL )) + { + if (GetLastError() != ERROR_MORE_DATA) break; + size = output->Size; + HeapFree( GetProcessHeap(), 0, output ); + continue; + } + CloseHandle( mgr ); + /* abuse the Size field to store the current index */ + output->Size = 0; + if (!FindNextVolumeW( output, volume, len )) + { + HeapFree( GetProcessHeap(), 0, output ); + return INVALID_HANDLE_VALUE; + } + return (HANDLE)output; + } + CloseHandle( mgr ); + return INVALID_HANDLE_VALUE; +} + +/* + * @implemented (Wine 13 sep 2008) + */ +HANDLE +STDCALL +FindFirstVolumeA( + LPSTR volume, + DWORD len + ) +{ + WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + HANDLE handle = FindFirstVolumeW( buffer, len ); + + if (handle != INVALID_HANDLE_VALUE) + { + if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) + { + FindVolumeClose( handle ); + handle = INVALID_HANDLE_VALUE; + } + } + HeapFree( GetProcessHeap(), 0, buffer ); + return handle; +} + +/* + * @implemented (Wine 13 sep 2008) + */ +BOOL +STDCALL +FindVolumeClose( + HANDLE hFindVolume + ) +{ + return HeapFree(GetProcessHeap(), 0, hFindVolume); +} + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/include/kernel32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include…
============================================================================== --- trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] Sat Sep 13 04:21:43 2008 @@ -76,6 +76,7 @@ HANDLE FASTCALL TranslateStdHandle(HANDLE hHandle); PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc); +DWORD FilenameW2A_N(LPSTR dest, INT destlen, LPCWSTR src, INT srclen); DWORD FilenameW2A_FitOrFail(LPSTR DestA, INT destLen, LPCWSTR SourceW, INT sourceLen); DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU); Modified: trunk/reactos/dll/win32/kernel32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/st…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] Sat Sep 13 04:21:43 2008 @@ -424,19 +424,6 @@ */ BOOL STDCALL -FindVolumeClose( - HANDLE hFindVolume - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -STDCALL FindVolumeMountPointClose( HANDLE hFindVolumeMountPoint ) @@ -817,55 +804,6 @@ memcpy( computername, hostname, len * sizeof(WCHAR) ); computername[len + 1] = 0; return TRUE; -} - -/* - * @implemented - */ -HANDLE -STDCALL -FindFirstVolumeW( - LPWSTR volume, - DWORD len - ) -{ - DWORD size = 1024; - HANDLE mgr = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, 0 ); - if (mgr == INVALID_HANDLE_VALUE) return INVALID_HANDLE_VALUE; - - for (;;) - { - MOUNTMGR_MOUNT_POINT input; - MOUNTMGR_MOUNT_POINTS *output; - - if (!(output = HeapAlloc( GetProcessHeap(), 0, size ))) - { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); - break; - } - memset( &input, 0, sizeof(input) ); - - if (!DeviceIoControl( mgr, IOCTL_MOUNTMGR_QUERY_POINTS, &input, sizeof(input), - output, size, NULL, NULL )) - { - if (GetLastError() != ERROR_MORE_DATA) break; - size = output->Size; - HeapFree( GetProcessHeap(), 0, output ); - continue; - } - CloseHandle( mgr ); - /* abuse the Size field to store the current index */ - output->Size = 0; - if (!FindNextVolumeW( output, volume, len )) - { - HeapFree( GetProcessHeap(), 0, output ); - return INVALID_HANDLE_VALUE; - } - return (HANDLE)output; - } - CloseHandle( mgr ); - return INVALID_HANDLE_VALUE; } /* @@ -1060,31 +998,6 @@ } /* - * @implemented - */ -HANDLE -STDCALL -FindFirstVolumeA( - LPSTR volume, - DWORD len - ) -{ - WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - HANDLE handle = FindFirstVolumeW( buffer, len ); - - if (handle != INVALID_HANDLE_VALUE) - { - if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) - { - FindVolumeClose( handle ); - handle = INVALID_HANDLE_VALUE; - } - } - HeapFree( GetProcessHeap(), 0, buffer ); - return handle; -} - -/* * @unimplemented */ HANDLE @@ -1146,21 +1059,6 @@ LPCSTR lpGuid, PVOID pBuffer, DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -STDCALL -GetVolumeNameForVolumeMountPointA( - LPCSTR lpszVolumeMountPoint, - LPSTR lpszVolumeName, - DWORD cchBufferLength ) { STUB;
16 years, 3 months
1
0
0
0
[cwittich] 36180: fix kernel32 format_msg winetest
by cwittich@svn.reactos.org
Author: cwittich Date: Sat Sep 13 03:48:18 2008 New Revision: 36180 URL:
http://svn.reactos.org/svn/reactos?rev=36180&view=rev
Log: fix kernel32 format_msg winetest Modified: trunk/reactos/dll/win32/kernel32/misc/errormsg.c Modified: trunk/reactos/dll/win32/kernel32/misc/errormsg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/er…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/errormsg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/errormsg.c [iso-8859-1] Sat Sep 13 03:48:18 2008 @@ -171,6 +171,12 @@ if ((dwFlags & FORMAT_MESSAGE_FROM_STRING) &&((dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) || (dwFlags & FORMAT_MESSAGE_FROM_HMODULE))) return 0; + + if (!lpBuffer) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } if (width && width != FORMAT_MESSAGE_MAX_WIDTH_MASK) FIXME("line wrapping (%lu) not supported.\n", width); @@ -423,6 +429,12 @@ &&((dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) || (dwFlags & FORMAT_MESSAGE_FROM_HMODULE))) return 0; + if (!lpBuffer) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (width && width != FORMAT_MESSAGE_MAX_WIDTH_MASK) FIXME("line wrapping not supported.\n"); from = NULL;
16 years, 3 months
1
0
0
0
[cwittich] 36179: fix most kernel32_profile winetests
by cwittich@svn.reactos.org
Author: cwittich Date: Sat Sep 13 03:23:32 2008 New Revision: 36179 URL:
http://svn.reactos.org/svn/reactos?rev=36179&view=rev
Log: fix most kernel32_profile winetests Modified: trunk/reactos/dll/win32/kernel32/misc/profile.c Modified: trunk/reactos/dll/win32/kernel32/misc/profile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/pr…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/profile.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/profile.c [iso-8859-1] Sat Sep 13 03:23:32 2008 @@ -755,6 +755,9 @@ } GetWindowsDirectoryW( windirW, MAX_PATH ); + + if (!filename) + filename = L"win.ini"; if ((RtlDetermineDosPathNameType_U(filename) == RtlPathTypeRelative) && !wcschr(filename, '\\') && !wcschr(filename, '/')) @@ -933,7 +936,7 @@ while ((section!=NULL)) { if (section->name[0]) { tmplen = wcslen(section->name)+1; - if (tmplen > buflen) { + if (tmplen >= buflen) { if (buflen > 0) { memcpy(buf, section->name, (buflen - 1) * sizeof(WCHAR)); buf += buflen - 1; @@ -1111,9 +1114,6 @@ int ret; LPCWSTR pDefVal = NULL; - if (!filename) - filename = L"win.ini"; - DPRINT("%S, %S, %S, %p, %u, %S\n", section, entry, def_val, buffer, len, filename); @@ -1337,7 +1337,13 @@ DWORD WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len, LPCWSTR filename ) { - int ret = 0; + int ret = 0; + + if (!section || !buffer) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } DPRINT("(%S, %p, %ld, %S)\n", section, buffer, len, filename); @@ -1363,18 +1369,23 @@ LPWSTR bufferW; INT retW, ret = 0; - bufferW = buffer ? HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)) : NULL; - if (section) RtlCreateUnicodeStringFromAsciiz(§ionW, section); - else sectionW.Buffer = NULL; + if (!section || !buffer) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + bufferW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + RtlCreateUnicodeStringFromAsciiz(§ionW, section); if (filename) RtlCreateUnicodeStringFromAsciiz(&filenameW, filename); else filenameW.Buffer = NULL; retW = GetPrivateProfileSectionW(sectionW.Buffer, bufferW, len, filenameW.Buffer); if (len > 2) { - ret = WideCharToMultiByte(CP_ACP, 0, bufferW, retW + 2, buffer, len, NULL, NULL); + ret = WideCharToMultiByte(CP_ACP, 0, bufferW, retW + 1, buffer, len, NULL, NULL); if (ret > 2) - ret -= 2; + ret -= 1; else { ret = 0; @@ -1645,13 +1656,17 @@ retW = GetPrivateProfileSectionNamesW(bufferW, size, filenameW.Buffer); if (retW && size) { - ret = WideCharToMultiByte(CP_ACP, 0, bufferW, retW, buffer, size, NULL, NULL); + ret = WideCharToMultiByte(CP_ACP, 0, bufferW, retW+1, buffer, size-1, NULL, NULL); if (!ret) { - ret = size; + ret = size-2; buffer[size-1] = 0; } - } + else + ret = ret-1; + } + else if(size) + buffer[0] = '\0'; RtlFreeUnicodeString(&filenameW); HeapFree(GetProcessHeap(), 0, bufferW);
16 years, 3 months
1
0
0
0
[cwittich] 36178: fix some kernel32 module winetests (GetProcAddress, GetModuleFileName)
by cwittich@svn.reactos.org
Author: cwittich Date: Sat Sep 13 02:37:05 2008 New Revision: 36178 URL:
http://svn.reactos.org/svn/reactos?rev=36178&view=rev
Log: fix some kernel32 module winetests (GetProcAddress, GetModuleFileName) Modified: trunk/reactos/dll/win32/kernel32/misc/ldr.c Modified: trunk/reactos/dll/win32/kernel32/misc/ldr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/ld…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/ldr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/ldr.c [iso-8859-1] Sat Sep 13 02:37:05 2008 @@ -230,22 +230,29 @@ { ANSI_STRING ProcedureName; FARPROC fnExp = NULL; + NTSTATUS Status; if (HIWORD(lpProcName) != 0) { RtlInitAnsiString (&ProcedureName, (LPSTR)lpProcName); - LdrGetProcedureAddress ((PVOID)hModule, + Status = LdrGetProcedureAddress ((PVOID)hModule, &ProcedureName, 0, (PVOID*)&fnExp); } else { - LdrGetProcedureAddress ((PVOID)hModule, + Status = LdrGetProcedureAddress ((PVOID)hModule, NULL, (ULONG)lpProcName, (PVOID*)&fnExp); + } + + if (!NT_SUCCESS(Status)) + { + SetLastError( RtlNtStatusToDosError( Status ) ); + fnExp = NULL; } return fnExp; @@ -313,27 +320,25 @@ Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); if (Module->DllBase == (PVOID)hModule) { - if (nSize * sizeof(WCHAR) < Module->FullDllName.Length) - { + Length = min(nSize, Module->FullDllName.Length / sizeof(WCHAR)); + FileName.Length = 0; + FileName.MaximumLength = (USHORT)Length * sizeof(WCHAR); + FileName.Buffer = lpFilename; + + /* convert unicode string to ansi (or oem) */ + if (bIsFileApiAnsi) + RtlUnicodeStringToAnsiString (&FileName, + &Module->FullDllName, + FALSE); + else + RtlUnicodeStringToOemString (&FileName, + &Module->FullDllName, + FALSE); + + if (nSize < Length) SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL); - } else - { - FileName.Length = 0; - FileName.MaximumLength = (USHORT)nSize * sizeof(WCHAR); - FileName.Buffer = lpFilename; - - /* convert unicode string to ansi (or oem) */ - if (bIsFileApiAnsi) - RtlUnicodeStringToAnsiString (&FileName, - &Module->FullDllName, - FALSE); - else - RtlUnicodeStringToOemString (&FileName, - &Module->FullDllName, - FALSE); - Length = Module->FullDllName.Length / sizeof(WCHAR); - } + lpFilename[Length] = '\0'; RtlLeaveCriticalSection (Peb->LoaderLock); return Length; @@ -381,22 +386,20 @@ if (Module->DllBase == (PVOID)hModule) { - if (nSize * sizeof(WCHAR) < Module->FullDllName.Length) - { + Length = min(nSize, Module->FullDllName.Length / sizeof(WCHAR)); + FileName.Length = 0; + FileName.MaximumLength = (USHORT) Length * sizeof(WCHAR); + FileName.Buffer = lpFilename; + + RtlCopyUnicodeString (&FileName, + &Module->FullDllName); + if (nSize < Length) SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL); - } else - { - FileName.Length = 0; - FileName.MaximumLength =(USHORT)nSize * sizeof(WCHAR); - FileName.Buffer = lpFilename; - - RtlCopyUnicodeString (&FileName, - &Module->FullDllName); - Length = Module->FullDllName.Length / sizeof(WCHAR); - } + lpFilename[Length] = L'\0'; RtlLeaveCriticalSection (Peb->LoaderLock); + return Length; }
16 years, 3 months
1
0
0
0
[sserapion] 36177: Remove hacks. Add hacks. Zero sum game?
by sserapion@svn.reactos.org
Author: sserapion Date: Sat Sep 13 02:13:27 2008 New Revision: 36177 URL:
http://svn.reactos.org/svn/reactos?rev=36177&view=rev
Log: Remove hacks. Add hacks. Zero sum game? Modified: branches/ros-amd64-bringup/reactos/include/crt/_mingw.h branches/ros-amd64-bringup/reactos/include/crt/stdlib.h branches/ros-amd64-bringup/reactos/include/crt/wchar.h Modified: branches/ros-amd64-bringup/reactos/include/crt/_mingw.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
============================================================================== --- branches/ros-amd64-bringup/reactos/include/crt/_mingw.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/include/crt/_mingw.h [iso-8859-1] Sat Sep 13 02:13:27 2008 @@ -272,14 +272,12 @@ #define _SIZE_T_DEFINED #undef size_t #ifdef _WIN64 -#define _INTEGRAL_MAX_BITS 64 #if defined(__GNUC__) && defined(__STRICT_ANSI__) typedef unsigned int size_t __attribute__ ((mode (DI))); #else typedef unsigned __int64 size_t; #endif #else - #define _INTEGRAL_MAX_BITS 32 typedef unsigned int size_t; #endif #endif Modified: branches/ros-amd64-bringup/reactos/include/crt/stdlib.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
============================================================================== --- branches/ros-amd64-bringup/reactos/include/crt/stdlib.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/include/crt/stdlib.h [iso-8859-1] Sat Sep 13 02:13:27 2008 @@ -562,7 +562,7 @@ char *__cdecl ulltoa (unsigned long long , char *, int); wchar_t *__cdecl lltow (long long, wchar_t *, int); wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int); - +#if _INTEGRAL_MAX_BITS >= 64 /* __CRT_INLINE using non-ansi functions */ __CRT_INLINE long long __cdecl atoll (const char * _c) { return _atoi64 (_c); } __CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); } @@ -571,7 +571,7 @@ __CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); } __CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); } #endif /* (__STRICT_ANSI__) */ - +#endif #endif /* !__NO_ISOCEXT */ #ifdef __cplusplus Modified: branches/ros-amd64-bringup/reactos/include/crt/wchar.h URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/inclu…
============================================================================== --- branches/ros-amd64-bringup/reactos/include/crt/wchar.h [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/include/crt/wchar.h [iso-8859-1] Sat Sep 13 02:13:27 2008 @@ -89,6 +89,8 @@ wchar_t name[260]; }; +/* #if _INTEGRAL_MAX_BITS >= 64 */ + struct _wfinddata32i64_t { unsigned attrib; __time32_t time_create; @@ -115,8 +117,9 @@ __int64 size; wchar_t name[260]; }; - -#if !defined(_WIN64) //defined(_USE_32BIT_TIME_T) +/* #endif */ + +#ifdef _USE_32BIT_TIME_T #define _wfinddata_t _wfinddata32_t #define _wfinddatai64_t _wfinddata32i64_t @@ -454,7 +457,7 @@ }; #endif -#if _INTEGRAL_MAX_BITS >= 64 +/* #if _INTEGRAL_MAX_BITS >= 64 */ struct _stat32i64 { _dev_t st_dev; @@ -497,7 +500,7 @@ __time64_t st_mtime; __time64_t st_ctime; }; -#endif +/* #endif */ #define __stat64 _stat64
16 years, 3 months
1
0
0
0
[sserapion] 36176: Move several functions out of file.c, use common code for 64bit, 32bit, unicode and non-unicode versions and provide proper definition. Fixes amd64 build of crt lib. (nothing tested)
by sserapion@svn.reactos.org
Author: sserapion Date: Sat Sep 13 02:12:22 2008 New Revision: 36176 URL:
http://svn.reactos.org/svn/reactos?rev=36176&view=rev
Log: Move several functions out of file.c, use common code for 64bit, 32bit, unicode and non-unicode versions and provide proper definition. Fixes amd64 build of crt lib. (nothing tested) Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find64.c (with props) branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat.c (with props) branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat64.c (with props) branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wstat.c (with props) Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.rbuild branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/file.c branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find.c branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wfind.c Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] Sat Sep 13 02:12:22 2008 @@ -259,15 +259,19 @@ </directory> <directory name="stdio"> <file>access.c</file> - <!-- file>file.c</file --> - <!-- file>find.c</file --> + <file>file.c</file> + <file>find.c</file> + <file>find64.c</file> <file>fmode.c</file> <file>lnx_sprintf.c</file> <file>perror.c</file> <file>popen.c</file> + <file>stat.c</file> + <file>stat64.c</file> <file>waccess.c</file> - <!-- file>wfind.c</file --> + <file>wfind.c</file> <file>wpopen.c</file> + <file>wstat.c</file> </directory> <directory name="stdlib"> <file>_exit.c</file> Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/file.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] Sat Sep 13 02:12:22 2008 @@ -68,11 +68,6 @@ #undef vprintf #undef vwprintf -/* for stat mode, permissions apply to all,owner and group */ -#define ALL_S_IREAD (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) -#define ALL_S_IWRITE (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) -#define ALL_S_IEXEC (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)) - /* _access() bit flags FIXME: incomplete */ /* defined in crt/io.h */ @@ -94,7 +89,7 @@ DWORD unkn[7]; /* critical section and init flag */ } ioinfo; -/*static */ioinfo fdesc[MAX_FILES]; +ioinfo fdesc[MAX_FILES]; FILE _iob[3] = { { 0 } }; @@ -109,17 +104,6 @@ /* INTERNAL: Static buffer for temp file name */ static char tmpname[MAX_PATH]; - -static const unsigned int EXE = 'e' << 16 | 'x' << 8 | 'e'; -static const unsigned int BAT = 'b' << 16 | 'a' << 8 | 't'; -static const unsigned int CMD = 'c' << 16 | 'm' << 8 | 'd'; -static const unsigned int COM = 'c' << 16 | 'o' << 8 | 'm'; - -#define TOUL(x) (ULONGLONG)(x) -static const ULONGLONG WCEXE = TOUL('e') << 32 | TOUL('x') << 16 | TOUL('e'); -static const ULONGLONG WCBAT = TOUL('b') << 32 | TOUL('a') << 16 | TOUL('t'); -static const ULONGLONG WCCMD = TOUL('c') << 32 | TOUL('m') << 16 | TOUL('d'); -static const ULONGLONG WCCOM = TOUL('c') << 32 | TOUL('o') << 16 | TOUL('m'); /* This critical section protects the tables fdesc and fstreams, * and their related indexes, fdstart, fdend, @@ -132,23 +116,6 @@ #define LOCK_FILES() do { EnterCriticalSection(&FILE_cs); } while (0) #define UNLOCK_FILES() do { LeaveCriticalSection(&FILE_cs); } while (0) -#ifndef _WIN64 -static void stat64_to_stati64(const struct __stat64 *buf64, struct _stati64 *buf) -{ - buf->st_dev = buf64->st_dev; - buf->st_ino = buf64->st_ino; - buf->st_mode = buf64->st_mode; - buf->st_nlink = buf64->st_nlink; - buf->st_uid = buf64->st_uid; - buf->st_gid = buf64->st_gid; - buf->st_rdev = buf64->st_rdev; - buf->st_size = buf64->st_size; - buf->st_atime = buf64->st_atime; - buf->st_mtime = buf64->st_mtime; - buf->st_ctime = buf64->st_ctime; -} -#endif - static inline BOOL is_valid_fd(int fd) { return fd >= 0 && fd < fdend && (fdesc[fd].wxflag & WX_OPEN); @@ -160,7 +127,7 @@ * it returns a valid handle which is about to be closed, a subsequent call * will fail, most likely in a sane way. */ -static HANDLE fdtoh(int fd) +HANDLE fdtoh(int fd) { if (!is_valid_fd(fd)) { @@ -1147,138 +1114,6 @@ { TRACE(":FILE* (%p) fd (%d)\n",file,file->_file); return file->_file; -} - -/********************************************************************* - * _fstat64 (MSVCRT.@) - */ -int CDECL _fstat64(int fd, struct _stat64* buf) -{ - DWORD dw; - DWORD type; - BY_HANDLE_FILE_INFORMATION hfi; - HANDLE hand = fdtoh(fd); - - TRACE(":fd (%d) stat (%p)\n",fd,buf); - if (hand == INVALID_HANDLE_VALUE) - return -1; - - if (!buf) - { - WARN(":failed-NULL buf\n"); - __set_errno(ERROR_INVALID_PARAMETER); - return -1; - } - - memset(&hfi, 0, sizeof(hfi)); - memset(buf, 0, sizeof(struct __stat64)); - type = GetFileType(hand); - if (type == FILE_TYPE_PIPE) - { - buf->st_dev = buf->st_rdev = fd; - buf->st_mode = S_IFIFO; - buf->st_nlink = 1; - } - else if (type == FILE_TYPE_CHAR) - { - buf->st_dev = buf->st_rdev = fd; - buf->st_mode = S_IFCHR; - buf->st_nlink = 1; - } - else /* FILE_TYPE_DISK etc. */ - { - if (!GetFileInformationByHandle(hand, &hfi)) - { - WARN(":failed-last error (%d)\n",GetLastError()); - __set_errno(ERROR_INVALID_PARAMETER); - return -1; - } - buf->st_mode = S_IFREG | S_IREAD; - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - buf->st_mode |= S_IWRITE; - buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - buf->st_nlink = hfi.nNumberOfLinks; - } - TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, - buf->st_mode); - return 0; -} - -/********************************************************************* - * _fstati64 (MSVCRT.@) - */ -int CDECL _fstati64(int fd, struct _stati64* buf) -{ - int ret; - struct __stat64 buf64; - - ret = _fstat64(fd, &buf64); - if (!ret) - stat64_to_stati64(&buf64, buf); - return ret; -} - -/********************************************************************* - * _fstat (MSVCRT.@) - */ -int CDECL _fstat(int fd, struct _stat32* buf) -{ - DWORD dw; - DWORD type; - BY_HANDLE_FILE_INFORMATION hfi; - HANDLE hand = fdtoh(fd); - - TRACE(":fd (%d) stat (%p)\n",fd,buf); - if (hand == INVALID_HANDLE_VALUE) - return -1; - - if (!buf) - { - WARN(":failed-NULL buf\n"); - __set_errno(ERROR_INVALID_PARAMETER); - return -1; - } - - memset(&hfi, 0, sizeof(hfi)); - memset(buf, 0, sizeof(struct _stat32)); - type = GetFileType(hand); - if (type == FILE_TYPE_PIPE) - { - buf->st_dev = buf->st_rdev = fd; - buf->st_mode = S_IFIFO; - buf->st_nlink = 1; - } - else if (type == FILE_TYPE_CHAR) - { - buf->st_dev = buf->st_rdev = fd; - buf->st_mode = S_IFCHR; - buf->st_nlink = 1; - } - else /* FILE_TYPE_DISK etc. */ - { - if (!GetFileInformationByHandle(hand, &hfi)) - { - WARN(":failed-last error (%d)\n",GetLastError()); - __set_errno(ERROR_INVALID_PARAMETER); - return -1; - } - buf->st_mode = S_IFREG | S_IREAD; - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - buf->st_mode |= S_IWRITE; - buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - buf->st_nlink = hfi.nNumberOfLinks; - } - TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, - buf->st_mode); - return 0; } /********************************************************************* @@ -1827,290 +1662,6 @@ else fdesc[fd].wxflag &= ~WX_TEXT; return ret; -} - -/********************************************************************* - * _stat64 (MSVCRT.@) - */ -int CDECL _stat64(const char* path, struct __stat64 * buf) -{ - DWORD dw; - WIN32_FILE_ATTRIBUTE_DATA hfi; - unsigned short mode = ALL_S_IREAD; - int plen; - - TRACE(":file (%s) buf(%p)\n",path,buf); - - if (!GetFileAttributesExA(path, GetFileExInfoStandard, &hfi)) - { - TRACE("failed (%d)\n",GetLastError()); - __set_errno(ERROR_FILE_NOT_FOUND); - return -1; - } - - memset(buf,0,sizeof(struct __stat64)); - - /* FIXME: rdev isn't drive num, despite what the docs say-what is it? - Bon 011120: This FIXME seems incorrect - Also a letter as first char isn't enough to be classified - as a drive letter - */ - if (isalpha(*path)&& (*(path+1)==':')) - buf->st_dev = buf->st_rdev = toupper(*path) - 'A'; /* drive num */ - else - buf->st_dev = buf->st_rdev = _getdrive() - 1; - - plen = strlen(path); - - /* Dir, or regular file? */ - if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - (path[plen-1] == '\\')) - mode |= (_S_IFDIR | ALL_S_IEXEC); - else - { - mode |= _S_IFREG; - /* executable? */ - if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ - { - unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) | - (tolower(path[plen-3]) << 16); - if (ext == EXE || ext == BAT || ext == CMD || ext == COM) - mode |= ALL_S_IEXEC; - } - } - - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - mode |= ALL_S_IWRITE; - - buf->st_mode = mode; - buf->st_nlink = 1; - buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, - (long)(buf->st_size >> 32),(long)buf->st_size, - (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); - return 0; -} - -/********************************************************************* - * _stati64 (MSVCRT.@) - */ -int CDECL _stati64(const char* path, struct _stati64 * buf) -{ - int ret; - struct __stat64 buf64; - - ret = _stat64(path, &buf64); - if (!ret) - stat64_to_stati64(&buf64, buf); - return ret; -} - -/********************************************************************* - * _stat (MSVCRT.@) - */ -int CDECL _stat32(const char* path, struct _stat32 * buf) -{ - DWORD dw; - WIN32_FILE_ATTRIBUTE_DATA hfi; - unsigned short mode = ALL_S_IREAD; - int plen; - - TRACE(":file (%s) buf(%p)\n",path,buf); - - if (!GetFileAttributesExA(path, GetFileExInfoStandard, &hfi)) - { - TRACE("failed (%d)\n",GetLastError()); - __set_errno(ERROR_FILE_NOT_FOUND); - return -1; - } - - memset(buf,0,sizeof(struct _stat32)); - - /* FIXME: rdev isn't drive num, despite what the docs say-what is it? - Bon 011120: This FIXME seems incorrect - Also a letter as first char isn't enough to be classified - as a drive letter - */ - if (isalpha(*path)&& (*(path+1)==':')) - buf->st_dev = buf->st_rdev = toupper(*path) - 'A'; /* drive num */ - else - buf->st_dev = buf->st_rdev = _getdrive() - 1; - - plen = strlen(path); - - /* Dir, or regular file? */ - if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - (path[plen-1] == '\\')) - mode |= (_S_IFDIR | ALL_S_IEXEC); - else - { - mode |= _S_IFREG; - /* executable? */ - if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ - { - unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) | - (tolower(path[plen-3]) << 16); - if (ext == EXE || ext == BAT || ext == CMD || ext == COM) - mode |= ALL_S_IEXEC; - } - } - - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - mode |= ALL_S_IWRITE; - - buf->st_mode = mode; - buf->st_nlink = 1; - buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, - (long)(buf->st_size >> 16),(long)buf->st_size, - (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); - return 0; -} - -/********************************************************************* - * _wstat64 (MSVCRT.@) - */ -int CDECL _wstat64(const wchar_t* path, struct __stat64 * buf) -{ - DWORD dw; - WIN32_FILE_ATTRIBUTE_DATA hfi; - unsigned short mode = ALL_S_IREAD; - int plen; - - TRACE(":file (%s) buf(%p)\n",debugstr_w(path),buf); - - if (!GetFileAttributesExW(path, GetFileExInfoStandard, &hfi)) - { - TRACE("failed (%d)\n",GetLastError()); - __set_errno(ERROR_FILE_NOT_FOUND); - return -1; - } - - memset(buf,0,sizeof(struct __stat64)); - - /* FIXME: rdev isn't drive num, despite what the docs says-what is it? */ - if (iswalpha(*path)) - buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */ - else - buf->st_dev = buf->st_rdev = _getdrive() - 1; - - plen = strlenW(path); - - /* Dir, or regular file? */ - if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - (path[plen-1] == '\\')) - mode |= (_S_IFDIR | ALL_S_IEXEC); - else - { - mode |= _S_IFREG; - /* executable? */ - if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ - { - ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | - ((ULONGLONG)tolowerW(path[plen-3]) << 32); - if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM) - mode |= ALL_S_IEXEC; - } - } - - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - mode |= ALL_S_IWRITE; - - buf->st_mode = mode; - buf->st_nlink = 1; - buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, - (long)(buf->st_size >> 32),(long)buf->st_size, - (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); - return 0; -} - -/********************************************************************* - * _wstati64 (MSVCRT.@) - */ -int CDECL _wstati64(const wchar_t* path, struct _stati64 * buf) -{ - int ret; - struct __stat64 buf64; - - ret = _wstat64(path, &buf64); - if (!ret) - stat64_to_stati64(&buf64, buf); - return ret; -} - -/********************************************************************* - * _wstat (MSVCRT.@) - */ -int CDECL _wstat32(const wchar_t* path, struct _stat32 * buf) -{ - DWORD dw; - WIN32_FILE_ATTRIBUTE_DATA hfi; - unsigned short mode = ALL_S_IREAD; - int plen; - - TRACE(":file (%s) buf(%p)\n",debugstr_w(path),buf); - - if (!GetFileAttributesExW(path, GetFileExInfoStandard, &hfi)) - { - TRACE("failed (%d)\n",GetLastError()); - __set_errno(ERROR_FILE_NOT_FOUND); - return -1; - } - - memset(buf,0,sizeof(struct _stat32)); - - /* FIXME: rdev isn't drive num, despite what the docs says-what is it? */ - if (iswalpha(*path)) - buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */ - else - buf->st_dev = buf->st_rdev = _getdrive() - 1; - - plen = strlenW(path); - - /* Dir, or regular file? */ - if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - (path[plen-1] == '\\')) - mode |= (_S_IFDIR | ALL_S_IEXEC); - else - { - mode |= _S_IFREG; - /* executable? */ - if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ - { - ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | - ((ULONGLONG)tolowerW(path[plen-3]) << 32); - if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM) - mode |= ALL_S_IEXEC; - } - } - - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - mode |= ALL_S_IWRITE; - - buf->st_mode = mode; - buf->st_nlink = 1; - buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, - (long)(buf->st_size >> 16),(long)buf->st_size, - (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); - return 0; } /********************************************************************* Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find.c [iso-8859-1] Sat Sep 13 02:12:22 2008 @@ -1,106 +1,5 @@ -#include <precomp.h> -#include <tchar.h> -#include <io.h> -/* - * @implemented - */ -intptr_t -_tfindfirst(const _TCHAR* _name, struct _tfinddata_t* result) -{ - WIN32_FIND_DATA FindFileData; - long hFindFile; - - hFindFile = (intptr_t)FindFirstFile(_name, &FindFileData); - if (hFindFile == -1) { - _dosmaperr(GetLastError()); - return -1; - } - - result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); - result->size = FindFileData.nFileSizeLow; - _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); - - return hFindFile; -} - -/* - * @implemented - */ -intptr_t _tfindnext(intptr_t handle, struct _tfinddata_t* result) -{ - WIN32_FIND_DATA FindFileData; - - if (!FindNextFile((void*)handle, &FindFileData)) { - _dosmaperr(GetLastError()); - return -1; - } - - result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); - result->size = FindFileData.nFileSizeLow; - _tcsncpy(result->name,FindFileData.cFileName, MAX_PATH); - - return 0; -} - - -/* - * @implemented - */ -intptr_t _tfindfirsti64(const _TCHAR *_name, struct _tfinddatai64_t *result) -{ - WIN32_FIND_DATA FindFileData; - long hFindFile; - - hFindFile = (intptr_t)FindFirstFile(_name, &FindFileData); - if (hFindFile == -1) - { - _dosmaperr(GetLastError()); - return -1; - } - - result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); - result->size = - (((__int64)FindFileData.nFileSizeLow)<<32) + FindFileData.nFileSizeLow; - _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); - - return hFindFile; -} - -/* - * @implemented - */ -int _tfindnexti64(intptr_t handle, struct _tfinddatai64_t *result) -{ - WIN32_FIND_DATA FindFileData; - - if (!FindNextFile((HANDLE)handle, &FindFileData)) { - _dosmaperr(GetLastError()); - return -1; - } - - result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); - result->size = - (((__int64)FindFileData.nFileSizeLow)<<32) + FindFileData.nFileSizeLow; - _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); - - return 0; -} - - - -#ifndef _UNICODE +#define _USE_FIND64 0 +#include "find64.c" /* * @implemented @@ -114,5 +13,3 @@ return 0; } - -#endif Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find64.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find64.c (added) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find64.c [iso-8859-1] Sat Sep 13 02:12:22 2008 @@ -1,0 +1,119 @@ +#include <precomp.h> +#include <tchar.h> +#include <io.h> + +#ifndef _USE_FIND64 +#define _USE_FIND64 1 +#endif + +/* + * @implemented + */ +#if _USE_FIND64 +intptr_t _tfindfirst32i64(const _TCHAR* _name, struct _tfinddata32i64_t* result) +#else +intptr_t _tfindfirst32(const _TCHAR* _name, struct _tfinddata32_t* result) +#endif +{ + WIN32_FIND_DATA FindFileData; + HANDLE hFindFile; + + hFindFile = FindFirstFile(_name, &FindFileData); + if (hFindFile == INVALID_HANDLE_VALUE) { + _dosmaperr(GetLastError()); + return -1; + } + + result->attrib = FindFileData.dwFileAttributes; + result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->size = FindFileData.nFileSizeLow; + _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); + + return (intptr_t)hFindFile; +} + +/* + * @implemented + */ +#if _USE_FIND64 +int _tfindnext32i64(intptr_t handle, struct _tfinddata32i64_t* result) +#else +int _tfindnext32(intptr_t handle, struct _tfinddata32_t* result) +#endif +{ + WIN32_FIND_DATA FindFileData; + + if (!FindNextFile((HANDLE)handle, &FindFileData)) { + _dosmaperr(GetLastError()); + return -1; + } + + result->attrib = FindFileData.dwFileAttributes; + result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->size = FindFileData.nFileSizeLow; + _tcsncpy(result->name,FindFileData.cFileName, MAX_PATH); + + return 0; +} + + +/* + * @implemented + */ +#if _USE_FIND64 +intptr_t _tfindfirst64(const _TCHAR *_name, struct _tfinddata64_t *result) +#else +intptr_t _tfindfirst64i32(const _TCHAR *_name, struct _tfinddata64i32_t *result) +#endif +{ + WIN32_FIND_DATA FindFileData; + HANDLE hFindFile; + + hFindFile = FindFirstFile(_name, &FindFileData); + if (hFindFile == INVALID_HANDLE_VALUE) { + _dosmaperr(GetLastError()); + return -1; + } + + result->attrib = FindFileData.dwFileAttributes; + result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->size = + (((__int64)FindFileData.nFileSizeLow)<<32) + FindFileData.nFileSizeLow; + _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); + + return (intptr_t)hFindFile; +} + +/* + * @implemented + */ +#if _USE_FIND64 +int _tfindnext64(intptr_t handle, struct _tfinddata64_t *result) +#else +int _tfindnext64i32(intptr_t handle, struct _tfinddata64i32_t *result) +#endif +{ + WIN32_FIND_DATA FindFileData; + + if (!FindNextFile((HANDLE)handle, &FindFileData)) { + _dosmaperr(GetLastError()); + return -1; + } + + result->attrib = FindFileData.dwFileAttributes; + result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->size = + (((__int64)FindFileData.nFileSizeLow)<<32) + FindFileData.nFileSizeLow; + _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); + + return 0; +} + Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/find64.c ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat.c (added) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat.c [iso-8859-1] Sat Sep 13 02:12:22 2008 @@ -1,0 +1,15 @@ +#define _USE_STAT64 0 +#include "stat64.c" + + +//only version needed +//int CDECL _fstati64(int fd, struct _stati64* buf) +//{ +// int ret; +// struct __stat64 buf64; +// +// ret = _fstat64(fd, &buf64); +// if (!ret) +// stat64_to_stati64(&buf64, buf); +// return ret; +//} Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat.c ------------------------------------------------------------------------------ svn:eol-style = native Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat64.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat64.c (added) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat64.c [iso-8859-1] Sat Sep 13 02:12:22 2008 @@ -1,0 +1,365 @@ +#include <precomp.h> +#include "wine/unicode.h" + +#include <direct.h> +#include <tchar.h> +#include <sys/stat.h> + +#ifndef _UNICODE +#include <string.h> +#endif + +#ifndef _USE_STAT64 +#define _USE_STAT64 1 +#endif + +/* for stat mode, permissions apply to all,owner and group */ +#define ALL_S_IREAD (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) +#define ALL_S_IWRITE (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) +#define ALL_S_IEXEC (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)) + +#define EXE ('e' << 16 | 'x' << 8 | 'e') +#define BAT ('b' << 16 | 'a' << 8 | 't') +#define CMD ('c' << 16 | 'm' << 8 | 'd') +#define COM ('c' << 16 | 'o' << 8 | 'm') + +#define TOUL(x) (ULONGLONG)(x) +#define WCEXE (TOUL('e') << 32 | TOUL('x') << 16 | TOUL('e')) +#define WCBAT (TOUL('b') << 32 | TOUL('a') << 16 | TOUL('t')) +#define WCCMD (TOUL('c') << 32 | TOUL('m') << 16 | TOUL('d')) +#define WCCOM (TOUL('c') << 32 | TOUL('o') << 16 | TOUL('m')) + +#if _USE_STAT64 +void stat64_to_stati64(const struct __stat64 *buf64, struct _stati64 *buf) +{ + buf->st_dev = buf64->st_dev; + buf->st_ino = buf64->st_ino; + buf->st_mode = buf64->st_mode; + buf->st_nlink = buf64->st_nlink; + buf->st_uid = buf64->st_uid; + buf->st_gid = buf64->st_gid; + buf->st_rdev = buf64->st_rdev; + buf->st_size = buf64->st_size; + buf->st_atime = buf64->st_atime; + buf->st_mtime = buf64->st_mtime; + buf->st_ctime = buf64->st_ctime; +} + +//int _tstati64(const TCHAR* path, struct _stati64 * buf) +//{ +// int ret; +// struct __stat64 buf64; +// +// ret = _tstat64(path, &buf64); +// if (!ret) +// stat64_to_stati64(&buf64, buf); +// return ret; +//} + +#endif + +HANDLE fdtoh(int fd); //file.c + +#if _USE_STAT64 +int CDECL _tstat64(const _TCHAR *path, struct _stat64 *buf) +#else +int CDECL _tstat64i32(const _TCHAR *path, struct _stat64i32 *buf) +#endif +{ + DWORD dw; + WIN32_FILE_ATTRIBUTE_DATA hfi; + unsigned short mode = ALL_S_IREAD; + int plen; + + TRACE(":file (%s) buf(%p)\n",path,buf); + + if (!GetFileAttributesEx(path, GetFileExInfoStandard, &hfi)) + { + TRACE("failed (%d)\n",GetLastError()); + __set_errno(ERROR_FILE_NOT_FOUND); + return -1; + } + + memset(buf,0,sizeof(struct __stat64)); + + /* FIXME: rdev isn't drive num, despite what the docs say-what is it? + Bon 011120: This FIXME seems incorrect + Also a letter as first char isn't enough to be classified + as a drive letter + */ +#ifndef _UNICODE + if (isalpha(*path)&& (*(path+1)==':')) + buf->st_dev = buf->st_rdev = toupper(*path) - 'A'; /* drive num */ +#else + if (iswalpha(*path)) + buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */ +#endif + else + buf->st_dev = buf->st_rdev = _getdrive() - 1; + +#ifndef _UNICODE + plen = strlen(path); +#else + plen = strlenW(path); +#endif + + /* Dir, or regular file? */ + if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || + (path[plen-1] == '\\')) + mode |= (_S_IFDIR | ALL_S_IEXEC); + else + { + mode |= _S_IFREG; + /* executable? */ + if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ + { +#ifndef _UNICODE + unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) | + (tolower(path[plen-3]) << 16); + if (ext == EXE || ext == BAT || ext == CMD || ext == COM) + mode |= ALL_S_IEXEC; +#else + ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | + ((ULONGLONG)tolowerW(path[plen-3]) << 32); + if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM) + mode |= ALL_S_IEXEC; +#endif + } + } + + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + mode |= ALL_S_IWRITE; + + buf->st_mode = mode; + buf->st_nlink = 1; +#if _USE_STAT64 + buf->st_size = buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; +#else + buf->st_size = hfi.nFileSizeLow; +#endif + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, + (long)(buf->st_size >> 16),(long)buf->st_size, + (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); + return 0; +} + +/********************************************************************* + * _stat (MSVCRT.@) + */ +#if _USE_STAT64 +int CDECL _tstat32i64(const _TCHAR *path,struct _stat32i64 *buf) +#else +int CDECL _tstat32(const _TCHAR *path,struct _stat32 *buf) +#endif +{ + DWORD dw; + WIN32_FILE_ATTRIBUTE_DATA hfi; + unsigned short mode = ALL_S_IREAD; + int plen; + + TRACE(":file (%s) buf(%p)\n",path,buf); + + if (!GetFileAttributesEx(path, GetFileExInfoStandard, &hfi)) + { + TRACE("failed (%d)\n",GetLastError()); + __set_errno(ERROR_FILE_NOT_FOUND); + return -1; + } + + memset(buf,0,sizeof(*buf)); + + /* FIXME: rdev isn't drive num, despite what the docs say-what is it? + Bon 011120: This FIXME seems incorrect + Also a letter as first char isn't enough to be classified + as a drive letter + */ +#ifndef _UNICODE + if (isalpha(*path)&& (*(path+1)==':')) + buf->st_dev = buf->st_rdev = toupper(*path) - 'A'; /* drive num */ +#else + if (iswalpha(*path)) + buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */ +#endif + else + buf->st_dev = buf->st_rdev = _getdrive() - 1; + +#ifndef _UNICODE + plen = strlen(path); +#else + plen = strlenW(path); +#endif + + /* Dir, or regular file? */ + if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || + (path[plen-1] == '\\')) + mode |= (_S_IFDIR | ALL_S_IEXEC); + else + { + mode |= _S_IFREG; + /* executable? */ + if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ + { +#ifndef _UNICODE + unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) | + (tolower(path[plen-3]) << 16); + if (ext == EXE || ext == BAT || ext == CMD || ext == COM) + mode |= ALL_S_IEXEC; +#else + ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | + ((ULONGLONG)tolowerW(path[plen-3]) << 32); + if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM) + mode |= ALL_S_IEXEC; +#endif + } + } + + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + mode |= ALL_S_IWRITE; + + buf->st_mode = mode; + buf->st_nlink = 1; +#if _USE_STAT64 + buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; +#else + buf->st_size = hfi.nFileSizeLow; +#endif + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, + (long)(buf->st_size >> 16),(long)buf->st_size, + (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); + return 0; +} + +#ifndef _UNICODE //No wide versions needed + +#if _USE_STAT64 +int CDECL _fstat64(int fd, struct _stat64* buf) +#else +int CDECL _fstat64i32(int fd, struct _stat64i32* buf) +#endif +{ + DWORD dw; + DWORD type; + BY_HANDLE_FILE_INFORMATION hfi; + HANDLE hand = fdtoh(fd); + + TRACE(":fd (%d) stat (%p)\n",fd,buf); + if (hand == INVALID_HANDLE_VALUE) + return -1; + + if (!buf) + { + WARN(":failed-NULL buf\n"); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + + memset(&hfi, 0, sizeof(hfi)); + memset(buf, 0, sizeof(struct __stat64)); + type = GetFileType(hand); + if (type == FILE_TYPE_PIPE) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFIFO; + buf->st_nlink = 1; + } + else if (type == FILE_TYPE_CHAR) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFCHR; + buf->st_nlink = 1; + } + else /* FILE_TYPE_DISK etc. */ + { + if (!GetFileInformationByHandle(hand, &hfi)) + { + WARN(":failed-last error (%d)\n",GetLastError()); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + buf->st_mode = S_IFREG | S_IREAD; + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + buf->st_mode |= S_IWRITE; + buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + buf->st_nlink = hfi.nNumberOfLinks; + } + TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, + buf->st_mode); + return 0; +} + +/********************************************************************* + * _fstat (MSVCRT.@) + */ +#if _USE_STAT64 +int CDECL _fstat32(int fd, struct _stat32* buf) +#else +int CDECL _fstat32i64(int fd, struct _stat32i64* buf) +#endif +{ + DWORD dw; + DWORD type; + BY_HANDLE_FILE_INFORMATION hfi; + HANDLE hand = fdtoh(fd); + + TRACE(":fd (%d) stat (%p)\n",fd,buf); + if (hand == INVALID_HANDLE_VALUE) + return -1; + + if (!buf) + { + WARN(":failed-NULL buf\n"); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + + memset(&hfi, 0, sizeof(hfi)); + memset(buf, 0, sizeof(struct _stat32)); + type = GetFileType(hand); + if (type == FILE_TYPE_PIPE) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFIFO; + buf->st_nlink = 1; + } + else if (type == FILE_TYPE_CHAR) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFCHR; + buf->st_nlink = 1; + } + else /* FILE_TYPE_DISK etc. */ + { + if (!GetFileInformationByHandle(hand, &hfi)) + { + WARN(":failed-last error (%d)\n",GetLastError()); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + buf->st_mode = S_IFREG | S_IREAD; + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + buf->st_mode |= S_IWRITE; + buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + buf->st_nlink = hfi.nNumberOfLinks; + } + TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, + buf->st_mode); + return 0; +} + +#endif Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/stat64.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wfind.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wfind.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wfind.c [iso-8859-1] Sat Sep 13 02:12:22 2008 @@ -1,5 +1,8 @@ #define UNICODE #define _UNICODE - -#include "find.c" +#define _USE_FIND64 0 +#include <wchar.h> +#include "find64.c" +#undef _USE_FIND64 +#include "find64.c" Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wstat.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wstat.c (added) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wstat.c [iso-8859-1] Sat Sep 13 02:12:22 2008 @@ -1,0 +1,7 @@ +#define _UNICODE +#define UNICODE +#define _USE_STAT64 0 +#include <wchar.h> +#include "stat64.c" +#undef _USE_STAT64 +#include "stat64.c" Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/stdio/wstat.c ------------------------------------------------------------------------------ svn:eol-style = native
16 years, 3 months
1
0
0
0
[sserapion] 36175: Protect other architectures from i386 and amd64 specifics. Disallow warnings in this module(like it was before).
by sserapion@svn.reactos.org
Author: sserapion Date: Sat Sep 13 02:05:42 2008 New Revision: 36175 URL:
http://svn.reactos.org/svn/reactos?rev=36175&view=rev
Log: Protect other architectures from i386 and amd64 specifics. Disallow warnings in this module(like it was before). Modified: branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crtexe.c branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/mingw.rbuild branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pseudo-reloc.c Modified: branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crtexe.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/3…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crtexe.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/crtexe.c [iso-8859-1] Sat Sep 13 02:05:42 2008 @@ -202,7 +202,9 @@ if (__dyn_tls_init_callback != NULL && _IsNonwritableInCurrentImage ((PBYTE) &__dyn_tls_init_callback)) __dyn_tls_init_callback (NULL, DLL_THREAD_ATTACH, NULL); +#if defined(__i386__) || defined(__x86_64__) _pei386_runtime_relocator (); +#endif #if defined(__x86_64__) __asm__ __volatile__ ( Modified: branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/mingw.rbuild URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/3…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/mingw.rbuild [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/mingw.rbuild [iso-8859-1] Sat Sep 13 02:05:42 2008 @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd"> <group> -<module name="mingw_common" type="staticlibrary" isstartuplib="true" underscoresymbols="true" allowwarnings="true"> +<module name="mingw_common" type="staticlibrary" isstartuplib="true" underscoresymbols="true"> <importlibrary definition="moldname-msvcrt.def" dllname="msvcrt.dll" /> <include base="mingw_common">include</include> <file>CRT_fp10.c</file> Modified: branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pseudo-reloc.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/3…
============================================================================== --- branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pseudo-reloc.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/lib/3rdparty/mingw/pseudo-reloc.c [iso-8859-1] Sat Sep 13 02:05:42 2008 @@ -11,6 +11,9 @@ DISCLAMED. This includes but is not limited to warrenties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ + +/* Only necesary on x86 and amd64 targets */ +#if defined(__i386__) || defined(__x86_64__) #include <windows.h> @@ -44,3 +47,4 @@ &__RUNTIME_PSEUDO_RELOC_LIST_END__, &_image_base__); } +#endif
16 years, 3 months
1
0
0
0
[sserapion] 36174: Fix warnings/errors in 64bit build.
by sserapion@svn.reactos.org
Author: sserapion Date: Fri Sep 12 21:00:44 2008 New Revision: 36174 URL:
http://svn.reactos.org/svn/reactos?rev=36174&view=rev
Log: Fix warnings/errors in 64bit build. Modified: branches/ros-amd64-bringup/reactos/base/applications/taskmgr/perfdata.c Modified: branches/ros-amd64-bringup/reactos/base/applications/taskmgr/perfdata.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/base/…
============================================================================== --- branches/ros-amd64-bringup/reactos/base/applications/taskmgr/perfdata.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/base/applications/taskmgr/perfdata.c [iso-8859-1] Fri Sep 12 21:00:44 2008 @@ -88,7 +88,7 @@ void PerfDataRefresh(void) { - SIZE_T ulSize; + ULONG ulSize; NTSTATUS status; LPBYTE pBuffer; ULONG BufferSize; @@ -393,7 +393,7 @@ for (Index = 0; Index < ProcessCount; Index++) { - if ((DWORD)pPerfData[Index].ProcessId == dwProcessId) + if (PtrToUlong(pPerfData[Index].ProcessId) == dwProcessId) { FoundIndex = Index; break; @@ -412,7 +412,7 @@ EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) - ProcessId = (ULONG)pPerfData[Index].ProcessId; + ProcessId = PtrToUlong(pPerfData[Index].ProcessId); else ProcessId = 0;
16 years, 3 months
1
0
0
0
← Newer
1
...
40
41
42
43
44
45
46
...
75
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
68
69
70
71
72
73
74
75
Results per page:
10
25
50
100
200