| 154 | |
| 155 | |
| 156 | LRESULT CALLBACK WindowFunc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| 157 | { |
| 158 | /****************************************************************************** |
| 159 | * |
| 160 | * W i n d o w F u n c |
| 161 | * |
| 162 | ****************************************************************************** |
| 163 | * |
| 164 | * Input: hWnd - Handle to the window |
| 165 | * message - Message ID |
| 166 | * wParam - WPARAM parameter for the message |
| 167 | * lParam - LPARAM parameter for the message |
| 168 | * |
| 169 | * Return: FALSE indicates that the message has not been handled |
| 170 | * TRUE indicates the message has been handled |
| 171 | * |
| 172 | * Description: This is main window procedure for the Firebird server. This |
| 173 | * traps all the Firebird significant messages and processes |
| 174 | * them. |
| 175 | *****************************************************************************/ |
| 176 | static BOOL bInTaskBar = FALSE; |
| 177 | static bool bStartup = false; |
| 178 | |
| 179 | switch (message) |
| 180 | { |
| 181 | case WM_QUERYENDSESSION: |
| 182 | // If we are running as a non-service server, then query the user |
| 183 | // to determine if we should end the session. Otherwise, assume that |
| 184 | // the server is a service and could be servicing remote clients and |
| 185 | // therefore should not be shut down. |
| 186 | |
| 187 | if (usServerFlags & SRVR_non_service) { |
| 188 | return CanEndServer(hWnd); |
| 189 | } |
| 190 | |
| 191 | return TRUE; |
| 192 | |
| 193 | case WM_CLOSE: |
| 194 | // If we are running as a non-service server, then query the user |
| 195 | // to determine if we should end the session. Otherwise, assume that |
| 196 | // the server is a service and could be servicing remote clients and |
| 197 | // therefore should not be shut down. The DestroyWindow() will destroy |
| 198 | // the hidden window created by the server for IPC. This should get |
| 199 | // destroyed when the user session ends. |
| 200 | |
| 201 | if (usServerFlags & SRVR_non_service) |
| 202 | { |
| 203 | if (CanEndServer(hWnd)) |
| 204 | { |
| 205 | if (GetPriorityClass(GetCurrentProcess()) != NORMAL_PRIORITY_CLASS) |
| 206 | { |
| 207 | SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); |
| 208 | } |
| 209 | fb_shutdown(SHUTDOWN_TIMEOUT, fb_shutrsn_app_stopped); |
| 210 | //DestroyWindow(hWnd); |
| 211 | } |
| 212 | } |
| 213 | break; |
nothing calls this directly
no test coverage detected