zoukankan      html  css  js  c++  java
  • c++ 输出文件

    HANDLE hFile = ::CreateFile(_T("c:\\0123.txt"), //创建文件的名称。
                                                GENERIC_WRITE|GENERIC_READ, // 写和读文件。
                                                0,                                        // 不共享读写。
                                                NULL,                                  // 缺省安全属性。
                                                CREATE_ALWAYS,               // 如果文件存在,也创建。
                                                FILE_ATTRIBUTE_NORMAL, // 一般的文件。
                                                NULL);                                // 模板文件为空。

    if (hFile == INVALID_HANDLE_VALUE)
    {
    //
    OutputDebugString(_T("CreateFile fail!\r\n"));
    }

    DWORD dwWritenSize = 0;
    //::WriteFile(hFile,"1=",sizeof(CHAR)*strlen("1="),&dwWritenSize,NULL);
    ::WriteFile(hFile,lpszHookedExe,sizeof(TCHAR)*wcslen(lpszHookedExe),&dwWritenSize,NULL);
    ::WriteFile(hFile,"\r\n",sizeof(CHAR)*strlen("\r\n"),&dwWritenSize,NULL);
    FlushFileBuffers(hFile);

    //::WriteFile(hFile,"2=",sizeof(CHAR)*strlen("2="),&dwWritenSize,NULL);
    ::WriteFile(hFile,lpszDllPath,sizeof(TCHAR)*wcslen(lpszDllPath),&dwWritenSize,NULL);
    ::WriteFile(hFile,"\r\n",sizeof(CHAR)*strlen("\r\n"),&dwWritenSize,NULL);
    FlushFileBuffers(hFile);

    //::WriteFile(hFile,"3=",sizeof(CHAR)*strlen("3="),&dwWritenSize,NULL);
    ::WriteFile(hFile,lpszDetouredDllPath,sizeof(TCHAR)*wcslen(lpszDetouredDllPath),&dwWritenSize,NULL);
    //::WriteFile(hFile,"\r\n",sizeof(CHAR)*strlen("\r\n"),&dwWritenSize,NULL);
    FlushFileBuffers(hFile);

    CloseHandle(hFile);

  • 相关阅读:
    GeoServer与Spring MVC
    GeoServer二次开发1 hello Geoserver
    servlet的生命周期
    springboot打包出错,没有主清单
    空间数据库管理
    Gone with the wind
    谎言中的民众
    还是有些怀念这里啊
    MSN Protcol 学习笔记
    祝我的老师教师节快乐!
  • 原文地址:https://www.cnblogs.com/carl2380/p/2292568.html
Copyright © 2011-2022 走看看