summaryrefslogtreecommitdiff
path: root/src/lib/evil/evil_main.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2017-12-11 15:06:02 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-11 16:04:02 +0900
commit771bb6e6a79113fe86b9bd641d1418a78aee81ae (patch)
treef1dccef88a7d64f06191a779f9e5080497bfcb57 /src/lib/evil/evil_main.c
parent196b6f1ba48bf06a11c0017e43550583a05d00f5 (diff)
Evil: use static buffer to store error messages
Reviewers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5394
Diffstat (limited to 'src/lib/evil/evil_main.c')
-rw-r--r--src/lib/evil/evil_main.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/evil/evil_main.c b/src/lib/evil/evil_main.c
index 8ddd85f..875d6c5 100644
--- a/src/lib/evil/evil_main.c
+++ b/src/lib/evil/evil_main.c
@@ -22,6 +22,8 @@ extern LONGLONG _evil_time_freq;
22extern LONGLONG _evil_time_count; 22extern LONGLONG _evil_time_count;
23extern long _evil_time_second; 23extern long _evil_time_second;
24 24
25extern DWORD _evil_tls_index;
26
25long _evil_systemtime_to_time(SYSTEMTIME st); 27long _evil_systemtime_to_time(SYSTEMTIME st);
26 28
27int 29int
@@ -96,3 +98,41 @@ evil_shutdown(void)
96 98
97 return _evil_init_count; 99 return _evil_init_count;
98} 100}
101
102BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved)
103{
104 LPVOID data;
105
106 switch (reason)
107 {
108 case DLL_PROCESS_ATTACH:
109 _evil_tls_index = TlsAlloc();
110 if (_evil_tls_index == TLS_OUT_OF_INDEXES)
111 return FALSE;
112 case DLL_THREAD_ATTACH:
113 data = (LPVOID)LocalAlloc(LPTR, 4096);
114 if (!data)
115 return FALSE;
116 if (!TlsSetValue(_evil_tls_index, data))
117 return FALSE;
118 break;
119 case DLL_THREAD_DETACH:
120 data = TlsGetValue(_evil_tls_index);
121 if (data)
122 LocalFree((HLOCAL)data);
123 break;
124 case DLL_PROCESS_DETACH:
125 data = TlsGetValue(_evil_tls_index);
126 if (data)
127 LocalFree((HLOCAL)data);
128 TlsFree(_evil_tls_index);
129 break;
130 default:
131 break;
132 }
133
134 return TRUE;
135
136 (void)inst;
137 (void)reserved;
138}