| // dllmain.cpp : Defines the entry point for the DLL application. |
| #include "windows.h" |
| #include "opencl.h" |
| #include "debug.h" |
| #include <WinUser.h> |
| |
| #if defined(_WIN32) |
| #define IDD_DIALOG1 101 |
| |
| static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| { |
| RECT rect; |
| |
| switch(uMsg) |
| { |
| case WM_INITDIALOG: |
| GetWindowRect(GetDesktopWindow(), &rect); |
| SetWindowPos(hwnd, HWND_TOP, rect.right / 2, rect.bottom / 2, 0, 0, SWP_NOSIZE); |
| SetTimer(hwnd, 1, 100, NULL); |
| return TRUE; |
| case WM_COMMAND: |
| if(LOWORD(wParam) == IDCANCEL) |
| { |
| EndDialog(hwnd, 0); |
| } |
| break; |
| case WM_TIMER: |
| if(IsDebuggerPresent()) |
| { |
| EndDialog(hwnd, 0); |
| } |
| } |
| |
| return FALSE; |
| } |
| |
| static void WaitForDebugger(HINSTANCE instance) |
| { |
| if(!IsDebuggerPresent()) |
| { |
| HRSRC dialog = FindResource(instance, MAKEINTRESOURCE(IDD_DIALOG1), RT_DIALOG); |
| DLGTEMPLATE *dialogTemplate = (DLGTEMPLATE*)LoadResource(instance, dialog); |
| DialogBoxIndirect(instance, dialogTemplate, NULL, DebuggerWaitDialogProc); |
| } |
| } |
| |
| BOOL APIENTRY DllMain(HINSTANCE instance, DWORD ul_reason_for_call, LPVOID lpReserved) |
| { |
| UNIMPLEMENTED(); |
| switch (ul_reason_for_call) |
| { |
| case DLL_PROCESS_ATTACH: |
| WaitForDebugger(instance); |
| case DLL_THREAD_ATTACH: |
| case DLL_THREAD_DETACH: |
| case DLL_PROCESS_DETACH: |
| break; |
| } |
| return TRUE; |
| } |
| #endif |
| |