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 */