From 9017f3f4f682e4e8ef9b506464e1dd1b3c135810 Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Sun, 15 May 2005 11:58:48 +0000 Subject: [PATCH] Generate hooks and stubs for tests svn path=/branches/xmlbuildsystem/; revision=15304 --- reactos/lib/kernel32/kernel32.xml | 34 ++-- reactos/lib/kernel32/tests/tests/CreateFile.c | 12 +- reactos/tools/rbuild/backend/mingw/mingw.cpp | 64 ++---- reactos/tools/rbuild/backend/mingw/mingw.h | 13 +- reactos/tools/rbuild/filesupportcode.cpp | 68 +++++++ reactos/tools/rbuild/project.cpp | 108 +++++----- reactos/tools/rbuild/rbuild.h | 56 +++++- reactos/tools/rbuild/rbuild.mak | 10 + reactos/tools/rbuild/stubbedcomponent.cpp | 19 ++ reactos/tools/rbuild/testsupportcode.cpp | 190 ++++++++++++++++++ reactos/tools/rbuild/wineresource.cpp | 2 +- 11 files changed, 426 insertions(+), 150 deletions(-) create mode 100644 reactos/tools/rbuild/filesupportcode.cpp create mode 100644 reactos/tools/rbuild/testsupportcode.cpp diff --git a/reactos/lib/kernel32/kernel32.xml b/reactos/lib/kernel32/kernel32.xml index 315f50f5177..d62f7119a69 100644 --- a/reactos/lib/kernel32/kernel32.xml +++ b/reactos/lib/kernel32/kernel32.xml @@ -1,3 +1,19 @@ + + + . + include + + + 0x0500 + kernel32_base + pseh + rosrtl + ntdll + -lgcc + -nostartfiles + -nostdlib + kernel32.rc + . include @@ -104,24 +120,8 @@ tls.c - - - . - include - - - 0x0500 - kernel32_base - pseh - rosrtl - ntdll - -lgcc - -nostartfiles - -nostdlib - kernel32.rc - +--> \ No newline at end of file diff --git a/reactos/lib/kernel32/tests/tests/CreateFile.c b/reactos/lib/kernel32/tests/tests/CreateFile.c index 96b7426d7ca..efbe9dc5fd7 100644 --- a/reactos/lib/kernel32/tests/tests/CreateFile.c +++ b/reactos/lib/kernel32/tests/tests/CreateFile.c @@ -12,11 +12,11 @@ typedef struct { LPCWSTR lpFileName; DWORD dwDesiredAccess; - DWORD dwShareMode; - LPSECURITY_ATTRIBUTES lpSecurityAttributes; - DWORD dwCreationDisposition; - DWORD dwFlagsAndAttributes; - HANDLE hTemplateFile; + DWORD dwShareMode; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + DWORD dwCreationDisposition; + DWORD dwFlagsAndAttributes; + HANDLE hTemplateFile; } CreateFile_PARAMETERS; typedef struct @@ -93,7 +93,7 @@ MockNtCreateFile(PHANDLE FileHandle, static HOOK NtCreateFileHooks[] = { {"NtCreateFile", MockNtCreateFile}, - NULL, NULL + {NULL, NULL} }; static void TestFile() diff --git a/reactos/tools/rbuild/backend/mingw/mingw.cpp b/reactos/tools/rbuild/backend/mingw/mingw.cpp index 4b5fbb650e0..65c7b82dcc1 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@ -41,18 +41,6 @@ v2s ( const string_list& v, int wrap_at ) } -/* static */ string -Environment::GetVariable ( const string& name ) -{ - char* value = getenv ( name.c_str () ); - if ( value != NULL && strlen ( value ) > 0 ) - return ssprintf ( "%s", - value ); - else - return ""; -} - - Directory::Directory ( const string& name_ ) : name(name_) { @@ -131,45 +119,13 @@ Directory::ReplaceVariable ( string name, return path; } -/* static */ string -Directory::GetEnvironmentVariablePathOrDefault ( const string& name, - const string& defaultValue ) -{ - const string& environmentVariableValue = Environment::GetVariable ( name ); - if ( environmentVariableValue.length () > 0 ) - return NormalizeFilename ( environmentVariableValue ); - else - return defaultValue; -} - -/* static */ string -Directory::GetIntermediatePath () -{ - return GetEnvironmentVariablePathOrDefault ( "ROS_INTERMEDIATE", - "obj-i386" ); -} - -/* static */ string -Directory::GetOutputPath () -{ - return GetEnvironmentVariablePathOrDefault ( "ROS_OUTPUT", - "output-i386" ); -} - -/* static */ string -Directory::GetInstallPath () -{ - return GetEnvironmentVariablePathOrDefault ( "ROS_INSTALL", - "reactos" ); -} - void Directory::ResolveVariablesInPath ( char* buf, string path ) { - string s = ReplaceVariable ( "$(INTERMEDIATE)", GetIntermediatePath (), path ); - s = ReplaceVariable ( "$(OUTPUT)", GetOutputPath (), s ); - s = ReplaceVariable ( "$(INSTALL)", GetInstallPath (), s ); + string s = ReplaceVariable ( "$(INTERMEDIATE)", Environment::GetIntermediatePath (), path ); + s = ReplaceVariable ( "$(OUTPUT)", Environment::GetOutputPath (), s ); + s = ReplaceVariable ( "$(INSTALL)", Environment::GetInstallPath (), s ); strcpy ( buf, s.c_str () ); } @@ -217,7 +173,7 @@ Directory::EscapeSpaces ( string path ) void Directory::CreateRule ( FILE* f, - const string& parent ) + const string& parent ) { string path; @@ -356,6 +312,7 @@ MingwBackend::Process () GenerateDirectoryTargets (); GenerateDirectories (); UnpackWineResources (); + GenerateTestSupportCode (); CheckAutomaticDependencies (); CloseMakefile (); } @@ -641,7 +598,7 @@ MingwBackend::GenerateXmlBuildFilesMacro() const string MingwBackend::GetBin2ResExecutable () { - return NormalizeFilename ( Directory::GetOutputPath () + SSEP + "tools/bin2res/bin2res" + EXEPOSTFIX ); + return NormalizeFilename ( Environment::GetOutputPath () + SSEP + "tools/bin2res/bin2res" + EXEPOSTFIX ); } void @@ -654,6 +611,15 @@ MingwBackend::UnpackWineResources () printf ( "done\n" ); } +void +MingwBackend::GenerateTestSupportCode () +{ + printf ( "Generating test support code..." ); + TestSupportCode testSupportCode ( ProjectNode ); + testSupportCode.GenerateTestSupportCode ( verbose ); + printf ( "done\n" ); +} + void MingwBackend::CheckAutomaticDependencies () { diff --git a/reactos/tools/rbuild/backend/mingw/mingw.h b/reactos/tools/rbuild/backend/mingw/mingw.h index 437023d28af..02be559787e 100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.h +++ b/reactos/tools/rbuild/backend/mingw/mingw.h @@ -18,13 +18,6 @@ v2s ( const string_list& v, int wrap_at ); typedef std::map directory_map; -class Environment -{ -public: - static std::string GetVariable ( const std::string& name ); -}; - - class Directory { public: @@ -37,17 +30,12 @@ public: std::string EscapeSpaces ( std::string path ); void CreateRule ( FILE* f, const std::string& parent ); - static std::string GetIntermediatePath (); - static std::string GetOutputPath (); - static std::string GetInstallPath (); private: bool mkdir_p ( const char* path ); std::string ReplaceVariable ( std::string name, std::string value, std::string path ); std::string GetEnvironmentVariable ( const std::string& name ); - static std::string GetEnvironmentVariablePathOrDefault ( const std::string& name, - const std::string& defaultValue ); void ResolveVariablesInPath ( char* buf, std::string path ); bool CreateDirectory ( std::string path ); @@ -92,6 +80,7 @@ private: void GenerateXmlBuildFilesMacro() const; std::string GetBin2ResExecutable (); void UnpackWineResources (); + void GenerateTestSupportCode (); void CheckAutomaticDependencies (); bool IncludeDirectoryTarget ( const std::string& directory ) const; bool TryToDetectThisCompiler ( const std::string& compiler ); diff --git a/reactos/tools/rbuild/filesupportcode.cpp b/reactos/tools/rbuild/filesupportcode.cpp new file mode 100644 index 00000000000..249f4eb5faf --- /dev/null +++ b/reactos/tools/rbuild/filesupportcode.cpp @@ -0,0 +1,68 @@ +#include "pch.h" +#include + +#include "rbuild.h" + +using std::string; + +/* static */ void +FileSupportCode::WriteIfChanged ( char* outbuf, + string filename ) +{ + FILE* out; + unsigned int end; + char* cmpbuf; + unsigned int stat; + + out = fopen ( filename.c_str (), "rb" ); + if ( out == NULL ) + { + out = fopen ( filename.c_str (), "wb" ); + if ( out == NULL ) + throw AccessDeniedException ( filename ); + fputs ( outbuf, out ); + fclose ( out ); + return; + } + + fseek ( out, 0, SEEK_END ); + end = ftell ( out ); + cmpbuf = (char*) malloc ( end ); + if ( cmpbuf == NULL ) + { + fclose ( out ); + throw OutOfMemoryException (); + } + + fseek ( out, 0, SEEK_SET ); + stat = fread ( cmpbuf, 1, end, out ); + if ( stat != end ) + { + free ( cmpbuf ); + fclose ( out ); + throw AccessDeniedException ( filename ); + } + if ( end == strlen ( outbuf ) && memcmp ( cmpbuf, outbuf, end ) == 0 ) + { + free ( cmpbuf ); + fclose ( out ); + return; + } + + free ( cmpbuf ); + fclose ( out ); + out = fopen ( filename.c_str (), "wb" ); + if ( out == NULL ) + { + throw AccessDeniedException ( filename ); + } + + stat = fwrite ( outbuf, 1, strlen ( outbuf ), out); + if ( strlen ( outbuf ) != stat ) + { + fclose ( out ); + throw AccessDeniedException ( filename ); + } + + fclose ( out ); +} diff --git a/reactos/tools/rbuild/project.cpp b/reactos/tools/rbuild/project.cpp index 453268cace0..3b64b41cc45 100644 --- a/reactos/tools/rbuild/project.cpp +++ b/reactos/tools/rbuild/project.cpp @@ -7,6 +7,50 @@ using std::string; using std::vector; +/* static */ string +Environment::GetVariable ( const string& name ) +{ + char* value = getenv ( name.c_str () ); + if ( value != NULL && strlen ( value ) > 0 ) + return ssprintf ( "%s", + value ); + else + return ""; +} + +/* static */ string +Environment::GetEnvironmentVariablePathOrDefault ( const string& name, + const string& defaultValue ) +{ + const string& environmentVariableValue = Environment::GetVariable ( name ); + if ( environmentVariableValue.length () > 0 ) + return NormalizeFilename ( environmentVariableValue ); + else + return defaultValue; +} + +/* static */ string +Environment::GetIntermediatePath () +{ + return GetEnvironmentVariablePathOrDefault ( "ROS_INTERMEDIATE", + "obj-i386" ); +} + +/* static */ string +Environment::GetOutputPath () +{ + return GetEnvironmentVariablePathOrDefault ( "ROS_OUTPUT", + "output-i386" ); +} + +/* static */ string +Environment::GetInstallPath () +{ + return GetEnvironmentVariablePathOrDefault ( "ROS_INSTALL", + "reactos" ); +} + + Project::Project ( const string& filename ) : xmlfile (filename), node (NULL), @@ -41,68 +85,6 @@ Project::LookupProperty ( const string& name ) const return NULL; } -void -Project::WriteIfChanged ( char* outbuf, - string filename ) -{ - FILE* out; - unsigned int end; - char* cmpbuf; - unsigned int stat; - - out = fopen ( filename.c_str (), "rb" ); - if ( out == NULL ) - { - out = fopen ( filename.c_str (), "wb" ); - if ( out == NULL ) - throw AccessDeniedException ( filename ); - fputs ( outbuf, out ); - fclose ( out ); - return; - } - - fseek ( out, 0, SEEK_END ); - end = ftell ( out ); - cmpbuf = (char*) malloc ( end ); - if ( cmpbuf == NULL ) - { - fclose ( out ); - throw OutOfMemoryException (); - } - - fseek ( out, 0, SEEK_SET ); - stat = fread ( cmpbuf, 1, end, out ); - if ( stat != end ) - { - free ( cmpbuf ); - fclose ( out ); - throw AccessDeniedException ( filename ); - } - if ( end == strlen ( outbuf ) && memcmp ( cmpbuf, outbuf, end ) == 0 ) - { - free ( cmpbuf ); - fclose ( out ); - return; - } - - free ( cmpbuf ); - fclose ( out ); - out = fopen ( filename.c_str (), "wb" ); - if ( out == NULL ) - { - throw AccessDeniedException ( filename ); - } - - stat = fwrite ( outbuf, 1, strlen ( outbuf ), out); - if ( strlen ( outbuf ) != stat ) - { - fclose ( out ); - throw AccessDeniedException ( filename ); - } - - fclose ( out ); -} - void Project::SetConfigurationOption ( char* s, string name, @@ -161,7 +143,7 @@ Project::WriteConfigurationFile () s = s + sprintf ( s, "#endif /* __INCLUDE_CONFIG_H */\n" ); - WriteIfChanged ( buf, "include" SSEP "roscfg.h" ); + FileSupportCode::WriteIfChanged ( buf, "include" SSEP "roscfg.h" ); free ( buf ); } diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index e5716893044..8192e8fe1cb 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -55,6 +55,7 @@ class If; class CompilerFlag; class LinkerFlag; class Property; +class TestSupportCode; class WineResource; class AutomaticDependency; class Bootstrap; @@ -66,6 +67,25 @@ class StubbedSymbol; class SourceFileTest; + +class Environment +{ +public: + static std::string GetVariable ( const std::string& name ); + static std::string GetIntermediatePath (); + static std::string GetOutputPath (); + static std::string GetInstallPath (); + static std::string GetEnvironmentVariablePathOrDefault ( const std::string& name, + const std::string& defaultValue ); +}; + +class FileSupportCode +{ +public: + static void WriteIfChanged ( char* outbuf, + std::string filename ); +}; + class IfableData { public: @@ -110,8 +130,6 @@ private: std::string* alternativeName ); void SetConfigurationOption ( char* s, std::string name ); - void WriteIfChanged ( char* outbuf, - std::string filename ); void ReadXml (); void ProcessXMLSubElement ( const XMLElement& e, const std::string& path, @@ -422,6 +440,37 @@ public: }; +class TestSupportCode +{ +public: + const Project& project; + + TestSupportCode ( const Project& project ); + ~TestSupportCode (); + void GenerateTestSupportCode ( bool verbose ); +private: + bool IsTestModule ( const Module& module ); + void GenerateTestSupportCodeForModule ( Module& module, + bool verbose ); + std::string GetHooksFilename ( Module& module ); + char* WriteStubbedSymbolToHooksFile ( char* buffer, + const StubbedComponent& component, + const StubbedSymbol& symbol ); + char* WriteStubbedComponentToHooksFile ( char* buffer, + const StubbedComponent& component ); + void WriteHooksFile ( Module& module ); + std::string GetStubsFilename ( Module& module ); + char* WriteStubbedSymbolToStubsFile ( char* buffer, + const StubbedComponent& component, + const StubbedSymbol& symbol, + int stubIndex ); + char* WriteStubbedComponentToStubsFile ( char* buffer, + const StubbedComponent& component, + int* stubIndex ); + void WriteStubsFile ( Module& module ); +}; + + class WineResource { public: @@ -610,10 +659,13 @@ public: const XMLElement& node; std::string symbol; std::string newname; + std::string strippedName; StubbedSymbol ( const XMLElement& stubbedSymbolNode ); ~StubbedSymbol (); void ProcessXML(); +private: + std::string StripSymbol ( std::string symbol ); }; extern std::string diff --git a/reactos/tools/rbuild/rbuild.mak b/reactos/tools/rbuild/rbuild.mak index 33d052b95b2..8d19202c85f 100644 --- a/reactos/tools/rbuild/rbuild.mak +++ b/reactos/tools/rbuild/rbuild.mak @@ -116,6 +116,7 @@ RBUILD_COMMON_SOURCES = \ compilerflag.cpp \ define.cpp \ exception.cpp \ + filesupportcode.cpp \ include.cpp \ installfile.cpp \ linkerflag.cpp \ @@ -123,6 +124,7 @@ RBUILD_COMMON_SOURCES = \ project.cpp \ ssprintf.cpp \ stubbedcomponent.cpp \ + testsupportcode.cpp \ wineresource.cpp \ XML.cpp \ ) @@ -230,6 +232,10 @@ $(RBUILD_INT_)exception.o: $(RBUILD_BASE_)exception.cpp $(RBUILD_HEADERS) | $(RB $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ +$(RBUILD_INT_)filesupportcode.o: $(RBUILD_BASE_)filesupportcode.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) + $(ECHO_CC) + ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ + $(RBUILD_INT_)include.o: $(RBUILD_BASE_)include.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ @@ -266,6 +272,10 @@ $(RBUILD_INT_)wineresource.o: $(RBUILD_BASE_)wineresource.cpp $(RBUILD_HEADERS) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ +$(RBUILD_INT_)testsupportcode.o: $(RBUILD_BASE_)testsupportcode.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) + $(ECHO_CC) + ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ + $(RBUILD_INT_)XML.o: $(RBUILD_BASE_)XML.cpp $(RBUILD_HEADERS) | $(RBUILD_INT) $(ECHO_CC) ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@ diff --git a/reactos/tools/rbuild/stubbedcomponent.cpp b/reactos/tools/rbuild/stubbedcomponent.cpp index 5d65716bee9..5a71e902c25 100644 --- a/reactos/tools/rbuild/stubbedcomponent.cpp +++ b/reactos/tools/rbuild/stubbedcomponent.cpp @@ -77,4 +77,23 @@ StubbedSymbol::ProcessXML () newname = att->value; else newname = symbol; + + strippedName = StripSymbol ( symbol ); +} + +string +StubbedSymbol::StripSymbol ( string symbol ) +{ + size_t start = 0; + while ( start < symbol.length () && symbol[start] == '@') + start++; + size_t end = symbol.length () - 1; + while ( end > 0 && isdigit ( symbol[end] ) ) + end--; + if ( end > 0 and symbol[end] == '@' ) + end--; + if ( end > 0 ) + return symbol.substr ( start, end - start + 1 ); + else + return ""; } diff --git a/reactos/tools/rbuild/testsupportcode.cpp b/reactos/tools/rbuild/testsupportcode.cpp new file mode 100644 index 00000000000..4c1860a4d94 --- /dev/null +++ b/reactos/tools/rbuild/testsupportcode.cpp @@ -0,0 +1,190 @@ +#include "pch.h" +#include + +#include "rbuild.h" + +using std::string; +using std::vector; + +TestSupportCode::TestSupportCode ( const Project& project ) + : project ( project ) +{ +} + +TestSupportCode::~TestSupportCode () +{ +} + +bool +TestSupportCode::IsTestModule ( const Module& module ) +{ + return module.type == Test; +} + +void +TestSupportCode::GenerateTestSupportCode ( bool verbose ) +{ + for ( size_t i = 0; i < project.modules.size (); i++ ) + { + if ( IsTestModule ( *project.modules[i] ) ) + { + GenerateTestSupportCodeForModule ( *project.modules[i], + verbose ); + } + } +} + +void +TestSupportCode::GenerateTestSupportCodeForModule ( Module& module, + bool verbose ) +{ + if ( verbose ) + { + printf ( "\nGenerating test support code for %s", + module.name.c_str () ); + } + + WriteHooksFile ( module ); + WriteStubsFile ( module ); +} + +string +TestSupportCode::GetHooksFilename ( Module& module ) +{ + return NormalizeFilename ( Environment::GetIntermediatePath () + SSEP + module.GetBasePath () + SSEP + "_hooks.c" ); +} + +char* +TestSupportCode::WriteStubbedSymbolToHooksFile ( char* buffer, + const StubbedComponent& component, + const StubbedSymbol& symbol ) +{ + buffer = buffer + sprintf ( buffer, + " {\"%s\", \"%s\", NULL, NULL, NULL},\n", + component.name.c_str (), + symbol.strippedName.c_str () ); + return buffer; +} + +char* +TestSupportCode::WriteStubbedComponentToHooksFile ( char* buffer, + const StubbedComponent& component ) +{ + for ( size_t i = 0; i < component.symbols.size () ; i++ ) + buffer = WriteStubbedSymbolToHooksFile ( buffer, + component, + *component.symbols[i] ); + return buffer; +} + +void +TestSupportCode::WriteHooksFile ( Module& module ) +{ + char* buf; + char* s; + + buf = (char*) malloc ( 50*1024 ); + if ( buf == NULL ) + throw OutOfMemoryException (); + + s = buf; + s = s + sprintf ( s, "/* This file is automatically generated. */\n" ); + s = s + sprintf ( s, "#include \n" ); + s = s + sprintf ( s, "#include \"regtests.h\"\n" ); + s = s + sprintf ( s, "\n" ); + s = s + sprintf ( s, "API_DESCRIPTION ExternalDependencies[] =\n" ); + s = s + sprintf ( s, "{\n" ); + + int symbolCount = 0; + for ( size_t i = 0; i < module.stubbedComponents.size () ; i++ ) + { + s = WriteStubbedComponentToHooksFile ( s, + *module.stubbedComponents[i] ); + symbolCount += module.stubbedComponents[i]->symbols.size (); + } + + s = s + sprintf ( s, "};\n" ); + s = s + sprintf ( s, "\n" ); + s = s + sprintf ( s, "#define ExternalDependencyCount %d\n", symbolCount ); + s = s + sprintf ( s, "ULONG MaxExternalDependency = ExternalDependencyCount - 1;\n" ); + s = s + sprintf ( s, "\n" ); + + FileSupportCode::WriteIfChanged ( buf, GetHooksFilename ( module ) ); + + free ( buf ); +} + +string +TestSupportCode::GetStubsFilename ( Module& module ) +{ + return NormalizeFilename ( Environment::GetIntermediatePath () + SSEP + module.GetBasePath () + SSEP + "_stubs.S" ); +} + +char* +TestSupportCode::WriteStubbedSymbolToStubsFile ( char* buffer, + const StubbedComponent& component, + const StubbedSymbol& symbol, + int stubIndex ) +{ + buffer = buffer + sprintf ( buffer, + ".globl _%s\n", + symbol.symbol.c_str () ); + buffer = buffer + sprintf ( buffer, + "_%s:\n", + symbol.symbol.c_str () ); + buffer = buffer + sprintf ( buffer, + " pushl $%d\n", + stubIndex ); + buffer = buffer + sprintf ( buffer, + " jmp passthrough\n" ); + buffer = buffer + sprintf ( buffer, "\n" ); + return buffer; +} + +char* +TestSupportCode::WriteStubbedComponentToStubsFile ( char* buffer, + const StubbedComponent& component, + int* stubIndex ) +{ + for ( size_t i = 0; i < component.symbols.size () ; i++ ) + buffer = WriteStubbedSymbolToStubsFile ( buffer, + component, + *component.symbols[i], + (*stubIndex)++ ); + return buffer; +} + +void +TestSupportCode::WriteStubsFile ( Module& module ) +{ + char* buf; + char* s; + + buf = (char*) malloc ( 50*1024 ); + if ( buf == NULL ) + throw OutOfMemoryException (); + + s = buf; + s = s + sprintf ( s, "/* This file is automatically generated. */\n" ); + s = s + sprintf ( s, "passthrough:\n" ); + s = s + sprintf ( s, " call _FrameworkGetHook@4\n" ); + s = s + sprintf ( s, " test %%eax, %%eax\n" ); + s = s + sprintf ( s, " je .return\n" ); + s = s + sprintf ( s, " jmp *%%eax\n" ); + s = s + sprintf ( s, ".return:\n" ); + s = s + sprintf ( s, " /* This will most likely corrupt the stack */\n" ); + s = s + sprintf ( s, " ret\n" ); + s = s + sprintf ( s, "\n" ); + + int stubIndex = 0; + for ( size_t i = 0; i < module.stubbedComponents.size () ; i++ ) + { + s = WriteStubbedComponentToStubsFile ( s, + *module.stubbedComponents[i], + &stubIndex ); + } + + FileSupportCode::WriteIfChanged ( buf, GetStubsFilename ( module ) ); + + free ( buf ); +} diff --git a/reactos/tools/rbuild/wineresource.cpp b/reactos/tools/rbuild/wineresource.cpp index f031c57f952..cd04ea3aa7c 100644 --- a/reactos/tools/rbuild/wineresource.cpp +++ b/reactos/tools/rbuild/wineresource.cpp @@ -82,7 +82,7 @@ WineResource::UnpackResourcesInModule ( Module& module, if ( verbose ) { - printf ( "Unpacking resources for %s", + printf ( "\nUnpacking resources for %s", module.name.c_str () ); }