Skip to content

Commit

Permalink
fix typo, style
Browse files Browse the repository at this point in the history
Signed-off-by: Satoshi Tanda <[email protected]>
  • Loading branch information
tandasat committed Sep 28, 2016
1 parent de995b0 commit cb00397
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion COMPILE_MSVC.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ versions, and Windows Driver Kit 8.1 Update 1 or newer versions are required.
next steps.

In VisualStudio interface, modify the preprocessor definitions via
"Project Properties" -> "Configuration Propertis" -> "C/C++" -> "Preprocessor"
"Project Properties" -> "Configuration Properties" -> "C/C++" -> "Preprocessor"
to customize Capstone library, as followings.

- CAPSTONE_HAS_ARM: support ARM. Delete this to remove ARM support.
Expand Down
2 changes: 1 addition & 1 deletion HACK.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ the code and try to recompile/reinstall again. This can be done with:
$ sudo ./make.sh install

At the same time, for Java/Ocaml/Python bindings, be sure to always use
the bindings coming with the core to avoid potential incompatility issue
the bindings coming with the core to avoid potential incompatibility issue
with older versions.
See bindings/<language>/README for detail instructions on how to compile &
install the bindings.
4 changes: 2 additions & 2 deletions contrib/cs_driver/cs_driver/cs_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ static NTSTATUS cs_driver_hello() {
// On a 32bit driver, KeSaveFloatingPointState() is required before using any
// Capstone function because Capstone can access to the MMX/x87 registers and
// 32bit Windows requires drivers to use KeSaveFloatingPointState() before and
// KeRestoreFloatingPointState() after accesing to them. See "Using Floating
// KeRestoreFloatingPointState() after accessing them. See "Using Floating
// Point or MMX in a WDM Driver" on MSDN for more details.
status = KeSaveFloatingPointState(&float_save);
if (!NT_SUCCESS(status)) {
return status;
}

// Do stuff just like user-mode. All functionalites are supported.
// Do stuff just like user-mode. All functionalities are supported.
if (cs_open(CS_ARCH_X86, (sizeof(void *) == 4) ? CS_MODE_32 : CS_MODE_64,
&handle) != CS_ERR_OK) {
goto exit;
Expand Down
2 changes: 1 addition & 1 deletion docs/README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Documention of Capstone disassembly framework.
Documentation of Capstone disassembly framework.

* Switching to 2.1 engine.

Expand Down
8 changes: 4 additions & 4 deletions include/capstone/x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,15 @@ typedef struct cs_x86 {
// prefix[3] indicates address-size override (X86_PREFIX_ADDRSIZE)
uint8_t prefix[4];

// Instruction opcode, wich can be from 1 to 4 bytes in size.
// Instruction opcode, which can be from 1 to 4 bytes in size.
// This contains VEX opcode as well.
// An trailing opcode byte gets value 0 when irrelevant.
uint8_t opcode[4];

// REX prefix: only a non-zero value is relavant for x86_64
// REX prefix: only a non-zero value is relevant for x86_64
uint8_t rex;

// Address size, which can be overrided with above prefix[5].
// Address size, which can be overridden with above prefix[5].
uint8_t addr_size;

// ModR/M byte
Expand All @@ -292,7 +292,7 @@ typedef struct cs_x86 {
/* SIB state */
// SIB index register, or X86_REG_INVALID when irrelevant.
x86_reg sib_index;
// SIB scale. only applicable if sib_index is relavant.
// SIB scale. only applicable if sib_index is relevant.
int8_t sib_scale;
// SIB base register, or X86_REG_INVALID when irrelevant.
x86_reg sib_base;
Expand Down
5 changes: 3 additions & 2 deletions tests/test_winkernel.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Capstone Disassembly Engine */
/* By Satoshi Tanda <[email protected]>, 2016 */

#include <ntddk.h>

#include <capstone/platform.h>
Expand All @@ -21,7 +22,7 @@ EXTERN_C DRIVER_INITIALIZE DriverEntry;
#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:
// Drivers must protect floating point hardware state. See use of float.
// 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.
Expand Down Expand Up @@ -103,7 +104,7 @@ static void test()
// On a 32bit driver, KeSaveFloatingPointState() is required before using any
// Capstone function because Capstone can access to the MMX/x87 registers and
// 32bit Windows requires drivers to use KeSaveFloatingPointState() before and
// KeRestoreFloatingPointState() after accesing to them. See "Using Floating
// KeRestoreFloatingPointState() after accessing them. See "Using Floating
// Point or MMX in a WDM Driver" on MSDN for more details.
status = KeSaveFloatingPointState(&float_save);
if (!NT_SUCCESS(status)) {
Expand Down
15 changes: 8 additions & 7 deletions windows/winkernel_mm.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Capstone Disassembly Engine */
/* By Satoshi Tanda <[email protected]>, 2016 */

#include "winkernel_mm.h"
#include <ntddk.h>

Expand Down Expand Up @@ -77,27 +78,27 @@ void * CAPSTONE_API cs_winkernel_realloc(void *ptr, size_t size)
return new_ptr;
}

// vsnprintf(). _vsnprintf() is avaialable for drivers, but it differs from
// vsnprintf() in a return value and when a null-terminater is set.
// vsnprintf(). _vsnprintf() is available for drivers, but it differs from
// vsnprintf() in a return value and when a null-terminator is set.
// cs_winkernel_vsnprintf() takes care of those differences.
#pragma warning(push)
#pragma warning(disable : 28719) // Banned API Usage : _vsnprintf is a Banned
// API as listed in dontuse.h for security
// purposes.
// Banned API Usage : _vsnprintf is a Banned API as listed in dontuse.h for
// security purposes.
#pragma warning(disable : 28719)
int CAPSTONE_API cs_winkernel_vsnprintf(char *buffer, size_t count, const char *format, va_list argptr)
{
int result = _vsnprintf(buffer, count, format, argptr);

// _vsnprintf() returns -1 when a string is truncated, and returns "count"
// when an entire string is stored but without '\0' at the end of "buffer".
// In both cases, null-terminater needs to be added manually.
// In both cases, null-terminator needs to be added manually.
if (result == -1 || (size_t)result == count) {
buffer[count - 1] = '\0';
}

if (result == -1) {
// In case when -1 is returned, the function has to get and return a number
// of characters that would have been written. This attempts so by re-tring
// of characters that would have been written. This attempts so by retrying
// the same conversion with temp buffer that is most likely big enough to
// complete formatting and get a number of characters that would have been
// written.
Expand Down
1 change: 1 addition & 0 deletions windows/winkernel_mm.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Capstone Disassembly Engine */
/* By Satoshi Tanda <[email protected]>, 2016 */

#ifndef CS_WINDOWS_WINKERNEL_MM_H
#define CS_WINDOWS_WINKERNEL_MM_H

Expand Down

0 comments on commit cb00397

Please sign in to comment.