Skip to content

Commit

Permalink
edit documents and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tandasat committed May 14, 2016
1 parent 0e5f191 commit 59df550
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
1 change: 1 addition & 0 deletions HACK.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion contrib/cs_driver/cs_driver/cs_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion include/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typedef unsigned char bool;
#include <stdbool.h>
#endif

#else
#else
// not MSVC -> C99 is supported
#include <stdbool.h>
#endif
Expand Down
2 changes: 1 addition & 1 deletion tests/README
Original file line number Diff line number Diff line change
Expand Up @@ -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.
45 changes: 26 additions & 19 deletions tests/test_winkernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,22 +33,26 @@ namespace unnamed {
#include "test.c"
} // namespace unnamed

namespace arm {
#include "test_arm.c"
} // namespace arm

namespace arm64 {
#include "test_arm64.c"
} // namespace arm64

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

namespace arm64 {
#include "test_arm64.c"
} // namespace arm64

namespace mips {
#include "test_mips.c"
} // namespace mips
Expand All @@ -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
Expand Down Expand Up @@ -95,13 +102,13 @@ static void test()
}

unnamed::test();
arm::test();
arm64::test();
detail::test();
skipdata::test();
iter::test();
arm::test();
arm64::test();
mips::test();
ppc::test();
skipdata::test();
sparc::test();
systemz::test();
x86::test();
Expand All @@ -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);
Expand All @@ -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;
Expand Down

0 comments on commit 59df550

Please sign in to comment.