Skip to content

Commit

Permalink
Merge commit 'dabc40cb19bf4e297c32284d26c74adbd6775e49' as 'ext/detours'
Browse files Browse the repository at this point in the history
  • Loading branch information
vosen committed Jan 3, 2021
2 parents ae95016 + dabc40c commit 7752394
Show file tree
Hide file tree
Showing 178 changed files with 102,613 additions and 0 deletions.
72 changes: 72 additions & 0 deletions ext/detours/.github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: Bug Report
about: Report a bug in Detours
title: "<header>: Problem"
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is. Please check that you've
read the guidelines for submitting a bug report in the
[Bug Reports](https://github.com/microsoft/Detours/wiki/FAQ#bug-reports) section
of the FAQ.

**Command-line test case**
```
C:\Temp>type repro.cpp
#include <iostream>
#include <windows.h>
#include <detours.h>
void main() {
// Replace this program with one demonstrating your actual bug report,
// along with the following compilation command. Please leave compiler
// version banners in the output (don't use /nologo), and include output
// of your test program, if any.
std::cout << "Test Case Result: ";
if (DetourIsHelperProcess()) {
std::cout << "Fail\n";
} else {
std::cout << "Pass\n";
}
}
C:\Temp>cl.exe /EHsc /W4 /WX .\repro.cpp -I. ..\lib.X64\detours.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29111 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
repro.cpp
Microsoft (R) Incremental Linker Version 14.27.29111.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:repro.exe
repro.obj
..\lib.X64\detours.lib
C:\Temp>.\repro.exe
Test Case Result: Pass
```

**Expected behavior**
A clear and concise description of what you expected to happen.
Alternatively, include `static_assert` or `assert` lines in your
test case above whose failure clearly indicates the problem.

**Detours version**
* Option 1: Release version
* Displayed on the releases page: https://github.com/microsoft/Detours/releases/
* Example:
```
Version 4.0.1 of Detours
```
* Option 2: git commit hash
* Example:
```
https://github.com/microsoft/Detours/commit/2195148
```
**Additional context**
Add any other context about the problem here.
35 changes: 35 additions & 0 deletions ext/detours/.github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Question
about: Ask a question about Detours
title: ""
labels: question
assignees: ''

---

Instructions
============
Here, you can ask a question about Detours, and a maintainer or someone from
the community will answer. Please read the examples below, then delete all of
this text and replace it with your question. If you aren't sure whether a
question is on-topic, just go ahead and ask it! :-)

Please make sure to check the Wiki, esspecially the FAQ, to make sure your
question hasn't been answered there already:
https://github.com/microsoft/Detours/wiki/FAQ

On-Topic Examples
-----------------
* What is this code in the Detours doing? You can link to the relevant code:
https://help.github.com/en/github/managing-your-work-on-github/creating-a-permanent-link-to-a-code-snippet
* What are the preferred conventions for writing something?
* What are the maintainers planning to do in the future?
* Would the maintainers be interested in specific enhancements?

Off-Topic Examples
------------------
* Questions about non-Detours components, such as the compiler, the Windows API,
the Visual Studio IDE, etc.
* Questions about whether you've encountered a bug in Detours. Instead of this
Question template, please use the Bug Report template, because we'll need
a command-line test case and the other information requested there.
13 changes: 13 additions & 0 deletions ext/detours/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
Before submitting a pull request, please ensure that:
* These changes introduce no known API breaks (changing the public facing
functions return types, function parameters, renaming functions, etc.).
* The changes are tested.
* Your changes are written from scratch using only this repository.
If your changes are derived from any other project, you *must* mention it
here, so we can determine whether the license is compatible and what else
needs to be done.
-->
6 changes: 6 additions & 0 deletions ext/detours/.github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
name: "Detours CodeQL Config"

queries:
- uses: security-and-quality
- uses: security-extended
77 changes: 77 additions & 0 deletions ext/detours/.github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: CI-Build

env:
# Turn on msvc analysis during build, enable once warnings are clean.
DETOURS_ANALYZE: true

# Compile in parallel where possible.
CL: /MP

# Triggers the workflow on push or pull request events for the master branch.
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2016]
arch: [x86, x64, x64_arm, x64_arm64]

steps:
- name: Clone Repository
uses: actions/checkout@v2
with:
# Must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head of the pull request.
# Only include this option if you are running this workflow on pull requests.
fetch-depth: 2

# If this run was triggered by a pull request event then checkout
# the head of the pull request instead of the merge commit.
# Only include this step if you are running this workflow on pull requests.
- name: Checkout head of the pull request
run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Setup build environment variables using vcvarsall.bat.
- name: Configure MSCV Compiler for ${{ matrix.arch }}
uses: ilammy/[email protected]
with:
arch: ${{ matrix.arch }}

- name: Initialize CodeQL for C++
uses: github/codeql-action/init@v1
if: ${{ matrix.os == 'windows-2019' }}
with:
languages: cpp
config-file: ./.github/codeql/codeql-config.yml

- name: Build Detours for ${{ matrix.arch }} on ${{ matrix.os }}
env:
# Tell detours what process to target
DETOURS_TARGET_PROCESSOR: ${{ env.VSCMD_ARG_TGT_ARCH }}
run: nmake

- name: Run unit tests for ${{ matrix.arch }} on ${{ matrix.os }}
id: run-unit-tests
run: cd tests && nmake test
if: ${{ matrix.arch == 'x86' || matrix.arch == 'x64' }}

- name: Upload artifacts for ${{ matrix.arch }} on ${{ matrix.os }}
uses: actions/upload-artifact@v2
with:
name: artifacts-${{ matrix.os }}
path: |
lib.*/
bin.*/
include/
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
if: ${{ matrix.os == 'windows-2019' }}
41 changes: 41 additions & 0 deletions ext/detours/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# C extensions
*.so

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# vim
*~
*.swp

# Visual Studio build
*.ipch
.vs/
output/
include/
*.exp
*.pdb
*.lib
*.dll
*.exe
obj.*
*.ipdb
*.iobj
*.tlog
*.log
*.obj
*.user
*.recipe
/bin.*
*.vcxproj.FileListAbsolute.txt
*.vcxprojAssemblyReference.cache
118 changes: 118 additions & 0 deletions ext/detours/CREDITS.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
==============================================================================
The following individuals have helped identify specific bugs and improvements
in Detours. The entire Detours community has benefited from their help.
==============================================================================

* Jay Krell: Identified error in DetourFindPayload that caused a
incorrect failure when pcbData is NULL. (Build_342)

* Jay Krell: Identified issue with VirtualSize == 0 files created in
NT 3.1 images. (Build_339)

* Igor Odnovorov: Identified an issue with the placement of the trampoline
region when a function is detoured twice and the second
trampoline region is outside of the +/- 2GB range of
the target. (Build_337)

* Jay Krell: Identified need for some programs to enumerate the
address of IAT entries. (Build_336)

* Calvin Hsia: Identified need for some program to change the excluded
system region. (Build_336)

* Adam Smith: Identified error in failure handling when VirtualProect
cannot make pages executable because the Prohibit
Dynamic Code Generation mitigation policy has been
applied to a process. (Build_335)

* Ben Faull: Identified fix to detour_alloc_region_from_lo and
detour_alloc_region_from_hi that preserves ASLR entropy.
(Build_334)

* Shaoxiang Su: Reported errors building with Visual Studio 2015.
(Build_332)

* Jay Krell: Identified and resolved significant gaps in the X86, X64
and IA64 disassemblers for instruction found in code,
but seldom found in function prologues. (Build_331)

* Allan Murphy: Identify error in rep and jmp ds: encodings. (Build_331)

* Philip Bacon: Identified incorrect entry point return for pure
resource-only binaries. (Build_330)

* Jay Krell: Identified failure in DetourAttachEx to update nAlign.
(Build_330)

* Sumit Sarin: Helped debug error with packed binaries.
(Build_329)

* Nitya Kumar Sharma: Reported bug in DetourAfterWithDll for 32/64 agnostic
EXEs.
(Build_327)

* Richard Black: Identified a large number of typos in documentation.
(Build_326)

* Michael Bilodeau: Identified bug in DetourUpdateProcessWithDll when the
target process contains a Detours payload *after* all
valid PE binaries.
(Build_324)

* Meera Jindal: Reported bug in identification of target address in
DetourCopyInstruction for jmp[] and call[] on x86 & x64,
the ff15 and ff25 opcodes.
(Build_323)

* Ken Johnson: Assistance with SAL 2.0 annotations.
(Build_319)

* Nick Wood: Identified bug in DetourFindFunction on ARM.
(Build_314)

* Mark Russinovich: Helped debug DetourCreateProcessWithDllEx.
(Build_314)

* John Lin: Implementation idea for DetoursCreateProcessWithDllEx.
(Build_314)

* Andrew Zawadowskiy Reported an improper memory page permissions
vulnerability in Detours 2.1. (Vulnerability does not
exist in versions later than Detours 2.1.)
(Build_223)

* Nightxie: Identified bug in detour_alloc_round_up_to_region.
(Build_310)

* Diana Milirud: Identified bug in B* instructions on ARM.
(Build_309)

* Juan Carlos Identified correct MSIL entry point for unsigned MSIL.
Luciani: (Build_308)

* Lee Hunt Suggested improvements in algorithm for allocation of
Lawrence Landauer trampoline regions on x64 to avoid collisions with
Joe Laughlin: system DLLs.
(Build_307)

* Tyler Sims Identified bug in handling of "anycpu" MSIL binaries
Darren Kennedy: on x64.
(Build_307)

* Andre Vachon: Help with optimized binaries.
(Build 301)

* Chris Mann: Identified fix not forward ported from 2.2 to 3.0.
(Build_301)

* Mark Irving: Identified bug with EXEs missing second import table.
(Build_300)

* Ben Schwarz: Identified bug in handling of multi-byte NOPs.
(Build_300)

* Aaron Giles Coded initial ARM/Thumb2 disassembler.
Jared Henderson: (Build_300)

* Doug Brubacher: Coded initial x86 disassembler.
(Build_100)
23 changes: 23 additions & 0 deletions ext/detours/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) Microsoft Corporation

All rights reserved.

# MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 7752394

Please sign in to comment.