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
[hbirr] 13125: - Fixed the disabling of interrupts on the stack before sysexit.
by hbirr@svn.reactos.com
- Fixed the disabling of interrupts on the stack before sysexit. Modified: trunk/reactos/ntoskrnl/ke/i386/syscall.S _____ Modified: trunk/reactos/ntoskrnl/ke/i386/syscall.S --- trunk/reactos/ntoskrnl/ke/i386/syscall.S 2005-01-18 17:00:47 UTC (rev 13124) +++ trunk/reactos/ntoskrnl/ke/i386/syscall.S 2005-01-18 18:12:41 UTC (rev 13125) @@ -10,13 +10,13 @@ * and re-wrote most of handler code. - Alex Ionescu */ +#include <roscfg.h> #include <ddk/status.h> #include <internal/i386/segment.h> #include <internal/ps.h> #include <internal/i386/ke.h> #include <ntos/tss.h> #include <napi/shared_data.h> -#include <roscfg.h> #define UserMode (1) @@ -40,7 +40,7 @@ pushl $USER_DS pushl %edx /* Ring 3 SS:ESP */ pushfl - orl $200, (%esp) /* Re-enable IRQs in EFLAGS, to fake INT */ + orl $X86_EFLAGS_IF, (%esp) /* Re-enable IRQs in EFLAGS, to fake INT */ pushl $USER_CS pushl $KUSER_SHARED_SYSCALL_RET @@ -281,11 +281,11 @@ mov %ecx, %fs /* We will be cleaning up the stack ourselves */ - popl %edx /* New Ring 3 EIP */ - add $0x4, %esp /* Skip Ring 3 DS */ - andl $0xFD, 9(%esp) /* Remove IRQ hack from EFLAGS */ - popfl /* Restore old EFLAGS */ - popl %ecx /* Old Ring 3 SS:ESP */ + popl %edx /* New Ring 3 EIP */ + add $0x4, %esp /* Skip Ring 3 DS */ + andl $~X86_EFLAGS_IF, (%esp) /* Remove IRQ hack from EFLAGS */ + popfl /* Restore old EFLAGS */ + popl %ecx /* Old Ring 3 SS:ESP */ /* * At this point:
19 years, 10 months
1
0
0
0
[royce] 13124: msvc6 compatibility
by royce@svn.reactos.com
msvc6 compatibility Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-18 14:16:01 UTC (rev 13123) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-18 17:00:47 UTC (rev 13124) @@ -10,9 +10,11 @@ using std::map; using std::set; +typedef set<string> set_string; + map<ModuleType,MingwModuleHandler*>* MingwModuleHandler::handler_map = NULL; -set<string> +set_string MingwModuleHandler::directory_set; int MingwModuleHandler::ref = 0; @@ -74,19 +76,21 @@ MingwModuleHandler::GetDirectory ( const string& filename ) const { size_t index = filename.find_last_of ( '/' ); - if (index == string::npos) return "."; - else return filename.substr ( 0, index ); + if (index == string::npos) + return "."; + else + return filename.substr ( 0, index ); } 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() ); + 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 ""; } @@ -101,14 +105,14 @@ string MingwModuleHandler::ReplaceExtension ( const string& filename, - const string& newExtension ) const + const string& newExtension ) 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 ( 0, index + ext_index ) + newExtension; + string tmp = filename.substr( index, filename.size() - index ); + size_t ext_index = tmp.find_last_of( '.' ); + if (ext_index != string::npos) + return filename.substr ( 0, index + ext_index ) + newExtension; return filename + newExtension; } @@ -129,7 +133,7 @@ MingwModuleHandler::GetModuleArchiveFilename ( const Module& module ) const { return ReplaceExtension ( FixupTargetFilename ( module.GetPath () ), - ".a" ); + ".a" ); } string @@ -218,9 +222,9 @@ newExtension = ".stubs.o"; else newExtension = ".o"; - return PassThruCacheDirectory - ( FixupTargetFilename ( ReplaceExtension ( sourceFilename, - newExtension ) ) ); + return PassThruCacheDirectory ( + FixupTargetFilename ( + ReplaceExtension ( sourceFilename, newExtension ) ) ); } string @@ -242,34 +246,39 @@ void MingwModuleHandler::GenerateDirectoryTargets() const { - fprintf( fMakefile, "ifneq ($(ROS_INTERMEDIATE),)\ndirectories::" ); + set_string::iterator i; + fprintf( fMakefile, "ifneq ($(ROS_INTERMEDIATE),)\ndirectories::" ); - for( set<string>::iterator i = directory_set.begin(); - i != directory_set.end(); - i++ ) - fprintf( fMakefile, " %s", i->c_str() ); + for ( i = directory_set.begin(); + i != directory_set.end(); + i++ ) + { + fprintf ( fMakefile, " %s", i->c_str() ); + } - fprintf( fMakefile, "\n\n" ); + fprintf( fMakefile, "\n\n" ); - for( set<string>::iterator i = directory_set.begin(); - i != directory_set.end(); - i++ ) - fprintf( fMakefile, "%s ", i->c_str() ); + for ( i = directory_set.begin(); + i != directory_set.end(); + i++ ) + { + fprintf ( fMakefile, "%s ", i->c_str() ); + } - fprintf ( fMakefile, - "::\n\t${mkdir} $@\n\n" - "else\n" - "directories::\n\n" - "endif\n\n" ); + fprintf ( fMakefile, + "::\n\t${mkdir} $@\n\n" + "else\n" + "directories::\n\n" + "endif\n\n" ); - directory_set.clear(); + directory_set.clear(); } string MingwModuleHandler::GenerateGccDefineParametersFromVector ( const vector<Define*>& defines ) const { string parameters; - for (size_t i = 0; i < defines.size (); i++) + for ( size_t i = 0; i < defines.size (); i++ ) { Define& define = *defines[i]; if (parameters.length () > 0) @@ -290,7 +299,7 @@ { string parameters = GenerateGccDefineParametersFromVector ( module.project.defines ); string s = GenerateGccDefineParametersFromVector ( module.defines ); - if (s.length () > 0) + if ( s.length () > 0 ) { parameters += " "; parameters += s; @@ -365,7 +374,7 @@ const vector<Define*>& defines ) const { size_t i; - + fprintf ( fMakefile, "%s %s", @@ -714,11 +723,11 @@ junk_tmp.c_str () ); fprintf ( fMakefile, - "\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s --kill-at\n", - targetName.c_str (), - base_tmp.c_str (), - (module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (), - temp_exp.c_str () ); + "\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s --kill-at\n", + targetName.c_str (), + base_tmp.c_str (), + ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (), + temp_exp.c_str () ); fprintf ( fMakefile, "\t${rm} %s\n", @@ -776,6 +785,7 @@ } for ( i = 0; i < ifs.size(); i++ ) + { GenerateObjectFileTargets ( module, ifs[i]->files, ifs[i]->ifs, @@ -783,6 +793,7 @@ cflagsMacro, nasmflagsMacro, windresflagsMacro ); + } } void @@ -821,11 +832,11 @@ const string& ar, const string& objs_macro ) const { - string archiveFilename = GetModuleArchiveFilename ( module ); + string archiveFilename = GetModuleArchiveFilename ( module ); fprintf ( fMakefile, "%s: %s\n", - archiveFilename.c_str (), + archiveFilename.c_str (), objs_macro.c_str ()); fprintf ( fMakefile, @@ -1002,8 +1013,10 @@ const Invoke& invoke = *module.invocations[i]; if ( invoke.invokeModule->type != BuildTool ) + { throw InvalidBuildFileException ( module.node.location, - "Only modules of type buildtool can be invoked." ); + "Only modules of type buildtool can be invoked." ); + } string invokeTarget = module.GetInvocationTarget ( i ); fprintf ( fMakefile, @@ -1068,10 +1081,10 @@ p2 = end; } fprintf ( fMakefile, - "%.*s: %s\n", - p2-p, - p, - preconditionDependenciesName.c_str ()); + "%.*s: %s\n", + p2-p, + p, + preconditionDependenciesName.c_str ()); p = p2; p += strspn ( p, " \t" ); } @@ -1091,7 +1104,7 @@ fprintf ( fMakefile, "\t${dlltool} --dllname %s --def %s --output-lib %s --kill-at\n\n", module.GetTargetName ().c_str (), - (module.GetBasePath () + SSEP + module.importLibrary->definition).c_str (), + ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (), FixupTargetFilename ( module.GetDependencyPath () ).c_str () ); } } @@ -1298,9 +1311,9 @@ string linkerParameters ( "-Wl,--subsystem,native -Wl,--entry,_DriverEntry@8 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll" ); GenerateLinkerCommand ( module, - "${gcc}", - linkerParameters, - archiveFilename ); + "${gcc}", + linkerParameters, + archiveFilename ); } else { @@ -1347,15 +1360,15 @@ delete cflags; fprintf ( fMakefile, "%s: %s %s\n", - target.c_str (), + target.c_str (), archiveFilename.c_str (), importLibraryDependencies.c_str () ); string linkerParameters ( "-Wl,--subsystem,native -Wl,--entry,_DriverEntry@8 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll" ); GenerateLinkerCommand ( module, - "${gcc}", - linkerParameters, - archiveFilename ); + "${gcc}", + linkerParameters, + archiveFilename ); } else { @@ -1415,9 +1428,9 @@ string linkerParameters ( "-Wl,--subsystem,native -Wl,--entry,_DllMainCRTStartup@12 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll" ); GenerateLinkerCommand ( module, - "${gcc}", - linkerParameters, - objectFilenames ); + "${gcc}", + linkerParameters, + objectFilenames ); } else { @@ -1465,9 +1478,9 @@ string linkerParameters ( "-Wl,--subsystem,console -Wl,--entry,_DllMain@12 -Wl,--image-base,0x10000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll" ); GenerateLinkerCommand ( module, - "${gcc}", - linkerParameters, - objectFilenames ); + "${gcc}", + linkerParameters, + objectFilenames ); } else { @@ -1516,9 +1529,9 @@ string linkerParameters ( "-Wl,--subsystem,windows -Wl,--entry,_WinMainCRTStartup -Wl,--image-base,0x00400000 -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000" ); GenerateLinkerCommand ( module, - "${gcc}", - linkerParameters, - objectFilenames ); + "${gcc}", + linkerParameters, + objectFilenames ); } else {
19 years, 10 months
1
0
0
0
[ekohl] 13123: Revert accidential changes.
by ekohl@svn.reactos.com
Revert accidential changes. Modified: trunk/reactos/lib/kernel32/debug/debugger.c _____ Modified: trunk/reactos/lib/kernel32/debug/debugger.c --- trunk/reactos/lib/kernel32/debug/debugger.c 2005-01-18 13:59:14 UTC (rev 13122) +++ trunk/reactos/lib/kernel32/debug/debugger.c 2005-01-18 14:16:01 UTC (rev 13123) @@ -79,46 +79,14 @@ * * @unmplemented */ -BOOL WINAPI -DebugActiveProcess(DWORD dwProcessId) +BOOL +WINAPI +DebugActiveProcess( + DWORD dwProcessId + ) { - CSRSS_API_REQUEST Request; - CSRSS_API_REPLY Reply; - HANDLE hProcess; - NTSTATUS Status; - - hProcess = OpenProcess(PROCESS_ALL_ACCESS, - FALSE, - dwProcessId); - if (hProcess == NULL) - return FALSE; - - /* Notify CSRSS */ - Request.Type = CSRSS_DEBUG_PROCESS; - Request.Data.DebugProcessRequest.DebuggeeProcessId = dwProcessId; - Request.Data.DebugProcessRequest.DebuggerProcessId = GetCurrentProcessId(); - Request.Data.DebugProcessRequest.DebuggerThreadId = GetCurrentThreadId(); - Status = CsrClientCallServer(&Request, - &Reply, - sizeof(CSRSS_API_REQUEST), - sizeof(CSRSS_API_REPLY)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status)) - { - SetLastError(ERROR_ACCESS_DENIED); - return FALSE; - } - - CloseHandle(hProcess); - - /* Connect the current process (debugger) to the debug subsystem */ - Status = DbgUiConnectToDbg(); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; }
19 years, 10 months
1
0
0
0
[ekohl] 13122: - Remove Nt/ZwQueryOleDirectoryFile.
by ekohl@svn.reactos.com
- Remove Nt/ZwQueryOleDirectoryFile. - Nt/ZwPlugPlayControl has got 3 instead of 4 arguments. Modified: trunk/reactos/lib/kernel32/debug/debugger.c Modified: trunk/reactos/lib/ntdll/def/ntdll.def Modified: trunk/reactos/ntoskrnl/io/dir.c Modified: trunk/reactos/ntoskrnl/ntoskrnl.def Modified: trunk/reactos/tools/nci/sysfuncs.lst _____ Modified: trunk/reactos/lib/kernel32/debug/debugger.c --- trunk/reactos/lib/kernel32/debug/debugger.c 2005-01-18 13:27:28 UTC (rev 13121) +++ trunk/reactos/lib/kernel32/debug/debugger.c 2005-01-18 13:59:14 UTC (rev 13122) @@ -24,24 +24,24 @@ { HANDLE DebugPort; NTSTATUS Status; - - if(pbDebuggerPresent == NULL) + + if (pbDebuggerPresent == NULL) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - + Status = NtQueryInformationProcess(hProcess, ProcessDebugPort, (PVOID)&DebugPort, sizeof(HANDLE), NULL); - if(NT_SUCCESS(Status)) + if (NT_SUCCESS(Status)) { *pbDebuggerPresent = ((DebugPort != NULL) ? TRUE : FALSE); return TRUE; } - + SetLastErrorByStatus(Status); return FALSE; } @@ -64,8 +64,7 @@ ClientId.UniqueThread = (HANDLE)dwThreadId; Status = DbgUiContinue(&ClientId, dwContinueStatus); - - if(!NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { SetLastErrorByStatus(Status); return FALSE; @@ -76,16 +75,50 @@ /* - * @unimplemented + * NOTE: I'm not sure if the function is complete. + * + * @unmplemented */ -BOOL -WINAPI -DebugActiveProcess ( - DWORD dwProcessId - ) +BOOL WINAPI +DebugActiveProcess(DWORD dwProcessId) { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + CSRSS_API_REQUEST Request; + CSRSS_API_REPLY Reply; + HANDLE hProcess; + NTSTATUS Status; + + hProcess = OpenProcess(PROCESS_ALL_ACCESS, + FALSE, + dwProcessId); + if (hProcess == NULL) + return FALSE; + + /* Notify CSRSS */ + Request.Type = CSRSS_DEBUG_PROCESS; + Request.Data.DebugProcessRequest.DebuggeeProcessId = dwProcessId; + Request.Data.DebugProcessRequest.DebuggerProcessId = GetCurrentProcessId(); + Request.Data.DebugProcessRequest.DebuggerThreadId = GetCurrentThreadId(); + Status = CsrClientCallServer(&Request, + &Reply, + sizeof(CSRSS_API_REQUEST), + sizeof(CSRSS_API_REPLY)); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Reply.Status)) + { + SetLastError(ERROR_ACCESS_DENIED); + return FALSE; + } + + CloseHandle(hProcess); + + /* Connect the current process (debugger) to the debug subsystem */ + Status = DbgUiConnectToDbg(); + if (!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + return TRUE; } _____ Modified: trunk/reactos/lib/ntdll/def/ntdll.def --- trunk/reactos/lib/ntdll/def/ntdll.def 2005-01-18 13:27:28 UTC (rev 13121) +++ trunk/reactos/lib/ntdll/def/ntdll.def 2005-01-18 13:59:14 UTC (rev 13122) @@ -154,7 +154,7 @@ NtOpenThread@16 NtOpenThreadToken@16 NtOpenTimer@12 -NtPlugPlayControl@16 +NtPlugPlayControl@12 NtPrivilegeCheck@12 NtPrivilegedServiceAuditAlarm@20 NtPrivilegeObjectAuditAlarm@24 @@ -182,7 +182,6 @@ NtQueryMultipleValueKey@24 NtQueryMutant@20 NtQueryObject@20 -NtQueryOleDirectoryFile@44 NtQueryPerformanceCounter@8 NtQuerySection@20 NtQuerySecurityObject@20 @@ -573,7 +572,7 @@ ;RtlQueryPropertyNames ;RtlQueryPropertySet RtlQueryRegistryValues@20 -;RtlQuerySecutityObject +;RtlQuerySecurityObject ;RtlQueryTagHeap RtlQueryTimeZoneInformation@4 RtlRaiseException@4 @@ -770,7 +769,7 @@ ZwOpenThread@16 ZwOpenThreadToken@16 ZwOpenTimer@12 -ZwPlugPlayControl@16 +ZwPlugPlayControl@12 ZwPrivilegeCheck@12 ZwPrivilegedServiceAuditAlarm@20 ZwPrivilegeObjectAuditAlarm@24 @@ -798,7 +797,6 @@ ZwQueryMultipleValueKey@24 ZwQueryMutant@20 ZwQueryObject@20 -ZwQueryOleDirectoryFile@44 ZwQueryPerformanceCounter@8 ZwQuerySection@20 ZwQuerySecurityObject@20 _____ Modified: trunk/reactos/ntoskrnl/io/dir.c --- trunk/reactos/ntoskrnl/io/dir.c 2005-01-18 13:27:28 UTC (rev 13121) +++ trunk/reactos/ntoskrnl/io/dir.c 2005-01-18 13:59:14 UTC (rev 13122) @@ -236,11 +236,4 @@ return(Status); } -NTSTATUS STDCALL NtQueryOleDirectoryFile(VOID) -{ - UNIMPLEMENTED; - return(STATUS_NOT_IMPLEMENTED); -} - - /* EOF */ _____ Modified: trunk/reactos/ntoskrnl/ntoskrnl.def --- trunk/reactos/ntoskrnl/ntoskrnl.def 2005-01-18 13:27:28 UTC (rev 13121) +++ trunk/reactos/ntoskrnl/ntoskrnl.def 2005-01-18 13:59:14 UTC (rev 13122) @@ -815,7 +815,6 @@ NtQueryInformationProcess@20 NtQueryInformationThread@20 NtQueryInformationToken@20 -;NtQueryOleDirectoryFile@44 <--- ? NtQueryQuotaInformationFile@36 NtQuerySecurityObject@20 NtQuerySystemInformation@16 _____ Modified: trunk/reactos/tools/nci/sysfuncs.lst --- trunk/reactos/tools/nci/sysfuncs.lst 2005-01-18 13:27:28 UTC (rev 13121) +++ trunk/reactos/tools/nci/sysfuncs.lst 2005-01-18 13:59:14 UTC (rev 13122) @@ -102,7 +102,7 @@ NtOpenThreadToken 4 NtOpenThreadTokenEx 5 NtOpenTimer 3 -NtPlugPlayControl 4 +NtPlugPlayControl 3 NtPowerInformation 5 NtPrivilegeCheck 3 NtPrivilegedServiceAuditAlarm 5 @@ -133,7 +133,6 @@ NtQueryMultipleValueKey 6 NtQueryMutant 5 NtQueryObject 5 -NtQueryOleDirectoryFile 11 NtQueryPerformanceCounter 2 NtQueryQuotaInformationFile 9 NtQuerySection 5
19 years, 10 months
1
0
0
0
[gdalsnes] 13121: replace heap allocs with pool allocs (cant use heap allocs in rtl)
by gdalsnes@svn.reactos.com
replace heap allocs with pool allocs (cant use heap allocs in rtl) Modified: trunk/reactos/lib/rtl/registry.c _____ Modified: trunk/reactos/lib/rtl/registry.c --- trunk/reactos/lib/rtl/registry.c 2005-01-18 11:07:34 UTC (rev 13120) +++ trunk/reactos/lib/rtl/registry.c 2005-01-18 13:27:28 UTC (rev 13121) @@ -295,7 +295,7 @@ KeyPath->MaximumLength); if (KeyPath->Buffer == NULL) { - DPRINT1 ("RtlAllocateHeap() failed\n"); + DPRINT1 ("ExAllocatePool() failed\n"); RtlFreeUnicodeString (&SidString); return STATUS_NO_TOKEN; } @@ -362,7 +362,7 @@ IN PCWSTR Path, IN PRTL_QUERY_REGISTRY_TABLE QueryTable, IN PVOID Context, - IN PVOID Environment) + IN PVOID Environment OPTIONAL) { NTSTATUS Status; HANDLE BaseKeyHandle; @@ -751,9 +751,7 @@ /* Should not happen, because the name length is limited to 255 characters */ ExFreePool(ValueName); ValueNameSize = FullValueInfo->NameLength + sizeof(WCHAR); - ValueName = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - ValueNameSize); + ValueName = ExAllocatePool(PagedPool, ValueNameSize); if (ValueName == NULL) { Status = STATUS_NO_MEMORY; @@ -938,9 +936,7 @@ { BufferLength = SubKeyName->MaximumLength + sizeof(KEY_BASIC_INFORMATION); - KeyInfo = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - BufferLength); + KeyInfo = ExAllocatePool(PagedPool, BufferLength); if (KeyInfo == NULL) return(STATUS_NO_MEMORY); } @@ -969,9 +965,7 @@ if (KeyInfo != NULL) { - RtlFreeHeap(RtlGetProcessHeap(), - 0, - KeyInfo); + ExFreePool(KeyInfo); } return(Status); @@ -1029,9 +1023,7 @@ if (DataLength != NULL) BufferLength = *DataLength; - ValueInfo = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - BufferLength); + ValueInfo = ExAllocatePool(PagedPool, BufferLength); if (ValueInfo == NULL) return(STATUS_NO_MEMORY); @@ -1057,9 +1049,7 @@ } } - RtlFreeHeap(RtlGetProcessHeap(), - 0, - ValueInfo); + ExFreePool(ValueInfo); return(Status); }
19 years, 10 months
1
0
0
0
[ion] 13113: Share duplicated Rtl code. I've taken care to use the most recent code, so now ntoskrnl can also do environment string expansion.
by ion@svn.reactos.com
Share duplicated Rtl code. I've taken care to use the most recent code, so now ntoskrnl can also do environment string expansion. Modified: trunk/reactos/lib/ntdll/makefile Deleted: trunk/reactos/lib/ntdll/rtl/registry.c Modified: trunk/reactos/lib/rtl/makefile Added: trunk/reactos/lib/rtl/registry.c Modified: trunk/reactos/ntoskrnl/Makefile Deleted: trunk/reactos/ntoskrnl/cm/rtlfunc.c _____ Modified: trunk/reactos/lib/ntdll/makefile --- trunk/reactos/lib/ntdll/makefile 2005-01-18 04:25:27 UTC (rev 13112) +++ trunk/reactos/lib/ntdll/makefile 2005-01-18 04:33:31 UTC (rev 13113) @@ -77,7 +77,6 @@ rtl/process.o \ rtl/propvar.o \ rtl/rangelist.o \ - rtl/registry.o \ rtl/resource.o \ rtl/teb.o \ rtl/thread.o \ _____ Deleted: trunk/reactos/lib/ntdll/rtl/registry.c --- trunk/reactos/lib/ntdll/rtl/registry.c 2005-01-18 04:25:27 UTC (rev 13112) +++ trunk/reactos/lib/ntdll/rtl/registry.c 2005-01-18 04:33:31 UTC (rev 13113) @@ -1,1125 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * PURPOSE: Rtl registry functions - * FILE: lib/ntdll/rtl/registry.c - * PROGRAMER: Eric Kohl - * REVISION HISTORY: - * 2000/08/11: Created - */ - -/* - * TODO: - * - finish RtlQueryRegistryValues() - * - support RTL_QUERY_REGISTRY_DELETE - */ - -/* INCLUDES ****************************************************************/ - -#include <ddk/ntddk.h> -#include <ntdll/rtl.h> -#include <ntos/minmax.h> - -#define NDEBUG -#include <ntdll/ntdll.h> - - -/* FUNCTIONS ***************************************************************/ - -static NTSTATUS -RtlpGetRegistryHandle(ULONG RelativeTo, - PWSTR Path, - BOOLEAN Create, - PHANDLE KeyHandle) -{ - UNICODE_STRING KeyPath; - UNICODE_STRING KeyName; - WCHAR KeyBuffer[MAX_PATH]; - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - - DPRINT("RtlpGetRegistryHandle()\n"); - - if (RelativeTo & RTL_REGISTRY_HANDLE) - { - Status = NtDuplicateObject(NtCurrentProcess(), - (HANDLE)Path, - NtCurrentProcess(), - KeyHandle, - 0, - FALSE, - DUPLICATE_SAME_ACCESS); - return(Status); - } - - if (RelativeTo & RTL_REGISTRY_OPTIONAL) - RelativeTo &= ~RTL_REGISTRY_OPTIONAL; - - if (RelativeTo >= RTL_REGISTRY_MAXIMUM) - return(STATUS_INVALID_PARAMETER); - - KeyName.Length = 0; - KeyName.MaximumLength = MAX_PATH; - KeyName.Buffer = KeyBuffer; - KeyBuffer[0] = 0; - - switch (RelativeTo) - { - case RTL_REGISTRY_ABSOLUTE: - RtlAppendUnicodeToString(&KeyName, - L"\\"); - break; - - case RTL_REGISTRY_SERVICES: - RtlAppendUnicodeToString(&KeyName, - L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"); - break; - - case RTL_REGISTRY_CONTROL: - RtlAppendUnicodeToString(&KeyName, - L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\"); - break; - - case RTL_REGISTRY_WINDOWS_NT: - RtlAppendUnicodeToString(&KeyName, - L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\"); - break; - - case RTL_REGISTRY_DEVICEMAP: - RtlAppendUnicodeToString(&KeyName, - L"\\Registry\\Machine\\Hardware\\DeviceMap\\"); - break; - - case RTL_REGISTRY_USER: - Status = RtlFormatCurrentUserKeyPath (&KeyPath); - if (!NT_SUCCESS(Status)) - return(Status); - RtlAppendUnicodeStringToString (&KeyName, - &KeyPath); - RtlFreeUnicodeString (&KeyPath); - RtlAppendUnicodeToString (&KeyName, - L"\\"); - break; - - /* ReactOS specific */ - case RTL_REGISTRY_ENUM: - RtlAppendUnicodeToString(&KeyName, - L"\\Registry\\Machine\\System\\CurrentControlSet\\Enum\\"); - break; - } - - DPRINT("KeyName %wZ\n", &KeyName); - - if (Path[0] == L'\\' && RelativeTo != RTL_REGISTRY_ABSOLUTE) - { - Path++; - } - RtlAppendUnicodeToString(&KeyName, - Path); - - DPRINT("KeyName %wZ\n", &KeyName); - - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE | OBJ_OPENIF, - NULL, - NULL); - - if (Create == TRUE) - { - Status = NtCreateKey(KeyHandle, - KEY_ALL_ACCESS, - &ObjectAttributes, - 0, - NULL, - 0, - NULL); - } - else - { - Status = NtOpenKey(KeyHandle, - KEY_ALL_ACCESS, - &ObjectAttributes); - } - - return(Status); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -RtlCheckRegistryKey(IN ULONG RelativeTo, - IN PWSTR Path) -{ - HANDLE KeyHandle; - NTSTATUS Status; - - Status = RtlpGetRegistryHandle(RelativeTo, - Path, - FALSE, - &KeyHandle); - if (!NT_SUCCESS(Status)) - return(Status); - - NtClose(KeyHandle); - - return(STATUS_SUCCESS); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -RtlCreateRegistryKey(IN ULONG RelativeTo, - IN PWSTR Path) -{ - HANDLE KeyHandle; - NTSTATUS Status; - - Status = RtlpGetRegistryHandle(RelativeTo, - Path, - TRUE, - &KeyHandle); - if (!NT_SUCCESS(Status)) - return(Status); - - NtClose(KeyHandle); - - return(STATUS_SUCCESS); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -RtlDeleteRegistryValue(IN ULONG RelativeTo, - IN PCWSTR Path, - IN PCWSTR ValueName) -{ - HANDLE KeyHandle; - NTSTATUS Status; - UNICODE_STRING Name; - - Status = RtlpGetRegistryHandle(RelativeTo, - (PWSTR)Path, - FALSE, - &KeyHandle); - if (!NT_SUCCESS(Status)) - return(Status); - - RtlInitUnicodeString(&Name, - ValueName); - - Status = NtDeleteValueKey(KeyHandle, - &Name); - - NtClose(KeyHandle); - - return(Status); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -RtlFormatCurrentUserKeyPath (OUT PUNICODE_STRING KeyPath) -{ - HANDLE TokenHandle; - UCHAR Buffer[256]; - PSID_AND_ATTRIBUTES SidBuffer; - ULONG Length; - UNICODE_STRING SidString; - NTSTATUS Status; - - DPRINT ("RtlFormatCurrentUserKeyPath() called\n"); - - Status = NtOpenThreadToken (NtCurrentThread (), - TOKEN_READ, - TRUE, - &TokenHandle); - if (!NT_SUCCESS (Status)) - { - if (Status != STATUS_NO_TOKEN) - { - DPRINT1 ("NtOpenThreadToken() failed (Status %lx)\n", Status); - return Status; - } - - Status = NtOpenProcessToken (NtCurrentProcess (), - TOKEN_READ, - &TokenHandle); - if (!NT_SUCCESS (Status)) - { - DPRINT1 ("NtOpenProcessToken() failed (Status %lx)\n", Status); - return Status; - } - } - - SidBuffer = (PSID_AND_ATTRIBUTES)Buffer; - Status = NtQueryInformationToken (TokenHandle, - TokenUser, - (PVOID)SidBuffer, - 256, - &Length); - NtClose (TokenHandle); - if (!NT_SUCCESS(Status)) - { - DPRINT1 ("NtQueryInformationToken() failed (Status %lx)\n", Status); - return Status; - } - - Status = RtlConvertSidToUnicodeString (&SidString, - SidBuffer[0].Sid, - TRUE); - if (!NT_SUCCESS(Status)) - { - DPRINT1 ("RtlConvertSidToUnicodeString() failed (Status %lx)\n", Status); - return Status; - } - - DPRINT ("SidString: '%wZ'\n", &SidString); - - Length = SidString.Length + sizeof(L"\\Registry\\User\\"); - DPRINT ("Length: %lu\n", Length); - - KeyPath->Length = 0; - KeyPath->MaximumLength = Length; - KeyPath->Buffer = RtlAllocateHeap (RtlGetProcessHeap (), - 0, - KeyPath->MaximumLength); - if (KeyPath->Buffer == NULL) - { - DPRINT1 ("RtlAllocateHeap() failed\n"); - RtlFreeUnicodeString (&SidString); - return STATUS_NO_TOKEN; - } - - RtlAppendUnicodeToString (KeyPath, - L"\\Registry\\User\\"); - RtlAppendUnicodeStringToString (KeyPath, - &SidString); - RtlFreeUnicodeString (&SidString); - - return STATUS_SUCCESS; -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -RtlOpenCurrentUser(IN ACCESS_MASK DesiredAccess, - OUT PHANDLE KeyHandle) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyPath; - NTSTATUS Status; - - Status = RtlFormatCurrentUserKeyPath(&KeyPath); - if (NT_SUCCESS(Status)) - { - InitializeObjectAttributes(&ObjectAttributes, - &KeyPath, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - Status = NtOpenKey(KeyHandle, - DesiredAccess, - &ObjectAttributes); - RtlFreeUnicodeString(&KeyPath); - if (NT_SUCCESS(Status)) - { - return STATUS_SUCCESS; - } - } - - RtlInitUnicodeString (&KeyPath, - L"\\Registry\\User\\.Default"); - InitializeObjectAttributes(&ObjectAttributes, - &KeyPath, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - Status = NtOpenKey(KeyHandle, - DesiredAccess, - &ObjectAttributes); - - return Status; -} - - -/* - * @unimplemented - */ -NTSTATUS STDCALL -RtlQueryRegistryValues(IN ULONG RelativeTo, - IN PCWSTR Path, - IN PRTL_QUERY_REGISTRY_TABLE QueryTable, - IN PVOID Context, - IN PVOID Environment) -{ - NTSTATUS Status; - HANDLE BaseKeyHandle; - HANDLE CurrentKeyHandle; - PRTL_QUERY_REGISTRY_TABLE QueryEntry; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyName; - PKEY_VALUE_PARTIAL_INFORMATION ValueInfo; - PKEY_VALUE_FULL_INFORMATION FullValueInfo; - ULONG BufferSize; - ULONG ResultSize; - ULONG Index; - ULONG StringLen; - ULONG ValueNameSize; - PWSTR StringPtr; - PWSTR ExpandBuffer; - PWSTR ValueName; - UNICODE_STRING EnvValue; - UNICODE_STRING EnvExpandedValue; - - DPRINT("RtlQueryRegistryValues() called\n"); - - Status = RtlpGetRegistryHandle(RelativeTo, - (PWSTR)Path, - FALSE, - &BaseKeyHandle); - if (!NT_SUCCESS(Status)) - { - DPRINT("RtlpGetRegistryHandle() failed (Status %lx)\n", Status); - return(Status); - } - - CurrentKeyHandle = BaseKeyHandle; - QueryEntry = QueryTable; - while ((QueryEntry->QueryRoutine != NULL) || - (QueryEntry->Name != NULL)) - { - if (((QueryEntry->Flags & (RTL_QUERY_REGISTRY_SUBKEY | RTL_QUERY_REGISTRY_TOPKEY)) != 0) && - (BaseKeyHandle != CurrentKeyHandle)) - { - NtClose(CurrentKeyHandle); - CurrentKeyHandle = BaseKeyHandle; - } - - if (QueryEntry->Flags & RTL_QUERY_REGISTRY_SUBKEY) - { - DPRINT("Open new subkey: %S\n", QueryEntry->Name); - - RtlInitUnicodeString(&KeyName, - QueryEntry->Name); - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE, - BaseKeyHandle, - NULL); - Status = NtOpenKey(&CurrentKeyHandle, - KEY_ALL_ACCESS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - break; - } - else if (QueryEntry->Flags & RTL_QUERY_REGISTRY_DIRECT) - { - DPRINT("Query value directly: %S\n", QueryEntry->Name); - - RtlInitUnicodeString(&KeyName, - QueryEntry->Name); - - BufferSize = sizeof (KEY_VALUE_PARTIAL_INFORMATION) + 4096; - ValueInfo = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - BufferSize); - if (ValueInfo == NULL) - { - Status = STATUS_NO_MEMORY; - break; - } - - Status = NtQueryValueKey(CurrentKeyHandle, - &KeyName, - KeyValuePartialInformation, - ValueInfo, - BufferSize, - &ResultSize); - if (!NT_SUCCESS(Status)) - { - if (QueryEntry->Flags & RTL_QUERY_REGISTRY_REQUIRED) - { - RtlFreeHeap(RtlGetProcessHeap(), 0, ValueInfo); - Status = STATUS_OBJECT_NAME_NOT_FOUND; - break; - } - - if (QueryEntry->DefaultType == REG_SZ) - { - PUNICODE_STRING ValueString; - PUNICODE_STRING SourceString; - - SourceString = (PUNICODE_STRING)QueryEntry->DefaultData; - ValueString = (PUNICODE_STRING)QueryEntry->EntryContext; - if (ValueString->Buffer == NULL) - { - ValueString->Length = SourceString->Length; - ValueString->MaximumLength = SourceString->MaximumLength; - ValueString->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - ValueString->MaximumLength); - if (!ValueString->Buffer) - break; - ValueString->Buffer[0] = 0; - memcpy(ValueString->Buffer, - SourceString->Buffer, - SourceString->MaximumLength); - } - else - { - ValueString->Length = min(SourceString->Length, - ValueString->MaximumLength - sizeof(WCHAR)); - memcpy(ValueString->Buffer, - SourceString->Buffer, - ValueString->Length); - ((PWSTR)ValueString->Buffer)[ValueString->Length / sizeof(WCHAR)] = 0; - } - } - else - { - memcpy(QueryEntry->EntryContext, - QueryEntry->DefaultData, - QueryEntry->DefaultLength); - } - Status = STATUS_SUCCESS; - } - else - { - if ((ValueInfo->Type == REG_SZ) || - (ValueInfo->Type == REG_MULTI_SZ) || - (ValueInfo->Type == REG_EXPAND_SZ && (QueryEntry->Flags & RTL_QUERY_REGISTRY_NOEXPAND))) - { - PUNICODE_STRING ValueString; - - ValueString = (PUNICODE_STRING)QueryEntry->EntryContext; - if (ValueString->Buffer == NULL) - { - ValueString->MaximumLength = ValueInfo->DataLength; - ValueString->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - ValueString->MaximumLength); - if (ValueString->Buffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - break; - } - ValueString->Buffer[0] = 0; - } - ValueString->Length = min(ValueInfo->DataLength, - ValueString->MaximumLength) - sizeof(WCHAR); - memcpy(ValueString->Buffer, - ValueInfo->Data, - ValueString->Length); - ((PWSTR)ValueString->Buffer)[ValueString->Length / sizeof(WCHAR)] = 0; - } - else if (ValueInfo->Type == REG_EXPAND_SZ) - { - PUNICODE_STRING ValueString; - - DPRINT("Expand REG_EXPAND_SZ type\n"); - - ValueString = (PUNICODE_STRING)QueryEntry->EntryContext; - - ExpandBuffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - ValueInfo->DataLength * 2); - if (ExpandBuffer == NULL) - { - Status = STATUS_NO_MEMORY; - break; - } - - RtlInitUnicodeString(&EnvValue, - (PWSTR)ValueInfo->Data); - EnvExpandedValue.Length = 0; - EnvExpandedValue.MaximumLength = ValueInfo->DataLength * 2; - EnvExpandedValue.Buffer = ExpandBuffer; - *ExpandBuffer = 0; - - RtlExpandEnvironmentStrings_U(Environment, - &EnvValue, - &EnvExpandedValue, - &StringLen); - - if (ValueString->Buffer == NULL) - { - ValueString->MaximumLength = EnvExpandedValue.Length + sizeof(WCHAR); - ValueString->Length = EnvExpandedValue.Length; - ValueString->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - ValueString->MaximumLength); - if (ValueString->Buffer == NULL) - { - Status = STATUS_INSUFFICIENT_RESOURCES; - break; - } - } - else - { - ValueString->Length = min(EnvExpandedValue.Length, - ValueString->MaximumLength - sizeof(WCHAR)); - } - - memcpy(ValueString->Buffer, - EnvExpandedValue.Buffer, - ValueString->Length); - ((PWSTR)ValueString->Buffer)[ValueString->Length / sizeof(WCHAR)] = 0; - - RtlFreeHeap(RtlGetProcessHeap(), - 0, - ExpandBuffer); - } - else - { - memcpy(QueryEntry->EntryContext, - ValueInfo->Data, - ValueInfo->DataLength); - } - } - - if (QueryEntry->Flags & RTL_QUERY_REGISTRY_DELETE) - { - DPRINT1("FIXME: Delete value: %S\n", QueryEntry->Name); - - } - - RtlFreeHeap(RtlGetProcessHeap(), - 0, - ValueInfo); - } - else - { - DPRINT("Query value via query routine: %S\n", QueryEntry->Name); - if (QueryEntry->Name != NULL) - { - RtlInitUnicodeString(&KeyName, - QueryEntry->Name); - - BufferSize = sizeof (KEY_VALUE_PARTIAL_INFORMATION) + 4096; - ValueInfo = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - BufferSize); - if (ValueInfo == NULL) - { - Status = STATUS_NO_MEMORY; - break; - } - - Status = NtQueryValueKey(CurrentKeyHandle, - &KeyName, - KeyValuePartialInformation, - ValueInfo, - BufferSize, - &ResultSize); - if (!NT_SUCCESS(Status)) - { - if (!(QueryEntry->Flags & RTL_QUERY_REGISTRY_REQUIRED)) - { - Status = QueryEntry->QueryRoutine(QueryEntry->Name, - QueryEntry->DefaultType, - QueryEntry->DefaultData, - QueryEntry->DefaultLength, - Context, - QueryEntry->EntryContext); - } - } - else if ((ValueInfo->Type == REG_MULTI_SZ) && - !(QueryEntry->Flags & RTL_QUERY_REGISTRY_NOEXPAND)) - { - DPRINT("Expand REG_MULTI_SZ type\n"); - StringPtr = (PWSTR)ValueInfo->Data; - while (*StringPtr != 0) - { - StringLen = (wcslen(StringPtr) + 1) * sizeof(WCHAR); - Status = QueryEntry->QueryRoutine(QueryEntry->Name, - REG_SZ, - (PVOID)StringPtr, - StringLen, - Context, - QueryEntry->EntryContext); - if(!NT_SUCCESS(Status)) - break; - StringPtr = (PWSTR)((PUCHAR)StringPtr + StringLen); - } - } - else if ((ValueInfo->Type == REG_EXPAND_SZ) && - !(QueryEntry->Flags & RTL_QUERY_REGISTRY_NOEXPAND)) - { - DPRINT("Expand REG_EXPAND_SZ type\n"); - - ExpandBuffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - ValueInfo->DataLength * 2); - if (ExpandBuffer == NULL) - { - Status = STATUS_NO_MEMORY; - break; - } - - RtlInitUnicodeString(&EnvValue, - (PWSTR)ValueInfo->Data); - EnvExpandedValue.Length = 0; - EnvExpandedValue.MaximumLength = ValueInfo->DataLength * 2 * sizeof(WCHAR); - EnvExpandedValue.Buffer = ExpandBuffer; - *ExpandBuffer = 0; - - RtlExpandEnvironmentStrings_U(Environment, - &EnvValue, - &EnvExpandedValue, - &StringLen); - - StringLen = (wcslen(ExpandBuffer) + 1) * sizeof(WCHAR); - Status = QueryEntry->QueryRoutine(QueryEntry->Name, - REG_SZ, - (PVOID)ExpandBuffer, - StringLen, - Context, - QueryEntry->EntryContext); - - RtlFreeHeap(RtlGetProcessHeap(), - 0, - ExpandBuffer); - } - else - { - Status = QueryEntry->QueryRoutine(QueryEntry->Name, - ValueInfo->Type, - ValueInfo->Data, - ValueInfo->DataLength, - Context, - QueryEntry->EntryContext); - } - - if (QueryEntry->Flags & RTL_QUERY_REGISTRY_DELETE) - { - DPRINT1("FIXME: Delete value: %S\n", QueryEntry->Name); - - } - - RtlFreeHeap(RtlGetProcessHeap(), - 0, - ValueInfo); - if (!NT_SUCCESS(Status)) - break; - } - else if (QueryEntry->Flags & RTL_QUERY_REGISTRY_NOVALUE) - { - DPRINT("Simple callback\n"); - Status = QueryEntry->QueryRoutine(NULL, - REG_NONE, - NULL, - 0, - Context, - QueryEntry->EntryContext); - if (!NT_SUCCESS(Status)) - break; - } - else - { - DPRINT("Enumerate values\n"); - - BufferSize = sizeof(KEY_VALUE_FULL_INFORMATION) + 4096; - FullValueInfo = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - BufferSize); - if (FullValueInfo == NULL) - { - Status = STATUS_NO_MEMORY; - break; - } - ValueNameSize = 256 * sizeof(WCHAR); - ValueName = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - ValueNameSize); - if (ValueName == NULL) - { - Status = STATUS_NO_MEMORY; - break; - } - Index = 0; - while (TRUE) - { - Status = NtEnumerateValueKey(CurrentKeyHandle, - Index, - KeyValueFullInformation, - FullValueInfo, - BufferSize, - &ResultSize); - if (!NT_SUCCESS(Status)) - { - if ((Status == STATUS_NO_MORE_ENTRIES) && - (Index == 0) && - (QueryEntry->Flags & RTL_QUERY_REGISTRY_REQUIRED)) - { - Status = STATUS_OBJECT_NAME_NOT_FOUND; - } - else if (Status == STATUS_NO_MORE_ENTRIES) - { - Status = STATUS_SUCCESS; - } - break; - } - - if (FullValueInfo->NameLength > ValueNameSize - sizeof(WCHAR)) - { - /* Should not happen, because the name length is limited to 255 characters */ - RtlFreeHeap(RtlGetProcessHeap(), - 0, - ValueName); - ValueNameSize = FullValueInfo->NameLength + sizeof(WCHAR); - ValueName = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - ValueNameSize); - if (ValueName == NULL) - { - Status = STATUS_NO_MEMORY; - break; - } - } - - memcpy(ValueName, - FullValueInfo->Name, - FullValueInfo->NameLength); - ValueName[FullValueInfo->NameLength / sizeof(WCHAR)] = 0; - - DPRINT("FullValueInfo->Type: %lu\n", FullValueInfo->Type); - if ((FullValueInfo->Type == REG_MULTI_SZ) && - !(QueryEntry->Flags & RTL_QUERY_REGISTRY_NOEXPAND)) - { - DPRINT("Expand REG_MULTI_SZ type\n"); - StringPtr = (PWSTR)((PVOID)FullValueInfo + FullValueInfo->DataOffset); - while (*StringPtr != 0) - { - StringLen = (wcslen(StringPtr) + 1) * sizeof(WCHAR); - Status = QueryEntry->QueryRoutine(ValueName, - REG_SZ, - (PVOID)StringPtr, - StringLen, - Context, - QueryEntry->EntryContext); - if(!NT_SUCCESS(Status)) - break; - StringPtr = (PWSTR)((PUCHAR)StringPtr + StringLen); - } - } - else if ((FullValueInfo->Type == REG_EXPAND_SZ) && - !(QueryEntry->Flags & RTL_QUERY_REGISTRY_NOEXPAND)) - { - DPRINT("Expand REG_EXPAND_SZ type\n"); - - StringPtr = (PWSTR)((PVOID)FullValueInfo + FullValueInfo->DataOffset); - ExpandBuffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - FullValueInfo->DataLength * 2); - if (ExpandBuffer == NULL) - { - Status = STATUS_NO_MEMORY; - break; - } - - RtlInitUnicodeString(&EnvValue, - StringPtr); - EnvExpandedValue.Length = 0; - EnvExpandedValue.MaximumLength = FullValueInfo->DataLength * 2; - EnvExpandedValue.Buffer = ExpandBuffer; - *ExpandBuffer = 0; - - RtlExpandEnvironmentStrings_U(Environment, - &EnvValue, - &EnvExpandedValue, - &StringLen); - - StringLen = (wcslen(ExpandBuffer) + 1) * sizeof(WCHAR); - Status = QueryEntry->QueryRoutine(ValueName, - REG_SZ, - (PVOID)ExpandBuffer, - StringLen, - Context, - QueryEntry->EntryContext); - - RtlFreeHeap(RtlGetProcessHeap(), - 0, - ExpandBuffer); - } - else - { - Status = QueryEntry->QueryRoutine(ValueName, - FullValueInfo->Type, - (PVOID)FullValueInfo + FullValueInfo->DataOffset, - FullValueInfo->DataLength, - Context, - QueryEntry->EntryContext); - } - - if (!NT_SUCCESS(Status)) - break; - - /* FIXME: How will these be deleted? */ - - Index++; - } - - RtlFreeHeap(RtlGetProcessHeap(), - 0, - FullValueInfo); - RtlFreeHeap(RtlGetProcessHeap(), - 0, - ValueName); - if (!NT_SUCCESS(Status)) - break; - } - } - - QueryEntry++; - } - - if (CurrentKeyHandle != BaseKeyHandle) - NtClose(CurrentKeyHandle); - - NtClose(BaseKeyHandle); - - return(Status); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -RtlWriteRegistryValue(IN ULONG RelativeTo, - IN PCWSTR Path, - IN PCWSTR ValueName, - IN ULONG ValueType, - IN PVOID ValueData, - IN ULONG ValueLength) -{ - HANDLE KeyHandle; - NTSTATUS Status; - UNICODE_STRING Name; - - Status = RtlpGetRegistryHandle(RelativeTo, - (PWSTR)Path, - TRUE, - &KeyHandle); - if (!NT_SUCCESS(Status)) - return(Status); - - RtlInitUnicodeString(&Name, - ValueName); - - Status = NtSetValueKey(KeyHandle, - &Name, - 0, - ValueType, - ValueData, - ValueLength); - if (NT_SUCCESS(Status)) - NtClose(KeyHandle); - - return(Status); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -RtlpNtCreateKey(OUT HANDLE KeyHandle, - IN ACCESS_MASK DesiredAccess, - IN POBJECT_ATTRIBUTES ObjectAttributes, - IN ULONG Unused1, - OUT PULONG Disposition, - IN ULONG Unused2) -{ - if (ObjectAttributes != NULL) - ObjectAttributes->Attributes &= ~(OBJ_PERMANENT | OBJ_EXCLUSIVE); - - return(NtCreateKey(KeyHandle, - DesiredAccess, - ObjectAttributes, - 0, - NULL, - 0, - Disposition)); -} - - -/* - * @implemented - */ -NTSTATUS STDCALL -RtlpNtEnumerateSubKey(IN HANDLE KeyHandle, - OUT PUNICODE_STRING SubKeyName, - IN ULONG Index, - IN ULONG Unused) -{ - PKEY_BASIC_INFORMATION KeyInfo = NULL; - ULONG BufferLength = 0; - ULONG ReturnedLength; - NTSTATUS Status; - - if (SubKeyName->MaximumLength != 0) - { - BufferLength = SubKeyName->MaximumLength + - sizeof(KEY_BASIC_INFORMATION); - KeyInfo = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - BufferLength); - if (KeyInfo == NULL) - return(STATUS_NO_MEMORY); - } - [truncated at 1000 lines; 2023 more skipped]
19 years, 10 months
2
1
0
0
[gvg] 13120: SVN property stuff
by gvg@svn.reactos.com
SVN property stuff Modified: trunk/reactos/apps/utils/rosperf/Makefile Modified: trunk/reactos/apps/utils/rosperf/fill.c Modified: trunk/reactos/apps/utils/rosperf/lines.c Modified: trunk/reactos/apps/utils/rosperf/rosperf.c Modified: trunk/reactos/apps/utils/rosperf/rosperf.h Modified: trunk/reactos/apps/utils/rosperf/rosperf.rc Modified: trunk/reactos/apps/utils/rosperf/testlist.c Property changes on: trunk/reactos/apps/utils/rosperf ___________________________________________________________________ Name: svn:ignore + *.o *.a *.d *.exe *.coff *.sym *.map _____ Modified: trunk/reactos/apps/utils/rosperf/Makefile --- trunk/reactos/apps/utils/rosperf/Makefile 2005-01-18 10:41:49 UTC (rev 13119) +++ trunk/reactos/apps/utils/rosperf/Makefile 2005-01-18 11:07:34 UTC (rev 13120) @@ -1,24 +1,24 @@ -PATH_TO_TOP = ../../.. - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = rosperf - -TARGET_SDKLIBS = version.a gdi32.a user32.a kernel32.a ntdll.a - -TARGET_OBJECTS = rosperf.o testlist.o fill.o lines.o - -TARGET_CFLAGS = -Wall -Werror -D__USE_W32API - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# Automatic dependency tracking -DEP_OBJECTS := $(TARGET_OBJECTS) - -include $(PATH_TO_TOP)/tools/depend.mk - -# EOF +PATH_TO_TOP = ../../.. + +TARGET_TYPE = program + +TARGET_APPTYPE = console + +TARGET_NAME = rosperf + +TARGET_SDKLIBS = version.a gdi32.a user32.a kernel32.a ntdll.a + +TARGET_OBJECTS = rosperf.o testlist.o fill.o lines.o + +TARGET_CFLAGS = -Wall -Werror -D__USE_W32API + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +# Automatic dependency tracking +DEP_OBJECTS := $(TARGET_OBJECTS) + +include $(PATH_TO_TOP)/tools/depend.mk + +# EOF Property changes on: trunk/reactos/apps/utils/rosperf/Makefile ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/apps/utils/rosperf/fill.c --- trunk/reactos/apps/utils/rosperf/fill.c 2005-01-18 10:41:49 UTC (rev 13119) +++ trunk/reactos/apps/utils/rosperf/fill.c 2005-01-18 11:07:34 UTC (rev 13120) @@ -1,60 +1,60 @@ -/* - * ReactOS RosPerf - ReactOS GUI performance test program - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <windows.h> -#include "rosperf.h" - -void -FillProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) -{ - unsigned Rep; - - for (Rep = 0; Rep < Reps; Rep++) - { - PatBlt((Rep & 0x100) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc, 0, 0, - PerfInfo->WndWidth, PerfInfo->WndHeight, PATCOPY); - } -} - -void -FillSmallProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) -{ -#define SMALL_SIZE 16 - unsigned Rep; - unsigned x, y; - - x = 0; - y = 0; - - for (Rep = 0; Rep < Reps; Rep++) - { - PatBlt((Rep & 0x10000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc, x, y, - SMALL_SIZE, SMALL_SIZE, PATCOPY); - x += SMALL_SIZE + 1; - if (PerfInfo->WndWidth < x + SMALL_SIZE) - { - x = 0; - y += SMALL_SIZE + 1; - if (PerfInfo->WndHeight < y + SMALL_SIZE) - { - y = 0; - } - } - } -} -/* EOF */ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <windows.h> +#include "rosperf.h" + +void +FillProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + + for (Rep = 0; Rep < Reps; Rep++) + { + PatBlt((Rep & 0x100) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc, 0, 0, + PerfInfo->WndWidth, PerfInfo->WndHeight, PATCOPY); + } +} + +void +FillSmallProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ +#define SMALL_SIZE 16 + unsigned Rep; + unsigned x, y; + + x = 0; + y = 0; + + for (Rep = 0; Rep < Reps; Rep++) + { + PatBlt((Rep & 0x10000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc, x, y, + SMALL_SIZE, SMALL_SIZE, PATCOPY); + x += SMALL_SIZE + 1; + if (PerfInfo->WndWidth < x + SMALL_SIZE) + { + x = 0; + y += SMALL_SIZE + 1; + if (PerfInfo->WndHeight < y + SMALL_SIZE) + { + y = 0; + } + } + } +} +/* EOF */ Property changes on: trunk/reactos/apps/utils/rosperf/fill.c ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/apps/utils/rosperf/lines.c --- trunk/reactos/apps/utils/rosperf/lines.c 2005-01-18 10:41:49 UTC (rev 13119) +++ trunk/reactos/apps/utils/rosperf/lines.c 2005-01-18 11:07:34 UTC (rev 13120) @@ -1,97 +1,97 @@ -/* - * ReactOS RosPerf - ReactOS GUI performance test program - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <windows.h> -#include "rosperf.h" - -void -LinesProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) -{ - unsigned Rep; - int Dest; - HDC Dc; - - for (Rep = 0; Rep < Reps; ) - { - Dc = (Rep & 0x1000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; - - for (Dest = 2; Dest < PerfInfo->WndHeight && Rep < Reps; Rep++, Dest += 2) - { - MoveToEx(Dc, 0, 0, NULL); - LineTo(Dc, PerfInfo->WndWidth, Dest); - } - - for (Dest = PerfInfo->WndWidth - 2; 0 <= Dest && Rep < Reps; Rep++, Dest -= 2) - { - MoveToEx(Dc, PerfInfo->WndWidth, 0, NULL); - LineTo(Dc, Dest, PerfInfo->WndHeight); - } - - for (Dest = PerfInfo->WndHeight - 2; 0 <= Dest && Rep < Reps; Rep++, Dest -= 2) - { - MoveToEx(Dc, PerfInfo->WndWidth, PerfInfo->WndHeight, NULL); - LineTo(Dc, 0, Dest); - } - - for (Dest = 2; Dest < PerfInfo->WndWidth && Rep < Reps; Rep++, Dest += 2) - { - MoveToEx(Dc, 0, PerfInfo->WndHeight, NULL); - LineTo(Dc, Dest, 0); - } - } -} - -void -LinesHorizontalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) -{ - unsigned Rep; - unsigned y; - HDC Dc; - - for (Rep = 0; Rep < Reps; ) - { - Dc = (Rep & 0x10000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; - - for (y = 0; y < PerfInfo->WndHeight && Rep < Reps; Rep++, y += 3) - { - MoveToEx(Dc, 0, y, NULL); - LineTo(Dc, PerfInfo->WndWidth, y); - } - } -} - -void -LinesVerticalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) -{ - unsigned Rep; - unsigned x; - HDC Dc; - - for (Rep = 0; Rep < Reps; ) - { - Dc = (Rep & 0x1000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; - - for (x = 0; x < PerfInfo->WndWidth && Rep < Reps; Rep++, x += 3) - { - MoveToEx(Dc, x, 0, NULL); - LineTo(Dc, x, PerfInfo->WndHeight); - } - } -} - -/* EOF */ +/* + * ReactOS RosPerf - ReactOS GUI performance test program + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <windows.h> +#include "rosperf.h" + +void +LinesProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + int Dest; + HDC Dc; + + for (Rep = 0; Rep < Reps; ) + { + Dc = (Rep & 0x1000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; + + for (Dest = 2; Dest < PerfInfo->WndHeight && Rep < Reps; Rep++, Dest += 2) + { + MoveToEx(Dc, 0, 0, NULL); + LineTo(Dc, PerfInfo->WndWidth, Dest); + } + + for (Dest = PerfInfo->WndWidth - 2; 0 <= Dest && Rep < Reps; Rep++, Dest -= 2) + { + MoveToEx(Dc, PerfInfo->WndWidth, 0, NULL); + LineTo(Dc, Dest, PerfInfo->WndHeight); + } + + for (Dest = PerfInfo->WndHeight - 2; 0 <= Dest && Rep < Reps; Rep++, Dest -= 2) + { + MoveToEx(Dc, PerfInfo->WndWidth, PerfInfo->WndHeight, NULL); + LineTo(Dc, 0, Dest); + } + + for (Dest = 2; Dest < PerfInfo->WndWidth && Rep < Reps; Rep++, Dest += 2) + { + MoveToEx(Dc, 0, PerfInfo->WndHeight, NULL); + LineTo(Dc, Dest, 0); + } + } +} + +void +LinesHorizontalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + unsigned y; + HDC Dc; + + for (Rep = 0; Rep < Reps; ) + { + Dc = (Rep & 0x10000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; + + for (y = 0; y < PerfInfo->WndHeight && Rep < Reps; Rep++, y += 3) + { + MoveToEx(Dc, 0, y, NULL); + LineTo(Dc, PerfInfo->WndWidth, y); + } + } +} + +void +LinesVerticalProc(void *Context, PPERF_INFO PerfInfo, unsigned Reps) +{ + unsigned Rep; + unsigned x; + HDC Dc; + + for (Rep = 0; Rep < Reps; ) + { + Dc = (Rep & 0x1000) ? PerfInfo->BackgroundDc : PerfInfo->ForegroundDc; + + for (x = 0; x < PerfInfo->WndWidth && Rep < Reps; Rep++, x += 3) + { + MoveToEx(Dc, x, 0, NULL); + LineTo(Dc, x, PerfInfo->WndHeight); + } + } +} + +/* EOF */ Property changes on: trunk/reactos/apps/utils/rosperf/lines.c ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/apps/utils/rosperf/rosperf.c --- trunk/reactos/apps/utils/rosperf/rosperf.c 2005-01-18 10:41:49 UTC (rev 13119) +++ trunk/reactos/apps/utils/rosperf/rosperf.c 2005-01-18 11:07:34 UTC (rev 13120) @@ -1,923 +1,923 @@ -/* - * ReactOS RosPerf - ReactOS GUI performance test program - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -/* - * Ideas copied from x11perf: - * - * Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Digital not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR - * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <windows.h> -#include <reactos/buildno.h> - -#include "rosperf.h" - -#define MAINWND_WIDTH 400 -#define MAINWND_HEIGHT 400 - -static HWND LabelWnd; - -unsigned -NullInit(void **Context, PPERF_INFO PerfInfo, unsigned Reps) -{ - *Context = NULL; - - return Reps; -} - -void -NullCleanup(void *Context, PPERF_INFO PerfInfo) -{ -} - -static void -ProcessMessages(void) -{ - MSG Msg; - - while (PeekMessageW(&Msg, NULL, 0, 0, PM_REMOVE)) - { - if (WM_QUIT == Msg.message) - { - exit(Msg.wParam); - } - TranslateMessage(&Msg); - DispatchMessageW(&Msg); - } -} - -static void -ClearWindow(PPERF_INFO PerfInfo) -{ - InvalidateRect(PerfInfo->Wnd, NULL, TRUE); - UpdateWindow(PerfInfo->Wnd); -} - -static unsigned -CalibrateTest(PTEST Test, PPERF_INFO PerfInfo) -{ -#define GOAL 2500 /* Try to get up to 2.5 seconds */ -#define ENOUGH 2000 /* But settle for 2.0 seconds */ -#define TICK 10 /* Assume clock not faster than .01 seconds */ - - unsigned Reps, DidReps; /* Reps desired, reps performed */ - unsigned Exponent; - void *Context; - DWORD StartTick; - DWORD Duration; - - /* Attempt to get an idea how long each rep lasts by getting enough - reps to last more than ENOUGH. Then scale that up to the number of - seconds desired. - - If init call to test ever fails, return False and test will be skipped. - */ - - Reps = 1; - for (;;) - { - ClearWindow(PerfInfo); - DidReps = (*Test->Init)(&Context, PerfInfo, Reps); - ProcessMessages(); - if (0 == DidReps) - { - return 0; - } - StartTick = GetTickCount(); - (*Test->Proc)(Context, PerfInfo, Reps); - Duration = GetTickCount() - StartTick; - (*Test->PassCleanup) (Context, PerfInfo); - (*Test->Cleanup)(Context, PerfInfo); - ProcessMessages(); - - if (DidReps != Reps) - { - /* The test can't do the number of reps as we asked for. - Give up */ - return DidReps; - } - /* Did we go long enough? */ - if (ENOUGH <= Duration) - { - break; - } - - /* Don't let too short a clock make new reps wildly high */ - if (Duration <= TICK) - { - Reps *= 10; - } - else - { - /* Try to get up to GOAL seconds. */ - Reps = (int)(GOAL * (double) Reps / (double) Duration) + 1; - } - } - - Reps = (int) ((double) PerfInfo->Seconds * 1000.0 * (double) Reps / (double) Duration) + 1; - - /* Now round reps up to 1 digit accuracy, so we don't get stupid-looking - numbers of repetitions. */ - Reps--; - Exponent = 1; - while (9 < Reps) - { - Reps /= 10; - Exponent *= 10; - } - Reps = (Reps + 1) * Exponent; - - return Reps; -} - -static void -DisplayStatus(HWND Label, LPCWSTR Message, LPCWSTR Test, int Try) -{ - WCHAR Status[128]; - - snwprintf(Status, sizeof(Status) / sizeof(Status[0]), L"%d %s %s", Try, Message, Test); - SetWindowTextW(Label, Status); - InvalidateRect(Label, NULL, TRUE); - UpdateWindow(Label); -} - -static double -RoundTo3Digits(double d) -{ - /* It's kind of silly to print out things like ``193658.4/sec'' so just - junk all but 3 most significant digits. */ - - double exponent, sign; - - exponent = 1.0; - /* the code below won't work if d should happen to be non-positive. */ - if (d < 0.0) - { - d = -d; - sign = -1.0; - } - else - { - sign = 1.0; - } - - if (1000.0 <= d) - { - do - { - exponent *= 10.0; - } - while (1000.0 <= d / exponent); - d = (double)((int)(d / exponent + 0.5)); - d *= exponent; - } - else - { - if (0.0 != d) - { - while (d * exponent < 100.0) - { - exponent *= 10.0; - } - } - d = (double)((int)(d * exponent + 0.5)); - d /= exponent; - } - - return d * sign; -} - -static void -ReportTimes(DWORD Time, int Reps, LPCWSTR Label, BOOL Average) -{ - double MSecsPerObj, ObjsPerSec; - - if (0 != Time) - { - MSecsPerObj = (double) Time / (double) Reps; - ObjsPerSec = (double) Reps * 1000.0 / (double) Time; - - /* Round obj/sec to 3 significant digits. Leave msec untouched, to - allow averaging results from several repetitions. */ - ObjsPerSec = RoundTo3Digits(ObjsPerSec); - - wprintf(L"%7d %s @ %8.4f msec (%8.1f/sec): %s\n", - Reps, Average ? L"trep" : L"reps", MSecsPerObj, ObjsPerSec, Label); - } - else - { - wprintf(L"%6d %sreps @ 0.0 msec (unmeasurably fast): %s\n", - Reps, Average ? L"t" : L"", Label); - } - -} - -static void -ProcessTest(PTEST Test, PPERF_INFO PerfInfo) -{ - unsigned Reps; - unsigned Repeat; - void *Context; - DWORD StartTick; - DWORD Time, TotalTime; - - DisplayStatus(LabelWnd, L"Calibrating", Test->Label, 0); - Reps = CalibrateTest(Test, PerfInfo); - if (0 == Reps) - { - return; - } - - Reps = Test->Init(&Context, PerfInfo, Reps); - if (0 == Reps) - { - return; - } - TotalTime = 0; - for (Repeat = 0; Repeat < PerfInfo->Repeats; Repeat++) - { - DisplayStatus(LabelWnd, L"Testing", Test->Label, Repeat + 1); - ClearWindow(PerfInfo); - StartTick = GetTickCount(); - (*Test->Proc)(Context, PerfInfo, Reps); - Time = GetTickCount() - StartTick; - ProcessMessages(); - TotalTime += Time; - ReportTimes(Time, Reps, Test->Label, FALSE); - (*Test->PassCleanup)(Context, PerfInfo); - ProcessMessages(); - } - (*Test->Cleanup)(Context, PerfInfo); - ReportTimes(TotalTime, Repeat * Reps, Test->Label, TRUE); - ProcessMessages(); -} - -static void -PrintOSVersion(void) -{ -#define BUFSIZE 160 - OSVERSIONINFOEXW VersionInfo; - BOOL OsVersionInfoEx; - HKEY hKey; - WCHAR ProductType[BUFSIZE]; - DWORD BufLen; - LONG Ret; - unsigned RosVersionLen; - LPWSTR RosVersion; - - /* Try calling GetVersionEx using the OSVERSIONINFOEX structure. - * If that fails, try using the OSVERSIONINFO structure. */ - - ZeroMemory(&VersionInfo, sizeof(OSVERSIONINFOEXW)); - VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); - - OsVersionInfoEx = GetVersionExW((OSVERSIONINFOW *) &VersionInfo); - if (! OsVersionInfoEx) - { - VersionInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - if (! GetVersionExW((OSVERSIONINFOW *) &VersionInfo)) - { - return; - } - } - - RosVersion = VersionInfo.szCSDVersion + wcslen(VersionInfo.szCSDVersion) + 1; - RosVersionLen = sizeof(VersionInfo.szCSDVersion) / sizeof(VersionInfo.szCSDVersion[0]) - - (RosVersion - VersionInfo.szCSDVersion); - if (7 <= RosVersionLen && 0 == wcsnicmp(RosVersion, L"ReactOS", 7)) - { - wprintf(L"Running on %s\n", RosVersion); - return; - } - - switch (VersionInfo.dwPlatformId) - { - /* Test for the Windows NT product family. */ - case VER_PLATFORM_WIN32_NT: - - /* Test for the specific product. */ - if (5 == VersionInfo.dwMajorVersion && 2 == VersionInfo.dwMinorVersion) - { - wprintf(L"Running on Microsoft Windows Server 2003, "); - } - else if (5 == VersionInfo.dwMajorVersion && 1 == VersionInfo.dwMinorVersion) - { - wprintf(L"Running on Microsoft Windows XP "); - } - else if (5 == VersionInfo.dwMajorVersion && 0 == VersionInfo.dwMinorVersion) - { - wprintf(L"Running on Microsoft Windows 2000 "); - } - else if (VersionInfo.dwMajorVersion <= 4 ) - { - wprintf(L"Running on Microsoft Windows NT "); - } - - /* Test for specific product on Windows NT 4.0 SP6 and later. */ - if (OsVersionInfoEx) - { - /* Test for the workstation type. */ - if (VER_NT_WORKSTATION == VersionInfo.wProductType) - { - if (4 == VersionInfo.dwMajorVersion) - { - wprintf(L"Workstation 4.0 "); - } - else if (0 != (VersionInfo.wSuiteMask & VER_SUITE_PERSONAL)) - { - wprintf(L"Home Edition "); - } - else - { - wprintf(L"Professional "); - } - } - - /* Test for the server type. */ - else if (VER_NT_SERVER == VersionInfo.wProductType || - VER_NT_DOMAIN_CONTROLLER == VersionInfo.wProductType) - { - if (5 == VersionInfo.dwMajorVersion && 2 == VersionInfo.dwMinorVersion) - { - if (0 != (VersionInfo.wSuiteMask & VER_SUITE_DATACENTER)) - { - wprintf(L"Datacenter Edition "); - } - else if (0 != (VersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE)) - { - wprintf(L"Enterprise Edition "); - } - else if (VER_SUITE_BLADE == VersionInfo.wSuiteMask) - { - wprintf(L"Web Edition "); - } - else - { - wprintf(L"Standard Edition "); - } - } - - else if (5 == VersionInfo.dwMajorVersion && 0 == VersionInfo.dwMinorVersion) - { - if (0 != (VersionInfo.wSuiteMask & VER_SUITE_DATACENTER)) - { - wprintf(L"Datacenter Server "); - } - else if (0 != (VersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE)) - { - wprintf(L"Advanced Server " ); - } - else - { - wprintf(L"Server " ); - } - } - - else /* Windows NT 4.0 */ - { - if (0 != (VersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE)) - { - wprintf(L"Server 4.0, Enterprise Edition "); - } - else - { - wprintf(L"Server 4.0 "); - } - } - } - } - else /* Test for specific product on Windows NT 4.0 SP5 and earlier */ - { - BufLen = BUFSIZE; - - Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, - L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions", - 0, KEY_QUERY_VALUE, &hKey); - if (ERROR_SUCCESS != Ret) - { - return; - } - - Ret = RegQueryValueExW(hKey, L"ProductType", NULL, NULL, - (LPBYTE) ProductType, &BufLen); - if (ERROR_SUCCESS != Ret || BUFSIZE < BufLen) - { - return; - } - - RegCloseKey(hKey); - - if (0 == lstrcmpiW(L"WINNT", ProductType)) - { - wprintf(L"Workstation "); - } - else if (0 == lstrcmpiW(L"LANMANNT", ProductType)) - { - wprintf(L"Server "); - } - else if (0 == lstrcmpiW(L"SERVERNT", ProductType)) - { - wprintf(L"Advanced Server "); - } - - wprintf(L"%d.%d ", VersionInfo.dwMajorVersion, VersionInfo.dwMinorVersion); - } - - /* Display service pack (if any) and build number. */ - - if (4 == VersionInfo.dwMajorVersion && - 0 == lstrcmpiW(VersionInfo.szCSDVersion, L"Service Pack 6")) - { - /* Test for SP6 versus SP6a. */ - Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, - L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009", - 0, KEY_QUERY_VALUE, &hKey); - if (ERROR_SUCCESS == Ret) - { - wprintf(L"Service Pack 6a (Build %d)\n", VersionInfo.dwBuildNumber & 0xFFFF); - } - else /* Windows NT 4.0 prior to SP6a */ - { - wprintf(L"%s (Build %d)\n", - VersionInfo.szCSDVersion, - VersionInfo.dwBuildNumber & 0xFFFF); - } - - RegCloseKey(hKey); - } - else /* not Windows NT 4.0 */ - { - wprintf(L"%s (Build %d)\n", - VersionInfo.szCSDVersion, - VersionInfo.dwBuildNumber & 0xFFFF); - } - - - break; - - /* Test for the Windows Me/98/95. A bit silly since we're using Unicode... */ - case VER_PLATFORM_WIN32_WINDOWS: - - if (4 == VersionInfo.dwMajorVersion && 0 == VersionInfo.dwMinorVersion) - { - wprintf(L"Running on Microsoft Windows 95 "); - if (L'C' == VersionInfo.szCSDVersion[1] || L'B' == VersionInfo.szCSDVersion[1]) - { - wprintf(L"OSR2"); - } - } - - else if (4 == VersionInfo.dwMajorVersion && 10 == VersionInfo.dwMinorVersion) - { - wprintf(L"Running on Microsoft Windows 98 "); - if (L'A' == VersionInfo.szCSDVersion[1]) - { - wprintf(L"SE"); - } - } - - else if (4 == VersionInfo.dwMajorVersion && 90 == VersionInfo.dwMinorVersion) - { - wprintf(L"Running on Microsoft Windows Millennium Edition"); - } - wprintf(L"\n"); - break; - - case VER_PLATFORM_WIN32s: /* Even silier... */ - - wprintf(L"Running on Microsoft Win32s\n"); - break; - } -} - -static void -PrintAppVersion(void) -{ - wprintf(L"RosPerf %S (Build %S)\n", KERNEL_VERSION_STR, KERNEL_VERSION_BUILD_STR); -} - -static void -PrintDisplayInfo(void) -{ - HDC Dc; - - Dc = GetDC(NULL); - if (NULL == Dc) - { - return; - } - - wprintf(L"Display settings %d * %d * %d\n", GetDeviceCaps(Dc, HORZRES), - GetDeviceCaps(Dc, VERTRES), GetDeviceCaps(Dc, BITSPIXEL) * GetDeviceCaps(Dc, PLANES)); - - ReleaseDC(NULL, Dc); -} - -static void -PrintStartupInfo(void) -{ - PrintAppVersion(); - PrintOSVersion(); - PrintDisplayInfo(); -} - -static LRESULT CALLBACK -MainWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT Ps; - HDC Dc; - LRESULT Result; - - switch (Msg) - { - case WM_DESTROY: - PostQuitMessage(0); - Result = 0; - break; - - case WM_PAINT: - Dc = BeginPaint(Wnd, &Ps); - EndPaint (Wnd, &Ps); - Result = 0; - break; - - default: - Result = DefWindowProcW(Wnd, Msg, wParam, lParam); - break; - } - - return Result; -} - -static LRESULT CALLBACK -LabelWndProc(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) -{ - PAINTSTRUCT Ps; - HDC Dc; - RECT ClientRect, WindowRect; - TEXTMETRICW Tm; - LRESULT Result; - WCHAR Title[80]; - [truncated at 1000 lines; 1495 more skipped]
19 years, 10 months
1
0
0
0
[gvg] 13119: Fix crash during boot
by gvg@svn.reactos.com
Fix crash during boot Modified: trunk/reactos/lib/rtl/env.c _____ Modified: trunk/reactos/lib/rtl/env.c --- trunk/reactos/lib/rtl/env.c 2005-01-18 10:08:31 UTC (rev 13118) +++ trunk/reactos/lib/rtl/env.c 2005-01-18 10:41:49 UTC (rev 13119) @@ -533,6 +533,10 @@ if (Environment == NULL) { + if (NtCurrentPeb() == NULL) + { + return(STATUS_VARIABLE_NOT_FOUND); + } Environment = NtCurrentPeb()->ProcessParameters->Environment; SysEnvUsed = TRUE; }
19 years, 10 months
1
0
0
0
[gvg] 13118: Fix line endings
by gvg@svn.reactos.com
Fix line endings Modified: trunk/reactos/tools/nci/ncitool.c Property changes on: trunk/reactos/tools/nci/makefile ___________________________________________________________________ Name: svn:eol-style + native _____ Modified: trunk/reactos/tools/nci/ncitool.c --- trunk/reactos/tools/nci/ncitool.c 2005-01-18 06:00:55 UTC (rev 13117) +++ trunk/reactos/tools/nci/ncitool.c 2005-01-18 10:08:31 UTC (rev 13118) @@ -1,581 +1,581 @@ -/* - * FILE: tools/nci/ncitool.c - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: Native Call Interface Support Tool - * PURPOSE: Generates NCI Tables and Stubs. - * PROGRAMMER; Alex Ionescu (alex(a)relsoft.net) - * CHANGE HISTORY: 14/01/05 - Created. Based on original code by - * KJK::Hyperion and Emanuelle Aliberti. - * - */ - -/* INCLUDE ******************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <malloc.h> - -/* DEFINES ****************************************************************/ - -#define INPUT_BUFFER_SIZE 255 -#define Arguments 8 - -/******* Table Indexes ************/ -#define MAIN_INDEX 0x0 -#define WIN32K_INDEX 0x1000 - -/******* Argument List ************/ -/* First, define the Databases */ -#define NativeSystemDb 0 -#define NativeGuiDb 1 - -/* Now the Service Tables */ -#define NtosServiceTable 2 -#define Win32kServiceTable 3 - -/* And finally, the stub files. */ -#define NtosUserStubs 4 -#define NtosKernelStubs 5 -#define Win32kGdiStubs 6 -#define Win32kUserStubs 7 - -/********** Stub Code ************/ - -/* - * This stubs calls into KUSER_SHARED_DATA where either a - * sysenter or interrupt is performed, depending on CPU support. - */ -#if defined(__GNUC__) -#define UserModeStub_x86 " movl $0x%x, %%eax\n" \ - " movl $KUSER_SHARED_SYSCALL, %%ecx\n" \ - " call *%%ecx\n" \ - " ret $0x%x\n\n" -#elif defined(_MSC_VER) -#define UserModeStub_x86 " asm { \n" \ - " mov eax, %xh\n" \ - " mov ecx, KUSER_SHARED_SYSCALL\n" \ - " call [ecx]\n" \ - " ret %xh\n" \ - " }\n" -#else -#error Unknown compiler for inline assembler -#endif - -/* - * This stub calls KiSystemService directly with a fake INT2E stack. - * Because EIP is pushed during the call, the handler will return here. - */ -#if defined(__GNUC__) -#define KernelModeStub_x86 " movl $0x%x, %%eax\n" \ - " leal 4(%%esp), %%edx\n" \ - " pushfl\n" \ - " pushl $KERNEL_CS\n" \ - " call _KiSystemService\n" \ - " ret $0x%x\n\n" -#elif defined(_MSC_VER) -#define KernelModeStub_x86 " asm { \n" \ - " mov eax, %xh\n" \ - " lea edx, [esp+4]\n" \ - " pushf\n" \ - " push KERNEL_CS\n" \ - " call _KiSystemService\n" \ - " ret %xh\n" \ - " }\n" -#else -#error Unknown compiler for inline assembler -#endif - -/***** Arch Dependent Stuff ******/ -//#ifdef _M_IX86 -#define ARGS_TO_BYTES(x) x*4 -#define UserModeStub UserModeStub_x86 -#define KernelModeStub KernelModeStub_x86 - -//#elseif -//#error Unsupported Architecture -//#endif - -/* FUNCTIONS ****************************************************************/ - -/*++ - * WriteFileHeader - * - * Prints out the File Header for a Stub File. - * - * Params: - * StubFile - Stub File to which to write the header. - * - * FileDescription - Description of the Stub file to which to write the header. - * - * FileLocation - Name of the Stub file to which to write the header. - * - * Returns: - * None. - * - * Remarks: - * FileLocation is only used for printing the header. - * - *--*/ -void -WriteFileHeader(FILE * StubFile, - char* FileDescription, - char* FileLocation) -{ - /* This prints out the file header */ - fprintf(StubFile, - "/* FILE: %s\n" - " * COPYRIGHT: See COPYING in the top level directory\n" - " * PURPOSE: %s\n" - " * PROGRAMMER: Computer Generated File. See tools/nci/ncitool.c\n" - " * REMARK: DO NOT EDIT OR COMMIT MODIFICATIONS TO THIS FILE\n" - " */\n\n\n" - "#include <napi/shared_data.h>\n\n", - FileDescription, - FileLocation); -} - -/*++ - * WriteFileHeader - * - * Prints out the File Header for a Stub File. - * - * Params: - * StubFile - Stub File to which to write the header. - * - * FileDescription - Description of the Stub file to which to write the header. - * - * FileLocation - Name of the Stub file to which to write the header. - * - * Returns: - * None. - * - * Remarks: - * FileLocation is only used for printing the header. - * - *--*/ -void -WriteStubHeader(FILE* StubFile, - char* SyscallName, - unsigned StackBytes) -{ - /* Export the function */ - fprintf(StubFile, ".global _%s@%d\n", SyscallName, StackBytes); - - /* Define it */ - fprintf(StubFile, "_%s@%d:\n\n", SyscallName, StackBytes); -} - - -/*++ - * WriteKernelModeStub - * - * Prints out the Kernel Mode Stub for a System Call. - * - * Params: - * StubFile - Stub File to which to write the header. - * - * SyscallName - Name of System Call for which to add the stub. - * - * StackBytes - Number of bytes on the stack to return after doing the system call. - * - * SyscallId - Service Descriptor Table ID for this System Call. - * - * Returns: - * None. - * - * Remarks: - * On i386, StackBytes is the number of arguments x 4. - * - *--*/ -void -WriteKernelModeStub(FILE* StubFile, - char* SyscallName, - unsigned StackBytes, - unsigned int SyscallId) -{ - /* Write the Stub Header and export the Function */ - WriteStubHeader(StubFile, SyscallName, StackBytes); - - /* Write the Stub Code */ - fprintf(StubFile, KernelModeStub, SyscallId, StackBytes); -} - -/*++ - * WriteUserModeStub - * - * Prints out the User Mode Stub for a System Call. - * - * Params: - * StubFile - Stub File to which to write the header. - * - * SyscallName - Name of System Call for which to add the stub. - * - * StackBytes - Number of bytes on the stack to return after doing the system call. - * - * SyscallId - Service Descriptor Table ID for this System Call. - * - * Returns: - * None. - * - * Remarks: - * On i386, StackBytes is the number of arguments x 4. - * - *--*/ -void -WriteUserModeStub(FILE* StubFile, - char* SyscallName, - unsigned StackBytes, - unsigned int SyscallId) -{ - /* Write the Stub Header and export the Function */ - WriteStubHeader(StubFile, SyscallName, StackBytes); - - /* Write the Stub Code */ - fprintf(StubFile, UserModeStub, SyscallId, StackBytes); -} - -/*++ - * GetNameAndArgumentsFromDb - * - * Parses an entry from a System Call Database, extracting - * the function's name and arguments that it takes. - * - * Params: - * Line - Entry from the Database to parse. - * - * NtSyscallName - Output string to which to save the Function Name - * - * SyscallArguments - Output string to which to save the number of - * arguments that the function takes. - * - * Returns: - * None. - * - * Remarks: - * On i386, StackBytes is the number of arguments x 4. - * - *--*/ -void -GetNameAndArgumentsFromDb(char Line[], - char ** NtSyscallName, - char ** SyscallArguments) -{ - char *s; - char *stmp; - - /* Remove new line */ - if ((s = (char *) strchr(Line,'\r')) != NULL) { - *s = '\0'; - } - - /* Skip comments (#) and empty lines */ - s = &Line[0]; - if ((*s) != '#' && (*s) != '\0') { - - /* Extract the NtXXX name */ - *NtSyscallName = (char *)strtok(s," \t"); - - /* Extract the argument count */ - *SyscallArguments = (char *)strtok(NULL," \t"); - - /* Remove, if present, the trailing LF */ - if ((stmp = strchr(*SyscallArguments, '\n')) != NULL) { - *stmp = '\0'; - } - - } else { - - /* Skip this entry */ - *NtSyscallName = NULL; - } -} - -/*++ - * CreateStubs - * - * Parses a System Call Database and creates stubs for all the entries. - * - * Params: - * SyscallDb - System Call Database to parse. - * - * UserModeFiles - Array of Usermode Stub Files to which to write the stubs. - * - * KernelModeFile - Kernelmode Stub Files to which to write the stubs. - * - * Index - Name of System Call for which to add the stub. - * - * UserFiles - Number of bytes on the stack to return after doing the system call. - * - * NeedsZw - Service Descriptor Table ID for this System Call. - * - * Returns: - * None. - * - * Remarks: - * None. - * - *--*/ -void -CreateStubs(FILE * SyscallDb, - FILE * UserModeFiles[], - FILE * KernelModeFile, - unsigned Index, - unsigned UserFiles, - unsigned NeedsZw) -{ - char Line[INPUT_BUFFER_SIZE]; - char *NtSyscallName; - char *ZwSyscallName = NULL; - char *SyscallArguments; - int SyscallId; - unsigned StackBytes; - - /* We loop, incrementing the System Call Index, until the end of the file */ - for (SyscallId = 0; ((!feof(SyscallDb)) && (fgets(Line, sizeof(Line), SyscallDb) != NULL));) { - - /* Extract the Name and Arguments */ - GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments); - StackBytes = ARGS_TO_BYTES(strtoul(SyscallArguments, NULL, 0)); - - /* Make sure we really extracted something */ - if (NtSyscallName) { - - /* Create the ZwXXX name, if requested */ - if (NeedsZw) { - ZwSyscallName = alloca(strlen(NtSyscallName)); - strcpy(ZwSyscallName, NtSyscallName); - ZwSyscallName[0] = 'Z'; - ZwSyscallName[1] = 'w'; - } - - /* Create Usermode Stubs for Nt/Zw syscalls in each Usermode file */ - int i; - for (i= 0; i < UserFiles; i++) { - - /* Write the Nt Version */ - WriteUserModeStub(UserModeFiles[i], - NtSyscallName, - StackBytes, - SyscallId | Index); - - /* If a Zw Version is needed (was specified), write it too */ - if (ZwSyscallName) WriteUserModeStub(UserModeFiles[i], - ZwSyscallName, - StackBytes, - SyscallId | Index); - - } - - /* Create the Kernel coutnerparts (only Zw*, Nt* are the real functions!) */ - if (KernelModeFile) WriteKernelModeStub(KernelModeFile, - ZwSyscallName, - StackBytes, - SyscallId | Index); - - /* Only increase if we actually added something */ - SyscallId++; - } - } -} - -/*++ - * CreateSystemServiceTable - * - * Parses a System Call Database and creates a System Call Service Table for it. - * - * Params: - * SyscallDb - System Call Database to parse. - * - * SyscallTable - File in where to create System Call Service Table. - * - * Name - Name of the Service Table. - * - * FileLocation - Filename containing the Table. - * - * Returns: - * None. - * - * Remarks: - * FileLocation is only used for the header generation. - * - *--*/ -void -CreateSystemServiceTable(FILE *SyscallDb, - FILE *SyscallTable, - char * Name, - char * FileLocation) -{ - char Line[INPUT_BUFFER_SIZE]; - char *NtSyscallName; - char *SyscallArguments; - int SyscallId; - - /* Print the Header */ - WriteFileHeader(SyscallTable, "System Call Table for Native API", FileLocation); - - /* First we build the SSDT */ - fprintf(SyscallTable,"\n\n\n"); - fprintf(SyscallTable,"SSDT %sSSDT[] = {\n", Name); - - /* We loop, incrementing the System Call Index, until the end of the file */ - for (SyscallId = 0; ((!feof(SyscallDb)) && (fgets(Line, sizeof(Line), SyscallDb) != NULL));) { - - /* Extract the Name and Arguments */ - GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments); - - /* Make sure we really extracted something */ - if (NtSyscallName) { - - /* Add a new line */ - if (SyscallId > 0) fprintf(SyscallTable,",\n"); - - /* Write the syscall name in the service table. */ - fprintf(SyscallTable,"\t\t(PVOID (NTAPI *)(VOID))%s", NtSyscallName); - - /* Only increase if we actually added something */ - SyscallId++; - } - } - - /* Close the service table (C syntax) */ - fprintf(SyscallTable,"\n};\n"); - - /* Now we build the SSPT */ - rewind(SyscallDb); - fprintf(SyscallTable,"\n\n\n"); - fprintf(SyscallTable,"SSPT %sSSPT[] = {\n", Name); - - for (SyscallId = 0; ((!feof(SyscallDb)) && (fgets(Line, sizeof(Line), SyscallDb) != NULL));) { - - /* Extract the Name and Arguments */ - GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments); - - /* Make sure we really extracted something */ - if (NtSyscallName) { - - /* Add a new line */ - if (SyscallId > 0) fprintf(SyscallTable,",\n"); - - /* Write the syscall arguments in the argument table. */ - fprintf(SyscallTable,"\t\t%lu * sizeof(void *)",strtoul(SyscallArguments, NULL, 0)); - - /* Only increase if we actually added something */ - SyscallId++; - } - } - - /* Close the service table (C syntax) */ - fprintf(SyscallTable,"\n};\n"); - - /* - * We write some useful defines - */ - fprintf(SyscallTable, "\n\n#define MIN_SYSCALL_NUMBER 0\n"); - fprintf(SyscallTable, "#define MAX_SYSCALL_NUMBER %d\n", SyscallId - 1); - fprintf(SyscallTable, "#define NUMBER_OF_SYSCALLS %d\n", SyscallId); - fprintf(SyscallTable, "ULONG %sNumberOfSysCalls = %d;\n", Name, SyscallId); -} - -void usage(char * argv0) -{ - printf("Usage: %s sysfuncs.lst w32ksvc.db napi.h ssdt.h napi.S zw.S win32k.S win32k.S\n" - " sysfuncs.lst native system functions database\n" - " w32ksvc.db native graphic functions database\n" - " napi.h NTOSKRNL service table\n" - " ssdt.h WIN32K service table\n" - " napi.S NTDLL stubs\n" - " zw.S NTOSKRNL Zw stubs\n" - " win32k.S GDI32 stubs\n" - " win32k.S USER32 stubs\n", - argv0 - ); -} - -int main(int argc, char* argv[]) -{ - FILE * Files[Arguments]; - int FileNumber; - char * OpenType = "r"; - - /* Make sure all arguments all there */ - if (argc != Arguments + 1) { - usage(argv[0]); - return(1); - } - - /* Open all Output and bail out if any fail */ - for (FileNumber = 0; FileNumber < Arguments; FileNumber++) { - - /* Open the File */ - if (FileNumber == 2) OpenType = "wb"; - Files[FileNumber] = fopen(argv[FileNumber + 1], OpenType); - - /* Check for failure and error out if so */ - if (!Files[FileNumber]) { - perror(argv[FileNumber + 1]); - return (1); - } - - } - - /* Write the File Headers */ - WriteFileHeader(Files[NtosUserStubs], - "System Call Stubs for Native API", - argv[NtosUserStubs + 1]); - - WriteFileHeader(Files[NtosKernelStubs], - "System Call Stubs for Native API", - argv[NtosKernelStubs + 1]); - fputs("#include <internal/i386/segment.h>\n\n", Files[NtosKernelStubs]); - - WriteFileHeader(Files[Win32kGdiStubs], - "System Call Stubs for Native API", - argv[Win32kGdiStubs + 1]); - - WriteFileHeader(Files[Win32kUserStubs], - "System Call Stubs for Native API", - argv[Win32kUserStubs + 1]); - - - /* Create the System Stubs */ - CreateStubs(Files[NativeSystemDb], - &Files[NtosUserStubs], - Files[NtosKernelStubs], - MAIN_INDEX, - 1, - 1); - - /* Create the Graphics Stubs */ - CreateStubs(Files[NativeGuiDb], - &Files[Win32kGdiStubs], - NULL, - WIN32K_INDEX, - 2, - 0); - - /* Rewind the databases */ - rewind(Files[NativeSystemDb]); - rewind(Files[NativeGuiDb]); - - /* Create the Service Tables */ - CreateSystemServiceTable(Files[NativeSystemDb], - Files[NtosServiceTable], - "Main", - argv[NtosServiceTable + 1]); - - CreateSystemServiceTable(Files[NativeGuiDb], - Files[Win32kServiceTable], - "Win32k", - argv[Win32kServiceTable + 1]); - - /* Close all files */ - for (FileNumber = 0; FileNumber < Arguments; FileNumber++) { - - /* Close the File */ - fclose(Files[FileNumber]); - - } - - return(0); -} +/* + * FILE: tools/nci/ncitool.c + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: Native Call Interface Support Tool + * PURPOSE: Generates NCI Tables and Stubs. + * PROGRAMMER; Alex Ionescu (alex(a)relsoft.net) + * CHANGE HISTORY: 14/01/05 - Created. Based on original code by + * KJK::Hyperion and Emanuelle Aliberti. + * + */ + +/* INCLUDE ******************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <malloc.h> + +/* DEFINES ****************************************************************/ + +#define INPUT_BUFFER_SIZE 255 +#define Arguments 8 + +/******* Table Indexes ************/ +#define MAIN_INDEX 0x0 +#define WIN32K_INDEX 0x1000 + +/******* Argument List ************/ +/* First, define the Databases */ +#define NativeSystemDb 0 +#define NativeGuiDb 1 + +/* Now the Service Tables */ +#define NtosServiceTable 2 +#define Win32kServiceTable 3 + +/* And finally, the stub files. */ +#define NtosUserStubs 4 +#define NtosKernelStubs 5 +#define Win32kGdiStubs 6 +#define Win32kUserStubs 7 + +/********** Stub Code ************/ + +/* + * This stubs calls into KUSER_SHARED_DATA where either a + * sysenter or interrupt is performed, depending on CPU support. + */ +#if defined(__GNUC__) +#define UserModeStub_x86 " movl $0x%x, %%eax\n" \ + " movl $KUSER_SHARED_SYSCALL, %%ecx\n" \ + " call *%%ecx\n" \ + " ret $0x%x\n\n" +#elif defined(_MSC_VER) +#define UserModeStub_x86 " asm { \n" \ + " mov eax, %xh\n" \ + " mov ecx, KUSER_SHARED_SYSCALL\n" \ + " call [ecx]\n" \ + " ret %xh\n" \ + " }\n" +#else +#error Unknown compiler for inline assembler +#endif + +/* + * This stub calls KiSystemService directly with a fake INT2E stack. + * Because EIP is pushed during the call, the handler will return here. + */ +#if defined(__GNUC__) +#define KernelModeStub_x86 " movl $0x%x, %%eax\n" \ + " leal 4(%%esp), %%edx\n" \ + " pushfl\n" \ + " pushl $KERNEL_CS\n" \ + " call _KiSystemService\n" \ + " ret $0x%x\n\n" +#elif defined(_MSC_VER) +#define KernelModeStub_x86 " asm { \n" \ + " mov eax, %xh\n" \ + " lea edx, [esp+4]\n" \ + " pushf\n" \ + " push KERNEL_CS\n" \ + " call _KiSystemService\n" \ + " ret %xh\n" \ + " }\n" +#else +#error Unknown compiler for inline assembler +#endif + +/***** Arch Dependent Stuff ******/ +//#ifdef _M_IX86 +#define ARGS_TO_BYTES(x) x*4 +#define UserModeStub UserModeStub_x86 +#define KernelModeStub KernelModeStub_x86 + +//#elseif +//#error Unsupported Architecture +//#endif + +/* FUNCTIONS ****************************************************************/ + +/*++ + * WriteFileHeader + * + * Prints out the File Header for a Stub File. + * + * Params: + * StubFile - Stub File to which to write the header. + * + * FileDescription - Description of the Stub file to which to write the header. + * + * FileLocation - Name of the Stub file to which to write the header. + * + * Returns: + * None. + * + * Remarks: + * FileLocation is only used for printing the header. + * + *--*/ +void +WriteFileHeader(FILE * StubFile, + char* FileDescription, + char* FileLocation) +{ + /* This prints out the file header */ + fprintf(StubFile, + "/* FILE: %s\n" + " * COPYRIGHT: See COPYING in the top level directory\n" + " * PURPOSE: %s\n" + " * PROGRAMMER: Computer Generated File. See tools/nci/ncitool.c\n" + " * REMARK: DO NOT EDIT OR COMMIT MODIFICATIONS TO THIS FILE\n" + " */\n\n\n" + "#include <napi/shared_data.h>\n\n", + FileDescription, + FileLocation); +} + +/*++ + * WriteFileHeader + * + * Prints out the File Header for a Stub File. + * + * Params: + * StubFile - Stub File to which to write the header. + * + * FileDescription - Description of the Stub file to which to write the header. + * + * FileLocation - Name of the Stub file to which to write the header. + * + * Returns: + * None. + * + * Remarks: + * FileLocation is only used for printing the header. + * + *--*/ +void +WriteStubHeader(FILE* StubFile, + char* SyscallName, + unsigned StackBytes) +{ + /* Export the function */ + fprintf(StubFile, ".global _%s@%d\n", SyscallName, StackBytes); + + /* Define it */ + fprintf(StubFile, "_%s@%d:\n\n", SyscallName, StackBytes); +} + + +/*++ + * WriteKernelModeStub + * + * Prints out the Kernel Mode Stub for a System Call. + * + * Params: + * StubFile - Stub File to which to write the header. + * + * SyscallName - Name of System Call for which to add the stub. + * + * StackBytes - Number of bytes on the stack to return after doing the system call. + * + * SyscallId - Service Descriptor Table ID for this System Call. + * + * Returns: + * None. + * + * Remarks: + * On i386, StackBytes is the number of arguments x 4. + * + *--*/ +void +WriteKernelModeStub(FILE* StubFile, + char* SyscallName, + unsigned StackBytes, + unsigned int SyscallId) +{ + /* Write the Stub Header and export the Function */ + WriteStubHeader(StubFile, SyscallName, StackBytes); + + /* Write the Stub Code */ + fprintf(StubFile, KernelModeStub, SyscallId, StackBytes); +} + +/*++ + * WriteUserModeStub + * + * Prints out the User Mode Stub for a System Call. + * + * Params: + * StubFile - Stub File to which to write the header. + * + * SyscallName - Name of System Call for which to add the stub. + * + * StackBytes - Number of bytes on the stack to return after doing the system call. + * + * SyscallId - Service Descriptor Table ID for this System Call. + * + * Returns: + * None. + * + * Remarks: + * On i386, StackBytes is the number of arguments x 4. + * + *--*/ +void +WriteUserModeStub(FILE* StubFile, + char* SyscallName, + unsigned StackBytes, + unsigned int SyscallId) +{ + /* Write the Stub Header and export the Function */ + WriteStubHeader(StubFile, SyscallName, StackBytes); + + /* Write the Stub Code */ + fprintf(StubFile, UserModeStub, SyscallId, StackBytes); +} + +/*++ + * GetNameAndArgumentsFromDb + * + * Parses an entry from a System Call Database, extracting + * the function's name and arguments that it takes. + * + * Params: + * Line - Entry from the Database to parse. + * + * NtSyscallName - Output string to which to save the Function Name + * + * SyscallArguments - Output string to which to save the number of + * arguments that the function takes. + * + * Returns: + * None. + * + * Remarks: + * On i386, StackBytes is the number of arguments x 4. + * + *--*/ +void +GetNameAndArgumentsFromDb(char Line[], + char ** NtSyscallName, + char ** SyscallArguments) +{ + char *s; + char *stmp; + + /* Remove new line */ + if ((s = (char *) strchr(Line,'\r')) != NULL) { + *s = '\0'; + } + + /* Skip comments (#) and empty lines */ + s = &Line[0]; + if ((*s) != '#' && (*s) != '\0') { + + /* Extract the NtXXX name */ + *NtSyscallName = (char *)strtok(s," \t"); + + /* Extract the argument count */ + *SyscallArguments = (char *)strtok(NULL," \t"); + + /* Remove, if present, the trailing LF */ + if ((stmp = strchr(*SyscallArguments, '\n')) != NULL) { + *stmp = '\0'; + } + + } else { + + /* Skip this entry */ + *NtSyscallName = NULL; + } +} + +/*++ + * CreateStubs + * + * Parses a System Call Database and creates stubs for all the entries. + * + * Params: + * SyscallDb - System Call Database to parse. + * + * UserModeFiles - Array of Usermode Stub Files to which to write the stubs. + * + * KernelModeFile - Kernelmode Stub Files to which to write the stubs. + * + * Index - Name of System Call for which to add the stub. + * + * UserFiles - Number of bytes on the stack to return after doing the system call. + * + * NeedsZw - Service Descriptor Table ID for this System Call. + * + * Returns: + * None. + * + * Remarks: + * None. + * + *--*/ +void +CreateStubs(FILE * SyscallDb, + FILE * UserModeFiles[], + FILE * KernelModeFile, + unsigned Index, + unsigned UserFiles, + unsigned NeedsZw) +{ + char Line[INPUT_BUFFER_SIZE]; + char *NtSyscallName; + char *ZwSyscallName = NULL; + char *SyscallArguments; + int SyscallId; + unsigned StackBytes; + + /* We loop, incrementing the System Call Index, until the end of the file */ + for (SyscallId = 0; ((!feof(SyscallDb)) && (fgets(Line, sizeof(Line), SyscallDb) != NULL));) { + + /* Extract the Name and Arguments */ + GetNameAndArgumentsFromDb(Line, &NtSyscallName, &SyscallArguments); + StackBytes = ARGS_TO_BYTES(strtoul(SyscallArguments, NULL, 0)); + + /* Make sure we really extracted something */ + if (NtSyscallName) { + + /* Create the ZwXXX name, if requested */ + if (NeedsZw) { + ZwSyscallName = alloca(strlen(NtSyscallName)); + strcpy(ZwSyscallName, NtSyscallName); + ZwSyscallName[0] = 'Z'; + ZwSyscallName[1] = 'w'; + } + + /* Create Usermode Stubs for Nt/Zw syscalls in each Usermode file */ + int i; + for (i= 0; i < UserFiles; i++) { + + /* Write the Nt Version */ + WriteUserModeStub(UserModeFiles[i], + NtSyscallName, + StackBytes, + SyscallId | Index); + + /* If a Zw Version is needed (was specified), write it too */ + if (ZwSyscallName) WriteUserModeStub(UserModeFiles[i], + ZwSyscallName, + StackBytes, + SyscallId | Index); + + } + + /* Create the Kernel coutnerparts (only Zw*, Nt* are the real functions!) */ + if (KernelModeFile) WriteKernelModeStub(KernelModeFile, + ZwSyscallName, + StackBytes, + SyscallId | Index); + + /* Only increase if we actually added something */ + SyscallId++; + } + } +} + +/*++ + * CreateSystemServiceTable + * + * Parses a System Call Database and creates a System Call Service Table for it. + * + * Params: + * SyscallDb - System Call Database to parse. + * + * SyscallTable - File in where to create System Call Service Table. + * + * Name - Name of the Service Table. + * + * FileLocation - Filename containing the Table. + * + * Returns: + * None. + * + * Remarks: + * FileLocation is only used for the header generation. + * + *--*/ +void +CreateSystemServiceTable(FILE *SyscallDb, + FILE *SyscallTable, + char * Name, + char * FileLocation) +{ + char Line[INPUT_BUFFER_SIZE]; + char *NtSyscallName; [truncated at 1000 lines; 183 more skipped]
19 years, 10 months
1
0
0
0
[sedwards] 13116: added cabinet, msi and msiexec to the Makefile. This gets IE, Office and friends a little further along
by sedwards@svn.reactos.com
added cabinet,msi and msiexec to the Makefile. This gets IE, Office and friends a little further along Modified: trunk/reactos/Makefile _____ Modified: trunk/reactos/Makefile --- trunk/reactos/Makefile 2005-01-18 04:41:17 UTC (rev 13115) +++ trunk/reactos/Makefile 2005-01-18 05:52:54 UTC (rev 13116) @@ -57,7 +57,7 @@ # libpcap packet epsapi DLLS = acledit aclui advapi32 advpack cabinet cards comctl32 crtdll comdlg32 d3d8thk dbghelp expat fmifs freetype \ gdi32 gdiplus glu32 hid imagehlp imm32 iphlpapi kernel32 lzexpand mesa32 midimap mmdrv mpr msacm msafd \ - msgina msimg32 msvcrt20 msvideo mswsock netapi32 ntdll ole32 oleaut32 oledlg olepro32 opengl32 \ + msgina msi msimg32 msvcrt20 msvideo mswsock netapi32 ntdll ole32 oleaut32 oledlg olepro32 opengl32 \ packet psapi riched20 richedit rpcrt4 samlib secur32 setupapi shell32 shlwapi snmpapi syssetup twain \ unicode user32 userenv version wininet winmm winspool ws2help ws2_32 wsock32 wshirda dnsapi \ urlmon shdocvw dinput dinput8 dxdiagn devenum dsound $(DLLS_KBD) $(DLLS_CPL) $(DLLS_SHELLEXT) @@ -100,7 +100,7 @@ # System applications # autochk cmd format services setup usetup welcome winlogon msiexec -SYS_APPS = autochk calc cmd explorer expand format regedt32 regsvr32 \ +SYS_APPS = autochk calc cmd explorer expand format msiexec regedt32 regsvr32 \ reporterror services setup taskmgr userinit usetup welcome vmwinst \ winlogon regedit winefile notepad reactos
19 years, 10 months
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
29
...
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