HRSRC hmyrs = NULL
HGLOBAL hrpt = NULL
HANDLE hFile=NULL
DWORD dwSize
LPVOID lpBuffer
dwSize = 2143794
hmyrs = FindResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(130), _T("EXE"))
if (hmyrs == NULL)
{
MessageBox(_T("error"), _T("wlf"), 0)
return
}
hrpt = LoadResource(NULL, hmyrs)
if (hrpt == NULL)
{
MessageBox(_T("LoadResource error"))
}
lpBuffer = LockResource(hrpt)
DWORD wr
hFile = ::CreateFile(_T("wlf.exe"), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)
if (hFile == INVALID_HANDLE_VALUE)
{
MessageBox(_T("Create File error"))
}
if (false == WriteFile(hFile, lpBuffer, dwSize, &wr, NULL))
{
MessageBox(_T("Write File error"))
}
CloseHandle(hFile)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)