Bonjour tout le monde,
J'ai téléchargé la bibliothèque detours express 3.0 de Microsoft : http://research.microsoft.com/en-us/projects/detours/
Je l'ai donc installé et je me suis retrouvé avec un dossier : C:\Program Files\Microsoft Research\Detours Express 3.0
J'ai donc copié tout les fichiers de ce dossier dans le répertoire de mon projet sous Code::Block
Et j'ai ensuite voulus compilé mon code source :
Je me retrouve avec les erreurs suivantes :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 #include <cstdio> #include <stdio.h> #include <stdlib.h> #include <windows.h> #include "detours.h" #pragma comment(lib,"ws2_32.lib") int (WINAPI *pSend)(SOCKET s, const char* buf, int len, int flags) = send; int WINAPI MySend(SOCKET s, const char* buf, int len, int flags); int (WINAPI *pRecv)(SOCKET s, char* buf, int len, int flags) = recv; int WINAPI MyRecv(SOCKET s, char* buf, int len, int flags); FILE* pSendLogFile; FILE* pRecvLogFile; int WINAPI MySend(SOCKET s, const char* buf, int len, int flags) { pSendLogFile = fopen("C:\\SendLog.txt", "a+"); fprintf(pSendLogFile, "%s\n", buf); fclose(pSendLogFile); return pSend(s, buf, len, flags); } int WINAPI MyRecv(SOCKET s, char* buf, int len, int flags) { pRecvLogFile = fopen("C:\\RecvLog.txt", "a+"); fprintf(pRecvLogFile, "%s\n", buf); fclose(pRecvLogFile); return pRecv(s, buf, len, flags); } extern "C" __declspec(dllexport) void dummy(void){ return; } BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID reserved) { if (DetourIsHelperProcess()) { return TRUE; } if (dwReason == DLL_PROCESS_ATTACH) { //DetourRestoreAfterWith(); DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourAttach((PVOID*)(&pSend), (PVOID)MySend); DetourTransactionCommit(); DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourAttach((PVOID*)(&pRecv), (PVOID)MyRecv); DetourTransactionCommit(); } else if (dwReason == DLL_PROCESS_DETACH) { DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourAttach((PVOID*)(&pSend), (PVOID)MySend); DetourTransactionCommit(); DetourTransactionBegin(); DetourUpdateThread(GetCurrentThread()); DetourAttach((PVOID*)(&pRecv), (PVOID)MyRecv); DetourTransactionCommit(); } return TRUE; }
Je débute avec cette bibliothèque et je n'ai pas trouvé beaucoup de documentation sur internet.||=== Build: Debug in dllWinsock (compiler: GNU GCC Compiler) ===|
C:\...\dllWinsock\main.cpp|7|warning: ignoring #pragma comment [-Wunknown-pragmas]|
C:\...\dllWinsock\main.cpp|8|warning: ignoring #pragma comment [-Wunknown-pragmas]|
obj\Debug\main.o||In function `Z7DllMainP11HINSTANCE__mPv@12'
C:\...\dllWinsock\main.cpp|40|undefined reference to `DetourIsHelperProcess@0'|
C:\...\dllWinsock\main.cpp|47|undefined reference to `DetourTransactionBegin@0'|
C:\...\dllWinsock\main.cpp|48|undefined reference to `DetourUpdateThread@4'|
C:\...\dllWinsock\main.cpp|49|undefined reference to `DetourAttach@8'|
C:\...\dllWinsock\main.cpp|50|undefined reference to `DetourTransactionCommit@0'|
C:\...\dllWinsock\main.cpp|52|undefined reference to `DetourTransactionBegin@0'|
C:\...\dllWinsock\main.cpp|53|undefined reference to `DetourUpdateThread@4'|
C:\...\dllWinsock\main.cpp|54|undefined reference to `DetourAttach@8'|
C:\...\dllWinsock\main.cpp|55|undefined reference to `DetourTransactionCommit@0'|
C:\...\dllWinsock\main.cpp|58|undefined reference to `DetourTransactionBegin@0'|
C:\...\dllWinsock\main.cpp|59|undefined reference to `DetourUpdateThread@4'|
C:\...\dllWinsock\main.cpp|60|undefined reference to `DetourAttach@8'|
C:\...\dllWinsock\main.cpp|61|undefined reference to `DetourTransactionCommit@0'|
C:\...\dllWinsock\main.cpp|63|undefined reference to `DetourTransactionBegin@0'|
C:\...\dllWinsock\main.cpp|64|undefined reference to `DetourUpdateThread@4'|
C:\...\dllWinsock\main.cpp|65|undefined reference to `DetourAttach@8'|
C:\...\dllWinsock\main.cpp|66|undefined reference to `DetourTransactionCommit@0'|
||=== Build failed: 17 error(s), 2 warning(s) (0 minute(s), 3 second(s)) ===|
EDIT : Je viens de me rendre compte que je me suis trompé de section en voyant développement Windows. Si un modérateur pouvait le déplacer dans la section adapté...
Partager