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
July 2011
----- 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
24 participants
517 discussions
Start a n
N
ew thread
[ion] 52773: NO CODE CHANGE: [KERNEL32]: Rename "misc" to "wine" since this is what this is now.
by ion@svn.reactos.org
Author: ion Date: Fri Jul 22 03:26:28 2011 New Revision: 52773 URL:
http://svn.reactos.org/svn/reactos?rev=52773&view=rev
Log: NO CODE CHANGE: [KERNEL32]: Rename "misc" to "wine" since this is what this is now. Added: trunk/reactos/dll/win32/kernel32/wine/ - copied from r52758, trunk/reactos/dll/win32/kernel32/client/misc/ trunk/reactos/dll/win32/kernel32/wine/comm.c - copied unchanged from r52772, trunk/reactos/dll/win32/kernel32/client/misc/comm.c trunk/reactos/dll/win32/kernel32/wine/lzexpand.c - copied unchanged from r52772, trunk/reactos/dll/win32/kernel32/client/misc/lzexpand.c trunk/reactos/dll/win32/kernel32/wine/profile.c - copied unchanged from r52772, trunk/reactos/dll/win32/kernel32/client/misc/profile.c trunk/reactos/dll/win32/kernel32/wine/res.c - copied unchanged from r52772, trunk/reactos/dll/win32/kernel32/client/misc/res.c trunk/reactos/dll/win32/kernel32/wine/timezone.c - copied unchanged from r52772, trunk/reactos/dll/win32/kernel32/client/misc/timezone.c Removed: trunk/reactos/dll/win32/kernel32/client/misc/ trunk/reactos/dll/win32/kernel32/wine/stubs.c trunk/reactos/dll/win32/kernel32/wine/time.c trunk/reactos/dll/win32/kernel32/wine/toolhelp.c Modified: trunk/reactos/dll/win32/kernel32/CMakeLists.txt trunk/reactos/dll/win32/kernel32/kernel32.rbuild Modified: trunk/reactos/dll/win32/kernel32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] Fri Jul 22 03:26:28 2011 @@ -61,13 +61,13 @@ client/file/rw.c client/file/tape.c client/file/volume.c - client/misc/actctx.c - client/misc/comm.c - client/misc/lzexpand.c - client/misc/muldiv.c - client/misc/profile.c - client/misc/res.c - client/misc/timezone.c + wine/actctx.c + wine/comm.c + wine/lzexpand.c + wine/muldiv.c + wine/profile.c + wine/res.c + wine/timezone.c winnls/string/casemap.c winnls/string/chartype.c winnls/string/collation.c Modified: trunk/reactos/dll/win32/kernel32/kernel32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] Fri Jul 22 03:26:28 2011 @@ -80,15 +80,15 @@ <file>tape.c</file> <file>volume.c</file> </directory> - <directory name="misc"> - <file>actctx.c</file> - <file>comm.c</file> - <file>lzexpand.c</file> - <file>muldiv.c</file> - <file>profile.c</file> - <file>res.c</file> - <file>timezone.c</file> - </directory> + </directory> + <directory name="wine"> + <file>actctx.c</file> + <file>comm.c</file> + <file>lzexpand.c</file> + <file>muldiv.c</file> + <file>profile.c</file> + <file>res.c</file> + <file>timezone.c</file> </directory> <directory name="winnls"> <directory name="string"> Removed: trunk/reactos/dll/win32/kernel32/wine/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/wine/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/wine/stubs.c (removed) @@ -1,1381 +1,0 @@ -/* - * KERNEL32.DLL stubs (STUB functions) - * Remove from this file, if you implement them. - */ - -#include <k32.h> - -#define NDEBUG -#include <debug.h> - -#define STUB \ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \ - DPRINT1("%s() is UNIMPLEMENTED!\n", __FUNCTION__) - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseAttachCompleteThunk (VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseDumpAppcompatCache(VOID) -{ - STUB; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseFlushAppcompatCache(VOID) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseCheckAppcompatCache(ULONG Unknown1, - ULONG Unknown2, - ULONG Unknown3, - PULONG Unknown4) -{ - STUB; - if (Unknown4) *Unknown4 = 0; - return TRUE; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseUpdateAppcompatCache(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -CmdBatNotification ( - DWORD Unknown - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -CreateVirtualBuffer ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -ExitVDM ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -ExtendVirtualBuffer ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -FreeVirtualBuffer ( - HANDLE hVirtualBuffer - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -GetNextVDMCommand ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -GetVDMCurrentDirectories ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterConsoleVDM ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3, - DWORD Unknown4, - DWORD Unknown5, - DWORD Unknown6, - DWORD Unknown7, - DWORD Unknown8, - DWORD Unknown9, - DWORD Unknown10 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterWowBaseHandlers ( - DWORD Unknown0 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterWowExec ( - DWORD Unknown0 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVDMCurrentDirectories ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -TrimVirtualBuffer ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -VDMConsoleOperation ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -VDMOperationStarted ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -VirtualBufferExceptionHandler ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2 - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -BindIoCompletionCallback(HANDLE FileHandle, - LPOVERLAPPED_COMPLETION_ROUTINE Function, - ULONG Flags) -{ - NTSTATUS Status = 0; - - DPRINT("(%p, %p, %d)\n", FileHandle, Function, Flags); - - Status = RtlSetIoCompletionCallback(FileHandle, - (PIO_APC_ROUTINE)Function, - Flags); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -CreateJobSet ( - ULONG NumJob, - PJOB_SET_ARRAY UserJobSet, - ULONG Flags) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindVolumeMountPointClose( - HANDLE hFindVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaHighestNodeNumber( - PULONG HighestNodeNumber - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaNodeProcessorMask( - UCHAR Node, - PULONGLONG ProcessorMask - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaProcessorNode( - UCHAR Processor, - PUCHAR NodeNumber - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -ReadFileScatter(HANDLE hFile, - FILE_SEGMENT_ELEMENT aSegmentArray[], - DWORD nNumberOfBytesToRead, - LPDWORD lpReserved, - LPOVERLAPPED lpOverlapped) -{ - PIO_STATUS_BLOCK pIOStatus; - LARGE_INTEGER Offset; - NTSTATUS Status; - - DPRINT("(%p %p %u %p)\n", hFile, aSegmentArray, nNumberOfBytesToRead, lpOverlapped); - - Offset.LowPart = lpOverlapped->Offset; - Offset.HighPart = lpOverlapped->OffsetHigh; - pIOStatus = (PIO_STATUS_BLOCK) lpOverlapped; - pIOStatus->Status = STATUS_PENDING; - pIOStatus->Information = 0; - - Status = NtReadFileScatter(hFile, - NULL, - NULL, - NULL, - pIOStatus, - aSegmentArray, - nNumberOfBytesToRead, - &Offset, - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -VOID -WINAPI -RestoreLastError( - DWORD dwErrCode - ) -{ - STUB; -} - -/* - * @implemented - */ -BOOL -WINAPI -WriteFileGather(HANDLE hFile, - FILE_SEGMENT_ELEMENT aSegmentArray[], - DWORD nNumberOfBytesToWrite, - LPDWORD lpReserved, - LPOVERLAPPED lpOverlapped) -{ - PIO_STATUS_BLOCK IOStatus; - LARGE_INTEGER Offset; - NTSTATUS Status; - - DPRINT("%p %p %u %p\n", hFile, aSegmentArray, nNumberOfBytesToWrite, lpOverlapped); - - Offset.LowPart = lpOverlapped->Offset; - Offset.HighPart = lpOverlapped->OffsetHigh; - IOStatus = (PIO_STATUS_BLOCK) lpOverlapped; - IOStatus->Status = STATUS_PENDING; - IOStatus->Information = 0; - - Status = NtWriteFileGather(hFile, - NULL, - NULL, - NULL, - IOStatus, - aSegmentArray, - nNumberOfBytesToWrite, - &Offset, - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -DeleteVolumeMountPointW( - LPCWSTR lpszVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -FindFirstVolumeMountPointW( - LPCWSTR lpszRootPathName, - LPWSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -FindNextVolumeW( - HANDLE handle, - LPWSTR volume, - DWORD len - ) -{ - MOUNTMGR_MOUNT_POINTS *data = handle; - - while (data->Size < data->NumberOfMountPoints) - { - static const WCHAR volumeW[] = {'\\','?','?','\\','V','o','l','u','m','e','{',}; - WCHAR *link = (WCHAR *)((char *)data + data->MountPoints[data->Size].SymbolicLinkNameOffset); - DWORD size = data->MountPoints[data->Size].SymbolicLinkNameLength; - data->Size++; - /* skip non-volumes */ - if (size < sizeof(volumeW) || memcmp( link, volumeW, sizeof(volumeW) )) continue; - if (size + sizeof(WCHAR) >= len * sizeof(WCHAR)) - { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return FALSE; - } - memcpy( volume, link, size ); - volume[1] = '\\'; /* map \??\ to \\?\ */ - volume[size / sizeof(WCHAR)] = '\\'; /* Windows appends a backslash */ - volume[size / sizeof(WCHAR) + 1] = 0; - DPRINT( "returning entry %u %s\n", data->Size - 1, volume ); - return TRUE; - } - SetLastError( ERROR_NO_MORE_FILES ); - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindNextVolumeMountPointW( - HANDLE hFindVolumeMountPoint, - LPWSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -GetFirmwareEnvironmentVariableW( - LPCWSTR lpName, - LPCWSTR lpGuid, - PVOID pBuffer, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetVolumePathNamesForVolumeNameW( - LPCWSTR lpszVolumeName, - LPWSTR lpszVolumePathNames, - DWORD cchBufferLength, - PDWORD lpcchReturnLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetFirmwareEnvironmentVariableW( - LPCWSTR lpName, - LPCWSTR lpGuid, - PVOID pValue, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVolumeMountPointW( - LPCWSTR lpszVolumeMountPoint, - LPCWSTR lpszVolumeName - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -DeleteVolumeMountPointA( - LPCSTR lpszVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -FindFirstVolumeMountPointA( - LPCSTR lpszRootPathName, - LPSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -FindNextVolumeA(HANDLE handle, - LPSTR volume, - DWORD len) -{ - WCHAR *buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, len * sizeof(WCHAR)); - BOOL ret; - - if (!buffer) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - if ((ret = FindNextVolumeW( handle, buffer, len ))) - { - if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE; - } - - HeapFree( GetProcessHeap(), 0, buffer ); - return ret; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindNextVolumeMountPointA( - HANDLE hFindVolumeMountPoint, - LPSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -GetFirmwareEnvironmentVariableA( - LPCSTR lpName, - LPCSTR lpGuid, - PVOID pBuffer, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetVolumePathNamesForVolumeNameA( - LPCSTR lpszVolumeName, - LPSTR lpszVolumePathNames, - DWORD cchBufferLength, - PDWORD lpcchReturnLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetFirmwareEnvironmentVariableA( - LPCSTR lpName, - LPCSTR lpGuid, - PVOID pValue, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVolumeMountPointA( - LPCSTR lpszVolumeMountPoint, - LPCSTR lpszVolumeName - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR name) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR name) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD WINAPI GetHandleContext(HANDLE hnd) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE WINAPI CreateSocketHandle(VOID) -{ - STUB; - return INVALID_HANDLE_VALUE; -} - -/* - * @unimplemented - */ -BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, - LPSTR lpszInitName, LPSTR lpszProcName, - FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, - LPVOID lpBuff ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -VOID WINAPI UTUnRegister( HMODULE hModule ) -{ - STUB; -} - -/* - * @unimplemented - */ -FARPROC WINAPI DelayLoadFailureHook(LPCSTR pszDllName, LPCSTR pszProcName) -{ - STUB; - return NULL; -} - -/* - * @unimplemented - */ -NTSTATUS WINAPI CreateNlsSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,ULONG Size,ULONG AccessMask) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI IsValidUILanguage(LANGID langid) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -VOID WINAPI NlsConvertIntegerToString(ULONG Value,ULONG Base,ULONG strsize, LPWSTR str, ULONG strsize2) -{ - STUB; -} - -/* - * @unimplemented - */ -UINT WINAPI SetCPGlobal(UINT CodePage) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetClientTimeZoneInformation( - CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) -{ - STUB; - return 0; -} - -ULONG -WINAPI -NlsGetCacheUpdateCount(VOID) -{ - STUB; - return 0; -} - -BOOLEAN -WINAPI -Wow64EnableWow64FsRedirection (BOOLEAN Wow64EnableWow64FsRedirection) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -Wow64DisableWow64FsRedirection (VOID ** pv) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -Wow64RevertWow64FsRedirection (VOID * pv) -{ - STUB; - return FALSE; -} - -UINT -WINAPI -EnumSystemFirmwareTables(IN DWORD FirmwareTableProviderSignature, - OUT PVOID pFirmwareTableBuffer, - IN DWORD BufferSize) -{ - STUB; - return 0; -} - -BOOL -WINAPI -GetSystemFileCacheSize(OUT PSIZE_T lpMinimumFileCacheSize, - OUT PSIZE_T lpMaximumFileCacheSize, - OUT PDWORD lpFlags) -{ - STUB; - return FALSE; -} - -UINT -WINAPI -GetSystemFirmwareTable(IN DWORD FirmwareTableProviderSignature, - IN DWORD FirmwareTableID, - OUT PVOID pFirmwareTableBuffer, - IN DWORD BufferSize) -{ - STUB; - return 0; -} - -BOOL -WINAPI -SetSystemFileCacheSize(IN SIZE_T MinimumFileCacheSize, - IN SIZE_T MaximumFileCacheSize, - IN DWORD Flags) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetThreadStackGuarantee(IN OUT PULONG StackSizeInBytes) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetProcessWorkingSetSizeEx(IN HANDLE hProcess, - IN SIZE_T dwMinimumWorkingSetSize, - IN SIZE_T dwMaximumWorkingSetSize, - IN DWORD Flags) -{ - STUB; - return FALSE; -} - - -BOOL -WINAPI -GetProcessWorkingSetSizeEx(IN HANDLE hProcess, - OUT PSIZE_T lpMinimumWorkingSetSize, - OUT PSIZE_T lpMaximumWorkingSetSize, - OUT PDWORD Flags) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaAvailableMemoryNode(IN UCHAR Node, - OUT PULONGLONG AvailableBytes) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaAvailableMemory(PVOID lpInfo, - ULONG Length, - PULONG ReturnLength) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaProcessorMap(PVOID lpInfo, - ULONG Length, - PULONG ReturnLength) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -NlsResetProcessLocale(VOID) -{ - STUB; - return TRUE; -} - -DWORD -WINAPI -AddLocalAlternateComputerNameA(LPSTR lpName, PNTSTATUS Status) -{ - STUB; - return 0; -} - -DWORD -WINAPI -AddLocalAlternateComputerNameW(LPWSTR lpName, PNTSTATUS Status) -{ - STUB; - return 0; -} - -NTSTATUS -WINAPI -BaseCleanupAppcompatCache(VOID) -{ - STUB; - return STATUS_NOT_IMPLEMENTED; -} - -NTSTATUS -WINAPI -BaseCleanupAppcompatCacheSupport(PVOID pUnknown) -{ - STUB; - return STATUS_NOT_IMPLEMENTED; -} - -BOOL -WINAPI -BaseInitAppcompatCache(VOID) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -BaseInitAppcompatCacheSupport(VOID) -{ - STUB; - return FALSE; -} - -VOID -WINAPI -CreateProcessInternalWSecure(VOID) -{ - STUB; -} - -DWORD -WINAPI -EnumerateLocalComputerNamesA(PVOID pUnknown, DWORD Size, LPSTR lpBuffer, LPDWORD lpnSize) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -DWORD -WINAPI -EnumerateLocalComputerNamesW(PVOID pUnknown, DWORD Size, LPWSTR lpBuffer, LPDWORD lpnSize) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -PVOID -WINAPI -GetComPlusPackageInstallStatus(VOID) -{ - STUB; - return NULL; -} - -BOOL -WINAPI -GetConsoleCharType(HANDLE hConsole, COORD Coord, PDWORD Type) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetConsoleCursorMode(HANDLE hConsole, PBOOL pUnknown1, PBOOL pUnknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetConsoleNlsMode(HANDLE hConsole, LPDWORD lpMode) -{ - STUB; - return FALSE; -} - -VOID -WINAPI -GetDefaultSortkeySize(LPVOID lpUnknown) -{ - STUB; - lpUnknown = NULL; -} - -VOID -WINAPI -GetLinguistLangSize(LPVOID lpUnknown) -{ - STUB; - lpUnknown = NULL; -} - -BOOL -WINAPI -OpenDataFile(HANDLE hFile, DWORD dwUnused) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -PrivMoveFileIdentityW(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -ReadConsoleInputExA(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -ReadConsoleInputExW(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -RegisterConsoleIME(HWND hWnd, LPDWORD ThreadId) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -RegisterConsoleOS2(BOOL bUnknown) -{ - STUB; - return FALSE; -} - -DWORD -WINAPI -RemoveLocalAlternateComputerNameA(LPSTR lpName, DWORD Unknown) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -DWORD -WINAPI -RemoveLocalAlternateComputerNameW(LPWSTR lpName, DWORD Unknown) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -BOOL -WINAPI -SetComPlusPackageInstallStatus(LPVOID lpInfo) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleCursorMode(HANDLE hConsole, BOOL Unknown1, BOOL Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleLocalEUDC(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3, DWORD Unknown4) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleNlsMode(HANDLE hConsole, DWORD dwMode) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleOS2OemFormat(BOOL bUnknown) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -UnregisterConsoleIME(VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseCheckRunApp(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4, - IN DWORD Unknown5, - IN DWORD Unknown6, - IN DWORD Unknown7, - IN DWORD Unknown8, - IN DWORD Unknown9, - IN DWORD Unknown10) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BasepCheckWinSaferRestrictions(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4, - IN DWORD Unknown5, - IN DWORD Unknown6) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -NumaVirtualQueryNode(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -ReOpenFile(IN HANDLE hOriginalFile, - IN DWORD dwDesiredAccess, - IN DWORD dwShareMode, - IN DWORD dwFlags) -{ - STUB; - return INVALID_HANDLE_VALUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLastConsoleEventActive(VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetConsoleCommandHistoryMode(IN DWORD dwMode) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLocalPrimaryComputerNameA(IN DWORD Unknown1, - IN DWORD Unknown2) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLocalPrimaryComputerNameW(IN DWORD Unknown1, - IN DWORD Unknown2) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -VOID -WINAPI -SetTermsrvAppInstallMode(IN BOOL bInstallMode) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -TermsrvAppInstallMode(VOID) -{ - STUB; - return FALSE; -} Removed: trunk/reactos/dll/win32/kernel32/wine/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/wine/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/wine/time.c (removed) @@ -1,814 +1,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/misc/time.c - * PURPOSE: Time conversion functions - * PROGRAMMER: Ariadne - * DOSDATE and DOSTIME structures from Onno Hovers - * UPDATE HISTORY: - * Created 19/01/99 - */ - -/* INCLUDES ******************************************************************/ - -#include <k32.h> - -#define NDEBUG -#include <debug.h> - -/* TYPES *********************************************************************/ - -typedef struct __DOSTIME -{ - WORD Second:5; - WORD Minute:6; - WORD Hour:5; -} DOSTIME, *PDOSTIME; - -typedef struct __DOSDATE -{ - WORD Day:5; - WORD Month:4; - WORD Year:5; -} 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_TimeZoneID - * - * Calculates whether daylight savings is on now. - * - * PARAMS - * pTzi [in] Timezone info. - * - * 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_ZoneID( const TIME_ZONE_INFORMATION *pTzi ) -{ - FILETIME ftTime; - GetSystemTimeAsFileTime( &ftTime); - return TIME_CompTimeZoneID( pTzi, &ftTime, FALSE); -} - -/*********************************************************************** - * 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 ****************************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToDosDateTime(CONST FILETIME *lpFileTime, - LPWORD lpFatDate, - LPWORD lpFatTime) -{ - PDOSTIME pdtime=(PDOSTIME) lpFatTime; - PDOSDATE pddate=(PDOSDATE) lpFatDate; - SYSTEMTIME SystemTime = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - if (lpFileTime == NULL) - return FALSE; - - if (lpFatDate == NULL) - return FALSE; - - if (lpFatTime == NULL) - return FALSE; - - FileTimeToSystemTime(lpFileTime, &SystemTime); - - pdtime->Second = SystemTime.wSecond / 2; - pdtime->Minute = SystemTime.wMinute; - pdtime->Hour = SystemTime.wHour; - - pddate->Day = SystemTime.wDay; - pddate->Month = SystemTime.wMonth; - pddate->Year = SystemTime.wYear - 1980; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -DosDateTimeToFileTime(WORD wFatDate, - WORD wFatTime, - LPFILETIME lpFileTime) -{ - PDOSTIME pdtime = (PDOSTIME) &wFatTime; - PDOSDATE pddate = (PDOSDATE) &wFatDate; - SYSTEMTIME SystemTime; - - if (lpFileTime == NULL) - return FALSE; - - SystemTime.wMilliseconds = 0; - SystemTime.wSecond = pdtime->Second * 2; - SystemTime.wMinute = pdtime->Minute; - SystemTime.wHour = pdtime->Hour; - - SystemTime.wDay = pddate->Day; - SystemTime.wMonth = pddate->Month; - SystemTime.wYear = 1980 + pddate->Year; - - if (SystemTimeToFileTime(&SystemTime, lpFileTime) == FALSE) - { - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -LONG -WINAPI -CompareFileTime(CONST FILETIME *lpFileTime1, CONST FILETIME *lpFileTime2) -{ - if (lpFileTime1 == NULL) - return 0; - if (lpFileTime2 == NULL) - return 0; - - if (*((PLONGLONG)lpFileTime1) > *((PLONGLONG)lpFileTime2)) - return 1; - else if (*((PLONGLONG)lpFileTime1) < *((PLONGLONG)lpFileTime2)) - return -1; - - return 0; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetSystemTimeAsFileTime(PFILETIME lpFileTime) -{ - do - { - lpFileTime->dwHighDateTime = SharedUserData->SystemTime.High1Time; - lpFileTime->dwLowDateTime = SharedUserData->SystemTime.LowPart; - } - while (lpFileTime->dwHighDateTime != (DWORD)SharedUserData->SystemTime.High2Time); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) -{ - TIME_FIELDS TimeFields; - LARGE_INTEGER liTime; - - TimeFields.Year = lpSystemTime->wYear; - TimeFields.Month = lpSystemTime->wMonth; - TimeFields.Day = lpSystemTime->wDay; - TimeFields.Hour = lpSystemTime->wHour; - TimeFields.Minute = lpSystemTime->wMinute; - TimeFields.Second = lpSystemTime->wSecond; - TimeFields.Milliseconds = lpSystemTime->wMilliseconds; - - if (RtlTimeFieldsToTime (&TimeFields, &liTime)) - { - lpFileTime->dwLowDateTime = liTime.u.LowPart; - lpFileTime->dwHighDateTime = liTime.u.HighPart; - return TRUE; - } - - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) -{ - TIME_FIELDS TimeFields; - LARGE_INTEGER liTime; - - if (lpFileTime->dwHighDateTime & 0x80000000) - return FALSE; - - liTime.u.LowPart = lpFileTime->dwLowDateTime; - liTime.u.HighPart = lpFileTime->dwHighDateTime; - - RtlTimeToTimeFields(&liTime, &TimeFields); - - lpSystemTime->wYear = TimeFields.Year; - lpSystemTime->wMonth = TimeFields.Month; - lpSystemTime->wDay = TimeFields.Day; - lpSystemTime->wHour = TimeFields.Hour; - lpSystemTime->wMinute = TimeFields.Minute; - lpSystemTime->wSecond = TimeFields.Second; - lpSystemTime->wMilliseconds = TimeFields.Milliseconds; - lpSystemTime->wDayOfWeek = TimeFields.Weekday; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToLocalFileTime(CONST FILETIME *lpFileTime, LPFILETIME lpLocalFileTime) -{ - LARGE_INTEGER TimeZoneBias; - - do - { - TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; - TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; - } - while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); - - *((PLONGLONG)lpLocalFileTime) = *((PLONGLONG)lpFileTime) - TimeZoneBias.QuadPart; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -LocalFileTimeToFileTime(CONST FILETIME *lpLocalFileTime, LPFILETIME lpFileTime) -{ - LARGE_INTEGER TimeZoneBias; - - do - { - TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; - TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; - } - while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); - - *((PLONGLONG)lpFileTime) = *((PLONGLONG)lpLocalFileTime) + TimeZoneBias.QuadPart; - - return TRUE; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetLocalTime(LPSYSTEMTIME lpSystemTime) -{ - FILETIME FileTime; - FILETIME LocalFileTime; - - GetSystemTimeAsFileTime(&FileTime); - FileTimeToLocalFileTime(&FileTime, &LocalFileTime); - FileTimeToSystemTime(&LocalFileTime, lpSystemTime); -} - - -/* - * @implemented - */ -VOID -WINAPI -GetSystemTime(LPSYSTEMTIME lpSystemTime) -{ - FILETIME FileTime; - - GetSystemTimeAsFileTime(&FileTime); - FileTimeToSystemTime(&FileTime, lpSystemTime); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetLocalTime(CONST SYSTEMTIME *lpSystemTime) -{ - FILETIME LocalFileTime; - LARGE_INTEGER FileTime; - NTSTATUS Status; - - SystemTimeToFileTime(lpSystemTime, &LocalFileTime); - LocalFileTimeToFileTime(&LocalFileTime, (FILETIME *)&FileTime); - Status = NtSetSystemTime(&FileTime, &FileTime); - if (!NT_SUCCESS(Status)) - return FALSE; - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetSystemTime(CONST SYSTEMTIME *lpSystemTime) -{ - LARGE_INTEGER NewSystemTime; - NTSTATUS Status; - - SystemTimeToFileTime(lpSystemTime, (PFILETIME)&NewSystemTime); - Status = NtSetSystemTime(&NewSystemTime, &NewSystemTime); - if (!NT_SUCCESS(Status)) - return FALSE; - return TRUE; -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation) -{ - NTSTATUS Status; - - DPRINT("GetTimeZoneInformation()\n"); - - Status = NtQuerySystemInformation(SystemCurrentTimeZoneInformation, - lpTimeZoneInformation, - sizeof(TIME_ZONE_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return TIME_ZONE_ID_INVALID; - } - - return TIME_ZoneID(lpTimeZoneInformation); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) -{ - NTSTATUS Status; - - DPRINT("SetTimeZoneInformation()\n"); - - Status = RtlSetTimeZoneInformation((LPTIME_ZONE_INFORMATION)lpTimeZoneInformation); - if (!NT_SUCCESS(Status)) - { - DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)\n", Status); - SetLastErrorByStatus(Status); - return FALSE; - } - - Status = NtSetSystemInformation(SystemCurrentTimeZoneInformation, - (PVOID)lpTimeZoneInformation, - sizeof(TIME_ZONE_INFORMATION)); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtSetSystemInformation() failed (Status %lx)\n", Status); - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetTickCount(VOID) -{ - /* Call the 64-bit version */ - return (DWORD)GetTickCount64(); -} - - -/* - * @implemented - */ -ULONGLONG -WINAPI -GetTickCount64(VOID) -{ - ULONG Multiplier; - LARGE_INTEGER TickCount; - - /* Loop until we get a perfect match */ - for (;;) - { - /* Read the tick count value */ - TickCount.HighPart = SharedUserData->TickCount.High1Time; - TickCount.LowPart = SharedUserData->TickCount.LowPart; - if (TickCount.HighPart == SharedUserData->TickCount.High2Time) break; - YieldProcessor(); - } - - /* Get the multiplier */ - Multiplier = SharedUserData->TickCountMultiplier; - - /* Convert to milliseconds and return */ - return (Int64ShrlMod32(UInt32x32To64(Multiplier, TickCount.LowPart), 24) + - (Multiplier * (TickCount.HighPart << 8))); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SystemTimeToTzSpecificLocalTime(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation, - CONST SYSTEMTIME *lpUniversalTime, - LPSYSTEMTIME lpLocalTime) -{ - TIME_ZONE_INFORMATION TzInfo; - FILETIME FileTime; - LONGLONG llTime; - LONG lBias; - - if (lpTimeZoneInformation != NULL) - { - TzInfo = *lpTimeZoneInformation; - } - else - { - if (GetTimeZoneInformation(&TzInfo) == TIME_ZONE_ID_INVALID) - return FALSE; - } - - if (!lpUniversalTime || !lpLocalTime) - return FALSE; - - if (!SystemTimeToFileTime(lpUniversalTime, &FileTime)) - return FALSE; - - FILETIME2LL(&FileTime, llTime) - - if (!TIME_GetTimezoneBias(&TzInfo, &FileTime, FALSE, &lBias)) - return FALSE; - - /* convert minutes to 100-nanoseconds-ticks */ - llTime -= (LONGLONG)lBias * TICKSPERMIN; - - LL2FILETIME( llTime, &FileTime) - - return FileTimeToSystemTime(&FileTime, lpLocalTime); -} - - -/* - * @implemented (Wine 13 sep 2008) - */ -BOOL -WINAPI -TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, - LPSYSTEMTIME 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 -WINAPI -GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, - PDWORD lpTimeIncrement, - PBOOL lpTimeAdjustmentDisabled) -{ - SYSTEM_QUERY_TIME_ADJUST_INFORMATION Buffer; - NTSTATUS Status; - - Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation, - &Buffer, - sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - *lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment; - *lpTimeIncrement = (DWORD)Buffer.TimeIncrement; - *lpTimeAdjustmentDisabled = (BOOL)Buffer.Enable; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetSystemTimeAdjustment(DWORD dwTimeAdjustment, - BOOL bTimeAdjustmentDisabled) -{ - NTSTATUS Status; - SYSTEM_SET_TIME_ADJUST_INFORMATION Buffer; - - Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment; - Buffer.Enable = (BOOLEAN)bTimeAdjustmentDisabled; - - Status = NtSetSystemInformation(SystemTimeAdjustmentInformation, - &Buffer, - sizeof(SYSTEM_SET_TIME_ADJUST_INFORMATION)); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetSystemTimes(LPFILETIME lpIdleTime, - LPFILETIME lpKernelTime, - LPFILETIME lpUserTime) -{ - SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcPerfInfo; - NTSTATUS Status; - - Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation, - &SysProcPerfInfo, - sizeof(SysProcPerfInfo), - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } -/* - Good only for one processor system. - */ - - lpIdleTime->dwLowDateTime = SysProcPerfInfo.IdleTime.LowPart; - lpIdleTime->dwHighDateTime = SysProcPerfInfo.IdleTime.HighPart; - - lpKernelTime->dwLowDateTime = SysProcPerfInfo.KernelTime.LowPart; - lpKernelTime->dwHighDateTime = SysProcPerfInfo.KernelTime.HighPart; - - lpUserTime->dwLowDateTime = SysProcPerfInfo.UserTime.LowPart; - lpUserTime->dwHighDateTime = SysProcPerfInfo.UserTime.HighPart; - - return TRUE; -} - -/* EOF */ Removed: trunk/reactos/dll/win32/kernel32/wine/toolhelp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/wine/toolhelp.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/wine/toolhelp.c (removed) @@ -1,1310 +1,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: dll/win32/kernel32/misc/toolhelp.c - * PURPOSE: Toolhelp functions - * PROGRAMMER: Thomas Weidenmueller <w3seek(a)reactos.com> - * Robert Dickenson (robd(a)mok.lvcm.com) - * - * NOTES: Do NOT use the heap functions in here because they - * adulterate the heap statistics! - * - * UPDATE HISTORY: - * 10/30/2004 Implemented some parts (w3) - * Inspired by the book "Windows NT Native API" - * Created 05 January 2003 (robd) - */ - -#include <k32.h> - -#include <tlhelp32.h> - -#define NDEBUG -#include <debug.h> - -/* INTERNAL DEFINITIONS *******************************************************/ - -typedef struct _RTLP_HEAP_ENTRY -{ - ULONG Size; - USHORT Flags; - USHORT Unknown1; /* FIXME */ - ULONG Unknown2; /* FIXME */ - PVOID Address; -} RTLP_HEAP_ENTRY, *PRTLP_HEAP_ENTRY; - -#define CHECK_PARAM_SIZE(ptr, siz) \ - if((ptr) == NULL || (ptr)->dwSize != (siz)) \ - { \ - SetLastError(ERROR_INVALID_PARAMETER); \ - return FALSE; \ - } - -/* - * Tests in win showed that the dwSize field can be greater than the actual size - * of the structure for the ansi functions. I found this out by accidently - * forgetting to set the dwSize field in a test application and it just didn't - * work in ros but in win. - */ - -#define CHECK_PARAM_SIZEA(ptr, siz) \ - if((ptr) == NULL || (ptr)->dwSize < (siz)) \ - { \ - SetLastError(ERROR_INVALID_PARAMETER); \ - return FALSE; \ - } - -#define OffsetToPtr(Snapshot, Offset) \ - ((ULONG_PTR)((Snapshot) + 1) + (ULONG_PTR)(Offset)) - -typedef struct _TH32SNAPSHOT -{ - /* Heap list */ - ULONG HeapListCount; - ULONG HeapListIndex; - ULONG_PTR HeapListOffset; - /* Module list */ - ULONG ModuleListCount; - ULONG ModuleListIndex; - ULONG_PTR ModuleListOffset; - /* Process list */ - ULONG ProcessListCount; - ULONG ProcessListIndex; - ULONG_PTR ProcessListOffset; - /* Thread list */ - ULONG ThreadListCount; - ULONG ThreadListIndex; - ULONG_PTR ThreadListOffset; -} TH32SNAPSHOT, *PTH32SNAPSHOT; - -/* INTERNAL FUNCTIONS *********************************************************/ - -static VOID -TH32FreeAllocatedResources(PRTL_DEBUG_INFORMATION HeapDebug, - PRTL_DEBUG_INFORMATION ModuleDebug, - PVOID ProcThrdInfo, - SIZE_T ProcThrdInfoSize) -{ - if(HeapDebug != NULL) - { - RtlDestroyQueryDebugBuffer(HeapDebug); - } - if(ModuleDebug != NULL) - { - RtlDestroyQueryDebugBuffer(ModuleDebug); - } - - if(ProcThrdInfo != NULL) - { - NtFreeVirtualMemory(NtCurrentProcess(), - &ProcThrdInfo, - &ProcThrdInfoSize, - MEM_RELEASE); - } -} - -static NTSTATUS -TH32CreateSnapshot(DWORD dwFlags, - DWORD th32ProcessID, - PRTL_DEBUG_INFORMATION *HeapDebug, - PRTL_DEBUG_INFORMATION *ModuleDebug, - PVOID *ProcThrdInfo, - SIZE_T *ProcThrdInfoSize) -{ - NTSTATUS Status = STATUS_SUCCESS; - - *HeapDebug = NULL; - *ModuleDebug = NULL; - *ProcThrdInfo = NULL; - *ProcThrdInfoSize = 0; - - /* - * Allocate the debug information for a heap snapshot - */ - if(dwFlags & TH32CS_SNAPHEAPLIST) - { - *HeapDebug = RtlCreateQueryDebugBuffer(0, FALSE); - if(*HeapDebug != NULL) - { - Status = RtlQueryProcessDebugInformation(th32ProcessID, - RTL_DEBUG_QUERY_HEAPS, - *HeapDebug); - } - else - Status = STATUS_UNSUCCESSFUL; - } - - /* - * Allocate the debug information for a module snapshot - */ - if(dwFlags & TH32CS_SNAPMODULE && - NT_SUCCESS(Status)) - { - *ModuleDebug = RtlCreateQueryDebugBuffer(0, FALSE); - if(*ModuleDebug != NULL) - { - Status = RtlQueryProcessDebugInformation(th32ProcessID, - RTL_DEBUG_QUERY_MODULES, - *ModuleDebug); - } - else - Status = STATUS_UNSUCCESSFUL; - } - - /* - * Allocate enough memory for the system's process list - */ - - if(dwFlags & (TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD) && - NT_SUCCESS(Status)) - { - for(;;) - { - (*ProcThrdInfoSize) += 0x10000; - Status = NtAllocateVirtualMemory(NtCurrentProcess(), - ProcThrdInfo, - 0, - ProcThrdInfoSize, - MEM_COMMIT, - PAGE_READWRITE); - if(!NT_SUCCESS(Status)) - { - break; - } - - Status = NtQuerySystemInformation(SystemProcessInformation, - *ProcThrdInfo, - *ProcThrdInfoSize, - NULL); - if(Status == STATUS_INFO_LENGTH_MISMATCH) - { - NtFreeVirtualMemory(NtCurrentProcess(), - ProcThrdInfo, - ProcThrdInfoSize, - MEM_RELEASE); - *ProcThrdInfo = NULL; - } - else - { - break; - } - } - } - - /* - * Free resources in case of failure! - */ - - if(!NT_SUCCESS(Status)) - { - TH32FreeAllocatedResources(*HeapDebug, - *ModuleDebug, - *ProcThrdInfo, - *ProcThrdInfoSize); - } - - return Status; -} - -static NTSTATUS -TH32CreateSnapshotSectionInitialize(DWORD dwFlags, - DWORD th32ProcessID, - PRTL_DEBUG_INFORMATION HeapDebug, - PRTL_DEBUG_INFORMATION ModuleDebug, - PVOID ProcThrdInfo, - HANDLE *SectionHandle) -{ - PSYSTEM_PROCESS_INFORMATION ProcessInfo; - LPHEAPLIST32 HeapListEntry; - LPMODULEENTRY32W ModuleListEntry; - LPPROCESSENTRY32W ProcessListEntry; - LPTHREADENTRY32 ThreadListEntry; - OBJECT_ATTRIBUTES ObjectAttributes; - LARGE_INTEGER SSize, SOffset; - HANDLE hSection; - PTH32SNAPSHOT Snapshot; - ULONG_PTR DataOffset; - SIZE_T ViewSize; - ULONG i, nProcesses = 0, nThreads = 0, nHeaps = 0, nModules = 0; - ULONG RequiredSnapshotSize = sizeof(TH32SNAPSHOT); - PRTL_PROCESS_HEAPS hi = NULL; - PRTL_PROCESS_MODULES mi = NULL; - NTSTATUS Status = STATUS_SUCCESS; - - /* - * Determine the required size for the heap snapshot - */ - if(dwFlags & TH32CS_SNAPHEAPLIST) - { - hi = (PRTL_PROCESS_HEAPS)HeapDebug->Heaps; - nHeaps = hi->NumberOfHeaps; - RequiredSnapshotSize += nHeaps * sizeof(HEAPLIST32); - } - - /* - * Determine the required size for the module snapshot - */ - if(dwFlags & TH32CS_SNAPMODULE) - { - mi = (PRTL_PROCESS_MODULES)ModuleDebug->Modules; - nModules = mi->NumberOfModules; - RequiredSnapshotSize += nModules * sizeof(MODULEENTRY32W); - } - - /* - * Determine the required size for the processes and threads snapshot - */ - if(dwFlags & (TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD)) - { - ULONG ProcOffset = 0; - - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)ProcThrdInfo; - do - { - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)ProcessInfo + ProcOffset); - nProcesses++; - nThreads += ProcessInfo->NumberOfThreads; - ProcOffset = ProcessInfo->NextEntryOffset; - } while(ProcOffset != 0); - - if(dwFlags & TH32CS_SNAPPROCESS) - { - RequiredSnapshotSize += nProcesses * sizeof(PROCESSENTRY32W); - } - if(dwFlags & TH32CS_SNAPTHREAD) - { - RequiredSnapshotSize += nThreads * sizeof(THREADENTRY32); - } - } - - /* - * Create and map the section - */ - - SSize.QuadPart = RequiredSnapshotSize; - - InitializeObjectAttributes(&ObjectAttributes, - NULL, - ((dwFlags & TH32CS_INHERIT) ? OBJ_INHERIT : 0), - NULL, - NULL); - - Status = NtCreateSection(&hSection, - SECTION_ALL_ACCESS, - &ObjectAttributes, - &SSize, - PAGE_READWRITE, - SEC_COMMIT, - NULL); - if(!NT_SUCCESS(Status)) - { - return Status; - } - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSection, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(!NT_SUCCESS(Status)) - { - NtClose(hSection); - return Status; - } - - RtlZeroMemory(Snapshot, sizeof(TH32SNAPSHOT)); - DataOffset = 0; - - /* - * Initialize the section data and fill it with all the data we collected - */ - - /* initialize the heap list */ - if(dwFlags & TH32CS_SNAPHEAPLIST) - { - Snapshot->HeapListCount = nHeaps; - Snapshot->HeapListOffset = DataOffset; - HeapListEntry = (LPHEAPLIST32)OffsetToPtr(Snapshot, DataOffset); - for(i = 0; i < nHeaps; i++) - { - HeapListEntry->dwSize = sizeof(HEAPLIST32); - HeapListEntry->th32ProcessID = th32ProcessID; - HeapListEntry->th32HeapID = (ULONG_PTR)hi->Heaps[i].BaseAddress; - HeapListEntry->dwFlags = hi->Heaps[i].Flags; - - HeapListEntry++; - } - - DataOffset += hi->NumberOfHeaps * sizeof(HEAPLIST32); - } - - /* initialize the module list */ - if(dwFlags & TH32CS_SNAPMODULE) - { - Snapshot->ModuleListCount = nModules; - Snapshot->ModuleListOffset = DataOffset; - ModuleListEntry = (LPMODULEENTRY32W)OffsetToPtr(Snapshot, DataOffset); - for(i = 0; i < nModules; i++) - { - ModuleListEntry->dwSize = sizeof(MODULEENTRY32W); - ModuleListEntry->th32ModuleID = 1; /* no longer used, always set to one! */ - ModuleListEntry->th32ProcessID = th32ProcessID; - ModuleListEntry->GlblcntUsage = mi->Modules[i].LoadCount; - ModuleListEntry->ProccntUsage = mi->Modules[i].LoadCount; - ModuleListEntry->modBaseAddr = (BYTE*)mi->Modules[i].ImageBase; - ModuleListEntry->modBaseSize = mi->Modules[i].ImageSize; - ModuleListEntry->hModule = (HMODULE)mi->Modules[i].ImageBase; - - MultiByteToWideChar(CP_ACP, - 0, - &mi->Modules[i].FullPathName[mi->Modules[i].OffsetToFileName], - -1, - ModuleListEntry->szModule, - sizeof(ModuleListEntry->szModule) / sizeof(ModuleListEntry->szModule[0])); - - MultiByteToWideChar(CP_ACP, - 0, - mi->Modules[i].FullPathName, - -1, - ModuleListEntry->szExePath, - sizeof(ModuleListEntry->szExePath) / sizeof(ModuleListEntry->szExePath[0])); - - ModuleListEntry++; - } - - DataOffset += mi->NumberOfModules * sizeof(MODULEENTRY32W); - } - - /* initialize the process list */ - if(dwFlags & TH32CS_SNAPPROCESS) - { - ULONG ProcOffset = 0; - - Snapshot->ProcessListCount = nProcesses; - Snapshot->ProcessListOffset = DataOffset; - ProcessListEntry = (LPPROCESSENTRY32W)OffsetToPtr(Snapshot, DataOffset); - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)ProcThrdInfo; - do - { - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)ProcessInfo + ProcOffset); - - ProcessListEntry->dwSize = sizeof(PROCESSENTRY32W); - ProcessListEntry->cntUsage = 0; /* no longer used */ - ProcessListEntry->th32ProcessID = (ULONG_PTR)ProcessInfo->UniqueProcessId; - ProcessListEntry->th32DefaultHeapID = 0; /* no longer used */ - ProcessListEntry->th32ModuleID = 0; /* no longer used */ - ProcessListEntry->cntThreads = ProcessInfo->NumberOfThreads; - ProcessListEntry->th32ParentProcessID = (ULONG_PTR)ProcessInfo->InheritedFromUniqueProcessId; - ProcessListEntry->pcPriClassBase = ProcessInfo->BasePriority; - ProcessListEntry->dwFlags = 0; /* no longer used */ - if(ProcessInfo->ImageName.Buffer != NULL) - { - lstrcpynW(ProcessListEntry->szExeFile, - ProcessInfo->ImageName.Buffer, - min(ProcessInfo->ImageName.Length / sizeof(WCHAR), sizeof(ProcessListEntry->szExeFile) / sizeof(ProcessListEntry->szExeFile[0]))); - } - else - { - lstrcpyW(ProcessListEntry->szExeFile, L"[System Process]"); - } - - ProcessListEntry++; - - ProcOffset = ProcessInfo->NextEntryOffset; - } while(ProcOffset != 0); - - DataOffset += nProcesses * sizeof(PROCESSENTRY32W); - } - - /* initialize the thread list */ - if(dwFlags & TH32CS_SNAPTHREAD) - { - ULONG ProcOffset = 0; - - Snapshot->ThreadListCount = nThreads; - Snapshot->ThreadListOffset = DataOffset; - ThreadListEntry = (LPTHREADENTRY32)OffsetToPtr(Snapshot, DataOffset); - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)ProcThrdInfo; - do - { - PSYSTEM_THREAD_INFORMATION ThreadInfo; - ULONG n; - - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)ProcessInfo + ProcOffset); - ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(ProcessInfo + 1); - - for(n = 0; n < ProcessInfo->NumberOfThreads; n++) - { - ThreadListEntry->dwSize = sizeof(THREADENTRY32); - ThreadListEntry->cntUsage = 0; /* no longer used */ - ThreadListEntry->th32ThreadID = (ULONG_PTR)ThreadInfo->ClientId.UniqueThread; - ThreadListEntry->th32OwnerProcessID = (ULONG_PTR)ThreadInfo->ClientId.UniqueProcess; - ThreadListEntry->tpBasePri = ThreadInfo->BasePriority; - ThreadListEntry->tpDeltaPri = 0; /* no longer used */ - ThreadListEntry->dwFlags = 0; /* no longer used */ - - ThreadInfo++; - ThreadListEntry++; - } - - ProcOffset = ProcessInfo->NextEntryOffset; - } while(ProcOffset != 0); - } - - /* - * We're done, unmap the view and return the section handle - */ - - Status = NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - - if(NT_SUCCESS(Status)) - { - *SectionHandle = hSection; - } - else - { - NtClose(hSection); - } - - return Status; -} - -/* PUBLIC FUNCTIONS ***********************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -Heap32First(LPHEAPENTRY32 lphe, DWORD th32ProcessID, DWORD th32HeapID) -{ - PRTL_DEBUG_INFORMATION DebugInfo; - PRTL_HEAP_INFORMATION Heap; - PRTLP_HEAP_ENTRY Block, LastBlock; - ULONG i; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lphe, sizeof(HEAPENTRY32)); - - DebugInfo = RtlCreateQueryDebugBuffer(0, - FALSE); - if (DebugInfo == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - Status = RtlQueryProcessDebugInformation(th32ProcessID, - RTL_DEBUG_QUERY_HEAPS | RTL_DEBUG_QUERY_HEAP_BLOCKS, - DebugInfo); - - if (NT_SUCCESS(Status)) - { - Status = STATUS_NO_MORE_FILES; - - for (i = 0; - i != DebugInfo->Heaps->NumberOfHeaps; - i++) - { - Heap = &DebugInfo->Heaps->Heaps[i]; - - if ((ULONG_PTR)Heap->BaseAddress == th32HeapID) - { - lphe->hHandle = (HANDLE)Heap->BaseAddress; - lphe->dwAddress = 0; - lphe->dwBlockSize = 0; - lphe->dwFlags = 0; - lphe->dwLockCount = 0; - lphe->dwResvd = 0; - lphe->th32ProcessID = th32ProcessID; - lphe->th32HeapID = (ULONG_PTR)Heap->BaseAddress; - - Block = (PRTLP_HEAP_ENTRY)Heap->Entries; - LastBlock = Block + Heap->NumberOfEntries; - - while (Block != LastBlock && (Block->Flags & PROCESS_HEAP_UNCOMMITTED_RANGE)) - { - lphe->dwResvd++; - lphe->dwAddress = (ULONG_PTR)((ULONG_PTR)Block->Address + Heap->EntryOverhead); - Block++; - } - - if (Block != LastBlock && lphe->dwResvd != 0) - { - lphe->dwBlockSize = Block->Size; - - if (Block->Flags & 0x2F1) /* FIXME */ - lphe->dwFlags = LF32_FIXED; - else if (Block->Flags & 0x20) /* FIXME */ - lphe->dwFlags = LF32_MOVEABLE; - else if (Block->Flags & 0x100) /* FIXME */ - lphe->dwFlags = LF32_FREE; - - Status = STATUS_SUCCESS; - } - - break; - } - } - } - - RtlDestroyQueryDebugBuffer(DebugInfo); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Heap32Next(LPHEAPENTRY32 lphe) -{ - PRTL_DEBUG_INFORMATION DebugInfo; - PRTL_HEAP_INFORMATION Heap; - PRTLP_HEAP_ENTRY Block, LastBlock; - BOOLEAN FoundUncommitted = FALSE; - ULONG i; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lphe, sizeof(HEAPENTRY32)); - - DebugInfo = RtlCreateQueryDebugBuffer(0, - FALSE); - if (DebugInfo == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - Status = RtlQueryProcessDebugInformation(lphe->th32ProcessID, - RTL_DEBUG_QUERY_HEAPS | RTL_DEBUG_QUERY_HEAP_BLOCKS, - DebugInfo); - - if (NT_SUCCESS(Status)) - { - Status = STATUS_NO_MORE_FILES; - - for (i = 0; - i != DebugInfo->Heaps->NumberOfHeaps; - i++) - { - Heap = &DebugInfo->Heaps->Heaps[i]; - - if ((ULONG_PTR)Heap->BaseAddress == lphe->th32HeapID) - { - if (++lphe->dwResvd < Heap->NumberOfEntries) - { - lphe->dwFlags = 0; - - Block = (PRTLP_HEAP_ENTRY)Heap->Entries + lphe->dwResvd; - LastBlock = (PRTLP_HEAP_ENTRY)Heap->Entries + Heap->NumberOfEntries; - - while (Block < LastBlock && (Block->Flags & PROCESS_HEAP_UNCOMMITTED_RANGE)) - { - lphe->dwResvd++; - lphe->dwAddress = (ULONG_PTR)((ULONG_PTR)Block->Address + Heap->EntryOverhead); - FoundUncommitted = TRUE; - Block++; - } - - if (Block < LastBlock) - { - if (!FoundUncommitted) - lphe->dwAddress += lphe->dwBlockSize; - - lphe->dwBlockSize = Block->Size; - - if (Block->Flags & 0x2F1) /* FIXME */ - lphe->dwFlags = LF32_FIXED; - else if (Block->Flags & 0x20) /* FIXME */ - lphe->dwFlags = LF32_MOVEABLE; - else if (Block->Flags & 0x100) /* FIXME */ - lphe->dwFlags = LF32_FREE; - - Status = STATUS_SUCCESS; - } - } - - break; - } - } - } - - RtlDestroyQueryDebugBuffer(DebugInfo); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; - -} - - -/* - * @implemented - */ -BOOL -WINAPI -Heap32ListFirst(HANDLE hSnapshot, LPHEAPLIST32 lphl) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lphl, sizeof(HEAPLIST32)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->HeapListCount > 0) - { - LPHEAPLIST32 Entries = (LPHEAPLIST32)OffsetToPtr(Snapshot, Snapshot->HeapListOffset); - Snapshot->HeapListIndex = 1; - RtlCopyMemory(lphl, &Entries[0], sizeof(HEAPLIST32)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Heap32ListNext(HANDLE hSnapshot, LPHEAPLIST32 lphl) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lphl, sizeof(HEAPLIST32)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->HeapListCount > 0 && - Snapshot->HeapListIndex < Snapshot->HeapListCount) - { - LPHEAPLIST32 Entries = (LPHEAPLIST32)OffsetToPtr(Snapshot, Snapshot->HeapListOffset); - RtlCopyMemory(lphl, &Entries[Snapshot->HeapListIndex++], sizeof(HEAPLIST32)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Module32First(HANDLE hSnapshot, LPMODULEENTRY32 lpme) -{ - MODULEENTRY32W me; - BOOL Ret; - - CHECK_PARAM_SIZEA(lpme, sizeof(MODULEENTRY32)); - - me.dwSize = sizeof(MODULEENTRY32W); - - Ret = Module32FirstW(hSnapshot, &me); - if(Ret) - { - lpme->th32ModuleID = me.th32ModuleID; - lpme->th32ProcessID = me.th32ProcessID; - lpme->GlblcntUsage = me.GlblcntUsage; - lpme->ProccntUsage = me.ProccntUsage; - lpme->modBaseAddr = me.modBaseAddr; - lpme->modBaseSize = me.modBaseSize; - lpme->hModule = me.hModule; - - WideCharToMultiByte(CP_ACP, 0, me.szModule, -1, lpme->szModule, sizeof(lpme->szModule), 0, 0); - WideCharToMultiByte(CP_ACP, 0, me.szExePath, -1, lpme->szExePath, sizeof(lpme->szExePath), 0, 0); - } - - return Ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Module32FirstW(HANDLE hSnapshot, LPMODULEENTRY32W lpme) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lpme, sizeof(MODULEENTRY32W)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ModuleListCount > 0) - { - LPMODULEENTRY32W Entries = (LPMODULEENTRY32W)OffsetToPtr(Snapshot, Snapshot->ModuleListOffset); - Snapshot->ModuleListIndex = 1; - RtlCopyMemory(lpme, &Entries[0], sizeof(MODULEENTRY32W)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Module32Next(HANDLE hSnapshot, LPMODULEENTRY32 lpme) -{ - MODULEENTRY32W me; - BOOL Ret; - - CHECK_PARAM_SIZEA(lpme, sizeof(MODULEENTRY32)); - - me.dwSize = sizeof(MODULEENTRY32W); - - Ret = Module32NextW(hSnapshot, &me); - if(Ret) - { - lpme->th32ModuleID = me.th32ModuleID; - lpme->th32ProcessID = me.th32ProcessID; - lpme->GlblcntUsage = me.GlblcntUsage; - lpme->ProccntUsage = me.ProccntUsage; - lpme->modBaseAddr = me.modBaseAddr; - lpme->modBaseSize = me.modBaseSize; - lpme->hModule = me.hModule; - - WideCharToMultiByte(CP_ACP, 0, me.szModule, -1, lpme->szModule, sizeof(lpme->szModule), 0, 0); - WideCharToMultiByte(CP_ACP, 0, me.szExePath, -1, lpme->szExePath, sizeof(lpme->szExePath), 0, 0); - } - - return Ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Module32NextW(HANDLE hSnapshot, LPMODULEENTRY32W lpme) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lpme, sizeof(MODULEENTRY32W)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if((Snapshot->ModuleListCount > 0) && - (Snapshot->ModuleListIndex < Snapshot->ModuleListCount)) - { - LPMODULEENTRY32W Entries = (LPMODULEENTRY32W)OffsetToPtr(Snapshot, Snapshot->ModuleListOffset); - RtlCopyMemory(lpme, &Entries[Snapshot->ModuleListIndex++], sizeof(MODULEENTRY32W)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Process32First(HANDLE hSnapshot, LPPROCESSENTRY32 lppe) -{ - PROCESSENTRY32W pe; - BOOL Ret; - - CHECK_PARAM_SIZEA(lppe, sizeof(PROCESSENTRY32)); - - pe.dwSize = sizeof(PROCESSENTRY32W); - - Ret = Process32FirstW(hSnapshot, &pe); - if(Ret) - { - lppe->cntUsage = pe.cntUsage; - lppe->th32ProcessID = pe.th32ProcessID; - lppe->th32DefaultHeapID = pe.th32DefaultHeapID; - lppe->th32ModuleID = pe.th32ModuleID; - lppe->cntThreads = pe.cntThreads; - lppe->th32ParentProcessID = pe.th32ParentProcessID; - lppe->pcPriClassBase = pe.pcPriClassBase; - lppe->dwFlags = pe.dwFlags; - - WideCharToMultiByte(CP_ACP, 0, pe.szExeFile, -1, lppe->szExeFile, sizeof(lppe->szExeFile), 0, 0); - } - - return Ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Process32FirstW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lppe, sizeof(PROCESSENTRY32W)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ProcessListCount > 0) - { - LPPROCESSENTRY32W Entries = (LPPROCESSENTRY32W)OffsetToPtr(Snapshot, Snapshot->ProcessListOffset); - - Snapshot->ProcessListIndex = 1; - RtlCopyMemory(lppe, &Entries[0], sizeof(PROCESSENTRY32W)); - Ret = TRUE; - } - else - { - - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Process32Next(HANDLE hSnapshot, LPPROCESSENTRY32 lppe) -{ - PROCESSENTRY32W pe; - BOOL Ret; - - CHECK_PARAM_SIZEA(lppe, sizeof(PROCESSENTRY32)); - - pe.dwSize = sizeof(PROCESSENTRY32W); - - Ret = Process32NextW(hSnapshot, &pe); - if(Ret) - { - lppe->cntUsage = pe.cntUsage; - lppe->th32ProcessID = pe.th32ProcessID; - lppe->th32DefaultHeapID = pe.th32DefaultHeapID; - lppe->th32ModuleID = pe.th32ModuleID; - lppe->cntThreads = pe.cntThreads; - lppe->th32ParentProcessID = pe.th32ParentProcessID; - lppe->pcPriClassBase = pe.pcPriClassBase; - lppe->dwFlags = pe.dwFlags; - - WideCharToMultiByte(CP_ACP, 0, pe.szExeFile, -1, lppe->szExeFile, sizeof(lppe->szExeFile), 0, 0); - } - - return Ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Process32NextW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lppe, sizeof(PROCESSENTRY32W)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ProcessListCount > 0 && - Snapshot->ProcessListIndex < Snapshot->ProcessListCount) - { - LPPROCESSENTRY32W Entries = (LPPROCESSENTRY32W)OffsetToPtr(Snapshot, Snapshot->ProcessListOffset); - RtlCopyMemory(lppe, &Entries[Snapshot->ProcessListIndex++], sizeof(PROCESSENTRY32W)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Thread32First(HANDLE hSnapshot, LPTHREADENTRY32 lpte) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lpte, sizeof(THREADENTRY32)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ThreadListCount > 0) - { - LPTHREADENTRY32 Entries = (LPTHREADENTRY32)OffsetToPtr(Snapshot, Snapshot->ThreadListOffset); - Snapshot->ThreadListIndex = 1; - RtlCopyMemory(lpte, &Entries[0], sizeof(THREADENTRY32)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Thread32Next(HANDLE hSnapshot, LPTHREADENTRY32 lpte) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lpte, sizeof(THREADENTRY32)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ThreadListCount > 0 && - Snapshot->ThreadListIndex < Snapshot->ThreadListCount) - { - LPTHREADENTRY32 Entries = (LPTHREADENTRY32)OffsetToPtr(Snapshot, Snapshot->ThreadListOffset); - RtlCopyMemory(lpte, &Entries[Snapshot->ThreadListIndex++], sizeof(THREADENTRY32)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Toolhelp32ReadProcessMemory(DWORD th32ProcessID, LPCVOID lpBaseAddress, - LPVOID lpBuffer, SIZE_T cbRead, SIZE_T* lpNumberOfBytesRead) -{ - HANDLE hProcess = OpenProcess(PROCESS_VM_READ, FALSE, th32ProcessID); - if(hProcess != NULL) - { - BOOL Ret = ReadProcessMemory(hProcess, lpBaseAddress, lpBuffer, cbRead, lpNumberOfBytesRead); - CloseHandle(hProcess); - return Ret; - } - - return FALSE; -} - - -/* - * @implemented - */ -HANDLE -WINAPI -CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID) -{ - PRTL_DEBUG_INFORMATION HeapDebug, ModuleDebug; - PVOID ProcThrdInfo; - SIZE_T ProcThrdInfoSize; - NTSTATUS Status; - HANDLE hSnapShotSection = NULL; - - if(th32ProcessID == 0) - { - th32ProcessID = GetCurrentProcessId(); - } - - /* - * Get all information required for the snapshot - */ - Status = TH32CreateSnapshot(dwFlags, - th32ProcessID, - &HeapDebug, - &ModuleDebug, - &ProcThrdInfo, - &ProcThrdInfoSize); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - /* - * Create a section handle and initialize the collected information - */ - Status = TH32CreateSnapshotSectionInitialize(dwFlags, - th32ProcessID, - HeapDebug, - ModuleDebug, - ProcThrdInfo, - &hSnapShotSection); - - /* - * Free the temporarily allocated memory which is no longer needed - */ - TH32FreeAllocatedResources(HeapDebug, - ModuleDebug, - ProcThrdInfo, - ProcThrdInfoSize); - - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - return hSnapShotSection; -} - -/* EOF */
13 years, 5 months
1
0
0
0
[ion] 52772: NO CODE CHANGE [KERNEL32]: And at last, the final stroke. Move toolhelp.c into client, and split time.c into timezone.c (wineisms) and time.c (incorrect/buggy ntisms), which goes into ...
by ion@svn.reactos.org
Author: ion Date: Fri Jul 22 03:21:17 2011 New Revision: 52772 URL:
http://svn.reactos.org/svn/reactos?rev=52772&view=rev
Log: NO CODE CHANGE [KERNEL32]: And at last, the final stroke. Move toolhelp.c into client, and split time.c into timezone.c (wineisms) and time.c (incorrect/buggy ntisms), which goes into client. Now "misc" truly only contains Wine-code (along with winnls), and the true NT base API that needs to be focused on is in "client". Added: trunk/reactos/dll/win32/kernel32/client/misc/timezone.c - copied, changed from r52770, trunk/reactos/dll/win32/kernel32/client/misc/time.c trunk/reactos/dll/win32/kernel32/client/time.c (with props) trunk/reactos/dll/win32/kernel32/client/toolhelp.c - copied unchanged from r52758, trunk/reactos/dll/win32/kernel32/client/misc/toolhelp.c Removed: trunk/reactos/dll/win32/kernel32/client/misc/time.c trunk/reactos/dll/win32/kernel32/client/misc/toolhelp.c Modified: trunk/reactos/dll/win32/kernel32/CMakeLists.txt trunk/reactos/dll/win32/kernel32/kernel32.rbuild Modified: trunk/reactos/dll/win32/kernel32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] Fri Jul 22 03:21:17 2011 @@ -27,7 +27,9 @@ client/session.c client/synch.c client/sysinfo.c + client/time.c client/timerqueue.c + client/toolhelp.c client/utils.c client/thread.c client/vdm.c @@ -65,8 +67,7 @@ client/misc/muldiv.c client/misc/profile.c client/misc/res.c - client/misc/time.c - client/misc/toolhelp.c + client/misc/timezone.c winnls/string/casemap.c winnls/string/chartype.c winnls/string/collation.c Removed: trunk/reactos/dll/win32/kernel32/client/misc/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/misc/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/misc/time.c (removed) @@ -1,810 +1,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/misc/time.c - * PURPOSE: Time conversion functions - * PROGRAMMER: Ariadne - * DOSDATE and DOSTIME structures from Onno Hovers - * UPDATE HISTORY: - * Created 19/01/99 - */ - -/* INCLUDES ******************************************************************/ - -#include <k32.h> - -#define NDEBUG -#include <debug.h> - -/* TYPES *********************************************************************/ - -typedef struct __DOSTIME -{ - WORD Second:5; - WORD Minute:6; - WORD Hour:5; -} DOSTIME, *PDOSTIME; - -typedef struct __DOSDATE -{ - WORD Day:5; - WORD Month:4; - WORD Year:5; -} 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_TimeZoneID - * - * Calculates whether daylight savings is on now. - * - * PARAMS - * pTzi [in] Timezone info. - * - * 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_ZoneID( const TIME_ZONE_INFORMATION *pTzi ) -{ - FILETIME ftTime; - GetSystemTimeAsFileTime( &ftTime); - return TIME_CompTimeZoneID( pTzi, &ftTime, FALSE); -} - -/*********************************************************************** - * 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 ****************************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToDosDateTime(CONST FILETIME *lpFileTime, - LPWORD lpFatDate, - LPWORD lpFatTime) -{ - PDOSTIME pdtime=(PDOSTIME) lpFatTime; - PDOSDATE pddate=(PDOSDATE) lpFatDate; - SYSTEMTIME SystemTime = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - if (lpFileTime == NULL) - return FALSE; - - if (lpFatDate == NULL) - return FALSE; - - if (lpFatTime == NULL) - return FALSE; - - FileTimeToSystemTime(lpFileTime, &SystemTime); - - pdtime->Second = SystemTime.wSecond / 2; - pdtime->Minute = SystemTime.wMinute; - pdtime->Hour = SystemTime.wHour; - - pddate->Day = SystemTime.wDay; - pddate->Month = SystemTime.wMonth; - pddate->Year = SystemTime.wYear - 1980; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -DosDateTimeToFileTime(WORD wFatDate, - WORD wFatTime, - LPFILETIME lpFileTime) -{ - PDOSTIME pdtime = (PDOSTIME) &wFatTime; - PDOSDATE pddate = (PDOSDATE) &wFatDate; - SYSTEMTIME SystemTime; - - if (lpFileTime == NULL) - return FALSE; - - SystemTime.wMilliseconds = 0; - SystemTime.wSecond = pdtime->Second * 2; - SystemTime.wMinute = pdtime->Minute; - SystemTime.wHour = pdtime->Hour; - - SystemTime.wDay = pddate->Day; - SystemTime.wMonth = pddate->Month; - SystemTime.wYear = 1980 + pddate->Year; - - if (SystemTimeToFileTime(&SystemTime, lpFileTime) == FALSE) - { - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -LONG -WINAPI -CompareFileTime(CONST FILETIME *lpFileTime1, CONST FILETIME *lpFileTime2) -{ - if (lpFileTime1 == NULL) - return 0; - if (lpFileTime2 == NULL) - return 0; - - if (*((PLONGLONG)lpFileTime1) > *((PLONGLONG)lpFileTime2)) - return 1; - else if (*((PLONGLONG)lpFileTime1) < *((PLONGLONG)lpFileTime2)) - return -1; - - return 0; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetSystemTimeAsFileTime(PFILETIME lpFileTime) -{ - do - { - lpFileTime->dwHighDateTime = SharedUserData->SystemTime.High1Time; - lpFileTime->dwLowDateTime = SharedUserData->SystemTime.LowPart; - } - while (lpFileTime->dwHighDateTime != (DWORD)SharedUserData->SystemTime.High2Time); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) -{ - TIME_FIELDS TimeFields; - LARGE_INTEGER liTime; - - TimeFields.Year = lpSystemTime->wYear; - TimeFields.Month = lpSystemTime->wMonth; - TimeFields.Day = lpSystemTime->wDay; - TimeFields.Hour = lpSystemTime->wHour; - TimeFields.Minute = lpSystemTime->wMinute; - TimeFields.Second = lpSystemTime->wSecond; - TimeFields.Milliseconds = lpSystemTime->wMilliseconds; - - if (RtlTimeFieldsToTime (&TimeFields, &liTime)) - { - lpFileTime->dwLowDateTime = liTime.u.LowPart; - lpFileTime->dwHighDateTime = liTime.u.HighPart; - return TRUE; - } - - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) -{ - TIME_FIELDS TimeFields; - LARGE_INTEGER liTime; - - if (lpFileTime->dwHighDateTime & 0x80000000) - return FALSE; - - liTime.u.LowPart = lpFileTime->dwLowDateTime; - liTime.u.HighPart = lpFileTime->dwHighDateTime; - - RtlTimeToTimeFields(&liTime, &TimeFields); - - lpSystemTime->wYear = TimeFields.Year; - lpSystemTime->wMonth = TimeFields.Month; - lpSystemTime->wDay = TimeFields.Day; - lpSystemTime->wHour = TimeFields.Hour; - lpSystemTime->wMinute = TimeFields.Minute; - lpSystemTime->wSecond = TimeFields.Second; - lpSystemTime->wMilliseconds = TimeFields.Milliseconds; - lpSystemTime->wDayOfWeek = TimeFields.Weekday; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToLocalFileTime(CONST FILETIME *lpFileTime, LPFILETIME lpLocalFileTime) -{ - LARGE_INTEGER TimeZoneBias; - - do - { - TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; - TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; - } - while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); - - *((PLONGLONG)lpLocalFileTime) = *((PLONGLONG)lpFileTime) - TimeZoneBias.QuadPart; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -LocalFileTimeToFileTime(CONST FILETIME *lpLocalFileTime, LPFILETIME lpFileTime) -{ - LARGE_INTEGER TimeZoneBias; - - do - { - TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; - TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; - } - while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); - - *((PLONGLONG)lpFileTime) = *((PLONGLONG)lpLocalFileTime) + TimeZoneBias.QuadPart; - - return TRUE; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetLocalTime(LPSYSTEMTIME lpSystemTime) -{ - FILETIME FileTime; - FILETIME LocalFileTime; - - GetSystemTimeAsFileTime(&FileTime); - FileTimeToLocalFileTime(&FileTime, &LocalFileTime); - FileTimeToSystemTime(&LocalFileTime, lpSystemTime); -} - - -/* - * @implemented - */ -VOID -WINAPI -GetSystemTime(LPSYSTEMTIME lpSystemTime) -{ - FILETIME FileTime; - - GetSystemTimeAsFileTime(&FileTime); - FileTimeToSystemTime(&FileTime, lpSystemTime); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetLocalTime(CONST SYSTEMTIME *lpSystemTime) -{ - FILETIME LocalFileTime; - LARGE_INTEGER FileTime; - NTSTATUS Status; - - SystemTimeToFileTime(lpSystemTime, &LocalFileTime); - LocalFileTimeToFileTime(&LocalFileTime, (FILETIME *)&FileTime); - Status = NtSetSystemTime(&FileTime, &FileTime); - if (!NT_SUCCESS(Status)) - return FALSE; - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetSystemTime(CONST SYSTEMTIME *lpSystemTime) -{ - LARGE_INTEGER NewSystemTime; - NTSTATUS Status; - - SystemTimeToFileTime(lpSystemTime, (PFILETIME)&NewSystemTime); - Status = NtSetSystemTime(&NewSystemTime, &NewSystemTime); - if (!NT_SUCCESS(Status)) - return FALSE; - return TRUE; -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation) -{ - NTSTATUS Status; - - DPRINT("GetTimeZoneInformation()\n"); - - Status = NtQuerySystemInformation(SystemCurrentTimeZoneInformation, - lpTimeZoneInformation, - sizeof(TIME_ZONE_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return TIME_ZONE_ID_INVALID; - } - - return TIME_ZoneID(lpTimeZoneInformation); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) -{ - NTSTATUS Status; - - DPRINT("SetTimeZoneInformation()\n"); - - Status = RtlSetTimeZoneInformation((LPTIME_ZONE_INFORMATION)lpTimeZoneInformation); - if (!NT_SUCCESS(Status)) - { - DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)\n", Status); - SetLastErrorByStatus(Status); - return FALSE; - } - - Status = NtSetSystemInformation(SystemCurrentTimeZoneInformation, - (PVOID)lpTimeZoneInformation, - sizeof(TIME_ZONE_INFORMATION)); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtSetSystemInformation() failed (Status %lx)\n", Status); - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetTickCount(VOID) -{ - ULARGE_INTEGER TickCount; - - while (TRUE) - { - TickCount.HighPart = (ULONG)SharedUserData->TickCount.High1Time; - TickCount.LowPart = SharedUserData->TickCount.LowPart; - - if (TickCount.HighPart == (ULONG)SharedUserData->TickCount.High2Time) - break; - - YieldProcessor(); - } - - return (ULONG)((UInt32x32To64(TickCount.LowPart, SharedUserData->TickCountMultiplier) >> 24) + - UInt32x32To64((TickCount.HighPart << 8) & 0xFFFFFFFF, SharedUserData->TickCountMultiplier)); - -} - -/* - * @implemented - */ -BOOL -WINAPI -SystemTimeToTzSpecificLocalTime(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation, - CONST SYSTEMTIME *lpUniversalTime, - LPSYSTEMTIME lpLocalTime) -{ - TIME_ZONE_INFORMATION TzInfo; - FILETIME FileTime; - LONGLONG llTime; - LONG lBias; - - if (lpTimeZoneInformation != NULL) - { - TzInfo = *lpTimeZoneInformation; - } - else - { - if (GetTimeZoneInformation(&TzInfo) == TIME_ZONE_ID_INVALID) - return FALSE; - } - - if (!lpUniversalTime || !lpLocalTime) - return FALSE; - - if (!SystemTimeToFileTime(lpUniversalTime, &FileTime)) - return FALSE; - - FILETIME2LL(&FileTime, llTime) - - if (!TIME_GetTimezoneBias(&TzInfo, &FileTime, FALSE, &lBias)) - return FALSE; - - /* convert minutes to 100-nanoseconds-ticks */ - llTime -= (LONGLONG)lBias * TICKSPERMIN; - - LL2FILETIME( llTime, &FileTime) - - return FileTimeToSystemTime(&FileTime, lpLocalTime); -} - - -/* - * @implemented (Wine 13 sep 2008) - */ -BOOL -WINAPI -TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, - LPSYSTEMTIME 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 -WINAPI -GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, - PDWORD lpTimeIncrement, - PBOOL lpTimeAdjustmentDisabled) -{ - SYSTEM_QUERY_TIME_ADJUST_INFORMATION Buffer; - NTSTATUS Status; - - Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation, - &Buffer, - sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - *lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment; - *lpTimeIncrement = (DWORD)Buffer.TimeIncrement; - *lpTimeAdjustmentDisabled = (BOOL)Buffer.Enable; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetSystemTimeAdjustment(DWORD dwTimeAdjustment, - BOOL bTimeAdjustmentDisabled) -{ - NTSTATUS Status; - SYSTEM_SET_TIME_ADJUST_INFORMATION Buffer; - - Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment; - Buffer.Enable = (BOOLEAN)bTimeAdjustmentDisabled; - - Status = NtSetSystemInformation(SystemTimeAdjustmentInformation, - &Buffer, - sizeof(SYSTEM_SET_TIME_ADJUST_INFORMATION)); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetSystemTimes(LPFILETIME lpIdleTime, - LPFILETIME lpKernelTime, - LPFILETIME lpUserTime) -{ - SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcPerfInfo; - NTSTATUS Status; - - Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation, - &SysProcPerfInfo, - sizeof(SysProcPerfInfo), - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } -/* - Good only for one processor system. - */ - - lpIdleTime->dwLowDateTime = SysProcPerfInfo.IdleTime.LowPart; - lpIdleTime->dwHighDateTime = SysProcPerfInfo.IdleTime.HighPart; - - lpKernelTime->dwLowDateTime = SysProcPerfInfo.KernelTime.LowPart; - lpKernelTime->dwHighDateTime = SysProcPerfInfo.KernelTime.HighPart; - - lpUserTime->dwLowDateTime = SysProcPerfInfo.UserTime.LowPart; - lpUserTime->dwHighDateTime = SysProcPerfInfo.UserTime.HighPart; - - return TRUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetClientTimeZoneInformation( - CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) -{ - STUB; - return 0; -} - -/* EOF */ Copied: trunk/reactos/dll/win32/kernel32/client/misc/timezone.c (from r52770, trunk/reactos/dll/win32/kernel32/client/misc/time.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/misc/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/misc/timezone.c [iso-8859-1] Fri Jul 22 03:21:17 2011 @@ -18,20 +18,6 @@ #include <debug.h> /* TYPES *********************************************************************/ - -typedef struct __DOSTIME -{ - WORD Second:5; - WORD Minute:6; - WORD Hour:5; -} DOSTIME, *PDOSTIME; - -typedef struct __DOSDATE -{ - WORD Day:5; - WORD Month:4; - WORD Year:5; -} DOSDATE, *PDOSDATE; #define TICKSPERMIN 600000000 @@ -260,286 +246,6 @@ /* * @implemented */ -BOOL -WINAPI -FileTimeToDosDateTime(CONST FILETIME *lpFileTime, - LPWORD lpFatDate, - LPWORD lpFatTime) -{ - PDOSTIME pdtime=(PDOSTIME) lpFatTime; - PDOSDATE pddate=(PDOSDATE) lpFatDate; - SYSTEMTIME SystemTime = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - if (lpFileTime == NULL) - return FALSE; - - if (lpFatDate == NULL) - return FALSE; - - if (lpFatTime == NULL) - return FALSE; - - FileTimeToSystemTime(lpFileTime, &SystemTime); - - pdtime->Second = SystemTime.wSecond / 2; - pdtime->Minute = SystemTime.wMinute; - pdtime->Hour = SystemTime.wHour; - - pddate->Day = SystemTime.wDay; - pddate->Month = SystemTime.wMonth; - pddate->Year = SystemTime.wYear - 1980; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -DosDateTimeToFileTime(WORD wFatDate, - WORD wFatTime, - LPFILETIME lpFileTime) -{ - PDOSTIME pdtime = (PDOSTIME) &wFatTime; - PDOSDATE pddate = (PDOSDATE) &wFatDate; - SYSTEMTIME SystemTime; - - if (lpFileTime == NULL) - return FALSE; - - SystemTime.wMilliseconds = 0; - SystemTime.wSecond = pdtime->Second * 2; - SystemTime.wMinute = pdtime->Minute; - SystemTime.wHour = pdtime->Hour; - - SystemTime.wDay = pddate->Day; - SystemTime.wMonth = pddate->Month; - SystemTime.wYear = 1980 + pddate->Year; - - if (SystemTimeToFileTime(&SystemTime, lpFileTime) == FALSE) - { - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -LONG -WINAPI -CompareFileTime(CONST FILETIME *lpFileTime1, CONST FILETIME *lpFileTime2) -{ - if (lpFileTime1 == NULL) - return 0; - if (lpFileTime2 == NULL) - return 0; - - if (*((PLONGLONG)lpFileTime1) > *((PLONGLONG)lpFileTime2)) - return 1; - else if (*((PLONGLONG)lpFileTime1) < *((PLONGLONG)lpFileTime2)) - return -1; - - return 0; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetSystemTimeAsFileTime(PFILETIME lpFileTime) -{ - do - { - lpFileTime->dwHighDateTime = SharedUserData->SystemTime.High1Time; - lpFileTime->dwLowDateTime = SharedUserData->SystemTime.LowPart; - } - while (lpFileTime->dwHighDateTime != (DWORD)SharedUserData->SystemTime.High2Time); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) -{ - TIME_FIELDS TimeFields; - LARGE_INTEGER liTime; - - TimeFields.Year = lpSystemTime->wYear; - TimeFields.Month = lpSystemTime->wMonth; - TimeFields.Day = lpSystemTime->wDay; - TimeFields.Hour = lpSystemTime->wHour; - TimeFields.Minute = lpSystemTime->wMinute; - TimeFields.Second = lpSystemTime->wSecond; - TimeFields.Milliseconds = lpSystemTime->wMilliseconds; - - if (RtlTimeFieldsToTime (&TimeFields, &liTime)) - { - lpFileTime->dwLowDateTime = liTime.u.LowPart; - lpFileTime->dwHighDateTime = liTime.u.HighPart; - return TRUE; - } - - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) -{ - TIME_FIELDS TimeFields; - LARGE_INTEGER liTime; - - if (lpFileTime->dwHighDateTime & 0x80000000) - return FALSE; - - liTime.u.LowPart = lpFileTime->dwLowDateTime; - liTime.u.HighPart = lpFileTime->dwHighDateTime; - - RtlTimeToTimeFields(&liTime, &TimeFields); - - lpSystemTime->wYear = TimeFields.Year; - lpSystemTime->wMonth = TimeFields.Month; - lpSystemTime->wDay = TimeFields.Day; - lpSystemTime->wHour = TimeFields.Hour; - lpSystemTime->wMinute = TimeFields.Minute; - lpSystemTime->wSecond = TimeFields.Second; - lpSystemTime->wMilliseconds = TimeFields.Milliseconds; - lpSystemTime->wDayOfWeek = TimeFields.Weekday; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToLocalFileTime(CONST FILETIME *lpFileTime, LPFILETIME lpLocalFileTime) -{ - LARGE_INTEGER TimeZoneBias; - - do - { - TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; - TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; - } - while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); - - *((PLONGLONG)lpLocalFileTime) = *((PLONGLONG)lpFileTime) - TimeZoneBias.QuadPart; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -LocalFileTimeToFileTime(CONST FILETIME *lpLocalFileTime, LPFILETIME lpFileTime) -{ - LARGE_INTEGER TimeZoneBias; - - do - { - TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; - TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; - } - while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); - - *((PLONGLONG)lpFileTime) = *((PLONGLONG)lpLocalFileTime) + TimeZoneBias.QuadPart; - - return TRUE; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetLocalTime(LPSYSTEMTIME lpSystemTime) -{ - FILETIME FileTime; - FILETIME LocalFileTime; - - GetSystemTimeAsFileTime(&FileTime); - FileTimeToLocalFileTime(&FileTime, &LocalFileTime); - FileTimeToSystemTime(&LocalFileTime, lpSystemTime); -} - - -/* - * @implemented - */ -VOID -WINAPI -GetSystemTime(LPSYSTEMTIME lpSystemTime) -{ - FILETIME FileTime; - - GetSystemTimeAsFileTime(&FileTime); - FileTimeToSystemTime(&FileTime, lpSystemTime); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetLocalTime(CONST SYSTEMTIME *lpSystemTime) -{ - FILETIME LocalFileTime; - LARGE_INTEGER FileTime; - NTSTATUS Status; - - SystemTimeToFileTime(lpSystemTime, &LocalFileTime); - LocalFileTimeToFileTime(&LocalFileTime, (FILETIME *)&FileTime); - Status = NtSetSystemTime(&FileTime, &FileTime); - if (!NT_SUCCESS(Status)) - return FALSE; - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetSystemTime(CONST SYSTEMTIME *lpSystemTime) -{ - LARGE_INTEGER NewSystemTime; - NTSTATUS Status; - - SystemTimeToFileTime(lpSystemTime, (PFILETIME)&NewSystemTime); - Status = NtSetSystemTime(&NewSystemTime, &NewSystemTime); - if (!NT_SUCCESS(Status)) - return FALSE; - return TRUE; -} - - -/* - * @implemented - */ DWORD WINAPI GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation) @@ -594,32 +300,6 @@ return TRUE; } - -/* - * @implemented - */ -DWORD -WINAPI -GetTickCount(VOID) -{ - ULARGE_INTEGER TickCount; - - while (TRUE) - { - TickCount.HighPart = (ULONG)SharedUserData->TickCount.High1Time; - TickCount.LowPart = SharedUserData->TickCount.LowPart; - - if (TickCount.HighPart == (ULONG)SharedUserData->TickCount.High2Time) - break; - - YieldProcessor(); - } - - return (ULONG)((UInt32x32To64(TickCount.LowPart, SharedUserData->TickCountMultiplier) >> 24) + - UInt32x32To64((TickCount.HighPart << 8) & 0xFFFFFFFF, SharedUserData->TickCountMultiplier)); - -} - /* * @implemented */ @@ -699,112 +379,4 @@ return FileTimeToSystemTime(&ft, lpUniversalTime); } - -/* - * @implemented - */ -BOOL -WINAPI -GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, - PDWORD lpTimeIncrement, - PBOOL lpTimeAdjustmentDisabled) -{ - SYSTEM_QUERY_TIME_ADJUST_INFORMATION Buffer; - NTSTATUS Status; - - Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation, - &Buffer, - sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - *lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment; - *lpTimeIncrement = (DWORD)Buffer.TimeIncrement; - *lpTimeAdjustmentDisabled = (BOOL)Buffer.Enable; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetSystemTimeAdjustment(DWORD dwTimeAdjustment, - BOOL bTimeAdjustmentDisabled) -{ - NTSTATUS Status; - SYSTEM_SET_TIME_ADJUST_INFORMATION Buffer; - - Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment; - Buffer.Enable = (BOOLEAN)bTimeAdjustmentDisabled; - - Status = NtSetSystemInformation(SystemTimeAdjustmentInformation, - &Buffer, - sizeof(SYSTEM_SET_TIME_ADJUST_INFORMATION)); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetSystemTimes(LPFILETIME lpIdleTime, - LPFILETIME lpKernelTime, - LPFILETIME lpUserTime) -{ - SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcPerfInfo; - NTSTATUS Status; - - Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation, - &SysProcPerfInfo, - sizeof(SysProcPerfInfo), - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } -/* - Good only for one processor system. - */ - - lpIdleTime->dwLowDateTime = SysProcPerfInfo.IdleTime.LowPart; - lpIdleTime->dwHighDateTime = SysProcPerfInfo.IdleTime.HighPart; - - lpKernelTime->dwLowDateTime = SysProcPerfInfo.KernelTime.LowPart; - lpKernelTime->dwHighDateTime = SysProcPerfInfo.KernelTime.HighPart; - - lpUserTime->dwLowDateTime = SysProcPerfInfo.UserTime.LowPart; - lpUserTime->dwHighDateTime = SysProcPerfInfo.UserTime.HighPart; - - return TRUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetClientTimeZoneInformation( - CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) -{ - STUB; - return 0; -} - /* EOF */ Removed: trunk/reactos/dll/win32/kernel32/client/misc/toolhelp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/misc/toolhelp.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/misc/toolhelp.c (removed) @@ -1,1310 +1,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: dll/win32/kernel32/misc/toolhelp.c - * PURPOSE: Toolhelp functions - * PROGRAMMER: Thomas Weidenmueller <w3seek(a)reactos.com> - * Robert Dickenson (robd(a)mok.lvcm.com) - * - * NOTES: Do NOT use the heap functions in here because they - * adulterate the heap statistics! - * - * UPDATE HISTORY: - * 10/30/2004 Implemented some parts (w3) - * Inspired by the book "Windows NT Native API" - * Created 05 January 2003 (robd) - */ - -#include <k32.h> - -#include <tlhelp32.h> - -#define NDEBUG -#include <debug.h> - -/* INTERNAL DEFINITIONS *******************************************************/ - -typedef struct _RTLP_HEAP_ENTRY -{ - ULONG Size; - USHORT Flags; - USHORT Unknown1; /* FIXME */ - ULONG Unknown2; /* FIXME */ - PVOID Address; -} RTLP_HEAP_ENTRY, *PRTLP_HEAP_ENTRY; - -#define CHECK_PARAM_SIZE(ptr, siz) \ - if((ptr) == NULL || (ptr)->dwSize != (siz)) \ - { \ - SetLastError(ERROR_INVALID_PARAMETER); \ - return FALSE; \ - } - -/* - * Tests in win showed that the dwSize field can be greater than the actual size - * of the structure for the ansi functions. I found this out by accidently - * forgetting to set the dwSize field in a test application and it just didn't - * work in ros but in win. - */ - -#define CHECK_PARAM_SIZEA(ptr, siz) \ - if((ptr) == NULL || (ptr)->dwSize < (siz)) \ - { \ - SetLastError(ERROR_INVALID_PARAMETER); \ - return FALSE; \ - } - -#define OffsetToPtr(Snapshot, Offset) \ - ((ULONG_PTR)((Snapshot) + 1) + (ULONG_PTR)(Offset)) - -typedef struct _TH32SNAPSHOT -{ - /* Heap list */ - ULONG HeapListCount; - ULONG HeapListIndex; - ULONG_PTR HeapListOffset; - /* Module list */ - ULONG ModuleListCount; - ULONG ModuleListIndex; - ULONG_PTR ModuleListOffset; - /* Process list */ - ULONG ProcessListCount; - ULONG ProcessListIndex; - ULONG_PTR ProcessListOffset; - /* Thread list */ - ULONG ThreadListCount; - ULONG ThreadListIndex; - ULONG_PTR ThreadListOffset; -} TH32SNAPSHOT, *PTH32SNAPSHOT; - -/* INTERNAL FUNCTIONS *********************************************************/ - -static VOID -TH32FreeAllocatedResources(PRTL_DEBUG_INFORMATION HeapDebug, - PRTL_DEBUG_INFORMATION ModuleDebug, - PVOID ProcThrdInfo, - SIZE_T ProcThrdInfoSize) -{ - if(HeapDebug != NULL) - { - RtlDestroyQueryDebugBuffer(HeapDebug); - } - if(ModuleDebug != NULL) - { - RtlDestroyQueryDebugBuffer(ModuleDebug); - } - - if(ProcThrdInfo != NULL) - { - NtFreeVirtualMemory(NtCurrentProcess(), - &ProcThrdInfo, - &ProcThrdInfoSize, - MEM_RELEASE); - } -} - -static NTSTATUS -TH32CreateSnapshot(DWORD dwFlags, - DWORD th32ProcessID, - PRTL_DEBUG_INFORMATION *HeapDebug, - PRTL_DEBUG_INFORMATION *ModuleDebug, - PVOID *ProcThrdInfo, - SIZE_T *ProcThrdInfoSize) -{ - NTSTATUS Status = STATUS_SUCCESS; - - *HeapDebug = NULL; - *ModuleDebug = NULL; - *ProcThrdInfo = NULL; - *ProcThrdInfoSize = 0; - - /* - * Allocate the debug information for a heap snapshot - */ - if(dwFlags & TH32CS_SNAPHEAPLIST) - { - *HeapDebug = RtlCreateQueryDebugBuffer(0, FALSE); - if(*HeapDebug != NULL) - { - Status = RtlQueryProcessDebugInformation(th32ProcessID, - RTL_DEBUG_QUERY_HEAPS, - *HeapDebug); - } - else - Status = STATUS_UNSUCCESSFUL; - } - - /* - * Allocate the debug information for a module snapshot - */ - if(dwFlags & TH32CS_SNAPMODULE && - NT_SUCCESS(Status)) - { - *ModuleDebug = RtlCreateQueryDebugBuffer(0, FALSE); - if(*ModuleDebug != NULL) - { - Status = RtlQueryProcessDebugInformation(th32ProcessID, - RTL_DEBUG_QUERY_MODULES, - *ModuleDebug); - } - else - Status = STATUS_UNSUCCESSFUL; - } - - /* - * Allocate enough memory for the system's process list - */ - - if(dwFlags & (TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD) && - NT_SUCCESS(Status)) - { - for(;;) - { - (*ProcThrdInfoSize) += 0x10000; - Status = NtAllocateVirtualMemory(NtCurrentProcess(), - ProcThrdInfo, - 0, - ProcThrdInfoSize, - MEM_COMMIT, - PAGE_READWRITE); - if(!NT_SUCCESS(Status)) - { - break; - } - - Status = NtQuerySystemInformation(SystemProcessInformation, - *ProcThrdInfo, - *ProcThrdInfoSize, - NULL); - if(Status == STATUS_INFO_LENGTH_MISMATCH) - { - NtFreeVirtualMemory(NtCurrentProcess(), - ProcThrdInfo, - ProcThrdInfoSize, - MEM_RELEASE); - *ProcThrdInfo = NULL; - } - else - { - break; - } - } - } - - /* - * Free resources in case of failure! - */ - - if(!NT_SUCCESS(Status)) - { - TH32FreeAllocatedResources(*HeapDebug, - *ModuleDebug, - *ProcThrdInfo, - *ProcThrdInfoSize); - } - - return Status; -} - -static NTSTATUS -TH32CreateSnapshotSectionInitialize(DWORD dwFlags, - DWORD th32ProcessID, - PRTL_DEBUG_INFORMATION HeapDebug, - PRTL_DEBUG_INFORMATION ModuleDebug, - PVOID ProcThrdInfo, - HANDLE *SectionHandle) -{ - PSYSTEM_PROCESS_INFORMATION ProcessInfo; - LPHEAPLIST32 HeapListEntry; - LPMODULEENTRY32W ModuleListEntry; - LPPROCESSENTRY32W ProcessListEntry; - LPTHREADENTRY32 ThreadListEntry; - OBJECT_ATTRIBUTES ObjectAttributes; - LARGE_INTEGER SSize, SOffset; - HANDLE hSection; - PTH32SNAPSHOT Snapshot; - ULONG_PTR DataOffset; - SIZE_T ViewSize; - ULONG i, nProcesses = 0, nThreads = 0, nHeaps = 0, nModules = 0; - ULONG RequiredSnapshotSize = sizeof(TH32SNAPSHOT); - PRTL_PROCESS_HEAPS hi = NULL; - PRTL_PROCESS_MODULES mi = NULL; - NTSTATUS Status = STATUS_SUCCESS; - - /* - * Determine the required size for the heap snapshot - */ - if(dwFlags & TH32CS_SNAPHEAPLIST) - { - hi = (PRTL_PROCESS_HEAPS)HeapDebug->Heaps; - nHeaps = hi->NumberOfHeaps; - RequiredSnapshotSize += nHeaps * sizeof(HEAPLIST32); - } - - /* - * Determine the required size for the module snapshot - */ - if(dwFlags & TH32CS_SNAPMODULE) - { - mi = (PRTL_PROCESS_MODULES)ModuleDebug->Modules; - nModules = mi->NumberOfModules; - RequiredSnapshotSize += nModules * sizeof(MODULEENTRY32W); - } - - /* - * Determine the required size for the processes and threads snapshot - */ - if(dwFlags & (TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD)) - { - ULONG ProcOffset = 0; - - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)ProcThrdInfo; - do - { - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)ProcessInfo + ProcOffset); - nProcesses++; - nThreads += ProcessInfo->NumberOfThreads; - ProcOffset = ProcessInfo->NextEntryOffset; - } while(ProcOffset != 0); - - if(dwFlags & TH32CS_SNAPPROCESS) - { - RequiredSnapshotSize += nProcesses * sizeof(PROCESSENTRY32W); - } - if(dwFlags & TH32CS_SNAPTHREAD) - { - RequiredSnapshotSize += nThreads * sizeof(THREADENTRY32); - } - } - - /* - * Create and map the section - */ - - SSize.QuadPart = RequiredSnapshotSize; - - InitializeObjectAttributes(&ObjectAttributes, - NULL, - ((dwFlags & TH32CS_INHERIT) ? OBJ_INHERIT : 0), - NULL, - NULL); - - Status = NtCreateSection(&hSection, - SECTION_ALL_ACCESS, - &ObjectAttributes, - &SSize, - PAGE_READWRITE, - SEC_COMMIT, - NULL); - if(!NT_SUCCESS(Status)) - { - return Status; - } - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSection, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(!NT_SUCCESS(Status)) - { - NtClose(hSection); - return Status; - } - - RtlZeroMemory(Snapshot, sizeof(TH32SNAPSHOT)); - DataOffset = 0; - - /* - * Initialize the section data and fill it with all the data we collected - */ - - /* initialize the heap list */ - if(dwFlags & TH32CS_SNAPHEAPLIST) - { - Snapshot->HeapListCount = nHeaps; - Snapshot->HeapListOffset = DataOffset; - HeapListEntry = (LPHEAPLIST32)OffsetToPtr(Snapshot, DataOffset); - for(i = 0; i < nHeaps; i++) - { - HeapListEntry->dwSize = sizeof(HEAPLIST32); - HeapListEntry->th32ProcessID = th32ProcessID; - HeapListEntry->th32HeapID = (ULONG_PTR)hi->Heaps[i].BaseAddress; - HeapListEntry->dwFlags = hi->Heaps[i].Flags; - - HeapListEntry++; - } - - DataOffset += hi->NumberOfHeaps * sizeof(HEAPLIST32); - } - - /* initialize the module list */ - if(dwFlags & TH32CS_SNAPMODULE) - { - Snapshot->ModuleListCount = nModules; - Snapshot->ModuleListOffset = DataOffset; - ModuleListEntry = (LPMODULEENTRY32W)OffsetToPtr(Snapshot, DataOffset); - for(i = 0; i < nModules; i++) - { - ModuleListEntry->dwSize = sizeof(MODULEENTRY32W); - ModuleListEntry->th32ModuleID = 1; /* no longer used, always set to one! */ - ModuleListEntry->th32ProcessID = th32ProcessID; - ModuleListEntry->GlblcntUsage = mi->Modules[i].LoadCount; - ModuleListEntry->ProccntUsage = mi->Modules[i].LoadCount; - ModuleListEntry->modBaseAddr = (BYTE*)mi->Modules[i].ImageBase; - ModuleListEntry->modBaseSize = mi->Modules[i].ImageSize; - ModuleListEntry->hModule = (HMODULE)mi->Modules[i].ImageBase; - - MultiByteToWideChar(CP_ACP, - 0, - &mi->Modules[i].FullPathName[mi->Modules[i].OffsetToFileName], - -1, - ModuleListEntry->szModule, - sizeof(ModuleListEntry->szModule) / sizeof(ModuleListEntry->szModule[0])); - - MultiByteToWideChar(CP_ACP, - 0, - mi->Modules[i].FullPathName, - -1, - ModuleListEntry->szExePath, - sizeof(ModuleListEntry->szExePath) / sizeof(ModuleListEntry->szExePath[0])); - - ModuleListEntry++; - } - - DataOffset += mi->NumberOfModules * sizeof(MODULEENTRY32W); - } - - /* initialize the process list */ - if(dwFlags & TH32CS_SNAPPROCESS) - { - ULONG ProcOffset = 0; - - Snapshot->ProcessListCount = nProcesses; - Snapshot->ProcessListOffset = DataOffset; - ProcessListEntry = (LPPROCESSENTRY32W)OffsetToPtr(Snapshot, DataOffset); - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)ProcThrdInfo; - do - { - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)ProcessInfo + ProcOffset); - - ProcessListEntry->dwSize = sizeof(PROCESSENTRY32W); - ProcessListEntry->cntUsage = 0; /* no longer used */ - ProcessListEntry->th32ProcessID = (ULONG_PTR)ProcessInfo->UniqueProcessId; - ProcessListEntry->th32DefaultHeapID = 0; /* no longer used */ - ProcessListEntry->th32ModuleID = 0; /* no longer used */ - ProcessListEntry->cntThreads = ProcessInfo->NumberOfThreads; - ProcessListEntry->th32ParentProcessID = (ULONG_PTR)ProcessInfo->InheritedFromUniqueProcessId; - ProcessListEntry->pcPriClassBase = ProcessInfo->BasePriority; - ProcessListEntry->dwFlags = 0; /* no longer used */ - if(ProcessInfo->ImageName.Buffer != NULL) - { - lstrcpynW(ProcessListEntry->szExeFile, - ProcessInfo->ImageName.Buffer, - min(ProcessInfo->ImageName.Length / sizeof(WCHAR), sizeof(ProcessListEntry->szExeFile) / sizeof(ProcessListEntry->szExeFile[0]))); - } - else - { - lstrcpyW(ProcessListEntry->szExeFile, L"[System Process]"); - } - - ProcessListEntry++; - - ProcOffset = ProcessInfo->NextEntryOffset; - } while(ProcOffset != 0); - - DataOffset += nProcesses * sizeof(PROCESSENTRY32W); - } - - /* initialize the thread list */ - if(dwFlags & TH32CS_SNAPTHREAD) - { - ULONG ProcOffset = 0; - - Snapshot->ThreadListCount = nThreads; - Snapshot->ThreadListOffset = DataOffset; - ThreadListEntry = (LPTHREADENTRY32)OffsetToPtr(Snapshot, DataOffset); - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)ProcThrdInfo; - do - { - PSYSTEM_THREAD_INFORMATION ThreadInfo; - ULONG n; - - ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)ProcessInfo + ProcOffset); - ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(ProcessInfo + 1); - - for(n = 0; n < ProcessInfo->NumberOfThreads; n++) - { - ThreadListEntry->dwSize = sizeof(THREADENTRY32); - ThreadListEntry->cntUsage = 0; /* no longer used */ - ThreadListEntry->th32ThreadID = (ULONG_PTR)ThreadInfo->ClientId.UniqueThread; - ThreadListEntry->th32OwnerProcessID = (ULONG_PTR)ThreadInfo->ClientId.UniqueProcess; - ThreadListEntry->tpBasePri = ThreadInfo->BasePriority; - ThreadListEntry->tpDeltaPri = 0; /* no longer used */ - ThreadListEntry->dwFlags = 0; /* no longer used */ - - ThreadInfo++; - ThreadListEntry++; - } - - ProcOffset = ProcessInfo->NextEntryOffset; - } while(ProcOffset != 0); - } - - /* - * We're done, unmap the view and return the section handle - */ - - Status = NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - - if(NT_SUCCESS(Status)) - { - *SectionHandle = hSection; - } - else - { - NtClose(hSection); - } - - return Status; -} - -/* PUBLIC FUNCTIONS ***********************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -Heap32First(LPHEAPENTRY32 lphe, DWORD th32ProcessID, DWORD th32HeapID) -{ - PRTL_DEBUG_INFORMATION DebugInfo; - PRTL_HEAP_INFORMATION Heap; - PRTLP_HEAP_ENTRY Block, LastBlock; - ULONG i; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lphe, sizeof(HEAPENTRY32)); - - DebugInfo = RtlCreateQueryDebugBuffer(0, - FALSE); - if (DebugInfo == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - Status = RtlQueryProcessDebugInformation(th32ProcessID, - RTL_DEBUG_QUERY_HEAPS | RTL_DEBUG_QUERY_HEAP_BLOCKS, - DebugInfo); - - if (NT_SUCCESS(Status)) - { - Status = STATUS_NO_MORE_FILES; - - for (i = 0; - i != DebugInfo->Heaps->NumberOfHeaps; - i++) - { - Heap = &DebugInfo->Heaps->Heaps[i]; - - if ((ULONG_PTR)Heap->BaseAddress == th32HeapID) - { - lphe->hHandle = (HANDLE)Heap->BaseAddress; - lphe->dwAddress = 0; - lphe->dwBlockSize = 0; - lphe->dwFlags = 0; - lphe->dwLockCount = 0; - lphe->dwResvd = 0; - lphe->th32ProcessID = th32ProcessID; - lphe->th32HeapID = (ULONG_PTR)Heap->BaseAddress; - - Block = (PRTLP_HEAP_ENTRY)Heap->Entries; - LastBlock = Block + Heap->NumberOfEntries; - - while (Block != LastBlock && (Block->Flags & PROCESS_HEAP_UNCOMMITTED_RANGE)) - { - lphe->dwResvd++; - lphe->dwAddress = (ULONG_PTR)((ULONG_PTR)Block->Address + Heap->EntryOverhead); - Block++; - } - - if (Block != LastBlock && lphe->dwResvd != 0) - { - lphe->dwBlockSize = Block->Size; - - if (Block->Flags & 0x2F1) /* FIXME */ - lphe->dwFlags = LF32_FIXED; - else if (Block->Flags & 0x20) /* FIXME */ - lphe->dwFlags = LF32_MOVEABLE; - else if (Block->Flags & 0x100) /* FIXME */ - lphe->dwFlags = LF32_FREE; - - Status = STATUS_SUCCESS; - } - - break; - } - } - } - - RtlDestroyQueryDebugBuffer(DebugInfo); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Heap32Next(LPHEAPENTRY32 lphe) -{ - PRTL_DEBUG_INFORMATION DebugInfo; - PRTL_HEAP_INFORMATION Heap; - PRTLP_HEAP_ENTRY Block, LastBlock; - BOOLEAN FoundUncommitted = FALSE; - ULONG i; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lphe, sizeof(HEAPENTRY32)); - - DebugInfo = RtlCreateQueryDebugBuffer(0, - FALSE); - if (DebugInfo == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - Status = RtlQueryProcessDebugInformation(lphe->th32ProcessID, - RTL_DEBUG_QUERY_HEAPS | RTL_DEBUG_QUERY_HEAP_BLOCKS, - DebugInfo); - - if (NT_SUCCESS(Status)) - { - Status = STATUS_NO_MORE_FILES; - - for (i = 0; - i != DebugInfo->Heaps->NumberOfHeaps; - i++) - { - Heap = &DebugInfo->Heaps->Heaps[i]; - - if ((ULONG_PTR)Heap->BaseAddress == lphe->th32HeapID) - { - if (++lphe->dwResvd < Heap->NumberOfEntries) - { - lphe->dwFlags = 0; - - Block = (PRTLP_HEAP_ENTRY)Heap->Entries + lphe->dwResvd; - LastBlock = (PRTLP_HEAP_ENTRY)Heap->Entries + Heap->NumberOfEntries; - - while (Block < LastBlock && (Block->Flags & PROCESS_HEAP_UNCOMMITTED_RANGE)) - { - lphe->dwResvd++; - lphe->dwAddress = (ULONG_PTR)((ULONG_PTR)Block->Address + Heap->EntryOverhead); - FoundUncommitted = TRUE; - Block++; - } - - if (Block < LastBlock) - { - if (!FoundUncommitted) - lphe->dwAddress += lphe->dwBlockSize; - - lphe->dwBlockSize = Block->Size; - - if (Block->Flags & 0x2F1) /* FIXME */ - lphe->dwFlags = LF32_FIXED; - else if (Block->Flags & 0x20) /* FIXME */ - lphe->dwFlags = LF32_MOVEABLE; - else if (Block->Flags & 0x100) /* FIXME */ - lphe->dwFlags = LF32_FREE; - - Status = STATUS_SUCCESS; - } - } - - break; - } - } - } - - RtlDestroyQueryDebugBuffer(DebugInfo); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; - -} - - -/* - * @implemented - */ -BOOL -WINAPI -Heap32ListFirst(HANDLE hSnapshot, LPHEAPLIST32 lphl) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lphl, sizeof(HEAPLIST32)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->HeapListCount > 0) - { - LPHEAPLIST32 Entries = (LPHEAPLIST32)OffsetToPtr(Snapshot, Snapshot->HeapListOffset); - Snapshot->HeapListIndex = 1; - RtlCopyMemory(lphl, &Entries[0], sizeof(HEAPLIST32)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Heap32ListNext(HANDLE hSnapshot, LPHEAPLIST32 lphl) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lphl, sizeof(HEAPLIST32)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->HeapListCount > 0 && - Snapshot->HeapListIndex < Snapshot->HeapListCount) - { - LPHEAPLIST32 Entries = (LPHEAPLIST32)OffsetToPtr(Snapshot, Snapshot->HeapListOffset); - RtlCopyMemory(lphl, &Entries[Snapshot->HeapListIndex++], sizeof(HEAPLIST32)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Module32First(HANDLE hSnapshot, LPMODULEENTRY32 lpme) -{ - MODULEENTRY32W me; - BOOL Ret; - - CHECK_PARAM_SIZEA(lpme, sizeof(MODULEENTRY32)); - - me.dwSize = sizeof(MODULEENTRY32W); - - Ret = Module32FirstW(hSnapshot, &me); - if(Ret) - { - lpme->th32ModuleID = me.th32ModuleID; - lpme->th32ProcessID = me.th32ProcessID; - lpme->GlblcntUsage = me.GlblcntUsage; - lpme->ProccntUsage = me.ProccntUsage; - lpme->modBaseAddr = me.modBaseAddr; - lpme->modBaseSize = me.modBaseSize; - lpme->hModule = me.hModule; - - WideCharToMultiByte(CP_ACP, 0, me.szModule, -1, lpme->szModule, sizeof(lpme->szModule), 0, 0); - WideCharToMultiByte(CP_ACP, 0, me.szExePath, -1, lpme->szExePath, sizeof(lpme->szExePath), 0, 0); - } - - return Ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Module32FirstW(HANDLE hSnapshot, LPMODULEENTRY32W lpme) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lpme, sizeof(MODULEENTRY32W)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ModuleListCount > 0) - { - LPMODULEENTRY32W Entries = (LPMODULEENTRY32W)OffsetToPtr(Snapshot, Snapshot->ModuleListOffset); - Snapshot->ModuleListIndex = 1; - RtlCopyMemory(lpme, &Entries[0], sizeof(MODULEENTRY32W)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Module32Next(HANDLE hSnapshot, LPMODULEENTRY32 lpme) -{ - MODULEENTRY32W me; - BOOL Ret; - - CHECK_PARAM_SIZEA(lpme, sizeof(MODULEENTRY32)); - - me.dwSize = sizeof(MODULEENTRY32W); - - Ret = Module32NextW(hSnapshot, &me); - if(Ret) - { - lpme->th32ModuleID = me.th32ModuleID; - lpme->th32ProcessID = me.th32ProcessID; - lpme->GlblcntUsage = me.GlblcntUsage; - lpme->ProccntUsage = me.ProccntUsage; - lpme->modBaseAddr = me.modBaseAddr; - lpme->modBaseSize = me.modBaseSize; - lpme->hModule = me.hModule; - - WideCharToMultiByte(CP_ACP, 0, me.szModule, -1, lpme->szModule, sizeof(lpme->szModule), 0, 0); - WideCharToMultiByte(CP_ACP, 0, me.szExePath, -1, lpme->szExePath, sizeof(lpme->szExePath), 0, 0); - } - - return Ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Module32NextW(HANDLE hSnapshot, LPMODULEENTRY32W lpme) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lpme, sizeof(MODULEENTRY32W)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if((Snapshot->ModuleListCount > 0) && - (Snapshot->ModuleListIndex < Snapshot->ModuleListCount)) - { - LPMODULEENTRY32W Entries = (LPMODULEENTRY32W)OffsetToPtr(Snapshot, Snapshot->ModuleListOffset); - RtlCopyMemory(lpme, &Entries[Snapshot->ModuleListIndex++], sizeof(MODULEENTRY32W)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Process32First(HANDLE hSnapshot, LPPROCESSENTRY32 lppe) -{ - PROCESSENTRY32W pe; - BOOL Ret; - - CHECK_PARAM_SIZEA(lppe, sizeof(PROCESSENTRY32)); - - pe.dwSize = sizeof(PROCESSENTRY32W); - - Ret = Process32FirstW(hSnapshot, &pe); - if(Ret) - { - lppe->cntUsage = pe.cntUsage; - lppe->th32ProcessID = pe.th32ProcessID; - lppe->th32DefaultHeapID = pe.th32DefaultHeapID; - lppe->th32ModuleID = pe.th32ModuleID; - lppe->cntThreads = pe.cntThreads; - lppe->th32ParentProcessID = pe.th32ParentProcessID; - lppe->pcPriClassBase = pe.pcPriClassBase; - lppe->dwFlags = pe.dwFlags; - - WideCharToMultiByte(CP_ACP, 0, pe.szExeFile, -1, lppe->szExeFile, sizeof(lppe->szExeFile), 0, 0); - } - - return Ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Process32FirstW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lppe, sizeof(PROCESSENTRY32W)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ProcessListCount > 0) - { - LPPROCESSENTRY32W Entries = (LPPROCESSENTRY32W)OffsetToPtr(Snapshot, Snapshot->ProcessListOffset); - - Snapshot->ProcessListIndex = 1; - RtlCopyMemory(lppe, &Entries[0], sizeof(PROCESSENTRY32W)); - Ret = TRUE; - } - else - { - - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Process32Next(HANDLE hSnapshot, LPPROCESSENTRY32 lppe) -{ - PROCESSENTRY32W pe; - BOOL Ret; - - CHECK_PARAM_SIZEA(lppe, sizeof(PROCESSENTRY32)); - - pe.dwSize = sizeof(PROCESSENTRY32W); - - Ret = Process32NextW(hSnapshot, &pe); - if(Ret) - { - lppe->cntUsage = pe.cntUsage; - lppe->th32ProcessID = pe.th32ProcessID; - lppe->th32DefaultHeapID = pe.th32DefaultHeapID; - lppe->th32ModuleID = pe.th32ModuleID; - lppe->cntThreads = pe.cntThreads; - lppe->th32ParentProcessID = pe.th32ParentProcessID; - lppe->pcPriClassBase = pe.pcPriClassBase; - lppe->dwFlags = pe.dwFlags; - - WideCharToMultiByte(CP_ACP, 0, pe.szExeFile, -1, lppe->szExeFile, sizeof(lppe->szExeFile), 0, 0); - } - - return Ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Process32NextW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lppe, sizeof(PROCESSENTRY32W)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ProcessListCount > 0 && - Snapshot->ProcessListIndex < Snapshot->ProcessListCount) - { - LPPROCESSENTRY32W Entries = (LPPROCESSENTRY32W)OffsetToPtr(Snapshot, Snapshot->ProcessListOffset); - RtlCopyMemory(lppe, &Entries[Snapshot->ProcessListIndex++], sizeof(PROCESSENTRY32W)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Thread32First(HANDLE hSnapshot, LPTHREADENTRY32 lpte) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lpte, sizeof(THREADENTRY32)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ThreadListCount > 0) - { - LPTHREADENTRY32 Entries = (LPTHREADENTRY32)OffsetToPtr(Snapshot, Snapshot->ThreadListOffset); - Snapshot->ThreadListIndex = 1; - RtlCopyMemory(lpte, &Entries[0], sizeof(THREADENTRY32)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Thread32Next(HANDLE hSnapshot, LPTHREADENTRY32 lpte) -{ - PTH32SNAPSHOT Snapshot; - LARGE_INTEGER SOffset; - SIZE_T ViewSize; - NTSTATUS Status; - - CHECK_PARAM_SIZE(lpte, sizeof(THREADENTRY32)); - - SOffset.QuadPart = 0; - ViewSize = 0; - Snapshot = NULL; - - Status = NtMapViewOfSection(hSnapshot, - NtCurrentProcess(), - (PVOID*)&Snapshot, - 0, - 0, - &SOffset, - &ViewSize, - ViewShare, - 0, - PAGE_READWRITE); - if(NT_SUCCESS(Status)) - { - BOOL Ret; - - if(Snapshot->ThreadListCount > 0 && - Snapshot->ThreadListIndex < Snapshot->ThreadListCount) - { - LPTHREADENTRY32 Entries = (LPTHREADENTRY32)OffsetToPtr(Snapshot, Snapshot->ThreadListOffset); - RtlCopyMemory(lpte, &Entries[Snapshot->ThreadListIndex++], sizeof(THREADENTRY32)); - Ret = TRUE; - } - else - { - SetLastError(ERROR_NO_MORE_FILES); - Ret = FALSE; - } - - NtUnmapViewOfSection(NtCurrentProcess(), (PVOID)Snapshot); - return Ret; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -Toolhelp32ReadProcessMemory(DWORD th32ProcessID, LPCVOID lpBaseAddress, - LPVOID lpBuffer, SIZE_T cbRead, SIZE_T* lpNumberOfBytesRead) -{ - HANDLE hProcess = OpenProcess(PROCESS_VM_READ, FALSE, th32ProcessID); - if(hProcess != NULL) - { - BOOL Ret = ReadProcessMemory(hProcess, lpBaseAddress, lpBuffer, cbRead, lpNumberOfBytesRead); - CloseHandle(hProcess); - return Ret; - } - - return FALSE; -} - - -/* - * @implemented - */ -HANDLE -WINAPI -CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID) -{ - PRTL_DEBUG_INFORMATION HeapDebug, ModuleDebug; - PVOID ProcThrdInfo; - SIZE_T ProcThrdInfoSize; - NTSTATUS Status; - HANDLE hSnapShotSection = NULL; - - if(th32ProcessID == 0) - { - th32ProcessID = GetCurrentProcessId(); - } - - /* - * Get all information required for the snapshot - */ - Status = TH32CreateSnapshot(dwFlags, - th32ProcessID, - &HeapDebug, - &ModuleDebug, - &ProcThrdInfo, - &ProcThrdInfoSize); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - /* - * Create a section handle and initialize the collected information - */ - Status = TH32CreateSnapshotSectionInitialize(dwFlags, - th32ProcessID, - HeapDebug, - ModuleDebug, - ProcThrdInfo, - &hSnapShotSection); - - /* - * Free the temporarily allocated memory which is no longer needed - */ - TH32FreeAllocatedResources(HeapDebug, - ModuleDebug, - ProcThrdInfo, - ProcThrdInfoSize); - - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - return hSnapShotSection; -} - -/* EOF */ Added: trunk/reactos/dll/win32/kernel32/client/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/time.c (added) +++ trunk/reactos/dll/win32/kernel32/client/time.c [iso-8859-1] Fri Jul 22 03:21:17 2011 @@ -1,0 +1,451 @@ +/* $Id: time.c 52770 2011-07-22 02:13:57Z ion $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/kernel32/misc/time.c + * PURPOSE: Time conversion functions + * PROGRAMMER: Ariadne + * DOSDATE and DOSTIME structures from Onno Hovers + * UPDATE HISTORY: + * Created 19/01/99 + */ + +/* INCLUDES ******************************************************************/ + +#include <k32.h> + +#define NDEBUG +#include <debug.h> + +/* TYPES *********************************************************************/ + +typedef struct __DOSTIME +{ + WORD Second:5; + WORD Minute:6; + WORD Hour:5; +} DOSTIME, *PDOSTIME; + +typedef struct __DOSDATE +{ + WORD Day:5; + WORD Month:4; + WORD Year:5; +} DOSDATE, *PDOSDATE; + +/* FUNCTIONS ******************************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +FileTimeToDosDateTime(CONST FILETIME *lpFileTime, + LPWORD lpFatDate, + LPWORD lpFatTime) +{ + PDOSTIME pdtime=(PDOSTIME) lpFatTime; + PDOSDATE pddate=(PDOSDATE) lpFatDate; + SYSTEMTIME SystemTime = { 0, 0, 0, 0, 0, 0, 0, 0 }; + + if (lpFileTime == NULL) + return FALSE; + + if (lpFatDate == NULL) + return FALSE; + + if (lpFatTime == NULL) + return FALSE; + + FileTimeToSystemTime(lpFileTime, &SystemTime); + + pdtime->Second = SystemTime.wSecond / 2; + pdtime->Minute = SystemTime.wMinute; + pdtime->Hour = SystemTime.wHour; + + pddate->Day = SystemTime.wDay; + pddate->Month = SystemTime.wMonth; + pddate->Year = SystemTime.wYear - 1980; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +DosDateTimeToFileTime(WORD wFatDate, + WORD wFatTime, + LPFILETIME lpFileTime) +{ + PDOSTIME pdtime = (PDOSTIME) &wFatTime; + PDOSDATE pddate = (PDOSDATE) &wFatDate; + SYSTEMTIME SystemTime; + + if (lpFileTime == NULL) + return FALSE; + + SystemTime.wMilliseconds = 0; + SystemTime.wSecond = pdtime->Second * 2; + SystemTime.wMinute = pdtime->Minute; + SystemTime.wHour = pdtime->Hour; + + SystemTime.wDay = pddate->Day; + SystemTime.wMonth = pddate->Month; + SystemTime.wYear = 1980 + pddate->Year; + + if (SystemTimeToFileTime(&SystemTime, lpFileTime) == FALSE) + { + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +LONG +WINAPI +CompareFileTime(CONST FILETIME *lpFileTime1, CONST FILETIME *lpFileTime2) +{ + if (lpFileTime1 == NULL) + return 0; + if (lpFileTime2 == NULL) + return 0; + + if (*((PLONGLONG)lpFileTime1) > *((PLONGLONG)lpFileTime2)) + return 1; + else if (*((PLONGLONG)lpFileTime1) < *((PLONGLONG)lpFileTime2)) + return -1; + + return 0; +} + + +/* + * @implemented + */ +VOID +WINAPI +GetSystemTimeAsFileTime(PFILETIME lpFileTime) +{ + do + { + lpFileTime->dwHighDateTime = SharedUserData->SystemTime.High1Time; + lpFileTime->dwLowDateTime = SharedUserData->SystemTime.LowPart; + } + while (lpFileTime->dwHighDateTime != (DWORD)SharedUserData->SystemTime.High2Time); +} + + +/* + * @implemented + */ +BOOL +WINAPI +SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) +{ + TIME_FIELDS TimeFields; + LARGE_INTEGER liTime; + + TimeFields.Year = lpSystemTime->wYear; + TimeFields.Month = lpSystemTime->wMonth; + TimeFields.Day = lpSystemTime->wDay; + TimeFields.Hour = lpSystemTime->wHour; + TimeFields.Minute = lpSystemTime->wMinute; + TimeFields.Second = lpSystemTime->wSecond; + TimeFields.Milliseconds = lpSystemTime->wMilliseconds; + + if (RtlTimeFieldsToTime (&TimeFields, &liTime)) + { + lpFileTime->dwLowDateTime = liTime.u.LowPart; + lpFileTime->dwHighDateTime = liTime.u.HighPart; + return TRUE; + } + + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) +{ + TIME_FIELDS TimeFields; + LARGE_INTEGER liTime; + + if (lpFileTime->dwHighDateTime & 0x80000000) + return FALSE; + + liTime.u.LowPart = lpFileTime->dwLowDateTime; + liTime.u.HighPart = lpFileTime->dwHighDateTime; + + RtlTimeToTimeFields(&liTime, &TimeFields); + + lpSystemTime->wYear = TimeFields.Year; + lpSystemTime->wMonth = TimeFields.Month; + lpSystemTime->wDay = TimeFields.Day; + lpSystemTime->wHour = TimeFields.Hour; + lpSystemTime->wMinute = TimeFields.Minute; + lpSystemTime->wSecond = TimeFields.Second; + lpSystemTime->wMilliseconds = TimeFields.Milliseconds; + lpSystemTime->wDayOfWeek = TimeFields.Weekday; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +FileTimeToLocalFileTime(CONST FILETIME *lpFileTime, LPFILETIME lpLocalFileTime) +{ + LARGE_INTEGER TimeZoneBias; + + do + { + TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; + TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; + } + while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); + + *((PLONGLONG)lpLocalFileTime) = *((PLONGLONG)lpFileTime) - TimeZoneBias.QuadPart; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +LocalFileTimeToFileTime(CONST FILETIME *lpLocalFileTime, LPFILETIME lpFileTime) +{ + LARGE_INTEGER TimeZoneBias; + + do + { + TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; + TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; + } + while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); + + *((PLONGLONG)lpFileTime) = *((PLONGLONG)lpLocalFileTime) + TimeZoneBias.QuadPart; + + return TRUE; +} + + +/* + * @implemented + */ +VOID +WINAPI +GetLocalTime(LPSYSTEMTIME lpSystemTime) +{ + FILETIME FileTime; + FILETIME LocalFileTime; + + GetSystemTimeAsFileTime(&FileTime); + FileTimeToLocalFileTime(&FileTime, &LocalFileTime); + FileTimeToSystemTime(&LocalFileTime, lpSystemTime); +} + + +/* + * @implemented + */ +VOID +WINAPI +GetSystemTime(LPSYSTEMTIME lpSystemTime) +{ + FILETIME FileTime; + + GetSystemTimeAsFileTime(&FileTime); + FileTimeToSystemTime(&FileTime, lpSystemTime); +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetLocalTime(CONST SYSTEMTIME *lpSystemTime) +{ + FILETIME LocalFileTime; + LARGE_INTEGER FileTime; + NTSTATUS Status; + + SystemTimeToFileTime(lpSystemTime, &LocalFileTime); + LocalFileTimeToFileTime(&LocalFileTime, (FILETIME *)&FileTime); + Status = NtSetSystemTime(&FileTime, &FileTime); + if (!NT_SUCCESS(Status)) + return FALSE; + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetSystemTime(CONST SYSTEMTIME *lpSystemTime) +{ + LARGE_INTEGER NewSystemTime; + NTSTATUS Status; + + SystemTimeToFileTime(lpSystemTime, (PFILETIME)&NewSystemTime); + Status = NtSetSystemTime(&NewSystemTime, &NewSystemTime); + if (!NT_SUCCESS(Status)) + return FALSE; + return TRUE; +} + +/* + * @implemented + */ +DWORD +WINAPI +GetTickCount(VOID) +{ + ULARGE_INTEGER TickCount; + + while (TRUE) + { + TickCount.HighPart = (ULONG)SharedUserData->TickCount.High1Time; + TickCount.LowPart = SharedUserData->TickCount.LowPart; + + if (TickCount.HighPart == (ULONG)SharedUserData->TickCount.High2Time) + break; + + YieldProcessor(); + } + + return (ULONG)((UInt32x32To64(TickCount.LowPart, SharedUserData->TickCountMultiplier) >> 24) + + UInt32x32To64((TickCount.HighPart << 8) & 0xFFFFFFFF, SharedUserData->TickCountMultiplier)); + +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetClientTimeZoneInformation( + CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) +{ + STUB; + return 0; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, + PDWORD lpTimeIncrement, + PBOOL lpTimeAdjustmentDisabled) +{ + SYSTEM_QUERY_TIME_ADJUST_INFORMATION Buffer; + NTSTATUS Status; + + Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation, + &Buffer, + sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + *lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment; + *lpTimeIncrement = (DWORD)Buffer.TimeIncrement; + *lpTimeAdjustmentDisabled = (BOOL)Buffer.Enable; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetSystemTimeAdjustment(DWORD dwTimeAdjustment, + BOOL bTimeAdjustmentDisabled) +{ + NTSTATUS Status; + SYSTEM_SET_TIME_ADJUST_INFORMATION Buffer; + + Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment; + Buffer.Enable = (BOOLEAN)bTimeAdjustmentDisabled; + + Status = NtSetSystemInformation(SystemTimeAdjustmentInformation, + &Buffer, + sizeof(SYSTEM_SET_TIME_ADJUST_INFORMATION)); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetSystemTimes(LPFILETIME lpIdleTime, + LPFILETIME lpKernelTime, + LPFILETIME lpUserTime) +{ + SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcPerfInfo; + NTSTATUS Status; + + Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation, + &SysProcPerfInfo, + sizeof(SysProcPerfInfo), + NULL); + + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } +/* + Good only for one processor system. + */ + + lpIdleTime->dwLowDateTime = SysProcPerfInfo.IdleTime.LowPart; + lpIdleTime->dwHighDateTime = SysProcPerfInfo.IdleTime.HighPart; + + lpKernelTime->dwLowDateTime = SysProcPerfInfo.KernelTime.LowPart; + lpKernelTime->dwHighDateTime = SysProcPerfInfo.KernelTime.HighPart; + + lpUserTime->dwLowDateTime = SysProcPerfInfo.UserTime.LowPart; + lpUserTime->dwHighDateTime = SysProcPerfInfo.UserTime.HighPart; + + return TRUE; +} + + + +/* EOF */ Propchange: trunk/reactos/dll/win32/kernel32/client/time.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/kernel32/kernel32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] Fri Jul 22 03:21:17 2011 @@ -44,8 +44,10 @@ <file>session.c</file> <file>synch.c</file> <file>sysinfo.c</file> + <file>time.c</file> <file>timerqueue.c</file> <file>thread.c</file> + <file>toolhelp.c</file> <file>utils.c</file> <file>vdm.c</file> <file>version.c</file> @@ -85,8 +87,7 @@ <file>muldiv.c</file> <file>profile.c</file> <file>res.c</file> - <file>time.c</file> - <file>toolhelp.c</file> + <file>timezone.c</file> </directory> </directory> <directory name="winnls">
13 years, 5 months
1
0
0
0
[ion] 52771: [KERNEL32]: We lost an API. Rbuild didn't care.
by ion@svn.reactos.org
Author: ion Date: Fri Jul 22 02:43:12 2011 New Revision: 52771 URL:
http://svn.reactos.org/svn/reactos?rev=52771&view=rev
Log: [KERNEL32]: We lost an API. Rbuild didn't care. Modified: trunk/reactos/dll/win32/kernel32/client/appcache.c Modified: trunk/reactos/dll/win32/kernel32/client/appcache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/appcache.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/appcache.c [iso-8859-1] Fri Jul 22 02:43:12 2011 @@ -104,7 +104,15 @@ return NULL; } -/* +BOOL +WINAPI +SetComPlusPackageInstallStatus(LPVOID lpInfo) +{ + STUB; + return FALSE; +} + + /* * @unimplemented */ VOID
13 years, 5 months
1
0
0
0
[ion] 52770: [KERNEL32]: Remove stubs.c and instead distribute stubs in their appropriate files. [KERNEL32]: Create vdm.c and appcache.c since no files existed for these kinds of APIs.
by ion@svn.reactos.org
Author: ion Date: Fri Jul 22 02:13:57 2011 New Revision: 52770 URL:
http://svn.reactos.org/svn/reactos?rev=52770&view=rev
Log: [KERNEL32]: Remove stubs.c and instead distribute stubs in their appropriate files. [KERNEL32]: Create vdm.c and appcache.c since no files existed for these kinds of APIs. Added: trunk/reactos/dll/win32/kernel32/client/appcache.c (with props) trunk/reactos/dll/win32/kernel32/client/vdm.c (with props) Removed: trunk/reactos/dll/win32/kernel32/client/misc/stubs.c Modified: trunk/reactos/dll/win32/kernel32/CMakeLists.txt trunk/reactos/dll/win32/kernel32/client/compname.c trunk/reactos/dll/win32/kernel32/client/except.c trunk/reactos/dll/win32/kernel32/client/file/console.c trunk/reactos/dll/win32/kernel32/client/file/file.c trunk/reactos/dll/win32/kernel32/client/file/iocompl.c trunk/reactos/dll/win32/kernel32/client/file/volume.c trunk/reactos/dll/win32/kernel32/client/handle.c trunk/reactos/dll/win32/kernel32/client/job.c trunk/reactos/dll/win32/kernel32/client/loader.c trunk/reactos/dll/win32/kernel32/client/misc/time.c trunk/reactos/dll/win32/kernel32/client/proc.c trunk/reactos/dll/win32/kernel32/client/synch.c trunk/reactos/dll/win32/kernel32/client/sysinfo.c trunk/reactos/dll/win32/kernel32/client/thread.c trunk/reactos/dll/win32/kernel32/client/utils.c trunk/reactos/dll/win32/kernel32/k32.h trunk/reactos/dll/win32/kernel32/kernel32.pspec trunk/reactos/dll/win32/kernel32/kernel32.rbuild trunk/reactos/dll/win32/kernel32/kernel32.spec trunk/reactos/dll/win32/kernel32/winnls/string/nls.c Modified: trunk/reactos/dll/win32/kernel32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -8,6 +8,7 @@ spec2def(kernel32.dll kernel32.spec) list(APPEND SOURCE + client/appcache.c client/atom.c client/compname.c client/debugger.c @@ -29,6 +30,7 @@ client/timerqueue.c client/utils.c client/thread.c + client/vdm.c client/version.c client/virtmem.c client/vista.c @@ -63,7 +65,6 @@ client/misc/muldiv.c client/misc/profile.c client/misc/res.c - client/misc/stubs.c client/misc/time.c client/misc/toolhelp.c winnls/string/casemap.c Added: trunk/reactos/dll/win32/kernel32/client/appcache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/appcache.c (added) +++ trunk/reactos/dll/win32/kernel32/client/appcache.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -1,0 +1,126 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/kernel32/client/appcache.c + * PURPOSE: Application Compatibility Cache + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include <k32.h> + +#define NDEBUG +#include <debug.h> + +/* TYPES **********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +/* + * @unimplemented + */ +VOID +WINAPI +BaseDumpAppcompatCache(VOID) +{ + STUB; +} + +/* + * @unimplemented + */ +VOID +WINAPI +BaseFlushAppcompatCache(VOID) +{ + STUB; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +BaseCheckAppcompatCache(ULONG Unknown1, + ULONG Unknown2, + ULONG Unknown3, + PULONG Unknown4) +{ + STUB; + if (Unknown4) *Unknown4 = 0; + return TRUE; +} + +/* + * @unimplemented + */ +VOID +WINAPI +BaseUpdateAppcompatCache(ULONG Unknown1, + ULONG Unknown2, + ULONG Unknown3) +{ + STUB; +} + +NTSTATUS +WINAPI +BaseCleanupAppcompatCache(VOID) +{ + STUB; + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +WINAPI +BaseCleanupAppcompatCacheSupport(PVOID pUnknown) +{ + STUB; + return STATUS_NOT_IMPLEMENTED; +} + +BOOL +WINAPI +BaseInitAppcompatCache(VOID) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +BaseInitAppcompatCacheSupport(VOID) +{ + STUB; + return FALSE; +} + +PVOID +WINAPI +GetComPlusPackageInstallStatus(VOID) +{ + STUB; + return NULL; +} + +/* + * @unimplemented + */ +VOID +WINAPI +SetTermsrvAppInstallMode(IN BOOL bInstallMode) +{ + STUB; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +TermsrvAppInstallMode(VOID) +{ + STUB; + return FALSE; +} Propchange: trunk/reactos/dll/win32/kernel32/client/appcache.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/kernel32/client/compname.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/compname.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/compname.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -558,4 +558,77 @@ return TRUE; } +DWORD +WINAPI +AddLocalAlternateComputerNameA(LPSTR lpName, PNTSTATUS Status) +{ + STUB; + return 0; +} + +DWORD +WINAPI +AddLocalAlternateComputerNameW(LPWSTR lpName, PNTSTATUS Status) +{ + STUB; + return 0; +} + +DWORD +WINAPI +EnumerateLocalComputerNamesA(PVOID pUnknown, DWORD Size, LPSTR lpBuffer, LPDWORD lpnSize) +{ + STUB; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD +WINAPI +EnumerateLocalComputerNamesW(PVOID pUnknown, DWORD Size, LPWSTR lpBuffer, LPDWORD lpnSize) +{ + STUB; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD +WINAPI +RemoveLocalAlternateComputerNameA(LPSTR lpName, DWORD Unknown) +{ + STUB; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD +WINAPI +RemoveLocalAlternateComputerNameW(LPWSTR lpName, DWORD Unknown) +{ + STUB; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetLocalPrimaryComputerNameA(IN DWORD Unknown1, + IN DWORD Unknown2) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetLocalPrimaryComputerNameW(IN DWORD Unknown1, + IN DWORD Unknown2) +{ + STUB; + return FALSE; +} + + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/except.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/except.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/except.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -697,4 +697,17 @@ return NtCurrentTeb()->LastErrorValue; } +/* + * @unimplemented + */ +VOID +WINAPI +RestoreLastError( + DWORD dwErrCode + ) +{ + STUB; +} + + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/file/console.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/console.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/console.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -4195,4 +4195,143 @@ return Ret; } +BOOL +WINAPI +GetConsoleCharType(HANDLE hConsole, COORD Coord, PDWORD Type) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +GetConsoleCursorMode(HANDLE hConsole, PBOOL pUnknown1, PBOOL pUnknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +GetConsoleNlsMode(HANDLE hConsole, LPDWORD lpMode) +{ + STUB; + return FALSE; +} + + +BOOL +WINAPI +ReadConsoleInputExA(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +ReadConsoleInputExW(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +RegisterConsoleIME(HWND hWnd, LPDWORD ThreadId) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +RegisterConsoleOS2(BOOL bUnknown) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleCursorMode(HANDLE hConsole, BOOL Unknown1, BOOL Unknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleLocalEUDC(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3, DWORD Unknown4) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleNlsMode(HANDLE hConsole, DWORD dwMode) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleOS2OemFormat(BOOL bUnknown) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +UnregisterConsoleIME(VOID) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR name) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR name) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetLastConsoleEventActive(VOID) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetConsoleCommandHistoryMode(IN DWORD dwMode) +{ + STUB; + return FALSE; +} + + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/file/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/file.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/file.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -2020,4 +2020,143 @@ return Ret; } +/* + * @implemented + */ +BOOL +WINAPI +ReadFileScatter(HANDLE hFile, + FILE_SEGMENT_ELEMENT aSegmentArray[], + DWORD nNumberOfBytesToRead, + LPDWORD lpReserved, + LPOVERLAPPED lpOverlapped) +{ + PIO_STATUS_BLOCK pIOStatus; + LARGE_INTEGER Offset; + NTSTATUS Status; + + DPRINT("(%p %p %u %p)\n", hFile, aSegmentArray, nNumberOfBytesToRead, lpOverlapped); + + Offset.LowPart = lpOverlapped->Offset; + Offset.HighPart = lpOverlapped->OffsetHigh; + pIOStatus = (PIO_STATUS_BLOCK) lpOverlapped; + pIOStatus->Status = STATUS_PENDING; + pIOStatus->Information = 0; + + Status = NtReadFileScatter(hFile, + NULL, + NULL, + NULL, + pIOStatus, + aSegmentArray, + nNumberOfBytesToRead, + &Offset, + NULL); + + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +WriteFileGather(HANDLE hFile, + FILE_SEGMENT_ELEMENT aSegmentArray[], + DWORD nNumberOfBytesToWrite, + LPDWORD lpReserved, + LPOVERLAPPED lpOverlapped) +{ + PIO_STATUS_BLOCK IOStatus; + LARGE_INTEGER Offset; + NTSTATUS Status; + + DPRINT("%p %p %u %p\n", hFile, aSegmentArray, nNumberOfBytesToWrite, lpOverlapped); + + Offset.LowPart = lpOverlapped->Offset; + Offset.HighPart = lpOverlapped->OffsetHigh; + IOStatus = (PIO_STATUS_BLOCK) lpOverlapped; + IOStatus->Status = STATUS_PENDING; + IOStatus->Information = 0; + + Status = NtWriteFileGather(hFile, + NULL, + NULL, + NULL, + IOStatus, + aSegmentArray, + nNumberOfBytesToWrite, + &Offset, + NULL); + + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +BOOL +WINAPI +OpenDataFile(HANDLE hFile, DWORD dwUnused) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +PrivMoveFileIdentityW(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +HANDLE +WINAPI +ReOpenFile(IN HANDLE hOriginalFile, + IN DWORD dwDesiredAccess, + IN DWORD dwShareMode, + IN DWORD dwFlags) +{ + STUB; + return INVALID_HANDLE_VALUE; +} + +BOOLEAN +WINAPI +Wow64EnableWow64FsRedirection (BOOLEAN Wow64EnableWow64FsRedirection) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +Wow64DisableWow64FsRedirection (VOID ** pv) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +Wow64RevertWow64FsRedirection (VOID * pv) +{ + STUB; + return FALSE; +} + + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/file/iocompl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/iocompl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/iocompl.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -192,27 +192,29 @@ /* - * @unimplemented + * @implemented */ BOOL WINAPI -CancelIoEx(IN HANDLE hFile, - IN LPOVERLAPPED lpOverlapped) -{ - UNIMPLEMENTED; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -CancelSynchronousIo(IN HANDLE hThread) -{ - UNIMPLEMENTED; - return FALSE; +BindIoCompletionCallback(HANDLE FileHandle, + LPOVERLAPPED_COMPLETION_ROUTINE Function, + ULONG Flags) +{ + NTSTATUS Status = 0; + + DPRINT("(%p, %p, %d)\n", FileHandle, Function, Flags); + + Status = RtlSetIoCompletionCallback(FileHandle, + (PIO_APC_ROUTINE)Function, + Flags); + + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; } /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/file/volume.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/file/volume.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/file/volume.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -1330,4 +1330,229 @@ return Result; } + +/* + * @unimplemented + */ +BOOL +WINAPI +SetVolumeMountPointW( + LPCWSTR lpszVolumeMountPoint, + LPCWSTR lpszVolumeName + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +DeleteVolumeMountPointA( + LPCSTR lpszVolumeMountPoint + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +HANDLE +WINAPI +FindFirstVolumeMountPointA( + LPCSTR lpszRootPathName, + LPSTR lpszVolumeMountPoint, + DWORD cchBufferLength + ) +{ + STUB; + return 0; +} + +/* + * @implemented + */ +BOOL +WINAPI +FindNextVolumeA(HANDLE handle, + LPSTR volume, + DWORD len) +{ + WCHAR *buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, len * sizeof(WCHAR)); + BOOL ret; + + if (!buffer) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + if ((ret = FindNextVolumeW( handle, buffer, len ))) + { + if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE; + } + + HeapFree( GetProcessHeap(), 0, buffer ); + return ret; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +FindNextVolumeMountPointA( + HANDLE hFindVolumeMountPoint, + LPSTR lpszVolumeMountPoint, + DWORD cchBufferLength + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetVolumePathNamesForVolumeNameA( + LPCSTR lpszVolumeName, + LPSTR lpszVolumePathNames, + DWORD cchBufferLength, + PDWORD lpcchReturnLength + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetVolumeMountPointA( + LPCSTR lpszVolumeMountPoint, + LPCSTR lpszVolumeName + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +FindVolumeMountPointClose( + HANDLE hFindVolumeMountPoint + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +DeleteVolumeMountPointW( + LPCWSTR lpszVolumeMountPoint + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +HANDLE +WINAPI +FindFirstVolumeMountPointW( + LPCWSTR lpszRootPathName, + LPWSTR lpszVolumeMountPoint, + DWORD cchBufferLength + ) +{ + STUB; + return 0; +} + +/* + * @implemented + */ +BOOL +WINAPI +FindNextVolumeW( + HANDLE handle, + LPWSTR volume, + DWORD len + ) +{ + MOUNTMGR_MOUNT_POINTS *data = handle; + + while (data->Size < data->NumberOfMountPoints) + { + static const WCHAR volumeW[] = {'\\','?','?','\\','V','o','l','u','m','e','{',}; + WCHAR *link = (WCHAR *)((char *)data + data->MountPoints[data->Size].SymbolicLinkNameOffset); + DWORD size = data->MountPoints[data->Size].SymbolicLinkNameLength; + data->Size++; + /* skip non-volumes */ + if (size < sizeof(volumeW) || memcmp( link, volumeW, sizeof(volumeW) )) continue; + if (size + sizeof(WCHAR) >= len * sizeof(WCHAR)) + { + SetLastError( ERROR_FILENAME_EXCED_RANGE ); + return FALSE; + } + memcpy( volume, link, size ); + volume[1] = '\\'; /* map \??\ to \\?\ */ + volume[size / sizeof(WCHAR)] = '\\'; /* Windows appends a backslash */ + volume[size / sizeof(WCHAR) + 1] = 0; + DPRINT( "returning entry %u %s\n", data->Size - 1, volume ); + return TRUE; + } + SetLastError( ERROR_NO_MORE_FILES ); + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +FindNextVolumeMountPointW( + HANDLE hFindVolumeMountPoint, + LPWSTR lpszVolumeMountPoint, + DWORD cchBufferLength + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetVolumePathNamesForVolumeNameW( + LPCWSTR lpszVolumeName, + LPWSTR lpszVolumePathNames, + DWORD cchBufferLength, + PDWORD lpcchReturnLength + ) +{ + STUB; + return 0; +} + + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/handle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/handle.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/handle.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -215,4 +215,31 @@ return(nCount); } +/* + * @unimplemented + */ +DWORD WINAPI GetHandleContext(HANDLE hnd) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +HANDLE WINAPI CreateSocketHandle(VOID) +{ + STUB; + return INVALID_HANDLE_VALUE; +} + +/* + * @unimplemented + */ +BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context) +{ + STUB; + return 0; +} + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/job.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/job.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/job.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -431,4 +431,18 @@ return TRUE; } +/* + * @unimplemented + */ +BOOL +WINAPI +CreateJobSet ( + ULONG NumJob, + PJOB_SET_ARRAY UserJobSet, + ULONG Flags) +{ + STUB; + return 0; +} + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/loader.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/loader.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -1168,4 +1168,33 @@ return GetLastError(); } +/* + * @unimplemented + */ +FARPROC WINAPI DelayLoadFailureHook(LPCSTR pszDllName, LPCSTR pszProcName) +{ + STUB; + return NULL; +} + +/* + * @unimplemented + */ +BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, + LPSTR lpszInitName, LPSTR lpszProcName, + FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, + LPVOID lpBuff ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +VOID WINAPI UTUnRegister( HMODULE hModule ) +{ + STUB; +} + /* EOF */ Removed: trunk/reactos/dll/win32/kernel32/client/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/misc/stubs.c (removed) @@ -1,1381 +1,0 @@ -/* - * KERNEL32.DLL stubs (STUB functions) - * Remove from this file, if you implement them. - */ - -#include <k32.h> - -#define NDEBUG -#include <debug.h> - -#define STUB \ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \ - DPRINT1("%s() is UNIMPLEMENTED!\n", __FUNCTION__) - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseAttachCompleteThunk (VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseDumpAppcompatCache(VOID) -{ - STUB; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseFlushAppcompatCache(VOID) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseCheckAppcompatCache(ULONG Unknown1, - ULONG Unknown2, - ULONG Unknown3, - PULONG Unknown4) -{ - STUB; - if (Unknown4) *Unknown4 = 0; - return TRUE; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseUpdateAppcompatCache(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -CmdBatNotification ( - DWORD Unknown - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -CreateVirtualBuffer ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -ExitVDM ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -ExtendVirtualBuffer ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -FreeVirtualBuffer ( - HANDLE hVirtualBuffer - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -GetNextVDMCommand ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -GetVDMCurrentDirectories ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterConsoleVDM ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3, - DWORD Unknown4, - DWORD Unknown5, - DWORD Unknown6, - DWORD Unknown7, - DWORD Unknown8, - DWORD Unknown9, - DWORD Unknown10 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterWowBaseHandlers ( - DWORD Unknown0 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterWowExec ( - DWORD Unknown0 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVDMCurrentDirectories ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -TrimVirtualBuffer ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -VDMConsoleOperation ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -VDMOperationStarted ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -VirtualBufferExceptionHandler ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2 - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -BindIoCompletionCallback(HANDLE FileHandle, - LPOVERLAPPED_COMPLETION_ROUTINE Function, - ULONG Flags) -{ - NTSTATUS Status = 0; - - DPRINT("(%p, %p, %d)\n", FileHandle, Function, Flags); - - Status = RtlSetIoCompletionCallback(FileHandle, - (PIO_APC_ROUTINE)Function, - Flags); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -CreateJobSet ( - ULONG NumJob, - PJOB_SET_ARRAY UserJobSet, - ULONG Flags) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindVolumeMountPointClose( - HANDLE hFindVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaHighestNodeNumber( - PULONG HighestNodeNumber - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaNodeProcessorMask( - UCHAR Node, - PULONGLONG ProcessorMask - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaProcessorNode( - UCHAR Processor, - PUCHAR NodeNumber - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -ReadFileScatter(HANDLE hFile, - FILE_SEGMENT_ELEMENT aSegmentArray[], - DWORD nNumberOfBytesToRead, - LPDWORD lpReserved, - LPOVERLAPPED lpOverlapped) -{ - PIO_STATUS_BLOCK pIOStatus; - LARGE_INTEGER Offset; - NTSTATUS Status; - - DPRINT("(%p %p %u %p)\n", hFile, aSegmentArray, nNumberOfBytesToRead, lpOverlapped); - - Offset.LowPart = lpOverlapped->Offset; - Offset.HighPart = lpOverlapped->OffsetHigh; - pIOStatus = (PIO_STATUS_BLOCK) lpOverlapped; - pIOStatus->Status = STATUS_PENDING; - pIOStatus->Information = 0; - - Status = NtReadFileScatter(hFile, - NULL, - NULL, - NULL, - pIOStatus, - aSegmentArray, - nNumberOfBytesToRead, - &Offset, - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -VOID -WINAPI -RestoreLastError( - DWORD dwErrCode - ) -{ - STUB; -} - -/* - * @implemented - */ -BOOL -WINAPI -WriteFileGather(HANDLE hFile, - FILE_SEGMENT_ELEMENT aSegmentArray[], - DWORD nNumberOfBytesToWrite, - LPDWORD lpReserved, - LPOVERLAPPED lpOverlapped) -{ - PIO_STATUS_BLOCK IOStatus; - LARGE_INTEGER Offset; - NTSTATUS Status; - - DPRINT("%p %p %u %p\n", hFile, aSegmentArray, nNumberOfBytesToWrite, lpOverlapped); - - Offset.LowPart = lpOverlapped->Offset; - Offset.HighPart = lpOverlapped->OffsetHigh; - IOStatus = (PIO_STATUS_BLOCK) lpOverlapped; - IOStatus->Status = STATUS_PENDING; - IOStatus->Information = 0; - - Status = NtWriteFileGather(hFile, - NULL, - NULL, - NULL, - IOStatus, - aSegmentArray, - nNumberOfBytesToWrite, - &Offset, - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -DeleteVolumeMountPointW( - LPCWSTR lpszVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -FindFirstVolumeMountPointW( - LPCWSTR lpszRootPathName, - LPWSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -FindNextVolumeW( - HANDLE handle, - LPWSTR volume, - DWORD len - ) -{ - MOUNTMGR_MOUNT_POINTS *data = handle; - - while (data->Size < data->NumberOfMountPoints) - { - static const WCHAR volumeW[] = {'\\','?','?','\\','V','o','l','u','m','e','{',}; - WCHAR *link = (WCHAR *)((char *)data + data->MountPoints[data->Size].SymbolicLinkNameOffset); - DWORD size = data->MountPoints[data->Size].SymbolicLinkNameLength; - data->Size++; - /* skip non-volumes */ - if (size < sizeof(volumeW) || memcmp( link, volumeW, sizeof(volumeW) )) continue; - if (size + sizeof(WCHAR) >= len * sizeof(WCHAR)) - { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return FALSE; - } - memcpy( volume, link, size ); - volume[1] = '\\'; /* map \??\ to \\?\ */ - volume[size / sizeof(WCHAR)] = '\\'; /* Windows appends a backslash */ - volume[size / sizeof(WCHAR) + 1] = 0; - DPRINT( "returning entry %u %s\n", data->Size - 1, volume ); - return TRUE; - } - SetLastError( ERROR_NO_MORE_FILES ); - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindNextVolumeMountPointW( - HANDLE hFindVolumeMountPoint, - LPWSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -GetFirmwareEnvironmentVariableW( - LPCWSTR lpName, - LPCWSTR lpGuid, - PVOID pBuffer, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetVolumePathNamesForVolumeNameW( - LPCWSTR lpszVolumeName, - LPWSTR lpszVolumePathNames, - DWORD cchBufferLength, - PDWORD lpcchReturnLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetFirmwareEnvironmentVariableW( - LPCWSTR lpName, - LPCWSTR lpGuid, - PVOID pValue, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVolumeMountPointW( - LPCWSTR lpszVolumeMountPoint, - LPCWSTR lpszVolumeName - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -DeleteVolumeMountPointA( - LPCSTR lpszVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -FindFirstVolumeMountPointA( - LPCSTR lpszRootPathName, - LPSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -FindNextVolumeA(HANDLE handle, - LPSTR volume, - DWORD len) -{ - WCHAR *buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, len * sizeof(WCHAR)); - BOOL ret; - - if (!buffer) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - if ((ret = FindNextVolumeW( handle, buffer, len ))) - { - if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE; - } - - HeapFree( GetProcessHeap(), 0, buffer ); - return ret; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindNextVolumeMountPointA( - HANDLE hFindVolumeMountPoint, - LPSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -GetFirmwareEnvironmentVariableA( - LPCSTR lpName, - LPCSTR lpGuid, - PVOID pBuffer, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetVolumePathNamesForVolumeNameA( - LPCSTR lpszVolumeName, - LPSTR lpszVolumePathNames, - DWORD cchBufferLength, - PDWORD lpcchReturnLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetFirmwareEnvironmentVariableA( - LPCSTR lpName, - LPCSTR lpGuid, - PVOID pValue, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVolumeMountPointA( - LPCSTR lpszVolumeMountPoint, - LPCSTR lpszVolumeName - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR name) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR name) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD WINAPI GetHandleContext(HANDLE hnd) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE WINAPI CreateSocketHandle(VOID) -{ - STUB; - return INVALID_HANDLE_VALUE; -} - -/* - * @unimplemented - */ -BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, - LPSTR lpszInitName, LPSTR lpszProcName, - FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, - LPVOID lpBuff ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -VOID WINAPI UTUnRegister( HMODULE hModule ) -{ - STUB; -} - -/* - * @unimplemented - */ -FARPROC WINAPI DelayLoadFailureHook(LPCSTR pszDllName, LPCSTR pszProcName) -{ - STUB; - return NULL; -} - -/* - * @unimplemented - */ -NTSTATUS WINAPI CreateNlsSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,ULONG Size,ULONG AccessMask) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI IsValidUILanguage(LANGID langid) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -VOID WINAPI NlsConvertIntegerToString(ULONG Value,ULONG Base,ULONG strsize, LPWSTR str, ULONG strsize2) -{ - STUB; -} - -/* - * @unimplemented - */ -UINT WINAPI SetCPGlobal(UINT CodePage) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetClientTimeZoneInformation( - CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) -{ - STUB; - return 0; -} - -ULONG -WINAPI -NlsGetCacheUpdateCount(VOID) -{ - STUB; - return 0; -} - -BOOLEAN -WINAPI -Wow64EnableWow64FsRedirection (BOOLEAN Wow64EnableWow64FsRedirection) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -Wow64DisableWow64FsRedirection (VOID ** pv) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -Wow64RevertWow64FsRedirection (VOID * pv) -{ - STUB; - return FALSE; -} - -UINT -WINAPI -EnumSystemFirmwareTables(IN DWORD FirmwareTableProviderSignature, - OUT PVOID pFirmwareTableBuffer, - IN DWORD BufferSize) -{ - STUB; - return 0; -} - -BOOL -WINAPI -GetSystemFileCacheSize(OUT PSIZE_T lpMinimumFileCacheSize, - OUT PSIZE_T lpMaximumFileCacheSize, - OUT PDWORD lpFlags) -{ - STUB; - return FALSE; -} - -UINT -WINAPI -GetSystemFirmwareTable(IN DWORD FirmwareTableProviderSignature, - IN DWORD FirmwareTableID, - OUT PVOID pFirmwareTableBuffer, - IN DWORD BufferSize) -{ - STUB; - return 0; -} - -BOOL -WINAPI -SetSystemFileCacheSize(IN SIZE_T MinimumFileCacheSize, - IN SIZE_T MaximumFileCacheSize, - IN DWORD Flags) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetThreadStackGuarantee(IN OUT PULONG StackSizeInBytes) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetProcessWorkingSetSizeEx(IN HANDLE hProcess, - IN SIZE_T dwMinimumWorkingSetSize, - IN SIZE_T dwMaximumWorkingSetSize, - IN DWORD Flags) -{ - STUB; - return FALSE; -} - - -BOOL -WINAPI -GetProcessWorkingSetSizeEx(IN HANDLE hProcess, - OUT PSIZE_T lpMinimumWorkingSetSize, - OUT PSIZE_T lpMaximumWorkingSetSize, - OUT PDWORD Flags) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaAvailableMemoryNode(IN UCHAR Node, - OUT PULONGLONG AvailableBytes) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaAvailableMemory(PVOID lpInfo, - ULONG Length, - PULONG ReturnLength) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaProcessorMap(PVOID lpInfo, - ULONG Length, - PULONG ReturnLength) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -NlsResetProcessLocale(VOID) -{ - STUB; - return TRUE; -} - -DWORD -WINAPI -AddLocalAlternateComputerNameA(LPSTR lpName, PNTSTATUS Status) -{ - STUB; - return 0; -} - -DWORD -WINAPI -AddLocalAlternateComputerNameW(LPWSTR lpName, PNTSTATUS Status) -{ - STUB; - return 0; -} - -NTSTATUS -WINAPI -BaseCleanupAppcompatCache(VOID) -{ - STUB; - return STATUS_NOT_IMPLEMENTED; -} - -NTSTATUS -WINAPI -BaseCleanupAppcompatCacheSupport(PVOID pUnknown) -{ - STUB; - return STATUS_NOT_IMPLEMENTED; -} - -BOOL -WINAPI -BaseInitAppcompatCache(VOID) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -BaseInitAppcompatCacheSupport(VOID) -{ - STUB; - return FALSE; -} - -VOID -WINAPI -CreateProcessInternalWSecure(VOID) -{ - STUB; -} - -DWORD -WINAPI -EnumerateLocalComputerNamesA(PVOID pUnknown, DWORD Size, LPSTR lpBuffer, LPDWORD lpnSize) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -DWORD -WINAPI -EnumerateLocalComputerNamesW(PVOID pUnknown, DWORD Size, LPWSTR lpBuffer, LPDWORD lpnSize) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -PVOID -WINAPI -GetComPlusPackageInstallStatus(VOID) -{ - STUB; - return NULL; -} - -BOOL -WINAPI -GetConsoleCharType(HANDLE hConsole, COORD Coord, PDWORD Type) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetConsoleCursorMode(HANDLE hConsole, PBOOL pUnknown1, PBOOL pUnknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetConsoleNlsMode(HANDLE hConsole, LPDWORD lpMode) -{ - STUB; - return FALSE; -} - -VOID -WINAPI -GetDefaultSortkeySize(LPVOID lpUnknown) -{ - STUB; - lpUnknown = NULL; -} - -VOID -WINAPI -GetLinguistLangSize(LPVOID lpUnknown) -{ - STUB; - lpUnknown = NULL; -} - -BOOL -WINAPI -OpenDataFile(HANDLE hFile, DWORD dwUnused) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -PrivMoveFileIdentityW(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -ReadConsoleInputExA(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -ReadConsoleInputExW(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -RegisterConsoleIME(HWND hWnd, LPDWORD ThreadId) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -RegisterConsoleOS2(BOOL bUnknown) -{ - STUB; - return FALSE; -} - -DWORD -WINAPI -RemoveLocalAlternateComputerNameA(LPSTR lpName, DWORD Unknown) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -DWORD -WINAPI -RemoveLocalAlternateComputerNameW(LPWSTR lpName, DWORD Unknown) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -BOOL -WINAPI -SetComPlusPackageInstallStatus(LPVOID lpInfo) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleCursorMode(HANDLE hConsole, BOOL Unknown1, BOOL Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleLocalEUDC(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3, DWORD Unknown4) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleNlsMode(HANDLE hConsole, DWORD dwMode) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleOS2OemFormat(BOOL bUnknown) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -UnregisterConsoleIME(VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseCheckRunApp(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4, - IN DWORD Unknown5, - IN DWORD Unknown6, - IN DWORD Unknown7, - IN DWORD Unknown8, - IN DWORD Unknown9, - IN DWORD Unknown10) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BasepCheckWinSaferRestrictions(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4, - IN DWORD Unknown5, - IN DWORD Unknown6) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -NumaVirtualQueryNode(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -ReOpenFile(IN HANDLE hOriginalFile, - IN DWORD dwDesiredAccess, - IN DWORD dwShareMode, - IN DWORD dwFlags) -{ - STUB; - return INVALID_HANDLE_VALUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLastConsoleEventActive(VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetConsoleCommandHistoryMode(IN DWORD dwMode) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLocalPrimaryComputerNameA(IN DWORD Unknown1, - IN DWORD Unknown2) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLocalPrimaryComputerNameW(IN DWORD Unknown1, - IN DWORD Unknown2) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -VOID -WINAPI -SetTermsrvAppInstallMode(IN BOOL bInstallMode) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -TermsrvAppInstallMode(VOID) -{ - STUB; - return FALSE; -} Modified: trunk/reactos/dll/win32/kernel32/client/misc/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/misc/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/misc/time.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -795,4 +795,16 @@ return TRUE; } +/* + * @unimplemented + */ +BOOL +WINAPI +SetClientTimeZoneInformation( + CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) +{ + STUB; + return 0; +} + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/proc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -2141,6 +2141,29 @@ } SetLastErrorByStatus(Status); + return FALSE; +} + +BOOL +WINAPI +SetProcessWorkingSetSizeEx(IN HANDLE hProcess, + IN SIZE_T dwMinimumWorkingSetSize, + IN SIZE_T dwMaximumWorkingSetSize, + IN DWORD Flags) +{ + STUB; + return FALSE; +} + + +BOOL +WINAPI +GetProcessWorkingSetSizeEx(IN HANDLE hProcess, + OUT PSIZE_T lpMinimumWorkingSetSize, + OUT PSIZE_T lpMaximumWorkingSetSize, + OUT PDWORD Flags) +{ + STUB; return FALSE; } Modified: trunk/reactos/dll/win32/kernel32/client/synch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/synch.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/synch.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -1351,4 +1351,152 @@ return TRUE; } + +/* + * @implemented + */ +VOID WINAPI +Sleep(DWORD dwMilliseconds) +{ + SleepEx(dwMilliseconds, FALSE); + return; +} + + +/* + * @implemented + */ +DWORD WINAPI +SleepEx(DWORD dwMilliseconds, + BOOL bAlertable) +{ + LARGE_INTEGER Interval; + NTSTATUS errCode; + + if (dwMilliseconds != INFINITE) + { + /* + * System time units are 100 nanoseconds (a nanosecond is a billionth of + * a second). + */ + Interval.QuadPart = -((LONGLONG)dwMilliseconds * 10000); + } + else + { + /* Approximately 292000 years hence */ + Interval.QuadPart = -0x7FFFFFFFFFFFFFFFLL; + } + +dowait: + errCode = NtDelayExecution ((BOOLEAN)bAlertable, &Interval); + if ((bAlertable) && (errCode == STATUS_ALERTED)) goto dowait; + return (errCode == STATUS_USER_APC) ? WAIT_IO_COMPLETION : 0; +} + + +/* + * @implemented + */ +BOOL +WINAPI +RegisterWaitForSingleObject( + PHANDLE phNewWaitObject, + HANDLE hObject, + WAITORTIMERCALLBACK Callback, + PVOID Context, + ULONG dwMilliseconds, + ULONG dwFlags + ) +{ + NTSTATUS Status = RtlRegisterWait(phNewWaitObject, + hObject, + Callback, + Context, + dwMilliseconds, + dwFlags); + + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + return TRUE; +} + + +/* + * @implemented + */ +HANDLE +WINAPI +RegisterWaitForSingleObjectEx( + HANDLE hObject, + WAITORTIMERCALLBACK Callback, + PVOID Context, + ULONG dwMilliseconds, + ULONG dwFlags + ) +{ + NTSTATUS Status; + HANDLE hNewWaitObject; + + Status = RtlRegisterWait(&hNewWaitObject, + hObject, + Callback, + Context, + dwMilliseconds, + dwFlags); + + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return NULL; + } + + return hNewWaitObject; +} + + +/* + * @implemented + */ +BOOL +WINAPI +UnregisterWait( + HANDLE WaitHandle + ) +{ + NTSTATUS Status = RtlDeregisterWaitEx(WaitHandle, NULL); + + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +UnregisterWaitEx( + HANDLE WaitHandle, + HANDLE CompletionEvent + ) +{ + NTSTATUS Status = RtlDeregisterWaitEx(WaitHandle, CompletionEvent); + + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + /* EOF */ Modified: trunk/reactos/dll/win32/kernel32/client/sysinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/sysinfo.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/sysinfo.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -268,3 +268,160 @@ return TRUE; } + +/* + * @unimplemented + */ +BOOL +WINAPI +GetNumaHighestNodeNumber( + PULONG HighestNodeNumber + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetNumaNodeProcessorMask( + UCHAR Node, + PULONGLONG ProcessorMask + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetNumaProcessorNode( + UCHAR Processor, + PUCHAR NodeNumber + ) +{ + STUB; + return 0; +} + +BOOL +WINAPI +GetNumaAvailableMemoryNode(IN UCHAR Node, + OUT PULONGLONG AvailableBytes) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +GetFirmwareEnvironmentVariableW( + LPCWSTR lpName, + LPCWSTR lpGuid, + PVOID pBuffer, + DWORD nSize + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetFirmwareEnvironmentVariableW( + LPCWSTR lpName, + LPCWSTR lpGuid, + PVOID pValue, + DWORD nSize + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +GetFirmwareEnvironmentVariableA( + LPCSTR lpName, + LPCSTR lpGuid, + PVOID pBuffer, + DWORD nSize + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetFirmwareEnvironmentVariableA( + LPCSTR lpName, + LPCSTR lpGuid, + PVOID pValue, + DWORD nSize + ) +{ + STUB; + return 0; +} + +UINT +WINAPI +EnumSystemFirmwareTables(IN DWORD FirmwareTableProviderSignature, + OUT PVOID pFirmwareTableBuffer, + IN DWORD BufferSize) +{ + STUB; + return 0; +} + +UINT +WINAPI +GetSystemFirmwareTable(IN DWORD FirmwareTableProviderSignature, + IN DWORD FirmwareTableID, + OUT PVOID pFirmwareTableBuffer, + IN DWORD BufferSize) +{ + STUB; + return 0; +} + +BOOL +WINAPI +GetSystemFileCacheSize(OUT PSIZE_T lpMinimumFileCacheSize, + OUT PSIZE_T lpMaximumFileCacheSize, + OUT PDWORD lpFlags) +{ + STUB; + return FALSE; +} + + +BOOL +WINAPI +SetSystemFileCacheSize(IN SIZE_T MinimumFileCacheSize, + IN SIZE_T MaximumFileCacheSize, + IN DWORD Flags) +{ + STUB; + return FALSE; +} + Modified: trunk/reactos/dll/win32/kernel32/client/thread.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/thread.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/thread.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -816,6 +816,15 @@ return 1; } +BOOL +WINAPI +SetThreadStackGuarantee(IN OUT PULONG StackSizeInBytes) +{ + STUB; + return FALSE; +} + + /* * @implemented */ @@ -848,48 +857,6 @@ } -/* - * @implemented - */ -VOID WINAPI -Sleep(DWORD dwMilliseconds) -{ - SleepEx(dwMilliseconds, FALSE); - return; -} - - -/* - * @implemented - */ -DWORD WINAPI -SleepEx(DWORD dwMilliseconds, - BOOL bAlertable) -{ - LARGE_INTEGER Interval; - NTSTATUS errCode; - - if (dwMilliseconds != INFINITE) - { - /* - * System time units are 100 nanoseconds (a nanosecond is a billionth of - * a second). - */ - Interval.QuadPart = -((LONGLONG)dwMilliseconds * 10000); - } - else - { - /* Approximately 292000 years hence */ - Interval.QuadPart = -0x7FFFFFFFFFFFFFFFLL; - } - -dowait: - errCode = NtDelayExecution ((BOOLEAN)bAlertable, &Interval); - if ((bAlertable) && (errCode == STATUS_ALERTED)) goto dowait; - return (errCode == STATUS_USER_APC) ? WAIT_IO_COMPLETION : 0; -} - - typedef struct _QUEUE_USER_WORKITEM_CONTEXT { LPTHREAD_START_ROUTINE Function; @@ -957,112 +924,6 @@ 0, WorkItemContext); - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -RegisterWaitForSingleObject( - PHANDLE phNewWaitObject, - HANDLE hObject, - WAITORTIMERCALLBACK Callback, - PVOID Context, - ULONG dwMilliseconds, - ULONG dwFlags - ) -{ - NTSTATUS Status = RtlRegisterWait(phNewWaitObject, - hObject, - Callback, - Context, - dwMilliseconds, - dwFlags); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - return TRUE; -} - - -/* - * @implemented - */ -HANDLE -WINAPI -RegisterWaitForSingleObjectEx( - HANDLE hObject, - WAITORTIMERCALLBACK Callback, - PVOID Context, - ULONG dwMilliseconds, - ULONG dwFlags - ) -{ - NTSTATUS Status; - HANDLE hNewWaitObject; - - Status = RtlRegisterWait(&hNewWaitObject, - hObject, - Callback, - Context, - dwMilliseconds, - dwFlags); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - return hNewWaitObject; -} - - -/* - * @implemented - */ -BOOL -WINAPI -UnregisterWait( - HANDLE WaitHandle - ) -{ - NTSTATUS Status = RtlDeregisterWaitEx(WaitHandle, NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -UnregisterWaitEx( - HANDLE WaitHandle, - HANDLE CompletionEvent - ) -{ - NTSTATUS Status = RtlDeregisterWaitEx(WaitHandle, CompletionEvent); - - if (!NT_SUCCESS(Status)) - { SetLastErrorByStatus(Status); return FALSE; } Modified: trunk/reactos/dll/win32/kernel32/client/utils.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/utils.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/utils.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -488,3 +488,39 @@ DPRINT("Section: %lx for file: %lx\n", *hSection, hFile); return Status; } + +/* + * @unimplemented + */ +BOOL +WINAPI +BaseCheckRunApp(IN DWORD Unknown1, + IN DWORD Unknown2, + IN DWORD Unknown3, + IN DWORD Unknown4, + IN DWORD Unknown5, + IN DWORD Unknown6, + IN DWORD Unknown7, + IN DWORD Unknown8, + IN DWORD Unknown9, + IN DWORD Unknown10) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +BasepCheckWinSaferRestrictions(IN DWORD Unknown1, + IN DWORD Unknown2, + IN DWORD Unknown3, + IN DWORD Unknown4, + IN DWORD Unknown5, + IN DWORD Unknown6) +{ + STUB; + return FALSE; +} Added: trunk/reactos/dll/win32/kernel32/client/vdm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/vdm.c (added) +++ trunk/reactos/dll/win32/kernel32/client/vdm.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -1,0 +1,245 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/kernel32/client/vdm.c + * PURPOSE: Virtual Dos Machine (VDM) Support + * PROGRAMMERS: Alex Ionescu (alex.ionescu(a)reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include <k32.h> + +#define NDEBUG +#include <debug.h> + +/* TYPES **********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +/* + * @unimplemented + */ +BOOL +WINAPI +CmdBatNotification ( + DWORD Unknown + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +CreateVirtualBuffer ( + DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +ExitVDM ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +ExtendVirtualBuffer ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +FreeVirtualBuffer ( + HANDLE hVirtualBuffer + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +GetNextVDMCommand ( + DWORD Unknown0 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +GetVDMCurrentDirectories ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +RegisterConsoleVDM ( + DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3, + DWORD Unknown4, + DWORD Unknown5, + DWORD Unknown6, + DWORD Unknown7, + DWORD Unknown8, + DWORD Unknown9, + DWORD Unknown10 + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +RegisterWowBaseHandlers ( + DWORD Unknown0 + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +RegisterWowExec ( + DWORD Unknown0 + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +SetVDMCurrentDirectories ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +TrimVirtualBuffer ( + DWORD Unknown0 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +VDMConsoleOperation ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +VDMOperationStarted ( + DWORD Unknown0 + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +VirtualBufferExceptionHandler ( + DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2 + ) +{ + STUB; + return 0; +} Propchange: trunk/reactos/dll/win32/kernel32/client/vdm.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/reactos/dll/win32/kernel32/k32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/k32.h?r…
============================================================================== --- trunk/reactos/dll/win32/kernel32/k32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/k32.h [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -42,4 +42,8 @@ /* PSEH for SEH Support */ #include <pseh/pseh2.h> +#define STUB \ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \ + DPRINT1("%s() is UNIMPLEMENTED!\n", __FUNCTION__) + #endif Modified: trunk/reactos/dll/win32/kernel32/kernel32.pspec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.pspec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.pspec [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -72,8 +72,6 @@ ;@ stdcall CallbackMayRunLong ; Win 7 @ stdcall CancelDeviceWakeupRequest(long) @ stdcall CancelIo(long) -@ stdcall CancelIoEx(long ptr) -@ stdcall CancelSynchronousIo(long) ;@ stdcall CancelThreadpoolIo(ptr) ntdll.TpCancelAsyncIoOperation; Win 7 @ stdcall CancelTimerQueueTimer(long long) @ stdcall CancelWaitableTimer(long) @@ -177,7 +175,6 @@ ;@ stdcall CreateProcessAsUserW ; Win 7 @ stdcall CreateProcessInternalA(ptr str str ptr ptr long long ptr str ptr ptr long) @ stdcall CreateProcessInternalW(ptr wstr wstr ptr ptr long long ptr wstr ptr ptr long) -@ stdcall CreateProcessInternalWSecure() ; missing in Win 7 @ stdcall CreateProcessW(wstr wstr ptr ptr long long ptr wstr ptr ptr) @ stdcall CreateRemoteThread(long ptr long ptr long long ptr) ;@ stdcall CreateRemoteThreadEx api-ms-win-core-processthreads-l1-1-0.CreateRemoteThreadEx ; Win 7 @@ -572,14 +569,12 @@ ;@ stdcall -arch=x86_64 GetNextUmsListItem @ stdcall GetNextVDMCommand(long) @ stdcall GetNlsSectionName(long long long str str long) ; missing in Win 7 -@ stdcall GetNumaAvailableMemory(ptr long ptr) ; missing in Win 7 @ stdcall GetNumaAvailableMemoryNode(long ptr) ;@ stdcall GetNumaAvailableMemoryNodeEx ; Win 7 @ stdcall GetNumaHighestNodeNumber(ptr) ;@ stdcall GetNumaNodeNumberFromHandle ; Win 7 @ stdcall GetNumaNodeProcessorMask(long ptr) ;@ stdcall GetNumaNodeProcessorMaskEx ; Win 7 -@ stdcall GetNumaProcessorMap(ptr long ptr) ; missing in Win 7 @ stdcall GetNumaProcessorNode(long ptr) ;@ stdcall GetNumaProcessorNodeEx ; Win 7 ;@ stdcall GetNumaProximityNode ; Win 7 @@ -921,7 +916,6 @@ ;@ stdcall NotifyMountMgr ; Win 7 @ stub NotifyNLSUserCache ; missing in XP SP3 and win 7 ;@ stdcall NotifyUILanguageChange ; Win 7 -@ stdcall NumaVirtualQueryNode(long long long long) ; missing in win 7 @ stdcall OpenConsoleW(wstr long long long) @ stdcall OpenDataFile(long long) ; missing in Win 7 @ stdcall OpenEventA(long long str) Modified: trunk/reactos/dll/win32/kernel32/kernel32.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -25,6 +25,7 @@ <file>thread.S</file> </directory> </if> + <file>appcache.c</file> <file>atom.c</file> <file>compname.c</file> <file>debugger.c</file> @@ -46,6 +47,7 @@ <file>timerqueue.c</file> <file>thread.c</file> <file>utils.c</file> + <file>vdm.c</file> <file>version.c</file> <file>virtmem.c</file> <file>vista.c</file> @@ -83,7 +85,6 @@ <file>muldiv.c</file> <file>profile.c</file> <file>res.c</file> - <file>stubs.c</file> <file>time.c</file> <file>toolhelp.c</file> </directory> Modified: trunk/reactos/dll/win32/kernel32/kernel32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel3…
============================================================================== --- trunk/reactos/dll/win32/kernel32/kernel32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/kernel32.spec [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -70,8 +70,6 @@ ;@ stdcall CallbackMayRunLong ; Win 7 @ stdcall CancelDeviceWakeupRequest(long) @ stdcall CancelIo(long) -@ stdcall CancelIoEx(long ptr) -@ stdcall CancelSynchronousIo(long) ;@ stdcall CancelThreadpoolIo(ptr) ntdll.TpCancelAsyncIoOperation; Win 7 @ stdcall CancelTimerQueueTimer(long long) @ stdcall CancelWaitableTimer(long) @@ -175,7 +173,6 @@ ;@ stdcall CreateProcessAsUserW ; Win 7 @ stdcall CreateProcessInternalA(ptr str str ptr ptr long long ptr str ptr ptr long) @ stdcall CreateProcessInternalW(ptr wstr wstr ptr ptr long long ptr wstr ptr ptr long) -@ stdcall CreateProcessInternalWSecure() ; missing in Win 7 @ stdcall CreateProcessW(wstr wstr ptr ptr long long ptr wstr ptr ptr) @ stdcall CreateRemoteThread(long ptr long ptr long long ptr) ;@ stdcall CreateRemoteThreadEx api-ms-win-core-processthreads-l1-1-0.CreateRemoteThreadEx ; Win 7 @@ -570,14 +567,12 @@ ;@ stdcall -arch=x86_64 GetNextUmsListItem @ stdcall GetNextVDMCommand(long) @ stdcall GetNlsSectionName(long long long str str long) ; missing in Win 7 -@ stdcall GetNumaAvailableMemory(ptr long ptr) ; missing in Win 7 @ stdcall GetNumaAvailableMemoryNode(long ptr) ;@ stdcall GetNumaAvailableMemoryNodeEx ; Win 7 @ stdcall GetNumaHighestNodeNumber(ptr) ;@ stdcall GetNumaNodeNumberFromHandle ; Win 7 @ stdcall GetNumaNodeProcessorMask(long ptr) ;@ stdcall GetNumaNodeProcessorMaskEx ; Win 7 -@ stdcall GetNumaProcessorMap(ptr long ptr) ; missing in Win 7 @ stdcall GetNumaProcessorNode(long ptr) ;@ stdcall GetNumaProcessorNodeEx ; Win 7 ;@ stdcall GetNumaProximityNode ; Win 7 @@ -919,7 +914,6 @@ ;@ stdcall NotifyMountMgr ; Win 7 ;@ stub NotifyNLSUserCache ; missing in XP SP3 and win 7 ;@ stdcall NotifyUILanguageChange ; Win 7 -@ stdcall NumaVirtualQueryNode(long long long long) ; missing in win 7 @ stdcall OpenConsoleW(wstr long long long) @ stdcall OpenDataFile(long long) ; missing in Win 7 @ stdcall OpenEventA(long long str) Modified: trunk/reactos/dll/win32/kernel32/winnls/string/nls.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/winnls/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/winnls/string/nls.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/winnls/string/nls.c [iso-8859-1] Fri Jul 22 02:13:57 2011 @@ -2031,4 +2031,71 @@ return IntIsLeadByte(&AnsiCodePage.CodePageTable, TestByte); } +/* + * @unimplemented + */ +NTSTATUS WINAPI CreateNlsSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,ULONG Size,ULONG AccessMask) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL WINAPI IsValidUILanguage(LANGID langid) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +VOID WINAPI NlsConvertIntegerToString(ULONG Value,ULONG Base,ULONG strsize, LPWSTR str, ULONG strsize2) +{ + STUB; +} + +/* + * @unimplemented + */ +UINT WINAPI SetCPGlobal(UINT CodePage) +{ + STUB; + return 0; +} + +BOOL +WINAPI +NlsResetProcessLocale(VOID) +{ + STUB; + return TRUE; +} + +VOID +WINAPI +GetDefaultSortkeySize(LPVOID lpUnknown) +{ + STUB; + lpUnknown = NULL; +} + +VOID +WINAPI +GetLinguistLangSize(LPVOID lpUnknown) +{ + STUB; + lpUnknown = NULL; +} + +ULONG +WINAPI +NlsGetCacheUpdateCount(VOID) +{ + STUB; + return 0; +} + /* EOF */
13 years, 5 months
1
0
0
0
[spetreolle] 52769: [ROSTESTS] Add 3 missing tests to rbuild testcd. Thanks to Caemyr and Testman.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Thu Jul 21 23:14:57 2011 New Revision: 52769 URL:
http://svn.reactos.org/svn/reactos?rev=52769&view=rev
Log: [ROSTESTS] Add 3 missing tests to rbuild testcd. Thanks to Caemyr and Testman. Modified: trunk/reactos/boot/bootdata/packages/reactos.dff Modified: trunk/reactos/boot/bootdata/packages/reactos.dff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/packages/rea…
============================================================================== --- trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/packages/reactos.dff [iso-8859-1] Thu Jul 21 23:14:57 2011 @@ -801,6 +801,7 @@ modules\rostests\winetests\gdiplus\gdiplus_winetest.exe 7 optional modules\rostests\winetests\hlink\hlink_winetest.exe 7 optional modules\rostests\winetests\icmp\icmp_winetest.exe 7 optional +modules\rostests\winetests\imagehlp\imagehlp_winetest.exe 7 optional modules\rostests\winetests\imm32\imm32_winetest.exe 7 optional modules\rostests\winetests\inetcomm\inetcomm_winetest.exe 7 optional modules\rostests\winetests\inetmib1\inetmib1_winetest.exe 7 optional @@ -855,6 +856,7 @@ modules\rostests\winetests\twain_32\twain_32_winetest.exe 7 optional modules\rostests\winetests\urlmon\urlmon_winetest.exe 7 optional modules\rostests\winetests\user32\user32_winetest.exe 7 optional +modules\rostests\winetests\userenv\userenv_winetest.exe 7 optional modules\rostests\winetests\usp10\usp10_winetest.exe 7 optional modules\rostests\winetests\uxtheme\uxtheme_winetest.exe 7 optional modules\rostests\winetests\version\version_winetest.exe 7 optional @@ -869,6 +871,7 @@ modules\rostests\apitests\dciman32\dciman32_apitest.exe 7 optional modules\rostests\apitests\gdi32\gdi32_apitest.exe 7 optional +modules\rostests\apitests\kernel32\kernel32_apitest.exe 7 optional modules\rostests\apitests\ntdll\ntdll_apitest.exe 7 optional modules\rostests\apitests\user32\user32_apitest.exe 7 optional modules\rostests\apitests\ws2_32\ws2_32_apitest.exe 7 optional
13 years, 5 months
1
0
0
0
[jgardou] 52768: [SPEC2DEF] - fix forward name export for c++ mangled functions.
by jgardou@svn.reactos.org
Author: jgardou Date: Thu Jul 21 21:13:28 2011 New Revision: 52768 URL:
http://svn.reactos.org/svn/reactos?rev=52768&view=rev
Log: [SPEC2DEF] - fix forward name export for c++ mangled functions. Modified: trunk/reactos/tools/spec2def/spec2def.c Modified: trunk/reactos/tools/spec2def/spec2def.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/spec2def/spec2def.c?…
============================================================================== --- trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] (original) +++ trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] Thu Jul 21 21:13:28 2011 @@ -348,7 +348,7 @@ { /* C++ stubs are forwarded to C stubs */ fprintf(fileDest, "="); - fprintf(fileDest, "stub_function%d(", pexp->nNumber); + fprintf(fileDest, "stub_function%d", pexp->nNumber); } else if ((giArch == ARCH_X86) && gbKillAt && !gbMSComp && (pexp->nCallingConvention == CC_STDCALL ||
13 years, 5 months
1
0
0
0
[cmihail] 52767: [lwIP] - Modify the signatures of the lwIP wrapper interfaces. This is the first step toward fixing some nasty crashes related to race conditions. [TCPIP] - Call the new lwIP wrapp...
by cmihail@svn.reactos.org
Author: cmihail Date: Thu Jul 21 20:58:54 2011 New Revision: 52767 URL:
http://svn.reactos.org/svn/reactos?rev=52767&view=rev
Log: [lwIP] - Modify the signatures of the lwIP wrapper interfaces. This is the first step toward fixing some nasty crashes related to race conditions. [TCPIP] - Call the new lwIP wrapper interfaces appropriately. Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/accept.c branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/CMakeLists.txt branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/include/rosip.h branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/accept.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/accept.c [iso-8859-1] Thu Jul 21 20:58:54 2011 @@ -67,7 +67,7 @@ AddressToBind.addr = Connection->AddressFile->Address.Address.IPv4Address; - Status = TCPTranslateError(LibTCPBind(Connection->SocketContext, + Status = TCPTranslateError(LibTCPBind(Connection, &AddressToBind, Connection->AddressFile->Port)); @@ -91,7 +91,7 @@ if (NT_SUCCESS(Status)) { - Connection->SocketContext = LibTCPListen(Connection->SocketContext, Backlog); + Connection->SocketContext = LibTCPListen(Connection, Backlog); if (!Connection->SocketContext) Status = STATUS_UNSUCCESSFUL; } Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/event.c [iso-8859-1] Thu Jul 21 20:58:54 2011 @@ -143,30 +143,32 @@ VOID TCPFinEventHandler(void *arg, err_t err) { - PCONNECTION_ENDPOINT Connection = arg; + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; + + DbgPrint("[IP, TCPFinEventHandler] Called for Connection( 0x%x )-> SocketContext = pcb (0x%x)\n", Connection, Connection->SocketContext); /* Only clear the pointer if the shutdown was caused by an error */ if (err != ERR_OK) { /* We're already closed by the error so we don't want to call lwip_close */ + DbgPrint("[IP, TCPFinEventHandler] MAKING Connection( 0x%x )-> SocketContext = pcb (0x%x) NULL\n", Connection, Connection->SocketContext); Connection->SocketContext = NULL; } - - DbgPrint("[IP, TCPFinEventHandler] Called for Connection( 0x%x )-> SocketContext = pcb (0x%x)\n", Connection, Connection->SocketContext); FlushAllQueues(Connection, TCPTranslateError(err)); + + DbgPrint("[IP, TCPFinEventHandler] Done\n"); } VOID TCPAcceptEventHandler(void *arg, struct tcp_pcb *newpcb) { - PCONNECTION_ENDPOINT Connection = arg; + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; PTDI_BUCKET Bucket; PLIST_ENTRY Entry; PIRP Irp; NTSTATUS Status; KIRQL OldIrql; - struct tcp_pcb* OldSocketContext; DbgPrint("[IP, TCPAcceptEventHandler] Called\n"); @@ -202,22 +204,19 @@ LockObject(Bucket->AssociatedEndpoint, &OldIrql); + /* sanity assert...this should never be in anything else but a CLOSED state */ + ASSERT(((struct tcp_pcb*)Bucket->AssociatedEndpoint->SocketContext)->state == CLOSED); + + /* free socket context created in FileOpenConnection, as we're using a new one */ + LibTCPClose(Bucket->AssociatedEndpoint, TRUE); + /* free previously created socket context (we don't use it, we use newpcb) */ - OldSocketContext = Bucket->AssociatedEndpoint->SocketContext; Bucket->AssociatedEndpoint->SocketContext = newpcb; - LibTCPAccept(newpcb, - (struct tcp_pcb*)Connection->SocketContext, - Bucket->AssociatedEndpoint); + LibTCPAccept(newpcb, (PTCP_PCB)Connection->SocketContext, Bucket->AssociatedEndpoint); DbgPrint("[IP, TCPAcceptEventHandler] Trying to unlock Bucket->AssociatedEndpoint\n"); UnlockObject(Bucket->AssociatedEndpoint, OldIrql); - - /* sanity assert...this should never be in anything else but a CLOSED state */ - ASSERT(((struct tcp_pcb*)OldSocketContext)->state == CLOSED); - - /* free socket context created in FileOpenConnection, as we're using a new one */ - LibTCPClose(OldSocketContext, TRUE); } DereferenceObject(Bucket->AssociatedEndpoint); @@ -270,7 +269,7 @@ ("Connection->SocketContext: %x\n", Connection->SocketContext)); - Status = TCPTranslateError(LibTCPSend(Connection->SocketContext, + Status = TCPTranslateError(LibTCPSend(Connection, SendBuffer, SendLen, TRUE)); @@ -368,7 +367,7 @@ VOID TCPConnectEventHandler(void *arg, err_t err) { - PCONNECTION_ENDPOINT Connection = arg; + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; PTDI_BUCKET Bucket; PLIST_ENTRY Entry; Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Thu Jul 21 20:58:54 2011 @@ -115,19 +115,19 @@ DbgPrint("[IP, TCPClose] Called for Connection( 0x%x )->SocketConext( 0x%x )\n", Connection, Connection->SocketContext); Socket = Connection->SocketContext; - Connection->SocketContext = NULL; + //Connection->SocketContext = NULL; /* We should not be associated to an address file at this point */ ASSERT(!Connection->AddressFile); /* Don't try to close again if the other side closed us already */ - if (Socket) + if (Connection->SocketContext) { FlushAllQueues(Connection, STATUS_CANCELLED); DbgPrint("[IP, TCPClose] Socket (pcb) = 0x%x\n", Socket); - LibTCPClose(Socket, FALSE); + LibTCPClose(Connection, FALSE); } DbgPrint("[IP, TCPClose] Leaving. Connection->RefCount = %d\n", Connection->RefCount); @@ -299,7 +299,7 @@ bindaddr.addr = Connection->AddressFile->Address.Address.IPv4Address; } - Status = TCPTranslateError(LibTCPBind(Connection->SocketContext, + Status = TCPTranslateError(LibTCPBind(Connection, &bindaddr, Connection->AddressFile->Port)); @@ -338,7 +338,7 @@ InsertTailList( &Connection->ConnectRequest, &Bucket->Entry ); - Status = TCPTranslateError(LibTCPConnect(Connection->SocketContext, + Status = TCPTranslateError(LibTCPConnect(Connection, &connaddr, RemotePort)); @@ -372,12 +372,12 @@ { if (Flags & TDI_DISCONNECT_RELEASE) { - Status = TCPTranslateError(LibTCPShutdown(Connection->SocketContext, 0, 1)); + Status = TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); } if ((Flags & TDI_DISCONNECT_ABORT) || !Flags) { - Status = TCPTranslateError(LibTCPShutdown(Connection->SocketContext, 1, 1)); + Status = TCPTranslateError(LibTCPShutdown(Connection, 1, 1)); } } else @@ -464,7 +464,7 @@ Connection->SocketContext)); DbgPrint("[IP, TCPSendData] Called\n"); - Status = TCPTranslateError(LibTCPSend(Connection->SocketContext, + Status = TCPTranslateError(LibTCPSend(Connection, BufferData, SendLength, FALSE)); Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/CMakeLists.txt [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/CMakeLists.txt [iso-8859-1] Thu Jul 21 20:58:54 2011 @@ -1,3 +1,8 @@ +include_directories( + BEFORE include + ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/include + ${REACTOS_SOURCE_DIR}/lib/drivers/lwip/src/include + ${REACTOS_SOURCE_DIR}/lib/drivers/lwip/src/include/ipv4) include_directories( src/include Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/include/rosip.h URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/include/rosip.h [iso-8859-1] Thu Jul 21 20:58:54 2011 @@ -4,6 +4,9 @@ #include "lwip/tcp.h" #include "lwip/pbuf.h" #include "lwip/ip_addr.h" +#include "tcpip.h" + +typedef struct tcp_pcb* PTCP_PCB; /* External TCP event handlers */ extern void TCPConnectEventHandler(void *arg, const err_t err); @@ -13,16 +16,17 @@ extern u32_t TCPRecvEventHandler(void *arg, struct pbuf *p); /* TCP functions */ -struct tcp_pcb *LibTCPSocket(void *arg); -err_t LibTCPBind(struct tcp_pcb *pcb, struct ip_addr *const ipaddr, const u16_t port); -struct tcp_pcb *LibTCPListen(struct tcp_pcb *pcb, const u8_t backlog); -err_t LibTCPSend(struct tcp_pcb *pcb, void *const dataptr, const u16_t len, const int safe); -err_t LibTCPConnect(struct tcp_pcb *pcb, struct ip_addr *const ipaddr, const u16_t port); -err_t LibTCPShutdown(struct tcp_pcb *pcb, const int shut_rx, const int shut_tx); -err_t LibTCPClose(struct tcp_pcb *pcb, const int safe); -err_t LibTCPGetPeerName(struct tcp_pcb *pcb, struct ip_addr *const ipaddr, u16_t *const port); -err_t LibTCPGetHostName(struct tcp_pcb *pcb, struct ip_addr *const ipaddr, u16_t *const port); -void LibTCPAccept(struct tcp_pcb *pcb, struct tcp_pcb *listen_pcb, void *arg); +PTCP_PCB LibTCPSocket(void *arg); +err_t LibTCPBind(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port); +PTCP_PCB LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog); +err_t LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, const int safe); +err_t LibTCPConnect(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port); +err_t LibTCPShutdown(PCONNECTION_ENDPOINT Connection, const int shut_rx, const int shut_tx); +err_t LibTCPClose(PCONNECTION_ENDPOINT Connection, const int safe); + +err_t LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); +err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); +void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg); /* IP functions */ void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size); Modified: branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/TcpIpDriver/lib/drive…
============================================================================== --- branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c [iso-8859-1] (original) +++ branches/GSoC_2011/TcpIpDriver/lib/drivers/lwip/src/rostcp.c [iso-8859-1] Thu Jul 21 20:58:54 2011 @@ -272,7 +272,7 @@ KEVENT Event; /* Input */ - struct tcp_pcb *Pcb; + PCONNECTION_ENDPOINT Connection; struct ip_addr *IpAddress; u16_t Port; @@ -288,18 +288,20 @@ ASSERT(msg); - msg->Error = tcp_bind(msg->Pcb, msg->IpAddress, ntohs(msg->Port)); + msg->Error = tcp_bind((PTCP_PCB)msg->Connection->SocketContext, + msg->IpAddress, + ntohs(msg->Port)); KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); } err_t -LibTCPBind(struct tcp_pcb *pcb, struct ip_addr *const ipaddr, const u16_t port) +LibTCPBind(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port) { struct bind_callback_msg *msg; err_t ret; - if (!pcb) + if (!Connection->SocketContext) return ERR_CLSD; DbgPrint("[lwIP, LibTCPBind] Called\n"); @@ -308,7 +310,7 @@ if (msg) { KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); - msg->Pcb = pcb; + msg->Connection = Connection; msg->IpAddress = ipaddr; msg->Port = port; @@ -319,7 +321,7 @@ else ret = ERR_CLSD; - DbgPrint("[lwIP, LibTCPBind] pcb = 0x%x\n", pcb); + DbgPrint("[lwIP, LibTCPBind] pcb = 0x%x\n", Connection->SocketContext); DbgPrint("[lwIP, LibTCPBind] Done\n"); @@ -337,11 +339,11 @@ KEVENT Event; /* Input */ - struct tcp_pcb *Pcb; + PCONNECTION_ENDPOINT Connection; u8_t Backlog; /* Output */ - struct tcp_pcb *NewPcb; + PTCP_PCB NewPcb; }; static @@ -354,7 +356,7 @@ DbgPrint("[lwIP, LibTCPListenCallback] Called\n"); - msg->NewPcb = tcp_listen_with_backlog(msg->Pcb, msg->Backlog); + msg->NewPcb = tcp_listen_with_backlog((PTCP_PCB)msg->Connection->SocketContext, msg->Backlog); if (msg->NewPcb) { @@ -366,22 +368,22 @@ KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); } -struct tcp_pcb * -LibTCPListen(struct tcp_pcb *pcb, const u8_t backlog) +PTCP_PCB +LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog) { struct listen_callback_msg *msg; - void *ret; - - DbgPrint("[lwIP, LibTCPListen] Called on pcb = 0x%x\n", pcb); - - if (!pcb) + PTCP_PCB ret; + + DbgPrint("[lwIP, LibTCPListen] Called on pcb = 0x%x\n", Connection->SocketContext); + + if (!Connection->SocketContext) return NULL; msg = ExAllocatePool(NonPagedPool, sizeof(struct listen_callback_msg)); if (msg) { KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); - msg->Pcb = pcb; + msg->Connection = Connection; msg->Backlog = backlog; tcpip_callback_with_block(LibTCPListenCallback, msg, 1); @@ -392,7 +394,7 @@ ret = NULL; DbgPrint("[lwIP, LibTCPListen] pcb = 0x%x, newpcb = 0x%x, sizeof(pcb) = %d \n", - pcb, ret, sizeof(struct tcp_pcb)); + Connection->SocketContext, ret, sizeof(struct tcp_pcb)); DbgPrint("[lwIP, LibTCPListen] Done\n"); @@ -410,7 +412,7 @@ KEVENT Event; /* Input */ - struct tcp_pcb *Pcb; + PCONNECTION_ENDPOINT Connection; void *Data; u16_t DataLength; @@ -426,26 +428,29 @@ ASSERT(msg); - if (tcp_sndbuf(msg->Pcb) < msg->DataLength) + if (tcp_sndbuf((PTCP_PCB)msg->Connection->SocketContext) < msg->DataLength) { msg->Error = ERR_INPROGRESS; } else { - msg->Error = tcp_write(msg->Pcb, msg->Data, msg->DataLength, TCP_WRITE_FLAG_COPY); - - tcp_output(msg->Pcb); + msg->Error = tcp_write((PTCP_PCB)msg->Connection->SocketContext, + msg->Data, + msg->DataLength, + TCP_WRITE_FLAG_COPY); + + tcp_output((PTCP_PCB)msg->Connection->SocketContext); } KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); } err_t -LibTCPSend(struct tcp_pcb *pcb, void *const dataptr, const u16_t len, const int safe) +LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, const int safe) { err_t ret; - if (!pcb) + if (!Connection->SocketContext) return ERR_CLSD; /* @@ -455,14 +460,14 @@ */ if (safe) { - if (tcp_sndbuf(pcb) < len) + if (tcp_sndbuf((PTCP_PCB)Connection->SocketContext) < len) { ret = ERR_INPROGRESS; } else { - ret = tcp_write(pcb, dataptr, len, TCP_WRITE_FLAG_COPY); - tcp_output(pcb); + ret = tcp_write((PTCP_PCB)Connection->SocketContext, dataptr, len, TCP_WRITE_FLAG_COPY); + tcp_output((PTCP_PCB)Connection->SocketContext); } return ret; @@ -475,7 +480,7 @@ if (msg) { KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); - msg->Pcb = pcb; + msg->Connection = Connection; msg->Data = dataptr; msg->DataLength = len; @@ -486,7 +491,7 @@ else ret = ERR_CLSD; - DbgPrint("[lwIP, LibTCPSend] pcb = 0x%x\n", pcb); + DbgPrint("[lwIP, LibTCPSend] pcb = 0x%x\n", Connection->SocketContext); ExFreePool(msg); @@ -503,7 +508,7 @@ KEVENT Event; /* Input */ - struct tcp_pcb *Pcb; + PCONNECTION_ENDPOINT Connection; struct ip_addr *IpAddress; u16_t Port; @@ -521,10 +526,13 @@ ASSERT(arg); - tcp_recv(msg->Pcb, InternalRecvEventHandler); - tcp_sent(msg->Pcb, InternalSendEventHandler); - - err_t Error = tcp_connect(msg->Pcb, msg->IpAddress, ntohs(msg->Port), InternalConnectEventHandler); + tcp_recv((PTCP_PCB)msg->Connection->SocketContext, InternalRecvEventHandler); + tcp_sent((PTCP_PCB)msg->Connection->SocketContext, InternalSendEventHandler); + + err_t Error = tcp_connect((PTCP_PCB)msg->Connection->SocketContext, + msg->IpAddress, ntohs(msg->Port), + InternalConnectEventHandler); + msg->Error = Error == ERR_OK ? ERR_INPROGRESS : Error; KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); @@ -533,21 +541,21 @@ } err_t -LibTCPConnect(struct tcp_pcb *pcb, struct ip_addr *const ipaddr, const u16_t port) +LibTCPConnect(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port) { struct connect_callback_msg *msg; err_t ret; DbgPrint("[lwIP, LibTCPConnect] Called\n"); - if (!pcb) + if (!Connection->SocketContext) return ERR_CLSD; msg = ExAllocatePool(NonPagedPool, sizeof(struct connect_callback_msg)); if (msg) { KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); - msg->Pcb = pcb; + msg->Connection = Connection; msg->IpAddress = ipaddr; msg->Port = port; @@ -562,7 +570,7 @@ ExFreePool(msg); - DbgPrint("[lwIP, LibTCPConnect] pcb = 0x%x\n", pcb); + DbgPrint("[lwIP, LibTCPConnect] pcb = 0x%x\n", Connection->SocketContext); DbgPrint("[lwIP, LibTCPConnect] Done\n"); @@ -578,7 +586,7 @@ KEVENT Event; /* Input */ - struct tcp_pcb *Pcb; + PCONNECTION_ENDPOINT Connection; int shut_rx; int shut_tx; @@ -597,9 +605,12 @@ it means lwIP will take care of it anyway and if it does so before us it will cause memory corruption. */ - if ((msg->Pcb->state == ESTABLISHED) || (msg->Pcb->state == SYN_RCVD)) - { - msg->Error = tcp_shutdown(msg->Pcb, msg->shut_rx, msg->shut_tx); + if ((((PTCP_PCB)msg->Connection->SocketContext)->state == ESTABLISHED) || + (((PTCP_PCB)msg->Connection->SocketContext)->state == SYN_RCVD)) + { + msg->Error = + tcp_shutdown((PTCP_PCB)msg->Connection->SocketContext, + msg->shut_rx, msg->shut_tx); } else msg->Error = ERR_OK; @@ -608,27 +619,29 @@ } err_t -LibTCPShutdown(struct tcp_pcb *pcb, const int shut_rx, const int shut_tx) +LibTCPShutdown(PCONNECTION_ENDPOINT Connection, const int shut_rx, const int shut_tx) { struct shutdown_callback_msg *msg; err_t ret; - DbgPrint("[lwIP, LibTCPShutdown] Called on pcb = 0x%x, rx = %d, tx = %d\n", pcb, shut_rx, shut_tx); - - if (!pcb) + DbgPrint("[lwIP, LibTCPShutdown] Called on pcb = 0x%x, rx = %d, tx = %d\n", + Connection->SocketContext, shut_rx, shut_tx); + + if (!Connection->SocketContext) { DbgPrint("[lwIP, LibTCPShutdown] Done... NO pcb\n"); return ERR_CLSD; } - DbgPrint("[lwIP, LibTCPShutdown] pcb->state = %s\n", tcp_state_str[pcb->state]); + DbgPrint("[lwIP, LibTCPShutdown] pcb->state = %s\n", + tcp_state_str[((PTCP_PCB)Connection->SocketContext)->state]); msg = ExAllocatePool(NonPagedPool, sizeof(struct shutdown_callback_msg)); if (msg) { KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); - msg->Pcb = pcb; + msg->Connection = Connection; msg->shut_rx = shut_rx; msg->shut_tx = shut_tx; @@ -655,7 +668,7 @@ KEVENT Event; /* Input */ - struct tcp_pcb *Pcb; + PCONNECTION_ENDPOINT Connection; /* Output */ err_t Error; @@ -663,49 +676,9 @@ static void -LibTCPCloseCallback(void *arg) -{ - struct close_callback_msg *msg = arg; - - if (msg->Pcb->state == CLOSED) - { - DbgPrint("[lwIP, LibTCPCloseCallback] Connection was closed on us\n"); - msg->Error = ERR_OK; - } - - if (msg->Pcb->state == LISTEN) - { - DbgPrint("[lwIP, LibTCPCloseCallback] Closing a listener\n"); - msg->Error = tcp_close(msg->Pcb); - } - else - { - DbgPrint("[lwIP, LibTCPCloseCallback] Aborting a connection\n"); - tcp_abort(msg->Pcb); - msg->Error = ERR_OK; - } - - KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); -} - -err_t -//LibTCPClose(struct tcp_pcb *pcb, const int safe) -LibTCPClose(struct tcp_pcb *pcb, const int safe) -{ - err_t ret; - - DbgPrint("[lwIP, LibTCPClose] Called on pcb = 0x%x\n", pcb); - - if (!pcb) - { - DbgPrint("[lwIP, LibTCPClose] Done... NO pcb\n"); - return ERR_CLSD; - } - - DbgPrint("[lwIP, LibTCPClose] pcb->state = %s\n", tcp_state_str[pcb->state]); - +CloseCallbacks(struct tcp_pcb *pcb) +{ tcp_arg(pcb, NULL); - /* if this pcb is not in LISTEN state than it has valid recv, send and err callbacks to cancel @@ -718,6 +691,58 @@ } tcp_accept(pcb, NULL); +} + +static +void +LibTCPCloseCallback(void *arg) +{ + struct close_callback_msg *msg = arg; + + DbgPrint("[lwIP, LibTCPCloseCallback] pcb = 0x%x\n", (PTCP_PCB)msg->Connection->SocketContext); + + if (!msg->Connection->SocketContext) + { + DbgPrint("[lwIP, LibTCPCloseCallback] NULL pcb...bail, bail!!!\n"); + + ASSERT(FALSE); + + msg->Error = ERR_OK; + return; + } + + CloseCallbacks((PTCP_PCB)msg->Connection->SocketContext); + + if (((PTCP_PCB)msg->Connection->SocketContext)->state == LISTEN) + { + DbgPrint("[lwIP, LibTCPCloseCallback] Closing a listener\n"); + msg->Error = tcp_close((PTCP_PCB)msg->Connection->SocketContext); + } + else + { + DbgPrint("[lwIP, LibTCPCloseCallback] Aborting a connection\n"); + tcp_abort((PTCP_PCB)msg->Connection->SocketContext); + msg->Error = ERR_OK; + } + + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +err_t +LibTCPClose(PCONNECTION_ENDPOINT Connection, const int safe) +{ + err_t ret; + + DbgPrint("[lwIP, LibTCPClose] Called on pcb = 0x%x\n", Connection->SocketContext); + + if (!Connection->SocketContext) + { + DbgPrint("[lwIP, LibTCPClose] Done... NO pcb\n"); + return ERR_CLSD; + } + + DbgPrint("[lwIP, LibTCPClose] pcb->state = %s\n", + tcp_state_str[((PTCP_PCB)Connection->SocketContext)->state]); /* If we're being called from a handler it means we're in the conetxt of teh tcpip @@ -726,15 +751,16 @@ */ if (safe) { - if (pcb->state == LISTEN) + CloseCallbacks((PTCP_PCB)Connection->SocketContext); + if ( ((PTCP_PCB)Connection->SocketContext)->state == LISTEN ) { DbgPrint("[lwIP, LibTCPClose] Closing a listener\n"); - ret = tcp_close(pcb); + ret = tcp_close((PTCP_PCB)Connection->SocketContext); } else { DbgPrint("[lwIP, LibTCPClose] Aborting a connection\n"); - tcp_abort(pcb); + tcp_abort((PTCP_PCB)Connection->SocketContext); ret = ERR_OK; } @@ -749,7 +775,7 @@ { KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); - msg->Pcb = pcb; + msg->Connection = Connection; tcpip_callback_with_block(LibTCPCloseCallback, msg, 1); @@ -772,7 +798,7 @@ } void -LibTCPAccept(struct tcp_pcb *pcb, struct tcp_pcb *listen_pcb, void *arg) +LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg) { DbgPrint("[lwIP, LibTCPAccept] Called. (pcb, arg) = (0x%x, 0x%x)\n", pcb, arg); @@ -790,7 +816,7 @@ } err_t -LibTCPGetHostName(struct tcp_pcb *pcb, struct ip_addr *const ipaddr, u16_t *const port) +LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port) { DbgPrint("[lwIP, LibTCPGetHostName] Called. pcb = (0x%x)\n", pcb); @@ -808,7 +834,7 @@ } err_t -LibTCPGetPeerName(struct tcp_pcb *pcb, struct ip_addr * const ipaddr, u16_t * const port) +LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr * const ipaddr, u16_t * const port) { DbgPrint("[lwIP, LibTCPGetPeerName] pcb = (0x%x)\n", pcb);
13 years, 5 months
1
0
0
0
[tkreuzer] 52766: [CMAKE] Add msvcrt20 and msvcrt40 to build
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jul 21 18:40:41 2011 New Revision: 52766 URL:
http://svn.reactos.org/svn/reactos?rev=52766&view=rev
Log: [CMAKE] Add msvcrt20 and msvcrt40 to build Modified: trunk/reactos/dll/win32/CMakeLists.txt trunk/reactos/dll/win32/msvcrt20/CMakeLists.txt trunk/reactos/dll/win32/msvcrt40/CMakeLists.txt Modified: trunk/reactos/dll/win32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/CMakeLists.txt?r…
============================================================================== --- trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] Thu Jul 21 18:40:41 2011 @@ -108,8 +108,8 @@ add_subdirectory(mssip32) add_subdirectory(mstask) add_subdirectory(msvcrt) -#add_subdirectory(msvcrt20) FIX spec2def -#add_subdirectory(msvcrt40) FIX spec2def +add_subdirectory(msvcrt20) +add_subdirectory(msvcrt40) add_subdirectory(msvfw32) add_subdirectory(msvidc32) add_subdirectory(mswsock) Modified: trunk/reactos/dll/win32/msvcrt20/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt20/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/msvcrt20/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt20/CMakeLists.txt [iso-8859-1] Thu Jul 21 18:40:41 2011 @@ -8,6 +8,7 @@ list(APPEND SOURCE msvcrt20.c + ${CMAKE_CURRENT_BINARY_DIR}/msvcrt20_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/msvcrt20.def) add_library(msvcrt20 SHARED ${SOURCE}) Modified: trunk/reactos/dll/win32/msvcrt40/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msvcrt40/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/msvcrt40/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msvcrt40/CMakeLists.txt [iso-8859-1] Thu Jul 21 18:40:41 2011 @@ -8,6 +8,7 @@ list(APPEND SOURCE msvcrt40.c + ${CMAKE_CURRENT_BINARY_DIR}/msvcrt40_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/msvcrt40.def) add_library(msvcrt40 SHARED ${SOURCE})
13 years, 5 months
1
0
0
0
[tkreuzer] 52765: [SPEC2DEF] Fix creation of stubs for c++ mangled names
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Thu Jul 21 18:39:24 2011 New Revision: 52765 URL:
http://svn.reactos.org/svn/reactos?rev=52765&view=rev
Log: [SPEC2DEF] Fix creation of stubs for c++ mangled names Modified: trunk/reactos/tools/spec2def/spec2def.c Modified: trunk/reactos/tools/spec2def/spec2def.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/spec2def/spec2def.c?…
============================================================================== --- trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] (original) +++ trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] Thu Jul 21 18:39:24 2011 @@ -19,6 +19,7 @@ int nArgCount; int anArgs[30]; unsigned int uFlags; + int nNumber; } EXPORT; enum _ARCH @@ -168,7 +169,15 @@ fprintf(file, "__stdcall "); } - fprintf(file, "%.*s(", pexp->nNameLength, pexp->pcName); + /* Check for C++ */ + if (pexp->pcName[0] == '?') + { + fprintf(file, "stub_function%d(", pexp->nNumber); + } + else + { + fprintf(file, "%.*s(", pexp->nNameLength, pexp->pcName); + } for (i = 0; i < pexp->nArgCount; i++) { @@ -334,6 +343,13 @@ fprintf(fileDest, "="); PrintName(fileDest, pexp, "", 1, fDeco && !gbMSComp); } + else if (((pexp->uFlags & FL_STUB) || (pexp->nCallingConvention == CC_STUB)) && + (pexp->pcName[0] == '?')) + { + /* C++ stubs are forwarded to C stubs */ + fprintf(fileDest, "="); + fprintf(fileDest, "stub_function%d(", pexp->nNumber); + } else if ((giArch == ARCH_X86) && gbKillAt && !gbMSComp && (pexp->nCallingConvention == CC_STDCALL || pexp->nCallingConvention == CC_FASTCALL)) @@ -379,12 +395,14 @@ /* Loop all lines */ nLine = 1; + exp.nNumber = 0; for (pcLine = pcStart; *pcLine; pcLine = NextLine(pcLine), nLine++) { pc = pcLine; exp.nArgCount = 0; exp.uFlags = 0; + exp.nNumber++; //fprintf(stderr, "info: line %d, token:'%d, %.20s'\n", // nLine, TokenLength(pcLine), pcLine); @@ -591,7 +609,7 @@ /* Check for c++ mangled name */ if (pc[0] == '?') { - printf("Found c++ mangled name...\n"); + //printf("Found c++ mangled name...\n"); // } else
13 years, 5 months
1
0
0
0
[spetreolle] 52764: [HIVES] Fix Nls registry keys casing. Tested by Alex.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Thu Jul 21 17:33:38 2011 New Revision: 52764 URL:
http://svn.reactos.org/svn/reactos?rev=52764&view=rev
Log: [HIVES] Fix Nls registry keys casing. Tested by Alex. Modified: trunk/reactos/boot/bootdata/hivesys_amd64.inf trunk/reactos/boot/bootdata/hivesys_arm.inf trunk/reactos/boot/bootdata/hivesys_i386.inf [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/boot/bootdata/hivesys_amd64.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys_amd6…
Modified: trunk/reactos/boot/bootdata/hivesys_arm.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys_arm.…
Modified: trunk/reactos/boot/bootdata/hivesys_i386.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys_i386…
13 years, 5 months
1
0
0
0
← Newer
1
...
22
23
24
25
26
27
28
...
52
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
Results per page:
10
25
50
100
200