BearKidsTeam / VirtoolsScriptDeobfuscation

Other
10 stars 2 forks source link

Cannot build (VS2022) #4

Closed xchellx closed 2 years ago

xchellx commented 2 years ago

Yes I have the 3.5 SDK. Yes, I placed it so the includes and libs directories match up with the SDK (%VIRTOOLS35SDKROOT%\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation). It is complaining of a unresolved external symbol, which from what I've read has to do with the runtimes of the static libraries not matching the library of the built project consuming the static libraries. I would compile this with VS2005 but it is in the VCXPROJ format (which was introduced in VS2010) and even building it in the V90 toolset in VS2010, it still fails because your code uses newer C++11 features which the V90 toolset does not support. A guide on what is needed to build this would be helpful.

Build started...
1>------ Build started: Project: Custom, Configuration: Release Win32 ------
1>StdAfx.cpp
1>D:\Virtools 3.5 SDK\Sdk\Includes\CKPathSplitter.h(127,11): warning C4996: 'strcmpi': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strcmpi. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Includes\XHashFun.h(60,67): warning C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _stricmp. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Includes\CKContext.h(344,4): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Includes\CKContext.h(347,5): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Includes\CKContext.h(352,4): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Includes\CKContext.h(343,4): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Includes\CKContext.h(351,4): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>BBDecoder.cpp
1>Custom.cpp
1>Decorator.cpp
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(32,23): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(33,28): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(397,35): warning C4244: '+=': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(404,29): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(423,40): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(424,35): warning C4244: '+=': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(435,34): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(436,34): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(437,49): warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(438,22): warning C4244: 'return': conversion from 'float' to 'int', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(456,40): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(457,20): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(464,19): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(465,19): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(475,40): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(476,40): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(483,19): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(484,57): warning C4244: '=': conversion from 'int' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(553,26): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(554,27): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(714,19): warning C4244: 'initializing': conversion from 'const _Ty' to 'float', possible loss of data
1>        with
1>        [
1>            _Ty=double
1>        ]
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(715,20): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(716,48): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Decorator.cpp(716,36): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
1>FreeBlock.cpp
1>Generator.cpp
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Generator.cpp(39,21): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Generator.cpp(40,21): warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Generator.cpp(228,2): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Generator.cpp(237,2): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Generator.cpp(241,15): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>Parser.cpp
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Parser.cpp(304,14): warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Parser.cpp(371,2): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Parser.cpp(382,2): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Parser.cpp(391,2): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>D:\Virtools 3.5 SDK\Sdk\Samples\Plugins\VirtoolsScriptDeobfuscation\Parser.cpp(402,2): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>Generating Code...
1>D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppBuild.targets(1361,5): warning MSB8012: TargetPath(D:\Virtools 3.5 SDK\Sdk\Temp\Win32\Custom\Release\Custom.dll) does not match the Linker's OutputFile property value (D:\Virtools 3.5 SDK\BuildingBlocks\Custom.dll). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>.\Custom.def(4): warning LNK4017: DESCRIPTION statement not supported for the target platform; ignored
1>   Creating library ..\..\..\Temp\Win32\Custom\Release\Custom.lib and object ..\..\..\Temp\Win32\Custom\Release\Custom.exp
1>Decorator.obj : error LNK2019: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) referenced in function "void __cdecl std::_Throw_tree_length_error(void)" (?_Throw_tree_length_error@std@@YAXXZ)
1>Parser.obj : error LNK2001: unresolved external symbol "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z)
1>..\..\..\..\BuildingBlocks\Custom.dll : fatal error LNK1120: 1 unresolved externals
1>Done building project "Custom.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
xchellx commented 2 years ago

There is a workaround for now, I created stdshim.cpp with the content below:

#include "precomp.h"

namespace std
{
    void __cdecl _Xlength_error(char const*) {
        return;
    }
}
yyc12345 commented 2 years ago

Thank you for your report. We have acknowledged this issue.

First of all, change build configurations and build this plugin in Debug mode. It has been said in readme.

Build with VS2017 under Debug mode

The reason of this problem is that a extra fields was filled in Release mode. This field is located in Linker - Input - Ignore specific default library. And it should not be filled originally. Maybe this field was inherited from parent project accidently.

A guide of compiling this project only was written in Chinese readme and do not synchronized with English readme in time. It is my fault. This problem will be solved in future quickly.