From 1fea4e6d87826fcf84a5373fc29b078061c6232a Mon Sep 17 00:00:00 2001 From: xorstream Date: Fri, 20 Jan 2017 22:34:14 +1100 Subject: [PATCH] Some small changes to clean up before pull request. --- .../msvc_native/sample_x86/sample_x86.vcxproj | 18 ++++++-- bindings/msvc_native/unicorn/unicorn.vcxproj | 31 ++++++++++++- include/unicorn/unicorn.h | 4 ++ samples/sample_x86.c | 46 ------------------- 4 files changed, 48 insertions(+), 51 deletions(-) diff --git a/bindings/msvc_native/sample_x86/sample_x86.vcxproj b/bindings/msvc_native/sample_x86/sample_x86.vcxproj index 97c8148a..ae7fb5a8 100644 --- a/bindings/msvc_native/sample_x86/sample_x86.vcxproj +++ b/bindings/msvc_native/sample_x86/sample_x86.vcxproj @@ -68,15 +68,21 @@ true + $(ProjectDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ true + $(ProjectDir)$(Platform)\$(Configuration)\ false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ false + $(ProjectDir)$(Platform)\$(Configuration)\ @@ -87,11 +93,12 @@ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;__i386__ MultiThreadedDebug ../../../include + false Console true - ../Debug + $(SolutionDir)$(Platform)\$(Configuration)\ @@ -103,11 +110,12 @@ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;__x86_64__ MultiThreadedDebug ../../../include + false Console true - ../x64/Debug + $(SolutionDir)$(Platform)\$(Configuration)\ @@ -121,13 +129,14 @@ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;__i386__ MultiThreaded ../../../include + false Console true true true - ../Release + $(SolutionDir)$(Platform)\$(Configuration)\ @@ -141,13 +150,14 @@ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;__x86_64__ MultiThreaded ../../../include + false Console true true true - ../x64/Release + $(SolutionDir)$(Platform)\$(Configuration)\ diff --git a/bindings/msvc_native/unicorn/unicorn.vcxproj b/bindings/msvc_native/unicorn/unicorn.vcxproj index 080d702f..1d7eab32 100644 --- a/bindings/msvc_native/unicorn/unicorn.vcxproj +++ b/bindings/msvc_native/unicorn/unicorn.vcxproj @@ -216,7 +216,20 @@ - + + $(ProjectDir)$(Platform)\$(Configuration)\ + $(SolutionDir)$(Platform)\$(Configuration)\ + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(ProjectDir)$(Platform)\$(Configuration)\ + + + $(ProjectDir)$(Platform)\$(Configuration)\ + + + $(ProjectDir)$(Platform)\$(Configuration)\ + @@ -233,6 +246,10 @@ Windows true + + $(SolutionDir)$(Platform)\$(Configuration)\ + ws2_32.lib;x86_64-softmmu.lib + @@ -250,6 +267,10 @@ Windows true + + $(SolutionDir)$(Platform)\$(Configuration)\ + ws2_32.lib;x86_64-softmmu.lib + @@ -271,6 +292,10 @@ true true + + $(SolutionDir)$(Platform)\$(Configuration)\ + ws2_32.lib;x86_64-softmmu.lib + @@ -292,6 +317,10 @@ true true + + $(SolutionDir)$(Platform)\$(Configuration)\ + ws2_32.lib;x86_64-softmmu.lib + diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index 6e08191a..961742fe 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -8,6 +8,10 @@ extern "C" { #endif +#ifdef _MSC_VER +#pragma comment(lib, "unicorn.lib") +#endif + #include "platform.h" #include #if defined(UNICORN_HAS_OSXKERNEL) diff --git a/samples/sample_x86.c b/samples/sample_x86.c index 609304ad..5e9b5c06 100644 --- a/samples/sample_x86.c +++ b/samples/sample_x86.c @@ -3,39 +3,7 @@ /* Sample code to demonstrate how to emulate X86 code */ -#include "platform.h" #include - -#pragma comment(lib, "ws2_32.lib") -#pragma comment(lib, "unicorn.lib") -#pragma comment(lib, "x86_64-softmmu.lib") - -/* -// windows specific -#ifdef _MSC_VER -#include -#include -#define PRIx64 "llX" -#ifdef DYNLOAD -#include "unicorn_dynload.h" -#else // DYNLOAD -#include -#ifdef _WIN64 -#pragma comment(lib, "unicorn_staload64.lib") -#else // _WIN64 -#pragma comment(lib, "unicorn_staload.lib") -#endif // _WIN64 -#endif // DYNLOAD - -// posix specific -#else // _MSC_VER -#include "platform.h" -#include "platform.h" -#include -#endif // _MSC_VER -*/ - -// common includes #include @@ -999,16 +967,6 @@ static void test_x86_16(void) int main(int argc, char **argv, char **envp) { - // dynamically load shared library -#ifdef DYNLOAD - if (!uc_dyn_load(NULL, 0)) { - printf("Error dynamically loading shared library.\n"); - printf("Please check that unicorn.dll/unicorn.so is available as well as\n"); - printf("any other dependent dll/so files.\n"); - return 1; - } -#endif - if (argc == 2) { if (!strcmp(argv[1], "-16")) { test_x86_16(); @@ -1047,10 +1005,6 @@ int main(int argc, char **argv, char **envp) test_x86_64_syscall(); } - // dynamically free shared library -#ifdef DYNLOAD - uc_dyn_free(); -#endif return 0; }