xref: /reactos/dll/opengl/opengl32/dllmain.c (revision 4067eb14)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * COPYRIGHT:            See COPYING in the top level directory
3*c2c66affSColin Finck  * PROJECT:              ReactOS
4*c2c66affSColin Finck  * FILE:                 dll/opengl/opengl32/dllmain.c
5*c2c66affSColin Finck  * PURPOSE:              OpenGL32 DLL
6*c2c66affSColin Finck  */
7*c2c66affSColin Finck 
8*c2c66affSColin Finck #include "opengl32.h"
9*c2c66affSColin Finck 
10*c2c66affSColin Finck BOOL WINAPI
DllMain(HINSTANCE hInstance,DWORD Reason,LPVOID Reserved)11*c2c66affSColin Finck DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
12*c2c66affSColin Finck {
13*c2c66affSColin Finck     switch ( Reason )
14*c2c66affSColin Finck     {
15*c2c66affSColin Finck         case DLL_PROCESS_ATTACH:
16*c2c66affSColin Finck             /* Initialize Context list */
17*c2c66affSColin Finck             InitializeListHead(&ContextListHead);
18*c2c66affSColin Finck             /* no break */
19*c2c66affSColin Finck         case DLL_THREAD_ATTACH:
20*c2c66affSColin Finck             break;
21*c2c66affSColin Finck 
22*c2c66affSColin Finck         case DLL_THREAD_DETACH:
23*c2c66affSColin Finck             /* Set NULL context for this thread */
24*c2c66affSColin Finck             wglMakeCurrent(NULL, NULL);
25*c2c66affSColin Finck         break;
26*c2c66affSColin Finck         case DLL_PROCESS_DETACH:
27*c2c66affSColin Finck             /* Clean up */
28*c2c66affSColin Finck             if (!Reserved)
29*c2c66affSColin Finck             {
30*c2c66affSColin Finck                 /* The process is not shutting down: release everything */
31*c2c66affSColin Finck                 wglMakeCurrent(NULL, NULL);
32*c2c66affSColin Finck                 IntDeleteAllContexts();
33*c2c66affSColin Finck                 IntDeleteAllICDs();
34*c2c66affSColin Finck             }
35*c2c66affSColin Finck             break;
36*c2c66affSColin Finck     }
37*c2c66affSColin Finck 
38*c2c66affSColin Finck     return TRUE;
39*c2c66affSColin Finck }
40