Click here to Skip to main content
16,006,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Registry Pin
CPallini10-May-08 7:38
mveCPallini10-May-08 7:38 
QuestionDisable Tap and Hold (MFC) Pin
abupriabi@yahoo.com9-May-08 16:35
abupriabi@yahoo.com9-May-08 16:35 
AnswerRe: Disable Tap and Hold (MFC) Pin
Rajkumar R9-May-08 20:34
Rajkumar R9-May-08 20:34 
QuestionClass that defines a location?? Pin
codedecode9-May-08 16:27
codedecode9-May-08 16:27 
AnswerRe: Class that defines a location?? Pin
Garth J Lancaster9-May-08 17:31
professionalGarth J Lancaster9-May-08 17:31 
QuestionRe: Class that defines a location?? Pin
codedecode10-May-08 6:46
codedecode10-May-08 6:46 
AnswerRe: Class that defines a location?? Pin
Garth J Lancaster10-May-08 16:28
professionalGarth J Lancaster10-May-08 16:28 
Questionerror doing resource update Pin
alex7869-May-08 10:38
alex7869-May-08 10:38 
i have a problem creating resourcebundle....i made two programs
1.resourcecreator.exe( it creates the resource using calc.exe into extractor.exe)
2.extractor.exe ( it is the program on which resource is created....and same program when run uses itself to extract the resource calc.exe)...


on creating resource by using resourcecreator.exe when i try to run updated extractor.exe it gives error..."extractor.exe is not a valid win32 application"...


resourcecreator.cpp
#include"windows.h"
#include"conio.h"
#include"stdio.h"
int main()
{
HANDLE hFile;
HANDLE hResource;
DWORD dwFileSize,      
      dwBytesRead;
LPBYTE lpBuffer;

hFile = CreateFile("calc.exe", GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

if(hFile == NULL )
{
    printf("%s","file not opened" );
}
else
{
    printf( "%s","file opened" );
}

if (INVALID_HANDLE_VALUE != hFile)
{
    dwFileSize = GetFileSize(hFile, NULL);
    lpBuffer = new BYTE[dwFileSize];
    if (ReadFile(hFile, lpBuffer, dwFileSize, &dwBytesRead, NULL) != FALSE)
    {
        hResource = BeginUpdateResource("extractor.exe", FALSE);
        if (NULL != hResource)
        {
            if (UpdateResource(hResource, 
                    RT_RCDATA, 
                    MAKEINTRESOURCE(104), 
                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 
                    (LPVOID) lpBuffer, 
                    dwFileSize) != FALSE)
    	   {
                EndUpdateResource(hResource, FALSE);
                printf("%s","\nresource updated" );
            }
        }
    }
    delete [] lpBuffer;
    CloseHandle(hFile);
    }
    getch();
    return 0;
}




-----------------------------------------------
extractor.cpp
#include"windows.h"




int main()
{
    HMODULE hLibrary;
    HRSRC hResource;
    HGLOBAL hResourceLoaded;
    LPBYTE lpBuffer;

    hLibrary = LoadLibrary("extractor.exe");
    if (NULL != hLibrary)
    {
        hResource = FindResource(hLibrary, MAKEINTRESOURCE(104), RT_RCDATA);
        if (NULL != hResource)
        {
            hResourceLoaded = LoadResource(hLibrary, hResource);
            if (NULL != hResourceLoaded)
            {
                lpBuffer = (LPBYTE) LockResource(hResourceLoaded);           
                if (NULL != lpBuffer)
                {
                    DWORD dwFileSize,dwBytesWritten;
                    HANDLE hFile;
                    dwFileSize = SizeofResource(hLibrary, hResource);
                    hFile = CreateFile("newcreation.exe", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
                    if (INVALID_HANDLE_VALUE != hFile)
                    {
                        WriteFile(hFile, lpBuffer, dwFileSize, &dwBytesWritten, NULL);
                        CloseHandle(hFile);
                    }
                }
            }
        }
        FreeLibrary(hLibrary);
    }
    return 0;
}



can you guide me a little bit...it would be really nice..
thanx....mail me at ashutosh.dhiman@gmail.com

there are 10 type of people in the world...
01 who understand binary.
10 who don't...

Questionhelp on exe generation form other exe..... Pin
alex7869-May-08 4:53
alex7869-May-08 4:53 
AnswerRe: help on exe generation form other exe..... Pin
CPallini9-May-08 4:58
mveCPallini9-May-08 4:58 
GeneralRe: help on exe generation form other exe..... Pin
alex7869-May-08 5:09
alex7869-May-08 5:09 
GeneralRe: help on exe generation form other exe..... [modified] Pin
Rajkumar R9-May-08 5:17
Rajkumar R9-May-08 5:17 
GeneralRe: help on exe generation form other exe..... Pin
CPallini9-May-08 5:36
mveCPallini9-May-08 5:36 
GeneralRe: help on exe generation form other exe..... Pin
alex7869-May-08 5:54
alex7869-May-08 5:54 
RantSorry, we don't help to produce malicious software. Pin
CPallini9-May-08 6:27
mveCPallini9-May-08 6:27 
GeneralRe: Sorry, we don't help to produce malicious software. Pin
alex7869-May-08 6:46
alex7869-May-08 6:46 
JokeRe: help on exe generation form other exe..... Pin
Hamid_RT9-May-08 6:56
Hamid_RT9-May-08 6:56 
GeneralRe: help on exe generation form other exe..... Pin
CPallini9-May-08 8:28
mveCPallini9-May-08 8:28 
GeneralRe: help on exe generation form other exe..... Pin
Hamid_RT9-May-08 20:33
Hamid_RT9-May-08 20:33 
GeneralRe: help on exe generation form other exe..... Pin
CPallini9-May-08 20:44
mveCPallini9-May-08 20:44 
AnswerRe: help on exe generation form other exe..... Pin
Rajesh R Subramanian9-May-08 5:00
professionalRajesh R Subramanian9-May-08 5:00 
GeneralRe: help on exe generation form other exe..... Pin
alex7869-May-08 5:07
alex7869-May-08 5:07 
GeneralRe: help on exe generation form other exe..... Pin
Hamid_RT9-May-08 6:53
Hamid_RT9-May-08 6:53 
QuestionCurrent location Pin
capint9-May-08 4:40
capint9-May-08 4:40 
AnswerRe: Current location Pin
Rajkumar R9-May-08 4:46
Rajkumar R9-May-08 4:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.