-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Add the check for whether the PE matches the platform
- Loading branch information
Showing
4 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @file platform_check.h | ||
* @brief Check if the PE image matches the program platform. | ||
* @author Chen Zhenshuo (chenzs108@outlook.com) | ||
* @version 1.0 | ||
* @date 2020-01-14 | ||
* | ||
* @par GitHub | ||
* https://github.com/czs108/ | ||
* | ||
* @note The implementation is different between x64 and x86 platforms. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "../image.h" | ||
|
||
#include <stdbool.h> | ||
|
||
/** | ||
* @brief Check if the PE image matches the program platform. | ||
* | ||
* @param image_info The PE image. | ||
* @return `true` if the PE image matches the program platform, otherwise `false`. | ||
*/ | ||
bool IsPeMatchPlatform( | ||
const PE_IMAGE_INFO *const image_info); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @file platform_check_x64.c | ||
* @brief Check if the PE image matches the program platform. | ||
* @author Chen Zhenshuo (chenzs108@outlook.com) | ||
* @version 1.0 | ||
* @date 2020-01-14 | ||
* | ||
* @par GitHub | ||
* https://github.com/czs108/ | ||
* | ||
* @note This implementation is for x64 platforms. | ||
*/ | ||
|
||
#include "platform_check.h" | ||
|
||
#include <assert.h> | ||
|
||
|
||
bool IsPeMatchPlatform( | ||
const PE_IMAGE_INFO *const image_info) | ||
{ | ||
assert(image_info != NULL); | ||
|
||
return IsPe64(image_info); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @file platform_check_x86.c | ||
* @brief Check if the PE image matches the program platform. | ||
* @author Chen Zhenshuo (chenzs108@outlook.com) | ||
* @version 1.0 | ||
* @date 2020-01-14 | ||
* | ||
* @par GitHub | ||
* https://github.com/czs108/ | ||
* | ||
* @note This implementation is for x86 platforms. | ||
*/ | ||
|
||
#include "platform_check.h" | ||
|
||
#include <assert.h> | ||
|
||
|
||
bool IsPeMatchPlatform( | ||
const PE_IMAGE_INFO *const image_info) | ||
{ | ||
assert(image_info != NULL); | ||
|
||
return IsPe64(image_info) != true; | ||
} |