Merge pull request #683 from tandasat/master
edit documents and comments
This commit is contained in:
commit
f15196e484
1
HACK.TXT
1
HACK.TXT
|
@ -20,6 +20,7 @@ Capstone source is organized as followings.
|
|||
├── include <- API headers in C language (*.h)
|
||||
├── msvc <- Microsoft Visual Studio support (for Windows compile)
|
||||
├── packages <- Packages for Linux/OSX/BSD.
|
||||
├── windows <- Windows support (for Windows kernel driver compile)
|
||||
├── suite <- Development test tools - for Capstone developers only
|
||||
├── tests <- Test code (in C language)
|
||||
└── xcode <- Xcode support (for MacOSX compile)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// generate capstone_static_winkernel.lib. It can be done by adding the
|
||||
// capstone_static_winkernel project to your solution and compiling it first.
|
||||
//
|
||||
// Then, configure your drive project (cs_driver in this example) to locate to
|
||||
// Then, configure your driver project (cs_driver in this example) to locate to
|
||||
// capstone.h and capstone_static_winkernel.lib. To do it, open project
|
||||
// properties of the project and set Configuration to "All Configurations" and
|
||||
// Platform to "All Platforms". Then, add the following entries:
|
||||
|
|
2
cs.c
2
cs.c
|
@ -340,7 +340,7 @@ static uint8_t skipdata_size(cs_struct *handle)
|
|||
switch(handle->arch) {
|
||||
default:
|
||||
// should never reach
|
||||
return -1;
|
||||
return (uint8_t)-1;
|
||||
case CS_ARCH_ARM:
|
||||
// skip 2 bytes on Thumb mode.
|
||||
if (handle->mode & CS_MODE_THUMB)
|
||||
|
|
|
@ -22,7 +22,7 @@ typedef unsigned char bool;
|
|||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
#else
|
||||
// not MSVC -> C99 is supported
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
|
|
@ -24,4 +24,4 @@ This directory contains some test code to show how to use Capstone API.
|
|||
architecture.
|
||||
|
||||
- test_winkernel.cpp
|
||||
This code show how to use Capstone from a Windows driver.
|
||||
This code shows how to use Capstone from a Windows driver.
|
||||
|
|
|
@ -13,9 +13,16 @@ extern "C" {
|
|||
}
|
||||
#endif
|
||||
|
||||
EXTERN_C DRIVER_INITIALIZE DriverEntry;
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4005) // 'identifier' : macro redefinition
|
||||
#pragma warning(disable : 4007) // 'main': must be '__cdecl'
|
||||
#pragma warning(disable : 4005) // 'identifier' : macro redefinition
|
||||
#pragma warning(disable : 4007) // 'main': must be '__cdecl'
|
||||
|
||||
// Drivers must protect floating point hardware state. See use of float simm:
|
||||
// Use KeSaveFloatingPointState/KeRestoreFloatingPointState around floating
|
||||
// point operations. Display Drivers should use the corresponding Eng... routines.
|
||||
#pragma warning(disable : 28110) // Suppress this, as it is false positive.
|
||||
|
||||
// "Import" existing tests into this file. All code is encaptured into unique
|
||||
// namespace so that the same name does not conflict. Beware that those code
|
||||
|
@ -26,6 +33,18 @@ namespace unnamed {
|
|||
#include "test.c"
|
||||
} // namespace unnamed
|
||||
|
||||
namespace detail {
|
||||
#include "test_detail.c"
|
||||
} // namespace detail
|
||||
|
||||
namespace skipdata {
|
||||
#include "test_skipdata.c"
|
||||
} // namespace skipdata
|
||||
|
||||
namespace iter {
|
||||
#include "test_iter.c"
|
||||
} // namespace iter
|
||||
|
||||
namespace arm {
|
||||
#include "test_arm.c"
|
||||
} // namespace arm
|
||||
|
@ -34,14 +53,6 @@ namespace arm64 {
|
|||
#include "test_arm64.c"
|
||||
} // namespace arm64
|
||||
|
||||
namespace detail {
|
||||
#include "test_detail.c"
|
||||
} // namespace detail
|
||||
|
||||
namespace iter {
|
||||
#include "test_iter.c"
|
||||
} // namespace iter
|
||||
|
||||
namespace mips {
|
||||
#include "test_mips.c"
|
||||
} // namespace mips
|
||||
|
@ -50,10 +61,6 @@ namespace ppc {
|
|||
#include "test_ppc.c"
|
||||
} // namespace ppc
|
||||
|
||||
namespace skipdata {
|
||||
#include "test_skipdata.c"
|
||||
} // namespace skipdata
|
||||
|
||||
namespace sparc {
|
||||
#include "test_sparc.c"
|
||||
} // namespace sparc
|
||||
|
@ -95,13 +102,13 @@ static void test()
|
|||
}
|
||||
|
||||
unnamed::test();
|
||||
detail::test();
|
||||
skipdata::test();
|
||||
iter::test();
|
||||
arm::test();
|
||||
arm64::test();
|
||||
detail::test();
|
||||
iter::test();
|
||||
mips::test();
|
||||
ppc::test();
|
||||
skipdata::test();
|
||||
sparc::test();
|
||||
systemz::test();
|
||||
x86::test();
|
||||
|
@ -128,8 +135,7 @@ static void cs_winkernel_vsnprintf_test()
|
|||
}
|
||||
|
||||
// Driver entry point
|
||||
EXTERN_C NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||
PUNICODE_STRING RegistryPath)
|
||||
EXTERN_C NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(DriverObject);
|
||||
UNREFERENCED_PARAMETER(RegistryPath);
|
||||
|
@ -140,6 +146,7 @@ EXTERN_C NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject,
|
|||
|
||||
// This functions mimics printf() but does not return the same value as printf()
|
||||
// would do. printf() is required to exercise regression tests.
|
||||
_Use_decl_annotations_
|
||||
int __cdecl printf(const char * format, ...)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
|
Loading…
Reference in New Issue