I use the CopyFile() in DLL.
But CopyFile() return FALSE. Error Cdoe is 5(Access is denied).
I can't understand this error.
Attach the Code.
My OS is Windows 8.1.
Thanks.
+ Call 'GetOpenFileNameWCallback' fuction when if you attach the file in mail service.
Code: Select all
BOOL (WINAPI *GetOpenFileNameWNext)(
_Inout_ LPOPENFILENAME lpofn
);
BOOL WINAPI GetOpenFileNameWCallback(
_Inout_ LPOPENFILENAME lpofn
)
{
CopyFile(L"c:\\test\\a.txt", L"c:\\test\\c.txt", TRUE); /// Fail!! Error Code is 5. why?
return GetOpenFileNameWNext(lpofn);
}
void HookStart()
{
InitializeMadCHook();
CopyFile(L"c:\\test\\a.txt", L"c:\\test\\b.txt", TRUE); /// Success!
HookAPI("Comdlg32.dll", "GetOpenFileNameW", GetOpenFileNameWCallback, (PVOID*)&GetOpenFileNameWNext);
}
void HookEnd()
{
FinalizeMadCHook();
}