- build as unicode

- use a _tmain hack w3seek put together

svn path=/trunk/; revision=19165
This commit is contained in:
Ged Murphy 2005-11-12 00:26:21 +00:00
parent a9c4dac3c8
commit 6e0eccd2f3
2 changed files with 45 additions and 1 deletions

View file

@ -137,10 +137,13 @@ INT ScControl(LPTSTR MachineName, // remote machine name
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 @@ int _tmain(int argc, LPCTSTR argv[])
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

View file

@ -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>