X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Fmain.cpp;h=fa28c1ffed271c2c6c03736d0bafcb71ad13841d;hb=7f847aeb48e0e8f58ead52ba255cff27527628eb;hp=5cf18c3a81222412d8bf61ae8ed724e7b2ff4062;hpb=516755dde30a4820495580d1b52a5b992f800461;p=libs%2Fcore.git diff --git a/source/core/main.cpp b/source/core/main.cpp index 5cf18c3..fa28c1f 100644 --- a/source/core/main.cpp +++ b/source/core/main.cpp @@ -1,23 +1,45 @@ -/* $Id$ - -This file is part of libmspcore -Copyright © 2006 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ #ifdef WIN32 #include +#include +#include #endif - #include "application.h" #ifdef WIN32 +using namespace std; +using namespace Msp; + int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/) { int argc = 0; - LPWSTR *argv=CommandLineToArgvW(GetCommandLineW(), &argc); - return Msp::Application::run(argc, (char **)argv, hInstance); + LPWSTR *argv_w = CommandLineToArgvW(GetCommandLineW(), &argc); + + unsigned max_size = 0; + for(int i=0; i(argv_buf); + char *argv_ptr = argv_buf+(argc+1)*sizeof(char *); + for(int i=0; i(argv_w[i]), wcslen(argv_w[i])*2); + arg = StringCodec::transcode(arg); + copy(arg.begin(), arg.end(), argv_ptr); + argv_ptr += arg.size(); + *argv_ptr++ = 0; + } + + LocalFree(argv_w); + int exit_code = Msp::Application::run(argc, argv, hInstance); + delete[] argv_buf; + return exit_code; } -#endif +#else int main(int argc, char **argv) -{ return Msp::Application::run(argc, argv); } +{ + return Msp::Application::run(argc, argv); +} +#endif