summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorSimon Howard2010-01-27 19:50:30 +0000
committerSimon Howard2010-01-27 19:50:30 +0000
commit0b8bf3cfe37a3d6e8ad01c0f6726430f53c0ad7e (patch)
tree483f983aacbd9907290cf61f0e3b3afb1b03f7e9 /setup
parent3cf74a97261b1a0aceb591b495b0857781918edd (diff)
parenta9e2d244a5a37fed344405e40698de2a2969c12a (diff)
downloadchocolate-doom-0b8bf3cfe37a3d6e8ad01c0f6726430f53c0ad7e.tar.gz
chocolate-doom-0b8bf3cfe37a3d6e8ad01c0f6726430f53c0ad7e.tar.bz2
chocolate-doom-0b8bf3cfe37a3d6e8ad01c0f6726430f53c0ad7e.zip
Merge from trunk.
Subversion-branch: /branches/opl-branch Subversion-revision: 1829
Diffstat (limited to 'setup')
-rw-r--r--setup/.gitignore2
-rw-r--r--setup/Makefile.am2
-rw-r--r--setup/execute.c35
-rw-r--r--setup/setup-manifest.xml25
-rw-r--r--setup/setup-res.rc.in2
5 files changed, 47 insertions, 19 deletions
diff --git a/setup/.gitignore b/setup/.gitignore
index e2da8a59..37c8e4c1 100644
--- a/setup/.gitignore
+++ b/setup/.gitignore
@@ -4,3 +4,5 @@ Makefile
chocolate-setup
*.rc
*.exe
+tags
+TAGS
diff --git a/setup/Makefile.am b/setup/Makefile.am
index 92b4e394..91c7449a 100644
--- a/setup/Makefile.am
+++ b/setup/Makefile.am
@@ -44,7 +44,7 @@ chocolate_setup_LDADD = \
if HAVE_PYTHON
-setup_icon.c : ../data/setup.ico
+setup_icon.c : ../data/setup8.ico
../data/convert-icon $^ $@
endif
diff --git a/setup/execute.c b/setup/execute.c
index fb9885fa..8e753f60 100644
--- a/setup/execute.c
+++ b/setup/execute.c
@@ -185,29 +185,38 @@ static void ConcatWCString(wchar_t *buf, const char *value)
static wchar_t *BuildCommandLine(const char *program, const char *arg)
{
+ wchar_t exe_path[MAX_PATH];
wchar_t *result;
- char *sep;
+ wchar_t *sep;
+
+ // Get the path to this .exe file.
+
+ GetModuleFileNameW(NULL, exe_path, MAX_PATH);
- result = calloc(strlen(myargv[0]) + strlen(program) + strlen(arg) + 6,
+ // Allocate buffer to contain result string.
+
+ result = calloc(wcslen(exe_path) + strlen(program) + strlen(arg) + 6,
sizeof(wchar_t));
wcscpy(result, L"\"");
- sep = strrchr(myargv[0], DIR_SEPARATOR);
+ // Copy the path part of the filename (including ending \)
+ // into the result buffer:
+
+ sep = wcsrchr(exe_path, DIR_SEPARATOR);
if (sep != NULL)
{
- ConcatWCString(result, myargv[0]);
-
- // Cut off the string after the last directory separator,
- // before appending the actual program.
-
- result[sep - myargv[0] + 2] = '\0';
-
+ wcsncpy(result + 1, exe_path, sep - exe_path + 1);
+ result[sep - exe_path + 2] = '\0';
}
+ // Concatenate the name of the program:
+
ConcatWCString(result, program);
+ // End of program name, start of argument:
+
wcscat(result, L"\" \"");
ConcatWCString(result, arg);
@@ -301,9 +310,9 @@ static int ExecuteCommand(const char *program, const char *arg)
argv[1] = arg;
argv[2] = NULL;
- execv(argv[0], (char **) argv);
+ execvp(argv[0], (char **) argv);
- exit(-1);
+ exit(0x80);
}
else
{
@@ -312,7 +321,7 @@ static int ExecuteCommand(const char *program, const char *arg)
waitpid(childpid, &result, 0);
- if (WIFEXITED(result))
+ if (WIFEXITED(result) && WEXITSTATUS(result) != 0x80)
{
return WEXITSTATUS(result);
}
diff --git a/setup/setup-manifest.xml b/setup/setup-manifest.xml
index 409a142b..c2788306 100644
--- a/setup/setup-manifest.xml
+++ b/setup/setup-manifest.xml
@@ -1,16 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!-- Magic manifest file that should make Windows Vista/7 not
+ attempt to gain elevated privileges for chocolate-setup.
+
+ Based on:
+
+ http://www.cygwin.com/ml/cygwin/2006-12/msg00580.html
+ -->
+
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<!-- The "name" field in this tag should be the same as the executable's
name -->
- <assemblyIdentity version="1.2.1.0" processorArchitecture="*"
- name="chocolate-setup" type="win32"/>
+ <assemblyIdentity version="0.0.0.0" processorArchitecture="X86"
+ name="chocolate-setup.exe" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
- <!-- Hi Vista! We don't require elevated privileges. Thanks! -->
- <requestedExecutionLevel level="asInvoker"/>
+ <requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
+
+ <!-- Stop the Program Compatibility Assistant appearing: -->
+
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> <!-- 7 -->
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> <!-- Vista -->
+ </application>
+ </compatibility>
</assembly>
diff --git a/setup/setup-res.rc.in b/setup/setup-res.rc.in
index dc25135a..2bc3106c 100644
--- a/setup/setup-res.rc.in
+++ b/setup/setup-res.rc.in
@@ -1,6 +1,6 @@
1 ICON "../data/setup.ico"
-CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "setup-manifest.xml"
+1 24 MOVEABLE PURE "setup-manifest.xml"
1 VERSIONINFO
PRODUCTVERSION @WINDOWS_RC_VERSION@