954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to hook a MyCopyFileW function in OS

PROC bHook(LPSTR BaseLibraryName, LPSTR BaseFunctionName, PROC NewFunctionPointer, bool UnHook, PROC Custom)
{
PROC hBaseProc;
    return hBaseProc;

}

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
            OutputDebugString("--------Detour dll Load!");

        bHook("KERNEL32.DLL", "CopyFileW", (PROC)MyCopyFileW, false, 0);

            break;
        case DLL_THREAD_ATTACH:
            break;
        case DLL_THREAD_DETACH:
            break;
        case DLL_PROCESS_DETACH:
            OutputDebugString("---------Detour dll exit");

            break;
    }
    return TRUE;
}

error C2440: 'type cast' : cannot convert from '' to 'int (__stdcall *)(void)'
None of the functions with this name in scope match the target type

I have encounter this error message from visual c++ 6.0.

Please help

max8888
Newbie Poster
2 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

Have you defined MyCopyFileW?

dougy83
Posting Whiz in Training
275 posts since Jun 2007
Reputation Points: 85
Solved Threads: 45
 

Hi guys,
i am trying to hook a MyCopyFileW function in OS, that is ideally whenever a copy function is performed, another copy function will override it, with the stuffs i want it to do.

I am not sure if this is the correct copy function.

Any idea how to do it.

max8888
Newbie Poster
2 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You