SF.net SVN: geany:[4779] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sat Mar 20 15:16:21 UTC 2010


Revision: 4779
          http://geany.svn.sourceforge.net/geany/?rev=4779&view=rev
Author:   eht16
Date:     2010-03-20 15:16:21 +0000 (Sat, 20 Mar 2010)

Log Message:
-----------
Make CreateChildProcess() working with Unicode strings, e.g. directory names (closes 2972606).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/win32.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-03-19 17:38:27 UTC (rev 4778)
+++ trunk/ChangeLog	2010-03-20 15:16:21 UTC (rev 4779)
@@ -1,3 +1,9 @@
+2010-03-20  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/win32.c:
+   Make CreateChildProcess() working with Unicode strings, e.g.
+   directory names (closes 2972606).
+
 2010-03-19  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/stash.c:

Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c	2010-03-19 17:38:27 UTC (rev 4778)
+++ trunk/src/win32.c	2010-03-20 15:16:21 UTC (rev 4779)
@@ -1007,9 +1007,11 @@
 static gboolean CreateChildProcess(geany_win32_spawn *gw_spawn, TCHAR *szCmdline, const TCHAR *dir, GError **error)
 {
 	PROCESS_INFORMATION piProcInfo;
-	STARTUPINFO siStartInfo;
+	STARTUPINFOW siStartInfo;
 	BOOL bFuncRetn = FALSE;
 	gchar *expandedCmdline;
+	wchar_t w_commandline[MAX_PATH];
+	wchar_t w_dir[MAX_PATH];
 
 	/* Set up members of the PROCESS_INFORMATION structure. */
 	ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION));
@@ -1026,15 +1028,18 @@
 	/* Expand environment variables like %blah%. */
 	expandedCmdline = win32_expand_environment_variables(szCmdline);
 
+	MultiByteToWideChar(CP_UTF8, 0, expandedCmdline, -1, w_commandline, sizeof(w_commandline));
+	MultiByteToWideChar(CP_UTF8, 0, dir, -1, w_dir, sizeof(w_dir));
+
 	/* Create the child process. */
-	bFuncRetn = CreateProcess(NULL,
-		expandedCmdline,             /* command line */
+	bFuncRetn = CreateProcessW(NULL,
+		w_commandline,             /* command line */
 		NULL,          /* process security attributes */
 		NULL,          /* primary thread security attributes */
 		TRUE,          /* handles are inherited */
 		CREATE_NO_WINDOW,             /* creation flags */
 		NULL,          /* use parent's environment */
-		dir,           /* use parent's current directory */
+		w_dir,           /* use parent's current directory */
 		&siStartInfo,  /* STARTUPINFO pointer */
 		&piProcInfo);  /* receives PROCESS_INFORMATION */
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list