mirror of
https://github.com/reactos/reactos.git
synced 2024-10-30 19:41:57 +00:00
456be5d16b
svn path=/trunk/; revision=15091
56 lines
893 B
C
56 lines
893 B
C
/* $Id$
|
|
*
|
|
* Entry point for programs that use wmain()
|
|
*/
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
|
|
#include <windef.h>
|
|
#include <winbase.h>
|
|
|
|
int wmain(int argc,wchar_t *argv[]);
|
|
|
|
wchar_t *
|
|
a2w( char * a, wchar_t * w )
|
|
{
|
|
wchar_t * ww = w;
|
|
while (*a) *w++ = (wchar_t) *a++;
|
|
*w = 0;
|
|
return ww;
|
|
}
|
|
|
|
wchar_t *
|
|
fgetws(wchar_t *buf, int bufsize, FILE *file)
|
|
{
|
|
char * abuf = GlobalAlloc(bufsize,0);
|
|
if (!buf)return NULL;
|
|
fgets(abuf,bufsize,file);
|
|
a2w(abuf,buf);
|
|
GlobalFree(abuf);
|
|
return buf;
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
wchar_t ** wargv;
|
|
int i;
|
|
int ec;
|
|
|
|
wargv = (wchar_t **) GlobalAlloc(
|
|
sizeof(void*) * argc,
|
|
0
|
|
);
|
|
for(i=0;i<argc;++i)
|
|
{
|
|
wargv[i] = (wchar_t*) GlobalAlloc(
|
|
sizeof(wchar_t) * (1+lstrlenA(argv[i])),
|
|
0
|
|
);
|
|
a2w(argv[i],wargv[i]);
|
|
}
|
|
wargv[i] = NULL;
|
|
ec = wmain(argc,wargv);
|
|
for (i=0;wargv[i];++i) GlobalFree(wargv[i]);
|
|
return ec;
|
|
}
|