mirror of
https://gitea.tendokyu.moe/TeamTofuShop/capnhook.git
synced 2026-09-22 22:38:12 +03:00
Fix MSVC compatibility issues
Project now builds in Visual Studio 2017, probably earlier versions too as long as they support enough of C99.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#define WIN32_NO_STATUS
|
||||
/* See precompiled.h for more information */
|
||||
#include <windows.h>
|
||||
#undef WIN32_NO_STATUS
|
||||
#include <winternl.h>
|
||||
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
hook_lib = static_library(
|
||||
'hook',
|
||||
include_directories : inc,
|
||||
c_pch : '../precompiled.h',
|
||||
c_pch : [
|
||||
'../precompiled.c',
|
||||
'../precompiled.h',
|
||||
],
|
||||
sources : [
|
||||
'args.c',
|
||||
'args.h',
|
||||
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
hooklib_lib = static_library(
|
||||
'hooklib',
|
||||
include_directories : inc,
|
||||
c_pch : '../precompiled.h',
|
||||
c_pch : [
|
||||
'../precompiled.c',
|
||||
'../precompiled.h',
|
||||
],
|
||||
sources : [
|
||||
'serial.c',
|
||||
'serial.h',
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <ntdef.h>
|
||||
#else
|
||||
#include <winnt.h>
|
||||
#endif
|
||||
#include <devioctl.h>
|
||||
#include <ntddser.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <ntdef.h>
|
||||
#else
|
||||
#include <winnt.h>
|
||||
#endif
|
||||
#include <devioctl.h>
|
||||
#include <ntddser.h>
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <ntdef.h>
|
||||
#else
|
||||
#include <winnt.h>
|
||||
#endif
|
||||
#include <devioctl.h>
|
||||
#include <ntddser.h>
|
||||
|
||||
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
executable(
|
||||
'inject',
|
||||
include_directories : inc,
|
||||
c_pch : '../precompiled.h',
|
||||
c_pch : [
|
||||
'../precompiled.c',
|
||||
'../precompiled.h',
|
||||
],
|
||||
sources : [
|
||||
'debug.c',
|
||||
'debug.h',
|
||||
|
||||
+16
-8
@@ -1,18 +1,26 @@
|
||||
project('capnhook', 'c', version: '0.1.0')
|
||||
|
||||
add_project_arguments(
|
||||
'-Wall',
|
||||
'-DCOBJMACROS',
|
||||
'-ffunction-sections',
|
||||
'-fdata-sections',
|
||||
'-DWIN32_LEAN_AND_MEAN',
|
||||
language: 'c',
|
||||
)
|
||||
|
||||
add_project_link_arguments(
|
||||
'-Wl,--gc-sections',
|
||||
'-static-libgcc',
|
||||
language: 'c',
|
||||
)
|
||||
# Use get_argument_syntax() instead once Meson 0.49.0 releases
|
||||
if meson.get_compiler('c').get_id() != 'msvc'
|
||||
add_project_arguments(
|
||||
'-Wall',
|
||||
'-ffunction-sections',
|
||||
'-fdata-sections',
|
||||
language: 'c',
|
||||
)
|
||||
|
||||
add_project_link_arguments(
|
||||
'-Wl,--gc-sections',
|
||||
'-static-libgcc',
|
||||
language: 'c',
|
||||
)
|
||||
endif
|
||||
|
||||
inc = include_directories('.')
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include "precompiled.h"
|
||||
@@ -1,13 +1,27 @@
|
||||
/*
|
||||
Making NTSTATUS available is slightly awkward. See:
|
||||
https://kirkshoop.github.io/2011/09/20/ntstatus.html
|
||||
*/
|
||||
|
||||
/* Win32 user-mode API */
|
||||
#define WIN32_NO_STATUS
|
||||
#include <windows.h>
|
||||
#undef WIN32_NO_STATUS
|
||||
#include <winternl.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <unknwn.h>
|
||||
|
||||
/* Win32 kernel-mode definitions */
|
||||
#ifdef __GNUC__
|
||||
/* MinGW needs to include this for PHYSICAL_ADDRESS to be defined.
|
||||
The MS SDK throws a bunch of duplicate symbol errors instead. */
|
||||
#include <ntdef.h>
|
||||
#else
|
||||
#include <winnt.h>
|
||||
#endif
|
||||
#include <devioctl.h>
|
||||
#include <ntddser.h>
|
||||
#include <ntstatus.h>
|
||||
|
||||
/* ANSI C */
|
||||
#include <assert.h>
|
||||
|
||||
Reference in New Issue
Block a user