Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / ASM

Inject your code to a Portable Executable file

Rate me:
Please Sign up or sign in to vote.
4.97/5 (203 votes)
27 Dec 2005GPL333 min read 912.2K   42.6K   690  
This article demonstrates five steps to inject your code in a portable executable (EXE, DLL, OCX,...) file without recompiling source code.
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by peviewer.rc
//
#define IDR_RT_MANIFEST1                1
#define IDD_MAINDLG                     24
#define IDB_TOOLBAR                     101
#define IDS_APP_TITLE                   103
#define IDM_ABOUT                       104
#define IDD_GOTO                        104
#define IDM_EXIT                        105
#define IDR_ACCEL                       105
#define IDD_SELBLOCK                    105
#define IDD_SEARCH                      106
#define IDC_CRYPTAPI                    109
#define IDS_FIRSTCOLUMN                 110
#define IDS_D1_FIRSTCOLUMN              110
#define IDS_COLUMN2                     111
#define IDS_D1_COLUMN2                  111
#define IDS_COLUMN3                     112
#define IDS_D1_COLUMN3                  112
#define IDS_COLUMN4                     113
#define IDS_D1_COLUMN4                  113
#define IDS_COLUMN5                     114
#define IDS_D1_COLUMN5                  114
#define IDS_COLUMN6                     115
#define IDS_D1_COLUMN6                  115
#define IDR_MAINFRAME                   120
#define IDS_D2_FIRSTCOLUMN              120
#define IDD_ABOUTBOX                    121
#define IDS_D2_COLUMN2                  121
#define IDS_D2_COLUMN3                  122
#define IDS_D2_COLUMN4                  123
#define IDS_D3_FIRSTCOLUMN              130
#define IDS_D3_COLUMN2                  131
#define IDS_D3_COLUMN3                  132
#define IDR_RT_MANIFEST2                176
#define IDD_SUBSYSTEM                   177
#define IDD_SECTIONVIEW                 178
#define IDD_SECTIONVIEW1                179
#define IDD_DATAVIEW1                   179
#define IDI_ICON                        180
#define IDI_16Edit                      181
#define IDR_POPUPMENU1                  185
#define IDD_DIALOG1                     186
#define SB_OK                           1000
#define SB_CANCEL                       1001
#define SB_START                        1002
#define SB_END                          1003
#define SB_RADIOEND                     1004
#define SS_OK                           1005
#define SB_RADIOSIZE                    1005
#define SS_CANCEL                       1006
#define SB_SIZE                         1006
#define SS_STR                          1007
#define SS_SEARCHASCII                  1008
#define SS_CASESENSITIVE                1009
#define SS_NOCASESENSITIVE              1010
#define SS_SEARCHFROMTOP                1011
#define SS_SEARCHFROMCURPOS             1012
#define SS_SEARCHFROMOFF                1013
#define SS_DOWN                         1014
#define SS_UP                           1015
#define GO_OFFSET                       1016
#define SS_SEARCHUNICODE                1016
#define SS_OFFSET                       1017
#define SS_CUROFF                       1018
#define GO_OK                           1039
#define GO_CANCEL                       1040
#define ID_ABOUT                        1053
#define IDC_WEB                         1070
#define IDC_FILE_SAVE                   1147
#define ID_FILE_SAVE                    1148
#define ID_EPSAVE1                      1148
#define ID_PEIDVEW                      1148
#define ID_FILE_OPEN                    1150
#define IDC_FILE_OPEN                   1151
#define ID_FILE_OPEN5                   1151
#define ID_IMPORT_DATA                  1151
#define IDC_ENCRYPT                     1152
#define ID_SECTIONVIEW                  1152
#define IDC_DECRYPT                     1153
#define ID_FILE_OPEN6                   1153
#define ID_FIRSTBYTES                   1153
#define ID_IT_VIEW                      1153
#define ID_SUBSYSTEM                    1154
#define IDC_ALG_ID                      1155
#define IDC_PASSWORD                    1156
#define IDC_STATIC1                     1157
#define IDC_STATIC2                     1158
#define IDC_PROGRESS1                   1159
#define IDC_OEP                         1160
#define IDC_LINKINFO                    1161
#define IDC_ROOEP                       1162
#define IDC_EPSECTION                   1163
#define IDC_SUBSYSTEM                   1164
#define IDC_FIRSTBYTES                  1165
#define IDC_IMAGEBASE                   1171
#define IDC_IMAGESIZE                   1172
#define IDC_LISTSECTION                 1172
#define IDC_CODEBASE                    1173
#define ID_EPSAVE                       1173
#define IDC_DATABASE                    1174
#define IDC_SECTIONALIGN                1175
#define IDC_FILEALIGN                   1176
#define IDC_MAGIC                       1177
#define ID_RESOURCE                     1178
#define ID_RESOURCE_DATA                1178
#define IDC_SECTIONSNUM                 1179
#define IDC_TREE1                       1179
#define IDC_TIMEDATE                    1180
#define IDC_HEADERSSIZE                 1181
#define IDC_CHARACTER                   1182
#define IDC_CHECKSUM                    1183
#define IDC_OPTIONALSIZE                1184
#define IDC_RVANUMSIZE                  1185
#define IDC_ETRVA                       1196
#define IDC_ITRVA                       1197
#define IDC_RSRCRVA                     1198
#define IDC_TLSRVA                      1199
#define IDC_DEBUGRVA                    1200
#define IDC_ETSIZE                      1201
#define IDC_ITSIZE                      1202
#define IDC_RSRCSIZE                    1203
#define IDC_TLSSIZE                     1204
#define IDC_DEBUGSIZE                   1205
#define ID__DISASSEMBLE                 32825
#define ID_POPMENU_DISASSEMBLE          32828
#define ID_POPMENU_HEXVIEWER            32829
#define ID_POPMENU_HEXEDIT              32830
#define ID_POPMENU_DATAVIEW             32831
#define ID_POPMENU_DISASSEMBLER         32832
#define ID_POPMENU_SAVEDATATOFILE       32833
#define ID_POPMENU_SAVEREPORTTOFILE     32834
#define TB_GOTO                         40001
#define TB_SELBLOCK                     40002
#define TB_CLOSE                        40003
#define TB_WIN2TOP                      40004
#define TB_SAVE                         40005
#define TB_SEARCH                       40006
#define TB_SEARCHDOWN                   40007
#define TB_SEARCHUP                     40008
#define TB_ABOUT                        40009
#define TB_COPY                         40010
#define TB_CUT                          40011
#define TB_PASTE                        40012
#define TB_UNDO                         40013
#define TB_SELALL                       40014
#define IDC_STATIC                      -1

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC                     1
#define _APS_NEXT_RESOURCE_VALUE        187
#define _APS_NEXT_COMMAND_VALUE         32835
#define _APS_NEXT_CONTROL_VALUE         1180
#define _APS_NEXT_SYMED_VALUE           110
#endif
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Germany Germany
Ashkbiz Danehkar studied electrical engineering and computational science at the University of Rostock, Germany, where he obtained a Master of Science in Computational Engineering in the special field of Electrical Engineering in 2007. He worked as a software and hardware developer for some private limited companies until 2005, mostly focusing on industrial automation and microcontroller programming. During 2005–2006, he worked part-time remotely as a software reverse engineer for Panda Security (Bilbao, Spain). His master's thesis in 2007 was about the development of a microcontroller-based measurement system using an embedded system equipped with a real-time operating system (RTOS) and an AVR microcontroller to monitor the neuromuscular blockade and control the anesthesia.

Comments and Discussions