资源简介
x86-x64体系探索及编程-随书代码.rar
代码片段和文件信息
// merge.cpp : Defines the entry point for the console application.
//
#include “stdafx.h“
#include “..\include\MyHeader.h“
#include
#define BUF_SIZE 512
#define MAX_LINE 250
#define MAX_CONFIG_LINE 30
typedef struct
{
TCHAR inFileName[MAX_PATH]; /* 输入文件名 */
DWORD inOffset; /* 输入文件偏移,以 512 字节为单位 */
TCHAR outFileName[MAX_PATH]; /* 输出文件名 */
DWORD outOffset; /* 输出文件偏移 以 512 字节为单位 */
DWORD nCount; /* 块数 */
//HANDLE hInFile; /* 输入文件 HANDLE */
//HANDLE hOutFile; /* 输出文件 HANDLE */
} MERGE_CONFIG *LPMERGE_CONFIG;
MERGE_CONFIG mergeConfig[MAX_CONFIG_LINE];
static DWORD mergeConfigIndex = 0;
static BOOL GetMergeConfig(LPTSTR lpLine);
static void PrintMergeConfigTable();
static VOID ReportError(LPCTSTR userMessage DWORD exitCode BOOL printErrorMessage);
int _tmain(int argc _TCHAR* argv[])
{
HANDLE hIn hOut;
FILE *fp;
errno_t err;
TCHAR chLine[MAX_LINE];
BYTE buf[BUF_SIZE];
DWORD i nIn nOut;
BOOL bSuccess = TRUE;
TCHAR msgError[100];
/* 打印作者信息 */
_tprintf(_T(“\n“));
if (argc > 1)
{
ReportError(_T(“Usage: merge\n“) 1 FALSE);
}
if ((err = _tfopen_s(&fp _T(“config.txt“) _T(“r“))) != 0)
{
ReportError(_T(“ “) 2 TRUE);
}
while (_fgetts(chLine BUF_SIZE fp))
{
if (!GetMergeConfig(chLine))
{
ReportError(_T(“Error: merge config please check the config.txt“) 3 FALSE);
}
}
for (i = 0; i < mergeConfigIndex; i++)
{
hIn = CreateFile(mergeConfig[i].inFileName GENERIC_READ FILE_SHARE_READ NULL OPEN_EXISTING FILE_ATTRIBUTE_NORMAL NULL);
if (hIn == INVALID_HANDLE_VALUE)
{
_stprintf_s(msgError 100 _T(“: %s“) mergeConfig[i].inFileName);
ReportError(msgError 4 TRUE);
}
hOut = CreateFile(mergeConfig[i].outFileName GENERIC_WRITE FILE_SHARE_READ NULL OPEN_EXISTING FILE_ATTRIBUTE_NORMAL NULL);
if (hOut == INVALID_HANDLE_VALUE)
{
_stprintf_s(msgError 100 _T(“: %s“) mergeConfig[i].outFileName);
ReportError(msgError 4 TRUE);
}
if (SetFilePointer(hIn mergeConfig[i].inOffset * 512 0 FILE_BEGIN) == INVALID_SET_FILE_POINTER)
ReportError(_T(“Error: move the input file pointer for read“) 5 TRUE);
if (SetFilePointer(hOut mergeConfig[i].outOffset * 512 0 FILE_BEGIN) == INVALID_SET_FILE_POINTER)
ReportError(_T(“Error: move the output file pointer for write“) 5 TRUE);
bSuccess = TRUE;
__try
{
while ((mergeConfig[i].nCount != 0) && ReadFile(hIn buf BUF_SIZE &nIn NULL) && (nIn > 0) && bSuccess)
{
if (!WriteFile(hOut buf nIn &nOut NULL))
{
//_tprintf(_T(“entry #%d:\t%s ---> %s:\tfailure\n“) i mergeConfig[i].inFileName mergeConfig[i].outFileName);
bSuccess = FALSE;
}
mergeConfig[i].nCount--;
}
}
__finally
{
CloseHandle(hIn
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 355328 2009-06-24 22:03 tools\dd.exe
文件 10240 2011-11-07 20:51 tools\merge.exe
文件 35328 2012-08-03 18:36 tools\merge源代码\merge\Debug\merge.exe
文件 358160 2012-08-03 18:36 tools\merge源代码\merge\Debug\merge.ilk
文件 551936 2012-08-03 18:36 tools\merge源代码\merge\Debug\merge.pdb
文件 136 2012-08-01 11:59 tools\merge源代码\merge\include\MyHeader.h
文件 5946 2012-08-03 18:36 tools\merge源代码\merge\merge\Debug\BuildLog.htm
文件 663 2012-08-03 18:33 tools\merge源代码\merge\merge\Debug\merge.exe.em
文件 728 2012-08-03 18:33 tools\merge源代码\merge\merge\Debug\merge.exe.em
文件 621 2012-08-03 18:36 tools\merge源代码\merge\merge\Debug\merge.exe.intermediate.manifest
文件 39123 2012-08-03 18:36 tools\merge源代码\merge\merge\Debug\merge.obj
文件 3276800 2012-08-03 18:33 tools\merge源代码\merge\merge\Debug\merge.pch
文件 67 2012-08-03 18:36 tools\merge源代码\merge\merge\Debug\mt.dep
文件 11721 2012-08-03 18:33 tools\merge源代码\merge\merge\Debug\stdafx.obj
文件 363520 2012-08-03 18:36 tools\merge源代码\merge\merge\Debug\vc90.idb
文件 167936 2012-08-03 18:36 tools\merge源代码\merge\merge\Debug\vc90.pdb
文件 6859 2012-08-03 18:36 tools\merge源代码\merge\merge\merge.cpp
文件 4492 2012-08-03 18:30 tools\merge源代码\merge\merge\merge.vcproj
文件 1427 2012-09-04 15:36 tools\merge源代码\merge\merge\merge.vcproj.MK-B1A6C8647613.Administrator.user
文件 1171 2012-08-03 18:30 tools\merge源代码\merge\merge\ReadMe.txt
文件 210 2012-08-03 18:30 tools\merge源代码\merge\merge\stdafx.cpp
文件 233 2012-08-03 18:30 tools\merge源代码\merge\merge\stdafx.h
文件 498 2012-08-03 18:30 tools\merge源代码\merge\merge\targetver.h
文件 10906624 2012-09-04 15:36 tools\merge源代码\merge\merge.ncb
文件 886 2012-08-03 18:30 tools\merge源代码\merge\merge.sln
..A..H. 7680 2012-09-04 15:36 tools\merge源代码\merge\merge.suo
目录 0 2012-09-04 15:36 tools\merge源代码\merge\merge\Debug
目录 0 2012-09-04 15:36 tools\merge源代码\merge\Debug
目录 0 2012-09-04 15:36 tools\merge源代码\merge\include
目录 0 2012-09-04 15:36 tools\merge源代码\merge\merge
............此处省略965个文件信息
相关资源
- PMP PMbook 章节练习题和答案
- Go.Standard.Library.Cookbook.pdf
- Algebra I Textbook for Students of Mathemati
- Handbook of Digital Currency
- poi-bin-3.9以及XSSFWorkbook所需的所有架包
- book.rar85742
- Handbook of Evolutionary Computation pdf
- Wava 6000 (内有comp86编译器,comp51编译
- Topopogy Without Tears book.pdf
-
Linux shell sc
ripting cookbook英文原版经 - unity 5x animation cookbook
- Bad.Data.Handbook
- 信息安全管理手册Information Security M
- gitlab cookbook
- Intouch modbus驱动DASMBTCP1.1
- 安卓xmpp客户端基于asmack+openfire
- nasmide(x86汇编语言从实模式到保护模
- PhasedArrayAntennaHandbook(2ndedition).pdf
- Book-ReflectarrayAntennas-JohnHuang-2008.pdf
- InsightSoftwareGuide-Book2-4.7.1.pdf
- asm算法 opencv实现
- Unity 2018 Artificial Intelligence Cookbook 2n
- ModSecurity Handbook[英文完整版]
- macbook在win下控制风扇转速的软件
- Cyclone IV 中文手册 HandBook
- [PDF]Hadoop MapReduce Cookbook v2 (文字版)
- 初学者必看!ASM如何转换为HEX文件.
- Selenium Testing Tools Cookbook中文版
- The Kubernetes Book: March 2019
- HP EliteBook 2530P 维修手册
评论
共有 条评论