diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 83dfdf64ef2..f85e32bd872 100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@ -2302,7 +2302,7 @@ MingwKernelModuleHandler::GenerateKernelModuleTarget () string linkerParameters = ssprintf ( "-Wl,-T,%s%cntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared", module.GetBasePath ().c_str (), cSep, - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, "${gcc}", @@ -2389,7 +2389,7 @@ MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget () string dependencies = linkDepsMacro + " " + objectsMacro; string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared", - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, "${gcc}", @@ -2437,7 +2437,7 @@ MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget () string dependencies = linkDepsMacro + " " + objectsMacro; string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -shared", - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, "${gcc}", @@ -2484,7 +2484,7 @@ MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget () string dependencies = linkDepsMacro + " " + objectsMacro; string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -shared", - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, "${gcc}", @@ -2531,7 +2531,7 @@ MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget () string dependencies = linkDepsMacro + " " + objectsMacro; string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib", - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, "${gcc}", @@ -2584,7 +2584,7 @@ MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget () linker = "${gcc}"; string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -shared", - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, linker, @@ -2637,7 +2637,7 @@ MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget () linker = "${gcc}"; string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000", - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, linker, @@ -2690,7 +2690,7 @@ MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget () linker = "${gcc}"; string linkerParameters = ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000", - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, linker, @@ -3255,7 +3255,7 @@ MingwTestModuleHandler::GenerateTestModuleTarget () linker = "${gcc}"; string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000", - module.entrypoint.c_str (), + module.GetEntryPoint(true).c_str (), module.baseaddress.c_str () ); GenerateLinkerCommand ( dependencies, linker, diff --git a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp index c6bcf36a53f..fb137d24f0e 100644 --- a/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp +++ b/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp @@ -393,7 +393,7 @@ MSVCBackend::_generate_vcproj ( const Module& module ) fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" ); fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 ); fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 ); - fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint == "" ? "DriverEntry" : module.entrypoint.c_str ()); + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint(false) == "" ? "DriverEntry" : module.GetEntryPoint(false).c_str ()); fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str ()); } else if ( exe ) @@ -424,7 +424,7 @@ MSVCBackend::_generate_vcproj ( const Module& module ) } else if ( dll ) { - fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.entrypoint == "" ? "DllMain" : module.entrypoint.c_str ()); + fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint(false) == "" ? "DllMain" : module.GetEntryPoint(false).c_str ()); fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str ()); } fprintf ( OUT, "\t\t\t\tTargetMachine=\"%d\"/>\r\n", 1 ); diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp index 41425a2b75f..8c642a6fba6 100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@ -825,29 +825,29 @@ Module::GetDefaultModuleEntrypoint () const switch ( type ) { case Kernel: - return "_NtProcessStartup"; + return "NtProcessStartup"; case KernelModeDLL: case KernelModeDriver: case ExportDriver: - return "_DriverEntry@8"; + return "DriverEntry@8"; case NativeDLL: - return "_DllMainCRTStartup@12"; + return "DllMainCRTStartup@12"; case NativeCUI: - return "_NtProcessStartup@4"; + return "NtProcessStartup@4"; case Win32DLL: - return "_DllMain@12"; + return "DllMain@12"; case Win32CUI: case Test: if ( isUnicode ) - return "_wmainCRTStartup"; + return "wmainCRTStartup"; else - return "_mainCRTStartup"; + return "mainCRTStartup"; case Win32SCR: case Win32GUI: if ( isUnicode ) - return "_wWinMainCRTStartup"; + return "wWinMainCRTStartup"; else - return "_WinMainCRTStartup"; + return "WinMainCRTStartup"; case BuildTool: case StaticLibrary: case ObjectLibrary: @@ -1038,6 +1038,17 @@ Module::GetInvocationTarget ( const int index ) const index ); } +string +Module::GetEntryPoint(bool leadingUnderscore) const +{ + string result = ""; + if (leadingUnderscore) + result = "_"; + + result += entrypoint; + return result; +} + bool Module::HasFileWithExtension ( const IfableData& data, diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 685c576d957..ab5c761f69e 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -285,7 +285,6 @@ public: std::string name; std::string guid; std::string extension; - std::string entrypoint; std::string baseaddress; std::string payload; std::string path; @@ -328,6 +327,7 @@ public: std::string GetPath () const; // "path/foo.exe" std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe" std::string GetPathToBaseDir() const; // "../" offset to rootdirectory + std::string GetEntryPoint(bool leadingUnderscore) const; void GetTargets ( string_list& ) const; std::string GetInvocationTarget ( const int index ) const; bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const; @@ -339,6 +339,7 @@ private: std::string GetDefaultModuleExtension () const; std::string GetDefaultModuleEntrypoint () const; std::string GetDefaultModuleBaseaddress () const; + std::string entrypoint; void ProcessXMLSubElement ( const XMLElement& e, const std::string& path, ParseContext& parseContext );