- build as unicode
- use a _tmain hack w3seek put together
Modified: trunk/reactos/subsys/system/sc/sc.c
Modified: trunk/reactos/subsys/system/sc/sc.xml
_____
Modified: trunk/reactos/subsys/system/sc/sc.c
--- trunk/reactos/subsys/system/sc/sc.c 2005-11-12 00:24:16 UTC (rev
19164)
+++ trunk/reactos/subsys/system/sc/sc.c 2005-11-12 00:26:21 UTC (rev
19165)
@@ -137,10 +137,13 @@
return 0;
}
+#if defined(_UNICODE) && defined(__GNUC__)
+static
+#endif
int _tmain(int argc, LPCTSTR argv[])
{
- LPTSTR MachineName = NULL; // remote machine
+ LPTSTR MachineName = NULL; // remote machine
LPCTSTR Command = NULL; // sc command
LPCTSTR ServiceName = NULL; // Name of service
@@ -169,3 +172,42 @@
return MainUsage();
}
+
+
+#if defined(_UNICODE) && defined(__GNUC__)
+/* HACK - MINGW HAS NO OFFICIAL SUPPORT FOR wmain()!!! */
+int main( int argc, char **argv )
+{
+ WCHAR **argvW;
+ int i, j, Ret = 1;
+
+ if ((argvW = malloc(argc * sizeof(WCHAR*))))
+ {
+ /* convert the arguments */
+ for (i = 0, j = 0; i < argc; i++)
+ {
+ if (!(argvW[i] = malloc((strlen(argv[i]) + 1) *
sizeof(WCHAR))))
+ {
+ j++;
+ }
+ swprintf(argvW[i], L"%hs", argv[i]);
+ }
+
+ if (j == 0)
+ {
+ /* no error converting the parameters, call wmain() */
+ Ret = wmain(argc, (LPCTSTR *)argvW);
+ }
+
+ /* free the arguments */
+ for (i = 0; i < argc; i++)
+ {
+ if (argvW[i])
+ free(argvW[i]);
+ }
+ free(argvW);
+ }
+
+ return Ret;
+}
+#endif
_____
Modified: trunk/reactos/subsys/system/sc/sc.xml
--- trunk/reactos/subsys/system/sc/sc.xml 2005-11-12 00:24:16 UTC
(rev 19164)
+++ trunk/reactos/subsys/system/sc/sc.xml 2005-11-12 00:26:21 UTC
(rev 19165)
@@ -1,6 +1,8 @@
<module name="sc" type="win32cui"
installbase="system32"
installname="sc.exe">
<define name="__USE_W32API" />
<define name="DEFINE_GUID" />
+ <define name="UNICODE" />
+ <define name="_UNICODE" />
<library>kernel32</library>
<file>sc.c</file>
<file>start.c</file>
Show replies by date