winemenubuilder: Use a unicode WinMain.

This commit is contained in:
Damjan Jovanovic 2010-05-04 21:38:21 +02:00 committed by Alexandre Julliard
parent 8de7d2ed4c
commit bc526034e0
2 changed files with 21 additions and 18 deletions

View File

@ -4,7 +4,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = winemenubuilder.exe MODULE = winemenubuilder.exe
APPMODE = -mwindows APPMODE = -mwindows -municode
IMPORTS = uuid shell32 shlwapi ole32 user32 advapi32 kernel32 IMPORTS = uuid shell32 shlwapi ole32 user32 advapi32 kernel32
EXTRAINCL = @PNGINCL@ EXTRAINCL = @PNGINCL@

View File

@ -2729,9 +2729,9 @@ static void cleanup_menus(void)
WINE_ERR("error opening registry key, menu cleanup failed\n"); WINE_ERR("error opening registry key, menu cleanup failed\n");
} }
static CHAR *next_token( LPSTR *p ) static WCHAR *next_token( LPWSTR *p )
{ {
LPSTR token = NULL, t = *p; LPWSTR token = NULL, t = *p;
if( !t ) if( !t )
return NULL; return NULL;
@ -2746,7 +2746,7 @@ static CHAR *next_token( LPSTR *p )
case '"': case '"':
/* unquote the token */ /* unquote the token */
token = ++t; token = ++t;
t = strchr( token, '"' ); t = strchrW( token, '"' );
if( t ) if( t )
*t++ = 0; *t++ = 0;
break; break;
@ -2755,7 +2755,7 @@ static CHAR *next_token( LPSTR *p )
break; break;
default: default:
token = t; token = t;
t = strchr( token, ' ' ); t = strchrW( token, ' ' );
if( t ) if( t )
*t++ = 0; *t++ = 0;
break; break;
@ -2808,11 +2808,16 @@ static BOOL init_xdg(void)
/*********************************************************************** /***********************************************************************
* *
* WinMain * wWinMain
*/ */
int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show) int PASCAL wWinMain (HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int show)
{ {
LPSTR token = NULL, p; static const WCHAR dash_aW[] = {'-','a',0};
static const WCHAR dash_rW[] = {'-','r',0};
static const WCHAR dash_uW[] = {'-','u',0};
static const WCHAR dash_wW[] = {'-','w',0};
LPWSTR token = NULL, p;
BOOL bWait = FALSE; BOOL bWait = FALSE;
BOOL bURL = FALSE; BOOL bURL = FALSE;
int ret = 0; int ret = 0;
@ -2825,37 +2830,35 @@ int PASCAL WinMain (HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show
token = next_token( &p ); token = next_token( &p );
if( !token ) if( !token )
break; break;
if( !lstrcmpA( token, "-a" ) ) if( !strcmpW( token, dash_aW ) )
{ {
RefreshFileTypeAssociations(); RefreshFileTypeAssociations();
continue; continue;
} }
if( !lstrcmpA( token, "-r" ) ) if( !strcmpW( token, dash_rW ) )
{ {
cleanup_menus(); cleanup_menus();
continue; continue;
} }
if( !lstrcmpA( token, "-w" ) ) if( !strcmpW( token, dash_wW ) )
bWait = TRUE; bWait = TRUE;
else if ( !lstrcmpA( token, "-u" ) ) else if ( !strcmpW( token, dash_uW ) )
bURL = TRUE; bURL = TRUE;
else if( token[0] == '-' ) else if( token[0] == '-' )
{ {
WINE_ERR( "unknown option %s\n",token); WINE_ERR( "unknown option %s\n", wine_dbgstr_w(token) );
} }
else else
{ {
WCHAR link[MAX_PATH];
BOOL bRet; BOOL bRet;
MultiByteToWideChar( CP_ACP, 0, token, -1, link, sizeof(link)/sizeof(WCHAR) );
if (bURL) if (bURL)
bRet = Process_URL( link, bWait ); bRet = Process_URL( token, bWait );
else else
bRet = Process_Link( link, bWait ); bRet = Process_Link( token, bWait );
if (!bRet) if (!bRet)
{ {
WINE_ERR( "failed to build menu item for %s\n",token); WINE_ERR( "failed to build menu item for %s\n", wine_dbgstr_w(token) );
ret = 1; ret = 1;
} }
} }