ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
July 2005
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
563 discussions
Start a n
N
ew thread
[weiden] 16441: fixed some signed/unsigned comparison warnings with -Wsign-compare
by weiden@svn.reactos.com
fixed some signed/unsigned comparison warnings with -Wsign-compare Modified: trunk/reactos/apps/utils/net/arp/arp.c Modified: trunk/reactos/apps/utils/net/finger/net.c Modified: trunk/reactos/apps/utils/net/ftp/fake.c Modified: trunk/reactos/apps/utils/net/ftp/ftp.c Modified: trunk/reactos/apps/utils/net/route/route.c Modified: trunk/reactos/apps/utils/ps/ps.c Modified: trunk/reactos/apps/utils/rosperf/fill.c Modified: trunk/reactos/apps/utils/rosperf/lines.c Modified: trunk/reactos/apps/utils/rosperf/rosperf.h Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c Modified: trunk/reactos/boot/freeldr/freeldr/fs/iso.c Modified: trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c Modified: trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c Modified: trunk/reactos/boot/freeldr/freeldr/mm/meminit.c Modified: trunk/reactos/boot/freeldr/freeldr/multiboot.c Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c Modified: trunk/reactos/boot/freeldr/freeldr/rtl/print.c Modified: trunk/reactos/boot/freeldr/freeldr/ui/tui.c Modified: trunk/reactos/drivers/dd/blue/blue.c Modified: trunk/reactos/drivers/dd/bootvid/bootvid.c Modified: trunk/reactos/drivers/dd/parallel/parallel.c Modified: trunk/reactos/drivers/fs/ntfs/attrib.c Modified: trunk/reactos/drivers/fs/ntfs/mft.c Modified: trunk/reactos/drivers/fs/vfat/rw.c Modified: trunk/reactos/drivers/net/afd/afd/select.c Modified: trunk/reactos/drivers/net/ndis/ndis/buffer.c Modified: trunk/reactos/drivers/net/ndis/ndis/miniport.c Modified: trunk/reactos/drivers/net/npf/read.c Modified: trunk/reactos/drivers/net/npf/win_bpf_filter.c Modified: trunk/reactos/drivers/storage/disk/disk.c Modified: trunk/reactos/drivers/usb/cromwell/linux/usb.h Modified: trunk/reactos/drivers/video/displays/vga/objects/bitblt.c Modified: trunk/reactos/drivers/video/displays/vga/objects/lineto.c Modified: trunk/reactos/drivers/video/displays/vga/objects/paint.c Modified: trunk/reactos/drivers/video/displays/vga/objects/pointer.c Modified: trunk/reactos/drivers/video/displays/vga/vgavideo/vgavideo.c Modified: trunk/reactos/drivers/video/miniport/vga/initvga.c Modified: trunk/reactos/include/ndk/ketypes.h Modified: trunk/reactos/include/reactos/exeformat.h Modified: trunk/reactos/lib/aclui/checklist.c Modified: trunk/reactos/lib/adns/src/check.c Modified: trunk/reactos/lib/adns/src/query.c Modified: trunk/reactos/lib/adns/src/reply.c Modified: trunk/reactos/lib/adns/src/setup.c Modified: trunk/reactos/lib/adns/src/types.c Modified: trunk/reactos/lib/advapi32/crypt/crypt.c Modified: trunk/reactos/lib/advpack/advpack.c Modified: trunk/reactos/lib/cpl/desk/settings.c Modified: trunk/reactos/lib/cpl/intl/locale.c Modified: trunk/reactos/lib/cpl/intl/time.c Modified: trunk/reactos/lib/crt/direct/getcwd.c Modified: trunk/reactos/lib/crt/io/access.c Modified: trunk/reactos/lib/crt/io/chmod.c Modified: trunk/reactos/lib/crt/process/process.c Modified: trunk/reactos/lib/crt/search/lfind.c Modified: trunk/reactos/lib/crt/signal/signal.c Modified: trunk/reactos/lib/crt/stdio/fread.c Modified: trunk/reactos/lib/crt/stdio/fwrite.c Modified: trunk/reactos/lib/crt/stdlib/fcvtbuf.c Modified: trunk/reactos/lib/crt/stdlib/getenv.c Modified: trunk/reactos/lib/crt/string/strset.c Modified: trunk/reactos/lib/crt/time/ctime.c Modified: trunk/reactos/lib/crt/time/strftime.c Modified: trunk/reactos/lib/crt/wine/cppexcept.c Modified: trunk/reactos/lib/crt/wstring/wcsset.c Modified: trunk/reactos/lib/dnsapi/dnsapi/query.c Modified: trunk/reactos/lib/fslib/vfatlib/fat16.c Modified: trunk/reactos/lib/fslib/vfatlib/fat32.c Modified: trunk/reactos/lib/fslib/vfatlib/vfatlib.c Modified: trunk/reactos/lib/gdi32/misc/misc.c Modified: trunk/reactos/lib/gdi32/objects/dc.c Modified: trunk/reactos/lib/gdi32/objects/font.c Modified: trunk/reactos/lib/kernel32/file/bintype.c Modified: trunk/reactos/lib/kernel32/file/file.c Modified: trunk/reactos/lib/kernel32/misc/console.c Modified: trunk/reactos/lib/kernel32/misc/errormsg.c Modified: trunk/reactos/lib/kernel32/misc/lang.c Modified: trunk/reactos/lib/kernel32/misc/lzexpand_main.c Modified: trunk/reactos/lib/kernel32/misc/nls.c Modified: trunk/reactos/lib/kernel32/misc/profile.c Modified: trunk/reactos/lib/kernel32/misc/time.c Modified: trunk/reactos/lib/kernel32/process/create.c Modified: trunk/reactos/lib/ntdll/stdlib/lfind.c Modified: trunk/reactos/lib/rossym/frommem.c Modified: trunk/reactos/lib/rtl/i386/exception.c Modified: trunk/reactos/lib/rtl/unicode.c Modified: trunk/reactos/lib/syssetup/wizard.c Modified: trunk/reactos/lib/ws2_32/misc/dllmain.c Modified: trunk/reactos/lib/ws2_32/misc/ns.c Modified: trunk/reactos/ntoskrnl/ex/list.c Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c Modified: trunk/reactos/ntoskrnl/ex/uuid.c Modified: trunk/reactos/ntoskrnl/io/file.c Modified: trunk/reactos/ntoskrnl/io/iomgr.c Modified: trunk/reactos/ntoskrnl/io/irq.c Modified: trunk/reactos/ntoskrnl/io/pnpdma.c [truncated at 100 lines; 41 more skipped] _____ Modified: trunk/reactos/apps/utils/net/arp/arp.c --- trunk/reactos/apps/utils/net/arp/arp.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/net/arp/arp.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -53,7 +53,8 @@ /* FIXME: allow user to specify an interface address, via pszIfAddr */ INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr) { - INT i, k, iRet; + INT iRet; + UINT i, k; PMIB_IPNETTABLE pIpNetTable; PMIB_IPADDRTABLE pIpAddrTable; ULONG ulSize = 0; _____ Modified: trunk/reactos/apps/utils/net/finger/net.c --- trunk/reactos/apps/utils/net/finger/net.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/net/finger/net.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -59,7 +59,7 @@ return; *host++ = '\0'; - if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) { + if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != (unsigned long)-1) { def.h_name = host; def.h_addr_list = alist; def.h_addr = (char *)&defaddr; _____ Modified: trunk/reactos/apps/utils/net/ftp/fake.c --- trunk/reactos/apps/utils/net/ftp/fake.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/net/ftp/fake.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -100,7 +100,7 @@ index = 0; total = recv(s, buffer, sizeof(buffer), 0); - if (total == INVALID_SOCKET) + if (total == SOCKET_ERROR) { total = 0; return ERROR; _____ Modified: trunk/reactos/apps/utils/net/ftp/ftp.c --- trunk/reactos/apps/utils/net/ftp/ftp.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/net/ftp/ftp.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -119,7 +119,7 @@ bzero((char *)&hisctladdr, sizeof (hisctladdr)); hisctladdr.sin_addr.s_addr = inet_addr(host); - if (hisctladdr.sin_addr.s_addr != -1) { + if (hisctladdr.sin_addr.s_addr != (unsigned long)-1) { hisctladdr.sin_family = AF_INET; (void) strncpy(hostnamebuf, host, sizeof(hostnamebuf)); } else { _____ Modified: trunk/reactos/apps/utils/net/route/route.c --- trunk/reactos/apps/utils/net/route/route.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/net/route/route.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -36,7 +36,7 @@ DWORD Error; ULONG Size = 0; char Destination[IPBUF], Gateway[IPBUF], Netmask[IPBUF]; - int i; + unsigned int i; if( (Error = GetIpForwardTable( NULL, &Size, TRUE )) == ERROR_INSUFFICIENT_BUFFER ) { _____ Modified: trunk/reactos/apps/utils/ps/ps.c --- trunk/reactos/apps/utils/ps/ps.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/ps/ps.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -213,7 +213,7 @@ unsigned char minute, minute1, tmin, tmin1; unsigned char seconds, seconds1, tsec, tsec1; - int ti; + unsigned int ti; LARGE_INTEGER ptime; ptime.QuadPart = CurrentProcess->KernelTime.QuadPart; _____ Modified: trunk/reactos/apps/utils/rosperf/fill.c --- trunk/reactos/apps/utils/rosperf/fill.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/rosperf/fill.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -36,7 +36,7 @@ { #define SMALL_SIZE 16 unsigned Rep; - unsigned x, y; + int x, y; x = 0; y = 0; _____ Modified: trunk/reactos/apps/utils/rosperf/lines.c --- trunk/reactos/apps/utils/rosperf/lines.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/rosperf/lines.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -60,7 +60,7 @@ LinesHorizontalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) { unsigned Rep; - unsigned y; + int y; HDC Dc; for (Rep = 0; Rep < Reps; ) @@ -79,7 +79,7 @@ LinesVerticalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) { unsigned Rep; - unsigned x; + int x; HDC Dc; for (Rep = 0; Rep < Reps; ) _____ Modified: trunk/reactos/apps/utils/rosperf/rosperf.h --- trunk/reactos/apps/utils/rosperf/rosperf.h 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/apps/utils/rosperf/rosperf.h 2005-07-05 22:35:29 UTC (rev 16441) @@ -28,8 +28,8 @@ COLORREF BackgroundColor; HDC ForegroundDc; HDC BackgroundDc; - ULONG WndWidth; - ULONG WndHeight; + INT WndWidth; + INT WndHeight; } PERF_INFO, *PPERF_INFO; typedef unsigned (*INITTESTPROC)(void **Context, PPERF_INFO PerfInfo, unsigned Reps); _____ Modified: trunk/reactos/boot/freeldr/freeldr/fs/ext2.c --- trunk/reactos/boot/freeldr/freeldr/fs/ext2.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/fs/ext2.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -192,7 +192,7 @@ */ BOOL Ext2LookupFile(PCHAR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer) { - int i; + UINT i; ULONG NumberOfPathParts; CHAR PathPart[261]; PVOID DirectoryBuffer; _____ Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c --- trunk/reactos/boot/freeldr/freeldr/fs/fat.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/fs/fat.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -689,7 +689,7 @@ */ BOOL FatLookupFile(PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer) { - int i; + UINT i; ULONG NumberOfPathParts; CHAR PathPart[261]; PVOID DirectoryBuffer; @@ -827,9 +827,9 @@ BOOL FatGetFatEntry(ULONG Cluster, ULONG* ClusterPointer) { ULONG fat = 0; - int FatOffset; - int ThisFatSecNum; - int ThisFatEntOffset; + UINT FatOffset; + UINT ThisFatSecNum; + UINT ThisFatEntOffset; DbgPrint((DPRINT_FILESYSTEM, "FatGetFatEntry() Retrieving FAT entry for cluster %d.\n", Cluster)); _____ Modified: trunk/reactos/boot/freeldr/freeldr/fs/fs.c --- trunk/reactos/boot/freeldr/freeldr/fs/fs.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/fs/fs.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -339,10 +339,10 @@ */ ULONG FsGetNumPathParts(PCHAR Path) { - ULONG i; + size_t i; ULONG num; - for (i=0,num=0; i<(int)strlen(Path); i++) + for (i=0,num=0; i<strlen(Path); i++) { if ((Path[i] == '\\') || (Path[i] == '/')) { @@ -364,12 +364,12 @@ */ VOID FsGetFirstNameFromPath(PCHAR Buffer, PCHAR Path) { - ULONG i; + size_t i; // Copy all the characters up to the end of the // string or until we hit a '\' character // and put them in Buffer - for (i=0; i<(int)strlen(Path); i++) + for (i=0; i<strlen(Path); i++) { if ((Path[i] == '\\') || (Path[i] == '/')) { _____ Modified: trunk/reactos/boot/freeldr/freeldr/fs/iso.c --- trunk/reactos/boot/freeldr/freeldr/fs/iso.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/fs/iso.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -182,7 +182,7 @@ */ static BOOL IsoLookupFile(PCHAR FileName, PISO_FILE_INFO IsoFileInfoPointer) { - int i; + UINT i; ULONG NumberOfPathParts; CHAR PathPart[261]; PVOID DirectoryBuffer; _____ Modified: trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c --- trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/fs/ntfs.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -168,7 +168,7 @@ } /* II. Read all complete 64-sector blocks. */ - while (Length >= 64 * NtfsBootSector->BytesPerSector) + while (Length >= (ULONGLONG)64 * (ULONGLONG)NtfsBootSector->BytesPerSector) { if (!MachDiskReadLogicalSectors(NtfsDriveNumber, NtfsSectorOfClusterZero + (Offset / NtfsBootSector->BytesPerSector), 64, (PCHAR)DISKREADBUFFER)) return FALSE; _____ Modified: trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c --- trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/inffile/inffile.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -56,7 +56,7 @@ struct _INFCACHELINE *Next; struct _INFCACHELINE *Prev; - LONG FieldCount; + ULONG FieldCount; PCHAR Key; @@ -437,7 +437,7 @@ /* push data from current token start up to pos into the current token */ static int push_token( struct parser *parser, const CHAR *pos ) { - int len = pos - parser->start; + unsigned int len = pos - parser->start; const CHAR *src = parser->start; CHAR *dst = parser->token + parser->token_len; _____ Modified: trunk/reactos/boot/freeldr/freeldr/mm/meminit.c --- trunk/reactos/boot/freeldr/freeldr/mm/meminit.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/mm/meminit.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -384,8 +384,8 @@ VOID MmFixupSystemMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG* MapCount) { - int Index; - int Index2; + UINT Index; + UINT Index2; // Loop through each entry in the array for (Index=0; Index<*MapCount; Index++) _____ Modified: trunk/reactos/boot/freeldr/freeldr/multiboot.c --- trunk/reactos/boot/freeldr/freeldr/multiboot.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/multiboot.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -528,7 +528,7 @@ ULONG_PTR SourceSection; ULONG_PTR TargetSection; ULONG SectionSize; - LONG i; + INT i; PIMAGE_DATA_DIRECTORY RelocationDDir; PIMAGE_BASE_RELOCATION RelocationDir, RelocationEnd; ULONG Count; @@ -588,7 +588,7 @@ Section += SectionCount; /* Walk each section backwards */ - for (i=SectionCount; i >= 0; i--, Section--) { + for (i=(INT)SectionCount; i >= 0; i--, Section--) { /* Get the disk location and the memory location, and the size */ SourceSection = RaToPa(Section->PointerToRawData); @@ -636,7 +636,7 @@ /* Calculate the Offset of the Type */ TypeOffset = (PUSHORT)(RelocationDir + 1); - for (i = 0; i < Count; i++) { + for (i = 0; i < (INT)Count; i++) { ShortPtr = (PUSHORT)(Address + (*TypeOffset & 0xFFF)); @@ -765,7 +765,7 @@ if (ModuleData) { /* Make sure this is the right module and that it hasn't been closed */ - if ((ModuleBase == ModuleData->ModuleStart) && (ModuleData->ModuleEnd == -1)) { + if ((ModuleBase == ModuleData->ModuleStart) && (ModuleData->ModuleEnd == (ULONG_PTR)-1)) { /* Close the Module */ ModuleData->ModuleEnd = ModuleData->ModuleStart + ModuleSize; _____ Modified: trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c --- trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/reactos/binhive.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -1360,10 +1360,10 @@ PWCHAR wName; PCHAR cName; LONG Error; - LONG DataSize; + ULONG DataSize; PCHAR cBuffer; PWCHAR wBuffer; - LONG i; + ULONG i; if (ValueCell->CellSize >= 0 || ValueCell->Id != REG_VALUE_CELL_ID) { _____ Modified: trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c --- trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/reactos/reactos.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -558,7 +558,7 @@ CHAR szHalName[1024]; CHAR szFileName[1024]; CHAR szBootPath[256]; - INT i; + UINT i; CHAR MsgBuffer[256]; ULONG SectionId; _____ Modified: trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c --- trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/reactos/setupldr.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -240,7 +240,7 @@ ULONG Size; char *SourcePath; char *LoadOptions; - int i; + UINT i; HINF InfHandle; ULONG ErrorLine; _____ Modified: trunk/reactos/boot/freeldr/freeldr/rtl/print.c --- trunk/reactos/boot/freeldr/freeldr/rtl/print.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/rtl/print.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -27,7 +27,7 @@ */ void print(char *str) { - int i; + size_t i; for (i = 0; i < strlen(str); i++) MachConsPutChar(str[i]); _____ Modified: trunk/reactos/boot/freeldr/freeldr/ui/tui.c --- trunk/reactos/boot/freeldr/freeldr/ui/tui.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/boot/freeldr/freeldr/ui/tui.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -517,9 +517,10 @@ VOID TuiMessageBoxCritical(PCHAR MessageText) { int width = 8; - int height = 1; + unsigned int height = 1; int curline = 0; - int i , j, k; + int k; + size_t i , j; int x1, x2, y1, y2; char temp[260]; char key; @@ -768,16 +769,17 @@ BOOL TuiEditBox(PCHAR MessageText, PCHAR EditTextBuffer, ULONG Length) { int width = 8; - int height = 1; + unsigned int height = 1; int curline = 0; - int i , j, k; + int k; + size_t i , j; int x1, x2, y1, y2; char temp[260]; char key; int EditBoxLine; - int EditBoxStartX, EditBoxEndX; + ULONG EditBoxStartX, EditBoxEndX; int EditBoxCursorX; - int EditBoxTextCount; + unsigned int EditBoxTextCount; int EditBoxTextDisplayIndex; BOOL ReturnCode; PVOID ScreenBuffer; _____ Modified: trunk/reactos/drivers/dd/blue/blue.c --- trunk/reactos/drivers/dd/blue/blue.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/dd/blue/blue.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -165,7 +165,8 @@ NTSTATUS Status; char *pch = Irp->UserBuffer; PBYTE vidmem; - int i, j, offset; + unsigned int i; + int j, offset; int cursorx, cursory; int rows, columns; int processed = DeviceExtension->Mode & ENABLE_PROCESSED_OUTPUT; _____ Modified: trunk/reactos/drivers/dd/bootvid/bootvid.c --- trunk/reactos/drivers/dd/bootvid/bootvid.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/dd/bootvid/bootvid.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -158,7 +158,7 @@ STATIC VOID FASTCALL vgaSetRegisters(PVGA_REGISTERS Registers) { - int i; + UINT i; /* Update misc output register */ WRITE_PORT_UCHAR(MISC, Registers->Misc); _____ Modified: trunk/reactos/drivers/dd/parallel/parallel.c --- trunk/reactos/drivers/dd/parallel/parallel.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/dd/parallel/parallel.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -80,7 +80,7 @@ { PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp); NTSTATUS status; - int i; + UINT i; switch (Stack->MajorFunction) { _____ Modified: trunk/reactos/drivers/fs/ntfs/attrib.c --- trunk/reactos/drivers/fs/ntfs/attrib.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/fs/ntfs/attrib.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -280,7 +280,7 @@ Attribute = (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset); while (Attribute < (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->BytesInUse) && - Attribute->AttributeType != -1) + Attribute->AttributeType != (ATTRIBUTE_TYPE)-1) { NtfsDumpAttribute (Attribute); _____ Modified: trunk/reactos/drivers/fs/ntfs/mft.c --- trunk/reactos/drivers/fs/ntfs/mft.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/fs/ntfs/mft.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -128,7 +128,7 @@ Attribute = (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->AttributeOffset); while (Attribute < (PATTRIBUTE)((ULONG_PTR)FileRecord + FileRecord->BytesInUse) && - Attribute->AttributeType != -1) + Attribute->AttributeType != (ATTRIBUTE_TYPE)-1) { if (Attribute->AttributeType == Type) { _____ Modified: trunk/reactos/drivers/fs/vfat/rw.c --- trunk/reactos/drivers/fs/vfat/rw.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/fs/vfat/rw.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -831,7 +831,7 @@ ByteOffset = IrpContext->Stack->Parameters.Write.ByteOffset; if (ByteOffset.u.LowPart == FILE_WRITE_TO_END_OF_FILE && - ByteOffset.u.HighPart == 0xffffffff) + ByteOffset.u.HighPart == -1) { ByteOffset.QuadPart = Fcb->RFCB.FileSize.QuadPart; } _____ Modified: trunk/reactos/drivers/net/afd/afd/select.c --- trunk/reactos/drivers/net/afd/afd/select.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/net/afd/afd/select.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -62,7 +62,7 @@ VOID SignalSocket( PAFD_ACTIVE_POLL Poll, PAFD_POLL_INFO PollReq, NTSTATUS Status ) { - int i; + UINT i; PIRP Irp = Poll->Irp; AFD_DbgPrint(MID_TRACE,("Called (Status %x)\n", Status)); KeCancelTimer( &Poll->Timer ); @@ -121,7 +121,7 @@ PIRP Irp; PAFD_POLL_INFO PollReq; PAFD_HANDLE HandleArray; - int i; + UINT i; AFD_DbgPrint(MID_TRACE,("Killing selects that refer to %x\n", FileObject)); _____ Modified: trunk/reactos/drivers/net/ndis/ndis/buffer.c --- trunk/reactos/drivers/net/ndis/ndis/buffer.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/net/ndis/ndis/buffer.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -34,7 +34,7 @@ for (;;) { if (!Buffer) - return -1; + return 0xFFFFFFFF; NdisQueryBuffer(Buffer, (PVOID)Data, Size); @@ -77,7 +77,7 @@ NDIS_DbgPrint(MAX_TRACE, ("DstBuffer (0x%X) DstOffset (0x%X) SrcData (0x%X) Length (%d)\n", DstBuffer, DstOffset, SrcData, Length)); /* Skip DstOffset bytes in the destination buffer chain */ - if (SkipToOffset(DstBuffer, DstOffset, &DstData, &DstSize) == -1) + if (SkipToOffset(DstBuffer, DstOffset, &DstData, &DstSize) == 0xFFFFFFFF) return 0; /* Start copying the data */ @@ -134,7 +134,7 @@ NDIS_DbgPrint(MAX_TRACE, ("DstData 0x%X SrcBuffer 0x%X SrcOffset 0x%X Length %d\n",DstData,SrcBuffer, SrcOffset, Length)); /* Skip SrcOffset bytes in the source buffer chain */ - if (SkipToOffset(SrcBuffer, SrcOffset, &SrcData, &SrcSize) == -1) + if (SkipToOffset(SrcBuffer, SrcOffset, &SrcData, &SrcSize) == 0xFFFFFFFF) return 0; /* Start copying the data */ @@ -234,11 +234,11 @@ /* Skip DstOffset bytes in the destination buffer chain */ NdisQueryBuffer(DstBuffer, (PVOID)&DstData, &DstSize); - if (SkipToOffset(DstBuffer, DstOffset, &DstData, &DstSize) == -1) + if (SkipToOffset(DstBuffer, DstOffset, &DstData, &DstSize) == 0xFFFFFFFF) return 0; /* Skip SrcOffset bytes in the source packet */ NdisGetFirstBufferFromPacket(SrcPacket, &SrcBuffer, (PVOID)&SrcData, &SrcSize, &Total); - if (SkipToOffset(SrcBuffer, SrcOffset, &SrcData, &SrcSize) == -1) + if (SkipToOffset(SrcBuffer, SrcOffset, &SrcData, &SrcSize) == 0xFFFFFFFF) return 0; /* Copy the data */ for (Total = 0;;) { @@ -669,12 +669,12 @@ /* Skip DestinationOffset bytes in the destination packet */ NdisGetFirstBufferFromPacket(Destination, &DstBuffer, (PVOID)&DstData, &DstSize, &Total); - if (SkipToOffset(DstBuffer, DestinationOffset, &DstData, &DstSize) == -1) + if (SkipToOffset(DstBuffer, DestinationOffset, &DstData, &DstSize) == 0xFFFFFFFF) return; /* Skip SourceOffset bytes in the source packet */ NdisGetFirstBufferFromPacket(Source, &SrcBuffer, (PVOID)&SrcData, &SrcSize, &Total); - if (SkipToOffset(SrcBuffer, SourceOffset, &SrcData, &SrcSize) == -1) + if (SkipToOffset(SrcBuffer, SourceOffset, &SrcData, &SrcSize) == 0xFFFFFFFF) return; /* Copy the data */ _____ Modified: trunk/reactos/drivers/net/ndis/ndis/miniport.c --- trunk/reactos/drivers/net/ndis/ndis/miniport.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/net/ndis/ndis/miniport.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -1395,7 +1395,7 @@ Status = IoGetDeviceProperty(Adapter->NdisMiniportBlock.PhysicalDeviceObject, DevicePropertyLegacyBusType, Size, &Adapter->NdisMiniportBlock.BusType, &Size); - if (!NT_SUCCESS(Status) || Adapter->NdisMiniportBlock.BusType == -1) + if (!NT_SUCCESS(Status) || Adapter->NdisMiniportBlock.BusType == (NDIS_INTERFACE_TYPE)-1) { NdisInitUnicodeString(&ParamName, L"BusType"); NdisReadConfiguration(&NdisStatus, &ConfigParam, ConfigHandle, @@ -1409,7 +1409,7 @@ Status = IoGetDeviceProperty(Adapter->NdisMiniportBlock.PhysicalDeviceObject, DevicePropertyBusNumber, Size, &Adapter->NdisMiniportBlock.BusNumber, &Size); - if (!NT_SUCCESS(Status) || Adapter->NdisMiniportBlock.BusNumber == -1) + if (!NT_SUCCESS(Status) || Adapter->NdisMiniportBlock.BusNumber == (NDIS_INTERFACE_TYPE)-1) { NdisInitUnicodeString(&ParamName, L"BusNumber"); NdisReadConfiguration(&NdisStatus, &ConfigParam, ConfigHandle, @@ -1424,7 +1424,7 @@ Status = IoGetDeviceProperty(Adapter->NdisMiniportBlock.PhysicalDeviceObject, DevicePropertyAddress, Size, &Adapter->NdisMiniportBlock.SlotNumber, &Size); - if (!NT_SUCCESS(Status) || Adapter->NdisMiniportBlock.SlotNumber == -1) + if (!NT_SUCCESS(Status) || Adapter->NdisMiniportBlock.SlotNumber == (NDIS_INTERFACE_TYPE)-1) { NdisInitUnicodeString(&ParamName, L"SlotNumber"); NdisReadConfiguration(&NdisStatus, &ConfigParam, ConfigHandle, _____ Modified: trunk/reactos/drivers/net/npf/read.c --- trunk/reactos/drivers/net/npf/read.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/net/npf/read.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -437,7 +437,7 @@ return NDIS_STATUS_NOT_ACCEPTED; //if the filter returns -1 the whole packet must be accepted - if(fres==-1 || fres > PacketSize+HeaderBufferSize)fres=PacketSize+HeaderBufferSize; + if(fres==(UINT)-1 || fres > PacketSize+HeaderBufferSize)fres=PacketSize+HeaderBufferSize; if(Open->mode & MODE_STAT){ // we are in statistics mode _____ Modified: trunk/reactos/drivers/net/npf/win_bpf_filter.c --- trunk/reactos/drivers/net/npf/win_bpf_filter.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/net/npf/win_bpf_filter.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -906,7 +906,7 @@ IF_LOUD(DbgPrint("Validating program");) flag=0; - for(j=0;j<VALID_INSTRUCTIONS_LEN;j++) + for(j=0;j<(int32)VALID_INSTRUCTIONS_LEN;j++) if (p->code==valid_instructions[j]) flag=1; if (flag==0) _____ Modified: trunk/reactos/drivers/storage/disk/disk.c --- trunk/reactos/drivers/storage/disk/disk.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/storage/disk/disk.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -384,7 +384,7 @@ PDEVICE_EXTENSION DeviceExtension; PDISK_DATA DiskData; PIO_STACK_LOCATION IrpStack; - ULARGE_INTEGER EndingOffset; + LARGE_INTEGER EndingOffset; DPRINT("DiskClassCheckReadWrite() called\n"); _____ Modified: trunk/reactos/drivers/usb/cromwell/linux/usb.h --- trunk/reactos/drivers/usb/cromwell/linux/usb.h 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/usb/cromwell/linux/usb.h 2005-07-05 22:35:29 UTC (rev 16441) @@ -327,7 +327,7 @@ { int actual; actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, dev->devpath); - return (actual >= size) ? -1 : actual; + return (actual >= (int)size) ? -1 : actual; } /*---------------------------------------------------------------------- ---*/ _____ Modified: trunk/reactos/drivers/video/displays/vga/objects/bitblt.c --- trunk/reactos/drivers/video/displays/vga/objects/bitblt.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/video/displays/vga/objects/bitblt.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -174,11 +174,11 @@ BRUSHOBJ* Brush, POINTL* BrushPoint, ROP4 Rop4) { UCHAR SolidColor = 0; - ULONG Left; - ULONG Length; + LONG Left; + LONG Length; PUCHAR Video; UCHAR Mask; - ULONG i, j; + INT i, j; ULONG RasterOp = VGA_NORMAL; /* Punt brush blts to non-device surfaces. */ _____ Modified: trunk/reactos/drivers/video/displays/vga/objects/lineto.c --- trunk/reactos/drivers/video/displays/vga/objects/lineto.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/video/displays/vga/objects/lineto.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -301,7 +301,8 @@ RECTL *RectBounds, MIX mix) { - LONG x, y, deltax, deltay, i, xchange, ychange, hx, vy; + LONG x, y, deltax, deltay, xchange, ychange, hx, vy; + ULONG i; ULONG Pixel = Brush->iSolidColor; RECT_ENUM RectEnum; BOOL EnumMore; @@ -342,7 +343,7 @@ CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, CD_RIGHTDOWN, 0); do { - EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum); + EnumMore = CLIPOBJ_bEnum(Clip, sizeof(RectEnum), (PVOID) &RectEnum); for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= y1; i++) { if (y1 < RectEnum.arcl[i].bottom && _____ Modified: trunk/reactos/drivers/video/displays/vga/objects/paint.c --- trunk/reactos/drivers/video/displays/vga/objects/paint.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/video/displays/vga/objects/paint.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -7,10 +7,10 @@ BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor) { - int x, y, x2, y2, w, h; - ULONG offset, j, pre1; + int x, y, x2, y2, w, h, j; + ULONG offset, pre1; ULONG orgpre1, orgx, midpre1, tmppre1; - ULONG ileftpix, imidpix, irightpix; + int ileftpix, imidpix, irightpix; /* double leftpix, midpix, rightpix;*/ UCHAR a; @@ -150,7 +150,7 @@ CLIPOBJ_cEnumStart(ClipRegion, FALSE, CT_RECTANGLES, CD_ANY, 0); do { - int i; + UINT i; EnumMore = CLIPOBJ_bEnum(ClipRegion, sizeof(RectEnum), (PVOID) &RectEnum); DPRINT("EnumMore: %d, count: %d\n", EnumMore, RectEnum.c); for( i=0; i<RectEnum.c; i++){ _____ Modified: trunk/reactos/drivers/video/displays/vga/objects/pointer.c --- trunk/reactos/drivers/video/displays/vga/objects/pointer.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/video/displays/vga/objects/pointer.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -303,9 +303,9 @@ { ULONG SizeX, SizeY; - SizeX = min(((X + ppdev->pPointerAttributes->Width) + 7) & ~0x7, ppdev->sizeSurf.cx); + SizeX = min(((X + (LONG)ppdev->pPointerAttributes->Width) + 7) & ~0x7, ppdev->sizeSurf.cx); SizeX -= (X & ~0x7); - SizeY = min(ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - Y); + SizeY = min((LONG)ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - Y); Rect->left = max(X, 0) & ~0x7; Rect->top = max(Y, 0); @@ -365,8 +365,8 @@ Rect.bottom - Rect.top); /* Display the cursor. */ - SizeX = min(ppdev->pPointerAttributes->Width, ppdev->sizeSurf.cx - cx); - SizeY = min(ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - cy); + SizeX = min((LONG)ppdev->pPointerAttributes->Width, ppdev->sizeSurf.cx - cx); + SizeY = min((LONG)ppdev->pPointerAttributes->Height, ppdev->sizeSurf.cy - cy); AndMask = ppdev->pPointerAttributes->Pixels + (ppdev->pPointerAttributes->Height - SizeY) * ppdev->pPointerAttributes->WidthInBytes; VGADDI_BltPointerToVGA(cx, _____ Modified: trunk/reactos/drivers/video/displays/vga/vgavideo/vgavideo.c --- trunk/reactos/drivers/video/displays/vga/vgavideo/vgavideo.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/video/displays/vga/vgavideo/vgavideo.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -266,7 +266,7 @@ UCHAR a; ULONG pre1; ULONG orgpre1, orgx, midpre1; - ULONG ileftpix, imidpix, irightpix; + LONG ileftpix, imidpix, irightpix; orgx = x; @@ -341,7 +341,7 @@ BOOL vgaVLine(INT x, INT y, INT len, UCHAR c) { - ULONG offset, i; + INT offset, i; UCHAR a; offset = xconv[x]+y80[y]; @@ -391,9 +391,9 @@ ULONG left = x >> 3; ULONG shift = x - (x & ~0x7); UCHAR pixel, nextpixel; - ULONG rightcount; - ULONG i, j; - ULONG stride = w >> 3; + LONG rightcount; + INT i, j; + LONG stride = w >> 3; /* Calculate the number of rightmost bytes not in a dword block. */ if (w >= 8) @@ -528,9 +528,9 @@ void DIB_BltToVGA(int x, int y, int w, int h, void *b, int Source_lDelta, int StartMod) { PBYTE pb, opb = b; - ULONG i, j; - ULONG x2 = x + w; - ULONG y2 = y + h; + LONG i, j; + LONG x2 = x + w; + LONG y2 = y + h; ULONG offset; UCHAR a; _____ Modified: trunk/reactos/drivers/video/miniport/vga/initvga.c --- trunk/reactos/drivers/video/miniport/vga/initvga.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/drivers/video/miniport/vga/initvga.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -27,7 +27,7 @@ STATIC VOID FASTCALL vgaSaveRegisters(PVGA_REGISTERS Registers) { - int i; + UINT i; for (i = 0; i < sizeof(Registers->CRT); i++) { @@ -60,7 +60,7 @@ STATIC VOID FASTCALL vgaSetRegisters(PVGA_REGISTERS Registers) { - int i; + UINT i; /* Update misc output register */ VideoPortWritePortUchar(MISC, Registers->Misc); _____ Modified: trunk/reactos/include/ndk/ketypes.h --- trunk/reactos/include/ndk/ketypes.h 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/include/ndk/ketypes.h 2005-07-05 22:35:29 UTC (rev 16441) @@ -98,7 +98,7 @@ PVOID RegionEnd; ULONG BucketShift; PVOID Buffer; - CSHORT Source; + KPROFILE_SOURCE Source; ULONG Affinity; BOOLEAN Active; struct _KPROCESS *Process; _____ Modified: trunk/reactos/include/reactos/exeformat.h --- trunk/reactos/include/reactos/exeformat.h 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/include/reactos/exeformat.h 2005-07-05 22:35:29 UTC (rev 16441) @@ -69,7 +69,7 @@ * as opposed to STATUS_INVALID_IMAGE_FORMAT meaning the format is supported, * but the particular file is malformed */ -#define STATUS_ROS_EXEFMT_UNKNOWN_FORMAT (0xA0100001) +#define STATUS_ROS_EXEFMT_UNKNOWN_FORMAT ((NTSTATUS)0xA0100001) /* * Returned by MmCreateSection to signal successful loading of an executable @@ -78,7 +78,7 @@ * STATUS_ROS_EXEFMT_LOADED_FORMAT and the appropriate EXEFMT_LOADED_XXX */ #define FACILITY_ROS_EXEFMT_FORMAT (0x11) -#define STATUS_ROS_EXEFMT_LOADED_FORMAT (0x60110000) +#define STATUS_ROS_EXEFMT_LOADED_FORMAT ((NTSTATUS)0x60110000) /* non-standard format, ZwQuerySection required to retrieve the format tag */ #define EXEFMT_LOADED_EXTENDED (0x0000FFFF) _____ Modified: trunk/reactos/lib/aclui/checklist.c --- trunk/reactos/lib/aclui/checklist.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/aclui/checklist.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -63,7 +63,7 @@ BOOL FocusVisible; COLORREF TextColor[2]; - UINT CheckBoxLeft[2]; + INT CheckBoxLeft[2]; BOOL QuickSearchEnabled; PCHECKITEM QuickSearchHitItem; @@ -531,7 +531,7 @@ VisibleItems = (rcClient.bottom - rcClient.top) / infoPtr->ItemHeight; - if (ScrollInfo.nPage == VisibleItems && ScrollInfo.nMax > 0) + if (ScrollInfo.nPage == (UINT)VisibleItems && ScrollInfo.nMax > 0) { ScrollInfo.nMax--; } @@ -1456,7 +1456,7 @@ default: { INT SearchLen = wcslen(infoPtr->QuickSearchText); - if (SearchLen < (sizeof(infoPtr->QuickSearchText) / sizeof(infoPtr->QuickSearchText[0])) - 1) + if (SearchLen < (INT)(sizeof(infoPtr->QuickSearchText) / sizeof(infoPtr->QuickSearchText[0])) - 1) { infoPtr->QuickSearchText[SearchLen++] = c; infoPtr->QuickSearchText[SearchLen] = L'\0'; @@ -1832,7 +1832,7 @@ case CLM_SETCHECKBOXCOLUMN: { - infoPtr->CheckBoxLeft[wParam != CLB_DENY] = (UINT)lParam; + infoPtr->CheckBoxLeft[wParam != CLB_DENY] = (INT)lParam; Ret = 1; break; } @@ -1894,7 +1894,7 @@ { LPSTYLESTRUCT Style = (LPSTYLESTRUCT)lParam; - if (wParam == GWL_STYLE) + if (wParam == (WPARAM)GWL_STYLE) { BOOL AllowChangeStyle; _____ Modified: trunk/reactos/lib/adns/src/check.c --- trunk/reactos/lib/adns/src/check.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/adns/src/check.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -116,7 +116,7 @@ break; case server_disconnected: case server_broken: - assert(ads->tcpsocket == -1); + assert(ads->tcpsocket == INVALID_SOCKET); checkc_notcpbuf(ads); break; case server_ok: _____ Modified: trunk/reactos/lib/adns/src/query.c --- trunk/reactos/lib/adns/src/query.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/adns/src/query.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -286,7 +286,7 @@ iaddr= (const unsigned char*) &(((const struct sockaddr_in*)addr) -> sin_addr); lreq= strlen(zone) + 4*4 + 1; - if (lreq > sizeof(shortbuf)) { + if (lreq > (int)sizeof(shortbuf)) { buf= malloc( strlen(zone) + 4*4 + 1 ); if (!buf) return errno; buf_free= buf; _____ Modified: trunk/reactos/lib/adns/src/reply.c --- trunk/reactos/lib/adns/src/reply.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/adns/src/reply.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -222,7 +222,7 @@ * it contains the relevant info. */ } - } else if (rrtype == (qu->typei->type & adns__rrt_typemask)) { + } else if (rrtype == ((INT)qu->typei->type & (INT)adns__rrt_typemask)) { wantedrrs++; } else { adns__debug(ads,serv,qu,"ignoring answer RR with irrelevant type %d",rrtype); @@ -322,7 +322,7 @@ &ownermatched); assert(!st); assert(rrtype != -1); if (rrclass != DNS_CLASS_IN || - rrtype != (qu->typei->type & adns__rrt_typemask) || + rrtype != ((INT)qu->typei->type & (INT)adns__rrt_typemask) || !ownermatched) continue; adns__update_expires(qu,ttl,now); _____ Modified: trunk/reactos/lib/adns/src/setup.c --- trunk/reactos/lib/adns/src/setup.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/adns/src/setup.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -163,7 +163,7 @@ return; } - if (l >= sizeof(tbuf)) { + if (l >= (int)sizeof(tbuf)) { configparseerr(ads,fn,lno,"sortlist entry `%.*s' too long",l,word); continue; } _____ Modified: trunk/reactos/lib/adns/src/types.c --- trunk/reactos/lib/adns/src/types.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/adns/src/types.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -749,7 +749,7 @@ if (lablen>1 && pai->qu->query_dgram[labstart]=='0') return adns_s_querydomainwrong; } - for (i=0; i<sizeof(expectdomain)/sizeof(*expectdomain); i++) { + for (i=0; i<(int)sizeof(expectdomain)/(int)sizeof(*expectdomain); i++) { st= adns__findlabel_next(&fls,&lablen,&labstart); assert(!st); l= strlen(expectdomain[i]); if (lablen != l || memcmp(pai->qu->query_dgram + labstart, expectdomain[i], (size_t)l)) _____ Modified: trunk/reactos/lib/advapi32/crypt/crypt.c --- trunk/reactos/lib/advapi32/crypt/crypt.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/advapi32/crypt/crypt.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -126,7 +126,7 @@ return TRUE; } wcount = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - wcount = wcount < wstrsize/sizeof(WCHAR) ? wcount : wstrsize/sizeof(WCHAR); + wcount = wcount < wstrsize/(int)sizeof(WCHAR) ? wcount : wstrsize/(int)sizeof(WCHAR); if (wstrsize == -1) *wstr = CRYPT_Alloc(wcount * sizeof(WCHAR)); if (*wstr) _____ Modified: trunk/reactos/lib/advpack/advpack.c --- trunk/reactos/lib/advpack/advpack.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/advpack/advpack.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -272,7 +272,7 @@ PDWORD PReserved ) { HANDLE Process, Token; - INT i; + UINT i; BOOL Good = FALSE; DWORD Buffer[4096]; DWORD Size; _____ Modified: trunk/reactos/lib/cpl/desk/settings.c --- trunk/reactos/lib/cpl/desk/settings.c 2005-07-05 22:14:07 UTC (rev 16440) +++ trunk/reactos/lib/cpl/desk/settings.c 2005-07-05 22:35:29 UTC (rev 16441) @@ -247,7 +247,7 @@ if (LoadString(hApplet, (2900 + Current->dmBitsPerPel), Buffer, sizeof(Buffer) / sizeof(TCHAR))) { index = SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)Buffer); [truncated at 1000 lines; 4365 more skipped]
19 years, 6 months
1
0
0
0
[ion] 16440: Ged Murpy <gedmurphy@gmail.com>
by ion@svn.reactos.com
Ged Murpy <gedmurphy(a)gmail.com> * ARP Rewrite, 90% complete (still in progress) Modified: trunk/reactos/apps/utils/net/arp/arp.c Modified: trunk/reactos/apps/utils/net/arp/arp.rc Modified: trunk/reactos/apps/utils/net/arp/arp.xml _____ Modified: trunk/reactos/apps/utils/net/arp/arp.c --- trunk/reactos/apps/utils/net/arp/arp.c 2005-07-05 21:57:55 UTC (rev 16439) +++ trunk/reactos/apps/utils/net/arp/arp.c 2005-07-05 22:14:07 UTC (rev 16440) @@ -1,97 +1,461 @@ -/* - * arp - display ARP cache from the IP stack parameters. +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS arp utility + * FILE: apps/utils/net/arp/arp.c + * PURPOSE: view and manipulate the ARP cache + * PROGRAMMERS: Ged Murphy (gedmurphy(a)gmail.com) + * REVISIONS: + * GM 27/06/05 Created * - * This source code is in the PUBLIC DOMAIN and has NO WARRANTY. - * - * Robert Dickenson <robd(a)reactos.org>, August 15, 2002. */ + + +#include <windows.h> #include <stdio.h> -#include <windows.h> +#include <stdlib.h> #include <tchar.h> -#include <time.h> - -#include <iptypes.h> -#include <ipexport.h> +#include <string.h> +#include <ctype.h> +#include <winsock2.h> #include <iphlpapi.h> -#include <snmp.h> + +#define WIN32_LEAN_AND_MEAN +#define UNICODE +#define _UNICODE + +/* + * Globals + */ +const char SEPERATOR = '-'; + + + +/* + * function declerations + */ +INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr); +INT PrintEntries(PMIB_IPNETROW pIpAddRow); +INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr); +INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr); +VOID Usage(VOID); + + + +/* + * + * Takes optional parameters of an internet address and interface address. + * Retrieve all entries in the ARP cache. If an internet address is + * specified, display the ARP entry relating to that address. If an + * interface address is specified, display all entries relating to + * that interface. + * + */ +/* FIXME: allow user to specify an interface address, via pszIfAddr */ +INT DisplayArpEntries(PTCHAR pszInetAddr, PTCHAR pszIfAddr) +{ + INT i, k, iRet; + PMIB_IPNETTABLE pIpNetTable; + PMIB_IPADDRTABLE pIpAddrTable; + ULONG ulSize = 0; + struct in_addr inaddr, inaddr2; + DWORD dwSize = 0; + PTCHAR pszIpAddr; + TCHAR szIntIpAddr[20]; + + /* Return required buffer size */ + GetIpNetTable(NULL, &ulSize, 0); + + /* allocate memory for ARP address table */ + pIpNetTable = (PMIB_IPNETTABLE) malloc(ulSize * sizeof(BYTE)); + ZeroMemory(pIpNetTable, sizeof(*pIpNetTable)); + + /* get Arp address table */ + if (pIpNetTable != NULL) { + GetIpNetTable(pIpNetTable, &ulSize, TRUE); + } else { + _tprintf(_T("failed to allocate memory for GetIpNetTable\n")); + free(pIpNetTable); + return -1; + } + + /* check there are entries in the table */ + if (pIpNetTable->dwNumEntries == 0) { + _tprintf(_T("No ARP entires found\n")); + free(pIpNetTable); + return -1; + } + + + + /* try doing this in the way it's done above, it's clearer */ + /* Retrieve the interface-to-ip address mapping + * table to get the IP address for adapter */ + pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize); + GetIpAddrTable(pIpAddrTable, &dwSize, 0); // NULL ? + -#include "trace.h" - -VOID WINAPI SnmpSvcInitUptime(); - -/////////////////////////////////////////////////////////////////////// ///////// - -const char szUsage[] = { "\n" \ - "Displays and modifies the IP Protocol to physical address translation tables\n" \ - "used by address resolution protocol (ARP).\n" \ - "\n" \ - "ARP -s inet_addr eth_addr [if_addr]\n" \ - "ARP -d inet_addr [if_addr]\n" \ - "ARP -a [inet_addr] [-N if_addr]\n" \ - "\n" \ - " -a Displays the active ARP table by querying the current protocol\n" \ - " data. If inet_addr is specified, the IP and physical addresses\n" \ - " for the specified address are displayed. If more than one\n" \ - " network interface is using ARP, each interfaces ARP table is\n" \ - " displayed.\n" \ - " -g Indentical to -a.\n" \ - " inet_addr Specifies the IP address.\n" \ - " -N if_addr Displays the ARP table for the specified interface only\n" \ - " -d Deletes the host entry specified by inet_addr. inet_addr may be\n" \ - " wildcarded with * to delete all host entries in the ARP table.\n" \ - " -s Adds the host and associates the IP address inet_addr with the\n" \ - " physical address eth_addr. The physical address must be specified\n" \ - " as 6 hexadecimal characters delimited by hyphens. The new entry\n" \ - " will become permanent in the ARP table.\n" \ - " eth_addr Specifies the interface physical address.\n" \ - " if_addr If present, this specifies the IP address of the interface whose\n" \ - " address translation table should be modified. If not present, the\n" \ - " first applicable interface will be used.\n" \ - "Example:\n" \ - " > arp -s 192.168.0.12 55-AA-55-01-02-03 .... Static entry creation.\n" \ - " > arp -a .... ARP table display.\n" \ - " > arp -d * .... Delete all ARP table entries.\n" -}; - -void usage(void) + pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize); + //ZeroMemory(pIpAddrTable, sizeof(*pIpAddrTable)); + + if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR) { // NO_ERROR = 0 + _tprintf(_T("GetIpAddrTable failed: %d\n"), iRet); + _tprintf(_T("error: %d\n"), WSAGetLastError()); + } + + + for (k=0; k < pIpAddrTable->dwNumEntries; k++) { + if (pIpNetTable->table[0].dwIndex == pIpAddrTable->table[k].dwIndex) { + //printf("printing pIpAddrTable->table[?].dwIndex = %lx\n", pIpNetTable->table[k].dwIndex); + inaddr2.s_addr = pIpAddrTable->table[k].dwAddr; + pszIpAddr = inet_ntoa(inaddr2); + strcpy(szIntIpAddr, pszIpAddr); + } + } + + + /* print header, including interface IP address and index number */ + _tprintf(_T("\nInterface: %s --- 0x%lx \n"), szIntIpAddr, pIpNetTable->table[0].dwIndex); + _tprintf(_T(" Internet Address Physical Address Type\n")); + + /* go through all ARP entries */ + for (i=0; i < pIpNetTable->dwNumEntries; i++) { + + /* if the user has supplied their own internet addesss * + * only print the arp entry which matches that */ + if (pszInetAddr) { + inaddr.S_un.S_addr = pIpNetTable->table[i].dwAddr; + pszIpAddr = inet_ntoa(inaddr); + + /* check if it matches, print it */ + if (strcmp(pszIpAddr, pszInetAddr) == 0) { + PrintEntries(&pIpNetTable->table[i]); + } + } else { + /* if an address is not supplied, print all entries */ + PrintEntries(&pIpNetTable->table[i]); + } + + } + + free(pIpNetTable); + free(pIpAddrTable); + + return 0; +} + + + +/* + * + * Takes an ARP entry and prints the IP address, + * the MAC address and the entry type to screen + * + */ +INT PrintEntries(PMIB_IPNETROW pIpAddRow) { -// fprintf(stderr,"USAGE:\n"); - fputs(szUsage, stderr); + IN_ADDR inaddr; + TCHAR cMacAddr[20]; + + /* print IP addresses */ + inaddr.S_un.S_addr = pIpAddRow->dwAddr; + _tprintf(_T(" %-22s"), inet_ntoa(inaddr)); //error checking + + /* print MAC address */ + _stprintf(cMacAddr, _T("%02x-%02x-%02x-%02x-%02x-%02x"), + pIpAddRow->bPhysAddr[0], + pIpAddRow->bPhysAddr[1], + pIpAddRow->bPhysAddr[2], + pIpAddRow->bPhysAddr[3], + pIpAddRow->bPhysAddr[4], + pIpAddRow->bPhysAddr[5]); + _tprintf(_T("%-22s"), cMacAddr); + + /* print cache type */ + switch (pIpAddRow->dwType) { + case MIB_IPNET_TYPE_DYNAMIC : _tprintf(_T("dynamic\n")); + break; + case MIB_IPNET_TYPE_STATIC : _tprintf(_T("static\n")); + break; + case MIB_IPNET_TYPE_INVALID : _tprintf(_T("invalid\n")); + break; + case MIB_IPNET_TYPE_OTHER : _tprintf(_T("other\n")); + break; + } + return 0; } - -int main(int argc, char *argv[]) + + + +/* + * + * Takes an internet address, a MAC address and an optional interface + * address as arguments and checks their validity. + * Fill out an MIB_IPNETROW structure and insert the data into the + * ARP cache as a static entry. + * + */ +INT Addhost(PTCHAR pszInetAddr, PTCHAR pszEthAddr, PTCHAR pszIfAddr) { - TCHAR szComputerName[50]; - DWORD dwSize = 50; - - int nBytes = 500; - BYTE* pCache; - - if (argc > 1) { - usage(); - return 1; + PMIB_IPNETROW pAddHost; + PMIB_IPADDRTABLE pIpAddrTable; + DWORD dwIpAddr; + DWORD dwSize = 0; + INT iRet, i, val; + TCHAR c; + + /* error checking */ + + /* check IP address */ + if (pszInetAddr != NULL) { + if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE) { + _tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr); + return -1; + } + } else { + Usage(); } - - SnmpSvcInitUptime(); - - GetComputerName(szComputerName, &dwSize); - _tprintf(_T("ReactOS ARP cache on Computer Name: %s\n"), szComputerName); - - pCache = (BYTE*)SnmpUtilMemAlloc(nBytes); - - Sleep(2500); - - if (pCache != NULL) { - - DWORD dwUptime = SnmpSvcGetUptime(); - - _tprintf(_T("SNMP uptime: %ld\n"), dwUptime); - - SnmpUtilMemFree(pCache); + + /* check MAC address */ + if (strlen(pszEthAddr) != 17) { + _tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr); + return -1; + } + for (i=0; i<17; i++) { + if (pszEthAddr[i] == SEPERATOR) { + continue; + } + if (!isxdigit(pszEthAddr[i])) { + _tprintf(_T("ARP: bad argument: %s\n"), pszEthAddr); + return -1; + } + } + + /* reserve memory on heap and zero */ + pAddHost = (MIB_IPNETROW *) malloc(sizeof(MIB_IPNETROW)); + ZeroMemory(pAddHost, sizeof(MIB_IPNETROW)); + + + + + /* set dwIndex field to the index of a local IP address to + * indicate the network on which the ARP entry applies */ + if (pszIfAddr) { + sscanf(pszIfAddr, "%lx", &pAddHost->dwIndex); } else { - _tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n")); - return 1; + /* map the IP to the index */ + pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize); + GetIpAddrTable(pIpAddrTable, &dwSize, 0); + + pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize); + + if ((iRet = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR) { // NO_ERROR = 0 + _tprintf(_T("GetIpAddrTable failed: %d\n"), iRet); + _tprintf(_T("error: %d\n"), WSAGetLastError()); + } + printf("printing pIpAddrTable->table[0].dwIndex = %lx\n", pIpAddrTable->table[0].dwIndex); + pAddHost->dwIndex = 4; } - return 0; + + /* Set MAC address to 6 bytes (typical) */ + pAddHost->dwPhysAddrLen = 6; + + + /* Encode bPhysAddr into correct byte array */ + for (i=0; i<6; i++) { + val =0; + c = toupper(pszEthAddr[i*3]); + c = c - (isdigit(c) ? '0' : ('A' - 10)); + val += c; + val = (val << 4); + c = toupper(pszEthAddr[i*3 + 1]); + c = c - (isdigit(c) ? '0' : ('A' - 10)); + val += c; + pAddHost->bPhysAddr[i] = val; + + } + + + /* copy converted IP address */ + pAddHost->dwAddr = dwIpAddr; + + + /* set type to static */ + pAddHost->dwType = MIB_IPNET_TYPE_STATIC; + + + /* Add the ARP entry */ + if ((iRet = SetIpNetEntry(pAddHost)) != NO_ERROR) { + _tprintf(_T("The ARP entry addition failed: %d\n"), iRet); + return -1; + } + + free(pIpAddrTable); + free(pAddHost); + + return 0; } - + + + +/* + * + * Takes an internet address and an optional interface address as + * arguments and checks their validity. + * Add the interface number and IP to an MIB_IPNETROW structure + * and remove the entrty from the ARP cache. + * + */ +INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr) +{ + PMIB_IPNETROW pDelHost; + PMIB_IPADDRTABLE pIpAddrTable; + DWORD dwIpAddr; + DWORD dwSize = 0; + INT iret; + + /* error checking */ + + /* check IP address */ + if (pszInetAddr != NULL) { + if ((dwIpAddr = inet_addr(pszInetAddr)) == INADDR_NONE) { + _tprintf(_T("ARP: bad IP address: %s\n"), pszInetAddr); + return -1; + } + } else { + Usage(); + } + + + pIpAddrTable = (MIB_IPADDRTABLE*) malloc(sizeof(MIB_IPADDRTABLE)); + pDelHost = (MIB_IPNETROW *) malloc(sizeof(MIB_IPNETROW)); + ZeroMemory(pIpAddrTable, sizeof(MIB_IPADDRTABLE)); + ZeroMemory(pDelHost, sizeof(MIB_IPNETROW)); + /* set dwIndex field to the index of a local IP address to + * indicate the network on which the ARP entry applies */ + if (pszIfAddr) { + sscanf(pszIfAddr, "%lx", &pDelHost->dwIndex); + } else { + /* map the IP to the index */ + if (GetIpAddrTable(pIpAddrTable, &dwSize, 0) == ERROR_INSUFFICIENT_BUFFER) { + pIpAddrTable = (MIB_IPADDRTABLE *) malloc(dwSize); + } + if ((iret = GetIpAddrTable(pIpAddrTable, &dwSize, TRUE)) != NO_ERROR) { + _tprintf(_T("GetIpAddrTable failed: %d\n"), iret); + _tprintf(_T("error: %d\n"), WSAGetLastError()); + } + pDelHost->dwIndex = 4; //pIpAddrTable->table[0].dwIndex; + } + + /* copy converted IP address */ + pDelHost->dwAddr = dwIpAddr; + + /* Add the ARP entry */ + if ((iret = DeleteIpNetEntry(pDelHost)) != NO_ERROR) { + _tprintf(_T("The ARP entry deletion failed: %d\n"), iret); + return -1; + } + + free(pIpAddrTable); + free(pDelHost); + + return 0; +} + + + +/* + * + * print program usage to screen + * + */ +VOID Usage(VOID) +{ + _tprintf(_T("\nDisplays and modifies the IP-to-Physical address translation tables used by\n" + "address resolution protocol (ARP).\n" + "\n" + "ARP -s inet_addr eth_addr [if_addr]\n" + "ARP -d inet_addr [if_addr]\n" + "ARP -a [inet_addr] [-N if_addr]\n" + "\n" + " -a Displays current ARP entries by interrogating the current\n" + " protocol data. If inet_addr is specified, the IP and Physical\n" + " addresses for only the specified computer are displayed. If\n" + " more than one network interface uses ARP, entries for each ARP\n" + " table are displayed.\n" + " -g Same as -a.\n" + " inet_addr Specifies an internet address.\n" + " -N if_addr Displays the ARP entries for the network interface specified\n" + " by if_addr.\n" + " -d Deletes the host specified by inet_addr. inet_addr may be\n" + " wildcarded with * to delete all hosts.\n" + " -s Adds the host and associates the Internet address inet_addr\n" + " with the Physical address eth_addr. The Physical address is\n" + " given as 6 hexadecimal bytes separated by hyphens. The entry\n" + " is permanent.\n" + " eth_addr Specifies a physical address.\n" + " if_addr If present, this specifies the Internet address of the\n" + " interface whose address translation table should be modified.\n" + " If not present, the first applicable interface will be used.\n" + "Example:\n" + " > arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.\n" + " > arp -a .... Displays the arp table.\n\n")); +} + + + +/* + * + * Program entry. + * Parse command line and call the required function + * + */ +INT main(int argc, char* argv[]) +{ + const char N[] = "-N"; + + if ((argc < 2) || (argc > 5)) + { + Usage(); + return FALSE; + } + + + if (argv[1][0] == '-') { + switch (argv[1][1]) { + /* FIX ME */ + /* need better control for -a, as -N might not be arg 4 */ + case 'a': if (argc == 2) + DisplayArpEntries(NULL, NULL); + else if (argc == 3) + DisplayArpEntries(argv[2], NULL); + else if ((argc == 5) && ((strcmp(argv[3], N)) == 0)) + DisplayArpEntries(argv[2], argv[4]); + else + Usage(); + break; + case 'g': break; + case 'd': if (argc == 3) + Deletehost(argv[2], NULL); + else if (argc == 4) + Deletehost(argv[2], argv[3]); + else + Usage(); + break; + case 's': if (argc == 4) + Addhost(argv[2], argv[3], NULL); + else if (argc == 5) + Addhost(argv[2], argv[3], argv[4]); + else + Usage(); + break; + default: + Usage(); + return -1; + } + } else { + Usage(); + return -1; + } + + return 0; +} _____ Modified: trunk/reactos/apps/utils/net/arp/arp.rc --- trunk/reactos/apps/utils/net/arp/arp.rc 2005-07-05 21:57:55 UTC (rev 16439) +++ trunk/reactos/apps/utils/net/arp/arp.rc 2005-07-05 22:14:07 UTC (rev 16440) @@ -1,6 +1,5 @@ -/* $Id$ */ - #define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 arp\0" #define REACTOS_STR_INTERNAL_NAME "arp\0" #define REACTOS_STR_ORIGINAL_FILENAME "arp.exe\0" +#define REACTOS_STR_ORIGINAL_COPYRIGHT "Ged Murphy (gedmurphy(a)gmail.com)\0" #include <reactos/version.rc> _____ Modified: trunk/reactos/apps/utils/net/arp/arp.xml --- trunk/reactos/apps/utils/net/arp/arp.xml 2005-07-05 21:57:55 UTC (rev 16439) +++ trunk/reactos/apps/utils/net/arp/arp.xml 2005-07-05 22:14:07 UTC (rev 16440) @@ -2,8 +2,10 @@ <include base="arp">.</include> <define name="__USE_W32API" /> <library>kernel32</library> - <library>user32</library> - <library>snmpapi</library> + <library>iphlpapi</library> + <library>ws2_32</library> + <library>shlwapi</library> <file>arp.c</file> <file>arp.rc</file> </module> +
19 years, 6 months
1
0
0
0
[ion] 16439: Fix the build by adding KDPC_DATA as a shared arch structure. Kind of a hack but I could not find another way to avoid the undelrying recursive dependencies that not doing this would cause. Also made an arch-specific fix to KPROCESS and wrote a little comment on it
by ion@svn.reactos.com
Fix the build by adding KDPC_DATA as a shared arch structure. Kind of a hack but I could not find another way to avoid the undelrying recursive dependencies that not doing this would cause. Also made an arch-specific fix to KPROCESS and wrote a little comment on it Modified: trunk/reactos/include/ndk/arch/ketypes.h Modified: trunk/reactos/include/ndk/ketypes.h _____ Modified: trunk/reactos/include/ndk/arch/ketypes.h --- trunk/reactos/include/ndk/arch/ketypes.h 2005-07-05 21:17:01 UTC (rev 16438) +++ trunk/reactos/include/ndk/arch/ketypes.h 2005-07-05 21:57:55 UTC (rev 16439) @@ -9,6 +9,15 @@ #ifndef _ARCH_KETYPES_H #define _ARCH_KETYPES_H +/* Shared structure needed by Arch-specific headers */ +typedef struct _KDPC_DATA +{ + LIST_ENTRY DpcListHead; + ULONG DpcLock; + ULONG DpcQueueDepth; + ULONG DpcCount; +} KDPC_DATA, *PKDPC_DATA; + #ifdef _M_IX86 #include <ndk/i386/ketypes.h> #else _____ Modified: trunk/reactos/include/ndk/ketypes.h --- trunk/reactos/include/ndk/ketypes.h 2005-07-05 21:17:01 UTC (rev 16438) +++ trunk/reactos/include/ndk/ketypes.h 2005-07-05 21:57:55 UTC (rev 16439) @@ -15,6 +15,12 @@ #include "mmtypes.h" #include <arc/arc.h> +/* + * Architecture-specific types + * NB: Although KPROCESS is Arch-Specific, + * only some members are different and we will use #ifdef + * directly in the structure to avoid dependency-hell + */ #include "arch/ketypes.h" /* CONSTANTS *****************************************************************/ @@ -57,23 +63,15 @@ CurrentApcEnvironment } KAPC_ENVIRONMENT; -typedef struct _KDPC_DATA -{ - LIST_ENTRY DpcListHead; - ULONG DpcLock; - ULONG DpcQueueDepth; - ULONG DpcCount; -} KDPC_DATA, *PKDPC_DATA; - /* We don't want to force NTIFS usage only for a single structure */ #ifndef _NTIFS_ typedef struct _KAPC_STATE { - LIST_ENTRY ApcListHead[2]; - PKPROCESS Process; - BOOLEAN KernelApcInProgress; - BOOLEAN KernelApcPending; - BOOLEAN UserApcPending; + LIST_ENTRY ApcListHead[2]; + PKPROCESS Process; + BOOLEAN KernelApcInProgress; + BOOLEAN KernelApcPending; + BOOLEAN UserApcPending; } KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE; #endif @@ -108,26 +106,26 @@ typedef struct _KINTERRUPT { - CSHORT Type; - CSHORT Size; - LIST_ENTRY InterruptListEntry; - PKSERVICE_ROUTINE ServiceRoutine; - PVOID ServiceContext; - KSPIN_LOCK SpinLock; - ULONG TickCount; - PKSPIN_LOCK ActualLock; - PVOID DispatchAddress; - ULONG Vector; - KIRQL Irql; - KIRQL SynchronizeIrql; - BOOLEAN FloatingSave; - BOOLEAN Connected; - CHAR Number; - UCHAR ShareVector; - KINTERRUPT_MODE Mode; - ULONG ServiceCount; - ULONG DispatchCount; - ULONG DispatchCode[106]; + CSHORT Type; + CSHORT Size; + LIST_ENTRY InterruptListEntry; + PKSERVICE_ROUTINE ServiceRoutine; + PVOID ServiceContext; + KSPIN_LOCK SpinLock; + ULONG TickCount; + PKSPIN_LOCK ActualLock; + PVOID DispatchAddress; + ULONG Vector; + KIRQL Irql; + KIRQL SynchronizeIrql; + BOOLEAN FloatingSave; + BOOLEAN Connected; + CHAR Number; + UCHAR ShareVector; + KINTERRUPT_MODE Mode; + ULONG ServiceCount; + ULONG DispatchCount; + ULONG DispatchCode[106]; } KINTERRUPT, *PKINTERRUPT; typedef struct _KEVENT_PAIR @@ -183,23 +181,14 @@ typedef struct _KTHREAD { - /* For waiting on thread exit */ DISPATCHER_HEADER DispatcherHeader; /* 00 */ - - /* List of mutants owned by the thread */ LIST_ENTRY MutantListHead; /* 10 */ PVOID InitialStack; /* 18 */ ULONG_PTR StackLimit; /* 1C */ - - /* Pointer to the thread's environment block in user memory */ struct _TEB *Teb; /* 20 */ - - /* Pointer to the thread's TLS array */ PVOID TlsArray; /* 24 */ PVOID KernelStack; /* 28 */ UCHAR DebugActive; /* 2C */ - - /* Thread state (one of THREAD_STATE_xxx constants below) */ UCHAR State; /* 2D */ BOOLEAN Alerted[2]; /* 2E */ UCHAR Iopl; /* 30 */ @@ -215,8 +204,8 @@ UCHAR WaitReason; /* 57 */ union /* 58 */ { - PKWAIT_BLOCK WaitBlockList; /* 58 */ - PKGATE GateObject; /* 58 */ + PKWAIT_BLOCK WaitBlockList; /* 58 */ + PKGATE GateObject; /* 58 */ }; /* 58 */ LIST_ENTRY WaitListEntry; /* 5C */ ULONG WaitTime; /* 64 */ @@ -230,10 +219,10 @@ { struct { - USHORT KernelApcDisable; - USHORT SpecialApcDisable; + USHORT KernelApcDisable; + USHORT SpecialApcDisable; }; - ULONG CombinedApcDisable; /* D0 */ + ULONG CombinedApcDisable; /* D0 */ }; KAFFINITY UserAffinity; /* D4 */ UCHAR SystemAffinityActive;/* D8 */ @@ -278,23 +267,18 @@ #include <poppack.h> -/* - * NAME: KPROCESS - * DESCRIPTION: Internal Kernel Process Structure. - * PORTABILITY: Architecture Dependent. - * KERNEL VERSION: 5.2 - * DOCUMENTATION:
http://reactos.com/wiki/index.php/KPROCESS
- */ typedef struct _KPROCESS { DISPATCHER_HEADER Header; /* 000 */ LIST_ENTRY ProfileListHead; /* 010 */ PHYSICAL_ADDRESS DirectoryTableBase; /* 018 */ +#if defined(_M_IX86) KGDTENTRY LdtDescriptor; /* 020 */ KIDTENTRY Int21Descriptor; /* 028 */ USHORT IopmOffset; /* 030 */ UCHAR Iopl; /* 032 */ UCHAR Unused; /* 033 */ +#endif ULONG ActiveProcessors; /* 034 */ ULONG KernelTime; /* 038 */ ULONG UserTime; /* 03C */
19 years, 6 months
1
0
0
0
[gvg] 16438: Sync to Wine-20050628:
by gvg@svn.reactos.com
Sync to Wine-20050628: Alexandre Julliard <julliard(a)winehq.org> - Generate the resource data directly inside the resource directory. - Replaced all uses of the __ASM_NAME macro by the asm_name function to allow run-time determination of the correct format. - Beginnings of an infrastructure to allow specifying the target CPU and platform at run-time. - Output the exported names as a C string so that they end up in the correct section. - Reuse output_dll_init for the constructor of debug files. - Moved all assembly code to the end of the generated C files to avoid conflicting with the compiler over section changes. - Switch back to .data at the end of asm sections to work around an optimization in recent gcc versions. - Remove some i386 ifdefs for 16-bit entry points since they are no longer used by default on other platforms anyway. - Make import thunks position-independent to avoid text relocations. - Generate proper PIC code for CALL32_CBClient. - Store a relative pointer for registry entry points to avoid some text relocations. - Allocate ordinals in the order of the declarations in the spec file. Wolfgang Thaller <wolfgang.thaller(a)gmx.net> - Winebuild darwin/x86-specific fixes: - Assembler interprets .align as power-of-two - Add .weak_reference to output where gcc 3.3 swallows it - Use __ASM_NAME and HAVE_ASM_DOT_SIZE in a few places in winebuild where they have been missing (needed for Darwin/x86). Pierre d'Herbemont <stegefin(a)free.fr> - Use .mod_*_func sections on Mac OS X/i386 instead of the elf constructor/destructor. Modified: trunk/reactos/tools/winebuild/build.h Modified: trunk/reactos/tools/winebuild/import.c Modified: trunk/reactos/tools/winebuild/main.c Modified: trunk/reactos/tools/winebuild/parser.c Modified: trunk/reactos/tools/winebuild/relay.c Modified: trunk/reactos/tools/winebuild/res32.c Modified: trunk/reactos/tools/winebuild/spec16.c Modified: trunk/reactos/tools/winebuild/spec32.c Modified: trunk/reactos/tools/winebuild/utils.c Modified: trunk/reactos/tools/winebuild/winglue.h _____ Modified: trunk/reactos/tools/winebuild/build.h --- trunk/reactos/tools/winebuild/build.h 2005-07-05 21:03:46 UTC (rev 16437) +++ trunk/reactos/tools/winebuild/build.h 2005-07-05 21:17:01 UTC (rev 16438) @@ -109,6 +109,19 @@ struct resource *resources; /* array of dll resources (format differs between Win16/Win32) */ } DLLSPEC; +enum target_cpu +{ + CPU_x86, CPU_SPARC, CPU_ALPHA, CPU_POWERPC +}; + +enum target_platform +{ + PLATFORM_UNSPECIFIED, PLATFORM_APPLE, PLATFORM_SVR4, PLATFORM_WINDOWS +}; + +extern enum target_cpu target_cpu; +extern enum target_platform target_platform; + /* entry point flags */ #define FLAG_NORELAY 0x01 /* don't use relay debugging for this function */ #define FLAG_NONAME 0x02 /* don't import function by name */ @@ -166,7 +179,11 @@ extern DLLSPEC *alloc_dll_spec(void); extern void free_dll_spec( DLLSPEC *spec ); extern const char *make_c_identifier( const char *str ); -extern int get_alignment(int alignBoundary); +extern unsigned int get_alignment(unsigned int align); +extern unsigned int get_page_size(void); +extern const char *asm_name( const char *func ); +extern const char *func_declaration( const char *func ); +extern const char *func_size( const char *func ); extern void add_import_dll( const char *name, const char *filename ); extern void add_delayed_import( const char *name ); @@ -174,6 +191,7 @@ extern void read_undef_symbols( char **argv ); extern int resolve_imports( DLLSPEC *spec ); extern int output_imports( FILE *outfile, DLLSPEC *spec, int *nb_delayed ); +extern void output_import_thunks( FILE *outfile, DLLSPEC *spec ); extern int load_res32_file( const char *name, DLLSPEC *spec ); extern void output_resources( FILE *outfile, DLLSPEC *spec ); extern void load_res16_file( const char *name, DLLSPEC *spec ); _____ Modified: trunk/reactos/tools/winebuild/import.c --- trunk/reactos/tools/winebuild/import.c 2005-07-05 21:03:46 UTC (rev 16437) +++ trunk/reactos/tools/winebuild/import.c 2005-07-05 21:17:01 UTC (rev 16438) @@ -125,24 +125,17 @@ "tanh" }; -#ifdef __powerpc__ -# ifdef __APPLE__ -# define ppc_high(mem) "ha16(" mem ")" -# define ppc_low(mem) "lo16(" mem ")" -static const char * const ppc_reg[32] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "r10","r11","r12","r13","r14","r15", - "r16","r17","r18","r19","r20","r21","r22","r23", - "r24","r25","r26","r27","r28","r29","r30","r31" }; -# else /* __APPLE__ */ -# define ppc_high(mem) "(" mem ")@hi" -# define ppc_low(mem) "(" mem ")@l" -static const char * const ppc_reg[32] = { "0", "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" }; -# endif /* __APPLE__ */ -#endif /* __powerpc__ */ +static inline const char *ppc_reg( int reg ) +{ + static const char * const ppc_regs[32] = { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", + "r8", "r9", "r10","r11","r12","r13","r14","r15", + "r16","r17","r18","r19","r20","r21","r22","r23", + "r24","r25","r26","r27","r28","r29","r30","r31" }; + if (target_platform == PLATFORM_APPLE) return ppc_regs[reg]; + return ppc_regs[reg] + 1; /* skip the 'r' */ +} + /* compare function names; helper for resolve_imports */ static int name_cmp( const void *name, const void *entry ) { @@ -191,9 +184,8 @@ inline static void output_function_size( FILE *outfile, const char *name ) { -#ifdef HAVE_ASM_DOT_SIZE - fprintf( outfile, " \"\\t.size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\\n\"\n", name, name); -#endif + const char *size = func_size( name ); + if (size[0]) fprintf( outfile, " \"\\t%s\\n\"\n", size ); } /* free an import structure */ @@ -607,15 +599,17 @@ /* read in the list of undefined symbols */ void read_undef_symbols( char **argv ) { - static const char name_prefix[] = __ASM_NAME(""); - static const int prefix_len = sizeof(name_prefix) - 1; + size_t prefix_len; FILE *f; - char *cmd, buffer[1024]; + char *cmd, buffer[1024], name_prefix[16]; int err; const char *name; if (!argv[0]) return; + strcpy( name_prefix, asm_name("") ); + prefix_len = strlen( name_prefix ); + undef_size = nb_undef_symbols = 0; /* if we have multiple object files, link them together */ @@ -695,14 +689,120 @@ return 1; } +/* output a single import thunk */ +static void output_import_thunk( FILE *outfile, const char *name, const char *table, int pos ) +{ + fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(8) ); + fprintf( outfile, " \"\\t%s\\n\"\n", func_declaration(name) ); + fprintf( outfile, " \"\\t.globl %s\\n\"\n", asm_name(name) ); + fprintf( outfile, " \"%s:\\n\"\n", asm_name(name) ); + + switch(target_cpu) + { + case CPU_x86: + if (!UsePIC) + { + if (strstr( name, "__wine_call_from_16" )) fprintf( outfile, " \"\\t.byte 0x2e\\n\"\n" ); + fprintf( outfile, " \"\\tjmp *(imports+%d)\\n\"\n", pos ); + } + else + { + if (!strcmp( name, "__wine_call_from_32_regs" ) || + !strcmp( name, "__wine_call_from_16_regs" )) + { + /* special case: need to preserve all registers */ + fprintf( outfile, " \"\\tpushl %%eax\\n\"\n" ); + fprintf( outfile, " \"\\tpushfl\\n\"\n" ); + fprintf( outfile, " \"\\tcall .L__wine_spec_%s\\n\"\n", name ); + fprintf( outfile, " \".L__wine_spec_%s:\\n\"\n", name ); + fprintf( outfile, " \"\\tpopl %%eax\\n\"\n" ); + fprintf( outfile, " \"\\taddl $%d+%s-.L__wine_spec_%s,%%eax\\n\"\n", + pos, asm_name(table), name ); + if (!strcmp( name, "__wine_call_from_16_regs" )) + fprintf( outfile, " \"\\t.byte 0x2e\\n\"\n" ); + fprintf( outfile, " \"\\tmovl 0(%%eax),%%eax\\n\"\n" ); + fprintf( outfile, " \"\\txchgl 4(%%esp),%%eax\\n\"\n" ); + fprintf( outfile, " \"\\tpopfl\\n\"\n" ); + fprintf( outfile, " \"\\tret\\n\"\n" ); + } + else + { + fprintf( outfile, " \"\\tcall .L__wine_spec_%s\\n\"\n", name ); + fprintf( outfile, " \".L__wine_spec_%s:\\n\"\n", name ); + fprintf( outfile, " \"\\tpopl %%eax\\n\"\n" ); + fprintf( outfile, " \"\\taddl $%d+%s-.L__wine_spec_%s,%%eax\\n\"\n", + pos, asm_name(table), name ); + if (strstr( name, "__wine_call_from_16" )) + fprintf( outfile, " \"\\t.byte 0x2e\\n\"\n" ); + fprintf( outfile, " \"\\tjmp *0(%%eax)\\n\"\n" ); + } + } + break; + case CPU_SPARC: + if ( !UsePIC ) + { + fprintf( outfile, " \"\\tsethi %%hi(%s+%d), %%g1\\n\"\n", table, pos ); + fprintf( outfile, " \"\\tld [%%g1+%%lo(%s+%d)], %%g1\\n\"\n", table, pos ); + fprintf( outfile, " \"\\tjmp %%g1\\n\\tnop\\n\"\n" ); + } + else + { + /* Hmpf. Stupid sparc assembler always interprets global variable + names as GOT offsets, so we have to do it the long way ... */ + fprintf( outfile, " \"\\tsave %%sp, -96, %%sp\\n\"\n" ); + fprintf( outfile, " \"0:\\tcall 1f\\n\\tnop\\n\"\n" ); + fprintf( outfile, " \"1:\\tsethi %%hi(%s+%d-0b), %%g1\\n\"\n", table, pos ); + fprintf( outfile, " \"\\tor %%g1, %%lo(%s+%d-0b), %%g1\\n\"\n", table, pos ); + fprintf( outfile, " \"\\tld [%%g1+%%o7], %%g1\\n\"\n" ); + fprintf( outfile, " \"\\tjmp %%g1\\n\\trestore\\n\"\n" ); + } + break; + case CPU_ALPHA: + fprintf( outfile, " \"\\tlda $0,%s\\n\"\n", table ); + fprintf( outfile, " \"\\tlda $0,%d($0)\\n\"\n", pos); + fprintf( outfile, " \"\\tjmp $31,($0)\\n\"\n" ); + break; + case CPU_POWERPC: + fprintf(outfile, " \"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg(1), ppc_reg(1)); + fprintf(outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg(9), ppc_reg(1)); + fprintf(outfile, " \"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg(1), ppc_reg(1)); + fprintf(outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg(8), ppc_reg(1)); + fprintf(outfile, " \"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg(1), ppc_reg(1)); + fprintf(outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg(7), ppc_reg(1)); + if (target_platform == PLATFORM_APPLE) + { + fprintf(outfile, " \"\\tlis %s, ha16(%s+%d)\\n\"\n", + ppc_reg(9), asm_name(table), pos); + fprintf(outfile, " \"\\tla %s, lo16(%s+%d)(%s)\\n\"\n", + ppc_reg(8), asm_name(table), pos, ppc_reg(9)); + } + else + { + fprintf(outfile, " \"\\tlis %s, (%s+%d)@hi\\n\"\n", + ppc_reg(9), asm_name(table), pos); + fprintf(outfile, " \"\\tla %s, (%s+%d)@l(%s)\\n\"\n", + ppc_reg(8), asm_name(table), pos, ppc_reg(9)); + } + fprintf(outfile, " \"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg(7), ppc_reg(8)); + fprintf(outfile, " \"\\tmtctr %s\\n\"\n", ppc_reg(7)); + fprintf(outfile, " \"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg(7), ppc_reg(1)); + fprintf(outfile, " \"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg(1), ppc_reg(1)); + fprintf(outfile, " \"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg(8), ppc_reg(1)); + fprintf(outfile, " \"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg(1), ppc_reg(1)); + fprintf(outfile, " \"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg(9), ppc_reg(1)); + fprintf(outfile, " \"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg(1), ppc_reg(1)); + fprintf(outfile, " \"\\tbctr\\n\"\n"); + break; + } + output_function_size( outfile, name ); +} + /* output the import table of a Win32 module */ static int output_immediate_imports( FILE *outfile ) { - int i, j, pos; - int nb_imm = nb_imports - nb_delayed; - static const char import_thunks[] = "__wine_spec_import_thunks"; + int i, j, nb_imm = nb_imports - nb_delayed; - if (!nb_imm) goto done; + if (!nb_imm) return 0; /* main import header */ @@ -753,13 +853,23 @@ } fprintf( outfile, " }\n};\n\n" ); - /* thunks for imported functions */ + return nb_imm; +} - fprintf( outfile, "#ifndef __GNUC__\nstatic void __asm__dummy_import(void) {\n#endif\n\n" ); +/* output the import thunks of a Win32 module */ +static void output_immediate_import_thunks( FILE *outfile ) +{ + int i, j, pos; + int nb_imm = nb_imports - nb_delayed; + static const char import_thunks[] = "__wine_spec_import_thunks"; + + if (!nb_imm) return; + pos = (sizeof(void *) + 2*sizeof(unsigned int) + sizeof(const char *) + sizeof(void *)) * (nb_imm + 1); /* offset of imports.data from start of imports */ + fprintf( outfile, "/* immediate import thunks */\n" ); fprintf( outfile, "asm(\".text\\n\\t.align %d\\n\"\n", get_alignment(8) ); - fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", import_thunks); + fprintf( outfile, " \"%s:\\n\"\n", asm_name(import_thunks)); for (i = 0; i < nb_imports; i++) { @@ -767,84 +877,21 @@ for (j = 0; j < dll_imports[i]->nb_imports; j++, pos += sizeof(const char *)) { ORDDEF *odp = dll_imports[i]->imports[j]; - const char *name = odp->name ? odp->name : odp->export_name; - fprintf( outfile, " \"\\t" __ASM_FUNC("%s") "\\n\"\n", name ); - fprintf( outfile, " \"\\t.globl " __ASM_NAME("%s") "\\n\"\n", name ); - fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\\t", name); - -#ifndef __REACTOS__ -#if defined(__i386__) - if (strstr( name, "__wine_call_from_16" )) - fprintf( outfile, ".byte 0x2e\\n\\tjmp *(imports+%d)\\n\\tnop\\n", pos ); - else - fprintf( outfile, "jmp *(imports+%d)\\n\\tmovl %%esi,%%esi\\n", pos ); -#elif defined(__sparc__) - if ( !UsePIC ) - { - fprintf( outfile, "sethi %%hi(imports+%d), %%g1\\n\\t", pos ); - fprintf( outfile, "ld [%%g1+%%lo(imports+%d)], %%g1\\n\\t", pos ); - fprintf( outfile, "jmp %%g1\\n\\tnop\\n" ); - } - else - { - /* Hmpf. Stupid sparc assembler always interprets global variable - names as GOT offsets, so we have to do it the long way ... */ - fprintf( outfile, "save %%sp, -96, %%sp\\n" ); - fprintf( outfile, "0:\\tcall 1f\\n\\tnop\\n" ); - fprintf( outfile, "1:\\tsethi %%hi(imports+%d-0b), %%g1\\n\\t", pos ); - fprintf( outfile, "or %%g1, %%lo(imports+%d-0b), %%g1\\n\\t", pos ); - fprintf( outfile, "ld [%%g1+%%o7], %%g1\\n\\t" ); - fprintf( outfile, "jmp %%g1\\n\\trestore\\n" ); - } - -#elif defined(__powerpc__) - fprintf(outfile, "\taddi %s, %s, -0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf(outfile, "\t\"\\tstw %s, 0(%s)\\n\"\n", ppc_reg[9], ppc_reg[1]); - fprintf(outfile, "\t\"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf(outfile, "\t\"\\tstw %s, 0(%s)\\n\"\n", ppc_reg[8], ppc_reg[1]); - fprintf(outfile, "\t\"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf(outfile, "\t\"\\tstw %s, 0(%s)\\n\"\n", ppc_reg[7], ppc_reg[1]); - - fprintf(outfile, "\t\"\\tlis %s, " ppc_high(__ASM_NAME("imports") "+ %d") "\\n\"\n", ppc_reg[9], pos); - fprintf(outfile, "\t\"\\tla %s, " ppc_low (__ASM_NAME("imports") "+ %d") "(%s)\\n\"\n", ppc_reg[8], pos, ppc_reg[9]); - fprintf(outfile, "\t\"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg[7], ppc_reg[8]); - fprintf(outfile, "\t\"\\tmtctr %s\\n\"\n", ppc_reg[7]); - - fprintf(outfile, "\t\"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg[7], ppc_reg[1]); - fprintf(outfile, "\t\"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf(outfile, "\t\"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg[8], ppc_reg[1]); - fprintf(outfile, "\t\"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf(outfile, "\t\"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg[9], ppc_reg[1]); - fprintf(outfile, "\t\"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf(outfile, "\t\"\\tbctr\\n"); -#elif defined(__ALPHA__) - fprintf( outfile, "\tlda $0,imports\\n\"\n" ); - fprintf( outfile, "\t\"\\tlda $0,%d($0)\\n\"\n", pos); - fprintf( outfile, "\t\"\\tjmp $31,($0)\\n" ); -#else -#error You need to define import thunks for your architecture! -#endif -#endif /*__REACTOS__*/ - fprintf( outfile, "\"\n" ); - output_function_size( outfile, name ); + output_import_thunk( outfile, odp->name ? odp->name : odp->export_name, + "imports", pos ); } pos += 4; } output_function_size( outfile, import_thunks ); - fprintf( outfile, " \".text\");\n#ifndef __GNUC__\n}\n#endif\n\n" ); - - done: - return nb_imm; + fprintf( outfile, ");\n" ); } /* output the delayed import table of a Win32 module */ static int output_delayed_imports( FILE *outfile, const DLLSPEC *spec ) { - int i, idx, j, pos; - static const char delayed_import_loaders[] = "__wine_spec_delayed_import_loaders"; - static const char delayed_import_thunks[] = "__wine_spec_delayed_import_thunks"; + int i, j; - if (!nb_delayed) goto done; + if (!nb_delayed) return 0; fprintf( outfile, "static void *__wine_delay_imp_hmod[%d];\n", nb_delayed ); for (i = 0; i < nb_imports; i++) @@ -932,83 +979,93 @@ fprintf( outfile, " RaiseException( 0x%08x, %d, 2, args );\n", EXCEPTION_WINE_STUB, EXCEPTION_NONCONTINUABLE ); fprintf( outfile, " return 0;\n" ); - fprintf( outfile, " }\n}\n\n" ); + fprintf( outfile, " }\n}\n" ); - fprintf( outfile, "#ifndef __GNUC__\n" ); - fprintf( outfile, "static void __asm__dummy_delay_import(void) {\n" ); - fprintf( outfile, "#endif\n" ); + return nb_delayed; +} - fprintf( outfile, "asm(\".align %d\\n\"\n", get_alignment(8) ); - fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", delayed_import_loaders); - fprintf( outfile, " \"\\t" __ASM_FUNC("__wine_delay_load_asm") "\\n\"\n" ); - fprintf( outfile, " \"" __ASM_NAME("__wine_delay_load_asm") ":\\n\"\n" ); -#if defined(__i386__) - fprintf( outfile, " \"\\tpushl %%ecx\\n\\tpushl %%edx\\n\\tpushl %%eax\\n\"\n" ); - fprintf( outfile, " \"\\tcall __wine_delay_load\\n\"\n" ); - fprintf( outfile, " \"\\tpopl %%edx\\n\\tpopl %%ecx\\n\\tjmp *%%eax\\n\"\n" ); -#elif defined(__sparc__) - fprintf( outfile, " \"\\tsave %%sp, -96, %%sp\\n\"\n" ); - fprintf( outfile, " \"\\tcall __wine_delay_load\\n\"\n" ); - fprintf( outfile, " \"\\tmov %%g1, %%o0\\n\"\n" ); - fprintf( outfile, " \"\\tjmp %%o0\\n\\trestore\\n\"\n" ); -#elif defined(__powerpc__) -# if defined(__APPLE__) -/* On darwin an extra 56 bytes must be allowed for the linkage area+param area */ -# define extra_stack_storage 56 -# else -# define extra_stack_storage 0 -# endif - /* Save all callee saved registers into a stackframe. */ - fprintf( outfile, " \"\\tstwu %s, -%d(%s)\\n\"\n",ppc_reg[1], 48+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[3], 4+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[4], 8+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[5], 12+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[6], 16+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[7], 20+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[8], 24+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[9], 28+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[10],32+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[11],36+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[12],40+extra_stack_storage, ppc_reg[1]); +/* output the delayed import thunks of a Win32 module */ +static void output_delayed_import_thunks( FILE *outfile, const DLLSPEC *spec ) +{ + int i, idx, j, pos, extra_stack_storage = 0; + static const char delayed_import_loaders[] = "__wine_spec_delayed_import_loaders"; + static const char delayed_import_thunks[] = "__wine_spec_delayed_import_thunks"; - /* r0 -> r3 (arg1) */ - fprintf( outfile, " \"\\tmr %s, %s\\n\"\n", ppc_reg[3], ppc_reg[0]); + if (!nb_delayed) return; - /* save return address */ - fprintf( outfile, " \"\\tmflr %s\\n\"\n", ppc_reg[0]); - fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg[0], 44+extra_stack_storage, ppc_reg[1]); + fprintf( outfile, "/* delayed import thunks */\n" ); + fprintf( outfile, "asm(\".text\\n\"\n" ); + fprintf( outfile, " \"\\t.align %d\\n\"\n", get_alignment(8) ); + fprintf( outfile, " \"%s:\\n\"\n", asm_name(delayed_import_loaders)); + fprintf( outfile, " \"\\t%s\\n\"\n", func_declaration("__wine_delay_load_asm") ); + fprintf( outfile, " \"%s:\\n\"\n", asm_name("__wine_delay_load_asm") ); + switch(target_cpu) + { + case CPU_x86: + fprintf( outfile, " \"\\tpushl %%ecx\\n\\tpushl %%edx\\n\\tpushl %%eax\\n\"\n" ); + fprintf( outfile, " \"\\tcall %s\\n\"\n", asm_name("__wine_delay_load") ); + fprintf( outfile, " \"\\tpopl %%edx\\n\\tpopl %%ecx\\n\\tjmp *%%eax\\n\"\n" ); + break; + case CPU_SPARC: + fprintf( outfile, " \"\\tsave %%sp, -96, %%sp\\n\"\n" ); + fprintf( outfile, " \"\\tcall %s\\n\"\n", asm_name("__wine_delay_load") ); + fprintf( outfile, " \"\\tmov %%g1, %%o0\\n\"\n" ); + fprintf( outfile, " \"\\tjmp %%o0\\n\\trestore\\n\"\n" ); + break; + case CPU_ALPHA: + fprintf( outfile, " \"\\tjsr $26,%s\\n\"\n", asm_name("__wine_delay_load") ); + fprintf( outfile, " \"\\tjmp $31,($0)\\n\"\n" ); + break; + case CPU_POWERPC: + if (target_platform == PLATFORM_APPLE) extra_stack_storage = 56; - /* Call the __wine_delay_load function, arg1 is arg1. */ - fprintf( outfile, " \"\\tbl " __ASM_NAME("__wine_delay_load") "\\n\"\n"); + /* Save all callee saved registers into a stackframe. */ + fprintf( outfile, " \"\\tstwu %s, -%d(%s)\\n\"\n",ppc_reg(1), 48+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(3), 4+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(4), 8+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(5), 12+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(6), 16+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(7), 20+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(8), 24+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(9), 28+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(10),32+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(11),36+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(12),40+extra_stack_storage, ppc_reg(1)); - /* Load return value from call into ctr register */ - fprintf( outfile, " \"\\tmtctr %s\\n\"\n", ppc_reg[3]); + /* r0 -> r3 (arg1) */ + fprintf( outfile, " \"\\tmr %s, %s\\n\"\n", ppc_reg(3), ppc_reg(0)); - /* restore all saved registers and drop stackframe. */ - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[3], 4+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[4], 8+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[5], 12+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[6], 16+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[7], 20+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[8], 24+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[9], 28+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[10],32+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[11],36+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[12],40+extra_stack_storage, ppc_reg[1]); + /* save return address */ + fprintf( outfile, " \"\\tmflr %s\\n\"\n", ppc_reg(0)); + fprintf( outfile, " \"\\tstw %s, %d(%s)\\n\"\n", ppc_reg(0), 44+extra_stack_storage, ppc_reg(1)); - /* Load return value from call into return register */ - fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg[0], 44+extra_stack_storage, ppc_reg[1]); - fprintf( outfile, " \"\\tmtlr %s\\n\"\n", ppc_reg[0]); - fprintf( outfile, " \"\\taddi %s, %s, %d\\n\"\n", ppc_reg[1], ppc_reg[1], 48+extra_stack_storage); + /* Call the __wine_delay_load function, arg1 is arg1. */ + fprintf( outfile, " \"\\tbl %s\\n\"\n", asm_name("__wine_delay_load") ); - /* branch to ctr register. */ - fprintf( outfile, " \"bctr\\n\"\n"); -#elif defined(__ALPHA__) - fprintf( outfile, " \"\\tjsr $26,__wine_delay_load\\n\"\n" ); - fprintf( outfile, " \"\\tjmp $31,($0)\\n\"\n" ); -#else -#error You need to defined delayed import thunks for your architecture! -#endif + /* Load return value from call into ctr register */ + fprintf( outfile, " \"\\tmtctr %s\\n\"\n", ppc_reg(3)); + + /* restore all saved registers and drop stackframe. */ + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(3), 4+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(4), 8+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(5), 12+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(6), 16+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(7), 20+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(8), 24+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(9), 28+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(10),32+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(11),36+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(12),40+extra_stack_storage, ppc_reg(1)); + + /* Load return value from call into return register */ + fprintf( outfile, " \"\\tlwz %s, %d(%s)\\n\"\n", ppc_reg(0), 44+extra_stack_storage, ppc_reg(1)); + fprintf( outfile, " \"\\tmtlr %s\\n\"\n", ppc_reg(0)); + fprintf( outfile, " \"\\taddi %s, %s, %d\\n\"\n", ppc_reg(1), ppc_reg(1), 48+extra_stack_storage); + + /* branch to ctr register. */ + fprintf( outfile, " \"bctr\\n\"\n"); + break; + } output_function_size( outfile, "__wine_delay_load_asm" ); for (i = idx = 0; i < nb_imports; i++) @@ -1021,43 +1078,51 @@ const char *name = odp->name ? odp->name : odp->export_name; sprintf( buffer, "__wine_delay_imp_%d_%s", i, name ); - fprintf( outfile, " \"\\t" __ASM_FUNC("%s") "\\n\"\n", buffer ); - fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", buffer ); -#if defined(__i386__) - fprintf( outfile, " \"\\tmovl $%d, %%eax\\n\"\n", (idx << 16) | j ); - fprintf( outfile, " \"\\tjmp __wine_delay_load_asm\\n\"\n" ); -#elif defined(__sparc__) - fprintf( outfile, " \"\\tset %d, %%g1\\n\"\n", (idx << 16) | j ); - fprintf( outfile, " \"\\tb,a __wine_delay_load_asm\\n\"\n" ); -#elif defined(__powerpc__) -#ifdef __APPLE__ - /* On Darwin we can use r0 and r2 */ - /* Upper part in r2 */ - fprintf( outfile, " \"\\tlis %s, %d\\n\"\n", ppc_reg[2], idx); - /* Lower part + r2 -> r0, Note we can't use r0 directly */ - fprintf( outfile, " \"\\taddi %s, %s, %d\\n\"\n", ppc_reg[0], ppc_reg[2], j); - fprintf( outfile, " \"\\tb " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n"); -#else /* __APPLE__ */ - /* On linux we can't use r2 since r2 is not a scratch register (hold the TOC) */ - /* Save r13 on the stack */ - fprintf( outfile, " \"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf( outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg[13], ppc_reg[1]); - /* Upper part in r13 */ - fprintf( outfile, " \"\\tlis %s, %d\\n\"\n", ppc_reg[13], idx); - /* Lower part + r13 -> r0, Note we can't use r0 directly */ - fprintf( outfile, " \"\\taddi %s, %s, %d\\n\"\n", ppc_reg[0], ppc_reg[13], j); - /* Restore r13 */ - fprintf( outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg[13], ppc_reg[1]); - fprintf( outfile, " \"\\taddic %s, %s, 0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf( outfile, " \"\\tb " __ASM_NAME("__wine_delay_load_asm") "\\n\"\n"); -#endif /* __APPLE__ */ -#elif defined(__ALPHA__) - fprintf( outfile, " \"\\tlda $0,%d($31)\\n\"\n", j); - fprintf( outfile, " \"\\tldah $0,%d($0)\\n\"\n", idx); - fprintf( outfile, " \"\\tjmp $31,__wine_delay_load_asm\\n\"\n" ); -#else -#error You need to defined delayed import thunks for your architecture! -#endif + fprintf( outfile, " \"\\t%s\\n\"\n", func_declaration(buffer) ); + fprintf( outfile, " \"%s:\\n\"\n", asm_name(buffer) ); + switch(target_cpu) + { + case CPU_x86: + fprintf( outfile, " \"\\tmovl $%d, %%eax\\n\"\n", (idx << 16) | j ); + fprintf( outfile, " \"\\tjmp %s\\n\"\n", asm_name("__wine_delay_load_asm") ); + break; + case CPU_SPARC: + fprintf( outfile, " \"\\tset %d, %%g1\\n\"\n", (idx << 16) | j ); + fprintf( outfile, " \"\\tb,a %s\\n\"\n", asm_name("__wine_delay_load_asm") ); + break; + case CPU_ALPHA: + fprintf( outfile, " \"\\tlda $0,%d($31)\\n\"\n", j); + fprintf( outfile, " \"\\tldah $0,%d($0)\\n\"\n", idx); + fprintf( outfile, " \"\\tjmp $31,%s\\n\"\n", asm_name("__wine_delay_load_asm") ); + break; + case CPU_POWERPC: + switch(target_platform) + { + case PLATFORM_APPLE: + /* On Darwin we can use r0 and r2 */ + /* Upper part in r2 */ + fprintf( outfile, " \"\\tlis %s, %d\\n\"\n", ppc_reg(2), idx); + /* Lower part + r2 -> r0, Note we can't use r0 directly */ + fprintf( outfile, " \"\\taddi %s, %s, %d\\n\"\n", ppc_reg(0), ppc_reg(2), j); + fprintf( outfile, " \"\\tb %s\\n\"\n", asm_name("__wine_delay_load_asm") ); + break; + default: + /* On linux we can't use r2 since r2 is not a scratch register (hold the TOC) */ + /* Save r13 on the stack */ + fprintf( outfile, " \"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg(1), ppc_reg(1)); + fprintf( outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg(13), ppc_reg(1)); + /* Upper part in r13 */ + fprintf( outfile, " \"\\tlis %s, %d\\n\"\n", ppc_reg(13), idx); + /* Lower part + r13 -> r0, Note we can't use r0 directly */ + fprintf( outfile, " \"\\taddi %s, %s, %d\\n\"\n", ppc_reg(0), ppc_reg(13), j); + /* Restore r13 */ + fprintf( outfile, " \"\\tstw %s, 0(%s)\\n\"\n", ppc_reg(13), ppc_reg(1)); + fprintf( outfile, " \"\\taddic %s, %s, 0x4\\n\"\n", ppc_reg(1), ppc_reg(1)); + fprintf( outfile, " \"\\tb %s\\n\"\n", asm_name("__wine_delay_load_asm") ); + break; + } + break; + } output_function_size( outfile, name ); } idx++; @@ -1065,7 +1130,7 @@ output_function_size( outfile, delayed_import_loaders ); fprintf( outfile, "\n \".align %d\\n\"\n", get_alignment(8) ); - fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\"\n", delayed_import_thunks); + fprintf( outfile, " \"%s:\\n\"\n", asm_name(delayed_import_thunks)); pos = nb_delayed * 32; for (i = 0; i < nb_imports; i++) { @@ -1073,75 +1138,12 @@ for (j = 0; j < dll_imports[i]->nb_imports; j++, pos += 4) { ORDDEF *odp = dll_imports[i]->imports[j]; - const char *name = odp->name ? odp->name : odp->export_name; - - fprintf( outfile, " \"\\t" __ASM_FUNC("%s") "\\n\"\n", name ); - fprintf( outfile, " \"\\t.globl " __ASM_NAME("%s") "\\n\"\n", name ); - fprintf( outfile, " \"" __ASM_NAME("%s") ":\\n\\t\"", name ); -#if defined(__i386__) - if (strstr( name, "__wine_call_from_16" )) - fprintf( outfile, "\".byte 0x2e\\n\\tjmp *(delay_imports+%d)\\n\\tnop\\n\"", pos ); - else - fprintf( outfile, "\"jmp *(delay_imports+%d)\\n\\tmovl %%esi,%%esi\\n\"", pos ); -#elif defined(__sparc__) - if ( !UsePIC ) - { - fprintf( outfile, "\"sethi %%hi(delay_imports+%d), %%g1\\n\\t\"", pos ); - fprintf( outfile, "\"ld [%%g1+%%lo(delay_imports+%d)], %%g1\\n\\t\"", pos ); - fprintf( outfile, "\"jmp %%g1\\n\\tnop\\n\"" ); - } - else - { - /* Hmpf. Stupid sparc assembler always interprets global variable - names as GOT offsets, so we have to do it the long way ... */ - fprintf( outfile, "\"save %%sp, -96, %%sp\\n\"" ); - fprintf( outfile, "\"0:\\tcall 1f\\n\\tnop\\n\"" ); - fprintf( outfile, "\"1:\\tsethi %%hi(delay_imports+%d-0b), %%g1\\n\\t\"", pos ); - fprintf( outfile, "\"or %%g1, %%lo(delay_imports+%d-0b), %%g1\\n\\t\"", pos ); - fprintf( outfile, "\"ld [%%g1+%%o7], %%g1\\n\\t\"" ); - fprintf( outfile, "\"jmp %%g1\\n\\trestore\\n\"" ); - } - -#elif defined(__powerpc__) - fprintf( outfile, "\t\"addi %s, %s, -0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf( outfile, "\t\"\\tstw %s, 0(%s)\\n\"\n", ppc_reg[9], ppc_reg[1]); - fprintf( outfile, "\t\"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf( outfile, "\t\"\\tstw %s, 0(%s)\\n\"\n", ppc_reg[8], ppc_reg[1]); - fprintf( outfile, "\t\"\\taddi %s, %s, -0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf( outfile, "\t\"\\tstw %s, 0(%s)\\n\"\n", ppc_reg[7], ppc_reg[1]); - - fprintf( outfile, "\t\"\\tlis %s, " ppc_high(__ASM_NAME("delay_imports") "+ %d") "\\n\"\n", ppc_reg[9], pos); - fprintf( outfile, "\t\"\\tla %s, " ppc_low (__ASM_NAME("delay_imports") "+ %d") "(%s)\\n\"\n", ppc_reg[8], pos, ppc_reg[9]); - fprintf( outfile, "\t\"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg[7], ppc_reg[8]); - fprintf( outfile, "\t\"\\tmtctr %s\\n\"\n", ppc_reg[7]); - - fprintf( outfile, "\t\"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg[7], ppc_reg[1]); - fprintf( outfile, "\t\"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf( outfile, "\t\"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg[8], ppc_reg[1]); - fprintf( outfile, "\t\"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf( outfile, "\t\"\\tlwz %s, 0(%s)\\n\"\n", ppc_reg[9], ppc_reg[1]); - fprintf( outfile, "\t\"\\taddi %s, %s, 0x4\\n\"\n", ppc_reg[1], ppc_reg[1]); - fprintf( outfile, "\t\"\\tbctr\\n\""); -#elif defined(__ALPHA__) - fprintf( outfile, "\t\"lda $0,delay_imports\\n\"\n" ); - fprintf( outfile, "\t\"\\tlda $0,%d($0)\\n\"\n", pos); - fprintf( outfile, "\t\"\\tjmp $31,($0)\\n\"" ); -#else -#error You need to define delayed import thunks for your architecture! -#endif - fprintf( outfile, "\n" ); - output_function_size( outfile, name ); + output_import_thunk( outfile, odp->name ? odp->name : odp->export_name, + "delay_imports", pos ); } } output_function_size( outfile, delayed_import_thunks ); fprintf( outfile, ");\n" ); - fprintf( outfile, "#ifndef __GNUC__\n" ); - fprintf( outfile, "}\n" ); - fprintf( outfile, "#endif\n" ); - fprintf( outfile, "\n" ); - - done: - return nb_delayed; } /* output the import and delayed import tables of a Win32 module @@ -1152,3 +1154,10 @@ *nb_delayed = output_delayed_imports( outfile, spec ); return output_immediate_imports( outfile ); } + +/* output the import and delayed import thunks of a Win32 module */ +void output_import_thunks( FILE *outfile, DLLSPEC *spec ) +{ + output_delayed_import_thunks( outfile, spec ); + output_immediate_import_thunks( outfile ); +} _____ Modified: trunk/reactos/tools/winebuild/main.c --- trunk/reactos/tools/winebuild/main.c 2005-07-05 21:03:46 UTC (rev 16437) +++ trunk/reactos/tools/winebuild/main.c 2005-07-05 21:17:01 UTC (rev 16438) @@ -44,14 +44,30 @@ int nb_errors = 0; int display_warnings = 0; int kill_at = 0; +int debugging = 0; -/* we only support relay debugging on i386 */ #ifdef __i386__ -int debugging = 1; +enum target_cpu target_cpu = CPU_x86; +#elif defined(__sparc__) +enum target_cpu target_cpu = CPU_SPARC; +#elif defined(__ALPHA__) +enum target_cpu target_cpu = CPU_ALPHA; +#elif defined(__powerpc__) +enum target_cpu target_cpu = CPU_POWERPC; #else -int debugging = 0; +#error Unsupported CPU #endif +#ifdef __APPLE__ +enum target_platform target_platform = PLATFORM_APPLE; +#elif defined(__svr4__) +enum target_platform target_platform = PLATFORM_SVR4; +#elif defined(_WINDOWS) +enum target_platform target_platform = PLATFORM_WINDOWS; +#else +enum target_platform target_platform = PLATFORM_UNSPECIFIED; +#endif + char **debug_channels = NULL; char **lib_path = NULL; @@ -454,6 +470,9 @@ output_file = stdout; argv = parse_options( argc, argv, spec ); + /* we only support relay debugging on i386 */ + debugging = (target_cpu == CPU_x86); + switch(exec_mode) { case MODE_DLL: _____ Modified: trunk/reactos/tools/winebuild/parser.c --- trunk/reactos/tools/winebuild/parser.c 2005-07-05 21:03:46 UTC (rev 16437) +++ trunk/reactos/tools/winebuild/parser.c 2005-07-05 21:17:01 UTC (rev 16438) @@ -485,14 +485,12 @@ assert( 0 ); } -#ifndef __i386__ - if (odp->flags & FLAG_I386) + if ((target_cpu != CPU_x86) && (odp->flags & FLAG_I386)) { /* ignore this entry point on non-Intel archs */ spec->nb_entry_points--; return 1; } -#endif if (ordinal != -1) { @@ -627,17 +625,17 @@ } /* now assign ordinals to the rest */ - for (i = 0, ordinal = spec->base; i < spec->nb_names; i++) + for (i = 0, ordinal = spec->base; i < spec->nb_entry_points; i++) { - if (spec->names[i]->ordinal != -1) continue; /* already has an ordinal */ + if (spec->entry_points[i].ordinal != -1) continue; while (spec->ordinals[ordinal]) ordinal++; if (ordinal >= MAX_ORDINALS) { - current_line = spec->names[i]->lineno; + current_line = spec->entry_points[i].lineno; fatal_error( "Too many functions defined (max %d)\n", MAX_ORDINALS ); } - spec->names[i]->ordinal = ordinal; - spec->ordinals[ordinal] = spec->names[i]; + spec->entry_points[i].ordinal = ordinal; + spec->ordinals[ordinal] = &spec->entry_points[i]; } if (ordinal > spec->limit) spec->limit = ordinal; } _____ Modified: trunk/reactos/tools/winebuild/relay.c --- trunk/reactos/tools/winebuild/relay.c 2005-07-05 21:03:46 UTC (rev 16437) +++ trunk/reactos/tools/winebuild/relay.c 2005-07-05 21:17:01 UTC (rev 16438) @@ -31,22 +31,26 @@ #include "build.h" -#ifdef __i386__ - static void function_header( FILE *outfile, const char *name ) { fprintf( outfile, "\n\t.align %d\n", get_alignment(4) ); - fprintf( outfile, "\t" __ASM_FUNC("%s") "\n", name ); - fprintf( outfile, "\t.globl " __ASM_NAME("%s") "\n", name ); - fprintf( outfile, __ASM_NAME("%s") ":\n", name ); + fprintf( outfile, "\t%s\n", func_declaration(name) ); + fprintf( outfile, "\t.globl %s\n", asm_name(name) ); + fprintf( outfile, "%s:\n", asm_name(name) ); } static void function_footer( FILE *outfile, const char *name ) { - fprintf( outfile, ".size " __ASM_NAME("%s") ", . - " __ASM_NAME("%s") "\n", name, name ); + const char *size = func_size( name ); + if (size[0]) fprintf( outfile, "\t%s\n", size ); } +static inline const char *data16_prefix(void) +{ + return (target_platform == PLATFORM_SVR4) ? "\tdata16\n" : ""; +} + /******************************************************************* * BuildCallFrom16Core * @@ -147,37 +151,31 @@ if (UsePIC) { - fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector@GOT") "(%%ecx), %%edx\n" ); + fprintf( outfile, "\t.byte 0x2e\n\tmovl %s(%%ecx), %%edx\n", asm_name("CallTo16_DataSelector@GOT") ); fprintf( outfile, "\t.byte 0x2e\n\tmovl (%%edx), %%edx\n" ); } else - fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector") ",%%edx\n" ); + fprintf( outfile, "\t.byte 0x2e\n\tmovl %s,%%edx\n", asm_name("CallTo16_DataSelector") ); /* Load 32-bit segment registers */ -#ifdef __svr4__ - fprintf( outfile, "\tdata16\n"); -#endif - fprintf( outfile, "\tmovw %%dx, %%ds\n" ); -#ifdef __svr4__ - fprintf( outfile, "\tdata16\n"); -#endif - fprintf( outfile, "\tmovw %%dx, %%es\n" ); + fprintf( outfile, "%s\tmovw %%dx, %%ds\n", data16_prefix() ); + fprintf( outfile, "%s\tmovw %%dx, %%es\n", data16_prefix() ); if ( UsePIC ) { - fprintf( outfile, "\tmovl " __ASM_NAME("CallTo16_TebSelector@GOT") "(%%ecx), %%edx\n" ); + fprintf( outfile, "\tmovl %s(%%ecx), %%edx\n", asm_name("CallTo16_TebSelector@GOT") ); fprintf( outfile, "\tmovw (%%edx), %%fs\n" ); } else - fprintf( outfile, "\tmovw " __ASM_NAME("CallTo16_TebSelector") ", %%fs\n" ); + fprintf( outfile, "\tmovw %s, %%fs\n", asm_name("CallTo16_TebSelector") ); fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); /* Get address of wine_ldt_copy array into %ecx */ if ( UsePIC ) - fprintf( outfile, "\tmovl " __ASM_NAME("wine_ldt_copy@GOT") "(%%ecx), %%ecx\n" ); + fprintf( outfile, "\tmovl %s(%%ecx), %%ecx\n", asm_name("wine_ldt_copy@GOT") ); else - fprintf( outfile, "\tmovl $" __ASM_NAME("wine_ldt_copy") ", %%ecx\n" ); + fprintf( outfile, "\tmovl $%s, %%ecx\n", asm_name("wine_ldt_copy") ); /* Translate STACK16FRAME base to flat offset in %edx */ fprintf( outfile, "\tmovw %%ss, %%dx\n" ); @@ -195,10 +193,7 @@ fprintf( outfile, "\tpushl %%ebp\n" ); /* Switch stacks */ -#ifdef __svr4__ - fprintf( outfile,"\tdata16\n"); -#endif - fprintf( outfile, "\t.byte 0x64\n\tmovw %%ss, (%d)\n", STACKOFFSET + 2 ); + fprintf( outfile, "%s\t.byte 0x64\n\tmovw %%ss, (%d)\n", data16_prefix(), STACKOFFSET + 2 ); fprintf( outfile, "\t.byte 0x64\n\tmovw %%sp, (%d)\n", STACKOFFSET ); fprintf( outfile, "\tpushl %%ds\n" ); fprintf( outfile, "\tpopl %%ss\n" ); @@ -320,9 +315,9 @@ fprintf( outfile, "\tpushl $0\n" ); if ( UsePIC ) - fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16@PLT") "\n "); + fprintf( outfile, "\tcall %s\n ", asm_name("RELAY_DebugCallFrom16@PLT")); else - fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16") "\n "); + fprintf( outfile, "\tcall %s\n ", asm_name("RELAY_DebugCallFrom16")); fprintf( outfile, "\tpopl %%edx\n" ); fprintf( outfile, "\tpopl %%edx\n" ); @@ -359,9 +354,9 @@ fprintf( outfile, "\tpushl $0\n" ); if ( UsePIC ) - fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16Ret@PLT") "\n "); + fprintf( outfile, "\tcall %s\n ", asm_name("RELAY_DebugCallFrom16Ret@PLT")); else - fprintf( outfile, "\tcall " __ASM_NAME("RELAY_DebugCallFrom16Ret") "\n "); + fprintf( outfile, "\tcall %s\n ", asm_name("RELAY_DebugCallFrom16Ret")); fprintf( outfile, "\tpopl %%eax\n" ); fprintf( outfile, "\tpopl %%eax\n" ); @@ -545,10 +540,7 @@ /* Switch to the 16-bit stack */ fprintf( outfile, "\tmovl %%esp,%%edx\n" ); -#ifdef __svr4__ - fprintf( outfile,"\tdata16\n"); -#endif - fprintf( outfile, "\t.byte 0x64\n\tmovw (%d),%%ss\n", STACKOFFSET + 2); + fprintf( outfile, "%s\t.byte 0x64\n\tmovw (%d),%%ss\n", data16_prefix(), STACKOFFSET + 2); fprintf( outfile, "\t.byte 0x64\n\tmovw (%d),%%sp\n", STACKOFFSET ); fprintf( outfile, "\t.byte 0x64\n\tmovl %%edx,(%d)\n", STACKOFFSET ); @@ -625,26 +617,19 @@ /* Restore 32-bit segment registers */ - fprintf( outfile, "\t.byte 0x2e\n\tmovl " __ASM_NAME("CallTo16_DataSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%edi\n" ); -#ifdef __svr4__ - fprintf( outfile, "\tdata16\n"); -#endif - fprintf( outfile, "\tmovw %%di,%%ds\n" ); -#ifdef __svr4__ - fprintf( outfile, "\tdata16\n"); -#endif - fprintf( outfile, "\tmovw %%di,%%es\n" ); + fprintf( outfile, "\t.byte 0x2e\n\tmovl %s", asm_name("CallTo16_DataSelector") ); + fprintf( outfile, "-%s,%%edi\n", asm_name("Call16_Ret_Start") ); + fprintf( outfile, "%s\tmovw %%di,%%ds\n", data16_prefix() ); + fprintf( outfile, "%s\tmovw %%di,%%es\n", data16_prefix() ); - fprintf( outfile, "\t.byte 0x2e\n\tmov " __ASM_NAME("CallTo16_TebSelector") "-" __ASM_NAME("Call16_Ret_Start") ",%%fs\n" ); + fprintf( outfile, "\t.byte 0x2e\n\tmov %s", asm_name("CallTo16_TebSelector") ); + fprintf( outfile, "-%s,%%fs\n", asm_name("Call16_Ret_Start") ); fprintf( outfile, "\t.byte 0x64\n\tmov (%d),%%gs\n", STRUCTOFFSET(TEB,gs_sel) ); /* Restore the 32-bit stack */ -#ifdef __svr4__ - fprintf( outfile, "\tdata16\n"); -#endif - fprintf( outfile, "\tmovw %%di,%%ss\n" ); + fprintf( outfile, "%s\tmovw %%di,%%ss\n", data16_prefix() ); fprintf( outfile, "\t.byte 0x64\n\tmovl (%d),%%esp\n", STACKOFFSET ); /* Return to caller */ @@ -657,10 +642,10 @@ /* Declare the return address and data selector variables */ fprintf( outfile, "\n\t.align %d\n", get_alignment(4) ); - fprintf( outfile, "\t.globl " __ASM_NAME("CallTo16_DataSelector") "\n" ); - fprintf( outfile, __ASM_NAME("CallTo16_DataSelector") ":\t.long 0\n" ); - fprintf( outfile, "\t.globl " __ASM_NAME("CallTo16_TebSelector") "\n" ); - fprintf( outfile, __ASM_NAME("CallTo16_TebSelector") ":\t.long 0\n" ); + fprintf( outfile, "\t.globl %s\n", asm_name("CallTo16_DataSelector") ); + fprintf( outfile, "%s:\t.long 0\n", asm_name("CallTo16_DataSelector") ); + fprintf( outfile, "\t.globl %s\n", asm_name("CallTo16_TebSelector") ); + fprintf( outfile, "%s:\t.long 0\n", asm_name("CallTo16_TebSelector") ); } @@ -756,14 +741,14 @@ */ static void BuildCallTo32CBClient( FILE *outfile, BOOL isEx ) { - const char *name = isEx? "CBClientEx" : "CBClient"; + const char *name = isEx? "CALL32_CBClientEx" : "CALL32_CBClient"; int size = isEx? 24 : 12; /* Function header */ fprintf( outfile, "\n\t.align %d\n", get_alignment(4) ); - fprintf( outfile, "\t.globl " __ASM_NAME("CALL32_%s") "\n", name ); - fprintf( outfile, __ASM_NAME("CALL32_%s") ":\n", name ); + fprintf( outfile, "\t.globl %s\n", asm_name(name) ); + fprintf( outfile, "%s:\n", asm_name(name) ); /* Entry code */ @@ -773,6 +758,15 @@ fprintf( outfile, "\tpushl %%esi\n" ); fprintf( outfile, "\tpushl %%ebx\n" ); [truncated at 1000 lines; 1404 more skipped]
19 years, 6 months
1
0
0
0
[ekohl] 16437: Add architecture-specific headers and move I386-specific definitions into them.
by ekohl@svn.reactos.com
Add architecture-specific headers and move I386-specific definitions into them. Added: trunk/reactos/include/ndk/arch/ Added: trunk/reactos/include/ndk/arch/ketypes.h Added: trunk/reactos/include/ndk/arch/mmtypes.h Modified: trunk/reactos/include/ndk/fixmes.txt Added: trunk/reactos/include/ndk/i386/ketypes.h Added: trunk/reactos/include/ndk/i386/mmtypes.h Modified: trunk/reactos/include/ndk/ketypes.h Modified: trunk/reactos/include/ndk/mmtypes.h _____ Added: trunk/reactos/include/ndk/arch/ketypes.h --- trunk/reactos/include/ndk/arch/ketypes.h 2005-07-05 20:47:48 UTC (rev 16436) +++ trunk/reactos/include/ndk/arch/ketypes.h 2005-07-05 21:03:46 UTC (rev 16437) @@ -0,0 +1,18 @@ +/* + * PROJECT: ReactOS Native Headers + * FILE: include/ndk/arch/ketypes.h + * PURPOSE: Architecture-specific definitions for Kernel Types + * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net) + * UPDATE HISTORY: + * Created 06/10/04 + */ +#ifndef _ARCH_KETYPES_H +#define _ARCH_KETYPES_H + +#ifdef _M_IX86 +#include <ndk/i386/ketypes.h> +#else +#error "Unknown processor" +#endif + +#endif _____ Added: trunk/reactos/include/ndk/arch/mmtypes.h --- trunk/reactos/include/ndk/arch/mmtypes.h 2005-07-05 20:47:48 UTC (rev 16436) +++ trunk/reactos/include/ndk/arch/mmtypes.h 2005-07-05 21:03:46 UTC (rev 16437) @@ -0,0 +1,18 @@ +/* + * PROJECT: ReactOS Native Headers + * FILE: include/ndk/arch/mmtypes.h + * PURPOSE: Architecture-specific definitions for Memory Manager Types + * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net) + * UPDATE HISTORY: + * Created 06/10/04 + */ +#ifndef _ARCH_MMTYPES_H +#define _ARCH_MMTYPES_H + +#ifdef _M_IX86 +#include <ndk/i386/mmtypes.h> +#else +#error "Unknown processor" +#endif + +#endif _____ Modified: trunk/reactos/include/ndk/fixmes.txt --- trunk/reactos/include/ndk/fixmes.txt 2005-07-05 20:47:48 UTC (rev 16436) +++ trunk/reactos/include/ndk/fixmes.txt 2005-07-05 21:03:46 UTC (rev 16437) @@ -30,7 +30,7 @@ - MADDRESS_SPACE must be converted into the NT Type (Alex) [pstypes.h, mmtypes.h] Priority 4: - - Kernel and Memory Types are not architecture-specific [ketypes.h, mmtypes.h] + - FIXED: Kernel and Memory Types are not architecture-specific (Eric) [ketypes.h, mmtypes.h] - Win32K Builds with windows.h [extypes.h, ketypes.h] Priority 5: _____ Added: trunk/reactos/include/ndk/i386/ketypes.h --- trunk/reactos/include/ndk/i386/ketypes.h 2005-07-05 20:47:48 UTC (rev 16436) +++ trunk/reactos/include/ndk/i386/ketypes.h 2005-07-05 21:03:46 UTC (rev 16437) @@ -0,0 +1,518 @@ +/* + * PROJECT: ReactOS Native Headers + * FILE: include/ndk/i386/ketypes.h + * PURPOSE: I386-specific definitions for Kernel Types not defined in DDK/IFS + * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net) + * UPDATE HISTORY: + * Created 06/10/04 + */ +#ifndef _I386_KETYPES_H +#define _I386_KETYPES_H + +/* DEPENDENCIES **************************************************************/ + +/* CONSTANTS *****************************************************************/ + +/* X86 80386 Segment Types */ +#define I386_TSS 0x9 +#define I386_ACTIVE_TSS 0xB +#define I386_CALL_GATE 0xC +#define I386_INTERRUPT_GATE 0xE +#define I386_TRAP_GATE 0xF + +/* EXPORTED DATA *************************************************************/ + +/* ENUMERATIONS **************************************************************/ + +/* TYPES *********************************************************************/ + +typedef struct _FNSAVE_FORMAT +{ + ULONG ControlWord; + ULONG StatusWord; + ULONG TagWord; + ULONG ErrorOffset; + ULONG ErrorSelector; + ULONG DataOffset; + ULONG DataSelector; + UCHAR RegisterArea[80]; +} FNSAVE_FORMAT, *PFNSAVE_FORMAT; + +typedef struct _FXSAVE_FORMAT +{ + USHORT ControlWord; + USHORT StatusWord; + USHORT TagWord; + USHORT ErrorOpcode; + ULONG ErrorOffset; + ULONG ErrorSelector; + ULONG DataOffset; + ULONG DataSelector; + ULONG MXCsr; + ULONG MXCsrMask; + UCHAR RegisterArea[128]; + UCHAR Reserved3[128]; + UCHAR Reserved4[224]; + UCHAR Align16Byte[8]; +} FXSAVE_FORMAT, *PFXSAVE_FORMAT; + +typedef struct _FX_SAVE_AREA +{ + union + { + FNSAVE_FORMAT FnArea; + FXSAVE_FORMAT FxArea; + } U; + ULONG NpxSavedCpu; + ULONG Cr0NpxState; +} FX_SAVE_AREA, *PFX_SAVE_AREA; + +typedef struct _KTRAP_FRAME +{ + PVOID DebugEbp; + PVOID DebugEip; + PVOID DebugArgMark; + PVOID DebugPointer; + PVOID TempCs; + PVOID TempEip; + ULONG Dr0; + ULONG Dr1; + ULONG Dr2; + ULONG Dr3; + ULONG Dr6; + ULONG Dr7; + USHORT Gs; + USHORT Reserved1; + USHORT Es; + USHORT Reserved2; + USHORT Ds; + USHORT Reserved3; + ULONG Edx; + ULONG Ecx; + ULONG Eax; + ULONG PreviousMode; + PVOID ExceptionList; + USHORT Fs; + USHORT Reserved4; + ULONG Edi; + ULONG Esi; + ULONG Ebx; + ULONG Ebp; + ULONG ErrorCode; + ULONG Eip; + ULONG Cs; + ULONG Eflags; + ULONG Esp; + USHORT Ss; + USHORT Reserved5; + USHORT V86_Es; + USHORT Reserved6; + USHORT V86_Ds; + USHORT Reserved7; + USHORT V86_Fs; + USHORT Reserved8; + USHORT V86_Gs; + USHORT Reserved9; +} KTRAP_FRAME, *PKTRAP_FRAME; + +/* FIXME: Win32k uses windows.h! */ +#ifndef __WIN32K__ +typedef struct _LDT_ENTRY +{ + WORD LimitLow; + WORD BaseLow; + union + { + struct + { + BYTE BaseMid; + BYTE Flags1; + BYTE Flags2; + BYTE BaseHi; + } Bytes; + struct + { + DWORD BaseMid : 8; + DWORD Type : 5; + DWORD Dpl : 2; + DWORD Pres : 1; + DWORD LimitHi : 4; + DWORD Sys : 1; + DWORD Reserved_0 : 1; + DWORD Default_Big : 1; + DWORD Granularity : 1; + DWORD BaseHi : 8; + } Bits; + } HighWord; +} LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY; +#endif + +typedef struct _KGDTENTRY +{ + USHORT LimitLow; + USHORT BaseLow; + union + { + struct + { + UCHAR BaseMid; + UCHAR Flags1; + UCHAR Flags2; + UCHAR BaseHi; + } Bytes; + struct + { + ULONG BaseMid : 8; + ULONG Type : 5; + ULONG Dpl : 2; + ULONG Pres : 1; + ULONG LimitHi : 4; + ULONG Sys : 1; + ULONG Reserved_0 : 1; + ULONG Default_Big : 1; + ULONG Granularity : 1; + ULONG BaseHi : 8; + } Bits; + } HighWord; +} KGDTENTRY, *PKGDTENTRY; + +typedef struct _KIDT_ACCESS +{ + union + { + struct + { + UCHAR Reserved; + UCHAR SegmentType:4; + UCHAR SystemSegmentFlag:1; + UCHAR Dpl:2; + UCHAR Present:1; + }; + USHORT Value; + }; +} KIDT_ACCESS, *PKIDT_ACCESS; + +typedef struct _KIDTENTRY +{ + USHORT Offset; + USHORT Selector; + USHORT Access; + USHORT ExtendedOffset; +} KIDTENTRY, *PKIDTENTRY; + +typedef struct _HARDWARE_PTE_X86 +{ + ULONG Valid : 1; + ULONG Write : 1; + ULONG Owner : 1; + ULONG WriteThrough : 1; + ULONG CacheDisable : 1; + ULONG Accessed : 1; + ULONG Dirty : 1; + ULONG LargePage : 1; + ULONG Global : 1; + ULONG CopyOnWrite : 1; + ULONG Prototype : 1; + ULONG reserved : 1; + ULONG PageFrameNumber : 20; +} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86; + +typedef struct _DESCRIPTOR +{ + WORD Pad; + WORD Limit; + DWORD Base; +} KDESCRIPTOR, *PKDESCRIPTOR; + +typedef struct _KSPECIAL_REGISTERS +{ + DWORD Cr0; + DWORD Cr2; + DWORD Cr3; + DWORD Cr4; + DWORD KernelDr0; + DWORD KernelDr1; + DWORD KernelDr2; + DWORD KernelDr3; + DWORD KernelDr6; + DWORD KernelDr7; + KDESCRIPTOR Gdtr; + KDESCRIPTOR Idtr; + WORD Tr; + WORD Ldtr; + DWORD Reserved[6]; +} KSPECIAL_REGISTERS, *PKSPECIAL_REGISTERS; + +#pragma pack(push,4) + +typedef struct _KPROCESSOR_STATE +{ + PCONTEXT ContextFrame; + KSPECIAL_REGISTERS SpecialRegisters; +} KPROCESSOR_STATE; + +/* Processor Control Block */ +typedef struct _KPRCB +{ + USHORT MinorVersion; + USHORT MajorVersion; + struct _KTHREAD *CurrentThread; + struct _KTHREAD *NextThread; + struct _KTHREAD *IdleThread; + UCHAR Number; + UCHAR Reserved; + USHORT BuildType; + ULONG SetMember; + UCHAR CpuType; + UCHAR CpuID; + USHORT CpuStep; + KPROCESSOR_STATE ProcessorState; + ULONG KernelReserved[16]; + ULONG HalReserved[16]; + UCHAR PrcbPad0[92]; + PVOID LockQueue[33]; // Used for Queued Spinlocks + struct _KTHREAD *NpxThread; + ULONG InterruptCount; + ULONG KernelTime; + ULONG UserTime; + ULONG DpcTime; + ULONG DebugDpcTime; + ULONG InterruptTime; + ULONG AdjustDpcThreshold; + ULONG PageColor; + UCHAR SkipTick; + UCHAR DebuggerSavedIRQL; + UCHAR Spare1[6]; + struct _KNODE *ParentNode; + ULONG MultiThreadProcessorSet; + struct _KPRCB *MultiThreadSetMaster; + ULONG ThreadStartCount[2]; + ULONG CcFastReadNoWait; + ULONG CcFastReadWait; + ULONG CcFastReadNotPossible; + ULONG CcCopyReadNoWait; + ULONG CcCopyReadWait; + ULONG CcCopyReadNoWaitMiss; + ULONG KeAlignmentFixupCount; + ULONG KeContextSwitches; + ULONG KeDcacheFlushCount; + ULONG KeExceptionDispatchCount; + ULONG KeFirstLevelTbFills; + ULONG KeFloatingEmulationCount; + ULONG KeIcacheFlushCount; + ULONG KeSecondLevelTbFills; + ULONG KeSystemCalls; + ULONG IoReadOperationCount; + ULONG IoWriteOperationCount; + ULONG IoOtherOperationCount; + LARGE_INTEGER IoReadTransferCount; + LARGE_INTEGER IoWriteTransferCount; + LARGE_INTEGER IoOtherTransferCount; + ULONG SpareCounter1[8]; + PP_LOOKASIDE_LIST PPLookasideList[16]; + PP_LOOKASIDE_LIST PPNPagedLookasideList[32]; + PP_LOOKASIDE_LIST PPPagedLookasideList[32]; + ULONG PacketBarrier; + ULONG ReverseStall; + PVOID IpiFrame; + UCHAR PrcbPad2[52]; + PVOID CurrentPacket[3]; + ULONG TargetSet; + ULONG_PTR WorkerRoutine; + ULONG IpiFrozen; + UCHAR PrcbPad3[40]; + ULONG RequestSummary; + struct _KPRCB *SignalDone; + UCHAR PrcbPad4[56]; + struct _KDPC_DATA DpcData[2]; + PVOID DpcStack; + ULONG MaximumDpcQueueDepth; + ULONG DpcRequestRate; + ULONG MinimumDpcRate; + UCHAR DpcInterruptRequested; + UCHAR DpcThreadRequested; + UCHAR DpcRoutineActive; + UCHAR DpcThreadActive; + ULONG PrcbLock; + ULONG DpcLastCount; + ULONG TimerHand; + ULONG TimerRequest; + PVOID DpcThread; + struct _KEVENT *DpcEvent; + UCHAR ThreadDpcEnable; + BOOLEAN QuantumEnd; + UCHAR PrcbPad50; + UCHAR IdleSchedule; + ULONG DpcSetEventRequest; + UCHAR PrcbPad5[18]; + LONG TickOffset; + struct _KDPC* CallDpc; + ULONG PrcbPad7[8]; + LIST_ENTRY WaitListHead; + ULONG ReadySummary; + ULONG SelectNextLast; + LIST_ENTRY DispatcherReadyListHead[32]; + SINGLE_LIST_ENTRY DeferredReadyListHead; + ULONG PrcbPad72[11]; + PVOID ChainedInterruptList; + LONG LookasideIrpFloat; + LONG MmPageFaultCount; + LONG MmCopyOnWriteCount; + LONG MmTransitionCount; + LONG MmCacheTransitionCount; + LONG MmDemandZeroCount; + LONG MmPageReadCount; + LONG MmPageReadIoCount; + LONG MmCacheReadCount; + LONG MmCacheIoCount; + LONG MmDirtyPagesWriteCount; + LONG MmDirtyWriteIoCount; + LONG MmMappedPagesWriteCount; + LONG MmMappedWriteIoCount; + ULONG SpareFields0[1]; + CHAR VendorString[13]; + UCHAR InitialApicId; + UCHAR LogicalProcessorsPerPhysicalProcessor; + ULONG MHz; + ULONG FeatureBits; + LARGE_INTEGER UpdateSignature; + LARGE_INTEGER IsrTime; + LARGE_INTEGER SpareField1; + FX_SAVE_AREA NpxSaveArea; + PROCESSOR_POWER_STATE PowerState; +} KPRCB, *PKPRCB; + +/* + * This is the complete, internal KPCR structure + */ +typedef struct _KIPCR +{ + KPCR_TIB Tib; /* 00 */ + struct _KPCR *Self; /* 1C */ + struct _KPRCB *Prcb; /* 20 */ + KIRQL Irql; /* 24 */ + ULONG IRR; /* 28 */ + ULONG IrrActive; /* 2C */ + ULONG IDR; /* 30 */ + PVOID KdVersionBlock; /* 34 */ + PUSHORT IDT; /* 38 */ + PUSHORT GDT; /* 3C */ + struct _KTSS *TSS; /* 40 */ + USHORT MajorVersion; /* 44 */ + USHORT MinorVersion; /* 46 */ + KAFFINITY SetMember; /* 48 */ + ULONG StallScaleFactor; /* 4C */ + UCHAR SparedUnused; /* 50 */ + UCHAR Number; /* 51 */ + UCHAR Reserved; /* 52 */ + UCHAR L2CacheAssociativity; /* 53 */ + ULONG VdmAlert; /* 54 */ + ULONG KernelReserved[14]; /* 58 */ + ULONG L2CacheSize; /* 90 */ + ULONG HalReserved[16]; /* 94 */ + ULONG InterruptMode; /* D4 */ + UCHAR KernelReserved2[0x48]; /* D8 */ + KPRCB PrcbData; /* 120 */ +} KIPCR, *PKIPCR; + +#pragma pack(pop) + +#include <pshpack1.h> + +typedef struct _KTSSNOIOPM +{ + USHORT PreviousTask; + USHORT Reserved1; + ULONG Esp0; + USHORT Ss0; + USHORT Reserved2; + ULONG Esp1; + USHORT Ss1; + USHORT Reserved3; + ULONG Esp2; + USHORT Ss2; + USHORT Reserved4; + ULONG Cr3; + ULONG Eip; + ULONG Eflags; + ULONG Eax; + ULONG Ecx; + ULONG Edx; + ULONG Ebx; + ULONG Esp; + ULONG Ebp; + ULONG Esi; + ULONG Edi; + USHORT Es; + USHORT Reserved5; + USHORT Cs; + USHORT Reserved6; + USHORT Ss; + USHORT Reserved7; + USHORT Ds; + USHORT Reserved8; + USHORT Fs; + USHORT Reserved9; + USHORT Gs; + USHORT Reserved10; + USHORT Ldt; + USHORT Reserved11; + USHORT Trap; + USHORT IoMapBase; + /* no interrupt redirection map */ + UCHAR IoBitmap[1]; +} KTSSNOIOPM; + +typedef struct _KTSS +{ + USHORT PreviousTask; + USHORT Reserved1; + ULONG Esp0; + USHORT Ss0; + USHORT Reserved2; + ULONG Esp1; + USHORT Ss1; + USHORT Reserved3; + ULONG Esp2; + USHORT Ss2; + USHORT Reserved4; + ULONG Cr3; + ULONG Eip; + ULONG Eflags; + ULONG Eax; + ULONG Ecx; + ULONG Edx; + ULONG Ebx; + ULONG Esp; + ULONG Ebp; + ULONG Esi; + ULONG Edi; + USHORT Es; + USHORT Reserved5; + USHORT Cs; + USHORT Reserved6; + USHORT Ss; + USHORT Reserved7; + USHORT Ds; + USHORT Reserved8; + USHORT Fs; + USHORT Reserved9; + USHORT Gs; + USHORT Reserved10; + USHORT Ldt; + USHORT Reserved11; + USHORT Trap; + USHORT IoMapBase; + /* no interrupt redirection map */ + UCHAR IoBitmap[8193]; +} KTSS; + +#include <poppack.h> + +/* i386 Doesn't have Exception Frames */ +typedef struct _KEXCEPTION_FRAME +{ + +} KEXCEPTION_FRAME, *PKEXCEPTION_FRAME; + +#endif _____ Added: trunk/reactos/include/ndk/i386/mmtypes.h --- trunk/reactos/include/ndk/i386/mmtypes.h 2005-07-05 20:47:48 UTC (rev 16436) +++ trunk/reactos/include/ndk/i386/mmtypes.h 2005-07-05 21:03:46 UTC (rev 16437) @@ -0,0 +1,12 @@ +/* + * PROJECT: ReactOS Native Headers + * FILE: include/ndk/i386/mmtypes.h + * PURPOSE: I386-specific definitions for Memory Manager Types not defined in DDK/IFS + * PROGRAMMER: Alex Ionescu (alex(a)relsoft.net) + * UPDATE HISTORY: + * Created 06/10/04 + */ +#ifndef _I386_MMTYPES_H +#define _I386_MMTYPES_H + +#endif _____ Modified: trunk/reactos/include/ndk/ketypes.h --- trunk/reactos/include/ndk/ketypes.h 2005-07-05 20:47:48 UTC (rev 16436) +++ trunk/reactos/include/ndk/ketypes.h 2005-07-05 21:03:46 UTC (rev 16437) @@ -15,6 +15,8 @@ #include "mmtypes.h" #include <arc/arc.h> +#include "arch/ketypes.h" + /* CONSTANTS *****************************************************************/ #define SSDT_MAX_ENTRIES 4 #define PROCESSOR_FEATURE_MAX 64 @@ -23,13 +25,6 @@ #define THREAD_WAIT_OBJECTS 4 -/* X86 80386 Segment Types */ -#define I386_TSS 0x9 -#define I386_ACTIVE_TSS 0xB -#define I386_CALL_GATE 0xC -#define I386_INTERRUPT_GATE 0xE -#define I386_TRAP_GATE 0xF - /* EXPORTED DATA *************************************************************/ extern CHAR NTOSAPI KeNumberProcessors; extern LOADER_PARAMETER_BLOCK NTOSAPI KeLoaderBlock; @@ -82,496 +77,6 @@ } KAPC_STATE, *PKAPC_STATE, *RESTRICTED_POINTER PRKAPC_STATE; #endif -/* FIXME: Most of these should go to i386 directory */ -typedef struct _FNSAVE_FORMAT -{ - ULONG ControlWord; - ULONG StatusWord; - ULONG TagWord; - ULONG ErrorOffset; - ULONG ErrorSelector; - ULONG DataOffset; - ULONG DataSelector; - UCHAR RegisterArea[80]; -} FNSAVE_FORMAT, *PFNSAVE_FORMAT; - -typedef struct _FXSAVE_FORMAT -{ - USHORT ControlWord; - USHORT StatusWord; - USHORT TagWord; - USHORT ErrorOpcode; - ULONG ErrorOffset; - ULONG ErrorSelector; - ULONG DataOffset; - ULONG DataSelector; - ULONG MXCsr; - ULONG MXCsrMask; - UCHAR RegisterArea[128]; - UCHAR Reserved3[128]; - UCHAR Reserved4[224]; - UCHAR Align16Byte[8]; -} FXSAVE_FORMAT, *PFXSAVE_FORMAT; - -typedef struct _FX_SAVE_AREA -{ - union - { - FNSAVE_FORMAT FnArea; - FXSAVE_FORMAT FxArea; - } U; - ULONG NpxSavedCpu; - ULONG Cr0NpxState; -} FX_SAVE_AREA, *PFX_SAVE_AREA; - -typedef struct _KTRAP_FRAME -{ - PVOID DebugEbp; - PVOID DebugEip; - PVOID DebugArgMark; - PVOID DebugPointer; - PVOID TempCs; - PVOID TempEip; - ULONG Dr0; - ULONG Dr1; - ULONG Dr2; - ULONG Dr3; - ULONG Dr6; - ULONG Dr7; - USHORT Gs; - USHORT Reserved1; - USHORT Es; - USHORT Reserved2; - USHORT Ds; - USHORT Reserved3; - ULONG Edx; - ULONG Ecx; - ULONG Eax; - ULONG PreviousMode; - PVOID ExceptionList; - USHORT Fs; - USHORT Reserved4; - ULONG Edi; - ULONG Esi; - ULONG Ebx; - ULONG Ebp; - ULONG ErrorCode; - ULONG Eip; - ULONG Cs; - ULONG Eflags; - ULONG Esp; - USHORT Ss; - USHORT Reserved5; - USHORT V86_Es; - USHORT Reserved6; - USHORT V86_Ds; - USHORT Reserved7; - USHORT V86_Fs; - USHORT Reserved8; - USHORT V86_Gs; - USHORT Reserved9; -} KTRAP_FRAME, *PKTRAP_FRAME; - -/* FIXME: Win32k uses windows.h! */ -#ifndef __WIN32K__ -typedef struct _LDT_ENTRY -{ - WORD LimitLow; - WORD BaseLow; - union - { - struct - { - BYTE BaseMid; - BYTE Flags1; - BYTE Flags2; - BYTE BaseHi; - } Bytes; - struct - { - DWORD BaseMid : 8; - DWORD Type : 5; - DWORD Dpl : 2; - DWORD Pres : 1; - DWORD LimitHi : 4; - DWORD Sys : 1; - DWORD Reserved_0 : 1; - DWORD Default_Big : 1; - DWORD Granularity : 1; - DWORD BaseHi : 8; - } Bits; - } HighWord; -} LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY; -#endif - -typedef struct _KGDTENTRY -{ - USHORT LimitLow; - USHORT BaseLow; - union - { - struct - { - UCHAR BaseMid; - UCHAR Flags1; - UCHAR Flags2; - UCHAR BaseHi; - } Bytes; - struct - { - ULONG BaseMid : 8; - ULONG Type : 5; - ULONG Dpl : 2; - ULONG Pres : 1; - ULONG LimitHi : 4; - ULONG Sys : 1; - ULONG Reserved_0 : 1; - ULONG Default_Big : 1; - ULONG Granularity : 1; - ULONG BaseHi : 8; - } Bits; - } HighWord; -} KGDTENTRY, *PKGDTENTRY; - -typedef struct _KIDT_ACCESS -{ - union - { - struct - { - UCHAR Reserved; - UCHAR SegmentType:4; - UCHAR SystemSegmentFlag:1; - UCHAR Dpl:2; - UCHAR Present:1; - }; - USHORT Value; - }; -} KIDT_ACCESS, *PKIDT_ACCESS; - -typedef struct _KIDTENTRY -{ - USHORT Offset; - USHORT Selector; - USHORT Access; - USHORT ExtendedOffset; -} KIDTENTRY, *PKIDTENTRY; - -typedef struct _HARDWARE_PTE_X86 -{ - ULONG Valid : 1; - ULONG Write : 1; - ULONG Owner : 1; - ULONG WriteThrough : 1; - ULONG CacheDisable : 1; - ULONG Accessed : 1; - ULONG Dirty : 1; - ULONG LargePage : 1; - ULONG Global : 1; - ULONG CopyOnWrite : 1; - ULONG Prototype : 1; - ULONG reserved : 1; - ULONG PageFrameNumber : 20; -} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86; - -typedef struct _DESCRIPTOR -{ - WORD Pad; - WORD Limit; - DWORD Base; -} KDESCRIPTOR, *PKDESCRIPTOR; - -typedef struct _KSPECIAL_REGISTERS -{ - DWORD Cr0; - DWORD Cr2; - DWORD Cr3; - DWORD Cr4; - DWORD KernelDr0; - DWORD KernelDr1; - DWORD KernelDr2; - DWORD KernelDr3; - DWORD KernelDr6; - DWORD KernelDr7; - KDESCRIPTOR Gdtr; - KDESCRIPTOR Idtr; - WORD Tr; - WORD Ldtr; - DWORD Reserved[6]; -} KSPECIAL_REGISTERS, *PKSPECIAL_REGISTERS; - -#pragma pack(push,4) - -typedef struct _KPROCESSOR_STATE -{ - PCONTEXT ContextFrame; - KSPECIAL_REGISTERS SpecialRegisters; -} KPROCESSOR_STATE; - -/* Processor Control Block */ -typedef struct _KPRCB -{ - USHORT MinorVersion; - USHORT MajorVersion; - struct _KTHREAD *CurrentThread; - struct _KTHREAD *NextThread; - struct _KTHREAD *IdleThread; - UCHAR Number; - UCHAR Reserved; - USHORT BuildType; - ULONG SetMember; - UCHAR CpuType; - UCHAR CpuID; - USHORT CpuStep; - KPROCESSOR_STATE ProcessorState; - ULONG KernelReserved[16]; - ULONG HalReserved[16]; - UCHAR PrcbPad0[92]; - PVOID LockQueue[33]; // Used for Queued Spinlocks - struct _KTHREAD *NpxThread; - ULONG InterruptCount; - ULONG KernelTime; - ULONG UserTime; - ULONG DpcTime; - ULONG DebugDpcTime; - ULONG InterruptTime; - ULONG AdjustDpcThreshold; - ULONG PageColor; - UCHAR SkipTick; - UCHAR DebuggerSavedIRQL; - UCHAR Spare1[6]; - struct _KNODE *ParentNode; - ULONG MultiThreadProcessorSet; - struct _KPRCB *MultiThreadSetMaster; - ULONG ThreadStartCount[2]; - ULONG CcFastReadNoWait; - ULONG CcFastReadWait; - ULONG CcFastReadNotPossible; - ULONG CcCopyReadNoWait; - ULONG CcCopyReadWait; - ULONG CcCopyReadNoWaitMiss; - ULONG KeAlignmentFixupCount; - ULONG KeContextSwitches; - ULONG KeDcacheFlushCount; - ULONG KeExceptionDispatchCount; - ULONG KeFirstLevelTbFills; - ULONG KeFloatingEmulationCount; - ULONG KeIcacheFlushCount; - ULONG KeSecondLevelTbFills; - ULONG KeSystemCalls; - ULONG IoReadOperationCount; - ULONG IoWriteOperationCount; - ULONG IoOtherOperationCount; - LARGE_INTEGER IoReadTransferCount; - LARGE_INTEGER IoWriteTransferCount; - LARGE_INTEGER IoOtherTransferCount; - ULONG SpareCounter1[8]; - PP_LOOKASIDE_LIST PPLookasideList[16]; - PP_LOOKASIDE_LIST PPNPagedLookasideList[32]; - PP_LOOKASIDE_LIST PPPagedLookasideList[32]; - ULONG PacketBarrier; - ULONG ReverseStall; - PVOID IpiFrame; - UCHAR PrcbPad2[52]; - PVOID CurrentPacket[3]; - ULONG TargetSet; - ULONG_PTR WorkerRoutine; - ULONG IpiFrozen; - UCHAR PrcbPad3[40]; - ULONG RequestSummary; - struct _KPRCB *SignalDone; - UCHAR PrcbPad4[56]; - struct _KDPC_DATA DpcData[2]; - PVOID DpcStack; - ULONG MaximumDpcQueueDepth; - ULONG DpcRequestRate; - ULONG MinimumDpcRate; - UCHAR DpcInterruptRequested; - UCHAR DpcThreadRequested; - UCHAR DpcRoutineActive; - UCHAR DpcThreadActive; - ULONG PrcbLock; - ULONG DpcLastCount; - ULONG TimerHand; - ULONG TimerRequest; - PVOID DpcThread; - struct _KEVENT *DpcEvent; - UCHAR ThreadDpcEnable; - BOOLEAN QuantumEnd; - UCHAR PrcbPad50; - UCHAR IdleSchedule; - ULONG DpcSetEventRequest; - UCHAR PrcbPad5[18]; - LONG TickOffset; - struct _KDPC* CallDpc; - ULONG PrcbPad7[8]; - LIST_ENTRY WaitListHead; - ULONG ReadySummary; - ULONG SelectNextLast; - LIST_ENTRY DispatcherReadyListHead[32]; - SINGLE_LIST_ENTRY DeferredReadyListHead; - ULONG PrcbPad72[11]; - PVOID ChainedInterruptList; - LONG LookasideIrpFloat; - LONG MmPageFaultCount; - LONG MmCopyOnWriteCount; - LONG MmTransitionCount; - LONG MmCacheTransitionCount; - LONG MmDemandZeroCount; - LONG MmPageReadCount; - LONG MmPageReadIoCount; - LONG MmCacheReadCount; - LONG MmCacheIoCount; - LONG MmDirtyPagesWriteCount; - LONG MmDirtyWriteIoCount; - LONG MmMappedPagesWriteCount; - LONG MmMappedWriteIoCount; - ULONG SpareFields0[1]; - CHAR VendorString[13]; - UCHAR InitialApicId; - UCHAR LogicalProcessorsPerPhysicalProcessor; - ULONG MHz; - ULONG FeatureBits; - LARGE_INTEGER UpdateSignature; - LARGE_INTEGER IsrTime; - LARGE_INTEGER SpareField1; - FX_SAVE_AREA NpxSaveArea; - PROCESSOR_POWER_STATE PowerState; -} KPRCB, *PKPRCB; - -/* - * This is the complete, internal KPCR structure - */ -typedef struct _KIPCR -{ - KPCR_TIB Tib; /* 00 */ - struct _KPCR *Self; /* 1C */ - struct _KPRCB *Prcb; /* 20 */ - KIRQL Irql; /* 24 */ - ULONG IRR; /* 28 */ - ULONG IrrActive; /* 2C */ - ULONG IDR; /* 30 */ - PVOID KdVersionBlock; /* 34 */ [truncated at 1000 lines; 145 more skipped]
19 years, 6 months
1
0
0
0
[gvg] 16436: Sync to Wine-20050628:
by gvg@svn.reactos.com
Sync to Wine-20050628: Eric Pouech <pouech-eric(a)wanadoo.fr> - Const correctness fixes. Mike McCormack <mike(a)codeweavers.com> - Fix some declaration and write string warnings. Modified: trunk/reactos/tools/unicode/cptable.c Modified: trunk/reactos/tools/unicode/mbtowc.c _____ Modified: trunk/reactos/tools/unicode/cptable.c --- trunk/reactos/tools/unicode/cptable.c 2005-07-05 19:52:25 UTC (rev 16435) +++ trunk/reactos/tools/unicode/cptable.c 2005-07-05 20:47:48 UTC (rev 16436) @@ -156,7 +156,7 @@ static int cmp_codepage( const void *codepage, const void *entry ) { - return (unsigned int)codepage - (*(const union cptable **)entry)->info.codepage; + return (unsigned int)codepage - (*(const union cptable *const *)entry)->info.codepage; } _____ Modified: trunk/reactos/tools/unicode/mbtowc.c --- trunk/reactos/tools/unicode/mbtowc.c 2005-07-05 19:52:25 UTC (rev 16435) +++ trunk/reactos/tools/unicode/mbtowc.c 2005-07-05 20:47:48 UTC (rev 16436) @@ -25,7 +25,7 @@ typedef unsigned char uchar; /* get the decomposition of a Unicode char */ -int get_decomposition( WCHAR src, WCHAR *dst, unsigned int dstlen ) +static int get_decomposition( WCHAR src, WCHAR *dst, unsigned int dstlen ) { extern const WCHAR unicode_decompose_table[]; const WCHAR *ptr = unicode_decompose_table;
19 years, 6 months
1
0
0
0
[gvg] 16435: Wine-20050628 vendor drop
by gvg@svn.reactos.com
Wine-20050628 vendor drop Modified: vendor/wine/dlls/cabinet/current/cabextract.c Modified: vendor/wine/dlls/cabinet/current/cabinet.h Modified: vendor/wine/dlls/cabinet/current/cabinet_main.c Modified: vendor/wine/dlls/cabinet/current/fci.c Modified: vendor/wine/dlls/comctl32/current/comctl32.h Modified: vendor/wine/dlls/comctl32/current/commctrl.c Modified: vendor/wine/dlls/comctl32/current/flatsb.c Modified: vendor/wine/dlls/comctl32/current/ipaddress.c Modified: vendor/wine/dlls/comctl32/current/listview.c Modified: vendor/wine/dlls/comctl32/current/monthcal.c Modified: vendor/wine/dlls/comctl32/current/pager.c Modified: vendor/wine/dlls/comctl32/current/propsheet.c Modified: vendor/wine/dlls/comctl32/current/tab.c Modified: vendor/wine/dlls/comctl32/current/toolbar.c Modified: vendor/wine/dlls/comctl32/current/treeview.c Modified: vendor/wine/dlls/comctl32/current/updown.c Modified: vendor/wine/dlls/commdlg/current/filedlg.c Modified: vendor/wine/dlls/commdlg/current/filedlgbrowser.c Modified: vendor/wine/dlls/commdlg/current/filedlgbrowser.h Modified: vendor/wine/dlls/commdlg/current/printdlg.c Modified: vendor/wine/dlls/dinput/current/device_private.h Modified: vendor/wine/dlls/dinput/current/dinput.spec Modified: vendor/wine/dlls/dinput/current/dinput_main.c Modified: vendor/wine/dlls/dinput/current/dinput_private.h Modified: vendor/wine/dlls/dinput/current/joystick_linux.c Modified: vendor/wine/dlls/dinput/current/joystick_linuxinput.c Modified: vendor/wine/dlls/dinput/current/keyboard.c Modified: vendor/wine/dlls/dinput/current/mouse.c Modified: vendor/wine/dlls/dsound/current/Makefile.in Modified: vendor/wine/dlls/dsound/current/buffer.c Modified: vendor/wine/dlls/dsound/current/capture.c Modified: vendor/wine/dlls/dsound/current/dsound.c Modified: vendor/wine/dlls/dsound/current/dsound.spec Modified: vendor/wine/dlls/dsound/current/dsound_main.c Modified: vendor/wine/dlls/dsound/current/dsound_private.h Added: vendor/wine/dlls/dsound/current/duplex.c Modified: vendor/wine/dlls/dsound/current/mixer.c Modified: vendor/wine/dlls/dsound/current/primary.c Modified: vendor/wine/dlls/dsound/current/propset.c Modified: vendor/wine/dlls/dsound/current/sound3d.c Modified: vendor/wine/dlls/icmp/current/icmp.spec Modified: vendor/wine/dlls/mpr/current/mpr.spec Modified: vendor/wine/dlls/mpr/current/pwcache.c Modified: vendor/wine/dlls/msi/current/Makefile.in Modified: vendor/wine/dlls/msi/current/action.c Modified: vendor/wine/dlls/msi/current/action.h Added: vendor/wine/dlls/msi/current/classes.c Modified: vendor/wine/dlls/msi/current/cond.y Modified: vendor/wine/dlls/msi/current/create.c Modified: vendor/wine/dlls/msi/current/custom.c Modified: vendor/wine/dlls/msi/current/database.c Modified: vendor/wine/dlls/msi/current/dialog.c Added: vendor/wine/dlls/msi/current/events.c Added: vendor/wine/dlls/msi/current/files.c Modified: vendor/wine/dlls/msi/current/format.c Added: vendor/wine/dlls/msi/current/helpers.c Modified: vendor/wine/dlls/msi/current/insert.c Added: vendor/wine/dlls/msi/current/install.c Modified: vendor/wine/dlls/msi/current/msi.c Modified: vendor/wine/dlls/msi/current/msi.spec Modified: vendor/wine/dlls/msi/current/msipriv.h Modified: vendor/wine/dlls/msi/current/msiquery.c Modified: vendor/wine/dlls/msi/current/order.c Modified: vendor/wine/dlls/msi/current/package.c Modified: vendor/wine/dlls/msi/current/preview.c Modified: vendor/wine/dlls/msi/current/query.h Modified: vendor/wine/dlls/msi/current/record.c Modified: vendor/wine/dlls/msi/current/registry.c Modified: vendor/wine/dlls/msi/current/select.c Modified: vendor/wine/dlls/msi/current/sql.y Modified: vendor/wine/dlls/msi/current/suminfo.c Modified: vendor/wine/dlls/msi/current/table.c Modified: vendor/wine/dlls/msi/current/tokenize.c Modified: vendor/wine/dlls/msi/current/update.c Added: vendor/wine/dlls/msi/current/upgrade.c Modified: vendor/wine/dlls/msi/current/where.c Modified: vendor/wine/dlls/ole32/current/antimoniker.c Modified: vendor/wine/dlls/ole32/current/bindctx.c Modified: vendor/wine/dlls/ole32/current/clipboard.c Modified: vendor/wine/dlls/ole32/current/compobj.c Modified: vendor/wine/dlls/ole32/current/compobj_private.h Modified: vendor/wine/dlls/ole32/current/compositemoniker.c Modified: vendor/wine/dlls/ole32/current/datacache.c Modified: vendor/wine/dlls/ole32/current/defaulthandler.c Modified: vendor/wine/dlls/ole32/current/errorinfo.c Modified: vendor/wine/dlls/ole32/current/filemoniker.c Modified: vendor/wine/dlls/ole32/current/ftmarshal.c Modified: vendor/wine/dlls/ole32/current/git.c Modified: vendor/wine/dlls/ole32/current/hglobalstream.c Modified: vendor/wine/dlls/ole32/current/ifs.c Modified: vendor/wine/dlls/ole32/current/itemmoniker.c Modified: vendor/wine/dlls/ole32/current/marshal.c Modified: vendor/wine/dlls/ole32/current/memlockbytes.c Modified: vendor/wine/dlls/ole32/current/memlockbytes16.c Modified: vendor/wine/dlls/ole32/current/moniker.c Modified: vendor/wine/dlls/ole32/current/moniker.h Modified: vendor/wine/dlls/ole32/current/ole16.c Modified: vendor/wine/dlls/ole32/current/ole2.c Modified: vendor/wine/dlls/ole32/current/ole32.spec Modified: vendor/wine/dlls/ole32/current/oleobj.c [truncated at 100 lines; 134 more skipped] _____ Modified: vendor/wine/dlls/cabinet/current/cabextract.c --- vendor/wine/dlls/cabinet/current/cabextract.c 2005-07-05 19:09:41 UTC (rev 16434) +++ vendor/wine/dlls/cabinet/current/cabextract.c 2005-07-05 19:52:25 UTC (rev 16435) @@ -31,6 +31,7 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <ctype.h> #include "windef.h" #include "winbase.h" @@ -2523,7 +2524,6 @@ * print_fileinfo (internal) */ void print_fileinfo(struct cab_file *fi) { - int d = fi->date, t = fi->time; char *fname = NULL; if (fi->attribs & cffile_A_NAME_IS_UTF) { @@ -2536,8 +2536,8 @@ TRACE("%9u | %02d.%02d.%04d %02d:%02d:%02d | %s\n", fi->length, - d & 0x1f, (d>>5) & 0xf, (d>>9) + 1980, - t >> 11, (t>>5) & 0x3f, (t << 1) & 0x3e, + fi->date & 0x1f, (fi->date>>5) & 0xf, (fi->date>>9) + 1980, + fi->time >> 11, (fi->time>>5) & 0x3f, (fi->time << 1) & 0x3e, fname ? fname : fi->filename ); _____ Modified: vendor/wine/dlls/cabinet/current/cabinet.h --- vendor/wine/dlls/cabinet/current/cabinet.h 2005-07-05 19:09:41 UTC (rev 16434) +++ vendor/wine/dlls/cabinet/current/cabinet.h 2005-07-05 19:52:25 UTC (rev 16435) @@ -305,7 +305,41 @@ PFNFCIDELETE pfndelete; PFNFCIGETTEMPFILE pfnfcigtf; PCCAB pccab; - void *pv; + BOOL fPrevCab; + BOOL fNextCab; + BOOL fSplitFolder; + cab_ULONG statusFolderCopied; + cab_ULONG statusFolderTotal; + BOOL fGetNextCabInVain; + void *pv; + char szPrevCab[CB_MAX_CABINET_NAME]; /* previous cabinet name */ + char szPrevDisk[CB_MAX_DISK_NAME]; /* disk name of previous cabinet */ + CCAB oldCCAB; + char* data_in; /* uncompressed data blocks */ + cab_UWORD cdata_in; + char* data_out; /* compressed data blocks */ + ULONG cCompressedBytesInFolder; + cab_UWORD cFolders; + cab_UWORD cFiles; + cab_ULONG cDataBlocks; + cab_ULONG cbFileRemainer; /* uncompressed, yet to be written data */ + /* of spanned file of a spanning folder of a spanning cabinet */ + cab_UBYTE szFileNameCFDATA1[CB_MAX_FILENAME]; + int handleCFDATA1; + cab_UBYTE szFileNameCFFILE1[CB_MAX_FILENAME]; + int handleCFFILE1; + cab_UBYTE szFileNameCFDATA2[CB_MAX_FILENAME]; + int handleCFDATA2; + cab_UBYTE szFileNameCFFILE2[CB_MAX_FILENAME]; + int handleCFFILE2; + cab_UBYTE szFileNameCFFOLDER[CB_MAX_FILENAME]; + int handleCFFOLDER; + cab_ULONG sizeFileCFDATA1; + cab_ULONG sizeFileCFFILE1; + cab_ULONG sizeFileCFDATA2; + cab_ULONG sizeFileCFFILE2; + cab_ULONG sizeFileCFFOLDER; + BOOL fNewPrevious; } FCI_Int, *PFCI_Int; typedef struct { @@ -326,6 +360,18 @@ /* cast an HFDI into a PFDI_Int */ #define PFDI_INT(hfdi) ((PFDI_Int)(hfdi)) +/* quick pfci method invokers */ +#define PFCI_ALLOC(hfdi, size) ((*PFCI_INT(hfdi)->pfnalloc) (size)) +#define PFCI_FREE(hfdi, ptr) ((*PFCI_INT(hfdi)->pfnfree) (ptr)) +#define PFCI_GETTEMPFILE(hfci,name,length) ((*PFCI_INT(hfci)->pfnfcigtf)(name,length,PFCI_INT(hfci)->pv)) +#define PFCI_DELETE(hfci,name,err,pv) ((*PFCI_INT(hfci)->pfndelete)(name,err,pv)) +#define PFCI_OPEN(hfci,name,oflag,pmode,err,pv) ((*PFCI_INT(hfci)->pfnopen)(name,oflag,pmode,err,pv)) +#define PFCI_READ(hfci,hf,memory,cb,err,pv)((*PFCI_INT(hfci)->pfnread)(hf,memory ,cb,err,pv)) +#define PFCI_WRITE(hfci,hf,memory,cb,err,pv) ((*PFCI_INT(hfci)->pfnwrite)(hf,memory,cb,err,pv)) +#define PFCI_CLOSE(hfci,hf,err,pv) ((*PFCI_INT(hfci)->pfnclose)(hf,err,pv)) +#define PFCI_SEEK(hfci,hf,dist,seektype,err,pv)((*PFCI_INT(hfci)->pfnseek)(hf,di st,seektype,err,pv)) +#define PFCI_FILEPLACED(hfci,pccab,name,cb,cont,pv)((*PFCI_INT(hfci)->pfnfiledes t)(pccab,name,cb,cont,pv)) + /* quickie pfdi method invokers */ #define PFDI_ALLOC(hfdi, size) ((*PFDI_INT(hfdi)->pfnalloc) (size)) #define PFDI_FREE(hfdi, ptr) ((*PFDI_INT(hfdi)->pfnfree) (ptr)) _____ Modified: vendor/wine/dlls/cabinet/current/cabinet_main.c --- vendor/wine/dlls/cabinet/current/cabinet_main.c 2005-07-05 19:09:41 UTC (rev 16434) +++ vendor/wine/dlls/cabinet/current/cabinet_main.c 2005-07-05 19:52:25 UTC (rev 16435) @@ -89,12 +89,12 @@ HRESULT WINAPI Extract(EXTRACTdest *dest, LPCSTR what) { #define DUMPC(idx) idx >= sizeof(EXTRACTdest) ? ' ' : \ - ptr[idx] >= 0x20 ? ptr[idx] : '.' + ((unsigned char*) dest)[idx] >= 0x20 ? \ + ((unsigned char*) dest)[idx] : '.' -#define DUMPH(idx) idx >= sizeof(EXTRACTdest) ? 0x55 : ptr[idx] +#define DUMPH(idx) idx >= sizeof(EXTRACTdest) ? 0x55 : ((unsigned char*) dest)[idx] LPSTR dir; - unsigned char *ptr = (unsigned char*) dest; unsigned int i; TRACE("(dest == %0lx, what == %s)\n", (long) dest, debugstr_a(what)); _____ Modified: vendor/wine/dlls/cabinet/current/fci.c --- vendor/wine/dlls/cabinet/current/fci.c 2005-07-05 19:09:41 UTC (rev 16434) +++ vendor/wine/dlls/cabinet/current/fci.c 2005-07-05 19:52:25 UTC (rev 16435) @@ -19,9 +19,27 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* + +There is still some work to be done: + +- currently no support for big-endian machines +- the ERF error structure aren't used on error +- no real compression yet +- unknown behaviour if files>4GB or cabinet >4GB +- incorrect status information +- check if the maximum size for a cabinet is too small to store any data +- call pfnfcignc on exactly the same position as MS FCIAddFile in every case + +*/ + + + #include "config.h" #include <stdarg.h> +#include <stdio.h> +#include <string.h> #include "windef.h" #include "winbase.h" @@ -33,12 +51,56 @@ WINE_DEFAULT_DEBUG_CHANNEL(cabinet); +typedef struct { + cab_UBYTE signature[4]; /* !CAB for unfinished cabinets else MSCF */ + cab_ULONG reserved1; + cab_ULONG cbCabinet; /* size of the cabinet file in bytes*/ + cab_ULONG reserved2; + cab_ULONG coffFiles; /* offset to first CFFILE section */ + cab_ULONG reserved3; + cab_UBYTE versionMinor; /* 3 */ + cab_UBYTE versionMajor; /* 1 */ + cab_UWORD cFolders; /* number of CFFOLDER entries in the cabinet*/ + cab_UWORD cFiles; /* number of CFFILE entries in the cabinet*/ + cab_UWORD flags; /* 1=prev cab, 2=next cabinet, 4=reserved setions*/ + cab_UWORD setID; /* identification number of all cabinets in a set*/ + cab_UWORD iCabinet; /* number of the cabinet in a set */ + /* additional area if "flags" were set*/ +} CFHEADER; /* minimum 36 bytes */ + +typedef struct { + cab_ULONG coffCabStart; /* offset to the folder's first CFDATA section */ + cab_UWORD cCFData; /* number of this folder's CFDATA sections */ + cab_UWORD typeCompress; /* compression type of data in CFDATA section*/ + /* additional area if reserve flag was set */ +} CFFOLDER; /* minumum 8 bytes */ + +typedef struct { + cab_ULONG cbFile; /* size of the uncompressed file in bytes */ + cab_ULONG uoffFolderStart; /* offset of the uncompressed file in the folder */ + cab_UWORD iFolder; /* number of folder in the cabinet 0=first */ + /* for special values see below this structure*/ + cab_UWORD date; /* last modification date*/ + cab_UWORD time; /* last modification time*/ + cab_UWORD attribs; /* DOS fat attributes and UTF indicator */ + /* ... and a C string with the name of the file */ +} CFFILE; /* 16 bytes + name of file */ + + +typedef struct { + cab_ULONG csum; /* checksum of this entry*/ + cab_UWORD cbData; /* number of compressed bytes */ + cab_UWORD cbUncomp; /* number of bytes when data is uncompressed */ + /* optional reserved area */ + /* compressed data */ +} CFDATA; + + /*********************************************************************** * FCICreate (CABINET.10) * - * Provided with several callbacks, - * returns a handle which can be used to perform operations - * on cabinet files. + * FCICreate is provided with several callbacks and + * returns a handle which can be used to create cabinet files. * * PARAMS * perf [IO] A pointer to an ERF structure. When FCICreate @@ -54,7 +116,7 @@ * the same interface as _open. * pfnread [I] A pointer to a function which reads from a file into * a caller-provided buffer. Uses the same interface - * as _read + * as _read. * pfnwrite [I] A pointer to a function which writes to a file from * a caller-provided buffer. Uses the same interface * as _write. @@ -64,8 +126,8 @@ * Uses the same interface as _lseek. * pfndelete [I] A pointer to a function which deletes a file. * pfnfcigtf [I] A pointer to a function which gets the name of a - * temporary file; ignored in wine - * pccab [I] A pointer to an initialized CCAB structure + * temporary file. + * pccab [I] A pointer to an initialized CCAB structure. * pv [I] A pointer to an application-defined notification * function which will be passed to other FCI functions * as a parameter. @@ -94,9 +156,13 @@ PCCAB pccab, void *pv) { - HFCI rv; + HFCI hfci; + int err; + PFCI_Int p_fci_internal; - if ((!pfnalloc) || (!pfnfree)) { + if ((!perf) || (!pfnalloc) || (!pfnfree) || (!pfnopen) || (!pfnread) || + (!pfnwrite) || (!pfnclose) || (!pfnseek) || (!pfndelete) || + (!pfnfcigtf) || (!pccab)) { perf->erfOper = FCIERR_NONE; perf->erfType = ERROR_BAD_ARGUMENTS; perf->fError = TRUE; @@ -105,7 +171,7 @@ return NULL; } - if (!(rv = (HFCI) (*pfnalloc)(sizeof(FCI_Int)))) { + if (!((hfci = ((HFCI) (*pfnalloc)(sizeof(FCI_Int)))))) { perf->erfOper = FCIERR_ALLOC_FAIL; perf->erfType = ERROR_NOT_ENOUGH_MEMORY; perf->fError = TRUE; @@ -114,41 +180,1977 @@ return NULL; } - PFCI_INT(rv)->FCI_Intmagic = FCI_INT_MAGIC; - PFCI_INT(rv)->perf = perf; - PFCI_INT(rv)->pfnfiledest = pfnfiledest; - PFCI_INT(rv)->pfnalloc = pfnalloc; - PFCI_INT(rv)->pfnfree = pfnfree; - PFCI_INT(rv)->pfnopen = pfnopen; - PFCI_INT(rv)->pfnread = pfnread; - PFCI_INT(rv)->pfnwrite = pfnwrite; - PFCI_INT(rv)->pfnclose = pfnclose; - PFCI_INT(rv)->pfnseek = pfnseek; - PFCI_INT(rv)->pfndelete = pfndelete; - PFCI_INT(rv)->pfnfcigtf = pfnfcigtf; - PFCI_INT(rv)->pccab = pccab; - PFCI_INT(rv)->pv = pv; + p_fci_internal=((PFCI_Int)(hfci)); + p_fci_internal->FCI_Intmagic = FCI_INT_MAGIC; + p_fci_internal->perf = perf; + p_fci_internal->pfnfiledest = pfnfiledest; + p_fci_internal->pfnalloc = pfnalloc; + p_fci_internal->pfnfree = pfnfree; + p_fci_internal->pfnopen = pfnopen; + p_fci_internal->pfnread = pfnread; + p_fci_internal->pfnwrite = pfnwrite; + p_fci_internal->pfnclose = pfnclose; + p_fci_internal->pfnseek = pfnseek; + p_fci_internal->pfndelete = pfndelete; + p_fci_internal->pfnfcigtf = pfnfcigtf; + p_fci_internal->pccab = pccab; + p_fci_internal->fPrevCab = FALSE; + p_fci_internal->fNextCab = FALSE; + p_fci_internal->fSplitFolder = FALSE; + p_fci_internal->fGetNextCabInVain = FALSE; + p_fci_internal->pv = pv; + p_fci_internal->data_in = NULL; + p_fci_internal->cdata_in = 0; + p_fci_internal->data_out = NULL; + p_fci_internal->cCompressedBytesInFolder = 0; + p_fci_internal->cFolders = 0; + p_fci_internal->cFiles = 0; + p_fci_internal->cDataBlocks = 0; + p_fci_internal->sizeFileCFDATA1 = 0; + p_fci_internal->sizeFileCFFILE1 = 0; + p_fci_internal->sizeFileCFDATA2 = 0; + p_fci_internal->sizeFileCFFILE2 = 0; + p_fci_internal->sizeFileCFFOLDER = 0; + p_fci_internal->sizeFileCFFOLDER = 0; + p_fci_internal->fNewPrevious = FALSE; - /* Still mark as incomplete, because of other missing FCI* APIs */ + memcpy(p_fci_internal->szPrevCab, pccab->szCab, CB_MAX_CABINET_NAME); + memcpy(p_fci_internal->szPrevDisk, pccab->szDisk, CB_MAX_DISK_NAME); - PFCI_INT(rv)->FCI_Intmagic = 0; - PFDI_FREE(rv, rv); - FIXME("(%p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p): stub\n", - perf, pfnfiledest, pfnalloc, pfnfree, pfnopen, pfnread, pfnwrite, pfnclose, - pfnseek, pfndelete, pfnfcigtf, pccab, pv); + /* CFDATA */ + if( !PFCI_GETTEMPFILE(hfci,p_fci_internal->szFileNameCFDATA1, + CB_MAX_FILENAME)) { + /* TODO error handling */ + return FALSE; + } + /* safety */ + if ( strlen(p_fci_internal->szFileNameCFDATA1) >= CB_MAX_FILENAME ) { + /* TODO set error code */ + return FALSE; + } - perf->erfOper = FCIERR_NONE; - perf->erfType = 0; - perf->fError = TRUE; + p_fci_internal->handleCFDATA1 = PFCI_OPEN(hfci, + p_fci_internal->szFileNameCFDATA1, 34050, 384, &err, pv); + /* TODO check handle */ + /* TODO error checking of err */ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + /* array of all CFFILE in a folder */ + if( !PFCI_GETTEMPFILE(hfci,p_fci_internal->szFileNameCFFILE1, + CB_MAX_FILENAME)) { + /* TODO error handling */ + return FALSE; + } + /* safety */ + if ( strlen(p_fci_internal->szFileNameCFFILE1) >= CB_MAX_FILENAME ) { + /* TODO set error code */ + return FALSE; + } + p_fci_internal->handleCFFILE1 = PFCI_OPEN(hfci, + p_fci_internal->szFileNameCFFILE1, 34050, 384, &err, pv); + /* TODO check handle */ + /* TODO error checking of err */ - return NULL; + /* CFDATA with checksum and ready to be copied into cabinet */ + if( !PFCI_GETTEMPFILE(hfci,p_fci_internal->szFileNameCFDATA2, + CB_MAX_FILENAME)) { + /* TODO error handling */ + return FALSE; + } + /* safety */ + if ( strlen(p_fci_internal->szFileNameCFDATA2) >= CB_MAX_FILENAME ) { + /* TODO set error code */ + return FALSE; + } + p_fci_internal->handleCFDATA2 = PFCI_OPEN(hfci, + p_fci_internal->szFileNameCFDATA2, 34050, 384, &err, pv); + /* TODO check handle */ + /* TODO error checking of err */ -} + /* array of all CFFILE in a folder, ready to be copied into cabinet */ + if( !PFCI_GETTEMPFILE(hfci,p_fci_internal->szFileNameCFFILE2, + CB_MAX_FILENAME)) { + /* TODO error handling */ + return FALSE; + } + /* safety */ + if ( strlen(p_fci_internal->szFileNameCFFILE2) >= CB_MAX_FILENAME ) { + /* TODO set error code */ + return FALSE; + } + p_fci_internal->handleCFFILE2 = PFCI_OPEN(hfci, + p_fci_internal->szFileNameCFFILE2, 34050, 384, &err, pv); + /* TODO check handle */ + /* TODO error checking of err */ + /* array of all CFFILE in a folder, ready to be copied into cabinet */ + if( !PFCI_GETTEMPFILE(hfci,p_fci_internal->szFileNameCFFOLDER, + CB_MAX_FILENAME)) { + /* TODO error handling */ + return FALSE; + } + /* safety */ + if ( strlen(p_fci_internal->szFileNameCFFOLDER) >= CB_MAX_FILENAME ) { + /* TODO set error code */ + return FALSE; + } + p_fci_internal->handleCFFOLDER = PFCI_OPEN(hfci, + p_fci_internal->szFileNameCFFOLDER, 34050, 384, &err, pv); + + + /* TODO close and delete new files when return FALSE */ + + /* TODO check handle */ + /* TODO error checking of err */ + + return hfci; +} /* end of FCICreate */ + + + + + + +static BOOL fci_flush_data_block (HFCI hfci, int* err, + PFNFCISTATUS pfnfcis) { + + /* attention no hfci checks!!! */ + /* attention no checks if there is data available!!! */ + CFDATA data; + CFDATA* cfdata=&data; + char* reserved; + PFCI_Int p_fci_internal=((PFCI_Int)(hfci)); + UINT cbReserveCFData=p_fci_internal->pccab->cbReserveCFData; + UINT i; + + /* TODO compress the data of p_fci_internal->data_in */ + /* and write it to p_fci_internal->data_out */ + memcpy(p_fci_internal->data_out, p_fci_internal->data_in, + p_fci_internal->cdata_in /* number of bytes to copy */); + + cfdata->csum=0; /* checksum has to be set later */ + /* TODO set realsize of compressed data */ + cfdata->cbData = p_fci_internal->cdata_in; + cfdata->cbUncomp = p_fci_internal->cdata_in; + + /* write cfdata to p_fci_internal->handleCFDATA1 */ + if( PFCI_WRITE(hfci, p_fci_internal->handleCFDATA1, /* file handle */ + cfdata, sizeof(*cfdata), err, p_fci_internal->pv) + != sizeof(*cfdata) ) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err */ + + p_fci_internal->sizeFileCFDATA1 += sizeof(*cfdata); + + /* add optional reserved area */ + + /* This allocation and freeing at each CFData block is a bit */ + /* inefficent, but it's harder to forget about freeing the buffer :-). */ + /* Reserved areas are used seldom besides that... */ + if (cbReserveCFData!=0) { + if(!(reserved = (char*)PFCI_ALLOC(hfci, cbReserveCFData))) { + p_fci_internal->perf->erfOper = FCIERR_ALLOC_FAIL; + p_fci_internal->perf->erfType = ERROR_NOT_ENOUGH_MEMORY; + p_fci_internal->perf->fError = TRUE; + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + for(i=0;i<cbReserveCFData;) { + reserved[i++]='\0'; + } + if( PFCI_WRITE(hfci, p_fci_internal->handleCFDATA1, /* file handle */ + reserved, /* memory buffer */ + cbReserveCFData, /* number of bytes to copy */ + err, p_fci_internal->pv) != cbReserveCFData ) { + PFCI_FREE(hfci, reserved); + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err PFCI_FREE(hfci, reserved)*/ + + p_fci_internal->sizeFileCFDATA1 += cbReserveCFData; + PFCI_FREE(hfci, reserved); + } + + /* write p_fci_internal->data_out to p_fci_internal->handleCFDATA1 */ + if( PFCI_WRITE(hfci, p_fci_internal->handleCFDATA1, /* file handle */ + p_fci_internal->data_out, /* memory buffer */ + cfdata->cbData, /* number of bytes to copy */ + err, p_fci_internal->pv) != cfdata->cbData) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err */ + + p_fci_internal->sizeFileCFDATA1 += cfdata->cbData; + + /* reset the offset */ + p_fci_internal->cdata_in = 0; + p_fci_internal->cCompressedBytesInFolder += cfdata->cbData; + + /* report status with pfnfcis about uncompressed and compressed file data */ + if( (*pfnfcis)(statusFile, cfdata->cbData, cfdata->cbUncomp, + p_fci_internal->pv) == -1) { + /* TODO set error code and abort */ + return FALSE; + } + + ++(p_fci_internal->cDataBlocks); + + return TRUE; +} /* end of fci_flush_data_block */ + + + + + +static cab_ULONG fci_get_checksum(void *pv, UINT cb, CHECKSUM seed) +{ + cab_ULONG csum; + cab_ULONG ul; + int cUlong; + BYTE *pb; + + csum = seed; + cUlong = cb / 4; + pb = pv; + + while (cUlong-- > 0) { + ul = *pb++; + ul |= (((cab_ULONG)(*pb++)) << 8); + ul |= (((cab_ULONG)(*pb++)) << 16); + ul |= (((cab_ULONG)(*pb++)) << 24); + + csum ^= ul; + } + + ul = 0; + switch (cb % 4) { + case 3: + ul |= (((ULONG)(*pb++)) << 16); + case 2: + ul |= (((ULONG)(*pb++)) << 8); + case 1: + ul |= *pb++; + default: + break; + } + csum ^= ul; + + return csum; +} /* end of fci_get_checksum */ + + + + + +static BOOL fci_flushfolder_copy_cfdata(HFCI hfci, char* buffer, UINT cbReserveCFData, + PFNFCISTATUS pfnfcis, int* err, int handleCFDATA1new, + cab_ULONG* psizeFileCFDATA1new, cab_ULONG* payload) +{ + cab_ULONG read_result; + CFDATA* pcfdata=(CFDATA*)buffer; + BOOL split_block=FALSE; + cab_UWORD savedUncomp=0; + PFCI_Int p_fci_internal=((PFCI_Int)(hfci)); + + *payload=0; + + /* while not all CFDATAs have been copied do */ + while(!FALSE) { + if( p_fci_internal->fNextCab ) { + if( split_block ) { + /* TODO internal error should never happen */ + return FALSE; + } + } + /* REUSE the variable read_result */ + if ( p_fci_internal->oldCCAB.cbReserveCFHeader != 0 || + p_fci_internal->oldCCAB.cbReserveCFFolder != 0 || + p_fci_internal->oldCCAB.cbReserveCFData != 0 ) { + read_result=4; + } else { + read_result=0; + } + if (p_fci_internal->fPrevCab) { + read_result+=strlen(p_fci_internal->szPrevCab)+1 + + strlen(p_fci_internal->szPrevDisk)+1; + } + /* No more CFDATA fits into the cabinet under construction */ + /* So don't try to store more data into it */ + if( p_fci_internal->fNextCab && + (p_fci_internal->oldCCAB.cb <= sizeof(CFDATA) + cbReserveCFData + + p_fci_internal->sizeFileCFFILE1 + p_fci_internal->sizeFileCFDATA2 + + p_fci_internal->sizeFileCFFILE2 + p_fci_internal->sizeFileCFFOLDER + + sizeof(CFHEADER) + + read_result + + p_fci_internal->oldCCAB.cbReserveCFHeader + + sizeof(CFFOLDER) + + p_fci_internal->oldCCAB.cbReserveCFFolder + + strlen(p_fci_internal->pccab->szCab)+1 + + strlen(p_fci_internal->pccab->szDisk)+1 + )) { + /* This may never be run for the first time the while loop is entered. + Pray that the code that calls fci_flushfolder_copy_cfdata handles this.*/ + split_block=TRUE; /* In this case split_block is abused to store */ + /* the complete data block into the next cabinet and not into the */ + /* current one. Originally split_block is the indicator that a */ + /* data block has been splitted across different cabinets. */ + } else { + + /* read CFDATA from p_fci_internal->handleCFDATA1 to cfdata*/ + read_result= PFCI_READ(hfci, p_fci_internal->handleCFDATA1,/*file handle*/ + buffer, /* memory buffer */ + sizeof(CFDATA)+cbReserveCFData, /* number of bytes to copy */ + err, p_fci_internal->pv); + if (read_result!=sizeof(CFDATA)+cbReserveCFData) { + if (read_result==0) break; /* ALL DATA has been copied */ + /* TODO read error */ + return FALSE; + } + /* TODO error handling of err */ + + /* REUSE buffer p_fci_internal->data_out !!! */ + /* read data from p_fci_internal->handleCFDATA1 to */ + /* p_fci_internal->data_out */ + if( PFCI_READ(hfci, p_fci_internal->handleCFDATA1 /* file handle */, + p_fci_internal->data_out /* memory buffer */, + pcfdata->cbData /* number of bytes to copy */, + err, p_fci_internal->pv) != pcfdata->cbData ) { + /* TODO read error */ + return FALSE; + } + /* TODO error handling of err */ + + /* if cabinet size is too large */ + + /* REUSE the variable read_result */ + if ( p_fci_internal->oldCCAB.cbReserveCFHeader != 0 || + p_fci_internal->oldCCAB.cbReserveCFFolder != 0 || + p_fci_internal->oldCCAB.cbReserveCFData != 0 ) { + read_result=4; + } else { + read_result=0; + } + if (p_fci_internal->fPrevCab) { + read_result+=strlen(p_fci_internal->szPrevCab)+1 + + strlen(p_fci_internal->szPrevDisk)+1; + } + + /* Is cabinet with new CFDATA too large? Then data block has to be split */ + if( p_fci_internal->fNextCab && + (p_fci_internal->oldCCAB.cb < sizeof(CFDATA) + cbReserveCFData + + pcfdata->cbData + + p_fci_internal->sizeFileCFFILE1 + p_fci_internal->sizeFileCFDATA2 + + p_fci_internal->sizeFileCFFILE2 + p_fci_internal->sizeFileCFFOLDER + + sizeof(CFHEADER) + + read_result + + p_fci_internal->oldCCAB.cbReserveCFHeader + + sizeof(CFFOLDER) + /* size of new CFFolder entry */ + p_fci_internal->oldCCAB.cbReserveCFFolder + + strlen(p_fci_internal->pccab->szCab)+1 + /* name of next cabinet */ + strlen(p_fci_internal->pccab->szDisk)+1 /* name of next disk */ + )) { + /* REUSE read_result to save the size of the compressed data */ + read_result=pcfdata->cbData; + /* Modify the size of the compressed data to store only a part of the */ + /* data block into the current cabinet. This is done to prevent */ + /* that the maximum cabinet size will be exceeded. The remainer */ + /* will be stored into the next following cabinet. */ + + /* The cabinet will be of size "p_fci_internal->oldCCAB.cb". */ + /* Substract everything except the size of the block of data */ + /* to get it's actual size */ + pcfdata->cbData = p_fci_internal->oldCCAB.cb - ( + sizeof(CFDATA) + cbReserveCFData + + p_fci_internal->sizeFileCFFILE1 + p_fci_internal->sizeFileCFDATA2 + + p_fci_internal->sizeFileCFFILE2 + p_fci_internal->sizeFileCFFOLDER + + sizeof(CFHEADER) + + p_fci_internal->oldCCAB.cbReserveCFHeader + + sizeof(CFFOLDER) + /* set size of new CFFolder entry */ + p_fci_internal->oldCCAB.cbReserveCFFolder ); + /* substract the size of special header fields */ + if ( p_fci_internal->oldCCAB.cbReserveCFHeader != 0 || + p_fci_internal->oldCCAB.cbReserveCFFolder != 0 || + p_fci_internal->oldCCAB.cbReserveCFData != 0 ) { + pcfdata->cbData-=4; + } + if (p_fci_internal->fPrevCab) { + pcfdata->cbData-=strlen(p_fci_internal->szPrevCab)+1 + + strlen(p_fci_internal->szPrevDisk)+1; + } + pcfdata->cbData-=strlen(p_fci_internal->pccab->szCab)+1 + + strlen(p_fci_internal->pccab->szDisk)+1; + + savedUncomp = pcfdata->cbUncomp; + pcfdata->cbUncomp = 0; /* on splitted blocks of data this is zero */ + + /* if split_block==TRUE then the above while loop won't */ + /* be executed again */ + split_block=TRUE; /* split_block is the indicator that */ + /* a data block has been splitted across */ + /* diffentent cabinets.*/ + } + + /* This should never happen !!! */ + if (pcfdata->cbData==0) { + /* TODO set error */ + return FALSE; + } + + /* get checksum and write to cfdata.csum */ + pcfdata->csum = fci_get_checksum( &(pcfdata->cbData), + sizeof(CFDATA)+cbReserveCFData - + sizeof(pcfdata->csum), fci_get_checksum( p_fci_internal->data_out, /*buffer*/ + pcfdata->cbData, 0 ) ); + + /* write cfdata with checksum to p_fci_internal->handleCFDATA2 */ + if( PFCI_WRITE(hfci, p_fci_internal->handleCFDATA2, /* file handle */ + buffer, /* memory buffer */ + sizeof(CFDATA)+cbReserveCFData, /* number of bytes to copy */ + err, p_fci_internal->pv) != sizeof(CFDATA)+cbReserveCFData ) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err */ + + p_fci_internal->sizeFileCFDATA2 += sizeof(CFDATA)+cbReserveCFData; + + /* write compressed data into p_fci_internal->handleCFDATA2 */ + if( PFCI_WRITE(hfci, p_fci_internal->handleCFDATA2, /* file handle */ + p_fci_internal->data_out, /* memory buffer */ + pcfdata->cbData, /* number of bytes to copy */ + err, p_fci_internal->pv) != pcfdata->cbData) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err */ + + p_fci_internal->sizeFileCFDATA2 += pcfdata->cbData; + ++(p_fci_internal->cDataBlocks); + p_fci_internal->statusFolderCopied += pcfdata->cbData; + (*payload)+=pcfdata->cbUncomp; + /* if cabinet size too large and data has been split */ + /* write the remainer of the data block to the new CFDATA1 file */ + if( split_block ) { /* This does not include the */ + /* abused one (just search for "abused" )*/ + /* copy all CFDATA structures from handleCFDATA1 to handleCFDATA1new */ + if (p_fci_internal->fNextCab==FALSE ) { + /* TODO internal error */ + return FALSE; + } + + /* set cbData the size of the remainer of the data block */ + pcfdata->cbData = read_result - pcfdata->cbData; + /*recover former value of cfdata.cbData; read_result will be the offset*/ + read_result -= pcfdata->cbData; + pcfdata->cbUncomp = savedUncomp; + + /* reset checksum, it will be computed later */ + pcfdata->csum=0; + /* write cfdata WITHOUT checksum to handleCFDATA1new */ + if( PFCI_WRITE(hfci, handleCFDATA1new, /* file handle */ + buffer, /* memory buffer */ + sizeof(CFDATA)+cbReserveCFData, /* number of bytes to copy */ + err, p_fci_internal->pv) != sizeof(CFDATA)+cbReserveCFData ) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err dont forget PFCI_FREE(hfci, reserved) */ + + *psizeFileCFDATA1new += sizeof(CFDATA)+cbReserveCFData; + + /* write compressed data into handleCFDATA1new */ + if( PFCI_WRITE(hfci, handleCFDATA1new, /* file handle */ + p_fci_internal->data_out + read_result, /* memory buffer + offset */ + /* to last part of split data */ + pcfdata->cbData, /* number of bytes to copy */ + err, p_fci_internal->pv) != pcfdata->cbData) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err */ + + p_fci_internal->statusFolderCopied += pcfdata->cbData; + + *psizeFileCFDATA1new += pcfdata->cbData; + /* the two blocks of the split data block have been written */ + /* dont reset split_data yet, because it is still needed see below */ + } + + /* report status with pfnfcis about copied size of folder */ + if( (*pfnfcis)(statusFolder, + p_fci_internal->statusFolderCopied, /*cfdata.cbData(+previous ones)*/ + p_fci_internal->statusFolderTotal, /* total folder size */ + p_fci_internal->pv) == -1) { + /* TODO set error code and abort */ + return FALSE; + } + } + + /* if cabinet size too large */ + /* write the remaining data blocks to the new CFDATA1 file */ + if ( split_block ) { /* This does include the */ + /* abused one (just search for "abused" )*/ + if (p_fci_internal->fNextCab==FALSE ) { + /* TODO internal error */ + return FALSE; + } + /* copy all CFDATA structures from handleCFDATA1 to handleCFDATA1new */ + while(!FALSE) { + /* read CFDATA from p_fci_internal->handleCFDATA1 to cfdata*/ + read_result= PFCI_READ(hfci, p_fci_internal->handleCFDATA1,/* handle */ + buffer, /* memory buffer */ + sizeof(CFDATA)+cbReserveCFData, /* number of bytes to copy */ + err, p_fci_internal->pv); + if (read_result!=sizeof(CFDATA)+cbReserveCFData) { + if (read_result==0) break; /* ALL DATA has been copied */ + /* TODO read error */ + return FALSE; + } + /* TODO error handling of err */ + + /* REUSE buffer p_fci_internal->data_out !!! */ + /* read data from p_fci_internal->handleCFDATA1 to */ + /* p_fci_internal->data_out */ + if( PFCI_READ(hfci, p_fci_internal->handleCFDATA1 /* file handle */, + p_fci_internal->data_out /* memory buffer */, + pcfdata->cbData /* number of bytes to copy */, + err, p_fci_internal->pv) != pcfdata->cbData ) { + /* TODO read error */ + return FALSE; + } + /* TODO error handling of err dont forget PFCI_FREE(hfci, reserved) */ + + /* write cfdata with checksum to handleCFDATA1new */ + if( PFCI_WRITE(hfci, handleCFDATA1new, /* file handle */ + buffer, /* memory buffer */ + sizeof(CFDATA)+cbReserveCFData, /* number of bytes to copy */ + err, p_fci_internal->pv) != sizeof(CFDATA)+cbReserveCFData ) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err dont forget PFCI_FREE(hfci, reserved) */ + + *psizeFileCFDATA1new += sizeof(CFDATA)+cbReserveCFData; + + /* write compressed data into handleCFDATA1new */ + if( PFCI_WRITE(hfci, handleCFDATA1new, /* file handle */ + p_fci_internal->data_out, /* memory buffer */ + pcfdata->cbData, /* number of bytes to copy */ + err, p_fci_internal->pv) != pcfdata->cbData) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err */ + + *psizeFileCFDATA1new += pcfdata->cbData; + p_fci_internal->statusFolderCopied += pcfdata->cbData; + + /* report status with pfnfcis about copied size of folder */ + if( (*pfnfcis)(statusFolder, + p_fci_internal->statusFolderCopied,/*cfdata.cbData(+revious ones)*/ + p_fci_internal->statusFolderTotal, /* total folder size */ + p_fci_internal->pv) == -1) { + /* TODO set error code and abort */ + return FALSE; + } + + } /* end of WHILE */ + break; /* jump out of the next while loop */ + } /* end of if( split_data ) */ + } /* end of WHILE */ + return TRUE; +} /* end of fci_flushfolder_copy_cfdata */ + + + + + +static BOOL fci_flushfolder_copy_cffolder(HFCI hfci, int* err, UINT cbReserveCFFolder, + cab_ULONG sizeFileCFDATA2old) +{ + CFFOLDER cffolder; + UINT i; + char* reserved; + PFCI_Int p_fci_internal=((PFCI_Int)(hfci)); + + /* absolute offset cannot be set yet, because the size of cabinet header, */ + /* the number of CFFOLDERs and the number of CFFILEs may change. */ + /* Instead the size of all previous data blocks will be stored and */ + /* the remainer of the offset will be added when the cabinet will be */ + /* flushed to disk. */ + /* This is exactly the way the original CABINET.DLL works!!! */ + cffolder.coffCabStart=sizeFileCFDATA2old; + + /* set the number of this folder's CFDATA sections */ + cffolder.cCFData=p_fci_internal->cDataBlocks; + /* TODO set compression type */ + cffolder.typeCompress = tcompTYPE_NONE; + + /* write cffolder to p_fci_internal->handleCFFOLDER */ + if( PFCI_WRITE(hfci, p_fci_internal->handleCFFOLDER, /* file handle */ + &cffolder, /* memory buffer */ + sizeof(cffolder), /* number of bytes to copy */ + err, p_fci_internal->pv) != sizeof(cffolder) ) { + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err */ + + p_fci_internal->sizeFileCFFOLDER += sizeof(cffolder); + + /* add optional reserved area */ + if (cbReserveCFFolder!=0) { + if(!(reserved = (char*)PFCI_ALLOC(hfci, cbReserveCFFolder))) { + p_fci_internal->perf->erfOper = FCIERR_ALLOC_FAIL; + p_fci_internal->perf->erfType = ERROR_NOT_ENOUGH_MEMORY; + p_fci_internal->perf->fError = TRUE; + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + for(i=0;i<cbReserveCFFolder;) { + reserved[i++]='\0'; + } + if( PFCI_WRITE(hfci, p_fci_internal->handleCFFOLDER, /* file handle */ + reserved, /* memory buffer */ + cbReserveCFFolder, /* number of bytes to copy */ + err, p_fci_internal->pv) != cbReserveCFFolder ) { + PFCI_FREE(hfci, reserved); + /* TODO write error */ + return FALSE; + } + /* TODO error handling of err */ + + p_fci_internal->sizeFileCFFOLDER += cbReserveCFFolder; + + PFCI_FREE(hfci, reserved); + } + return TRUE; +} /* end of fci_flushfolder_copy_cffolder */ + + + + + +static BOOL fci_flushfolder_copy_cffile(HFCI hfci, int* err, int handleCFFILE1new, + cab_ULONG *psizeFileCFFILE1new, cab_ULONG payload) +{ + CFFILE cffile; + cab_ULONG read_result; + cab_ULONG seek=0; + cab_ULONG sizeOfFiles=0, sizeOfFilesPrev; + BOOL may_be_prev=TRUE; + cab_ULONG cbFileRemainer=0; + PFCI_Int p_fci_internal=((PFCI_Int)(hfci)); + /* set seek of p_fci_internal->handleCFFILE1 to 0 */ + if( PFCI_SEEK(hfci,p_fci_internal->handleCFFILE1,0,SEEK_SET,err, + p_fci_internal->pv) !=0 ) { + /* TODO wrong return value */ + } + /* TODO error handling of err */ + + /* while not all CFFILE structures have been copied do */ + while(!FALSE) { + /* REUSE the variable read_result */ + /* read data from p_fci_internal->handleCFFILE1 to cffile */ + read_result = PFCI_READ(hfci,p_fci_internal->handleCFFILE1/* file handle */, + &cffile, /* memory buffer */ + sizeof(cffile), /* number of bytes to copy */ + err, p_fci_internal->pv); + if( read_result != sizeof(cffile) ) { + if( read_result == 0 ) break; /* ALL CFFILE structures have been copied */ + /* TODO read error */ + return FALSE; + } + /* TODO error handling of err */ + + /* Microsoft's(R) CABINET.DLL would do a seek to the current! */ + /* position. I don't know why so I'll just omit it */ + + /* read the filename from p_fci_internal->handleCFFILE1 */ + /* REUSE the variable read_result AGAIN */ + /* REUSE the memory buffer PFCI(hfci)->data_out */ + if( PFCI_READ(hfci, p_fci_internal->handleCFFILE1 /*file handle*/, + p_fci_internal->data_out, /* memory buffer */ + CB_MAX_FILENAME, /* number of bytes to copy */ + err, p_fci_internal->pv) <2) { + /* TODO read error */ + return FALSE; + } + /* TODO maybe other checks of read_result */ + /* TODO error handling of err */ + + /* safety */ + if( strlen(p_fci_internal->data_out)>=CB_MAX_FILENAME ) { + /* TODO set error code internal error */ + return FALSE; + } + + seek+=sizeof(cffile) + strlen(p_fci_internal->data_out)+1; + + /* set seek of p_fci_internal->handleCFFILE1 to end of file name */ + /* i.e. seek to the next CFFILE area */ + if( PFCI_SEEK(hfci,p_fci_internal->handleCFFILE1, + seek, /* seek position*/ + SEEK_SET ,err, + p_fci_internal->pv) [truncated at 1000 lines; 39903 more skipped]
19 years, 6 months
1
0
0
0
[gvg] 16434: Complete Wine-20050524 sync
by gvg@svn.reactos.com
Complete Wine-20050524 sync Deleted: vendor/wine/dlls/cabinet/Wine-20050419/ Added: vendor/wine/dlls/cabinet/Wine-20050524/ Deleted: vendor/wine/dlls/comctl32/Wine-20050419/ Added: vendor/wine/dlls/comctl32/Wine-20050524/ Deleted: vendor/wine/dlls/commdlg/Wine-20050419/ Added: vendor/wine/dlls/commdlg/Wine-20050524/ Deleted: vendor/wine/dlls/dinput/Wine-20050419/ Added: vendor/wine/dlls/dinput/Wine-20050524/ Deleted: vendor/wine/dlls/dinput8/Wine-20050419/ Added: vendor/wine/dlls/dinput8/Wine-20050524/ Added: vendor/wine/dlls/dinput8/Wine-20050524/current/ Deleted: vendor/wine/dlls/dsound/Wine-20050419/ Added: vendor/wine/dlls/dsound/Wine-20050524/ Deleted: vendor/wine/dlls/icmp/Wine-20050419/ Added: vendor/wine/dlls/icmp/Wine-20050524/ Deleted: vendor/wine/dlls/mpr/Wine-20050419/ Added: vendor/wine/dlls/mpr/Wine-20050524/ Deleted: vendor/wine/dlls/msi/Wine-20050419/ Added: vendor/wine/dlls/msi/Wine-20050524/ Deleted: vendor/wine/dlls/msimg32/Wine-20050419/ Added: vendor/wine/dlls/msimg32/Wine-20050524/ Deleted: vendor/wine/dlls/ole32/Wine-20050419/ Added: vendor/wine/dlls/ole32/Wine-20050524/ Deleted: vendor/wine/dlls/oleaut32/Wine-20050419/ Added: vendor/wine/dlls/oleaut32/Wine-20050524/ Deleted: vendor/wine/dlls/oledlg/Wine-20050419/ Added: vendor/wine/dlls/oledlg/Wine-20050524/ Deleted: vendor/wine/dlls/olepro32/Wine-20050419/ Added: vendor/wine/dlls/olepro32/Wine-20050524/ Deleted: vendor/wine/dlls/riched20/Wine-20050419/ Added: vendor/wine/dlls/riched20/Wine-20050524/ Deleted: vendor/wine/dlls/richedit/Wine-20050419/ Added: vendor/wine/dlls/richedit/Wine-20050524/ Deleted: vendor/wine/dlls/rpcrt4/Wine-20050419/ Added: vendor/wine/dlls/rpcrt4/Wine-20050524/ Deleted: vendor/wine/dlls/setupapi/Wine-20050419/ Added: vendor/wine/dlls/setupapi/Wine-20050524/ Deleted: vendor/wine/dlls/shdocvw/Wine-20050419/ Added: vendor/wine/dlls/shdocvw/Wine-20050524/ Deleted: vendor/wine/dlls/shell32/Wine-20050419/ Added: vendor/wine/dlls/shell32/Wine-20050524/ Deleted: vendor/wine/dlls/shlwapi/Wine-20050419/ Added: vendor/wine/dlls/shlwapi/Wine-20050524/ Deleted: vendor/wine/dlls/urlmon/Wine-20050419/ Added: vendor/wine/dlls/urlmon/Wine-20050524/ Added: vendor/wine/dlls/wininet/Wine-20050524/ Deleted: vendor/wine/dlls/winmm/Wine-20050419/ Added: vendor/wine/dlls/winmm/Wine-20050524/ Deleted: vendor/wine/libs/unicode/Wine-20050419/ Added: vendor/wine/libs/unicode/Wine-20050524/ Deleted: vendor/wine/libs/wpp/Wine-20050419/ Added: vendor/wine/libs/wpp/Wine-20050524/ Deleted: vendor/wine/programs/msiexec/Wine-20050419/ Added: vendor/wine/programs/msiexec/Wine-20050524/ Deleted: vendor/wine/tools/widl/Wine-20050419/ Added: vendor/wine/tools/widl/Wine-20050524/ Deleted: vendor/wine/tools/winebuild/Wine-20050419/ Added: vendor/wine/tools/winebuild/Wine-20050524/ Deleted: vendor/wine/tools/wrc/Wine-20050419/ Added: vendor/wine/tools/wrc/Wine-20050524/ _____ Copied: vendor/wine/dlls/cabinet/Wine-20050524 (from rev 16433, vendor/wine/dlls/cabinet/current) _____ Copied: vendor/wine/dlls/comctl32/Wine-20050524 (from rev 16433, vendor/wine/dlls/comctl32/current) _____ Copied: vendor/wine/dlls/commdlg/Wine-20050524 (from rev 16433, vendor/wine/dlls/commdlg/current) _____ Copied: vendor/wine/dlls/dinput/Wine-20050524 (from rev 16433, vendor/wine/dlls/dinput/current) _____ Copied: vendor/wine/dlls/dinput8/Wine-20050524 (from rev 16433, vendor/wine/dlls/dinput8/current) _____ Copied: vendor/wine/dlls/dinput8/Wine-20050524/current (from rev 16433, vendor/wine/dlls/dinput8/current) _____ Copied: vendor/wine/dlls/dsound/Wine-20050524 (from rev 16433, vendor/wine/dlls/dsound/current) _____ Copied: vendor/wine/dlls/icmp/Wine-20050524 (from rev 16433, vendor/wine/dlls/icmp/current) _____ Copied: vendor/wine/dlls/mpr/Wine-20050524 (from rev 16433, vendor/wine/dlls/mpr/current) _____ Copied: vendor/wine/dlls/msi/Wine-20050524 (from rev 16433, vendor/wine/dlls/msi/current) _____ Copied: vendor/wine/dlls/msimg32/Wine-20050524 (from rev 16433, vendor/wine/dlls/msimg32/current) _____ Copied: vendor/wine/dlls/ole32/Wine-20050524 (from rev 16433, vendor/wine/dlls/ole32/current) _____ Copied: vendor/wine/dlls/oleaut32/Wine-20050524 (from rev 16433, vendor/wine/dlls/oleaut32/current) _____ Copied: vendor/wine/dlls/oledlg/Wine-20050524 (from rev 16433, vendor/wine/dlls/oledlg/current) _____ Copied: vendor/wine/dlls/olepro32/Wine-20050524 (from rev 16433, vendor/wine/dlls/olepro32/current) _____ Copied: vendor/wine/dlls/riched20/Wine-20050524 (from rev 16433, vendor/wine/dlls/riched20/current) _____ Copied: vendor/wine/dlls/richedit/Wine-20050524 (from rev 16433, vendor/wine/dlls/richedit/current) _____ Copied: vendor/wine/dlls/rpcrt4/Wine-20050524 (from rev 16433, vendor/wine/dlls/rpcrt4/current) _____ Copied: vendor/wine/dlls/setupapi/Wine-20050524 (from rev 16433, vendor/wine/dlls/setupapi/current) _____ Copied: vendor/wine/dlls/shdocvw/Wine-20050524 (from rev 16433, vendor/wine/dlls/shdocvw/current) _____ Copied: vendor/wine/dlls/shell32/Wine-20050524 (from rev 16433, vendor/wine/dlls/shell32/current) _____ Copied: vendor/wine/dlls/shlwapi/Wine-20050524 (from rev 16433, vendor/wine/dlls/shlwapi/current) _____ Copied: vendor/wine/dlls/urlmon/Wine-20050524 (from rev 16433, vendor/wine/dlls/urlmon/current) _____ Copied: vendor/wine/dlls/wininet/Wine-20050524 (from rev 16433, vendor/wine/dlls/wininet/current) _____ Copied: vendor/wine/dlls/winmm/Wine-20050524 (from rev 16433, vendor/wine/dlls/winmm/current) _____ Copied: vendor/wine/libs/unicode/Wine-20050524 (from rev 16433, vendor/wine/libs/unicode/current) _____ Copied: vendor/wine/libs/wpp/Wine-20050524 (from rev 16433, vendor/wine/libs/wpp/current) _____ Copied: vendor/wine/programs/msiexec/Wine-20050524 (from rev 16433, vendor/wine/programs/msiexec/current) _____ Copied: vendor/wine/tools/widl/Wine-20050524 (from rev 16433, vendor/wine/tools/widl/current) _____ Copied: vendor/wine/tools/winebuild/Wine-20050524 (from rev 16433, vendor/wine/tools/winebuild/current) _____ Copied: vendor/wine/tools/wrc/Wine-20050524 (from rev 16433, vendor/wine/tools/wrc/current)
19 years, 6 months
1
0
0
0
[navaraf] 16433: Remove spurious "#define _OLEIDL_H".
by navaraf@svn.reactos.com
Remove spurious "#define _OLEIDL_H". Modified: trunk/reactos/w32api/include/servprov.h _____ Modified: trunk/reactos/w32api/include/servprov.h --- trunk/reactos/w32api/include/servprov.h 2005-07-05 17:10:52 UTC (rev 16432) +++ trunk/reactos/w32api/include/servprov.h 2005-07-05 17:13:01 UTC (rev 16433) @@ -1,6 +1,5 @@ #ifndef _SERVPROV_H #define _SERVPROV_H -#define _OLEIDL_H #if __GNUC__ >=3 #pragma GCC system_header #endif
19 years, 6 months
1
0
0
0
[gvg] 16432: Always return a meaningfull status code
by gvg@svn.reactos.com
Always return a meaningfull status code Modified: trunk/reactos/ntoskrnl/ps/win32.c _____ Modified: trunk/reactos/ntoskrnl/ps/win32.c --- trunk/reactos/ntoskrnl/ps/win32.c 2005-07-05 17:10:19 UTC (rev 16431) +++ trunk/reactos/ntoskrnl/ps/win32.c 2005-07-05 17:10:52 UTC (rev 16432) @@ -64,7 +64,7 @@ PsInitWin32Thread (PETHREAD Thread) { PEPROCESS Process; - NTSTATUS Status; + NTSTATUS Status = STATUS_SUCCESS; Process = Thread->ThreadsProcess;
19 years, 6 months
1
0
0
0
← Newer
1
...
46
47
48
49
50
51
52
...
57
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
Results per page:
10
25
50
100
200