Click here to Skip to main content
15,885,757 members
Articles / Programming Languages / C++

An Analysis of the Windows PE Checksum Algorithm

Rate me:
Please Sign up or sign in to vote.
4.89/5 (42 votes)
7 Mar 2008CPOL17 min read 167.9K   8.4K   100  
An Analysis Demonstrating the PE Checksum is an Additive Checksum based on RFC 1071
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#include ""res\\Sample.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""     // Standard components\r\n"
    "#endif\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME           ICON                    "res\\Sample.ico"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_PECHECKSUM_DIALOG DIALOGEX 0, 0, 320, 126
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "PE Checksum"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
    PUSHBUTTON      "E&xit",IDCANCEL,263,103,50,16
    RTEXT           "Filename:",IDC_STATIC,11,11,38,10
    EDITTEXT        IDC_EDIT_BROWSE,52,10,219,12,ES_AUTOHSCROLL
    PUSHBUTTON      "Browse",IDC_BTN_BROWSE,276,10,37,13
    GROUPBOX        "Image Help Checksum",IDC_STATIC,7,26,149,70
    GROUPBOX        "New Checksum Value",IDC_STATIC,165,26,149,70
    RTEXT           "Existing:",IDC_STATIC,14,41,46,10
    RTEXT           "Calculated:",IDC_STATIC,14,60,46,10
    EDITTEXT        IDC_EDIT_CS_EXISTING,64,40,76,12,ES_AUTOHSCROLL | ES_READONLY
    EDITTEXT        IDC_EDIT_CS_CALCULATED,64,59,76,12,ES_AUTOHSCROLL | ES_READONLY
    RTEXT           "New Value:",IDC_STATIC,173,41,46,10
    EDITTEXT        IDC_EDIT_NEW_VALUE,223,40,76,12,ES_AUTOHSCROLL
    PUSHBUTTON      "Retrieve",IDC_BTN_RETRIEVE,103,78,37,13
    PUSHBUTTON      "Write",IDC_BTN_WRITE_NEW_VALUE,262,78,37,13
    RTEXT           "(Empty = 0x00)",IDC_STATIC,182,60,117,10
END


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 5,0,0,1
 PRODUCTVERSION 5,0,0,1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904e4"
        BEGIN
            VALUE "CompanyName", "Jeffrey Walton"
            VALUE "FileDescription", "PEChecksum"
            VALUE "FileVersion", "5.0.0.1"
            VALUE "InternalName", "PEChecksum.exe"
            VALUE "LegalCopyright", "(c) Jeffrey Walton.  All rights reserved."
            VALUE "OriginalFilename", "PEChecksum.exe"
            VALUE "ProductVersion", "5.0.0.1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO 
BEGIN
    IDD_PECHECKSUM_DIALOG, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 313
        TOPMARGIN, 7
        BOTTOMMARGIN, 119
    END
END
#endif    // APSTUDIO_INVOKED

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#pragma code_page(1252)
#include "res\Sample.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"     // Standard components
#endif

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

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 Code Project Open License (CPOL)


Written By
Systems / Hardware Administrator
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions