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 2009
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
27 participants
605 discussions
Start a n
N
ew thread
[dchapyshev] 41764: - GetProcessHeap -> RtlGetProcessHeap - Add checks at heap allocation - Add some debug prints
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Sat Jul 4 12:48:18 2009 New Revision: 41764 URL:
http://svn.reactos.org/svn/reactos?rev=41764&view=rev
Log: - GetProcessHeap -> RtlGetProcessHeap - Add checks at heap allocation - Add some debug prints Modified: trunk/reactos/dll/win32/kernel32/file/backup.c trunk/reactos/dll/win32/kernel32/file/dir.c trunk/reactos/dll/win32/kernel32/file/dosdev.c trunk/reactos/dll/win32/kernel32/file/volume.c trunk/reactos/dll/win32/kernel32/misc/atom.c trunk/reactos/dll/win32/kernel32/misc/comm.c trunk/reactos/dll/win32/kernel32/misc/icustubs.cpp trunk/reactos/dll/win32/kernel32/misc/profile.c trunk/reactos/dll/win32/kernel32/misc/res.c trunk/reactos/dll/win32/kernel32/misc/stubs.c trunk/reactos/dll/win32/kernel32/process/session.c Modified: trunk/reactos/dll/win32/kernel32/file/backup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/ba…
============================================================================== --- trunk/reactos/dll/win32/kernel32/file/backup.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/file/backup.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -32,6 +32,7 @@ LPVOID * lpContext ) { + UNIMPLEMENTED; SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } @@ -51,6 +52,7 @@ LPVOID * lpContext ) { + UNIMPLEMENTED; SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } @@ -71,6 +73,7 @@ LPVOID * lpContext ) { + UNIMPLEMENTED; SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } Modified: trunk/reactos/dll/win32/kernel32/file/dir.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/di…
============================================================================== --- trunk/reactos/dll/win32/kernel32/file/dir.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/file/dir.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -1030,7 +1030,7 @@ } else { - Name = RtlAllocateHeap(GetProcessHeap(), + Name = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, (wcslen(lpFileName) + wcslen(lpExtension) + 1) * sizeof(WCHAR)); Modified: trunk/reactos/dll/win32/kernel32/file/dosdev.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/do…
============================================================================== --- trunk/reactos/dll/win32/kernel32/file/dosdev.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/file/dosdev.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -76,6 +76,7 @@ LPCWSTR lpTargetPath ) { + UNIMPLEMENTED; return FALSE; } Modified: trunk/reactos/dll/win32/kernel32/file/volume.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/vo…
============================================================================== --- trunk/reactos/dll/win32/kernel32/file/volume.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/file/volume.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -917,7 +917,7 @@ BufferLength = sizeof(MOUNTDEV_NAME) + 50 * sizeof(WCHAR); do { - MountDevName = RtlAllocateHeap(GetProcessHeap(), 0, BufferLength); + MountDevName = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferLength); if (MountDevName == NULL) { NtClose(FileHandle); @@ -964,7 +964,7 @@ MountPoint->DeviceNameOffset = sizeof(MOUNTMGR_MOUNT_POINT); MountPoint->DeviceNameLength = MountDevName->NameLength; RtlCopyMemory(MountPoint + 1, MountDevName->Name, MountDevName->NameLength); - RtlFreeHeap(GetProcessHeap(), 0, MountDevName); + RtlFreeHeap(RtlGetProcessHeap(), 0, MountDevName); RtlInitUnicodeString(&NtFileName, L"\\??\\MountPointManager"); InitializeObjectAttributes(&ObjectAttributes, &NtFileName, 0, NULL, NULL); @@ -974,17 +974,17 @@ if (!NT_SUCCESS(Status)) { SetLastErrorByStatus(Status); - RtlFreeHeap(GetProcessHeap(), 0, MountPoint); + RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoint); return FALSE; } BufferLength = sizeof(MOUNTMGR_MOUNT_POINTS); do { - MountPoints = RtlAllocateHeap(GetProcessHeap(), 0, BufferLength); + MountPoints = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferLength); if (MountPoints == NULL) { - RtlFreeHeap(GetProcessHeap(), 0, MountPoint); + RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoint); NtClose(FileHandle); SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; @@ -996,7 +996,7 @@ MountPoints, BufferLength); if (!NT_SUCCESS(Status)) { - RtlFreeHeap(GetProcessHeap(), 0, MountPoints); + RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoints); if (Status == STATUS_BUFFER_OVERFLOW) { BufferLength = MountPoints->Size; @@ -1004,7 +1004,7 @@ } else if (!NT_SUCCESS(Status)) { - RtlFreeHeap(GetProcessHeap(), 0, MountPoint); + RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoint); NtClose(FileHandle); SetLastErrorByStatus(Status); return FALSE; @@ -1013,7 +1013,7 @@ } while (!NT_SUCCESS(Status)); - RtlFreeHeap(GetProcessHeap(), 0, MountPoint); + RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoint); NtClose(FileHandle); /* @@ -1055,14 +1055,14 @@ Result = FALSE; } - RtlFreeHeap(GetProcessHeap(), 0, MountPoints); + RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoints); return Result; } } } - RtlFreeHeap(GetProcessHeap(), 0, MountPoints); + RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoints); SetLastError(ERROR_INVALID_PARAMETER); return FALSE; @@ -1091,7 +1091,7 @@ if ((ret = GetVolumeNameForVolumeMountPointW( pathW, volumeW, len ))) FilenameW2A_N( lpszVolumeName, len, volumeW, -1 ); - RtlFreeHeap( GetProcessHeap(), 0, pathW ); + RtlFreeHeap( RtlGetProcessHeap(), 0, pathW ); return ret; } @@ -1107,7 +1107,7 @@ { DWORD size = 1024; HANDLE mgr = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, 0, FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, OPEN_EXISTING, 0, 0 ); + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, INVALID_HANDLE_VALUE ); if (mgr == INVALID_HANDLE_VALUE) return INVALID_HANDLE_VALUE; for (;;) @@ -1115,7 +1115,7 @@ MOUNTMGR_MOUNT_POINT input; MOUNTMGR_MOUNT_POINTS *output; - if (!(output = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if (!(output = RtlAllocateHeap( RtlGetProcessHeap(), 0, size ))) { SetLastError( ERROR_NOT_ENOUGH_MEMORY ); break; @@ -1127,7 +1127,7 @@ { if (GetLastError() != ERROR_MORE_DATA) break; size = output->Size; - RtlFreeHeap( GetProcessHeap(), 0, output ); + RtlFreeHeap( RtlGetProcessHeap(), 0, output ); continue; } CloseHandle( mgr ); @@ -1135,7 +1135,7 @@ output->Size = 0; if (!FindNextVolumeW( output, volume, len )) { - RtlFreeHeap( GetProcessHeap(), 0, output ); + RtlFreeHeap( RtlGetProcessHeap(), 0, output ); return INVALID_HANDLE_VALUE; } return (HANDLE)output; @@ -1154,8 +1154,18 @@ DWORD len ) { - WCHAR *buffer = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ); - HANDLE handle = FindFirstVolumeW( buffer, len ); + WCHAR *buffer = NULL; + HANDLE handle; + + buffer = RtlAllocateHeap( RtlGetProcessHeap(), 0, len * sizeof(WCHAR) ); + + if (!buffer) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return INVALID_HANDLE_VALUE; + } + + handle = FindFirstVolumeW( buffer, len ); if (handle != INVALID_HANDLE_VALUE) { @@ -1165,7 +1175,7 @@ handle = INVALID_HANDLE_VALUE; } } - RtlFreeHeap( GetProcessHeap(), 0, buffer ); + RtlFreeHeap( RtlGetProcessHeap(), 0, buffer ); return handle; } @@ -1178,7 +1188,7 @@ HANDLE hFindVolume ) { - return RtlFreeHeap(GetProcessHeap(), 0, hFindVolume); + return RtlFreeHeap(RtlGetProcessHeap(), 0, hFindVolume); } /* Modified: trunk/reactos/dll/win32/kernel32/misc/atom.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/at…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/atom.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/atom.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -340,6 +340,12 @@ 0, AtomInfoLength); + if (!AtomInfo) + { + SetLastErrorByStatus(STATUS_NO_MEMORY); + return 0; + } + /* Query the name */ Status = NtQueryInformationAtom(Atom, AtomBasicInformation, Modified: trunk/reactos/dll/win32/kernel32/misc/comm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/co…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/comm.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/comm.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -741,7 +741,14 @@ if (lpszName) { len = MultiByteToWideChar( CP_ACP, 0, lpszName, -1, NULL, 0 ); + lpDeviceW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + if (!lpDeviceW) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + MultiByteToWideChar( CP_ACP, 0, lpszName, -1, lpDeviceW, len ); } r = SetDefaultCommConfigW(lpDeviceW,lpCC,dwSize); Modified: trunk/reactos/dll/win32/kernel32/misc/icustubs.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/ic…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/icustubs.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/icustubs.cpp [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -45,17 +45,17 @@ void free(void * memory) { - RtlFreeHeap(GetProcessHeap(), 0, memory); + RtlFreeHeap(RtlGetProcessHeap(), 0, memory); } void * malloc(size_t size) { - return RtlAllocateHeap(GetProcessHeap(), 0, size); + return RtlAllocateHeap(RtlGetProcessHeap(), 0, size); } void * realloc(void * memory, size_t size) { - return RtlReAllocateHeap(GetProcessHeap(), 0, memory, size); + return RtlReAllocateHeap(RtlGetProcessHeap(), 0, memory, size); } int __cdecl _purecall() Modified: trunk/reactos/dll/win32/kernel32/misc/profile.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/pr…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/profile.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/profile.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -488,6 +488,7 @@ { len = (int)(szLineEnd - szValueStart); key->value = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ); + if (!key->value) break; memcpy(key->value, szValueStart, len * sizeof(WCHAR)); key->value[len] = '\0'; } @@ -1155,6 +1156,7 @@ int len = (int)(p - def_val) + 1; defval_tmp = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); + if (!defval_tmp) return 0; memcpy(defval_tmp, def_val, len * sizeof(WCHAR)); defval_tmp[len] = '\0'; def_val = defval_tmp; @@ -1384,6 +1386,12 @@ } bufferW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!bufferW) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + RtlCreateUnicodeStringFromAsciiz(§ionW, section); if (filename) RtlCreateUnicodeStringFromAsciiz(&filenameW, filename); else filenameW.Buffer = NULL; Modified: trunk/reactos/dll/win32/kernel32/misc/res.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/re…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/res.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/res.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -97,6 +97,7 @@ return (LPWSTR) (UINT_PTR) LOWORD(str); len = (lstrlenW( str ) + 1) * sizeof (WCHAR); ret = HeapAlloc( GetProcessHeap(), 0, len ); + if (!ret) return NULL; memcpy( ret, str, len ); return ret; } @@ -285,6 +286,7 @@ if (!restype) { restype = HeapAlloc( GetProcessHeap(), 0, sizeof *restype ); + if (!restype) return FALSE; restype->id = res_strdupW( Type ); list_init( &restype->children ); add_resource_dir_entry( &updates->root, restype ); @@ -294,6 +296,7 @@ if (!resname) { resname = HeapAlloc( GetProcessHeap(), 0, sizeof *resname ); + if (!resname) return FALSE; resname->id = res_strdupW( Name ); list_init( &resname->children ); add_resource_dir_entry( &restype->children, resname ); @@ -468,6 +471,7 @@ string = (const IMAGE_RESOURCE_DIR_STRING_U*) (((const char *)root) + entry->NameOffset); s = HeapAlloc(GetProcessHeap(), 0, (string->Length + 1)*sizeof (WCHAR) ); + if (!s) return NULL; memcpy( s, string->NameString, (string->Length + 1)*sizeof (WCHAR) ); s[string->Length] = 0; Modified: trunk/reactos/dll/win32/kernel32/misc/stubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/st…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -661,8 +661,14 @@ LPSTR volume, DWORD len) { - WCHAR *buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + 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 ))) { Modified: trunk/reactos/dll/win32/kernel32/process/session.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/process…
============================================================================== --- trunk/reactos/dll/win32/kernel32/process/session.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/process/session.c [iso-8859-1] Sat Jul 4 12:48:18 2009 @@ -9,6 +9,9 @@ * 2001-12-07 created */ #include <k32.h> +#include <wine/debug.h> + +WINE_DEFAULT_DEBUG_CHANNEL(kernel32session); DWORD ActiveConsoleSessionId = 0; @@ -19,6 +22,7 @@ DWORD WINAPI DosPathToSessionPathW (DWORD SessionID, LPWSTR InPath, LPWSTR * OutPath) { + UNIMPLEMENTED; return 0; } @@ -39,6 +43,7 @@ DosPathToSessionPathA (DWORD SessionId, LPSTR InPath, LPSTR * OutPath) { //DosPathToSessionPathW (SessionId,InPathW,OutPathW); + UNIMPLEMENTED; return 0; }
15 years, 5 months
1
0
0
0
[cgutman] 41763: - Don't use a global interface_info struct - This should allow for multiple NIC support but it's currently broken because GetIfTable returns invalid information for NICs after the first one which prevents DHCP initialization for those adapters
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Jul 4 07:36:19 2009 New Revision: 41763 URL:
http://svn.reactos.org/svn/reactos?rev=41763&view=rev
Log: - Don't use a global interface_info struct - This should allow for multiple NIC support but it's currently broken because GetIfTable returns invalid information for NICs after the first one which prevents DHCP initialization for those adapters Modified: trunk/reactos/base/services/dhcp/adapter.c trunk/reactos/base/services/dhcp/dhclient.c trunk/reactos/base/services/dhcp/include/dhcpd.h trunk/reactos/base/services/dhcp/include/rosdhcp.h trunk/reactos/base/services/dhcp/util.c Modified: trunk/reactos/base/services/dhcp/adapter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/adapter…
============================================================================== --- trunk/reactos/base/services/dhcp/adapter.c [iso-8859-1] (original) +++ trunk/reactos/base/services/dhcp/adapter.c [iso-8859-1] Sat Jul 4 07:36:19 2009 @@ -3,7 +3,6 @@ static SOCKET DhcpSocket = INVALID_SOCKET; static LIST_ENTRY AdapterList; static WSADATA wsd; -extern struct interface_info *ifi; PCHAR *GetSubkeyNames( PCHAR MainKeyName, PCHAR Append ) { int i = 0; @@ -215,6 +214,7 @@ PMIB_IFTABLE Table = (PMIB_IFTABLE) malloc(sizeof(MIB_IFTABLE)); DWORD Error, Size, i; PDHCP_ADAPTER Adapter = NULL; + struct interface_info *ifi = NULL; WSAStartup(0x0101,&wsd); Modified: trunk/reactos/base/services/dhcp/dhclient.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/dhclien…
============================================================================== --- trunk/reactos/base/services/dhcp/dhclient.c [iso-8859-1] (original) +++ trunk/reactos/base/services/dhcp/dhclient.c [iso-8859-1] Sat Jul 4 07:36:19 2009 @@ -100,8 +100,6 @@ int unknown_ok = 1; int routefd; -struct interface_info *ifi = NULL; - void usage(void); int check_option(struct client_lease *l, int option); int ipv4addrs(char * buf); @@ -135,6 +133,7 @@ main(int argc, char *argv[]) { int i = 0; + PDHCP_ADAPTER Adapter; ApiInit(); AdapterInit(); PipeInit(); @@ -150,32 +149,29 @@ DH_DbgPrint(MID_TRACE,("DHCP Service Started\n")); - read_client_conf(); - - if (!interface_link_status(ifi->name)) { - DH_DbgPrint(MID_TRACE,("%s: no link ", ifi->name)); - Sleep(1000); - while (!interface_link_status(ifi->name)) { - DH_DbgPrint(MID_TRACE,(".")); - if (++i > 10) { - DH_DbgPrint(MID_TRACE,("Giving up for now on adapter [%s]\n", ifi->name)); - } - Sleep(1000); - } - DH_DbgPrint(MID_TRACE,("Got link on [%s]\n", ifi->name)); - } - - DH_DbgPrint(MID_TRACE,("Discover Interfaces\n")); - - /* If no adapters were found, just idle for now ... If any show up, - * then we'll start it later */ - if( ifi ) { - /* set up the interface */ - discover_interfaces(ifi); - - DH_DbgPrint - (MID_TRACE, - ("Setting init state and restarting interface %p\n",ifi)); + for (Adapter = AdapterGetFirst(); + Adapter != NULL; + Adapter = AdapterGetNext(Adapter)) + { + read_client_conf(&Adapter->DhclientInfo); + + if (!interface_link_status(Adapter->DhclientInfo.name)) { + DH_DbgPrint(MID_TRACE,("%s: no link ", Adapter->DhclientInfo.name)); + Sleep(1000); + while (!interface_link_status(Adapter->DhclientInfo.name)) { + DH_DbgPrint(MID_TRACE,(".")); + if (++i > 10) { + DH_DbgPrint(MID_TRACE,("Giving up for now on adapter [%s]\n", Adapter->DhclientInfo.name)); + } + Sleep(1000); + } + DH_DbgPrint(MID_TRACE,("Got link on [%s]\n", Adapter->DhclientInfo.name)); + } + + DH_DbgPrint(MID_TRACE,("Discover Interfaces\n")); + + /* set up the interface */ + discover_interfaces(&Adapter->DhclientInfo); } bootp_packet_handler = do_packet; @@ -1556,7 +1552,7 @@ FILE *leaseFile; void -rewrite_client_leases(void) +rewrite_client_leases(struct interface_info *ifi) { struct client_lease *lp; @@ -1587,7 +1583,7 @@ if (!rewrite) { if (leases_written++ > 20) { - rewrite_client_leases(); + rewrite_client_leases(ip); leases_written = 0; } } @@ -1674,19 +1670,16 @@ } void -priv_script_init(char *reason, char *medium) -{ - struct interface_info *ip = ifi; - +priv_script_init(struct interface_info *ip, char *reason, char *medium) +{ if (ip) { // XXX Do we need to do anything? } } void -priv_script_write_params(char *prefix, struct client_lease *lease) -{ - struct interface_info *ip = ifi; +priv_script_write_params(struct interface_info *ip, char *prefix, struct client_lease *lease) +{ u_int8_t dbuf[1500]; int i, len = 0; Modified: trunk/reactos/base/services/dhcp/include/dhcpd.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/include…
============================================================================== --- trunk/reactos/base/services/dhcp/include/dhcpd.h [iso-8859-1] (original) +++ trunk/reactos/base/services/dhcp/include/dhcpd.h [iso-8859-1] Sat Jul 4 07:36:19 2009 @@ -426,11 +426,11 @@ void make_decline(struct interface_info *, struct client_lease *); void free_client_lease(struct client_lease *); -void rewrite_client_leases(void); +void rewrite_client_leases(struct interface_info *); void write_client_lease(struct interface_info *, struct client_lease *, int); -void priv_script_init(char *, char *); -void priv_script_write_params(char *, struct client_lease *); +void priv_script_init(struct interface_info *, char *, char *); +void priv_script_write_params(struct interface_info *, char *, struct client_lease *); int priv_script_go(void); void script_init(char *, struct string_list *); @@ -466,7 +466,7 @@ int, struct hardware *); /* clparse.c */ -int read_client_conf(void); +int read_client_conf(struct interface_info *); void read_client_leases(void); void parse_client_statement(FILE *, struct interface_info *, struct client_config *); Modified: trunk/reactos/base/services/dhcp/include/rosdhcp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/include…
============================================================================== --- trunk/reactos/base/services/dhcp/include/rosdhcp.h [iso-8859-1] (original) +++ trunk/reactos/base/services/dhcp/include/rosdhcp.h [iso-8859-1] Sat Jul 4 07:36:19 2009 @@ -72,6 +72,8 @@ void AdapterInit(VOID); HANDLE PipeInit(VOID); +extern PDHCP_ADAPTER AdapterGetFirst(); +extern PDHCP_ADAPTER AdapterGetNext(PDHCP_ADAPTER); extern PDHCP_ADAPTER AdapterFindIndex( unsigned int AdapterIndex ); extern PDHCP_ADAPTER AdapterFindInfo( struct interface_info *info ); extern VOID ApiInit(); Modified: trunk/reactos/base/services/dhcp/util.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/util.c?…
============================================================================== --- trunk/reactos/base/services/dhcp/util.c [iso-8859-1] (original) +++ trunk/reactos/base/services/dhcp/util.c [iso-8859-1] Sat Jul 4 07:36:19 2009 @@ -3,8 +3,6 @@ #define NDEBUG #include <reactos/debug.h> - -extern struct interface_info *ifi; char *piaddr( struct iaddr addr ) { struct sockaddr_in sa; @@ -96,7 +94,7 @@ void *dmalloc( int size, char *name ) { return malloc( size ); } -int read_client_conf(void) { +int read_client_conf(struct interface_info *ifi) { /* What a strange dance */ struct client_config *config; char ComputerName [MAX_COMPUTERNAME_LENGTH + 1];
15 years, 5 months
1
0
0
0
[tkreuzer] 41762: Merge eng/palette.c, objects/palobj.c and objects/color.c into objects/palette.c, dropping some useless bitrotting code. The rest of the code needs some love and cleanup. Btw, Arch, how's the weather?
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jul 4 04:18:32 2009 New Revision: 41762 URL:
http://svn.reactos.org/svn/reactos?rev=41762&view=rev
Log: Merge eng/palette.c, objects/palobj.c and objects/color.c into objects/palette.c, dropping some useless bitrotting code. The rest of the code needs some love and cleanup. Btw, Arch, how's the weather? Added: trunk/reactos/subsystems/win32/win32k/objects/palette.c - copied, changed from r41760, trunk/reactos/subsystems/win32/win32k/eng/palette.c Removed: trunk/reactos/subsystems/win32/win32k/eng/palette.c trunk/reactos/subsystems/win32/win32k/objects/color.c trunk/reactos/subsystems/win32/win32k/objects/palobj.c Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild Removed: trunk/reactos/subsystems/win32/win32k/eng/palette.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/palette.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/palette.c (removed) @@ -1,101 +1,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: GDI Palette Functions - * FILE: subsys/win32k/eng/palette.c - * PROGRAMER: Jason Filby - */ - -#include <w32k.h> - -#define NDEBUG -#include <debug.h> - -// -// -// -VOID -FASTCALL -ColorCorrection(PPALETTE PalGDI, PPALETTEENTRY PaletteEntry, ULONG Colors) -{ - PPDEVOBJ ppdev = (PPDEVOBJ)PalGDI->hPDev; - - if (!ppdev) return; - - if (ppdev->flFlags & PDEV_GAMMARAMP_TABLE) - { - INT i; - PGAMMARAMP GammaRamp = (PGAMMARAMP)ppdev->pvGammaRamp; - for ( i = 0; i < Colors; i++) - { - PaletteEntry[i].peRed += GammaRamp->Red[i]; - PaletteEntry[i].peGreen += GammaRamp->Green[i]; - PaletteEntry[i].peBlue += GammaRamp->Blue[i]; - } - } - return; -} - -/* - * @implemented - */ -HPALETTE -APIENTRY -EngCreatePalette( - ULONG Mode, - ULONG NumColors, - ULONG *Colors, - ULONG Red, - ULONG Green, - ULONG Blue) -{ - HPALETTE Palette; - - Palette = PALETTE_AllocPalette(Mode, NumColors, Colors, Red, Green, Blue); - if (Palette != NULL) - { - GDIOBJ_SetOwnership(Palette, NULL); - } - - return Palette; -} - -/* - * @implemented - */ -BOOL -APIENTRY -EngDeletePalette(IN HPALETTE Palette) -{ - GDIOBJ_SetOwnership(Palette, PsGetCurrentProcess()); - - return PALETTE_FreePaletteByHandle(Palette); -} - -/* - * @implemented - */ -ULONG -APIENTRY -PALOBJ_cGetColors(PALOBJ *PalObj, ULONG Start, ULONG Colors, ULONG *PaletteEntry) -{ - PALETTE *PalGDI; - - PalGDI = (PALETTE*)PalObj; - /* PalGDI = (PALETTE*)AccessInternalObjectFromUserObject(PalObj); */ - - if (Start >= PalGDI->NumColors) - return 0; - - Colors = min(Colors, PalGDI->NumColors - Start); - - /* NOTE: PaletteEntry ULONGs are in the same order as PALETTEENTRY. */ - RtlCopyMemory(PaletteEntry, PalGDI->IndexedColors + Start, sizeof(ULONG) * Colors); - - if (PalGDI->Mode & PAL_GAMMACORRECTION) - ColorCorrection(PalGDI, (PPALETTEENTRY)PaletteEntry, Colors); - - return Colors; -} - -/* EOF */ Removed: trunk/reactos/subsystems/win32/win32k/objects/color.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/color.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/color.c (removed) @@ -1,877 +1,0 @@ -/* - * ReactOS W32 Subsystem - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ */ - -#include <w32k.h> - -#define NDEBUG -#include <debug.h> - -// FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping - -int COLOR_gapStart = 256; -int COLOR_gapEnd = -1; -int COLOR_gapFilled = 0; -int COLOR_max = 256; - -#ifndef NO_MAPPING -static HPALETTE hPrimaryPalette = 0; // used for WM_PALETTECHANGED -#endif -//static HPALETTE hLastRealizedPalette = 0; // UnrealizeObject() needs it - - -static UINT SystemPaletteUse = SYSPAL_NOSTATIC; /* the program need save the pallete and restore it */ - -const PALETTEENTRY COLOR_sysPalTemplate[NB_RESERVED_COLORS] = -{ - // first 10 entries in the system palette - // red green blue flags - { 0x00, 0x00, 0x00, PC_SYS_USED }, - { 0x80, 0x00, 0x00, PC_SYS_USED }, - { 0x00, 0x80, 0x00, PC_SYS_USED }, - { 0x80, 0x80, 0x00, PC_SYS_USED }, - { 0x00, 0x00, 0x80, PC_SYS_USED }, - { 0x80, 0x00, 0x80, PC_SYS_USED }, - { 0x00, 0x80, 0x80, PC_SYS_USED }, - { 0xc0, 0xc0, 0xc0, PC_SYS_USED }, - { 0xc0, 0xdc, 0xc0, PC_SYS_USED }, - { 0xa6, 0xca, 0xf0, PC_SYS_USED }, - - // ... c_min/2 dynamic colorcells - // ... gap (for sparse palettes) - // ... c_min/2 dynamic colorcells - - { 0xff, 0xfb, 0xf0, PC_SYS_USED }, - { 0xa0, 0xa0, 0xa4, PC_SYS_USED }, - { 0x80, 0x80, 0x80, PC_SYS_USED }, - { 0xff, 0x00, 0x00, PC_SYS_USED }, - { 0x00, 0xff, 0x00, PC_SYS_USED }, - { 0xff, 0xff, 0x00, PC_SYS_USED }, - { 0x00, 0x00, 0xff, PC_SYS_USED }, - { 0xff, 0x00, 0xff, PC_SYS_USED }, - { 0x00, 0xff, 0xff, PC_SYS_USED }, - { 0xff, 0xff, 0xff, PC_SYS_USED } // last 10 -}; - -const PALETTEENTRY* FASTCALL COLOR_GetSystemPaletteTemplate(void) -{ - return (const PALETTEENTRY*)&COLOR_sysPalTemplate; -} - -UINT APIENTRY -IntAnimatePalette(HPALETTE hPal, - UINT StartIndex, - UINT NumEntries, - CONST PPALETTEENTRY PaletteColors) -{ - UINT ret = 0; - - if( hPal != NtGdiGetStockObject(DEFAULT_PALETTE) ) - { - PPALETTE palPtr; - UINT pal_entries; - HDC hDC; - PDC dc; - PWINDOW_OBJECT Wnd; - const PALETTEENTRY *pptr = PaletteColors; - - palPtr = (PPALETTE)PALETTE_LockPalette(hPal); - if (!palPtr) return FALSE; - - pal_entries = palPtr->NumColors; - if (StartIndex >= pal_entries) - { - PALETTE_UnlockPalette(palPtr); - return FALSE; - } - if (StartIndex+NumEntries > pal_entries) NumEntries = pal_entries - StartIndex; - - for (NumEntries += StartIndex; StartIndex < NumEntries; StartIndex++, pptr++) - { - /* According to MSDN, only animate PC_RESERVED colours */ - if (palPtr->IndexedColors[StartIndex].peFlags & PC_RESERVED) - { - memcpy( &palPtr->IndexedColors[StartIndex], pptr, - sizeof(PALETTEENTRY) ); - ret++; - PALETTE_ValidateFlags(&palPtr->IndexedColors[StartIndex], 1); - } - } - - PALETTE_UnlockPalette(palPtr); - - /* Immediately apply the new palette if current window uses it */ - Wnd = UserGetDesktopWindow(); - hDC = UserGetWindowDC(Wnd); - dc = DC_LockDc(hDC); - if (NULL != dc) - { - if (dc->dclevel.hpal == hPal) - { - DC_UnlockDc(dc); - IntGdiRealizePalette(hDC); - } - else - DC_UnlockDc(dc); - } - UserReleaseDC(Wnd,hDC, FALSE); - } - return ret; -} - -HPALETTE APIENTRY NtGdiCreateHalftonePalette(HDC hDC) -{ - int i, r, g, b; - struct { - WORD Version; - WORD NumberOfEntries; - PALETTEENTRY aEntries[256]; - } Palette; - - Palette.Version = 0x300; - Palette.NumberOfEntries = 256; - if (IntGetSystemPaletteEntries(hDC, 0, 256, Palette.aEntries) == 0) - { - /* from wine, more that 256 color math */ - Palette.NumberOfEntries = 20; - for (i = 0; i < Palette.NumberOfEntries; i++) - { - Palette.aEntries[i].peRed=0xff; - Palette.aEntries[i].peGreen=0xff; - Palette.aEntries[i].peBlue=0xff; - Palette.aEntries[i].peFlags=0x00; - } - - Palette.aEntries[0].peRed=0x00; - Palette.aEntries[0].peBlue=0x00; - Palette.aEntries[0].peGreen=0x00; - - /* the first 6 */ - for (i=1; i <= 6; i++) - { - Palette.aEntries[i].peRed=(i%2)?0x80:0; - Palette.aEntries[i].peGreen=(i==2)?0x80:(i==3)?0x80:(i==6)?0x80:0; - Palette.aEntries[i].peBlue=(i>3)?0x80:0; - } - - for (i=7; i <= 12; i++) - { - switch(i) - { - case 7: - Palette.aEntries[i].peRed=0xc0; - Palette.aEntries[i].peBlue=0xc0; - Palette.aEntries[i].peGreen=0xc0; - break; - case 8: - Palette.aEntries[i].peRed=0xc0; - Palette.aEntries[i].peGreen=0xdc; - Palette.aEntries[i].peBlue=0xc0; - break; - case 9: - Palette.aEntries[i].peRed=0xa6; - Palette.aEntries[i].peGreen=0xca; - Palette.aEntries[i].peBlue=0xf0; - break; - case 10: - Palette.aEntries[i].peRed=0xff; - Palette.aEntries[i].peGreen=0xfb; - Palette.aEntries[i].peBlue=0xf0; - break; - case 11: - Palette.aEntries[i].peRed=0xa0; - Palette.aEntries[i].peGreen=0xa0; - Palette.aEntries[i].peBlue=0xa4; - break; - case 12: - Palette.aEntries[i].peRed=0x80; - Palette.aEntries[i].peGreen=0x80; - Palette.aEntries[i].peBlue=0x80; - } - } - - for (i=13; i <= 18; i++) - { - Palette.aEntries[i].peRed=(i%2)?0xff:0; - Palette.aEntries[i].peGreen=(i==14)?0xff:(i==15)?0xff:(i==18)?0xff:0; - Palette.aEntries[i].peBlue=(i>15)?0xff:0x00; - } - } - else - { - /* 256 color table */ - for (r = 0; r < 6; r++) - for (g = 0; g < 6; g++) - for (b = 0; b < 6; b++) - { - i = r + g*6 + b*36 + 10; - Palette.aEntries[i].peRed = r * 51; - Palette.aEntries[i].peGreen = g * 51; - Palette.aEntries[i].peBlue = b * 51; - } - - for (i = 216; i < 246; i++) - { - int v = (i - 216) << 3; - Palette.aEntries[i].peRed = v; - Palette.aEntries[i].peGreen = v; - Palette.aEntries[i].peBlue = v; - } - } - - return NtGdiCreatePaletteInternal((LOGPALETTE *)&Palette, Palette.NumberOfEntries); -} - - - -/* - * @implemented - */ -HPALETTE APIENTRY -NtGdiCreatePaletteInternal ( IN LPLOGPALETTE pLogPal, IN UINT cEntries ) -{ - PPALETTE PalGDI; - HPALETTE NewPalette; - - pLogPal->palNumEntries = cEntries; - NewPalette = PALETTE_AllocPalette( PAL_INDEXED, - cEntries, - (PULONG)pLogPal->palPalEntry, - 0, 0, 0); - - if (NewPalette == NULL) - { - return NULL; - } - - PalGDI = (PPALETTE) PALETTE_LockPalette(NewPalette); - if (PalGDI != NULL) - { - PALETTE_ValidateFlags(PalGDI->IndexedColors, PalGDI->NumColors); - PalGDI->logicalToSystem = NULL; - PALETTE_UnlockPalette(PalGDI); - } - else - { - /* FIXME - Handle PalGDI == NULL!!!! */ - DPRINT1("waring PalGDI is NULL \n"); - } - return NewPalette; -} - - -BOOL APIENTRY NtGdiGetColorAdjustment(HDC hDC, - LPCOLORADJUSTMENT ca) -{ - UNIMPLEMENTED; - return FALSE; -} - -unsigned short GetNumberOfBits(unsigned int dwMask) -{ - unsigned short wBits; - for (wBits = 0; dwMask; dwMask = dwMask & (dwMask - 1)) - wBits++; - return wBits; -} - -COLORREF APIENTRY NtGdiGetNearestColor(HDC hDC, COLORREF Color) -{ - COLORREF nearest = CLR_INVALID; - PDC dc; - PPALETTE palGDI; - LONG RBits, GBits, BBits; - - dc = DC_LockDc(hDC); - if (NULL != dc) - { - HPALETTE hpal = dc->dclevel.hpal; - palGDI = (PPALETTE) PALETTE_LockPalette(hpal); - if (!palGDI) - { - DC_UnlockDc(dc); - return nearest; - } - - switch (palGDI->Mode) - { - case PAL_INDEXED: - nearest = COLOR_LookupNearestColor(palGDI->IndexedColors, - palGDI->NumColors, Color); - break; - case PAL_BGR: - case PAL_RGB: - nearest = Color; - break; - case PAL_BITFIELDS: - RBits = 8 - GetNumberOfBits(palGDI->RedMask); - GBits = 8 - GetNumberOfBits(palGDI->GreenMask); - BBits = 8 - GetNumberOfBits(palGDI->BlueMask); - nearest = RGB( - (GetRValue(Color) >> RBits) << RBits, - (GetGValue(Color) >> GBits) << GBits, - (GetBValue(Color) >> BBits) << BBits); - break; - } - PALETTE_UnlockPalette(palGDI); - DC_UnlockDc(dc); - } - - return nearest; -} - -UINT APIENTRY NtGdiGetNearestPaletteIndex(HPALETTE hpal, - COLORREF Color) -{ - PPALETTE palGDI = (PPALETTE) PALETTE_LockPalette(hpal); - UINT index = 0; - - if (NULL != palGDI) - { - /* Return closest match for the given RGB color */ - index = COLOR_PaletteLookupPixel(palGDI->IndexedColors, palGDI->NumColors, NULL, Color, FALSE); - PALETTE_UnlockPalette(palGDI); - } - - return index; -} - -UINT APIENTRY -IntGetPaletteEntries(HPALETTE hpal, - UINT StartIndex, - UINT Entries, - LPPALETTEENTRY pe) -{ - PPALETTE palGDI; - UINT numEntries; - - palGDI = (PPALETTE) PALETTE_LockPalette(hpal); - if (NULL == palGDI) - { - return 0; - } - - numEntries = palGDI->NumColors; - if (NULL != pe) - { - if (numEntries < StartIndex + Entries) - { - Entries = numEntries - StartIndex; - } - if (numEntries <= StartIndex) - { - PALETTE_UnlockPalette(palGDI); - return 0; - } - memcpy(pe, palGDI->IndexedColors + StartIndex, Entries * sizeof(PALETTEENTRY)); - for (numEntries = 0; numEntries < Entries; numEntries++) - { - if (pe[numEntries].peFlags & 0xF0) - { - pe[numEntries].peFlags = 0; - } - } - } - else - { - Entries = numEntries; - } - - PALETTE_UnlockPalette(palGDI); - return Entries; -} - -UINT APIENTRY -IntGetSystemPaletteEntries(HDC hDC, - UINT StartIndex, - UINT Entries, - LPPALETTEENTRY pe) -{ - PPALETTE palGDI = NULL; - PDC dc = NULL; - UINT EntriesSize = 0; - UINT Ret = 0; - - if (Entries == 0) - { - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - - if (pe != NULL) - { - EntriesSize = Entries * sizeof(pe[0]); - if (Entries != EntriesSize / sizeof(pe[0])) - { - /* Integer overflow! */ - SetLastWin32Error(ERROR_INVALID_PARAMETER); - return 0; - } - } - - if (!(dc = DC_LockDc(hDC))) - { - SetLastWin32Error(ERROR_INVALID_HANDLE); - return 0; - } - - palGDI = PALETTE_LockPalette(dc->dclevel.hpal); - if (palGDI != NULL) - { - if (pe != NULL) - { - if (StartIndex >= palGDI->NumColors) - Entries = 0; - else if (Entries > palGDI->NumColors - StartIndex) - Entries = palGDI->NumColors - StartIndex; - - memcpy(pe, - palGDI->IndexedColors + StartIndex, - Entries * sizeof(pe[0])); - - Ret = Entries; - } - else - { - Ret = dc->ppdev->GDIInfo.ulNumPalReg; - } - } - - if (palGDI != NULL) - PALETTE_UnlockPalette(palGDI); - - if (dc != NULL) - DC_UnlockDc(dc); - - return Ret; -} - -UINT APIENTRY NtGdiGetSystemPaletteUse(HDC hDC) -{ - return SystemPaletteUse; -} - -/*! -The RealizePalette function modifies the palette for the device associated with the specified device context. If the device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device context is a display DC, the physical palette for that device is modified. - -A logical palette is a buffer between color-intensive applications and the system, allowing these applications to use as many colors as needed without interfering with colors displayed by other windows. - -1= IF DRAWING TO A DEVICE --- If it is a paletted bitmap, and is not an identity palette, then an XLATEOBJ is created between the logical palette and - the system palette. --- If it is an RGB palette, then an XLATEOBJ is created between the RGB values and the system palette. - -2= IF DRAWING TO A MEMORY DC\BITMAP --- If it is a paletted bitmap, and is not an identity palette, then an XLATEOBJ is created between the logical palette and - the dc palette. --- If it is an RGB palette, then an XLATEOBJ is created between the RGB values and the dc palette. -*/ -UINT FASTCALL IntGdiRealizePalette(HDC hDC) -{ - /* - * This function doesn't do any real work now and there's plenty - * of bugs in it. - */ - - PPALETTE palGDI, sysGDI; - int realized = 0; - PDC dc; - HPALETTE systemPalette; - USHORT sysMode, palMode; - - dc = DC_LockDc(hDC); - if (!dc) return 0; - - systemPalette = NtGdiGetStockObject(DEFAULT_PALETTE); - palGDI = PALETTE_LockPalette(dc->dclevel.hpal); - - if (palGDI == NULL) - { - DPRINT1("IntGdiRealizePalette(): palGDI is NULL, exiting\n"); - DC_UnlockDc(dc); - return 0; - } - - sysGDI = PALETTE_LockPalette(systemPalette); - - if (sysGDI == NULL) - { - DPRINT1("IntGdiRealizePalette(): sysGDI is NULL, exiting\n"); - PALETTE_UnlockPalette(palGDI); - DC_UnlockDc(dc); - return 0; - } - - // The RealizePalette function modifies the palette for the device associated with the specified device context. If the - // device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device - // context is a display DC, the physical palette for that device is modified. - if(dc->dctype == DC_TYPE_MEMORY) - { - // Memory managed DC - DPRINT1("RealizePalette unimplemented for memory managed DCs\n"); - } else - { - DPRINT1("RealizePalette unimplemented for device DCs\n"); - } - - // need to pass this to IntEngCreateXlate with palettes unlocked - sysMode = sysGDI->Mode; - palMode = palGDI->Mode; - PALETTE_UnlockPalette(sysGDI); - PALETTE_UnlockPalette(palGDI); - - // Create the XLATEOBJ for device managed DCs - if(dc->dctype != DC_TYPE_MEMORY) - { - if (palGDI->logicalToSystem != NULL) - { - EngDeleteXlate(palGDI->logicalToSystem); - } - palGDI->logicalToSystem = IntEngCreateXlate(sysMode, palMode, systemPalette, dc->dclevel.hpal); - } - - DC_UnlockDc(dc); - - return realized; -} - -BOOL APIENTRY NtGdiResizePalette(HPALETTE hpal, - UINT Entries) -{ -/* PALOBJ *palPtr = (PALOBJ*)AccessUserObject(hPal); - UINT cPrevEnt, prevVer; - INT prevsize, size = sizeof(LOGPALETTE) + (cEntries - 1) * sizeof(PALETTEENTRY); - XLATEOBJ *XlateObj = NULL; - - if(!palPtr) return FALSE; - cPrevEnt = palPtr->logpalette->palNumEntries; - prevVer = palPtr->logpalette->palVersion; - prevsize = sizeof(LOGPALETTE) + (cPrevEnt - 1) * sizeof(PALETTEENTRY) + sizeof(int*) + sizeof(GDIOBJHDR); - size += sizeof(int*) + sizeof(GDIOBJHDR); - XlateObj = palPtr->logicalToSystem; - - if (!(palPtr = GDI_ReallocObject(size, hPal, palPtr))) return FALSE; - - if(XlateObj) - { - XLATEOBJ *NewXlateObj = (int*) HeapReAlloc(GetProcessHeap(), 0, XlateObj, cEntries * sizeof(int)); - if(NewXlateObj == NULL) - { - ERR("Can not resize logicalToSystem -- out of memory!"); - GDI_ReleaseObj( hPal ); - return FALSE; - } - palPtr->logicalToSystem = NewXlateObj; - } - - if(cEntries > cPrevEnt) - { - if(XlateObj) memset(palPtr->logicalToSystem + cPrevEnt, 0, (cEntries - cPrevEnt)*sizeof(int)); - memset( (BYTE*)palPtr + prevsize, 0, size - prevsize ); - PALETTE_ValidateFlags((PALETTEENTRY*)((BYTE*)palPtr + prevsize), cEntries - cPrevEnt ); - } - palPtr->logpalette->palNumEntries = cEntries; - palPtr->logpalette->palVersion = prevVer; -// GDI_ReleaseObj( hPal ); - return TRUE; */ - - UNIMPLEMENTED; - return FALSE; -} - -BOOL APIENTRY NtGdiSetColorAdjustment(HDC hDC, - LPCOLORADJUSTMENT ca) -{ - UNIMPLEMENTED; - return FALSE; -} - -UINT APIENTRY -IntSetPaletteEntries(HPALETTE hpal, - UINT Start, - UINT Entries, - CONST LPPALETTEENTRY pe) -{ - PPALETTE palGDI; - WORD numEntries; - - if ((UINT)hpal & GDI_HANDLE_STOCK_MASK) - { - return 0; - } - - palGDI = PALETTE_LockPalette(hpal); - if (!palGDI) return 0; - - numEntries = palGDI->NumColors; - if (Start >= numEntries) - { - PALETTE_UnlockPalette(palGDI); - return 0; - } - if (numEntries < Start + Entries) - { - Entries = numEntries - Start; - } - memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY)); - PALETTE_ValidateFlags(palGDI->IndexedColors, palGDI->NumColors); - if (palGDI->logicalToSystem) - ExFreePool(palGDI->logicalToSystem); - palGDI->logicalToSystem = NULL; - PALETTE_UnlockPalette(palGDI); - - return Entries; -} - -UINT APIENTRY -NtGdiSetSystemPaletteUse(HDC hDC, UINT Usage) -{ - UINT old = SystemPaletteUse; - - /* Device doesn't support colour palettes */ - if (!(NtGdiGetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)) { - return SYSPAL_ERROR; - } - - switch (Usage) - { - case SYSPAL_NOSTATIC: - case SYSPAL_NOSTATIC256: - case SYSPAL_STATIC: - SystemPaletteUse = Usage; - break; - - default: - old=SYSPAL_ERROR; - break; - } - - return old; -} - -BOOL -APIENTRY -NtGdiUnrealizeObject(HGDIOBJ hgdiobj) -{ - BOOL Ret = FALSE; - PPALETTE palGDI; - - if ( !hgdiobj || - ((UINT)hgdiobj & GDI_HANDLE_STOCK_MASK) || - !GDI_HANDLE_IS_TYPE(hgdiobj, GDI_OBJECT_TYPE_PALETTE) ) - return Ret; - - palGDI = PALETTE_LockPalette(hgdiobj); - if (!palGDI) return FALSE; - - // FIXME!! - // Need to do something!!! - // Zero out Current and Old Translated pointers? - // - Ret = TRUE; - PALETTE_UnlockPalette(palGDI); - return Ret; -} - -BOOL APIENTRY -NtGdiUpdateColors(HDC hDC) -{ - PWINDOW_OBJECT Wnd; - BOOL calledFromUser, ret; - USER_REFERENCE_ENTRY Ref; - - calledFromUser = UserIsEntered(); - - if (!calledFromUser){ - UserEnterExclusive(); - } - - Wnd = UserGetWindowObject(IntWindowFromDC(hDC)); - if (Wnd == NULL) - { - SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); - - if (!calledFromUser){ - UserLeave(); - } - - return FALSE; - } - - UserRefObjectCo(Wnd, &Ref); - ret = co_UserRedrawWindow(Wnd, NULL, 0, RDW_INVALIDATE); - UserDerefObjectCo(Wnd); - - if (!calledFromUser){ - UserLeave(); - } - - return ret; -} - -INT APIENTRY COLOR_PaletteLookupPixel(PALETTEENTRY *palPalEntry, INT size, - XLATEOBJ *XlateObj, COLORREF col, BOOL skipReserved) -{ - int i, best = 0, diff = 0x7fffffff; - int r, g, b; - - for( i = 0; i < size && diff ; i++ ) - { -#if 0 - if(!(palPalEntry[i].peFlags & PC_SYS_USED) || (skipReserved && palPalEntry[i].peFlags & PC_SYS_RESERVED)) - continue; -#endif - - r = abs((SHORT)palPalEntry[i].peRed - GetRValue(col)); - g = abs((SHORT)palPalEntry[i].peGreen - GetGValue(col)); - b = abs((SHORT)palPalEntry[i].peBlue - GetBValue(col)); - - r = r*r + g*g + b*b; - - if( r < diff ) { best = i; diff = r; } - } - - if (XlateObj == NULL) - return best; - else - return (XlateObj->pulXlate) ? (INT)XlateObj->pulXlate[best] : best; -} - -COLORREF APIENTRY COLOR_LookupNearestColor( PALETTEENTRY* palPalEntry, int size, COLORREF color ) -{ - INT index; - - index = COLOR_PaletteLookupPixel(palPalEntry, size, NULL, color, FALSE); - return RGB( - palPalEntry[index].peRed, - palPalEntry[index].peGreen, - palPalEntry[index].peBlue); -} - -int APIENTRY COLOR_PaletteLookupExactIndex( PALETTEENTRY* palPalEntry, int size, - COLORREF col ) -{ - int i; - BYTE r = GetRValue(col), g = GetGValue(col), b = GetBValue(col); - for( i = 0; i < size; i++ ) - { - if( palPalEntry[i].peFlags & PC_SYS_USED ) /* skips gap */ - if(palPalEntry[i].peRed == r && palPalEntry[i].peGreen == g && palPalEntry[i].peBlue == b) return i; - } - return -1; -} - - -W32KAPI -LONG -APIENTRY -NtGdiDoPalette( - IN HGDIOBJ hObj, - IN WORD iStart, - IN WORD cEntries, - IN LPVOID pUnsafeEntries, - IN DWORD iFunc, - IN BOOL bInbound) -{ - LONG ret; - LPVOID pEntries = NULL; - - /* FIXME: Handle bInbound correctly */ - - if (bInbound && - (pUnsafeEntries == NULL || cEntries == 0)) - { - return 0; - } - - if (pUnsafeEntries) - { - pEntries = ExAllocatePool(PagedPool, cEntries * sizeof(PALETTEENTRY)); - if (!pEntries) - return 0; - if (bInbound) - { - _SEH2_TRY - { - ProbeForRead(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); - memcpy(pEntries, pUnsafeEntries, cEntries * sizeof(PALETTEENTRY)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - ExFreePool(pEntries); - _SEH2_YIELD(return 0); - } - _SEH2_END - } - } - - ret = 0; - switch(iFunc) - { - case GdiPalAnimate: - if (pEntries) - ret = IntAnimatePalette((HPALETTE)hObj, iStart, cEntries, (CONST PPALETTEENTRY)pEntries); - break; - - case GdiPalSetEntries: - if (pEntries) - ret = IntSetPaletteEntries((HPALETTE)hObj, iStart, cEntries, (CONST LPPALETTEENTRY)pEntries); - break; - - case GdiPalGetEntries: - ret = IntGetPaletteEntries((HPALETTE)hObj, iStart, cEntries, (LPPALETTEENTRY)pEntries); - break; - - case GdiPalGetSystemEntries: - ret = IntGetSystemPaletteEntries((HDC)hObj, iStart, cEntries, (LPPALETTEENTRY)pEntries); - break; - - case GdiPalSetColorTable: - if (pEntries) - ret = IntSetDIBColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pEntries); - break; - - case GdiPalGetColorTable: - if (pEntries) - ret = IntGetDIBColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pEntries); - break; - } - - if (pEntries) - { - if (!bInbound) - { - _SEH2_TRY - { - ProbeForWrite(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); - memcpy(pUnsafeEntries, pEntries, cEntries * sizeof(PALETTEENTRY)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - ret = 0; - } - _SEH2_END - } - ExFreePool(pEntries); - } - - return ret; -} - -/* EOF */ Copied: trunk/reactos/subsystems/win32/win32k/objects/palette.c (from r41760, trunk/reactos/subsystems/win32/win32k/eng/palette.c) URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/palette.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/palette.c [iso-8859-1] Sat Jul 4 04:18:32 2009 @@ -3,7 +3,8 @@ * PROJECT: ReactOS kernel * PURPOSE: GDI Palette Functions * FILE: subsys/win32k/eng/palette.c - * PROGRAMER: Jason Filby + * PROGRAMERS: Jason Filby + * Timo Kreuzer */ #include <w32k.h> @@ -11,9 +12,270 @@ #define NDEBUG #include <debug.h> -// -// -// +static UINT SystemPaletteUse = SYSPAL_NOSTATIC; /* the program need save the pallete and restore it */ + +const PALETTEENTRY COLOR_sysPalTemplate[NB_RESERVED_COLORS] = +{ + // first 10 entries in the system palette + // red green blue flags + { 0x00, 0x00, 0x00, PC_SYS_USED }, + { 0x80, 0x00, 0x00, PC_SYS_USED }, + { 0x00, 0x80, 0x00, PC_SYS_USED }, + { 0x80, 0x80, 0x00, PC_SYS_USED }, + { 0x00, 0x00, 0x80, PC_SYS_USED }, + { 0x80, 0x00, 0x80, PC_SYS_USED }, + { 0x00, 0x80, 0x80, PC_SYS_USED }, + { 0xc0, 0xc0, 0xc0, PC_SYS_USED }, + { 0xc0, 0xdc, 0xc0, PC_SYS_USED }, + { 0xa6, 0xca, 0xf0, PC_SYS_USED }, + + // ... c_min/2 dynamic colorcells + // ... gap (for sparse palettes) + // ... c_min/2 dynamic colorcells + + { 0xff, 0xfb, 0xf0, PC_SYS_USED }, + { 0xa0, 0xa0, 0xa4, PC_SYS_USED }, + { 0x80, 0x80, 0x80, PC_SYS_USED }, + { 0xff, 0x00, 0x00, PC_SYS_USED }, + { 0x00, 0xff, 0x00, PC_SYS_USED }, + { 0xff, 0xff, 0x00, PC_SYS_USED }, + { 0x00, 0x00, 0xff, PC_SYS_USED }, + { 0xff, 0x00, 0xff, PC_SYS_USED }, + { 0x00, 0xff, 0xff, PC_SYS_USED }, + { 0xff, 0xff, 0xff, PC_SYS_USED } // last 10 +}; + +const PALETTEENTRY* FASTCALL COLOR_GetSystemPaletteTemplate(void) +{ + return (const PALETTEENTRY*)&COLOR_sysPalTemplate; +} + +INT APIENTRY COLOR_PaletteLookupPixel(PALETTEENTRY *palPalEntry, INT size, + XLATEOBJ *XlateObj, COLORREF col, BOOL skipReserved) +{ + int i, best = 0, diff = 0x7fffffff; + int r, g, b; + + for( i = 0; i < size && diff ; i++ ) + { +#if 0 + if(!(palPalEntry[i].peFlags & PC_SYS_USED) || (skipReserved && palPalEntry[i].peFlags & PC_SYS_RESERVED)) + continue; +#endif + + r = abs((SHORT)palPalEntry[i].peRed - GetRValue(col)); + g = abs((SHORT)palPalEntry[i].peGreen - GetGValue(col)); + b = abs((SHORT)palPalEntry[i].peBlue - GetBValue(col)); + + r = r*r + g*g + b*b; + + if( r < diff ) { best = i; diff = r; } + } + + if (XlateObj == NULL) + return best; + else + return (XlateObj->pulXlate) ? (INT)XlateObj->pulXlate[best] : best; +} + +COLORREF APIENTRY COLOR_LookupNearestColor( PALETTEENTRY* palPalEntry, int size, COLORREF color ) +{ + INT index; + + index = COLOR_PaletteLookupPixel(palPalEntry, size, NULL, color, FALSE); + return RGB( + palPalEntry[index].peRed, + palPalEntry[index].peGreen, + palPalEntry[index].peBlue); +} + +unsigned short GetNumberOfBits(unsigned int dwMask) +{ + unsigned short wBits; + for (wBits = 0; dwMask; dwMask = dwMask & (dwMask - 1)) + wBits++; + return wBits; +} + +// Create the system palette +HPALETTE FASTCALL PALETTE_Init(VOID) +{ + int i; + HPALETTE hpalette; + PLOGPALETTE palPtr; +#ifndef NO_MAPPING + PALOBJ *palObj; +#endif + const PALETTEENTRY* __sysPalTemplate = (const PALETTEENTRY*)COLOR_GetSystemPaletteTemplate(); + + // create default palette (20 system colors) + palPtr = ExAllocatePoolWithTag(PagedPool, + sizeof(LOGPALETTE) + + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), + TAG_PALETTE); + if (!palPtr) return FALSE; + + palPtr->palVersion = 0x300; + palPtr->palNumEntries = NB_RESERVED_COLORS; + for (i=0; i<NB_RESERVED_COLORS; i++) + { + palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed; + palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen; + palPtr->palPalEntry[i].peBlue = __sysPalTemplate[i].peBlue; + palPtr->palPalEntry[i].peFlags = 0; + } + + hpalette = NtGdiCreatePaletteInternal(palPtr,NB_RESERVED_COLORS); + ExFreePoolWithTag(palPtr, TAG_PALETTE); + +#ifndef NO_MAPPING + palObj = (PALOBJ*)PALETTE_LockPalette(hpalette); + if (palObj) + { + if (!(palObj->mapping = ExAllocatePool(PagedPool, sizeof(int) * 20))) + { + DbgPrint("Win32k: Can not create palette mapping -- out of memory!"); + return FALSE; + } + PALETTE_UnlockPalette(palObj); + } +#endif + + /* palette_size = visual->map_entries; */ + + return hpalette; +} + +VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY* lpPalE, INT size) +{ + int i = 0; + for (; i<size ; i++) + lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07); +} + +HPALETTE +FASTCALL +PALETTE_AllocPalette(ULONG Mode, + ULONG NumColors, + ULONG *Colors, + ULONG Red, + ULONG Green, + ULONG Blue) +{ + HPALETTE NewPalette; + PPALETTE PalGDI; + + PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); + if (!PalGDI) + { + return NULL; + } + + NewPalette = PalGDI->BaseObject.hHmgr; + + PalGDI->Self = NewPalette; + PalGDI->Mode = Mode; + + if (NULL != Colors) + { + PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, + sizeof(PALETTEENTRY) * NumColors, + TAG_PALETTE); + if (NULL == PalGDI->IndexedColors) + { + PALETTE_UnlockPalette(PalGDI); + PALETTE_FreePaletteByHandle(NewPalette); + return NULL; + } + RtlCopyMemory(PalGDI->IndexedColors, Colors, sizeof(PALETTEENTRY) * NumColors); + } + + if (PAL_INDEXED == Mode) + { + PalGDI->NumColors = NumColors; + } + else if (PAL_BITFIELDS == Mode) + { + PalGDI->RedMask = Red; + PalGDI->GreenMask = Green; + PalGDI->BlueMask = Blue; + } + + PALETTE_UnlockPalette(PalGDI); + + return NewPalette; +} + +HPALETTE +FASTCALL +PALETTE_AllocPaletteIndexedRGB(ULONG NumColors, + CONST RGBQUAD *Colors) +{ + HPALETTE NewPalette; + PPALETTE PalGDI; + UINT i; + + PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); + if (!PalGDI) + { + return NULL; + } + + NewPalette = PalGDI->BaseObject.hHmgr; + + PalGDI->Self = NewPalette; + PalGDI->Mode = PAL_INDEXED; + + PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, + sizeof(PALETTEENTRY) * NumColors, + TAG_PALETTE); + if (NULL == PalGDI->IndexedColors) + { + PALETTE_UnlockPalette(PalGDI); + PALETTE_FreePaletteByHandle(NewPalette); + return NULL; + } + + for (i = 0; i < NumColors; i++) + { + PalGDI->IndexedColors[i].peRed = Colors[i].rgbRed; + PalGDI->IndexedColors[i].peGreen = Colors[i].rgbGreen; + PalGDI->IndexedColors[i].peBlue = Colors[i].rgbBlue; + PalGDI->IndexedColors[i].peFlags = 0; + } + + PalGDI->NumColors = NumColors; + + PALETTE_UnlockPalette(PalGDI); + + return NewPalette; +} + +BOOL INTERNAL_CALL +PALETTE_Cleanup(PVOID ObjectBody) +{ + PPALETTE pPal = (PPALETTE)ObjectBody; + if (NULL != pPal->IndexedColors) + { + ExFreePool(pPal->IndexedColors); + } + + return TRUE; +} + +INT FASTCALL +PALETTE_GetObject(PPALETTE pGdiObject, INT cbCount, LPLOGBRUSH lpBuffer) +{ + if (!lpBuffer) + { + return sizeof(WORD); + } + + if ((UINT)cbCount < sizeof(WORD)) return 0; + *((WORD*)lpBuffer) = (WORD)pGdiObject->NumColors; + return sizeof(WORD); +} + VOID FASTCALL ColorCorrection(PPALETTE PalGDI, PPALETTEENTRY PaletteEntry, ULONG Colors) @@ -35,6 +297,8 @@ } return; } + +/** Display Driver Interface **************************************************/ /* * @implemented @@ -98,4 +362,753 @@ return Colors; } + +/** Systemcall Interface ******************************************************/ + +/* + * @implemented + */ +HPALETTE APIENTRY +NtGdiCreatePaletteInternal ( IN LPLOGPALETTE pLogPal, IN UINT cEntries ) +{ + PPALETTE PalGDI; + HPALETTE NewPalette; + + pLogPal->palNumEntries = cEntries; + NewPalette = PALETTE_AllocPalette( PAL_INDEXED, + cEntries, + (PULONG)pLogPal->palPalEntry, + 0, 0, 0); + + if (NewPalette == NULL) + { + return NULL; + } + + PalGDI = (PPALETTE) PALETTE_LockPalette(NewPalette); + if (PalGDI != NULL) + { + PALETTE_ValidateFlags(PalGDI->IndexedColors, PalGDI->NumColors); + PalGDI->logicalToSystem = NULL; + PALETTE_UnlockPalette(PalGDI); + } + else + { + /* FIXME - Handle PalGDI == NULL!!!! */ + DPRINT1("waring PalGDI is NULL \n"); + } + return NewPalette; +} + +HPALETTE APIENTRY NtGdiCreateHalftonePalette(HDC hDC) +{ + int i, r, g, b; + struct { + WORD Version; + WORD NumberOfEntries; + PALETTEENTRY aEntries[256]; + } Palette; + + Palette.Version = 0x300; + Palette.NumberOfEntries = 256; + if (IntGetSystemPaletteEntries(hDC, 0, 256, Palette.aEntries) == 0) + { + /* from wine, more that 256 color math */ + Palette.NumberOfEntries = 20; + for (i = 0; i < Palette.NumberOfEntries; i++) + { + Palette.aEntries[i].peRed=0xff; + Palette.aEntries[i].peGreen=0xff; + Palette.aEntries[i].peBlue=0xff; + Palette.aEntries[i].peFlags=0x00; + } + + Palette.aEntries[0].peRed=0x00; + Palette.aEntries[0].peBlue=0x00; + Palette.aEntries[0].peGreen=0x00; + + /* the first 6 */ + for (i=1; i <= 6; i++) + { + Palette.aEntries[i].peRed=(i%2)?0x80:0; + Palette.aEntries[i].peGreen=(i==2)?0x80:(i==3)?0x80:(i==6)?0x80:0; + Palette.aEntries[i].peBlue=(i>3)?0x80:0; + } + + for (i=7; i <= 12; i++) + { + switch(i) + { + case 7: + Palette.aEntries[i].peRed=0xc0; + Palette.aEntries[i].peBlue=0xc0; + Palette.aEntries[i].peGreen=0xc0; + break; + case 8: + Palette.aEntries[i].peRed=0xc0; + Palette.aEntries[i].peGreen=0xdc; + Palette.aEntries[i].peBlue=0xc0; + break; + case 9: + Palette.aEntries[i].peRed=0xa6; + Palette.aEntries[i].peGreen=0xca; + Palette.aEntries[i].peBlue=0xf0; + break; + case 10: + Palette.aEntries[i].peRed=0xff; + Palette.aEntries[i].peGreen=0xfb; + Palette.aEntries[i].peBlue=0xf0; + break; + case 11: + Palette.aEntries[i].peRed=0xa0; + Palette.aEntries[i].peGreen=0xa0; + Palette.aEntries[i].peBlue=0xa4; + break; + case 12: + Palette.aEntries[i].peRed=0x80; + Palette.aEntries[i].peGreen=0x80; + Palette.aEntries[i].peBlue=0x80; + } + } + + for (i=13; i <= 18; i++) + { + Palette.aEntries[i].peRed=(i%2)?0xff:0; + Palette.aEntries[i].peGreen=(i==14)?0xff:(i==15)?0xff:(i==18)?0xff:0; + Palette.aEntries[i].peBlue=(i>15)?0xff:0x00; + } + } + else + { + /* 256 color table */ + for (r = 0; r < 6; r++) + for (g = 0; g < 6; g++) + for (b = 0; b < 6; b++) + { + i = r + g*6 + b*36 + 10; + Palette.aEntries[i].peRed = r * 51; + Palette.aEntries[i].peGreen = g * 51; + Palette.aEntries[i].peBlue = b * 51; + } + + for (i = 216; i < 246; i++) + { + int v = (i - 216) << 3; + Palette.aEntries[i].peRed = v; + Palette.aEntries[i].peGreen = v; + Palette.aEntries[i].peBlue = v; + } + } + + return NtGdiCreatePaletteInternal((LOGPALETTE *)&Palette, Palette.NumberOfEntries); +} + +BOOL +APIENTRY +NtGdiResizePalette( + HPALETTE hpal, + UINT Entries) +{ +/* PALOBJ *palPtr = (PALOBJ*)AccessUserObject(hPal); + UINT cPrevEnt, prevVer; + INT prevsize, size = sizeof(LOGPALETTE) + (cEntries - 1) * sizeof(PALETTEENTRY); + XLATEOBJ *XlateObj = NULL; + + if(!palPtr) return FALSE; + cPrevEnt = palPtr->logpalette->palNumEntries; + prevVer = palPtr->logpalette->palVersion; + prevsize = sizeof(LOGPALETTE) + (cPrevEnt - 1) * sizeof(PALETTEENTRY) + sizeof(int*) + sizeof(GDIOBJHDR); + size += sizeof(int*) + sizeof(GDIOBJHDR); + XlateObj = palPtr->logicalToSystem; + + if (!(palPtr = GDI_ReallocObject(size, hPal, palPtr))) return FALSE; + + if(XlateObj) + { + XLATEOBJ *NewXlateObj = (int*) HeapReAlloc(GetProcessHeap(), 0, XlateObj, cEntries * sizeof(int)); + if(NewXlateObj == NULL) + { + ERR("Can not resize logicalToSystem -- out of memory!"); + GDI_ReleaseObj( hPal ); + return FALSE; + } + palPtr->logicalToSystem = NewXlateObj; + } + + if(cEntries > cPrevEnt) + { + if(XlateObj) memset(palPtr->logicalToSystem + cPrevEnt, 0, (cEntries - cPrevEnt)*sizeof(int)); + memset( (BYTE*)palPtr + prevsize, 0, size - prevsize ); + PALETTE_ValidateFlags((PALETTEENTRY*)((BYTE*)palPtr + prevsize), cEntries - cPrevEnt ); + } + palPtr->logpalette->palNumEntries = cEntries; + palPtr->logpalette->palVersion = prevVer; +// GDI_ReleaseObj( hPal ); + return TRUE; */ + + UNIMPLEMENTED; + return FALSE; +} + +BOOL +APIENTRY +NtGdiGetColorAdjustment( + HDC hdc, + LPCOLORADJUSTMENT pca) +{ + UNIMPLEMENTED; + return FALSE; +} + +BOOL +APIENTRY +NtGdiSetColorAdjustment( + HDC hdc, + LPCOLORADJUSTMENT pca) +{ + UNIMPLEMENTED; + return FALSE; +} + +COLORREF APIENTRY NtGdiGetNearestColor(HDC hDC, COLORREF Color) +{ + COLORREF nearest = CLR_INVALID; + PDC dc; + PPALETTE palGDI; + LONG RBits, GBits, BBits; + + dc = DC_LockDc(hDC); + if (NULL != dc) + { + HPALETTE hpal = dc->dclevel.hpal; + palGDI = (PPALETTE) PALETTE_LockPalette(hpal); + if (!palGDI) + { + DC_UnlockDc(dc); + return nearest; + } + + switch (palGDI->Mode) + { + case PAL_INDEXED: + nearest = COLOR_LookupNearestColor(palGDI->IndexedColors, + palGDI->NumColors, Color); + break; + case PAL_BGR: + case PAL_RGB: + nearest = Color; + break; + case PAL_BITFIELDS: + RBits = 8 - GetNumberOfBits(palGDI->RedMask); + GBits = 8 - GetNumberOfBits(palGDI->GreenMask); + BBits = 8 - GetNumberOfBits(palGDI->BlueMask); + nearest = RGB( + (GetRValue(Color) >> RBits) << RBits, + (GetGValue(Color) >> GBits) << GBits, + (GetBValue(Color) >> BBits) << BBits); + break; + } + PALETTE_UnlockPalette(palGDI); + DC_UnlockDc(dc); + } + + return nearest; +} + +UINT +APIENTRY +NtGdiGetNearestPaletteIndex( + HPALETTE hpal, + COLORREF crColor) +{ + PPALETTE ppal = (PPALETTE) PALETTE_LockPalette(hpal); + UINT index = 0; + + if (ppal) + { + /* Return closest match for the given RGB color */ + index = COLOR_PaletteLookupPixel(ppal->IndexedColors, + ppal->NumColors, + NULL, + crColor, + FALSE); + PALETTE_UnlockPalette(ppal); + } + + return index; +} + +UINT +FASTCALL +IntGdiRealizePalette(HDC hDC) +{ + /* + * This function doesn't do any real work now and there's plenty + * of bugs in it. + */ + + PPALETTE palGDI, sysGDI; + int realized = 0; + PDC dc; + HPALETTE systemPalette; + USHORT sysMode, palMode; + + dc = DC_LockDc(hDC); + if (!dc) return 0; + + systemPalette = NtGdiGetStockObject(DEFAULT_PALETTE); + palGDI = PALETTE_LockPalette(dc->dclevel.hpal); + + if (palGDI == NULL) + { + DPRINT1("IntGdiRealizePalette(): palGDI is NULL, exiting\n"); + DC_UnlockDc(dc); + return 0; + } + + sysGDI = PALETTE_LockPalette(systemPalette); + + if (sysGDI == NULL) + { + DPRINT1("IntGdiRealizePalette(): sysGDI is NULL, exiting\n"); + PALETTE_UnlockPalette(palGDI); + DC_UnlockDc(dc); + return 0; + } + + // The RealizePalette function modifies the palette for the device associated with the specified device context. If the + // device context is a memory DC, the color table for the bitmap selected into the DC is modified. If the device + // context is a display DC, the physical palette for that device is modified. + if(dc->dctype == DC_TYPE_MEMORY) + { + // Memory managed DC + DPRINT1("RealizePalette unimplemented for memory managed DCs\n"); + } else + { + DPRINT1("RealizePalette unimplemented for device DCs\n"); + } + + // need to pass this to IntEngCreateXlate with palettes unlocked + sysMode = sysGDI->Mode; + palMode = palGDI->Mode; + PALETTE_UnlockPalette(sysGDI); + PALETTE_UnlockPalette(palGDI); + + // Create the XLATEOBJ for device managed DCs + if(dc->dctype != DC_TYPE_MEMORY) + { + if (palGDI->logicalToSystem != NULL) + { + EngDeleteXlate(palGDI->logicalToSystem); + } + palGDI->logicalToSystem = IntEngCreateXlate(sysMode, palMode, systemPalette, dc->dclevel.hpal); + } + + DC_UnlockDc(dc); + + return realized; +} + +UINT APIENTRY +IntAnimatePalette(HPALETTE hPal, + UINT StartIndex, + UINT NumEntries, + CONST PPALETTEENTRY PaletteColors) +{ + UINT ret = 0; + + if( hPal != NtGdiGetStockObject(DEFAULT_PALETTE) ) + { + PPALETTE palPtr; + UINT pal_entries; + HDC hDC; + PDC dc; + PWINDOW_OBJECT Wnd; + const PALETTEENTRY *pptr = PaletteColors; + + palPtr = (PPALETTE)PALETTE_LockPalette(hPal); + if (!palPtr) return FALSE; + + pal_entries = palPtr->NumColors; + if (StartIndex >= pal_entries) + { + PALETTE_UnlockPalette(palPtr); + return FALSE; + } + if (StartIndex+NumEntries > pal_entries) NumEntries = pal_entries - StartIndex; + + for (NumEntries += StartIndex; StartIndex < NumEntries; StartIndex++, pptr++) + { + /* According to MSDN, only animate PC_RESERVED colours */ + if (palPtr->IndexedColors[StartIndex].peFlags & PC_RESERVED) + { + memcpy( &palPtr->IndexedColors[StartIndex], pptr, + sizeof(PALETTEENTRY) ); + ret++; + PALETTE_ValidateFlags(&palPtr->IndexedColors[StartIndex], 1); + } + } + + PALETTE_UnlockPalette(palPtr); + + /* Immediately apply the new palette if current window uses it */ + Wnd = UserGetDesktopWindow(); + hDC = UserGetWindowDC(Wnd); + dc = DC_LockDc(hDC); + if (NULL != dc) + { + if (dc->dclevel.hpal == hPal) + { + DC_UnlockDc(dc); + IntGdiRealizePalette(hDC); + } + else + DC_UnlockDc(dc); + } + UserReleaseDC(Wnd,hDC, FALSE); + } + return ret; +} + +UINT APIENTRY +IntGetPaletteEntries( + HPALETTE hpal, + UINT StartIndex, + UINT Entries, + LPPALETTEENTRY pe) +{ + PPALETTE palGDI; + UINT numEntries; + + palGDI = (PPALETTE) PALETTE_LockPalette(hpal); + if (NULL == palGDI) + { + return 0; + } + + numEntries = palGDI->NumColors; + if (NULL != pe) + { + if (numEntries < StartIndex + Entries) + { + Entries = numEntries - StartIndex; + } + if (numEntries <= StartIndex) + { + PALETTE_UnlockPalette(palGDI); + return 0; + } + memcpy(pe, palGDI->IndexedColors + StartIndex, Entries * sizeof(PALETTEENTRY)); + for (numEntries = 0; numEntries < Entries; numEntries++) + { + if (pe[numEntries].peFlags & 0xF0) + { + pe[numEntries].peFlags = 0; + } + } + } + else + { + Entries = numEntries; + } + + PALETTE_UnlockPalette(palGDI); + return Entries; +} + +UINT APIENTRY +IntGetSystemPaletteEntries(HDC hDC, + UINT StartIndex, + UINT Entries, + LPPALETTEENTRY pe) +{ + PPALETTE palGDI = NULL; + PDC dc = NULL; + UINT EntriesSize = 0; + UINT Ret = 0; + + if (Entries == 0) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + + if (pe != NULL) + { + EntriesSize = Entries * sizeof(pe[0]); + if (Entries != EntriesSize / sizeof(pe[0])) + { + /* Integer overflow! */ + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return 0; + } + } + + if (!(dc = DC_LockDc(hDC))) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return 0; + } + + palGDI = PALETTE_LockPalette(dc->dclevel.hpal); + if (palGDI != NULL) + { + if (pe != NULL) + { + if (StartIndex >= palGDI->NumColors) + Entries = 0; + else if (Entries > palGDI->NumColors - StartIndex) + Entries = palGDI->NumColors - StartIndex; + + memcpy(pe, + palGDI->IndexedColors + StartIndex, + Entries * sizeof(pe[0])); + + Ret = Entries; + } + else + { + Ret = dc->ppdev->GDIInfo.ulNumPalReg; + } + } + + if (palGDI != NULL) + PALETTE_UnlockPalette(palGDI); + + if (dc != NULL) + DC_UnlockDc(dc); + + return Ret; +} + +UINT +APIENTRY +IntSetPaletteEntries( + HPALETTE hpal, + UINT Start, + UINT Entries, + CONST LPPALETTEENTRY pe) +{ + PPALETTE palGDI; + WORD numEntries; + + if ((UINT)hpal & GDI_HANDLE_STOCK_MASK) + { + return 0; + } + + palGDI = PALETTE_LockPalette(hpal); + if (!palGDI) return 0; + + numEntries = palGDI->NumColors; + if (Start >= numEntries) + { + PALETTE_UnlockPalette(palGDI); + return 0; + } + if (numEntries < Start + Entries) + { + Entries = numEntries - Start; + } + memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY)); + PALETTE_ValidateFlags(palGDI->IndexedColors, palGDI->NumColors); + if (palGDI->logicalToSystem) + ExFreePool(palGDI->logicalToSystem); + palGDI->logicalToSystem = NULL; + PALETTE_UnlockPalette(palGDI); + + return Entries; +} + +W32KAPI +LONG +APIENTRY +NtGdiDoPalette( + IN HGDIOBJ hObj, + IN WORD iStart, + IN WORD cEntries, + IN LPVOID pUnsafeEntries, + IN DWORD iFunc, + IN BOOL bInbound) +{ + LONG ret; + LPVOID pEntries = NULL; + + /* FIXME: Handle bInbound correctly */ + + if (bInbound && + (pUnsafeEntries == NULL || cEntries == 0)) + { + return 0; + } + + if (pUnsafeEntries) + { + pEntries = ExAllocatePool(PagedPool, cEntries * sizeof(PALETTEENTRY)); + if (!pEntries) + return 0; + if (bInbound) + { + _SEH2_TRY + { + ProbeForRead(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); + memcpy(pEntries, pUnsafeEntries, cEntries * sizeof(PALETTEENTRY)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ExFreePool(pEntries); + _SEH2_YIELD(return 0); + } + _SEH2_END + } + } + + ret = 0; + switch(iFunc) + { + case GdiPalAnimate: + if (pEntries) + ret = IntAnimatePalette((HPALETTE)hObj, iStart, cEntries, (CONST PPALETTEENTRY)pEntries); + break; + + case GdiPalSetEntries: + if (pEntries) + ret = IntSetPaletteEntries((HPALETTE)hObj, iStart, cEntries, (CONST LPPALETTEENTRY)pEntries); + break; + + case GdiPalGetEntries: + ret = IntGetPaletteEntries((HPALETTE)hObj, iStart, cEntries, (LPPALETTEENTRY)pEntries); + break; + + case GdiPalGetSystemEntries: + ret = IntGetSystemPaletteEntries((HDC)hObj, iStart, cEntries, (LPPALETTEENTRY)pEntries); + break; + + case GdiPalSetColorTable: + if (pEntries) + ret = IntSetDIBColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pEntries); + break; + + case GdiPalGetColorTable: + if (pEntries) + ret = IntGetDIBColorTable((HDC)hObj, iStart, cEntries, (RGBQUAD*)pEntries); + break; + } + + if (pEntries) + { + if (!bInbound) + { + _SEH2_TRY + { + ProbeForWrite(pUnsafeEntries, cEntries * sizeof(PALETTEENTRY), 1); + memcpy(pUnsafeEntries, pEntries, cEntries * sizeof(PALETTEENTRY)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + ret = 0; + } + _SEH2_END + } + ExFreePool(pEntries); + } + + return ret; +} + +UINT APIENTRY +NtGdiSetSystemPaletteUse(HDC hDC, UINT Usage) +{ + UINT old = SystemPaletteUse; + + /* Device doesn't support colour palettes */ + if (!(NtGdiGetDeviceCaps(hDC, RASTERCAPS) & RC_PALETTE)) { + return SYSPAL_ERROR; + } + + switch (Usage) + { + case SYSPAL_NOSTATIC: + case SYSPAL_NOSTATIC256: + case SYSPAL_STATIC: + SystemPaletteUse = Usage; + break; + + default: + old=SYSPAL_ERROR; + break; + } + + return old; +} + +UINT +APIENTRY +NtGdiGetSystemPaletteUse(HDC hDC) +{ + return SystemPaletteUse; +} + +BOOL +APIENTRY +NtGdiUpdateColors(HDC hDC) +{ + PWINDOW_OBJECT Wnd; + BOOL calledFromUser, ret; + USER_REFERENCE_ENTRY Ref; + + calledFromUser = UserIsEntered(); + + if (!calledFromUser){ + UserEnterExclusive(); + } + + Wnd = UserGetWindowObject(IntWindowFromDC(hDC)); + if (Wnd == NULL) + { + SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); + + if (!calledFromUser){ + UserLeave(); + } + + return FALSE; + } + + UserRefObjectCo(Wnd, &Ref); + ret = co_UserRedrawWindow(Wnd, NULL, 0, RDW_INVALIDATE); + UserDerefObjectCo(Wnd); + + if (!calledFromUser){ + UserLeave(); + } + + return ret; +} + +BOOL +APIENTRY +NtGdiUnrealizeObject(HGDIOBJ hgdiobj) +{ + BOOL Ret = FALSE; + PPALETTE palGDI; + + if ( !hgdiobj || + ((UINT)hgdiobj & GDI_HANDLE_STOCK_MASK) || + !GDI_HANDLE_IS_TYPE(hgdiobj, GDI_OBJECT_TYPE_PALETTE) ) + return Ret; + + palGDI = PALETTE_LockPalette(hgdiobj); + if (!palGDI) return FALSE; + + // FIXME!! + // Need to do something!!! + // Zero out Current and Old Translated pointers? + // + Ret = TRUE; + PALETTE_UnlockPalette(palGDI); + return Ret; +} + + /* EOF */ Removed: trunk/reactos/subsystems/win32/win32k/objects/palobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/palobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/palobj.c (removed) @@ -1,362 +1,0 @@ -/* - * ReactOS W32 Subsystem - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <w32k.h> - -#define NDEBUG -#include <debug.h> - -#ifndef NO_MAPPING -static int PALETTE_firstFree = 0; -static unsigned char PALETTE_freeList[256]; -#endif - -int PALETTE_PaletteFlags = 0; -PALETTEENTRY *COLOR_sysPal = NULL; -int COLOR_gapStart; -int COLOR_gapEnd; -int COLOR_gapFilled; -int COLOR_max; - -PPALETTEENTRY FASTCALL ReturnSystemPalette(VOID) -{ - return COLOR_sysPal; -} - -BOOL INTERNAL_CALL -PALETTE_Cleanup(PVOID ObjectBody) -{ - PPALETTE pPal = (PPALETTE)ObjectBody; - if (NULL != pPal->IndexedColors) - { - ExFreePool(pPal->IndexedColors); - } - - return TRUE; -} - -HPALETTE -FASTCALL -PALETTE_AllocPalette(ULONG Mode, - ULONG NumColors, - ULONG *Colors, - ULONG Red, - ULONG Green, - ULONG Blue) -{ - HPALETTE NewPalette; - PPALETTE PalGDI; - - PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); - if (!PalGDI) - { - return NULL; - } - - NewPalette = PalGDI->BaseObject.hHmgr; - - PalGDI->Self = NewPalette; - PalGDI->Mode = Mode; - - if (NULL != Colors) - { - PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, - sizeof(PALETTEENTRY) * NumColors, - TAG_PALETTE); - if (NULL == PalGDI->IndexedColors) - { - PALETTE_UnlockPalette(PalGDI); - PALETTE_FreePaletteByHandle(NewPalette); - return NULL; - } - RtlCopyMemory(PalGDI->IndexedColors, Colors, sizeof(PALETTEENTRY) * NumColors); - } - - if (PAL_INDEXED == Mode) - { - PalGDI->NumColors = NumColors; - } - else if (PAL_BITFIELDS == Mode) - { - PalGDI->RedMask = Red; - PalGDI->GreenMask = Green; - PalGDI->BlueMask = Blue; - } - - PALETTE_UnlockPalette(PalGDI); - - return NewPalette; -} - -HPALETTE -FASTCALL -PALETTE_AllocPaletteIndexedRGB(ULONG NumColors, - CONST RGBQUAD *Colors) -{ - HPALETTE NewPalette; - PPALETTE PalGDI; - UINT i; - - PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); - if (!PalGDI) - { - return NULL; - } - - NewPalette = PalGDI->BaseObject.hHmgr; - - PalGDI->Self = NewPalette; - PalGDI->Mode = PAL_INDEXED; - - PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, - sizeof(PALETTEENTRY) * NumColors, - TAG_PALETTE); - if (NULL == PalGDI->IndexedColors) - { - PALETTE_UnlockPalette(PalGDI); - PALETTE_FreePaletteByHandle(NewPalette); - return NULL; - } - - for (i = 0; i < NumColors; i++) - { - PalGDI->IndexedColors[i].peRed = Colors[i].rgbRed; - PalGDI->IndexedColors[i].peGreen = Colors[i].rgbGreen; - PalGDI->IndexedColors[i].peBlue = Colors[i].rgbBlue; - PalGDI->IndexedColors[i].peFlags = 0; - } - - PalGDI->NumColors = NumColors; - - PALETTE_UnlockPalette(PalGDI); - - return NewPalette; -} - -// Create the system palette -HPALETTE FASTCALL PALETTE_Init(VOID) -{ - int i; - HPALETTE hpalette; - PLOGPALETTE palPtr; -#ifndef NO_MAPPING - PALOBJ *palObj; -#endif - const PALETTEENTRY* __sysPalTemplate = (const PALETTEENTRY*)COLOR_GetSystemPaletteTemplate(); - - // create default palette (20 system colors) - palPtr = ExAllocatePoolWithTag(PagedPool, - sizeof(LOGPALETTE) + - (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), - TAG_PALETTE); - if (!palPtr) return FALSE; - - palPtr->palVersion = 0x300; - palPtr->palNumEntries = NB_RESERVED_COLORS; - for (i=0; i<NB_RESERVED_COLORS; i++) - { - palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed; - palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen; - palPtr->palPalEntry[i].peBlue = __sysPalTemplate[i].peBlue; - palPtr->palPalEntry[i].peFlags = 0; - } - - hpalette = NtGdiCreatePaletteInternal(palPtr,NB_RESERVED_COLORS); - ExFreePoolWithTag(palPtr, TAG_PALETTE); - -#ifndef NO_MAPPING - palObj = (PALOBJ*)PALETTE_LockPalette(hpalette); - if (palObj) - { - if (!(palObj->mapping = ExAllocatePool(PagedPool, sizeof(int) * 20))) - { - DbgPrint("Win32k: Can not create palette mapping -- out of memory!"); - return FALSE; - } - PALETTE_UnlockPalette(palObj); - } -#endif - - /* palette_size = visual->map_entries; */ - - return hpalette; -} - -#ifndef NO_MAPPING -static void FASTCALL PALETTE_FormatSystemPalette(void) -{ - // Build free list so we'd have an easy way to find - // out if there are any available colorcells. - - int i, j = PALETTE_firstFree = NB_RESERVED_COLORS/2; - - COLOR_sysPal[j].peFlags = 0; - for (i = (NB_RESERVED_COLORS>>1) + 1 ; i < 256 - (NB_RESERVED_COLORS>>1) ; i++) - { - if (i < COLOR_gapStart || i > COLOR_gapEnd) - { - COLOR_sysPal[i].peFlags = 0; // unused tag - PALETTE_freeList[j] = i; // next - j = i; - } - } - PALETTE_freeList[j] = 0; -} -#endif - -VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY* lpPalE, INT size) -{ - int i = 0; - for (; i<size ; i++) - lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07); -} - -#ifndef NO_MAPPING -// Set the color-mapping table for selected palette. -// Return number of entries which mapping has changed. -INT APIENTRY PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapOnly) -{ - char flag; - int prevMapping = (palPtr->mapping) ? 1 : 0; - int index, iRemapped = 0; - int *mapping; - HPALETTE hSysPal = NtGdiGetStockObject(DEFAULT_PALETTE); - PPALETTE pSysPal = PALETTE_LockPalette(hSysPal); - PPALETTE palGDI = CONTAINING_RECORD(palPtr,PALETTE,PalObj); - /* FIXME - handle pSysPal == NULL!!!!!!! */ - - COLOR_sysPal = pSysPal->IndexedColors; - PALETTE_UnlockPalette(pSysPal); // FIXME: Is this a right way to obtain pointer to the system palette? - - - // reset dynamic system palette entries - - if (!mapOnly && PALETTE_firstFree != -1) PALETTE_FormatSystemPalette(); - - // initialize palette mapping table - - //mapping = HeapReAlloc( GetProcessHeap(), 0, palPtr->mapping, - // sizeof(int)*palPtr->logpalette->palNumEntries); - ExFreePool(palPtr->mapping); - mapping = ExAllocatePoolWithTag(PagedPool, sizeof(int)*palGDI->NumColors, TAG_PALETTEMAP); - - if (!mapping) - { - DPRINT1("Failed allocating memory for palette mapping!\n"); - return 0; - } - - palPtr->mapping = mapping; - - for (uNum += uStart; uStart < uNum; uStart++) - { - index = -1; - flag = PC_SYS_USED; - - switch (palGDI->IndexedColors[uStart].peFlags & 0x07) - { - case PC_EXPLICIT: // palette entries are indices into system palette - // The PC_EXPLICIT flag is used to copy an entry from the system palette into the logical palette - index = *(WORD*)(palGDI->IndexedColors + uStart); - if (index > 255 || (index >= COLOR_gapStart && index <= COLOR_gapEnd)) - { - DbgPrint("Win32k: PC_EXPLICIT: idx %d out of system palette, assuming black.\n", index); - index = 0; - } - break; - - case PC_RESERVED: // forbid future mappings to this entry - // For palette animation, the entries in the logical palette need the PC_RESERVED flag - flag |= PC_SYS_RESERVED; - - // fall through - default: // try to collapse identical colors - index = COLOR_PaletteLookupExactIndex(COLOR_sysPal, 256, - *(COLORREF*)(palGDI->IndexedColors + uStart)); - // fall through - - case PC_NOCOLLAPSE: - // If an entry in the logical palette is marked with the PC_NOCOLLAPSE flag, the palette - // manager allocates a free entry in the system palette if one is available and only uses the - // closest colour match if there are no (more) free entries in the system palette - - DbgPrint("Win32k: WARNING: PC_NOCOLLAPSE is not yet working properly\n"); - - if (index < 0) - { - if (PALETTE_firstFree > 0 /* && !(PALETTE_PaletteFlags & PALETTE_FIXED) FIXME */) - { - DbgPrint("Win32k: Unimplemented Palette Operation: PC_NOCOLLAPSE [objects/palette.c]\n"); - /* XColor color; - index = PALETTE_firstFree; // ought to be available - PALETTE_firstFree = PALETTE_freeList[index]; - - color.pixel = (PALETTE_PaletteToXPixel) ? PALETTE_PaletteToXPixel[index] : index; - color.red = palPtr->logpalette->palPalEntry[uStart].peRed << 8; - color.green = palPtr->logpalette->palPalEntry[uStart].peGreen << 8; - color.blue = palPtr->logpalette->palPalEntry[uStart].peBlue << 8; - color.flags = DoRed | DoGreen | DoBlue; - TSXStoreColor(display, PALETTE_PaletteXColormap, &color); - - COLOR_sysPal[index] = palPtr->logpalette->palPalEntry[uStart]; - COLOR_sysPal[index].peFlags = flag; - PALETTE_freeList[index] = 0; - - if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; */ - break; - } - /* else if (PALETTE_PaletteFlags & PALETTE_VIRTUAL) - { - index = PALETTE_ToPhysical(NULL, 0x00ffffff & - *(COLORREF*)(palPtr->logpalette->palPalEntry + uStart)); - break; - } FIXME */ - - // we have to map to existing entry in the system palette - - index = COLOR_PaletteLookupPixel(COLOR_sysPal, 256, NULL, - *(COLORREF*)(palGDI->IndexedColors + uStart), TRUE); - } - palGDI->IndexedColors[uStart].peFlags |= PC_SYS_USED; - - /* if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; FIXME */ - break; - } - - if (!prevMapping || palPtr->mapping[uStart] != index) iRemapped++; - palPtr->mapping[uStart] = index; - } - return iRemapped; -} -#endif - -INT FASTCALL -PALETTE_GetObject(PPALETTE pGdiObject, INT cbCount, LPLOGBRUSH lpBuffer) -{ - if (!lpBuffer) - { - return sizeof(WORD); - } - - if ((UINT)cbCount < sizeof(WORD)) return 0; - *((WORD*)lpBuffer) = (WORD)pGdiObject->NumColors; - return sizeof(WORD); -} - -/* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/win32k.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/wi…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/win32k.rbuild [iso-8859-1] Sat Jul 4 04:18:32 2009 @@ -67,7 +67,6 @@ <file>engmisc.c</file> <file>mouse.c</file> <file>paint.c</file> - <file>palette.c</file> <file>perfcnt.c</file> <file>semaphor.c</file> <file>sort.c</file> @@ -163,7 +162,6 @@ <file>bitmaps.c</file> <file>brush.c</file> <file>cliprgn.c</file> - <file>color.c</file> <file>coord.c</file> <file>dcattr.c</file> <file>dclife.c</file> @@ -181,7 +179,7 @@ <file>icm.c</file> <file>line.c</file> <file>metafile.c</file> - <file>palobj.c</file> + <file>palette.c</file> <file>path.c</file> <file>pen.c</file> <file>polyfill.c</file>
15 years, 5 months
1
0
0
0
[cgutman] 41761: - Fix a typo
by cgutman@svn.reactos.org
Author: cgutman Date: Sat Jul 4 04:04:05 2009 New Revision: 41761 URL:
http://svn.reactos.org/svn/reactos?rev=41761&view=rev
Log: - Fix a typo Modified: trunk/reactos/base/services/dhcp/adapter.c Modified: trunk/reactos/base/services/dhcp/adapter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/dhcp/adapter…
============================================================================== --- trunk/reactos/base/services/dhcp/adapter.c [iso-8859-1] (original) +++ trunk/reactos/base/services/dhcp/adapter.c [iso-8859-1] Sat Jul 4 04:04:05 2009 @@ -160,7 +160,7 @@ if( AdapterKey ) IPAddress = RegReadString( AdapterKey, NULL, "IPAddress" ); - if( IPAddress && strcmp( IPAddress, "0.0.0.0" ) ) { + if( IPAddress && !strcmp( IPAddress, "0.0.0.0" ) ) { /* Non-automatic case */ DH_DbgPrint (MID_TRACE,("Adapter Name: [%s] (Bind Status %x) (static %s)\n",
15 years, 5 months
1
0
0
0
[tkreuzer] 41760: [FORMATTING] palette.c: remove extended header, fix indentation, no code change
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jul 4 03:06:04 2009 New Revision: 41760 URL:
http://svn.reactos.org/svn/reactos?rev=41760&view=rev
Log: [FORMATTING] palette.c: remove extended header, fix indentation, no code change Modified: trunk/reactos/subsystems/win32/win32k/eng/palette.c Modified: trunk/reactos/subsystems/win32/win32k/eng/palette.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/eng/palette.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/eng/palette.c [iso-8859-1] Sat Jul 4 03:06:04 2009 @@ -1,30 +1,9 @@ /* - * ReactOS W32 Subsystem - * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* $Id$ - * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: GDI Palette Functions * FILE: subsys/win32k/eng/palette.c * PROGRAMER: Jason Filby - * REVISION HISTORY: - * 11/7/1999: Created */ #include <w32k.h> @@ -35,79 +14,88 @@ // // // -VOID FASTCALL +VOID +FASTCALL ColorCorrection(PPALETTE PalGDI, PPALETTEENTRY PaletteEntry, ULONG Colors) { - PPDEVOBJ ppdev = (PPDEVOBJ)PalGDI->hPDev; + PPDEVOBJ ppdev = (PPDEVOBJ)PalGDI->hPDev; - if (!ppdev) return; + if (!ppdev) return; - if (ppdev->flFlags & PDEV_GAMMARAMP_TABLE) - { - INT i; - PGAMMARAMP GammaRamp = (PGAMMARAMP)ppdev->pvGammaRamp; - for ( i = 0; i < Colors; i++) - { - PaletteEntry[i].peRed += GammaRamp->Red[i]; - PaletteEntry[i].peGreen += GammaRamp->Green[i]; - PaletteEntry[i].peBlue += GammaRamp->Blue[i]; - } - } - return; + if (ppdev->flFlags & PDEV_GAMMARAMP_TABLE) + { + INT i; + PGAMMARAMP GammaRamp = (PGAMMARAMP)ppdev->pvGammaRamp; + for ( i = 0; i < Colors; i++) + { + PaletteEntry[i].peRed += GammaRamp->Red[i]; + PaletteEntry[i].peGreen += GammaRamp->Green[i]; + PaletteEntry[i].peBlue += GammaRamp->Blue[i]; + } + } + return; } /* * @implemented */ -HPALETTE APIENTRY -EngCreatePalette(ULONG Mode, ULONG NumColors, ULONG *Colors, - ULONG Red, ULONG Green, ULONG Blue) +HPALETTE +APIENTRY +EngCreatePalette( + ULONG Mode, + ULONG NumColors, + ULONG *Colors, + ULONG Red, + ULONG Green, + ULONG Blue) { - HPALETTE Palette; + HPALETTE Palette; - Palette = PALETTE_AllocPalette(Mode, NumColors, Colors, Red, Green, Blue); - if (Palette != NULL) - { - GDIOBJ_SetOwnership(Palette, NULL); - } + Palette = PALETTE_AllocPalette(Mode, NumColors, Colors, Red, Green, Blue); + if (Palette != NULL) + { + GDIOBJ_SetOwnership(Palette, NULL); + } - return Palette; + return Palette; } /* * @implemented */ -BOOL APIENTRY +BOOL +APIENTRY EngDeletePalette(IN HPALETTE Palette) { - GDIOBJ_SetOwnership(Palette, PsGetCurrentProcess()); + GDIOBJ_SetOwnership(Palette, PsGetCurrentProcess()); - return PALETTE_FreePaletteByHandle(Palette); + return PALETTE_FreePaletteByHandle(Palette); } /* * @implemented */ -ULONG APIENTRY +ULONG +APIENTRY PALOBJ_cGetColors(PALOBJ *PalObj, ULONG Start, ULONG Colors, ULONG *PaletteEntry) { - PALETTE *PalGDI; + PALETTE *PalGDI; - PalGDI = (PALETTE*)PalObj; + PalGDI = (PALETTE*)PalObj; /* PalGDI = (PALETTE*)AccessInternalObjectFromUserObject(PalObj); */ - if (Start >= PalGDI->NumColors) - return 0; + if (Start >= PalGDI->NumColors) + return 0; - Colors = min(Colors, PalGDI->NumColors - Start); + Colors = min(Colors, PalGDI->NumColors - Start); - /* NOTE: PaletteEntry ULONGs are in the same order as PALETTEENTRY. */ - RtlCopyMemory(PaletteEntry, PalGDI->IndexedColors + Start, sizeof(ULONG) * Colors); + /* NOTE: PaletteEntry ULONGs are in the same order as PALETTEENTRY. */ + RtlCopyMemory(PaletteEntry, PalGDI->IndexedColors + Start, sizeof(ULONG) * Colors); - if (PalGDI->Mode & PAL_GAMMACORRECTION) - ColorCorrection(PalGDI, (PPALETTEENTRY)PaletteEntry, Colors); + if (PalGDI->Mode & PAL_GAMMACORRECTION) + ColorCorrection(PalGDI, (PPALETTEENTRY)PaletteEntry, Colors); - return Colors; + return Colors; } /* EOF */
15 years, 5 months
1
0
0
0
[tkreuzer] 41759: [FORMATTING] palobj.c: Fix indentation, no code change.
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jul 4 02:47:33 2009 New Revision: 41759 URL:
http://svn.reactos.org/svn/reactos?rev=41759&view=rev
Log: [FORMATTING] palobj.c: Fix indentation, no code change. Modified: trunk/reactos/subsystems/win32/win32k/objects/palobj.c Modified: trunk/reactos/subsystems/win32/win32k/objects/palobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/palobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/palobj.c [iso-8859-1] Sat Jul 4 02:47:33 2009 @@ -34,21 +34,21 @@ int COLOR_gapFilled; int COLOR_max; -PPALETTEENTRY FASTCALL ReturnSystemPalette (VOID) -{ - return COLOR_sysPal; +PPALETTEENTRY FASTCALL ReturnSystemPalette(VOID) +{ + return COLOR_sysPal; } BOOL INTERNAL_CALL PALETTE_Cleanup(PVOID ObjectBody) { - PPALETTE pPal = (PPALETTE)ObjectBody; - if (NULL != pPal->IndexedColors) - { - ExFreePool(pPal->IndexedColors); - } - - return TRUE; + PPALETTE pPal = (PPALETTE)ObjectBody; + if (NULL != pPal->IndexedColors) + { + ExFreePool(pPal->IndexedColors); + } + + return TRUE; } HPALETTE @@ -60,46 +60,48 @@ ULONG Green, ULONG Blue) { - HPALETTE NewPalette; - PPALETTE PalGDI; - - PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); - if (!PalGDI) - { - return NULL; - } - - NewPalette = PalGDI->BaseObject.hHmgr; - - PalGDI->Self = NewPalette; - PalGDI->Mode = Mode; - - if (NULL != Colors) - { - PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE); - if (NULL == PalGDI->IndexedColors) - { - PALETTE_UnlockPalette(PalGDI); - PALETTE_FreePaletteByHandle(NewPalette); - return NULL; - } - RtlCopyMemory(PalGDI->IndexedColors, Colors, sizeof(PALETTEENTRY) * NumColors); - } - - if (PAL_INDEXED == Mode) - { - PalGDI->NumColors = NumColors; - } - else if (PAL_BITFIELDS == Mode) - { - PalGDI->RedMask = Red; - PalGDI->GreenMask = Green; - PalGDI->BlueMask = Blue; - } - - PALETTE_UnlockPalette(PalGDI); - - return NewPalette; + HPALETTE NewPalette; + PPALETTE PalGDI; + + PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); + if (!PalGDI) + { + return NULL; + } + + NewPalette = PalGDI->BaseObject.hHmgr; + + PalGDI->Self = NewPalette; + PalGDI->Mode = Mode; + + if (NULL != Colors) + { + PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, + sizeof(PALETTEENTRY) * NumColors, + TAG_PALETTE); + if (NULL == PalGDI->IndexedColors) + { + PALETTE_UnlockPalette(PalGDI); + PALETTE_FreePaletteByHandle(NewPalette); + return NULL; + } + RtlCopyMemory(PalGDI->IndexedColors, Colors, sizeof(PALETTEENTRY) * NumColors); + } + + if (PAL_INDEXED == Mode) + { + PalGDI->NumColors = NumColors; + } + else if (PAL_BITFIELDS == Mode) + { + PalGDI->RedMask = Red; + PalGDI->GreenMask = Green; + PalGDI->BlueMask = Blue; + } + + PALETTE_UnlockPalette(PalGDI); + + return NewPalette; } HPALETTE @@ -107,116 +109,122 @@ PALETTE_AllocPaletteIndexedRGB(ULONG NumColors, CONST RGBQUAD *Colors) { - HPALETTE NewPalette; - PPALETTE PalGDI; - UINT i; - - PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); - if (!PalGDI) - { - return NULL; - } - - NewPalette = PalGDI->BaseObject.hHmgr; - - PalGDI->Self = NewPalette; - PalGDI->Mode = PAL_INDEXED; - - PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY) * NumColors, TAG_PALETTE); - if (NULL == PalGDI->IndexedColors) - { - PALETTE_UnlockPalette(PalGDI); - PALETTE_FreePaletteByHandle(NewPalette); - return NULL; - } - for (i = 0; i < NumColors; i++) - { - PalGDI->IndexedColors[i].peRed = Colors[i].rgbRed; - PalGDI->IndexedColors[i].peGreen = Colors[i].rgbGreen; - PalGDI->IndexedColors[i].peBlue = Colors[i].rgbBlue; - PalGDI->IndexedColors[i].peFlags = 0; - } - - PalGDI->NumColors = NumColors; - - PALETTE_UnlockPalette(PalGDI); - - return NewPalette; + HPALETTE NewPalette; + PPALETTE PalGDI; + UINT i; + + PalGDI = (PPALETTE)GDIOBJ_AllocObjWithHandle(GDI_OBJECT_TYPE_PALETTE); + if (!PalGDI) + { + return NULL; + } + + NewPalette = PalGDI->BaseObject.hHmgr; + + PalGDI->Self = NewPalette; + PalGDI->Mode = PAL_INDEXED; + + PalGDI->IndexedColors = ExAllocatePoolWithTag(PagedPool, + sizeof(PALETTEENTRY) * NumColors, + TAG_PALETTE); + if (NULL == PalGDI->IndexedColors) + { + PALETTE_UnlockPalette(PalGDI); + PALETTE_FreePaletteByHandle(NewPalette); + return NULL; + } + + for (i = 0; i < NumColors; i++) + { + PalGDI->IndexedColors[i].peRed = Colors[i].rgbRed; + PalGDI->IndexedColors[i].peGreen = Colors[i].rgbGreen; + PalGDI->IndexedColors[i].peBlue = Colors[i].rgbBlue; + PalGDI->IndexedColors[i].peFlags = 0; + } + + PalGDI->NumColors = NumColors; + + PALETTE_UnlockPalette(PalGDI); + + return NewPalette; } // Create the system palette HPALETTE FASTCALL PALETTE_Init(VOID) { - int i; - HPALETTE hpalette; - PLOGPALETTE palPtr; -#ifndef NO_MAPPING - PALOBJ *palObj; -#endif - const PALETTEENTRY* __sysPalTemplate = (const PALETTEENTRY*)COLOR_GetSystemPaletteTemplate(); - - // create default palette (20 system colors) - palPtr = ExAllocatePoolWithTag(PagedPool, sizeof(LOGPALETTE) + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), TAG_PALETTE); - if (!palPtr) return FALSE; - - palPtr->palVersion = 0x300; - palPtr->palNumEntries = NB_RESERVED_COLORS; - for(i=0; i<NB_RESERVED_COLORS; i++) - { - palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed; - palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen; - palPtr->palPalEntry[i].peBlue = __sysPalTemplate[i].peBlue; - palPtr->palPalEntry[i].peFlags = 0; - } - - hpalette = NtGdiCreatePaletteInternal(palPtr,NB_RESERVED_COLORS); - ExFreePoolWithTag(palPtr, TAG_PALETTE); - -#ifndef NO_MAPPING - palObj = (PALOBJ*)PALETTE_LockPalette(hpalette); - if (palObj) - { - if (!(palObj->mapping = ExAllocatePool(PagedPool, sizeof(int) * 20))) - { - DbgPrint("Win32k: Can not create palette mapping -- out of memory!"); - return FALSE; - } - PALETTE_UnlockPalette(palObj); - } -#endif - -/* palette_size = visual->map_entries; */ - - return hpalette; + int i; + HPALETTE hpalette; + PLOGPALETTE palPtr; +#ifndef NO_MAPPING + PALOBJ *palObj; +#endif + const PALETTEENTRY* __sysPalTemplate = (const PALETTEENTRY*)COLOR_GetSystemPaletteTemplate(); + + // create default palette (20 system colors) + palPtr = ExAllocatePoolWithTag(PagedPool, + sizeof(LOGPALETTE) + + (NB_RESERVED_COLORS * sizeof(PALETTEENTRY)), + TAG_PALETTE); + if (!palPtr) return FALSE; + + palPtr->palVersion = 0x300; + palPtr->palNumEntries = NB_RESERVED_COLORS; + for (i=0; i<NB_RESERVED_COLORS; i++) + { + palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed; + palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen; + palPtr->palPalEntry[i].peBlue = __sysPalTemplate[i].peBlue; + palPtr->palPalEntry[i].peFlags = 0; + } + + hpalette = NtGdiCreatePaletteInternal(palPtr,NB_RESERVED_COLORS); + ExFreePoolWithTag(palPtr, TAG_PALETTE); + +#ifndef NO_MAPPING + palObj = (PALOBJ*)PALETTE_LockPalette(hpalette); + if (palObj) + { + if (!(palObj->mapping = ExAllocatePool(PagedPool, sizeof(int) * 20))) + { + DbgPrint("Win32k: Can not create palette mapping -- out of memory!"); + return FALSE; + } + PALETTE_UnlockPalette(palObj); + } +#endif + + /* palette_size = visual->map_entries; */ + + return hpalette; } #ifndef NO_MAPPING static void FASTCALL PALETTE_FormatSystemPalette(void) { - // Build free list so we'd have an easy way to find - // out if there are any available colorcells. - - int i, j = PALETTE_firstFree = NB_RESERVED_COLORS/2; - - COLOR_sysPal[j].peFlags = 0; - for(i = (NB_RESERVED_COLORS>>1) + 1 ; i < 256 - (NB_RESERVED_COLORS>>1) ; i++) - { - if( i < COLOR_gapStart || i > COLOR_gapEnd ) - { - COLOR_sysPal[i].peFlags = 0; // unused tag - PALETTE_freeList[j] = i; // next - j = i; - } - } - PALETTE_freeList[j] = 0; + // Build free list so we'd have an easy way to find + // out if there are any available colorcells. + + int i, j = PALETTE_firstFree = NB_RESERVED_COLORS/2; + + COLOR_sysPal[j].peFlags = 0; + for (i = (NB_RESERVED_COLORS>>1) + 1 ; i < 256 - (NB_RESERVED_COLORS>>1) ; i++) + { + if (i < COLOR_gapStart || i > COLOR_gapEnd) + { + COLOR_sysPal[i].peFlags = 0; // unused tag + PALETTE_freeList[j] = i; // next + j = i; + } + } + PALETTE_freeList[j] = 0; } #endif VOID FASTCALL PALETTE_ValidateFlags(PALETTEENTRY* lpPalE, INT size) { - int i = 0; - for( ; i<size ; i++ ) - lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07); + int i = 0; + for (; i<size ; i++) + lpPalE[i].peFlags = PC_SYS_USED | (lpPalE[i].peFlags & 0x07); } #ifndef NO_MAPPING @@ -224,130 +232,131 @@ // Return number of entries which mapping has changed. INT APIENTRY PALETTE_SetMapping(PALOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapOnly) { - char flag; - int prevMapping = (palPtr->mapping) ? 1 : 0; - int index, iRemapped = 0; - int *mapping; - HPALETTE hSysPal = NtGdiGetStockObject(DEFAULT_PALETTE); - PPALETTE pSysPal = PALETTE_LockPalette(hSysPal); - PPALETTE palGDI = CONTAINING_RECORD(palPtr,PALETTE,PalObj); - /* FIXME - handle pSysPal == NULL!!!!!!! */ - - COLOR_sysPal = pSysPal->IndexedColors; - PALETTE_UnlockPalette(pSysPal); // FIXME: Is this a right way to obtain pointer to the system palette? - - - // reset dynamic system palette entries - - if( !mapOnly && PALETTE_firstFree != -1) PALETTE_FormatSystemPalette(); - - // initialize palette mapping table - - //mapping = HeapReAlloc( GetProcessHeap(), 0, palPtr->mapping, - // sizeof(int)*palPtr->logpalette->palNumEntries); - ExFreePool(palPtr->mapping); - mapping = ExAllocatePoolWithTag(PagedPool, sizeof(int)*palGDI->NumColors, TAG_PALETTEMAP); - - if (!mapping) - { - DPRINT1("Failed allocating memory for palette mapping!\n"); - return 0; - } - - palPtr->mapping = mapping; - - for(uNum += uStart; uStart < uNum; uStart++) - { - index = -1; - flag = PC_SYS_USED; - - switch( palGDI->IndexedColors[uStart].peFlags & 0x07 ) - { - case PC_EXPLICIT: // palette entries are indices into system palette - // The PC_EXPLICIT flag is used to copy an entry from the system palette into the logical palette - index = *(WORD*)(palGDI->IndexedColors + uStart); - if(index > 255 || (index >= COLOR_gapStart && index <= COLOR_gapEnd)) + char flag; + int prevMapping = (palPtr->mapping) ? 1 : 0; + int index, iRemapped = 0; + int *mapping; + HPALETTE hSysPal = NtGdiGetStockObject(DEFAULT_PALETTE); + PPALETTE pSysPal = PALETTE_LockPalette(hSysPal); + PPALETTE palGDI = CONTAINING_RECORD(palPtr,PALETTE,PalObj); + /* FIXME - handle pSysPal == NULL!!!!!!! */ + + COLOR_sysPal = pSysPal->IndexedColors; + PALETTE_UnlockPalette(pSysPal); // FIXME: Is this a right way to obtain pointer to the system palette? + + + // reset dynamic system palette entries + + if (!mapOnly && PALETTE_firstFree != -1) PALETTE_FormatSystemPalette(); + + // initialize palette mapping table + + //mapping = HeapReAlloc( GetProcessHeap(), 0, palPtr->mapping, + // sizeof(int)*palPtr->logpalette->palNumEntries); + ExFreePool(palPtr->mapping); + mapping = ExAllocatePoolWithTag(PagedPool, sizeof(int)*palGDI->NumColors, TAG_PALETTEMAP); + + if (!mapping) + { + DPRINT1("Failed allocating memory for palette mapping!\n"); + return 0; + } + + palPtr->mapping = mapping; + + for (uNum += uStart; uStart < uNum; uStart++) + { + index = -1; + flag = PC_SYS_USED; + + switch (palGDI->IndexedColors[uStart].peFlags & 0x07) { - DbgPrint("Win32k: PC_EXPLICIT: idx %d out of system palette, assuming black.\n", index); - index = 0; + case PC_EXPLICIT: // palette entries are indices into system palette + // The PC_EXPLICIT flag is used to copy an entry from the system palette into the logical palette + index = *(WORD*)(palGDI->IndexedColors + uStart); + if (index > 255 || (index >= COLOR_gapStart && index <= COLOR_gapEnd)) + { + DbgPrint("Win32k: PC_EXPLICIT: idx %d out of system palette, assuming black.\n", index); + index = 0; + } + break; + + case PC_RESERVED: // forbid future mappings to this entry + // For palette animation, the entries in the logical palette need the PC_RESERVED flag + flag |= PC_SYS_RESERVED; + + // fall through + default: // try to collapse identical colors + index = COLOR_PaletteLookupExactIndex(COLOR_sysPal, 256, + *(COLORREF*)(palGDI->IndexedColors + uStart)); + // fall through + + case PC_NOCOLLAPSE: + // If an entry in the logical palette is marked with the PC_NOCOLLAPSE flag, the palette + // manager allocates a free entry in the system palette if one is available and only uses the + // closest colour match if there are no (more) free entries in the system palette + + DbgPrint("Win32k: WARNING: PC_NOCOLLAPSE is not yet working properly\n"); + + if (index < 0) + { + if (PALETTE_firstFree > 0 /* && !(PALETTE_PaletteFlags & PALETTE_FIXED) FIXME */) + { + DbgPrint("Win32k: Unimplemented Palette Operation: PC_NOCOLLAPSE [objects/palette.c]\n"); + /* XColor color; + index = PALETTE_firstFree; // ought to be available + PALETTE_firstFree = PALETTE_freeList[index]; + + color.pixel = (PALETTE_PaletteToXPixel) ? PALETTE_PaletteToXPixel[index] : index; + color.red = palPtr->logpalette->palPalEntry[uStart].peRed << 8; + color.green = palPtr->logpalette->palPalEntry[uStart].peGreen << 8; + color.blue = palPtr->logpalette->palPalEntry[uStart].peBlue << 8; + color.flags = DoRed | DoGreen | DoBlue; + TSXStoreColor(display, PALETTE_PaletteXColormap, &color); + + COLOR_sysPal[index] = palPtr->logpalette->palPalEntry[uStart]; + COLOR_sysPal[index].peFlags = flag; + PALETTE_freeList[index] = 0; + + if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; */ + break; + } + /* else if (PALETTE_PaletteFlags & PALETTE_VIRTUAL) + { + index = PALETTE_ToPhysical(NULL, 0x00ffffff & + *(COLORREF*)(palPtr->logpalette->palPalEntry + uStart)); + break; + } FIXME */ + + // we have to map to existing entry in the system palette + + index = COLOR_PaletteLookupPixel(COLOR_sysPal, 256, NULL, + *(COLORREF*)(palGDI->IndexedColors + uStart), TRUE); + } + palGDI->IndexedColors[uStart].peFlags |= PC_SYS_USED; + + /* if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; FIXME */ + break; } - break; - - case PC_RESERVED: // forbid future mappings to this entry - // For palette animation, the entries in the logical palette need the PC_RESERVED flag - flag |= PC_SYS_RESERVED; - - // fall through - default: // try to collapse identical colors - index = COLOR_PaletteLookupExactIndex(COLOR_sysPal, 256, - *(COLORREF*)(palGDI->IndexedColors + uStart)); - // fall through - - case PC_NOCOLLAPSE: - // If an entry in the logical palette is marked with the PC_NOCOLLAPSE flag, the palette - // manager allocates a free entry in the system palette if one is available and only uses the - // closest colour match if there are no (more) free entries in the system palette - - DbgPrint("Win32k: WARNING: PC_NOCOLLAPSE is not yet working properly\n"); - - if( index < 0 ) - { - if(PALETTE_firstFree > 0 /* && !(PALETTE_PaletteFlags & PALETTE_FIXED) FIXME */ ) - { - DbgPrint("Win32k: Unimplemented Palette Operation: PC_NOCOLLAPSE [objects/palette.c]\n"); -/* XColor color; - index = PALETTE_firstFree; // ought to be available - PALETTE_firstFree = PALETTE_freeList[index]; - - color.pixel = (PALETTE_PaletteToXPixel) ? PALETTE_PaletteToXPixel[index] : index; - color.red = palPtr->logpalette->palPalEntry[uStart].peRed << 8; - color.green = palPtr->logpalette->palPalEntry[uStart].peGreen << 8; - color.blue = palPtr->logpalette->palPalEntry[uStart].peBlue << 8; - color.flags = DoRed | DoGreen | DoBlue; - TSXStoreColor(display, PALETTE_PaletteXColormap, &color); - - COLOR_sysPal[index] = palPtr->logpalette->palPalEntry[uStart]; - COLOR_sysPal[index].peFlags = flag; - PALETTE_freeList[index] = 0; - - if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; */ - break; - } -/* else if (PALETTE_PaletteFlags & PALETTE_VIRTUAL) - { - index = PALETTE_ToPhysical(NULL, 0x00ffffff & - *(COLORREF*)(palPtr->logpalette->palPalEntry + uStart)); - break; - } FIXME */ - - // we have to map to existing entry in the system palette - - index = COLOR_PaletteLookupPixel(COLOR_sysPal, 256, NULL, - *(COLORREF*)(palGDI->IndexedColors + uStart), TRUE); - } - palGDI->IndexedColors[uStart].peFlags |= PC_SYS_USED; - -/* if(PALETTE_PaletteToXPixel) index = PALETTE_PaletteToXPixel[index]; FIXME */ - break; - } - - if( !prevMapping || palPtr->mapping[uStart] != index ) iRemapped++; + + if (!prevMapping || palPtr->mapping[uStart] != index) iRemapped++; palPtr->mapping[uStart] = index; - } - return iRemapped; + } + return iRemapped; } #endif INT FASTCALL PALETTE_GetObject(PPALETTE pGdiObject, INT cbCount, LPLOGBRUSH lpBuffer) { - if (!lpBuffer) - { + if (!lpBuffer) + { + return sizeof(WORD); + } + + if ((UINT)cbCount < sizeof(WORD)) return 0; + *((WORD*)lpBuffer) = (WORD)pGdiObject->NumColors; return sizeof(WORD); - } - if ((UINT)cbCount < sizeof(WORD)) return 0; - *((WORD*)lpBuffer) = (WORD)pGdiObject->NumColors; - return sizeof(WORD); } /* EOF */
15 years, 5 months
1
0
0
0
[spetreolle] 41758: - Disable debugging flood
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sat Jul 4 02:41:56 2009 New Revision: 41758 URL:
http://svn.reactos.org/svn/reactos?rev=41758&view=rev
Log: - Disable debugging flood Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Sat Jul 4 02:41:56 2009 @@ -11,7 +11,7 @@ #include <ntddk.h> #include <portcls.h> -#define YDEBUG +#define NDEBUG #include <debug.h> #include <dmusicks.h>
15 years, 5 months
1
0
0
0
[cfinck] 41757: ReactOS 0.3.10 is ready!
by cfinck@svn.reactos.org
Author: cfinck Date: Fri Jul 3 16:24:24 2009 New Revision: 41757 URL:
http://svn.reactos.org/svn/reactos?rev=41757&view=rev
Log: ReactOS 0.3.10 is ready! Added: tags/ReactOS-0.3.10/ - copied from r41756, branches/ros-branch-0_3_10/ Removed: branches/ros-branch-0_3_10/
15 years, 5 months
1
0
0
0
[dchapyshev] 41756: - .def -> .spec - Add stubs for AsrAddSifEntryW, AsrCreateStateFileW, AsrFreeContext, AsrRestorePlugPlayRegistryData
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Fri Jul 3 15:21:42 2009 New Revision: 41756 URL:
http://svn.reactos.org/svn/reactos?rev=41756&view=rev
Log: - .def -> .spec - Add stubs for AsrAddSifEntryW, AsrCreateStateFileW, AsrFreeContext, AsrRestorePlugPlayRegistryData Added: trunk/reactos/dll/win32/syssetup/syssetup.spec (with props) Removed: trunk/reactos/dll/win32/syssetup/syssetup.def Modified: trunk/reactos/dll/win32/syssetup/syssetup.rbuild Removed: trunk/reactos/dll/win32/syssetup/syssetup.def URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/syssetu…
============================================================================== --- trunk/reactos/dll/win32/syssetup/syssetup.def [iso-8859-1] (original) +++ trunk/reactos/dll/win32/syssetup/syssetup.def (removed) @@ -1,31 +1,0 @@ -LIBRARY SYSSETUP.DLL -EXPORTS -;ApplyAcls -;DevInstallW -;GenerateScsiHwIdList -InitializeSetupActionLog@4 -InstallLiveCD@4 -InstallReactOS@4 -KeyboardClassInstaller@12 -;LogItem@8 -;LogItem0 -;LogItem1 -;LogItem2 -;LogItem3 -;LogItemN -MouseClassInstaller@12 -;PnPInitializationThread -;RepairStartMenuItems -;ReportError -;ScsiClassInstaller -SetupChangeFontSize@8 -SetupChangeLocale@8 -SetupChangeLocaleEx@24 -;SetupCreateOptionalComponentsPage -;SetupInfObjectInstallActionW -;SetupSetLargeDialogFont -;TapeClassInstaller -TerminateSetupActionLog@0 -;UpgradePrinters -;ViewSetupActionLog -; EOF Modified: trunk/reactos/dll/win32/syssetup/syssetup.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/syssetu…
============================================================================== --- trunk/reactos/dll/win32/syssetup/syssetup.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/syssetup/syssetup.rbuild [iso-8859-1] Fri Jul 3 15:21:42 2009 @@ -1,5 +1,5 @@ <module name="syssetup" type="win32dll" baseaddress="${BASEADDRESS_SYSSETUP}" installbase="system32" installname="syssetup.dll" unicode="yes" allowwarnings="true" crt="msvcrt"> - <importlibrary definition="syssetup.def" /> + <importlibrary definition="syssetup.spec" /> <include base="syssetup">.</include> <library>pseh</library> <library>uuid</library> Added: trunk/reactos/dll/win32/syssetup/syssetup.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/syssetu…
============================================================================== --- trunk/reactos/dll/win32/syssetup/syssetup.spec (added) +++ trunk/reactos/dll/win32/syssetup/syssetup.spec [iso-8859-1] Fri Jul 3 15:21:42 2009 @@ -1,0 +1,32 @@ +@ stub ApplyAcls +@ stub AsrAddSifEntryW +@ stub AsrCreateStateFileW +@ stub AsrFreeContext +@ stub AsrRestorePlugPlayRegistryData +@ stub DevInstallW +@ stub GenerateScsiHwIdList +@ stdcall InitializeSetupActionLog(long) +@ stdcall InstallLiveCD(ptr) +@ stdcall InstallReactOS(ptr) +@ stdcall KeyboardClassInstaller(long ptr ptr) +@ stub LogItem@8 +@ stub LogItem0 +@ stub LogItem1 +@ stub LogItem2 +@ stub LogItem3 +@ stub LogItemN +@ stdcall MouseClassInstaller(long ptr ptr) +@ stub PnPInitializationThread +@ stub RepairStartMenuItems +@ stub ReportError +@ stub ScsiClassInstaller +@ stdcall SetupChangeFontSize(ptr wstr) +@ stdcall SetupChangeLocale(ptr long) +@ stdcall SetupChangeLocaleEx(ptr long wstr str long long) +@ stub SetupCreateOptionalComponentsPage +@ stub SetupInfObjectInstallActionW +@ stub SetupSetLargeDialogFont +@ stub TapeClassInstaller +@ stdcall TerminateSetupActionLog() +@ stub UpgradePrinters +@ stub ViewSetupActionLog Propchange: trunk/reactos/dll/win32/syssetup/syssetup.spec ------------------------------------------------------------------------------ svn:eol-style = native
15 years, 5 months
1
0
0
0
[dchapyshev] 41755: - Fixes return values for PeekMessageA/W
by dchapyshev@svn.reactos.org
Author: dchapyshev Date: Fri Jul 3 13:53:34 2009 New Revision: 41755 URL:
http://svn.reactos.org/svn/reactos?rev=41755&view=rev
Log: - Fixes return values for PeekMessageA/W Modified: trunk/reactos/dll/win32/user32/windows/message.c Modified: trunk/reactos/dll/win32/user32/windows/message.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/m…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/message.c [iso-8859-1] Fri Jul 3 13:53:34 2009 @@ -1551,21 +1551,21 @@ MsgConversionCleanup(lpMsg, TRUE, FALSE, NULL); Res = NtUserPeekMessage(&Info, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); - if (-1 == (int) Res || ! Res) - { - return Res; + if (-1 == (int) Res || !Res) + { + return FALSE; } Conversion.LParamSize = Info.LParamSize; Conversion.KMMsg = Info.Msg; if (! MsgiKMToUMMessage(&Conversion.KMMsg, &Conversion.UnicodeMsg)) { - return (BOOL) -1; + return FALSE; } if (! MsgiUnicodeToAnsiMessage(&Conversion.AnsiMsg, &Conversion.UnicodeMsg)) { MsgiKMToUMCleanup(&Info.Msg, &Conversion.UnicodeMsg); - return (BOOL) -1; + return FALSE; } if (!lpMsg) { @@ -1604,16 +1604,16 @@ MsgConversionCleanup(lpMsg, FALSE, FALSE, NULL); Res = NtUserPeekMessage(&Info, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg); - if (-1 == (int) Res || ! Res) - { - return Res; + if (-1 == (int) Res || !Res) + { + return FALSE; } Conversion.LParamSize = Info.LParamSize; Conversion.KMMsg = Info.Msg; if (! MsgiKMToUMMessage(&Conversion.KMMsg, &Conversion.UnicodeMsg)) { - return (BOOL) -1; + return FALSE; } if (!lpMsg) {
15 years, 5 months
1
0
0
0
← Newer
1
...
54
55
56
57
58
59
60
61
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Results per page:
10
25
50
100
200