diff options
56 files changed, 782 insertions, 210 deletions
diff --git a/agent/Makefile.inc b/agent/Makefile.inc index f568a1a8..4f5a3d5d 100644 --- a/agent/Makefile.inc +++ b/agent/Makefile.inc @@ -21,7 +21,10 @@ else endif ifeq ($(OPSYS),Windows) - CC = @$(TCF_AGENT_DIR)/bin/mcc -p $(BINDIR)/agent.pdb + CC = @$(TCF_AGENT_DIR)/bin/mcc -p $(BINDIR)/agent.pdb -m $(MACHINE) + AR = @$(TCF_AGENT_DIR)/bin/mlb -m $(MACHINE) + AR_FLAGS = + AR_OUT_F = EXTOBJ = .obj EXTLIB = .lib EXTEXE = .exe @@ -128,7 +131,7 @@ INIT = /etc/init.d HFILES = $(foreach dir,$(SRCDIRS),$(wildcard $(TCF_AGENT_DIR)/$(dir)/*.h)) CFILES = $(foreach fnm,$(foreach dir,$(SRCDIRS),$(wildcard $(TCF_AGENT_DIR)/$(dir)/*.c)),$(subst ^$(TCF_AGENT_DIR)/,,^$(fnm))) -OFILES = $(addprefix $(BINDIR)/,$(addsuffix $(EXTOBJ),$(basename $(filter-out main/main%,$(CFILES))))) +OFILES = $(addprefix $(BINDIR)/,$(addsuffix $(EXTOBJ),$(basename $(filter-out tcf/main/main%,$(CFILES))))) EXECS = $(addprefix $(BINDIR)/,agent$(EXTEXE) client$(EXTEXE) tcfreg$(EXTEXE) valueadd$(EXTEXE) tcflog$(EXTEXE)) ifeq ($(OPSYS),Cygwin) diff --git a/agent/agent.sln b/agent/agent.sln index e27ad2fa..f01abf36 100644 --- a/agent/agent.sln +++ b/agent/agent.sln @@ -1,18 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C++ Express 2008
+# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agent", "agent.vcproj", "{A1341B90-F807-4D1F-A48E-C42BE62D9C57}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A1341B90-F807-4D1F-A48E-C42BE62D9C57}.Debug|Win32.ActiveCfg = Debug|Win32
{A1341B90-F807-4D1F-A48E-C42BE62D9C57}.Debug|Win32.Build.0 = Debug|Win32
+ {A1341B90-F807-4D1F-A48E-C42BE62D9C57}.Debug|x64.ActiveCfg = Debug|x64
+ {A1341B90-F807-4D1F-A48E-C42BE62D9C57}.Debug|x64.Build.0 = Debug|x64
{A1341B90-F807-4D1F-A48E-C42BE62D9C57}.Release|Win32.ActiveCfg = Release|Win32
{A1341B90-F807-4D1F-A48E-C42BE62D9C57}.Release|Win32.Build.0 = Release|Win32
+ {A1341B90-F807-4D1F-A48E-C42BE62D9C57}.Release|x64.ActiveCfg = Release|x64
+ {A1341B90-F807-4D1F-A48E-C42BE62D9C57}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/agent/agent.vcproj b/agent/agent.vcproj index f941d680..f13dd7c6 100644 --- a/agent/agent.vcproj +++ b/agent/agent.vcproj @@ -4,20 +4,24 @@ Version="9.00"
Name="agent"
ProjectGUID="{A1341B90-F807-4D1F-A48E-C42BE62D9C57}"
+ RootNamespace="agent"
TargetFrameworkVersion="0"
>
<Platforms>
<Platform
Name="Win32"
/>
+ <Platform
+ Name="x64"
+ />
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
- OutputDirectory="$(SolutionDir)\obj\MSVC\$(ConfigurationName)"
- IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(ConfigurationName)"
+ OutputDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
@@ -37,7 +41,7 @@ />
<Tool
Name="VCMIDLTool"
- TypeLibraryName=".\obj\MSVC\Release/agent.tlb"
+ TypeLibraryName="$(OutDir)\agent.tlb"
HeaderFileName=""
/>
<Tool
@@ -46,14 +50,14 @@ Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories=".;system/Windows;machine/x86_64"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ PreprocessorDefinitions="NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile=".\obj\MSVC\Release/agent.pch"
- AssemblerListingLocation=".\obj\MSVC\Release/"
- ObjectFile=".\obj\MSVC\Release/"
- ProgramDataBaseFileName=".\obj\MSVC\Release/"
+ PrecompiledHeaderFile="$(OutDir)\agent.pch"
+ AssemblerListingLocation="$(OutDir)\"
+ ObjectFile="$(OutDir)\"
+ ProgramDataBaseFileName="$(OutDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
CompileAs="1"
@@ -72,10 +76,10 @@ <Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.lib Iphlpapi.lib version.lib"
- OutputFile=".\obj\MSVC\Release/agent.exe"
+ OutputFile="$(OutDir)\agent.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
- ProgramDatabaseFile=".\obj\MSVC\Release/agent.pdb"
+ ProgramDatabaseFile="$(OutDir)\agent.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="2"
@@ -93,7 +97,99 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\obj\MSVC\Release/agent.bsc"
+ OutputFile="$(OutDir)\agent.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName="$(OutDir)\agent.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/Oy-"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories=".;system/Windows;machine/x86_64"
+ PreprocessorDefinitions="NDEBUG;_CONSOLE"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile="$(OutDir)\agent.pch"
+ AssemblerListingLocation="$(OutDir)\"
+ ObjectFile="$(OutDir)\"
+ ProgramDataBaseFileName="$(OutDir)\"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="WS2_32.lib Iphlpapi.lib version.lib"
+ OutputFile="$(OutDir)\agent.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile="$(OutDir)\agent.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile="$(OutDir)\agent.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -107,8 +203,8 @@ </Configuration>
<Configuration
Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)\obj\MSVC\$(ConfigurationName)"
- IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(ConfigurationName)"
+ OutputDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
@@ -128,20 +224,20 @@ />
<Tool
Name="VCMIDLTool"
- TypeLibraryName=".\obj\MSVC\Debug/agent.tlb"
+ TypeLibraryName="$(OutDir)\agent.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;system/Windows;machine/x86_64"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ PreprocessorDefinitions="_DEBUG;_CONSOLE"
MinimalRebuild="true"
RuntimeLibrary="1"
- PrecompiledHeaderFile=".\obj\MSVC\Debug/agent.pch"
- AssemblerListingLocation=".\obj\MSVC\Debug/"
- ObjectFile=".\obj\MSVC\Debug/"
- ProgramDataBaseFileName=".\obj\MSVC\Debug/"
+ PrecompiledHeaderFile="$(OutDir)\agent.pch"
+ AssemblerListingLocation="$(OutDir)\"
+ ObjectFile="$(OutDir)\"
+ ProgramDataBaseFileName="$(OutDir)\"
WarningLevel="4"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
@@ -162,11 +258,11 @@ <Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.lib Iphlpapi.lib version.lib"
- OutputFile=".\obj\MSVC\Debug/agent.exe"
+ OutputFile="$(OutDir)\agent.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
- ProgramDatabaseFile=".\obj\MSVC\Debug/agent.pdb"
+ ProgramDatabaseFile="$(OutDir)\agent.pdb"
SubSystem="1"
RandomizedBaseAddress="1"
DataExecutionPrevention="2"
@@ -184,7 +280,99 @@ <Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
- OutputFile=".\obj\MSVC\Debug/agent.bsc"
+ OutputFile="$(OutDir)\agent.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ TypeLibraryName="$(OutDir)\agent.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;system/Windows;machine/x86_64"
+ PreprocessorDefinitions="_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile="$(OutDir)\agent.pch"
+ AssemblerListingLocation="$(OutDir)\"
+ ObjectFile="$(OutDir)\"
+ ProgramDataBaseFileName="$(OutDir)\"
+ WarningLevel="4"
+ SuppressStartupBanner="true"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="WS2_32.lib Iphlpapi.lib version.lib"
+ OutputFile="$(OutDir)\agent.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile="$(OutDir)\agent.pdb"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile="$(OutDir)\agent.bsc"
/>
<Tool
Name="VCFxCopTool"
@@ -695,6 +883,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -702,6 +898,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\tcf\main\main_log.c"
@@ -715,6 +919,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -722,6 +934,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\tcf\main\main_lua.c"
@@ -735,6 +955,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -742,6 +970,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\tcf\main\main_reg.c"
@@ -755,6 +991,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -762,6 +1006,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\tcf\main\main_va.c"
@@ -775,6 +1027,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -782,6 +1042,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\tcf\main\server.c"
@@ -865,6 +1133,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -872,6 +1148,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\system\GNU\Linux\tcf\regset.h"
@@ -894,6 +1178,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -901,6 +1193,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\system\Darwin\tcf\regset.h"
@@ -922,6 +1222,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -929,6 +1237,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\system\FreeBSD\tcf\regset.h"
@@ -950,6 +1266,14 @@ />
</FileConfiguration>
<FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
@@ -957,6 +1281,14 @@ Name="VCCLCompilerTool"
/>
</FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\system\VxWorks\tcf\context-vxworks.h"
diff --git a/agent/bin/mcc b/agent/bin/mcc index 79754478..44c41192 100755 --- a/agent/bin/mcc +++ b/agent/bin/mcc @@ -10,6 +10,7 @@ # -D<name> macro definition # -I<dir> include directory # -p<file> PDB file name +# -m<machine> i386 or x86_64 . `dirname $0`/mcc-env @@ -20,9 +21,10 @@ cflag=0 gflag=0 Oflag=0 language= +machine= oval= -while getopts co:D:I:gOp:x: name +while getopts co:D:I:gOp:x:m: name do case $name in c) @@ -54,6 +56,9 @@ do x) language="$OPTARG" ;; + m) + machine="$OPTARG" + ;; *) echo Invalid option $name exit 2 @@ -97,4 +102,12 @@ else fi CFLAGS3="/Oy- /DWIN32 /D_CONSOLE /D_VC80_UPGRADE=0x0600 /D_MBCS /W4" +if [ "$machine" == "x86_64" ] ; then + export LIB=$(cygpath -aw "$VSHOME/VC/lib/amd64")\;$(cygpath -aw "$WINSDK/Lib/x64") + export PATH="$VSHOME/VC/bin/x86_amd64:$PATH" + if [ "$PROCESSOR_ARCHITECTURE" == "AMD64" -o "$PROCESSOR_ARCHITEW6432" == "AMD64" ] ; then + export PATH="$VSHOME/VC/bin/amd64:$PATH" + fi +fi + cl.exe /nologo $CFLAGS1 $CFLAGS2 $CFLAGS3 "${cmd[@]}" "$@" || exit 1 diff --git a/agent/bin/mlb b/agent/bin/mlb new file mode 100644 index 00000000..078325c8 --- /dev/null +++ b/agent/bin/mlb @@ -0,0 +1,38 @@ +#!/bin/bash + +# This script invokes Microsoft Visual Studio lib.exe from CygWin shell. +# Command line options: +# -m<machine> i386 or x86_64 + +. `dirname $0`/mcc-env + +machine= + +while getopts m: name +do + case $name in + m) + machine="$OPTARG" + ;; + *) + echo Invalid option $name + exit 2 + ;; + esac +done + +shift `expr $OPTIND - 1` + +libfile=$1 +shift + +export LIB= + +if [ "$machine" == "x86_64" ] ; then + export PATH="$VSHOME/VC/bin/x86_amd64:$PATH" + if [ "$PROCESSOR_ARCHITECTURE" == "AMD64" -o "$PROCESSOR_ARCHITEW6432" == "AMD64" ] ; then + export PATH="$VSHOME/VC/bin/amd64:$PATH" + fi +fi + +lib.exe /nologo /nodefaultlib "/out:$libfile" "$@" || exit 1 diff --git a/agent/machine/x86_64/tcf/cpudefs-mdep.h b/agent/machine/x86_64/tcf/cpudefs-mdep.h index 328d669a..24df2cca 100644 --- a/agent/machine/x86_64/tcf/cpudefs-mdep.h +++ b/agent/machine/x86_64/tcf/cpudefs-mdep.h @@ -37,7 +37,7 @@ #define REG_OFFSET(name) offsetof(REG_SET, name) RegisterDefinition regs_index[] = { -#if defined(WIN32) && defined(__i386__) +#if defined(_WIN32) && defined(__i386__) # define REG_SP Esp # define REG_BP Ebp # define REG_IP Eip @@ -85,10 +85,10 @@ RegisterDefinition regs_index[] = { { "status", REG_OFFSET(FloatSave.StatusWord), 2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, regs_index + 24 }, { "tag", REG_OFFSET(FloatSave.TagWord), 2, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, regs_index + 24 }, -#elif defined(WIN32) && defined(__x86_64__) -# define REG_SP Esp -# define REG_BP Ebp -# define REG_IP Eip +#elif defined(_WIN32) && defined(__x86_64__) +# define REG_SP Rsp +# define REG_BP Rbp +# define REG_IP Rip { "rax", REG_OFFSET(Rax), 8, 0, 0}, { "rdx", REG_OFFSET(Rdx), 8, 1, 1}, { "rcx", REG_OFFSET(Rcx), 8, 2, 2}, diff --git a/agent/system/Msys/tcf/regset.h b/agent/system/Msys/tcf/regset.h index fb4eab83..61729743 100644 --- a/agent/system/Msys/tcf/regset.h +++ b/agent/system/Msys/tcf/regset.h @@ -18,6 +18,6 @@ * hold values of target CPU registers. */ -#if defined(WIN32) +#if defined(_WIN32) typedef CONTEXT REG_SET; #endif diff --git a/agent/system/Windows/tcf/context-win32.c b/agent/system/Windows/tcf/context-win32.c index 93a00c40..deedf35b 100644 --- a/agent/system/Windows/tcf/context-win32.c +++ b/agent/system/Windows/tcf/context-win32.c @@ -19,7 +19,7 @@ #include <tcf/config.h> -#if defined(WIN32) +#if defined(_WIN32) #if ENABLE_DebugContext && !ENABLE_ContextProxy @@ -48,6 +48,16 @@ # define MAX_HW_BPS 4 #endif +#if defined(_M_IX86) +# define reg_ip Eip +# define reg_sp Esp +typedef DWORD REGWORD; +#elif defined(_M_AMD64) +# define reg_ip Rip +# define reg_sp Rsp +typedef DWORD64 REGWORD; +#endif + typedef struct ContextExtensionWin32 { pid_t pid; HANDLE handle; @@ -204,7 +214,7 @@ static void get_registers(Context * ctx) { else { ext->trace_flag = (ext->regs->EFlags & 0x100) != 0; trace(LOG_CONTEXT, "context: get regs OK: ctx %#lx, id %s, PC %#lx", - ctx, ctx->id, ext->regs->Eip); + ctx, ctx->id, ext->regs->reg_ip); } } @@ -264,7 +274,7 @@ static DWORD event_win32_context_stopped(Context * ctx) { if (ext->regs->Dr6 & 0xfu) { int i, j = 0; for (i = 0; i < MAX_HW_BPS; i++) { - if (ext->regs->Dr6 & (1u << i)) { + if (ext->regs->Dr6 & ((REGWORD)1 << i)) { ContextBreakpoint * bp = debug_state->hw_bps[i]; if (bp == NULL) continue; ctx->stopped_by_cb = ext->triggered_hw_bps; @@ -274,19 +284,19 @@ static DWORD event_win32_context_stopped(Context * ctx) { } } #endif - if (ext->step_opcodes_len > 0 && ext->step_opcodes[0] == 0x9c && ext->step_opcodes_addr != ext->regs->Eip) { + if (ext->step_opcodes_len > 0 && ext->step_opcodes[0] == 0x9c && ext->step_opcodes_addr != ext->regs->reg_ip) { /* PUSHF instruction: need to clear trace flag from top of the stack */ SIZE_T bcnt = 0; ContextAddress buf = 0; assert(ext->regs->EFlags & 0x100); - assert(ext->step_opcodes_addr == ext->regs->Eip - 1); - if (!ReadProcessMemory(EXT(ctx->mem)->handle, (LPCVOID)ext->regs->Esp, &buf, sizeof(ContextAddress), &bcnt) || bcnt != sizeof(ContextAddress)) { + assert(ext->step_opcodes_addr == ext->regs->reg_ip - 1); + if (!ReadProcessMemory(EXT(ctx->mem)->handle, (LPCVOID)ext->regs->reg_sp, &buf, sizeof(ContextAddress), &bcnt) || bcnt != sizeof(ContextAddress)) { log_error("ReadProcessMemory", 0); } else { assert(buf & 0x100); buf &= ~0x100; - if (!WriteProcessMemory(EXT(ctx->mem)->handle, (LPVOID)ext->regs->Esp, &buf, sizeof(ContextAddress), &bcnt) || bcnt != sizeof(ContextAddress)) { + if (!WriteProcessMemory(EXT(ctx->mem)->handle, (LPVOID)ext->regs->reg_sp, &buf, sizeof(ContextAddress), &bcnt) || bcnt != sizeof(ContextAddress)) { log_error("WriteProcessMemory", 0); } } @@ -302,7 +312,7 @@ static DWORD event_win32_context_stopped(Context * ctx) { get_registers(ctx); if (!ext->regs_error) { if (is_breakpoint_address(ctx, exception_addr)) { - ext->regs->Eip = exception_addr; + ext->regs->reg_ip = exception_addr; ext->regs_dirty = 1; ctx->stopped_by_bp = 1; #if USE_HW_BPS @@ -314,7 +324,7 @@ static DWORD event_win32_context_stopped(Context * ctx) { #endif } else { - ext->regs->Eip = exception_addr; + ext->regs->reg_ip = exception_addr; ext->regs_dirty = 1; } } @@ -431,7 +441,7 @@ static void break_process_event(void * args) { } if (cnt > 0) { const SIZE_T buf_size = 0x100; - DWORD size = 0; + SIZE_T size = 0; int error = 0; trace(LOG_CONTEXT, "context: creating remote thread in process %#lx, id %s", ctx, ctx->id); @@ -476,7 +486,7 @@ static int win32_resume(Context * ctx, int step) { /* Update debug registers */ if (ctx->stopped_by_cb != NULL || ext->hw_bps_regs_generation != debug_state->hw_bps_generation) { int i; - DWORD Dr7 = 0; + REGWORD Dr7 = 0; int step_over_hw_bp = 0; get_registers(ctx); @@ -488,13 +498,13 @@ static int win32_resume(Context * ctx, int step) { for (i = 0; i < MAX_HW_BPS; i++) { ContextBreakpoint * bp = debug_state->hw_bps[i]; if (bp != NULL && - ext->regs->Eip == bp->address && + ext->regs->reg_ip == bp->address && (bp->access_types & CTX_BP_ACCESS_INSTRUCTION)) { /* Skipping the breakpoint */ step_over_hw_bp = 1; bp = NULL; } - Dr7 &= ~(3u << (i * 2)); + Dr7 &= ~((REGWORD)3 << (i * 2)); if (bp != NULL) { switch (i) { case 0: @@ -522,34 +532,34 @@ static int win32_resume(Context * ctx, int step) { } break; } - Dr7 |= 1u << (i * 2); + Dr7 |= (REGWORD)1 << (i * 2); if (bp->access_types == (CTX_BP_ACCESS_INSTRUCTION | CTX_BP_ACCESS_VIRTUAL)) { - Dr7 &= ~(3u << (i * 4 + 16)); + Dr7 &= ~((REGWORD)3 << (i * 4 + 16)); } else if (bp->access_types == (CTX_BP_ACCESS_DATA_WRITE | CTX_BP_ACCESS_VIRTUAL)) { - Dr7 &= ~(3u << (i * 4 + 16)); - Dr7 |= 1u << (i * 4 + 16); + Dr7 &= ~((REGWORD)3 << (i * 4 + 16)); + Dr7 |= (REGWORD)1 << (i * 4 + 16); } else if (bp->access_types == (CTX_BP_ACCESS_DATA_READ | CTX_BP_ACCESS_DATA_WRITE | CTX_BP_ACCESS_VIRTUAL)) { - Dr7 |= 3u << (i * 4 + 16); + Dr7 |= (REGWORD)3 << (i * 4 + 16); } else { errno = set_errno(ERR_UNSUPPORTED, "Invalid hardware breakpoint: unsupported access mode"); return -1; } if (bp->length == 1) { - Dr7 &= ~(3u << (i * 4 + 18)); + Dr7 &= ~((REGWORD)3 << (i * 4 + 18)); } else if (bp->length == 2) { - Dr7 &= ~(3u << (i * 4 + 18)); - Dr7 |= 1u << (i * 4 + 18); + Dr7 &= ~((REGWORD)3 << (i * 4 + 18)); + Dr7 |= (REGWORD)1 << (i * 4 + 18); } else if (bp->length == 4) { - Dr7 |= 3u << (i * 4 + 18); + Dr7 |= (REGWORD)3 << (i * 4 + 18); } else if (bp->length == 8) { - Dr7 &= ~(3u << (i * 4 + 18)); - Dr7 |= 2u << (i * 4 + 18); + Dr7 &= ~((REGWORD)3 << (i * 4 + 18)); + Dr7 |= (REGWORD)2 << (i * 4 + 18); } else { errno = set_errno(ERR_UNSUPPORTED, "Invalid hardware breakpoint: unsupported length"); @@ -606,8 +616,8 @@ static int win32_resume(Context * ctx, int step) { set_error_report_errno(ext->regs_error); return -1; } - ext->step_opcodes_addr = ext->regs->Eip; - if (!ReadProcessMemory(prs_ext->handle, (LPCVOID)ext->regs->Eip, &ext->step_opcodes, + ext->step_opcodes_addr = ext->regs->reg_ip; + if (!ReadProcessMemory(prs_ext->handle, (LPCVOID)ext->regs->reg_ip, &ext->step_opcodes, sizeof(ext->step_opcodes), &ext->step_opcodes_len) || ext->step_opcodes_len == 0) { errno = log_error("ReadProcessMemory", 0); return -1; @@ -1466,4 +1476,4 @@ void init_contexts_sys_dep(void) { } #endif /* if ENABLE_DebugContext */ -#endif /* WIN32 */ +#endif /* _WIN32 */ diff --git a/agent/system/Windows/tcf/pthreads-win32.c b/agent/system/Windows/tcf/pthreads-win32.c index 08a64aa3..4f7f887d 100644 --- a/agent/system/Windows/tcf/pthreads-win32.c +++ b/agent/system/Windows/tcf/pthreads-win32.c @@ -15,7 +15,7 @@ #include <tcf/config.h> -#if defined(WIN32) && !defined(DISABLE_PTHREADS_WIN32) +#if defined(_WIN32) && !defined(DISABLE_PTHREADS_WIN32) #include <assert.h> #include <tcf/framework/myalloc.h> diff --git a/agent/system/Windows/tcf/regset.h b/agent/system/Windows/tcf/regset.h index fb4eab83..61729743 100644 --- a/agent/system/Windows/tcf/regset.h +++ b/agent/system/Windows/tcf/regset.h @@ -18,6 +18,6 @@ * hold values of target CPU registers. */ -#if defined(WIN32) +#if defined(_WIN32) typedef CONTEXT REG_SET; #endif diff --git a/agent/system/Windows/tcf/windbgcache.c b/agent/system/Windows/tcf/windbgcache.c index cfd43476..436a079c 100644 --- a/agent/system/Windows/tcf/windbgcache.c +++ b/agent/system/Windows/tcf/windbgcache.c @@ -20,7 +20,7 @@ #include <tcf/config.h> -#if defined(WIN32) && !ENABLE_ELF +#if defined(_WIN32) && !ENABLE_ELF # define ENABLE_PE_Symbols ((SERVICE_LineNumbers && !ENABLE_LineNumbersProxy) || (SERVICE_Symbols && !ENABLE_SymbolsProxy)) # define ENABLE_EnumerateModules (SERVICE_MemoryMap && !ENABLE_ContextProxy) #else diff --git a/agent/system/Windows/tcf/windbgcache.h b/agent/system/Windows/tcf/windbgcache.h index 670cad7d..818e742b 100644 --- a/agent/system/Windows/tcf/windbgcache.h +++ b/agent/system/Windows/tcf/windbgcache.h @@ -22,12 +22,13 @@ #include <tcf/config.h> -#if defined(WIN32) +#if defined(_WIN32) #if defined(__GNUC__) # include <imagehlp.h> #else # define _NO_CVCONST_H +# define _IMAGEHLP_SOURCE_ # include <dbghelp.h> #endif @@ -247,5 +248,5 @@ extern BOOL LocEnumerateLoadedModulesW64(HANDLE hProcess, PENUMLOADED_MODULES_CA } #endif -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ #endif /* D_windbgcache */ diff --git a/agent/tcf/config.h b/agent/tcf/config.h index c8da0eaa..92a64971 100644 --- a/agent/tcf/config.h +++ b/agent/tcf/config.h @@ -23,7 +23,7 @@ #include <tcf/framework/mdep.h> -#if defined(WIN32) +#if defined(_WIN32) # define TARGET_WINDOWS 1 # define TARGET_VXWORKS 0 # define TARGET_UNIX 0 diff --git a/agent/tcf/framework/asyncreq.c b/agent/tcf/framework/asyncreq.c index c4e9b525..44838ca9 100644 --- a/agent/tcf/framework/asyncreq.c +++ b/agent/tcf/framework/asyncreq.c @@ -21,7 +21,7 @@ #include <tcf/config.h> #include <assert.h> #include <stddef.h> -#if defined(WIN32) +#if defined(_WIN32) #elif defined(_WRS_KERNEL) #else # include <sys/wait.h> @@ -143,7 +143,7 @@ static void * worker_thread_handler(void * x) { break; /* Platform dependant IO methods */ -#if defined(WIN32) +#if defined(_WIN32) case AsyncReqConnectPipe: req->u.cnp.rval = ConnectNamedPipe(req->u.cnp.pipe, NULL); if (!req->u.cnp.rval) { diff --git a/agent/tcf/framework/asyncreq.h b/agent/tcf/framework/asyncreq.h index 888baf9c..6e711016 100644 --- a/agent/tcf/framework/asyncreq.h +++ b/agent/tcf/framework/asyncreq.h @@ -106,7 +106,7 @@ struct AsyncReqInfo { /* Out */ int rval; } con; -#ifdef WIN32 +#ifdef _WIN32 struct { /* In */ HANDLE pipe; diff --git a/agent/tcf/framework/channel.c b/agent/tcf/framework/channel.c index 7b48db5f..f164c5cd 100644 --- a/agent/tcf/framework/channel.c +++ b/agent/tcf/framework/channel.c @@ -219,8 +219,8 @@ PeerServer * channel_peer_from_url(const char * url) { } char * channel_peer_to_json(PeerServer * ps) { - int i; - char *rval; + unsigned i; + char * rval; ByteArrayOutputStream buf; OutputStream * out; diff --git a/agent/tcf/framework/channel_pipe.c b/agent/tcf/framework/channel_pipe.c index d6f9aa98..fb0dc702 100644 --- a/agent/tcf/framework/channel_pipe.c +++ b/agent/tcf/framework/channel_pipe.c @@ -19,7 +19,7 @@ #include <tcf/config.h> -#if defined(WIN32) +#if defined(_WIN32) #include <fcntl.h> #include <errno.h> @@ -78,7 +78,7 @@ struct ServerInstance { int index; int fd_inp; int fd_out; -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) HANDLE pipe; AsyncReqInfo req; #endif @@ -550,7 +550,7 @@ void channel_pipe_connect(PeerServer * ps, ChannelConnectCallBack callback, void post_event(channel_pipe_connect_done, info); } -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) #define check_error_win32(ok) { if (!(ok)) check_error(set_win32_errno(GetLastError())); } @@ -564,7 +564,7 @@ static void pipe_client_connected(void * args) { if (req->error) error = req->error; if (!error) { - int l = 0; + size_t l = 0; HANDLE h = NULL; OVERLAPPED overlap; char inp_path[FILE_PATH_SIZE]; @@ -659,7 +659,7 @@ static void close_output_pipe(ChannelPIPE * c) { } static void register_server(ServerPIPE * s) { - int i; + size_t i; PeerServer * ps = s->serv.ps; PeerServer * ps2 = peer_server_alloc(); const char * transport = peer_server_getprop(ps, "TransportName", NULL); @@ -705,7 +705,7 @@ static void server_close(ChannelServer * serv) { if (ins->fd_inp >= 0 && close(ins->fd_inp) < 0) check_error(errno); if (ins->fd_out >= 0 && close(ins->fd_out) < 0) check_error(errno); ins->fd_inp = ins->fd_out = -1; -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) ins->pipe = NULL; #endif } @@ -714,7 +714,7 @@ static void server_close(ChannelServer * serv) { ChannelServer * channel_pipe_server(PeerServer * ps) { ServerPIPE * s = (ServerPIPE *)loc_alloc_zero(sizeof(ServerPIPE)); -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) { int i; const char * path = peer_server_getprop(ps, attr_pipe_name, def_pipe_name); diff --git a/agent/tcf/framework/channel_tcp.c b/agent/tcf/framework/channel_tcp.c index 6971a27e..ae7c359c 100644 --- a/agent/tcf/framework/channel_tcp.c +++ b/agent/tcf/framework/channel_tcp.c @@ -41,7 +41,7 @@ # ifndef _MSC_VER # include <dirent.h> # endif -# ifdef WIN32 +# ifdef _WIN32 # include <ShlObj.h> # endif #else @@ -69,7 +69,7 @@ #define MSG_MORE 0 #endif -#ifdef WIN32 +#ifdef _WIN32 # define FD_SETX(a,b) FD_SET((unsigned)a, b) # define MKDIR_MODE_TCF 0 # define MKDIR_MODE_SSL 0 @@ -89,7 +89,7 @@ #define MAX_IFC 10 #if !defined(ENABLE_OutputQueue) -# if ENABLE_SSL || ENABLE_ContextProxy || defined(WIN32) +# if ENABLE_SSL || ENABLE_ContextProxy || defined(_WIN32) # define ENABLE_OutputQueue 1 # else # define ENABLE_OutputQueue 0 @@ -175,7 +175,7 @@ static void ini_ssl(void) { RAND_add(&ts.tv_nsec, sizeof(ts.tv_nsec), 0.1); } inited = 1; -#ifdef WIN32 +#ifdef _WIN32 { WCHAR fnm[MAX_PATH]; char buf[MAX_PATH]; @@ -815,7 +815,7 @@ static ChannelTCP * create_channel(int sock, int en_ssl, int server, int unix_do } } -#ifdef WIN32 +#ifdef _WIN32 { unsigned long opts = 1; if (ioctlsocket((SOCKET)sock, FIONBIO, &opts) != 0) { @@ -897,7 +897,7 @@ static ChannelTCP * create_channel(int sock, int en_ssl, int server, int unix_do } static void refresh_peer_server(int sock, PeerServer * ps) { - int i; + unsigned i; const char * transport = peer_server_getprop(ps, "TransportName", NULL); assert(transport != NULL); if (strcmp(transport, "UNIX") == 0) { @@ -1183,7 +1183,7 @@ ChannelServer * channel_tcp_server(PeerServer * ps) { reason = "create"; continue; } -#if !defined(WIN32) +#if !defined(_WIN32) { const int i = 1; if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *)&i, sizeof(i)) < 0) { @@ -1435,14 +1435,14 @@ void generate_ssl_certificate(void) { if (!err && (fp = fopen(fnm, "w")) == NULL) err = errno; if (!err && !PEM_write_PKCS8PrivateKey(fp, rsa_key, NULL, NULL, 0, NULL, NULL)) err = set_ssl_errno(); if (!err && fclose(fp) != 0) err = errno; -#ifndef WIN32 +#ifndef _WIN32 if (!err && chmod(fnm, S_IRWXU) != 0) err = errno; #endif snprintf(fnm, sizeof(fnm), "%s/ssl/local.cert", tcf_dir); if (!err && (fp = fopen(fnm, "w")) == NULL) err = errno; if (!err && !PEM_write_X509(fp, cert)) err = set_ssl_errno(); if (!err && fclose(fp) != 0) err = errno; -#ifndef WIN32 +#ifndef _WIN32 if (!err && chmod(fnm, S_IRWXU) != 0) err = errno; #endif if (err) { diff --git a/agent/tcf/framework/errors.c b/agent/tcf/framework/errors.c index 9ef8bf44..a231e3a4 100644 --- a/agent/tcf/framework/errors.c +++ b/agent/tcf/framework/errors.c @@ -42,7 +42,7 @@ #define MESSAGE_CNT (ERR_MESSAGE_MAX - ERR_MESSAGE_MIN + 1) -#ifdef WIN32 +#ifdef _WIN32 # define ERR_WINDOWS_MIN (STD_ERR_BASE + 0x10000) # define ERR_WINDOWS_MAX (ERR_WINDOWS_MIN + 0xffff) # define ERR_WINDOWS_CNT (ERR_WINDOWS_MAX - ERR_WINDOWS_MIN + 1) @@ -115,7 +115,7 @@ static ErrorMessage * alloc_msg(int source) { return m; } -#ifdef WIN32 +#ifdef _WIN32 static char * system_strerror(DWORD error_code, HMODULE module) { WCHAR * buf = NULL; @@ -134,7 +134,7 @@ static char * system_strerror(DWORD error_code, HMODULE module) { msg_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, NULL, 0, NULL, NULL); if (msg_len > 0) { realloc_msg_buf(); - msg_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, msg_buf, msg_max, NULL, NULL); + msg_len = WideCharToMultiByte(CP_UTF8, 0, buf, -1, msg_buf, (int)msg_max, NULL, NULL); } } if (msg_len == 0) { @@ -351,7 +351,7 @@ const char * errno_to_str(int err) { return "Cannot get error message text: errno_to_str() must be called from the main thread"; } } -#ifdef WIN32 +#ifdef _WIN32 if (err >= ERR_WINDOWS_MIN && err <= ERR_WINDOWS_MAX) { if (is_dispatch_thread()) { return system_strerror(err - ERR_WINDOWS_MIN, NULL); @@ -495,10 +495,10 @@ ErrorReport * get_error_report(int err) { report->pub.format = loc_strdup(errno_to_str(err)); -#ifdef WIN32 +#ifdef _WIN32 if (err >= ERR_WINDOWS_MIN && err <= ERR_WINDOWS_MAX) { add_report_prop_int(report, "AltCode", err - ERR_WINDOWS_MIN); - add_report_prop_str(report, "AltOrg", "WIN32"); + add_report_prop_str(report, "AltOrg", "_WIN32"); err = ERR_OTHER; } #endif diff --git a/agent/tcf/framework/errors.h b/agent/tcf/framework/errors.h index ce772eb7..57b016d5 100644 --- a/agent/tcf/framework/errors.h +++ b/agent/tcf/framework/errors.h @@ -104,9 +104,9 @@ extern int set_fmt_errno(int no, const char * fmt, ...); */ extern int set_gai_errno(int gai_error_code); -#ifdef WIN32 +#ifdef _WIN32 /* - * Set errno to indicate WIN32 error code. + * Set errno to indicate _WIN32 error code. * This function is thread-safe - can be called from background threads. * Return new value of errno. */ diff --git a/agent/tcf/framework/events.c b/agent/tcf/framework/events.c index 99c32dfd..0f51c1c6 100644 --- a/agent/tcf/framework/events.c +++ b/agent/tcf/framework/events.c @@ -45,7 +45,7 @@ struct event_node { void * arg; }; -#if defined(WIN32) +#if defined(_WIN32) static DWORD event_thread; # define current_thread GetCurrentThreadId() # define is_event_thread (event_thread == current_thread) diff --git a/agent/tcf/framework/exceptions.h b/agent/tcf/framework/exceptions.h index 6d988dcb..9f44ac20 100644 --- a/agent/tcf/framework/exceptions.h +++ b/agent/tcf/framework/exceptions.h @@ -40,9 +40,9 @@ typedef struct Trap Trap; struct Trap { - int error; jmp_buf env; Trap * next; + int error; }; #define set_trap(trap) (set_trap_a(trap), setjmp((trap)->env), set_trap_b(trap)) diff --git a/agent/tcf/framework/ip_ifc.c b/agent/tcf/framework/ip_ifc.c index 9f984fda..f4bdc3f5 100644 --- a/agent/tcf/framework/ip_ifc.c +++ b/agent/tcf/framework/ip_ifc.c @@ -31,12 +31,12 @@ #define MAX(x,y) ((x) > (y) ? (x) : (y)) -#if !defined(WIN32) && !defined(ifr_netmask) +#if !defined(_WIN32) && !defined(ifr_netmask) # define ifr_netmask ifr_addr #endif int build_ifclist(int sock, int max, ip_ifc_info * list) { -#ifdef WIN32 +#ifdef _WIN32 int i; int ind; MIB_IPADDRTABLE * info; diff --git a/agent/tcf/framework/mdep-inet.h b/agent/tcf/framework/mdep-inet.h index 1e643eb0..faabbf1a 100644 --- a/agent/tcf/framework/mdep-inet.h +++ b/agent/tcf/framework/mdep-inet.h @@ -21,7 +21,7 @@ #ifndef D_mdep_inet #define D_mdep_inet -#if defined(WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) #include <ws2tcpip.h> #include <iphlpapi.h> @@ -63,7 +63,7 @@ extern int wsa_bind(int socket, const struct sockaddr * addr, int addr_size); extern int wsa_listen(int socket, int size); extern int wsa_recv(int socket, void * buf, size_t size, int flags); extern int wsa_recvfrom(int socket, void * buf, size_t size, int flags, - struct sockaddr * addr, socklen_t * addr_size); + struct sockaddr * addr, socklen_t * addr_size); extern int wsa_send(int socket, const void * buf, size_t size, int flags); extern int wsa_sendto(int socket, const void * buf, size_t size, int flags, const struct sockaddr * dest_addr, socklen_t dest_size); diff --git a/agent/tcf/framework/mdep-threads.h b/agent/tcf/framework/mdep-threads.h index 8247d613..02b0b992 100644 --- a/agent/tcf/framework/mdep-threads.h +++ b/agent/tcf/framework/mdep-threads.h @@ -21,7 +21,7 @@ #ifndef D_mdep_threads #define D_mdep_threads -#if defined(WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) #ifdef DISABLE_PTHREADS_WIN32 # include <pthread.h> diff --git a/agent/tcf/framework/mdep.c b/agent/tcf/framework/mdep.c index f73ecebc..ca01fe40 100644 --- a/agent/tcf/framework/mdep.c +++ b/agent/tcf/framework/mdep.c @@ -35,7 +35,7 @@ pthread_attr_t pthread_create_attr; int utf8_locale = 0; -#if defined(WIN32) +#if defined(_WIN32) #ifndef SIO_UDP_CONNRESET #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) @@ -215,9 +215,9 @@ int inet_pton(int af, const char * src, void * dst) { return 1; } -#endif /* WIN32 */ +#endif /* _WIN32 */ -#if defined(WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) static __int64 file_time_to_unix_time(const FILETIME * ft) { __int64 res = (__int64)ft->dwHighDateTime << 32; @@ -504,9 +504,9 @@ int utf8_closedir(DIR * d) { return r; } -#endif /* defined(WIN32) && !defined(__CYGWIN__) */ +#endif /* defined(_WIN32) && !defined(__CYGWIN__) */ -#if defined(WIN32) && !defined(__CYGWIN__) || defined(_WRS_KERNEL) || defined(__SYMBIAN32__) +#if defined(_WIN32) && !defined(__CYGWIN__) || defined(_WRS_KERNEL) || defined(__SYMBIAN32__) ssize_t pread(int fd, void * buf, size_t size, off_t offset) { off_t offs0; @@ -528,7 +528,7 @@ ssize_t pwrite(int fd, const void * buf, size_t size, off_t offset) { return wr; } -#endif /* defined(WIN32) && !defined(__CYGWIN__) || defined(_WRS_KERNEL) || defined(__SYMBIAN32__) */ +#endif /* defined(_WIN32) && !defined(__CYGWIN__) || defined(_WRS_KERNEL) || defined(__SYMBIAN32__) */ #ifndef big_endian_host extern int big_endian_host(void) { @@ -538,7 +538,7 @@ extern int big_endian_host(void) { } #endif -#if defined(WIN32) +#if defined(_WIN32) #include <shlobj.h> @@ -810,7 +810,7 @@ void ini_mdep(void) { /** canonicalize_file_name ****************************************************/ -#if defined(WIN32) +#if defined(_WIN32) char * canonicalize_file_name(const char * name) { DWORD len; @@ -1092,7 +1092,7 @@ const char * loc_gai_strerror(int ecode) { return buf; } -#elif defined(WIN32) +#elif defined(_WIN32) const char * loc_gai_strerror(int ecode) { WCHAR * buf = NULL; @@ -1126,7 +1126,7 @@ const char * loc_gai_strerror(int ecode) { #endif -#if defined(WIN32) || defined(_WRS_KERNEL) || defined (__SYMBIAN32__) +#if defined(_WIN32) || defined(_WRS_KERNEL) || defined (__SYMBIAN32__) int is_daemon(void) { return 0; diff --git a/agent/tcf/framework/mdep.h b/agent/tcf/framework/mdep.h index b37de2a1..007acdd6 100644 --- a/agent/tcf/framework/mdep.h +++ b/agent/tcf/framework/mdep.h @@ -27,7 +27,7 @@ #define __STDC_FORMAT_MACROS 1 -#if defined(WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) /* MS Windows NT/XP */ #ifndef _WIN32_WINNT @@ -114,7 +114,11 @@ struct timespec { #if defined(__MINGW32__) typedef unsigned int useconds_t; #elif defined(_MSC_VER) -#define __i386__ +#if defined(_M_IX86) +# define __i386__ +#elif defined(_M_AMD64) +# define __x86_64__ +#endif #define strcasecmp(x,y) stricmp(x,y) typedef unsigned long pid_t; typedef unsigned long useconds_t; @@ -181,7 +185,7 @@ extern int utf8_rename(const char * path1, const char * path2); * readdir() emulation with UTF-8 support */ struct UTF8_DIR { - long hdl; + intptr_t hdl; struct _wfinddatai64_t blk; wchar_t * path; }; diff --git a/agent/tcf/framework/myalloc.c b/agent/tcf/framework/myalloc.c index 785e20cb..3e4525d3 100644 --- a/agent/tcf/framework/myalloc.c +++ b/agent/tcf/framework/myalloc.c @@ -29,10 +29,10 @@ #define POOL_SIZE (0x100000 * MEM_USAGE_FACTOR) static char * tmp_pool = NULL; -static unsigned tmp_pool_pos = 0; -static unsigned tmp_pool_max = 0; -static unsigned tmp_pool_avr = 0; -static unsigned tmp_alloc_size = 0; +static size_t tmp_pool_pos = 0; +static size_t tmp_pool_max = 0; +static size_t tmp_pool_avr = 0; +static size_t tmp_alloc_size = 0; static LINK tmp_alloc_list = TCF_LIST_INIT(tmp_alloc_list); static int tmp_gc_posted = 0; @@ -95,7 +95,7 @@ void * tmp_realloc(void * ptr, size_t size) { if (ptr == NULL) return tmp_alloc(size); if ((char *)ptr >= tmp_pool && (char *)ptr <= tmp_pool + tmp_pool_max) { size_t m = *((size_t *)ptr - 1); - unsigned pos = tmp_pool_pos - m; + size_t pos = tmp_pool_pos - m; if (ptr == tmp_pool + pos && pos + size <= tmp_pool_max) { tmp_pool_pos = pos + size; *((size_t *)ptr - 1) = size; diff --git a/agent/tcf/framework/peer.c b/agent/tcf/framework/peer.c index e69e3766..fdb99bf6 100644 --- a/agent/tcf/framework/peer.c +++ b/agent/tcf/framework/peer.c @@ -50,8 +50,8 @@ static void notify_listeners(PeerServer * ps, int type) { } static int is_same(PeerServer * a, PeerServer * b) { - int i; - int j; + unsigned i; + unsigned j; if (a->ind != b->ind) { return 0; @@ -109,7 +109,7 @@ PeerServer * peer_server_alloc(void) { } void peer_server_addprop(PeerServer * s, const char * name, const char * value) { - int i; + unsigned i; if (strcmp(name, "ID") == 0) { loc_free(name); @@ -134,7 +134,7 @@ void peer_server_addprop(PeerServer * s, const char * name, const char * value) } const char * peer_server_getprop(PeerServer * s, const char * name, const char * default_value) { - int i; + unsigned i; for (i = 0; i < s->ind; i++) { if (strcmp(s->list[i].name, name) == 0) { diff --git a/agent/tcf/framework/peer.h b/agent/tcf/framework/peer.h index 1aca9762..2937562b 100644 --- a/agent/tcf/framework/peer.h +++ b/agent/tcf/framework/peer.h @@ -33,10 +33,10 @@ struct PeerServerList { struct PeerServer { const char * id; - int max; - int ind; + unsigned max; + unsigned ind; PeerServerList * list; - unsigned int flags; + unsigned flags; time_t creation_time; time_t expiration_time; PeerServer * next; diff --git a/agent/tcf/framework/plugins.c b/agent/tcf/framework/plugins.c index c820d6a1..6d3b71e2 100644 --- a/agent/tcf/framework/plugins.c +++ b/agent/tcf/framework/plugins.c @@ -43,7 +43,7 @@ #define _QUOTEME(x) #x #define QUOTE(x) _QUOTEME(x) -#if defined(WIN32) +#if defined(_WIN32) #define PLUGINS_DEF_EXT "dll" /* Default plugins' extension */ #else #define PLUGINS_DEF_EXT "so" /* Default plugins' extension */ diff --git a/agent/tcf/framework/signames.c b/agent/tcf/framework/signames.c index 8cab1c8e..d100960b 100644 --- a/agent/tcf/framework/signames.c +++ b/agent/tcf/framework/signames.c @@ -22,7 +22,7 @@ #include <signal.h> #include <tcf/framework/signames.h> -#if defined(WIN32) +#if defined(_WIN32) typedef struct ExceptionName { DWORD code; diff --git a/agent/tcf/framework/trace.c b/agent/tcf/framework/trace.c index 636f6076..b2c3b2cb 100644 --- a/agent/tcf/framework/trace.c +++ b/agent/tcf/framework/trace.c @@ -27,7 +27,7 @@ int log_mode = LOG_EVENTS | LOG_CHILD | LOG_WAITPID | LOG_CONTEXT | LOG_PROTOCOL #include <string.h> #include <tcf/framework/mdep-threads.h> -#if defined(WIN32) +#if defined(_WIN32) #elif defined(_WRS_KERNEL) #elif defined(__SYMBIAN32__) #else @@ -46,7 +46,7 @@ int print_trace(int mode, const char * fmt, ...) { va_start(ap, fmt); if (is_daemon()) { -#if defined(WIN32) +#if defined(_WIN32) #elif defined(_WRS_KERNEL) #elif defined(__SYMBIAN32__) #else diff --git a/agent/tcf/framework/waitpid.c b/agent/tcf/framework/waitpid.c index e8e07e40..b64f84d4 100644 --- a/agent/tcf/framework/waitpid.c +++ b/agent/tcf/framework/waitpid.c @@ -50,7 +50,7 @@ void add_waitpid_listener(WaitPIDListener * listener, void * args) { listener_cnt++; } -#if defined(WIN32) +#if defined(_WIN32) #define MAX_HANDLES 64 diff --git a/agent/tcf/main/cmdline.c b/agent/tcf/main/cmdline.c index 741dc0de..c04dfa30 100644 --- a/agent/tcf/main/cmdline.c +++ b/agent/tcf/main/cmdline.c @@ -200,7 +200,7 @@ static int cmd_peers(char * s) { static int cmd_peerinfo(char * s) { PeerServer * ps; - int i; + unsigned i; printf("Peer information: %s\n", s); ps = peer_server_find(s); diff --git a/agent/tcf/main/main.c b/agent/tcf/main/main.c index 1d4099fc..d60a3540 100644 --- a/agent/tcf/main/main.c +++ b/agent/tcf/main/main.c @@ -82,7 +82,7 @@ static void signal_handler(int sig) { } } -#if defined(WIN32) +#if defined(_WIN32) static LONG NTAPI VectoredExceptionHandler(PEXCEPTION_POINTERS x) { if (is_dispatch_thread()) { DWORD exception_code = x->ExceptionRecord->ExceptionCode; @@ -308,7 +308,7 @@ int main(int argc, char ** argv) { signal(SIGILL, signal_handler); signal(SIGINT, signal_handler); signal(SIGTERM, signal_handler); -#if defined(WIN32) +#if defined(_WIN32) SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE); AddVectoredExceptionHandler(1, VectoredExceptionHandler); #endif diff --git a/agent/tcf/main/main_lua.c b/agent/tcf/main/main_lua.c index 87050493..0b300784 100644 --- a/agent/tcf/main/main_lua.c +++ b/agent/tcf/main/main_lua.c @@ -1261,7 +1261,7 @@ static int lua_peer_getid(lua_State *L) static int lua_peer_getnames(lua_State *L) { - int i; + unsigned i; struct peer_extra *pse = NULL; assert(L == luastate); @@ -1455,7 +1455,7 @@ int main(int argc, char ** argv) { log_mode = 0; -#ifndef WIN32 +#ifndef _WIN32 signal(SIGPIPE, SIG_IGN); #endif ini_mdep(); diff --git a/agent/tcf/main/test.c b/agent/tcf/main/test.c index 77ac3d8a..cb6ccffe 100644 --- a/agent/tcf/main/test.c +++ b/agent/tcf/main/test.c @@ -32,7 +32,7 @@ #include <tcf/framework/errors.h> #include <tcf/services/diagnostics.h> #include <tcf/main/test.h> -#if defined(WIN32) +#if defined(_WIN32) # include <system/Windows/tcf/context-win32.h> #endif @@ -190,7 +190,7 @@ int find_test_symbol(Context * ctx, const char * name, void ** addr, int * sym_c return -1; } -#if defined(WIN32) +#if defined(_WIN32) typedef struct ContextAttachArgs { ContextAttachCallBack * done; void * data; @@ -206,10 +206,10 @@ static void done_context_attach(int error, Context * ctx, void * data) { CloseHandle(args->process); loc_free(args); } -#endif /* defined(WIN32) */ +#endif /* defined(_WIN32) */ int run_test_process(ContextAttachCallBack * done, void * data) { -#if defined(WIN32) +#if defined(_WIN32) char fnm[FILE_PATH_SIZE]; char cmd[FILE_PATH_SIZE]; int res = 0; diff --git a/agent/tcf/services/discovery.c b/agent/tcf/services/discovery.c index 35dcd6ec..9fbac909 100644 --- a/agent/tcf/services/discovery.c +++ b/agent/tcf/services/discovery.c @@ -41,7 +41,7 @@ static const char * LOCATOR = "Locator"; static int peer_cnt = 0; static int write_peer_properties(PeerServer * ps, void * arg) { - int i; + unsigned i; OutputStream * out = (OutputStream *)arg; if (peer_cnt > 0) write_stream(out, ','); diff --git a/agent/tcf/services/discovery_udp.c b/agent/tcf/services/discovery_udp.c index df26dbc0..e310cf5b 100644 --- a/agent/tcf/services/discovery_udp.c +++ b/agent/tcf/services/discovery_udp.c @@ -409,7 +409,7 @@ static int udp_send_peer_info(PeerServer * ps, void * arg) { } if (send_size == 8) { - int i; + unsigned i; send_buf[4] = UDP_ACK_INFO; app_str("ID="); app_strz(ps->id); diff --git a/agent/tcf/services/filesystem.c b/agent/tcf/services/filesystem.c index 36458ced..bf6127ad 100644 --- a/agent/tcf/services/filesystem.c +++ b/agent/tcf/services/filesystem.c @@ -35,11 +35,11 @@ #if defined(__CYGWIN__) # include <ctype.h> #endif -#if !defined(WIN32) || defined(__CYGWIN__) +#if !defined(_WIN32) || defined(__CYGWIN__) # include <utime.h> # include <dirent.h> #endif -#if defined(WIN32) +#if defined(_WIN32) # include <Windows.h> #endif #if defined(_WRS_KERNEL) @@ -97,7 +97,7 @@ struct FileAttrs { int permissions; uint64_t atime; uint64_t mtime; -#if defined(WIN32) +#if defined(_WIN32) DWORD win32_attrs; #endif }; @@ -297,7 +297,7 @@ static void read_file_attrs(InputStream * inp, const char * nm, void * arg) { attrs->mtime = json_read_uint64(inp); attrs->flags |= ATTR_ACMODTIME; } -#if defined(WIN32) +#if defined(_WIN32) else if (strcmp(nm, "Win32Attrs") == 0) { attrs->win32_attrs = json_read_ulong(inp); } @@ -352,7 +352,7 @@ static void write_file_attrs(OutputStream * out, FileAttrs * attrs) { cnt++; } -#if defined(WIN32) +#if defined(_WIN32) if (attrs->win32_attrs != INVALID_FILE_ATTRIBUTES) { if (cnt) write_stream(out, ','); json_write_string(out, "Win32Attrs"); @@ -401,7 +401,7 @@ static void read_path(InputStream * inp, char * path, int size) { } strlcpy(path, buf, size); } -#elif defined(WIN32) +#elif defined(_WIN32) if (path[0] != 0 && path[1] == ':' && path[2] == '/') return; #elif defined(_WRS_KERNEL) { @@ -435,7 +435,7 @@ static void command_open(char * token, Channel * c) { flags = json_read_ulong(&c->inp); if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX); memset(&attrs, 0, sizeof(FileAttrs)); -#if defined(WIN32) +#if defined(_WIN32) attrs.win32_attrs = INVALID_FILE_ATTRIBUTES; #endif json_read_struct(&c->inp, read_file_attrs, &attrs); @@ -451,7 +451,7 @@ static void command_open(char * token, Channel * c) { err = errno; } else { -#if defined(WIN32) +#if defined(_WIN32) if (attrs.win32_attrs != INVALID_FILE_ATTRIBUTES) { if (SetFileAttributes(path, attrs.win32_attrs) == 0) err = set_win32_errno(GetLastError()); @@ -498,7 +498,7 @@ static void reply_stat(char * token, OutputStream * out, int err, struct stat * if (err == 0) fill_attrs(&attrs, buf); else memset(&attrs, 0, sizeof(attrs)); -#if defined(WIN32) +#if defined(_WIN32) attrs.win32_attrs = err ? INVALID_FILE_ATTRIBUTES : GetFileAttributes(path); #endif @@ -629,11 +629,11 @@ static void post_io_request(OpenFileInfo * handle) { if (attrs.flags & ATTR_SIZE) { if (ftruncate(handle->file, attrs.size) < 0) err = errno; } -#if defined(WIN32) || defined(_WRS_KERNEL) +#if defined(_WIN32) || defined(_WRS_KERNEL) if (attrs.flags & ATTR_PERMISSIONS) { if (chmod(handle->path, attrs.permissions) < 0) err = errno; } -#if defined(WIN32) +#if defined(_WIN32) if (attrs.win32_attrs != INVALID_FILE_ATTRIBUTES) { if (SetFileAttributes(handle->path, attrs.win32_attrs) == 0) err = set_win32_errno(GetLastError()); @@ -849,7 +849,7 @@ static void command_setstat(char * token, Channel * c) { read_path(&c->inp, path, sizeof(path)); if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX); memset(&attrs, 0, sizeof(FileAttrs)); -#if defined(WIN32) +#if defined(_WIN32) attrs.win32_attrs = INVALID_FILE_ATTRIBUTES; #endif json_read_struct(&c->inp, read_file_attrs, &attrs); @@ -859,7 +859,7 @@ static void command_setstat(char * token, Channel * c) { if (attrs.flags & ATTR_SIZE) { if (truncate(path, attrs.size) < 0) err = errno; } -#if !defined(WIN32) && !defined(_WRS_KERNEL) +#if !defined(_WIN32) && !defined(_WRS_KERNEL) if (attrs.flags & ATTR_UIDGID) { if (chown(path, attrs.uid, attrs.gid) < 0) err = errno; } @@ -873,7 +873,7 @@ static void command_setstat(char * token, Channel * c) { buf.modtime = (time_t)(attrs.mtime / 1000); if (utime(path, &buf) < 0) err = errno; } -#if defined(WIN32) +#if defined(_WIN32) if (attrs.win32_attrs != INVALID_FILE_ATTRIBUTES) { if (SetFileAttributes(path, attrs.win32_attrs) == 0) err = set_win32_errno(GetLastError()); @@ -891,7 +891,7 @@ static void command_fsetstat(char * token, Channel * c) { json_read_string(&c->inp, id, sizeof(id)); if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX); memset(&attrs, 0, sizeof(FileAttrs)); -#if defined(WIN32) +#if defined(_WIN32) attrs.win32_attrs = INVALID_FILE_ATTRIBUTES; #endif json_read_struct(&c->inp, read_file_attrs, &attrs); @@ -978,7 +978,7 @@ static void command_readdir(char * token, Channel * c) { snprintf(path, sizeof(path), "%s/%s", h->path, e->d_name); if (stat(path, &st) == 0) { fill_attrs(&attrs, &st); -#if defined(WIN32) +#if defined(_WIN32) attrs.win32_attrs = GetFileAttributes(path); #endif write_stream(&c->out, ','); @@ -1040,7 +1040,7 @@ static void command_mkdir(char * token, Channel * c) { read_path(&c->inp, path, sizeof(path)); if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX); memset(&attrs, 0, sizeof(FileAttrs)); -#if defined(WIN32) +#if defined(_WIN32) attrs.win32_attrs = INVALID_FILE_ATTRIBUTES; #endif json_read_struct(&c->inp, read_file_attrs, &attrs); @@ -1055,7 +1055,7 @@ static void command_mkdir(char * token, Channel * c) { #else if (mkdir(path, mode) < 0) err = errno; #endif -#if defined(WIN32) +#if defined(_WIN32) if (attrs.win32_attrs != INVALID_FILE_ATTRIBUTES) { if (SetFileAttributes(path, attrs.win32_attrs) == 0) err = set_win32_errno(GetLastError()); @@ -1126,7 +1126,7 @@ static void command_readlink(char * token, Channel * c) { if (read_stream(&c->inp) != MARKER_EOM) exception(ERR_JSON_SYNTAX); link[0] = 0; -#if defined(WIN32) || defined(_WRS_KERNEL) +#if defined(_WIN32) || defined(_WRS_KERNEL) err = ENOSYS; #else if (readlink(path, link, sizeof(link)) < 0) err = errno; @@ -1151,7 +1151,7 @@ static void command_symlink(char * token, Channel * c) { if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX); if (read_stream(&c->inp) != MARKER_EOM) exception(ERR_JSON_SYNTAX); -#if defined(WIN32) || defined(_WRS_KERNEL) +#if defined(_WIN32) || defined(_WRS_KERNEL) err = ENOSYS; #else if (symlink(target, link) < 0) err = errno; @@ -1219,7 +1219,7 @@ static void command_copy(char * token, Channel * c) { if (utime(dst, &buf) < 0) err = errno; } if (err == 0 && copy_perms && chmod(dst, st.st_mode) < 0) err = errno; -#if !defined(WIN32) && !defined(_WRS_KERNEL) +#if !defined(_WIN32) && !defined(_WRS_KERNEL) if (err == 0 && copy_uidgid && chown(dst, st.st_uid, st.st_gid) < 0) err = errno; #endif @@ -1256,7 +1256,7 @@ static void command_roots(char * token, Channel * c) { write_stringz(&c->out, token); write_stream(&c->out, '['); -#ifdef WIN32 +#ifdef _WIN32 { int cnt = 0; int disk = 0; diff --git a/agent/tcf/services/linenumbers_win32.c b/agent/tcf/services/linenumbers_win32.c index 830beac5..fac43d7d 100644 --- a/agent/tcf/services/linenumbers_win32.c +++ b/agent/tcf/services/linenumbers_win32.c @@ -21,7 +21,7 @@ #include <tcf/config.h> -#if SERVICE_LineNumbers && !ENABLE_LineNumbersProxy && defined(WIN32) && !ENABLE_ELF +#if SERVICE_LineNumbers && !ENABLE_LineNumbersProxy && defined(_WIN32) && !ENABLE_ELF #include <errno.h> #include <assert.h> diff --git a/agent/tcf/services/processes.c b/agent/tcf/services/processes.c index ac2f32c7..1f897400 100644 --- a/agent/tcf/services/processes.c +++ b/agent/tcf/services/processes.c @@ -55,7 +55,7 @@ static const char * PROCESSES[2] = { "Processes", "ProcessesV1" }; #endif -#if defined(WIN32) +#if defined(_WIN32) # include <tlhelp32.h> # ifdef _MSC_VER # pragma warning(disable:4201) /* nonstandard extension used : nameless struct/union (in winternl.h) */ @@ -309,7 +309,7 @@ static void command_get_context(char * token, Channel * c) { write_stringz(&c->out, token); if (pid != 0 && parent == 0) { -#if defined(WIN32) +#if defined(_WIN32) #elif defined(_WRS_KERNEL) if (TASK_ID_VERIFY(pid) == ERROR) err = ERR_INV_CONTEXT; #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) @@ -353,7 +353,7 @@ static void command_get_children(char * token, Channel * c) { write_stringz(&c->out, "null"); } else { -#if defined(WIN32) +#if defined(_WIN32) DWORD err = 0; HANDLE snapshot; PROCESSENTRY32 pe32; @@ -611,7 +611,7 @@ static void command_terminate(char * token, Channel * c) { err = ERR_INV_CONTEXT; } else { -#if defined(WIN32) +#if defined(_WIN32) HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, pid); if (h == NULL) { err = set_win32_errno(GetLastError()); @@ -645,7 +645,7 @@ static void command_signal(char * token, Channel * c) { write_stringz(&c->out, "R"); write_stringz(&c->out, token); -#if defined(WIN32) +#if defined(_WIN32) err = ENOSYS; #elif defined(_WRS_KERNEL) if (kill(pid, signal) < 0) err = errno; @@ -922,7 +922,7 @@ static ProcessOutput * read_process_output(ChildProcess * prs, int fd) { # define context_attach_self() (errno = ERR_UNSUPPORTED, -1) #endif -#if defined(WIN32) +#if defined(_WIN32) static int start_process_imp(Channel * c, char ** envp, const char * dir, const char * exe, char ** args, ProcessStartParams * params, int * selfattach, ChildProcess ** prs) { @@ -997,7 +997,7 @@ static int start_process_imp(Channel * c, char ** envp, const char * dir, const DWORD id = GetCurrentProcessId(); for (i = 0; i < hi->Count; i++) { if (hi->Handles[i].ProcessId != id) continue; - SetHandleInformation((HANDLE)(int)hi->Handles[i].Handle, HANDLE_FLAG_INHERIT, FALSE); + SetHandleInformation((HANDLE)(uintptr_t)hi->Handles[i].Handle, HANDLE_FLAG_INHERIT, FALSE); } } else { diff --git a/agent/tcf/services/symbols_win32.c b/agent/tcf/services/symbols_win32.c index b6fb6633..d9c24952 100644 --- a/agent/tcf/services/symbols_win32.c +++ b/agent/tcf/services/symbols_win32.c @@ -19,7 +19,7 @@ #include <tcf/config.h> -#if SERVICE_Symbols && !ENABLE_SymbolsProxy && defined(WIN32) && !ENABLE_ELF +#if SERVICE_Symbols && !ENABLE_SymbolsProxy && defined(_WIN32) && !ENABLE_ELF #include <errno.h> #include <assert.h> @@ -249,7 +249,7 @@ const char * symbol2id(const Symbol * sym) { snprintf(buf, sizeof(buf), "@P%"PRIX64".%s", (uint64_t)sym->length, base); } else { - int i = sym->info ? sym->info - basic_type_info + 1 : 0; + int i = sym->info ? (int)(sym->info - basic_type_info) + 1 : 0; snprintf(buf, sizeof(buf), "@S%"PRIX64".%lX.%X.%X.%s", (uint64_t)sym->module, sym->index, sym->frame, i, sym->ctx->id); } diff --git a/agent/tcf/services/sysmon.c b/agent/tcf/services/sysmon.c index 7a710072..ce70c17d 100644 --- a/agent/tcf/services/sysmon.c +++ b/agent/tcf/services/sysmon.c @@ -408,7 +408,7 @@ static void command_get_environment(char * token, Channel * c) { write_stream(&c->out, MARKER_EOM); } -#elif defined(WIN32) +#elif defined(_WIN32) #include <windows.h> #include <wchar.h> @@ -540,7 +540,6 @@ static RTL_USER_PROCESS_PARAMETERS upa; static int get_process_info(HANDLE prs) { static LONG (NTAPI * QueryInformationProcessProc)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG) = NULL; - SIZE_T len = 0; memset(&pbi, 0, sizeof(pbi)); memset(&peb, 0, sizeof(peb)); @@ -553,19 +552,19 @@ static int get_process_info(HANDLE prs) { return -1; } } - if (QueryInformationProcessProc(prs, ProcessBasicInformation, &pbi, sizeof(pbi), &len) < 0) { + if (QueryInformationProcessProc(prs, ProcessBasicInformation, &pbi, sizeof(pbi), NULL) < 0) { set_win32_errno(GetLastError()); return -1; } if (pbi.PebBaseAddress != NULL) { - if (ReadProcessMemory(prs, (LPCVOID)pbi.PebBaseAddress, &peb, sizeof(peb), &len) == 0) { + if (ReadProcessMemory(prs, (LPCVOID)pbi.PebBaseAddress, &peb, sizeof(peb), NULL) == 0) { set_win32_errno(GetLastError()); return -1; } if (peb.ProcessParameters != NULL) { - if (ReadProcessMemory(prs, (LPCVOID)peb.ProcessParameters, &upa, sizeof(upa), &len) == 0) { + if (ReadProcessMemory(prs, (LPCVOID)peb.ProcessParameters, &upa, sizeof(upa), NULL) == 0) { set_win32_errno(GetLastError()); return -1; } @@ -584,8 +583,8 @@ static int write_unicode_string(OutputStream * out, HANDLE prs, UNICODE_STRING s if (buff_size > sizeof(w_fnm)) buff_size = sizeof(w_fnm); if (ReadProcessMemory(prs, (LPCVOID)str.Buffer, w_fnm, buff_size, &read_size)) { char a_fnm[FILE_PATH_SIZE * 4]; - DWORD k = wcslen(w_fnm); - int n = WideCharToMultiByte(CP_UTF8, 0, w_fnm, k, a_fnm, sizeof(a_fnm), NULL, NULL); + size_t k = wcslen(w_fnm); + int n = WideCharToMultiByte(CP_UTF8, 0, w_fnm, (int)k, a_fnm, sizeof(a_fnm), NULL, NULL); a_fnm[n] = 0; write_stream(out, ','); json_write_string(out, name); diff --git a/agent/tcf/services/tcf_elf.c b/agent/tcf/services/tcf_elf.c index 8c6e9db9..2e69e43b 100644 --- a/agent/tcf/services/tcf_elf.c +++ b/agent/tcf/services/tcf_elf.c @@ -44,7 +44,7 @@ #if defined(_WRS_KERNEL) #elif defined(_MSC_VER) # define USE_MMAP -#elif defined(WIN32) +#elif defined(_WIN32) #else # include <sys/mman.h> # define USE_MMAP @@ -97,7 +97,7 @@ static void elf_dispose(ELF_File * file) { ELF_Section * s = file->sections + n; #if !defined(USE_MMAP) loc_free(s->data); -#elif defined(WIN32) +#elif defined(_WIN32) UnmapViewOfFile(s->data); #else if (s->mmap_addr != NULL) munmap(s->mmap_addr, s->mmap_size); @@ -108,7 +108,7 @@ static void elf_dispose(ELF_File * file) { } loc_free(file->sections); } -#if defined(WIN32) +#if defined(_WIN32) if (file->mmap_handle != NULL) CloseHandle(file->mmap_handle); #endif release_error_report(file->error); @@ -302,7 +302,7 @@ static char * get_debug_info_file_name(ELF_File * file, int * error) { char * lnm = fnm; struct stat buf; char * name = (char *)sec->data; - int l = strlen(file->name); + int l = (int)strlen(file->name); while (l > 0 && file->name[l - 1] != '/' && file->name[l - 1] != '\\') l--; if (strcmp(file->name + l, name) != 0) { snprintf(fnm, sizeof(fnm), "%.*s%s", l, file->name, name); @@ -657,7 +657,7 @@ int elf_load(ELF_Section * s) { } #ifdef USE_MMAP -#ifdef WIN32 +#ifdef _WIN32 { ELF_File * file = s->file; if (file->mmap_handle == NULL) { diff --git a/agent/tcf/services/tcf_elf.h b/agent/tcf/services/tcf_elf.h index 643544a3..c9b2b5b1 100644 --- a/agent/tcf/services/tcf_elf.h +++ b/agent/tcf/services/tcf_elf.h @@ -23,12 +23,12 @@ #if ENABLE_ELF -#if !defined(WIN32) && !defined(__APPLE__) +#if !defined(_WIN32) && !defined(__APPLE__) # include <elf.h> #endif #include <tcf/framework/context.h> -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) #define EI_MAG0 0 #define EI_MAG1 1 @@ -252,7 +252,7 @@ typedef struct { #endif -#if defined(_WRS_KERNEL) || defined(WIN32) || defined(__APPLE__) +#if defined(_WRS_KERNEL) || defined(_WIN32) || defined(__APPLE__) typedef uint64_t Elf64_Addr; typedef uint16_t Elf64_Half; @@ -389,7 +389,7 @@ struct ELF_File { ErrorReport * error; int fd; -#if defined(WIN32) +#if defined(_WIN32) HANDLE mmap_handle; #endif diff --git a/agent/tcf/services/terminals.c b/agent/tcf/services/terminals.c index 48e8d59d..fbe7aed6 100644 --- a/agent/tcf/services/terminals.c +++ b/agent/tcf/services/terminals.c @@ -48,7 +48,7 @@ static const char * TERMINALS = "Terminals"; -#if defined(WIN32) +#if defined(_WIN32) # define TERM_LAUNCH_EXEC "cmd" # define TERM_LAUNCH_ARGS {TERM_LAUNCH_EXEC, NULL} struct winsize { @@ -232,7 +232,7 @@ static int kill_term(Terminal * term) { int err = 0; int pid = get_process_pid(term->prs); -#if defined(WIN32) +#if defined(_WIN32) HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, pid); if (h == NULL) { err = set_win32_errno(GetLastError()); @@ -291,7 +291,7 @@ static void terminal_exited(void * args) { loc_free(term); } -#if !defined(WIN32) +#if !defined(_WIN32) /* * Set the environment variable "name" to the value "value". If the variable * exists already, override it or just skip. @@ -420,7 +420,7 @@ static void command_launch(char * token, Channel * c) { if (read_stream(&c->inp) != 0) exception(ERR_JSON_SYNTAX); if (read_stream(&c->inp) != MARKER_EOM) exception(ERR_JSON_SYNTAX); -#if !defined(WIN32) +#if !defined(_WIN32) { struct stat st; if (err == 0 && stat(exec, &st) != 0) { @@ -461,7 +461,7 @@ static void command_launch(char * token, Channel * c) { if (err == 0 && start_process(c, &prms, &selfattach, &term->prs) < 0) err = errno; if (!err) { -#if !defined(WIN32) +#if !defined(_WIN32) struct winsize size; int tty = get_process_tty(term->prs); memset(&size, 0, sizeof(struct winsize)); @@ -525,7 +525,7 @@ static void command_set_win_size(char * token, Channel * c) { err = ERR_INV_CONTEXT; } else if (term->width != size.ws_col || term->height != size.ws_row) { -#if defined(WIN32) +#if defined(_WIN32) #else int tty = get_process_tty(term->prs); if (ioctl(tty, TIOCSWINSZ, &size) < 0) err = errno; diff --git a/agent/tcf/services/vm.c b/agent/tcf/services/vm.c index 58f21697..4bf94809 100644 --- a/agent/tcf/services/vm.c +++ b/agent/tcf/services/vm.c @@ -29,8 +29,8 @@ static VMState * state = NULL; static uint8_t * code = NULL; -static unsigned code_pos = 0; -static unsigned code_len = 0; +static size_t code_pos = 0; +static size_t code_len = 0; static void inv_dwarf(const char * msg) { str_exception(ERR_INV_DWARF, msg); diff --git a/examples/daytime/Makefile b/examples/daytime/Makefile index 91bc280d..71ed161b 100644 --- a/examples/daytime/Makefile +++ b/examples/daytime/Makefile @@ -12,7 +12,7 @@ EXECS = $(BINDIR)/agent$(EXTEXE) all: $(EXECS) $(BINDIR)/libtcf$(EXTLIB) : $(OFILES) - $(AR) -rc $@ $^ + $(AR) $(AR_FLAGS) $@ $^ $(RANLIB) $(BINDIR)/agent$(EXTEXE): $(BINDIR)/tcf/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) diff --git a/server/Makefile b/server/Makefile index 65e7fe0a..f26a441b 100644 --- a/server/Makefile +++ b/server/Makefile @@ -12,7 +12,7 @@ EXECS = $(BINDIR)/server$(EXTEXE) all: $(EXECS) $(BINDIR)/libtcf$(EXTLIB) : $(OFILES) - $(AR) -rc $@ $^ + $(AR) $(AR_FLAGS) $@ $^ $(RANLIB) $(BINDIR)/server$(EXTEXE): $(BINDIR)/tcf/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) diff --git a/server/server.sln b/server/server.sln index d206d039..093e1078 100644 --- a/server/server.sln +++ b/server/server.sln @@ -1,18 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C++ Express 2008
+# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "server.vcproj", "{4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}.Debug|Win32.ActiveCfg = Debug|Win32
{4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}.Debug|Win32.Build.0 = Debug|Win32
+ {4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}.Debug|x64.ActiveCfg = Debug|x64
+ {4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}.Debug|x64.Build.0 = Debug|x64
{4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}.Release|Win32.ActiveCfg = Release|Win32
{4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}.Release|Win32.Build.0 = Release|Win32
+ {4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}.Release|x64.ActiveCfg = Release|x64
+ {4EBA43E4-98C0-4F00-ADA7-21758F1BAE77}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/server/server.vcproj b/server/server.vcproj index ed91d3f9..5501097f 100644 --- a/server/server.vcproj +++ b/server/server.vcproj @@ -12,14 +12,17 @@ <Platform
Name="Win32"
/>
+ <Platform
+ Name="x64"
+ />
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
- OutputDirectory=".\obj\MSVC\Debug"
- IntermediateDirectory=".\obj\MSVC\Debug"
+ OutputDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
@@ -42,7 +45,7 @@ Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;../agent"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ PreprocessorDefinitions="_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -94,8 +97,8 @@ </Configuration>
<Configuration
Name="Release|Win32"
- OutputDirectory=".\obj\MSVC\Release"
- IntermediateDirectory=".\obj\MSVC\Release"
+ OutputDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
@@ -120,7 +123,7 @@ Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories=".;../agent"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ PreprocessorDefinitions="NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
@@ -171,6 +174,163 @@ Name="VCPostBuildEventTool"
/>
</Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=".;../agent"
+ PreprocessorDefinitions="_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="WS2_32.lib Iphlpapi.lib"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(SolutionDir)\obj\MSVC\$(PlatformName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ TargetEnvironment="3"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories=".;../agent"
+ PreprocessorDefinitions="NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ CompileAs="1"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="WS2_32.lib Iphlpapi.lib"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="2"
+ TargetMachine="17"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
</Configurations>
<References>
</References>
diff --git a/tests/cmd-line/Makefile b/tests/cmd-line/Makefile index c17dc195..5e7bf46d 100644 --- a/tests/cmd-line/Makefile +++ b/tests/cmd-line/Makefile @@ -12,7 +12,7 @@ EXECS = $(BINDIR)/agent$(EXTEXE) all: $(EXECS) $(BINDIR)/libtcf$(EXTLIB) : $(OFILES) - $(AR) -rc $@ $^ + $(AR) $(AR_FLAGS) $@ $^ $(RANLIB) $(BINDIR)/agent$(EXTEXE): $(BINDIR)/tcf/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) diff --git a/tests/mem-leaks/Makefile b/tests/mem-leaks/Makefile index 91bc280d..71ed161b 100644 --- a/tests/mem-leaks/Makefile +++ b/tests/mem-leaks/Makefile @@ -12,7 +12,7 @@ EXECS = $(BINDIR)/agent$(EXTEXE) all: $(EXECS) $(BINDIR)/libtcf$(EXTLIB) : $(OFILES) - $(AR) -rc $@ $^ + $(AR) $(AR_FLAGS) $@ $^ $(RANLIB) $(BINDIR)/agent$(EXTEXE): $(BINDIR)/tcf/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) diff --git a/tests/test-dwarf/Makefile b/tests/test-dwarf/Makefile index 657b0729..0bb478be 100644 --- a/tests/test-dwarf/Makefile +++ b/tests/test-dwarf/Makefile @@ -12,7 +12,7 @@ EXECS = $(BINDIR)/dwarf-test$(EXTEXE) all: $(EXECS) $(BINDIR)/libtcf$(EXTLIB) : $(OFILES) - $(AR) -rc $@ $^ + $(AR) $(AR_FLAGS) $@ $^ $(RANLIB) $(BINDIR)/dwarf-test$(EXTEXE): $(BINDIR)/tcf/main/main$(EXTOBJ) $(BINDIR)/libtcf$(EXTLIB) |