-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
37 lines (32 loc) · 1 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <windows.h>
#include "detours.h"
#include "Shlobj.h"
typedef
PIDLIST_ABSOLUTE (WINAPI* tSHBrowseForFolderW) (LPBROWSEINFO lpbi);
PIDLIST_ABSOLUTE WINAPI hook_SHBrowseForFolderW(LPBROWSEINFO lpbi);
MologieDetours::Detour<tSHBrowseForFolderW>* detour_SHBrowseForFolderW = NULL;
PIDLIST_ABSOLUTE WINAPI hook_SHBrowseForFolderW(LPBROWSEINFO lpbi) {
lpbi->ulFlags |= BIF_EDITBOX | BIF_STATUSTEXT;
return detour_SHBrowseForFolderW->GetOriginalFunction()( lpbi );
}
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
switch(fdwReason)
{
case DLL_PROCESS_ATTACH:
try
{
detour_SHBrowseForFolderW = new MologieDetours::Detour<tSHBrowseForFolderW>("Shell32.dll", "SHBrowseForFolderW", hook_SHBrowseForFolderW);
}
catch(MologieDetours::DetourException &e)
{
// Something went wrong, too bad
return FALSE;
}
break;
case DLL_PROCESS_DETACH:
delete detour_SHBrowseForFolderW;
break;
}
return TRUE;
}