Skip to content

Commit 6fb7f09

Browse files
committed
[FEATURE] Added unicode support
1 parent 6bb8ac5 commit 6fb7f09

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

CMakeLists.txt

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ cmake_minimum_required ( VERSION 3.0 )
33
# replace "peconv_project" by your own project name:
44
project ( peconv_project )
55

6-
76
# libs
87
# modules:
98
set ( M_PARSER "libpeconv/libpeconv" )
109

10+
option(PECONV_UNICODE "Enable Unicode" OFF)
11+
12+
# enable unicode support
13+
if(PECONV_UNICODE)
14+
add_definitions (-DUNICODE -D_UNICODE)
15+
endif()
16+
1117
# modules paths:
1218
set (PECONV_DIR "${CMAKE_SOURCE_DIR}/${M_PARSER}" CACHE PATH "PEConv main path")
1319
add_subdirectory ( ${PECONV_DIR} )

project_template/main.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#include <Windows.h>
22
#include <iostream>
3+
#include <tchar.h>
34

45
#include <peconv.h> // include libPeConv header
56

67
/**
78
A demo of a basic manual PE loader - you can use it as a starting point for your own project,
89
or delete it and start from the scratch
910
*/
10-
int load_and_run(LPCSTR pe_path)
11+
int load_and_run(LPCTSTR pe_path)
1112
{
1213
// manually load the PE file using libPeConv:
1314
size_t v_size = 0;
@@ -41,12 +42,12 @@ int load_and_run(LPCSTR pe_path)
4142
return new_main();
4243
}
4344

44-
int main(int argc, char *argv[])
45+
int _tmain(int argc, LPTSTR argv[])
4546
{
4647
if (argc < 2) {
4748
std::cout << "Args: <path to the exe>" << std::endl;
4849
return 0;
4950
}
50-
const LPCSTR pe_path = argv[1];
51+
const LPTSTR pe_path = argv[1];
5152
return load_and_run(pe_path);
5253
}

0 commit comments

Comments
 (0)