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] 13214: * Build cabman and zlib
by chorns@svn.reactos.com
* Build cabman and zlib * Add iso module type Modified: branches/xmlbuildsystem/reactos/ReactOS.xml Modified: branches/xmlbuildsystem/reactos/lib/directory.xml Added: branches/xmlbuildsystem/reactos/lib/zlib/zlib.xml Added: branches/xmlbuildsystem/reactos/tools/cabman/cabman.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/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h Modified: branches/xmlbuildsystem/reactos/tools/tools.xml _____ Modified: branches/xmlbuildsystem/reactos/ReactOS.xml --- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -50,4 +50,7 @@ <directory name="subsys"> <xi:include href="subsys/directory.xml" /> </directory> + + <module name="bootcd" type="iso"> + </module> </project> _____ Modified: branches/xmlbuildsystem/reactos/lib/directory.xml --- branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/lib/directory.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -100,3 +100,6 @@ <directory name="ws2_32"> <xi:include href="ws2_32/ws2_32.xml" /> </directory> +<directory name="zlib"> + <xi:include href="zlib/zlib.xml" /> +</directory> _____ Added: branches/xmlbuildsystem/reactos/lib/zlib/zlib.xml --- branches/xmlbuildsystem/reactos/lib/zlib/zlib.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/lib/zlib/zlib.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -0,0 +1,17 @@ +<module name="zlib" type="staticlibrary"> + <include base="zlib">.</include> + <file>adler32.c</file> + <file>compress.c</file> + <file>crc32.c</file> + <file>gzio.c</file> + <file>uncompr.c</file> + <file>deflate.c</file> + <file>trees.c</file> + <file>zutil.c</file> + <file>inflate.c</file> + <file>infblock.c</file> + <file>inftrees.c</file> + <file>infcodes.c</file> + <file>infutil.c</file> + <file>inffast.c</file> +</module> _____ Added: branches/xmlbuildsystem/reactos/tools/cabman/cabman.xml --- branches/xmlbuildsystem/reactos/tools/cabman/cabman.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/cabman/cabman.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -0,0 +1,10 @@ +<module name="cabman" type="buildtool"> + <include base="cabman">.</include> + <include base="zlib">.</include> + <library>zlib</library> + <file>cabinet.cxx</file> + <file>dfp.cxx</file> + <file>main.cxx</file> + <file>mszip.cxx</file> + <file>raw.cxx</file> +</module> _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-22 15:27:06 UTC (rev 13214) @@ -48,14 +48,14 @@ } void -MingwBackend::CloseMakefile () +MingwBackend::CloseMakefile () const { if (fMakefile) fclose ( fMakefile ); } void -MingwBackend::GenerateHeader () +MingwBackend::GenerateHeader () const { fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" ); } @@ -101,7 +101,7 @@ const vector<Property*>& properties, const vector<Include*>& includes, const vector<Define*>& defines, - const vector<If*>& ifs ) + const vector<If*>& ifs ) const { size_t i; @@ -144,7 +144,7 @@ } string -MingwBackend::GenerateProjectLFLAGS () +MingwBackend::GenerateProjectLFLAGS () const { string lflags; for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ ) @@ -158,15 +158,17 @@ } void -MingwBackend::GenerateGlobalVariables () +MingwBackend::GenerateGlobalVariables () const { #ifdef WIN32 fprintf ( fMakefile, "host_gcc = gcc\n" ); + fprintf ( fMakefile, "host_gpp = g++\n" ); fprintf ( fMakefile, "host_ld = ld\n" ); fprintf ( fMakefile, "host_ar = ar\n" ); fprintf ( fMakefile, "host_objcopy = objcopy\n" ); fprintf ( fMakefile, "rm = del /f /q\n" ); fprintf ( fMakefile, "gcc = gcc\n" ); + fprintf ( fMakefile, "gpp = g++\n" ); fprintf ( fMakefile, "ld = ld\n" ); fprintf ( fMakefile, "ar = ar\n" ); fprintf ( fMakefile, "objcopy = objcopy\n" ); @@ -174,11 +176,13 @@ fprintf ( fMakefile, "windres = windres\n" ); #else fprintf ( fMakefile, "host_gcc = gcc\n" ); + fprintf ( fMakefile, "host_gpp = g++\n" ); fprintf ( fMakefile, "host_ld = ld\n" ); fprintf ( fMakefile, "host_ar = ar\n" ); fprintf ( fMakefile, "host_objcopy = objcopy\n" ); fprintf ( fMakefile, "rm = rm -f\n" ); fprintf ( fMakefile, "gcc = mingw32-gcc\n" ); + fprintf ( fMakefile, "gpp = mingw32-g++\n" ); fprintf ( fMakefile, "ld = mingw32-ld\n" ); fprintf ( fMakefile, "ar = mingw32-ar\n" ); fprintf ( fMakefile, "objcopy = mingw32-objcopy\n" ); @@ -204,14 +208,24 @@ fprintf ( fMakefile, ".PHONY: clean\n\n" ); } +bool +MingwBackend::IncludeInAllTarget ( const Module& module ) const +{ + if ( module.type == ObjectLibrary ) + return false; + if ( module.type == Iso ) + return false; + return true; +} + void -MingwBackend::GenerateAllTarget () +MingwBackend::GenerateAllTarget () const { fprintf ( fMakefile, "all:" ); for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { Module& module = *ProjectNode.modules[i]; - if ( module.type != ObjectLibrary ) + if ( IncludeInAllTarget ( module ) ) { fprintf ( fMakefile, " %s", @@ -222,7 +236,7 @@ } void -MingwBackend::ProcessModule ( Module& module ) +MingwBackend::ProcessModule ( Module& module ) const { MingwModuleHandler* h = MingwModuleHandler::LookupHandler ( module.node.location, _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-22 15:27:06 UTC (rev 13214) @@ -10,10 +10,10 @@ MingwBackend ( Project& project ); virtual void Process (); private: - void ProcessModule ( Module& module ); + void ProcessModule ( Module& module ) const; void CreateMakefile (); - void CloseMakefile (); - void GenerateHeader (); + void CloseMakefile () const; + void GenerateHeader () const; void GenerateProjectCFlagsMacro ( const char* assignmentOperation, const std::vector<Include*>& includes, const std::vector<Define*>& defines ) const; @@ -21,11 +21,12 @@ const std::vector<Property*>& properties, const std::vector<Include*>& includes, const std::vector<Define*>& defines, - const std::vector<If*>& ifs ); - std::string GenerateProjectLFLAGS (); - void GenerateDirectoryTargets (); - void GenerateGlobalVariables (); - void GenerateAllTarget (); + const std::vector<If*>& ifs ) const; + std::string GenerateProjectLFLAGS () const; + void GenerateDirectoryTargets () const; + void GenerateGlobalVariables () const; + bool IncludeInAllTarget ( const Module& module ) const; + void GenerateAllTarget () const; FILE* fMakefile; }; _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-22 15:27:06 UTC (rev 13214) @@ -83,18 +83,6 @@ } string -MingwModuleHandler::GetExtension ( const string& filename ) const -{ - size_t index = filename.find_last_of ( '/' ); - if (index == string::npos) index = 0; - string tmp = filename.substr( index, filename.size() - index ); - size_t ext_index = tmp.find_last_of( '.' ); - if (ext_index != string::npos) - return filename.substr ( index + ext_index, filename.size() ); - return ""; -} - -string MingwModuleHandler::GetBasename ( const string& filename ) const { size_t index = filename.find_last_of ( '.' ); @@ -722,6 +710,7 @@ MingwModuleHandler::GenerateCommands ( const Module& module, const string& sourceFilename, const string& cc, + const string& cppc, const string& cflagsMacro, const string& nasmflagsMacro, const string& windresflagsMacro ) const @@ -735,6 +724,14 @@ cflagsMacro ); return; } + else if ( extension == ".cxx" || extension == ".CXX" ) + { + GenerateGccCommand ( module, + sourceFilename, + cppc, + cflagsMacro ); + return; + } else if ( extension == ".s" || extension == ".S" ) { GenerateGccAssemblerCommand ( module, @@ -848,6 +845,7 @@ const vector<File*>& files, const vector<If*>& ifs, const string& cc, + const string& cppc, const string& cflagsMacro, const string& nasmflagsMacro, const string& windresflagsMacro ) const @@ -860,6 +858,7 @@ GenerateCommands ( module, sourceFilename, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -873,6 +872,7 @@ ifs[i]->files, ifs[i]->ifs, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -882,6 +882,7 @@ void MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, const string& cc, + const string& cppc, const string& cflagsMacro, const string& nasmflagsMacro, const string& windresflagsMacro ) const @@ -890,6 +891,7 @@ module.files, module.ifs, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -956,6 +958,7 @@ MingwModuleHandler::GenerateMacrosAndTargets ( const Module& module, const string& cc, + const string& cppc, const string& ar, const string* cflags ) const { @@ -995,6 +998,7 @@ string ar_target = GenerateArchiveTarget ( module, ar, objectsMacro ); GenerateObjectFileTargets ( module, cc, + cppc, cflagsMacro, nasmflagsMacro, windresflagsMacro ); @@ -1017,7 +1021,7 @@ void MingwModuleHandler::GenerateMacrosAndTargetsHost ( const Module& module ) const { - GenerateMacrosAndTargets ( module, "${host_gcc}", "${host_ar}", NULL ); + GenerateMacrosAndTargets ( module, "${host_gcc}", "${host_gpp}", "${host_ar}", NULL ); } void @@ -1031,7 +1035,7 @@ MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module, const string* clags ) const { - GenerateMacrosAndTargets ( module, "${gcc}", "${ar}", clags ); + GenerateMacrosAndTargets ( module, "${gcc}", "${gpp}", "${ar}", clags ); } string @@ -1251,17 +1255,27 @@ { string target ( FixupTargetFilename ( module.GetPath () ) ); string archiveFilename = GetModuleArchiveFilename ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); GenerateMacrosAndTargetsHost ( module ); - fprintf ( fMakefile, "%s: %s\n", + string linker; + if ( module.HasFileWithExtensions ( ".cxx", ".CXX" ) ) + linker = "${host_gpp}"; + else + linker = "${host_gcc}"; + + fprintf ( fMakefile, "%s: %s %s\n", target.c_str (), - archiveFilename.c_str () ); + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); fprintf ( fMakefile, - "\t${host_gcc} %s -o %s %s\n\n", + "\t%s %s -o %s %s %s\n\n", + linker.c_str (), GetLinkerMacro ( module ).c_str (), target.c_str (), - archiveFilename.c_str () ); + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); } @@ -1718,3 +1732,30 @@ "\t${rm} %s\n", junk_tmp.c_str () ); } + + +static MingwIsoModuleHandler isomodule_handler; + +MingwIsoModuleHandler::MingwIsoModuleHandler () + : MingwModuleHandler ( Iso ) +{ +} + +void +MingwIsoModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateIsoModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module ) +{ + string target ( FixupTargetFilename ( module.GetPath ()) ); + + fprintf ( fMakefile, "%s: all\n", + target.c_str () ); + fprintf ( fMakefile, + "\t\n" ); +} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-22 15:27:06 UTC (rev 13214) @@ -22,7 +22,6 @@ const std::string &PassThruCacheDirectory ( const std::string &f ) const; std::string GetWorkingDirectory () const; std::string GetDirectory (const std::string& filename ) const; - std::string GetExtension ( const std::string& filename ) const; std::string GetBasename ( const std::string& filename ) const; std::string ReplaceExtension ( const std::string& filename, const std::string& newExtension ) const; @@ -114,6 +113,7 @@ void GenerateCommands ( const Module& module, const std::string& sourceFilename, const std::string& cc, + const std::string& cppc, const std::string& cflagsMacro, const std::string& nasmflagsMacro, const std::string& windresflagsMacro ) const; @@ -121,11 +121,13 @@ const std::vector<File*>& files, const std::vector<If*>& ifs, const std::string& cc, + const std::string& cppc, const std::string& cflagsMacro, const std::string& nasmflagsMacro, const std::string& windresflagsMacro ) const; void GenerateObjectFileTargets ( const Module& module, const std::string& cc, + const std::string& cppc, const std::string& cflagsMacro, const std::string& nasmflagsMacro, const std::string& windresflagsMacro ) const; @@ -137,6 +139,7 @@ const std::string& objs_macro ) const; void GenerateMacrosAndTargets ( const Module& module, const std::string& cc, + const std::string& cppc, const std::string& ar, const std::string* clags ) const; std::string GetPreconditionDependenciesName ( const Module& module ) const; @@ -244,4 +247,14 @@ void GenerateBootLoaderModuleTarget ( const Module& module ); }; + +class MingwIsoModuleHandler : public MingwModuleHandler +{ +public: + MingwIsoModuleHandler (); + virtual void Process ( const Module& module ); +private: + void GenerateIsoModuleTarget ( const Module& module ); +}; + #endif /* MINGW_MODULEHANDLER_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-22 15:27:06 UTC (rev 13214) @@ -20,6 +20,18 @@ } string +GetExtension ( const string& filename ) +{ + size_t index = filename.find_last_of ( '/' ); + if (index == string::npos) index = 0; + string tmp = filename.substr( index, filename.size() - index ); + size_t ext_index = tmp.find_last_of( '.' ); + if (ext_index != string::npos) + return filename.substr ( index + ext_index, filename.size() ); + return ""; +} + +string NormalizeFilename ( const string& filename ) { Path path; @@ -253,6 +265,8 @@ return Win32GUI; if ( attribute.value == "bootloader" ) return BootLoader; + if ( attribute.value == "iso" ) + return Iso; throw InvalidAttributeValueException ( location, attribute.name, attribute.value ); @@ -279,6 +293,8 @@ case KernelModeDriver: case BootLoader: return ".sys"; + case Iso: + return ".iso"; } throw InvalidOperationException ( __FILE__, __LINE__ ); @@ -356,7 +372,21 @@ index ); } +bool +Module::HasFileWithExtensions ( const std::string& extension1, + const std::string& extension2 ) const +{ + for ( size_t i = 0; i < files.size (); i++ ) + { + File& file = *files[i]; + string extension = GetExtension ( file.name ); + if ( extension == extension1 || extension == extension2 ) + return true; + } + return false; +} + File::File ( const string& _name, bool _first ) : name(_name), first(_first) { _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-22 15:27:06 UTC (rev 13214) @@ -79,7 +79,8 @@ NativeDLL, Win32DLL, Win32GUI, - BootLoader + BootLoader, + Iso }; @@ -117,6 +118,8 @@ std::string GetPathWithPrefix ( const std::string& prefix ) const; std::string GetTargets () const; std::string GetInvocationTarget ( const int index ) const; + bool HasFileWithExtensions ( const std::string& extension1, + const std::string& extension2 ) const; void ProcessXML(); private: std::string GetDefaultModuleExtension () const; @@ -340,6 +343,9 @@ FixSeparator ( const std::string& s ); extern std::string +GetExtension ( const std::string& filename ); + +extern std::string NormalizeFilename ( const std::string& filename ); #endif /* __RBUILD_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/tools.xml --- branches/xmlbuildsystem/reactos/tools/tools.xml 2005-01-22 15:09:36 UTC (rev 13213) +++ branches/xmlbuildsystem/reactos/tools/tools.xml 2005-01-22 15:27:06 UTC (rev 13214) @@ -1,6 +1,9 @@ <directory name="bin2res"> <xi:include href="bin2res/bin2res.xml" /> </directory> +<directory name="cabman"> + <xi:include href="cabman/cabman.xml" /> +</directory> <module name="buildno" type="buildtool"> <include base="buildno">.</include> <file>buildno.c</file>
19 years, 9 months
1
0
0
0
[royce] 13213: This fixes the small problem that generated files were being added to the Dev-C++ project even though they didn't yet exist. - patch by Trevor McCort
by royce@svn.reactos.com
This fixes the small problem that generated files were being added to the Dev-C++ project even though they didn't yet exist. - patch by Trevor McCort Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/devcpp/devcpp.cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/devcpp/devcpp.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/devcpp/devcpp.cpp 2005-01-22 14:34:54 UTC (rev 13212) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/devcpp/devcpp.cpp 2005-01-22 15:09:36 UTC (rev 13213) @@ -1,208 +1,240 @@ - -#include <iostream> -#include <fstream> -#include <string> - -#include "devcpp.h" - -using namespace std; - -static class DevCppFactory : public Backend::Factory -{ - public: - - DevCppFactory() : Factory("devcpp") {} - Backend *operator() (Project &project) - { - return new DevCppBackend(project); - } - -} factory; - - -DevCppBackend::DevCppBackend(Project &project) : Backend(project) -{ - m_unitCount = 0; -} - -void DevCppBackend::Process() -{ - string filename = ProjectNode.name + ".dev"; - - cout << "Creating Dev-C++ project: " << filename << endl; - - ProcessModules(); - - m_devFile.open(filename.c_str()); - - if(!m_devFile.is_open()) - { - cout << "Could not open file." << endl; - return; - } - - m_devFile << "[Project]" << endl; - - m_devFile << "FileName=" << filename << endl - << "Name=" << ProjectNode.name << endl - << "UnitCount=" << m_unitCount << endl - << "Type=1" << endl - << "Ver=1" << endl - << "ObjFiles=" << endl - << "Includes=" << endl - << "Libs=" << endl - << "PrivateResource=" << endl - << "ResourceIncludes=" << endl - << "MakeIncludes=" << endl - << "Compiler=" << endl - << "CppCompiler=" << endl - << "Linker=" << endl - << "IsCpp=1" << endl - << "Icon=" << endl - << "ExeOutput=" << endl - << "ObjectOutput=" << endl - << "OverrideOutput=0" << endl - << "OverrideOutputName=" << endl - << "HostApplication=" << endl - << "CommandLine=" << endl - << "UseCustomMakefile=1" << endl - << "CustomMakefile=" << ProjectNode.makefile << endl - << "IncludeVersionInto=0" << endl - << "SupportXPThemes=0" << endl - << "CompilerSet=0" << endl - - << "CompilerSettings=0000000000000000000000" << endl; - - OutputFolders(); - - m_devFile << endl << endl; - - OutputFileUnits(); - - m_devFile.close(); - - // Dev-C++ needs a makefile, so use the MinGW backend to create one. - - cout << "Creating Makefile: " << ProjectNode.makefile << endl; - - Backend *backend = Backend::Factory::Create("mingw", ProjectNode); - backend->Process(); - delete backend; - - cout << "Done." << endl << endl; - - cout << "You may want to disable Class browsing (see below) before you open this project in Dev-C++, as the " - << "parsing required for large projects can take quite awhile." - << endl << endl - << "(Tools->Editor Options->Class browsing->Enable class browsing check box)" - << endl << endl; -} - -void DevCppBackend::ProcessModules() -{ - for(size_t i = 0; i < ProjectNode.modules.size(); i++) - { - Module &module = *ProjectNode.modules[i]; - - for(size_t k = 0; k < module.files.size(); k++) - { - File &file = *module.files[k]; - - ProcessFile(file.name); - } - } -} - -void DevCppBackend::ProcessFile(string &filepath) -{ - // Remove the .\ at the start of the filenames - filepath.erase(0, 2); - - // Change the \ to / - for(size_t i = 0; i < filepath.length(); i++) - { - if(filepath[i] == '\\') - filepath[i] = '/'; - } - - // Remove the filename from the path - string folder = ""; - - size_t pos = filepath.rfind(string("/"), filepath.length() - 1); - - if(pos != string::npos) - { - folder = filepath; - folder.erase(pos, folder.length() - pos); - } - - FileUnit fileUnit; - fileUnit.filename = filepath; - fileUnit.folder = folder; - - m_fileUnits.push_back(fileUnit); - - if(folder != "") - AddFolders(folder); - - m_unitCount++; -} - -bool DevCppBackend::CheckFolderAdded(string &folder) -{ - for(size_t i = 0; i < m_folders.size(); i++) - { - if(m_folders[i] == folder) - return true; - } - - return false; -} - -void DevCppBackend::AddFolders(string &folder) -{ - // Check if this folder was already added. true if it was, false otherwise. - if(CheckFolderAdded(folder)) - return; - - m_folders.push_back(folder); - - size_t pos = folder.rfind(string("/"), folder.length() - 1); - - if(pos == string::npos) - return; - - folder.erase(pos, folder.length() - pos); - AddFolders(folder); -} - -void DevCppBackend::OutputFolders() -{ - m_devFile << "Folders="; - - for(size_t i = 0; i < m_folders.size(); i++) - { - if(i > 0) - m_devFile << ","; - - m_devFile << m_folders[i]; - } -} - -void DevCppBackend::OutputFileUnits() -{ - for(size_t i = 0; i < m_fileUnits.size(); i++) - { - m_devFile << "[Unit" << i + 1 << "]" << endl; - - m_devFile << "FileName=" << m_fileUnits[i].filename << endl; - m_devFile << "CompileCpp=1" << endl; - m_devFile << "Folder=" << m_fileUnits[i].folder << endl; - m_devFile << "Compile=1" << endl; - m_devFile << "Link=1" << endl; - m_devFile << "Priority=1000" << endl; - m_devFile << "OverrideBuildCmd=0" << endl; - m_devFile << "BuildCmd=" << endl << endl;; - } -} - +/* + * Dev-C++ Backend + * Copyright (C) 2005 Trevor McCort + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <iostream> +#include <fstream> +#include <string> + +#include "devcpp.h" + +using namespace std; + +static class DevCppFactory : public Backend::Factory +{ + public: + + DevCppFactory() : Factory("devcpp") {} + Backend *operator() (Project &project) + { + return new DevCppBackend(project); + } + +} factory; + + +DevCppBackend::DevCppBackend(Project &project) : Backend(project) +{ + m_unitCount = 0; +} + +void DevCppBackend::Process() +{ + string filename = ProjectNode.name + ".dev"; + + cout << "Creating Dev-C++ project: " << filename << endl; + + ProcessModules(); + + m_devFile.open(filename.c_str()); + + if(!m_devFile.is_open()) + { + cout << "Could not open file." << endl; + return; + } + + m_devFile << "[Project]" << endl; + + m_devFile << "FileName=" << filename << endl + << "Name=" << ProjectNode.name << endl + << "UnitCount=" << m_unitCount << endl + << "Type=1" << endl + << "Ver=1" << endl + << "ObjFiles=" << endl + << "Includes=" << endl + << "Libs=" << endl + << "PrivateResource=" << endl + << "ResourceIncludes=" << endl + << "MakeIncludes=" << endl + << "Compiler=" << endl + << "CppCompiler=" << endl + << "Linker=" << endl + << "IsCpp=1" << endl + << "Icon=" << endl + << "ExeOutput=" << endl + << "ObjectOutput=" << endl + << "OverrideOutput=0" << endl + << "OverrideOutputName=" << endl + << "HostApplication=" << endl + << "CommandLine=" << endl + << "UseCustomMakefile=1" << endl + << "CustomMakefile=" << ProjectNode.makefile << endl + << "IncludeVersionInto=0" << endl + << "SupportXPThemes=0" << endl + << "CompilerSet=0" << endl + + << "CompilerSettings=0000000000000000000000" << endl; + + OutputFolders(); + + m_devFile << endl << endl; + + OutputFileUnits(); + + m_devFile.close(); + + // Dev-C++ needs a makefile, so use the MinGW backend to create one. + + cout << "Creating Makefile: " << ProjectNode.makefile << endl; + + Backend *backend = Backend::Factory::Create("mingw", ProjectNode); + backend->Process(); + delete backend; + + cout << "Done." << endl << endl; + + cout << "You may want to disable Class browsing (see below) before you open this project in Dev-C++, as the " + << "parsing required for large projects can take quite awhile." + << endl << endl + << "(Tools->Editor Options->Class browsing->Enable class browsing check box)" + << endl << endl; +} + +void DevCppBackend::ProcessModules() +{ + for(size_t i = 0; i < ProjectNode.modules.size(); i++) + { + Module &module = *ProjectNode.modules[i]; + + for(size_t k = 0; k < module.files.size(); k++) + { + File &file = *module.files[k]; + + ProcessFile(file.name); + } + } +} + +bool FileExists(string &filename) +{ + ifstream file(filename.c_str()); + + if(!file.is_open()) + return false; + + file.close(); + return true; +} + +void DevCppBackend::ProcessFile(string &filepath) +{ + // Remove the .\ at the start of the filenames + filepath.erase(0, 2); + + if(!FileExists(filepath)) + return; + + // Change the \ to / + for(size_t i = 0; i < filepath.length(); i++) + { + if(filepath[i] == '\\') + filepath[i] = '/'; + } + + // Remove the filename from the path + string folder = ""; + + size_t pos = filepath.rfind(string("/"), filepath.length() - 1); + + if(pos != string::npos) + { + folder = filepath; + folder.erase(pos, folder.length() - pos); + } + + FileUnit fileUnit; + fileUnit.filename = filepath; + fileUnit.folder = folder; + + m_fileUnits.push_back(fileUnit); + + if(folder != "") + AddFolders(folder); + + m_unitCount++; +} + +bool DevCppBackend::CheckFolderAdded(string &folder) +{ + for(size_t i = 0; i < m_folders.size(); i++) + { + if(m_folders[i] == folder) + return true; + } + + return false; +} + +void DevCppBackend::AddFolders(string &folder) +{ + // Check if this folder was already added. true if it was, false otherwise. + if(CheckFolderAdded(folder)) + return; + + m_folders.push_back(folder); + + size_t pos = folder.rfind(string("/"), folder.length() - 1); + + if(pos == string::npos) + return; + + folder.erase(pos, folder.length() - pos); + AddFolders(folder); +} + +void DevCppBackend::OutputFolders() +{ + m_devFile << "Folders="; + + for(size_t i = 0; i < m_folders.size(); i++) + { + if(i > 0) + m_devFile << ","; + + m_devFile << m_folders[i]; + } +} + +void DevCppBackend::OutputFileUnits() +{ + for(size_t i = 0; i < m_fileUnits.size(); i++) + { + m_devFile << "[Unit" << i + 1 << "]" << endl; + + + m_devFile << "FileName=" << m_fileUnits[i].filename << endl; + m_devFile << "CompileCpp=1" << endl; + m_devFile << "Folder=" << m_fileUnits[i].folder << endl; + m_devFile << "Compile=1" << endl; + m_devFile << "Link=1" << endl; + m_devFile << "Priority=1000" << endl; + m_devFile << "OverrideBuildCmd=0" << endl; + m_devFile << "BuildCmd=" << endl << endl;; + } +}
19 years, 9 months
1
0
0
0
[weiden] 13212: return the status code when probing the buffer failed
by weiden@svn.reactos.com
return the status code when probing the buffer failed Modified: trunk/reactos/ntoskrnl/ps/job.c _____ Modified: trunk/reactos/ntoskrnl/ps/job.c --- trunk/reactos/ntoskrnl/ps/job.c 2005-01-22 14:07:45 UTC (rev 13211) +++ trunk/reactos/ntoskrnl/ps/job.c 2005-01-22 14:34:54 UTC (rev 13212) @@ -384,6 +384,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } if(NT_SUCCESS(Status))
19 years, 9 months
1
0
0
0
[chorns] 13211: * Build freeldr
by chorns@svn.reactos.com
* Build freeldr * Add BootLoader and ObjectLibrary module types * Add <compilerflag> tag Modified: branches/xmlbuildsystem/reactos/ReactOS.xml Added: branches/xmlbuildsystem/reactos/boot/boot.xml Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.xml Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_base.xml Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_base64k.xml Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_main.xml Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_startup.xml Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Added: branches/xmlbuildsystem/reactos/tools/rbuild/compilerflag.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h _____ Modified: branches/xmlbuildsystem/reactos/ReactOS.xml --- branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/ReactOS.xml 2005-01-22 14:07:45 UTC (rev 13211) @@ -21,6 +21,9 @@ <include>w32api/include</include> <include>w32api/include/ddk</include> + <directory name="boot"> + <xi:include href="boot/boot.xml" /> + </directory> <directory name="drivers"> <xi:include href="drivers/directory.xml" /> </directory> _____ Added: branches/xmlbuildsystem/reactos/boot/boot.xml --- branches/xmlbuildsystem/reactos/boot/boot.xml 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/boot/boot.xml 2005-01-22 14:07:45 UTC (rev 13211) @@ -0,0 +1,3 @@ +<directory name="freeldr"> + <xi:include href="freeldr/freeldr.xml" /> +</directory> _____ Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.xml 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr.xml 2005-01-22 14:07:45 UTC (rev 13211) @@ -0,0 +1,6 @@ +<module name="freeldr" type="bootloader"> + <library>freeldr_startup</library> + <library>freeldr_base64k</library> + <library>freeldr_base</library> + <library>freeldr_main</library> +</module> _____ Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_base.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_base.xml 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_base.xml 2005-01-22 14:07:45 UTC (rev 13211) @@ -0,0 +1,107 @@ +<module name="freeldr_base" type="objectlibrary"> + <include base="freeldr_base">include</include> + <compilerflag>-nostdlib</compilerflag> + <compilerflag>-nostdinc</compilerflag> + <compilerflag>-ffreestanding</compilerflag> + <compilerflag>-fno-builtin</compilerflag> + <compilerflag>-fno-inline</compilerflag> + <compilerflag>-fno-zero-initialized-in-bss</compilerflag> + <compilerflag>-Os</compilerflag> + <directory name="arch"> + <if property="ARCH" value="i386"> + <directory name="i386"> + <file>_alloca.S</file> + <file>archmach.c</file> + <file>hardware.c</file> + <file>hwacpi.c</file> + <file>hwapm.c</file> + <file>hwcpu.c</file> + <file>hwpci.c</file> + <file>i386disk.c</file> + <file>i386rtl.c</file> + <file>i386vid.c</file> + <file>machpc.c</file> + <file>machxbox.c</file> + <file>pccons.c</file> + <file>pcdisk.c</file> + <file>pcmem.c</file> + <file>pcrtc.c</file> + <file>pcvideo.c</file> + <file>portio.c</file> + <file>xboxcons.c</file> + <file>xboxdisk.c</file> + <file>xboxfont.c</file> + <file>xboxhw.c</file> + <file>xboxmem.c</file> + <file>xboxrtc.c</file> + <file>xboxvideo.c</file> + </directory> + </if> + </directory> + <directory name="cache"> + <file>blocklist.c</file> + <file>cache.c</file> + </directory> + <directory name="comm"> + <file>rs232.c</file> + </directory> + <directory name="disk"> + <file>disk.c</file> + <file>partition.c</file> + </directory> + <directory name="fs"> + <file>ext2.c</file> + <file>fat.c</file> + <file>fs.c</file> + <file>fsrec.c</file> + <file>iso.c</file> + <file>ntfs.c</file> + </directory> + <directory name="inifile"> + <file>ini_init.c</file> + <file>inifile.c</file> + <file>parse.c</file> + </directory> + <directory name="math"> + <file>libgcc2.c</file> + </directory> + <directory name="mm"> + <file>meminit.c</file> + <file>mm.c</file> + </directory> + <directory name="reactos"> + <file>arcname.c</file> + <file>binhive.c</file> + <file>reactos.c</file> + <file>registry.c</file> + </directory> + <directory name="rtl"> + <file>list.c</file> + <file>memcmp.c</file> + <file>memcpy.c</file> + <file>memmove.c</file> + <file>memset.c</file> + <file>print.c</file> + <file>stdlib.c</file> + <file>string.c</file> + </directory> + <directory name="ui"> + <file>gui.c</file> + <file>tui.c</file> + <file>tuimenu.c</file> + <file>ui.c</file> + </directory> + <directory name="video"> + <file>bank.c</file> + <file>fade.c</file> + <file>palette.c</file> + <file>pixel.c</file> + <file>video.c</file> + </directory> + <file>freeldr.c</file> + <file>debug.c</file> + <file>multiboot.c</file> + <file>version.c</file> + <file>cmdline.c</file> + <file>machine.c</file> +</module> _____ Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_base64k.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_base64k.xml 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_base64k.xml 2005-01-22 14:07:45 UTC (rev 13211) @@ -0,0 +1,25 @@ +<module name="freeldr_base64k" type="objectlibrary"> + <include base="freeldr_base64k">include</include> + <compilerflag>-nostdlib</compilerflag> + <compilerflag>-nostdinc</compilerflag> + <compilerflag>-ffreestanding</compilerflag> + <compilerflag>-fno-builtin</compilerflag> + <compilerflag>-fno-inline</compilerflag> + <compilerflag>-fno-zero-initialized-in-bss</compilerflag> + <compilerflag>-Os</compilerflag> + <directory name="arch"> + <if property="ARCH" value="i386"> + <directory name="i386"> + <file>boot.S</file> + <file>drvmap.S</file> + <file>i386cpu.S</file> + <file>i386idt.S</file> + <file>i386pnp.S</file> + <file>i386trap.S</file> + <file>int386.S</file> + <file>linux.S</file> + <file>mb.S</file> + </directory> + </if> + </directory> +</module> _____ Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_main.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_main.xml 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_main.xml 2005-01-22 14:07:45 UTC (rev 13211) @@ -0,0 +1,20 @@ +<module name="freeldr_main" type="objectlibrary"> + <include base="freeldr_main">include</include> + <compilerflag>-nostdlib</compilerflag> + <compilerflag>-nostdinc</compilerflag> + <compilerflag>-ffreestanding</compilerflag> + <compilerflag>-fno-builtin</compilerflag> + <compilerflag>-fno-inline</compilerflag> + <compilerflag>-fno-zero-initialized-in-bss</compilerflag> + <compilerflag>-Os</compilerflag> + <directory name="inffile"> + <file>inffile.c</file> + </directory> + <file>bootmgr.c</file> + <file>drivemap.c</file> + <file>miscboot.c</file> + <file>options.c</file> + <file>linuxboot.c</file> + <file>oslist.c</file> + <file>custom.c</file> +</module> _____ Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_startup.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_startup.xml 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr/freeldr_startup.xml 2005-01-22 14:07:45 UTC (rev 13211) @@ -0,0 +1,17 @@ +<module name="freeldr_startup" type="objectlibrary"> + <include base="freeldr_startup">include</include> + <compilerflag>-nostdlib</compilerflag> + <compilerflag>-nostdinc</compilerflag> + <compilerflag>-ffreestanding</compilerflag> + <compilerflag>-fno-builtin</compilerflag> + <compilerflag>-fno-inline</compilerflag> + <compilerflag>-fno-zero-initialized-in-bss</compilerflag> + <directory name="arch"> + <if property="ARCH" value="i386"> + <directory name="i386"> + <file first="true">fathelp.asm</file> + <file>arch.S</file> + </directory> + </if> + </directory> +</module> _____ Added: branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml --- branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/boot/freeldr/freeldr.xml 2005-01-22 14:07:45 UTC (rev 13211) @@ -0,0 +1,25 @@ +<!--<module name="bootsector" type="bootsector"> + <include base="bootsector">freeldr/include</include> + <compilerflag>-nostdlib</compilerflag> + <compilerflag>-nostdinc</compilerflag> + <compilerflag>-ffreestanding</compilerflag> + <compilerflag>-no-builtin</compilerflag> + <compilerflag>-no-inline</compilerflag> + <compilerflag>-no-zero-initialized-in-bss</compilerflag> + <directory name="bootsect"> + <file>dosmbr.asm</file> + <file>ext2.asm</file> + <file>fat32.asm</file> + <file>fat.asm</file> + <file>isoboot.asm</file> + <file>win2k.asm</file> + <file>wxpfat16.asm</file> + </directory> +</module>--> +<directory name="freeldr"> + <xi:include href="freeldr/freeldr_startup.xml" /> + <xi:include href="freeldr/freeldr_base64k.xml" /> + <xi:include href="freeldr/freeldr_base.xml" /> + <xi:include href="freeldr/freeldr_main.xml" /> + <xi:include href="freeldr/freeldr.xml" /> +</directory> _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-22 14:07:45 UTC (rev 13211) @@ -162,22 +162,26 @@ { #ifdef WIN32 fprintf ( fMakefile, "host_gcc = gcc\n" ); + fprintf ( fMakefile, "host_ld = ld\n" ); fprintf ( fMakefile, "host_ar = ar\n" ); - fprintf ( fMakefile, "host_ld = ld\n" ); + fprintf ( fMakefile, "host_objcopy = objcopy\n" ); fprintf ( fMakefile, "rm = del /f /q\n" ); fprintf ( fMakefile, "gcc = gcc\n" ); fprintf ( fMakefile, "ld = ld\n" ); fprintf ( fMakefile, "ar = ar\n" ); + fprintf ( fMakefile, "objcopy = objcopy\n" ); fprintf ( fMakefile, "dlltool = dlltool\n" ); fprintf ( fMakefile, "windres = windres\n" ); #else fprintf ( fMakefile, "host_gcc = gcc\n" ); + fprintf ( fMakefile, "host_ld = ld\n" ); fprintf ( fMakefile, "host_ar = ar\n" ); - fprintf ( fMakefile, "host_ld = ld\n" ); + fprintf ( fMakefile, "host_objcopy = objcopy\n" ); fprintf ( fMakefile, "rm = rm -f\n" ); fprintf ( fMakefile, "gcc = mingw32-gcc\n" ); fprintf ( fMakefile, "ld = mingw32-ld\n" ); fprintf ( fMakefile, "ar = mingw32-ar\n" ); + fprintf ( fMakefile, "objcopy = mingw32-objcopy\n" ); fprintf ( fMakefile, "dlltool = mingw32-dlltool\n" ); fprintf ( fMakefile, "windres = mingw32-windres\n" ); #endif @@ -207,9 +211,12 @@ for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { Module& module = *ProjectNode.modules[i]; - fprintf ( fMakefile, - " %s", - FixupTargetFilename ( module.GetPath () ).c_str () ); + if ( module.type != ObjectLibrary ) + { + fprintf ( fMakefile, + " %s", + FixupTargetFilename ( module.GetPath () ).c_str () ); + } } fprintf ( fMakefile, "\n\t\n\n" ); } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-22 14:07:45 UTC (rev 13211) @@ -145,13 +145,19 @@ else return false; } - + string +MingwModuleHandler::GetImportLibraryDependency ( const Module& importedModule ) const +{ + if ( importedModule.type == ObjectLibrary ) + return GetObjectsMacro ( importedModule ); + else + return PassThruCacheDirectory ( FixupTargetFilename ( importedModule.GetDependencyPath () ) ); +} + +string MingwModuleHandler::GetImportLibraryDependencies ( const Module& module ) const { - if ( module.libraries.size () == 0 ) - return ""; - string dependencies ( "" ); for ( size_t i = 0; i < module.libraries.size (); i++ ) { @@ -159,7 +165,7 @@ dependencies += " "; const Module* importedModule = module.project.LocateModule ( module.libraries[i]->name ); assert ( importedModule != NULL ); - dependencies += PassThruCacheDirectory ( FixupTargetFilename ( importedModule->GetDependencyPath () ) ).c_str (); + dependencies += GetImportLibraryDependency ( *importedModule ); } return dependencies; } @@ -379,6 +385,20 @@ string +MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags ) const +{ + string parameters; + for ( size_t i = 0; i < compilerFlags.size (); i++ ) + { + CompilerFlag& compilerFlag = *compilerFlags[i]; + if ( parameters.length () > 0 ) + parameters += " "; + parameters += compilerFlag.flag; + } + return parameters; +} + +string MingwModuleHandler::GenerateLinkerParametersFromVector ( const vector<LinkerFlag*>& linkerFlags ) const { string parameters; @@ -402,7 +422,8 @@ MingwModuleHandler::GenerateMacro ( const char* assignmentOperation, const string& macro, const vector<Include*>& includes, - const vector<Define*>& defines ) const + const vector<Define*>& defines, + const vector<CompilerFlag*>* compilerFlags ) const { size_t i; @@ -411,6 +432,19 @@ "%s %s", macro.c_str(), assignmentOperation ); + + if ( compilerFlags != NULL ) + { + string compilerParameters = GenerateCompilerParametersFromVector ( *compilerFlags ); + if ( compilerParameters.size () > 0 ) + { + fprintf ( + fMakefile, + " %s", + compilerParameters.c_str () ); + } + } + for ( i = 0; i < includes.size(); i++ ) { fprintf ( @@ -440,6 +474,7 @@ const vector<File*>& files, const vector<Include*>& includes, const vector<Define*>& defines, + const vector<CompilerFlag*>* compilerFlags, const vector<LinkerFlag*>* linkerFlags, const vector<If*>& ifs, const string& cflags_macro, @@ -455,11 +490,13 @@ GenerateMacro ( assignmentOperation, cflags_macro, includes, - defines ); + defines, + compilerFlags ); GenerateMacro ( assignmentOperation, windresflags_macro, includes, - defines ); + defines, + compilerFlags ); } if ( linkerFlags != NULL ) @@ -527,6 +564,7 @@ rIf.includes, rIf.defines, NULL, + NULL, rIf.ifs, cflags_macro, nasmflags_macro, @@ -554,6 +592,7 @@ module.files, module.includes, module.defines, + &module.compilerFlags, &module.linkerFlags, module.ifs, cflags_macro, @@ -1225,6 +1264,7 @@ archiveFilename.c_str () ); } + static MingwKernelModuleHandler kernelmodule_handler; MingwKernelModuleHandler::MingwKernelModuleHandler () @@ -1318,6 +1358,28 @@ } +static MingwObjectLibraryModuleHandler objectlibrary_handler; + +MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler () + : MingwModuleHandler ( ObjectLibrary ) +{ +} + +void +MingwObjectLibraryModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateObjectLibraryModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget ( const Module& module ) +{ + GenerateMacrosAndTargetsTarget ( module ); +} + + static MingwKernelModeDLLModuleHandler kernelmodedll_handler; MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler () @@ -1607,3 +1669,52 @@ target.c_str ()); } } + + +static MingwBootLoaderModuleHandler bootloadermodule_handler; + +MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler () + : MingwModuleHandler ( BootLoader ) +{ +} + +void +MingwBootLoaderModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateBootLoaderModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string targetName ( module.GetTargetName () ); + string target ( FixupTargetFilename (module.GetPath ()) ); + string workingDirectory = GetWorkingDirectory (); + string junk_tmp = ros_junk + module.name + ".junk.tmp"; + string objectsMacro = GetObjectsMacro ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateMacrosAndTargetsTarget ( module ); + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + objectsMacro.c_str (), + importLibraryDependencies.c_str () ); + + fprintf ( fMakefile, + "\t${ld} %s -N -Ttext=0x8000 -o %s %s %s\n", + GetLinkerMacro ( module ).c_str (), + junk_tmp.c_str (), + objectsMacro.c_str (), + importLibraryDependencies.c_str () ); + fprintf ( fMakefile, + "\t${objcopy} -O binary %s %s\n", + junk_tmp.c_str (), + target.c_str () ); + fprintf ( fMakefile, + "\t${rm} %s\n", + junk_tmp.c_str () ); +} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-22 14:07:45 UTC (rev 13211) @@ -29,6 +29,7 @@ std::string GetActualSourceFilename ( const std::string& filename ) const; std::string GetModuleArchiveFilename ( const Module& module ) const; bool IsGeneratedFile ( const File& file ) const; + std::string GetImportLibraryDependency ( const Module& importedModule ) const; std::string GetImportLibraryDependencies ( const Module& module ) const; std::string GetModuleDependencies ( const Module& module ) const; std::string GetAllDependencies ( const Module& module ) const; @@ -65,16 +66,19 @@ std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const; std::string GenerateGccDefineParameters ( const Module& module ) const; std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const; + std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags ) const; std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const; std::string GenerateLinkerParameters ( const Module& module ) const; void GenerateMacro ( const char* assignmentOperation, const std::string& macro, const std::vector<Include*>& includes, - const std::vector<Define*>& defines ) const; + const std::vector<Define*>& defines, + const std::vector<CompilerFlag*>* compilerFlags ) const; void GenerateMacros ( const char* op, const std::vector<File*>& files, const std::vector<Include*>& includes, const std::vector<Define*>& defines, + const std::vector<CompilerFlag*>* compilerFlags, const std::vector<LinkerFlag*>* linkerFlags, const std::vector<If*>& ifs, const std::string& cflags_macro, @@ -170,6 +174,16 @@ }; +class MingwObjectLibraryModuleHandler : public MingwModuleHandler +{ +public: + MingwObjectLibraryModuleHandler (); + virtual void Process ( const Module& module ); +private: + void GenerateObjectLibraryModuleTarget ( const Module& module ); +}; + + class MingwKernelModeDLLModuleHandler : public MingwModuleHandler { public: @@ -220,4 +234,14 @@ void GenerateWin32GUIModuleTarget ( const Module& module ); }; + +class MingwBootLoaderModuleHandler : public MingwModuleHandler +{ +public: + MingwBootLoaderModuleHandler (); + virtual void Process ( const Module& module ); +private: + void GenerateBootLoaderModuleTarget ( const Module& module ); +}; + #endif /* MINGW_MODULEHANDLER_H */ _____ Added: branches/xmlbuildsystem/reactos/tools/rbuild/compilerflag.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/compilerflag.cpp 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/tools/rbuild/compilerflag.cpp 2005-01-22 14:07:45 UTC (rev 13211) @@ -0,0 +1,47 @@ +#include "pch.h" +#include <assert.h> + +#include "rbuild.h" + +using std::string; +using std::vector; + +CompilerFlag::CompilerFlag ( const Project& project_, + const XMLElement& compilerFlagNode ) + : project(project_), + module(NULL), + node(compilerFlagNode) +{ + Initialize(); +} + +CompilerFlag::CompilerFlag ( const Project& project_, + const Module* module_, + const XMLElement& compilerFlagNode ) + : project(project_), + module(module_), + node(compilerFlagNode) +{ + Initialize(); +} + +CompilerFlag::~CompilerFlag () +{ +} + +void +CompilerFlag::Initialize () +{ +} + +void +CompilerFlag::ProcessXML () +{ + if (node.value.size () == 0) + { + throw InvalidBuildFileException ( + node.location, + "<compilerflag> is empty." ); + } + flag = node.value; +} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile --- branches/xmlbuildsystem/reactos/tools/rbuild/makefile 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/tools/rbuild/makefile 2005-01-22 14:07:45 UTC (rev 13211) @@ -17,6 +17,7 @@ BASE_OBJECTS = \ $(BACKEND_BASE_OBJECTS) \ + compilerflag.o \ define.o \ exception.o \ include.o \ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-22 14:07:45 UTC (rev 13211) @@ -1,5 +1,3 @@ -// module.cpp - #include "pch.h" #include <assert.h> @@ -74,6 +72,8 @@ delete dependencies[i]; for ( i = 0; i < ifs.size(); i++ ) delete ifs[i]; + for ( i = 0; i < compilerFlags.size(); i++ ) + delete compilerFlags[i]; for ( i = 0; i < linkerFlags.size(); i++ ) delete linkerFlags[i]; } @@ -98,6 +98,8 @@ dependencies[i]->ProcessXML (); for ( i = 0; i < ifs.size(); i++ ) ifs[i]->ProcessXML(); + for ( i = 0; i < compilerFlags.size(); i++ ) + compilerFlags[i]->ProcessXML(); for ( i = 0; i < linkerFlags.size(); i++ ) linkerFlags[i]->ProcessXML(); } @@ -203,6 +205,11 @@ ifs.push_back ( pIf ); subs_invalid = false; } + else if ( e.name == "compilerflag" ) + { + compilerFlags.push_back ( new CompilerFlag ( project, this, e ) ); + subs_invalid = true; + } else if ( e.name == "linkerflag" ) { linkerFlags.push_back ( new LinkerFlag ( project, this, e ) ); @@ -230,6 +237,8 @@ return BuildTool; if ( attribute.value == "staticlibrary" ) return StaticLibrary; + if ( attribute.value == "objectlibrary" ) + return ObjectLibrary; if ( attribute.value == "kernel" ) return Kernel; if ( attribute.value == "kernelmodedll" ) @@ -242,6 +251,8 @@ return Win32DLL; if ( attribute.value == "win32gui" ) return Win32GUI; + if ( attribute.value == "bootloader" ) + return BootLoader; throw InvalidAttributeValueException ( location, attribute.name, attribute.value ); @@ -256,6 +267,8 @@ return EXEPOSTFIX; case StaticLibrary: return ".a"; + case ObjectLibrary: + return ".o"; case Kernel: case Win32GUI: return ".exe"; @@ -264,6 +277,7 @@ case Win32DLL: return ".dll"; case KernelModeDriver: + case BootLoader: return ".sys"; } throw InvalidOperationException ( __FILE__, _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-22 13:34:27 UTC (rev 13210) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-22 14:07:45 UTC (rev 13211) @@ -32,6 +32,7 @@ class Dependency; class ImportLibrary; class If; +class CompilerFlag; class LinkerFlag; class Property; @@ -71,12 +72,14 @@ { BuildTool, StaticLibrary, + ObjectLibrary, Kernel, KernelModeDLL, KernelModeDriver, NativeDLL, Win32DLL, - Win32GUI + Win32GUI, + BootLoader }; @@ -97,6 +100,7 @@ std::vector<Invoke*> invocations; std::vector<Dependency*> dependencies; std::vector<If*> ifs; + std::vector<CompilerFlag*> compilerFlags; std::vector<LinkerFlag*> linkerFlags; Module ( const Project& project, @@ -277,6 +281,26 @@ }; +class CompilerFlag +{ +public: + const Project& project; + const Module* module; + const XMLElement& node; + std::string flag; + + CompilerFlag ( const Project& project, + const XMLElement& compilerFlagNode ); + CompilerFlag ( const Project& project, + const Module* module, + const XMLElement& compilerFlagNode ); + ~CompilerFlag (); + void ProcessXML(); +private: + void Initialize(); +}; + + class LinkerFlag { public:
19 years, 9 months
1
0
0
0
[weiden] 13210: 1. remove obsolete buffer size checks from NtQueryInformationProcess()
by weiden@svn.reactos.com
1. remove obsolete buffer size checks from NtQueryInformationProcess() 2. fixed some buffer checks Modified: trunk/reactos/ntoskrnl/ex/event.c Modified: trunk/reactos/ntoskrnl/ex/evtpair.c Modified: trunk/reactos/ntoskrnl/ex/mutant.c Modified: trunk/reactos/ntoskrnl/ex/profile.c Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c Modified: trunk/reactos/ntoskrnl/io/event.c Modified: trunk/reactos/ntoskrnl/ps/process.c _____ Modified: trunk/reactos/ntoskrnl/ex/event.c --- trunk/reactos/ntoskrnl/ex/event.c 2005-01-22 12:45:03 UTC (rev 13209) +++ trunk/reactos/ntoskrnl/ex/event.c 2005-01-22 13:34:27 UTC (rev 13210) @@ -151,6 +151,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } Status = ObCreateObject(PreviousMode, @@ -285,6 +290,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } Status = ObReferenceObjectByHandle(EventHandle, @@ -421,6 +431,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } Status = ObReferenceObjectByHandle(EventHandle, @@ -481,6 +496,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } Status = ObReferenceObjectByHandle(EventHandle, _____ Modified: trunk/reactos/ntoskrnl/ex/evtpair.c --- trunk/reactos/ntoskrnl/ex/evtpair.c 2005-01-22 12:45:03 UTC (rev 13209) +++ trunk/reactos/ntoskrnl/ex/evtpair.c 2005-01-22 13:34:27 UTC (rev 13210) @@ -114,6 +114,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } Status = ObCreateObject(ExGetPreviousMode(), @@ -183,6 +188,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } Status = ObOpenObjectByName(ObjectAttributes, _____ Modified: trunk/reactos/ntoskrnl/ex/mutant.c --- trunk/reactos/ntoskrnl/ex/mutant.c 2005-01-22 12:45:03 UTC (rev 13209) +++ trunk/reactos/ntoskrnl/ex/mutant.c 2005-01-22 13:34:27 UTC (rev 13210) @@ -137,6 +137,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } Status = ObCreateObject(PreviousMode, @@ -343,6 +348,11 @@ Status = _SEH_GetExceptionCode(); } _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } } Status = ObReferenceObjectByHandle(MutantHandle, _____ Modified: trunk/reactos/ntoskrnl/ex/profile.c --- trunk/reactos/ntoskrnl/ex/profile.c 2005-01-22 12:45:03 UTC (rev 13209) +++ trunk/reactos/ntoskrnl/ex/profile.c 2005-01-22 13:34:27 UTC (rev 13210) @@ -119,10 +119,42 @@ IN KPROFILE_SOURCE ProfileSource, IN KAFFINITY Affinity) { - HANDLE SafeProfileHandle; - NTSTATUS Status; + HANDLE hProfile; PKPROFILE Profile; PEPROCESS pProcess; + KPROCESSOR_MODE PreviousMode; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status = STATUS_SUCCESS; + + PreviousMode = ExGetPreviousMode(); + + if(BufferSize == 0) + { + return STATUS_INVALID_PARAMETER_7; + } + + if(PreviousMode != KernelMode) + { + _SEH_TRY + { + ProbeForWrite(ProfileHandle, + sizeof(HANDLE), + sizeof(ULONG)); + ProbeForWrite(Buffer, + BufferSize, + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } + } /* * Reference the associated process @@ -132,7 +164,7 @@ Status = ObReferenceObjectByHandle(Process, PROCESS_QUERY_INFORMATION, PsProcessType, - UserMode, + PreviousMode, (PVOID*)&pProcess, NULL); if (!NT_SUCCESS(Status)) @@ -143,7 +175,11 @@ else { pProcess = NULL; - /* FIXME: Check privilege. */ + if(!SeSinglePrivilegeCheck(SeSystemProfilePrivilege, + PreviousMode)) + { + return STATUS_PRIVILEGE_NOT_HELD; + } } /* @@ -170,11 +206,17 @@ /* * Create the object */ - Status = ObCreateObject(ExGetPreviousMode(), + InitializeObjectAttributes(&ObjectAttributes, + NULL, + 0, + NULL, + NULL); + + Status = ObCreateObject(KernelMode, ExProfileObjectType, + &ObjectAttributes, + PreviousMode, NULL, - ExGetPreviousMode(), - NULL, sizeof(KPROFILE), 0, 0, @@ -193,6 +235,7 @@ Profile->BufferMdl = MmCreateMdl(NULL, Buffer, BufferSize); if(Profile->BufferMdl == NULL) { DPRINT("MmCreateMdl: Out of memory!"); + ObDereferenceObject (Profile); return(STATUS_NO_MEMORY); } MmProbeAndLockPages(Profile->BufferMdl, UserMode, IoWriteAccess); @@ -212,7 +255,7 @@ STANDARD_RIGHTS_ALL, 0, NULL, - &SafeProfileHandle); + &hProfile); if (!NT_SUCCESS(Status)) { ObDereferenceObject (Profile); @@ -222,39 +265,70 @@ /* * Copy the created handle back to the caller */ - Status = MmCopyToCaller(ProfileHandle, &SafeProfileHandle, sizeof(HANDLE)); - if (!NT_SUCCESS(Status)) - { - ObDereferenceObject(Profile); - ZwClose(ProfileHandle); - return(Status); - } + _SEH_TRY + { + *ProfileHandle = hProfile; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; ObDereferenceObject(Profile); - return(STATUS_SUCCESS); + return Status; } NTSTATUS STDCALL NtQueryIntervalProfile(IN KPROFILE_SOURCE ProfileSource, OUT PULONG Interval) { - NTSTATUS Status; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; + + PreviousMode = ExGetPreviousMode(); + + if(PreviousMode != KernelMode) + { + _SEH_TRY + { + ProbeForWrite(Interval, + sizeof(ULONG), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } + } if (ProfileSource == ProfileTime) { - ULONG SafeInterval; + ULONG ReturnInterval; /* FIXME: What units does this use, for now nanoseconds */ - SafeInterval = 100; - Status = MmCopyToCaller(Interval, &SafeInterval, sizeof(ULONG)); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - return(STATUS_SUCCESS); + ReturnInterval = 100; + + _SEH_TRY + { + *Interval = ReturnInterval; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + return Status; } - return(STATUS_INVALID_PARAMETER_2); + return STATUS_INVALID_PARAMETER_2; } NTSTATUS STDCALL @@ -267,13 +341,16 @@ NTSTATUS STDCALL NtStartProfile(IN HANDLE ProfileHandle) { + PKPROFILE Profile; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; - PKPROFILE Profile; + + PreviousMode = ExGetPreviousMode(); Status = ObReferenceObjectByHandle(ProfileHandle, STANDARD_RIGHTS_ALL, ExProfileObjectType, - UserMode, + PreviousMode, (PVOID*)&Profile, NULL); if (!NT_SUCCESS(Status)) @@ -288,13 +365,16 @@ NTSTATUS STDCALL NtStopProfile(IN HANDLE ProfileHandle) { + PKPROFILE Profile; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; - PKPROFILE Profile; + + PreviousMode = ExGetPreviousMode(); Status = ObReferenceObjectByHandle(ProfileHandle, STANDARD_RIGHTS_ALL, ExProfileObjectType, - UserMode, + PreviousMode, (PVOID*)&Profile, NULL); if (!NT_SUCCESS(Status)) _____ Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c --- trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-01-22 12:45:03 UTC (rev 13209) +++ trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-01-22 13:34:27 UTC (rev 13210) @@ -95,7 +95,6 @@ IN ULONG ValueBufferLength, IN OUT PULONG ReturnLength OPTIONAL) { - NTSTATUS Status; ANSI_STRING AName; UNICODE_STRING WName; BOOLEAN Result; @@ -103,21 +102,17 @@ ANSI_STRING AValue; UNICODE_STRING WValue; KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; PreviousMode = ExGetPreviousMode(); - - /* - * Copy the name to kernel space if necessary and convert it to ANSI. - */ - Status = RtlCaptureUnicodeString(&WName, - PreviousMode, - NonPagedPool, - FALSE, - VariableName); - if(NT_SUCCESS(Status)) + + if(PreviousMode != KernelMode) { - if(PreviousMode != KernelMode) + _SEH_TRY { + ProbeForRead(VariableName, + sizeof(UNICODE_STRING), + sizeof(ULONG)); ProbeForWrite(ValueBuffer, ValueBufferLength, sizeof(WCHAR)); @@ -128,7 +123,28 @@ sizeof(ULONG)); } } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + if(!NT_SUCCESS(Status)) + { + return Status; + } + } + + /* + * Copy the name to kernel space if necessary and convert it to ANSI. + */ + Status = RtlCaptureUnicodeString(&WName, + PreviousMode, + NonPagedPool, + FALSE, + VariableName); + if(NT_SUCCESS(Status)) + { /* * according to ntinternals the SeSystemEnvironmentName privilege is required! */ _____ Modified: trunk/reactos/ntoskrnl/io/event.c --- trunk/reactos/ntoskrnl/io/event.c 2005-01-22 12:45:03 UTC (rev 13209) +++ trunk/reactos/ntoskrnl/io/event.c 2005-01-22 13:34:27 UTC (rev 13210) @@ -65,26 +65,15 @@ PHANDLE EventHandle) { OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING CapturedEventName; KPROCESSOR_MODE PreviousMode; PKEVENT Event; HANDLE Handle; NTSTATUS Status; PreviousMode = ExGetPreviousMode(); - - Status = RtlCaptureUnicodeString(&CapturedEventName, - PreviousMode, - NonPagedPool, - FALSE, - EventName); - if (!NT_SUCCESS(Status)) - { - return NULL; - } InitializeObjectAttributes(&ObjectAttributes, - &CapturedEventName, + EventName, OBJ_OPENIF, NULL, NULL); @@ -95,10 +84,6 @@ SynchronizationEvent, TRUE); - RtlRelaseCapturedUnicodeString(&CapturedEventName, - PreviousMode, - FALSE); - if (!NT_SUCCESS(Status)) { return NULL; _____ Modified: trunk/reactos/ntoskrnl/ps/process.c --- trunk/reactos/ntoskrnl/ps/process.c 2005-01-22 12:45:03 UTC (rev 13209) +++ trunk/reactos/ntoskrnl/ps/process.c 2005-01-22 13:34:27 UTC (rev 13210) @@ -1208,39 +1208,34 @@ switch (ProcessInformationClass) { case ProcessBasicInformation: - if (ProcessInformationLength != sizeof(PROCESS_BASIC_INFORMATION)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PPROCESS_BASIC_INFORMATION ProcessBasicInformationP = - (PPROCESS_BASIC_INFORMATION)ProcessInformation; + { + PPROCESS_BASIC_INFORMATION ProcessBasicInformationP = + (PPROCESS_BASIC_INFORMATION)ProcessInformation; - _SEH_TRY - { - ProcessBasicInformationP->ExitStatus = Process->ExitStatus; - ProcessBasicInformationP->PebBaseAddress = Process->Peb; - ProcessBasicInformationP->AffinityMask = Process->Pcb.Affinity; - ProcessBasicInformationP->UniqueProcessId = - Process->UniqueProcessId; - ProcessBasicInformationP->InheritedFromUniqueProcessId = - (ULONG)Process->InheritedFromUniqueProcessId; - ProcessBasicInformationP->BasePriority = - Process->Pcb.BasePriority; + _SEH_TRY + { + ProcessBasicInformationP->ExitStatus = Process->ExitStatus; + ProcessBasicInformationP->PebBaseAddress = Process->Peb; + ProcessBasicInformationP->AffinityMask = Process->Pcb.Affinity; + ProcessBasicInformationP->UniqueProcessId = + Process->UniqueProcessId; + ProcessBasicInformationP->InheritedFromUniqueProcessId = + (ULONG)Process->InheritedFromUniqueProcessId; + ProcessBasicInformationP->BasePriority = + Process->Pcb.BasePriority; - if (ReturnLength) - { - *ReturnLength = sizeof(PROCESS_BASIC_INFORMATION); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } + if (ReturnLength) + { + *ReturnLength = sizeof(PROCESS_BASIC_INFORMATION); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; + } case ProcessQuotaLimits: case ProcessIoCounters: @@ -1248,56 +1243,43 @@ break; case ProcessTimes: - if (ProcessInformationLength != sizeof(KERNEL_USER_TIMES)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PKERNEL_USER_TIMES ProcessTimeP = (PKERNEL_USER_TIMES)ProcessInformation; - _SEH_TRY - { - ProcessTimeP->CreateTime = Process->CreateTime; - ProcessTimeP->UserTime.QuadPart = Process->Pcb.UserTime * 100000LL; - ProcessTimeP->KernelTime.QuadPart = Process->Pcb.KernelTime * 100000LL; - ProcessTimeP->ExitTime = Process->ExitTime; + { + PKERNEL_USER_TIMES ProcessTimeP = (PKERNEL_USER_TIMES)ProcessInformation; + _SEH_TRY + { + ProcessTimeP->CreateTime = Process->CreateTime; + ProcessTimeP->UserTime.QuadPart = Process->Pcb.UserTime * 100000LL; + ProcessTimeP->KernelTime.QuadPart = Process->Pcb.KernelTime * 100000LL; + ProcessTimeP->ExitTime = Process->ExitTime; - if (ReturnLength) - { - *ReturnLength = sizeof(KERNEL_USER_TIMES); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } - break; + if (ReturnLength) + { + *ReturnLength = sizeof(KERNEL_USER_TIMES); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + break; + } case ProcessDebugPort: { - if (ProcessInformationLength != sizeof(HANDLE)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - _SEH_TRY - { - - *(PHANDLE)ProcessInformation = (Process->DebugPort != NULL ? (HANDLE)-1 : NULL); - if (ReturnLength) - { - *ReturnLength = sizeof(HANDLE); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } + _SEH_TRY + { + *(PHANDLE)ProcessInformation = (Process->DebugPort != NULL ? (HANDLE)-1 : NULL); + if (ReturnLength) + { + *ReturnLength = sizeof(HANDLE); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; } @@ -1308,54 +1290,42 @@ break; case ProcessHandleCount: - if (ProcessInformationLength != sizeof(ULONG)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - ULONG HandleCount = ObpGetHandleCountByHandleTable(&Process->HandleTable); + { + ULONG HandleCount = ObpGetHandleCountByHandleTable(&Process->HandleTable); - _SEH_TRY + _SEH_TRY + { + *(PULONG)ProcessInformation = HandleCount; + if (ReturnLength) { - *(PULONG)ProcessInformation = HandleCount; - if (ReturnLength) - { - *ReturnLength = sizeof(ULONG); - } + *ReturnLength = sizeof(ULONG); } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; + } case ProcessSessionInformation: { - if (ProcessInformationLength != sizeof(PROCESS_SESSION_INFORMATION)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PPROCESS_SESSION_INFORMATION SessionInfo = (PPROCESS_SESSION_INFORMATION)ProcessInformation; + PPROCESS_SESSION_INFORMATION SessionInfo = (PPROCESS_SESSION_INFORMATION)ProcessInformation; - _SEH_TRY + _SEH_TRY + { + SessionInfo->SessionId = Process->SessionId; + if (ReturnLength) { - SessionInfo->SessionId = Process->SessionId; - if (ReturnLength) - { - *ReturnLength = sizeof(PROCESS_SESSION_INFORMATION); - } + *ReturnLength = sizeof(PROCESS_SESSION_INFORMATION); } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; } @@ -1365,148 +1335,123 @@ break; case ProcessVmCounters: - if (ProcessInformationLength != sizeof(VM_COUNTERS)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PVM_COUNTERS pOut = (PVM_COUNTERS)ProcessInformation; + { + PVM_COUNTERS pOut = (PVM_COUNTERS)ProcessInformation; - _SEH_TRY - { - pOut->PeakVirtualSize = Process->PeakVirtualSize; - /* - * Here we should probably use VirtualSize.LowPart, but due to - * incompatibilities in current headers (no unnamed union), - * I opted for cast. - */ - pOut->VirtualSize = (ULONG)Process->VirtualSize.QuadPart; - pOut->PageFaultCount = Process->Vm.PageFaultCount; - pOut->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize; - pOut->WorkingSetSize = Process->Vm.WorkingSetSize; - pOut->QuotaPeakPagedPoolUsage = Process->QuotaPeakPoolUsage[0]; // TODO: Verify! - pOut->QuotaPagedPoolUsage = Process->QuotaPoolUsage[0]; // TODO: Verify! - pOut->QuotaPeakNonPagedPoolUsage = Process->QuotaPeakPoolUsage[1]; // TODO: Verify! - pOut->QuotaNonPagedPoolUsage = Process->QuotaPoolUsage[1]; // TODO: Verify! - pOut->PagefileUsage = Process->PagefileUsage; - pOut->PeakPagefileUsage = Process->PeakPagefileUsage; + _SEH_TRY + { + pOut->PeakVirtualSize = Process->PeakVirtualSize; + /* + * Here we should probably use VirtualSize.LowPart, but due to + * incompatibilities in current headers (no unnamed union), + * I opted for cast. + */ + pOut->VirtualSize = (ULONG)Process->VirtualSize.QuadPart; + pOut->PageFaultCount = Process->Vm.PageFaultCount; + pOut->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize; + pOut->WorkingSetSize = Process->Vm.WorkingSetSize; + pOut->QuotaPeakPagedPoolUsage = Process->QuotaPeakPoolUsage[0]; // TODO: Verify! + pOut->QuotaPagedPoolUsage = Process->QuotaPoolUsage[0]; // TODO: Verify! + pOut->QuotaPeakNonPagedPoolUsage = Process->QuotaPeakPoolUsage[1]; // TODO: Verify! + pOut->QuotaNonPagedPoolUsage = Process->QuotaPoolUsage[1]; // TODO: Verify! + pOut->PagefileUsage = Process->PagefileUsage; + pOut->PeakPagefileUsage = Process->PeakPagefileUsage; - if (ReturnLength) - { - *ReturnLength = sizeof(VM_COUNTERS); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } + if (ReturnLength) + { + *ReturnLength = sizeof(VM_COUNTERS); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; + } case ProcessDefaultHardErrorMode: - if (ProcessInformationLength != sizeof(ULONG)) + { + PULONG HardErrMode = (PULONG)ProcessInformation; + _SEH_TRY { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PULONG HardErrMode = (PULONG)ProcessInformation; - _SEH_TRY + *HardErrMode = Process->DefaultHardErrorProcessing; + if (ReturnLength) { - *HardErrMode = Process->DefaultHardErrorProcessing; - if (ReturnLength) - { - *ReturnLength = sizeof(ULONG); - } + *ReturnLength = sizeof(ULONG); } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; + } case ProcessPriorityBoost: - if (ProcessInformationLength != sizeof(ULONG)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PULONG BoostEnabled = (PULONG)ProcessInformation; + { + PULONG BoostEnabled = (PULONG)ProcessInformation; - _SEH_TRY - { - *BoostEnabled = Process->Pcb.DisableBoost ? FALSE : TRUE; + _SEH_TRY + { + *BoostEnabled = Process->Pcb.DisableBoost ? FALSE : TRUE; - if (ReturnLength) - { - *ReturnLength = sizeof(ULONG); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } + if (ReturnLength) + { + *ReturnLength = sizeof(ULONG); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; + } case ProcessDeviceMap: - if (ProcessInformationLength != sizeof(PROCESS_DEVICEMAP_INFORMATION)) - { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PROCESS_DEVICEMAP_INFORMATION DeviceMap; + { + PROCESS_DEVICEMAP_INFORMATION DeviceMap; - ObQueryDeviceMapInformation(Process, &DeviceMap); - - _SEH_TRY + ObQueryDeviceMapInformation(Process, &DeviceMap); + + _SEH_TRY + { + *(PPROCESS_DEVICEMAP_INFORMATION)ProcessInformation = DeviceMap; + if (ReturnLength) { - *(PPROCESS_DEVICEMAP_INFORMATION)ProcessInformation = DeviceMap; - if (ReturnLength) - { - *ReturnLength = sizeof(PROCESS_DEVICEMAP_INFORMATION); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } + *ReturnLength = sizeof(PROCESS_DEVICEMAP_INFORMATION); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; + } case ProcessPriorityClass: - if (ProcessInformationLength != sizeof(USHORT)) + { + PUSHORT Priority = (PUSHORT)ProcessInformation; + + _SEH_TRY { - Status = STATUS_INFO_LENGTH_MISMATCH; - } - else - { - PUSHORT Priority = (PUSHORT)ProcessInformation; - - _SEH_TRY - { - *Priority = Process->PriorityClass; + *Priority = Process->PriorityClass; - if (ReturnLength) - { - *ReturnLength = sizeof(USHORT); - } - } - _SEH_HANDLE - { - Status = _SEH_GetExceptionCode(); - } - _SEH_END; - } + if (ReturnLength) + { + *ReturnLength = sizeof(USHORT); + } + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; break; + } case ProcessImageFileName: { @@ -1620,6 +1565,7 @@ } } + /* don't forget to detach from the process!!! */ KeDetachProcess(); } else
19 years, 9 months
1
0
0
0
[weiden] 13209: fixed the prototype of KePulseEvent() and made NtPulseEvent() return the previous state
by weiden@svn.reactos.com
fixed the prototype of KePulseEvent() and made NtPulseEvent() return the previous state Modified: trunk/reactos/include/ddk/kefuncs.h Modified: trunk/reactos/ntoskrnl/ex/event.c Modified: trunk/reactos/ntoskrnl/ke/event.c Modified: trunk/reactos/w32api/include/ddk/winddk.h _____ Modified: trunk/reactos/include/ddk/kefuncs.h --- trunk/reactos/include/ddk/kefuncs.h 2005-01-22 12:20:12 UTC (rev 13208) +++ trunk/reactos/include/ddk/kefuncs.h 2005-01-22 12:45:03 UTC (rev 13209) @@ -218,9 +218,9 @@ VOID STDCALL KeLowerIrql (KIRQL NewIrql); -NTSTATUS STDCALL KePulseEvent (PKEVENT Event, - KPRIORITY Increment, - BOOLEAN Wait); +LONG STDCALL KePulseEvent (PKEVENT Event, + KPRIORITY Increment, + BOOLEAN Wait); LARGE_INTEGER STDCALL _____ Modified: trunk/reactos/ntoskrnl/ex/event.c --- trunk/reactos/ntoskrnl/ex/event.c 2005-01-22 12:20:12 UTC (rev 13208) +++ trunk/reactos/ntoskrnl/ex/event.c 2005-01-22 12:45:03 UTC (rev 13209) @@ -295,10 +295,21 @@ NULL); if(NT_SUCCESS(Status)) { - KePulseEvent(Event, EVENT_INCREMENT, FALSE); + LONG Prev = KePulseEvent(Event, EVENT_INCREMENT, FALSE); ObDereferenceObject(Event); - /* FIXME - Return the previous state! */ + if(PreviousState != NULL) + { + _SEH_TRY + { + *PreviousState = Prev; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } } return Status; _____ Modified: trunk/reactos/ntoskrnl/ke/event.c --- trunk/reactos/ntoskrnl/ke/event.c 2005-01-22 12:20:12 UTC (rev 13208) +++ trunk/reactos/ntoskrnl/ke/event.c 2005-01-22 12:45:03 UTC (rev 13209) @@ -108,16 +108,17 @@ /* * @implemented */ -NTSTATUS STDCALL KePulseEvent (PKEVENT Event, - KPRIORITY Increment, - BOOLEAN Wait) +LONG STDCALL +KePulseEvent (IN PKEVENT Event, + IN KPRIORITY Increment, + IN BOOLEAN Wait) { KIRQL OldIrql; - int ret; + LONG Ret; DPRINT("KePulseEvent(Event %x, Wait %x)\n",Event,Wait); OldIrql = KeAcquireDispatcherDatabaseLock(); - ret = InterlockedExchange(&Event->Header.SignalState,1); + Ret = InterlockedExchange(&Event->Header.SignalState,1); KiDispatcherObjectWake(&Event->Header, Increment); InterlockedExchange(&(Event->Header.SignalState),0); @@ -132,7 +133,7 @@ Thread->WaitIrql = OldIrql; } - return ((NTSTATUS)ret); + return Ret; } /* _____ Modified: trunk/reactos/w32api/include/ddk/winddk.h --- trunk/reactos/w32api/include/ddk/winddk.h 2005-01-22 12:20:12 UTC (rev 13208) +++ trunk/reactos/w32api/include/ddk/winddk.h 2005-01-22 12:45:03 UTC (rev 13209) @@ -7607,7 +7607,7 @@ VOID); NTOSAPI -NTSTATUS +LONG DDKAPI KePulseEvent( IN PRKEVENT Event,
19 years, 9 months
1
0
0
0
[weiden] 13208: 1. A few Nt vs. Zw fixes
by weiden@svn.reactos.com
1. A few Nt vs. Zw fixes 2. Fixed and extended RtlCaptureUnicodeString() 3. securely access buffers in NtQuerySystemEnvironmentValue() and NtSetSystemEnvironmentValue() and check for required SeSystemEnvironmentPrivilege privilege Modified: trunk/reactos/drivers/dd/ramdrv/ramdrv.c Modified: trunk/reactos/include/ntos/zw.h Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c Modified: trunk/reactos/ntoskrnl/include/internal/safe.h Modified: trunk/reactos/ntoskrnl/io/event.c Modified: trunk/reactos/ntoskrnl/ke/main.c Modified: trunk/reactos/ntoskrnl/rtl/capture.c Modified: trunk/reactos/ntoskrnl/se/semgr.c Modified: trunk/reactos/w32api/include/ddk/ntapi.h _____ Modified: trunk/reactos/drivers/dd/ramdrv/ramdrv.c --- trunk/reactos/drivers/dd/ramdrv/ramdrv.c 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/drivers/dd/ramdrv/ramdrv.c 2005-01-22 12:20:12 UTC (rev 13208) @@ -139,7 +139,7 @@ 0 ); allocsize.u.LowPart = allocsize.u.HighPart = 0; - Status = NtOpenFile( &file, + Status = ZwOpenFile( &file, GENERIC_READ, &objattr, &iosb, @@ -157,7 +157,7 @@ 0, 0, 0 ); - Status = NtCreateEvent( &event, + Status = ZwCreateEvent( &event, 0, &objattr, NotificationEvent, @@ -168,7 +168,7 @@ goto cleanfile; } - Status = NtQueryInformationFile( file, + Status = ZwQueryInformationFile( file, &iosb, &finfo, sizeof( finfo ), @@ -187,7 +187,7 @@ goto cleanevent; } - Status = NtReadFile( file, + Status = ZwReadFile( file, event, 0, 0, @@ -202,7 +202,7 @@ DPRINT( "Failed to read floppy\n" ); goto cleantbuff; } - Status = NtWaitForSingleObject( event, FALSE, 0 ); + Status = ZwWaitForSingleObject( event, FALSE, 0 ); if( Status != STATUS_WAIT_0 || !NT_SUCCESS( iosb.Status ) ) { DPRINT( "Failed to read floppy\n" ); @@ -221,16 +221,16 @@ } else DbgPrint( "RAMDRV: Failed to decomparess image, error: %d\n", err ); ExFreePool( tbuff ); - NtClose( file ); - NtClose( event ); + ZwClose( file ); + ZwClose( event ); return STATUS_SUCCESS; cleantbuff: ExFreePool( tbuff ); cleanevent: - NtClose( event ); + ZwClose( event ); cleanfile: - NtClose( file ); + ZwClose( file ); cleanbuffer: ExFreePool( devext->Buffer ); _____ Modified: trunk/reactos/include/ntos/zw.h --- trunk/reactos/include/ntos/zw.h 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/include/ntos/zw.h 2005-01-22 12:20:12 UTC (rev 13208) @@ -3107,19 +3107,19 @@ NTSTATUS STDCALL NtQuerySystemEnvironmentValue( - IN PUNICODE_STRING Name, - OUT PVOID Value, - ULONG Length, - PULONG ReturnLength + IN PUNICODE_STRING VariableName, + OUT PWSTR ValueBuffer, + IN ULONG ValueBufferLength, + OUT PULONG ReturnLength OPTIONAL ); NTSTATUS STDCALL ZwQuerySystemEnvironmentValue( - IN PUNICODE_STRING Name, - OUT PVOID Value, - ULONG Length, - PULONG ReturnLength + IN PUNICODE_STRING VariableName, + OUT PWSTR ValueBuffer, + IN ULONG ValueBufferLength, + OUT PULONG ReturnLength OPTIONAL ); _____ Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c --- trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/ntoskrnl/ex/sysinfo.c 2005-01-22 12:20:12 UTC (rev 13208) @@ -90,10 +90,10 @@ } NTSTATUS STDCALL -NtQuerySystemEnvironmentValue (IN PUNICODE_STRING UnsafeName, - OUT PVOID UnsafeValue, - IN ULONG Length, - IN OUT PULONG UnsafeReturnLength) +NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName, + OUT PWCHAR ValueBuffer, + IN ULONG ValueBufferLength, + IN OUT PULONG ReturnLength OPTIONAL) { NTSTATUS Status; ANSI_STRING AName; @@ -102,225 +102,197 @@ PCH Value; ANSI_STRING AValue; UNICODE_STRING WValue; - ULONG ReturnLength; + KPROCESSOR_MODE PreviousMode; + + PreviousMode = ExGetPreviousMode(); /* * Copy the name to kernel space if necessary and convert it to ANSI. */ - if (ExGetPreviousMode() != KernelMode) + Status = RtlCaptureUnicodeString(&WName, + PreviousMode, + NonPagedPool, + FALSE, + VariableName); + if(NT_SUCCESS(Status)) + { + if(PreviousMode != KernelMode) { - Status = RtlCaptureUnicodeString(&WName, UnsafeName); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - Status = RtlUnicodeStringToAnsiString(&AName, UnsafeName, TRUE); - if (!NT_SUCCESS(Status)) - { - return(Status); - } + ProbeForWrite(ValueBuffer, + ValueBufferLength, + sizeof(WCHAR)); + if(ReturnLength != NULL) + { + ProbeForWrite(ReturnLength, + sizeof(ULONG), + sizeof(ULONG)); + } } - else + + /* + * according to ntinternals the SeSystemEnvironmentName privilege is required! + */ + if(!SeSinglePrivilegeCheck(SeSystemEnvironmentPrivilege, + PreviousMode)) { - Status = RtlUnicodeStringToAnsiString(&AName, UnsafeName, TRUE); - if (!NT_SUCCESS(Status)) - { - return(Status); - } + RtlRelaseCapturedUnicodeString(&WName, + PreviousMode, + FALSE); + return STATUS_PRIVILEGE_NOT_HELD; } - - /* - * Create a temporary buffer for the value - */ - Value = ExAllocatePool(NonPagedPool, Length); - if (Value == NULL) + + /* + * convert the value name to ansi + */ + Status = RtlUnicodeStringToAnsiString(&AName, &WName, TRUE); + RtlRelaseCapturedUnicodeString(&WName, + PreviousMode, + FALSE); + if(!NT_SUCCESS(Status)) { - RtlFreeAnsiString(&AName); - if (ExGetPreviousMode() != KernelMode) - { - RtlFreeUnicodeString(&WName); - } - return(STATUS_NO_MEMORY); + return Status; } - + /* - * Get the environment variable + * Create a temporary buffer for the value */ - Result = HalGetEnvironmentVariable(AName.Buffer, Value, Length); - if (!Result) + Value = ExAllocatePool(NonPagedPool, ValueBufferLength); + if (Value == NULL) { RtlFreeAnsiString(&AName); - if (ExGetPreviousMode() != KernelMode) - { - RtlFreeUnicodeString(&WName); - } - ExFreePool(Value); - return(STATUS_UNSUCCESSFUL); + return STATUS_INSUFFICIENT_RESOURCES; } - - /* - * Convert the result to UNICODE. - */ - RtlInitAnsiString(&AValue, Value); - Status = RtlAnsiStringToUnicodeString(&WValue, &AValue, TRUE); - if (!NT_SUCCESS(Status)) + + /* + * Get the environment variable + */ + Result = HalGetEnvironmentVariable(AName.Buffer, Value, ValueBufferLength); + if(!Result) { RtlFreeAnsiString(&AName); - if (ExGetPreviousMode() != KernelMode) - { - RtlFreeUnicodeString(&WName); - } ExFreePool(Value); - return(Status); + return STATUS_UNSUCCESSFUL; } - ReturnLength = WValue.Length; - - /* - * Copy the result back to the caller. - */ - if (ExGetPreviousMode() != KernelMode) + + /* + * Convert the result to UNICODE, protect with SEH in case the value buffer + * isn't NULL-terminated! + */ + _SEH_TRY { - Status = MmCopyToCaller(UnsafeValue, WValue.Buffer, ReturnLength); - if (!NT_SUCCESS(Status)) - { - RtlFreeAnsiString(&AName); - if (ExGetPreviousMode() != KernelMode) - { - RtlFreeUnicodeString(&WName); - } - ExFreePool(Value); - RtlFreeUnicodeString(&WValue); - return(Status); - } - - Status = MmCopyToCaller(UnsafeReturnLength, &ReturnLength, - sizeof(ULONG)); - if (!NT_SUCCESS(Status)) - { - RtlFreeAnsiString(&AName); - if (ExGetPreviousMode() != KernelMode) - { - RtlFreeUnicodeString(&WName); - } - ExFreePool(Value); - RtlFreeUnicodeString(&WValue); - return(Status); - } + RtlInitAnsiString(&AValue, Value); + Status = RtlAnsiStringToUnicodeString(&WValue, &AValue, TRUE); } - else + _SEH_HANDLE { - memcpy(UnsafeValue, WValue.Buffer, ReturnLength); - memcpy(UnsafeReturnLength, &ReturnLength, sizeof(ULONG)); + Status = _SEH_GetExceptionCode(); } + _SEH_END; - /* - * Free temporary buffers. - */ - RtlFreeAnsiString(&AName); - if (ExGetPreviousMode() != KernelMode) + if(NT_SUCCESS(Status)) { - RtlFreeUnicodeString(&WName); + /* + * Copy the result back to the caller. + */ + _SEH_TRY + { + RtlCopyMemory(ValueBuffer, WValue.Buffer, WValue.Length); + ValueBuffer[WValue.Length / sizeof(WCHAR)] = L'\0'; + if(ReturnLength != NULL) + { + *ReturnLength = WValue.Length + sizeof(WCHAR); + } + + Status = STATUS_SUCCESS; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; } - ExFreePool(Value); - RtlFreeUnicodeString(&WValue); + + /* + * Cleanup allocated resources. + */ + RtlFreeAnsiString(&AName); + ExFreePool(Value); + } - return(STATUS_SUCCESS); + return Status; } NTSTATUS STDCALL -NtSetSystemEnvironmentValue (IN PUNICODE_STRING UnsafeName, - IN PUNICODE_STRING UnsafeValue) +NtSetSystemEnvironmentValue (IN PUNICODE_STRING VariableName, + IN PUNICODE_STRING Value) { - UNICODE_STRING WName; - ANSI_STRING AName; - UNICODE_STRING WValue; - ANSI_STRING AValue; - BOOLEAN Result; + UNICODE_STRING CapturedName, CapturedValue; + ANSI_STRING AName, AValue; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; + PreviousMode = ExGetPreviousMode(); + /* - * Check for required privilege. + * Copy the strings to kernel space if necessary */ - /* FIXME: Not implemented. */ - - /* - * Copy the name to kernel space if necessary and convert it to ANSI. - */ - if (ExGetPreviousMode() != KernelMode) + Status = RtlCaptureUnicodeString(&CapturedName, + PreviousMode, + NonPagedPool, + FALSE, + VariableName); + if(NT_SUCCESS(Status)) + { + Status = RtlCaptureUnicodeString(&CapturedValue, + PreviousMode, + NonPagedPool, + FALSE, + Value); + if(NT_SUCCESS(Status)) { - Status = RtlCaptureUnicodeString(&WName, UnsafeName); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - Status = RtlUnicodeStringToAnsiString(&AName, UnsafeName, TRUE); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - } - else - { - Status = RtlUnicodeStringToAnsiString(&AName, UnsafeName, TRUE); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - } + /* + * according to ntinternals the SeSystemEnvironmentName privilege is required! + */ + if(SeSinglePrivilegeCheck(SeSystemEnvironmentPrivilege, + PreviousMode)) + { + /* + * convert the strings to ANSI + */ + Status = RtlUnicodeStringToAnsiString(&AName, + &CapturedName, + TRUE); + if(NT_SUCCESS(Status)) + { + Status = RtlUnicodeStringToAnsiString(&AValue, + &CapturedValue, + TRUE); + if(NT_SUCCESS(Status)) + { + BOOLEAN Result = HalSetEnvironmentVariable(AName.Buffer, + AValue.Buffer); - /* - * Copy the value to kernel space and convert to ANSI. - */ - if (ExGetPreviousMode() != KernelMode) - { - Status = RtlCaptureUnicodeString(&WValue, UnsafeValue); - if (!NT_SUCCESS(Status)) - { - RtlFreeUnicodeString(&WName); - RtlFreeAnsiString(&AName); - return(Status); - } - Status = RtlUnicodeStringToAnsiString(&AValue, UnsafeValue, TRUE); - if (!NT_SUCCESS(Status)) - { - RtlFreeUnicodeString(&WName); - RtlFreeAnsiString(&AName); - RtlFreeUnicodeString(&WValue); - return(Status); - } + Status = (Result ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL); + } + } + } + else + { + Status = STATUS_PRIVILEGE_NOT_HELD; + } + + RtlRelaseCapturedUnicodeString(&CapturedValue, + PreviousMode, + FALSE); } - else - { - Status = RtlUnicodeStringToAnsiString(&AValue, UnsafeValue, TRUE); - if (!NT_SUCCESS(Status)) - { - RtlFreeAnsiString(&AName); - return(Status); - } - } - /* - * Set the environment variable - */ - Result = HalSetEnvironmentVariable(AName.Buffer, AValue.Buffer); - - /* - * Free everything and return status. - */ - RtlFreeAnsiString(&AName); - RtlFreeAnsiString(&AValue); - if (ExGetPreviousMode() != KernelMode) - { - RtlFreeUnicodeString(&WName); - RtlFreeUnicodeString(&WValue); - } - - if (!Result) - { - return(STATUS_UNSUCCESSFUL); - } - return(STATUS_SUCCESS); + RtlRelaseCapturedUnicodeString(&CapturedName, + PreviousMode, + FALSE); + } + + return Status; } _____ Modified: trunk/reactos/ntoskrnl/include/internal/safe.h --- trunk/reactos/ntoskrnl/include/internal/safe.h 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/ntoskrnl/include/internal/safe.h 2005-01-22 12:20:12 UTC (rev 13208) @@ -10,7 +10,15 @@ MmCopyToCaller(PVOID Dest, const VOID *Src, ULONG NumberOfBytes); NTSTATUS -RtlCaptureUnicodeString(PUNICODE_STRING Dest, - PUNICODE_STRING UnsafeSrc); +RtlCaptureUnicodeString(OUT PUNICODE_STRING Dest, + IN KPROCESSOR_MODE CurrentMode, + IN POOL_TYPE PoolType, + IN BOOLEAN CaptureIfKernel, + IN PUNICODE_STRING UnsafeSrc); +VOID +RtlRelaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, + IN KPROCESSOR_MODE CurrentMode, + IN BOOLEAN CaptureIfKernel); + #endif /* __NTOSKRNL_INCLUDE_INTERNAL_SAFE_Hb */ _____ Modified: trunk/reactos/ntoskrnl/io/event.c --- trunk/reactos/ntoskrnl/io/event.c 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/ntoskrnl/io/event.c 2005-01-22 12:20:12 UTC (rev 13208) @@ -34,7 +34,7 @@ NULL, NULL); - Status = NtCreateEvent(&Handle, + Status = ZwCreateEvent(&Handle, EVENT_ALL_ACCESS, &ObjectAttributes, NotificationEvent, @@ -65,21 +65,40 @@ PHANDLE EventHandle) { OBJECT_ATTRIBUTES ObjectAttributes; + UNICODE_STRING CapturedEventName; + KPROCESSOR_MODE PreviousMode; PKEVENT Event; HANDLE Handle; NTSTATUS Status; + + PreviousMode = ExGetPreviousMode(); + + Status = RtlCaptureUnicodeString(&CapturedEventName, + PreviousMode, + NonPagedPool, + FALSE, + EventName); + if (!NT_SUCCESS(Status)) + { + return NULL; + } InitializeObjectAttributes(&ObjectAttributes, - EventName, + &CapturedEventName, OBJ_OPENIF, NULL, NULL); - Status = NtCreateEvent(&Handle, + Status = ZwCreateEvent(&Handle, EVENT_ALL_ACCESS, &ObjectAttributes, SynchronizationEvent, TRUE); + + RtlRelaseCapturedUnicodeString(&CapturedEventName, + PreviousMode, + FALSE); + if (!NT_SUCCESS(Status)) { return NULL; _____ Modified: trunk/reactos/ntoskrnl/ke/main.c --- trunk/reactos/ntoskrnl/ke/main.c 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/ntoskrnl/ke/main.c 2005-01-22 12:20:12 UTC (rev 13208) @@ -748,7 +748,7 @@ 0, NULL, NULL); - Status = NtCreateEvent(&InitDoneEventHandle, + Status = ZwCreateEvent(&InitDoneEventHandle, EVENT_ALL_ACCESS, &ObjectAttributes, SynchronizationEvent, @@ -778,7 +778,7 @@ /* Wait for the system to be initialized */ Timeout.QuadPart = (LONGLONG)-1200000000; /* 120 second timeout */ - Status = NtWaitForMultipleObjects(((LONG) sizeof(Handles) / sizeof(HANDLE)), + Status = ZwWaitForMultipleObjects(((LONG) sizeof(Handles) / sizeof(HANDLE)), Handles, WaitAny, FALSE, /* Non-alertable */ @@ -804,9 +804,9 @@ InbvEnableBootDriver(FALSE); } - NtSetEvent(InitDoneEventHandle, NULL); + ZwSetEvent(InitDoneEventHandle, NULL); - NtClose(InitDoneEventHandle); + ZwClose(InitDoneEventHandle); } else { @@ -820,7 +820,7 @@ * Crash the system if the initial process terminates within 5 seconds. */ Timeout.QuadPart = (LONGLONG)-50000000; /* 5 second timeout */ - Status = NtWaitForSingleObject(ProcessHandle, + Status = ZwWaitForSingleObject(ProcessHandle, FALSE, &Timeout); if (Status != STATUS_TIMEOUT) @@ -834,8 +834,8 @@ KiTimerSystemAuditing = 1; - NtClose(ThreadHandle); - NtClose(ProcessHandle); + ZwClose(ThreadHandle); + ZwClose(ProcessHandle); } VOID __attribute((noinline)) _____ Modified: trunk/reactos/ntoskrnl/rtl/capture.c --- trunk/reactos/ntoskrnl/rtl/capture.c 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/ntoskrnl/rtl/capture.c 2005-01-22 12:20:12 UTC (rev 13208) @@ -35,43 +35,95 @@ /* FUNCTIONS *****************************************************************/ NTSTATUS -RtlCaptureUnicodeString(PUNICODE_STRING Dest, - PUNICODE_STRING UnsafeSrc) +RtlCaptureUnicodeString(OUT PUNICODE_STRING Dest, + IN KPROCESSOR_MODE CurrentMode, + IN POOL_TYPE PoolType, + IN BOOLEAN CaptureIfKernel, + IN PUNICODE_STRING UnsafeSrc) { - PUNICODE_STRING Src; - NTSTATUS Status; - + UNICODE_STRING Src; + NTSTATUS Status = STATUS_SUCCESS; + + ASSERT(Dest != NULL); + /* * Copy the source string structure to kernel space. */ - Status = MmCopyFromCaller(&Src, UnsafeSrc, sizeof(UNICODE_STRING)); - if (!NT_SUCCESS(Status)) + + if(CurrentMode == UserMode) + { + _SEH_TRY { - return(Status); + ProbeForRead(UnsafeSrc, + sizeof(UNICODE_STRING), + sizeof(ULONG)); + Src = *UnsafeSrc; } - + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } + } + else if(!CaptureIfKernel) + { + /* just copy the UNICODE_STRING structure, the pointers are considered valid */ + *Dest = *UnsafeSrc; + return STATUS_SUCCESS; + } + else + { + /* capture the string even though it is considered to be valid */ + Src = *UnsafeSrc; + } + /* * Initialize the destination string. */ - Dest->Length = Src->Length; - Dest->MaximumLength = Src->MaximumLength; - Dest->Buffer = ExAllocatePool(NonPagedPool, Dest->MaximumLength); + Dest->Length = Src.Length; + Dest->MaximumLength = Src.Length + sizeof(WCHAR); + Dest->Buffer = ExAllocatePool(PoolType, Dest->MaximumLength); if (Dest->Buffer == NULL) - { - return(STATUS_NO_MEMORY); - } + { + Dest->Length = Dest->MaximumLength = 0; + Dest->Buffer = NULL; + return STATUS_INSUFFICIENT_RESOURCES; + } /* * Copy the source string to kernel space. */ - Status = MmCopyFromCaller(Dest->Buffer, Src->Buffer, Dest->Length); - if (!NT_SUCCESS(Status)) + if(Src.Length > 0) + { + _SEH_TRY { - ExFreePool(Dest->Buffer); - return(Status); + RtlCopyMemory(Dest->Buffer, Src.Buffer, Src.Length); + Dest->Buffer[Src.Length / sizeof(WCHAR)] = L'\0'; } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + + return Status; +} - return(STATUS_SUCCESS); +VOID +RtlRelaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, + IN KPROCESSOR_MODE CurrentMode, + IN BOOLEAN CaptureIfKernel) +{ + if(CurrentMode != KernelMode || CaptureIfKernel ) + { + RtlFreeUnicodeString(CapturedString); + } } NTSTATUS _____ Modified: trunk/reactos/ntoskrnl/se/semgr.c --- trunk/reactos/ntoskrnl/se/semgr.c 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/ntoskrnl/se/semgr.c 2005-01-22 12:20:12 UTC (rev 13208) @@ -84,7 +84,7 @@ OBJ_PERMANENT, 0, NULL); - Status = NtCreateDirectoryObject(&DirectoryHandle, + Status = ZwCreateDirectoryObject(&DirectoryHandle, DIRECTORY_ALL_ACCESS, &ObjectAttributes); if (!NT_SUCCESS(Status)) @@ -101,7 +101,7 @@ OBJ_PERMANENT, DirectoryHandle, SePublicDefaultSd); - Status = NtCreateEvent(&EventHandle, + Status = ZwCreateEvent(&EventHandle, EVENT_ALL_ACCESS, &ObjectAttributes, SynchronizationEvent, @@ -113,8 +113,8 @@ return FALSE; } - NtClose(EventHandle); - NtClose(DirectoryHandle); + ZwClose(EventHandle); + ZwClose(DirectoryHandle); /* FIXME: Create SRM port and listener thread */ _____ Modified: trunk/reactos/w32api/include/ddk/ntapi.h --- trunk/reactos/w32api/include/ddk/ntapi.h 2005-01-22 06:47:33 UTC (rev 13207) +++ trunk/reactos/w32api/include/ddk/ntapi.h 2005-01-22 12:20:12 UTC (rev 13208) @@ -735,16 +735,16 @@ NTSTATUS NTAPI ZwQuerySystemEnvironmentValue( - IN PUNICODE_STRING Name, - OUT PVOID Value, - IN ULONG ValueLength, - OUT PULONG ReturnLength OPTIONAL); + IN PUNICODE_STRING VariableName, + OUT PWSTR ValueBuffer, + IN ULONG ValueBufferLength, + OUT PULONG ReturnLength OPTIONAL); NTOSAPI NTSTATUS NTAPI ZwSetSystemEnvironmentValue( - IN PUNICODE_STRING Name, + IN PUNICODE_STRING VariableName, IN PUNICODE_STRING Value); typedef enum _SHUTDOWN_ACTION {
19 years, 9 months
1
0
0
0
[arty] 13207: Working ping.
by arty@svn.reactos.com
Working ping. msafd: Added datagram flag to SOCK_RAW sockets transport/* did some refactoring, added some printing. Main thing: there is now a generic IP only header builder in rawip that's shared by udp and rawip. afd: Make sure datagram sockets always select writable Add some socket close infrastructure to kill associated active polls Modified: trunk/reactos/drivers/lib/ip/transport/datagram/datagram.c Modified: trunk/reactos/drivers/lib/ip/transport/rawip/rawip.c Modified: trunk/reactos/drivers/lib/ip/transport/udp/udp.c Modified: trunk/reactos/drivers/net/afd/afd/bind.c Modified: trunk/reactos/drivers/net/afd/afd/main.c Modified: trunk/reactos/drivers/net/afd/afd/select.c Modified: trunk/reactos/drivers/net/afd/afd/write.c Modified: trunk/reactos/drivers/net/afd/include/afd.h Modified: trunk/reactos/drivers/net/tcpip/include/rawip.h Modified: trunk/reactos/drivers/net/tcpip/tcpip/dispatch.c Modified: trunk/reactos/lib/msafd/misc/dllmain.c _____ Modified: trunk/reactos/drivers/lib/ip/transport/datagram/datagram.c --- trunk/reactos/drivers/lib/ip/transport/datagram/datagram.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/lib/ip/transport/datagram/datagram.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -86,6 +86,10 @@ if (Found) { TI_DbgPrint(MAX_TRACE, ("Suitable receive request found.\n")); + + TI_DbgPrint(MAX_TRACE, + ("Target Buffer: %x, Source Buffer: %x, Size %d\n", + Current->Buffer, DataBuffer, DataSize)); /* Copy the data into buffer provided by the user */ RtlCopyMemory( Current->Buffer, _____ Modified: trunk/reactos/drivers/lib/ip/transport/rawip/rawip.c --- trunk/reactos/drivers/lib/ip/transport/rawip/rawip.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/lib/ip/transport/rawip/rawip.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -2,7 +2,7 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS TCP/IP protocol driver * FILE: transport/rawip/rawip.c - * PURPOSE: Raw IP routines + * PURPOSE: User Datagram Protocol routines * PROGRAMMERS: Casper S. Hornstrup (chorns(a)users.sourceforge.net) * REVISIONS: * CSH 01/08-2000 Created @@ -10,71 +10,155 @@ #include "precomp.h" +NTSTATUS AddGenericHeaderIPv4( + PIP_ADDRESS RemoteAddress, + USHORT RemotePort, + PIP_ADDRESS LocalAddress, + USHORT LocalPort, + PIP_PACKET IPPacket, + UINT DataLength, + UINT Protocol, + UINT ExtraLength, + PVOID *NextHeader ) +/* + * FUNCTION: Adds an IPv4 and RawIp header to an IP packet + * ARGUMENTS: + * SendRequest = Pointer to send request + * LocalAddress = Pointer to our local address + * LocalPort = The port we send this datagram from + * IPPacket = Pointer to IP packet + * RETURNS: + * Status of operation + */ +{ + PIPv4_HEADER IPHeader; + ULONG BufferSize; + + TI_DbgPrint(MID_TRACE, ("Packet: %x NdisPacket %x\n", + IPPacket, IPPacket->NdisPacket)); + + BufferSize = MaxLLHeaderSize + sizeof(IPv4_HEADER) + ExtraLength; + + GetDataPtr( IPPacket->NdisPacket, + MaxLLHeaderSize, + (PCHAR *)&IPPacket->Header, + &IPPacket->ContigSize ); + + IPPacket->HeaderSize = 20; + + TI_DbgPrint(MAX_TRACE, ("Allocated %d bytes for headers at 0x%X.\n", + BufferSize, IPPacket->Header)); + TI_DbgPrint(MAX_TRACE, ("Packet total length %d\n", IPPacket->TotalSize)); + + /* Build IPv4 header */ + IPHeader = (PIPv4_HEADER)IPPacket->Header; + /* Version = 4, Length = 5 DWORDs */ + IPHeader->VerIHL = 0x45; + /* Normal Type-of-Service */ + IPHeader->Tos = 0; + /* Length of header and data */ + IPHeader->TotalLength = WH2N((USHORT)IPPacket->TotalSize); + /* Identification */ + IPHeader->Id = 0; + /* One fragment at offset 0 */ + IPHeader->FlagsFragOfs = 0; + /* Time-to-Live is 128 */ + IPHeader->Ttl = 128; + /* User Datagram Protocol */ + IPHeader->Protocol = Protocol; + /* Checksum is 0 (for later calculation of this) */ + IPHeader->Checksum = 0; + /* Source address */ + IPHeader->SrcAddr = LocalAddress->Address.IPv4Address; + /* Destination address. FIXME: IPv4 only */ + IPHeader->DstAddr = RemoteAddress->Address.IPv4Address; + + /* Build RawIp header */ + *NextHeader = (((PCHAR)IPHeader) + sizeof(IPv4_HEADER)); + IPPacket->Data = ((PCHAR)*NextHeader) + ExtraLength; + + return STATUS_SUCCESS; +} -BOOLEAN RawIPInitialized = FALSE; - -NTSTATUS BuildRawIPPacket( +NTSTATUS BuildRawIpPacket( PIP_PACKET Packet, - UINT DataLength, + PIP_ADDRESS RemoteAddress, + USHORT RemotePort, PIP_ADDRESS LocalAddress, - USHORT LocalPort ) + USHORT LocalPort, + PCHAR DataBuffer, + UINT DataLen ) /* - * FUNCTION: Builds an UDP packet + * FUNCTION: Builds an RawIp packet * ARGUMENTS: * Context = Pointer to context information (DATAGRAM_SEND_REQUEST) - * LocalAddress = Pointer to our local address (NULL) - * LocalPort = The port we send this datagram from (0) + * LocalAddress = Pointer to our local address + * LocalPort = The port we send this datagram from * IPPacket = Address of pointer to IP packet * RETURNS: * Status of operation */ { - PVOID Header; - NDIS_STATUS NdisStatus; - PNDIS_BUFFER HeaderBuffer; - PNDIS_PACKET NdisPacket = Packet->NdisPacket; - /* Will be zeroed in packet by IPInitializePacket */ - + NTSTATUS Status; + PCHAR Payload; + + TI_DbgPrint(MAX_TRACE, ("Called.\n")); + + /* FIXME: Assumes IPv4 */ + IPInitializePacket(Packet, IP_ADDRESS_V4); + if (!Packet) + return STATUS_INSUFFICIENT_RESOURCES; + + Packet->TotalSize = sizeof(IPv4_HEADER) + DataLen; + /* Prepare packet */ - IPInitializePacket(Packet,IP_ADDRESS_V4); - Packet->Flags = IP_PACKET_FLAG_RAW; /* Don't touch IP header */ - Packet->TotalSize = DataLength; - Packet->NdisPacket = NdisPacket; + Status = AllocatePacketWithBuffer( &Packet->NdisPacket, + NULL, + Packet->TotalSize + MaxLLHeaderSize ); + + if( !NT_SUCCESS(Status) ) return Status; - if (MaxLLHeaderSize != 0) { - Header = ExAllocatePool(NonPagedPool, MaxLLHeaderSize); - if (!Header) { - TI_DbgPrint(MIN_TRACE, ("Cannot allocate memory for packet headers.\n")); - return STATUS_INSUFFICIENT_RESOURCES; - } + TI_DbgPrint(MID_TRACE, ("Allocated packet: %x\n", Packet->NdisPacket)); + TI_DbgPrint(MID_TRACE, ("Local Addr : %s\n", A2S(LocalAddress))); + TI_DbgPrint(MID_TRACE, ("Remote Addr: %s\n", A2S(RemoteAddress))); + + switch (RemoteAddress->Type) { + case IP_ADDRESS_V4: + Status = AddGenericHeaderIPv4 + (RemoteAddress, RemotePort, + LocalAddress, LocalPort, Packet, DataLen, + IPPROTO_ICMP, /* XXX Figure out a better way to do this */ + 0, (PVOID *)&Payload ); + break; + case IP_ADDRESS_V6: + /* FIXME: Support IPv6 */ + Status = STATUS_UNSUCCESSFUL; + TI_DbgPrint(MIN_TRACE, ("IPv6 RawIp datagrams are not supported.\n")); + break; - TI_DbgPrint(MAX_TRACE, ("Allocated %d bytes for headers at 0x%X.\n", - MaxLLHeaderSize, Header)); - - /* Allocate NDIS buffer for maximum link level header */ - NdisAllocateBuffer(&NdisStatus, - &HeaderBuffer, - GlobalBufferPool, - Header, - MaxLLHeaderSize); - - if (NdisStatus != NDIS_STATUS_SUCCESS) { - TI_DbgPrint(MIN_TRACE, ("Cannot allocate NDIS buffer for packet headers. NdisStatus = (0x%X)\n", NdisStatus)); - ExFreePool(Header); - return STATUS_INSUFFICIENT_RESOURCES; - } - - /* Chain header at front of packet */ - NdisChainBufferAtFront(Packet->NdisPacket, HeaderBuffer); + default: + Status = STATUS_UNSUCCESSFUL; + TI_DbgPrint(MIN_TRACE, ("Bad Address Type %d\n", RemoteAddress->Type)); + break; } - + + TI_DbgPrint(MID_TRACE, ("Copying data (hdr %x data %x (%d))\n", + Packet->Header, Packet->Data, + (PCHAR)Packet->Data - (PCHAR)Packet->Header)); + + RtlCopyMemory( Packet->Data, DataBuffer, DataLen ); + + TI_DbgPrint(MID_TRACE, ("Displaying packet\n")); + DISPLAY_IP_PACKET(Packet); - + + TI_DbgPrint(MID_TRACE, ("Leaving\n")); + return STATUS_SUCCESS; } -VOID RawIPSendComplete +VOID RawIpSendPacketComplete ( PVOID Context, PNDIS_PACKET Packet, NDIS_STATUS Status ) { FreeNdisPacket( Packet ); } @@ -83,10 +167,10 @@ PADDRESS_FILE AddrFile, PTDI_CONNECTION_INFORMATION ConnInfo, PCHAR BufferData, - ULONG BufferLen, - PULONG DataUsed ) + ULONG DataSize, + PULONG DataUsed ) /* - * FUNCTION: Sends a raw IP datagram to a remote address + * FUNCTION: Sends an RawIp datagram to a remote address * ARGUMENTS: * Request = Pointer to TDI request * ConnInfo = Pointer to connection information @@ -96,134 +180,258 @@ * Status of operation */ { - NDIS_STATUS Status; IP_PACKET Packet; + PTA_IP_ADDRESS RemoteAddressTa = (PTA_IP_ADDRESS)ConnInfo->RemoteAddress; + IP_ADDRESS RemoteAddress; + USHORT RemotePort; + NTSTATUS Status; PNEIGHBOR_CACHE_ENTRY NCE; - IP_ADDRESS RemoteAddress; - Status = AllocatePacketWithBuffer( &Packet.NdisPacket, - BufferData, - BufferLen ); + TI_DbgPrint(MID_TRACE,("Sending Datagram(%x %x %x %d)\n", + AddrFile, ConnInfo, BufferData, DataSize)); + TI_DbgPrint(MID_TRACE,("RemoteAddressTa: %x\n", RemoteAddressTa)); + + switch( RemoteAddressTa->Address[0].AddressType ) { + case TDI_ADDRESS_TYPE_IP: + RemoteAddress.Type = IP_ADDRESS_V4; + RemoteAddress.Address.IPv4Address = + RemoteAddressTa->Address[0].Address[0].in_addr; + RemotePort = RemoteAddressTa->Address[0].Address[0].sin_port; + break; + + default: + return STATUS_UNSUCCESSFUL; + } - TI_DbgPrint(MID_TRACE,("Packet.NdisPacket %x\n", Packet.NdisPacket)); + Status = BuildRawIpPacket( &Packet, + &RemoteAddress, + RemotePort, + &AddrFile->Address, + AddrFile->Port, + BufferData, + DataSize ); + + if( !NT_SUCCESS(Status) ) + return Status; - *DataUsed = BufferLen; + TI_DbgPrint(MID_TRACE,("About to get route to destination\n")); - if( Status == NDIS_STATUS_SUCCESS ) - Status = BuildRawIPPacket( &Packet, - BufferLen, - &AddrFile->Address, - AddrFile->Port ); + if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) + return STATUS_UNSUCCESSFUL; - if( Status == NDIS_STATUS_SUCCESS ) { - RemoteAddress.Type = IP_ADDRESS_V4; - RtlCopyMemory( &RemoteAddress.Address.IPv4Address, - BufferData + FIELD_OFFSET(IPv4_HEADER, DstAddr), - sizeof(IPv4_RAW_ADDRESS) ); + TI_DbgPrint(MID_TRACE,("About to send datagram\n")); - if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) { - FreeNdisPacket( Packet.NdisPacket ); - return STATUS_NO_SUCH_DEVICE; - } - - IPSendDatagram( &Packet, NCE, RawIPSendComplete, NULL ); - } else - FreeNdisPacket( Packet.NdisPacket ); + IPSendDatagram( &Packet, NCE, RawIpSendPacketComplete, NULL ); - return Status; + TI_DbgPrint(MID_TRACE,("Leaving\n")); + + return STATUS_SUCCESS; } +VOID RawIpReceiveComplete(PVOID Context, NTSTATUS Status, ULONG Count) { + PDATAGRAM_RECEIVE_REQUEST ReceiveRequest = + (PDATAGRAM_RECEIVE_REQUEST)Context; + TI_DbgPrint(MAX_TRACE,("Called\n")); + ReceiveRequest->UserComplete( ReceiveRequest->UserContext, Status, Count ); + exFreePool( ReceiveRequest ); + TI_DbgPrint(MAX_TRACE,("Done\n")); +} -VOID RawIPReceive( - PIP_INTERFACE Interface, - PIP_PACKET IPPacket) +NTSTATUS RawIPReceiveDatagram( + PADDRESS_FILE AddrFile, + PTDI_CONNECTION_INFORMATION ConnInfo, + PCHAR BufferData, + ULONG ReceiveLength, + ULONG ReceiveFlags, + PTDI_CONNECTION_INFORMATION ReturnInfo, + PULONG BytesReceived, + PDATAGRAM_COMPLETION_ROUTINE Complete, + PVOID Context) /* - * FUNCTION: Receives and queues a raw IP datagram + * FUNCTION: Attempts to receive an RawIp datagram from a remote address * ARGUMENTS: - * NTE = Pointer to net table entry which the packet was received on - * IPPacket = Pointer to an IP packet that was received + * Request = Pointer to TDI request + * ConnInfo = Pointer to connection information + * Buffer = Pointer to NDIS buffer chain to store received data + * ReceiveLength = Maximum size to use of buffer, 0 if all can be used + * ReceiveFlags = Receive flags (None, Normal, Peek) + * ReturnInfo = Pointer to structure for return information + * BytesReceive = Pointer to structure for number of bytes received + * RETURNS: + * Status of operation * NOTES: - * This is the low level interface for receiving ICMP datagrams. - * It delivers the packet header and data to anyone that wants it - * When we get here the datagram has already passed sanity checks + * This is the high level interface for receiving RawIp datagrams */ { - PIP_ADDRESS DstAddress; - + KIRQL OldIrql; + NTSTATUS Status; + PDATAGRAM_RECEIVE_REQUEST ReceiveRequest; + TI_DbgPrint(MAX_TRACE, ("Called.\n")); + + TcpipAcquireSpinLock(&AddrFile->Lock, &OldIrql); + + if (AF_IS_VALID(AddrFile)) + { + ReceiveRequest = exAllocatePool(NonPagedPool, sizeof(DATAGRAM_RECEIVE_REQUEST)); + if (ReceiveRequest) + { + /* Initialize a receive request */ + + /* Extract the remote address filter from the request (if any) */ + if ((ConnInfo->RemoteAddressLength != 0) && + (ConnInfo->RemoteAddress)) + { + Status = AddrGetAddress(ConnInfo->RemoteAddress, + &ReceiveRequest->RemoteAddress, + &ReceiveRequest->RemotePort); + if (!NT_SUCCESS(Status)) + { + TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + exFreePool(ReceiveRequest); + return Status; + } + } + else + { + ReceiveRequest->RemotePort = 0; + } + ReceiveRequest->ReturnInfo = ReturnInfo; + ReceiveRequest->Buffer = BufferData; + ReceiveRequest->BufferSize = ReceiveLength; + ReceiveRequest->UserComplete = Complete; + ReceiveRequest->UserContext = Context; + ReceiveRequest->Complete = + (PDATAGRAM_COMPLETION_ROUTINE)RawIpReceiveComplete; + ReceiveRequest->Context = ReceiveRequest; + + /* Queue receive request */ + InsertTailList(&AddrFile->ReceiveQueue, &ReceiveRequest->ListEntry); + AF_SET_PENDING(AddrFile, AFF_RECEIVE); + + TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + + TI_DbgPrint(MAX_TRACE, ("Leaving (pending).\n")); + + return STATUS_PENDING; + } + else + { + Status = STATUS_INSUFFICIENT_RESOURCES; + } + } + else + { + Status = STATUS_INVALID_ADDRESS; + } + + TcpipReleaseSpinLock(&AddrFile->Lock, OldIrql); + + TI_DbgPrint(MAX_TRACE, ("Leaving with errors (0x%X).\n", Status)); + + return Status; +} - switch (IPPacket->Type) { - /* IPv4 packet */ - case IP_ADDRESS_V4: - DstAddress = &IPPacket->DstAddr; - break; - /* IPv6 packet */ - case IP_ADDRESS_V6: - TI_DbgPrint(MIN_TRACE, ("Discarded IPv6 raw IP datagram (%i bytes).\n", - IPPacket->TotalSize)); +VOID RawIpReceive(PIP_INTERFACE Interface, PIP_PACKET IPPacket) +/* + * FUNCTION: Receives and queues a RawIp datagram + * ARGUMENTS: + * NTE = Pointer to net table entry which the packet was received on +* IPPacket = Pointer to an IP packet that was received +* NOTES: +* This is the low level interface for receiving RawIp datagrams. It strips +* the RawIp header from a packet and delivers the data to anyone that wants it +*/ +{ + AF_SEARCH SearchContext; + PIPv4_HEADER IPv4Header; + PADDRESS_FILE AddrFile; + PIP_ADDRESS DstAddress, SrcAddress; + UINT DataSize; - /* FIXME: IPv6 is not supported */ - return; + TI_DbgPrint(MAX_TRACE, ("Called.\n")); - default: - return; - } + switch (IPPacket->Type) { + /* IPv4 packet */ + case IP_ADDRESS_V4: + IPv4Header = IPPacket->Header; + DstAddress = &IPPacket->DstAddr; + SrcAddress = &IPPacket->SrcAddr; + DataSize = IPPacket->TotalSize; + break; - /* Locate a receive request on destination address file object - and deliver the packet if one is found. If there is no receive - request on the address file object, call the associated receive - handler. If no receive handler is registered, drop the packet */ + /* IPv6 packet */ + case IP_ADDRESS_V6: + TI_DbgPrint(MIN_TRACE, ("Discarded IPv6 datagram (%i bytes).\n", IPPacket->TotalSize)); -#if 0 /* Decide what to do here */ - AddrFile = AddrSearchFirst(DstAddress, - 0, - IPPROTO_ICMP, - &SearchContext); - if (AddrFile) { - do { - DGDeliverData(AddrFile, - DstAddress, - IPPacket, - IPPacket->TotalSize); - } while ((AddrFile = AddrSearchNext(&SearchContext)) != NULL); - } else { - /* There are no open address files that will take this datagram */ - /* FIXME: IPv4 only */ - TI_DbgPrint(MID_TRACE, ("Cannot deliver IPv4 ICMP datagram to address (0x%X).\n", - DN2H(DstAddress->Address.IPv4Address))); - } -#endif - TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); + /* FIXME: IPv6 is not supported */ + return; + + default: + return; + } + + /* Locate a receive request on destination address file object + and deliver the packet if one is found. If there is no receive + request on the address file object, call the associated receive + handler. If no receive handler is registered, drop the packet */ + + AddrFile = AddrSearchFirst(DstAddress, + 0, + IPv4Header->Protocol, + &SearchContext); + if (AddrFile) { + do { + DGDeliverData(AddrFile, + SrcAddress, + DstAddress, + 0, + 0, + IPPacket, + DataSize); + } while ((AddrFile = AddrSearchNext(&SearchContext)) != NULL); + } else { + /* There are no open address files that will take this datagram */ + /* FIXME: IPv4 only */ + TI_DbgPrint(MID_TRACE, ("Cannot deliver IPv4 raw datagram to address (0x%X).\n", + DN2H(DstAddress->Address.IPv4Address))); + + /* FIXME: Send ICMP reply */ + } + TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); } -NTSTATUS RawIPStartup( - VOID) +NTSTATUS RawIPStartup(VOID) /* - * FUNCTION: Initializes the Raw IP subsystem + * FUNCTION: Initializes the UDP subsystem * RETURNS: * Status of operation */ { - RawIPInitialized = TRUE; +#ifdef __NTDRIVER__ + RtlZeroMemory(&UDPStats, sizeof(UDP_STATISTICS)); +#endif - return STATUS_SUCCESS; + /* Register this protocol with IP layer */ + IPRegisterProtocol(IPPROTO_ICMP, RawIpReceive); + + return STATUS_SUCCESS; } -NTSTATUS RawIPShutdown( - VOID) +NTSTATUS RawIPShutdown(VOID) /* - * FUNCTION: Shuts down the Raw IP subsystem + * FUNCTION: Shuts down the UDP subsystem * RETURNS: * Status of operation */ { - if (!RawIPInitialized) - return STATUS_SUCCESS; + /* Deregister this protocol with IP layer */ + IPRegisterProtocol(IPPROTO_ICMP, NULL); - return STATUS_SUCCESS; + return STATUS_SUCCESS; } /* EOF */ _____ Modified: trunk/reactos/drivers/lib/ip/transport/udp/udp.c --- trunk/reactos/drivers/lib/ip/transport/udp/udp.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/lib/ip/transport/udp/udp.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -33,51 +33,19 @@ * Status of operation */ { - PIPv4_HEADER IPHeader; PUDP_HEADER UDPHeader; - ULONG BufferSize; TI_DbgPrint(MID_TRACE, ("Packet: %x NdisPacket %x\n", IPPacket, IPPacket->NdisPacket)); + + AddGenericHeaderIPv4 + ( RemoteAddress, RemotePort, + LocalAddress, LocalPort, + IPPacket, DataLength, IPPROTO_UDP, + sizeof(UDP_HEADER), (PVOID *)&UDPHeader ); - BufferSize = MaxLLHeaderSize + sizeof(IPv4_HEADER) + sizeof(UDP_HEADER); - - GetDataPtr( IPPacket->NdisPacket, - MaxLLHeaderSize, - (PCHAR *)&IPPacket->Header, - &IPPacket->ContigSize ); - - IPPacket->HeaderSize = 20; - - TI_DbgPrint(MAX_TRACE, ("Allocated %d bytes for headers at 0x%X.\n", - BufferSize, IPPacket->Header)); - TI_DbgPrint(MAX_TRACE, ("Packet total length %d\n", IPPacket->TotalSize)); - - /* Build IPv4 header */ - IPHeader = (PIPv4_HEADER)IPPacket->Header; - /* Version = 4, Length = 5 DWORDs */ - IPHeader->VerIHL = 0x45; - /* Normal Type-of-Service */ - IPHeader->Tos = 0; - /* Length of header and data */ - IPHeader->TotalLength = WH2N((USHORT)IPPacket->TotalSize); - /* Identification */ - IPHeader->Id = 0; - /* One fragment at offset 0 */ - IPHeader->FlagsFragOfs = 0; - /* Time-to-Live is 128 */ - IPHeader->Ttl = 128; - /* User Datagram Protocol */ - IPHeader->Protocol = IPPROTO_UDP; - /* Checksum is 0 (for later calculation of this) */ - IPHeader->Checksum = 0; - /* Source address */ - IPHeader->SrcAddr = LocalAddress->Address.IPv4Address; - /* Destination address. FIXME: IPv4 only */ - IPHeader->DstAddr = RemoteAddress->Address.IPv4Address; - /* Build UDP header */ - UDPHeader = (PUDP_HEADER)(((PCHAR)IPHeader) + sizeof(IPv4_HEADER)); + UDPHeader = (PUDP_HEADER)(IPPacket->Data - sizeof(UDP_HEADER)); /* Port values are already big-endian values */ UDPHeader->SourcePort = LocalPort; UDPHeader->DestPort = RemotePort; @@ -89,7 +57,7 @@ IPPacket->Data = ((PCHAR)UDPHeader) + sizeof(UDP_HEADER); TI_DbgPrint(MID_TRACE, ("Packet: %d ip %d udp %d payload\n", - (PCHAR)UDPHeader - (PCHAR)IPHeader, + (PCHAR)UDPHeader - (PCHAR)IPPacket->Header, (PCHAR)IPPacket->Data - (PCHAR)UDPHeader, DataLength)); _____ Modified: trunk/reactos/drivers/net/afd/afd/bind.c --- trunk/reactos/drivers/net/afd/afd/bind.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/net/afd/afd/bind.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -74,10 +74,6 @@ /* This will be the from address for subsequent recvfrom calls */ TdiBuildConnectionInfo( &FCB->AddressFrom, FCB->LocalAddress ); - /* Allocate our backup buffer */ - FCB->Recv.Window = ExAllocatePool( NonPagedPool, FCB->Recv.Size ); - FCB->PollState |= AFD_EVENT_SEND; - /* A datagram socket is always sendable */ AFD_DbgPrint(MID_TRACE,("Calling TdiReceiveDatagram\n")); _____ Modified: trunk/reactos/drivers/net/afd/afd/main.c --- trunk/reactos/drivers/net/afd/afd/main.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/net/afd/afd/main.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -132,6 +132,18 @@ } FileObject->FsContext = FCB; + + /* It seems that UDP sockets are writable from inception */ + if( FCB->Flags & SGID_CONNECTIONLESS ) { + AFD_DbgPrint(MID_TRACE,("Packet oriented socket\n")); + /* Allocate our backup buffer */ + FCB->Recv.Window = ExAllocatePool( NonPagedPool, FCB->Recv.Size ); + FCB->Send.Window = ExAllocatePool( NonPagedPool, FCB->Send.Size ); + /* A datagram socket is always sendable */ + FCB->PollState |= AFD_EVENT_SEND; + PollReeval( FCB->DeviceExt, FCB->FileObject ); + } + Irp->IoStatus.Status = STATUS_SUCCESS; IoCompleteRequest( Irp, IO_NETWORK_INCREMENT ); @@ -215,6 +227,8 @@ FCB->PollState |= AFD_EVENT_CLOSE; PollReeval( FCB->DeviceExt, FileObject ); + KillSelectsForFCB( FCB->DeviceExt, FileObject ); + if( FCB->EventSelect ) ObDereferenceObject( FCB->EventSelect ); FileObject->FsContext = NULL; _____ Modified: trunk/reactos/drivers/net/afd/afd/select.c --- trunk/reactos/drivers/net/afd/afd/select.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/net/afd/afd/select.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -43,13 +43,23 @@ VOID SignalSocket( PAFD_ACTIVE_POLL Poll, PAFD_POLL_INFO PollReq, NTSTATUS Status ) { + int i; PIRP Irp = Poll->Irp; AFD_DbgPrint(MID_TRACE,("Called (Status %x)\n", Status)); + KeCancelTimer( &Poll->Timer ); Poll->Irp->IoStatus.Status = Status; Poll->Irp->IoStatus.Information = FIELD_OFFSET(AFD_POLL_INFO, Handles) + sizeof(AFD_HANDLE) * PollReq->HandleCount; CopyBackStatus( PollReq->Handles, PollReq->HandleCount ); + for( i = 0; i < PollReq->HandleCount; i++ ) { + AFD_DbgPrint + (MAX_TRACE, + ("Handle(%x): Got %x,%x\n", + PollReq->Handles[i].Handle, + PollReq->Handles[i].Events, + PollReq->Handles[i].Status)); + } UnlockHandles( AFD_HANDLES(PollReq), PollReq->HandleCount ); AFD_DbgPrint(MID_TRACE,("Completing\n")); IoCompleteRequest( Irp, IO_NETWORK_INCREMENT ); @@ -83,6 +93,41 @@ AFD_DbgPrint(MID_TRACE,("Timeout\n")); } +VOID KillSelectsForFCB( PAFD_DEVICE_EXTENSION DeviceExt, + PFILE_OBJECT FileObject ) { + KIRQL OldIrql; + PLIST_ENTRY ListEntry; + PAFD_ACTIVE_POLL Poll; + PIRP Irp; + PAFD_POLL_INFO PollReq; + int i; + + AFD_DbgPrint(MID_TRACE,("Killing selects that refer to %x\n", FileObject)); + + KeAcquireSpinLock( &DeviceExt->Lock, &OldIrql ); + + ListEntry = DeviceExt->Polls.Flink; + while ( ListEntry != &DeviceExt->Polls ) { + Poll = CONTAINING_RECORD(ListEntry, AFD_ACTIVE_POLL, ListEntry); + ListEntry = ListEntry->Flink; + Irp = Poll->Irp; + PollReq = Irp->AssociatedIrp.SystemBuffer; + + for( i = 0; i < PollReq->HandleCount; i++ ) { + AFD_DbgPrint(MAX_TRACE,("Req: %x, This %x\n", + PollReq->Handles[i].Handle, FileObject)); + if( (PVOID)PollReq->Handles[i].Handle == FileObject ) { + ZeroEvents( PollReq->Handles, PollReq->HandleCount ); + SignalSocket( Poll, PollReq, STATUS_SUCCESS ); + } + } + } + + KeReleaseSpinLock( &DeviceExt->Lock, OldIrql ); + + AFD_DbgPrint(MID_TRACE,("Done\n")); +} + VOID KillExclusiveSelects( PAFD_DEVICE_EXTENSION DeviceExt ) { KIRQL OldIrql; PLIST_ENTRY ListEntry; _____ Modified: trunk/reactos/drivers/net/afd/afd/write.c --- trunk/reactos/drivers/net/afd/afd/write.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/net/afd/afd/write.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -165,6 +165,9 @@ /* It's ok if the FCB already died */ if( !SocketAcquireStateLock( FCB ) ) return STATUS_SUCCESS; + FCB->PollState |= AFD_EVENT_SEND; + PollReeval( FCB->DeviceExt, FCB->FileObject ); + FCB->SendIrp.InFlightRequest = NULL; /* Request is not in flight any longer */ @@ -361,6 +364,7 @@ if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp, FALSE ); FCB->EventsFired &= ~AFD_EVENT_SEND; + FCB->PollState &= ~AFD_EVENT_SEND; /* Check that the socket is bound */ if( FCB->State != SOCKET_STATE_BOUND ) _____ Modified: trunk/reactos/drivers/net/afd/include/afd.h --- trunk/reactos/drivers/net/afd/include/afd.h 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/net/afd/include/afd.h 2005-01-22 06:47:33 UTC (rev 13207) @@ -262,6 +262,8 @@ AfdEnumEvents( PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp ); VOID PollReeval( PAFD_DEVICE_EXTENSION DeviceObject, PFILE_OBJECT FileObject ); +VOID KillSelectsForFCB( PAFD_DEVICE_EXTENSION DeviceExt, + PFILE_OBJECT FileObject ); /* tdi.c */ _____ Modified: trunk/reactos/drivers/net/tcpip/include/rawip.h --- trunk/reactos/drivers/net/tcpip/include/rawip.h 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/net/tcpip/include/rawip.h 2005-01-22 06:47:33 UTC (rev 13207) @@ -7,6 +7,8 @@ #ifndef __RAWIP_H #define __RAWIP_H + + NTSTATUS RawIPSendDatagram( PADDRESS_FILE AddrFile, PTDI_CONNECTION_INFORMATION ConnInfo, @@ -24,6 +26,17 @@ NTSTATUS RawIPShutdown( VOID); +NTSTATUS AddGenericHeaderIPv4( + PIP_ADDRESS RemoteAddress, + USHORT RemotePort, + PIP_ADDRESS LocalAddress, + USHORT LocalPort, + PIP_PACKET IPPacket, + UINT DataLength, + UINT Protocol, + UINT ExtraLength, + PVOID *NextHeader ); + #endif /* __RAWIP_H */ /* EOF */ _____ Modified: trunk/reactos/drivers/net/tcpip/tcpip/dispatch.c --- trunk/reactos/drivers/net/tcpip/tcpip/dispatch.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/drivers/net/tcpip/tcpip/dispatch.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -924,12 +924,15 @@ ("About to call send routine %x\n", (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send))); - Status = (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)( - Request.Handle.AddressHandle, - DgramInfo->SendDatagramInformation, - DataBuffer, - BufferSize, - &Irp->IoStatus.Information); + if( (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send) ) + Status = (*((PADDRESS_FILE)Request.Handle.AddressHandle)->Send)( + Request.Handle.AddressHandle, + DgramInfo->SendDatagramInformation, + DataBuffer, + BufferSize, + &Irp->IoStatus.Information); + else + Status = STATUS_UNSUCCESSFUL; if (Status != STATUS_PENDING) { DispDataRequestComplete(Irp, Status, Irp->IoStatus.Information); _____ Modified: trunk/reactos/lib/msafd/misc/dllmain.c --- trunk/reactos/lib/msafd/misc/dllmain.c 2005-01-22 03:54:23 UTC (rev 13206) +++ trunk/reactos/lib/msafd/misc/dllmain.c 2005-01-22 06:47:33 UTC (rev 13207) @@ -16,8 +16,8 @@ #include <rosrtl/string.h> #ifdef DBG -//DWORD DebugTraceLevel = DEBUG_ULTRA; -DWORD DebugTraceLevel = 0; +DWORD DebugTraceLevel = DEBUG_ULTRA; +//DWORD DebugTraceLevel = 0; #endif /* DBG */ HANDLE GlobalHeap; @@ -123,8 +123,11 @@ Socket->SanData = NULL; /* Ask alex about this */ - if( Socket->SharedData.SocketType == SOCK_DGRAM ) + if( Socket->SharedData.SocketType == SOCK_DGRAM || + Socket->SharedData.SocketType == SOCK_RAW ) { + AFD_DbgPrint(MID_TRACE,("Connectionless socket\n")); Socket->SharedData.ServiceFlags1 |= XP1_CONNECTIONLESS; + } /* Packet Size */ SizeOfPacket = TransportName.Length + sizeof(AFD_CREATE_PACKET) + sizeof(WCHAR);
19 years, 9 months
1
0
0
0
[ion] 13206: Fix remaning ROS bugs. A minor hack has been added to ObCreateObject because it seems that gcc doesn't dword-align the stacks?!! Thanks to w3seek for some of the ex patches.
by ion@svn.reactos.com
Fix remaning ROS bugs. A minor hack has been added to ObCreateObject because it seems that gcc doesn't dword-align the stacks?!! Thanks to w3seek for some of the ex patches. Modified: trunk/reactos/baseaddress.cfg Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_domain.c Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c Modified: trunk/reactos/lib/kernel32/file/file.c Modified: trunk/reactos/ntoskrnl/ex/event.c Modified: trunk/reactos/ntoskrnl/ex/evtpair.c Modified: trunk/reactos/ntoskrnl/ex/mutant.c Modified: trunk/reactos/ntoskrnl/io/file.c Modified: trunk/reactos/ntoskrnl/ob/object.c Modified: trunk/reactos/services/eventlog/eventlog.c _____ Modified: trunk/reactos/baseaddress.cfg --- trunk/reactos/baseaddress.cfg 2005-01-22 02:38:07 UTC (rev 13205) +++ trunk/reactos/baseaddress.cfg 2005-01-22 03:54:23 UTC (rev 13206) @@ -88,9 +88,9 @@ TARGET_BASE_LIB_ADVAPI32 =0x77dc0000 TARGET_BASE_LIB_USER32 =0x77e60000 TARGET_BASE_LIB_GDI32 =0x77ed0000 -TARGET_BASE_LIB_DNSAPI =0x78000000 +TARGET_BASE_LIB_DNSAPI =0x77f00000 TARGET_BASE_LIB_MSVCRT =0x78000000 -TARGET_BASE_LIB_MSVCRT20 =0x78000000 +TARGET_BASE_LIB_MSVCRT20 =0x78500000 TARGET_BASE_LIB_EXPAT =0x79000000 TARGET_BASE_LIB_KERNEL32 =0x7C800000 TARGET_BASE_LIB_NTDLL =0x7C900000 _____ Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_domain.c --- trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_domain.c 2005-01-22 02:38:07 UTC (rev 13205) +++ trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_domain.c 2005-01-22 03:54:23 UTC (rev 13206) @@ -64,7 +64,7 @@ register struct domain *dp, **dpp; register struct protosw *pr; - printf("domaininit starting\n"); + //printf("domaininit starting\n"); /* * NB - local domain is always present. @@ -73,7 +73,7 @@ ADDDOMAIN(inet); for (dpp = (struct domain **)domain_set.ls_items; *dpp; dpp++) { - printf("(1) Domain %s counting\n", (**dpp).dom_name); + //printf("(1) Domain %s counting\n", (**dpp).dom_name); (**dpp).dom_next = domains; domains = *dpp; } @@ -84,11 +84,11 @@ #endif */ for (dp = domains; dp; dp = dp->dom_next) { - printf("(1) Domain %s initializing\n", dp->dom_name); + //printf("(1) Domain %s initializing\n", dp->dom_name); if (dp->dom_init) (*dp->dom_init)(); for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { - printf("Registering protocols for %s\n", dp->dom_name); + //printf("Registering protocols for %s\n", dp->dom_name); if (pr->pr_init) (*pr->pr_init)(); } @@ -103,7 +103,7 @@ timeout(pffasttimo, (void *)0, 1); timeout(pfslowtimo, (void *)0, 1); - printf("Domaininit done\n"); + //printf("Domaininit done\n"); } struct protosw * _____ Modified: trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c --- trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c 2005-01-22 02:38:07 UTC (rev 13205) +++ trunk/reactos/drivers/lib/oskittcp/oskittcp/uipc_mbuf.c 2005-01-22 03:54:23 UTC (rev 13206) @@ -79,11 +79,11 @@ #else #define NCL_INIT 1 #endif - printf("Here1\n"); + //printf("Here1\n"); s = splimp(); if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0) goto bad; - printf("Here2\n"); + //printf("Here2\n"); splx(s); return; bad: @@ -116,12 +116,12 @@ npg = ncl * CLSIZE; - printf("kmem_malloc(%d)\n", npg); + //printf("kmem_malloc(%d)\n", npg); p = (caddr_t)kmem_malloc(mb_map, ctob(npg), nowait ? M_NOWAIT : M_WAITOK); - printf("kmem_malloc done\n"); + //printf("kmem_malloc done\n"); /* * Either the map is now full, or this is nowait and there @@ -133,13 +133,13 @@ ncl = ncl * CLBYTES / MCLBYTES; for (i = 0; i < ncl; i++) { ((union mcluster *)p)->mcl_next = mclfree; - printf( "Freeing %x onto the free list\n", p); + //printf( "Freeing %x onto the free list\n", p); mclfree = (union mcluster *)p; p += MCLBYTES; mbstat.m_clfree++; } mbstat.m_clusters += ncl; - printf( "done with m_clalloc\n"); + //printf( "done with m_clalloc\n"); return (1); } #endif /* !OSKIT */ _____ Modified: trunk/reactos/lib/kernel32/file/file.c --- trunk/reactos/lib/kernel32/file/file.c 2005-01-22 02:38:07 UTC (rev 13205) +++ trunk/reactos/lib/kernel32/file/file.c 2005-01-22 03:54:23 UTC (rev 13206) @@ -694,7 +694,7 @@ NTSTATUS Status; WIN32_FILE_ATTRIBUTE_DATA* FileAttributeData; - DPRINT ("GetFileAttributesExW(%S) called\n", lpFileName); + DPRINT("GetFileAttributesExW(%S) called\n", lpFileName); if (fInfoLevelId != GetFileExInfoStandard || lpFileInformation == NULL) @@ -709,7 +709,7 @@ NULL, NULL)) { - DPRINT ("Invalid path\n"); + DPRINT1 ("Invalid path\n"); SetLastError (ERROR_BAD_PATHNAME); return FALSE; } @@ -731,7 +731,7 @@ RtlFreeUnicodeString (&FileName); if (!NT_SUCCESS (Status)) { - DPRINT ("NtOpenFile() failed (Status %lx)\n", Status); + DPRINT1 ("NtOpenFile() failed %x (Status %lx)\n", &ObjectAttributes, Status); SetLastErrorByStatus (Status); return FALSE; } @@ -746,7 +746,7 @@ if (!NT_SUCCESS (Status)) { - DPRINT ("NtQueryInformationFile() failed (Status %lx)\n", Status); + DPRINT1 ("NtQueryInformationFile() failed (Status %lx)\n", Status); SetLastErrorByStatus (Status); return FALSE; } _____ Modified: trunk/reactos/ntoskrnl/ex/event.c --- trunk/reactos/ntoskrnl/ex/event.c 2005-01-22 02:38:07 UTC (rev 13205) +++ trunk/reactos/ntoskrnl/ex/event.c 2005-01-22 03:54:23 UTC (rev 13206) @@ -41,6 +41,10 @@ STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE | EVENT_QUERY_STATE, EVENT_ALL_ACCESS}; +static const INFORMATION_CLASS_INFO ExEventInfoClass[] = +{ + ICI_SQ_SAME( sizeof(EVENT_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ), /* EventBasicInformation */ +}; /* FUNCTIONS *****************************************************************/ @@ -92,6 +96,9 @@ } +/* + * @implemented + */ NTSTATUS STDCALL NtClearEvent(IN HANDLE EventHandle) { @@ -101,16 +108,16 @@ Status = ObReferenceObjectByHandle(EventHandle, EVENT_MODIFY_STATE, ExEventObjectType, - UserMode, + ExGetPreviousMode(), (PVOID*)&Event, NULL); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - KeClearEvent(Event); - ObDereferenceObject(Event); - return(STATUS_SUCCESS); + if(NT_SUCCESS(Status)) + { + KeClearEvent(Event); + ObDereferenceObject(Event); + } + + return Status; } @@ -188,68 +195,119 @@ } +/* + * @implemented + */ NTSTATUS STDCALL NtOpenEvent(OUT PHANDLE EventHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes) { - NTSTATUS Status; HANDLE hEvent; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; + + DPRINT("NtOpenEvent(0x%x, 0x%x, 0x%x)\n", EventHandle, DesiredAccess, ObjectAttributes); - DPRINT("ObjectName '%wZ'\n", ObjectAttributes->ObjectName); + PreviousMode = ExGetPreviousMode(); + + if(PreviousMode == UserMode) + { + _SEH_TRY + { + ProbeForWrite(EventHandle, + sizeof(HANDLE), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + + if(!NT_SUCCESS(Status)) + { + return Status; + } + } Status = ObOpenObjectByName(ObjectAttributes, ExEventObjectType, NULL, - UserMode, + PreviousMode, DesiredAccess, NULL, &hEvent); - if (!NT_SUCCESS(Status)) - { - return(Status); - } - - Status = MmCopyToCaller(EventHandle, &hEvent, sizeof(HANDLE)); - if (!NT_SUCCESS(Status)) + if(NT_SUCCESS(Status)) + { + _SEH_TRY { - ZwClose(EventHandle); - return(Status); + *EventHandle = hEvent; } - - return(Status); + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + + return Status; } +/* + * @implemented + */ NTSTATUS STDCALL NtPulseEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL) { PKEVENT Event; - NTSTATUS Status; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; - DPRINT("NtPulseEvent(EventHandle %x PreviousState %x)\n", + DPRINT("NtPulseEvent(EventHandle 0%x PreviousState 0%x)\n", EventHandle, PreviousState); + PreviousMode = ExGetPreviousMode(); + + if(PreviousState != NULL && PreviousMode == UserMode) + { + _SEH_TRY + { + ProbeForWrite(PreviousState, + sizeof(LONG), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + Status = ObReferenceObjectByHandle(EventHandle, EVENT_MODIFY_STATE, ExEventObjectType, - UserMode, + PreviousMode, (PVOID*)&Event, NULL); - if (!NT_SUCCESS(Status)) - { - return(Status); - } + if(NT_SUCCESS(Status)) + { + KePulseEvent(Event, EVENT_INCREMENT, FALSE); + ObDereferenceObject(Event); + + /* FIXME - Return the previous state! */ + } - KePulseEvent(Event, EVENT_INCREMENT, FALSE); - - ObDereferenceObject(Event); - return(STATUS_SUCCESS); + return Status; } +/* + * @implemented + */ NTSTATUS STDCALL NtQueryEvent(IN HANDLE EventHandle, IN EVENT_INFORMATION_CLASS EventInformationClass, @@ -257,78 +315,129 @@ IN ULONG EventInformationLength, OUT PULONG ReturnLength OPTIONAL) { - EVENT_BASIC_INFORMATION Info; PKEVENT Event; - NTSTATUS Status; - ULONG RetLen; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; - if (EventInformationClass > EventBasicInformation) - return STATUS_INVALID_INFO_CLASS; + PreviousMode = ExGetPreviousMode(); + + DefaultQueryInfoBufferCheck(EventInformationClass, + ExEventInfoClass, + EventInformation, + EventInformationLength, + ReturnLength, + PreviousMode, + &Status); + if(!NT_SUCCESS(Status)) + { + DPRINT1("NtQueryEvent() failed, Status: 0x%x\n", Status); + return Status; + } - if (EventInformationLength < sizeof(EVENT_BASIC_INFORMATION)) - return STATUS_INFO_LENGTH_MISMATCH; - Status = ObReferenceObjectByHandle(EventHandle, EVENT_QUERY_STATE, ExEventObjectType, - UserMode, + PreviousMode, (PVOID*)&Event, NULL); - if (!NT_SUCCESS(Status)) - return Status; - - if (Event->Header.Type == InternalNotificationEvent) - Info.EventType = NotificationEvent; - else - Info.EventType = SynchronizationEvent; - Info.EventState = KeReadStateEvent(Event); - - Status = MmCopyToCaller(EventInformation, &Event, - sizeof(EVENT_BASIC_INFORMATION)); - if (!NT_SUCCESS(Status)) + if(NT_SUCCESS(Status)) + { + switch(EventInformationClass) { - ObDereferenceObject(Event); - return(Status); - } + case EventBasicInformation: + { + PEVENT_BASIC_INFORMATION BasicInfo = (PEVENT_BASIC_INFORMATION)EventInformation; + + _SEH_TRY + { + if (Event->Header.Type == InternalNotificationEvent) + BasicInfo->EventType = NotificationEvent; + else + BasicInfo->EventType = SynchronizationEvent; + BasicInfo->EventState = KeReadStateEvent(Event); - if (ReturnLength != NULL) - { - RetLen = sizeof(EVENT_BASIC_INFORMATION); - Status = MmCopyToCaller(ReturnLength, &RetLen, sizeof(ULONG)); - if (!NT_SUCCESS(Status)) + if(ReturnLength != NULL) + { + *ReturnLength = sizeof(EVENT_BASIC_INFORMATION); + } + } + _SEH_HANDLE { - ObDereferenceObject(Event); - return(Status); + Status = _SEH_GetExceptionCode(); } + _SEH_END; + break; + } + + default: + Status = STATUS_NOT_IMPLEMENTED; + break; } - ObDereferenceObject(Event); - return(STATUS_SUCCESS); + ObDereferenceObject(Event); + } + + return Status; } +/* + * @implemented + */ NTSTATUS STDCALL NtResetEvent(IN HANDLE EventHandle, OUT PLONG PreviousState OPTIONAL) { PKEVENT Event; - NTSTATUS Status; - - DPRINT("NtResetEvent(EventHandle %x)\n", EventHandle); - + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; + + DPRINT("NtResetEvent(EventHandle 0%x PreviousState 0%x)\n", + EventHandle, PreviousState); + + PreviousMode = ExGetPreviousMode(); + + if(PreviousState != NULL && PreviousMode == UserMode) + { + _SEH_TRY + { + ProbeForWrite(PreviousState, + sizeof(LONG), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + Status = ObReferenceObjectByHandle(EventHandle, EVENT_MODIFY_STATE, ExEventObjectType, - UserMode, + PreviousMode, (PVOID*)&Event, NULL); - if (!NT_SUCCESS(Status)) + if(NT_SUCCESS(Status)) + { + LONG Prev = KeResetEvent(Event); + ObDereferenceObject(Event); + + if(PreviousState != NULL) { - return(Status); + _SEH_TRY + { + *PreviousState = Prev; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; } - KeResetEvent(Event); - ObDereferenceObject(Event); - return(STATUS_SUCCESS); + } + + return Status; } @@ -340,25 +449,58 @@ OUT PLONG PreviousState OPTIONAL) { PKEVENT Event; - NTSTATUS Status; - - DPRINT("NtSetEvent(EventHandle %x)\n", EventHandle); - + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; + + DPRINT("NtSetEvent(EventHandle 0%x PreviousState 0%x)\n", + EventHandle, PreviousState); + + PreviousMode = ExGetPreviousMode(); + + if(PreviousState != NULL && PreviousMode == UserMode) + { + _SEH_TRY + { + ProbeForWrite(PreviousState, + sizeof(LONG), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + Status = ObReferenceObjectByHandle(EventHandle, EVENT_MODIFY_STATE, ExEventObjectType, - UserMode, + PreviousMode, (PVOID*)&Event, NULL); - if (!NT_SUCCESS(Status)) + if(NT_SUCCESS(Status)) + { + LONG Prev = KeSetEvent(Event, EVENT_INCREMENT, FALSE); + ObDereferenceObject(Event); + + if(PreviousState != NULL) { - return(Status); + _SEH_TRY + { + *PreviousState = Prev; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; } - KeSetEvent(Event,EVENT_INCREMENT,FALSE); - ObDereferenceObject(Event); - return(STATUS_SUCCESS); + } + + return Status; } + /* * @unimplemented */ _____ Modified: trunk/reactos/ntoskrnl/ex/evtpair.c --- trunk/reactos/ntoskrnl/ex/evtpair.c 2005-01-22 02:38:07 UTC (rev 13205) +++ trunk/reactos/ntoskrnl/ex/evtpair.c 2005-01-22 03:54:23 UTC (rev 13206) @@ -95,39 +95,66 @@ IN POBJECT_ATTRIBUTES ObjectAttributes) { PKEVENT_PAIR EventPair; - NTSTATUS Status; + HANDLE hEventPair; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; + + PreviousMode = ExGetPreviousMode(); - DPRINT("NtCreateEventPair()\n"); + if(PreviousMode == UserMode) + { + _SEH_TRY + { + ProbeForWrite(EventPairHandle, + sizeof(HANDLE), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + Status = ObCreateObject(ExGetPreviousMode(), ExEventPairObjectType, ObjectAttributes, - ExGetPreviousMode(), + PreviousMode, NULL, sizeof(KEVENT_PAIR), 0, 0, (PVOID*)&EventPair); - if (!NT_SUCCESS(Status)) + if(NT_SUCCESS(Status)) + { + KeInitializeEvent(&EventPair->LowEvent, + SynchronizationEvent, + FALSE); + KeInitializeEvent(&EventPair->HighEvent, + SynchronizationEvent, + FALSE); + + Status = ObInsertObject ((PVOID)EventPair, + NULL, + DesiredAccess, + 0, + NULL, + &hEventPair); + ObDereferenceObject(EventPair); + + if(NT_SUCCESS(Status)) { - return(Status); + _SEH_TRY + { + *EventPairHandle = hEventPair; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; } - - KeInitializeEvent(&EventPair->LowEvent, - SynchronizationEvent, - FALSE); - KeInitializeEvent(&EventPair->HighEvent, - SynchronizationEvent, - FALSE); - - Status = ObInsertObject ((PVOID)EventPair, - NULL, - DesiredAccess, - 0, - NULL, - EventPairHandle); - - ObDereferenceObject(EventPair); - + } return Status; } @@ -137,18 +164,47 @@ IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes) { - NTSTATUS Status; + HANDLE hEventPair; + KPROCESSOR_MODE PreviousMode; + NTSTATUS Status = STATUS_SUCCESS; - DPRINT("NtOpenEventPair()\n"); + PreviousMode = ExGetPreviousMode(); + if(PreviousMode == UserMode) + { + _SEH_TRY + { + ProbeForWrite(EventPairHandle, + sizeof(HANDLE), + sizeof(ULONG)); + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + Status = ObOpenObjectByName(ObjectAttributes, ExEventPairObjectType, NULL, - UserMode, + PreviousMode, DesiredAccess, NULL, - EventPairHandle); - + &hEventPair); + if(NT_SUCCESS(Status)) + { + _SEH_TRY + { + *EventPairHandle = hEventPair; + } + _SEH_HANDLE + { + Status = _SEH_GetExceptionCode(); + } + _SEH_END; + } + return Status; } @@ -157,26 +213,30 @@ NtSetHighEventPair(IN HANDLE EventPairHandle) { PKEVENT_PAIR EventPair; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; DPRINT("NtSetHighEventPair(EventPairHandle %x)\n", EventPairHandle); + PreviousMode = ExGetPreviousMode(); + Status = ObReferenceObjectByHandle(EventPairHandle, - EVENT_PAIR_ALL_ACCESS, + SYNCHRONIZE, ExEventPairObjectType, - UserMode, + PreviousMode, (PVOID*)&EventPair, NULL); - if (!NT_SUCCESS(Status)) - return(Status); + if(NT_SUCCESS(Status)) + { + KeSetEvent(&EventPair->HighEvent, + EVENT_INCREMENT, + FALSE); - KeSetEvent(&EventPair->HighEvent, - EVENT_INCREMENT, - FALSE); - - ObDereferenceObject(EventPair); - return(STATUS_SUCCESS); + ObDereferenceObject(EventPair); + } + + return Status; } @@ -184,32 +244,36 @@ NtSetHighWaitLowEventPair(IN HANDLE EventPairHandle) { PKEVENT_PAIR EventPair; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; DPRINT("NtSetHighWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle); + PreviousMode = ExGetPreviousMode(); + Status = ObReferenceObjectByHandle(EventPairHandle, - EVENT_PAIR_ALL_ACCESS, + SYNCHRONIZE, ExEventPairObjectType, - UserMode, + PreviousMode, (PVOID*)&EventPair, NULL); - if (!NT_SUCCESS(Status)) - return(Status); + if(NT_SUCCESS(Status)) + { + KeSetEvent(&EventPair->HighEvent, + EVENT_INCREMENT, + TRUE); - KeSetEvent(&EventPair->HighEvent, - EVENT_INCREMENT, - TRUE); + KeWaitForSingleObject(&EventPair->LowEvent, + WrEventPair, + PreviousMode, + FALSE, + NULL); - KeWaitForSingleObject(&EventPair->LowEvent, - WrEventPair, - UserMode, - FALSE, - NULL); - - ObDereferenceObject(EventPair); - return(STATUS_SUCCESS); + ObDereferenceObject(EventPair); + } + + return Status; } @@ -217,26 +281,30 @@ NtSetLowEventPair(IN HANDLE EventPairHandle) { PKEVENT_PAIR EventPair; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; DPRINT("NtSetLowEventPair(EventPairHandle %x)\n", EventPairHandle); + PreviousMode = ExGetPreviousMode(); + Status = ObReferenceObjectByHandle(EventPairHandle, - EVENT_PAIR_ALL_ACCESS, + SYNCHRONIZE, ExEventPairObjectType, - UserMode, + PreviousMode, (PVOID*)&EventPair, NULL); - if (!NT_SUCCESS(Status)) - return(Status); + if(NT_SUCCESS(Status)) + { + KeSetEvent(&EventPair->LowEvent, + EVENT_INCREMENT, + FALSE); - KeSetEvent(&EventPair->LowEvent, - EVENT_INCREMENT, - FALSE); - - ObDereferenceObject(EventPair); - return(STATUS_SUCCESS); + ObDereferenceObject(EventPair); + } + + return Status; } @@ -244,32 +312,36 @@ NtSetLowWaitHighEventPair(IN HANDLE EventPairHandle) { PKEVENT_PAIR EventPair; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; DPRINT("NtSetLowWaitHighEventPair(EventPairHandle %x)\n", EventPairHandle); + PreviousMode = ExGetPreviousMode(); + Status = ObReferenceObjectByHandle(EventPairHandle, - EVENT_PAIR_ALL_ACCESS, + SYNCHRONIZE, ExEventPairObjectType, - UserMode, + PreviousMode, (PVOID*)&EventPair, NULL); - if (!NT_SUCCESS(Status)) - return(Status); + if(NT_SUCCESS(Status)) + { + KeSetEvent(&EventPair->LowEvent, + EVENT_INCREMENT, + TRUE); - KeSetEvent(&EventPair->LowEvent, - EVENT_INCREMENT, - TRUE); + KeWaitForSingleObject(&EventPair->HighEvent, + WrEventPair, + PreviousMode, + FALSE, + NULL); - KeWaitForSingleObject(&EventPair->HighEvent, - WrEventPair, - UserMode, - FALSE, - NULL); - - ObDereferenceObject(EventPair); - return(STATUS_SUCCESS); + ObDereferenceObject(EventPair); + } + + return Status; } @@ -277,28 +349,32 @@ NtWaitLowEventPair(IN HANDLE EventPairHandle) { PKEVENT_PAIR EventPair; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; DPRINT("NtWaitLowEventPair(EventPairHandle %x)\n", EventPairHandle); + PreviousMode = ExGetPreviousMode(); + Status = ObReferenceObjectByHandle(EventPairHandle, - EVENT_PAIR_ALL_ACCESS, + SYNCHRONIZE, ExEventPairObjectType, - UserMode, + PreviousMode, (PVOID*)&EventPair, NULL); - if (!NT_SUCCESS(Status)) - return(Status); + if(NT_SUCCESS(Status)) + { + KeWaitForSingleObject(&EventPair->LowEvent, + WrEventPair, + PreviousMode, + FALSE, + NULL); - KeWaitForSingleObject(&EventPair->LowEvent, - WrEventPair, - UserMode, - FALSE, - NULL); - - ObDereferenceObject(EventPair); - return(STATUS_SUCCESS); + ObDereferenceObject(EventPair); + } + + return Status; } @@ -306,28 +382,32 @@ NtWaitHighEventPair(IN HANDLE EventPairHandle) { PKEVENT_PAIR EventPair; + KPROCESSOR_MODE PreviousMode; NTSTATUS Status; DPRINT("NtWaitHighEventPair(EventPairHandle %x)\n", EventPairHandle); + PreviousMode = ExGetPreviousMode(); + Status = ObReferenceObjectByHandle(EventPairHandle, - EVENT_PAIR_ALL_ACCESS, + SYNCHRONIZE, ExEventPairObjectType, - UserMode, + PreviousMode, (PVOID*)&EventPair, NULL); - if (!NT_SUCCESS(Status)) - return(Status); + if(NT_SUCCESS(Status)) + { + KeWaitForSingleObject(&EventPair->HighEvent, + WrEventPair, + PreviousMode, + FALSE, + NULL); - KeWaitForSingleObject(&EventPair->HighEvent, - WrEventPair, - UserMode, - FALSE, - NULL); + ObDereferenceObject(EventPair); [truncated at 1000 lines; 494 more skipped]
19 years, 9 months
1
0
0
0
[sedwards] 13205: more syncing of setupapi
by sedwards@svn.reactos.com
more syncing of setupapi Modified: trunk/reactos/lib/setupapi/diskspace.c Modified: trunk/reactos/lib/setupapi/install.c Modified: trunk/reactos/lib/setupapi/parser.c Modified: trunk/reactos/lib/setupapi/setupcab.c Modified: trunk/reactos/lib/setupapi/setupx16.h Modified: trunk/reactos/lib/setupapi/setupx_main.c Modified: trunk/reactos/lib/setupapi/stubs.c Modified: trunk/reactos/lib/setupapi/virtcopy.c _____ Modified: trunk/reactos/lib/setupapi/diskspace.c --- trunk/reactos/lib/setupapi/diskspace.c 2005-01-22 02:06:56 UTC (rev 13204) +++ trunk/reactos/lib/setupapi/diskspace.c 2005-01-22 02:38:07 UTC (rev 13205) @@ -18,9 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" -#include "wine/port.h" - #include <stdarg.h> #include "windef.h" @@ -120,10 +117,10 @@ PVOID Reserved1, UINT Reserved2) { WCHAR driveW[20]; - int i; + unsigned int i; LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace; BOOL rc = FALSE; - WCHAR bkslsh[]= {'\\',0}; + static const WCHAR bkslsh[]= {'\\',0}; MultiByteToWideChar(CP_ACP,0,DriveSpec,-1,driveW,20); _____ Modified: trunk/reactos/lib/setupapi/install.c --- trunk/reactos/lib/setupapi/install.c 2005-01-22 02:06:56 UTC (rev 13204) +++ trunk/reactos/lib/setupapi/install.c 2005-01-22 02:38:07 UTC (rev 13205) @@ -342,7 +342,7 @@ { TRACE( "setting value %s to %s\n", debugstr_w(value), debugstr_w(str) ); if (str) RegSetValueExW( hkey, value, 0, type, (BYTE *)str, size * sizeof(WCHAR) ); - else RegSetValueExW( hkey, value, 0, type, (BYTE *)&empty, sizeof(WCHAR) ); + else RegSetValueExW( hkey, value, 0, type, (const BYTE *)&empty, sizeof(WCHAR) ); } HeapFree( GetProcessHeap(), 0, str ); return TRUE; _____ Modified: trunk/reactos/lib/setupapi/parser.c --- trunk/reactos/lib/setupapi/parser.c 2005-01-22 02:06:56 UTC (rev 13204) +++ trunk/reactos/lib/setupapi/parser.c 2005-01-22 02:38:07 UTC (rev 13205) @@ -162,15 +162,14 @@ if (new_count < 32) new_count = 32; if (array) - new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem ); + new_array = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, array, new_count * elem ); else - new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * elem ); + new_array = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, new_count * elem ); if (new_array) *count = new_count; else - if (array) - HeapFree( GetProcessHeap(), 0, array ); + HeapFree( GetProcessHeap(), 0, array ); return new_array; } @@ -178,7 +177,7 @@ /* find a section by name */ static int find_section( struct inf_file *file, const WCHAR *name ) { - int i; + unsigned int i; for (i = 0; i < file->nb_sections; i++) if (!strcmpiW( name, file->sections[i]->name )) return i; @@ -313,7 +312,8 @@ struct section *strings_section; struct line *line; struct field *field; - int i, dirid; + unsigned int i; + int dirid; WCHAR *dirid_str, *end; const WCHAR *ret = NULL; @@ -1170,9 +1170,7 @@ WCHAR Buffer[MAX_PATH]; GetWindowsDirectoryW( Buffer, MAX_PATH ); - - wcscat( Buffer, Layout ); - + strcatW( Buffer, Layout ); return SetupOpenInfFileW( Buffer, NULL, INF_STYLE_WIN4, NULL); } @@ -1184,7 +1182,7 @@ void WINAPI SetupCloseInfFile( HINF hinf ) { struct inf_file *file = hinf; - int i; + unsigned int i; for (i = 0; i < file->nb_sections; i++) HeapFree( GetProcessHeap(), 0, file->sections[i] ); HeapFree( GetProcessHeap(), 0, file->src_root ); _____ Modified: trunk/reactos/lib/setupapi/setupcab.c --- trunk/reactos/lib/setupapi/setupcab.c 2005-01-22 02:06:56 UTC (rev 13204) +++ trunk/reactos/lib/setupapi/setupcab.c 2005-01-22 02:38:07 UTC (rev 13205) @@ -19,7 +19,7 @@ * * * Many useful traces are commented in code, uncomment them if you have - * trouble and run with --debugmsg +setupapi + * trouble and run with WINEDEBUG=+setupapi * */ @@ -39,8 +39,8 @@ #include "fdi.h" #include "wine/unicode.h" -#include <fcntl.h> -#include <share.h> +#include "fcntl.h" +#include "share.h" #include "wine/debug.h" @@ -312,7 +312,7 @@ if (err == FILEOP_DOIT) { TRACE(" Callback specified filename: %s\n", debugstr_a(&(fici.FullTargetName[0]))); if (!fici.FullTargetName[0]) { - WARN(" Empty return string causing abort."); + WARN(" Empty return string causing abort.\n"); SetLastError(ERROR_PATH_NOT_FOUND); return -1; } @@ -597,11 +597,11 @@ BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context) { - CHAR CabinetFile_A[MAX_PATH]; - unsigned int len; + CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH]; + UINT len; SC_HSC_W my_hsc; ERF erf; - CHAR pszCabinet[MAX_PATH], pszCabPath[MAX_PATH], *p; + WCHAR pszCabPathW[MAX_PATH], *p; DWORD fpnsize; BOOL ret; @@ -612,36 +612,33 @@ return FALSE; if (!CabinetFile) return FALSE; - if (!WideCharToMultiByte(CP_ACP, 0, CabinetFile, -1, CabinetFile_A, MAX_PATH, 0, 0)) - return FALSE; memset(&my_hsc, 0, sizeof(SC_HSC_W)); - pszCabinet[0] = '\0'; - pszCabPath[0] = '\0'; - fpnsize = GetFullPathNameA(CabinetFile_A, MAX_PATH, &(pszCabPath[0]), &p); + fpnsize = GetFullPathNameW(CabinetFile, MAX_PATH, pszCabPathW, &p); if (fpnsize > MAX_PATH) { SetLastError(ERROR_BAD_PATHNAME); return FALSE; } if (p) { - strcpy(pszCabinet, p); - *p = '\0'; + strcpyW(my_hsc.most_recent_cabinet_name, p); + *p = 0; + len = WideCharToMultiByte(CP_ACP, 0, pszCabPathW, -1, pszCabPath, + MAX_PATH, 0, 0); + if (!len) return FALSE; } else { - strcpy(pszCabinet, CabinetFile_A); + strcpyW(my_hsc.most_recent_cabinet_name, CabinetFile); pszCabPath[0] = '\0'; } - TRACE("path: %s, cabfile: %s\n", debugstr_a(pszCabPath), debugstr_a(pszCabinet)); + len = WideCharToMultiByte(CP_ACP, 0, my_hsc.most_recent_cabinet_name, -1, + pszCabinet, MAX_PATH, 0, 0); + if (!len) return FALSE; - /* remember the cabinet name */ - len = 1 + MultiByteToWideChar(CP_ACP, 0, pszCabinet, -1, - &(my_hsc.most_recent_cabinet_name[0]), MAX_PATH); - if (len > MAX_PATH) - return FALSE; - else if (len <= 1) - my_hsc.most_recent_cabinet_name[0] = '\0'; + TRACE("path: %s, cabfile: %s\n", + debugstr_a(pszCabPath), debugstr_a(pszCabinet)); + my_hsc.magic = SC_HSC_W_MAGIC; my_hsc.msghandler = MsgHandler; my_hsc.context = Context; _____ Modified: trunk/reactos/lib/setupapi/setupx16.h --- trunk/reactos/lib/setupapi/setupx16.h 2005-01-22 02:06:56 UTC (rev 13204) +++ trunk/reactos/lib/setupapi/setupx16.h 2005-01-22 02:38:07 UTC (rev 13205) @@ -21,6 +21,7 @@ #include "wine/windef16.h" +typedef UINT16 DI_FUNCTION16; typedef UINT16 HINF16; typedef UINT16 LOGDISKID16; typedef UINT16 VHSTR; _____ Modified: trunk/reactos/lib/setupapi/setupx_main.c --- trunk/reactos/lib/setupapi/setupx_main.c 2005-01-22 02:06:56 UTC (rev 13204) +++ trunk/reactos/lib/setupapi/setupx_main.c 2005-01-22 02:38:07 UTC (rev 13205) @@ -476,9 +476,9 @@ else { pCurrLDD = pCurr->pldd; - if (pCurrLDD->pszPath) HeapFree(heap, 0, pCurrLDD->pszPath); - if (pCurrLDD->pszVolLabel) HeapFree(heap, 0, pCurrLDD->pszVolLabel); - if (pCurrLDD->pszDiskName) HeapFree(heap, 0, pCurrLDD->pszDiskName); + HeapFree(heap, 0, pCurrLDD->pszPath); + HeapFree(heap, 0, pCurrLDD->pszVolLabel); + HeapFree(heap, 0, pCurrLDD->pszDiskName); } memcpy(pCurrLDD, pldd, sizeof(LOGDISKDESC_S)); _____ Modified: trunk/reactos/lib/setupapi/stubs.c --- trunk/reactos/lib/setupapi/stubs.c 2005-01-22 02:06:56 UTC (rev 13204) +++ trunk/reactos/lib/setupapi/stubs.c 2005-01-22 02:38:07 UTC (rev 13205) @@ -113,6 +113,19 @@ } /*********************************************************************** + * CM_Get_Device_ID_ListA (SETUPAPI.@) + */ + +DWORD WINAPI CM_Get_Device_ID_ListA( + PCSTR pszFilter, PCHAR Buffer, ULONG BufferLen, ULONG ulFlags ) +{ + FIXME("%p %p %ld %ld\n", pszFilter, Buffer, BufferLen, ulFlags ); + memset(Buffer,0,2); + return CR_SUCCESS; +} + + +/********************************************************************** * * SetupCopyOEMInfA (SETUPAPI.@) */ BOOL WINAPI SetupCopyOEMInfA(PCSTR sourceinffile, PCSTR sourcemedialoc, _____ Modified: trunk/reactos/lib/setupapi/virtcopy.c --- trunk/reactos/lib/setupapi/virtcopy.c 2005-01-22 02:06:56 UTC (rev 13204) +++ trunk/reactos/lib/setupapi/virtcopy.c 2005-01-22 02:38:07 UTC (rev 13205) @@ -658,7 +658,7 @@ registered = TRUE; ZeroMemory (&wndClass, sizeof(WNDCLASSA)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; - wndClass.lpfnWndProc = (WNDPROC)VCP_UI_FileCopyWndProc; + wndClass.lpfnWndProc = VCP_UI_FileCopyWndProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = 0; wndClass.hCursor = LoadCursorA (0, (LPSTR)IDC_ARROW);
19 years, 9 months
1
0
0
0
← Newer
1
...
14
15
16
17
18
19
20
...
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