// This is the main project file for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #include #include #include #include #using using namespace System; using namespace std; int _tmain(int argc, _TCHAR* argv[]) { /* // FYI - if your doing headers... char header[4]; header[0] = (char) 0x00; header[1] = (char) 0x01; header[2] = (char) 0x02; header[3] = (char) 0x00; header[4] = (char) 0x00; // FYI - or just need to see what a character is in Hex... char tmp = 'A'; printf("the character a in hex is %X\n", tmp); */ string strConfigHeader = "Binary Padding/Fuzzing Utility\n"; string strFilename = ""; long paddingOffset; int paddingSize; int itemswritten; char *szCharacters; FILE *inFile; if (argc < 3) { printf(strConfigHeader.c_str()); printf("Usage: SMPadding \n"); return false; } strFilename = argv[1]; paddingOffset = atol(argv[2]); paddingSize = atoi(argv[3]); szCharacters = (char *) malloc(paddingSize); memset(szCharacters, 0x41, paddingSize); printf("%s", strConfigHeader.c_str()); printf("**********************************************************\n\n"); printf("Opening file %s...\n", strFilename.c_str()); inFile = fopen(strFilename.c_str(), "w"); printf("Offsetting by %d bytes...\n", paddingOffset); fseek(inFile, paddingOffset, 0); itemswritten = fwrite(szCharacters, paddingSize, 1, inFile); printf("Wrote %d bytes to the file.\n", itemswritten); fclose(inFile); return 0; }