ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
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
January 2005
----- 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
28 participants
703 discussions
Start a n
N
ew thread
[chorns] 13064: Import TechBot
by chorns@svn.reactos.com
Import TechBot Added: trunk/irc/TechBot/ Added: trunk/irc/TechBot/CHMLibrary/ Added: trunk/irc/TechBot/CHMLibrary/AssemblyInfo.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/ Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/BinaryReaderHelp.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMBtree.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMFile.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMIdxhdr.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMStrings.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMSystem.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMTocidx.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMTopics.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMUrlstr.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMUrltable.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/DumpingInfo.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/FullTextEngine.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/HHCParser.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/HHCParser2.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/HHKParser.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/TopicEntry.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/UrlTableEntry.cs Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/enumerations.cs Added: trunk/irc/TechBot/CHMLibrary/CHMLibrary.cmbx Added: trunk/irc/TechBot/CHMLibrary/CHMLibrary.prjx Added: trunk/irc/TechBot/CHMLibrary/Category.cs Added: trunk/irc/TechBot/CHMLibrary/ChmFileInfo.cs Added: trunk/irc/TechBot/CHMLibrary/Default.build Added: trunk/irc/TechBot/CHMLibrary/HtmlHelpSystem.cs Added: trunk/irc/TechBot/CHMLibrary/HttpUtility.cs Added: trunk/irc/TechBot/CHMLibrary/Index.cs Added: trunk/irc/TechBot/CHMLibrary/IndexItem.cs Added: trunk/irc/TechBot/CHMLibrary/IndexTopic.cs Added: trunk/irc/TechBot/CHMLibrary/InformationType.cs Added: trunk/irc/TechBot/CHMLibrary/Storage/ Added: trunk/irc/TechBot/CHMLibrary/Storage/CHMStream.cs Added: trunk/irc/TechBot/CHMLibrary/TOCItem.cs Added: trunk/irc/TechBot/CHMLibrary/TableOfContents.cs Added: trunk/irc/TechBot/Compression/ Added: trunk/irc/TechBot/Compression/AssemblyInfo.cs Added: trunk/irc/TechBot/Compression/Checksums/ Added: trunk/irc/TechBot/Compression/Checksums/Adler32.cs Added: trunk/irc/TechBot/Compression/Checksums/CRC32.cs Added: trunk/irc/TechBot/Compression/Checksums/IChecksum.cs Added: trunk/irc/TechBot/Compression/Checksums/StrangeCRC.cs Added: trunk/irc/TechBot/Compression/Compression.cmbx Added: trunk/irc/TechBot/Compression/Compression.prjx Added: trunk/irc/TechBot/Compression/Default.build Added: trunk/irc/TechBot/Compression/Deflater.cs Added: trunk/irc/TechBot/Compression/DeflaterConstants.cs Added: trunk/irc/TechBot/Compression/DeflaterEngine.cs Added: trunk/irc/TechBot/Compression/DeflaterHuffman.cs Added: trunk/irc/TechBot/Compression/DeflaterPending.cs Added: trunk/irc/TechBot/Compression/Inflater.cs Added: trunk/irc/TechBot/Compression/InflaterDynHeader.cs Added: trunk/irc/TechBot/Compression/InflaterHuffmanTree.cs Added: trunk/irc/TechBot/Compression/PendingBuffer.cs Added: trunk/irc/TechBot/Compression/Streams/ Added: trunk/irc/TechBot/Compression/Streams/DeflaterOutputStream.cs Added: trunk/irc/TechBot/Compression/Streams/InflaterInputStream.cs Added: trunk/irc/TechBot/Compression/Streams/OutputWindow.cs Added: trunk/irc/TechBot/Compression/Streams/StreamManipulator.cs Added: trunk/irc/TechBot/Compression/ZipException.cs Added: trunk/irc/TechBot/Default.build Added: trunk/irc/TechBot/TechBot/ Added: trunk/irc/TechBot/TechBot/App.config Added: trunk/irc/TechBot/TechBot/AssemblyInfo.cs Added: trunk/irc/TechBot/TechBot/Default.build Added: trunk/irc/TechBot/TechBot/ServiceThread.cs Added: trunk/irc/TechBot/TechBot/TechBot.prjx Added: trunk/irc/TechBot/TechBot/TechBotService.cs Added: trunk/irc/TechBot/TechBot.Console/ Added: trunk/irc/TechBot/TechBot.Console/App.config Added: trunk/irc/TechBot/TechBot.Console/AssemblyInfo.cs Added: trunk/irc/TechBot/TechBot.Console/Default.build Added: trunk/irc/TechBot/TechBot.Console/Main.cs Added: trunk/irc/TechBot/TechBot.Console/TechBot.Console.cmbx Added: trunk/irc/TechBot/TechBot.Console/TechBot.Console.prjx Added: trunk/irc/TechBot/TechBot.IRCLibrary/ Added: trunk/irc/TechBot/TechBot.IRCLibrary/AssemblyInfo.cs Added: trunk/irc/TechBot/TechBot.IRCLibrary/Default.build Added: trunk/irc/TechBot/TechBot.IRCLibrary/IRC.cs Added: trunk/irc/TechBot/TechBot.IRCLibrary/IrcChannel.cs Added: trunk/irc/TechBot/TechBot.IRCLibrary/IrcClient.cs Added: trunk/irc/TechBot/TechBot.IRCLibrary/IrcException.cs Added: trunk/irc/TechBot/TechBot.IRCLibrary/IrcMessage.cs Added: trunk/irc/TechBot/TechBot.IRCLibrary/IrcUser.cs Added: trunk/irc/TechBot/TechBot.IRCLibrary/TechBot.IRCLibrary.cmbx Added: trunk/irc/TechBot/TechBot.IRCLibrary/TechBot.IRCLibrary.prjx Added: trunk/irc/TechBot/TechBot.Library/ Added: trunk/irc/TechBot/TechBot.Library/ApiCommand.cs Added: trunk/irc/TechBot/TechBot.Library/AssemblyInfo.cs Added: trunk/irc/TechBot/TechBot.Library/Default.build Added: trunk/irc/TechBot/TechBot.Library/HelpCommand.cs Added: trunk/irc/TechBot/TechBot.Library/HresultCommand.cs Added: trunk/irc/TechBot/TechBot.Library/ICommand.cs Added: trunk/irc/TechBot/TechBot.Library/IrcService.cs Added: trunk/irc/TechBot/TechBot.Library/NtStatusCommand.cs Added: trunk/irc/TechBot/TechBot.Library/NumberParser.cs Added: trunk/irc/TechBot/TechBot.Library/ServiceOutput.cs Added: trunk/irc/TechBot/TechBot.Library/SvnCommand.cs [truncated at 100 lines; 5 more skipped] _____ Added: trunk/irc/TechBot/CHMLibrary/AssemblyInfo.cs --- trunk/irc/TechBot/CHMLibrary/AssemblyInfo.cs 2005-01-15 19:15:45 UTC (rev 13063) +++ trunk/irc/TechBot/CHMLibrary/AssemblyInfo.cs 2005-01-15 19:27:25 UTC (rev 13064) @@ -0,0 +1,32 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following +// attributes. +// +// change them to the information which is associated with the assembly +// you compile. + +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all values by your own or you can build default build and revision +// numbers with the '*' character (the default): + +[assembly: AssemblyVersion("1.0.*")] + +// The following attributes specify the key for the sign of your assembly. See the +// .NET Framework documentation for more information about signing. +// This is not required, if you don't want signing let these attributes like they're. +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] _____ Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/BinaryReaderHelp.cs --- trunk/irc/TechBot/CHMLibrary/CHMDecoding/BinaryReaderHelp.cs 2005-01-15 19:15:45 UTC (rev 13063) +++ trunk/irc/TechBot/CHMLibrary/CHMDecoding/BinaryReaderHelp.cs 2005-01-15 19:27:25 UTC (rev 13064) @@ -0,0 +1,274 @@ +using System; +using System.Collections; +using System.IO; +using System.Text; +using System.Globalization; + +namespace HtmlHelp.ChmDecoding +{ + /// <summary> + /// The class <c>BinaryReaderHelp</c> implements static helper methods for extracting binary data + /// from a binary reader object. + /// </summary> + internal class BinaryReaderHelp + { + /// <summary> + /// Internal helper method to extract null-terminated strings from a binary reader + /// </summary> + /// <param name="binReader">reference to the binary reader</param> + /// <param name="offset">offset in the stream</param> + /// <param name="noOffset">true if the offset value should be used</param> + /// <param name="encoder">encoder used for text encoding</param> + /// <returns>An extracted string value</returns> + internal static string ExtractString(ref BinaryReader binReader, int offset, bool noOffset, Encoding encoder) + { + string strReturn = ""; + + if(encoder == null) + encoder = Encoding.ASCII; + + ArrayList nameBytes = new ArrayList(); + byte curByte; + + if(!noOffset) + binReader.BaseStream.Seek(offset, SeekOrigin.Begin); + + if(binReader.BaseStream.Position >= binReader.BaseStream.Length) + return ""; + + curByte = binReader.ReadByte(); + while( (curByte != (byte)0) && (binReader.BaseStream.Position < binReader.BaseStream.Length) ) + { + nameBytes.Add( curByte ); + curByte = binReader.ReadByte(); + } + + byte[] name = (byte[]) (nameBytes.ToArray(System.Type.GetType("System.Byte"))); + strReturn = encoder.GetString(name,0,name.Length); + + return strReturn; + } + + /// <summary> + /// Internal helper method to extract a string with a specific length from the binary reader + /// </summary> + /// <param name="binReader">reference to the binary reader</param> + /// <param name="length">length of the string (number of bytes)</param> + /// <param name="offset">offset in the stream</param> + /// <param name="noOffset">true if the offset value should be used</param> + /// <param name="encoder">encoder used for text encoding</param> + /// <returns>An extracted string value</returns> + internal static string ExtractString(ref BinaryReader binReader, int length, int offset, bool noOffset, Encoding encoder) + { + string strReturn = ""; + + if(length == 0) + return ""; + + if(encoder == null) + encoder = Encoding.ASCII; + + ArrayList nameBytes = new ArrayList(); + byte curByte; + + if(!noOffset) + binReader.BaseStream.Seek(offset, SeekOrigin.Begin); + + if(binReader.BaseStream.Position >= binReader.BaseStream.Length) + return ""; + + curByte = binReader.ReadByte(); + while( (curByte != (byte)0) && (nameBytes.Count < length) && (binReader.BaseStream.Position < binReader.BaseStream.Length) ) + { + nameBytes.Add( curByte ); + + if(nameBytes.Count < length) + curByte = binReader.ReadByte(); + } + + byte[] name = (byte[]) (nameBytes.ToArray(System.Type.GetType("System.Byte"))); + strReturn = encoder.GetString(name,0,name.Length); + + return strReturn; + } + + /// <summary> + /// Internal helper method to extract a string with a specific length from the binary reader + /// </summary> + /// <param name="binReader">reference to the binary reader</param> + /// <param name="bFoundTerminator">reference to a bool vairable which will receive true if the + /// string terminator \0 was found. false indicates that the end of the stream was reached.</param> + /// <param name="offset">offset in the stream</param> + /// <param name="noOffset">true if the offset value should be used</param> + /// <param name="encoder">encoder used for text encoding</param> + /// <returns>An extracted string value</returns> + internal static string ExtractString(ref BinaryReader binReader, ref bool bFoundTerminator, int offset, bool noOffset, Encoding encoder) + { + string strReturn = ""; + + ArrayList nameBytes = new ArrayList(); + byte curByte; + + if(encoder == null) + encoder = Encoding.ASCII; + + if(!noOffset) + binReader.BaseStream.Seek(offset, SeekOrigin.Begin); + + if(binReader.BaseStream.Position >= binReader.BaseStream.Length) + return ""; + + curByte = binReader.ReadByte(); + while( (curByte != (byte)0) && (binReader.BaseStream.Position < binReader.BaseStream.Length) ) + { + nameBytes.Add( curByte ); + curByte = binReader.ReadByte(); + + if( curByte == (byte)0 ) + { + bFoundTerminator = true; + } + } + + byte[] name = (byte[]) (nameBytes.ToArray(System.Type.GetType("System.Byte"))); + strReturn = encoder.GetString(name,0,name.Length); + + return strReturn; + } + + /// <summary> + /// Internal helper method to extract a null-terminated UTF-16/UCS-2 strings from a binary reader + /// </summary> + /// <param name="binReader">reference to the binary reader</param> + /// <param name="offset">offset in the stream</param> + /// <param name="noOffset">true if the offset value should be used</param> + /// <param name="encoder">encoder used for text encoding</param> + /// <returns>An extracted string value</returns> + internal static string ExtractUTF16String(ref BinaryReader binReader, int offset, bool noOffset, Encoding encoder) + { + string strReturn = ""; + + ArrayList nameBytes = new ArrayList(); + byte curByte; + int lastByte=-1; + + if(!noOffset) + binReader.BaseStream.Seek(offset, SeekOrigin.Begin); + + if(binReader.BaseStream.Position >= binReader.BaseStream.Length) + return ""; + + if(encoder == null) + encoder = Encoding.Unicode; + + curByte = binReader.ReadByte(); + int nCnt = 0; + while( ((curByte != (byte)0) || (lastByte != 0) ) && (binReader.BaseStream.Position < binReader.BaseStream.Length) ) + { + nameBytes.Add( curByte ); + + if(nCnt%2 == 0) + lastByte = (int)curByte; + + curByte = binReader.ReadByte(); + + nCnt++; + } + + byte[] name = (byte[]) (nameBytes.ToArray(System.Type.GetType("System.Byte"))); + strReturn = Encoding.Unicode.GetString(name,0,name.Length); + + // apply text encoding + name = Encoding.Default.GetBytes(strReturn); + strReturn = encoder.GetString(name,0,name.Length); + + return strReturn; + } + + /// <summary> + /// Internal helper for reading ENCINT encoded integer values + /// </summary> + /// <param name="binReader">reference to the reader</param> + /// <returns>a long value</returns> + internal static long ReadENCINT(ref BinaryReader binReader) + { + long nRet = 0; + byte buffer = 0; + int shift = 0; + + if(binReader.BaseStream.Position >= binReader.BaseStream.Length) + return nRet; + + do + { + buffer = binReader.ReadByte(); + nRet |= ((long)((buffer & (byte)0x7F))) << shift; + shift += 7; + + }while ( (buffer & (byte)0x80) != 0); + + return nRet; + } + + /// <summary> + /// Reads an s/r encoded value from the byte array and decodes it into an integer + /// </summary> + /// <param name="wclBits">a byte array containing all bits (contains only 0 or 1 elements)</param> + /// <param name="s">scale param for encoding</param> + /// <param name="r">root param for encoding</param> + /// <param name="nBitIndex">current index in the wclBits array</param> + /// <returns>Returns an decoded integer value.</returns> + internal static int ReadSRItem(byte[] wclBits, int s, int r, ref int nBitIndex) + { + int nRet = 0; + int q = r; + + int nPref1Cnt = 0; + + while( wclBits[nBitIndex++] == 1) + { + nPref1Cnt++; + } + + if(nPref1Cnt == 0) + { + int nMask = 0; + + for(int nbits=0; nbits<q;nbits++) + { + nMask |= ( 0x01 & (int)wclBits[nBitIndex]) << (q-nbits-1); + nBitIndex++; + } + + nRet = nMask; + } + else + { + q += (nPref1Cnt-1); + + int nMask = 0; + int nRMaxValue = 0; + + for(int nbits=0; nbits<q;nbits++) + { + nMask |= ( 0x01 & (int)wclBits[nBitIndex]) << (q-nbits-1); + nBitIndex++; + } + + for(int nsv=0; nsv<r; nsv++) + { + nRMaxValue = nRMaxValue << 1; + nRMaxValue |= 0x1; + } + + nRMaxValue++; // startvalue of s/r encoding with 1 prefixing '1' + + nRMaxValue *= (int) Math.Pow((double)2, (double)(nPref1Cnt-1)); + + nRet = nRMaxValue + nMask; + } + + return nRet; + } + } +} _____ Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMBtree.cs --- trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMBtree.cs 2005-01-15 19:15:45 UTC (rev 13063) +++ trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMBtree.cs 2005-01-15 19:27:25 UTC (rev 13064) @@ -0,0 +1,325 @@ +using System; +using System.IO; +using System.Collections; +using System.Collections.Specialized; + +namespace HtmlHelp.ChmDecoding +{ + /// <summary> + /// The class <c>CHMBtree</c> implements methods/properties to decode the binary help index. + /// This class automatically creates an index arraylist for the current CHMFile instance. + /// It does not store the index internally ! + /// </summary> + /// <remarks>The binary index can be found in the storage file $WWKeywordLinks/BTree</remarks> + internal sealed class CHMBtree : IDisposable + { + /// <summary> + /// Constant specifying the size of the string blocks + /// </summary> + private const int BLOCK_SIZE = 2048; + /// <summary> + /// Internal flag specifying if the object is going to be disposed + /// </summary> + private bool disposed = false; + /// <summary> + /// Internal member storing the binary file data + /// </summary> + private byte[] _binaryFileData = null; + /// <summary> + /// Internal member storing flags + /// </summary> + private int _flags = 0; + /// <summary> + /// Internal member storing the data format + /// </summary> + private byte[] _dataFormat = new byte[16]; + /// <summary> + /// Internal member storing the index of the last listing block + /// </summary> + private int _indexOfLastListingBlock = 0; + /// <summary> + /// Internal member storing the index of the root block + /// </summary> + private int _indexOfRootBlock = 0; + /// <summary> + /// Internal member storing the number of blocks + /// </summary> + private int _numberOfBlocks = 0; + /// <summary> + /// Internal member storing the tree depth. + /// (1 if no index blocks, 2 one level of index blocks, ...) + /// </summary> + private int _treeDepth = 0; + /// <summary> + /// Internal member storing the number of keywords in the file + /// </summary> + private int _numberOfKeywords = 0; + /// <summary> + /// Internal member storing the codepage + /// </summary> + private int _codePage = 0; + /// <summary> + /// true if the index is from a CHI or CHM file, else CHW + /// </summary> + private bool _isCHI_CHM = true; + /// <summary> + /// Internal member storing the associated chmfile object + /// </summary> + private CHMFile _associatedFile = null; + /// <summary> + /// Internal flag specifying if we have to read listing or index blocks + /// </summary> + private bool _readListingBlocks = true; + /// <summary> + /// Internal member storing an indexlist of the current file. + /// </summary> + private ArrayList _indexList = new ArrayList(); + + /// <summary> + /// Constructor of the class + /// </summary> + /// <param name="binaryFileData">binary file data of the $WWKeywordLinks/BTree file</param> + /// <param name="associatedFile">associated chm file</param> + public CHMBtree(byte[] binaryFileData, CHMFile associatedFile) + { + if( associatedFile == null) + { + throw new ArgumentException("CHMBtree.ctor() - Associated CHMFile must not be null !", "associatedFile"); + } + + _binaryFileData = binaryFileData; + _associatedFile = associatedFile; + DecodeData(); + + // clear internal binary data after extraction + _binaryFileData = null; + } + + /// <summary> + /// Decodes the binary file data and fills the internal properties + /// </summary> + /// <returns>true if succeeded</returns> + private bool DecodeData() + { + bool bRet = true; + + MemoryStream memStream = new MemoryStream(_binaryFileData); + BinaryReader binReader = new BinaryReader(memStream); + + int nCurOffset = 0; + int nTemp = 0; + + // decode header + binReader.ReadChars(2); // 2chars signature (not important) + + _flags = (int)binReader.ReadInt16(); // WORD flags + + binReader.ReadInt16(); // size of blocks (always 2048) + + _dataFormat = binReader.ReadBytes(16); + + binReader.ReadInt32(); // unknown DWORD + + _indexOfLastListingBlock = binReader.ReadInt32(); + _indexOfRootBlock = binReader.ReadInt32(); + + binReader.ReadInt32(); // unknown DWORD + + _numberOfBlocks = binReader.ReadInt32(); + _treeDepth = binReader.ReadInt16(); + _numberOfKeywords = binReader.ReadInt32(); + _codePage = binReader.ReadInt32(); + + binReader.ReadInt32(); // lcid DWORD + + nTemp = binReader.ReadInt32(); + _isCHI_CHM = (nTemp==1); + + binReader.ReadInt32(); // unknown DWORD + binReader.ReadInt32(); // unknown DWORD + binReader.ReadInt32(); // unknown DWORD + binReader.ReadInt32(); // unknown DWORD + + // end of header decode + + while( (memStream.Position < memStream.Length) && (bRet) ) + { + nCurOffset = (int)memStream.Position; + byte [] dataBlock = binReader.ReadBytes(BLOCK_SIZE); + bRet &= DecodeBlock(dataBlock, ref nCurOffset, _treeDepth-1); + } + + return bRet; + } + + /// <summary> + /// Decodes a block of url-string data + /// </summary> + /// <param name="dataBlock">block of data</param> + /// <param name="nOffset">current file offset</param> + /// <param name="indexBlocks">number of index blocks</param> + /// <returns>true if succeeded</returns> + private bool DecodeBlock( byte[] dataBlock, ref int nOffset, int indexBlocks ) + { + bool bRet = true; + int nblockOffset = nOffset; + + MemoryStream memStream = new MemoryStream(dataBlock); + BinaryReader binReader = new BinaryReader(memStream); + + int freeSpace = binReader.ReadInt16(); // length of freespace + int nrOfEntries = binReader.ReadInt16(); // number of entries + + bool bListingEndReached = false; + + //while( (memStream.Position < (memStream.Length-freeSpace)) && (bRet) ) + //{ + int nIndexOfPrevBlock = -1; + int nIndexOfNextBlock = -1; + int nIndexOfChildBlock = 0; + + if(_readListingBlocks) + { + nIndexOfPrevBlock = binReader.ReadInt32(); // -1 if this is the header + nIndexOfNextBlock = binReader.ReadInt32(); // -1 if this is the last block + } + else + { + nIndexOfChildBlock = binReader.ReadInt32(); + } + + for(int nE = 0; nE < nrOfEntries; nE++) + { + if(_readListingBlocks) + { + bListingEndReached = (nIndexOfNextBlock==-1); + + string keyWord = BinaryReaderHelp.ExtractUTF16String(ref binReader, 0, true, _associatedFile.TextEncoding); + + bool isSeeAlsoKeyword = (binReader.ReadInt16()!=0); + + int indent = binReader.ReadInt16(); // indent of entry + int nCharIndex = binReader.ReadInt32(); + + binReader.ReadInt32(); + + int numberOfPairs = binReader.ReadInt32(); + + int[] nTopics = new int[numberOfPairs]; + string[] seeAlso = new string[numberOfPairs]; + + for(int i=0; i < numberOfPairs; i++) + { + if(isSeeAlsoKeyword) + { + seeAlso[i] = BinaryReaderHelp.ExtractUTF16String(ref binReader, 0, true, _associatedFile.TextEncoding); + } + else + { + nTopics[i] = binReader.ReadInt32(); + } + } + + binReader.ReadInt32(); // unknown + + int nIndexOfThisEntry = binReader.ReadInt32(); + + IndexItem newItem = new IndexItem(_associatedFile, keyWord, isSeeAlsoKeyword, indent, nCharIndex, nIndexOfThisEntry, seeAlso, nTopics); + _indexList.Add(newItem); + } + else + { + string keyWord = BinaryReaderHelp.ExtractUTF16String(ref binReader, 0, true, _associatedFile.TextEncoding); + + bool isSeeAlsoKeyword = (binReader.ReadInt16()!=0); + + int indent = binReader.ReadInt16(); // indent of entry + int nCharIndex = binReader.ReadInt32(); + + binReader.ReadInt32(); + + int numberOfPairs = binReader.ReadInt32(); + + int[] nTopics = new int[numberOfPairs]; + string[] seeAlso = new string[numberOfPairs]; + + for(int i=0; i < numberOfPairs; i++) + { + if(isSeeAlsoKeyword) + { + seeAlso[i] = BinaryReaderHelp.ExtractUTF16String(ref binReader, 0, true, _associatedFile.TextEncoding); + } + else + { + nTopics[i] = binReader.ReadInt32(); + } + } + + int nIndexChild = binReader.ReadInt32(); + int nIndexOfThisEntry=-1; + + IndexItem newItem = new IndexItem(_associatedFile, keyWord, isSeeAlsoKeyword, indent, nCharIndex, nIndexOfThisEntry, seeAlso, nTopics); + _indexList.Add(newItem); + + } + } + //} + + binReader.ReadBytes(freeSpace); + + + if( bListingEndReached ) + _readListingBlocks = false; + + return bRet; + } + + /// <summary> + /// Gets the internal generated index list + /// </summary> + internal ArrayList IndexList + { + get { return _indexList; } + } + + /// <summary> + /// Implement IDisposable. + /// </summary> + public void Dispose() + { + Dispose(true); + // This object will be cleaned up by the Dispose method. + // Therefore, you should call GC.SupressFinalize to + // take this object off the finalization queue + // and prevent finalization code for this object + // from executing a second time. + GC.SuppressFinalize(this); + } + + /// <summary> + /// Dispose(bool disposing) executes in two distinct scenarios. + /// If disposing equals true, the method has been called directly + /// or indirectly by a user's code. Managed and unmanaged resources + /// can be disposed. + /// If disposing equals false, the method has been called by the + /// runtime from inside the finalizer and you should not reference + /// other objects. Only unmanaged resources can be disposed. + /// </summary> + /// <param name="disposing">disposing flag</param> + private void Dispose(bool disposing) + { + // Check to see if Dispose has already been called. + if(!this.disposed) + { + // If disposing equals true, dispose all managed + // and unmanaged resources. + if(disposing) + { + // Dispose managed resources. + _binaryFileData = null; + } + } + disposed = true; + } + } +} _____ Added: trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMFile.cs --- trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMFile.cs 2005-01-15 19:15:45 UTC (rev 13063) +++ trunk/irc/TechBot/CHMLibrary/CHMDecoding/CHMFile.cs 2005-01-15 19:27:25 UTC (rev 13064) @@ -0,0 +1,2061 @@ +using System; +using System.Diagnostics; +using System.Collections; +using System.Collections.Specialized; +using System.IO; +using System.Text; +using System.Runtime.InteropServices; +using System.Globalization; +// using HtmlHelp.Storage; + +namespace HtmlHelp.ChmDecoding +{ + /// <summary> + /// Internal enumeration for specifying the type of the html-help file + /// </summary> + internal enum HtmlHelpFileType + { + /// <summary> + /// CHM - compiled contents file + /// </summary> + /// <remarks>A file with this extension must always exist. If the file would be too long, some parts + /// can be splitted into the filestypes below.</remarks> + CHM = 0, + /// <summary> + /// CHI - compiled system file + /// </summary> + CHI = 1, + /// <summary> + /// CHQ - compiled fulltext search file + /// </summary> + CHQ = 2, + /// <summary> + /// CHW - compiled index file + /// </summary> + CHW = 3 + + } + + /// <summary> + /// The class <c>CHMFile</c> implemts methods and properties for handling a single chmfile. + /// </summary> + public sealed class CHMFile : IDisposable + { + /// <summary> + /// Internal member storing a reference to the hosting HtmlHelpSystem instance + /// </summary> + private HtmlHelpSystem _systemInstance = null; + /// <summary> + /// Internal flag specifying if only system data has been loaded + /// </summary> + private bool _onlySystem = false; + /// <summary> + /// Internal flag specifying if the object is going to be disposed + /// </summary> + private bool disposed = false; + /// <summary> + /// Internal arraylist containing the table of contents + /// </summary> + private ArrayList _toc = new ArrayList(); + /// <summary> + /// Internal arraylist containing items of the toc which are merge-Links + /// </summary> + private ArrayList _mergeLinks = new ArrayList(); + /// <summary> + /// Internal member storing the read information types + /// </summary> + private ArrayList _informationTypes = new ArrayList(); + /// <summary> + /// Internal member storing the read categories + /// </summary> + private ArrayList _categories = new ArrayList(); + /// <summary> + /// Internal arraylist containing the index (klinks) + /// </summary> + private ArrayList _indexKLinks = new ArrayList(); + /// <summary> + /// Internal arraylist containing the index (alinks) + /// </summary> + private ArrayList _indexALinks = new ArrayList(); + /// <summary> + /// Internal member storing the full filename + /// </summary> + private string _chmFileName = ""; + /// <summary> + /// Internal member storing the full filename of the chi-file (includes all system files) + /// The file name is zero-length if there is no chi-file + /// </summary> + private string _chiFileName = ""; + /// <summary> + /// Internal member storing the full filename of the chw-file (includes the help index) + /// The file name is zero-length if there is no chw-file + /// </summary> + private string _chwFileName = ""; + /// <summary> + /// Internal member storing the full filename of the chq-file (includes the fulltext contents) + /// The file name is zero-length if there is no chq-file + /// </summary> + private string _chqFileName = ""; + /// <summary> + /// Internal member storing the decoded information from the internal #SYSTEM file + /// </summary> + private CHMSystem _systemFile = null; + /// <summary> + /// Internal member storing the decoded information from the internal #IDXHDR file + /// </summary> + private CHMIdxhdr _idxhdrFile = null; + /// <summary> + /// Internal member storing the decoded information from the internal #STRINGS file + /// </summary> + private CHMStrings _stringsFile = null; + /// <summary> + /// Internal member storing the decoded information from the internal #URLSTR file + /// </summary> + private CHMUrlstr _urlstrFile = null; + /// <summary> + /// Internal member storing the decoded information from the internal #URLTBL file + /// </summary> + private CHMUrltable _urltblFile = null; + /// <summary> + /// Internal member storing the decoded information from the internal #TOPICS file + /// </summary> + private CHMTopics _topicsFile = null; + /// <summary> + /// Internal member storing the decoded information from the internal #TOCIDX file + /// </summary> + private CHMTocidx _tocidxFile = null; + /// <summary> + /// Internal member storing the decoded information from the internal binary index file (KLinks). + /// </summary> + private CHMBtree _kLinks = null; + /// <summary> + /// Internal member storing the decoded information from the internal binary index file (ALinks). + /// </summary> + private CHMBtree _aLinks = null; + /// <summary> + /// Internal member storing the fulltext searcher for this file + /// </summary> + private FullTextEngine _ftSearcher = null; + /// <summary> + /// Internal member storing the default encoder + /// </summary> + private Encoding _textEncoding = Encoding.GetEncoding(1252); // standard windows-1252 encoder + /// <summary> + /// Internal memebr storing the chm file info + /// </summary> + private ChmFileInfo _chmFileInfo = null; + /// <summary> + /// Internal flag specifying if the dump must be written (if enabled) + /// </summary> + private bool _mustWriteDump = false; + /// <summary> + /// Internal flag specifying if data was read using the dump + /// </summary> + private bool _dumpRead = false; + /// <summary> + /// Internal member for specifying the number of dump-reading trys. + /// If dump-reading fails, this is used that it will not be opened a second time + /// (in CHM-Systems with CHM, CHI, etc. files) + /// </summary> + private int _dumpReadTrys = 0; + /// <summary> + /// Internal member storing the dumping info instance + /// </summary> + private DumpingInfo _dmpInfo = null; + + private CHMStream.CHMStream _currentWrapper; + private CHMStream.CHMStream _baseStream=null; + public CHMStream.CHMStream BaseStream + { + get + { + if (_baseStream==null) + _baseStream=new CHMStream.CHMStream(this.ChmFilePath); + return _baseStream; + } + } + + /// <summary> + /// Creates a new instance of the class + /// </summary> + /// <param name="systemInstance">a reference to the hosting HtmlHelpSystem instance</param> + /// <param name="chmFile">chm file to read</param> + public CHMFile(HtmlHelpSystem systemInstance, string chmFile) : this(systemInstance, chmFile, false, null) + { + } + + /// <summary> + /// Creates a new instance of the class + /// </summary> + /// <param name="systemInstance">a reference to the hosting HtmlHelpSystem instance</param> + /// <param name="chmFile">chm file to read</param> + /// <param name="dmpInfo">A dumping info class</param> + public CHMFile(HtmlHelpSystem systemInstance, string chmFile, DumpingInfo dmpInfo) : this(systemInstance, chmFile, false, dmpInfo) + { + } + + /// <summary> + /// Creates a new instance of the class + /// </summary> + /// <param name="systemInstance">a reference to the hosting HtmlHelpSystem instance</param> + /// <param name="chmFile">chm file to read</param> + /// <param name="onlySystemData">true if only system data should be extracted (no index or toc)</param> + internal CHMFile(HtmlHelpSystem systemInstance, string chmFile, bool onlySystemData) : this(systemInstance, chmFile, onlySystemData, null) + { + } + + /// <summary> + /// Creates a new instance of the class + /// </summary> + /// <param name="systemInstance">a reference to the hosting HtmlHelpSystem instance</param> + /// <param name="chmFile">chm file to read</param> + /// <param name="onlySystemData">true if only system data should be extracted (no index or toc)</param> + /// <param name="dmpInfo">A dumping info class</param> + internal CHMFile(HtmlHelpSystem systemInstance, string chmFile, bool onlySystemData, DumpingInfo dmpInfo) + { + _systemInstance = systemInstance; + _dumpReadTrys=0; + + _dmpInfo = dmpInfo; + if(dmpInfo != null) + { + dmpInfo.ChmFile = this; + } + + if( ! chmFile.ToLower().EndsWith(".chm") ) + { + throw new ArgumentException("HtmlHelp file must have the extension .chm !", "chmFile"); + } + + _chmFileName = chmFile; + _chiFileName = ""; + + // Read the IStorage file system + if( File.Exists(chmFile) ) + { + _onlySystem = onlySystemData; + + DateTime dtStartHH = DateTime.Now; + + string sCHIName = _chmFileName.Substring(0, _chmFileName.Length-3) + "chi"; + string sCHQName = _chmFileName.Substring(0, _chmFileName.Length-3) + "chq"; + string sCHWName = _chmFileName.Substring(0, _chmFileName.Length-3) + "chw"; + + // If there is a CHI file present (this file includes the internal system files for the current chm file) + if( File.Exists(sCHIName) ) + { + _chiFileName = sCHIName; + + ReadFile(_chiFileName, HtmlHelpFileType.CHI); + } + + // If there is a CHW file present (this file includes the internal binary index of the help) + if(( File.Exists(sCHWName) ) && (!_onlySystem) ) + { + _chwFileName = sCHWName; + + ReadFile(_chwFileName, HtmlHelpFileType.CHW); + } + + // If there is a CHQ file present (this file includes the fulltext-search data) + if(( File.Exists(sCHQName) ) && (!_onlySystem) ) + { + _chqFileName = sCHQName; + + ReadFile(_chqFileName, HtmlHelpFileType.CHQ); + } + + ReadFile(chmFile, HtmlHelpFileType.CHM); + + if(_mustWriteDump) + { + _mustWriteDump = !SaveDump(dmpInfo); + + } + + // check the default-topic setting + if(_systemFile.DefaultTopic.Length > 0) + { + CHMStream.CHMStream iw=null; + iw = new CHMStream.CHMStream(chmFile); + _currentWrapper=iw; + + // tryo to open the topic file + MemoryStream fileObject = iw.OpenStream( _systemFile.DefaultTopic); + if( fileObject != null) + { + // if succeed, the topic default topic is OK + fileObject.Close(); + } + else + { + // set the first topic of the toc-tree as default topic + if(_toc.Count > 0) + { + _systemFile.SetDefaultTopic( ((TOCItem) _toc[0]).Local ); + } + } + _currentWrapper=null; + } + else + { + // set the first topic of the toc-tree as default topic + if(_toc.Count > 0) + { + _systemFile.SetDefaultTopic( ((TOCItem) _toc[0]).Local ); + } + } + + _chmFileInfo = new ChmFileInfo(this); + } + else + { + throw new ArgumentException("File '" + chmFile + "' not found !", "chmFile"); + } + } + + /// <summary> + /// Read a IStorage file + /// </summary> + /// <param name="fname">filename</param> + /// <param name="type">type of file</param> + private void ReadFile(string fname, HtmlHelpFileType type) + { + CHMStream.CHMStream iw=null; + iw=new CHMStream.CHMStream(); + iw.OpenCHM(fname); + _currentWrapper=iw; + MemoryStream fileObject=null; + + // ITStorageWrapper iw = null; + + // Open the internal chm system files and parse their content + // FileObject fileObject = null; + // iw = new ITStorageWrapper(fname, false); + + if( (type != HtmlHelpFileType.CHQ) && (type != HtmlHelpFileType.CHW) ) + { + fileObject = iw.OpenStream("#SYSTEM"); + if ((fileObject != null) && (fileObject.Length>0)) + _systemFile = new CHMSystem(fileObject.ToArray(), this); + + fileObject = iw.OpenStream("#IDXHDR"); + if ((fileObject != null) && (fileObject.Length>0)) + _idxhdrFile = new CHMIdxhdr(fileObject.ToArray(), this); + + // try to read Dump + if((!_dumpRead)&&(CheckDump(_dmpInfo))&&(_dumpReadTrys==0)) + { + _dumpReadTrys++; [truncated at 1000 lines; 23868 more skipped]
19 years, 10 months
1
0
0
0
[chorns] 13063: Move Arch to irc module.
by chorns@svn.reactos.com
Move Arch to irc module. Added: trunk/irc/ Added: trunk/irc/ArchBlackmann/ Deleted: trunk/irc/ArchBlackmann/.cvsignore Deleted: trunk/rosapps/games/ArchBlackmann/ _____ Copied: trunk/irc/ArchBlackmann (from rev 13062, trunk/rosapps/games/ArchBlackmann) _____ Deleted: trunk/irc/ArchBlackmann/.cvsignore --- trunk/rosapps/games/ArchBlackmann/.cvsignore 2005-01-15 19:00:35 UTC (rev 13062) +++ trunk/irc/ArchBlackmann/.cvsignore 2005-01-15 19:15:45 UTC (rev 13063) @@ -1,5 +0,0 @@ -*.ncb -*.opt -*.plg -Debug -Release \ No newline at end of file
19 years, 10 months
1
0
0
0
[chorns] 13062: * Use objects rather than archive when linking ntoskrnl
by chorns@svn.reactos.com
* Use objects rather than archive when linking ntoskrnl * Remove unused file except.s * Remove duplicate strtok() in ntoskrnl Modified: branches/xmlbuildsystem/reactos/ntoskrnl/kd/gdbstub.c Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml Deleted: branches/xmlbuildsystem/reactos/ntoskrnl/rtl/i386/except.s Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h _____ Modified: branches/xmlbuildsystem/reactos/ntoskrnl/kd/gdbstub.c --- branches/xmlbuildsystem/reactos/ntoskrnl/kd/gdbstub.c 2005-01-15 17:59:06 UTC (rev 13061) +++ branches/xmlbuildsystem/reactos/ntoskrnl/kd/gdbstub.c 2005-01-15 19:00:35 UTC (rev 13062) @@ -163,56 +163,6 @@ "Blocked" /* THREAD_STATE_BLOCKED */ }; -char * -strtok(char *s, const char *delim) -{ - const char *spanp; - int c, sc; - char *tok; - static char *last; - - - if (s == NULL && (s = last) == NULL) - return (NULL); - - /* - * Skip (span) leading delimiters (s += strspn(s, delim), sort of). - */ - cont: - c = *s++; - for (spanp = delim; (sc = *spanp++) != 0;) { - if (c == sc) - goto cont; - } - - if (c == 0) { /* no non-delimiter characters */ - last = NULL; - return (NULL); - } - tok = s - 1; - - /* - * Scan token (scan for delimiters: s += strcspn(s, delim), sort of). - * Note that delim must have one NUL; we stop if we see that, too. - */ - for (;;) { - c = *s++; - spanp = delim; - do { - if ((sc = *spanp++) == c) { - if (c == 0) - s = NULL; - else - s[-1] = 0; - last = s; - return (tok); - } - } while (sc != 0); - } - /* NOTREACHED */ -} - - LONG HexValue (CHAR ch) { _____ Modified: branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml --- branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml 2005-01-15 17:59:06 UTC (rev 13061) +++ branches/xmlbuildsystem/reactos/ntoskrnl/ntoskrnl.xml 2005-01-15 19:00:35 UTC (rev 13062) @@ -345,7 +345,6 @@ <file>aulldiv.s</file> <file>aullrem.s</file> <file>aullshr.s</file> - <file>except.s</file> <file>exception.c</file> <file>seh.s</file> </directory> _____ Deleted: branches/xmlbuildsystem/reactos/ntoskrnl/rtl/i386/except.s --- branches/xmlbuildsystem/reactos/ntoskrnl/rtl/i386/except.s 2005-01-15 17:59:06 UTC (rev 13061) +++ branches/xmlbuildsystem/reactos/ntoskrnl/rtl/i386/except.s 2005-01-15 19:00:35 UTC (rev 13062) @@ -1,291 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Kernel-mode exception support for IA-32 - * FILE: ntoskrnl/rtl/i386/except.s - * PROGRAMER: Casper S. Hornstrup (chorns(a)users.sourceforge.net) - * NOTES: This file is shared with lib/ntdll/rtl/i386/except.s. - * Please keep them in sync. - */ - -#define EXCEPTION_UNWINDING 0x02 - -#define EREC_FLAGS 0x04 - -#define ExceptionContinueExecution 0 -#define ExceptionContinueSearch 1 -#define ExceptionNestedException 2 -#define ExceptionCollidedUnwind 3 - -.globl _RtlpExecuteHandlerForException -.globl _RtlpExecuteHandlerForUnwind - -#define CONTEXT_FLAGS 0x00 -#define CONTEXT_SEGGS 0x8C -#define CONTEXT_SEGFS 0x90 -#define CONTEXT_SEGES 0x94 -#define CONTEXT_SEGDS 0x98 -#define CONTEXT_EDI 0x9C -#define CONTEXT_ESI 0xA0 -#define CONTEXT_EBX 0xA4 -#define CONTEXT_EDX 0xA8 -#define CONTEXT_ECX 0xAC -#define CONTEXT_EAX 0xB0 -#define CONTEXT_EBP 0xB4 -#define CONTEXT_EIP 0xB8 -#define CONTEXT_SEGCS 0xBC -#define CONTEXT_EFLAGS 0xC0 -#define CONTEXT_ESP 0xC4 -#define CONTEXT_SEGSS 0xC8 - - -#define RCC_CONTEXT 0x08 - -// EAX = value to print -_do_debug: - pushal - pushl %eax - call _AsmDebug@4 - popal - ret - -#ifndef __NTOSKRNL__ - -// -// VOID -// RtlpCaptureContext(PCONTEXT pContext); -// -// Parameters: -// [ESP+08h] - PCONTEXT_X86 pContext -// Registers: -// None -// Returns: -// Nothing -// Notes: -// Grabs the current CPU context. -.globl _RtlpCaptureContext -_RtlpCaptureContext: - pushl %ebp - movl %esp, %ebp - movl RCC_CONTEXT(%ebp), %edx // EDX = Address of context structure - - cld - pushf - pop %eax - movl %eax, CONTEXT_EFLAGS(%edx) - xorl %eax, %eax - movl %eax, CONTEXT_EAX(%edx) - movl %eax, CONTEXT_EBX(%edx) - movl %eax, CONTEXT_ECX(%edx) - movl %eax, CONTEXT_EDX(%edx) - movl %eax, CONTEXT_ESI(%edx) - movl %eax, CONTEXT_EDI(%edx) - movl %cs, %eax - movl %eax, CONTEXT_SEGCS(%edx) - movl %ds, %eax - movl %eax, CONTEXT_SEGDS(%edx) - movl %es, %eax - movl %eax, CONTEXT_SEGES(%edx) - movl %fs, %eax - movl %eax, CONTEXT_SEGFS(%edx) - movl %gs, %eax - movl %eax, CONTEXT_SEGGS(%edx) - movl %ss, %eax - movl %eax, CONTEXT_SEGSS(%edx) - - // - // STACK LAYOUT: - (ESP to put in context structure) - // - RETURN ADDRESS OF CALLER OF CALLER - // - EBP OF CALLER OF CALLER - // ... - // - RETURN ADDRESS OF CALLER - // - EBP OF CALLER - // ... - // - - // Get return address of the caller of the caller of this function - movl %ebp, %ebx - //movl 4(%ebx), %eax // EAX = return address of caller - movl (%ebx), %ebx // EBX = EBP of caller - - movl 4(%ebx), %eax // EAX = return address of caller of caller - movl (%ebx), %ebx // EBX = EBP of caller of caller - - movl %eax, CONTEXT_EIP(%edx) // EIP = return address of caller of caller - movl %ebx, CONTEXT_EBP(%edx) // EBP = EBP of caller of caller - addl $8, %ebx - movl %ebx, CONTEXT_ESP(%edx) // ESP = EBP of caller of caller + 8 - - movl %ebp, %esp - popl %ebp - ret - -#endif /* !__NTOSKRNL__ */ - -#define REH_ERECORD 0x08 -#define REH_RFRAME 0x0C -#define REH_CONTEXT 0x10 -#define REH_DCONTEXT 0x14 -#define REH_EROUTINE 0x18 - -// Parameters: -// None -// Registers: -// [EBP+08h] - PEXCEPTION_RECORD ExceptionRecord -// [EBP+0Ch] - PEXCEPTION_REGISTRATION RegistrationFrame -// [EBP+10h] - PVOID Context -// [EBP+14h] - PVOID DispatcherContext -// [EBP+18h] - PEXCEPTION_HANDLER ExceptionRoutine -// EDX - Address of protecting exception handler -// Returns: -// EXCEPTION_DISPOSITION -// Notes: -// Setup the protecting exception handler and call the exception -// handler in the right context. -_RtlpExecuteHandler: - pushl %ebp - movl %esp, %ebp - pushl REH_RFRAME(%ebp) - - pushl %edx - pushl %fs:0x0 - movl %esp, %fs:0x0 - - // Prepare to call the exception handler - pushl REH_DCONTEXT(%ebp) - pushl REH_CONTEXT(%ebp) - pushl REH_RFRAME(%ebp) - pushl REH_ERECORD(%ebp) - - // Now call the exception handler - movl REH_EROUTINE(%ebp), %eax - call *%eax - - cmpl $-1, %fs:0x0 - jne .reh_stack_looks_ok - - // This should not happen - pushl 0 - pushl 0 - pushl 0 - pushl 0 - call _RtlAssert@16 - -.reh_loop: - jmp .reh_loop - -.reh_stack_looks_ok: - movl %fs:0x0, %esp - - // Return to the 'front-end' for this function - popl %fs:0x0 - movl %ebp, %esp - popl %ebp - ret - - -#define REP_ERECORD 0x04 -#define REP_RFRAME 0x08 -#define REP_CONTEXT 0x0C -#define REP_DCONTEXT 0x10 - -// Parameters: -// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord -// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame -// [ESP+0Ch] - PCONTEXT Context -// [ESP+10h] - PVOID DispatcherContext -// Registers: -// None -// Returns: -// EXCEPTION_DISPOSITION -// Notes: -// This exception handler protects the exception handling -// mechanism by detecting nested exceptions. -_RtlpExceptionProtector: - movl $ExceptionContinueSearch, %eax - movl REP_ERECORD(%esp), %ecx - testl $EXCEPTION_UNWINDING, EREC_FLAGS(%ecx) - jnz .rep_end - - // Unwinding is not taking place, so return ExceptionNestedException - - // Set DispatcherContext field to the exception registration for the - // exception handler that executed when a nested exception occurred - movl REP_DCONTEXT(%esp), %ecx - movl REP_RFRAME(%esp), %eax - movl %eax, (%ecx) - movl $ExceptionNestedException, %eax - -.rep_end: - ret - - -// Parameters: -// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord -// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame -// [ESP+0Ch] - PCONTEXT Context -// [ESP+10h] - PVOID DispatcherContext -// [ESP+14h] - PEXCEPTION_HANDLER ExceptionHandler -// Registers: -// None -// Returns: -// EXCEPTION_DISPOSITION -// Notes: -// Front-end -_RtlpExecuteHandlerForException: - movl $_RtlpExceptionProtector, %edx - jmp _RtlpExecuteHandler - - -#define RUP_ERECORD 0x04 -#define RUP_RFRAME 0x08 -#define RUP_CONTEXT 0x0C -#define RUP_DCONTEXT 0x10 - -// Parameters: -// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord -// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame -// [ESP+0Ch] - PCONTEXT Context -// [ESP+10h] - PVOID DispatcherContext -// Registers: -// None -// Returns: -// EXCEPTION_DISPOSITION -// Notes: -// This exception handler protects the exception handling -// mechanism by detecting collided unwinds. -_RtlpUnwindProtector: - movl $ExceptionContinueSearch, %eax - movl %ecx, RUP_ERECORD(%esp) - testl $EXCEPTION_UNWINDING, EREC_FLAGS(%ecx) - jz .rup_end - - // Unwinding is taking place, so return ExceptionCollidedUnwind - - movl RUP_RFRAME(%esp), %ecx - movl RUP_DCONTEXT(%esp), %edx - - // Set DispatcherContext field to the exception registration for the - // exception handler that executed when a collision occurred - movl RUP_RFRAME(%ecx), %eax - movl %eax, (%edx) - movl $ExceptionCollidedUnwind, %eax - -.rup_end: - ret - - -// Parameters: -// [ESP+04h] - PEXCEPTION_RECORD ExceptionRecord -// [ESP+08h] - PEXCEPTION_REGISTRATION RegistrationFrame -// [ESP+0Ch] - PCONTEXT Context -// [ESP+10h] - PVOID DispatcherContext -// [ESP+14h] - PEXCEPTION_HANDLER ExceptionHandler -// Registers: -// None -// Returns: -// EXCEPTION_DISPOSITION -_RtlpExecuteHandlerForUnwind: - movl $_RtlpUnwindProtector, %edx - jmp _RtlpExecuteHandler _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-15 17:59:06 UTC (rev 13061) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-15 19:00:35 UTC (rev 13062) @@ -588,6 +588,13 @@ } string +MingwModuleHandler::GetObjectsMacro ( const Module& module ) const +{ + return ssprintf ( "$(%s_OBJS)", + module.name.c_str () ); +} + +string MingwModuleHandler::GetLinkerMacro ( const Module& module ) const { return ssprintf ( "$(%s_LFLAGS)", @@ -840,9 +847,9 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module ) { static string ros_junk ( "$(ROS_TEMPORARY)" ); - string target ( FixupTargetFilename(module.GetPath()) ); - string workingDirectory = GetWorkingDirectory ( ); - string archiveFilename = GetModuleArchiveFilename ( module ); + string target ( FixupTargetFilename (module.GetPath ()) ); + string workingDirectory = GetWorkingDirectory (); + string objectsMacro = GetObjectsMacro ( module ); string importLibraryDependencies = GetImportLibraryDependencies ( module ); string base_tmp = ros_junk + module.name + ".base.tmp"; string junk_tmp = ros_junk + module.name + ".junk.tmp"; @@ -854,7 +861,7 @@ fprintf ( fMakefile, "%s: %s %s\n", target.c_str (), - archiveFilename.c_str (), + objectsMacro.c_str (), importLibraryDependencies.c_str () ); fprintf ( fMakefile, "\t${gcc} %s %s -Wl,--base-file,%s -o %s %s %s\n", @@ -862,7 +869,7 @@ gccOptions.c_str (), base_tmp.c_str (), junk_tmp.c_str (), - archiveFilename.c_str (), + objectsMacro.c_str (), importLibraryDependencies.c_str () ); fprintf ( fMakefile, "\t${rm} %s\n", @@ -871,7 +878,6 @@ "\t${dlltool} --dllname %s --base-file %s --def ntoskrnl/ntoskrnl.def --output-exp %s --kill-at\n", target.c_str (), base_tmp.c_str (), - //FixupTargetFilename ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (), temp_exp.c_str () ); fprintf ( fMakefile, "\t${rm} %s\n", @@ -882,7 +888,7 @@ gccOptions.c_str (), temp_exp.c_str (), target.c_str (), - archiveFilename.c_str (), + objectsMacro.c_str (), importLibraryDependencies.c_str () ); fprintf ( fMakefile, "\t${rm} %s\n\n", _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-15 17:59:06 UTC (rev 13061) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-15 19:00:35 UTC (rev 13062) @@ -36,6 +36,7 @@ std::string GetInvocationParameters ( const Invoke& invoke ) const; void GenerateInvocations ( const Module& module ) const; void GeneratePreconditionDependencies ( const Module& module ) const; + std::string GetObjectsMacro ( const Module& module ) const; std::string GetLinkerMacro ( const Module& module ) const; std::string GenerateMacros ( const Module& module, const std::string& cflags_macro,
19 years, 10 months
1
0
0
0
[chorns] 13061: If test
by chorns@svn.reactos.com
If test Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile Modified: branches/xmlbuildsystem/reactos/tools/rbuild/test.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/if.xml Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile --- branches/xmlbuildsystem/reactos/tools/rbuild/makefile 2005-01-15 16:42:28 UTC (rev 13060) +++ branches/xmlbuildsystem/reactos/tools/rbuild/makefile 2005-01-15 17:59:06 UTC (rev 13061) @@ -27,6 +27,7 @@ TESTS = \ tests/definetest.o \ + tests/iftest.o \ tests/includetest.o \ tests/invoketest.o \ tests/linkerflagtest.o \ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/test.h --- branches/xmlbuildsystem/reactos/tools/rbuild/test.h 2005-01-15 16:42:28 UTC (rev 13060) +++ branches/xmlbuildsystem/reactos/tools/rbuild/test.h 2005-01-15 17:59:06 UTC (rev 13061) @@ -81,10 +81,18 @@ void Run(); }; + class LinkerFlagTest : public BaseTest { public: void Run(); }; + +class IfTest : public BaseTest +{ +public: + void Run(); +}; + #endif /* __TEST_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp 2005-01-15 16:42:28 UTC (rev 13060) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp 2005-01-15 17:59:06 UTC (rev 13061) @@ -175,6 +175,7 @@ tests.push_back(new IncludeTest()); tests.push_back(new InvokeTest()); tests.push_back(new LinkerFlagTest()); + tests.push_back(new IfTest()); } }; _____ Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/if.xml --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/if.xml 2005-01-15 16:42:28 UTC (rev 13060) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/if.xml 2005-01-15 17:59:06 UTC (rev 13061) @@ -0,0 +1,9 @@ +<?xml version="1.0" ?> +<project name="Project" makefile="Makefile"> + <module name="module1" type="buildtool"> + <if property="VAR1" value="value1"> + <file>file1.c</file> + </if> + <file>file2.c</file> + </module> +</project> _____ Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp 2005-01-15 16:42:28 UTC (rev 13060) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp 2005-01-15 17:59:06 UTC (rev 13061) @@ -0,0 +1,25 @@ +#include "test.h" + +using std::string; + +void IfTest::Run() +{ + string projectFilename ( "tests/data/if.xml" ); + Project project ( projectFilename ); + + ARE_EQUAL ( 1, project.modules.size () ); + Module& module1 = *project.modules[0]; + + ARE_EQUAL ( 1, module1.ifs.size () ); + If& if1 = *module1.ifs[0]; + ARE_EQUAL ( "VAR1", if1.property ); + ARE_EQUAL ( "value1", if1.value ); + + ARE_EQUAL ( 1, if1.files.size () ); + File& file1 = *if1.files[0]; + ARE_EQUAL( "." SSEP "file1.c", file1.name ); + + ARE_EQUAL ( 1, module1.files.size () ); + File& file2 = *module1.files[0]; + ARE_EQUAL( "." SSEP "file2.c", file2.name ); +}
19 years, 10 months
1
0
0
0
[weiden] 13060: janitory work
by weiden@svn.reactos.com
janitory work Modified: trunk/reactos/lib/psapi/makefile Deleted: trunk/reactos/lib/psapi/misc/ Added: trunk/reactos/lib/psapi/psapi.c Deleted: trunk/reactos/lib/psapi/win32.c _____ Modified: trunk/reactos/lib/psapi/makefile --- trunk/reactos/lib/psapi/makefile 2005-01-15 16:35:30 UTC (rev 13059) +++ trunk/reactos/lib/psapi/makefile 2005-01-15 16:42:28 UTC (rev 13060) @@ -19,7 +19,7 @@ TARGET_PCH = precomp.h -TARGET_OBJECTS = misc/dllmain.o malloc.o win32.o +TARGET_OBJECTS = malloc.o psapi.o DEP_OBJECTS = $(TARGET_OBJECTS) _____ Copied: trunk/reactos/lib/psapi/psapi.c (from rev 13059, trunk/reactos/lib/psapi/win32.c) --- trunk/reactos/lib/psapi/win32.c 2005-01-15 16:35:30 UTC (rev 13059) +++ trunk/reactos/lib/psapi/psapi.c 2005-01-15 16:42:28 UTC (rev 13060) @@ -0,0 +1,1411 @@ +/* $Id$ + */ +/* + * COPYRIGHT: See COPYING in the top level directory + * LICENSE: See LGPL.txt in the top level directory + * PROJECT: ReactOS system libraries + * FILE: reactos/lib/psapi/misc/win32.c + * PURPOSE: Win32 interfaces for PSAPI + * PROGRAMMER: KJK::Hyperion <noog(a)libero.it> + * Thomas Weidenmueller <w3seek(a)reactos.com> + * UPDATE HISTORY: + * 10/06/2002: Created + */ + +#include "precomp.h" + +#define NDEBUG +#include <debug.h> + +BOOLEAN +WINAPI +DllMain(HINSTANCE hDllHandle, + DWORD nReason, + LPVOID Reserved) +{ + switch(nReason) + { + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hDllHandle); + break; + } + + return TRUE; +} + +/* INTERNAL *******************************************************************/ + +typedef struct _ENUM_DEVICE_DRIVERS_CONTEXT +{ + LPVOID *lpImageBase; + DWORD nCount; +} ENUM_DEVICE_DRIVERS_CONTEXT, *PENUM_DEVICE_DRIVERS_CONTEXT; + +NTSTATUS STDCALL +EnumDeviceDriversCallback(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule, + IN OUT PVOID CallbackContext) +{ + PENUM_DEVICE_DRIVERS_CONTEXT Context = (PENUM_DEVICE_DRIVERS_CONTEXT)CallbackContext; + + /* no more buffer space */ + if(Context->nCount == 0) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + + /* return current module */ + *Context->lpImageBase = CurrentModule->Base; + + /* go to next array slot */ + Context->lpImageBase++; + Context->nCount--; + + return STATUS_SUCCESS; +} + + +typedef struct _ENUM_PROCESSES_CONTEXT +{ + DWORD *lpidProcess; + DWORD nCount; +} ENUM_PROCESSES_CONTEXT, *PENUM_PROCESSES_CONTEXT; + +NTSTATUS STDCALL +EnumProcessesCallback(IN PSYSTEM_PROCESSES CurrentProcess, + IN OUT PVOID CallbackContext) +{ + PENUM_PROCESSES_CONTEXT Context = (PENUM_PROCESSES_CONTEXT)CallbackContext; + + /* no more buffer space */ + if(Context->nCount == 0) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + + /* return current process */ + *Context->lpidProcess = CurrentProcess->ProcessId; + + /* go to next array slot */ + Context->lpidProcess++; + Context->nCount--; + + return STATUS_SUCCESS; +} + + +typedef struct _ENUM_PROCESS_MODULES_CONTEXT +{ + HMODULE *lphModule; + DWORD nCount; +} ENUM_PROCESS_MODULES_CONTEXT, *PENUM_PROCESS_MODULES_CONTEXT; + +NTSTATUS STDCALL +EnumProcessModulesCallback(IN HANDLE ProcessHandle, + IN PLDR_MODULE CurrentModule, + IN OUT PVOID CallbackContext) +{ + PENUM_PROCESS_MODULES_CONTEXT Context = (PENUM_PROCESS_MODULES_CONTEXT)CallbackContext; + + /* no more buffer space */ + if(Context->nCount == 0) + { + return STATUS_INFO_LENGTH_MISMATCH; + } + + /* return current process */ + *Context->lphModule = CurrentModule->BaseAddress; + + /* go to next array slot */ + Context->lphModule++; + Context->nCount--; + + return STATUS_SUCCESS; +} + + +typedef struct _GET_DEVICE_DRIVER_NAME_CONTEXT +{ + LPVOID ImageBase; + struct + { + ULONG bFullName : sizeof(ULONG) * 8 / 2; + ULONG bUnicode : sizeof(ULONG) * 8 / 2; + }; + DWORD nSize; + union + { + LPVOID lpName; + LPSTR lpAnsiName; + LPWSTR lpUnicodeName; + }; +} GET_DEVICE_DRIVER_NAME_CONTEXT, *PGET_DEVICE_DRIVER_NAME_CONTEXT; + +NTSTATUS STDCALL +GetDeviceDriverNameCallback(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule, + IN OUT PVOID CallbackContext) +{ + PGET_DEVICE_DRIVER_NAME_CONTEXT Context = (PGET_DEVICE_DRIVER_NAME_CONTEXT)CallbackContext; + + /* module found */ + if(Context->ImageBase == CurrentModule->Base) + { + PCHAR pcModuleName; + ULONG l; + + /* get the full name or just the filename part */ + if(Context->bFullName) + pcModuleName = &CurrentModule->ImageName[0]; + else + pcModuleName = &CurrentModule->ImageName[CurrentModule->PathLength]; + + /* get the length of the name */ + l = strlen(pcModuleName); + + if(Context->nSize <= l) + { + /* use the user buffer's length */ + l = Context->nSize; + } + else + { + /* enough space for the null terminator */ + Context->nSize = ++l; + } + + /* copy the string */ + if(Context->bUnicode) + { + ANSI_STRING AnsiString; + UNICODE_STRING UnicodeString; + + UnicodeString.Length = 0; + UnicodeString.MaximumLength = l * sizeof(WCHAR); + UnicodeString.Buffer = Context->lpUnicodeName; + + RtlInitAnsiString(&AnsiString, pcModuleName); + /* driver names should always be in language-neutral ASCII, so we don't + bother calling AreFileApisANSI() */ + RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE); + } + else + { + memcpy(Context->lpAnsiName, pcModuleName, l); + } + + /* terminate the enumeration */ + return STATUS_NO_MORE_FILES; + } + else + { + /* continue searching */ + return STATUS_SUCCESS; + } +} + + +static DWORD +InternalGetDeviceDriverName(BOOLEAN bUnicode, + BOOLEAN bFullName, + LPVOID ImageBase, + LPVOID lpName, + DWORD nSize) +{ + GET_DEVICE_DRIVER_NAME_CONTEXT Context; + NTSTATUS Status; + + if(lpName == NULL || nSize == 0) + { + return 0; + } + + if(ImageBase == NULL) + { + SetLastError(ERROR_INVALID_HANDLE); + return 0; + } + + Context.ImageBase = ImageBase; + Context.bFullName = bFullName; + Context.bUnicode = bUnicode; + Context.nSize = nSize; + Context.lpName = lpName; + + /* start the enumeration */ + Status = PsaEnumerateSystemModules(GetDeviceDriverNameCallback, &Context); + + if(Status == STATUS_NO_MORE_FILES) + { + /* module was found, return string size */ + return Context.nSize; + } + else if(NT_SUCCESS(Status)) + { + /* module was not found */ + SetLastError(ERROR_INVALID_HANDLE); + } + else + { + /* an error occurred */ + SetLastErrorByStatus(Status); + } + return 0; +} + + +static DWORD +InternalGetMappedFileName(BOOLEAN bUnicode, + HANDLE hProcess, + LPVOID lpv, + LPVOID lpName, + DWORD nSize) +{ + PMEMORY_SECTION_NAME pmsnName; + ULONG nBufSize; + NTSTATUS Status; + + if(nSize == 0 || lpName == NULL) + { + return 0; + } + + if(nSize > (0xFFFF / sizeof(WCHAR))) + { + /* if the user buffer contains more characters than would fit in an + UNICODE_STRING, limit the buffer size. RATIONALE: we don't limit buffer + size elsewhere because here superfluous buffer size will mean a larger + temporary buffer */ + nBufSize = 0xFFFF / sizeof(WCHAR); + } + else + { + nBufSize = nSize * sizeof(WCHAR); + } + + /* allocate the memory */ + pmsnName = PsaiMalloc(nBufSize + offsetof(MEMORY_SECTION_NAME, NameBuffer)); + + if(pmsnName == NULL) + { + SetLastError(ERROR_OUTOFMEMORY); + return 0; + } + + /* initialize the destination buffer */ + pmsnName->SectionFileName.Length = 0; + pmsnName->SectionFileName.Length = nBufSize; + +#if 0 + __try + { +#endif + /* query the name */ + Status = NtQueryVirtualMemory(hProcess, + lpv, + MemorySectionName, + pmsnName, + nBufSize, + NULL); + if(!NT_SUCCESS(Status)) + { + PsaiFree(pmsnName); + SetLastErrorByStatus(Status); + return 0; + } + + if(bUnicode) + { + /* destination is an Unicode string: direct copy */ + memcpy((LPWSTR)lpName, pmsnName->NameBuffer, pmsnName->SectionFileName.Length); + + PsaiFree(pmsnName); + + if(pmsnName->SectionFileName.Length < nSize) + { + /* null-terminate the string */ + ((LPWSTR)lpName)[pmsnName->SectionFileName.Length] = 0; + return pmsnName->SectionFileName.Length + 1; + } + + return pmsnName->SectionFileName.Length; + } + else + { + ANSI_STRING AnsiString; + + AnsiString.Length = 0; + AnsiString.MaximumLength = nSize; + AnsiString.Buffer = (LPSTR)lpName; + + if(AreFileApisANSI()) + RtlUnicodeStringToAnsiString(&AnsiString, &pmsnName->SectionFileName, FALSE); + else + RtlUnicodeStringToOemString(&AnsiString, &pmsnName->SectionFileName, FALSE); + + PsaiFree(pmsnName); + + if(AnsiString.Length < nSize) + { + /* null-terminate the string */ + ((LPSTR)lpName)[AnsiString.Length] = 0; + return AnsiString.Length + 1; + } + + return AnsiString.Length; + } + +#if 0 + } + __finally + { + PsaiFree(pmsnName); + } +#endif +} + + +typedef struct _GET_MODULE_INFORMATION_FLAGS +{ + ULONG bWantName : sizeof(ULONG) * 8 / 4; + ULONG bUnicode : sizeof(ULONG) * 8 / 4; + ULONG bFullName : sizeof(ULONG) * 8 / 4; +} GET_MODULE_INFORMATION_FLAGS, *PGET_MODULE_INFORMATION_FLAGS; + +typedef struct _GET_MODULE_INFORMATION_CONTEXT +{ + HMODULE hModule; + GET_MODULE_INFORMATION_FLAGS Flags; + DWORD nBufSize; + union + { + LPWSTR lpUnicodeName; + LPSTR lpAnsiName; + LPMODULEINFO lpmodinfo; + LPVOID lpBuffer; + }; +} GET_MODULE_INFORMATION_CONTEXT, *PGET_MODULE_INFORMATION_CONTEXT; + +NTSTATUS STDCALL +GetModuleInformationCallback(IN HANDLE ProcessHandle, + IN PLDR_MODULE CurrentModule, + IN OUT PVOID CallbackContext) +{ + PGET_MODULE_INFORMATION_CONTEXT Context = (PGET_MODULE_INFORMATION_CONTEXT)CallbackContext; + + /* found the module we were looking for */ + if(CurrentModule->BaseAddress == Context->hModule) + { + /* we want the module name */ + if(Context->Flags.bWantName) + { + PUNICODE_STRING SourceString; + ULONG l; + NTSTATUS Status; + + if(Context->Flags.bFullName) + SourceString = &(CurrentModule->FullDllName); + else + SourceString = &(CurrentModule->BaseDllName); + + SourceString->Length -= SourceString->Length % sizeof(WCHAR); + + /* l is the byte size of the user buffer */ + l = Context->nBufSize * sizeof(WCHAR); + + /* if the user buffer has room for the string and a null terminator */ + if(l >= (SourceString->Length + sizeof(WCHAR))) + { + /* limit the buffer size */ + l = SourceString->Length; + + /* null-terminate the string */ + if(Context->Flags.bUnicode) + Context->lpUnicodeName[l / sizeof(WCHAR)] = 0; + else + Context->lpAnsiName[l / sizeof(WCHAR)] = 0; + } + + if(Context->Flags.bUnicode) + { + /* Unicode: direct copy */ + /* NOTE: I've chosen not to check for ProcessHandle == NtCurrentProcess(), + this function is complicated enough as it is */ + Status = NtReadVirtualMemory(ProcessHandle, + SourceString->Buffer, + Context->lpUnicodeName, + l, + NULL); + + if(!NT_SUCCESS(Status)) + { + Context->nBufSize = 0; + return Status; + } + + Context->nBufSize = l / sizeof(WCHAR); + } + else + { + /* ANSI/OEM: convert and copy */ + LPWSTR pwcUnicodeBuf; + ANSI_STRING AnsiString; + UNICODE_STRING UnicodeString; + + AnsiString.Length = 0; + AnsiString.MaximumLength = Context->nBufSize; + AnsiString.Buffer = Context->lpAnsiName; + + /* allocate the local buffer */ + pwcUnicodeBuf = PsaiMalloc(SourceString->Length); + +#if 0 + __try + { +#endif + if(pwcUnicodeBuf == NULL) + { + Status = STATUS_NO_MEMORY; + goto exitWithStatus; + } + + /* copy the string in the local buffer */ + Status = NtReadVirtualMemory(ProcessHandle, + SourceString->Buffer, + pwcUnicodeBuf, + l, + NULL); + + if(!NT_SUCCESS(Status)) + { + goto exitWithStatus; + } + + /* initialize Unicode string buffer */ + UnicodeString.Length = UnicodeString.MaximumLength = l; + UnicodeString.Buffer = pwcUnicodeBuf; + + /* convert and copy */ + if(AreFileApisANSI()) + RtlUnicodeStringToAnsiString(&AnsiString, &UnicodeString, FALSE); + else + RtlUnicodeStringToOemString(&AnsiString, &UnicodeString, FALSE); + + /* return the string size */ + Context->nBufSize = AnsiString.Length; +#if 0 + } + __finally + { + /* free the buffer */ + PsaiFree(pwcUnicodeBuf); + } +#else + Status = STATUS_NO_MORE_FILES; + +exitWithStatus: + /* free the buffer */ + PsaiFree(pwcUnicodeBuf); + return Status; +#endif + } + } + else + { + /* we want other module information */ + ULONG nSize = Context->nBufSize; + + /* base address */ + if(nSize >= sizeof(CurrentModule->BaseAddress)) + { + Context->lpmodinfo->lpBaseOfDll = CurrentModule->BaseAddress; + nSize -= sizeof(CurrentModule->BaseAddress); + } + + /* image size */ + if(nSize >= sizeof(CurrentModule->SizeOfImage)) + { + Context->lpmodinfo->SizeOfImage = CurrentModule->SizeOfImage; + nSize -= sizeof(CurrentModule->SizeOfImage); + } + + /* entry point */ + if(nSize >= sizeof(CurrentModule->EntryPoint)) + { + /* ??? FIXME? is "EntryPoint" just the offset, or the real address? */ + Context->lpmodinfo->EntryPoint = (PVOID)CurrentModule->EntryPoint; + } + + Context->nBufSize = TRUE; + } + + return STATUS_NO_MORE_FILES; + } + + return STATUS_SUCCESS; +} + + +static DWORD +InternalGetModuleInformation(HANDLE hProcess, + HMODULE hModule, + GET_MODULE_INFORMATION_FLAGS Flags, + LPVOID lpBuffer, + DWORD nBufSize) +{ + GET_MODULE_INFORMATION_CONTEXT Context; + NTSTATUS Status; + + Context.hModule = hModule; + Context.Flags = Flags; + Context.nBufSize = nBufSize; + Context.lpBuffer = lpBuffer; + + Status = PsaEnumerateProcessModules(hProcess, GetModuleInformationCallback, &Context); + + if(Status == STATUS_NO_MORE_FILES) + { + /* module was found, return string size */ + return Context.nBufSize; + } + else if(NT_SUCCESS(Status)) + { + /* module was not found */ + SetLastError(ERROR_INVALID_HANDLE); + } + else + { + /* an error occurred */ + SetLastErrorByStatus(Status); + } + return 0; +} + + +typedef struct _INTERNAL_ENUM_PAGE_FILES_CONTEXT +{ + PENUM_PAGE_FILE_CALLBACKA pCallbackRoutine; + LPVOID lpContext; +} INTERNAL_ENUM_PAGE_FILES_CONTEXT, *PINTERNAL_ENUM_PAGE_FILES_CONTEXT; + + +static BOOL +InternalAnsiPageFileCallback(LPVOID pContext, + PENUM_PAGE_FILE_INFORMATION pPageFileInfo, + LPCWSTR lpFilename) +{ + size_t slen; + LPSTR AnsiFileName; + PINTERNAL_ENUM_PAGE_FILES_CONTEXT Context = (PINTERNAL_ENUM_PAGE_FILES_CONTEXT)pContext; + + slen = wcslen(lpFilename); + + AnsiFileName = (LPSTR)LocalAlloc(LMEM_FIXED, (slen + 1) * sizeof(CHAR)); + if(AnsiFileName != NULL) + { + BOOL Ret; + + WideCharToMultiByte(CP_ACP, + 0, + lpFilename, + -1, /* only works if the string is NULL-terminated!!! */ + AnsiFileName, + (slen + 1) * sizeof(CHAR), + NULL, + NULL); + + Ret = Context->pCallbackRoutine(Context->lpContext, pPageFileInfo, AnsiFileName); + + LocalFree((HLOCAL)AnsiFileName); + + return Ret; + } + + return FALSE; +} + +/* PUBLIC *********************************************************************/ + +/* + * @implemented + */ +BOOL +STDCALL +EmptyWorkingSet(HANDLE hProcess) +{ + QUOTA_LIMITS QuotaLimits; + NTSTATUS Status; + + /* query the working set */ + Status = NtQueryInformationProcess(hProcess, + ProcessQuotaLimits, + &QuotaLimits, + sizeof(QuotaLimits), + NULL); + + if(!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + /* empty the working set */ + QuotaLimits.MinimumWorkingSetSize = -1; + QuotaLimits.MaximumWorkingSetSize = -1; + + /* set the working set */ + Status = NtSetInformationProcess(hProcess, + ProcessQuotaLimits, + &QuotaLimits, + sizeof(QuotaLimits)); + if(!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +STDCALL +EnumDeviceDrivers(LPVOID *lpImageBase, + DWORD cb, + LPDWORD lpcbNeeded) +{ + ENUM_DEVICE_DRIVERS_CONTEXT Context; + NTSTATUS Status; + + if(cb == 0 || lpImageBase == NULL) + { + *lpcbNeeded = 0; + return TRUE; + } + + cb /= sizeof(PVOID); + + Context.lpImageBase = lpImageBase; + Context.nCount = cb; + + Status = PsaEnumerateSystemModules(EnumDeviceDriversCallback, &Context); + + /* return the count of bytes returned */ + *lpcbNeeded = (cb - Context.nCount) * sizeof(PVOID); + + if(!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +STDCALL +EnumProcesses(DWORD *lpidProcess, + DWORD cb, + LPDWORD lpcbNeeded) +{ + ENUM_PROCESSES_CONTEXT Context; + NTSTATUS Status; + + cb /= sizeof(DWORD); + + if(cb == 0 || lpidProcess == NULL) + { + *lpcbNeeded = 0; + return TRUE; + } + + Context.lpidProcess = lpidProcess; + Context.nCount = cb; + + /* enumerate the process ids */ + Status = PsaEnumerateProcesses(EnumProcessesCallback, &Context); + + *lpcbNeeded = (cb - Context.nCount) * sizeof(DWORD); + + if(!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +STDCALL +EnumProcessModules(HANDLE hProcess, + HMODULE *lphModule, + DWORD cb, + LPDWORD lpcbNeeded) +{ + ENUM_PROCESS_MODULES_CONTEXT Context; + NTSTATUS Status; + + cb /= sizeof(HMODULE); + + if(cb == 0 || lphModule == NULL) + { + *lpcbNeeded = 0; + return TRUE; + } + + Context.lphModule = lphModule; + Context.nCount = cb; + + /* enumerate the process modules */ + Status = PsaEnumerateProcessModules(hProcess, EnumProcessModulesCallback, &Context); + + *lpcbNeeded = (cb - Context.nCount) * sizeof(DWORD); + + if(!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetDeviceDriverBaseNameA(LPVOID ImageBase, + LPSTR lpBaseName, + DWORD nSize) +{ + return InternalGetDeviceDriverName(FALSE, FALSE, ImageBase, lpBaseName, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetDeviceDriverFileNameA(LPVOID ImageBase, + LPSTR lpFilename, + DWORD nSize) +{ + return InternalGetDeviceDriverName(FALSE, TRUE, ImageBase, lpFilename, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetDeviceDriverBaseNameW(LPVOID ImageBase, + LPWSTR lpBaseName, + DWORD nSize) +{ + return InternalGetDeviceDriverName(TRUE, FALSE, ImageBase, lpBaseName, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetDeviceDriverFileNameW(LPVOID ImageBase, + LPWSTR lpFilename, + DWORD nSize) +{ + return InternalGetDeviceDriverName(TRUE, TRUE, ImageBase, lpFilename, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetMappedFileNameA(HANDLE hProcess, + LPVOID lpv, + LPSTR lpFilename, + DWORD nSize) +{ + return InternalGetMappedFileName(FALSE, hProcess, lpv, lpFilename, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetMappedFileNameW(HANDLE hProcess, + LPVOID lpv, + LPWSTR lpFilename, + DWORD nSize) +{ + return InternalGetMappedFileName(TRUE, hProcess, lpv, lpFilename, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetModuleBaseNameA(HANDLE hProcess, + HMODULE hModule, + LPSTR lpBaseName, + DWORD nSize) +{ + GET_MODULE_INFORMATION_FLAGS Flags = {TRUE, FALSE, FALSE}; + return InternalGetModuleInformation(hProcess, hModule, Flags, lpBaseName, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetModuleBaseNameW(HANDLE hProcess, + HMODULE hModule, + LPWSTR lpBaseName, + DWORD nSize) +{ + GET_MODULE_INFORMATION_FLAGS Flags = {TRUE, TRUE, FALSE}; + return InternalGetModuleInformation(hProcess, hModule, Flags, lpBaseName, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetModuleFileNameExA(HANDLE hProcess, + HMODULE hModule, + LPSTR lpFilename, + DWORD nSize) +{ + GET_MODULE_INFORMATION_FLAGS Flags = {TRUE, FALSE, TRUE}; + return InternalGetModuleInformation(hProcess, hModule, Flags, lpFilename, nSize); +} + + +/* + * @implemented + */ +DWORD +STDCALL +GetModuleFileNameExW(HANDLE hProcess, + HMODULE hModule, + LPWSTR lpFilename, + DWORD nSize) +{ + GET_MODULE_INFORMATION_FLAGS Flags = {TRUE, TRUE, TRUE}; + return InternalGetModuleInformation(hProcess, hModule, Flags, lpFilename, nSize); +} + + +/* + * @implemented + */ +BOOL +STDCALL +GetModuleInformation(HANDLE hProcess, + HMODULE hModule, + LPMODULEINFO lpmodinfo, + DWORD cb) +{ + GET_MODULE_INFORMATION_FLAGS Flags = {FALSE, FALSE, FALSE}; + return (BOOL)InternalGetModuleInformation(hProcess, hModule, Flags, lpmodinfo, cb); +} + + +/* + * @implemented + */ +BOOL +STDCALL +InitializeProcessForWsWatch(HANDLE hProcess) +{ + NTSTATUS Status; + + Status = NtSetInformationProcess(hProcess, + ProcessWorkingSetWatch, + NULL, + 0); + if(!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +STDCALL +GetWsChanges(HANDLE hProcess, + PPSAPI_WS_WATCH_INFORMATION lpWatchInfo, + DWORD cb) +{ + NTSTATUS Status; + + Status = NtQueryInformationProcess(hProcess, + ProcessWorkingSetWatch, + (PVOID)lpWatchInfo, + cb, + NULL); + if(!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } [truncated at 1000 lines; 1829 more skipped]
19 years, 10 months
1
0
0
0
[weiden] 13059: janitory work
by weiden@svn.reactos.com
janitory work Modified: trunk/reactos/lib/psapi/makefile Added: trunk/reactos/lib/psapi/malloc.c Deleted: trunk/reactos/lib/psapi/misc/malloc.c Deleted: trunk/reactos/lib/psapi/misc/win32.c Added: trunk/reactos/lib/psapi/win32.c _____ Modified: trunk/reactos/lib/psapi/makefile --- trunk/reactos/lib/psapi/makefile 2005-01-15 16:01:55 UTC (rev 13058) +++ trunk/reactos/lib/psapi/makefile 2005-01-15 16:35:30 UTC (rev 13059) @@ -19,10 +19,7 @@ TARGET_PCH = precomp.h -TARGET_OBJECTS = \ - misc/dllmain.o \ - misc/malloc.o \ - misc/win32.o +TARGET_OBJECTS = misc/dllmain.o malloc.o win32.o DEP_OBJECTS = $(TARGET_OBJECTS) _____ Copied: trunk/reactos/lib/psapi/malloc.c (from rev 13058, trunk/reactos/lib/psapi/misc/malloc.c) _____ Deleted: trunk/reactos/lib/psapi/misc/malloc.c --- trunk/reactos/lib/psapi/misc/malloc.c 2005-01-15 16:01:55 UTC (rev 13058) +++ trunk/reactos/lib/psapi/misc/malloc.c 2005-01-15 16:35:30 UTC (rev 13059) @@ -1,71 +0,0 @@ -/* $Id$ - */ -/* - * COPYRIGHT: None - * LICENSE: Public domain - * PROJECT: ReactOS system libraries - * FILE: reactos/lib/psapi/misc/malloc.c - * PURPOSE: Memory allocator for PSAPI - * PROGRAMMER: KJK::Hyperion <noog(a)libero.it> - * UPDATE HISTORY: - * 10/06/2002: Created - * 12/02/2003: malloc and free renamed to PsaiMalloc and PsaiFree, - * for better reusability - */ - -#include "precomp.h" - -#define NDEBUG -#include <debug.h> - -PVOID -STDCALL -MemAlloc(IN HANDLE Heap, - IN PVOID Ptr, - IN ULONG Size) -{ - PVOID pBuf = NULL; - - if(Size == 0 && Ptr == NULL) - { - return NULL; - } - - if(Heap == NULL) - { - Heap = NtCurrentPeb()->ProcessHeap; - } - - if(Size > 0) - { - if(Ptr == NULL) - /* malloc */ - pBuf = RtlAllocateHeap(Heap, 0, Size); - else - /* realloc */ - pBuf = RtlReAllocateHeap(Heap, 0, Ptr, Size); - } - else - /* free */ - RtlFreeHeap(Heap, 0, Ptr); - - return pBuf; -} - -void *PsaiMalloc(SIZE_T size) -{ - return MemAlloc(NULL, NULL, size); -} - -void *PsaiRealloc(void *ptr, SIZE_T size) -{ - return MemAlloc(NULL, ptr, size); -} - -void PsaiFree(void *ptr) -{ - MemAlloc(NULL, ptr, 0); -} - -/* EOF */ - _____ Deleted: trunk/reactos/lib/psapi/misc/win32.c --- trunk/reactos/lib/psapi/misc/win32.c 2005-01-15 16:01:55 UTC (rev 13058) +++ trunk/reactos/lib/psapi/misc/win32.c 2005-01-15 16:35:30 UTC (rev 13059) @@ -1,1395 +0,0 @@ -/* $Id$ - */ -/* - * COPYRIGHT: See COPYING in the top level directory - * LICENSE: See LGPL.txt in the top level directory - * PROJECT: ReactOS system libraries - * FILE: reactos/lib/psapi/misc/win32.c - * PURPOSE: Win32 interfaces for PSAPI - * PROGRAMMER: KJK::Hyperion <noog(a)libero.it> - * Thomas Weidenmueller <w3seek(a)reactos.com> - * UPDATE HISTORY: - * 10/06/2002: Created - */ - -#include "precomp.h" - -#define NDEBUG -#include <debug.h> - -/* INTERNAL *******************************************************************/ - -typedef struct _ENUM_DEVICE_DRIVERS_CONTEXT -{ - LPVOID *lpImageBase; - DWORD nCount; -} ENUM_DEVICE_DRIVERS_CONTEXT, *PENUM_DEVICE_DRIVERS_CONTEXT; - -NTSTATUS STDCALL -EnumDeviceDriversCallback(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule, - IN OUT PVOID CallbackContext) -{ - PENUM_DEVICE_DRIVERS_CONTEXT Context = (PENUM_DEVICE_DRIVERS_CONTEXT)CallbackContext; - - /* no more buffer space */ - if(Context->nCount == 0) - { - return STATUS_INFO_LENGTH_MISMATCH; - } - - /* return current module */ - *Context->lpImageBase = CurrentModule->Base; - - /* go to next array slot */ - Context->lpImageBase++; - Context->nCount--; - - return STATUS_SUCCESS; -} - - -typedef struct _ENUM_PROCESSES_CONTEXT -{ - DWORD *lpidProcess; - DWORD nCount; -} ENUM_PROCESSES_CONTEXT, *PENUM_PROCESSES_CONTEXT; - -NTSTATUS STDCALL -EnumProcessesCallback(IN PSYSTEM_PROCESSES CurrentProcess, - IN OUT PVOID CallbackContext) -{ - PENUM_PROCESSES_CONTEXT Context = (PENUM_PROCESSES_CONTEXT)CallbackContext; - - /* no more buffer space */ - if(Context->nCount == 0) - { - return STATUS_INFO_LENGTH_MISMATCH; - } - - /* return current process */ - *Context->lpidProcess = CurrentProcess->ProcessId; - - /* go to next array slot */ - Context->lpidProcess++; - Context->nCount--; - - return STATUS_SUCCESS; -} - - -typedef struct _ENUM_PROCESS_MODULES_CONTEXT -{ - HMODULE *lphModule; - DWORD nCount; -} ENUM_PROCESS_MODULES_CONTEXT, *PENUM_PROCESS_MODULES_CONTEXT; - -NTSTATUS STDCALL -EnumProcessModulesCallback(IN HANDLE ProcessHandle, - IN PLDR_MODULE CurrentModule, - IN OUT PVOID CallbackContext) -{ - PENUM_PROCESS_MODULES_CONTEXT Context = (PENUM_PROCESS_MODULES_CONTEXT)CallbackContext; - - /* no more buffer space */ - if(Context->nCount == 0) - { - return STATUS_INFO_LENGTH_MISMATCH; - } - - /* return current process */ - *Context->lphModule = CurrentModule->BaseAddress; - - /* go to next array slot */ - Context->lphModule++; - Context->nCount--; - - return STATUS_SUCCESS; -} - - -typedef struct _GET_DEVICE_DRIVER_NAME_CONTEXT -{ - LPVOID ImageBase; - struct - { - ULONG bFullName : sizeof(ULONG) * 8 / 2; - ULONG bUnicode : sizeof(ULONG) * 8 / 2; - }; - DWORD nSize; - union - { - LPVOID lpName; - LPSTR lpAnsiName; - LPWSTR lpUnicodeName; - }; -} GET_DEVICE_DRIVER_NAME_CONTEXT, *PGET_DEVICE_DRIVER_NAME_CONTEXT; - -NTSTATUS STDCALL -GetDeviceDriverNameCallback(IN PSYSTEM_MODULE_INFORMATION_ENTRY CurrentModule, - IN OUT PVOID CallbackContext) -{ - PGET_DEVICE_DRIVER_NAME_CONTEXT Context = (PGET_DEVICE_DRIVER_NAME_CONTEXT)CallbackContext; - - /* module found */ - if(Context->ImageBase == CurrentModule->Base) - { - PCHAR pcModuleName; - ULONG l; - - /* get the full name or just the filename part */ - if(Context->bFullName) - pcModuleName = &CurrentModule->ImageName[0]; - else - pcModuleName = &CurrentModule->ImageName[CurrentModule->PathLength]; - - /* get the length of the name */ - l = strlen(pcModuleName); - - if(Context->nSize <= l) - { - /* use the user buffer's length */ - l = Context->nSize; - } - else - { - /* enough space for the null terminator */ - Context->nSize = ++l; - } - - /* copy the string */ - if(Context->bUnicode) - { - ANSI_STRING AnsiString; - UNICODE_STRING UnicodeString; - - UnicodeString.Length = 0; - UnicodeString.MaximumLength = l * sizeof(WCHAR); - UnicodeString.Buffer = Context->lpUnicodeName; - - RtlInitAnsiString(&AnsiString, pcModuleName); - /* driver names should always be in language-neutral ASCII, so we don't - bother calling AreFileApisANSI() */ - RtlAnsiStringToUnicodeString(&UnicodeString, &AnsiString, FALSE); - } - else - { - memcpy(Context->lpAnsiName, pcModuleName, l); - } - - /* terminate the enumeration */ - return STATUS_NO_MORE_FILES; - } - else - { - /* continue searching */ - return STATUS_SUCCESS; - } -} - - -static DWORD -InternalGetDeviceDriverName(BOOLEAN bUnicode, - BOOLEAN bFullName, - LPVOID ImageBase, - LPVOID lpName, - DWORD nSize) -{ - GET_DEVICE_DRIVER_NAME_CONTEXT Context; - NTSTATUS Status; - - if(lpName == NULL || nSize == 0) - { - return 0; - } - - if(ImageBase == NULL) - { - SetLastError(ERROR_INVALID_HANDLE); - return 0; - } - - Context.ImageBase = ImageBase; - Context.bFullName = bFullName; - Context.bUnicode = bUnicode; - Context.nSize = nSize; - Context.lpName = lpName; - - /* start the enumeration */ - Status = PsaEnumerateSystemModules(GetDeviceDriverNameCallback, &Context); - - if(Status == STATUS_NO_MORE_FILES) - { - /* module was found, return string size */ - return Context.nSize; - } - else if(NT_SUCCESS(Status)) - { - /* module was not found */ - SetLastError(ERROR_INVALID_HANDLE); - } - else - { - /* an error occurred */ - SetLastErrorByStatus(Status); - } - return 0; -} - - -static DWORD -InternalGetMappedFileName(BOOLEAN bUnicode, - HANDLE hProcess, - LPVOID lpv, - LPVOID lpName, - DWORD nSize) -{ - PMEMORY_SECTION_NAME pmsnName; - ULONG nBufSize; - NTSTATUS Status; - - if(nSize == 0 || lpName == NULL) - { - return 0; - } - - if(nSize > (0xFFFF / sizeof(WCHAR))) - { - /* if the user buffer contains more characters than would fit in an - UNICODE_STRING, limit the buffer size. RATIONALE: we don't limit buffer - size elsewhere because here superfluous buffer size will mean a larger - temporary buffer */ - nBufSize = 0xFFFF / sizeof(WCHAR); - } - else - { - nBufSize = nSize * sizeof(WCHAR); - } - - /* allocate the memory */ - pmsnName = PsaiMalloc(nBufSize + offsetof(MEMORY_SECTION_NAME, NameBuffer)); - - if(pmsnName == NULL) - { - SetLastError(ERROR_OUTOFMEMORY); - return 0; - } - - /* initialize the destination buffer */ - pmsnName->SectionFileName.Length = 0; - pmsnName->SectionFileName.Length = nBufSize; - -#if 0 - __try - { -#endif - /* query the name */ - Status = NtQueryVirtualMemory(hProcess, - lpv, - MemorySectionName, - pmsnName, - nBufSize, - NULL); - if(!NT_SUCCESS(Status)) - { - PsaiFree(pmsnName); - SetLastErrorByStatus(Status); - return 0; - } - - if(bUnicode) - { - /* destination is an Unicode string: direct copy */ - memcpy((LPWSTR)lpName, pmsnName->NameBuffer, pmsnName->SectionFileName.Length); - - PsaiFree(pmsnName); - - if(pmsnName->SectionFileName.Length < nSize) - { - /* null-terminate the string */ - ((LPWSTR)lpName)[pmsnName->SectionFileName.Length] = 0; - return pmsnName->SectionFileName.Length + 1; - } - - return pmsnName->SectionFileName.Length; - } - else - { - ANSI_STRING AnsiString; - - AnsiString.Length = 0; - AnsiString.MaximumLength = nSize; - AnsiString.Buffer = (LPSTR)lpName; - - if(AreFileApisANSI()) - RtlUnicodeStringToAnsiString(&AnsiString, &pmsnName->SectionFileName, FALSE); - else - RtlUnicodeStringToOemString(&AnsiString, &pmsnName->SectionFileName, FALSE); - - PsaiFree(pmsnName); - - if(AnsiString.Length < nSize) - { - /* null-terminate the string */ - ((LPSTR)lpName)[AnsiString.Length] = 0; - return AnsiString.Length + 1; - } - - return AnsiString.Length; - } - -#if 0 - } - __finally - { - PsaiFree(pmsnName); - } -#endif -} - - -typedef struct _GET_MODULE_INFORMATION_FLAGS -{ - ULONG bWantName : sizeof(ULONG) * 8 / 4; - ULONG bUnicode : sizeof(ULONG) * 8 / 4; - ULONG bFullName : sizeof(ULONG) * 8 / 4; -} GET_MODULE_INFORMATION_FLAGS, *PGET_MODULE_INFORMATION_FLAGS; - -typedef struct _GET_MODULE_INFORMATION_CONTEXT -{ - HMODULE hModule; - GET_MODULE_INFORMATION_FLAGS Flags; - DWORD nBufSize; - union - { - LPWSTR lpUnicodeName; - LPSTR lpAnsiName; - LPMODULEINFO lpmodinfo; - LPVOID lpBuffer; - }; -} GET_MODULE_INFORMATION_CONTEXT, *PGET_MODULE_INFORMATION_CONTEXT; - -NTSTATUS STDCALL -GetModuleInformationCallback(IN HANDLE ProcessHandle, - IN PLDR_MODULE CurrentModule, - IN OUT PVOID CallbackContext) -{ - PGET_MODULE_INFORMATION_CONTEXT Context = (PGET_MODULE_INFORMATION_CONTEXT)CallbackContext; - - /* found the module we were looking for */ - if(CurrentModule->BaseAddress == Context->hModule) - { - /* we want the module name */ - if(Context->Flags.bWantName) - { - PUNICODE_STRING SourceString; - ULONG l; - NTSTATUS Status; - - if(Context->Flags.bFullName) - SourceString = &(CurrentModule->FullDllName); - else - SourceString = &(CurrentModule->BaseDllName); - - SourceString->Length -= SourceString->Length % sizeof(WCHAR); - - /* l is the byte size of the user buffer */ - l = Context->nBufSize * sizeof(WCHAR); - - /* if the user buffer has room for the string and a null terminator */ - if(l >= (SourceString->Length + sizeof(WCHAR))) - { - /* limit the buffer size */ - l = SourceString->Length; - - /* null-terminate the string */ - if(Context->Flags.bUnicode) - Context->lpUnicodeName[l / sizeof(WCHAR)] = 0; - else - Context->lpAnsiName[l / sizeof(WCHAR)] = 0; - } - - if(Context->Flags.bUnicode) - { - /* Unicode: direct copy */ - /* NOTE: I've chosen not to check for ProcessHandle == NtCurrentProcess(), - this function is complicated enough as it is */ - Status = NtReadVirtualMemory(ProcessHandle, - SourceString->Buffer, - Context->lpUnicodeName, - l, - NULL); - - if(!NT_SUCCESS(Status)) - { - Context->nBufSize = 0; - return Status; - } - - Context->nBufSize = l / sizeof(WCHAR); - } - else - { - /* ANSI/OEM: convert and copy */ - LPWSTR pwcUnicodeBuf; - ANSI_STRING AnsiString; - UNICODE_STRING UnicodeString; - - AnsiString.Length = 0; - AnsiString.MaximumLength = Context->nBufSize; - AnsiString.Buffer = Context->lpAnsiName; - - /* allocate the local buffer */ - pwcUnicodeBuf = PsaiMalloc(SourceString->Length); - -#if 0 - __try - { -#endif - if(pwcUnicodeBuf == NULL) - { - Status = STATUS_NO_MEMORY; - goto exitWithStatus; - } - - /* copy the string in the local buffer */ - Status = NtReadVirtualMemory(ProcessHandle, - SourceString->Buffer, - pwcUnicodeBuf, - l, - NULL); - - if(!NT_SUCCESS(Status)) - { - goto exitWithStatus; - } - - /* initialize Unicode string buffer */ - UnicodeString.Length = UnicodeString.MaximumLength = l; - UnicodeString.Buffer = pwcUnicodeBuf; - - /* convert and copy */ - if(AreFileApisANSI()) - RtlUnicodeStringToAnsiString(&AnsiString, &UnicodeString, FALSE); - else - RtlUnicodeStringToOemString(&AnsiString, &UnicodeString, FALSE); - - /* return the string size */ - Context->nBufSize = AnsiString.Length; -#if 0 - } - __finally - { - /* free the buffer */ - PsaiFree(pwcUnicodeBuf); - } -#else - Status = STATUS_NO_MORE_FILES; - -exitWithStatus: - /* free the buffer */ - PsaiFree(pwcUnicodeBuf); - return Status; -#endif - } - } - else - { - /* we want other module information */ - ULONG nSize = Context->nBufSize; - - /* base address */ - if(nSize >= sizeof(CurrentModule->BaseAddress)) - { - Context->lpmodinfo->lpBaseOfDll = CurrentModule->BaseAddress; - nSize -= sizeof(CurrentModule->BaseAddress); - } - - /* image size */ - if(nSize >= sizeof(CurrentModule->SizeOfImage)) - { - Context->lpmodinfo->SizeOfImage = CurrentModule->SizeOfImage; - nSize -= sizeof(CurrentModule->SizeOfImage); - } - - /* entry point */ - if(nSize >= sizeof(CurrentModule->EntryPoint)) - { - /* ??? FIXME? is "EntryPoint" just the offset, or the real address? */ - Context->lpmodinfo->EntryPoint = (PVOID)CurrentModule->EntryPoint; - } - - Context->nBufSize = TRUE; - } - - return STATUS_NO_MORE_FILES; - } - - return STATUS_SUCCESS; -} - - -static DWORD -InternalGetModuleInformation(HANDLE hProcess, - HMODULE hModule, - GET_MODULE_INFORMATION_FLAGS Flags, - LPVOID lpBuffer, - DWORD nBufSize) -{ - GET_MODULE_INFORMATION_CONTEXT Context; - NTSTATUS Status; - - Context.hModule = hModule; - Context.Flags = Flags; - Context.nBufSize = nBufSize; - Context.lpBuffer = lpBuffer; - - Status = PsaEnumerateProcessModules(hProcess, GetModuleInformationCallback, &Context); - - if(Status == STATUS_NO_MORE_FILES) - { - /* module was found, return string size */ - return Context.nBufSize; - } - else if(NT_SUCCESS(Status)) - { - /* module was not found */ - SetLastError(ERROR_INVALID_HANDLE); - } - else - { - /* an error occurred */ - SetLastErrorByStatus(Status); - } - return 0; -} - - -typedef struct _INTERNAL_ENUM_PAGE_FILES_CONTEXT -{ - PENUM_PAGE_FILE_CALLBACKA pCallbackRoutine; - LPVOID lpContext; -} INTERNAL_ENUM_PAGE_FILES_CONTEXT, *PINTERNAL_ENUM_PAGE_FILES_CONTEXT; - - -static BOOL -InternalAnsiPageFileCallback(LPVOID pContext, - PENUM_PAGE_FILE_INFORMATION pPageFileInfo, - LPCWSTR lpFilename) -{ - size_t slen; - LPSTR AnsiFileName; - PINTERNAL_ENUM_PAGE_FILES_CONTEXT Context = (PINTERNAL_ENUM_PAGE_FILES_CONTEXT)pContext; - - slen = wcslen(lpFilename); - - AnsiFileName = (LPSTR)LocalAlloc(LMEM_FIXED, (slen + 1) * sizeof(CHAR)); - if(AnsiFileName != NULL) - { - BOOL Ret; - - WideCharToMultiByte(CP_ACP, - 0, - lpFilename, - -1, /* only works if the string is NULL-terminated!!! */ - AnsiFileName, - (slen + 1) * sizeof(CHAR), - NULL, - NULL); - - Ret = Context->pCallbackRoutine(Context->lpContext, pPageFileInfo, AnsiFileName); - - LocalFree((HLOCAL)AnsiFileName); - - return Ret; - } - - return FALSE; -} - -/* PUBLIC *********************************************************************/ - -/* - * @implemented - */ -BOOL -STDCALL -EmptyWorkingSet(HANDLE hProcess) -{ - QUOTA_LIMITS QuotaLimits; - NTSTATUS Status; - - /* query the working set */ - Status = NtQueryInformationProcess(hProcess, - ProcessQuotaLimits, - &QuotaLimits, - sizeof(QuotaLimits), - NULL); - - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - /* empty the working set */ - QuotaLimits.MinimumWorkingSetSize = -1; - QuotaLimits.MaximumWorkingSetSize = -1; - - /* set the working set */ - Status = NtSetInformationProcess(hProcess, - ProcessQuotaLimits, - &QuotaLimits, - sizeof(QuotaLimits)); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -STDCALL -EnumDeviceDrivers(LPVOID *lpImageBase, - DWORD cb, - LPDWORD lpcbNeeded) -{ - ENUM_DEVICE_DRIVERS_CONTEXT Context; - NTSTATUS Status; - - if(cb == 0 || lpImageBase == NULL) - { - *lpcbNeeded = 0; - return TRUE; - } - - cb /= sizeof(PVOID); - - Context.lpImageBase = lpImageBase; - Context.nCount = cb; - - Status = PsaEnumerateSystemModules(EnumDeviceDriversCallback, &Context); - - /* return the count of bytes returned */ - *lpcbNeeded = (cb - Context.nCount) * sizeof(PVOID); - - if(!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -STDCALL -EnumProcesses(DWORD *lpidProcess, - DWORD cb, - LPDWORD lpcbNeeded) -{ - ENUM_PROCESSES_CONTEXT Context; - NTSTATUS Status; - - cb /= sizeof(DWORD); - - if(cb == 0 || lpidProcess == NULL) - { - *lpcbNeeded = 0; - return TRUE; - } - - Context.lpidProcess = lpidProcess; - Context.nCount = cb; - - /* enumerate the process ids */ - Status = PsaEnumerateProcesses(EnumProcessesCallback, &Context); - - *lpcbNeeded = (cb - Context.nCount) * sizeof(DWORD); - - if(!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -STDCALL -EnumProcessModules(HANDLE hProcess, - HMODULE *lphModule, - DWORD cb, - LPDWORD lpcbNeeded) -{ - ENUM_PROCESS_MODULES_CONTEXT Context; - NTSTATUS Status; - - cb /= sizeof(HMODULE); - - if(cb == 0 || lphModule == NULL) - { - *lpcbNeeded = 0; - return TRUE; - } - - Context.lphModule = lphModule; - Context.nCount = cb; - - /* enumerate the process modules */ - Status = PsaEnumerateProcessModules(hProcess, EnumProcessModulesCallback, &Context); - - *lpcbNeeded = (cb - Context.nCount) * sizeof(DWORD); - - if(!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetDeviceDriverBaseNameA(LPVOID ImageBase, - LPSTR lpBaseName, - DWORD nSize) -{ - return InternalGetDeviceDriverName(FALSE, FALSE, ImageBase, lpBaseName, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetDeviceDriverFileNameA(LPVOID ImageBase, - LPSTR lpFilename, - DWORD nSize) -{ - return InternalGetDeviceDriverName(FALSE, TRUE, ImageBase, lpFilename, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetDeviceDriverBaseNameW(LPVOID ImageBase, - LPWSTR lpBaseName, - DWORD nSize) -{ - return InternalGetDeviceDriverName(TRUE, FALSE, ImageBase, lpBaseName, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetDeviceDriverFileNameW(LPVOID ImageBase, - LPWSTR lpFilename, - DWORD nSize) -{ - return InternalGetDeviceDriverName(TRUE, TRUE, ImageBase, lpFilename, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetMappedFileNameA(HANDLE hProcess, - LPVOID lpv, - LPSTR lpFilename, - DWORD nSize) -{ - return InternalGetMappedFileName(FALSE, hProcess, lpv, lpFilename, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetMappedFileNameW(HANDLE hProcess, - LPVOID lpv, - LPWSTR lpFilename, - DWORD nSize) -{ - return InternalGetMappedFileName(TRUE, hProcess, lpv, lpFilename, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetModuleBaseNameA(HANDLE hProcess, - HMODULE hModule, - LPSTR lpBaseName, - DWORD nSize) -{ - GET_MODULE_INFORMATION_FLAGS Flags = {TRUE, FALSE, FALSE}; - return InternalGetModuleInformation(hProcess, hModule, Flags, lpBaseName, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetModuleBaseNameW(HANDLE hProcess, - HMODULE hModule, - LPWSTR lpBaseName, - DWORD nSize) -{ - GET_MODULE_INFORMATION_FLAGS Flags = {TRUE, TRUE, FALSE}; - return InternalGetModuleInformation(hProcess, hModule, Flags, lpBaseName, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetModuleFileNameExA(HANDLE hProcess, - HMODULE hModule, - LPSTR lpFilename, - DWORD nSize) -{ - GET_MODULE_INFORMATION_FLAGS Flags = {TRUE, FALSE, TRUE}; - return InternalGetModuleInformation(hProcess, hModule, Flags, lpFilename, nSize); -} - - -/* - * @implemented - */ -DWORD -STDCALL -GetModuleFileNameExW(HANDLE hProcess, - HMODULE hModule, - LPWSTR lpFilename, - DWORD nSize) -{ [truncated at 1000 lines; 494 more skipped]
19 years, 10 months
1
0
0
0
[weiden] 13058: fixed invalid dependency to msvcrt
by weiden@svn.reactos.com
fixed invalid dependency to msvcrt Modified: trunk/reactos/lib/psapi/makefile _____ Modified: trunk/reactos/lib/psapi/makefile --- trunk/reactos/lib/psapi/makefile 2005-01-15 15:28:51 UTC (rev 13057) +++ trunk/reactos/lib/psapi/makefile 2005-01-15 16:01:55 UTC (rev 13058) @@ -11,9 +11,9 @@ TARGET_CFLAGS = -I./include -Wall -Werror # require os code to explicitly request A/W version of structs/functions -TARGET_CFLAGS += -D_DISABLE_TIDENTS +TARGET_CFLAGS += -D_DISABLE_TIDENTS -D_SEH_NO_NATIVE_NLG -TARGET_LFLAGS = -nostartfiles +TARGET_LFLAGS = -nostartfiles -nostdlib TARGET_BASE = $(TARGET_BASE_LIB_PSAPI)
19 years, 10 months
1
0
0
0
[gvg] 13057: Herv, Poussineau <hpoussineau@fr.st>
by gvg@svn.reactos.com
Herv, Poussineau <hpoussineau(a)fr.st> Add localization to ctm Added: trunk/rosapps/sysutils/ctm/En.rc Added: trunk/rosapps/sysutils/ctm/Fr.rc Modified: trunk/rosapps/sysutils/ctm/ctm.c Modified: trunk/rosapps/sysutils/ctm/ctm.rc Added: trunk/rosapps/sysutils/ctm/resource.h _____ Added: trunk/rosapps/sysutils/ctm/En.rc --- trunk/rosapps/sysutils/ctm/En.rc 2005-01-15 15:09:22 UTC (rev 13056) +++ trunk/rosapps/sysutils/ctm/En.rc 2005-01-15 15:28:51 UTC (rev 13057) @@ -0,0 +1,31 @@ +// English (U.S.) resources + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Console TaskManager v0.1 by Aleksey Bragin <aleksey(a)studiocerebral.com>" + + IDS_COLUMN_IMAGENAME "Image name " + IDS_COLUMN_PID "PID " + IDS_COLUMN_CPU "CPU" + IDS_COLUMN_MEM "Mem Usage" + IDS_COLUMN_MEM_UNIT "Kb" + IDS_COLUMN_PF "Page Faults" + + IDS_IDLE_PROCESS "System Idle Process" + IDS_YES "y" + IDS_NO "n" + + IDS_MENU "Press: q - quit, k - kill process" + IDS_MENU_QUIT "q" + IDS_MENU_KILL_PROCESS "k" + + IDS_KILL_PROCESS "Are you sure you want to kill this process? (y/n)" + IDS_KILL_PROCESS_ERR1 "Unable to terminate this process..." + IDS_KILL_PROCESS_ERR2 "Unable to terminate process %3d (unable to OpenProcess)" + + IDS_CTM_GENERAL_ERR1 "ctm: can't use console." + IDS_CTM_GENERAL_ERR2 "ctm: can't GetConsoleMode() for input console." + IDS_CTM_GENERAL_ERR3 "ctm: can't GetConsoleMode() for output console." +END _____ Added: trunk/rosapps/sysutils/ctm/Fr.rc --- trunk/rosapps/sysutils/ctm/Fr.rc 2005-01-15 15:09:22 UTC (rev 13056) +++ trunk/rosapps/sysutils/ctm/Fr.rc 2005-01-15 15:28:51 UTC (rev 13057) @@ -0,0 +1,31 @@ +// French (France) resources + +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_TITLE "Console TaskManager v0.1 par Aleksey Bragin <aleksey(a)studiocerebral.com>" + + IDS_COLUMN_IMAGENAME "Processus " + IDS_COLUMN_PID "PID " + IDS_COLUMN_CPU "CPU" + IDS_COLUMN_MEM "Util. mém" + IDS_COLUMN_MEM_UNIT "Ko" + IDS_COLUMN_PF "Défauts de page" + + IDS_IDLE_PROCESS "Processus inactif du système" + IDS_YES "O" + IDS_NO "N" + + IDS_MENU "Menu: Quitter (q), Tuer processus (t)" + IDS_MENU_QUIT "Q" + IDS_MENU_KILL_PROCESS "T" + + IDS_KILL_PROCESS "Etes-vous sûr de vouloir tuer ce processus (o/n) ?" + IDS_KILL_PROCESS_ERR1 "Impossible de terminer ce processus..." + IDS_KILL_PROCESS_ERR2 "Impossible de terminer le processus %3d (erreur lors de OpenProcess)" + + IDS_CTM_GENERAL_ERR1 "ctm: impossible d'utiliser la console." + IDS_CTM_GENERAL_ERR2 "ctm: impossible de récupérer les paramètres de la console d'entrée." + IDS_CTM_GENERAL_ERR3 "ctm: impossible de récupérer les paramètres de la console de sortie." +END _____ Modified: trunk/rosapps/sysutils/ctm/ctm.c --- trunk/rosapps/sysutils/ctm/ctm.c 2005-01-15 15:09:22 UTC (rev 13056) +++ trunk/rosapps/sysutils/ctm/ctm.c 2005-01-15 15:28:51 UTC (rev 13057) @@ -1,3 +1,6 @@ +#define UNICODE +#define _UNICODE + /* Console Task Manager ctm.c - main program file @@ -6,8 +9,11 @@ Most of the code dealing with getting system parameters is taken from ReactOS Task Manager written by Brian Palmer (brianp(a)reactos.org) + + Localization features added by Hervé Poussineau (hpoussineau(a)fr.st) History: + 24 October 2004 - added localization features 09 April 2003 - v0.1, fixed bugs, added features, ported to mingw 20 March 2003 - v0.03, works good under ReactOS, and allows process killing @@ -42,18 +48,31 @@ #include <ntos/zwtypes.h> #include "ctm.h" +#include "resource.h" #define MAX_PROC 17 #define TIMES HANDLE hStdin; HANDLE hStdout; +HINSTANCE hInst; DWORD inConMode; DWORD outConMode; -//PROCNTQSI NtQuerySystemInformation= NULL; +DWORD columnRightPositions[5]; +TCHAR lpSeparator[80]; +TCHAR lpHeader[80]; +TCHAR lpMemUnit[3]; +TCHAR lpIdleProcess[80];; +TCHAR lpTitle[80]; +TCHAR lpHeader[80]; +TCHAR lpMenu[80]; +TCHAR lpEmpty[80]; +TCHAR KEY_QUIT, KEY_KILL; +TCHAR KEY_YES, KEY_NO; + const int ProcPerScreen = 17; // 17 processess are displayed on one page ULONG ProcessCountOld = 0; ULONG ProcessCount = 0; @@ -70,9 +89,11 @@ int selection=0; int scrolled=0; // offset from which process start showing +int first = 0; // first time in DisplayScreen #define NEW_CONSOLE +// Functions that are needed by epsapi void *PsaiMalloc(SIZE_T size) { return malloc(size); } void *PsaiRealloc(void *ptr, SIZE_T size) { return realloc(ptr, size); } void PsaiFree(void *ptr) { free(ptr); } @@ -120,39 +141,33 @@ int posStr; DWORD numChars; int lines; - int idx; - static int first = 0; + int idx, i; if (first == 0) { - // Header - pos.X = 2; pos.Y = 2; - _tcscpy(lpStr, _T("Console TaskManager v0.1 by Aleksey Bragin <aleksey(a)studiocerebral.com>")); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); + // Header + pos.X = 2; pos.Y = 2; + WriteConsoleOutputCharacter(hStdout, lpTitle, _tcslen(lpTitle), pos, &numChars); - pos.X = 2; pos.Y = 3; - _tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+--------- ----+")); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); + pos.X = 2; pos.Y = 3; + WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars); - pos.X = 2; pos.Y = 4; - _tcscpy(lpStr, _T("| Image name | PID | CPU | Mem Usage | Page Faults |")); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); + pos.X = 2; pos.Y = 4; + WriteConsoleOutputCharacter(hStdout, lpHeader, _tcslen(lpHeader), pos, &numChars); - pos.X = 2; pos.Y = 5; - _tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+--------- ----+")); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); + pos.X = 2; pos.Y = 5; + WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars); - // Footer - pos.X = 2; pos.Y = 23; - _tcscpy(lpStr, _T("+-------------------------------+-------+-----+-----------+--------- ----+")); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); + // Footer + pos.X = 2; pos.Y = ProcPerScreen+6; + WriteConsoleOutputCharacter(hStdout, lpSeparator, _tcslen(lpSeparator), pos, &numChars); + + // Menu + pos.X = 2; pos.Y = ProcPerScreen+7; + WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars); + WriteConsoleOutputCharacter(hStdout, lpMenu, _tcslen(lpMenu), pos, &numChars); - // Menu - pos.X = 2; pos.Y = 24; - _tcscpy(lpStr, _T("Press: q - quit, k - kill process ")); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); - - first = 1; + first = 1; } // Processess @@ -168,11 +183,14 @@ TCHAR lpMemUsg[12]; TCHAR lpPageFaults[15]; WORD wColor; + + for (i = 0; i < 80; i++) + lpStr[i] = _T(' '); // data - // image name if (idx < lines && scrolled + idx < ProcessCount) { + // image name #ifdef _UNICODE len = wcslen(pPerfData[scrolled+idx].ImageName); #else @@ -180,77 +198,40 @@ imgName, MAX_PATH, NULL, NULL); len = strlen(imgName); #endif - if (len > 31) - { - len = 31; - } + if (len > columnRightPositions[0]) + { + len = columnRightPositions[0]; + } #ifdef _UNICODE wcsncpy(&lpStr[2], pPerfData[scrolled+idx].ImageName, len); #else strncpy(&lpStr[2], imgName, len); #endif - } - else - { - len = 0; - } - if (len < 31) - { - _tcsncpy(&lpStr[2 + len], _T(" "), 31 - len); - } - // PID - if (idx < lines && scrolled + idx < ProcessCount) - { - _stprintf(lpPid, _T("%6ld "), pPerfData[scrolled+idx].ProcessId); - _tcsncpy(&lpStr[34], lpPid, 7); - } - else - { - _tcsncpy(&lpStr[34], _T(" "), 7); - } + // PID + _stprintf(lpPid, _T("%6ld"), pPerfData[scrolled+idx].ProcessId); + _tcsncpy(&lpStr[columnRightPositions[1] - 6], lpPid, 6); - // CPU - if (idx < lines && scrolled + idx < ProcessCount) - { - _stprintf(lpCpu, _T("%3d%% "), pPerfData[scrolled+idx].CPUUsage); - _tcsncpy(&lpStr[42], lpCpu, 5); - } - else - { - _tcsncpy(&lpStr[42], _T(" "), 5); - } +#ifdef TIMES + // CPU + _stprintf(lpCpu, _T("%3d%%"), pPerfData[scrolled+idx].CPUUsage); + _tcsncpy(&lpStr[columnRightPositions[2] - 4], lpCpu, 4); +#endif - // Mem usage - if (idx < lines && scrolled + idx < ProcessCount) - { - _stprintf(lpMemUsg, _T("%6ld "), pPerfData[scrolled+idx].WorkingSetSizeBytes / 1024); - _tcsncpy(&lpStr[48], lpMemUsg, 11); - } - else - { - _tcsncpy(&lpStr[48], _T(" "), 11); - } + // Mem usage + _stprintf(lpMemUsg, _T("%6ld %s"), pPerfData[scrolled+idx].WorkingSetSizeBytes / 1024, lpMemUnit); + _tcsncpy(&lpStr[columnRightPositions[3] - 9], lpMemUsg, 9); - // Page Fault - if (idx < lines && scrolled + idx < ProcessCount) - { - _stprintf(lpPageFaults, _T("%12ld "), pPerfData[scrolled+idx].PageFaultCount); - _tcsncpy(&lpStr[60], lpPageFaults, 13); + // Page Fault + _stprintf(lpPageFaults, _T("%12ld"), pPerfData[scrolled+idx].PageFaultCount); + _tcsncpy(&lpStr[columnRightPositions[4] - 12], lpPageFaults, 12); } - else - { - _tcsncpy(&lpStr[60], _T(" "), 13); - } // columns lpStr[0] = _T(' '); lpStr[1] = _T('|'); - lpStr[33] = _T('|'); - lpStr[41] = _T('|'); - lpStr[47] = _T('|'); - lpStr[59] = _T('|'); - lpStr[73] = _T('|'); + for (i = 0; i < 5; i++) + lpStr[columnRightPositions[i] + 1] = _T('|'); pos.X = 1; pos.Y = 6+idx; WriteConsoleOutputCharacter(hStdout, lpStr, 74, pos, &numChars); @@ -274,7 +255,7 @@ FillConsoleOutputAttribute( hStdout, // screen buffer handle wColor, // color to fill with - 31, // number of cells to fill + columnRightPositions[0] - 1, // number of cells to fill pos, // first cell to write to &numChars); // actual number written } @@ -285,13 +266,14 @@ // returns TRUE if exiting int ProcessKeys(int numEvents) { + DWORD numChars; if ((ProcessCount-scrolled < 17) && (ProcessCount > 17)) scrolled = ProcessCount-17; TCHAR key = GetKeyPressed(numEvents); - if (key == VK_Q) + if (key == KEY_QUIT) return TRUE; - else if (key == VK_K) + else if (key == KEY_KILL) { // user wants to kill some process, get his acknowledgement DWORD pId; @@ -299,15 +281,15 @@ TCHAR lpStr[100]; pos.X = 2; pos.Y = 24; - _tcscpy(lpStr, _T("Are you sure you want to kill this process? (y/n)")); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId); + if (LoadString(hInst, IDS_KILL_PROCESS, lpStr, 100)) + WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); do { GetNumberOfConsoleInputEvents(hStdin, &pId); key = GetKeyPressed(pId); } while (key == 0); - - if (key == VK_Y) + + if (key == KEY_YES) { HANDLE hProcess; pId = pPerfData[selection+scrolled].ProcessId; @@ -317,8 +299,11 @@ { if (!TerminateProcess(hProcess, 0)) { - _tcscpy(lpStr, _T("Unable to terminate this process... ")); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId); + if (LoadString(hInst, IDS_KILL_PROCESS_ERR1, lpStr, 80)) + { + WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars); + WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); + } Sleep(1000); } @@ -326,11 +311,17 @@ } else { - _stprintf(lpStr, _T("Unable to terminate process %3d (unable to OpenProcess) "), pId); - WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &pId); - Sleep(1000); + if (LoadString(hInst, IDS_KILL_PROCESS_ERR2, lpStr, 80)) + { + WriteConsoleOutputCharacter(hStdout, lpEmpty, _tcslen(lpEmpty), pos, &numChars); + _stprintf(lpStr, lpStr, pId); + WriteConsoleOutputCharacter(hStdout, lpStr, _tcslen(lpStr), pos, &numChars); + } + Sleep(1000); } } + + first = 0; } else if (key == VK_UP) { @@ -350,11 +341,6 @@ return FALSE; } -void PerfInit() -{ -// NtQuerySystemInformation = //(PROCNTQSI)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), //"NtQuerySystemInformation"); -} - void PerfDataRefresh() { LONG status; @@ -435,11 +421,9 @@ // Now alloc a new PERFDATA array and fill in the data if (pPerfDataOld) { - //delete[] pPerfDataOld; free(pPerfDataOld); } pPerfDataOld = pPerfData; - //pPerfData = new PERFDATA[ProcessCount]; pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount); pSPI = PsaWalkFirstProcess((PSYSTEM_PROCESSES)pBuffer); for (Idx=0; Idx<ProcessCount; Idx++) { @@ -461,7 +445,13 @@ pPerfData[Idx].ImageName[pSPI->ProcessName.Length / sizeof(WCHAR)] = 0; } else - wcscpy(pPerfData[Idx].ImageName, L"System Idle Process"); + { +#ifdef _UNICODE + wcscpy(pPerfData[Idx].ImageName, lpIdleProcess); +#else + MultiByteToWideChar(CP_ACP, 0, lpIdleProcess, strlen(lpIdleProcess), pPerfData[Idx].ImageName, MAX_PATH); +#endif + } pPerfData[Idx].ProcessId = pSPI->ProcessId; @@ -531,7 +521,6 @@ #endif pSPI = PsaWalkNextProcess(pSPI); } - //delete[] pBuffer; PsaFreeCapture(pBuffer); free(SysProcessorTimeInfo); @@ -565,31 +554,96 @@ int main(int *argc, char **argv) { + int i; + TCHAR lpStr[80]; + + for (i = 0; i < 80; i++) + lpEmpty[i] = lpHeader[i] = _T(' '); + lpEmpty[79] = _T('\0'); + + /* Initialize global variables */ + hInst = 0 /* FIXME: which value? [used with LoadString(hInst, ..., ..., ...)] */; + if (LoadString(hInst, IDS_COLUMN_IMAGENAME, lpStr, 80)) + { + columnRightPositions[0] = _tcslen(lpStr); + _tcsncpy(&lpHeader[2], lpStr, _tcslen(lpStr)); + } + if (LoadString(hInst, IDS_COLUMN_PID, lpStr, 80)) + { + columnRightPositions[1] = columnRightPositions[0] + _tcslen(lpStr) + 3; + _tcsncpy(&lpHeader[columnRightPositions[0] + 2], lpStr, _tcslen(lpStr)); + } + if (LoadString(hInst, IDS_COLUMN_CPU, lpStr, 80)) + { + columnRightPositions[2] = columnRightPositions[1] + _tcslen(lpStr) + 3; + _tcsncpy(&lpHeader[columnRightPositions[1] + 2], lpStr, _tcslen(lpStr)); + } + if (LoadString(hInst, IDS_COLUMN_MEM, lpStr, 80)) + { + columnRightPositions[3] = columnRightPositions[2] + _tcslen(lpStr) + 3; + _tcsncpy(&lpHeader[columnRightPositions[2] + 2], lpStr, _tcslen(lpStr)); + } + if (LoadString(hInst, IDS_COLUMN_PF, lpStr, 80)) + { + columnRightPositions[4] = columnRightPositions[3] + _tcslen(lpStr) + 3; + _tcsncpy(&lpHeader[columnRightPositions[3] + 2], lpStr, _tcslen(lpStr)); + } + + for (i = 0; i < columnRightPositions[4]; i++) + lpSeparator[i] = _T('-'); + lpHeader[0] = _T('|'); + lpSeparator[0] = _T('+'); + for (i = 0; i < 5; i++) + { + lpHeader[columnRightPositions[i]] = _T('|'); + lpSeparator[columnRightPositions[i]] = _T('+'); + } + lpSeparator[columnRightPositions[4] + 1] = _T('\0'); + + if (!LoadString(hInst, IDS_APP_TITLE, lpTitle, 80)) + lpTitle[0] = _T('\0'); + if (!LoadString(hInst, IDS_COLUMN_MEM_UNIT, lpMemUnit, 3)) + lpMemUnit[0] = _T('\0'); + if (!LoadString(hInst, IDS_MENU, lpMenu, 80)) + lpMenu[0] = _T('\0'); + if (!LoadString(hInst, IDS_IDLE_PROCESS, lpIdleProcess, 80)) + lpIdleProcess[0] = _T('\0'); + + if (LoadString(hInst, IDS_MENU_QUIT, lpStr, 2)) + KEY_QUIT = lpStr[0]; + if (LoadString(hInst, IDS_MENU_KILL_PROCESS, lpStr, 2)) + KEY_KILL = lpStr[0]; + if (LoadString(hInst, IDS_YES, lpStr, 2)) + KEY_YES = lpStr[0]; + if (LoadString(hInst, IDS_NO, lpStr, 2)) + KEY_NO = lpStr[0]; + GetInputOutputHandles(); if (hStdin == INVALID_HANDLE_VALUE || hStdout == INVALID_HANDLE_VALUE) { - printf("ctm: can't use console."); + if (LoadString(hInst, IDS_CTM_GENERAL_ERR1, lpStr, 80)) + _tprintf(lpStr); return -1; } if (GetConsoleMode(hStdin, &inConMode) == 0) { - printf("ctm: can't GetConsoleMode() for input console."); + if (LoadString(hInst, IDS_CTM_GENERAL_ERR2, lpStr, 80)) + _tprintf(lpStr); return -1; } if (GetConsoleMode(hStdout, &outConMode) == 0) { - printf("ctm: can't GetConsoleMode() for output console."); + if (LoadString(hInst, IDS_CTM_GENERAL_ERR3, lpStr, 80)) + _tprintf(lpStr); return -1; } SetConsoleMode(hStdin, 0); //FIXME: Should check for error! SetConsoleMode(hStdout, 0); //FIXME: Should check for error! - PerfInit(); - while (1) { DWORD numEvents; @@ -598,7 +652,7 @@ DisplayScreen(); //WriteConsole(hStdin, " ", 1, &numEvents, NULL); // TODO: Make another way (this is ugly, I know) -#if 1 +#if 0 /* WaitForSingleObject for console handles is not implemented in ROS */ WaitForSingleObject(hStdin, 1000); #endif @@ -610,7 +664,7 @@ if (ProcessKeys(numEvents) == TRUE) break; } -#if 0 +#if 1 else { /* Should be removed, if WaitForSingleObject is implemented for console handles */ _____ Modified: trunk/rosapps/sysutils/ctm/ctm.rc --- trunk/rosapps/sysutils/ctm/ctm.rc 2005-01-15 15:09:22 UTC (rev 13056) +++ trunk/rosapps/sysutils/ctm/ctm.rc 2005-01-15 15:28:51 UTC (rev 13057) @@ -1,7 +1,13 @@ -/* $Id: ctm.rc,v 1.3 2004/10/16 22:30:18 gvg Exp $ */ +/* $Id$ */ +#include <defines.h> +#include "resource.h" + #define REACTOS_STR_FILE_DESCRIPTION "ReactOS Console Task Manager\0" #define REACTOS_STR_INTERNAL_NAME "ctm\0" #define REACTOS_STR_ORIGINAL_FILENAME "ctm.exe\0" #define REACTOS_STR_ORIGINAL_COPYRIGHT "2003, Aleksey Bragin\0" #include <reactos/version.rc> + +#include "En.rc" +#include "Fr.rc" _____ Added: trunk/rosapps/sysutils/ctm/resource.h --- trunk/rosapps/sysutils/ctm/resource.h 2005-01-15 15:09:22 UTC (rev 13056) +++ trunk/rosapps/sysutils/ctm/resource.h 2005-01-15 15:28:51 UTC (rev 13057) @@ -0,0 +1,44 @@ +/* + * CTM resource definitions + * + * Copyright 2004 ReactOS team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define IDS_APP_TITLE 0 + +#define IDS_COLUMN_IMAGENAME 10 +#define IDS_COLUMN_PID 11 +#define IDS_COLUMN_CPU 12 +#define IDS_COLUMN_MEM 13 +#define IDS_COLUMN_MEM_UNIT 14 +#define IDS_COLUMN_PF 15 + +#define IDS_IDLE_PROCESS 100 +#define IDS_YES 101 +#define IDS_NO 102 + +#define IDS_MENU 200 +#define IDS_MENU_QUIT 201 +#define IDS_MENU_KILL_PROCESS 202 + +#define IDS_KILL_PROCESS 1000 +#define IDS_KILL_PROCESS_ERR1 1001 +#define IDS_KILL_PROCESS_ERR2 1002 + +#define IDS_CTM_GENERAL_ERR1 32768 +#define IDS_CTM_GENERAL_ERR2 32769 +#define IDS_CTM_GENERAL_ERR3 32770
19 years, 10 months
1
0
0
0
[gvg] 13056: amdg <xbn@isw.uni-stuttgart.de>
by gvg@svn.reactos.com
amdg <xbn(a)isw.uni-stuttgart.de> Spanish translation for timedate.cpl Added: trunk/reactos/lib/cpl/timedate/Es.rc Modified: trunk/reactos/lib/cpl/timedate/timedate.rc _____ Added: trunk/reactos/lib/cpl/timedate/Es.rc _____ Modified: trunk/reactos/lib/cpl/timedate/timedate.rc --- trunk/reactos/lib/cpl/timedate/timedate.rc 2005-01-15 13:52:36 UTC (rev 13055) +++ trunk/reactos/lib/cpl/timedate/timedate.rc 2005-01-15 15:09:22 UTC (rev 13056) @@ -17,7 +17,7 @@ IDC_CPLICON ICON "resources/applet.ico" +#include "En.rc" #include "De.rc" -#include "En.rc" +#include "Es.rc" #include "Fr.rc" -
19 years, 10 months
1
0
0
0
[chorns] 13055: * LinkerFlag tag support
by chorns@svn.reactos.com
* LinkerFlag tag support * Build addsys, libwine.a, user32.dll, advapi32.dll, gdi32.dll, msvcrt.dll, and welcome.exe Modified: branches/xmlbuildsystem/reactos/ReactOS.xml Added: branches/xmlbuildsystem/reactos/iface/addsys/addsys.xml Modified: branches/xmlbuildsystem/reactos/iface/addsys/genw32k.c Added: branches/xmlbuildsystem/reactos/iface/native/genntdll.xml Deleted: branches/xmlbuildsystem/reactos/iface/native/module.xml Added: branches/xmlbuildsystem/reactos/lib/advapi32/advapi32.xml Modified: branches/xmlbuildsystem/reactos/lib/directory.xml Added: branches/xmlbuildsystem/reactos/lib/gdi32/gdi32.xml Added: branches/xmlbuildsystem/reactos/lib/libwine/libwine.xml Modified: branches/xmlbuildsystem/reactos/lib/msvcrt/misc/dllmain.c Modified: branches/xmlbuildsystem/reactos/lib/msvcrt/misc/environ.c Added: branches/xmlbuildsystem/reactos/lib/msvcrt/msvcrt.xml Added: branches/xmlbuildsystem/reactos/lib/user32/user32.xml Added: branches/xmlbuildsystem/reactos/subsys/directory.xml Added: branches/xmlbuildsystem/reactos/subsys/system/directory.xml Added: branches/xmlbuildsystem/reactos/subsys/system/welcome/welcome.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/include.cpp Added: branches/xmlbuildsystem/reactos/tools/rbuild/linkerflag.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/test.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/linkerflag.xml Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/linkerflagtest.cpp _____ Modified: branches/xmlbuildsystem/reactos/ReactOS.xml --- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -30,8 +30,11 @@ <xi:include href="hal/directory.xml" /> </directory> <directory name="iface"> + <directory name="addsys"> + <xi:include href="iface/addsys/addsys.xml" /> + </directory> <directory name="native"> - <xi:include href="iface/native/module.xml" /> + <xi:include href="iface/native/genntdll.xml" /> </directory> </directory> <directory name="lib"> @@ -40,4 +43,7 @@ <directory name="ntoskrnl"> <xi:include href="ntoskrnl/ntoskrnl.xml" /> </directory> + <directory name="subsys"> + <xi:include href="subsys/directory.xml" /> + </directory> </project> Property changes on: branches/xmlbuildsystem/reactos/iface/addsys ___________________________________________________________________ Name: svn:ignore - genw32k genw32k.exe + addsys addsys.exe _____ Added: branches/xmlbuildsystem/reactos/iface/addsys/addsys.xml --- branches/xmlbuildsystem/reactos/iface/addsys/addsys.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/iface/addsys/addsys.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,14 @@ +<module name="addsys" type="buildtool"> + <include base="addsys">.</include> + <file>genw32k.c</file> + <invoke> + <input> + <inputfile>w32ksvc.db</inputfile> + </input> + <output> + <outputfile>../../subsys/win32k/main/svctab.c</outputfile> + <outputfile>../../lib/gdi32/misc/win32k.c</outputfile> + <outputfile>../../lib/user32/misc/win32k.c</outputfile> + </output> + </invoke> +</module> _____ Modified: branches/xmlbuildsystem/reactos/iface/addsys/genw32k.c --- branches/xmlbuildsystem/reactos/iface/addsys/genw32k.c 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/iface/addsys/genw32k.c 2005-01-15 13:52:36 UTC (rev 13055) @@ -299,11 +299,11 @@ void usage(char * argv0) { printf("Usage: %s w32ksvc.db w32k.lst ssdt.h win32k.c win32k.c\n" - " w32ksvc.db input file(system calls database)\n" " w32k.lst system functions database\n" " ssdt.h WIN32K service table\n" " win32k.c GDI32 stubs\n" - " win32k.c USER32 stubs\n", + " win32k.c USER32 stubs\n" + " w32ksvc.db input file(system calls database)\n", argv0 ); } @@ -322,34 +322,34 @@ return(1); } - in = fopen(argv[1],"rb"); - if (in == NULL) - { - perror("Failed to open input file (system calls database)"); - return(1); - } - - out1 = fopen(argv[2],"wb"); + out1 = fopen(argv[1],"wb"); if (out1 == NULL) { perror("Failed to open output file (WIN32K service table)"); return(1); } - out2 = fopen(argv[3],"wb"); + out2 = fopen(argv[2],"wb"); if (out2 == NULL) { perror("Failed to open output file (GDI32 stubs)"); return(1); } - out3 = fopen(argv[4],"wb"); + out3 = fopen(argv[3],"wb"); if (out3 == NULL) { perror("Failed to open output file (USER32 stubs)"); return(1); } + in = fopen(argv[4],"rb"); + if (in == NULL) + { + perror("Failed to open input file (system calls database)"); + return(1); + } + ret = process(in,out2,out3); rewind(in); ret = makeSystemServiceTable(in, out1); _____ Copied: branches/xmlbuildsystem/reactos/iface/native/genntdll.xml (from rev 12972, branches/xmlbuildsystem/reactos/iface/native/module.xml) _____ Deleted: branches/xmlbuildsystem/reactos/iface/native/module.xml --- branches/xmlbuildsystem/reactos/iface/native/module.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/iface/native/module.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -1,14 +0,0 @@ -<module name="genntdll" type="buildtool"> - <include base="genntdll">.</include> - <file>genntdll.c</file> - <invoke> - <input> - <inputfile>sysfuncs.lst</inputfile> - </input> - <output> - <outputfile>../../lib/ntdll/napi.c</outputfile> - <outputfile>../../include/ntdll/napi.h</outputfile> - <outputfile>../../ntoskrnl/nt/zw.c</outputfile> - </output> - </invoke> -</module> _____ Added: branches/xmlbuildsystem/reactos/lib/advapi32/advapi32.xml --- branches/xmlbuildsystem/reactos/lib/advapi32/advapi32.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/lib/advapi32/advapi32.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,47 @@ +<module name="advapi32" type="win32dll"> + <importlibrary definition="advapi32.def" /> + <include base="advapi32">.</include> + <define name="__USE_W32API" /> + <define name="WINVER">0x600</define> + <define name="_WIN32_IE">0x0500</define> + <define name="_WIN32_WINNT">0x0501</define> + <library>ntdll</library> + <library>kernel32</library> + <directory name="crypt"> + <file>crypt.c</file> + <file>crypt_des.c</file> + <file>crypt_lmhash.c</file> + <file>crypt_md4.c</file> + <file>crypt_md5.c</file> + <file>crypt_sha.c</file> + </directory> + <directory name="misc"> + <file>dllmain.c</file> + <file>hwprofiles.c</file> + <file>logon.c</file> + <file>shutdown.c</file> + <file>sysfunc.c</file> + </directory> + <directory name="reg"> + <file>reg.c</file> + </directory> + <directory name="sec"> + <file>ac.c</file> + <file>audit.c</file> + <file>lsa.c</file> + <file>misc.c</file> + <file>sec.c</file> + <file>sid.c</file> + <file>trustee.c</file> + </directory> + <directory name="service"> + <file>eventlog.c</file> + <file>scm.c</file> + <file>sctrl.c</file> + <file>undoc.c</file> + </directory> + <directory name="token"> + <file>privilege.c</file> + <file>token.c</file> + </directory> +</module> _____ Modified: branches/xmlbuildsystem/reactos/lib/directory.xml --- branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -1,3 +1,9 @@ +<directory name="advapi32"> + <xi:include href="advapi32/advapi32.xml" /> +</directory> +<directory name="gdi32"> + <xi:include href="gdi32/gdi32.xml" /> +</directory> <directory name="kernel32"> <xi:include href="kernel32/kernel32.xml" /> </directory> @@ -4,6 +10,12 @@ <directory name="kjs"> <xi:include href="kjs/kjs.xml" /> </directory> +<directory name="libwine"> + <xi:include href="libwine/libwine.xml" /> +</directory> +<directory name="msvcrt"> + <xi:include href="msvcrt/msvcrt.xml" /> +</directory> <directory name="ntdll"> <xi:include href="ntdll/ntdll.xml" /> </directory> @@ -19,3 +31,6 @@ <directory name="string"> <xi:include href="string/string.xml" /> </directory> +<directory name="user32"> + <xi:include href="user32/user32.xml" /> +</directory> _____ Added: branches/xmlbuildsystem/reactos/lib/gdi32/gdi32.xml --- branches/xmlbuildsystem/reactos/lib/gdi32/gdi32.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/lib/gdi32/gdi32.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,35 @@ +<module name="gdi32" type="win32dll"> + <dependency>addsys</dependency> + <importlibrary definition="gdi32.def" /> + <include base="gdi32">include</include> + <define name="_DISABLE_TIDENTS" /> + <define name="UNICODE" /> + <define name="__USE_W32API" /> + <define name="WINVER">0x0600</define> + <define name="_WIN32_WINNT">0x0501</define> + <library>ntdll</library> + <library>rosrtl</library> + <library>kernel32</library> + <library>advapi32</library> + <directory name="main"> + <file>dllmain.c</file> + </directory> + <directory name="misc"> + <file>heap.c</file> + <file>misc.c</file> + <file>stubs.c</file> + <file>stubsa.c</file> + <file>stubsw.c</file> + <file>win32k.c</file> + <file>wingl.c</file> + </directory> + <directory name="objects"> + <file>bitblt.c</file> + <file>dc.c</file> + <file>font.c</file> + <file>linedda.c</file> + <file>metafile.c</file> + <file>region.c</file> + <file>text.c</file> + </directory> +</module> _____ Added: branches/xmlbuildsystem/reactos/lib/libwine/libwine.xml --- branches/xmlbuildsystem/reactos/lib/libwine/libwine.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/lib/libwine/libwine.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,5 @@ +<module name="wine" type="staticlibrary"> + <define name="_DISABLE_TIDENTS" /> + <define name="__REACTOS__" /> + <file>debug.c</file> +</module> _____ Modified: branches/xmlbuildsystem/reactos/lib/msvcrt/misc/dllmain.c --- branches/xmlbuildsystem/reactos/lib/msvcrt/misc/dllmain.c 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/lib/msvcrt/misc/dllmain.c 2005-01-15 13:52:36 UTC (rev 13055) @@ -91,8 +91,8 @@ return FALSE; } - _acmdln = strdup(GetCommandLineA()); - _wcmdln = wcsdup(GetCommandLineW()); + _acmdln = _strdup(GetCommandLineA()); + _wcmdln = _wcsdup(GetCommandLineW()); /* FIXME: more initializations... */ _____ Modified: branches/xmlbuildsystem/reactos/lib/msvcrt/misc/environ.c --- branches/xmlbuildsystem/reactos/lib/msvcrt/misc/environ.c 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/lib/msvcrt/misc/environ.c 2005-01-15 13:52:36 UTC (rev 13055) @@ -165,9 +165,9 @@ for (envptr = original_environment; count > 1; newenvptr++, count--) { if (wide) - *newenvptr = (char*)wcsdup((wchar_t*)*envptr++); + *newenvptr = (char*)_wcsdup((wchar_t*)*envptr++); else - *newenvptr = strdup(*envptr++); + *newenvptr = _strdup(*envptr++); if (*newenvptr == NULL) { for (newenvptr--; newenvptr >= newenv; newenvptr--); @@ -243,7 +243,7 @@ /* Find the option we're trying to modify. */ for (index = 0, wenvptr = _wenviron; *wenvptr != NULL; wenvptr++, index++) { - if (!wcsnicmp(*wenvptr, option, epos - option)) + if (!_wcsnicmp(*wenvptr, option, epos - option)) { found = 1; break; @@ -277,7 +277,7 @@ else { /* Make a copy of the option that we will store in the environment block. */ - woption = wcsdup((wchar_t*)option); + woption = _wcsdup((wchar_t*)option); if (woption == NULL) { free(name); _____ Added: branches/xmlbuildsystem/reactos/lib/msvcrt/msvcrt.xml --- branches/xmlbuildsystem/reactos/lib/msvcrt/msvcrt.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/lib/msvcrt/msvcrt.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,443 @@ +<module name="msvcrt" type="win32dll"> + <linkerflag>-nostartfiles</linkerflag> + <linkerflag>--enable-stdcall-fixup</linkerflag> + <linkerflag>-lgcc</linkerflag> + <importlibrary definition="msvcrt.def" /> + <include base="msvcrt">.</include> + <define name="_DISABLE_TIDENTS" /> + <define name="__USE_W32API" /> + <define name="_WIN32_IE">0x600</define> + <define name="_WIN32_WINNT">0x501</define> + <define name="__REACTOS__" /> + <define name="USE_MSVCRT_PREFIX" /> + <define name="_MSVCRT_LIB_" /> + <define name="_MT" /> + <library>wine</library> + <library>string</library> + <library>kernel32</library> + <library>ntdll</library> + <directory name="conio"> + <file>cgets.c</file> + <file>cprintf.c</file> + <file>cputs.c</file> + <file>cscanf.c</file> + <file>getch.c</file> + <file>getche.c</file> + <file>kbhit.c</file> + <file>putch.c</file> + <file>ungetch.c</file> + </directory> + <directory name="ctype"> + <file>ctype.c</file> + <file>isalnum.c</file> + <file>isalpha.c</file> + <file>isascii.c</file> + <file>iscntrl.c</file> + <file>iscsym.c</file> + <file>isctype.c</file> + <file>isdigit.c</file> + <file>isgraph.c</file> + <file>islower.c</file> + <file>isprint.c</file> + <file>ispunct.c</file> + <file>isspace.c</file> + <file>isupper.c</file> + <file>isxdigit.c</file> + <file>toascii.c</file> + <file>tolower.c</file> + <file>toupper.c</file> + </directory> + <directory name="direct"> + <file>chdir.c</file> + <file>chdrive.c</file> + <file>getcwd.c</file> + <file>getdcwd.c</file> + <file>getdfree.c</file> + <file>getdrive.c</file> + <file>mkdir.c</file> + <file>rmdir.c</file> + <file>wchdir.c</file> + <file>wgetcwd.c</file> + <file>wgetdcwd.c</file> + <file>wmkdir.c</file> + <file>wrmdir.c</file> + </directory> + <directory name="except"> + <file>abnorter.c</file> + <file>exhand2.c</file> + <file>matherr.c</file> + <file>seh.s</file> + <file>unwind.c</file> + <file>xcptfil.c</file> + </directory> + <directory name="float"> + <file>chgsign.c</file> + <file>clearfp.c</file> + <file>cntrlfp.c</file> + <file>copysign.c</file> + <file>fpclass.c</file> + <file>fpecode.c</file> + <file>fpreset.c</file> + <file>isnan.c</file> + <file>logb.c</file> + <file>nafter.c</file> + <file>scalb.c</file> + <file>statfp.c</file> + </directory> + <directory name="io"> + <file>access.c</file> + <file>chmod.c</file> + <file>chsize.c</file> + <file>close.c</file> + <file>commit.c</file> + <file>create.c</file> + <file>dup2.c</file> + <file>dup.c</file> + <file>eof.c</file> + <file>filelen.c</file> + <file>fileleni.c</file> + <file>find.c</file> + <file>fmode.c</file> + <file>isatty.c</file> + <file>locking.c</file> + <file>lseek.c</file> + <file>lseeki64.c</file> + <file>mktemp.c</file> + <file>open.c</file> + <file>pipe.c</file> + <file>read.c</file> + <file>setmode.c</file> + <file>sopen.c</file> + <file>stubs.c</file> + <file>tell.c</file> + <file>telli64.c</file> + <file>umask.c</file> + <file>unlink.c</file> + <file>utime.c</file> + <file>waccess.c</file> + <file>wchmod.c</file> + <file>wcreate.c</file> + <file>wfind.c</file> + <file>wmktemp.c</file> + <file>wopen.c</file> + <file>write.c</file> + <file>wunlink.c</file> + <file>wutime.c</file> + </directory> + <directory name="locale"> + <file>locale.c</file> + </directory> + <directory name="math"> + <file>acos.c</file> + <file>adjust.c</file> + <file>asin.c</file> + <file>atan2.c</file> + <file>atan.c</file> + <file>cabs.c</file> + <file>ceil.c</file> + <file>cos.c</file> + <file>cosh.c</file> + <file>exp.c</file> + <file>fabs.c</file> + <file>floor.c</file> + <file>fmod.c</file> + <file>frexp.c</file> + <file>huge_val.c</file> + <file>hypot.c</file> + <file>j0_y0.c</file> + <file>j1_y1.c</file> + <file>jn_yn.c</file> + <file>ldexp.c</file> + <file>log10.c</file> + <file>log.c</file> + <file>math.c</file> + <file>modf.c</file> + <file>pow.c</file> + <file>sin.c</file> + <file>sinh.c</file> + <file>sqrt.c</file> + <file>stubs.c</file> + <file>tan.c</file> + <file>tanh.c</file> + </directory> + <directory name="mbstring"> + <file>hanzen.c</file> + <file>ischira.c</file> + <file>iskana.c</file> + <file>iskmoji.c</file> + <file>iskpun.c</file> + <file>islead.c</file> + <file>islwr.c</file> + <file>ismbal.c</file> + <file>ismbaln.c</file> + <file>ismbc.c</file> + <file>ismbgra.c</file> + <file>ismbkaln.c</file> + <file>ismblead.c</file> + <file>ismbpri.c</file> + <file>ismbpun.c</file> + <file>ismbtrl.c</file> + <file>isuppr.c</file> + <file>jistojms.c</file> + <file>jmstojis.c</file> + <file>mbbtype.c</file> + <file>mbccpy.c</file> + <file>mbclen.c</file> + <file>mbscat.c</file> + <file>mbschr.c</file> + <file>mbscmp.c</file> + <file>mbscoll.c</file> + <file>mbscpy.c</file> + <file>mbscspn.c</file> + <file>mbsdec.c</file> + <file>mbsdup.c</file> + <file>mbsicmp.c</file> + <file>mbsicoll.c</file> + <file>mbsinc.c</file> + <file>mbslen.c</file> + <file>mbslwr.c</file> + <file>mbsncat.c</file> + <file>mbsnccnt.c</file> + <file>mbsncmp.c</file> + <file>mbsncoll.c</file> + <file>mbsncpy.c</file> + <file>mbsnextc.c</file> + <file>mbsnicmp.c</file> + <file>mbsnicoll.c</file> + <file>mbsninc.c</file> + <file>mbsnset.c</file> + <file>mbspbrk.c</file> + <file>mbsrchr.c</file> + <file>mbsrev.c</file> + <file>mbsset.c</file> + <file>mbsspn.c</file> + <file>mbsspnp.c</file> + <file>mbsstr.c</file> + <file>mbstok.c</file> + <file>mbstrlen.c</file> + <file>mbsupr.c</file> + </directory> + <directory name="misc"> + <file>amsg.c</file> + <file>assert.c</file> + <file>crtmain.c</file> + <file>dllmain.c</file> + <file>environ.c</file> + <file>getargs.c</file> + <file>initterm.c</file> + <file>lock.c</file> + <file>purecall.c</file> + <file>stubs.c</file> + <file>tls.c</file> + </directory> + <directory name="process"> + <file>_cwait.c</file> + <file>_system.c</file> + <file>dll.c</file> + <file>process.c</file> + <file>procid.c</file> + <file>thread.c</file> + <file>threadid.c</file> + <file>threadx.c</file> + </directory> + <directory name="search"> + <file>lfind.c</file> + <file>lsearch.c</file> + </directory> + <directory name="setjmp"> + <directory name="i386"> + <file>setjmp.s</file> + </directory> + </directory> + <directory name="signal"> + <file>signal.c</file> + </directory> + <directory name="stdio"> + <file>allocfil.c</file> + <file>clearerr.c</file> + <file>fclose.c</file> + <file>fdopen.c</file> + <file>feof.c</file> + <file>ferror.c</file> + <file>fflush.c</file> + <file>fgetc.c</file> + <file>fgetchar.c</file> + <file>fgetpos.c</file> + <file>fgets.c</file> + <file>fgetws.c</file> + <file>filbuf.c</file> + <file>fileno.c</file> + <file>flsbuf.c</file> + <file>fopen.c</file> + <file>fprintf.c</file> + <file>fputc.c</file> + <file>fputchar.c</file> + <file>fputs.c</file> + <file>fread.c</file> + <file>freopen.c</file> + <file>fscanf.c</file> + <file>fseek.c</file> + <file>fsetpos.c</file> + <file>fsopen.c</file> + <file>ftell.c</file> + <file>fwalk.c</file> + <file>fwrite.c</file> + <file>getc.c</file> + <file>getchar.c</file> + <file>gets.c</file> + <file>getw.c</file> + <file>perror.c</file> + <file>popen.c</file> + <file>printf.c</file> + <file>putc.c</file> + <file>putchar.c</file> + <file>puts.c</file> + <file>putw.c</file> + <file>remove.c</file> + <file>rename.c</file> + <file>rewind.c</file> + <file>rmtmp.c</file> + <file>scanf.c</file> + <file>setbuf.c</file> + <file>setvbuf.c</file> + <file>sprintf.c</file> + <file>sscanf.c</file> + <file>stdhnd.c</file> + <file>tempnam.c</file> + <file>tmpfile.c</file> + <file>tmpnam.c</file> + <file>ungetc.c</file> + <file>vfprintf.c</file> + <file>vfscanf.c</file> + <file>vfwprint.c</file> + <file>vprintf.c</file> + <file>vscanf.c</file> + <file>vsprintf.c</file> + <file>vsscanf.c</file> + <file>wfdopen.c</file> + <file>wrename.c</file> + <file>wtempnam.c</file> + <file>wtmpnam.c</file> + </directory> + <directory name="stdlib"> + <file>abort.c</file> + <file>abs.c</file> + <file>atexit.c</file> + <file>atof.c</file> + <file>atoi.c</file> + <file>atoi64.c</file> + <file>atol.c</file> + <file>atold.c</file> + <file>bsearch.c</file> + <file>div.c</file> + <file>ecvt.c</file> + <file>ecvtbuf.c</file> + <file>errno.c</file> + <file>fcvt.c</file> + <file>fcvtbuf.c</file> + <file>fullpath.c</file> + <file>gcvt.c</file> + <file>getenv.c</file> + <file>itoa.c</file> + <file>itow.c</file> + <file>labs.c</file> + <file>ldiv.c</file> + <file>makepath.c</file> + <file>malloc.c</file> + <file>mbstowcs.c</file> + <file>mbtowc.c</file> + <file>obsol.c</file> + <file>putenv.c</file> + <file>qsort.c</file> + <file>rand.c</file> + <file>rot.c</file> + <file>senv.c</file> + <file>splitp.c</file> + <file>strtod.c</file> + <file>strtol.c</file> + <file>strtold.c</file> + <file>strtoll.c</file> + <file>strtoul.c</file> + <file>strtoull.c</file> + <file>swab.c</file> + <file>wcstod.c</file> + <file>wcstol.c</file> + <file>wcstom.c</file> + <file>wcstomb.c</file> + <file>wcstombs.c</file> + <file>wcstoul.c</file> + <file>wctomb.c</file> + <file>wfulpath.c</file> + <file>witoa.c</file> + <file>witow.c</file> + <file>wmakpath.c</file> + <file>wputenv.c</file> + <file>wsenv.c</file> + <file>wsplitp.c</file> + <file>wtoi.c</file> + <file>wtoi64.c</file> + <file>_exit.c</file> + </directory> + <directory name="string"> + <file>lasttok.c</file> + <file>memicmp.c</file> + <file>strcoll.c</file> + <file>strdup.c</file> + <file>strerror.c</file> + <file>stricmp.c</file> + <file>strlwr.c</file> + <file>strncoll.c</file> + <file>strnicmp.c</file> + <file>strpbrk.c</file> + <file>strrev.c</file> + <file>strset.c</file> + <file>strstr.c</file> + <file>strtok.c</file> + <file>strupr.c</file> + <file>strxfrm.c</file> + </directory> + <directory name="sys_stat"> + <file>fstat.c</file> + <file>fstati64.c</file> + <file>futime.c</file> + <file>stat.c</file> + <file>wstat.c</file> + </directory> + <directory name="time"> + <file>clock.c</file> + <file>ctime.c</file> + <file>difftime.c</file> + <file>ftime.c</file> + <file>strdate.c</file> + <file>strftime.c</file> + <file>strtime.c</file> + <file>time.c</file> + <file>tz_vars.c</file> + <file>wctime.c</file> + <file>wstrdate.c</file> + <file>wstrtime.c</file> + </directory> + <directory name="wine"> + <file>cpp.c</file> + <file>cppexcept.c</file> + <file>heap.c</file> + <file>thread.c</file> + </directory> + <directory name="wstring"> + <file>wcscoll.c</file> + <file>wcscspn.c</file> + <file>wcsdup.c</file> + <file>wcsicmp.c</file> + <file>wcslwr.c</file> + <file>wcsnicmp.c</file> + <file>wcspbrk.c</file> + <file>wcsrev.c</file> + <file>wcsset.c</file> + <file>wcsspn.c</file> + <file>wcsstr.c</file> + <file>wcstok.c</file> + <file>wcsupr.c</file> + <file>wcsxfrm.c</file> + <file>wlasttok.c</file> + </directory> +</module> _____ Added: branches/xmlbuildsystem/reactos/lib/user32/user32.xml --- branches/xmlbuildsystem/reactos/lib/user32/user32.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/lib/user32/user32.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,74 @@ +<module name="user32" type="win32dll"> + <dependency>addsys</dependency> + <importlibrary definition="user32.def" /> + <include base="user32">include</include> + <define name="_DISABLE_TIDENTS" /> + <define name="UNICODE" /> + <define name="__REACTOS__" /> + <define name="__USE_W32API" /> + <define name="WINVER">0x0600</define> + <define name="_WIN32_WINNT">0x0501</define> + <library>wine</library> + <library>ntdll</library> + <library>gdi32</library> + <library>rosrtl</library> + <library>kernel32</library> + <library>advapi32</library> + <directory name="controls"> + <file>button.c</file> + <file>combo.c</file> + <file>edit.c</file> + <file>icontitle.c</file> + <file>listbox.c</file> + <file>regcontrol.c</file> + <file>scrollbar.c</file> + <file>static.c</file> + </directory> + <directory name="misc"> + <file>dde.c</file> + <file>ddeclient.c</file> + <file>ddeserver.c</file> + <file>desktop.c</file> + <file>display.c</file> + <file>dllmain.c</file> + <file>exit.c</file> + <file>exticon.c</file> + <file>misc.c</file> + <file>object.c</file> + <file>resources.c</file> + <file>strpool.c</file> + <file>stubs.c</file> + <file>timer.c</file> + <file>win32k.c</file> + <file>winhelp.c</file> + <file>winsta.c</file> + <file>wsprintf.c</file> + </directory> + <directory name="windows"> + <file>accel.c</file> + <file>bitmap.c</file> + <file>caret.c</file> + <file>class.c</file> + <file>clipboard.c</file> + <file>cursor.c</file> + <file>dc.c</file> + <file>defwnd.c</file> + <file>dialog.c</file> + <file>draw.c</file> + <file>font.c</file> + <file>hook.c</file> + <file>icon.c</file> + <file>input.c</file> + <file>mdi.c</file> + <file>menu.c</file> + <file>message.c</file> + <file>messagebox.c</file> + <file>nonclient.c</file> + <file>paint.c</file> + <file>prop.c</file> + <file>rect.c</file> + <file>text.c</file> + <file>window.c</file> + <file>winpos.c</file> + </directory> +</module> _____ Added: branches/xmlbuildsystem/reactos/subsys/directory.xml --- branches/xmlbuildsystem/reactos/subsys/directory.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/subsys/directory.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,3 @@ +<directory name="system"> + <xi:include href="system/directory.xml" /> +</directory> _____ Added: branches/xmlbuildsystem/reactos/subsys/system/directory.xml --- branches/xmlbuildsystem/reactos/subsys/system/directory.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/subsys/system/directory.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,3 @@ +<directory name="welcome"> + <xi:include href="welcome/welcome.xml" /> +</directory> _____ Added: branches/xmlbuildsystem/reactos/subsys/system/welcome/welcome.xml --- branches/xmlbuildsystem/reactos/subsys/system/welcome/welcome.xml 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/subsys/system/welcome/welcome.xml 2005-01-15 13:52:36 UTC (rev 13055) @@ -0,0 +1,9 @@ +<module name="welcome" type="win32gui"> + <define name="_WIN32_IE">0x0501</define> + <define name="_WIN32_WINNT">0x0501</define> + <define name="__USE_W32API" /> + <library>kernel32</library> + <library>gdi32</library> + <library>user32</library> + <file>welcome.c</file> +</module> _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-15 13:52:36 UTC (rev 13055) @@ -129,6 +129,20 @@ } } +string +MingwBackend::GenerateProjectLFLAGS () +{ + string lflags; + for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ ) + { + LinkerFlag& linkerFlag = *ProjectNode.linkerFlags[i]; + if ( lflags.length () > 0 ) + lflags += " "; + lflags += linkerFlag.flag; + } + return lflags; +} + void MingwBackend::GenerateGlobalVariables () { @@ -146,6 +160,7 @@ ProjectNode.includes, ProjectNode.defines, ProjectNode.ifs ); + fprintf ( fMakefile, "PROJECT_LFLAGS = %s\n", GenerateProjectLFLAGS ().c_str () ); fprintf ( fMakefile, "\n" ); fprintf ( fMakefile, ".PHONY: clean\n\n" ); _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-15 13:52:36 UTC (rev 13055) @@ -21,6 +21,7 @@ const std::vector<Include*>& includes, const std::vector<Define*>& defines, const std::vector<If*>& ifs ); + std::string GenerateProjectLFLAGS (); void GenerateGlobalVariables (); void GenerateAllTarget (); FILE* fMakefile; _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-15 10:37:01 UTC (rev 13054) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-15 13:52:36 UTC (rev 13055) @@ -265,15 +265,38 @@ return parameters; } + +string +MingwModuleHandler::GenerateLinkerParametersFromVector ( const vector<LinkerFlag*>& linkerFlags ) const +{ + string parameters; + for ( size_t i = 0; i < linkerFlags.size (); i++ ) + { + LinkerFlag& linkerFlag = *linkerFlags[i]; + if ( parameters.length () > 0 ) + parameters += " "; + parameters += linkerFlag.flag; + } + return parameters; +} + +string +MingwModuleHandler::GenerateLinkerParameters ( const Module& module ) const +{ + return GenerateLinkerParametersFromVector ( module.linkerFlags ); +} + void MingwModuleHandler::GenerateMacros ( - const char* op, + const char* assignmentOperation, const vector<File*>& files, const vector<Include*>& includes, const vector<Define*>& defines, + const vector<LinkerFlag*>* linkerFlags, const vector<If*>& ifs, const string& cflags_macro, const string& nasmflags_macro, + const string& linkerflags_macro, const string& objs_macro) const { size_t i; @@ -284,7 +307,7 @@ fMakefile, "%s %s", cflags_macro.c_str(), - op ); + assignmentOperation ); for ( i = 0; i < includes.size(); i++ ) { fprintf ( @@ -307,14 +330,28 @@ } fprintf ( fMakefile, "\n" ); } - + + if ( linkerFlags != NULL ) + { + string linkerParameters = GenerateLinkerParametersFromVector ( *linkerFlags ); + if ( linkerParameters.size () > 0 ) + { + fprintf ( + fMakefile, + "%s %s %s\n", + linkerflags_macro.c_str (), + assignmentOperation, + linkerParameters.c_str() ); + } + } + if ( files.size() ) { fprintf ( fMakefile, "%s %s", objs_macro.c_str(), [truncated at 1000 lines; 641 more skipped]
19 years, 10 months
1
0
0
0
← Newer
1
...
29
30
31
32
33
34
35
...
71
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Results per page:
10
25
50
100
200