summaryrefslogtreecommitdiff
path: root/src/unexw32.c
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2013-12-06 17:55:08 +0200
committerEli Zaretskii <eliz@gnu.org>2013-12-06 17:55:08 +0200
commit17788cb3da557d2d5c2dda8f7dedb80999a48242 (patch)
tree4f461dd94bb0a1e9ae12905ee76fda853f2e8bbe /src/unexw32.c
parent0cd7a14e577cae9c0713d1cfa549cfca3f0ca06c (diff)
Converted spawnve, but not tested the result yet.
Diffstat (limited to 'src/unexw32.c')
-rw-r--r--src/unexw32.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/unexw32.c b/src/unexw32.c
index 5320ec1e37..3dfce22d75 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -120,6 +120,8 @@ _start (void)
/* File handling. */
+/* Implementation note: this and the next functions work with ANSI
+ codepage encoded file names! */
int
open_input_file (file_data *p_file, char *filename)
{
@@ -128,8 +130,8 @@ open_input_file (file_data *p_file, char *filename)
void *file_base;
unsigned long size, upper_size;
- file = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ file = CreateFileA (filename, GENERIC_READ, FILE_SHARE_READ, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (file == INVALID_HANDLE_VALUE)
return FALSE;
@@ -166,9 +168,9 @@ open_output_file (file_data *p_file, char *filename, unsigned long size)
creating it, all the emacs-XX.YY.ZZ.nn.exe end up being hard
links to the same file, which defeats the purpose of these hard
links: being able to run previous builds. */
- DeleteFile (filename);
- file = CreateFile (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
- CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
+ DeleteFileA (filename);
+ file = CreateFileA (filename, GENERIC_READ | GENERIC_WRITE, 0, NULL,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
if (file == INVALID_HANDLE_VALUE)
return FALSE;
@@ -722,7 +724,7 @@ void
unexec (const char *new_name, const char *old_name)
{
file_data in_file, out_file;
- char out_filename[MAX_PATH], in_filename[MAX_PATH];
+ char out_filename[MAX_PATH], in_filename[MAX_PATH], new_name_a[MAX_PATH];
unsigned long size;
char *p;
char *q;
@@ -738,13 +740,14 @@ unexec (const char *new_name, const char *old_name)
*p = '/';
strcpy (out_filename, in_filename);
+ filename_to_ansi (new_name, new_name_a);
/* Change the base of the output filename to match the requested name. */
if ((p = strrchr (out_filename, '/')) == NULL)
abort ();
/* The filenames have already been expanded, and will be in Unix
format, so it is safe to expect an absolute name. */
- if ((q = strrchr (new_name, '/')) == NULL)
+ if ((q = strrchr (new_name_a, '/')) == NULL)
abort ();
strcpy (p, q);