annotate nt/runemacs.c @ 69574:e963763ec80a

(cua--highlight-rectangle): Set overlay cursor property value to 2 (to align with C level change).
author Kim F. Storm <storm@cua.dk>
date Sun, 19 Mar 2006 19:59:33 +0000
parents 45fbf2b25e1a
children 964e568f1d1d a802c5505156
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
68648
067115a6e738 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64890
diff changeset
1 /* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
2
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
3 This file is part of GNU Emacs.
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
4
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
5 GNU Emacs is free software; you can redistribute it and/or modify
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
6 it under the terms of the GNU General Public License as published by
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
8 any later version.
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
9
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
10 GNU Emacs is distributed in the hope that it will be useful,
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
13 GNU General Public License for more details.
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
14
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
15 You should have received a copy of the GNU General Public License
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
16 along with GNU Emacs; see the file COPYING. If not, write to
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
18 Boston, MA 02110-1301, USA. */
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
19
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 54773
diff changeset
20
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 /*
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22 Simple program to start Emacs with its console window hidden.
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 This program is provided purely for convenience, since most users will
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 use Emacs in windowing (GUI) mode, and will not want to have an extra
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 console window lying around. */
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
28 /*
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
29 You may want to define this if you want to be able to install updated
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
30 emacs binaries even when other users are using the current version.
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
31 The problem with some file servers (notably Novell) is that an open
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
32 file cannot be overwritten, deleted, or even renamed. So if someone
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
33 is running emacs.exe already, you cannot install a newer version.
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
34 By defining CHOOSE_NEWEST_EXE, you can name your new emacs.exe
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
35 something else which matches "emacs*.exe", and runemacs will
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
36 automatically select the newest emacs executeable in the bin directory.
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
37 (So you'll probably be able to delete the old version some hours/days
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
38 later).
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
39 */
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
40
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
41 /* #define CHOOSE_NEWEST_EXE */
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
42
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 #include <windows.h>
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 #include <string.h>
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 #include <malloc.h>
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 int WINAPI
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 {
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 STARTUPINFO start;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 SECURITY_ATTRIBUTES sec_attrs;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52 SECURITY_DESCRIPTOR sec_desc;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 PROCESS_INFORMATION child;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54 int wait_for_child = FALSE;
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
55 DWORD priority_class = NORMAL_PRIORITY_CLASS;
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56 DWORD ret_code = 0;
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
57 char *new_cmdline;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
58 char *p;
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 char modname[MAX_PATH];
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61 if (!GetModuleFileName (NULL, modname, MAX_PATH))
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
62 goto error;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 if ((p = strrchr (modname, '\\')) == NULL)
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64 goto error;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
65 *p = 0;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
66
38139
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
67 new_cmdline = alloca (MAX_PATH + strlen (cmdline) + 3);
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
68 /* Quote executable name in case of spaces in the path. */
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
69 *new_cmdline = '"';
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
70 strcpy (new_cmdline + 1, modname);
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
71
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
72 #ifdef CHOOSE_NEWEST_EXE
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
73 {
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
74 /* Silly hack to allow new versions to be installed on
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
75 server even when current version is in use. */
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
77 char * best_name = alloca (MAX_PATH + 1);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
78 FILETIME best_time = {0,0};
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
79 WIN32_FIND_DATA wfd;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
80 HANDLE fh;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
81 p = new_cmdline + strlen (new_cmdline);
38139
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
82 strcpy (p, "\\emacs*.exe\" ");
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
83 fh = FindFirstFile (new_cmdline, &wfd);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
84 if (fh == INVALID_HANDLE_VALUE)
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
85 goto error;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
86 do
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
87 {
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
88 if (wfd.ftLastWriteTime.dwHighDateTime > best_time.dwHighDateTime
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
89 || (wfd.ftLastWriteTime.dwHighDateTime == best_time.dwHighDateTime
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
90 && wfd.ftLastWriteTime.dwLowDateTime > best_time.dwLowDateTime))
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
91 {
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
92 best_time = wfd.ftLastWriteTime;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
93 strcpy (best_name, wfd.cFileName);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
94 }
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
95 }
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
96 while (FindNextFile (fh, &wfd));
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
97 FindClose (fh);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
98 *p++ = '\\';
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
99 strcpy (p, best_name);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
100 strcat (p, " ");
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
101 }
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
102 #else
38139
b2e0c0638bf2 (WinMain): Add quotes around executable name.
Jason Rumney <jasonr@gnu.org>
parents: 31089
diff changeset
103 strcat (new_cmdline, "\\emacs.exe\" ");
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
104 #endif
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
105
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
106 /* Append original arguments if any; first look for arguments we
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
107 recognise (-wait, -high, and -low), and apply them ourselves. */
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
108 while (cmdline[0] == '-' || cmdline[0] == '/')
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
109 {
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
110 if (strncmp (cmdline+1, "wait", 4) == 0)
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
111 {
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
112 wait_for_child = TRUE;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
113 cmdline += 5;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
114 }
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
115 else if (strncmp (cmdline+1, "high", 4) == 0)
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
116 {
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
117 priority_class = HIGH_PRIORITY_CLASS;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
118 cmdline += 5;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
119 }
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
120 else if (strncmp (cmdline+1, "low", 3) == 0)
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
121 {
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
122 priority_class = IDLE_PRIORITY_CLASS;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
123 cmdline += 4;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
124 }
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
125 else
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
126 break;
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
127 }
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 strcat (new_cmdline, cmdline);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
130 /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131 if ((p = strrchr (modname, '\\')) && stricmp (p, "\\bin") == 0)
15320
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
132 {
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
133 *p = 0;
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
134 for (p = modname; *p; p++)
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
135 if (*p == '\\') *p = '/';
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
136 SetEnvironmentVariable ("emacs_dir", modname);
b76f57d4320b (CHOOSE_NEWEST_EXE): New parameter macro.
Richard M. Stallman <rms@gnu.org>
parents: 15139
diff changeset
137 }
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139 memset (&start, 0, sizeof (start));
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140 start.cb = sizeof (start);
69378
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
141 start.dwFlags = STARTF_USESHOWWINDOW | STARTF_USECOUNTCHARS;
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142 start.wShowWindow = SW_HIDE;
69378
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
143 /* Ensure that we don't waste memory if the user has specified a huge
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
144 default screen buffer for command windows. */
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
145 start.dwXCountChars = 80;
45fbf2b25e1a (WinMain): Set screen buffer to 80x25.
Jason Rumney <jasonr@gnu.org>
parents: 68648
diff changeset
146 start.dwYCountChars = 25;
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148 sec_attrs.nLength = sizeof (sec_attrs);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 sec_attrs.lpSecurityDescriptor = NULL;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 sec_attrs.bInheritHandle = FALSE;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151
19720
8d429173786f (WinMain): Allow Emacs process to be started with
Geoff Voelker <voelker@cs.washington.edu>
parents: 15848
diff changeset
152 if (CreateProcess (NULL, new_cmdline, &sec_attrs, NULL, TRUE, priority_class,
54773
a4825fc03ab1 (WinMain): Let emacs environment default to parent.
Jason Rumney <jasonr@gnu.org>
parents: 52401
diff changeset
153 NULL, NULL, &start, &child))
15139
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 {
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 if (wait_for_child)
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 {
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 WaitForSingleObject (child.hProcess, INFINITE);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 GetExitCodeProcess (child.hProcess, &ret_code);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 }
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 CloseHandle (child.hThread);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161 CloseHandle (child.hProcess);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162 }
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 else
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 goto error;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 return (int) ret_code;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 error:
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
168 MessageBox (NULL, "Could not start Emacs.", "Error", MB_ICONSTOP);
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 return 1;
4d638e5a9e7d Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 38139
diff changeset
171
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 38139
diff changeset
172 /* arch-tag: 7e02df73-4df7-4aa0-baea-99c6d047a384
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 38139
diff changeset
173 (do not change this comment) */