mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:03:03 +01:00
Reduced dependencies upon window messages + cleanup.
This commit is contained in:
parent
8b504327ab
commit
878ef6a583
@ -87,7 +87,6 @@ LRESULT CALLBACK GeneralPage(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
HINSTANCE hInstance_gbl;
|
||||
HWND hPSDlg, hWndGbl;
|
||||
static DWORD ServerPid = 0;
|
||||
static int nRestarts = 0; /* the number of times the server was restarted */
|
||||
bool service_flag = true;
|
||||
/* unsigned short shutdown_flag = FALSE; */
|
||||
@ -115,7 +114,6 @@ int WINAPI WinMain(
|
||||
*
|
||||
**************************************/
|
||||
|
||||
|
||||
OSVERSIONINFO OsVersionInfo;
|
||||
|
||||
/* need to set the sizeof this structure for NT to work */
|
||||
@ -184,10 +182,9 @@ static bool parse_args(LPCSTR lpszArgs, bool* pserver_flag)
|
||||
bool return_value = true;
|
||||
|
||||
for (const char* p = lpszArgs; *p; p++) {
|
||||
if (*p++ == '-')
|
||||
if (*p++ == '-') {
|
||||
while (c = *p++) {
|
||||
switch (c) {
|
||||
case 'a':
|
||||
switch (UPPER(c)) {
|
||||
case 'A':
|
||||
return_value = false;
|
||||
break;
|
||||
@ -197,6 +194,7 @@ static bool parse_args(LPCSTR lpszArgs, bool* pserver_flag)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
@ -394,10 +392,6 @@ static LRESULT CALLBACK WindowFunc(
|
||||
PostMessage(hTmpWnd, WM_COMMAND, (WPARAM) IDM_PROPERTIES, 0);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case IDM_SET_SERVER_PID:
|
||||
ServerPid = (DWORD) lParam;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -587,7 +581,7 @@ THREAD_ENTRY_DECLARE start_and_watch_server(THREAD_ENTRY_PARAM)
|
||||
success = StartService(hService, 0, NULL);
|
||||
if (success != TRUE)
|
||||
error = GetLastError();
|
||||
/* if the server is alrady running, then inform it that it should
|
||||
/* if the server is already running, then inform it that it should
|
||||
* open the guardian mutex so that it may be governed. */
|
||||
if ((!error) || (error == ERROR_SERVICE_ALREADY_RUNNING)) {
|
||||
/* Make sure that it is actually ready to receive commands.
|
||||
@ -622,17 +616,18 @@ THREAD_ENTRY_DECLARE start_and_watch_server(THREAD_ENTRY_PARAM)
|
||||
CloseHandle(pi.hThread);
|
||||
}
|
||||
else {
|
||||
SendMessage(hTmpWnd, WM_COMMAND, (WPARAM) IDM_GUARDED,
|
||||
(LPARAM) hWndGbl);
|
||||
if (
|
||||
(procHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE,
|
||||
ServerPid)) == NULL)
|
||||
{
|
||||
SendMessage(hTmpWnd, WM_COMMAND, (WPARAM) IDM_GUARDED, 0);
|
||||
DWORD server_pid;
|
||||
GetWindowThreadProcessId(hTmpWnd, &server_pid);
|
||||
procHandle = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION,
|
||||
FALSE, server_pid);
|
||||
if (procHandle == NULL) {
|
||||
error = GetLastError();
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
else {
|
||||
success = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ iscguard.rh
|
||||
#define IDM_INTRSVRPROPERTIES 12
|
||||
#define IDM_SVRPROPERTIES 13
|
||||
#define IDM_GUARDED 14
|
||||
#define IDM_SET_SERVER_PID 15
|
||||
|
||||
/* Defines for String Table */
|
||||
#define IDS_QUIT 201
|
||||
|
@ -289,9 +289,6 @@ LRESULT CALLBACK WindowFunc(HWND hWnd,
|
||||
nid.uFlags = 0;
|
||||
Shell_NotifyIcon(NIM_DELETE, &nid);
|
||||
}
|
||||
SendMessage((HWND) lParam, WM_COMMAND,
|
||||
(WPARAM) IDM_SET_SERVER_PID,
|
||||
(LPARAM) GetCurrentProcessId());
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
@ -37,7 +37,6 @@ produced by Borland Resource Workshop
|
||||
#define IDM_PROPERTIES 10
|
||||
#define IDM_STARTUPCFG 11
|
||||
#define IDM_GUARDED 14
|
||||
#define IDM_SET_SERVER_PID 15
|
||||
|
||||
/* Defines for String Table */
|
||||
#define IDS_PNP1 200
|
||||
|
Loading…
Reference in New Issue
Block a user