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:
Decaf Code
2018-11-23 13:58:25 -05:00
parent d985965639
commit bfee3db861
10 changed files with 56 additions and 11 deletions
+1
View File
@@ -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
View File
@@ -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
View File
@@ -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',
+4
View File
@@ -1,6 +1,10 @@
#include <windows.h>
#ifdef __GNUC__
#include <ntdef.h>
#else
#include <winnt.h>
#endif
#include <devioctl.h>
#include <ntddser.h>
+4
View File
@@ -1,6 +1,10 @@
#include <windows.h>
#ifdef __GNUC__
#include <ntdef.h>
#else
#include <winnt.h>
#endif
#include <devioctl.h>
#include <ntddser.h>
+4
View File
@@ -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
View File
@@ -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
View File
@@ -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('.')
+1
View File
@@ -0,0 +1 @@
#include "precompiled.h"
+14
View File
@@ -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>